diff options
author | redmatrix <git@macgirvin.com> | 2016-05-24 20:49:23 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-24 20:49:23 -0700 |
commit | 80f2ba640ec528bd43db243122a69e765703b7c0 (patch) | |
tree | f1029b2b3143a501734bd49f00fbc95912044602 /include | |
parent | f9a295a23627cf272e14559b8a11e3780de43ea1 (diff) | |
download | volse-hubzilla-80f2ba640ec528bd43db243122a69e765703b7c0.tar.gz volse-hubzilla-80f2ba640ec528bd43db243122a69e765703b7c0.tar.bz2 volse-hubzilla-80f2ba640ec528bd43db243122a69e765703b7c0.zip |
code cleanup
Diffstat (limited to 'include')
-rw-r--r-- | include/Import/import_diaspora.php | 1 | ||||
-rw-r--r-- | include/account.php | 3 | ||||
-rw-r--r-- | include/acl_selectors.php | 4 | ||||
-rw-r--r-- | include/activities.php | 1 | ||||
-rw-r--r-- | include/api.php | 3 | ||||
-rw-r--r-- | include/bb2diaspora.php | 2 | ||||
-rw-r--r-- | include/bbcode.php | 3 | ||||
-rw-r--r-- | include/config.php | 14 | ||||
-rw-r--r-- | include/connections.php | 4 | ||||
-rw-r--r-- | include/conversation.php | 8 | ||||
-rw-r--r-- | include/datetime.php | 1 | ||||
-rw-r--r-- | include/follow.php | 1 | ||||
-rw-r--r-- | include/help.php | 2 | ||||
-rw-r--r-- | include/language.php | 6 | ||||
-rw-r--r-- | include/network.php | 9 | ||||
-rwxr-xr-x | include/oembed.php | 2 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 6 | ||||
-rw-r--r-- | include/photos.php | 2 | ||||
-rwxr-xr-x | include/plugin.php | 11 | ||||
-rw-r--r-- | include/text.php | 28 | ||||
-rw-r--r-- | include/widgets.php | 1 | ||||
-rw-r--r-- | include/zot.php | 4 |
22 files changed, 24 insertions, 92 deletions
diff --git a/include/Import/import_diaspora.php b/include/Import/import_diaspora.php index a94e73395..b664badf1 100644 --- a/include/Import/import_diaspora.php +++ b/include/Import/import_diaspora.php @@ -6,7 +6,6 @@ require_once('include/follow.php'); require_once('include/photo/photo_driver.php'); function import_diaspora($data) { - $a = get_app(); $account = App::get_account(); if(! $account) diff --git a/include/account.php b/include/account.php index e367e002d..a442f3073 100644 --- a/include/account.php +++ b/include/account.php @@ -656,7 +656,8 @@ function account_service_class_allows($aid, $property, $usage = false) { * @todo Should we merge this with account_service_class_fetch()? */ function service_class_fetch($uid, $property) { - $a = get_app(); + + if($uid == local_channel()) { $service_class = App::$account['account_service_class']; } diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 886574714..1f97a7a7b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -11,8 +11,6 @@ require_once("include/PermissionDescription.php"); function group_select($selname,$selclass,$preselected = false,$size = 4) { - $a = get_app(); - $o = ''; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n"; @@ -51,7 +49,6 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { /* MicMee 20130114 function contact_selector no longer in use, sql table contact does no longer exist function contact_selector($selname, $selclass, $preselected = false, $options) { - $a = get_app(); $mutual = false; $networks = null; @@ -157,7 +154,6 @@ function contact_selector($selname, $selclass, $preselected = false, $options) { function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false, $tabindex = null) { - $a = get_app(); $o = ''; diff --git a/include/activities.php b/include/activities.php index 7b9aa9963..3271db993 100644 --- a/include/activities.php +++ b/include/activities.php @@ -1,7 +1,6 @@ <?php /** @file */ function profile_activity($changed, $value) { - $a = get_app(); if(! local_channel() || ! is_array($changed) || ! count($changed)) return; diff --git a/include/api.php b/include/api.php index ba36cc01a..af5a22a74 100644 --- a/include/api.php +++ b/include/api.php @@ -451,8 +451,6 @@ require_once('include/api_auth.php'); */ function api_apply_template($templatename, $type, $data){ - $a = get_app(); - switch($type){ case "atom": case "rss": @@ -1904,7 +1902,6 @@ require_once('include/api_auth.php'); //logger('api_format_items: ' . print_r($user_info,true)); - $a = get_app(); $ret = array(); if(! $r) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 9167cb5ad..c7d0e56b1 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -479,8 +479,6 @@ function unescape_underscores_in_links($m) { function format_event_diaspora($ev) { - $a = get_app(); - if(! ((is_array($ev)) && count($ev))) return ''; diff --git a/include/bbcode.php b/include/bbcode.php index ba35050e8..1001a4938 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -275,7 +275,6 @@ function bb_location($match) { * @return string HTML iframe with content of $match[1] */ function bb_iframe($match) { - $a = get_app(); $sandbox = ((strpos($match[1], App::get_hostname())) ? ' sandbox="allow-scripts" ' : ''); @@ -449,8 +448,6 @@ function bb_sanitize_style($input) { function bb_observer($Text) { - $a = get_app(); - $observer = App::get_observer(); if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) { diff --git a/include/config.php b/include/config.php index 29ea10b5a..3017c3865 100644 --- a/include/config.php +++ b/include/config.php @@ -80,7 +80,6 @@ function load_config($family) { * @return mixed Return value or false on error or if not set */ function get_config($family, $key) { - global $a; if((! array_key_exists($family, App::$config)) || (! array_key_exists('config_loaded', App::$config[$family]))) load_config($family); @@ -135,7 +134,6 @@ function get_config_from_storage($family, $key) { * Return the set value, or false if the database update failed */ function set_config($family, $key, $value) { - global $a; // manage array value $dbvalue = ((is_array($value)) ? serialize($value) : $value); @@ -180,7 +178,7 @@ function set_config($family, $key, $value) { * @return mixed */ function del_config($family, $key) { - global $a; + $ret = false; if(array_key_exists($family, App::$config) && array_key_exists($key, App::$config[$family])) @@ -204,7 +202,6 @@ function del_config($family, $key) { * @return void|false Nothing or false if $uid is false */ function load_pconfig($uid) { - global $a; if($uid === false) return false; @@ -249,7 +246,6 @@ function load_pconfig($uid) { */ function get_pconfig($uid, $family, $key, $instore = false) { // logger('include/config.php: get_pconfig() deprecated instore param used', LOGGER_DEBUG); - global $a; if($uid === false) return false; @@ -285,7 +281,6 @@ function get_pconfig($uid, $family, $key, $instore = false) { * @return mixed Stored $value or false */ function set_pconfig($uid, $family, $key, $value) { - global $a; // this catches subtle errors where this function has been called // with local_channel() when not logged in (which returns false) @@ -372,7 +367,7 @@ function set_pconfig($uid, $family, $key, $value) { * @return mixed */ function del_pconfig($uid, $family, $key) { - global $a; + $ret = false; if (x(App::$config[$uid][$family], $key)) @@ -398,7 +393,6 @@ function del_pconfig($uid, $family, $key) { * @return void|false Returns false if xchan is not set */ function load_xconfig($xchan) { - global $a; if(! $xchan) return false; @@ -441,7 +435,6 @@ function load_xconfig($xchan) { * @return mixed Stored $value or false if it does not exist */ function get_xconfig($xchan, $family, $key) { - global $a; if(! $xchan) return false; @@ -477,7 +470,6 @@ function get_xconfig($xchan, $family, $key) { * @return mixed Stored $value or false */ function set_xconfig($xchan, $family, $key, $value) { - global $a; // manage array value $dbvalue = ((is_array($value)) ? serialize($value) : $value); @@ -530,7 +522,7 @@ function set_xconfig($xchan, $family, $key, $value) { * @return mixed */ function del_xconfig($xchan, $family, $key) { - global $a; + $ret = false; if(x(App::$config[$xchan][$family], $key)) diff --git a/include/connections.php b/include/connections.php index c55ffd817..d9331f42f 100644 --- a/include/connections.php +++ b/include/connections.php @@ -72,8 +72,6 @@ function channelx_by_n($id) { function vcard_from_xchan($xchan, $observer = null, $mode = '') { - $a = get_app(); - if(! $xchan) { if(App::$poi) { $xchan = App::$poi; @@ -267,7 +265,7 @@ function channel_remove($channel_id, $local = true, $unset_session=false) { if(! $channel_id) return; - $a = get_app(); + logger('Removing channel: ' . $channel_id); logger('channel_remove: local only: ' . intval($local)); diff --git a/include/conversation.php b/include/conversation.php index f405bc9d5..dabe2ca93 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -858,8 +858,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ function best_link_url($item) { - $a = get_app(); - $best_url = ''; $sparkle = false; @@ -888,7 +886,7 @@ function best_link_url($item) { function item_photo_menu($item){ - $a = get_app(); + $contact = null; $ssl_state = false; @@ -1408,7 +1406,7 @@ function render_location_default($item) { function prepare_page($item) { - $a = get_app(); + $naked = 1; // $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0); $observer = App::get_observer(); @@ -1442,7 +1440,7 @@ function prepare_page($item) { function network_tabs() { - $a = get_app(); + $no_active=''; $starred_active = ''; $new_active = ''; diff --git a/include/datetime.php b/include/datetime.php index 83fb49d04..bf58866e9 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -119,7 +119,6 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d * @return string */ function dob($dob) { - $a = get_app(); list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d'); $f = get_config('system', 'birthday_input_format'); diff --git a/include/follow.php b/include/follow.php index dd43c7c4c..0c3973175 100644 --- a/include/follow.php +++ b/include/follow.php @@ -17,7 +17,6 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) $result = array('success' => false,'message' => ''); - $a = get_app(); $is_red = false; $is_http = ((strpos($url,'://') !== false) ? true : false); diff --git a/include/help.php b/include/help.php index 13473164d..5518eeb70 100644 --- a/include/help.php +++ b/include/help.php @@ -24,8 +24,6 @@ function find_doc_file($s) { function search_doc_files($s) { - $a = get_app(); - $itemspage = get_pconfig(local_channel(),'system','itemspage'); \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); diff --git a/include/language.php b/include/language.php index 14139e90c..238c23028 100644 --- a/include/language.php +++ b/include/language.php @@ -82,13 +82,11 @@ function get_best_language() { if($arr['preferred'] !== 'unset') return $arr['preferred']; - $a = get_app(); return ((isset(App::$config['system']['language'])) ? App::$config['system']['language'] : 'en'); } function push_lang($language) { - global $a; App::$langsave = App::$language; @@ -104,7 +102,6 @@ function push_lang($language) { } function pop_lang() { - global $a; if(App::$language === App::$langsave) return; @@ -124,7 +121,6 @@ function pop_lang() { * @param boolean $install (optional) default false */ function load_translation_table($lang, $install = false) { - global $a; App::$strings = array(); @@ -170,7 +166,6 @@ function load_translation_table($lang, $install = false) { * */ function t($s, $ctx = '') { - global $a; $cs = $ctx ? '__ctx:' . $ctx . '__ ' . $s : $s; if (x(App::$strings, $cs)) { @@ -205,7 +200,6 @@ function translate_projectname($s) { * @return string */ function tt($singular, $plural, $count, $ctx = ''){ - $a = get_app(); $cs = $ctx ? "__ctx:" . $ctx . "__ " . $singular : $singular; if (x(App::$strings,$cs)) { diff --git a/include/network.php b/include/network.php index 35f4d113f..dd266f5d1 100644 --- a/include/network.php +++ b/include/network.php @@ -595,8 +595,6 @@ function parse_xml_string($s,$strict = true) { function scale_external_images($s, $include_link = true, $scale_replace = false) { - $a = get_app(); - // Picture addresses can contain special characters $s = htmlspecialchars_decode($s, ENT_COMPAT); @@ -1618,8 +1616,6 @@ function fetch_xrd_links($url) { function scrape_vcard($url) { - $a = get_app(); - $ret = array(); logger('scrape_vcard: url=' . $url); @@ -1699,8 +1695,6 @@ function scrape_vcard($url) { function scrape_feed($url) { - $a = get_app(); - $ret = array(); $level = 0; $x = z_fetch_url($url,false,$level,array('novalidate' => true)); @@ -1938,9 +1932,6 @@ function do_delivery($deliveries) { function get_site_info() { - global $db; - global $a; - $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); $directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_SECONDARY', 256 => 'DIRECTORY_MODE_STANDALONE'); diff --git a/include/oembed.php b/include/oembed.php index 1e5c51172..08363e488 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -227,7 +227,7 @@ function oembed_fetch_url($embedurl){ } function oembed_format_object($j){ - $a = get_app(); + $embedurl = $j->embedurl; // logger('format: ' . print_r($j,true)); diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 3bea54fd4..e57a9165a 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -521,7 +521,7 @@ function guess_image_type($filename, $headers = '') { logger('Photo: guess_image_type: '.$filename . ($headers?' from curl headers':''), LOGGER_DEBUG); $type = null; if ($headers) { - $a = get_app(); + $hdrs=array(); $h = explode("\n",$headers); foreach ($h as $l) { @@ -580,8 +580,6 @@ function guess_image_type($filename, $headers = '') { function import_xchan_photo($photo,$xchan,$thing = false) { - $a = get_app(); - $flags = (($thing) ? PHOTO_THING : PHOTO_XCHAN); $album = (($thing) ? 'Things' : 'Contact Photos'); @@ -703,8 +701,6 @@ function import_xchan_photo($photo,$xchan,$thing = false) { function import_channel_photo($photo,$type,$aid,$uid) { - $a = get_app(); - logger('import_channel_photo: importing channel photo for ' . $uid, LOGGER_DEBUG); $hash = photo_new_resource(); diff --git a/include/photos.php b/include/photos.php index d8d3d102c..c333a4d04 100644 --- a/include/photos.php +++ b/include/photos.php @@ -19,8 +19,6 @@ require_once('include/text.php'); */ function photo_upload($channel, $observer, $args) { - $a = get_app(); - $ret = array('success' => false); $channel_id = $channel['channel_id']; $account_id = $channel['channel_account_id']; diff --git a/include/plugin.php b/include/plugin.php index 0466360bb..6c108fcc5 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -500,7 +500,7 @@ function get_theme_info($theme){ * @return string */ function get_theme_screenshot($theme) { - $a = get_app(); + $exts = array('.png', '.jpg'); foreach($exts as $ext) { if(file_exists('view/theme/' . $theme . '/img/screenshot' . $ext)) @@ -521,7 +521,7 @@ function head_add_css($src, $media = 'screen') { } function head_remove_css($src, $media = 'screen') { - $a = get_app(); + $index = array_search(array($src, $media), App::$css_sources); if ($index !== false) unset(App::$css_sources[$index]); @@ -592,7 +592,7 @@ function head_add_js($src) { } function head_remove_js($src) { - $a = get_app(); + $index = array_search($src, App::$js_sources); if($index !== false) unset(App::$js_sources[$index]); @@ -633,7 +633,6 @@ function format_js_if_exists($source) { function theme_include($file, $root = '') { - $a = get_app(); // Make sure $root ends with a slash / if it's not blank if($root !== '' && $root[strlen($root)-1] !== '/') @@ -671,7 +670,7 @@ function theme_include($file, $root = '') { function get_intltext_template($s, $root = '') { - $a = get_app(); + $t = App::template_engine(); $template = $t->get_intltext_template($s, $root); @@ -680,7 +679,7 @@ function get_intltext_template($s, $root = '') { function get_markup_template($s, $root = '') { - $a = get_app(); + $t = App::template_engine(); $template = $t->get_markup_template($s, $root); return $template; diff --git a/include/text.php b/include/text.php index caaef664f..a7cc4c9bd 100644 --- a/include/text.php +++ b/include/text.php @@ -20,7 +20,6 @@ define('RANDOM_STRING_TEXT', 0x01 ); * @return string substituted string */ function replace_macros($s, $r) { - $a = get_app(); $arr = array('template' => $s, 'params' => $r); call_hooks('replace_macros', $arr); @@ -96,7 +95,6 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') { if($type == 'application/x-pdl') return escape_tags($s); - $a = get_app(); if(App::$is_sys) { return $s; } @@ -653,11 +651,10 @@ function log_priority_str($priority) { * @param int $level A log level. */ function dlogger($msg, $level = 0) { + // turn off logger in install mode - global $a; - global $db; - if((App::$module == 'install') || (! (DBA::$dba && DBA::$dba->connected))) + if(App::$module == 'setup') return; $debugging = get_config('system','debugging'); @@ -815,7 +812,6 @@ function get_mentions($item,$tags) { function contact_block() { $o = ''; - $a = get_app(); if(! App::$profile['uid']) return; @@ -928,7 +924,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { function search($s,$id='search-box',$url='/search',$save = false) { - $a = get_app(); + return replace_macros(get_markup_template('searchbox.tpl'),array( '$s' => $s, '$id' => $id, @@ -1073,7 +1069,7 @@ function get_mood_verbs() { // Function to list all smilies, both internal and from addons // Returns array with keys 'texts' and 'icons' function list_smilies() { - $a = get_app(); + $texts = array( '<3', '</3', @@ -1106,10 +1102,8 @@ function list_smilies() { ':coffee', ':facepalm', ':like', - ':dislike', - 'red#matrix', - 'red#', - 'r#' + ':dislike' + ); $icons = array( @@ -1145,9 +1139,6 @@ function list_smilies() { '<img class="smiley" src="' . z_root() . '/images/smiley-facepalm.gif" alt=":facepalm" />', '<img class="smiley" src="' . z_root() . '/images/like.gif" alt=":like" />', '<img class="smiley" src="' . z_root() . '/images/dislike.gif" alt=":dislike" />', - '<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#matrix') . '" />matrix</strong></a>', - '<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#') . '" />matrix</strong></a>', - '<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="r#" />matrix</strong></a>' ); @@ -1218,7 +1209,7 @@ function smile_unshield($m) { * @param array $x */ function preg_heart($x) { - $a = get_app(); + if (strlen($x[1]) == 1) return $x[0]; @@ -1491,7 +1482,6 @@ function format_event($jobject) { } function prepare_body(&$item,$attach = false) { - require_once('include/channel.php'); call_hooks('prepare_body_init', $item); @@ -1721,7 +1711,6 @@ function feed_hublinks() { /* return atom link elements for salmon endpoints */ function feed_salmonlinks($nick) { - $a = get_app(); $salmon = '<link rel="salmon" href="' . xmlify(z_root() . '/salmon/' . $nick) . '" />' . "\n" ; @@ -1789,7 +1778,7 @@ function mimetype_select($channel_id, $current = 'text/bbcode') { 'application/x-pdl' ); - $a = get_app(); + if(App::$is_sys) { $x[] = 'application/x-php'; } @@ -1822,7 +1811,6 @@ function mimetype_select($channel_id, $current = 'text/bbcode') { function lang_selector() { - global $a; $langs = glob('view/*/hstrings.php'); diff --git a/include/widgets.php b/include/widgets.php index e6d162ccd..c4b80afd0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -771,7 +771,6 @@ function widget_eventstools($arr) { } function widget_design_tools($arr) { - $a = get_app(); // mod menu doesn't load a profile. For any modules which load a profile, check it. // otherwise local_channel() is sufficient for permissions. diff --git a/include/zot.php b/include/zot.php index cfe524135..9ed3d7d03 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2944,8 +2944,6 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { if(UNO) return; - $a = get_app(); - logger('build_sync_packet'); if($packet) @@ -3932,8 +3930,6 @@ function zotinfo($arr) { $ret['site']['admin'] = get_config('system','admin_email'); - $a = get_app(); - $visible_plugins = array(); if(is_array(App::$plugins) && count(App::$plugins)) { $r = q("select * from addon where hidden = 0"); |