From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- include/widgets.php | 100 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 014160867..4aba14f04 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -13,13 +13,13 @@ require_once('include/Contact.php'); function widget_profile($args) { $a = get_app(); $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); - return profile_sidebar($a->profile, $block, true); + return profile_sidebar(App::$profile, $block, true); } function widget_zcard($args) { $a = get_app(); $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); - $channel = channelx_by_n($a->profile_uid); + $channel = channelx_by_n(App::$profile_uid); return get_zcard($channel,get_observer_hash(),array('width' => 875)); } @@ -34,7 +34,7 @@ function widget_tagcloud($args) { $o = ''; //$tab = 0; $a = get_app(); - $uid = $a->profile_uid; + $uid = App::$profile_uid; $count = ((x($args,'count')) ? intval($args['count']) : 24); $flags = 0; $type = TERM_CATEGORY; @@ -85,7 +85,7 @@ function widget_collections($args) { $each = 'group'; $edit = false; $current = 0; - $abook_id = get_app()->poi['abook_xchan']; + $abook_id = App::$poi['abook_xchan']; $wmode = 1; break; default: @@ -165,7 +165,7 @@ function widget_follow($args) { return ''; $a = get_app(); - $uid =$a->channel['channel_id']; + $uid =App::$channel['channel_id']; $r = q("select count(*) as total from abook where abook_channel = %d and abook_self = 0 ", intval($uid) ); @@ -238,7 +238,7 @@ function widget_savedsearch($arr) { $search = ''; } - $srchurl = $a->query_string; + $srchurl = App::$query_string; $srchurl = rtrim(preg_replace('/searchsave\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $hasq = ((strpos($srchurl,'?') !== false) ? true : false); @@ -316,7 +316,7 @@ function widget_filer($arr) { '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), '$terms' => $terms, - '$base' => z_root() . '/' . $a->cmd + '$base' => z_root() . '/' . App::$cmd )); } @@ -325,11 +325,11 @@ function widget_archive($arr) { $o = ''; $a = get_app(); - if(! $a->profile_uid) { + if(! App::$profile_uid) { return ''; } - $uid = $a->profile_uid; + $uid = App::$profile_uid; if(! feature_enabled($uid,'archives')) return ''; @@ -345,7 +345,7 @@ function widget_archive($arr) { if(! $visible_years) $visible_years = 5; - $url = z_root() . '/' . $a->cmd; + $url = z_root() . '/' . App::$cmd; $ret = list_post_dates($uid,$wall,$mindate); @@ -371,33 +371,33 @@ function widget_archive($arr) { function widget_fullprofile($arr) { $a = get_app(); - if(! $a->profile['profile_uid']) + if(! App::$profile['profile_uid']) return; $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); - return profile_sidebar($a->profile, $block); + return profile_sidebar(App::$profile, $block); } function widget_shortprofile($arr) { $a = get_app(); - if(! $a->profile['profile_uid']) + if(! App::$profile['profile_uid']) return; $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); - return profile_sidebar($a->profile, $block, true, true); + return profile_sidebar(App::$profile, $block, true, true); } function widget_categories($arr) { $a = get_app(); - if($a->profile['profile_uid'] && (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_stream'))) + if(App::$profile['profile_uid'] && (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_stream'))) return ''; $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); - $srchurl = $a->query_string; + $srchurl = App::$query_string; $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); @@ -408,14 +408,14 @@ function widget_categories($arr) { function widget_tagcloud_wall($arr) { $a = get_app(); - if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash'])) + if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash'])) return ''; - if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream')) + if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) return ''; $limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50); - if(feature_enabled($a->profile['profile_uid'], 'tagadelic')) - return wtagblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall'); + if(feature_enabled(App::$profile['profile_uid'], 'tagadelic')) + return wtagblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall'); return ''; } @@ -423,14 +423,14 @@ function widget_tagcloud_wall($arr) { function widget_catcloud_wall($arr) { $a = get_app(); - if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash'])) + if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash'])) return ''; - if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream')) + if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) return ''; $limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50); - return catblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall'); + return catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall'); } @@ -487,7 +487,7 @@ function widget_settings_menu($arr) { return; $a = get_app(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $abook_self_id = 0; @@ -660,7 +660,7 @@ function widget_conversations($arr) { require_once('include/message.php'); // private_messages_list() can do other more complicated stuff, for now keep it simple - $r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']); + $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']); if(! $r) { info( t('No messages.') . EOL); @@ -735,8 +735,8 @@ function widget_design_tools($arr) { // mod menu doesn't load a profile. For any modules which load a profile, check it. // otherwise local_channel() is sufficient for permissions. - if($a->profile['profile_uid']) - if(($a->profile['profile_uid'] != local_channel()) && (! $a->is_sys)) + if(App::$profile['profile_uid']) + if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys)) return ''; if(! local_channel()) @@ -754,20 +754,20 @@ function widget_findpeople($arr) { function widget_photo_albums($arr) { $a = get_app(); - if(! $a->profile['profile_uid']) + if(! App::$profile['profile_uid']) return ''; - $channelx = channelx_by_n($a->profile['profile_uid']); - if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_storage'))) + $channelx = channelx_by_n(App::$profile['profile_uid']); + if((! $channelx) || (! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_storage'))) return ''; require_once('include/photos.php'); - return photos_album_widget($channelx, $a->get_observer()); + return photos_album_widget($channelx, App::get_observer()); } function widget_vcard($arr) { require_once ('include/Contact.php'); - return vcard_from_xchan('', get_app()->get_observer()); + return vcard_from_xchan('', App::get_observer()); } @@ -785,24 +785,24 @@ function widget_dirtags($arr) { } function widget_menu_preview($arr) { - if(! get_app()->data['menu_item']) + if(! App::$data['menu_item']) return; require_once('include/menu.php'); - return menu_render(get_app()->data['menu_item']); + return menu_render(App::$data['menu_item']); } function widget_chatroom_list($arr) { $a = get_app(); require_once("include/chat.php"); - $r = chatroom_list($a->profile['profile_uid']); + $r = chatroom_list(App::$profile['profile_uid']); if($r) { return replace_macros(get_markup_template('chatroomlist.tpl'), array( '$header' => t('Chat Rooms'), '$baseurl' => z_root(), - '$nickname' => $a->profile['channel_address'], + '$nickname' => App::$profile['channel_address'], '$items' => $r, '$overview' => t('Overview') )); @@ -853,7 +853,7 @@ function widget_item($arr) { if(array_key_exists('channel_id',$arr) && intval($arr['channel_id'])) $channel_id = intval($arr['channel_id']); if(! $channel_id) - $channel_id = get_app()->profile_uid; + $channel_id = App::$profile_uid; if(! $channel_id) return ''; @@ -1002,14 +1002,14 @@ function widget_cover_photo($arr) { $a = get_app(); - if($a->module == 'channel' && $_REQUEST['mid']) + if(App::$module == 'channel' && $_REQUEST['mid']) return ''; $channel_id = 0; if(array_key_exists('channel_id', $arr) && intval($arr['channel_id'])) $channel_id = intval($arr['channel_id']); if(! $channel_id) - $channel_id = $a->profile_uid; + $channel_id = App::$profile_uid; if(! $channel_id) return ''; @@ -1065,13 +1065,13 @@ function widget_photo_rand($arr) { if(array_key_exists('channel_id', $arr) && intval($arr['channel_id'])) $channel_id = intval($arr['channel_id']); if(! $channel_id) - $channel_id = get_app()->profile_uid; + $channel_id = App::$profile_uid; if(! $channel_id) return ''; $scale = ((array_key_exists('scale',$arr)) ? intval($arr['scale']) : 0); - $ret = photos_list_photos(array('channel_id' => $channel_id),get_app()->get_observer(),$album); + $ret = photos_list_photos(array('channel_id' => $channel_id),App::get_observer(),$album); $filtered = array(); if($ret['success'] && $ret['photos']) @@ -1115,7 +1115,7 @@ function widget_random_block($arr) { if(array_key_exists('channel_id',$arr) && intval($arr['channel_id'])) $channel_id = intval($arr['channel_id']); if(! $channel_id) - $channel_id = get_app()->profile_uid; + $channel_id = App::$profile_uid; if(! $channel_id) return ''; @@ -1161,7 +1161,7 @@ function widget_rating($arr) { if($arr['target']) $hash = $arr['target']; else - $hash = $a->poi['xchan_hash']; + $hash = App::$poi['xchan_hash']; if(! $hash) return; @@ -1170,7 +1170,7 @@ function widget_rating($arr) { $remote = false; if(remote_channel() && ! local_channel()) { - $ob = $a->get_observer(); + $ob = App::get_observer(); if($ob && $ob['xchan_url']) { $p = parse_url($ob['xchan_url']); if($p) { @@ -1184,7 +1184,7 @@ function widget_rating($arr) { $self = false; if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($hash == $channel['channel_hash']) $self = true; @@ -1213,7 +1213,7 @@ function widget_rating($arr) { // used by site ratings pages to provide a return link function widget_pubsites($arr) { - if(get_app()->poi) + if(App::$poi) return; return '
'; } @@ -1354,7 +1354,7 @@ function widget_admin($arr) { $plugin = $h['name']; $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin'); // temp plugins with admin - $a->plugins_admin[] = $plugin; + App::$plugins_admin[] = $plugin; } } @@ -1382,7 +1382,7 @@ function widget_admin($arr) { function widget_album($args) { - $owner_uid = get_app()->profile_uid; + $owner_uid = App::$profile_uid; $sql_extra = permissions_sql($owner_uid); @@ -1441,7 +1441,7 @@ function widget_album($args) { $imgalt_e = $rr['filename']; $desc_e = $rr['description']; - $imagelink = (z_root() . '/photos/' . get_app()->profile['channel_address'] . '/image/' . $rr['resource_id']); + $imagelink = (z_root() . '/photos/' . App::$profile['channel_address'] . '/image/' . $rr['resource_id']); $photos[] = array( @@ -1467,7 +1467,7 @@ function widget_album($args) { '$album_id' => rand(), '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => false, - '$upload' => array(t('Upload'), z_root() . '/photos/' . get_app()->profile['channel_address'] . '/upload/' . bin2hex($album)), + '$upload' => array(t('Upload'), z_root() . '/photos/' . App::$profile['channel_address'] . '/upload/' . bin2hex($album)), '$order' => false, '$upload_form' => $upload_form, '$usage' => $usage_message -- cgit v1.2.3