From 0e895e24f7791fbbfec99fc7b911ba27613cc135 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 11 Apr 2015 22:14:56 +0200 Subject: [PATCH] Code reworks: replaced hardcoded network text with the corresponding constants. --- include/acl_selectors.php | 14 +++++++------- include/conversation.php | 2 +- include/text.php | 2 +- mod/contacts.php | 4 ++-- mod/dfrn_confirm.php | 3 ++- mod/photos.php | 2 +- mod/profperm.php | 12 +++++++----- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 668544b0bc..1e43431612 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -78,19 +78,19 @@ function contact_selector($selname, $selclass, $preselected = false, $options) { if(x($options,'networks')) { switch($options['networks']) { case 'DFRN_ONLY': - $networks = array('dfrn'); + $networks = array(NETWORK_DFRN); break; case 'PRIVATE': if(is_array($a->user) && $a->user['prvnets']) - $networks = array('dfrn','mail','dspr'); + $networks = array(NETWORK_DFRN,NETWORK_MAIL,NETWORK_DIASPORA); else - $networks = array('dfrn','face','mail', 'dspr'); + $networks = array(NETWORK_DFRN,NETWORK_FACEBOOK,NETWORK_MAIL, NETWORK_DIASPORA); break; case 'TWO_WAY': if(is_array($a->user) && $a->user['prvnets']) - $networks = array('dfrn','mail','dspr'); + $networks = array(NETWORK_DFRN,NETWORK_MAIL,NETWORK_DIASPORA); else - $networks = array('dfrn','face','mail','dspr','stat'); + $networks = array(NETWORK_DFRN,NETWORK_FACEBOOK,NETWORK_MAIL,NETWORK_DIASPORA,NETWORK_OSTATUS); break; default: break; @@ -182,10 +182,10 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p } if($privmail) { - $sql_extra .= " AND `network` IN ( 'dfrn', 'dspr' ) "; + $sql_extra .= " AND `network` IN ( NETWORK_DFRN, NETWORK_DIASPORA ) "; } elseif($privatenet) { - $sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) "; + $sql_extra .= " AND `network` IN ( NETWORK_DFRN, NETWORK_MAIL, NETWORK_FACEBOOK, NETWORK_DIASPORA ) "; } $tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : ""); diff --git a/include/conversation.php b/include/conversation.php index 20b54728c9..a6ea4da810 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -908,7 +908,7 @@ function like_puller($a,$item,&$arr,$mode) { if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) { $url = $item['author-link']; - if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { + if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === NETWORK_DFRN) && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle" '; } diff --git a/include/text.php b/include/text.php index 8ce54b3c67..fd5ae0a2b6 100644 --- a/include/text.php +++ b/include/text.php @@ -920,7 +920,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { if($redirect) { $a = get_app(); $redirect_url = $a->get_baseurl() . '/redir/' . $contact['id']; - if(local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === 'dfrn')) { + if(local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === NETWORK_DFRN)) { $redir = true; $url = $redirect_url; $sparkle = ' sparkle'; diff --git a/mod/contacts.php b/mod/contacts.php index 95b1944dc8..4a0d34a467 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -33,7 +33,7 @@ function contacts_init(&$a) { $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $a->data['contact']['name'], '$photo' => $a->data['contact']['photo'], - '$url' => ($a->data['contact']['network'] == 'dfrn') ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] + '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] )); $follow_widget = ''; } @@ -681,7 +681,7 @@ function contacts_content(&$a) { default: break; } - if(($rr['network'] === 'dfrn') && ($rr['rel'])) { + if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) { $url = "redir/{$rr['id']}"; $sparkle = ' class="sparkle" '; } diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index f1ce296d90..1cc258853b 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -340,7 +340,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { `pending` = 0, `duplex` = %d, `hidden` = %d, - `network` = 'dfrn' WHERE `id` = %d + `network` = '%s' WHERE `id` = %d ", dbesc($photos[0]), dbesc($photos[1]), @@ -351,6 +351,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { dbesc(datetime_convert()), intval($duplex), intval($hidden), + dbesc(NETWORK_DFRN), intval($contact_id) ); } diff --git a/mod/photos.php b/mod/photos.php index 003bcd9150..f8bba01b00 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1628,7 +1628,7 @@ function photos_content(&$a) { if(local_user() && ($item['contact-uid'] == local_user()) - && ($item['network'] == 'dfrn') && (! $item['self'] )) { + && ($item['network'] == NETWORK_DFRN) && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; } diff --git a/mod/profperm.php b/mod/profperm.php index 444f7a5eab..077f695bea 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -37,7 +37,8 @@ function profperm_content(&$a) { if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { $r = q("SELECT `id` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `self` = 0 - AND `network` = 'dfrn' AND `id` = %d AND `uid` = %d LIMIT 1", + AND `network` = '%s' AND `id` = %d AND `uid` = %d LIMIT 1", + dbesc(NETWORK_DFRN), intval($a->argv[2]), intval(local_user()) ); @@ -130,10 +131,11 @@ function profperm_content(&$a) { $o .= '

' . t("All Contacts \x28with secure profile access\x29") . '

'; $o .= ''; $o .= '
'; - - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 - AND `network` = 'dfrn' ORDER BY `name` ASC", - intval(local_user()) + + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 + AND `network` = '%s' ORDER BY `name` ASC", + intval(local_user()), + dbesc(NETWORK_DFRN) ); if(count($r)) { -- 2.39.5