From 5ce125d6e089d6e7527cbd5f055b463bf23c06b1 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 26 Jun 2015 15:13:52 +0200 Subject: [PATCH] cleanup of some unused code --- include/acl_selectors.php | 47 +++------------------------------------ include/conversation.php | 36 ------------------------------ mod/bookmarklet.php | 2 +- mod/display.php | 4 +--- mod/editpost.php | 4 +--- mod/events.php | 2 +- mod/group.php | 2 -- mod/network.php | 4 +--- mod/notes.php | 24 +++++++++----------- mod/photos.php | 6 ++--- mod/profile.php | 24 ++++++++++---------- mod/settings.php | 10 ++++----- 12 files changed, 36 insertions(+), 129 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 88f11b2b00..1f0dba6553 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -283,7 +283,7 @@ function get_acl_permissions($user = null) { } -function populate_acl($user = null,$celeb = false,$show_jotnets = false) { +function populate_acl($user = null, $show_jotnets = false) { $perms = get_acl_permissions($user); @@ -317,52 +317,11 @@ function populate_acl($user = null,$celeb = false,$show_jotnets = false) { t('Hide your profile details from unknown viewers?')); } - // We shouldn't need to prune deadguys from the block list. Either way they can't get the message. - // Also no point enumerating groups and checking them, that will take place on delivery. - -// $deny_cid = prune_deadguys($deny_cid); - - - /*$o = ''; - $o .= '
'; - $o .= '
'; - $o .= '
' . t('Visible To:') . '
' . t('everybody') . '
'; - $o .= '
'; - $o .= '
'; - $o .= '
'; - $o .= ''; - $o .= group_select('group_allow','group_allow',$allow_gid); - $o .= '
'; - $o .= '
'; - $o .= ''; - $o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb,true); - $o .= '
'; - $o .= '
' . "\r\n"; - $o .= '
' . "\r\n"; - $o .= '
'; - $o .= '
'; - $o .= '
' . t('Except For:') . '
'; - $o .= '
'; - $o .= '
'; - $o .= '
'; - $o .= ''; - $o .= group_select('group_deny','group_deny', $deny_gid); - $o .= '
'; - $o .= '
'; - $o .= ''; - $o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb,true); - $o .= '
'; - $o .= '
' . "\r\n"; - $o .= '
' . "\r\n"; - $o .= '
'; - $o .= '
' . "\r\n"; - $o .= '
' . "\r\n";*/ - $tpl = get_markup_template("acl_selector.tpl"); $o = replace_macros($tpl, array( '$showall'=> t("Visible to everybody"), - '$show' => t("show"), - '$hide' => t("don't show"), + '$show' => t("show"), + '$hide' => t("don't show"), '$allowcid' => json_encode($perms['allow_cid']), '$allowgid' => json_encode($perms['allow_gid']), '$denycid' => json_encode($perms['deny_cid']), diff --git a/include/conversation.php b/include/conversation.php index f6da55c4f1..aa211b809f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1025,42 +1025,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { )); - $jotplugins = ''; - $jotnets = ''; - - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); - - $mail_enabled = false; - $pubmail_enabled = false; - - if(($x['is_owner']) && (! $mail_disabled)) { - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", - intval(local_user()) - ); - if(count($r)) { - $mail_enabled = true; - if(intval($r[0]['pubmail'])) - $pubmail_enabled = true; - } - } - - if (!$a->user['hidewall']) { - if($mail_enabled) { - $selected = (($pubmail_enabled) ? ' checked="checked" ' : ''); - $jotnets .= '
' . t("Post to Email") . '
'; - } - - call_hooks('jot_networks', $jotnets); - } else - $jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'), - t('Hide your profile details from unknown viewers?')); - call_hooks('jot_tool', $jotplugins); - if($notes_cid) - $jotnets .= ''; - - // Private/public post links for the non-JS ACL form $private_post = 1; if($_REQUEST['public']) @@ -1115,10 +1081,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), - '$emailcc' => t('CC: email addresses'), '$public' => t('Public post'), '$jotnets' => $jotnets, - '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $x['lockstate'], '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], diff --git a/mod/bookmarklet.php b/mod/bookmarklet.php index e1759ab655..650dc95771 100644 --- a/mod/bookmarklet.php +++ b/mod/bookmarklet.php @@ -27,7 +27,7 @@ function bookmarklet_content(&$a) { 'nickname' => $a->user['nickname'], 'lockstate' => ((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))) ? 'lock' : 'unlock'), 'default_perms' => get_acl_permissions($a->user), - 'acl' => populate_acl($a->user, $celeb), + 'acl' => populate_acl($a->user), 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), diff --git a/mod/display.php b/mod/display.php index 02ff37bf83..93a240935b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -336,15 +336,13 @@ function display_content(&$a, $update = 0) { } if ($is_owner) { - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $x = array( 'is_owner' => true, 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], 'nickname' => $a->user['nickname'], 'lockstate' => ( (is_array($a->user)) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => populate_acl($a->user, $celeb), + 'acl' => populate_acl($a->user), 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), diff --git a/mod/editpost.php b/mod/editpost.php index 0319f200b3..b039341023 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -66,8 +66,6 @@ function editpost_content(&$a) { else $lockstate = 'unlock'; - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $jotplugins = ''; $jotnets = ''; @@ -141,7 +139,7 @@ function editpost_content(&$a) { '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''), '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, - '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb), + '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)), '$bang' => (($group) ? '!' : ''), '$profile_uid' => $_SESSION['uid'], '$preview' => t('Preview'), diff --git a/mod/events.php b/mod/events.php index e9e1af05d8..242f27f135 100644 --- a/mod/events.php +++ b/mod/events.php @@ -507,7 +507,7 @@ function events_content(&$a) { '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, '$preview' => t('Preview'), - '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user),false)), + '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user))), '$submit' => t('Submit') )); diff --git a/mod/group.php b/mod/group.php index 906d649a6b..4a447713dc 100644 --- a/mod/group.php +++ b/mod/group.php @@ -172,8 +172,6 @@ function group_content(&$a) { '$form_security_token' => get_form_security_token("group_drop"), )); - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $context = $context + array( '$title' => t('Group Editor'), diff --git a/mod/network.php b/mod/network.php index c3de76413b..5562218701 100644 --- a/mod/network.php +++ b/mod/network.php @@ -466,8 +466,6 @@ function network_content(&$a, $update = 0) { nav_set_selected('network'); - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $content = ""; if ($cid) { @@ -485,7 +483,7 @@ function network_content(&$a, $update = 0) { ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), 'default_perms' => get_acl_permissions($a->user), - 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb, true), + 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), true), 'bang' => (($group || $cid || $nets) ? '!' : ''), 'visitor' => 'block', 'profile_uid' => local_user(), diff --git a/mod/notes.php b/mod/notes.php index 09dac72b0c..b960924956 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -46,25 +46,21 @@ function notes_content(&$a,$update = false) { $commpage = false; $commvisitor = false; - $celeb = false; - - - $x = array( 'is_owner' => $is_owner, - 'allow_location' => (($a->user['allow_location']) ? true : false), - 'default_location' => $a->user['default-location'], - 'nickname' => $a->user['nickname'], - 'lockstate' => 'lock', - 'acl' => '', - 'bang' => '', - 'visitor' => 'block', - 'profile_uid' => local_user(), + 'allow_location' => (($a->user['allow_location']) ? true : false), + 'default_location' => $a->user['default-location'], + 'nickname' => $a->user['nickname'], + 'lockstate' => 'lock', + 'acl' => '', + 'bang' => '', + 'visitor' => 'block', + 'profile_uid' => local_user(), 'button' => t('Save'), 'acl_data' => '', - ); + ); - $o .= status_editor($a,$x,$a->contact['id']); + $o .= status_editor($a,$x,$a->contact['id']); } diff --git a/mod/photos.php b/mod/photos.php index 02ae0e76d2..9f79d421de 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1089,8 +1089,6 @@ function photos_content(&$a) { } } - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $uploader = ''; $ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'], @@ -1139,11 +1137,11 @@ function photos_content(&$a) { if($a->theme['template_engine'] === 'internal') { $albumselect_e = template_escape($albumselect); - $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb))); + $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user))); } else { $albumselect_e = $albumselect; - $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb)); + $aclselect_e = (($visitor) ? '' : populate_acl($a->user)); } $o .= replace_macros($tpl,array( diff --git a/mod/profile.php b/mod/profile.php index 9eb2d34b6c..81bd5ace8e 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -182,8 +182,6 @@ function profile_content(&$a, $update = 0) { $commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false); $commvisitor = (($commpage && $remote_contact == true) ? true : false); - $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $a->page['aside'] .= posted_date_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true); $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : '')); @@ -191,18 +189,20 @@ function profile_content(&$a, $update = 0) { $x = array( 'is_owner' => $is_owner, - 'allow_location' => ((($is_owner || $commvisitor) && $a->profile['allow_location']) ? true : false), - 'default_location' => (($is_owner) ? $a->user['default-location'] : ''), - 'nickname' => $a->profile['nickname'], - 'lockstate' => (((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($a->user, $celeb, true) : ''), - 'bang' => '', - 'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'), - 'profile_uid' => $a->profile['profile_uid'], + 'allow_location' => ((($is_owner || $commvisitor) && $a->profile['allow_location']) ? true : false), + 'default_location' => (($is_owner) ? $a->user['default-location'] : ''), + 'nickname' => $a->profile['nickname'], + 'lockstate' => (((is_array($a->user) && ((strlen($a->user['allow_cid'])) || + (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || + (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($a->user, true) : ''), + 'bang' => '', + 'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'), + 'profile_uid' => $a->profile['profile_uid'], 'acl_data' => ( $is_owner ? construct_acl_data($a, $a->user) : '' ), // For non-Javascript ACL selector - ); + ); - $o .= status_editor($a,$x); + $o .= status_editor($a,$x); } } diff --git a/mod/settings.php b/mod/settings.php index a003401dff..bf803df8bb 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1097,8 +1097,6 @@ function settings_content(&$a) { $stpl = get_markup_template('settings.tpl'); - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $expire_arr = array( 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')), 'advanced' => t('Advanced expiration settings'), @@ -1163,7 +1161,7 @@ function settings_content(&$a) { '$permissions' => t('Default Post Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$visibility' => $profile['net-publish'], - '$aclselect' => populate_acl($a->user,$celeb), + '$aclselect' => populate_acl($a->user), '$suggestme' => $suggestme, '$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''), '$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''), @@ -1208,9 +1206,9 @@ function settings_content(&$a) { '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''), '$desktop_notifications' => t('Activate desktop notifications'), - '$desktop_notifications_note' => t('Note: This is an experimental feature, as being not supported by each browser'), - '$desktop_notifications_success_message' => t('You will now receive desktop notifications!'), - + '$desktop_notifications_note' => t('Note: This is an experimental feature, as being not supported by each browser'), + '$desktop_notifications_success_message' => t('You will now receive desktop notifications!'), + '$email_textonly' => array('email_textonly', t('Text-only notification emails'), get_pconfig(local_user(),'system','email_textonly'), t('Send text only notification emails, without the html part')), -- 2.39.5