diff options
Diffstat (limited to 'mod')
116 files changed, 689 insertions, 689 deletions
diff --git a/mod/_well_known.php b/mod/_well_known.php index 46714deaa..23d79bb1d 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -25,36 +25,36 @@ function _well_known_init(&$a){ switch(argv(1)) {
case 'zot-info':
- $a->argc -= 1;
- array_shift($a->argv);
- $a->argv[0] = 'zfinger';
+ App::$argc -= 1;
+ array_shift(App::$argv);
+ App::$argv[0] = 'zfinger';
require_once('mod/zfinger.php');
zfinger_init($a);
break;
case 'webfinger':
- $a->argc -= 1;
- array_shift($a->argv);
- $a->argv[0] = 'wfinger';
+ App::$argc -= 1;
+ array_shift(App::$argv);
+ App::$argv[0] = 'wfinger';
require_once('mod/wfinger.php');
wfinger_init($a);
break;
case 'host-meta':
- $a->argc -= 1;
- array_shift($a->argv);
- $a->argv[0] = 'hostxrd';
+ App::$argc -= 1;
+ array_shift(App::$argv);
+ App::$argv[0] = 'hostxrd';
require_once('mod/hostxrd.php');
hostxrd_init($a);
break;
default:
- if(file_exists($a->cmd)) {
- echo file_get_contents($a->cmd);
+ if(file_exists(App::$cmd)) {
+ echo file_get_contents(App::$cmd);
killme();
}
- elseif(file_exists($a->cmd . '.php'))
- require_once($a->cmd . '.php');
+ elseif(file_exists(App::$cmd . '.php'))
+ require_once(App::$cmd . '.php');
break;
}
diff --git a/mod/achievements.php b/mod/achievements.php index 1d0018b08..9d4dad35b 100644 --- a/mod/achievements.php +++ b/mod/achievements.php @@ -23,7 +23,7 @@ function achievements_content(&$a) { $owner = intval($r[0]['channel_id']); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); $perms = get_all_perms($owner,$ob_hash); if(! $perms['view_profile']) { diff --git a/mod/admin.php b/mod/admin.php index 0d8bf8395..be703f922 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -196,7 +196,7 @@ function admin_page_summary(&$a) { $queues = array( 'label' => t('Message queues'), 'queue' => $queue ); // If no plugins active return 0, otherwise list of plugin names - $plugins = (count($a->plugins) == 0) ? count($a->plugins) : $a->plugins; + $plugins = (count(App::$plugins) == 0) ? count(App::$plugins) : App::$plugins; // Could be extended to provide also other alerts to the admin $alertmsg = ''; @@ -514,7 +514,7 @@ function admin_page_hubloc_post(&$a){ $hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post'; //perform ping - $m = zot_build_packet($a->get_channel(),'ping'); + $m = zot_build_packet(App::get_channel(),'ping'); $r = zot_zot($hublocurl,$m); //handle results and set the hubloc flags in db to make results visible $r2 = $r['body']; @@ -671,7 +671,7 @@ function admin_page_hubloc(&$a) { '$queues' => $queues, //'$accounts' => $accounts, /*$accounts is empty here*/ '$pending' => array( t('Pending registrations'), $pending), - '$plugins' => array( t('Active plugins'), $a->plugins ), + '$plugins' => array( t('Active plugins'), App::$plugins ), '$form_security_token' => get_form_security_token('admin_hubloc') )); } @@ -936,8 +936,8 @@ function admin_page_users(&$a){ $total = q("SELECT count(*) as total FROM account"); if (count($total)) { - $a->set_pager_total($total[0]['total']); - $a->set_pager_itemspage(100); + App::set_pager_total($total[0]['total']); + App::set_pager_itemspage(100); } @@ -958,8 +958,8 @@ function admin_page_users(&$a){ "FROM account as ac where true $serviceclass $order limit %d offset %d ", intval(ACCOUNT_BLOCKED), db_concat('ch.channel_address', ' '), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); // function _setup_users($e){ @@ -1117,15 +1117,15 @@ function admin_page_channels(&$a){ $total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0"); if($total) { - $a->set_pager_total($total[0]['total']); - $a->set_pager_itemspage(100); + App::set_pager_total($total[0]['total']); + App::set_pager_itemspage(100); } $order = " order by channel_name asc "; $channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ", - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); if($channels) { @@ -1183,14 +1183,14 @@ function admin_page_plugins(&$a){ /* * Single plugin */ - if ($a->argc == 3){ - $plugin = $a->argv[2]; + if (App::$argc == 3){ + $plugin = App::$argv[2]; if (!is_file("addon/$plugin/$plugin.php")){ notice( t("Item not found.") ); return ''; } - $enabled = in_array($plugin,$a->plugins); + $enabled = in_array($plugin,App::$plugins); $info = get_plugin_info($plugin); $x = check_plugin_versions($info); @@ -1198,11 +1198,11 @@ function admin_page_plugins(&$a){ if($enabled && ! $x) { $enabled = false; - $idz = array_search($plugin, $a->plugins); + $idz = array_search($plugin, App::$plugins); if ($idz !== false) { - unset($a->plugins[$idz]); + unset(App::$plugins[$idz]); uninstall_plugin($plugin); - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); } } $info['disabled'] = 1-intval($x); @@ -1211,23 +1211,23 @@ function admin_page_plugins(&$a){ check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't'); // Toggle plugin status - $idx = array_search($plugin, $a->plugins); + $idx = array_search($plugin, App::$plugins); if ($idx !== false){ - unset($a->plugins[$idx]); + unset(App::$plugins[$idx]); uninstall_plugin($plugin); info( sprintf( t("Plugin %s disabled."), $plugin ) ); } else { - $a->plugins[] = $plugin; + App::$plugins[] = $plugin; install_plugin($plugin); info( sprintf( t("Plugin %s enabled."), $plugin ) ); } - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); goaway(z_root() . '/admin/plugins' ); } // display plugin details require_once('library/markdown.php'); - if (in_array($plugin, $a->plugins)){ + if (in_array($plugin, App::$plugins)){ $status = 'on'; $action = t('Disable'); } else { @@ -1298,18 +1298,18 @@ function admin_page_plugins(&$a){ if (is_dir($file)){ list($tmp, $id) = array_map('trim', explode('/', $file)); $info = get_plugin_info($id); - $enabled = in_array($id,$a->plugins); + $enabled = in_array($id,App::$plugins); $x = check_plugin_versions($info); // disable plugins which are installed but incompatible versions if($enabled && ! $x) { $enabled = false; - $idz = array_search($id, $a->plugins); + $idz = array_search($id, App::$plugins); if ($idz !== false) { - unset($a->plugins[$idz]); + unset(App::$plugins[$idz]); uninstall_plugin($id); - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); } } $info['disabled'] = 1-intval($x); @@ -1428,8 +1428,8 @@ function admin_page_themes(&$a){ * Single theme */ - if ($a->argc == 3){ - $theme = $a->argv[2]; + if (App::$argc == 3){ + $theme = App::$argv[2]; if(! is_dir("view/theme/$theme")){ notice( t("Item not found.") ); return ''; diff --git a/mod/api.php b/mod/api.php index 232349292..aa95b81dd 100644 --- a/mod/api.php +++ b/mod/api.php @@ -27,7 +27,7 @@ function api_post(&$a) { return; } - if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_channel()) { + if(count(App::$user) && x(App::$user,'uid') && App::$user['uid'] != local_channel()) { notice( t('Permission denied.') . EOL); return; } @@ -35,13 +35,13 @@ function api_post(&$a) { } function api_content(&$a) { - if($a->cmd=='api/oauth/authorize'){ + if(App::$cmd=='api/oauth/authorize'){ /* * api/oauth/authorize interact with the user. return a standard page */ - $a->page['template'] = "minimal"; + App::$page['template'] = "minimal"; // get consumer/client from request token try { diff --git a/mod/appman.php b/mod/appman.php index e31492f0b..d8d030465 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -67,7 +67,7 @@ function appman_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $app = null; $embed = null; if($_REQUEST['appid']) { diff --git a/mod/apps.php b/mod/apps.php index fcf545421..3539b2bc0 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -9,7 +9,7 @@ function apps_content(&$a) { else $mode = 'list'; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; $apps = array(); diff --git a/mod/block.php b/mod/block.php index df3909629..301993d03 100644 --- a/mod/block.php +++ b/mod/block.php @@ -10,15 +10,15 @@ function block_init(&$a) { $profile = 0; profile_load($a,$which,$profile); - if($a->profile['profile_uid']) - head_set_icon($a->profile['thumb']); + if(App::$profile['profile_uid']) + head_set_icon(App::$profile['thumb']); } function block_content(&$a) { - if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_pages')) { + if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_pages')) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/blocks.php b/mod/blocks.php index 97cc5cd53..96005e9a3 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -9,7 +9,7 @@ function blocks_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,24 +25,24 @@ function blocks_init(&$a) { function blocks_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $which = argv(1); - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -86,7 +86,7 @@ function blocks_content(&$a) { $x = array( 'webpage' => ITEM_TYPE_BLOCK, 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], + 'nickname' => App::$profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', 'showacl' => false, diff --git a/mod/bookmarks.php b/mod/bookmarks.php index c3d25253f..02fe2f2e1 100644 --- a/mod/bookmarks.php +++ b/mod/bookmarks.php @@ -7,7 +7,7 @@ function bookmarks_init(&$a) { if(! $item_id) return; - $u = $a->get_channel(); + $u = App::get_channel(); $item_normal = item_normal(); @@ -53,7 +53,7 @@ function bookmarks_content(&$a) { require_once('include/menu.php'); require_once('include/conversation.php'); - $channel = $a->get_channel(); + $channel = App::get_channel(); $o = profile_tabs($a,true,$channel['channel_address']); diff --git a/mod/branchtopic.php b/mod/branchtopic.php index d49bbaf4c..3702e6d53 100644 --- a/mod/branchtopic.php +++ b/mod/branchtopic.php @@ -13,7 +13,7 @@ function branchtopic_init(&$a) { if(! $item_id) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! $channel) return; diff --git a/mod/cal.php b/mod/cal.php index 80a484c27..ffefd895e 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -25,16 +25,16 @@ function cal_init(&$a) { if(! $channelx) return; - $a->data['channel'] = $channelx; + App::$data['channel'] = $channelx; - $observer = $a->get_observer(); - $a->data['observer'] = $observer; + $observer = App::get_observer(); + App::$data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - head_set_icon($a->data['channel']['xchan_photo_s']); + head_set_icon(App::$data['channel']['xchan_photo_s']); - $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . (($a->data['channel']) ? $a->data['channel']['channel_id'] : 0) . "; </script>" ; + App::$page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . ((App::$data['channel']) ? App::$data['channel']['channel_id'] : 0) . "; </script>" ; } @@ -70,11 +70,11 @@ function cal_content(&$a) { $first_day = (($first_day) ? $first_day : 0); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl,array( + App::$page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => z_root(), '$module_url' => '/cal/' . $channel['channel_address'], '$modparams' => 2, - '$lang' => $a->language, + '$lang' => App::$language, '$first_day' => $first_day )); @@ -87,7 +87,7 @@ function cal_content(&$a) { $m = 0; $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); - // logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r(App::$argv,true)); if(argc() > 3 && intval(argv(2)) && intval(argv(3))) { $mode = 'view'; @@ -243,7 +243,7 @@ function cal_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j; } } diff --git a/mod/channel.php b/mod/channel.php index d609d6802..88c420366 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -16,7 +16,7 @@ function channel_init(&$a) { $which = argv(1); if(! $which) { if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_address']) $which = $channel['channel_address']; } @@ -27,19 +27,19 @@ function channel_init(&$a) { } $profile = 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); } - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n" ; - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n" ; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n" ; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n" ; // Not yet ready for prime time -// $a->page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ; -// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ; +// App::$page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ; +// App::$page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content @@ -75,27 +75,27 @@ function channel_content(&$a, $update = 0, $load = false) { if($update) { // Ensure we've got a profile owner if updating. - $a->profile['profile_uid'] = $a->profile_uid = $update; + App::$profile['profile_uid'] = App::$profile_uid = $update; } else { - if($a->profile['profile_uid'] == local_channel()) { + if(App::$profile['profile_uid'] == local_channel()) { nav_set_selected('home'); } } - $is_owner = (((local_channel()) && ($a->profile['profile_uid'] == local_channel())) ? true : false); + $is_owner = (((local_channel()) && (App::$profile['profile_uid'] == local_channel())) ? true : false); - $channel = $a->get_channel(); - $observer = $a->get_observer(); + $channel = App::get_channel(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - $perms = get_all_perms($a->profile['profile_uid'],$ob_hash); + $perms = get_all_perms(App::$profile['profile_uid'],$ob_hash); if(! $perms['view_stream']) { // We may want to make the target of this redirect configurable if($perms['view_profile']) { notice( t('Insufficient permissions. Request redirected to profile page.') . EOL); - goaway (z_root() . "/profile/" . $a->profile['channel_address']); + goaway (z_root() . "/profile/" . App::$profile['channel_address']); } notice( t('Permission denied.') . EOL); return; @@ -104,9 +104,9 @@ function channel_content(&$a, $update = 0, $load = false) { if(! $update) { - $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o .= profile_tabs($a, $is_owner, App::$profile['channel_address']); - $o .= common_friends_visitor_widget($a->profile['profile_uid']); + $o .= common_friends_visitor_widget(App::$profile['profile_uid']); if($channel && $is_owner) { $channel_acl = array( @@ -124,15 +124,15 @@ function channel_content(&$a, $update = 0, $load = false) { $x = array( 'is_owner' => $is_owner, - 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig($a->profile['profile_uid'],'system','use_browser_location')))) ? true : false), - 'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''), - 'nickname' => $a->profile['channel_address'], - 'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), + 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), + 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''), + 'nickname' => App::$profile['channel_address'], + 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), - 'profile_uid' => $a->profile['profile_uid'] + 'profile_uid' => App::$profile['profile_uid'] ); $o .= status_editor($a,$x); @@ -146,18 +146,18 @@ function channel_content(&$a, $update = 0, $load = false) { */ $item_normal = item_normal(); - $sql_extra = item_permissions_sql($a->profile['profile_uid']); + $sql_extra = item_permissions_sql(App::$profile['profile_uid']); - if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid)) + if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid)) $page_mode = 'list'; else $page_mode = 'client'; - $abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " "; + $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string) . '" title="oembed" />' . "\r\n"; if($update && $_SESSION['loadtime']) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; @@ -170,7 +170,7 @@ function channel_content(&$a, $update = 0, $load = false) { $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", dbesc($mid . '%'), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); } else { $r = q("SELECT distinct parent AS `item_id`, created from item @@ -180,7 +180,7 @@ function channel_content(&$a, $update = 0, $load = false) { AND (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra ORDER BY created DESC", - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); $_SESSION['loadtime'] = datetime_convert(); } @@ -203,15 +203,15 @@ function channel_content(&$a, $update = 0, $load = false) { } $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); if($load || ($_COOKIE['jsAvailable'] != 1)) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", dbesc($mid), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); if (! $r) { notice( t('Permission denied.') . EOL); @@ -225,7 +225,7 @@ function channel_content(&$a, $update = 0, $load = false) { AND (abook_blocked = 0 or abook.abook_flags is null) $sql_extra $sql_extra2 ORDER BY created DESC $pager_sql ", - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); } } @@ -243,7 +243,7 @@ function channel_content(&$a, $update = 0, $load = false) { WHERE `item`.`uid` = %d $item_normal AND `item`.`parent` IN ( %s ) $sql_extra ", - intval($a->profile['profile_uid']), + intval(App::$profile['profile_uid']), dbesc($parents_str) ); @@ -266,19 +266,19 @@ function channel_content(&$a, $update = 0, $load = false) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. - $maxheight = get_pconfig($a->profile['profile_uid'],'system','channel_divmore_height'); + $maxheight = get_pconfig(App::$profile['profile_uid'],'system','channel_divmore_height'); if(! $maxheight) $maxheight = 400; $o .= '<div id="live-channel"></div>' . "\r\n"; - $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] - . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] + $o .= "<script> var profile_uid = " . App::$profile['profile_uid'] + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'channel', - '$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'), + '$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'), '$gid' => '0', '$cid' => '0', '$cmin' => '0', @@ -290,7 +290,7 @@ function channel_content(&$a, $update = 0, $load = false) { '$nouveau' => '0', '$wall' => '1', '$fh' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => '', '$order' => '', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), @@ -344,7 +344,7 @@ function channel_content(&$a, $update = 0, $load = false) { if((! $update) || ($_COOKIE['jsAvailable'] != 1)) { $o .= alt_pager($a,count($items)); if ($mid && $items[0]['title']) - $a->page['title'] = $items[0]['title'] . " - " . $a->page['title']; + App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; } if($mid) diff --git a/mod/chanview.php b/mod/chanview.php index 0cbcb2e57..705fb5a7d 100644 --- a/mod/chanview.php +++ b/mod/chanview.php @@ -5,7 +5,7 @@ require_once('include/zot.php'); function chanview_content(&$a) { - $observer = $a->get_observer(); + $observer = App::get_observer(); $xchan = null; $r = null; @@ -38,7 +38,7 @@ function chanview_content(&$a) { ); } if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } @@ -47,7 +47,7 @@ function chanview_content(&$a) { // address, we can and should try to import it. If it's just a hash, we can't continue, but we // probably wouldn't have a hash if we don't already have an xchan for this channel. - if(! $a->poi) { + if(! App::$poi) { logger('mod_chanview: fallback'); // This is hackish - construct a zot address from the url if($_REQUEST['url']) { @@ -67,13 +67,13 @@ function chanview_content(&$a) { dbesc($_REQUEST['address']) ); if($r) - $a->poi = $r[0]; + App::$poi = $r[0]; } } } - if(! $a->poi) { + if(! App::$poi) { // We don't know who this is, and we can't figure it out from the URL // On the plus side, there's a good chance we know somebody else at that // hub so sending them there with a Zid will probably work anyway. @@ -82,8 +82,8 @@ function chanview_content(&$a) { $url = zid($url); } - if ($a->poi) { - $url = $a->poi['xchan_url']; + if (App::$poi) { + $url = App::$poi['xchan_url']; if($observer) $url = zid($url); } diff --git a/mod/chat.php b/mod/chat.php index 682921ec2..211846964 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -10,7 +10,7 @@ function chat_init(&$a) { $which = argv(1); if(! $which) { if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_address']) $which = $channel['channel_address']; } @@ -21,14 +21,14 @@ function chat_init(&$a) { } $profile = 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); } - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content @@ -45,7 +45,7 @@ function chat_post(&$a) { if((! $room) || (! local_channel())) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_POST['action'] === 'drop') { @@ -86,16 +86,16 @@ function chat_post(&$a) { function chat_content(&$a) { if(local_channel()) - $channel = $a->get_channel(); + $channel = App::get_channel(); - $ob = $a->get_observer(); + $ob = App::get_observer(); $observer = get_observer_hash(); if(! $observer) { notice( t('Permission denied.') . EOL); return; } - if(! perm_is_allowed($a->profile['profile_uid'],$observer,'chat')) { + if(! perm_is_allowed(App::$profile['profile_uid'],$observer,'chat')) { notice( t('Permission denied.') . EOL); return; } @@ -159,7 +159,7 @@ function chat_content(&$a) { return; $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1", intval($room_id), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); if($x) { @@ -206,7 +206,7 @@ function chat_content(&$a) { require_once('include/conversation.php'); - $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); @@ -228,17 +228,17 @@ function chat_content(&$a) { )); } - $rooms = chatroom_list($a->profile['profile_uid']); + $rooms = chatroom_list(App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( - '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), + '$header' => sprintf( t('%1$s\'s Chatrooms'), App::$profile['name']), '$name' => t('Name'), '$baseurl' => z_root(), - '$nickname' => $a->profile['channel_address'], + '$nickname' => App::$profile['channel_address'], '$rooms' => $rooms, '$norooms' => t('No chatrooms available'), '$newroom' => t('Create New'), - '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0), + '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0), '$chatroom_new' => $chatroom_new, )); diff --git a/mod/chatsvc.php b/mod/chatsvc.php index bdf4a9f8c..4fa38e819 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -8,16 +8,16 @@ function chatsvc_init(&$a) { $ret = array('success' => false); - $a->data['chat']['room_id'] = intval($_REQUEST['room_id']); + App::$data['chat']['room_id'] = intval($_REQUEST['room_id']); $x = q("select cr_uid from chatroom where cr_id = %d and cr_id != 0 limit 1", - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['room_id']) ); if(! $x) json_return_and_die($ret); - $a->data['chat']['uid'] = $x[0]['cr_uid']; + App::$data['chat']['uid'] = $x[0]['cr_uid']; - if(! perm_is_allowed($a->data['chat']['uid'],get_observer_hash(),'chat')) { + if(! perm_is_allowed(App::$data['chat']['uid'],get_observer_hash(),'chat')) { json_return_and_die($ret); } @@ -27,22 +27,22 @@ function chatsvc_post(&$a) { $ret = array('success' => false); - $room_id = $a->data['chat']['room_id']; + $room_id = App::$data['chat']['room_id']; $text = escape_tags($_REQUEST['chat_text']); if(! $text) return; - $sql_extra = permissions_sql($a->data['chat']['uid']); + $sql_extra = permissions_sql(App::$data['chat']['uid']); $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", - intval($a->data['chat']['uid']), - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['uid']), + intval(App::$data['chat']['room_id']) ); if(! $r) json_return_and_die($ret); $arr = array( - 'chat_room' => $a->data['chat']['room_id'], + 'chat_room' => App::$data['chat']['room_id'], 'chat_xchan' => get_observer_hash(), 'chat_text' => $text ); @@ -51,7 +51,7 @@ function chatsvc_post(&$a) { $x = q("insert into chat ( chat_room, chat_xchan, created, chat_text ) values( %d, '%s', '%s', '%s' )", - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), dbesc(get_observer_hash()), dbesc(datetime_convert()), dbesc($arr['chat_text']) @@ -64,13 +64,13 @@ function chatsvc_post(&$a) { function chatsvc_content(&$a) { $status = strip_tags($_REQUEST['status']); - $room_id = intval($a->data['chat']['room_id']); + $room_id = intval(App::$data['chat']['room_id']); $stopped = ((x($_REQUEST,'stopped') && intval($_REQUEST['stopped'])) ? true : false); if($status && $room_id) { $x = q("select channel_address from channel where channel_id = %d limit 1", - intval($a->data['chat']['uid']) + intval(App::$data['chat']['uid']) ); $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", @@ -90,11 +90,11 @@ function chatsvc_content(&$a) { $ret = array('success' => false); - $sql_extra = permissions_sql($a->data['chat']['uid']); + $sql_extra = permissions_sql(App::$data['chat']['uid']); $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", - intval($a->data['chat']['uid']), - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['uid']), + intval(App::$data['chat']['room_id']) ); if(! $r) json_return_and_die($ret); @@ -102,7 +102,7 @@ function chatsvc_content(&$a) { $inroom = array(); $r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['room_id']) ); if($r) { foreach($r as $rr) { @@ -125,7 +125,7 @@ function chatsvc_content(&$a) { $chats = array(); $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created", - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), intval($lastseen) ); if($r) { @@ -146,7 +146,7 @@ function chatsvc_content(&$a) { $r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", dbesc(datetime_convert()), - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']) ); diff --git a/mod/cloud.php b/mod/cloud.php index dc3e11ef3..eed941ff7 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -30,7 +30,7 @@ function cloud_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n"; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n"; if ($which) profile_load($a, $which, $profile); @@ -41,7 +41,7 @@ function cloud_init(&$a) { if ($ob_hash) { if (local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $auth->setCurrentUser($channel['channel_address']); $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; @@ -77,7 +77,7 @@ function cloud_init(&$a) { if($_SERVER['REQUEST_METHOD'] === 'GET') { try { - $x = RedFileData('/' . $a->cmd, $auth); + $x = RedFileData('/' . App::$cmd, $auth); } catch(\Exception $e) { if($e instanceof Sabre\DAV\Exception\Forbidden) { diff --git a/mod/common.php b/mod/common.php index e19a9d3a9..3390bd997 100644 --- a/mod/common.php +++ b/mod/common.php @@ -8,7 +8,7 @@ function common_init(&$a) { $channel_id = intval(argv(1)); else { notice( t('No channel.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -25,27 +25,27 @@ function common_content(&$a) { $o = ''; - if(! $a->profile['profile_uid']) + if(! App::$profile['profile_uid']) return; $observer_hash = get_observer_hash(); - if(! perm_is_allowed($a->profile['profile_uid'],$observer_hash,'view_contacts')) { + if(! perm_is_allowed(App::$profile['profile_uid'],$observer_hash,'view_contacts')) { notice( t('Permission denied.') . EOL); return; } $o .= '<h2>' . t('Common connections') . '</h2>'; - $t = count_common_friends($a->profile['profile_uid'],$observer_hash); + $t = count_common_friends(App::$profile['profile_uid'],$observer_hash); if(! $t) { notice( t('No connections in common.') . EOL); return $o; } - $r = common_friends($a->profile['profile_uid'],$observer_hash); + $r = common_friends(App::$profile['profile_uid'],$observer_hash); if($r) { diff --git a/mod/connect.php b/mod/connect.php index c36aef433..84c67e4d2 100644 --- a/mod/connect.php +++ b/mod/connect.php @@ -11,7 +11,7 @@ function connect_init(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -20,20 +20,20 @@ function connect_init(&$a) { ); if($r) - $a->data['channel'] = $r[0]; + App::$data['channel'] = $r[0]; profile_load($a,$which,''); } function connect_post(&$a) { - if(! array_key_exists('channel', $a->data)) + if(! array_key_exists('channel', App::$data)) return; - $edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false); if($edit) { - $has_premium = (($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); + $has_premium = ((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); $premium = (($_POST['premium']) ? intval($_POST['premium']) : 0); $text = escape_tags($_POST['text']); @@ -43,25 +43,25 @@ function connect_post(&$a) { intval(PAGE_PREMIUM), intval(local_channel()) ); - proc_run('php','include/notifier.php','refresh_all',$a->data['channel']['channel_id']); + proc_run('php','include/notifier.php','refresh_all',App::$data['channel']['channel_id']); } - set_pconfig($a->data['channel']['channel_id'],'system','selltext',$text); + set_pconfig(App::$data['channel']['channel_id'],'system','selltext',$text); // reload the page completely to get fresh data - goaway(z_root() . '/' . $a->query_string); + goaway(z_root() . '/' . App::$query_string); } $url = ''; - $observer = $a->get_observer(); + $observer = App::get_observer(); if(($observer) && ($_POST['submit'] === t('Continue'))) { if($observer['xchan_follow']) - $url = sprintf($observer['xchan_follow'],urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname())); + $url = sprintf($observer['xchan_follow'],urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname())); if(! $url) { $r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1", dbesc($observer['xchan_hash']) ); if($r) - $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname()); + $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname()); } } if($url) @@ -75,16 +75,16 @@ function connect_post(&$a) { function connect_content(&$a) { - $edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false); - $text = get_pconfig($a->data['channel']['channel_id'],'system','selltext'); + $text = get_pconfig(App::$data['channel']['channel_id'],'system','selltext'); if($edit) { $o = replace_macros(get_markup_template('sellpage_edit.tpl'),array( '$header' => t('Premium Channel Setup'), - '$address' => $a->data['channel']['channel_address'], - '$premium' => array('premium', t('Enable premium channel connection restrictions'),(($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), + '$address' => App::$data['channel']['channel_address'], + '$premium' => array('premium', t('Enable premium channel connection restrictions'),((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), '$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'), '$text' => $text, '$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'), @@ -102,7 +102,7 @@ function connect_content(&$a) { $submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array( '$continue' => t('Continue'), - '$address' => $a->data['channel']['channel_address'] + '$address' => App::$data['channel']['channel_address'] )); $o = replace_macros(get_markup_template('sellpage_view.tpl'),array( @@ -115,7 +115,7 @@ function connect_content(&$a) { )); - $arr = array('channel' => $a->data['channel'],'observer' => $a->get_observer(), 'sellpage' => $o, 'submit' => $submit); + $arr = array('channel' => App::$data['channel'],'observer' => App::get_observer(), 'sellpage' => $o, 'submit' => $submit); call_hooks('connect_premium', $arr); $o = $arr['sellpage']; diff --git a/mod/connections.php b/mod/connections.php index 1de8279c4..992d485bd 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -13,7 +13,7 @@ function connections_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -40,7 +40,7 @@ function connections_content(&$a) { $all = false; if(! $_REQUEST['aj']) - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $search_flags = ''; $head = ''; @@ -82,14 +82,14 @@ function connections_content(&$a) { $head = t('New'); $pending = true; nav_set_selected('intros'); - $a->argv[1] = 'pending'; + App::$argv[1] = 'pending'; } else { $head = t('All'); $search_flags = ''; $all = true; - $a->argc = 1; - unset($a->argv[1]); + App::$argc = 1; + unset(App::$argv[1]); } nav_set_selected('intros'); break; @@ -211,15 +211,15 @@ function connections_content(&$a) { intval(local_channel()) ); if($r) { - $a->set_pager_total($r[0]['total']); + App::set_pager_total($r[0]['total']); $total = $r[0]['total']; } $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ", intval(local_channel()), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); $contacts = array(); @@ -304,7 +304,7 @@ function connections_content(&$a) { '$finding' => (($searching) ? t('Connections search') . ": '" . $search . "'" : ""), '$submit' => t('Find'), '$edit' => t('Edit'), - '$cmd' => $a->cmd, + '$cmd' => App::$cmd, '$contacts' => $contacts, '$paginate' => paginate($a), diff --git a/mod/connedit.php b/mod/connedit.php index 5d087a3b1..f57fdefc6 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -32,11 +32,11 @@ function connedit_init(&$a) { intval(argv(1)) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -55,7 +55,7 @@ function connedit_post(&$a) { if(! $contact_id) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the // connection enable is toggled to a special autopost url and set permissions immediately, leaving @@ -224,8 +224,8 @@ function connedit_post(&$a) { else notice( t('Failed to update connection record.') . EOL); - if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms - && (! intval($a->poi['abook_self']))) { + if(App::$poi && App::$poi['abook_my_perms'] != $abook_my_perms + && (! intval(App::$poi['abook_self']))) { proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id); } @@ -235,7 +235,7 @@ function connedit_post(&$a) { require_once('include/group.php'); $g = group_rec_byhash(local_channel(),$default_group); if($g) - group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']); + group_add_member(local_channel(),'',App::$poi['abook_xchan'],$g['id']); } // Check if settings permit ("post new friend activity" is allowed, and @@ -259,19 +259,19 @@ function connedit_post(&$a) { $xarr['item_private'] = (($xarr['allow_cid']||$xarr['allow_gid']||$xarr['deny_cid']||$xarr['deny_gid']) ? 1 : 0); $obj = array( 'type' => ACTIVITY_OBJ_PERSON, - 'title' => $a->poi['xchan_name'], - 'id' => $a->poi['xchan_hash'], + 'title' => App::$poi['xchan_name'], + 'id' => App::$poi['xchan_hash'], 'link' => array( - array('rel' => 'alternate', 'type' => 'text/html', 'href' => $a->poi['xchan_url']), - array('rel' => 'photo', 'type' => $a->poi['xchan_photo_mimetype'], 'href' => $a->poi['xchan_photo_l']) + array('rel' => 'alternate', 'type' => 'text/html', 'href' => App::$poi['xchan_url']), + array('rel' => 'photo', 'type' => App::$poi['xchan_photo_mimetype'], 'href' => App::$poi['xchan_photo_l']) ), ); $xarr['object'] = json_encode($obj); $xarr['obj_type'] = ACTIVITY_OBJ_PERSON; - $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . $a->poi['xchan_url'] . ']' . $a->poi['xchan_name'] . '[/zrl]'; + $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . App::$poi['xchan_url'] . ']' . App::$poi['xchan_name'] . '[/zrl]'; - $xarr['body'] .= "\n\n\n" . '[zrl=' . $a->poi['xchan_url'] . '][zmg=80x80]' . $a->poi['xchan_photo_m'] . '[/zmg][/zrl]'; + $xarr['body'] .= "\n\n\n" . '[zrl=' . App::$poi['xchan_url'] . '][zmg=80x80]' . App::$poi['xchan_photo_m'] . '[/zmg][/zrl]'; post_activity_item($xarr); @@ -292,11 +292,11 @@ function connedit_post(&$a) { intval($contact_id) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } if($new_friend) { - $arr = array('channel_id' => local_channel(), 'abook' => $a->poi); + $arr = array('channel_id' => local_channel(), 'abook' => App::$poi); call_hooks('accept_follow', $arr); } @@ -319,23 +319,23 @@ function connedit_post(&$a) { function connedit_clone(&$a) { - if(! $a->poi) + if(! App::$poi) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), - intval($a->poi['abook_id']) + intval(App::$poi['abook_id']) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } - $clone = $a->poi; + $clone = App::$poi; unset($clone['abook_id']); unset($clone['abook_account']); @@ -363,7 +363,7 @@ function connedit_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $my_perms = get_channel_default_perms(local_channel()); $role = get_pconfig(local_channel(),'system','permissions_role'); if($role) { @@ -417,7 +417,7 @@ function connedit_content(&$a) { if($cmd === 'refresh') { if($orig_record[0]['xchan_network'] === 'zot') { - if(! zot_refresh($orig_record[0],get_app()->get_channel())) + if(! zot_refresh($orig_record[0],App::get_channel())) notice( t('Refresh failed - channel is currently unavailable.') ); } else { @@ -505,10 +505,10 @@ function connedit_content(&$a) { } } - if($a->poi) { + if(App::$poi) { - $contact_id = $a->poi['abook_id']; - $contact = $a->poi; + $contact_id = App::$poi['abook_id']; + $contact = App::$poi; $buttons = array( @@ -645,7 +645,7 @@ function connedit_content(&$a) { $perms = array(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $global_perms = get_perms(); $existing = get_all_perms(local_channel(),$contact['abook_xchan']); diff --git a/mod/cover_photo.php b/mod/cover_photo.php index 9e7136c14..c99fdf7de 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -24,7 +24,7 @@ function cover_photo_init(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); profile_load($a,$channel['channel_address']); } @@ -42,7 +42,7 @@ function cover_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo'); @@ -155,7 +155,7 @@ function cover_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); send_cover_photo_activity($channel,$base_image,$profile); @@ -174,7 +174,7 @@ function cover_photo_post(&$a) { require_once('include/attach.php'); - $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); + $res = attach_store(App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); logger('attach_store: ' . print_r($res,true)); @@ -274,7 +274,7 @@ function cover_photo_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $newuser = false; @@ -341,12 +341,12 @@ function cover_photo_content(&$a) { } - if(! x($a->data,'imagecrop')) { + if(! x(App::$data,'imagecrop')) { $tpl = get_markup_template('cover_photo.tpl'); $o .= replace_macros($tpl,array( - '$user' => $a->channel['channel_address'], + '$user' => App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), '$title' => t('Upload Cover Photo'), @@ -354,7 +354,7 @@ function cover_photo_content(&$a) { '$profiles' => $profiles, '$form_security_token' => get_form_security_token("cover_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . $a->channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') )); call_hooks('cover_photo_content_end', $o); @@ -362,13 +362,13 @@ function cover_photo_content(&$a) { return $o; } else { - $filename = $a->data['imagecrop'] . '-3'; + $filename = App::$data['imagecrop'] . '-3'; $resolution = 3; $tpl = get_markup_template("cropcover.tpl"); $o .= replace_macros($tpl,array( '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), - '$resource' => $a->data['imagecrop'] . '-3', + '$resource' => App::$data['imagecrop'] . '-3', '$image_url' => z_root() . '/photo/' . $filename, '$title' => t('Crop Image'), '$desc' => t('Please adjust the image cropping for optimum viewing.'), @@ -409,9 +409,9 @@ function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ } - $a->data['imagecrop'] = $hash; - $a->data['imagecrop_resolution'] = $smallest; - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); + App::$data['imagecrop'] = $hash; + App::$data['imagecrop_resolution'] = $smallest; + App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); return; } diff --git a/mod/dav.php b/mod/dav.php index b745dbb5c..e2a857dca 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -49,7 +49,7 @@ function dav_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n"; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n"; if ($which) profile_load($a, $which, $profile); @@ -60,7 +60,7 @@ function dav_init(&$a) { if ($ob_hash) { if (local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $auth->setCurrentUser($channel['channel_address']); $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; @@ -107,7 +107,7 @@ function dav_init(&$a) { if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) { try { - $x = RedFileData('/' . $a->cmd, $auth); + $x = RedFileData('/' . App::$cmd, $auth); if($x instanceof Zotlabs\Storage\File) $isapublic_file = true; } diff --git a/mod/directory.php b/mod/directory.php index fe5799c88..79c03777e 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -6,7 +6,7 @@ require_once('include/widgets.php'); require_once('include/bbcode.php'); function directory_init(&$a) { - $a->set_pager_itemspage(60); + App::set_pager_itemspage(60); if(x($_GET,'ignore')) { q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", @@ -158,7 +158,7 @@ function directory_content(&$a) { $query .= '&t=' . $token; if(! $globaldir) - $query .= '&hub=' . get_app()->get_hostname(); + $query .= '&hub=' . App::get_hostname(); if($search) $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search); @@ -180,8 +180,8 @@ function directory_content(&$a) { if($sort_order) $query .= '&order=' . urlencode($sort_order); - if($a->pager['page'] != 1) - $query .= '&p=' . $a->pager['page']; + if(App::$pager['page'] != 1) + $query .= '&p=' . App::$pager['page']; logger('mod_directory: query: ' . $query); @@ -355,7 +355,7 @@ function directory_content(&$a) { ksort($entries); // Sort array by key so that foreach-constructs work as expected if($j['keywords']) { - $a->data['directory_keywords'] = $j['keywords']; + App::$data['directory_keywords'] = $j['keywords']; } logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); @@ -406,7 +406,7 @@ function directory_content(&$a) { echo $o; killme(); } - if($a->pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { + if(App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { goaway(z_root() . '/chanview/?f=&address=' . $search); } info( t("No entries (some entries may be hidden).") . EOL); diff --git a/mod/dirsearch.php b/mod/dirsearch.php index bc2fa108f..1273c5ccd 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -4,7 +4,7 @@ require_once('include/dir_fns.php'); function dirsearch_init(&$a) { - $a->set_pager_itemspage(60); + App::set_pager_itemspage(60); } @@ -166,7 +166,7 @@ function dirsearch_content(&$a) { $logic = 'true'; if($dirmode == DIRECTORY_MODE_STANDALONE) { - $sql_extra .= " and xchan_addr like '%%" . get_app()->get_hostname() . "' "; + $sql_extra .= " and xchan_addr like '%%" . App::get_hostname() . "' "; } $safesql = (($safe > 0) ? " and xchan_censored = 0 and xchan_selfcensored = 0 " : ''); diff --git a/mod/display.php b/mod/display.php index 40427846b..e4a6a0e66 100644 --- a/mod/display.php +++ b/mod/display.php @@ -21,7 +21,7 @@ function display_content(&$a, $update = 0, $load = false) { require_once('include/items.php'); - $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array()); + App::$page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array()); if(argc() > 1 && argv(1) !== 'load') $item_hash = argv(1); @@ -32,7 +32,7 @@ function display_content(&$a, $update = 0, $load = false) { if(! $item_hash) { - $a->error = 404; + App::$error = 404; notice( t('Item not found.') . EOL); return; } @@ -42,7 +42,7 @@ function display_content(&$a, $update = 0, $load = false) { if(local_channel() && (! $update)) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $channel_acl = array( @@ -127,9 +127,9 @@ function display_content(&$a, $update = 0, $load = false) { $o .= '<div id="live-display"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) - . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'display', '$uid' => '0', @@ -144,7 +144,7 @@ function display_content(&$a, $update = 0, $load = false) { '$fh' => '0', '$nouveau' => '0', '$wall' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', '$order' => '', @@ -169,7 +169,7 @@ function display_content(&$a, $update = 0, $load = false) { $updateable = false; - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']),intval($a->pager['start'])); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']),intval(App::$pager['start'])); if($load || ($_COOKIE['jsAvailable'] != 1)) { $r = null; @@ -292,7 +292,7 @@ function display_content(&$a, $update = 0, $load = false) { } else { $o .= conversation($a, $items, 'display', $update, 'traditional'); if ($items[0]['title']) - $a->page['title'] = $items[0]['title'] . " - " . $a->page['title']; + App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; } diff --git a/mod/dreport.php b/mod/dreport.php index 1ad1eca7c..4edec2e2b 100644 --- a/mod/dreport.php +++ b/mod/dreport.php @@ -9,7 +9,7 @@ function dreport_content(&$a) { $table = 'item'; - $channel = $a->get_channel(); + $channel = App::get_channel(); $mid = ((argc() > 1) ? argv(1) : ''); diff --git a/mod/editblock.php b/mod/editblock.php index a49beca3d..35922e483 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -8,7 +8,7 @@ function editblock_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,9 +25,9 @@ function editblock_init(&$a) { function editblock_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -36,11 +36,11 @@ function editblock_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -108,7 +108,7 @@ function editblock_content(&$a) { else $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', diff --git a/mod/editlayout.php b/mod/editlayout.php index 2c77a2381..9c27afa30 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -8,7 +8,7 @@ function editlayout_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -23,9 +23,9 @@ function editlayout_init(&$a) { function editlayout_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -34,11 +34,11 @@ function editlayout_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -102,7 +102,7 @@ function editlayout_content(&$a) { $plaintext = true; - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -167,7 +167,7 @@ function editlayout_content(&$a) { '$bang' => '', '$profile_uid' => (intval($owner)), '$jotplugins' => $jotplugins, - '$sourceapp' => t($a->sourcename), + '$sourceapp' => t(App::$sourcename), '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), diff --git a/mod/editpost.php b/mod/editpost.php index 7555ef37c..dffc9c0da 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -44,9 +44,9 @@ function editpost_content(&$a) { // if(feature_enabled(local_channel(),'richtext')) // $plaintext = false; - $channel = $a->get_channel(); + $channel = App::get_channel(); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -101,7 +101,7 @@ function editpost_content(&$a) { } } - $cipher = get_pconfig(get_app()->profile['profile_uid'],'system','default_cipher'); + $cipher = get_pconfig(App::$profile['profile_uid'],'system','default_cipher'); if(! $cipher) $cipher = 'aes256'; @@ -148,12 +148,12 @@ function editpost_content(&$a) { '$profile_uid' => $owner_uid, '$preview' => t('Preview'), '$jotplugins' => $jotplugins, - '$sourceapp' => t($a->sourcename), + '$sourceapp' => t(App::$sourcename), '$catsenabled' => $catsenabled, '$defexpire' => datetime_convert('UTC', date_default_timezone_get(),$itm[0]['expires']), - '$feature_expire' => ((feature_enabled(get_app()->profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false), + '$feature_expire' => ((feature_enabled(App::$profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false), '$expires' => t('Set expiration date'), - '$feature_encrypt' => ((feature_enabled(get_app()->profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false), + '$feature_encrypt' => ((feature_enabled(App::$profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false), '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), diff --git a/mod/editwebpage.php b/mod/editwebpage.php index f6cf22390..445c31ad4 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -8,7 +8,7 @@ function editwebpage_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -24,9 +24,9 @@ function editwebpage_init(&$a) { function editwebpage_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -35,11 +35,11 @@ function editwebpage_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -143,7 +143,7 @@ function editwebpage_content(&$a) { else $layoutselect = layout_select($itm[0]['uid'],$itm[0]['layout_mid']); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -211,7 +211,7 @@ function editwebpage_content(&$a) { '$profile_uid' => (intval($owner)), '$preview' => t('Preview'), '$jotplugins' => $jotplugins, - '$sourceapp' => $a->sourcename, + '$sourceapp' => App::$sourcename, '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), diff --git a/mod/events.php b/mod/events.php index 30c083e4f..30cf5f303 100755 --- a/mod/events.php +++ b/mod/events.php @@ -116,7 +116,7 @@ function events_post(&$a) { $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0); - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList(false); @@ -158,7 +158,7 @@ function events_post(&$a) { } $post_tags = array(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $ac = $acl->get(); if(strlen($categories)) { @@ -281,17 +281,17 @@ function events_content(&$a) { $first_day = (($first_day) ? $first_day : 0); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl,array( + App::$page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => z_root(), '$module_url' => '/events', '$modparams' => 1, - '$lang' => $a->language, + '$lang' => App::$language, '$first_day' => $first_day )); $o = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); $mode = 'view'; $y = 0; @@ -299,7 +299,7 @@ function events_content(&$a) { $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); - // logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r(App::$argv,true)); @@ -340,7 +340,7 @@ function events_content(&$a) { $orig_event = $r[0]; } - $channel = $a->get_channel(); + $channel = App::get_channel(); // Passed parameters overrides anything found in the DB if(!x($orig_event)) @@ -571,7 +571,7 @@ function events_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j; } } @@ -641,7 +641,7 @@ function events_content(&$a) { killme(); } - if ($a->argv[1] === 'json'){ + if (App::$argv[1] === 'json'){ echo json_encode($events); killme(); } diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 6ce1292c8..96e0fe953 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -15,19 +15,19 @@ function fbrowser_content($a){ if (!local_channel()) killme(); - if ($a->argc==1) + if (App::$argc==1) killme(); - //echo "<pre>"; var_dump($a->argv); killme(); + //echo "<pre>"; var_dump(App::$argv); killme(); - switch($a->argv[1]){ + switch(App::$argv[1]){ case "image": $path = array( array(z_root()."/fbrowser/image/", t("Photos"))); $albums = false; $sql_extra = ""; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; - if ($a->argc==2){ + if (App::$argc==2){ $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ", intval(local_channel()) ); @@ -38,11 +38,11 @@ function fbrowser_content($a){ } $album = ""; - if ($a->argc==3){ - $album = hex2bin($a->argv[2]); + if (App::$argc==3){ + $album = hex2bin(App::$argv[2]); $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra2 = ""; - $path[]=array(z_root()."/fbrowser/image/".$a->argv[2]."/", $album); + $path[]=array(z_root()."/fbrowser/image/".App::$argv[2]."/", $album); } $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description` @@ -80,7 +80,7 @@ function fbrowser_content($a){ break; case "file": - if ($a->argc==2){ + if (App::$argc==2){ $files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ", intval(local_channel()) ); @@ -89,7 +89,7 @@ function fbrowser_content($a){ list($m1,$m2) = explode("/",$rr['filetype']); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); - if($a->get_template_engine() === 'internal') { + if(App::get_template_engine() === 'internal') { $filename_e = template_escape($rr['filename']); } else { diff --git a/mod/fhublocs.php b/mod/fhublocs.php index dce00e383..7eab2b811 100644 --- a/mod/fhublocs.php +++ b/mod/fhublocs.php @@ -38,7 +38,7 @@ function fhublocs_content(&$a) { if($y) $primary_address = $y[0]['xchan_addr']; - $hub_address = $rr['channel']['channel_address'] . '@' . get_app()->get_hostname(); + $hub_address = $rr['channel']['channel_address'] . '@' . App::get_hostname(); $primary = (($hub_address === $primary_address) ? 1 : 0); @@ -57,11 +57,11 @@ function fhublocs_content(&$a) { dbesc($rr['channel_guid']), dbesc($rr['channel_guid_sig']), dbesc($rr['channel_hash']), - dbesc($rr['channel_address'] . '@' . get_app()->get_hostname()), + dbesc($rr['channel_address'] . '@' . App::get_hostname()), intval($primary), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))), - dbesc(get_app()->get_hostname()), + dbesc(App::get_hostname()), dbesc(z_root() . '/post'), dbesc($sitekey), dbesc('zot') diff --git a/mod/filer.php b/mod/filer.php index 8d69503b2..b09c73f0a 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -12,7 +12,7 @@ function filer_content(&$a) { } $term = unxmlify(trim($_GET['term'])); - $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + $item_id = ((App::$argc > 1) ? intval(App::$argv[1]) : 0); logger('filer: tag ' . $term . ' item ' . $item_id); diff --git a/mod/filerm.php b/mod/filerm.php index 6a6c4ff15..82eed83f8 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -13,7 +13,7 @@ function filerm_content(&$a) { if($category) $term = $cat; - $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + $item_id = ((App::$argc > 1) ? intval(App::$argv[1]) : 0); logger('filerm: tag ' . $term . ' item ' . $item_id); diff --git a/mod/filestorage.php b/mod/filestorage.php index 753300e89..1feffa9ee 100644 --- a/mod/filestorage.php +++ b/mod/filestorage.php @@ -28,7 +28,7 @@ function filestorage_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_REQUEST); @@ -52,7 +52,7 @@ function filestorage_content(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -64,7 +64,7 @@ function filestorage_content(&$a) { $owner = intval($r[0]['channel_id']); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); $perms = get_all_perms($owner, $ob_hash); @@ -100,7 +100,7 @@ function filestorage_content(&$a) { } $f = $r[0]; - $channel = $a->get_channel(); + $channel = App::get_channel(); $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); @@ -123,7 +123,7 @@ function filestorage_content(&$a) { ); $f = $r[0]; - $channel = $a->get_channel(); + $channel = App::get_channel(); $cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : ''); $parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']); diff --git a/mod/follow.php b/mod/follow.php index 73e87c16f..207a99dd7 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -14,7 +14,7 @@ function follow_init(&$a) { $return_url = $_SESSION['return_url']; $confirm = intval($_REQUEST['confirm']); - $channel = $a->get_channel(); + $channel = App::get_channel(); $result = new_contact($uid,$url,$channel,true,$confirm); diff --git a/mod/fsuggest.php b/mod/fsuggest.php index ec87af6ae..261679e6b 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -7,10 +7,10 @@ function fsuggest_post(&$a) { return; } - if($a->argc != 2) + if(App::$argc != 2) return; - $contact_id = intval($a->argv[1]); + $contact_id = intval(App::$argv[1]); $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), @@ -79,10 +79,10 @@ function fsuggest_content(&$a) { return; } - if($a->argc != 2) + if(App::$argc != 2) return; - $contact_id = intval($a->argv[1]); + $contact_id = intval(App::$argv[1]); $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), diff --git a/mod/group.php b/mod/group.php index defac572a..d5f2129bd 100644 --- a/mod/group.php +++ b/mod/group.php @@ -62,7 +62,7 @@ function group_post(&$a) { function group_content(&$a) { $change = false; - logger('mod_group: ' . $a->cmd,LOGGER_DEBUG); + logger('mod_group: ' . App::$cmd,LOGGER_DEBUG); if(! local_channel()) { notice( t('Permission denied') . EOL); diff --git a/mod/hcard.php b/mod/hcard.php index 8339fd013..9954e0838 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -6,12 +6,12 @@ function hcard_init(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $profile = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; @@ -25,14 +25,14 @@ function hcard_init(&$a) { $profile = $r[0]['profile_guid']; } - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)) ); if($x) { - $a->profile = $x[0]; + App::$profile = $x[0]; } } diff --git a/mod/help.php b/mod/help.php index 19bf251bd..a266dbf7f 100644 --- a/mod/help.php +++ b/mod/help.php @@ -13,7 +13,7 @@ function load_doc_file($s) { - $lang = get_app()->language; + $lang = App::$language; if(! isset($lang)) $lang = 'en'; $b = basename($s); @@ -39,8 +39,8 @@ function search_doc_files($s) { $a = get_app(); $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); $regexop = db_getfunc('REGEXP'); @@ -68,7 +68,7 @@ function search_doc_files($s) { $r[$x]['rank'] ++; $r[$x]['rank'] += substr_count(strtolower($r[$x]['text']),strtolower($s)); // bias the results to the observer's native language - if($r[$x]['lang'] === $a->language) + if($r[$x]['lang'] === App::$language) $r[$x]['rank'] = $r[$x]['rank'] + 10; } @@ -187,30 +187,30 @@ function help_content(&$a) { $title = basename($path); $text = load_doc_file('doc/' . $path . '.md'); - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); + App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); if(! $text) { $text = load_doc_file('doc/' . $path . '.bb'); if($text) $doctype = 'bbcode'; - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title))); + App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title))); } if(! $text) { $text = load_doc_file('doc/' . $path . '.html'); if($text) $doctype = 'html'; - $a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); + App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title))); } } if(! $text) { $text = load_doc_file('doc/Site.md'); - $a->page['title'] = t('Help'); + App::$page['title'] = t('Help'); } if(! $text) { $doctype = 'bbcode'; $text = load_doc_file('doc/main.bb'); - $a->page['title'] = t('Help'); + App::$page['title'] = t('Help'); } if(! strlen($text)) { diff --git a/mod/home.php b/mod/home.php index bfac17eab..478c764ea 100644 --- a/mod/home.php +++ b/mod/home.php @@ -12,7 +12,7 @@ function home_init(&$a) { $splash = ((argc() > 1 && argv(1) === 'splash') ? true : false); - $channel = $a->get_channel(); + $channel = App::get_channel(); if(local_channel() && $channel && $channel['xchan_url'] && ! $splash) { $dest = $channel['channel_startpage']; if(! $dest) @@ -53,8 +53,8 @@ function home_content(&$a, $update = 0, $load = false) { if(strpos($frontpage,'include:') !== false) { $file = trim(str_replace('include:' , '', $frontpage)); if(file_exists($file)) { - $a->page['template'] = 'full'; - $a->page['title'] = t('$Projectname'); + App::$page['template'] = 'full'; + App::$page['title'] = t('$Projectname'); $o .= file_get_contents($file); return $o; } @@ -76,7 +76,7 @@ function home_content(&$a, $update = 0, $load = false) { $loginbox = get_config('system','login_on_homepage'); if(intval($loginbox) || $loginbox === false) - $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); + $o .= login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); return $o; diff --git a/mod/hostxrd.php b/mod/hostxrd.php index 18066b7bf..0e19d8af6 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -7,7 +7,7 @@ function hostxrd_init(&$a) { $tpl = get_markup_template('xrd_host.tpl'); $x = replace_macros(get_markup_template('xrd_host.tpl'), array( - '$zhost' => $a->get_hostname(), + '$zhost' => App::get_hostname(), '$zroot' => z_root() )); $arr = array('xrd' => $x); diff --git a/mod/id.php b/mod/id.php index bd4c1fa89..382df45d8 100644 --- a/mod/id.php +++ b/mod/id.php @@ -46,12 +46,12 @@ function id_init(&$a) { if(argc() > 1) { $which = argv(1); } else { - $a->error = 404; + App::$error = 404; return; } $profile = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); profile_load($a,$which,$profile); $op = new MysqlProvider; @@ -69,7 +69,7 @@ function id_init(&$a) { function getUserData($handle = null) { if (! local_channel()) { notice( t('Permission denied.') . EOL); - get_app()->page['content'] = login(); + App::$page['content'] = login(); return false; } @@ -235,7 +235,7 @@ class MysqlProvider extends LightOpenIDProvider { . '<button name="cancel">cancel</button> ' . '</form>'; - get_app()->page['content'] .= $o; + App::$page['content'] .= $o; } function checkid($realm, &$attributes) { @@ -279,7 +279,7 @@ class MysqlProvider extends LightOpenIDProvider { function assoc_handle() { logger('assoc_handle'); - $channel = get_app()->get_channel(); + $channel = App::get_channel(); return z_root() . '/channel/' . $channel['channel_address']; } diff --git a/mod/impel.php b/mod/impel.php index da7138438..a0cb1d949 100644 --- a/mod/impel.php +++ b/mod/impel.php @@ -22,7 +22,7 @@ function impel_init(&$a) { if(! $j) json_return_and_die($ret); - $channel = $a->get_channel(); + $channel = App::get_channel(); $arr = array(); $is_menu = false; diff --git a/mod/import.php b/mod/import.php index 0e41d41f3..e0c2ffa82 100644 --- a/mod/import.php +++ b/mod/import.php @@ -149,7 +149,7 @@ function import_account(&$a, $account_id) { } if(! $channel) - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! $channel) { logger('mod_import: channel not found. ', print_r($channel,true)); @@ -205,12 +205,12 @@ function import_account(&$a, $account_id) { dbesc($channel['channel_guid']), dbesc($channel['channel_guid_sig']), dbesc($channel['channel_hash']), - dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), + dbesc($channel['channel_address'] . '@' . App::get_hostname()), dbesc('zot'), intval(($seize) ? 1 : 0), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey']))), - dbesc(get_app()->get_hostname()), + dbesc(App::get_hostname()), dbesc(z_root() . '/post'), dbesc(get_config('system','pubkey')) ); @@ -249,7 +249,7 @@ function import_account(&$a, $account_id) { dbesc(z_root() . "/photo/profile/l/" . $channel['channel_id']), dbesc(z_root() . "/photo/profile/m/" . $channel['channel_id']), dbesc(z_root() . "/photo/profile/s/" . $channel['channel_id']), - dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), + dbesc($channel['channel_address'] . '@' . App::get_hostname()), dbesc(z_root() . '/channel/' . $channel['channel_address']), dbesc(z_root() . '/follow?f=&url=%s'), dbesc(z_root() . '/poco/' . $channel['channel_address']), diff --git a/mod/import_items.php b/mod/import_items.php index f369ad780..df3afb3ea 100644 --- a/mod/import_items.php +++ b/mod/import_items.php @@ -84,7 +84,7 @@ function import_items_post(&$a) { } } - $channel = $a->get_channel(); + $channel = App::get_channel(); if(array_key_exists('item',$data) && $data['item']) { diff --git a/mod/invite.php b/mod/invite.php index 7f4df6cc8..2adad8257 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -53,10 +53,10 @@ function invite_post(&$a) { else $nmessage = $message; - $account = $a->get_account(); + $account = App::get_account(); - $res = mail($recip, sprintf( t('Please join us on $Projectname'), $a->config['sitename']), + $res = mail($recip, sprintf( t('Please join us on $Projectname'), App::$config['sitename']), $nmessage, "From: " . $account['account_email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" @@ -118,11 +118,11 @@ function invite_content(&$a) { } } - $ob = $a->get_observer(); + $ob = App::get_observer(); if(! $ob) return $o; - $channel = $a->get_channel(); + $channel = App::get_channel(); $o = replace_macros($tpl, array( '$form_security_token' => get_form_security_token("send_invite"), diff --git a/mod/item.php b/mod/item.php index b84a7ff8d..6e7c77a4d 100644 --- a/mod/item.php +++ b/mod/item.php @@ -192,7 +192,7 @@ function item_post(&$a) { } if(! $observer) - $observer = $a->get_observer(); + $observer = App::get_observer(); if($parent) { logger('mod_item: item_post parent=' . $parent); @@ -251,7 +251,7 @@ function item_post(&$a) { if(! $channel) { if($uid && $uid == $profile_uid) { - $channel = $a->get_channel(); + $channel = App::get_channel(); } else { // posting as yourself but not necessarily to a channel you control diff --git a/mod/layouts.php b/mod/layouts.php index fd77cfc37..dbb005e08 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -9,7 +9,7 @@ function layouts_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,24 +25,24 @@ function layouts_init(&$a) { function layouts_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $which = argv(1); - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -113,7 +113,7 @@ function layouts_content(&$a) { $x = array( 'webpage' => ITEM_TYPE_PDL, 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], + 'nickname' => App::$profile['channel_address'], 'bang' => '', 'showacl' => false, 'visitor' => false, diff --git a/mod/like.php b/mod/like.php index 9901c1cfa..0fbdd5c30 100755 --- a/mod/like.php +++ b/mod/like.php @@ -9,14 +9,14 @@ function like_content(&$a) { $o = ''; - $observer = $a->get_observer(); + $observer = App::get_observer(); $interactive = $_REQUEST['interactive']; if($interactive) { $o .= '<h1>' . t('Like/Dislike') . '</h1>'; $o .= EOL . EOL; if(! $observer) { - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $o .= t('This action is restricted to members.') . EOL; $o .= t('Please <a href="rmagic">login with your $Projectname ID</a> or <a href="register">register as a new $Projectname member</a> to continue.') . EOL; return $o; diff --git a/mod/locs.php b/mod/locs.php index 8452f62d1..1daf41b89 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -6,7 +6,7 @@ function locs_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_REQUEST['primary']) { $hubloc_id = intval($_REQUEST['primary']); @@ -84,7 +84,7 @@ function locs_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_REQUEST['sync']) { proc_run('php','include/notifier.php','location',$channel['channel_id']); diff --git a/mod/login.php b/mod/login.php index 12c7d339e..31a4e7fc0 100644 --- a/mod/login.php +++ b/mod/login.php @@ -3,5 +3,5 @@ function login_content(&$a) { if(local_channel()) goaway(z_root()); - return login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? false : true); + return login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? false : true); } diff --git a/mod/lostpass.php b/mod/lostpass.php index 9a52ac7a9..2ae955983 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -98,7 +98,7 @@ function lostpass_content(&$a) { $email_tpl = get_intltext_template("passchanged_eml.tpl"); $message = replace_macros($email_tpl, array( - '$sitename' => $a->config['sitename'], + '$sitename' => App::$config['sitename'], '$siteurl' => z_root(), '$username' => sprintf( t('Site Member (%s)'), $email), '$email' => $email, diff --git a/mod/magic.php b/mod/magic.php index 12679773b..2f746507b 100644 --- a/mod/magic.php +++ b/mod/magic.php @@ -128,7 +128,7 @@ function magic_init(&$a) { } if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $token = random_string(); $token_sig = base64url_encode(rsa_sign($token,$channel['channel_prvkey'])); @@ -142,7 +142,7 @@ function magic_init(&$a) { dbesc($x[0]['hubloc_url']), dbesc(datetime_convert()) ); - $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . $a->get_hostname()) + $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . App::get_hostname()) . '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION; if($delegate) diff --git a/mod/mail.php b/mod/mail.php index 32bb19952..1ab2bc5ab 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -26,7 +26,7 @@ function mail_post(&$a) { // finger them and find out before we try and send it. if(! $recipient) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $ret = zot_finger($rstr,$channel); @@ -96,8 +96,8 @@ function mail_post(&$a) { if(! $recipient) { notice('No recipient found.'); - $a->argc = 2; - $a->argv[1] = 'new'; + App::$argc = 2; + App::$argv[1] = 'new'; return; } @@ -127,7 +127,7 @@ function mail_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); head_set_icon($channel['xchan_photo_s']); @@ -203,7 +203,7 @@ function mail_content(&$a) { '$expireswhen' => t('Expires YYYY-MM-DD HH:MM') )); - $a->page['htmlhead'] .= $header; + App::$page['htmlhead'] .= $header; $prename = ''; $preid = ''; @@ -298,18 +298,18 @@ function mail_content(&$a) { } if($messages[0]['to_xchan'] === $channel['channel_hash']) - $a->poi = $messages[0]['from']; + App::$poi = $messages[0]['from']; else - $a->poi = $messages[0]['to']; + App::$poi = $messages[0]['to']; // require_once('include/Contact.php'); -// $a->set_widget('mail_conversant',vcard_from_xchan($a->poi,$get_observer_hash,'mail')); +// App::set_widget('mail_conversant',vcard_from_xchan(App::$poi,$get_observer_hash,'mail')); $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + App::$page['htmlhead'] .= replace_macros($tpl, array( '$nickname' => $channel['channel_address'], '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), diff --git a/mod/manage.php b/mod/manage.php index d769f0393..5ac3e6af8 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -29,7 +29,7 @@ function manage_content(&$a) { $r = change_channel($change_channel); if((argc() > 2) && !(argv(2) === 'default')) { - goaway(z_root() . '/' . implode('/',array_slice($a->argv,2))); // Go to whatever is after /manage/, but with the new channel + goaway(z_root() . '/' . implode('/',array_slice(App::$argv,2))); // Go to whatever is after /manage/, but with the new channel } else { if($r && $r['channel_startpage']) @@ -45,7 +45,7 @@ function manage_content(&$a) { intval(get_account_id()) ); - $account = get_app()->get_account(); + $account = App::get_account(); if($r && count($r)) { $channels = $r; diff --git a/mod/match.php b/mod/match.php index 60c281861..f7fc6cebd 100644 --- a/mod/match.php +++ b/mod/match.php @@ -17,7 +17,7 @@ function match_content(&$a) { if (! local_channel()) return; - $_SESSION['return_url'] = z_root() . '/' . $a->cmd; + $_SESSION['return_url'] = z_root() . '/' . App::$cmd; $o .= '<h2>' . t('Profile Match') . '</h2>'; @@ -37,8 +37,8 @@ function match_content(&$a) { if ($tags) { $params['s'] = $tags; - if ($a->pager['page'] != 1) - $params['p'] = $a->pager['page']; + if (App::$pager['page'] != 1) + $params['p'] = App::$pager['page']; // if(strlen(get_config('system','directory_submit_url'))) // $x = post_url('http://dir.friendica.com/msearch', $params); @@ -48,8 +48,8 @@ function match_content(&$a) { $j = json_decode($x); if ($j->total) { - $a->set_pager_total($j->total); - $a->set_pager_itemspage($j->items_page); + App::set_pager_total($j->total); + App::set_pager_itemspage($j->items_page); } if (count($j->results)) { diff --git a/mod/menu.php b/mod/menu.php index bfc45adef..e11483c2d 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -7,7 +7,7 @@ function menu_init(&$a) { if (array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); if ($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } } @@ -19,7 +19,7 @@ function menu_post(&$a) { if(array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); - $a->is_sys = true; + App::$is_sys = true; } if(! $uid) @@ -39,7 +39,7 @@ function menu_post(&$a) { if($r) { menu_sync_packet($uid,get_observer_hash(),$menu_id); //info( t('Menu updated.') . EOL); - goaway(z_root() . '/mitem/' . $menu_id . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $menu_id . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to update menu.'). EOL); @@ -50,7 +50,7 @@ function menu_post(&$a) { menu_sync_packet($uid,get_observer_hash(),$r); //info( t('Menu created.') . EOL); - goaway(z_root() . '/mitem/' . $r . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $r . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to create menu.'). EOL); @@ -65,7 +65,7 @@ function menu_content(&$a) { $uid = local_channel(); - if ($a->is_sys && is_site_admin()) { + if (App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); } @@ -95,7 +95,7 @@ function menu_content(&$a) { '$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow Bookmarks'), 0 , t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$submit' => t('Submit and proceed'), - '$sys' => $a->is_sys, + '$sys' => App::$is_sys, '$display' => 'none' )); @@ -115,7 +115,7 @@ function menu_content(&$a) { '$hintdrop' => t('Delete this menu'), '$hintcontent' => t('Edit menu contents'), '$hintedit' => t('Edit this menu'), - '$sys' => $a->is_sys + '$sys' => App::$is_sys )); return $o; @@ -131,7 +131,7 @@ function menu_content(&$a) { if(!$r) notice( t('Menu could not be deleted.'). EOL); - goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/menu' . ((App::$is_sys) ? '?f=&sys=1' : '')); } $m = menu_fetch_id(intval(argv(1)),$uid); @@ -143,9 +143,9 @@ function menu_content(&$a) { $o = replace_macros(get_markup_template('menuedit.tpl'), array( '$header' => t('Edit Menu'), - '$sys' => $a->is_sys, + '$sys' => App::$is_sys, '$menu_id' => intval(argv(1)), - '$menu_edit_link' => 'mitem/' . intval(argv(1)) . (($a->is_sys) ? '?f=&sys=1' : ''), + '$menu_edit_link' => 'mitem/' . intval(argv(1)) . ((App::$is_sys) ? '?f=&sys=1' : ''), '$hintedit' => t('Add or remove entries to this menu'), '$editcontents' => t('Edit menu contents'), '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), diff --git a/mod/message.php b/mod/message.php index a97ab5399..f6d1d020c 100644 --- a/mod/message.php +++ b/mod/message.php @@ -17,7 +17,7 @@ function message_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); head_set_icon($channel['xchan_photo_s']); $cipher = get_pconfig(local_channel(),'system','default_cipher'); @@ -56,7 +56,7 @@ function message_content(&$a) { // 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); diff --git a/mod/mitem.php b/mod/mitem.php index 7f582c649..5503e93f6 100644 --- a/mod/mitem.php +++ b/mod/mitem.php @@ -10,7 +10,7 @@ function mitem_init(&$a) { if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); - $a->is_sys = true; + App::$is_sys = true; } if(! $uid) @@ -24,7 +24,7 @@ function mitem_init(&$a) { notice( t('Menu not found.') . EOL); return ''; } - $a->data['menu'] = $m; + App::$data['menu'] = $m; } @@ -32,7 +32,7 @@ function mitem_post(&$a) { $uid = local_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); } @@ -41,7 +41,7 @@ function mitem_post(&$a) { return; } - if(! $a->data['menu']) + if(! App::$data['menu']) return; if(!$_REQUEST['mitem_desc'] || !$_REQUEST['mitem_link']) { @@ -50,7 +50,7 @@ function mitem_post(&$a) { } $_REQUEST['mitem_channel_id'] = $uid; - $_REQUEST['menu_id'] = $a->data['menu']['menu_id']; + $_REQUEST['menu_id'] = App::$data['menu']['menu_id']; $_REQUEST['mitem_flags'] = 0; if($_REQUEST['usezid']) @@ -66,7 +66,7 @@ function mitem_post(&$a) { if($r) { menu_sync_packet($uid,get_observer_hash(),$_REQUEST['menu_id']); //info( t('Menu element updated.') . EOL); - goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to update menu element.') . EOL); @@ -78,10 +78,10 @@ function mitem_post(&$a) { menu_sync_packet($uid,get_observer_hash(),$_REQUEST['menu_id']); //info( t('Menu element added.') . EOL); if($_REQUEST['submit']) { - goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/menu' . ((App::$is_sys) ? '?f=&sys=1' : '')); } if($_REQUEST['submit-more']) { - goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . '?f=&display=block' . (($a->is_sys) ? '&sys=1' : '') ); + goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . '?f=&display=block' . ((App::$is_sys) ? '&sys=1' : '') ); } } else @@ -95,12 +95,12 @@ function mitem_post(&$a) { function mitem_content(&$a) { $uid = local_channel(); - $channel = $a->get_channel(); - $observer = $a->get_observer(); + $channel = App::get_channel(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); $channel = $sys; @@ -112,13 +112,13 @@ function mitem_content(&$a) { return ''; } - if(argc() < 2 || (! $a->data['menu'])) { + if(argc() < 2 || (! App::$data['menu'])) { notice( t('Not found.') . EOL); return ''; } - $m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash); - $a->data['menu_item'] = $m; + $m = menu_fetch(App::$data['menu']['menu_name'],$uid,$ob_hash); + App::$data['menu_item'] = $m; $menu_list = menu_list($uid); @@ -133,7 +133,7 @@ function mitem_content(&$a) { if(argc() == 2) { $r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc", - intval($a->data['menu']['menu_id']), + intval(App::$data['menu']['menu_id']), intval($uid) ); @@ -145,7 +145,7 @@ function mitem_content(&$a) { } $create = replace_macros(get_markup_template('mitemedit.tpl'), array( - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($acl->get(),false), @@ -159,7 +159,7 @@ function mitem_content(&$a) { '$display' => $display, '$lockstate' => $lockstate, '$menu_names' => $menu_names, - '$sys' => $a->is_sys + '$sys' => App::$is_sys )); $o .= replace_macros(get_markup_template('mitemlist.tpl'),array( @@ -167,10 +167,10 @@ function mitem_content(&$a) { '$create' => $create, '$nametitle' => t('Link Name'), '$targettitle' => t('Link Target'), - '$menuname' => $a->data['menu']['menu_name'], - '$menudesc' => $a->data['menu']['menu_desc'], + '$menuname' => App::$data['menu']['menu_name'], + '$menudesc' => App::$data['menu']['menu_desc'], '$edmenu' => t('Edit menu'), - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$mlist' => $r, '$edit' => t('Edit element'), '$drop' => t('Drop element'), @@ -196,7 +196,7 @@ function mitem_content(&$a) { if(! $m) { notice( t('Menu item not found.') . EOL); - goaway(z_root() . '/menu'. (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/menu'. ((App::$is_sys) ? '?f=&sys=1' : '')); } $mitem = $m[0]; @@ -212,13 +212,13 @@ function mitem_content(&$a) { else notice( t('Menu item could not be deleted.'). EOL); - goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . ((App::$is_sys) ? '?f=&sys=1' : '')); } // edit menu item $o = replace_macros(get_markup_template('mitemedit.tpl'), array( '$header' => t('Edit Menu Element'), - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($mitem,false), diff --git a/mod/mood.php b/mod/mood.php index 92a4f391b..3ded65469 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -11,7 +11,7 @@ function mood_init(&$a) { return; $uid = local_channel(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $verb = notags(trim($_GET['verb'])); if(! $verb) @@ -56,7 +56,7 @@ function mood_init(&$a) { $deny_gid = $channel['channel_deny_gid']; } - $poster = $a->get_observer(); + $poster = App::get_observer(); $mid = item_message_id(); diff --git a/mod/network.php b/mod/network.php index 0def662cc..e195ac496 100644 --- a/mod/network.php +++ b/mod/network.php @@ -19,8 +19,8 @@ function network_init(&$a) { goaway('network' . '?f=&' . $network_options); } - $channel = $a->get_channel(); - $a->profile_uid = local_channel(); + $channel = App::get_channel(); + App::$profile_uid = local_channel(); head_set_icon($channel['xchan_photo_s']); } @@ -28,18 +28,18 @@ function network_init(&$a) { function network_content(&$a, $update = 0, $load = false) { if(! local_channel()) { - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; return login(false); } if($load) $_SESSION['loadtime'] = datetime_convert(); - $arr = array('query' => $a->query_string); + $arr = array('query' => App::$query_string); call_hooks('network_content_init', $arr); - $channel = $a->get_channel(); + $channel = App::get_channel(); $item_normal = item_normal(); $datequery = $datequery2 = ''; @@ -268,10 +268,10 @@ function network_content(&$a, $update = 0, $load = false) { $o .= '<div id="live-network"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . local_channel() - . "; var profile_page = " . $a->pager['page'] + . "; var profile_page = " . App::$pager['page'] . "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'network', '$uid' => ((local_channel()) ? local_channel() : '0'), @@ -287,7 +287,7 @@ function network_content(&$a, $update = 0, $load = false) { '$nouveau' => (($nouveau) ? $nouveau : '0'), '$wall' => '0', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($search) ? $search : ''), '$order' => $order, '$file' => $file, @@ -348,8 +348,8 @@ function network_content(&$a, $update = 0, $load = false) { } else { $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); } @@ -380,7 +380,7 @@ function network_content(&$a, $update = 0, $load = false) { require_once('include/identity.php'); $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $a->data['firehose'] = intval($sys['channel_id']); + App::$data['firehose'] = intval($sys['channel_id']); } else { $uids = " and item.uid = " . local_channel() . " "; diff --git a/mod/new_channel.php b/mod/new_channel.php index db5fff82a..f3b63b655 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -62,11 +62,11 @@ function new_channel_post(&$a) { $arr = $_POST; - $acc = $a->get_account(); + $acc = App::get_account(); $arr['account_id'] = get_account_id(); // prevent execution by delegated channels as well as those not logged in. - // get_account_id() returns the account_id from the session. But $a->account + // get_account_id() returns the account_id from the session. But App::$account // may point to the original authenticated account. if((! $acc) || ($acc['account_id'] != $arr['account_id'])) { @@ -94,7 +94,7 @@ function new_channel_post(&$a) { function new_channel_content(&$a) { - $acc = $a->get_account(); + $acc = App::get_account(); if((! $acc) || $acc['account_id'] != get_account_id()) { notice( t('Permission denied.') . EOL); @@ -122,7 +122,7 @@ function new_channel_content(&$a) { } $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); - $nickhub = '@' . get_app()->get_hostname(); + $nickhub = '@' . App::get_hostname(); $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>',get_roles()); diff --git a/mod/notifications.php b/mod/notifications.php index f6a75e2c0..45eb6483b 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -6,7 +6,7 @@ function notifications_post(&$a) { goaway(z_root()); } - $request_id = (($a->argc > 1) ? $a->argv[1] : 0); + $request_id = ((App::$argc > 1) ? App::$argv[1] : 0); if($request_id === "all") return; diff --git a/mod/oembed.php b/mod/oembed.php index d4a4424f5..a3ac8672d 100644 --- a/mod/oembed.php +++ b/mod/oembed.php @@ -2,7 +2,7 @@ require_once("include/oembed.php"); function oembed_init(&$a){ - // logger('mod_oembed ' . $a->query_string, LOGGER_ALL); + // logger('mod_oembed ' . App::$query_string, LOGGER_ALL); if(argc() > 1) { if (argv(1) == 'b2h'){ diff --git a/mod/oexchange.php b/mod/oexchange.php index d59a8d127..342b8c3cd 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -16,7 +16,7 @@ function oexchange_content(&$a) { if(! local_channel()) { if(remote_channel()) { - $observer = $a->get_observer(); + $observer = App::get_observer(); if($observer && $observer['xchan_url']) { $parsed = @parse_url($observer['xchan_url']); if(! $parsed) { diff --git a/mod/openid.php b/mod/openid.php index b9ca672a9..1ca1ba91e 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -66,9 +66,9 @@ function openid_content(&$a) { $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); - $a->set_observer($r[0]); + App::set_observer($r[0]); require_once('include/security.php'); - $a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); + App::set_groups(init_groups_visitor($_SESSION['visitor_id'])); info(sprintf( t('Welcome %s. Remote authentication successful.'),$r[0]['xchan_name'])); logger('mod_openid: remote auth success from ' . $r[0]['xchan_addr']); if($_SESSION['return_url']) @@ -175,7 +175,7 @@ function openid_content(&$a) { $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); - $a->set_observer($r[0]); + App::set_observer($r[0]); info(sprintf( t('Welcome %s. Remote authentication successful.'),$r[0]['xchan_name'])); logger('mod_openid: remote auth success from ' . $r[0]['xchan_addr']); if($_SESSION['return_url']) diff --git a/mod/opensearch.php b/mod/opensearch.php index 212773b96..19f7985c5 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -8,7 +8,7 @@ function opensearch_init(&$a) { $o = replace_macros($tpl, array( '$baseurl' => z_root(), - '$nodename' => $a->get_hostname(), + '$nodename' => App::get_hostname(), )); echo $o; diff --git a/mod/page.php b/mod/page.php index d4aefc1cd..c7b827e4d 100644 --- a/mod/page.php +++ b/mod/page.php @@ -13,21 +13,21 @@ function page_init(&$a) { - if($a->profile['profile_uid']) - head_set_icon($a->profile['thumb']); + if(App::$profile['profile_uid']) + head_set_icon(App::$profile['thumb']); // load the item here in the init function because we need to extract // the page layout and initialise the correct theme. - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); // perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'. // This bypasses that restriction for sys channel (public) content - if((! perm_is_allowed($a->profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel($a->profile['profile_uid']))) { + if((! perm_is_allowed(App::$profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel(App::$profile['profile_uid']))) { notice( t('Permission denied.') . EOL); return; } @@ -92,12 +92,12 @@ function page_init(&$a) { } if($r[0]['title']) - $a->page['title'] = escape_tags($r[0]['title']); + App::$page['title'] = escape_tags($r[0]['title']); if($r[0]['item_type'] == ITEM_TYPE_PDL) { require_once('include/comanche.php'); comanche_parser(get_app(),$r[0]['body']); - get_app()->pdl = $r[0]['body']; + App::$pdl = $r[0]['body']; } elseif($r[0]['layout_mid']) { $l = q("select body from item where mid = '%s' and uid = %d limit 1", @@ -108,11 +108,11 @@ function page_init(&$a) { if($l) { require_once('include/comanche.php'); comanche_parser(get_app(),$l[0]['body']); - get_app()->pdl = $l[0]['body']; + App::$pdl = $l[0]['body']; } } - $a->data['webpage'] = $r; + App::$data['webpage'] = $r; } @@ -121,7 +121,7 @@ function page_init(&$a) { function page_content(&$a) { - $r = $a->data['webpage']; + $r = App::$data['webpage']; if(! $r) return; @@ -136,7 +136,7 @@ function page_content(&$a) { $r = fetch_post_tags($r,true); if($r[0]['mimetype'] === 'application/x-pdl') - $a->page['pdl_content'] = true; + App::$page['pdl_content'] = true; $o .= prepare_page($r[0]); return $o; diff --git a/mod/pconfig.php b/mod/pconfig.php index 413dd2911..64fc1271c 100755 --- a/mod/pconfig.php +++ b/mod/pconfig.php @@ -68,7 +68,7 @@ function pconfig_content(&$a) { if(argc() == 2) { $content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL; load_pconfig(local_channel(),escape_tags(argv(1))); - foreach($a->config[local_channel()][escape_tags(argv(1))] as $k => $x) { + foreach(App::$config[local_channel()][escape_tags(argv(1))] as $k => $x) { $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . $k . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . ']</a> = ' . escape_tags($x) . EOL; } } diff --git a/mod/photo.php b/mod/photo.php index e8cd95f1c..93c6efa95 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -156,8 +156,8 @@ function photo_init(&$a) { ); if($r) { - logger('mod_photo: forbidden. ' . $a->query_string); - $observer = $a->get_observer(); + logger('mod_photo: forbidden. ' . App::$query_string); + $observer = App::get_observer(); logger('mod_photo: observer = ' . (($observer) ? $observer['xchan_addr'] : '(not authenticated)')); $data = file_get_contents('images/nosign.png'); $mimetype = 'image/png'; diff --git a/mod/photos.php b/mod/photos.php index ddacc38a3..0adbf752a 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -29,16 +29,16 @@ function photos_init(&$a) { if(! $channelx) return; - $a->data['channel'] = $channelx; + App::$data['channel'] = $channelx; - $observer = $a->get_observer(); - $a->data['observer'] = $observer; + $observer = App::get_observer(); + App::$data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - head_set_icon($a->data['channel']['xchan_photo_s']); + head_set_icon(App::$data['channel']['xchan_photo_s']); - $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . (($a->data['channel']) ? $a->data['channel']['channel_id'] : 0) . "; </script>" ; + App::$page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . ((App::$data['channel']) ? App::$data['channel']['channel_id'] : 0) . "; </script>" ; } @@ -61,7 +61,7 @@ function photos_post(&$a) { $can_post = false; - $page_owner_uid = $a->data['channel']['channel_id']; + $page_owner_uid = App::$data['channel']['channel_id']; if(perm_is_allowed($page_owner_uid,get_observer_hash(),'write_storage')) $can_post = true; @@ -85,7 +85,7 @@ function photos_post(&$a) { $owner_record = $s[0]; - $acl = new Zotlabs\Access\AccessList($a->data['channel']); + $acl = new Zotlabs\Access\AccessList(App::$data['channel']); if((argc() > 3) && (argv(2) === 'album')) { @@ -165,7 +165,7 @@ function photos_post(&$a) { } - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address']); } if((argc() > 2) && (x($_REQUEST,'delete')) && ($_REQUEST['delete'] === t('Delete Photo'))) { @@ -179,7 +179,7 @@ function photos_post(&$a) { $r = q("SELECT `id`, `resource_id` FROM `photo` WHERE ( xchan = '%s' or `uid` = %d ) AND `resource_id` = '%s' LIMIT 1", dbesc($ob_hash), intval(local_channel()), - dbesc($a->argv[2]) + dbesc(App::$argv[2]) ); if($r) { @@ -202,11 +202,11 @@ function photos_post(&$a) { */ } - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); } - if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { + if((App::$argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); @@ -218,7 +218,7 @@ function photos_post(&$a) { $acl->set_from_array($_POST); $perm = $acl->get(); - $resource_id = $a->argv[2]; + $resource_id = App::$argv[2]; if(! strlen($albname)) $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); @@ -349,7 +349,7 @@ function photos_post(&$a) { $visibility = 1; if(! $item_id) { - $item_id = photos_create_item($a->data['channel'],get_observer_hash(),$p[0],$visibility); + $item_id = photos_create_item(App::$data['channel'],get_observer_hash(),$p[0],$visibility); } @@ -401,7 +401,7 @@ function photos_post(&$a) { $rawtags = '@' . $rawtags; require_once('include/text.php'); - $profile_uid = $a->profile['profile_uid']; + $profile_uid = App::$profile['profile_uid']; $results = linkify_tags($a, $rawtags, (local_channel()) ? local_channel() : $profile_uid); @@ -450,8 +450,8 @@ function photos_post(&$a) { * default post action - upload a photo */ - $channel = $a->data['channel']; - $observer = $a->data['observer']; + $channel = App::$data['channel']; + $observer = App::$data['observer']; $_REQUEST['source'] = 'photos'; require_once('include/attach.php'); @@ -470,9 +470,9 @@ function photos_post(&$a) { } if($_REQUEST['newalbum']) - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); else - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); } @@ -497,7 +497,7 @@ function photos_content(&$a) { require_once('include/security.php'); require_once('include/conversation.php'); - if(! x($a->data,'channel')) { + if(! x(App::$data,'channel')) { notice( t('No photos selected') . EOL ); return; } @@ -505,13 +505,13 @@ function photos_content(&$a) { $ph = photo_factory(''); $phototypes = $ph->supportedTypes(); - $_SESSION['photo_return'] = $a->cmd; + $_SESSION['photo_return'] = App::$cmd; // // Parse arguments // - $can_comment = perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'post_comments'); + $can_comment = perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'post_comments'); if(argc() > 3) { $datatype = argv(2); @@ -538,10 +538,10 @@ function photos_content(&$a) { $visitor = 0; - $owner_uid = $a->data['channel']['channel_id']; - $owner_aid = $a->data['channel']['channel_account_id']; + $owner_uid = App::$data['channel']['channel_id']; + $owner_aid = App::$data['channel']['channel_account_id']; - $observer = $a->get_observer(); + $observer = App::get_observer(); $can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'write_storage'); $can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_storage'); @@ -555,13 +555,13 @@ function photos_content(&$a) { $o = ""; - $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] - . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; + $o .= "<script> var profile_uid = " . App::$profile['profile_uid'] + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n"; // tabs $_is_owner = (local_channel() && (local_channel() == $owner_uid)); - $o .= profile_tabs($a,$_is_owner, $a->data['channel']['channel_address']); + $o .= profile_tabs($a,$_is_owner, App::$data['channel']['channel_address']); /** * Display upload form @@ -571,7 +571,7 @@ function photos_content(&$a) { $uploader = ''; - $ret = array('post_url' => z_root() . '/photos/' . $a->data['channel']['channel_address'], + $ret = array('post_url' => z_root() . '/photos/' . App::$data['channel']['channel_address'], 'addon_text' => $uploader, 'default_upload' => true); @@ -580,11 +580,11 @@ function photos_content(&$a) { /* Show space usage */ $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", - intval($a->data['channel']['channel_account_id']) + intval(App::$data['channel']['channel_account_id']) ); - $limit = service_class_fetch($a->data['channel']['channel_id'],'photo_upload_limit'); + $limit = service_class_fetch(App::$data['channel']['channel_id'],'photo_upload_limit'); if($limit !== false) { $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 ); } @@ -593,7 +593,7 @@ function photos_content(&$a) { } if($_is_owner) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); @@ -613,10 +613,10 @@ function photos_content(&$a) { $selname = (($datum) ? hex2bin($datum) : ''); - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); if(! $selname) { - $def_album = get_pconfig($a->data['channel']['channel_id'],'system','photo_path'); + $def_album = get_pconfig(App::$data['channel']['channel_id'],'system','photo_path'); if($def_album) { $selname = filepath_macro($def_album); $albums['album'][] = array('text' => $selname); @@ -628,7 +628,7 @@ function photos_content(&$a) { '$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, - '$nickname' => $a->data['channel']['channel_address'], + '$nickname' => App::$data['channel']['channel_address'], '$newalbum_label' => t('Enter an album name'), '$newalbum_placeholder' => t('or select an existing album (doubleclick)'), '$visible' => array('visible', t('Create a status post for this upload'), 0,'', array(t('No'), t('Yes')), 'onclick="showHideBodyTextarea();"'), @@ -669,7 +669,7 @@ function photos_content(&$a) { $album = (($datum) ? hex2bin($datum) : ''); - $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$cmd) . '" title="oembed" />' . "\r\n"; $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' @@ -681,10 +681,10 @@ function photos_content(&$a) { intval($unsafe) ); if(count($r)) { - $a->set_pager_total(count($r)); - $a->set_pager_itemspage(60); + App::set_pager_total(count($r)); + App::set_pager_itemspage(60); } else { - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address']); } if($_GET['order'] === 'posted') @@ -702,8 +702,8 @@ function photos_content(&$a) { intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); //edit album name @@ -711,7 +711,7 @@ function photos_content(&$a) { if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { $album_e = $album; - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); // @fixme - syncronise actions with DAV @@ -719,7 +719,7 @@ function photos_content(&$a) { // $album_edit = replace_macros($edit_tpl,array( // '$nametext' => t('Enter a new album name'), // '$name_placeholder' => t('or select an existing one (doubleclick)'), -// '$nickname' => $a->data['channel']['channel_address'], +// '$nickname' => App::$data['channel']['channel_address'], // '$album' => $album_e, // '$albums' => $albums['albums'], // '$hexalbum' => bin2hex($album), @@ -731,9 +731,9 @@ function photos_content(&$a) { } if($_GET['order'] === 'posted') - $order = array(t('Show Newest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album)); + $order = array(t('Show Newest First'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($album)); else - $order = array(t('Show Oldest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); + $order = array(t('Show Oldest First'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); $photos = array(); if(count($r)) { @@ -750,7 +750,7 @@ function photos_content(&$a) { $imgalt_e = $rr['filename']; $desc_e = $rr['description']; - $imagelink = (z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] + $imagelink = (z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '')); $photos[] = array( @@ -790,7 +790,7 @@ function photos_content(&$a) { '$album_id' => bin2hex($album), '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, - '$upload' => array(t('Upload'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), + '$upload' => array(t('Upload'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, '$upload_form' => $upload_form, '$usage' => $usage_message @@ -816,7 +816,7 @@ function photos_content(&$a) { if($datatype === 'image') { - $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$cmd) . '" title="oembed" />' . "\r\n"; // fetch image, item containing image, then comments @@ -871,8 +871,8 @@ function photos_content(&$a) { } } - $prevlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); - $nextlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $prevlink = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $nextlink = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); } @@ -889,7 +889,7 @@ function photos_content(&$a) { } } - $album_link = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); + $album_link = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); $tools = Null; $lock = Null; @@ -906,12 +906,12 @@ function photos_content(&$a) { ? array('lock', t('Private Photo')) : array('unlock', Null)); - $a->page['htmlhead'] .= '<script>$(document).keydown(function(event) {' . "\n"; + App::$page['htmlhead'] .= '<script>$(document).keydown(function(event) {' . "\n"; if($prevlink) - $a->page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = \'' . $prevlink . '\'; }' . "\n"; + App::$page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = \'' . $prevlink . '\'; }' . "\n"; if($nextlink) - $a->page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = \'' . $nextlink . '\'; }' . "\n"; - $a->page['htmlhead'] .= '});</script>'; + App::$page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = \'' . $nextlink . '\'; }' . "\n"; + App::$page['htmlhead'] .= '});</script>'; if($prevlink) $prevlink = array($prevlink, t('Previous')); @@ -992,7 +992,7 @@ function photos_content(&$a) { $album_e = $ph[0]['album']; $caption_e = $ph[0]['description']; $aclselect_e = (($_is_owner) ? populate_acl($ph[0]) : ''); - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); $_SESSION['album_return'] = bin2hex($ph[0]['album']); @@ -1005,7 +1005,7 @@ function photos_content(&$a) { 'album' => $album_e, 'newalbum_label' => t('Enter a new album name'), 'newalbum_placeholder' => t('or select an existing one (doubleclick)'), - 'nickname' => $a->data['channel']['channel_address'], + 'nickname' => App::$data['channel']['channel_address'], 'resource_id' => $ph[0]['resource_id'], 'capt_label' => t('Caption'), 'caption' => $caption_e, @@ -1026,7 +1026,7 @@ function photos_content(&$a) { $cmnt_tpl = get_markup_template('comment_item.tpl'); $tpl = get_markup_template('photo_item.tpl'); - $return_url = $a->cmd; + $return_url = App::$cmd; $like_tpl = get_markup_template('like_noshare.tpl'); @@ -1233,7 +1233,7 @@ function photos_content(&$a) { '$paginate' => $paginate, )); - $a->data['photo_html'] = $o; + App::$data['photo_html'] = $o; return $o; } @@ -1241,12 +1241,12 @@ function photos_content(&$a) { // Default - show recent photos with upload link (if applicable) //$o = ''; - $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$cmd) . '" title="oembed" />' . "\r\n"; $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", - intval($a->data['channel']['channel_id']), + intval(App::$data['channel']['channel_id']), dbesc('Contact Photos'), dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), @@ -1254,8 +1254,8 @@ function photos_content(&$a) { intval($unsafe) ); if(count($r)) { - $a->set_pager_total(count($r)); - $a->set_pager_itemspage(60); + App::set_pager_total(count($r)); + App::set_pager_itemspage(60); } $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN @@ -1263,14 +1263,14 @@ function photos_content(&$a) { WHERE uid=%d AND album != '%s' AND album != '%s' AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra group by resource_id) ph ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", - intval($a->data['channel']['channel_id']), + intval(App::$data['channel']['channel_id']), dbesc('Contact Photos'), dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); @@ -1285,7 +1285,7 @@ function photos_content(&$a) { $twist = 'rotright'; $ext = $phototypes[$rr['type']]; - if($a->get_template_engine() === 'internal') { + if(App::get_template_engine() === 'internal') { $alt_e = template_escape($rr['filename']); $name_e = template_escape($rr['album']); } @@ -1297,12 +1297,12 @@ function photos_content(&$a) { $photos[] = array( 'id' => $rr['id'], 'twist' => ' ' . $twist . rand(2,4), - 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'], + 'link' => z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'], 'title' => t('View Photo'), 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, 'alt' => $alt_e, 'album' => array( - 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), + 'link' => z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), 'name' => $name_e, 'alt' => t('View Album'), ), @@ -1331,7 +1331,7 @@ function photos_content(&$a) { '$title' => t('Recent Photos'), '$album_id' => bin2hex(t('Recent Photos')), '$can_post' => $can_post, - '$upload' => array(t('Upload'), z_root().'/photos/'.$a->data['channel']['channel_address'].'/upload'), + '$upload' => array(t('Upload'), z_root().'/photos/'.App::$data['channel']['channel_address'].'/upload'), '$photos' => $photos, '$upload_form' => $upload_form, '$usage' => $usage_message diff --git a/mod/ping.php b/mod/ping.php index c93644317..32bc9753e 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -93,7 +93,7 @@ function ping_init(&$a) { $result['notice'] = array(); - if($a->install) { + if(App::$install) { echo json_encode($result); killme(); } @@ -240,7 +240,7 @@ function ping_init(&$a) { } if(argc() > 1 && argv(1) === 'messages') { - $channel = $a->get_channel(); + $channel = App::get_channel(); $t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan where channel_id = %d and mail_seen = 0 and mail_deleted = 0 and from_xchan != '%s' order by created desc limit 50", @@ -413,7 +413,7 @@ function ping_init(&$a) { } $t4 = dba_timer(); - $channel = get_app()->get_channel(); + $channel = App::get_channel(); if($vnotify & VNOTIFY_MAIL) { $mails = q("SELECT count(id) as total from mail @@ -426,7 +426,7 @@ function ping_init(&$a) { } if($vnotify & VNOTIFY_REGISTER) { - if ($a->config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) { + if (App::$config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) { $regs = q("SELECT count(account_id) as total from account where (account_flags & %d) > 0", intval(ACCOUNT_PENDING) ); diff --git a/mod/poke.php b/mod/poke.php index 15a69780c..7245ceee7 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -22,7 +22,7 @@ function poke_init(&$a) { return; $uid = local_channel(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $verb = notags(trim($_REQUEST['verb'])); diff --git a/mod/prate.php b/mod/prate.php index b89d16f42..2da6855dd 100644 --- a/mod/prate.php +++ b/mod/prate.php @@ -7,7 +7,7 @@ function prate_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = argv(1); if(! $target) @@ -27,7 +27,7 @@ function prate_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = trim($_REQUEST['target']); if(! $target) diff --git a/mod/probe.php b/mod/probe.php index 62a2227b0..6408a8c4f 100644 --- a/mod/probe.php +++ b/mod/probe.php @@ -13,7 +13,7 @@ function probe_content(&$a) { $o .= '<br /><br />'; if(x($_GET,'addr')) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $addr = trim($_GET['addr']); $do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false); $res = zot_finger($addr,$channel,false); diff --git a/mod/profile.php b/mod/profile.php index 3c9c7808d..09bcfd56a 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -14,12 +14,12 @@ function profile_init(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $profile = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; @@ -33,14 +33,14 @@ function profile_init(&$a) { $profile = $r[0]['profile_guid']; } - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; + App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ; if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)) ); if($x) { - $a->profile = $x[0]; + App::$profile = $x[0]; } } @@ -60,22 +60,22 @@ function profile_content(&$a, $update = 0) { $tab = 'profile'; $o = ''; - if(! (perm_is_allowed($a->profile['profile_uid'],get_observer_hash(), 'view_profile'))) { + if(! (perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(), 'view_profile'))) { notice( t('Permission denied.') . EOL); return; } - $is_owner = ((local_channel()) && (local_channel() == $a->profile['profile_uid']) ? true : false); + $is_owner = ((local_channel()) && (local_channel() == App::$profile['profile_uid']) ? true : false); - if($a->profile['hidewall'] && (! $is_owner) && (! remote_channel())) { + if(App::$profile['hidewall'] && (! $is_owner) && (! remote_channel())) { notice( t('Permission denied.') . EOL); return; } - $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o .= profile_tabs($a, $is_owner, App::$profile['channel_address']); - $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string) . '" title="oembed" />' . "\r\n"; $o .= advanced_profile($a); call_hooks('profile_advanced',$o); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 789989ff2..bac93555f 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -67,7 +67,7 @@ function profile_photo_init(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); profile_load($a,$channel['channel_address']); } @@ -171,7 +171,7 @@ function profile_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); // If setting for the default profile, unset the profile photo flag from any other photos I own @@ -236,7 +236,7 @@ function profile_photo_post(&$a) { require_once('include/attach.php'); - $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash)); + $res = attach_store(App::get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash)); logger('attach_store: ' . print_r($res,true)); @@ -290,7 +290,7 @@ function profile_photo_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $newuser = false; @@ -389,12 +389,12 @@ function profile_photo_content(&$a) { intval(local_channel()) ); - if(! x($a->data,'imagecrop')) { + if(! x(App::$data,'imagecrop')) { $tpl = get_markup_template('profile_photo.tpl'); $o .= replace_macros($tpl,array( - '$user' => $a->channel['channel_address'], + '$user' => App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), '$title' => t('Upload Profile Photo'), @@ -404,7 +404,7 @@ function profile_photo_content(&$a) { '$profile0' => $profiles[0], '$form_security_token' => get_form_security_token("profile_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . $a->channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') )); call_hooks('profile_photo_content_end', $o); @@ -412,13 +412,13 @@ function profile_photo_content(&$a) { return $o; } else { - $filename = $a->data['imagecrop'] . '-' . $a->data['imagecrop_resolution']; - $resolution = $a->data['imagecrop_resolution']; + $filename = App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution']; + $resolution = App::$data['imagecrop_resolution']; $tpl = get_markup_template("cropbody.tpl"); $o .= replace_macros($tpl,array( '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), - '$resource' => $a->data['imagecrop'] . '-' . $a->data['imagecrop_resolution'], + '$resource' => App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'], '$image_url' => z_root() . '/photo/' . $filename, '$title' => t('Crop Image'), '$desc' => t('Please adjust the image cropping for optimum viewing.'), @@ -459,9 +459,9 @@ function profile_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ } - $a->data['imagecrop'] = $hash; - $a->data['imagecrop_resolution'] = $smallest; - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); + App::$data['imagecrop'] = $hash; + App::$data['imagecrop_resolution'] = $smallest; + App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); return; } diff --git a/mod/profiles.php b/mod/profiles.php index fca2ff429..75c05b634 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -99,11 +99,11 @@ function profiles_init(&$a) { $name = t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval(local_channel()), - intval($a->argv[2]) + intval(App::$argv[2]) ); if(! count($r1)) { notice( t('Profile unavailable to clone.') . EOL); - $a->error = 404; + App::$error = 404; return; } unset($r1[0]['id']); @@ -144,7 +144,7 @@ function profiles_init(&$a) { ); if(! $r1) { notice( t('Profile unavailable to export.') . EOL); - $a->error = 404; + App::$error = 404; return; } header('content-type: application/octet_stream'); @@ -168,7 +168,7 @@ function profiles_init(&$a) { // we start loading content if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) { if(feature_enabled(local_channel(),'multi_profiles')) - $id = $a->argv[1]; + $id = App::$argv[1]; else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel()) @@ -182,11 +182,11 @@ function profiles_init(&$a) { ); if(! count($r)) { notice( t('Profile not found.') . EOL); - $a->error = 404; + App::$error = 404; return; } - $chan = $a->get_channel(); + $chan = App::get_channel(); profile_load($a,$chan['channel_address'],$r[0]['id']); } @@ -234,7 +234,7 @@ function profiles_post(&$a) { if((argc() > 1) && (argv(1) !== "new") && intval(argv(1))) { $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($a->argv[1]), + intval(App::$argv[1]), intval(local_channel()) ); if(! count($orig)) { @@ -563,7 +563,7 @@ function profiles_post(&$a) { build_sync_packet(local_channel(),array('profile' => $r)); } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($namechanged && $is_default) { $r = q("UPDATE xchan SET xchan_name = '%s', xchan_name_date = '%s' WHERE xchan_hash = '%s'", @@ -590,7 +590,7 @@ function profiles_content(&$a) { $o = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! local_channel()) { notice( t('Permission denied.') . EOL); @@ -604,7 +604,7 @@ function profiles_content(&$a) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) { if(feature_enabled(local_channel(),'multi_profiles')) - $id = $a->argv[1]; + $id = App::$argv[1]; else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel()) @@ -628,7 +628,7 @@ function profiles_content(&$a) { // if(feature_enabled(local_channel(),'richtext')) // $editselect = 'textareas'; - $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( '$baseurl' => z_root(), '$editselect' => $editselect, )); diff --git a/mod/profperm.php b/mod/profperm.php index 4556119a4..2e3f708c8 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -7,10 +7,10 @@ function profperm_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $which = $channel['channel_address']; - $profile = $a->argv[1]; + $profile = App::$argv[1]; profile_load($a,$which,$profile); diff --git a/mod/public.php b/mod/public.php index 45edda6c0..fd89e0776 100644 --- a/mod/public.php +++ b/mod/public.php @@ -26,10 +26,10 @@ function public_content(&$a, $update = 0, $load = false) { $o .= '<div id="live-public"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) - . "; var profile_page = " . $a->pager['page'] + . "; var profile_page = " . App::$pager['page'] . "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'public', '$uid' => ((local_channel()) ? local_channel() : '0'), @@ -45,7 +45,7 @@ function public_content(&$a, $update = 0, $load = false) { '$nouveau' => '0', '$wall' => '0', '$list' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => '', '$order' => 'comment', '$file' => '', @@ -63,8 +63,8 @@ function public_content(&$a, $update = 0, $load = false) { $pager_sql = ''; } else { - $a->set_pager_itemspage(20); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(20); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); } require_once('include/identity.php'); @@ -77,7 +77,7 @@ function public_content(&$a, $update = 0, $load = false) { $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $sql_extra = item_permissions_sql($sys['channel_id']); - $a->data['firehose'] = intval($sys['channel_id']); + App::$data['firehose'] = intval($sys['channel_id']); } if(get_config('system','public_list_mode')) diff --git a/mod/rate.php b/mod/rate.php index f30afed64..41e06e794 100644 --- a/mod/rate.php +++ b/mod/rate.php @@ -6,20 +6,20 @@ function rate_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = $_REQUEST['target']; if(! $target) return; - $a->data['target'] = $target; + App::$data['target'] = $target; if($target) { $r = q("SELECT * FROM xchan where xchan_hash like '%s' LIMIT 1", dbesc($target) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } else { $r = q("select * from site where site_url like '%s' and site_type = %d", @@ -27,8 +27,8 @@ function rate_init(&$a) { intval(SITE_TYPE_ZOT) ); if($r) { - $a->data['site'] = $r[0]; - $a->data['site']['site_url'] = strtolower($r[0]['site_url']); + App::$data['site'] = $r[0]; + App::$data['site']['site_url'] = strtolower($r[0]['site_url']); } } } @@ -44,13 +44,13 @@ function rate_post(&$a) { if(! local_channel()) return; - if(! $a->data['target']) + if(! App::$data['target']) return; if(! $_REQUEST['execute']) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $rating = intval($_POST['rating']); if($rating < (-10)) @@ -60,13 +60,13 @@ function rate_post(&$a) { $rating_text = trim(escape_tags($_REQUEST['rating_text'])); - $signed = $a->data['target'] . '.' . $rating . '.' . $rating_text; + $signed = App::$data['target'] . '.' . $rating . '.' . $rating_text; $sig = base64url_encode(rsa_sign($signed,$channel['channel_prvkey'])); $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($z) { @@ -83,7 +83,7 @@ function rate_post(&$a) { else { $w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), - dbesc($a->data['target']), + dbesc(App::$data['target']), intval($rating), dbesc($rating_text), dbesc($sig), @@ -91,7 +91,7 @@ function rate_post(&$a) { ); $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($z) $record = $z[0]['xlink_id']; @@ -112,7 +112,7 @@ function rate_content(&$a) { return; } -// if(! $a->data['target']) { +// if(! App::$data['target']) { // notice( t('No recipients.') . EOL); // return; // } @@ -123,14 +123,14 @@ function rate_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($r) { - $a->data['xlink'] = $r[0]; + App::$data['xlink'] = $r[0]; $rating_val = $r[0]['xlink_rating']; $rating_text = $r[0]['xlink_rating_text']; } @@ -156,9 +156,9 @@ function rate_content(&$a) { $o = replace_macros(get_markup_template('rating_form.tpl'),array( '$header' => t('Rating'), '$website' => t('Website:'), - '$site' => (($a->data['site']) ? '<a href="' . $a->data['site']['site_url'] . '" >' . $a->data['site']['site_url'] . '</a>' : ''), - 'target' => $a->data['target'], - '$tgt_name' => (($a->poi && $a->poi['xchan_name']) ? $a->poi['xchan_name'] : sprintf( t('Remote Channel [%s] (not yet known on this site)'), substr($a->data['target'],0,16))), + '$site' => ((App::$data['site']) ? '<a href="' . App::$data['site']['site_url'] . '" >' . App::$data['site']['site_url'] . '</a>' : ''), + 'target' => App::$data['target'], + '$tgt_name' => ((App::$poi && App::$poi['xchan_name']) ? App::$poi['xchan_name'] : sprintf( t('Remote Channel [%s] (not yet known on this site)'), substr(App::$data['target'],0,16))), '$lbl_rating' => t('Rating (this information is public)'), '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'), '$rating_txt' => $rating_text, diff --git a/mod/ratings.php b/mod/ratings.php index dc98eb238..d99be974c 100644 --- a/mod/ratings.php +++ b/mod/ratings.php @@ -49,23 +49,23 @@ function ratings_init(&$a) { } if(array_key_exists('xchan_hash',$results['target'])) - $a->poi = $results['target']; + App::$poi = $results['target']; $friends = array(); $others = array(); if($results['ratings']) { foreach($results['ratings'] as $n) { - if(is_array($a->contacts) && array_key_exists($n['xchan_hash'],$a->contacts)) + if(is_array(App::$contacts) && array_key_exists($n['xchan_hash'],App::$contacts)) $friends[] = $n; else $others[] = $n; } } - $a->data = array('target' => $results['target'], 'results' => array_merge($friends,$others)); + App::$data = array('target' => $results['target'], 'results' => array_merge($friends,$others)); - if(! $a->data['results']) { + if(! App::$data['results']) { notice( t('No ratings') . EOL); } @@ -91,8 +91,8 @@ function ratings_content(&$a) { if(! $poco_rating) return; - $site_target = ((array_key_exists('target',$a->data) && array_key_exists('site_url',$a->data['target'])) ? - '<a href="' . $a->data['target']['site_url'] . '" >' . $a->data['target']['site_url'] . '</a>' : ''); + $site_target = ((array_key_exists('target',App::$data) && array_key_exists('site_url',App::$data['target'])) ? + '<a href="' . App::$data['target']['site_url'] . '" >' . App::$data['target']['site_url'] . '</a>' : ''); $o = replace_macros(get_markup_template('prep.tpl'),array( @@ -101,7 +101,7 @@ function ratings_content(&$a) { '$website' => t('Website: '), '$site' => $site_target, '$rating_text_lbl' => t('Description: '), - '$raters' => $a->data['results'] + '$raters' => App::$data['results'] )); return $o; diff --git a/mod/rbmark.php b/mod/rbmark.php index 4401e3626..563b5cbd5 100644 --- a/mod/rbmark.php +++ b/mod/rbmark.php @@ -30,7 +30,7 @@ function rbmark_post(&$a) { logger('rbmark_post: ' . print_r($_REQUEST,true)); - $channel = $a->get_channel(); + $channel = App::get_channel(); $t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title'])); bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), @@ -75,7 +75,7 @@ function rbmark_content(&$a) { goaway(z_root() . '/bookmarks'); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $m = menu_list($channel['channel_id'],'',MENU_BOOKMARK); diff --git a/mod/regmod.php b/mod/regmod.php index a1d300e56..d500de0dc 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -5,11 +5,11 @@ function regmod_content(&$a) { global $lang; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; if(! local_channel()) { info( t('Please login.') . EOL); - $o .= '<br /><br />' . login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); + $o .= '<br /><br />' . login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); return $o; } diff --git a/mod/regver.php b/mod/regver.php index 78f146ec5..a26843376 100644 --- a/mod/regver.php +++ b/mod/regver.php @@ -4,7 +4,7 @@ function regver_content(&$a) { global $lang; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; if(argc() != 3) killme(); diff --git a/mod/removeaccount.php b/mod/removeaccount.php index 2752a2ee7..b4c2bad33 100644 --- a/mod/removeaccount.php +++ b/mod/removeaccount.php @@ -18,7 +18,7 @@ function removeaccount_post(&$a) { return; - $account = $a->get_account(); + $account = App::get_account(); $account_id = get_account_id(); if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) diff --git a/mod/removeme.php b/mod/removeme.php index 452ee5ef5..ab1d5fe4f 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -18,7 +18,7 @@ function removeme_post(&$a) { return; - $account = $a->get_account(); + $account = App::get_account(); if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) return; diff --git a/mod/rmagic.php b/mod/rmagic.php index 597c6ed9c..6a47b495a 100644 --- a/mod/rmagic.php +++ b/mod/rmagic.php @@ -14,7 +14,7 @@ function rmagic_init(&$a) { if($r) { if($r[0]['hubloc_url'] === z_root()) goaway(z_root() . '/login'); - $dest = z_root() . '/' . str_replace('zid=','zid_=',get_app()->query_string); + $dest = z_root() . '/' . str_replace('zid=','zid_=',App::$query_string); goaway($r[0]['hubloc_url'] . '/magic' . '?f=&dest=' . $dest); } } @@ -70,7 +70,7 @@ function rmagic_post(&$a) { if($_SESSION['return_url']) $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$_SESSION['return_url'])); else - $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$a->query_string)); + $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',App::$query_string)); goaway($url . '/magic' . '?f=&dest=' . $dest); } diff --git a/mod/rpost.php b/mod/rpost.php index 915b1ca96..bc9842b63 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -37,9 +37,9 @@ function rpost_content(&$a) { // by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin // blocks them. - $url = get_rpost_path($a->get_observer()); + $url = get_rpost_path(App::get_observer()); // make sure we're not looping to our own hub - if(($url) && (! stristr($url, $a->get_hostname()))) { + if(($url) && (! stristr($url, App::get_hostname()))) { foreach($_REQUEST as $key => $arg) { $url .= '&' . $key . '=' . $arg; } @@ -92,7 +92,7 @@ function rpost_content(&$a) { $_REQUEST['body'] = html2bbcode($_REQUEST['body']); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList($channel); diff --git a/mod/search.php b/mod/search.php index 555d46f6a..37bd00a66 100644 --- a/mod/search.php +++ b/mod/search.php @@ -2,7 +2,7 @@ function search_init(&$a) { if(x($_REQUEST,'search')) - $a->data['search'] = $_REQUEST['search']; + App::$data['search'] = $_REQUEST['search']; } @@ -30,7 +30,7 @@ function search_content(&$a,$update = 0, $load = false) { $update = $load = 1; } - $observer = $a->get_observer(); + $observer = App::get_observer(); $observer_hash = (($observer) ? $observer['xchan_hash'] : ''); $o = '<div id="live-search"></div>' . "\r\n"; @@ -39,8 +39,8 @@ function search_content(&$a,$update = 0, $load = false) { $o .= '<h3>' . t('Search') . '</h3>'; - if(x($a->data,'search')) - $search = trim($a->data['search']); + if(x(App::$data,'search')) + $search = trim(App::$data['search']); else $search = ((x($_GET,'search')) ? trim(rawurldecode($_GET['search'])) : ''); @@ -99,12 +99,12 @@ function search_content(&$a,$update = 0, $load = false) { $o .= '<div id="live-search"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) - . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'search', - '$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'), + '$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'), '$gid' => '0', '$cid' => '0', '$cmin' => '0', @@ -117,7 +117,7 @@ function search_content(&$a,$update = 0, $load = false) { '$nouveau' => '0', '$wall' => '0', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($tag) ? urlencode('#') : '') . $search, '$order' => '', '$file' => '', @@ -141,8 +141,8 @@ function search_content(&$a,$update = 0, $load = false) { if(($update) && ($load)) { $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); // in case somebody turned off public access to sys channel content with permissions diff --git a/mod/service_limits.php b/mod/service_limits.php index ac96668ab..8ce410ab6 100644 --- a/mod/service_limits.php +++ b/mod/service_limits.php @@ -8,7 +8,7 @@ function service_limits_content(&$a) { return; } - $account = $a->get_account(); + $account = App::get_account(); if($account['account_service_class']) { $x = get_config('service_class',$account['account_service_class']); if($x) { diff --git a/mod/settings.php b/mod/settings.php index d8aa069d0..dbb381191 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -4,7 +4,7 @@ require_once('include/zot.php'); function get_theme_config_file($theme){ - $base_theme = get_app()->theme_info['extends']; + $base_theme = App::$theme_info['extends']; if (file_exists("view/theme/$theme/php/config.php")){ return "view/theme/$theme/php/config.php"; @@ -22,14 +22,14 @@ function settings_init(&$a) { if($_SESSION['delegate']) return; - $a->profile_uid = local_channel(); + App::$profile_uid = local_channel(); // default is channel settings in the absence of other arguments if(argc() == 1) { // We are setting these values - don't use the argc(), argv() functions here - $a->argc = 2; - $a->argv[] = 'channel'; + App::$argc = 2; + App::$argv[] = 'channel'; } @@ -45,7 +45,7 @@ function settings_post(&$a) { if($_SESSION['delegate']) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); logger('mod_settings: ' . print_r($_REQUEST,true)); @@ -153,7 +153,7 @@ function settings_post(&$a) { check_form_security_token_redirectOnErr('/settings/display', 'settings_display'); - $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->channel['channel_theme']); + $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : App::$channel['channel_theme']); $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); $preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); @@ -196,7 +196,7 @@ function settings_post(&$a) { set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); - if ($theme == $a->channel['channel_theme']){ + if ($theme == App::$channel['channel_theme']){ // call theme_post only if theme has not been changed if( ($themeconfigfile = get_theme_config_file($theme)) != null){ require_once($themeconfigfile); @@ -226,14 +226,14 @@ function settings_post(&$a) { $errs = array(); $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); - $account = $a->get_account(); + $account = App::get_account(); if($email != $account['account_email']) { if(! valid_email($email)) $errs[] = t('Not valid email.'); $adm = trim(get_config('system','admin_email')); if(($adm) && (strcasecmp($email,$adm) == 0)) { $errs[] = t('Protected email address. Cannot change to that email.'); - $email = $a->user['email']; + $email = App::$user['email']; } if(! $errs) { $r = q("update account set account_email = '%s' where account_id = %d", @@ -428,7 +428,7 @@ function settings_post(&$a) { $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0); - $channel = $a->get_channel(); + $channel = App::get_channel(); $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); if($adult != $existing_adult) @@ -482,7 +482,7 @@ function settings_post(&$a) { $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); $err = ''; @@ -556,7 +556,7 @@ function settings_post(&$a) { //$_SESSION['theme'] = $theme; - if($email_changed && $a->config['system']['register_policy'] == REGISTER_VERIFY) { + if($email_changed && App::$config['system']['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout // Why? Are we verifying people or email addresses? @@ -581,7 +581,7 @@ function settings_content(&$a) { } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -697,7 +697,7 @@ function settings_content(&$a) { call_hooks('account_settings', $account_settings); - $email = $a->account['account_email']; + $email = App::$account['account_email']; $tpl = get_markup_template("settings_account.tpl"); @@ -890,7 +890,7 @@ function settings_content(&$a) { load_pconfig(local_channel(),'expire'); - $channel = $a->get_channel(); + $channel = App::get_channel(); $global_perms = get_perms(); @@ -935,8 +935,8 @@ function settings_content(&$a) { $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT); $sys_expire = get_config('system','default_expire_days'); -// $unkmail = $a->user['unkmail']; -// $cntunkmail = $a->user['cntunkmail']; +// $unkmail = App::$user['unkmail']; +// $cntunkmail = App::$user['cntunkmail']; $hide_presence = intval(get_pconfig(local_channel(), 'system','hide_online_status')); @@ -989,7 +989,7 @@ function settings_content(&$a) { )); - $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . z_root() . '/channel/' . $nickname : ''); + $subdir = ((strlen(App::get_path())) ? '<br />' . t('or') . ' ' . z_root() . '/channel/' . $nickname : ''); $tpl_addr = get_markup_template("settings_nick_set.tpl"); @@ -997,7 +997,7 @@ function settings_content(&$a) { '$desc' => t('Your channel address is'), '$nickname' => $nickname, '$subdir' => $subdir, - '$basepath' => $a->get_hostname() + '$basepath' => App::get_hostname() )); $stpl = get_markup_template('settings.tpl'); diff --git a/mod/setup.php b/mod/setup.php index 84fb752c3..5dccc1711 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -60,7 +60,7 @@ function setup_post(&$a) { return; break; // just in case return don't return :) case 3: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = trim($_POST['dbhost']); $dbport = intval(trim($_POST['dbport'])); $dbuser = trim($_POST['dbuser']); @@ -83,7 +83,7 @@ function setup_post(&$a) { if(! $db->connected) { echo 'Database Connect failed: ' . $db->error; killme(); - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; } /*if(get_db_errno()) { unset($db); @@ -97,10 +97,10 @@ function setup_post(&$a) { unset($db); $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true); } else { - $a->data['db_create_failed']=true; + App::$data['db_create_failed']=true; } } else { - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; return; } }*/ @@ -111,7 +111,7 @@ function setup_post(&$a) { return; break; case 4: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = notags(trim($_POST['dbhost'])); $dbport = intval(notags(trim($_POST['dbport']))); $dbuser = notags(trim($_POST['dbuser'])); @@ -127,8 +127,8 @@ function setup_post(&$a) { if($siteurl != z_root()) { $test = z_fetch_url($siteurl."/setup/testrewrite"); if((! $test['success']) || ($test['body'] != 'ok')) { - $a->data['url_fail'] = true; - $a->data['url_error'] = $test['error']; + App::$data['url_fail'] = true; + App::$data['url_error'] = $test['error']; return; } } @@ -159,15 +159,15 @@ function setup_post(&$a) { $result = file_put_contents('.htconfig.php', $txt); if(! $result) { - $a->data['txt'] = $txt; + App::$data['txt'] = $txt; } $errors = load_database($db); if($errors) - $a->data['db_failed'] = $errors; + App::$data['db_failed'] = $errors; else - $a->data['db_installed'] = true; + App::$data['db_installed'] = true; return; break; @@ -196,31 +196,31 @@ function setup_content(&$a) { $wizard_status = ''; $install_title = t('$Projectname Server - Setup'); - if(x($a->data, 'db_conn_failed')) { + if(x(App::$data, 'db_conn_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not connect to database.'); } - if(x($a->data, 'url_fail')) { + if(x(App::$data, 'url_fail')) { $install_wizard_pass = 3; $wizard_status = t('Could not connect to specified site URL. Possible SSL certificate or DNS issue.'); - if($a->data['url_error']) - $wizard_status .= ' ' . $a->data['url_error']; + if(App::$data['url_error']) + $wizard_status .= ' ' . App::$data['url_error']; } - if(x($a->data, 'db_create_failed')) { + if(x(App::$data, 'db_create_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not create table.'); } $db_return_text = ''; - if(x($a->data, 'db_installed')) { + if(x(App::$data, 'db_installed')) { $txt = '<p style="font-size: 130%;">'; $txt .= t('Your site database has been installed.') . EOL; $db_return_text .= $txt; } - if(x($a->data, 'db_failed')) { + if(x(App::$data, 'db_failed')) { $txt = t('You may need to import the file "install/schema_xxx.sql" manually using a database client.') . EOL; $txt .= t('Please see the file "install/INSTALL.txt".') . EOL ."<hr>" ; - $txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL ; + $txt .= "<pre>".App::$data['db_failed'] . "</pre>". EOL ; $db_return_text .= $txt; } if($db && $db->connected) { @@ -236,7 +236,7 @@ function setup_content(&$a) { } } - if(x($a->data, 'txt') && strlen($a->data['txt'])) { + if(x(App::$data, 'txt') && strlen(App::$data['txt'])) { $db_return_text .= manual_config($a); } @@ -676,7 +676,7 @@ function check_htaccess(&$checks) { function manual_config(&$a) { - $data = htmlspecialchars($a->data['txt'], ENT_COMPAT, 'UTF-8'); + $data = htmlspecialchars(App::$data['txt'], ENT_COMPAT, 'UTF-8'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>"; diff --git a/mod/share.php b/mod/share.php index 198a6b210..c9adaf094 100644 --- a/mod/share.php +++ b/mod/share.php @@ -69,7 +69,7 @@ function share_init(&$a) { killme(); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $parsed = $observer['xchan_url']; if($parsed) { $post_url = $parsed['scheme'] . ':' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : '') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index bee072ea7..27c238270 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -8,7 +8,7 @@ function sharedwithme_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $is_owner = (local_channel() && (local_channel() == $channel['channel_id'])); diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 19b566b73..7711fafb2 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -24,7 +24,7 @@ function siteinfo_content(&$a) { $version = $commit = ''; } $visible_plugins = array(); - if(is_array($a->plugins) && count($a->plugins)) { + if(is_array(App::$plugins) && count(App::$plugins)) { $r = q("select * from addon where hidden = 0"); if(count($r)) foreach($r as $rr) diff --git a/mod/smilies.php b/mod/smilies.php index b22d0c6d2..2ccc007b4 100644 --- a/mod/smilies.php +++ b/mod/smilies.php @@ -1,7 +1,7 @@ <?php function smilies_content(&$a) { - if ($a->argv[1]==="json"){ + if (App::$argv[1]==="json"){ $tmp = list_smilies(); $results = array(); for($i = 0; $i < count($tmp['texts']); $i++) { diff --git a/mod/sources.php b/mod/sources.php index 0aaaa82b1..6ea0743aa 100644 --- a/mod/sources.php +++ b/mod/sources.php @@ -14,7 +14,7 @@ function sources_post(&$a) { $frequency = $_REQUEST['frequency']; $name = $_REQUEST['name']; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($name == '*') $xchan = '*'; diff --git a/mod/subthread.php b/mod/subthread.php index 9438b545c..aca034d43 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -37,7 +37,7 @@ function subthread_content(&$a) { $item = $r[0]; $owner_uid = $item['uid']; - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); if(! perm_is_allowed($owner_uid,$ob_hash,'post_comments')) diff --git a/mod/suggest.php b/mod/suggest.php index ebe0e0f78..ca888310a 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -27,7 +27,7 @@ function suggest_content(&$a) { return; } - $_SESSION['return_url'] = z_root() . '/' . $a->cmd; + $_SESSION['return_url'] = z_root() . '/' . App::$cmd; $r = suggestion_query(local_channel(),get_observer_hash()); diff --git a/mod/tagger.php b/mod/tagger.php index eba02c9c4..330b65b91 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -100,7 +100,7 @@ function tagger_content(&$a) { $termlink = html_entity_decode('⋕') . '[zrl=' . z_root() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; - $channel = $a->get_channel(); + $channel = App::get_channel(); $arr = array(); diff --git a/mod/tasks.php b/mod/tasks.php index b1b81473b..e11166f93 100644 --- a/mod/tasks.php +++ b/mod/tasks.php @@ -37,7 +37,7 @@ function tasks_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((argc() > 2) && (argv(1) === 'complete') && intval(argv(2))) { $ret = array('success' => false); diff --git a/mod/thing.php b/mod/thing.php index 7e7d1bdc7..44e9d9e2e 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -14,7 +14,7 @@ function thing_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : ''); @@ -264,7 +264,7 @@ function thing_content(&$a) { } } - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! (local_channel() && $channel)) { notice( t('Permission denied.') . EOL); diff --git a/mod/uexport.php b/mod/uexport.php index ee22383a3..4a16903f8 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -5,7 +5,7 @@ function uexport_init(&$a) { killme(); if(argc() > 1) { - $channel = $a->get_channel(); + $channel = App::get_channel(); require_once('include/identity.php'); diff --git a/mod/view.php b/mod/view.php index d4381743c..f18646cb9 100644 --- a/mod/view.php +++ b/mod/view.php @@ -1,6 +1,6 @@ <?php /** - * load view/theme/$current_theme/style.php with Red context + * load view/theme/$current_theme/style.php with Hubzilla context */ function view_init($a){ diff --git a/mod/viewconnections.php b/mod/viewconnections.php index d9a9aecc1..6e0daab6e 100644 --- a/mod/viewconnections.php +++ b/mod/viewconnections.php @@ -18,21 +18,21 @@ function viewconnections_content(&$a) { return; } - if(((! count($a->profile)) || ($a->profile['hide_friends']))) { + if(((! count(App::$profile)) || (App::$profile['hide_friends']))) { notice( t('Permission denied.') . EOL); return; } - if(! perm_is_allowed($a->profile['uid'], get_observer_hash(),'view_contacts')) { + if(! perm_is_allowed(App::$profile['uid'], get_observer_hash(),'view_contacts')) { notice( t('Permission denied.') . EOL); return; } if(! $_REQUEST['aj']) - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; - $is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false); + $is_owner = ((local_channel() && local_channel() == App::$profile['uid']) ? true : false); $abook_flags = " and abook_pending = 0 and abook_self = 0 "; $sql_extra = ''; @@ -43,16 +43,16 @@ function viewconnections_content(&$a) { } $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $abook_flags and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra ", - intval($a->profile['uid']) + intval(App::$profile['uid']) ); if($r) { - $a->set_pager_total($r[0]['total']); + App::set_pager_total($r[0]['total']); } $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $abook_flags and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra order by xchan_name LIMIT %d OFFSET %d ", - intval($a->profile['uid']), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$profile['uid']), + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); if((! $r) && (! $_REQUEST['aj'])) { diff --git a/mod/viewsrc.php b/mod/viewsrc.php index cffb01b6e..a4efd1214 100644 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -16,7 +16,7 @@ function viewsrc_content(&$a) { if(! $item_id) { - $a->error = 404; + App::$error = 404; notice( t('Item not found.') . EOL); } diff --git a/mod/wall_attach.php b/mod/wall_attach.php index f52a4f2e5..75786b479 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -8,9 +8,9 @@ function wall_attach_post(&$a) { $using_api = false; - if($a->data['api_info'] && array_key_exists('media',$_FILES)) { + if(App::$data['api_info'] && array_key_exists('media',$_FILES)) { $using_api = true; - $user_info = $a->data['api_info']; + $user_info = App::$data['api_info']; $nick = $user_info['screen_name']; $channel = get_channel_by_nick($user_info['screen_name']); } @@ -20,7 +20,7 @@ function wall_attach_post(&$a) { if(! $channel) killme(); - $observer = $a->get_observer(); + $observer = App::get_observer(); // if($_FILES['userfile']['tmp_name']) { diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 31a497f0f..54e2f8526 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -30,7 +30,7 @@ function wall_upload_post(&$a) { killme(); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])); diff --git a/mod/webpages.php b/mod/webpages.php index 6b157073e..2196eb9fc 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -9,7 +9,7 @@ function webpages_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,24 +25,24 @@ function webpages_init(&$a) { function webpages_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $which = argv(1); - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -84,8 +84,8 @@ function webpages_content(&$a) { // Nickname is set to the observers xchan, and profile_uid to the owner's. // This lets you post pages at other people's channels. - if((! $channel) && ($uid) && ($uid == $a->profile_uid)) { - $channel = $a->get_channel(); + if((! $channel) && ($uid) && ($uid == App::$profile_uid)) { + $channel = App::get_channel(); } if($channel) { $channel_acl = array( @@ -99,12 +99,12 @@ function webpages_content(&$a) { $channel_acl = array(); $is_owner = ($uid && $uid == $owner); - $o = profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o = profile_tabs($a, $is_owner, App::$profile['channel_address']); $x = array( 'webpage' => ITEM_TYPE_WEBPAGE, 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], + 'nickname' => App::$profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', 'acl' => (($is_owner) ? populate_acl($channel_acl,false) : ''), diff --git a/mod/wfinger.php b/mod/wfinger.php index 5c1a74f10..445dbb349 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -32,7 +32,7 @@ function wfinger_init(&$a) { $channel = str_replace('acct:','',$resource); if(strpos($channel,'@') !== false) { $host = substr($channel,strpos($channel,'@')+1); - if(strcasecmp($host,get_app()->get_hostname())) { + if(strcasecmp($host,App::get_hostname())) { goaway('https://' . $host . '/.well-known/webfinger?f=&resource=' . $resource . (($zot) ? '&zot=' . $zot : '')); } $channel = substr($channel,0,strpos($channel,'@')); diff --git a/mod/xrd.php b/mod/xrd.php index 0719407f6..463cda662 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -29,7 +29,7 @@ function xrd_init(&$a) { $dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'),array( '$baseurl' => z_root(), - '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',$a->get_hostname()), + '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',App::get_hostname()), '$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey'])) )); @@ -39,7 +39,7 @@ function xrd_init(&$a) { header("Content-type: application/xrd+xml"); - $aliases = array('acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); + $aliases = array('acct:' . $r[0]['channel_address'] . '@' . App::get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); for($x = 0; $x < count($aliases); $x ++) { if($aliases[$x] === $resource) diff --git a/mod/zotfeed.php b/mod/zotfeed.php index fffb0e4ab..5041532ae 100644 --- a/mod/zotfeed.php +++ b/mod/zotfeed.php @@ -16,7 +16,7 @@ function zotfeed_init(&$a) { json_return_and_die($result); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $channel_address = ((argc() > 1) ? argv(1) : ''); diff --git a/mod/zping.php b/mod/zping.php index 311517701..4cc4abb73 100644 --- a/mod/zping.php +++ b/mod/zping.php @@ -21,7 +21,7 @@ function zping_content(&$a) { return; - $m = zot_build_packet($a->get_channel(),'ping'); + $m = zot_build_packet(App::get_channel(),'ping'); $r = zot_zot($url,$m); return print_r($r,true); |