aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-04-03 21:36:29 -0400
committerAndrew Manning <tamanning@zoho.com>2016-04-03 21:36:29 -0400
commit0523b4b2f1012a8b5f3bffb7f136a20dc9a4e43f (patch)
treea92197de4503ec52889dc05483493f4df1a305b8 /mod
parent99d9456b3addc651a68874ddd391d25684252c4d (diff)
parentb4c1baada1fba46d4d75f40a7e78111d70d54e7a (diff)
downloadvolse-hubzilla-0523b4b2f1012a8b5f3bffb7f136a20dc9a4e43f.tar.gz
volse-hubzilla-0523b4b2f1012a8b5f3bffb7f136a20dc9a4e43f.tar.bz2
volse-hubzilla-0523b4b2f1012a8b5f3bffb7f136a20dc9a4e43f.zip
Merge branch 'master' of https://github.com/redmatrix/hubzilla into contextual-help
Diffstat (limited to 'mod')
-rw-r--r--mod/_well_known.php26
-rw-r--r--mod/achievements.php2
-rw-r--r--mod/admin.php106
-rw-r--r--mod/api.php6
-rw-r--r--mod/appman.php2
-rw-r--r--mod/apps.php2
-rw-r--r--mod/block.php6
-rw-r--r--mod/blocks.php16
-rw-r--r--mod/bookmarks.php4
-rw-r--r--mod/branchtopic.php2
-rwxr-xr-xmod/cal.php32
-rw-r--r--mod/channel.php78
-rw-r--r--mod/chanview.php14
-rw-r--r--mod/chat.php78
-rw-r--r--mod/chatsvc.php43
-rw-r--r--mod/cloud.php6
-rw-r--r--mod/common.php10
-rw-r--r--mod/connect.php34
-rw-r--r--mod/connections.php18
-rw-r--r--mod/connedit.php88
-rw-r--r--mod/cover_photo.php28
-rw-r--r--mod/dav.php6
-rw-r--r--mod/directory.php14
-rw-r--r--mod/dirsearch.php4
-rw-r--r--mod/display.php16
-rw-r--r--mod/dreport.php2
-rw-r--r--mod/editblock.php18
-rw-r--r--mod/editlayout.php20
-rw-r--r--mod/editpost.php18
-rw-r--r--mod/editwebpage.php20
-rwxr-xr-xmod/events.php40
-rw-r--r--mod/fbrowser.php32
-rw-r--r--mod/fhublocs.php6
-rw-r--r--mod/filer.php2
-rw-r--r--mod/filerm.php4
-rw-r--r--mod/filestorage.php10
-rw-r--r--mod/follow.php2
-rw-r--r--mod/fsuggest.php8
-rw-r--r--mod/group.php12
-rw-r--r--mod/hcard.php8
-rw-r--r--mod/help.php18
-rw-r--r--mod/home.php8
-rw-r--r--mod/hostxrd.php2
-rw-r--r--mod/id.php10
-rw-r--r--mod/impel.php2
-rw-r--r--mod/import.php14
-rw-r--r--mod/import_items.php2
-rw-r--r--mod/invite.php8
-rw-r--r--mod/item.php42
-rw-r--r--mod/layouts.php16
-rwxr-xr-xmod/like.php6
-rw-r--r--mod/lockview.php30
-rw-r--r--mod/locs.php15
-rw-r--r--mod/login.php2
-rw-r--r--mod/lostpass.php12
-rw-r--r--mod/magic.php4
-rw-r--r--mod/mail.php28
-rw-r--r--mod/manage.php8
-rw-r--r--mod/match.php14
-rw-r--r--mod/menu.php20
-rw-r--r--mod/message.php6
-rw-r--r--mod/mitem.php46
-rwxr-xr-xmod/mood.php4
-rw-r--r--mod/msearch.php4
-rw-r--r--mod/network.php28
-rw-r--r--mod/new_channel.php8
-rw-r--r--mod/notifications.php8
-rw-r--r--mod/notify.php4
-rw-r--r--mod/oembed.php2
-rw-r--r--mod/oexchange.php6
-rw-r--r--mod/openid.php6
-rw-r--r--mod/opensearch.php4
-rw-r--r--mod/page.php21
-rwxr-xr-xmod/pconfig.php2
-rw-r--r--mod/photo.php4
-rw-r--r--mod/photos.php168
-rw-r--r--mod/ping.php16
-rwxr-xr-xmod/poke.php2
-rw-r--r--mod/prate.php4
-rw-r--r--mod/probe.php2
-rw-r--r--mod/profile.php18
-rw-r--r--mod/profile_photo.php36
-rw-r--r--mod/profiles.php40
-rw-r--r--mod/profperm.php4
-rw-r--r--mod/public.php12
-rw-r--r--mod/randprof.php2
-rw-r--r--mod/rate.php36
-rw-r--r--mod/ratings.php14
-rw-r--r--mod/rbmark.php6
-rw-r--r--mod/register.php2
-rw-r--r--mod/regmod.php4
-rw-r--r--mod/regver.php2
-rw-r--r--mod/removeaccount.php4
-rw-r--r--mod/removeme.php4
-rw-r--r--mod/rmagic.php4
-rw-r--r--mod/rpost.php8
-rw-r--r--mod/rsd_xml.php2
-rw-r--r--mod/search.php20
-rw-r--r--mod/search_ac.php2
-rw-r--r--mod/service_limits.php2
-rw-r--r--mod/settings.php56
-rwxr-xr-xmod/setup.php50
-rw-r--r--mod/share.php4
-rw-r--r--mod/sharedwithme.php2
-rw-r--r--mod/siteinfo.php2
-rw-r--r--mod/smilies.php2
-rw-r--r--mod/sources.php2
-rwxr-xr-xmod/subthread.php4
-rw-r--r--mod/suggest.php6
-rw-r--r--mod/tagger.php8
-rw-r--r--mod/tagrm.php20
-rw-r--r--mod/tasks.php2
-rw-r--r--mod/thing.php4
-rw-r--r--mod/toggle_mobile.php2
-rw-r--r--mod/uexport.php2
-rw-r--r--mod/view.php2
-rw-r--r--mod/viewconnections.php18
-rw-r--r--mod/viewsrc.php2
-rw-r--r--mod/wall_attach.php6
-rw-r--r--mod/wall_upload.php2
-rw-r--r--mod/webpages.php22
-rw-r--r--mod/wfinger.php2
-rw-r--r--mod/xrd.php24
-rw-r--r--mod/zotfeed.php2
-rw-r--r--mod/zping.php2
125 files changed, 978 insertions, 941 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 6300ac027..be703f922 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -40,7 +40,7 @@ function admin_post(&$a){
$func($a);
}
}
- goaway($a->get_baseurl(true) . '/admin/plugins/' . argv(2) );
+ goaway(z_root() . '/admin/plugins/' . argv(2) );
break;
case 'themes':
$theme = argv(2);
@@ -54,7 +54,7 @@ function admin_post(&$a){
info(t('Theme settings updated.'));
if(is_ajax()) return;
- goaway($a->get_baseurl(true) . '/admin/themes/' . $theme );
+ goaway(z_root() . '/admin/themes/' . $theme );
break;
case 'logs':
admin_page_logs_post($a);
@@ -77,7 +77,7 @@ function admin_post(&$a){
}
}
- goaway($a->get_baseurl(true) . '/admin' );
+ goaway(z_root() . '/admin' );
}
/**
@@ -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 = '';
@@ -337,7 +337,7 @@ function admin_page_site_post(&$a){
set_config('system','curl_timeout', $timeout);
info( t('Site settings updated.') . EOL);
- goaway($a->get_baseurl(true) . '/admin/site' );
+ goaway(z_root() . '/admin/site' );
}
/**
@@ -460,7 +460,7 @@ function admin_page_site(&$a) {
'$corporate' => t('Policies'),
'$advanced' => t('Advanced'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
@@ -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'];
@@ -536,7 +536,7 @@ function admin_page_hubloc_post(&$a){
//after repair set hubloc flags to 0
}
- goaway($a->get_baseurl(true) . '/admin/hubloc' );
+ goaway(z_root() . '/admin/hubloc' );
}
function trim_array_elems($arr) {
@@ -659,7 +659,7 @@ function admin_page_hubloc(&$a) {
if(! $hubloc){
notice( t('No server found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/hubloc');
+ goaway(z_root() . '/admin/hubloc');
}
$t = get_markup_template('admin_hubloc.tpl');
@@ -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')
));
}
@@ -733,7 +733,7 @@ function admin_page_dbsync(&$a) {
if(intval(get_config('system','db_version')) <= intval(argv(3)))
set_config('system','db_version',intval(argv(3)) + 1);
info( t('Update has been marked successful') . EOL);
- goaway($a->get_baseurl(true) . '/admin/dbsync');
+ goaway(z_root() . '/admin/dbsync');
}
if(argc() > 2 && intval(argv(2))) {
@@ -771,7 +771,7 @@ function admin_page_dbsync(&$a) {
return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => $a->get_baseurl(true),
+ '$base' => z_root(),
'$banner' => t('Failed Updates'),
'$desc' => '',
'$mark' => t('Mark success (if update was manually applied)'),
@@ -871,7 +871,7 @@ function admin_page_users_post($a) {
}
}
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
/**
@@ -893,7 +893,7 @@ function admin_page_users(&$a){
if (! $account) {
notice( t('Account not found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
@@ -924,7 +924,7 @@ function admin_page_users(&$a){
break;
}
- goaway($a->get_baseurl(true) . '/admin/users' );
+ goaway(z_root() . '/admin/users' );
}
/* get pending */
@@ -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){
@@ -1003,7 +1003,7 @@ function admin_page_users(&$a){
'$form_security_token' => get_form_security_token("admin_users"),
// values //
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$pending' => $pending,
'$users' => $users,
@@ -1053,7 +1053,7 @@ function admin_page_channels_post(&$a) {
notice( sprintf( tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)) );
}
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
/**
@@ -1071,7 +1071,7 @@ function admin_page_channels(&$a){
if (! $channel) {
notice( t('Channel not found') . EOL);
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
switch(argv(2)) {
@@ -1110,22 +1110,22 @@ function admin_page_channels(&$a){
default:
break;
}
- goaway($a->get_baseurl(true) . '/admin/channels' );
+ goaway(z_root() . '/admin/channels' );
}
/* get channels */
$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) {
@@ -1163,7 +1163,7 @@ function admin_page_channels(&$a){
'$form_security_token' => get_form_security_token("admin_channels"),
// values //
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$channels' => $channels,
));
$o .= paginate($a);
@@ -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));
- goaway($a->get_baseurl(true) . '/admin/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 {
@@ -1264,7 +1264,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$plugin' => $plugin,
'$status' => $status,
@@ -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);
@@ -1324,7 +1324,7 @@ function admin_page_plugins(&$a){
'$title' => t('Administration'),
'$page' => t('Plugins'),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$function' => 'plugins',
'$plugins' => $plugins,
'$disabled' => t('Disabled - version incompatibility'),
@@ -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 '';
@@ -1448,7 +1448,7 @@ function admin_page_themes(&$a){
info( sprintf('Theme %s disabled.', $theme));
set_config('system', 'allowed_themes', $s);
- goaway($a->get_baseurl(true) . '/admin/themes' );
+ goaway(z_root() . '/admin/themes' );
}
// display theme details
@@ -1486,7 +1486,7 @@ function admin_page_themes(&$a){
'$page' => t('Themes'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$plugin' => $theme,
'$status' => $status,
@@ -1519,7 +1519,7 @@ function admin_page_themes(&$a){
'$title' => t('Administration'),
'$page' => t('Themes'),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$function' => 'themes',
'$plugins' => $xthemes,
'$experimental' => t('[Experimental]'),
@@ -1548,7 +1548,7 @@ function admin_page_logs_post(&$a) {
}
info( t('Log settings updated.') );
- goaway($a->get_baseurl(true) . '/admin/logs' );
+ goaway(z_root() . '/admin/logs' );
}
/**
@@ -1606,7 +1606,7 @@ readable.");
'$submit' => t('Submit'),
'$clear' => t('Clear'),
'$data' => $data,
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data...
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 453f46f69..b58f3a1f1 100755
--- a/mod/cal.php
+++ b/mod/cal.php
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/datetime.php');
require_once('include/event.php');
require_once('include/items.php');
-require_once('Contact.php');
+require_once('include/Contact.php');
function cal_init(&$a) {
@@ -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(
- '$baseurl' => $a->get_baseurl(),
+ 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] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
+ $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j;
}
}
@@ -321,11 +321,11 @@ function cal_content(&$a) {
$nick = $channel['channel_address'];
$o = replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
- '$new_event' => array($a->get_baseurl().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
- '$previus' => array($a->get_baseurl()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''),
- '$next' => array($a->get_baseurl()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''),
- '$export' => array($a->get_baseurl()."/cal/$nick/$y/$m/export",t('Export'),'',''),
+ '$baseurl' => z_root(),
+ '$new_event' => array(z_root().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
+ '$previus' => array(z_root()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''),
+ '$next' => array(z_root()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''),
+ '$export' => array(z_root()."/cal/$nick/$y/$m/export",t('Export'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events,
'$upload' => t('Import'),
diff --git a/mod/channel.php b/mod/channel.php
index dcccb16b6..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" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\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="' . $a->get_baseurl() . '/id/' . $which .'?f=" />' . "\r\n" ;
-// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $a->get_baseurl() . '/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 f219bde73..75c364008 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="' . $a->get_baseurl() . '/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,8 +159,9 @@ 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) {
$acl = new Zotlabs\Access\AccessList(false);
$acl->set($x[0]);
@@ -175,6 +176,11 @@ function chat_content(&$a) {
return;
}
+ $cipher = get_pconfig(local_channel(),'system','default_cipher');
+ if(! $cipher)
+ $cipher = 'aes256';
+
+
$o = replace_macros(get_markup_template('chat.tpl'),array(
'$is_owner' => ((local_channel() && local_channel() == $x[0]['cr_uid']) ? true : false),
'$room_name' => $room_name,
@@ -183,53 +189,59 @@ function chat_content(&$a) {
'$nickname' => argv(1),
'$submit' => t('Submit'),
'$leave' => t('Leave Room'),
- '$drop' => t('Delete This Room'),
+ '$drop' => t('Delete Room'),
'$away' => t('I am away right now'),
'$online' => t('I am online'),
'$bookmark_link' => $bookmark_link,
- '$bookmark' => t('Bookmark this room')
-
+ '$bookmark' => t('Bookmark this room'),
+ '$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false),
+ '$cipher' => $cipher,
+ '$linkurl' => t('Please enter a link URL:'),
+ '$encrypt' => t('Encrypt text'),
+ '$insert' => t('Insert web link')
));
return $o;
}
+ require_once('include/conversation.php');
+ $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();
- if(local_channel() && argc() > 2 && argv(2) === 'new') {
-
- $acl = new Zotlabs\Access\AccessList($channel);
- $channel_acl = $acl->get();
-
- require_once('include/acl_selectors.php');
-
- $o = replace_macros(get_markup_template('chatroom_new.tpl'),array(
+ $lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
+ require_once('include/acl_selectors.php');
+
+ $chatroom_new = '';
+ if(local_channel()) {
+ $chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array(
'$header' => t('New Chatroom'),
- '$name' => array('room_name',t('Chatroom Name'),'', ''),
+ '$name' => array('room_name',t('Chatroom name'),'', ''),
'$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''),
'$permissions' => t('Permissions'),
'$acl' => populate_acl($channel_acl,false),
+ '$lockstate' => $lockstate,
'$submit' => t('Submit')
+
));
- return $o;
}
-
-
- require_once('include/conversation.php');
-
- $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
-
- require_once('include/widgets.php');
+ $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' => $channel['channel_address'],
- '$rooms' => widget_chatroom_list(array()),
- '$newroom' => t('New Chatroom'),
- '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0)
+ '$nickname' => App::$profile['channel_address'],
+ '$rooms' => $rooms,
+ '$norooms' => t('No chatrooms available'),
+ '$newroom' => t('Create New'),
+ '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0),
+ '$chatroom_new' => $chatroom_new,
+ '$expire' => t('Expiration'),
+ '$expire_unit' => t('min') //minutes
));
return $o;
diff --git a/mod/chatsvc.php b/mod/chatsvc.php
index 44225e6dd..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,28 +102,30 @@ 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) {
switch($rr['cp_status']) {
case 'away':
$status = t('Away');
+ $status_class = 'away';
break;
case 'online':
default:
$status = t('Online');
+ $status_class = 'online';
break;
}
- $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], status => $status);
+ $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], 'status' => $status, 'status_class' => $status_class);
}
}
$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) {
@@ -135,7 +137,8 @@ function chatsvc_content(&$a) {
'name' => $rr['xchan_name'],
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'),
- 'text' => smilies(bbcode($rr['chat_text']))
+ 'text' => smilies(bbcode($rr['chat_text'])),
+ 'self' => ((get_observer_hash() == $rr['chat_xchan']) ? 'self' : '')
);
}
}
@@ -143,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 82d454477..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="' . $a->get_baseurl() . '/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 008bc21ac..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
@@ -73,7 +73,7 @@ function connedit_post(&$a) {
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
- goaway($a->get_baseurl(true) . '/connections');
+ goaway(z_root() . '/connections');
return; // NOTREACHED
}
@@ -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);
}
@@ -306,7 +306,7 @@ function connedit_post(&$a) {
connedit_clone($a);
if(($_REQUEST['pending']) && (!$_REQUEST['done']))
- goaway($a->get_baseurl(true) . '/connections/ifpending');
+ goaway(z_root() . '/connections/ifpending');
return;
@@ -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) {
@@ -405,19 +405,19 @@ function connedit_content(&$a) {
if(! count($orig_record)) {
notice( t('Could not access address book record.') . EOL);
- goaway($a->get_baseurl(true) . '/connections');
+ goaway(z_root() . '/connections');
}
if($cmd === 'update') {
// pull feed and consume it, which should subscribe to the hub.
proc_run('php',"include/poller.php","$contact_id");
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
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 {
@@ -425,7 +425,7 @@ function connedit_content(&$a) {
// if you are on a different network we'll force a refresh of the connection basic info
proc_run('php','include/notifier.php','permission_update',$contact_id);
}
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'block') {
@@ -434,7 +434,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'ignore') {
@@ -443,7 +443,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'archive') {
@@ -452,7 +452,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'hide') {
@@ -461,7 +461,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
// We'll prevent somebody from unapproving an already approved contact.
@@ -475,7 +475,7 @@ function connedit_content(&$a) {
else
notice(t('Unable to set address book parameters.') . EOL);
}
- goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
+ goaway(z_root() . '/connedit/' . $contact_id);
}
@@ -499,16 +499,16 @@ function connedit_content(&$a) {
info( t('Connection has been removed.') . EOL );
if(x($_SESSION,'return_url'))
- goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
- goaway($a->get_baseurl(true) . '/contacts');
+ goaway(z_root() . '/' . $_SESSION['return_url']);
+ goaway(z_root() . '/contacts');
}
}
- 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(
@@ -521,21 +521,21 @@ function connedit_content(&$a) {
'refresh' => array(
'label' => t('Refresh Permissions'),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/refresh',
'sel' => '',
'title' => t('Fetch updated permissions'),
),
'recent' => array(
'label' => t('Recent Activity'),
- 'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'],
+ 'url' => z_root() . '/network/?f=&cid=' . $contact['abook_id'],
'sel' => '',
'title' => t('View recent posts and comments'),
),
'block' => array(
'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/block',
'sel' => (intval($contact['abook_blocked']) ? 'active' : ''),
'title' => t('Block (or Unblock) all communications with this connection'),
'info' => (intval($contact['abook_blocked']) ? t('This connection is blocked!') : ''),
@@ -543,7 +543,7 @@ function connedit_content(&$a) {
'ignore' => array(
'label' => (intval($contact['abook_ignored']) ? t('Unignore') : t('Ignore')),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/ignore',
'sel' => (intval($contact['abook_ignored']) ? 'active' : ''),
'title' => t('Ignore (or Unignore) all inbound communications from this connection'),
'info' => (intval($contact['abook_ignored']) ? t('This connection is ignored!') : ''),
@@ -551,7 +551,7 @@ function connedit_content(&$a) {
'archive' => array(
'label' => (intval($contact['abook_archived']) ? t('Unarchive') : t('Archive')),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/archive',
'sel' => (intval($contact['abook_archived']) ? 'active' : ''),
'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'),
'info' => (intval($contact['abook_archived']) ? t('This connection is archived!') : ''),
@@ -559,7 +559,7 @@ function connedit_content(&$a) {
'hide' => array(
'label' => (intval($contact['abook_hidden']) ? t('Unhide') : t('Hide')),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/hide',
'sel' => (intval($contact['abook_hidden']) ? 'active' : ''),
'title' => t('Hide or Unhide this connection from your other connections'),
'info' => (intval($contact['abook_hidden']) ? t('This connection is hidden!') : ''),
@@ -567,7 +567,7 @@ function connedit_content(&$a) {
'delete' => array(
'label' => t('Delete'),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop',
+ 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/drop',
'sel' => '',
'title' => t('Delete this connection'),
),
@@ -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 9c99859ea..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="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/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,14 +362,14 @@ 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',
- '$image_url' => $a->get_baseurl() . '/photo/' . $filename,
+ '$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.'),
'$form_security_token' => get_form_security_token("cover_photo"),
@@ -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 272dae4c8..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="' . $a->get_baseurl() . '/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 dca96694e..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);
@@ -324,7 +324,7 @@ function directory_content(&$a) {
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'keywords' => $out,
- 'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '',
+ 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
'common_label' => t('Common connections:'),
@@ -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 9269676b1..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,8 +108,8 @@ function editblock_content(&$a) {
else
$mimeselect = mimetype_select($itm[0]['uid'],$mimetype);
- $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
- '$baseurl' => $a->get_baseurl(),
+ App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => '',
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
@@ -153,7 +153,7 @@ function editblock_content(&$a) {
'$mimeselect' => $mimeselect,
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$defloc' => $channel['channel_location'],
'$visitor' => false,
'$public' => t('Public post'),
diff --git a/mod/editlayout.php b/mod/editlayout.php
index fc68cfe3c..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,8 +102,8 @@ function editlayout_content(&$a) {
$plaintext = true;
- $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
- '$baseurl' => $a->get_baseurl(),
+ App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => '',
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
@@ -150,7 +150,7 @@ function editlayout_content(&$a) {
'$ptyp' => $itm[0]['type'],
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$defloc' => $channel['channel_location'],
'$visitor' => false,
'$public' => t('Public post'),
@@ -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 030d8d671..a433d91f4 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -1,6 +1,6 @@
<?php /** @file */
-require_once('acl_selectors.php');
+require_once('include/acl_selectors.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/taxonomy.php');
@@ -44,10 +44,10 @@ 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(
- '$baseurl' => $a->get_baseurl(),
+ App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => '',
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
@@ -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';
@@ -132,7 +132,7 @@ function editpost_content(&$a) {
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
'$parent' => (($itm[0]['parent'] != $itm[0]['id']) ? $itm[0]['parent'] : ''),
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$defloc' => $channel['channel_location'],
'$visitor' => false,
'$public' => t('Public post'),
@@ -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 0192fd9c0..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,8 +143,8 @@ 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(
- '$baseurl' => $a->get_baseurl(),
+ App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => '',
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
@@ -192,7 +192,7 @@ function editwebpage_content(&$a) {
'$ptyp' => $itm[0]['type'],
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$defloc' => $itm[0]['location'],
'$visitor' => ($is_owner) ? true : false,
'$acl' => populate_acl($itm[0],false),
@@ -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 8e3b3e06b..30cf5f303 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -93,8 +93,8 @@ function events_post(&$a) {
//$action = ($event_hash == '') ? 'new' : "event/" . $event_hash;
//fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location)
- //$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
- $onerror_url = $a->get_baseurl() . "/events";
+ //$onerror_url = z_root() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
+ $onerror_url = z_root() . "/events";
if(strcmp($finish,$start) < 0 && !$nofinish) {
notice( t('Event can not end before it has started.') . EOL);
@@ -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(
- '$baseurl' => $a->get_baseurl(),
+ 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))
@@ -435,7 +435,7 @@ function events_content(&$a) {
$tpl = get_markup_template('event_form.tpl');
$form = replace_macros($tpl,array(
- '$post' => $a->get_baseurl() . '/events',
+ '$post' => z_root() . '/events',
'$eid' => $eid,
'$type' => $type,
'$xchan' => $event_xchan,
@@ -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] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
+ $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j;
}
}
@@ -600,9 +600,9 @@ function events_content(&$a) {
$last_date = $d;
- $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false);
+ $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false);
- $drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
+ $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
if(! $title) {
@@ -641,7 +641,7 @@ function events_content(&$a) {
killme();
}
- if ($a->argv[1] === 'json'){
+ if (App::$argv[1] === 'json'){
echo json_encode($events); killme();
}
@@ -654,11 +654,11 @@ function events_content(&$a) {
}
$o = replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
- '$new_event' => array($a->get_baseurl().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
- '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
- '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
- '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''),
+ '$baseurl' => z_root(),
+ '$new_event' => array(z_root().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
+ '$previus' => array(z_root()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
+ '$next' => array(z_root()."/events/$nextyear/$nextmonth",t('Next'),'',''),
+ '$export' => array(z_root()."/events/$y/$m/export",t('Export'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events,
'$upload' => t('Import'),
diff --git a/mod/fbrowser.php b/mod/fbrowser.php
index 13abbfd8a..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($a->get_baseurl()."/fbrowser/image/", t("Photos")));
+ $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($a->get_baseurl()."/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`
@@ -60,9 +60,9 @@ function fbrowser_content($a){
$filename_e = $rr['filename'];
return array(
- $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['hiq'] . '.' .$ext,
+ z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['hiq'] . '.' .$ext,
$filename_e,
- $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['loq'] . '.'. $ext
+ z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['loq'] . '.'. $ext
);
}
$files = array_map("files1", $r);
@@ -70,7 +70,7 @@ function fbrowser_content($a){
$tpl = get_markup_template("filebrowser.tpl");
echo replace_macros($tpl, array(
'$type' => 'image',
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$path' => $path,
'$folders' => $albums,
'$files' =>$files,
@@ -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,14 +89,14 @@ 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 {
$filename_e = $rr['filename'];
}
- return array( $a->get_baseurl() . '/attach/' . $rr['id'], $filename_e, $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png');
+ return array( z_root() . '/attach/' . $rr['id'], $filename_e, z_root() . '/images/icons/16/' . $filetype . '.png');
}
$files = array_map("files2", $files);
//echo "<pre>"; var_dump($files); killme();
@@ -105,8 +105,8 @@ function fbrowser_content($a){
$tpl = get_markup_template("filebrowser.tpl");
echo replace_macros($tpl, array(
'$type' => 'file',
- '$baseurl' => $a->get_baseurl(),
- '$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),
+ '$baseurl' => z_root(),
+ '$path' => array( array(z_root()."/fbrowser/image/", t("Files")) ),
'$folders' => false,
'$files' =>$files,
'$cancel' => t('Cancel'),
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 bd8ce7cfc..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);
@@ -27,7 +27,7 @@ function filerm_content(&$a) {
}
if(x($_SESSION,'return_url'))
- goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
+ goaway(z_root() . '/' . $_SESSION['return_url']);
killme();
}
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 c63ccfa9b..d5f2129bd 100644
--- a/mod/group.php
+++ b/mod/group.php
@@ -20,11 +20,11 @@ function group_post(&$a) {
info( t('Privacy group created.') . EOL );
$r = group_byname(local_channel(),$name);
if($r)
- goaway($a->get_baseurl() . '/group/' . $r);
+ goaway(z_root() . '/group/' . $r);
}
else
notice( t('Could not create privacy group.') . EOL );
- goaway($a->get_baseurl() . '/group');
+ goaway(z_root() . '/group');
}
if((argc() == 2) && (intval(argv(1)))) {
@@ -36,7 +36,7 @@ function group_post(&$a) {
);
if(! $r) {
notice( t('Privacy group not found.') . EOL );
- goaway($a->get_baseurl() . '/connections');
+ goaway(z_root() . '/connections');
}
$group = $r[0];
@@ -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);
@@ -108,7 +108,7 @@ function group_content(&$a) {
else
notice( t('Unable to remove privacy group.') . EOL);
}
- goaway($a->get_baseurl() . '/group');
+ goaway(z_root() . '/group');
// NOTREACHED
}
@@ -135,7 +135,7 @@ function group_content(&$a) {
);
if(! $r) {
notice( t('Privacy group not found.') . EOL );
- goaway($a->get_baseurl() . '/connections');
+ goaway(z_root() . '/connections');
}
$group = $r[0];
diff --git a/mod/hcard.php b/mod/hcard.php
index 014a63b35..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="' . $a->get_baseurl() . '/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 f91f261a5..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'))
);
@@ -246,10 +246,10 @@ function import_account(&$a, $account_id) {
dbesc($channel['channel_guid']),
dbesc($channel['channel_guid_sig']),
dbesc($channel['channel_pubkey']),
- dbesc($a->get_baseurl() . "/photo/profile/l/" . $channel['channel_id']),
- dbesc($a->get_baseurl() . "/photo/profile/m/" . $channel['channel_id']),
- dbesc($a->get_baseurl() . "/photo/profile/s/" . $channel['channel_id']),
- dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
+ 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'] . '@' . 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 038a967b2..6e7c77a4d 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -119,7 +119,7 @@ function item_post(&$a) {
if (!$ret['success']) {
notice( t($ret['message']) . EOL) ;
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
}
@@ -173,7 +173,7 @@ function item_post(&$a) {
if(($r === false) || (! count($r))) {
notice( t('Unable to locate original post.') . EOL);
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
@@ -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);
@@ -205,7 +205,7 @@ function item_post(&$a) {
if(! $can_comment) {
notice( t('Permission denied.') . EOL) ;
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
}
@@ -213,7 +213,7 @@ function item_post(&$a) {
if(! perm_is_allowed($profile_uid,$observer['xchan_hash'],($webpage) ? 'write_pages' : 'post_wall')) {
notice( t('Permission denied.') . EOL) ;
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
}
@@ -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
@@ -267,7 +267,7 @@ function item_post(&$a) {
if(! $channel) {
logger("mod_item: no channel.");
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
@@ -282,7 +282,7 @@ function item_post(&$a) {
else {
logger("mod_item: no owner.");
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
@@ -422,7 +422,7 @@ function item_post(&$a) {
killme();
info( t('Empty post discarded.') . EOL );
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
}
@@ -462,7 +462,7 @@ function item_post(&$a) {
else {
notice( t('Executable content type not permitted to this channel.') . EOL);
if(x($_REQUEST,'return'))
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
killme();
}
}
@@ -636,7 +636,7 @@ function item_post(&$a) {
$r = attach_by_hash_nodata($hash,$rev);
if($r['success']) {
$attachments[] = array(
- 'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
+ 'href' => z_root() . '/attach/' . $r['data']['hash'],
'length' => $r['data']['filesize'],
'type' => $r['data']['filetype'],
'title' => urlencode($r['data']['filename']),
@@ -852,10 +852,10 @@ function item_post(&$a) {
if(x($datarray,'cancel')) {
logger('mod_item: post cancelled by plugin or duplicate suppressed.');
if($return_path)
- goaway($a->get_baseurl() . "/" . $return_path);
+ goaway(z_root() . "/" . $return_path);
$json = array('cancel' => 1);
- $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
+ $json['reload'] = z_root() . '/' . $_REQUEST['jsreload'];
echo json_encode($json);
killme();
}
@@ -901,7 +901,7 @@ function item_post(&$a) {
if((x($_REQUEST,'return')) && strlen($return_path)) {
logger('return: ' . $return_path);
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
}
killme();
}
@@ -926,7 +926,7 @@ function item_post(&$a) {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => $a->get_baseurl() . '/display/' . $datarray['mid'],
+ 'link' => z_root() . '/display/' . $datarray['mid'],
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $parent,
@@ -944,7 +944,7 @@ function item_post(&$a) {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => $a->get_baseurl() . '/display/' . $datarray['mid'],
+ 'link' => z_root() . '/display/' . $datarray['mid'],
'verb' => ACTIVITY_POST,
'otype' => 'item'
));
@@ -971,7 +971,7 @@ function item_post(&$a) {
else {
logger('mod_item: unable to retrieve post that was just stored.');
notice( t('System error. Post not saved.') . EOL);
- goaway($a->get_baseurl() . "/" . $return_path );
+ goaway(z_root() . "/" . $return_path );
// NOTREACHED
}
@@ -999,7 +999,7 @@ function item_post(&$a) {
}
$datarray['id'] = $post_id;
- $datarray['llink'] = $a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id;
+ $datarray['llink'] = z_root() . '/display/' . $channel['channel_address'] . '/' . $post_id;
call_hooks('post_local_end', $datarray);
@@ -1019,12 +1019,12 @@ function item_post(&$a) {
return $post;
if($return_path) {
- goaway($a->get_baseurl() . "/" . $return_path);
+ goaway(z_root() . "/" . $return_path);
}
$json = array('success' => 1);
if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
- $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
+ $json['reload'] = z_root() . '/' . $_REQUEST['jsreload'];
logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
@@ -1099,7 +1099,7 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
$images = $match[2];
if($images) {
foreach($images as $image) {
- if(! stristr($image,get_app()->get_baseurl() . '/photo/'))
+ if(! stristr($image,z_root() . '/photo/'))
continue;
$image_uri = substr($image,strrpos($image,'/') + 1);
if(strpos($image_uri,'-') !== false)
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 1de7882e9..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;
@@ -444,7 +444,7 @@ function like_content(&$a) {
$arr['thr_parent'] = $item['mid'];
$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
- $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
$allow_cid = $item['allow_cid'];
$allow_gid = $item['allow_gid'];
$deny_cid = $item['deny_cid'];
diff --git a/mod/lockview.php b/mod/lockview.php
index 84c16f658..d4a626a11 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -14,11 +14,21 @@ function lockview_content(&$a) {
if(! $item_id)
killme();
- if (!in_array($type, array('item','photo','event', 'menu_item')))
+ if (!in_array($type, array('item','photo','event', 'menu_item', 'chatroom')))
killme();
- //we have different naming in in menu_item table
- $id = (($type == 'menu_item') ? 'mitem_id' : 'id');
+ //we have different naming in in menu_item table and chatroom table
+ switch($type) {
+ case 'menu_item':
+ $id = 'mitem_id';
+ break;
+ case 'chatroom':
+ $id = 'cr_id';
+ break;
+ default:
+ $id = 'id';
+ break;
+ }
$r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1",
dbesc($type),
@@ -30,8 +40,18 @@ function lockview_content(&$a) {
$item = $r[0];
- //we have different naming in in menu_item table
- $uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']);
+ //we have different naming in in menu_item table and chatroom table
+ switch($type) {
+ case 'menu_item':
+ $uid = $item['mitem_channel_id'];
+ break;
+ case 'chatroom':
+ $uid = $item['cr_uid'];
+ break;
+ default:
+ $uid = $item['uid'];
+ break;
+ }
if($uid != local_channel()) {
echo '<li>' . t('Remote privacy information not available.') . '</li>';
diff --git a/mod/locs.php b/mod/locs.php
index 9f66e3263..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']);
@@ -110,11 +110,12 @@ function locs_content(&$a) {
$o = replace_macros(get_markup_template('locmanage.tpl'), array(
'$header' => t('Manage Channel Locations'),
- '$loc' => t('Location (address)'),
- '$mkprm' => t('Primary Location'),
- '$drop' => t('Drop location'),
+ '$loc' => t('Location'),
+ '$addr' => t('Address'),
+ '$mkprm' => t('Primary'),
+ '$drop' => t('Drop'),
'$submit' => t('Submit'),
- '$sync' => t('Sync now'),
+ '$sync' => t('Sync Now'),
'$sync_text' => t('Please wait several minutes between consecutive operations.'),
'$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'),
'$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'),
@@ -122,4 +123,4 @@ function locs_content(&$a) {
));
return $o;
-} \ No newline at end of file
+}
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 ffdd7b62e..2ae955983 100644
--- a/mod/lostpass.php
+++ b/mod/lostpass.php
@@ -31,10 +31,10 @@ function lostpass_post(&$a) {
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$message = replace_macros($email_tpl, array(
'$sitename' => get_config('system','sitename'),
- '$siteurl' => $a->get_baseurl(),
+ '$siteurl' => z_root(),
'$username' => sprintf( t('Site Member (%s)'), $email),
'$email' => $email,
- '$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $hash
+ '$reset_link' => z_root() . '/lostpass?verify=' . $hash
));
$subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
@@ -87,10 +87,10 @@ function lostpass_content(&$a) {
'$lbl2' => t('Your password has been reset as requested.'),
'$lbl3' => t('Your new password is'),
'$lbl4' => t('Save or copy your new password - and then'),
- '$lbl5' => '<a href="' . $a->get_baseurl() . '/login">' . t('click here to login') . '</a>.',
+ '$lbl5' => '<a href="' . z_root() . '/login">' . t('click here to login') . '</a>.',
'$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'),
'$newpass' => $new_password,
- '$baseurl' => $a->get_baseurl()
+ '$baseurl' => z_root()
));
@@ -98,8 +98,8 @@ function lostpass_content(&$a) {
$email_tpl = get_intltext_template("passchanged_eml.tpl");
$message = replace_macros($email_tpl, array(
- '$sitename' => $a->config['sitename'],
- '$siteurl' => $a->get_baseurl(),
+ '$sitename' => App::$config['sitename'],
+ '$siteurl' => z_root(),
'$username' => sprintf( t('Site Member (%s)'), $email),
'$email' => $email,
'$new_password' => $new_password,
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 59d15772b..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']);
@@ -149,7 +149,7 @@ function mail_content(&$a) {
if($r) {
//info( t('Message deleted.') . EOL );
}
- goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
+ goaway(z_root() . '/mail/' . $mailbox);
}
if((argc() == 4) && (argv(2) === 'recall')) {
@@ -174,7 +174,7 @@ function mail_content(&$a) {
if($r) {
info( t('Message recalled.') . EOL );
}
- goaway($a->get_baseurl(true) . '/mail/' . $mailbox . '/' . argv(3));
+ goaway(z_root() . '/mail/' . $mailbox . '/' . argv(3));
}
@@ -186,7 +186,7 @@ function mail_content(&$a) {
$r = private_messages_drop(local_channel(), argv(3), true);
if($r)
info( t('Conversation removed.') . EOL );
- goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
+ goaway(z_root() . '/mail/' . $mailbox);
}
if((argc() > 1) && (argv(1) === 'new')) {
@@ -196,14 +196,14 @@ function mail_content(&$a) {
$tpl = get_markup_template('msg-header.tpl');
$header = replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $channel['channel_address'],
'$linkurl' => t('Please enter a link URL:'),
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
));
- $a->page['htmlhead'] .= $header;
+ App::$page['htmlhead'] .= $header;
$prename = '';
$preid = '';
@@ -298,20 +298,20 @@ 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' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$linkurl' => t('Please enter a link URL:'),
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
diff --git a/mod/manage.php b/mod/manage.php
index cb845befe..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;
@@ -167,9 +167,7 @@ function manage_content(&$a) {
'$intros_format' => t('%d new introductions'),
'$channel_usage_message' => $channel_usage_message,
'$delegated_desc' => t('Delegated Channel'),
- '$delegates' => $delegates,
- '$locs' => t('Manage locations')
-
+ '$delegates' => $delegates
));
return $o;
diff --git a/mod/match.php b/mod/match.php
index fd739ba2c..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'] = $a->get_baseurl() . '/' . $a->cmd;
+ $_SESSION['return_url'] = z_root() . '/' . App::$cmd;
$o .= '<h2>' . t('Profile Match') . '</h2>';
@@ -37,25 +37,25 @@ 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);
// else
-// $x = post_url($a->get_baseurl() . '/msearch', $params);
+// $x = post_url(z_root() . '/msearch', $params);
$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)) {
$tpl = get_markup_template('match.tpl');
foreach ($j->results as $jj) {
- $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
+ $connlnk = z_root() . '/follow/?url=' . $jj->url;
$o .= replace_macros($tpl,array(
'$url' => zid($jj->url),
'$name' => $jj->name,
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 73239d2cb..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');
@@ -32,7 +32,7 @@ function message_content(&$a) {
$r = private_messages_drop(local_channel(), argv(2), true);
if($r)
info( t('Conversation removed.') . EOL );
- goaway($a->get_baseurl(true) . '/mail/combined' );
+ goaway(z_root() . '/mail/combined' );
}
if(argc() == 2) {
@@ -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/msearch.php b/mod/msearch.php
index b51c4e097..f94b75910 100644
--- a/mod/msearch.php
+++ b/mod/msearch.php
@@ -27,8 +27,8 @@ function msearch_post(&$a) {
foreach($r as $rr)
$results[] = array(
'name' => $rr['name'],
- 'url' => $a->get_baseurl() . '/channel/' . $rr['nickname'],
- 'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'],
+ 'url' => z_root() . '/channel/' . $rr['nickname'],
+ 'photo' => z_root() . '/photo/avatar/' . $rr['uid'],
'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords'])
);
}
diff --git a/mod/network.php b/mod/network.php
index 134a4081d..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 = '';
@@ -89,7 +89,7 @@ function network_content(&$a, $update = 0, $load = false) {
if($update)
killme();
notice( t('No such group') . EOL );
- goaway($a->get_baseurl(true) . '/network');
+ goaway(z_root() . '/network');
// NOTREACHED
}
@@ -129,7 +129,7 @@ function network_content(&$a, $update = 0, $load = false) {
killme();
}
notice( t('No such channel') . EOL );
- goaway($a->get_baseurl(true) . '/network');
+ goaway(z_root() . '/network');
// NOTREACHED
}
if($_GET['pf'] === '1')
@@ -242,7 +242,7 @@ function network_content(&$a, $update = 0, $load = false) {
}
else {
notice( t('Invalid connection.') . EOL);
- goaway($a->get_baseurl(true) . '/network');
+ goaway(z_root() . '/network');
}
}
@@ -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 577137c37..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 = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
+ $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 f679fbb3b..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;
@@ -46,12 +46,12 @@ function notifications_post(&$a) {
intval(local_channel())
);
}
- goaway($a->get_baseurl(true) . '/notifications/intros');
+ goaway(z_root() . '/notifications/intros');
}
if($_POST['submit'] == t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
intval($intro_id));
- goaway($a->get_baseurl(true) . '/notifications/intros');
+ goaway(z_root() . '/notifications/intros');
}
}
}
@@ -84,7 +84,7 @@ function notifications_content(&$a) {
$notifications_available =1;
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
- '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
+ '$item_link' => z_root().'/notify/view/'. $it['id'],
'$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date'])
diff --git a/mod/notify.php b/mod/notify.php
index 4c9d1977b..d56871880 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -19,7 +19,7 @@ function notify_init(&$a) {
);
goaway($r[0]['link']);
}
- goaway($a->get_baseurl(true));
+ goaway(z_root());
}
@@ -42,7 +42,7 @@ function notify_content(&$a) {
if($r) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array(
- '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
+ '$item_link' => z_root().'/notify/view/'. $it['id'],
'$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date'])
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 867cea6f2..342b8c3cd 100644
--- a/mod/oexchange.php
+++ b/mod/oexchange.php
@@ -6,7 +6,7 @@ function oexchange_init(&$a) {
if((argc() > 1) && (argv(1) === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl');
- $o = replace_macros($tpl, array('$base' => $a->get_baseurl()));
+ $o = replace_macros($tpl, array('$base' => z_root()));
echo $o;
killme();
}
@@ -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) {
@@ -47,7 +47,7 @@ function oexchange_content(&$a) {
$tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
- $ret = z_fetch_url($a->get_baseurl() . '/urlinfo?f=&url=' . $url . $title . $description . $tags);
+ $ret = z_fetch_url(z_root() . '/urlinfo?f=&url=' . $url . $title . $description . $tags);
if($ret['success'])
$s = $ret['body'];
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 d28c4f1b8..19f7985c5 100644
--- a/mod/opensearch.php
+++ b/mod/opensearch.php
@@ -7,8 +7,8 @@ function opensearch_init(&$a) {
header("Content-type: application/opensearchdescription+xml");
$o = replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
- '$nodename' => $a->get_hostname(),
+ '$baseurl' => z_root(),
+ '$nodename' => App::get_hostname(),
));
echo $o;
diff --git a/mod/page.php b/mod/page.php
index ae572ca1e..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;
}
@@ -91,10 +91,13 @@ function page_init(&$a) {
return;
}
+ if($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",
@@ -105,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;
}
@@ -118,7 +121,7 @@ function page_init(&$a) {
function page_content(&$a) {
- $r = $a->data['webpage'];
+ $r = App::$data['webpage'];
if(! $r)
return;
@@ -133,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 07138e6cf..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')) {
@@ -93,12 +93,12 @@ function photos_post(&$a) {
if($album === t('Profile Photos')) {
// not allowed
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
}
if(! photos_album_exists($page_owner_uid,$album)) {
notice( t('Album not found.') . EOL);
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
}
@@ -111,12 +111,12 @@ function photos_post(&$a) {
// @fixme - syncronise with DAV or disallow completely
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
// $x = photos_album_rename($page_owner_uid,$album,$newalbum);
// if($x) {
// $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
-// goaway($a->get_baseurl() . '/' . $newurl);
+// goaway(z_root() . '/' . $newurl);
// }
}
@@ -140,7 +140,7 @@ function photos_post(&$a) {
$str = null;
}
if(! $str) {
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$r = q("select id from item where resource_id in ( $str ) and resource_type = 'photo' and uid = %d " . item_normal(),
@@ -165,7 +165,7 @@ function photos_post(&$a) {
}
- goaway($a->get_baseurl() . '/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'))) {
@@ -174,12 +174,12 @@ function photos_post(&$a) {
$ob_hash = get_observer_hash();
if(! $ob_hash)
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$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) {
@@ -197,16 +197,16 @@ function photos_post(&$a) {
);
if(count($i)) {
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
- $url = $a->get_baseurl();
+ $url = z_root();
}
*/
}
- goaway($a->get_baseurl() . '/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);
@@ -440,7 +440,7 @@ function photos_post(&$a) {
}
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
return; // NOTREACHED
}
@@ -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($a->get_baseurl() . '/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($a->get_baseurl() . '/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' => $a->get_baseurl() . '/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($a->get_baseurl() . '/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'), $a->get_baseurl() . '/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'), $a->get_baseurl() . '/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 = ($a->get_baseurl() . '/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(
@@ -758,7 +758,7 @@ function photos_content(&$a) {
'twist' => ' ' . $twist . rand(2,4),
'link' => $imagelink,
'title' => t('View Photo'),
- 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
+ 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e,
'desc'=> $desc_e,
'ext' => $ext,
@@ -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'), $a->get_baseurl() . '/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 = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
- $nextlink = $a->get_baseurl() . '/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,14 +889,14 @@ function photos_content(&$a) {
}
}
- $album_link = $a->get_baseurl() . '/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;
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array(
- 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
- 'cover'=>array($a->get_baseurl() . '/cover_photo/use/'.$ph[0]['resource_id'], t('Use as cover photo')),
+ 'profile'=>array(z_root() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
+ 'cover'=>array(z_root() . '/cover_photo/use/'.$ph[0]['resource_id'], t('Use as cover photo')),
);
}
@@ -906,20 +906,20 @@ 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'));
$photo = array(
- 'href' => $a->get_baseurl() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
+ 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> t('View Full Size'),
- 'src' => $a->get_baseurl() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
+ 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
);
if($nextlink)
@@ -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');
@@ -1123,7 +1123,7 @@ function photos_content(&$a) {
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
continue;
- $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+ $redirect_url = z_root() . '/redir/' . $item['cid'] ;
$profile_url = zid($item['author']['xchan_url']);
@@ -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' => $a->get_baseurl() . '/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' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
+ 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
'alt' => $alt_e,
'album' => array(
- 'link' => $a->get_baseurl() . '/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'), $a->get_baseurl().'/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 69d504da1..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();
}
@@ -224,7 +224,7 @@ function ping_init(&$a) {
if(count($z)) {
foreach($z as $zz) {
$notifs[] = array(
- 'notify_link' => $a->get_baseurl() . '/notify/view/' . $zz['id'],
+ 'notify_link' => z_root() . '/notify/view/' . $zz['id'],
'name' => $zz['name'],
'url' => $zz['url'],
'photo' => $zz['photo'],
@@ -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",
@@ -251,7 +251,7 @@ function ping_init(&$a) {
if($t) {
foreach($t as $zz) {
$notifs[] = array(
- 'notify_link' => $a->get_baseurl() . '/mail/' . $zz['id'],
+ 'notify_link' => z_root() . '/mail/' . $zz['id'],
'name' => $zz['xchan_name'],
'url' => $zz['xchan_url'],
'photo' => $zz['xchan_photo_s'],
@@ -299,7 +299,7 @@ function ping_init(&$a) {
if($r) {
foreach($r as $rr) {
$result[] = array(
- 'notify_link' => $a->get_baseurl() . '/connections/ifpending',
+ 'notify_link' => z_root() . '/connections/ifpending',
'name' => $rr['xchan_name'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
@@ -341,7 +341,7 @@ function ping_init(&$a) {
$when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
$result[] = array(
- 'notify_link' => $a->get_baseurl() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'],
+ 'notify_link' => z_root() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'],
'name' => $rr['xchan_name'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
@@ -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 7ee03a77b..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="' . $a->get_baseurl() . '/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 9dc71f256..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
@@ -189,8 +189,8 @@ function profile_photo_post(&$a) {
}
else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
- dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-4'),
- dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-5'),
+ dbesc(z_root() . '/photo/' . $base_image['resource_id'] . '-4'),
+ dbesc(z_root() . '/photo/' . $base_image['resource_id'] . '-5'),
intval($_REQUEST['profile']),
intval(local_channel())
);
@@ -225,7 +225,7 @@ function profile_photo_post(&$a) {
notice( t('Unable to process image') . EOL);
}
- goaway($a->get_baseurl() . '/profiles');
+ goaway(z_root() . '/profiles');
return; // NOTREACHED
}
@@ -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;
@@ -345,7 +345,7 @@ function profile_photo_content(&$a) {
profile_photo_set_profile_perms(); //Reset default photo permissions to public
proc_run('php','include/directory.php',local_channel());
- goaway($a->get_baseurl() . '/profiles');
+ goaway(z_root() . '/profiles');
}
$r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
@@ -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="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/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,14 +412,14 @@ 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'],
- '$image_url' => $a->get_baseurl() . '/photo/' . $filename,
+ '$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.'),
'$form_security_token' => get_form_security_token("profile_photo"),
@@ -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 f891c6033..75c05b634 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -17,7 +17,7 @@ function profiles_init(&$a) {
);
if(! count($r)) {
notice( t('Profile not found.') . EOL);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway(z_root() . '/profiles');
return; // NOTREACHED
}
$profile_guid = $r['profile_guid'];
@@ -44,7 +44,7 @@ function profiles_init(&$a) {
// profiles_build_sync(local_channel());
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway(z_root() . '/profiles');
return; // NOTREACHED
}
@@ -83,9 +83,9 @@ function profiles_init(&$a) {
info( t('New profile created.') . EOL);
if(count($r3) == 1)
- goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
+ goaway(z_root() . '/profiles/' . $r3[0]['id']);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway(z_root() . '/profiles');
}
if((argc() > 2) && (argv(1) === 'clone')) {
@@ -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']);
@@ -129,9 +129,9 @@ function profiles_init(&$a) {
profiles_build_sync(local_channel());
if(($r3) && (count($r3) == 1))
- goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
+ goaway(z_root() . '/profiles/' . $r3[0]['id']);
- goaway($a->get_baseurl(true) . '/profiles');
+ goaway(z_root() . '/profiles');
return; // NOTREACHED
}
@@ -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,8 +628,8 @@ function profiles_content(&$a) {
// if(feature_enabled(local_channel(),'richtext'))
// $editselect = 'textareas';
- $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
- '$baseurl' => $a->get_baseurl(true),
+ App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
+ '$baseurl' => z_root(),
'$editselect' => $editselect,
));
@@ -703,7 +703,7 @@ function profiles_content(&$a) {
'$lbl_gender' => t('Your gender'),
'$lbl_marital' => t('Marital status'),
'$lbl_sexual' => t('Sexual preference'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$profile_id' => $r[0]['id'],
'$profile_name' => array('profile_name', t('Profile name'), $r[0]['profile_name'], t('Required'), '*'),
'$is_default' => $is_default,
@@ -767,7 +767,7 @@ function profiles_content(&$a) {
'$profile_name' => $rr['profile_name'],
'$visible' => (($rr['is_default'])
? '<strong>' . translate_scope(map_scope($channel['channel_r_profile'])) . '</strong>'
- : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
+ : '<a href="' . z_root() . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
));
}
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/randprof.php b/mod/randprof.php
index 9817685c8..124117e96 100644
--- a/mod/randprof.php
+++ b/mod/randprof.php
@@ -8,5 +8,5 @@ function randprof_init(&$a) {
goaway(chanlink_url($x));
/** FIXME this doesn't work at the moment as a fallback */
- goaway($a->get_baseurl() . '/profile');
+ goaway(z_root() . '/profile');
}
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..979f96f85 100644
--- a/mod/rbmark.php
+++ b/mod/rbmark.php
@@ -1,6 +1,6 @@
<?php /** @file */
-require_once('acl_selectors.php');
+require_once('include/acl_selectors.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/taxonomy.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/register.php b/mod/register.php
index b533483f7..712691547 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -206,7 +206,7 @@ function register_content(&$a) {
$tosurl = get_config('system','tos_url');
if(! $tosurl)
- $tosurl = $a->get_baseurl() . '/help/TermsOfService';
+ $tosurl = z_root() . '/help/TermsOfService';
$toslink = '<a href="' . $tosurl . '" target="_blank">' . t('Terms of Service') . '</a>';
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 f3fa53f75..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']))
@@ -52,7 +52,7 @@ function removeaccount_content(&$a) {
$_SESSION['remove_account_verify'] = $hash;
$tpl = get_markup_template('removeaccount.tpl');
$o .= replace_macros($tpl, array(
- '$basedir' => $a->get_baseurl(),
+ '$basedir' => z_root(),
'$hash' => $hash,
'$title' => t('Remove This Account'),
'$desc' => array(t('WARNING: '), t('This account and all its channels will be completely removed from the network. '), t('This action is permanent and can not be undone!')),
diff --git a/mod/removeme.php b/mod/removeme.php
index b604bc7db..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;
@@ -52,7 +52,7 @@ function removeme_content(&$a) {
$tpl = get_markup_template('removeme.tpl');
$o .= replace_macros($tpl, array(
- '$basedir' => $a->get_baseurl(),
+ '$basedir' => z_root(),
'$hash' => $hash,
'$title' => t('Remove This Channel'),
'$desc' => array(t('WARNING: '), t('This channel will be completely removed from the network. '), t('This action is permanent and can not be undone!')),
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..69b8c7b7e 100644
--- a/mod/rpost.php
+++ b/mod/rpost.php
@@ -1,6 +1,6 @@
<?php /** @file */
-require_once('acl_selectors.php');
+require_once('include/acl_selectors.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/taxonomy.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/rsd_xml.php b/mod/rsd_xml.php
index 6fd9514cd..4ce82dbe0 100644
--- a/mod/rsd_xml.php
+++ b/mod/rsd_xml.php
@@ -10,7 +10,7 @@ function rsd_xml_content(&$a) {
<engineName>Red</engineName>
<engineLink>http://friendica.com/</engineLink>
<apis>
- <api name="Twitter" preferred="true" apiLink="'.$a->get_baseurl().'/api/" blogID="">
+ <api name="Twitter" preferred="true" apiLink="'.z_root().'/api/" blogID="">
<settings>
<docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
<setting name="OAuth">false</setting>
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/search_ac.php b/mod/search_ac.php
index 19c1dc940..6ffdc6ed5 100644
--- a/mod/search_ac.php
+++ b/mod/search_ac.php
@@ -50,7 +50,7 @@ function search_ac_init(&$a){
if(count($r)) {
foreach($r as $g) {
$results[] = array(
- "photo" => $a->get_baseurl() . '/images/hashtag.png',
+ "photo" => z_root() . '/images/hashtag.png',
"name" => '#'.$g['term'],
"id" => $g['tid'],
"link" => $g['url'],
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 a6655f46a..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));
@@ -57,7 +57,7 @@ function settings_post(&$a) {
q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
dbesc($key),
local_channel());
- goaway($a->get_baseurl(true)."/settings/oauth/");
+ goaway(z_root()."/settings/oauth/");
return;
}
@@ -114,7 +114,7 @@ function settings_post(&$a) {
);
}
}
- goaway($a->get_baseurl(true)."/settings/oauth/");
+ goaway(z_root()."/settings/oauth/");
return;
}
@@ -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);
@@ -211,7 +211,7 @@ function settings_post(&$a) {
call_hooks('display_settings_post', $_POST);
build_sync_packet();
- goaway($a->get_baseurl(true) . '/settings/display' );
+ goaway(z_root() . '/settings/display' );
return; // NOTREACHED
}
@@ -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",
@@ -294,7 +294,7 @@ function settings_post(&$a) {
foreach($errs as $err)
notice($err . EOL);
}
- goaway($a->get_baseurl(true) . '/settings/account' );
+ goaway(z_root() . '/settings/account' );
}
@@ -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,14 +556,14 @@ 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?
}
- goaway($a->get_baseurl(true) . '/settings' );
+ goaway(z_root() . '/settings' );
return; // NOTREACHED
}
@@ -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']);
@@ -637,7 +637,7 @@ function settings_content(&$a) {
$r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
dbesc(argv(3)),
local_channel());
- goaway($a->get_baseurl(true)."/settings/oauth/");
+ goaway(z_root()."/settings/oauth/");
return;
}
@@ -653,7 +653,7 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_oauth.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$title' => t('Connected Apps'),
'$add' => t('Add application'),
'$edit' => t('Edit'),
@@ -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");
@@ -847,7 +847,7 @@ function settings_content(&$a) {
'$d_cset' => t('Content Settings'),
'$form_security_token' => get_form_security_token("settings_display"),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$uid' => local_channel(),
'$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
@@ -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') . ' ' . $a->get_baseurl(true) . '/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');
@@ -1039,7 +1039,7 @@ function settings_content(&$a) {
'$ptitle' => t('Channel Settings'),
'$submit' => t('Submit'),
- '$baseurl' => $a->get_baseurl(true),
+ '$baseurl' => z_root(),
'$uid' => local_channel(),
'$form_security_token' => get_form_security_token("settings"),
'$nickname_block' => $prof_addr,
diff --git a/mod/setup.php b/mod/setup.php
index 282b9cbef..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);
}
@@ -291,7 +291,7 @@ function setup_content(&$a) {
'$next' => t('Next'),
'$reload' => t('Check again'),
'$phpath' => $phpath,
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
));
return $o;
}; break;
@@ -329,7 +329,7 @@ function setup_content(&$a) {
'$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')),
'$lbl_10' => t('Please select a default timezone for your website'),
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$phpath' => $phpath,
@@ -372,7 +372,7 @@ function setup_content(&$a) {
'$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()),
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => z_root(),
'$submit' => t('Submit'),
));
@@ -633,7 +633,7 @@ function check_htaccess(&$checks) {
$help = '';
$ssl_error = false;
- $url = $a->get_baseurl() . '/setup/testrewrite';
+ $url = z_root() . '/setup/testrewrite';
if (function_exists('curl_init')){
$test = z_fetch_url($url);
@@ -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>";
@@ -733,7 +733,7 @@ function what_next() {
require_once ('include/identity.php');
create_sys_channel();
- $baseurl = $a->get_baseurl();
+ $baseurl = z_root();
return
t('<h1>What next</h1>')
."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.')
diff --git a/mod/share.php b/mod/share.php
index 198a6b210..43206b487 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -1,7 +1,7 @@
<?php
require_once('include/security.php');
-require_once('bbcode.php');
+require_once('include/bbcode.php');
function share_init(&$a) {
@@ -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 ce087806e..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'))
@@ -134,7 +134,7 @@ function subthread_content(&$a) {
$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
- $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink );
diff --git a/mod/suggest.php b/mod/suggest.php
index 438d884ca..ca888310a 100644
--- a/mod/suggest.php
+++ b/mod/suggest.php
@@ -27,7 +27,7 @@ function suggest_content(&$a) {
return;
}
- $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
+ $_SESSION['return_url'] = z_root() . '/' . App::$cmd;
$r = suggestion_query(local_channel(),get_observer_hash());
@@ -40,7 +40,7 @@ function suggest_content(&$a) {
foreach($r as $rr) {
- $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['xchan_addr'];
+ $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr'];
$arr[] = array(
'url' => chanlink_url($rr['xchan_url']),
@@ -48,7 +48,7 @@ function suggest_content(&$a) {
'profile' => $rr['xchan_url'],
'name' => $rr['xchan_name'],
'photo' => $rr['xchan_photo_m'],
- 'ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['xchan_hash'],
+ 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
'conntxt' => t('Connect'),
'connlnk' => $connlnk,
'ignore' => t('Ignore/Hide')
diff --git a/mod/tagger.php b/mod/tagger.php
index 27a8a15ea..330b65b91 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -80,9 +80,9 @@ function tagger_content(&$a) {
$link = xmlify('<link rel="alternate" type="text/html" href="'
- . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
+ . z_root() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
- $tagid = $a->get_baseurl() . '/search?tag=' . $term;
+ $tagid = z_root() . '/search?tag=' . $term;
$objtype = ACTIVITY_OBJ_TAGTERM;
$obj = json_encode(array(
@@ -98,9 +98,9 @@ function tagger_content(&$a) {
// saving here for reference
// also check out x22d5 and x2317 and x0d6b and x0db8 and x24d0 and xff20 !!!
- $termlink = html_entity_decode('&#x22d5;') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]';
+ $termlink = html_entity_decode('&#x22d5;') . '[zrl=' . z_root() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]';
- $channel = $a->get_channel();
+ $channel = App::get_channel();
$arr = array();
diff --git a/mod/tagrm.php b/mod/tagrm.php
index 56e842fb8..e10bbad73 100644
--- a/mod/tagrm.php
+++ b/mod/tagrm.php
@@ -1,15 +1,15 @@
<?php
-require_once('bbcode.php');
+require_once('include/bbcode.php');
function tagrm_post(&$a) {
if(! local_channel())
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
if((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel')))
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$tag = ((x($_POST,'tag')) ? trim($_POST['tag']) : '');
$item = ((x($_POST,'item')) ? intval($_POST['item']) : 0 );
@@ -20,7 +20,7 @@ function tagrm_post(&$a) {
);
if(! $r)
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$r = fetch_post_tags($r,true);
@@ -42,7 +42,7 @@ function tagrm_post(&$a) {
item_store_update($item);
info( t('Tag removed') . EOL );
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
// NOTREACHED
@@ -53,7 +53,7 @@ function tagrm_post(&$a) {
function tagrm_content(&$a) {
if(! local_channel()) {
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
@@ -69,7 +69,7 @@ function tagrm_content(&$a) {
);
if(! $r)
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$r = fetch_post_tags($r,true);
@@ -92,7 +92,7 @@ function tagrm_content(&$a) {
item_store_update($item);
info( t('Tag removed') . EOL );
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
}
@@ -109,12 +109,12 @@ function tagrm_content(&$a) {
);
if(! $r)
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$r = fetch_post_tags($r,true);
if(! count($r[0]['term']))
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway(z_root() . '/' . $_SESSION['photo_return']);
$o .= '<h3>' . t('Remove Item Tag') . '</h3>';
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/toggle_mobile.php b/mod/toggle_mobile.php
index 06dadca04..918c4aad6 100644
--- a/mod/toggle_mobile.php
+++ b/mod/toggle_mobile.php
@@ -10,7 +10,7 @@ function toggle_mobile_init(&$a) {
if(isset($_GET['address']))
$address = $_GET['address'];
else
- $address = $a->get_baseurl();
+ $address = z_root();
goaway($address);
}
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 ed8e1eabe..463cda662 100644
--- a/mod/xrd.php
+++ b/mod/xrd.php
@@ -28,8 +28,8 @@ function xrd_init(&$a) {
killme();
$dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'),array(
- '$baseurl' => $a->get_baseurl(),
- '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',$a->get_hostname()),
+ '$baseurl' => z_root(),
+ '$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)
@@ -51,17 +51,17 @@ function xrd_init(&$a) {
'$nick' => $r[0]['channel_address'],
'$accturi' => $resource,
'$aliases' => $aliases,
- '$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'],
- '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'],
- '$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'],
- '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['channel_address'],
- '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['channel_address'],
- '$photo' => $a->get_baseurl() . '/photo/profile/l/' . $r[0]['channel_id'],
+ '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'],
+ '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'],
+ '$atom' => z_root() . '/feed/' . $r[0]['channel_address'],
+ '$zot_post' => z_root() . '/post/' . $r[0]['channel_address'],
+ '$poco_url' => z_root() . '/poco/' . $r[0]['channel_address'],
+ '$photo' => z_root() . '/photo/profile/l/' . $r[0]['channel_id'],
'$dspr' => $dspr,
-// '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'],
-// '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention',
+// '$salmon' => z_root() . '/salmon/' . $r[0]['channel_address'],
+// '$salmen' => z_root() . '/salmon/' . $r[0]['channel_address'] . '/mention',
'$modexp' => 'data:application/magic-public-key,' . $salmon_key,
- '$subscribe' => $a->get_baseurl() . '/follow?url={uri}',
+ '$subscribe' => z_root() . '/follow?url={uri}',
'$bigkey' => salmon_key($r[0]['channel_pubkey'])
));
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);