aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php20
-rw-r--r--include/ConversationObject.php6
-rw-r--r--include/Import/import_diaspora.php2
-rw-r--r--include/ItemObject.php2
-rw-r--r--include/account.php8
-rw-r--r--include/acl_selectors.php12
-rw-r--r--include/activities.php2
-rw-r--r--include/api.php62
-rw-r--r--include/api_auth.php4
-rw-r--r--include/apps.php10
-rw-r--r--include/attach.php4
-rw-r--r--include/auth.php16
-rw-r--r--include/bbcode.php22
-rw-r--r--include/cli_startup.php6
-rw-r--r--include/comanche.php28
-rw-r--r--include/config.php146
-rw-r--r--include/contact_widgets.php8
-rw-r--r--include/conversation.php64
-rw-r--r--include/datetime.php2
-rw-r--r--include/dir_fns.php6
-rw-r--r--include/enotify.php8
-rw-r--r--include/event.php4
-rw-r--r--include/identity.php154
-rwxr-xr-xinclude/items.php24
-rw-r--r--include/language.php36
-rw-r--r--include/menu.php6
-rw-r--r--include/message.php6
-rw-r--r--include/nav.php34
-rw-r--r--include/network.php12
-rw-r--r--include/oauth.php2
-rwxr-xr-xinclude/oembed.php10
-rw-r--r--include/permissions.php4
-rw-r--r--include/photos.php6
-rwxr-xr-xinclude/plugin.php54
-rw-r--r--include/security.php32
-rw-r--r--include/session.php4
-rwxr-xr-xinclude/smarty.php18
-rw-r--r--include/socgraph.php2
-rw-r--r--include/taxonomy.php2
-rw-r--r--include/text.php80
-rw-r--r--include/widgets.php100
-rw-r--r--include/zot.php28
42 files changed, 528 insertions, 528 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 727d4b062..507c922d0 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -75,12 +75,12 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
$a = get_app();
if(! $xchan) {
- if($a->poi) {
- $xchan = $a->poi;
+ if(App::$poi) {
+ $xchan = App::$poi;
}
- elseif(is_array($a->profile) && $a->profile['channel_hash']) {
+ elseif(is_array(App::$profile) && App::$profile['channel_hash']) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
- dbesc($a->profile['channel_hash'])
+ dbesc(App::$profile['channel_hash'])
);
if($r)
$xchan = $r[0];
@@ -102,7 +102,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
}
if(array_key_exists('channel_id',$xchan))
- $a->profile_uid = $xchan['channel_id'];
+ App::$profile_uid = $xchan['channel_id'];
$url = (($observer)
? z_root() . '/magic?f=&dest=' . $xchan['xchan_url'] . '&addr=' . $xchan['xchan_addr']
@@ -111,7 +111,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
return replace_macros(get_markup_template('xchan_vcard.tpl'),array(
'$name' => $xchan['xchan_name'],
- '$photo' => ((is_array($a->profile) && array_key_exists('photo',$a->profile)) ? $a->profile['photo'] : $xchan['xchan_photo_l']),
+ '$photo' => ((is_array(App::$profile) && array_key_exists('photo',App::$profile)) ? App::$profile['photo'] : $xchan['xchan_photo_l']),
'$follow' => $xchan['xchan_addr'],
'$link' => zid($xchan['xchan_url']),
'$connect' => $connect,
@@ -333,19 +333,19 @@ function channel_remove($channel_id, $local = true, $unset_session=false) {
);
// if this was the default channel, set another one as default
- if($a->account['account_default_channel'] == $channel_id) {
+ if(App::$account['account_default_channel'] == $channel_id) {
$r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1",
- intval($a->account['account_id']),
+ intval(App::$account['account_id']),
intval(PAGE_REMOVED));
if ($r) {
$rr = q("update account set account_default_channel = %d where account_id = %d",
intval($r[0]['channel_id']),
- intval($a->account['account_id']));
+ intval(App::$account['account_id']));
logger("Default channel deleted, changing default to channel_id " . $r[0]['channel_id']);
}
else {
$rr = q("update account set account_default_channel = 0 where account_id = %d",
- intval($a->account['account_id'])
+ intval(App::$account['account_id'])
);
}
}
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index 66f6cca0e..82f381b0c 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -48,7 +48,7 @@ class Conversation extends BaseObject {
$a = $this->get_app();
- $this->observer = $a->get_observer();
+ $this->observer = App::get_observer();
$ob_hash = (($this->observer) ? $this->observer['xchan_hash'] : '');
switch($mode) {
@@ -57,7 +57,7 @@ class Conversation extends BaseObject {
$this->writable = true;
break;
case 'channel':
- $this->profile_owner = $a->profile['profile_uid'];
+ $this->profile_owner = App::$profile['profile_uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
break;
case 'display':
@@ -67,7 +67,7 @@ class Conversation extends BaseObject {
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
break;
case 'page':
- $this->profile_owner = $a->profile['uid'];
+ $this->profile_owner = App::$profile['uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
break;
default:
diff --git a/include/Import/import_diaspora.php b/include/Import/import_diaspora.php
index a0f473b50..a94e73395 100644
--- a/include/Import/import_diaspora.php
+++ b/include/Import/import_diaspora.php
@@ -8,7 +8,7 @@ require_once('include/photo/photo_driver.php');
function import_diaspora($data) {
$a = get_app();
- $account = $a->get_account();
+ $account = App::get_account();
if(! $account)
return false;
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 623bf0676..9d5acd95f 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -714,7 +714,7 @@ class Item extends BaseObject {
'$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false),
'$encrypt' => t('Encrypt text'),
'$cipher' => $conv->get_cipher(),
- '$sourceapp' => get_app()->sourcename
+ '$sourceapp' => App::$sourcename
));
diff --git a/include/account.php b/include/account.php
index 4c828003e..c64197b49 100644
--- a/include/account.php
+++ b/include/account.php
@@ -248,7 +248,7 @@ function verify_email_address($arr) {
$res = mail($arr['email'], email_header_encode(sprintf( t('Registration confirmation for %s'), get_config('system','sitename'))),
$email_msg,
- 'From: ' . 'Administrator' . '@' . get_app()->get_hostname() . "\n"
+ 'From: ' . 'Administrator' . '@' . App::get_hostname() . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit'
);
@@ -314,7 +314,7 @@ function send_reg_approval_email($arr) {
$res = mail($admin['email'], sprintf( t('Registration request at %s'), get_config('system','sitename')),
$email_msg,
- 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n"
+ 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit'
);
@@ -341,7 +341,7 @@ function send_register_success_email($email,$password) {
$res = mail($email, sprintf( t('Registration details for %s'), get_config('system','sitename')),
$email_msg,
- 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n"
+ 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit'
);
@@ -655,7 +655,7 @@ function account_service_class_allows($aid, $property, $usage = false) {
function service_class_fetch($uid, $property) {
$a = get_app();
if($uid == local_channel()) {
- $service_class = $a->account['account_service_class'];
+ $service_class = App::$account['account_service_class'];
}
else {
$r = q("select account_service_class as service_class
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 3c8f34321..92f9436a2 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -23,7 +23,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
// e.g. 'network_pre_group_deny', 'profile_pre_group_allow'
- call_hooks($a->module . '_pre_' . $selname, $arr);
+ call_hooks(App::$module . '_pre_' . $selname, $arr);
if($r) {
foreach($r as $rr) {
@@ -39,7 +39,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
}
$o .= "</select>\r\n";
- call_hooks($a->module . '_post_' . $selname, $o);
+ call_hooks(App::$module . '_post_' . $selname, $o);
return $o;
@@ -127,7 +127,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
- call_hooks($a->module . '_pre_' . $selname, $arr);
+ call_hooks(App::$module . '_pre_' . $selname, $arr);
if(count($r)) {
foreach($r as $rr) {
@@ -145,7 +145,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$o .= "</select>\r\n";
- call_hooks($a->module . '_post_' . $selname, $o);
+ call_hooks(App::$module . '_post_' . $selname, $o);
return $o;
}*/
@@ -182,7 +182,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
- call_hooks($a->module . '_pre_' . $selname, $arr);
+ call_hooks(App::$module . '_pre_' . $selname, $arr);
if($r) {
foreach($r as $rr) {
@@ -200,7 +200,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o .= "</select>\r\n";
- call_hooks($a->module . '_post_' . $selname, $o);
+ call_hooks(App::$module . '_post_' . $selname, $o);
return $o;
}
diff --git a/include/activities.php b/include/activities.php
index df43f1f6f..9ba191391 100644
--- a/include/activities.php
+++ b/include/activities.php
@@ -11,7 +11,7 @@ function profile_activity($changed, $value) {
require_once('include/items.php');
- $self = $a->get_channel();
+ $self = App::get_channel();
if(! count($self))
return;
diff --git a/include/api.php b/include/api.php
index 73fd58d4d..41837ad88 100644
--- a/include/api.php
+++ b/include/api.php
@@ -34,7 +34,7 @@ require_once('include/api_auth.php');
function api_user() {
$aid = get_account_id();
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if(($aid) && (x($_REQUEST,'channel'))) {
@@ -79,7 +79,7 @@ require_once('include/api_auth.php');
$type="json";
foreach ($API as $p=>$info){
- if (strpos($a->query_string, $p)===0){
+ if (strpos(App::$query_string, $p)===0){
$called_api= explode("/",$p);
//unset($_SERVER['PHP_AUTH_USER']);
if ($info['auth'] === true && api_user() === false) {
@@ -88,18 +88,18 @@ require_once('include/api_auth.php');
load_contact_links(api_user());
- $channel = $a->get_channel();
+ $channel = App::get_channel();
- logger('API call for ' . $channel['channel_name'] . ': ' . $a->query_string);
+ logger('API call for ' . $channel['channel_name'] . ': ' . App::$query_string);
logger('API parameters: ' . print_r($_REQUEST,true));
$type="json";
- if (strpos($a->query_string, ".xml")>0) $type="xml";
- if (strpos($a->query_string, ".json")>0) $type="json";
- if (strpos($a->query_string, ".rss")>0) $type="rss";
- if (strpos($a->query_string, ".atom")>0) $type="atom";
- if (strpos($a->query_string, ".as")>0) $type="as";
+ if (strpos(App::$query_string, ".xml")>0) $type="xml";
+ if (strpos(App::$query_string, ".json")>0) $type="json";
+ if (strpos(App::$query_string, ".rss")>0) $type="rss";
+ if (strpos(App::$query_string, ".atom")>0) $type="atom";
+ if (strpos(App::$query_string, ".as")>0) $type="as";
$r = call_user_func($info['func'], $a, $type);
if ($r===false) return;
@@ -141,7 +141,7 @@ require_once('include/api_auth.php');
}
}
header("HTTP/1.1 404 Not Found");
- logger('API call not implemented: '.$a->query_string." - ".print_r($_REQUEST,true));
+ logger('API call not implemented: '.App::$query_string." - ".print_r($_REQUEST,true));
$r = '<status><error>not implemented</error></status>';
switch($type){
case "xml":
@@ -171,7 +171,7 @@ require_once('include/api_auth.php');
$arr['$user'] = $user_info;
$arr['$rss'] = array(
'alternate' => $user_info['url'],
- 'self' => z_root(). "/". $a->query_string,
+ 'self' => z_root(). "/". App::$query_string,
'base' => z_root(),
'updated' => api_date(null),
'atom_updated' => datetime_convert('UTC','UTC','now',ATOM_TIME),
@@ -213,7 +213,7 @@ require_once('include/api_auth.php');
$extra_query .= " AND abook_channel = ".intval(api_user());
}
- if (is_null($user) && argc() > (count($called_api)-1) && (strstr($a->cmd,'/users'))){
+ if (is_null($user) && argc() > (count($called_api)-1) && (strstr(App::$cmd,'/users'))){
$argid = count($called_api);
list($xx, $null) = explode(".",argv($argid));
if(is_numeric($xx)){
@@ -326,7 +326,7 @@ require_once('include/api_auth.php');
'time_zone' => 'UTC', //$uinfo[0]['timezone'],
'geo_enabled' => false,
'statuses_count' => intval($countitms), //#XXX: fix me
- 'lang' => get_app()->language,
+ 'lang' => App::$language,
'description' => (($profile) ? $profile[0]['pdesc'] : ''),
'followers_count' => intval($countfollowers),
'favourites_count' => intval($starred),
@@ -635,13 +635,13 @@ require_once('include/api_auth.php');
function api_albums(&$a,$type) {
- json_return_and_die(photos_albums_list($a->get_channel(),$a->get_observer()));
+ json_return_and_die(photos_albums_list(App::get_channel(),App::get_observer()));
}
api_register_func('api/red/albums','api_albums', true);
function api_photos(&$a,$type) {
$album = $_REQUEST['album'];
- json_return_and_die(photos_list_photos($a->get_channel(),$a->get_observer(),$album));
+ json_return_and_die(photos_list_photos(App::get_channel(),App::get_observer(),$album));
}
api_register_func('api/red/photos','api_photos', true);
@@ -768,7 +768,7 @@ require_once('include/api_auth.php');
}
$txt = html2bbcode($txt);
- $a->argv[1] = $user_info['screen_name'];
+ App::$argv[1] = $user_info['screen_name'];
$_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
$_FILES['userfile'] = $_FILES['media'];
@@ -872,7 +872,7 @@ require_once('include/api_auth.php');
// upload each image if we have any
$_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
require_once('mod/wall_attach.php');
- $a->data['api_info'] = $user_info;
+ App::$data['api_info'] = $user_info;
$media = wall_attach_post($a);
if(strlen($media)>0)
@@ -885,7 +885,7 @@ require_once('include/api_auth.php');
// upload each image if we have any
$_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
require_once('mod/wall_attach.php');
- $a->data['api_info'] = $user_info;
+ App::$data['api_info'] = $user_info;
$media = wall_attach_post($a);
if(strlen($media)>0)
@@ -960,7 +960,7 @@ require_once('include/api_auth.php');
$arr['records'] = 999999;
$arr['item_type'] = '*';
- $i = items_fetch($arr,$a->get_channel(),get_observer_hash());
+ $i = items_fetch($arr,App::get_channel(),get_observer_hash());
if(! $i)
json_return_and_die(array());
@@ -1230,7 +1230,7 @@ require_once('include/api_auth.php');
$sql_extra .= ' AND `item`.`parent` = `item`.`id`';
if (api_user() != $user_info['uid']) {
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
require_once('include/permissions.php');
if(! perm_is_allowed($user_info['uid'],(($observer) ? $observer['xchan_hash'] : ''),'view_stream'))
return '';
@@ -1272,7 +1272,7 @@ require_once('include/api_auth.php');
break;
case "as":
$as = api_format_as($a, $ret, $user_info);
- $as['title'] = $a->config['sitename']." Home Timeline";
+ $as['title'] = App::$config['sitename']." Home Timeline";
$as['link']['url'] = z_root()."/".$user_info["screen_name"]."/all";
return($as);
break;
@@ -1333,7 +1333,7 @@ require_once('include/api_auth.php');
break;
case "as":
$as = api_format_as($a, $ret, $user_info);
- $as['title'] = $a->config['sitename']. " " . t('Public Timeline');
+ $as['title'] = App::$config['sitename']. " " . t('Public Timeline');
$as['link']['url'] = z_root()."/";
return($as);
break;
@@ -1409,7 +1409,7 @@ require_once('include/api_auth.php');
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
$item_normal = item_normal();
@@ -1526,7 +1526,7 @@ require_once('include/api_auth.php');
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
- $myurl = z_root() . '/channel/'. $a->user['nickname'];
+ $myurl = z_root() . '/channel/'. App::$user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/channel/','/u/',$myurl);
@@ -1561,7 +1561,7 @@ require_once('include/api_auth.php');
break;
case "as":
$as = api_format_as($a, $ret, $user_info);
- $as["title"] = $a->config['sitename']." Mentions";
+ $as["title"] = App::$config['sitename']." Mentions";
$as['link']['url'] = z_root()."/";
return($as);
break;
@@ -1633,7 +1633,7 @@ require_once('include/api_auth.php');
$arr['cid'] = $user_info['id'];
- $r = items_fetch($arr,get_app()->get_channel(),get_observer_hash());
+ $r = items_fetch($arr,App::get_channel(),get_observer_hash());
$ret = api_format_items($r,$user_info);
@@ -1752,7 +1752,7 @@ require_once('include/api_auth.php');
$sql_extra .= ' AND `item`.`parent` = `item`.`id`';
if (api_user() != $user_info['uid']) {
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
require_once('include/permissions.php');
if(! perm_is_allowed($user_info['uid'],(($observer) ? $observer['xchan_hash'] : ''),'view_stream'))
return '';
@@ -1783,7 +1783,7 @@ require_once('include/api_auth.php');
break;
case "as":
$as = api_format_as($a, $ret, $user_info);
- $as['title'] = $a->config['sitename']." Home Timeline";
+ $as['title'] = App::$config['sitename']." Home Timeline";
$as['link']['url'] = z_root()."/".$user_info["screen_name"]."/all";
return($as);
break;
@@ -1801,7 +1801,7 @@ require_once('include/api_auth.php');
function api_format_as($a, $ret, $user_info) {
$as = array();
- $as['title'] = $a->config['sitename']." Public Timeline";
+ $as['title'] = App::$config['sitename']." Public Timeline";
$items = array();
foreach ($ret as $item) {
$singleitem["actor"]["displayName"] = $item["user"]["name"];
@@ -2088,7 +2088,7 @@ require_once('include/api_auth.php');
load_config('system');
$name = get_config('system','sitename');
- $server = $a->get_hostname();
+ $server = App::get_hostname();
$logo = z_root() . '/images/rm-64.png';
$email = get_config('system','admin_email');
$closed = ((get_config('system','register_policy') == REGISTER_CLOSED) ? 'true' : 'false');
@@ -2270,7 +2270,7 @@ require_once('include/api_auth.php');
if ($page<0) $page=0;
$start = $page*$count;
- $channel = $a->get_channel();
+ $channel = App::get_channel();
$profile_url = z_root() . '/channel/' . $channel['channel_address'];
if ($box=="sentbox") {
diff --git a/include/api_auth.php b/include/api_auth.php
index 26a9df8d4..dc8492b20 100644
--- a/include/api_auth.php
+++ b/include/api_auth.php
@@ -20,9 +20,9 @@ function api_login(&$a){
if (!is_null($token)){
$oauth->loginUser($token->uid);
- $a->set_oauth_key($consumer->key);
+ App::set_oauth_key($consumer->key);
- call_hooks('logged_in', $a->user);
+ call_hooks('logged_in', App::$user);
return;
}
killme();
diff --git a/include/apps.php b/include/apps.php
index 0a62dc5a8..fac58b850 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -48,12 +48,12 @@ function parse_app_description($f) {
$ret = array();
$baseurl = z_root();
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
$address = (($channel) ? $channel['channel_address'] : '');
//future expansion
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
$lines = @file($f);
@@ -217,7 +217,7 @@ function app_render($papp,$mode = 'view') {
return '';
break;
case 'observer':
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
if(! $observer)
return '';
break;
@@ -239,7 +239,7 @@ function app_render($papp,$mode = 'view') {
$hosturl = z_root() . '/';
}
elseif(remote_channel()) {
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
if($observer && $observer['xchan_network'] === 'zot') {
// some folks might have xchan_url redirected offsite, use the connurl
$x = parse_url($observer['xchan_connurl']);
@@ -354,7 +354,7 @@ function app_store($arr) {
}
- $darray['app_id'] = ((x($arr,'guid')) ? $arr['guid'] : random_string(). '.' . get_app()->get_hostname());
+ $darray['app_id'] = ((x($arr,'guid')) ? $arr['guid'] : random_string(). '.' . App::get_hostname());
$darray['app_sig'] = ((x($arr,'sig')) ? $arr['sig'] : '');
$darray['app_author'] = ((x($arr,'author')) ? $arr['author'] : get_observer_hash());
$darray['app_name'] = ((x($arr,'name')) ? escape_tags($arr['name']) : t('Unknown'));
diff --git a/include/attach.php b/include/attach.php
index 343922a52..4ecc273e9 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -1477,7 +1477,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
require_once('include/items.php');
- $poster = get_app()->get_observer();
+ $poster = App::get_observer();
//if we got no object something went wrong
if(!$object)
@@ -1696,7 +1696,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
$ret = array();
$parent_arr = array();
$count_values = array();
- $poster = get_app()->get_observer();
+ $poster = App::get_observer();
//turn allow_gid into allow_cid's
foreach($arr_allow_gid as $gid) {
diff --git a/include/auth.php b/include/auth.php
index 1a7110c20..aaec45c40 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -97,7 +97,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
// process a logout request
- if(((x($_POST, 'auth-params')) && ($_POST['auth-params'] === 'logout')) || ($a->module === 'logout')) {
+ if(((x($_POST, 'auth-params')) && ($_POST['auth-params'] === 'logout')) || (App::$module === 'logout')) {
// process logout request
$args = array('channel_id' => local_channel());
call_hooks('logging_out', $args);
@@ -128,13 +128,13 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
dbesc($_SESSION['visitor_id'])
);
if($r) {
- get_app()->set_observer($r[0]);
+ App::set_observer($r[0]);
}
else {
unset($_SESSION['visitor_id']);
unset($_SESSION['authenticated']);
}
- $a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
+ App::set_groups(init_groups_visitor($_SESSION['visitor_id']));
}
// already logged in user returning
@@ -183,7 +183,7 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
);
if(($r) && (($r[0]['account_flags'] == ACCOUNT_OK) || ($r[0]['account_flags'] == ACCOUNT_UNVERIFIED))) {
- get_app()->account = $r[0];
+ App::$account = $r[0];
$login_refresh = false;
if(! x($_SESSION,'last_login_date')) {
$_SESSION['last_login_date'] = datetime_convert('UTC','UTC');
@@ -237,16 +237,16 @@ else {
$record = $addon_auth['user_record'];
}
else {
- $record = get_app()->account = account_verify_password($_POST['username'], $_POST['password']);
+ $record = App::$account = account_verify_password($_POST['username'], $_POST['password']);
- if(get_app()->account) {
- $_SESSION['account_id'] = get_app()->account['account_id'];
+ if(App::$account) {
+ $_SESSION['account_id'] = App::$account['account_id'];
}
else {
notice( t('Failed authentication') . EOL);
}
- logger('authenticate: ' . print_r(get_app()->account, true), LOGGER_DEBUG);
+ logger('authenticate: ' . print_r(App::$account, true), LOGGER_DEBUG);
}
if((! $record) || (! count($record))) {
diff --git a/include/bbcode.php b/include/bbcode.php
index e243db699..c2ff5d7c8 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -37,7 +37,7 @@ function tryzrlvideo($match) {
if($zrl)
$link = zid($link);
- return '<video controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
+ return '<video controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
}
// [noparse][i]italic[/i][/noparse] turns into
@@ -280,9 +280,9 @@ function bb_location($match) {
function bb_iframe($match) {
$a = get_app();
- $sandbox = ((strpos($match[1], $a->get_hostname())) ? ' sandbox="allow-scripts" ' : '');
+ $sandbox = ((strpos($match[1], App::get_hostname())) ? ' sandbox="allow-scripts" ' : '');
- return '<iframe ' . $sandbox . ' src="' . $match[1] . '" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="' . $match[1] . '">' . $match[1] . '</a></iframe>';
+ return '<iframe ' . $sandbox . ' src="' . $match[1] . '" width="' . App::$videowidth . '" height="' . App::$videoheight . '"><a href="' . $match[1] . '">' . $match[1] . '</a></iframe>';
}
function bb_ShareAttributesSimple($match) {
@@ -315,9 +315,9 @@ function bb_ShareAttributesSimple($match) {
function rpost_callback($match) {
if ($match[2]) {
- return str_replace($match[0], get_rpost_path(get_app()->get_observer()) . '&title=' . urlencode($match[2]) . '&body=' . urlencode($match[3]), $match[0]);
+ return str_replace($match[0], get_rpost_path(App::get_observer()) . '&title=' . urlencode($match[2]) . '&body=' . urlencode($match[3]), $match[0]);
} else {
- return str_replace($match[0], get_rpost_path(get_app()->get_observer()) . '&body=' . urlencode($match[3]), $match[0]);
+ return str_replace($match[0], get_rpost_path(App::get_observer()) . '&body=' . urlencode($match[3]), $match[0]);
}
}
@@ -401,7 +401,7 @@ function bb_observer($Text) {
$a = get_app();
- $observer = $a->get_observer();
+ $observer = App::get_observer();
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
if ($observer) {
@@ -415,7 +415,7 @@ function bb_observer($Text) {
}
}
- $channel = $a->get_channel();
+ $channel = App::get_channel();
if (strpos($Text,'[/channel]') !== false) {
if ($channel) {
@@ -477,7 +477,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
if($cache)
$observer = false;
else
- $observer = $a->get_observer();
+ $observer = App::get_observer();
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
if ($observer) {
@@ -494,7 +494,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
if($cache)
$channel = false;
else
- $channel = $a->get_channel();
+ $channel = App::get_channel();
if (strpos($Text,'[/channel]') !== false) {
if ($channel) {
@@ -930,7 +930,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
// $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
// if ($tryoembed)
-// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', $Text);
+// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . App::$videowidth . '" height="' . App::$videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', $Text);
// else
// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text);
// }
@@ -944,7 +944,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
// $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
// if ($tryoembed)
-// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
+// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . App::$videowidth . '" height="' . App::$videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
// else
// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "http://vimeo.com/$1", $Text);
// }
diff --git a/include/cli_startup.php b/include/cli_startup.php
index 70ab1a24a..6aa652a8f 100644
--- a/include/cli_startup.php
+++ b/include/cli_startup.php
@@ -18,8 +18,8 @@ function cli_startup() {
if(! defined('UNO'))
define('UNO', 0);
- $a->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
- date_default_timezone_set($a->timezone);
+ App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
+ date_default_timezone_set(App::$timezone);
require_once('include/dba/dba_driver.php');
$db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type);
@@ -30,7 +30,7 @@ function cli_startup() {
load_config('system');
- $a->set_baseurl(get_config('system','baseurl'));
+ App::set_baseurl(get_config('system','baseurl'));
load_hooks();
diff --git a/include/comanche.php b/include/comanche.php
index ddf331321..4d55aee19 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -56,34 +56,34 @@ function comanche_parser(&$a, $s, $pass = 0) {
if($pass == 0) {
$cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches);
if($cnt)
- $a->page['template'] = trim($matches[1]);
+ App::$page['template'] = trim($matches[1]);
$cnt = preg_match("/\[template=(.*?)\](.*?)\[\/template\]/ism", $s, $matches);
if($cnt) {
- $a->page['template'] = trim($matches[2]);
- $a->page['template_style'] = trim($matches[2]) . '_' . $matches[1];
+ App::$page['template'] = trim($matches[2]);
+ App::$page['template_style'] = trim($matches[2]) . '_' . $matches[1];
}
$cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $s, $matches);
if($cnt) {
- $a->page['template'] = trim($matches[1]);
+ App::$page['template'] = trim($matches[1]);
}
$cnt = preg_match("/\[theme=(.*?)\](.*?)\[\/theme\]/ism", $s, $matches);
if($cnt) {
- $a->layout['schema'] = trim($matches[1]);
- $a->layout['theme'] = trim($matches[2]);
+ App::$layout['schema'] = trim($matches[1]);
+ App::$layout['theme'] = trim($matches[2]);
}
$cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches);
if($cnt)
- $a->layout['theme'] = trim($matches[1]);
+ App::$layout['theme'] = trim($matches[1]);
$cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
// only the last webpage definition is used if there is more than one
foreach($matches as $mtch) {
- $a->layout['webpage'] = comanche_webpage($a,$mtch[1]);
+ App::$layout['webpage'] = comanche_webpage($a,$mtch[1]);
}
}
@@ -92,7 +92,7 @@ function comanche_parser(&$a, $s, $pass = 0) {
$cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $a->layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]);
+ App::$layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]);
}
}
@@ -122,8 +122,8 @@ function comanche_menu($s, $class = '') {
function comanche_replace_region($match) {
$a = get_app();
- if (array_key_exists($match[1], $a->page)) {
- return $a->page[$match[1]];
+ if (array_key_exists($match[1], App::$page)) {
+ return App::$page[$match[1]];
}
}
@@ -136,7 +136,7 @@ function comanche_replace_region($match) {
* @return channel_id
*/
function comanche_get_channel_id() {
- $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
+ $channel_id = ((is_array(App::$profile)) ? App::$profile['profile_uid'] : 0);
if ((! $channel_id) && (local_channel()))
$channel_id = local_channel();
@@ -190,7 +190,7 @@ function comanche_block($s, $class = '') {
}
if(trim($r[0]['body']) === '$content') {
- $o .= get_app()->page['content'];
+ $o .= App::$page['content'];
}
else {
$o .= prepare_text($r[0]['body'], $r[0]['mimetype']);
@@ -378,6 +378,6 @@ function comanche_region(&$a, $s) {
function register_page_template($arr) {
- get_app()->page_layouts[$arr['template']] = array($arr['variant']);
+ App::$page_layouts[$arr['template']] = array($arr['variant']);
return;
}
diff --git a/include/config.php b/include/config.php
index 28a72f7ea..712b4ca11 100644
--- a/include/config.php
+++ b/include/config.php
@@ -22,7 +22,7 @@
* an identifier. This is for example for people who do not have a local account.
* The storage is of size MEDIUMTEXT.
* @code{.php}
- * $observer = $a->get_observer_hash();
+ * $observer = App::get_observer_hash();
* if ($observer) {
* $var = get_xconfig($observer, 'category', 'key');
* }@endcode
@@ -38,7 +38,7 @@
* @brief Loads the hub's configuration from database to a cached storage.
*
* Retrieve a category ($family) of config variables from database to a cached
- * storage in the global $a->config[$family].
+ * storage in the global App::$config[$family].
*
* @param string $family
* The category of the configuration value
@@ -46,19 +46,19 @@
function load_config($family) {
global $a;
- if(! array_key_exists($family, $a->config))
- $a->config[$family] = array();
+ if(! array_key_exists($family, App::$config))
+ App::$config[$family] = array();
- if(! array_key_exists('config_loaded', $a->config[$family])) {
+ if(! array_key_exists('config_loaded', App::$config[$family])) {
$r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family));
if($r !== false) {
if($r) {
foreach($r as $rr) {
$k = $rr['k'];
- $a->config[$family][$k] = $rr['v'];
+ App::$config[$family][$k] = $rr['v'];
}
}
- $a->config[$family]['config_loaded'] = true;
+ App::$config[$family]['config_loaded'] = true;
}
}
}
@@ -68,7 +68,7 @@ function load_config($family) {
* and a key.
*
* Get a particular config variable from the given category ($family) and the
- * $key from a cached storage in $a->config[$family]. If a key is found in the
+ * $key from a cached storage in App::$config[$family]. If a key is found in the
* DB but does not exist in local config cache, pull it into the cache so we
* do not have to hit the DB again for this item.
*
@@ -83,16 +83,16 @@ function load_config($family) {
function get_config($family, $key) {
global $a;
- if((! array_key_exists($family, $a->config)) || (! array_key_exists('config_loaded', $a->config[$family])))
+ if((! array_key_exists($family, App::$config)) || (! array_key_exists('config_loaded', App::$config[$family])))
load_config($family);
- if(array_key_exists('config_loaded', $a->config[$family])) {
- if(! array_key_exists($key, $a->config[$family])) {
+ if(array_key_exists('config_loaded', App::$config[$family])) {
+ if(! array_key_exists($key, App::$config[$family])) {
return false;
}
- return ((! is_array($a->config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$family][$key]))
- ? unserialize($a->config[$family][$key])
- : $a->config[$family][$key]
+ return ((! is_array(App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$family][$key]))
+ ? unserialize(App::$config[$family][$key])
+ : App::$config[$family][$key]
);
}
return false;
@@ -148,7 +148,7 @@ function set_config($family, $key, $value) {
dbesc($dbvalue)
);
if($ret) {
- $a->config[$family][$key] = $value;
+ App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
@@ -161,7 +161,7 @@ function set_config($family, $key, $value) {
);
if($ret) {
- $a->config[$family][$key] = $value;
+ App::$config[$family][$key] = $value;
$ret = $value;
}
return $ret;
@@ -170,7 +170,7 @@ function set_config($family, $key, $value) {
/**
* @brief Deletes the given key from the hub's configuration database.
*
- * Removes the configured value from the stored cache in $a->config[$family]
+ * Removes the configured value from the stored cache in App::$config[$family]
* and removes it from the database.
*
* @param string $family
@@ -183,8 +183,8 @@ function del_config($family, $key) {
global $a;
$ret = false;
- if(array_key_exists($family, $a->config) && array_key_exists($key, $a->config[$family]))
- unset($a->config[$family][$key]);
+ if(array_key_exists($family, App::$config) && array_key_exists($key, App::$config[$family]))
+ unset(App::$config[$family][$key]);
$ret = q("DELETE FROM config WHERE cat = '%s' AND k = '%s'",
dbesc($family),
dbesc($key)
@@ -197,7 +197,7 @@ function del_config($family, $key) {
* @brief Loads all configuration values of a channel into a cached storage.
*
* All configuration values of the given channel are stored in global cache
- * which is available under the global variable $a->config[$uid].
+ * which is available under the global variable App::$config[$uid].
*
* @param string $uid
* The channel_id
@@ -209,8 +209,8 @@ function load_pconfig($uid) {
if($uid === false)
return false;
- if(! array_key_exists($uid, $a->config))
- $a->config[$uid] = array();
+ if(! array_key_exists($uid, App::$config))
+ App::$config[$uid] = array();
$r = q("SELECT * FROM pconfig WHERE uid = %d",
intval($uid)
@@ -220,11 +220,11 @@ function load_pconfig($uid) {
foreach($r as $rr) {
$k = $rr['k'];
$c = $rr['cat'];
- if(! array_key_exists($c, $a->config[$uid])) {
- $a->config[$uid][$c] = array();
- $a->config[$uid][$c]['config_loaded'] = true;
+ if(! array_key_exists($c, App::$config[$uid])) {
+ App::$config[$uid][$c] = array();
+ App::$config[$uid][$c]['config_loaded'] = true;
}
- $a->config[$uid][$c][$k] = $rr['v'];
+ App::$config[$uid][$c][$k] = $rr['v'];
}
}
}
@@ -234,7 +234,7 @@ function load_pconfig($uid) {
* ($family) and a key.
*
* Get a particular channel's config value from the given category ($family)
- * and the $key from a cached storage in $a->config[$uid].
+ * and the $key from a cached storage in App::$config[$uid].
*
* Returns false if not set.
*
@@ -254,15 +254,15 @@ function get_pconfig($uid, $family, $key, $instore = false) {
if($uid === false)
return false;
- if(! array_key_exists($uid, $a->config))
+ if(! array_key_exists($uid, App::$config))
load_pconfig($uid);
- if((! array_key_exists($family, $a->config[$uid])) || (! array_key_exists($key, $a->config[$uid][$family])))
+ if((! array_key_exists($family, App::$config[$uid])) || (! array_key_exists($key, App::$config[$uid][$family])))
return false;
- return ((! is_array($a->config[$uid][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$uid][$family][$key]))
- ? unserialize($a->config[$uid][$family][$key])
- : $a->config[$uid][$family][$key]
+ return ((! is_array(App::$config[$uid][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$uid][$family][$key]))
+ ? unserialize(App::$config[$uid][$family][$key])
+ : App::$config[$uid][$family][$key]
);
}
@@ -303,22 +303,22 @@ function set_pconfig($uid, $family, $key, $value) {
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
if(get_pconfig($uid, $family, $key) === false) {
- if(! array_key_exists($uid, $a->config))
- $a->config[$uid] = array();
- if(! array_key_exists($family, $a->config[$uid]))
- $a->config[$uid][$family] = array();
+ if(! array_key_exists($uid, App::$config))
+ App::$config[$uid] = array();
+ if(! array_key_exists($family, App::$config[$uid]))
+ App::$config[$uid][$family] = array();
// keep a separate copy for all variables which were
// set in the life of this page. We need this to
// synchronise channel clones.
- if(! array_key_exists('transient', $a->config[$uid]))
- $a->config[$uid]['transient'] = array();
- if(! array_key_exists($family, $a->config[$uid]['transient']))
- $a->config[$uid]['transient'][$family] = array();
+ if(! array_key_exists('transient', App::$config[$uid]))
+ App::$config[$uid]['transient'] = array();
+ if(! array_key_exists($family, App::$config[$uid]['transient']))
+ App::$config[$uid]['transient'][$family] = array();
- $a->config[$uid][$family][$key] = $value;
- $a->config[$uid]['transient'][$family][$key] = $value;
+ App::$config[$uid][$family][$key] = $value;
+ App::$config[$uid]['transient'][$family][$key] = $value;
$ret = q("INSERT INTO pconfig ( uid, cat, k, v ) VALUES ( %d, '%s', '%s', '%s' ) ",
intval($uid),
@@ -343,13 +343,13 @@ function set_pconfig($uid, $family, $key, $value) {
// set in the life of this page. We need this to
// synchronise channel clones.
- if(! array_key_exists('transient', $a->config[$uid]))
- $a->config[$uid]['transient'] = array();
- if(! array_key_exists($family, $a->config[$uid]['transient']))
- $a->config[$uid]['transient'][$family] = array();
+ if(! array_key_exists('transient', App::$config[$uid]))
+ App::$config[$uid]['transient'] = array();
+ if(! array_key_exists($family, App::$config[$uid]['transient']))
+ App::$config[$uid]['transient'][$family] = array();
- $a->config[$uid][$family][$key] = $value;
- $a->config[$uid]['transient'][$family][$key] = $value;
+ App::$config[$uid][$family][$key] = $value;
+ App::$config[$uid]['transient'][$family][$key] = $value;
if($ret)
return $value;
@@ -360,7 +360,7 @@ function set_pconfig($uid, $family, $key, $value) {
/**
* @brief Deletes the given key from the channel's configuration.
*
- * Removes the configured value from the stored cache in $a->config[$uid]
+ * Removes the configured value from the stored cache in App::$config[$uid]
* and removes it from the database.
*
* @param string $uid
@@ -375,8 +375,8 @@ function del_pconfig($uid, $family, $key) {
global $a;
$ret = false;
- if (x($a->config[$uid][$family], $key))
- unset($a->config[$uid][$family][$key]);
+ if (x(App::$config[$uid][$family], $key))
+ unset(App::$config[$uid][$family][$key]);
$ret = q("DELETE FROM pconfig WHERE uid = %d AND cat = '%s' AND k = '%s'",
intval($uid),
dbesc($family),
@@ -391,7 +391,7 @@ function del_pconfig($uid, $family, $key) {
* @brief Loads a full xchan's configuration into a cached storage.
*
* All configuration values of the given observer hash are stored in global
- * cache which is available under the global variable $a->config[$xchan].
+ * cache which is available under the global variable App::$config[$xchan].
*
* @param string $xchan
* The observer's hash
@@ -403,8 +403,8 @@ function load_xconfig($xchan) {
if(! $xchan)
return false;
- if(! array_key_exists($xchan, $a->config))
- $a->config[$xchan] = array();
+ if(! array_key_exists($xchan, App::$config))
+ App::$config[$xchan] = array();
$r = q("SELECT * FROM xconfig WHERE xchan = '%s'",
dbesc($xchan)
@@ -414,11 +414,11 @@ function load_xconfig($xchan) {
foreach($r as $rr) {
$k = $rr['k'];
$c = $rr['cat'];
- if(! array_key_exists($c, $a->config[$xchan])) {
- $a->config[$xchan][$c] = array();
- $a->config[$xchan][$c]['config_loaded'] = true;
+ if(! array_key_exists($c, App::$config[$xchan])) {
+ App::$config[$xchan][$c] = array();
+ App::$config[$xchan][$c]['config_loaded'] = true;
}
- $a->config[$xchan][$c][$k] = $rr['v'];
+ App::$config[$xchan][$c][$k] = $rr['v'];
}
}
}
@@ -428,7 +428,7 @@ function load_xconfig($xchan) {
* name ($family) and a key.
*
* Get a particular observer's config value from the given category ($family)
- * and the $key from a cached storage in $a->config[$xchan].
+ * and the $key from a cached storage in App::$config[$xchan].
*
* Returns false if not set.
*
@@ -446,15 +446,15 @@ function get_xconfig($xchan, $family, $key) {
if(! $xchan)
return false;
- if(! array_key_exists($xchan, $a->config))
+ if(! array_key_exists($xchan, App::$config))
load_xconfig($xchan);
- if((! array_key_exists($family, $a->config[$xchan])) || (! array_key_exists($key, $a->config[$xchan][$family])))
+ if((! array_key_exists($family, App::$config[$xchan])) || (! array_key_exists($key, App::$config[$xchan][$family])))
return false;
- return ((! is_array($a->config[$xchan][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$xchan][$family][$key]))
- ? unserialize($a->config[$xchan][$family][$key])
- : $a->config[$xchan][$family][$key]
+ return ((! is_array(App::$config[$xchan][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', App::$config[$xchan][$family][$key]))
+ ? unserialize(App::$config[$xchan][$family][$key])
+ : App::$config[$xchan][$family][$key]
);
}
@@ -484,12 +484,12 @@ function set_xconfig($xchan, $family, $key, $value) {
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
if(get_xconfig($xchan, $family, $key) === false) {
- if(! array_key_exists($xchan, $a->config))
- $a->config[$xchan] = array();
- if(! array_key_exists($family, $a->config[$xchan]))
- $a->config[$xchan][$family] = array();
+ if(! array_key_exists($xchan, App::$config))
+ App::$config[$xchan] = array();
+ if(! array_key_exists($family, App::$config[$xchan]))
+ App::$config[$xchan][$family] = array();
- $a->config[$xchan][$family][$key] = $value;
+ App::$config[$xchan][$family][$key] = $value;
$ret = q("INSERT INTO xconfig ( xchan, cat, k, v ) VALUES ( '%s', '%s', '%s', '%s' ) ",
dbesc($xchan),
dbesc($family),
@@ -508,7 +508,7 @@ function set_xconfig($xchan, $family, $key, $value) {
dbesc($key)
);
- $a->config[$xchan][$family][$key] = $value;
+ App::$config[$xchan][$family][$key] = $value;
if($ret)
return $value;
@@ -518,7 +518,7 @@ function set_xconfig($xchan, $family, $key, $value) {
/**
* @brief Deletes the given key from the observer's config.
*
- * Removes the configured value from the stored cache in $a->config[$xchan]
+ * Removes the configured value from the stored cache in App::$config[$xchan]
* and removes it from the database.
*
* @param string $xchan
@@ -533,8 +533,8 @@ function del_xconfig($xchan, $family, $key) {
global $a;
$ret = false;
- if(x($a->config[$xchan][$family], $key))
- unset($a->config[$xchan][$family][$key]);
+ if(x(App::$config[$xchan][$family], $key))
+ unset(App::$config[$xchan][$family][$key]);
$ret = q("DELETE FROM xconfig WHERE xchan = '%s' AND cat = '%s' AND k = '%s'",
dbesc($xchan),
dbesc($family),
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 66f84f066..ba1241fcb 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -10,7 +10,7 @@ function findpeople_widget() {
if(get_config('system','invitation_only')) {
$x = get_pconfig(local_channel(),'system','invites_remaining');
if($x || is_site_admin()) {
- $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
+ App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
. '</div>' . $inv;
}
@@ -68,7 +68,7 @@ function categories_widget($baseurl,$selected = '') {
$a = get_app();
- if(! feature_enabled($a->profile['profile_uid'],'categories'))
+ if(! feature_enabled(App::$profile['profile_uid'],'categories'))
return '';
$item_normal = item_normal();
@@ -83,9 +83,9 @@ function categories_widget($baseurl,$selected = '') {
and item.item_wall = 1
$item_normal
order by term.term asc",
- intval($a->profile['profile_uid']),
+ intval(App::$profile['profile_uid']),
intval(TERM_CATEGORY),
- dbesc($a->profile['channel_hash'])
+ dbesc(App::$profile['channel_hash'])
);
if($r && count($r)) {
foreach($r as $rr)
diff --git a/include/conversation.php b/include/conversation.php
index e3398543b..829e85382 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -54,7 +54,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
$origbody = $body;
$newbody = '';
- $observer = get_app()->get_observer();
+ $observer = App::get_observer();
$obhash = (($observer) ? $observer['xchan_hash'] : '');
$obaddr = (($observer) ? $observer['xchan_addr'] : '');
@@ -489,7 +489,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$live_update_div = '<div id="live-network"></div>' . "\r\n"
. "<script> var profile_uid = " . $_SESSION['uid']
- . "; var netargs = '" . substr($a->cmd,8)
+ . "; var netargs = '" . substr(App::$cmd,8)
. '?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
@@ -504,12 +504,12 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
. ((x($_GET,'cmax')) ? '&cmax=' . $_GET['cmax'] : '')
. ((x($_GET,'file')) ? '&file=' . $_GET['file'] : '')
. ((x($_GET,'uri')) ? '&uri=' . $_GET['uri'] : '')
- . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+ . "'; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
}
}
elseif ($mode === 'channel') {
- $profile_owner = $a->profile['profile_uid'];
+ $profile_owner = App::$profile['profile_uid'];
$page_writeable = ($profile_owner == local_channel());
if (!$update) {
@@ -519,8 +519,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
// because browser prefetching might change it on us. We have to deliver it with the page.
$live_update_div = '<div id="live-channel"></div>' . "\r\n"
- . "<script> var profile_uid = " . $a->profile['profile_uid']
- . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+ . "<script> var profile_uid = " . App::$profile['profile_uid']
+ . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
}
}
}
@@ -532,7 +532,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
}
elseif ($mode === 'page') {
- $profile_owner = $a->profile['uid'];
+ $profile_owner = App::$profile['uid'];
$page_writeable = ($profile_owner == local_channel());
$live_update_div = '<div id="live-page"></div>' . "\r\n";
}
@@ -542,11 +542,11 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
}
elseif ($mode === 'photos') {
- $profile_onwer = $a->profile['profile_uid'];
+ $profile_onwer = App::$profile['profile_uid'];
$page_writeable = ($profile_owner == local_channel());
$live_update_div = '<div id="live-photos"></div>' . "\r\n";
// for photos we've already formatted the top-level item (the photo)
- $content_html = $a->data['photo_html'];
+ $content_html = App::$data['photo_html'];
}
$page_dropping = ((local_channel() && local_channel() == $profile_owner) ? true : false);
@@ -555,13 +555,13 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$page_dropping = false;
- $channel = $a->get_channel();
- $observer = $a->get_observer();
+ $channel = App::get_channel();
+ $observer = App::get_observer();
if($update)
$return_url = $_SESSION['return_url'];
else
- $return_url = $_SESSION['return_url'] = $a->query_string;
+ $return_url = $_SESSION['return_url'] = App::$query_string;
load_contact_links(local_channel());
@@ -623,7 +623,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$nickname = $item['nickname'];
}
else
- $nickname = $a->user['nickname'];
+ $nickname = App::$user['nickname'];
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name']))
@@ -849,7 +849,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'$live_update' => $live_update_div,
'$remove' => t('remove'),
'$mode' => $mode,
- '$user' => $a->user,
+ '$user' => App::$user,
'$threads' => $threads,
'$wait' => t('Loading...'),
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
@@ -869,13 +869,13 @@ function best_link_url($item) {
$clean_url = normalise_link($item['author-link']);
if((local_channel()) && (local_channel() == $item['uid'])) {
- if(isset($a->contacts) && x($a->contacts,$clean_url)) {
- if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
- $best_url = z_root() . '/redir/' . $a->contacts[$clean_url]['id'];
+ if(isset(App::$contacts) && x(App::$contacts,$clean_url)) {
+ if(App::$contacts[$clean_url]['network'] === NETWORK_DFRN) {
+ $best_url = z_root() . '/redir/' . App::$contacts[$clean_url]['id'];
$sparkle = true;
}
else
- $best_url = $a->contacts[$clean_url]['url'];
+ $best_url = App::$contacts[$clean_url]['url'];
}
}
if(! $best_url) {
@@ -907,9 +907,9 @@ function item_photo_menu($item){
if($local_channel) {
$ssl_state = true;
- if(! count($a->contacts))
+ if(! count(App::$contacts))
load_contact_links($local_channel);
- $channel = $a->get_channel();
+ $channel = App::get_channel();
$channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
@@ -927,8 +927,8 @@ function item_photo_menu($item){
if($item['uid'] > 0)
$pm_url = z_root() . '/mail/new/?f=&hash=' . $item['author_xchan'];
- if($a->contacts && array_key_exists($item['author_xchan'],$a->contacts))
- $contact = $a->contacts[$item['author_xchan']];
+ if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts))
+ $contact = App::$contacts[$item['author_xchan']];
else
if($local_channel && $item['author']['xchan_addr'])
$follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
@@ -1159,7 +1159,7 @@ function status_editor($a, $x, $popup = false) {
$tpl = get_markup_template('jot-header.tpl');
- $a->page['htmlhead'] .= replace_macros($tpl, array(
+ App::$page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
@@ -1202,7 +1202,7 @@ function status_editor($a, $x, $popup = false) {
call_hooks('jot_networks', $jotnets);
$o .= replace_macros($tpl, array(
- '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : $a->query_string),
+ '$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string),
'$action' => z_root() . '/item',
'$share' => (x($x,'button') ? $x['button'] : t('Share')),
'$webpage' => $webpage,
@@ -1424,12 +1424,12 @@ function prepare_page($item) {
$a = get_app();
$naked = 1;
// $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
- $observer = $a->get_observer();
+ $observer = App::get_observer();
//240 chars is the longest we can have before we start hitting problems with suhosin sites
$preview = substr(urlencode($item['body']), 0, 240);
- $link = z_root() . '/' . $a->cmd;
- if(array_key_exists('webpage',$a->layout) && array_key_exists('authored',$a->layout['webpage'])) {
- if($a->layout['webpage']['authored'] === 'none')
+ $link = z_root() . '/' . App::$cmd;
+ if(array_key_exists('webpage',App::$layout) && array_key_exists('authored',App::$layout['webpage'])) {
+ if(App::$layout['webpage']['authored'] === 'none')
$naked = 1;
// ... other possible options
}
@@ -1508,7 +1508,7 @@ function network_tabs() {
if ($no_active=='active') $all_active='active';
- $cmd = $a->cmd;
+ $cmd = App::$cmd;
// tabs
$tabs = array();
@@ -1592,16 +1592,16 @@ function network_tabs() {
function profile_tabs($a, $is_owner = false, $nickname = null){
// Don't provide any profile tabs if we're running as the sys channel
- if ($a->is_sys)
+ if (App::$is_sys)
return;
- $channel = $a->get_channel();
+ $channel = App::get_channel();
if (is_null($nickname))
$nickname = $channel['channel_address'];
- $uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
+ $uid = ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : local_channel());
if($uid == local_channel()) {
$cal_link = '';
diff --git a/include/datetime.php b/include/datetime.php
index 8ee70a6fa..83fb49d04 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -135,7 +135,7 @@ function dob($dob) {
'dob',
t('Birthday'),
$value,
- ((intval($value)) ? t('Age: ') . age($value,$a->user['timezone'],$a->user['timezone']) : ''),
+ ((intval($value)) ? t('Age: ') . age($value,App::$user['timezone'],App::$user['timezone']) : ''),
'',
'placeholder="' . t('YYYY-MM-DD or MM-DD') .'"'
)));
diff --git a/include/dir_fns.php b/include/dir_fns.php
index fd2a5835d..1c3149081 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -421,7 +421,7 @@ function local_dir_update($uid, $force) {
$arr = array('channel_id' => $uid, 'hash' => $hash, 'profile' => $profile);
call_hooks('local_dir_update', $arr);
- $address = $p[0]['channel_address'] . '@' . get_app()->get_hostname();
+ $address = $p[0]['channel_address'] . '@' . App::get_hostname();
if (perm_is_allowed($uid, '', 'view_profile')) {
import_directory_profile($hash, $arr['profile'], $address, 0);
@@ -436,6 +436,6 @@ function local_dir_update($uid, $force) {
}
}
- $ud_hash = random_string() . '@' . get_app()->get_hostname();
- update_modtime($hash, $ud_hash, $p[0]['channel_address'] . '@' . get_app()->get_hostname(),(($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
+ $ud_hash = random_string() . '@' . App::get_hostname();
+ update_modtime($hash, $ud_hash, $p[0]['channel_address'] . '@' . App::get_hostname(),(($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
}
diff --git a/include/enotify.php b/include/enotify.php
index a44f87537..d87c5af11 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -62,7 +62,7 @@ function notification($params) {
$site_admin = sprintf( t('%s Administrator'), $sitename);
$sender_name = $product;
- $hostname = $a->get_hostname();
+ $hostname = App::get_hostname();
if(strpos($hostname,':'))
$hostname = substr($hostname,0,strpos($hostname,':'));
@@ -424,7 +424,7 @@ function notification($params) {
// wretched hack, but we don't want to duplicate all the preamble variations and we also don't want to screw up a translation
- if (($a->language === 'en' || (! $a->language)) && strpos($msg,', '))
+ if ((App::$language === 'en' || (! App::$language)) && strpos($msg,', '))
$msg = substr($msg,strpos($msg,', ')+1);
$r = q("update notify set msg = '%s' where id = %d and uid = %d",
@@ -441,7 +441,7 @@ function notification($params) {
logger('notification: sending notification email');
$hn = get_pconfig($recip['channel_id'],'system','email_notify_host');
- if($hn && (! stristr(get_app()->get_hostname(),$hn))) {
+ if($hn && (! stristr(App::get_hostname(),$hn))) {
// this isn't the email notification host
pop_lang();
return;
@@ -455,7 +455,7 @@ function notification($params) {
// use $_SESSION['zid_override'] to force zid() to use
// the recipient address instead of the current observer
- $_SESSION['zid_override'] = $recip['channel_address'] . '@' . get_app()->get_hostname();
+ $_SESSION['zid_override'] = $recip['channel_address'] . '@' . App::get_hostname();
$_SESSION['zrl_override'] = z_root() . '/channel/' . $recip['channel_address'];
$textversion = zidify_links($textversion);
diff --git a/include/event.php b/include/event.php
index 2969f4f61..7a99bc746 100644
--- a/include/event.php
+++ b/include/event.php
@@ -67,7 +67,7 @@ function ical_wrapper($ev) {
$o .= "BEGIN:VCALENDAR";
$o .= "\r\nVERSION:2.0";
$o .= "\r\nMETHOD:PUBLISH";
- $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Project\System::get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n";
+ $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Project\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n";
if(array_key_exists('start', $ev))
$o .= format_event_ical($ev);
else {
@@ -361,7 +361,7 @@ function event_store_event($arr) {
if(array_key_exists('external_id',$arr))
$hash = $arr['external_id'];
else
- $hash = random_string() . '@' . get_app()->get_hostname();
+ $hash = random_string() . '@' . App::get_hostname();
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
adjust,nofinish, event_status, event_status_date, event_percent, event_repeat, event_sequence, event_priority, allow_cid,allow_gid,deny_cid,deny_gid)
diff --git a/include/identity.php b/include/identity.php
index 03049639d..67fd63aaf 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -275,7 +275,7 @@ function create_identity($arr) {
intval($pageflags),
intval($system),
intval($expire),
- dbesc($a->timezone)
+ dbesc(App::$timezone)
);
$r = q("select * from channel where channel_account_id = %d
@@ -302,11 +302,11 @@ function create_identity($arr) {
dbesc($guid),
dbesc($sig),
dbesc($hash),
- dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()),
+ dbesc($ret['channel']['channel_address'] . '@' . App::get_hostname()),
intval($primary),
dbesc(z_root()),
dbesc(base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey']))),
- dbesc(get_app()->get_hostname()),
+ dbesc(App::get_hostname()),
dbesc(z_root() . '/post'),
dbesc(get_config('system','pubkey')),
dbesc('zot')
@@ -324,7 +324,7 @@ function create_identity($arr) {
dbesc(z_root() . "/photo/profile/l/{$newuid}"),
dbesc(z_root() . "/photo/profile/m/{$newuid}"),
dbesc(z_root() . "/photo/profile/s/{$newuid}"),
- dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()),
+ dbesc($ret['channel']['channel_address'] . '@' . App::get_hostname()),
dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']),
dbesc(z_root() . '/follow?f=&url=%s'),
dbesc(z_root() . '/poco/' . $ret['channel']['channel_address']),
@@ -780,14 +780,14 @@ function profile_load(&$a, $nickname, $profile = '') {
);
if(! $user) {
- logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
+ logger('profile error: ' . App::$query_string, LOGGER_DEBUG);
notice( t('Requested channel is not available.') . EOL );
- $a->error = 404;
+ App::$error = 404;
return;
}
// get the current observer
- $observer = $a->get_observer();
+ $observer = App::get_observer();
$can_view_profile = true;
@@ -826,9 +826,9 @@ function profile_load(&$a, $nickname, $profile = '') {
}
if(! $p) {
- logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
+ logger('profile error: ' . App::$query_string, LOGGER_DEBUG);
notice( t('Requested profile is not available.') . EOL );
- $a->error = 404;
+ App::$error = 404;
return;
}
@@ -885,23 +885,23 @@ function profile_load(&$a, $nickname, $profile = '') {
if($p[0]['keywords']) {
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$p[0]['keywords']);
if(strlen($keywords) && $can_view_profile)
- $a->page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ;
+ App::$page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ;
}
- $a->profile = $p[0];
- $a->profile_uid = $p[0]['profile_uid'];
- $a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
+ App::$profile = $p[0];
+ App::$profile_uid = $p[0]['profile_uid'];
+ App::$page['title'] = App::$profile['channel_name'] . " - " . App::$profile['channel_address'] . "@" . App::get_hostname();
- $a->profile['permission_to_view'] = $can_view_profile;
+ App::$profile['permission_to_view'] = $can_view_profile;
if($can_view_profile) {
$online = get_online_status($nickname);
- $a->profile['online_status'] = $online['result'];
+ App::$profile['online_status'] = $online['result'];
}
if(local_channel()) {
- $a->profile['channel_mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme');
- $_SESSION['mobile_theme'] = $a->profile['channel_mobile_theme'];
+ App::$profile['channel_mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme');
+ $_SESSION['mobile_theme'] = App::$profile['channel_mobile_theme'];
}
/*
@@ -978,7 +978,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$a = get_app();
- $observer = $a->get_observer();
+ $observer = App::get_observer();
$o = '';
$location = false;
@@ -1010,7 +1010,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$connect_url = rconnect_url($profile['uid'],get_observer_hash());
$connect = (($connect_url) ? t('Connect') : '');
if($connect_url)
- $connect_url = sprintf($connect_url,urlencode($profile['channel_address'] . '@' . $a->get_hostname()));
+ $connect_url = sprintf($connect_url,urlencode($profile['channel_address'] . '@' . App::get_hostname()));
// premium channel - over-ride
@@ -1164,7 +1164,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$rr['link'] = $url;
$rr['title'] = $rr['name'];
- $rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
+ $rr['date'] = day_translate(datetime_convert('UTC', App::$timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
$rr['startime'] = Null;
$rr['today'] = $today;
}
@@ -1214,15 +1214,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
if(strlen($rr['name']))
$total ++;
- $strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start'],'Y-m-d');
- if($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d'))
+ $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start'],'Y-m-d');
+ if($strt === datetime_convert('UTC',App::$timezone,'now','Y-m-d'))
$istoday = true;
}
$classtoday = (($istoday) ? 'event-today' : '');
foreach($r as &$rr) {
if($rr['adjust'])
- $md = datetime_convert('UTC',$a->timezone,$rr['start'],'Y/m');
+ $md = datetime_convert('UTC',App::$timezone,$rr['start'],'Y/m');
else
$md = datetime_convert('UTC','UTC',$rr['start'],'Y/m');
$md .= "/#link-".$rr['id'];
@@ -1231,12 +1231,12 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
if(! $title)
$title = t('[No description]');
- $strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start']);
- $today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false);
+ $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start']);
+ $today = ((substr($strt,0,10) === datetime_convert('UTC',App::$timezone,'now','Y-m-d')) ? true : false);
$rr['link'] = $md;
$rr['title'] = $title;
- $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
+ $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? App::$timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
$rr['startime'] = $strt;
$rr['today'] = $today;
}
@@ -1256,15 +1256,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
function advanced_profile(&$a) {
require_once('include/text.php');
- 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'))
return '';
- if($a->profile['name']) {
+ if(App::$profile['name']) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
- $advanced = ((feature_enabled($a->profile['profile_uid'],'advanced_profiles')) ? true : false);
+ $advanced = ((feature_enabled(App::$profile['profile_uid'],'advanced_profiles')) ? true : false);
if($advanced)
$fields = $profile_fields_advanced;
else
@@ -1283,19 +1283,19 @@ function advanced_profile(&$a) {
$profile = array();
- $profile['fullname'] = array( t('Full Name:'), $a->profile['name'] ) ;
+ $profile['fullname'] = array( t('Full Name:'), App::$profile['name'] ) ;
- if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
+ if(App::$profile['gender']) $profile['gender'] = array( t('Gender:'), App::$profile['gender'] );
$ob_hash = get_observer_hash();
- if($ob_hash && perm_is_allowed($a->profile['profile_uid'],$ob_hash,'post_like')) {
+ if($ob_hash && perm_is_allowed(App::$profile['profile_uid'],$ob_hash,'post_like')) {
$profile['canlike'] = true;
$profile['likethis'] = t('Like this channel');
- $profile['profile_guid'] = $a->profile['profile_guid'];
+ $profile['profile_guid'] = App::$profile['profile_guid'];
}
$likers = q("select liker, xchan.* from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'",
- intval($a->profile['profile_uid']),
+ intval(App::$profile['profile_uid']),
dbesc(ACTIVITY_OBJ_PROFILE),
dbesc(ACTIVITY_LIKE)
);
@@ -1307,87 +1307,87 @@ function advanced_profile(&$a) {
$profile['likers'][] = array('name' => $l['xchan_name'],'photo' => zid($l['xchan_photo_s']), 'url' => zid($l['xchan_url']));
}
- if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
+ if((App::$profile['dob']) && (App::$profile['dob'] != '0000-00-00')) {
$val = '';
- if((substr($a->profile['dob'],5,2) === '00') || (substr($a->profile['dob'],8,2) === '00'))
- $val = substr($a->profile['dob'],0,4);
+ if((substr(App::$profile['dob'],5,2) === '00') || (substr(App::$profile['dob'],8,2) === '00'))
+ $val = substr(App::$profile['dob'],0,4);
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');
if(! $val) {
- $val = ((intval($a->profile['dob']))
- ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format))
- : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format)));
+ $val = ((intval(App::$profile['dob']))
+ ? day_translate(datetime_convert('UTC','UTC',App::$profile['dob'] . ' 00:00 +00:00',$year_bd_format))
+ : day_translate(datetime_convert('UTC','UTC','2001-' . substr(App::$profile['dob'],5) . ' 00:00 +00:00',$short_bd_format)));
}
$profile['birthday'] = array( t('Birthday:'), $val);
}
- if($age = age($a->profile['dob'],$a->profile['timezone'],''))
+ if($age = age(App::$profile['dob'],App::$profile['timezone'],''))
$profile['age'] = array( t('Age:'), $age );
- if($a->profile['marital'])
- $profile['marital'] = array( t('Status:'), $a->profile['marital']);
+ if(App::$profile['marital'])
+ $profile['marital'] = array( t('Status:'), App::$profile['marital']);
- if($a->profile['with'])
- $profile['marital']['with'] = bbcode($a->profile['with']);
+ if(App::$profile['with'])
+ $profile['marital']['with'] = bbcode(App::$profile['with']);
- if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) {
- $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
+ if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) {
+ $profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s'));
}
- if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
+ if(App::$profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), App::$profile['sexual'] );
- if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
+ if(App::$profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify(App::$profile['homepage']) );
- if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
+ if(App::$profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify(App::$profile['hometown']) );
- if($a->profile['keywords']) $profile['keywords'] = array( t('Tags:'), $a->profile['keywords']);
+ if(App::$profile['keywords']) $profile['keywords'] = array( t('Tags:'), App::$profile['keywords']);
- if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
+ if(App::$profile['politic']) $profile['politic'] = array( t('Political Views:'), App::$profile['politic']);
- if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']);
+ if(App::$profile['religion']) $profile['religion'] = array( t('Religion:'), App::$profile['religion']);
- if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt );
+ if($txt = prepare_text(App::$profile['about'])) $profile['about'] = array( t('About:'), $txt );
- if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
+ if($txt = prepare_text(App::$profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
- if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
+ if($txt = prepare_text(App::$profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
- if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
+ if($txt = prepare_text(App::$profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
- if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
+ if($txt = prepare_text(App::$profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
- if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt);
+ if($txt = prepare_text(App::$profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt);
- if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
+ if($txt = prepare_text(App::$profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
- if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt);
+ if($txt = prepare_text(App::$profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt);
- if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt);
+ if($txt = prepare_text(App::$profile['tv'])) $profile['tv'] = array( t('Television:'), $txt);
- if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
+ if($txt = prepare_text(App::$profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
- if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
+ if($txt = prepare_text(App::$profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
- if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
+ if($txt = prepare_text(App::$profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
- if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
+ if($txt = prepare_text(App::$profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
- if($a->profile['extra_fields']) {
- foreach($a->profile['extra_fields'] as $f) {
+ if(App::$profile['extra_fields']) {
+ foreach(App::$profile['extra_fields'] as $f) {
$x = q("select * from profdef where field_name = '%s' limit 1",
dbesc($f)
);
- if($x && $txt = prepare_text($a->profile[$f]))
+ if($x && $txt = prepare_text(App::$profile[$f]))
$profile[$f] = array( $x[0]['field_desc'] . ':',$txt);
}
- $profile['extra_fields'] = $a->profile['extra_fields'];
+ $profile['extra_fields'] = App::$profile['extra_fields'];
}
- $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']);
+ $things = get_things(App::$profile['profile_guid'],App::$profile['profile_uid']);
// logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
@@ -1397,7 +1397,7 @@ function advanced_profile(&$a) {
'$likethis' => t('Like this thing'),
'$profile' => $profile,
'$fields' => $clean_fields,
- '$editmenu' => profile_edit_menu($a->profile['profile_uid']),
+ '$editmenu' => profile_edit_menu(App::$profile['profile_uid']),
'$things' => $things
));
}
@@ -1440,7 +1440,7 @@ function zid_init(&$a) {
$tmp_str = get_my_address();
if(validate_email($tmp_str)) {
proc_run('php','include/gprobe.php',bin2hex($tmp_str));
- $arr = array('zid' => $tmp_str, 'url' => $a->cmd);
+ $arr = array('zid' => $tmp_str, 'url' => App::$cmd);
call_hooks('zid_init',$arr);
if(! local_channel()) {
$r = q("select * from hubloc where hubloc_addr = '%s' order by hubloc_connected desc limit 1",
@@ -1450,7 +1450,7 @@ function zid_init(&$a) {
return;
logger('zid_init: not authenticated. Invoking reverse magic-auth for ' . $tmp_str);
// try to avoid recursion - but send them home to do a proper magic auth
- $query = $a->query_string;
+ $query = App::$query_string;
$query = str_replace(array('?zid=','&zid='),array('?rzid=','&rzid='),$query);
$dest = '/' . urlencode($query);
if($r && ($r[0]['hubloc_url'] != z_root()) && (! strstr($dest,'/magic')) && (! strstr($dest,'/rmagic'))) {
@@ -1631,7 +1631,7 @@ function identity_selector() {
intval(get_account_id())
);
if (count($r) > 1) {
- //$account = get_app()->get_account();
+ //$account = App::get_account();
$o = replace_macros(get_markup_template('channel_id_select.tpl'), array(
'$channels' => $r,
'$selected' => local_channel()
@@ -1649,7 +1649,7 @@ function is_public_profile() {
return false;
if(intval(get_config('system','block_public')))
return false;
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if($channel && $channel['channel_r_profile'] == PERMS_PUBLIC)
return true;
@@ -1855,7 +1855,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
// $translate = intval(($scale / 1.0) * 100);
- $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname();
+ $channel['channel_addr'] = $channel['channel_address'] . '@' . App::get_hostname();
$zcard = array('chan' => $channel);
$r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d",
diff --git a/include/items.php b/include/items.php
index 18e777a7f..09479e428 100755
--- a/include/items.php
+++ b/include/items.php
@@ -274,7 +274,7 @@ function can_comment_on_post($observer_xchan, $item) {
return true;
if(strstr($item['comment_policy'],'network:') && strstr($item['comment_policy'],'diaspora'))
return true;
- if(strstr($item['comment_policy'],'site:') && strstr($item['comment_policy'],get_app()->get_hostname()))
+ if(strstr($item['comment_policy'],'site:') && strstr($item['comment_policy'],App::get_hostname()))
return true;
return false;
@@ -413,8 +413,8 @@ function post_activity_item($arr) {
if(! array_key_exists('item_thread_top',$arr) && (! $is_comment))
$arr['item_thread_top'] = 1;
- $channel = get_app()->get_channel();
- $observer = get_app()->get_observer();
+ $channel = App::get_channel();
+ $observer = App::get_observer();
$arr['aid'] = ((x($arr,'aid')) ? $arr['aid'] : $channel['channel_account_id']);
$arr['uid'] = ((x($arr,'uid')) ? $arr['uid'] : $channel['channel_id']);
@@ -602,7 +602,7 @@ function get_feed_for($channel, $observer_hash, $params) {
'order' => 'post',
'top' => $params['top'],
'cat' => $params['cat']
- ), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
+ ), $channel, $observer_hash, CLIENT_MODE_NORMAL, App::$module);
$feed_template = get_markup_template('atom_feed.tpl');
@@ -1362,7 +1362,7 @@ function map_scope($scope, $strip = false) {
case PERMS_AUTHED:
return 'authenticated';
case PERMS_SITE:
- return 'site: ' . get_app()->get_hostname();
+ return 'site: ' . App::get_hostname();
case PERMS_PENDING:
return 'any connections';
case PERMS_CONTACTS:
@@ -2265,7 +2265,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$arr['body'] = trim(z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']));
if(local_channel() && (! $arr['sig'])) {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if($channel['channel_hash'] === $arr['author_xchan']) {
$arr['sig'] = base64url_encode(rsa_sign($arr['body'],$channel['channel_prvkey']));
$arr['item_verified'] = 1;
@@ -2661,7 +2661,7 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
$arr['body'] = trim(z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']));
if(local_channel() && (! $arr['sig'])) {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if($channel['channel_hash'] === $arr['author_xchan']) {
$arr['sig'] = base64url_encode(rsa_sign($arr['body'],$channel['channel_prvkey']));
$arr['item_verified'] = 1;
@@ -2887,7 +2887,7 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id,
logger('storing diaspora comment signature',LOGGER_DEBUG);
- $diaspora_handle = $channel['channel_address'] . '@' . get_app()->get_hostname();
+ $diaspora_handle = $channel['channel_address'] . '@' . App::get_hostname();
$signed_text = $datarray['mid'] . ';' . $parent_item['mid'] . ';' . $signed_body . ';' . $diaspora_handle;
@@ -4612,7 +4612,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
$ok_to_delete = true;
// author deletion
- $observer = $a->get_observer();
+ $observer = App::get_observer();
if($observer && $observer['xchan_hash'] && ($observer['xchan_hash'] === $item['author_xchan']))
$ok_to_delete = true;
@@ -5201,8 +5201,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$pager_sql = '';
} else {
$itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 20);
- $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(get_app()->pager['itemspage']), intval(get_app()->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 (isset($arr['start']) && isset($arr['records']))
@@ -5472,7 +5472,7 @@ function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow,
* @return boolean
*/
function comment_local_origin($item) {
- if(stripos($item['mid'], get_app()->get_hostname()) && ($item['parent'] != $item['id']))
+ if(stripos($item['mid'], App::get_hostname()) && ($item['parent'] != $item['id']))
return true;
return false;
diff --git a/include/language.php b/include/language.php
index 121816ae6..1a012cb84 100644
--- a/include/language.php
+++ b/include/language.php
@@ -83,38 +83,38 @@ function get_best_language() {
return $arr['preferred'];
$a = get_app();
- return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
+ return ((isset(App::$config['system']['language'])) ? App::$config['system']['language'] : 'en');
}
function push_lang($language) {
global $a;
- $a->langsave = $a->language;
+ App::$langsave = App::$language;
- if($language === $a->language)
+ if($language === App::$language)
return;
- if(isset($a->strings) && count($a->strings)) {
- $a->stringsave = $a->strings;
+ if(isset(App::$strings) && count(App::$strings)) {
+ App::$stringsave = App::$strings;
}
- $a->strings = array();
+ App::$strings = array();
load_translation_table($language);
- $a->language = $language;
+ App::$language = $language;
}
function pop_lang() {
global $a;
- if($a->language === $a->langsave)
+ if(App::$language === App::$langsave)
return;
- if(isset($a->stringsave))
- $a->strings = $a->stringsave;
+ if(isset(App::$stringsave))
+ App::$strings = App::$stringsave;
else
- $a->strings = array();
+ App::$strings = array();
- $a->language = $a->langsave;
+ App::$language = App::$langsave;
}
/**
@@ -126,7 +126,7 @@ function pop_lang() {
function load_translation_table($lang, $install = false) {
global $a;
- $a->strings = array();
+ App::$strings = array();
if(file_exists("view/$lang/hstrings.php")) {
include("view/$lang/hstrings.php");
@@ -173,8 +173,8 @@ function t($s, $ctx = '') {
global $a;
$cs = $ctx ? '__ctx:' . $ctx . '__ ' . $s : $s;
- if (x($a->strings, $cs)) {
- $t = $a->strings[$cs];
+ if (x(App::$strings, $cs)) {
+ $t = App::$strings[$cs];
return ((is_array($t)) ? translate_projectname($t[0]) : translate_projectname($t));
}
@@ -208,9 +208,9 @@ function tt($singular, $plural, $count, $ctx = ''){
$a = get_app();
$cs = $ctx ? "__ctx:" . $ctx . "__ " . $singular : $singular;
- if (x($a->strings,$cs)) {
- $t = $a->strings[$cs];
- $f = 'string_plural_select_' . str_replace('-', '_', $a->language);
+ if (x(App::$strings,$cs)) {
+ $t = App::$strings[$cs];
+ $f = 'string_plural_select_' . str_replace('-', '_', App::$language);
if (! function_exists($f))
$f = 'string_plural_select_default';
diff --git a/include/menu.php b/include/menu.php
index d90cefddb..ca3038946 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -72,7 +72,7 @@ function menu_render($menu, $class='', $edit = false, $var = array()) {
if(! $menu)
return '';
- $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
+ $channel_id = ((is_array(App::$profile)) ? App::$profile['profile_uid'] : 0);
if ((! $channel_id) && (local_channel()))
$channel_id = local_channel();
@@ -296,7 +296,7 @@ function menu_add_item($menu_id, $uid, $arr) {
$mitem_flags = intval($arr['mitem_flags']);
if(local_channel() == $uid) {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
}
$acl = new Zotlabs\Access\AccessList($channel);
@@ -337,7 +337,7 @@ function menu_edit_item($menu_id, $uid, $arr) {
if(local_channel() == $uid) {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
}
$acl = new Zotlabs\Access\AccessList($channel);
diff --git a/include/message.php b/include/message.php
index f5115b9f7..a7883d50e 100644
--- a/include/message.php
+++ b/include/message.php
@@ -38,7 +38,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$channel = $r[0];
}
else {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
}
if(! $channel) {
@@ -75,7 +75,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if($recip)
$recip_handle = $recip[0]['xchan_addr'];
- $sender_handle = $channel['channel_address'] . '@' . get_app()->get_hostname();
+ $sender_handle = $channel['channel_address'] . '@' . App::get_hostname();
$handles = $recip_handle . ';' . $sender_handle;
@@ -124,7 +124,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$dups = false;
$hash = random_string();
- $mid = $hash . '@' . get_app()->get_hostname();
+ $mid = $hash . '@' . App::get_hostname();
$r = q("SELECT id FROM mail WHERE mid = '%s' LIMIT 1",
dbesc($mid));
diff --git a/include/nav.php b/include/nav.php
index 7cd1e40d8..3f5c7963a 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -8,11 +8,11 @@ function nav(&$a) {
*
*/
- if(!(x($a->page,'nav')))
- $a->page['nav'] = '';
+ if(!(x(App::$page,'nav')))
+ App::$page['nav'] = '';
$base = z_root();
- $a->page['htmlhead'] .= <<< EOT
+ App::$page['htmlhead'] .= <<< EOT
<script>$(document).ready(function() {
$("#nav-search-text").search_autocomplete('$base/acl');
@@ -24,8 +24,8 @@ EOT;
if(local_channel()) {
- $channel = $a->get_channel();
- $observer = $a->get_observer();
+ $channel = App::get_channel();
+ $observer = App::get_observer();
$prof = q("select id from profile where uid = %d and is_default = 1",
intval($channel['channel_id'])
);
@@ -35,12 +35,12 @@ EOT;
);
}
elseif(remote_channel())
- $observer = $a->get_observer();
+ $observer = App::get_observer();
$myident = (($channel) ? $channel['xchan_addr'] : '');
- $sitelocation = (($myident) ? $myident : $a->get_hostname());
+ $sitelocation = (($myident) ? $myident : App::get_hostname());
@@ -55,7 +55,7 @@ EOT;
if($banner === false)
$banner = get_config('system','sitename');
- $a->page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
+ App::$page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
'$baseurl' => z_root(),
'$sitelocation' => $sitelocation,
'$banner' => $banner
@@ -136,18 +136,18 @@ EOT;
$homelink = get_my_url();
if(! $homelink) {
- $observer = $a->get_observer();
+ $observer = App::get_observer();
$homelink = (($observer) ? $observer['xchan_url'] : '');
}
- if(($a->module != 'home') && (! (local_channel())))
+ if((App::$module != 'home') && (! (local_channel())))
$nav['home'] = array($homelink, t('Home'), "", t('Home Page'),'home_nav_btn');
- if(($a->config['system']['register_policy'] == REGISTER_OPEN) && (! local_channel()) && (! remote_channel()))
+ if((App::$config['system']['register_policy'] == REGISTER_OPEN) && (! local_channel()) && (! remote_channel()))
$nav['register'] = array('register',t('Register'), "", t('Create an account'),'register_nav_btn');
- $help_url = z_root() . '/help?f=&cmd=' . $a->cmd;
+ $help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn');
@@ -234,7 +234,7 @@ $powered_by = '';
$tpl = get_markup_template('nav.tpl');
- $a->page['nav'] .= replace_macros($tpl, array(
+ App::$page['nav'] .= replace_macros($tpl, array(
'$baseurl' => z_root(),
'$sitelocation' => $sitelocation,
'$nav' => $x['nav'],
@@ -242,13 +242,13 @@ $powered_by = '';
'$emptynotifications' => t('Loading...'),
'$userinfo' => $x['usermenu'],
'$localuser' => local_channel(),
- '$sel' => $a->nav_sel,
+ '$sel' => App::$nav_sel,
'$powered_by' => $powered_by,
'$help' => t('@name, #tag, ?doc, content'),
'$pleasewait' => t('Please wait...')
));
- call_hooks('page_header', $a->page['nav']);
+ call_hooks('page_header', App::$page['nav']);
}
/*
@@ -257,7 +257,7 @@ $powered_by = '';
*/
function nav_set_selected($item){
$a = get_app();
- $a->nav_sel = array(
+ App::$nav_sel = array(
'community' => null,
'network' => null,
'home' => null,
@@ -271,5 +271,5 @@ function nav_set_selected($item){
'manage' => null,
'register' => null,
);
- $a->nav_sel[$item] = 'active';
+ App::$nav_sel[$item] = 'active';
}
diff --git a/include/network.php b/include/network.php
index 17e61bac5..ac14548a5 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1856,7 +1856,7 @@ function format_and_send_email($sender,$xchan,$item) {
$sender_name = t('Administrator');
- $hostname = get_app()->get_hostname();
+ $hostname = App::get_hostname();
if(strpos($hostname,':'))
$hostname = substr($hostname,0,strpos($hostname,':'));
$sender_email = 'noreply' . '@' . $hostname;
@@ -1930,11 +1930,11 @@ function get_site_info() {
$admin = array();
foreach($r as $rr) {
if($rr['channel_pageflags'] & PAGE_HUBADMIN)
- $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
+ $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . App::get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
}
if(! $admin) {
foreach($r as $rr) {
- $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
+ $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . App::get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
}
}
}
@@ -1949,7 +1949,7 @@ function get_site_info() {
$service_class = false;
$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)
@@ -1989,8 +1989,8 @@ function get_site_info() {
load_config('feature_lock');
$locked_features = array();
- if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
- foreach($a->config['feature_lock'] as $k => $v) {
+ if(is_array(App::$config['feature_lock']) && count(App::$config['feature_lock'])) {
+ foreach(App::$config['feature_lock'] as $k => $v) {
if($k === 'config_loaded')
continue;
$locked_features[$k] = intval($v);
diff --git a/include/oauth.php b/include/oauth.php
index f3d144158..ec41a5dd2 100644
--- a/include/oauth.php
+++ b/include/oauth.php
@@ -27,7 +27,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
);
if($r) {
- get_app()->set_oauth_key($consumer_key);
+ App::set_oauth_key($consumer_key);
return new OAuth1Consumer($r[0]['client_id'],$r[0]['pw'],$r[0]['redirect_uri']);
}
return null;
diff --git a/include/oembed.php b/include/oembed.php
index 751c136d2..3994af0fb 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -85,7 +85,7 @@ function oembed_fetch_url($embedurl){
// logger('fetch: ' . $embedurl);
- $txt = Cache::get($a->videowidth . $embedurl);
+ $txt = Cache::get(App::$videowidth . $embedurl);
if(strstr($txt,'youtu') && strstr(z_root(),'https:')) {
$txt = str_replace('http:','https:',$txt);
@@ -124,7 +124,7 @@ function oembed_fetch_url($embedurl){
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
- $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
$txt = $x['body'];
break;
}
@@ -133,7 +133,7 @@ function oembed_fetch_url($embedurl){
$entries = $xpath->query("//link[@type='text/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
- $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
$txt = $x['body'];
break;
}
@@ -142,7 +142,7 @@ function oembed_fetch_url($embedurl){
}
if ($txt==false || $txt=="") {
- $x = array('url' => $embedurl,'videowidth' => $a->videowidth);
+ $x = array('url' => $embedurl,'videowidth' => App::$videowidth);
call_hooks('oembed_probe',$x);
if(array_key_exists('embed',$x))
$txt = $x['embed'];
@@ -154,7 +154,7 @@ function oembed_fetch_url($embedurl){
//save in cache
if(! get_config('system','oembed_cache_disable'))
- Cache::set($a->videowidth . $embedurl,$txt);
+ Cache::set(App::$videowidth . $embedurl,$txt);
}
diff --git a/include/permissions.php b/include/permissions.php
index 8f593640c..19242d29f 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -63,7 +63,7 @@ function get_perms() {
*/
function get_all_perms($uid, $observer_xchan, $internal_use = true) {
- $api = get_app()->get_oauth_key();
+ $api = App::get_oauth_key();
if($api)
return get_all_api_perms($uid,$api);
@@ -270,7 +270,7 @@ function get_all_perms($uid, $observer_xchan, $internal_use = true) {
*/
function perm_is_allowed($uid, $observer_xchan, $permission) {
- $api = get_app()->get_oauth_key();
+ $api = App::get_oauth_key();
if($api)
return api_perm_is_allowed($uid,$api,$permission);
diff --git a/include/photos.php b/include/photos.php
index 5dd5f3c62..5838c013f 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -490,12 +490,12 @@ function photos_album_widget($channelx,$observer,$albums = null) {
$o = '';
// If we weren't passed an album list, see if the photos module
- // dropped one for us to find in $a->data['albums'].
+ // dropped one for us to find in App::$data['albums'].
// If all else fails, load it.
if(! $albums) {
- if(array_key_exists('albums', get_app()->data))
- $albums = get_app()->data['albums'];
+ if(array_key_exists('albums', App::$data))
+ $albums = App::$data['albums'];
else
$albums = photos_albums_list($channelx,$observer);
}
diff --git a/include/plugin.php b/include/plugin.php
index e0973b976..8dceb8fb1 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -219,7 +219,7 @@ function unregister_hook($hook, $file, $function) {
//
-// It might not be obvious but themes can manually add hooks to the $a->hooks
+// It might not be obvious but themes can manually add hooks to the App::$hooks
// array in their theme_init() and use this to customise the app behaviour.
// UPDATE: use insert_hook($hookname,$function_name) to do this
//
@@ -227,19 +227,19 @@ function unregister_hook($hook, $file, $function) {
function load_hooks() {
$a = get_app();
-// if(! is_array($a->hooks))
- $a->hooks = array();
+// if(! is_array(App::$hooks))
+ App::$hooks = array();
$r = q("SELECT * FROM hook WHERE true ORDER BY priority DESC");
if($r) {
foreach($r as $rr) {
- if(! array_key_exists($rr['hook'],$a->hooks))
- $a->hooks[$rr['hook']] = array();
+ if(! array_key_exists($rr['hook'],App::$hooks))
+ App::$hooks[$rr['hook']] = array();
- $a->hooks[$rr['hook']][] = array($rr['file'],$rr['function']);
+ App::$hooks[$rr['hook']][] = array($rr['file'],$rr['function']);
}
}
-//logger('hooks: ' . print_r($a->hooks,true));
+//logger('hooks: ' . print_r(App::$hooks,true));
}
/**
@@ -261,13 +261,13 @@ function load_hooks() {
*/
function insert_hook($hook, $fn) {
$a = get_app();
- if(! is_array($a->hooks))
- $a->hooks = array();
+ if(! is_array(App::$hooks))
+ App::$hooks = array();
- if(! array_key_exists($hook, $a->hooks))
- $a->hooks[$hook] = array();
+ if(! array_key_exists($hook, App::$hooks))
+ App::$hooks[$hook] = array();
- $a->hooks[$hook][] = array('', $fn);
+ App::$hooks[$hook][] = array('', $fn);
}
/**
@@ -282,8 +282,8 @@ function insert_hook($hook, $fn) {
function call_hooks($name, &$data = null) {
$a = get_app();
- if((is_array($a->hooks)) && (array_key_exists($name, $a->hooks))) {
- foreach($a->hooks[$name] as $hook) {
+ if((is_array(App::$hooks)) && (array_key_exists($name, App::$hooks))) {
+ foreach(App::$hooks[$name] as $hook) {
if($hook[0])
@include_once($hook[0]);
@@ -392,7 +392,7 @@ function check_plugin_versions($info) {
$test = trim($test);
if(! $test)
continue;
- if(! in_array($test,get_app()->plugins))
+ if(! in_array($test,App::$plugins))
$found = false;
}
}
@@ -508,19 +508,19 @@ function get_theme_screenshot($theme) {
* @param string $media change media attribute (default to 'screen')
*/
function head_add_css($src, $media = 'screen') {
- get_app()->css_sources[] = array($src, $media);
+ App::$css_sources[] = array($src, $media);
}
function head_remove_css($src, $media = 'screen') {
$a = get_app();
- $index = array_search(array($src, $media), $a->css_sources);
+ $index = array_search(array($src, $media), App::$css_sources);
if ($index !== false)
- unset($a->css_sources[$index]);
+ unset(App::$css_sources[$index]);
}
function head_get_css() {
$str = '';
- $sources = get_app()->css_sources;
+ $sources = App::$css_sources;
if (count($sources)) {
foreach ($sources as $source)
$str .= format_css_if_exists($source);
@@ -560,7 +560,7 @@ function script_path() {
// Some proxy setups may require using http_host
- if(intval(get_app()->config['system']['script_path_use_http_host']))
+ if(intval(App::$config['system']['script_path_use_http_host']))
$server_var = 'HTTP_HOST';
else
$server_var = 'SERVER_NAME';
@@ -576,19 +576,19 @@ function script_path() {
}
function head_add_js($src) {
- get_app()->js_sources[] = $src;
+ App::$js_sources[] = $src;
}
function head_remove_js($src) {
$a = get_app();
- $index = array_search($src, $a->js_sources);
+ $index = array_search($src, App::$js_sources);
if($index !== false)
- unset($a->js_sources[$index]);
+ unset(App::$js_sources[$index]);
}
function head_get_js() {
$str = '';
- $sources = get_app()->js_sources;
+ $sources = App::$js_sources;
if(count($sources))
foreach($sources as $source) {
if($source === 'main.js')
@@ -624,7 +624,7 @@ function theme_include($file, $root = '') {
if($root !== '' && $root[strlen($root)-1] !== '/')
$root = $root . '/';
- $theme_info = $a->theme_info;
+ $theme_info = App::$theme_info;
if(array_key_exists('extends',$theme_info))
$parent = $theme_info['extends'];
@@ -656,7 +656,7 @@ function theme_include($file, $root = '') {
function get_intltext_template($s, $root = '') {
$a = get_app();
- $t = $a->template_engine();
+ $t = App::template_engine();
$template = $t->get_intltext_template($s, $root);
return $template;
@@ -665,7 +665,7 @@ function get_intltext_template($s, $root = '') {
function get_markup_template($s, $root = '') {
$a = get_app();
- $t = $a->template_engine();
+ $t = App::template_engine();
$template = $t->get_markup_template($s, $root);
return $template;
}
diff --git a/include/security.php b/include/security.php
index 3b91808d5..479013460 100644
--- a/include/security.php
+++ b/include/security.php
@@ -21,14 +21,14 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$lastlog_updated = false;
if(x($user_record, 'account_id')) {
- $a->account = $user_record;
+ App::$account = $user_record;
$_SESSION['account_id'] = $user_record['account_id'];
$_SESSION['authenticated'] = 1;
$uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid'])))
? intval($_SESSION['uid'])
- : intval($a->account['account_default_channel'])
+ : intval(App::$account['account_default_channel'])
);
if($uid_to_load) {
@@ -40,9 +40,9 @@ function authenticate_success($user_record, $login_initial = false, $interactive
dbesc(datetime_convert()),
intval($_SESSION['account_id'])
);
- $a->account['account_lastlog'] = datetime_convert();
+ App::$account['account_lastlog'] = datetime_convert();
$lastlog_updated = true;
- call_hooks('logged_in', $a->account);
+ call_hooks('logged_in', App::$account);
}
}
@@ -59,7 +59,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
return;
}
- if(($a->module !== 'home') && x($_SESSION,'login_return_url') && strlen($_SESSION['login_return_url'])) {
+ if((App::$module !== 'home') && x($_SESSION,'login_return_url') && strlen($_SESSION['login_return_url'])) {
$return_url = $_SESSION['login_return_url'];
// don't let members get redirected to a raw ajax page update - this can happen
@@ -73,9 +73,9 @@ function authenticate_success($user_record, $login_initial = false, $interactive
/* This account has never created a channel. Send them to new_channel by default */
- if($a->module === 'login') {
+ if(App::$module === 'login') {
$r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0 ",
- intval($a->account['account_id'])
+ intval(App::$account['account_id'])
);
if(($r) && (! $r[0]['total']))
goaway(z_root() . '/new_channel');
@@ -116,7 +116,7 @@ function change_channel($change_channel) {
if($r) {
$hash = $r[0]['channel_hash'];
$_SESSION['uid'] = intval($r[0]['channel_id']);
- get_app()->set_channel($r[0]);
+ App::set_channel($r[0]);
$_SESSION['theme'] = $r[0]['channel_theme'];
$_SESSION['mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme');
date_default_timezone_set($r[0]['channel_timezone']);
@@ -129,8 +129,8 @@ function change_channel($change_channel) {
$_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(z_root(), strpos(z_root(), '://') + 3);
- get_app()->set_observer($x[0]);
- get_app()->set_perms(get_all_perms(local_channel(), $hash));
+ App::set_observer($x[0]);
+ App::set_perms(get_all_perms(local_channel(), $hash));
}
if(! is_dir('store/' . $r[0]['channel_address']))
@os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS,true);
@@ -293,7 +293,7 @@ function scopes_sql($uid,$observer) {
if(! is_foreigner($observer))
$str .= " or public_policy = 'network: red' ";
if(local_channel())
- $str .= " or public_policy = 'site: " . get_app()->get_hostname() . "' ";
+ $str .= " or public_policy = 'site: " . App::get_hostname() . "' ";
$ab = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
dbesc($observer),
@@ -320,7 +320,7 @@ function scopes_sql($uid,$observer) {
*/
function public_permissions_sql($observer_hash) {
- //$observer = get_app()->get_observer();
+ //$observer = App::get_observer();
$groups = init_groups_visitor($observer_hash);
$gs = '<<>>'; // should be impossible to match
@@ -363,7 +363,7 @@ function get_form_security_token($typename = '') {
$a = get_app();
$timestamp = time();
- $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $timestamp . $typename);
+ $sec_hash = hash('whirlpool', App::$user['guid'] . App::$user['prvkey'] . session_id() . $timestamp . $typename);
return $timestamp . '.' . $sec_hash;
}
@@ -379,7 +379,7 @@ function check_form_security_token($typename = '', $formname = 'form_security_to
$x = explode('.', $hash);
if (time() > (IntVal($x[0]) + $max_livetime)) return false;
- $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $x[0] . $typename);
+ $sec_hash = hash('whirlpool', App::$user['guid'] . App::$user['prvkey'] . session_id() . $x[0] . $typename);
return ($sec_hash == $x[1]);
}
@@ -390,7 +390,7 @@ function check_form_security_std_err_msg() {
function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token') {
if (!check_form_security_token($typename, $formname)) {
$a = get_app();
- logger('check_form_security_token failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
+ logger('check_form_security_token failed: user ' . App::$user['guid'] . ' - form element ' . $typename);
logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
notice( check_form_security_std_err_msg() );
goaway(z_root() . $err_redirect );
@@ -399,7 +399,7 @@ function check_form_security_token_redirectOnErr($err_redirect, $typename = '',
function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'form_security_token') {
if (!check_form_security_token($typename, $formname)) {
$a = get_app();
- logger('check_form_security_token failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
+ logger('check_form_security_token failed: user ' . App::$user['guid'] . ' - form element ' . $typename);
logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
header('HTTP/1.1 403 Forbidden');
killme();
diff --git a/include/session.php b/include/session.php
index 6060e4712..71bfdc12a 100644
--- a/include/session.php
+++ b/include/session.php
@@ -156,12 +156,12 @@ session_set_save_handler(
// Force cookies to be secure (https only) if this site is SSL enabled. Must be done before session_start().
- if(intval(get_app()->config['system']['ssl_cookie_protection'])) {
+ if(intval(App::$config['system']['ssl_cookie_protection'])) {
$arr = session_get_cookie_params();
session_set_cookie_params(
((isset($arr['lifetime'])) ? $arr['lifetime'] : 0),
((isset($arr['path'])) ? $arr['path'] : '/'),
- ((isset($arr['domain'])) ? $arr['domain'] : get_app()->get_hostname()),
+ ((isset($arr['domain'])) ? $arr['domain'] : App::get_hostname()),
((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
((isset($arr['httponly'])) ? $arr['httponly'] : true));
} \ No newline at end of file
diff --git a/include/smarty.php b/include/smarty.php
index 99f143db1..3812c6021 100755
--- a/include/smarty.php
+++ b/include/smarty.php
@@ -16,19 +16,19 @@ class FriendicaSmarty extends Smarty {
// setTemplateDir can be set to an array, which Smarty will parse in order.
// The order is thus very important here
$template_dirs = array('theme' => "view/theme/$theme/tpl/");
- if( x($a->theme_info,"extends") )
- $template_dirs = $template_dirs + array('extends' => "view/theme/".$a->theme_info["extends"]."/tpl/");
+ if( x(App::$theme_info,"extends") )
+ $template_dirs = $template_dirs + array('extends' => "view/theme/".App::$theme_info["extends"]."/tpl/");
$template_dirs = $template_dirs + array('base' => 'view/tpl/');
$this->setTemplateDir($template_dirs);
- $basecompiledir = $a->config['system']['smarty3_folder'];
+ $basecompiledir = App::$config['system']['smarty3_folder'];
$this->setCompileDir($basecompiledir.'/compiled/');
$this->setConfigDir($basecompiledir.'/config/');
$this->setCacheDir($basecompiledir.'/cache/');
- $this->left_delimiter = $a->get_template_ldelim('smarty3');
- $this->right_delimiter = $a->get_template_rdelim('smarty3');
+ $this->left_delimiter = App::get_template_ldelim('smarty3');
+ $this->right_delimiter = App::get_template_rdelim('smarty3');
// Don't report errors so verbosely
$this->error_reporting = E_ALL & ~E_NOTICE;
@@ -53,7 +53,7 @@ class FriendicaSmartyEngine implements ITemplateEngine {
// Cannot use get_config() here because it is called during installation when there is no DB.
// FIXME: this may leak private information such as system pathnames.
- $basecompiledir = ((array_key_exists('smarty3_folder',$a->config['system'])) ? $a->config['system']['smarty3_folder'] : '');
+ $basecompiledir = ((array_key_exists('smarty3_folder',App::$config['system'])) ? App::$config['system']['smarty3_folder'] : '');
if (!$basecompiledir) $basecompiledir = dirname(__dir__) . "/" . TEMPLATE_BUILD_PATH;
if (!is_dir($basecompiledir)) {
echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist."; killme();
@@ -61,7 +61,7 @@ class FriendicaSmartyEngine implements ITemplateEngine {
if(!is_writable($basecompiledir)){
echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> must be writable by webserver."; killme();
}
- $a->config['system']['smarty3_folder'] = $basecompiledir;
+ App::$config['system']['smarty3_folder'] = $basecompiledir;
}
// ITemplateEngine interface
@@ -94,8 +94,8 @@ class FriendicaSmartyEngine implements ITemplateEngine {
public function get_intltext_template($file, $root='') {
$a = get_app();
- if(file_exists("view/{$a->language}/$file"))
- $template_file = "view/{$a->language}/$file";
+ if(file_exists("view/{App::$language}/$file"))
+ $template_file = "view/{App::$language}/$file";
elseif(file_exists("view/en/$file"))
$template_file = "view/en/$file";
else
diff --git a/include/socgraph.php b/include/socgraph.php
index e44a8ea9a..1b1bccf20 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -409,7 +409,7 @@ function poco($a,$extended = false) {
http_status_exit(401);
}
- $observer = $a->get_observer();
+ $observer = App::get_observer();
if(argc() > 1) {
$user = notags(trim(argv(1)));
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 5ef106938..71ed6e91d 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -299,7 +299,7 @@ function dir_tagblock($link,$r) {
if(! $r)
- $r = get_app()->data['directory_keywords'];
+ $r = App::$data['directory_keywords'];
if($r) {
$o = '<div class="dirtagblock widget"><h3>' . t('Keywords') . '</h3><div class="tags" align="center">';
diff --git a/include/text.php b/include/text.php
index 7af5db22d..a1a1cfb1c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -27,7 +27,7 @@ function replace_macros($s, $r) {
$arr = array('template' => $s, 'params' => $r);
call_hooks('replace_macros', $arr);
- $t = $a->template_engine();
+ $t = App::template_engine();
$output = $t->replace_macros($arr['template'],$arr['params']);
return $output;
@@ -99,7 +99,7 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
return escape_tags($s);
$a = get_app();
- if($a->is_sys) {
+ if(App::$is_sys) {
return $s;
}
@@ -368,34 +368,34 @@ function hex2bin($s) {
// Automatic pagination.
// To use, get the count of total items.
-// Then call $a->set_pager_total($number_items);
-// Optionally call $a->set_pager_itemspage($n) to the number of items to display on each page
+// Then call App::set_pager_total($number_items);
+// Optionally call App::set_pager_itemspage($n) to the number of items to display on each page
// Then call paginate($a) after the end of the display loop to insert the pager block on the page
// (assuming there are enough items to paginate).
-// When using with SQL, the setting LIMIT %d, %d => $a->pager['start'],$a->pager['itemspage']
+// When using with SQL, the setting LIMIT %d, %d => App::$pager['start'],App::$pager['itemspage']
// will limit the results to the correct items for the current page.
// The actual page handling is then accomplished at the application layer.
function paginate(&$a) {
$o = '';
- $stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
+ $stripped = preg_replace('/(&page=[0-9]*)/','',App::$query_string);
// $stripped = preg_replace('/&zid=(.*?)([\?&]|$)/ism','',$stripped);
$stripped = str_replace('q=','',$stripped);
$stripped = trim($stripped,'/');
- $pagenum = $a->pager['page'];
+ $pagenum = App::$pager['page'];
$url = z_root() . '/' . $stripped;
- if($a->pager['total'] > $a->pager['itemspage']) {
+ if(App::$pager['total'] > App::$pager['itemspage']) {
$o .= '<div class="pager">';
- if($a->pager['page'] != 1)
- $o .= '<span class="pager_prev">'."<a href=\"$url".'&page='.($a->pager['page'] - 1).'">' . t('prev') . '</a></span> ';
+ if(App::$pager['page'] != 1)
+ $o .= '<span class="pager_prev">'."<a href=\"$url".'&page='.(App::$pager['page'] - 1).'">' . t('prev') . '</a></span> ';
$o .= "<span class=\"pager_first\"><a href=\"$url"."&page=1\">" . t('first') . "</a></span> ";
- $numpages = $a->pager['total'] / $a->pager['itemspage'];
+ $numpages = App::$pager['total'] / App::$pager['itemspage'];
$numstart = 1;
$numstop = $numpages;
@@ -406,15 +406,15 @@ function paginate(&$a) {
}
for($i = $numstart; $i <= $numstop; $i++){
- if($i == $a->pager['page'])
+ if($i == App::$pager['page'])
$o .= '<span class="pager_current">'.(($i < 10) ? '&nbsp;'.$i : $i);
else
$o .= "<span class=\"pager_n\"><a href=\"$url"."&page=$i\">".(($i < 10) ? '&nbsp;'.$i : $i)."</a>";
$o .= '</span> ';
}
- if(($a->pager['total'] % $a->pager['itemspage']) != 0) {
- if($i == $a->pager['page'])
+ if((App::$pager['total'] % App::$pager['itemspage']) != 0) {
+ if($i == App::$pager['page'])
$o .= '<span class="pager_current">'.(($i < 10) ? '&nbsp;'.$i : $i);
else
$o .= "<span class=\"pager_n\"><a href=\"$url"."&page=$i\">".(($i < 10) ? '&nbsp;'.$i : $i)."</a>";
@@ -424,8 +424,8 @@ function paginate(&$a) {
$lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);
$o .= "<span class=\"pager_last\"><a href=\"$url"."&page=$lastpage\">" . t('last') . "</a></span> ";
- if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0)
- $o .= '<span class="pager_next">'."<a href=\"$url"."&page=".($a->pager['page'] + 1).'">' . t('next') . '</a></span>';
+ if((App::$pager['total'] - (App::$pager['itemspage'] * App::$pager['page'])) > 0)
+ $o .= '<span class="pager_next">'."<a href=\"$url"."&page=".(App::$pager['page'] + 1).'">' . t('next') . '</a></span>';
$o .= '</div>'."\r\n";
}
return $o;
@@ -439,20 +439,20 @@ function alt_pager(&$a, $i, $more = '', $less = '') {
if(! $less)
$less = t('newer');
- $stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
+ $stripped = preg_replace('/(&page=[0-9]*)/','',App::$query_string);
$stripped = str_replace('q=','',$stripped);
$stripped = trim($stripped,'/');
- //$pagenum = $a->pager['page'];
+ //$pagenum = App::$pager['page'];
$url = z_root() . '/' . $stripped;
return replace_macros(get_markup_template('alt_pager.tpl'), array(
- '$has_less' => (($a->pager['page'] > 1) ? true : false),
- '$has_more' => (($i > 0 && $i >= $a->pager['itemspage']) ? true : false),
+ '$has_less' => ((App::$pager['page'] > 1) ? true : false),
+ '$has_more' => (($i > 0 && $i >= App::$pager['itemspage']) ? true : false),
'$less' => $less,
'$more' => $more,
'$url' => $url,
- '$prevpage' => $a->pager['page'] - 1,
- '$nextpage' => $a->pager['page'] + 1,
+ '$prevpage' => App::$pager['page'] - 1,
+ '$nextpage' => App::$pager['page'] + 1,
));
}
@@ -470,7 +470,7 @@ function item_message_id() {
do {
$dups = false;
$hash = random_string();
- $mid = $hash . '@' . get_app()->get_hostname();
+ $mid = $hash . '@' . App::get_hostname();
$r = q("SELECT id FROM item WHERE mid = '%s' LIMIT 1",
dbesc($mid));
@@ -544,7 +544,7 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
global $a;
global $db;
- if(($a->module == 'install') || (! ($db && $db->connected)))
+ if((App::$module == 'install') || (! ($db && $db->connected)))
return;
$debugging = get_config('system', 'debugging');
@@ -625,7 +625,7 @@ function dlogger($msg, $level = 0) {
global $a;
global $db;
- if(($a->module == 'install') || (! ($db && $db->connected)))
+ if((App::$module == 'install') || (! ($db && $db->connected)))
return;
$debugging = get_config('system','debugging');
@@ -785,20 +785,20 @@ function contact_block() {
$o = '';
$a = get_app();
- if(! $a->profile['uid'])
+ if(! App::$profile['uid'])
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'))
return;
- $shown = get_pconfig($a->profile['uid'],'system','display_friend_count');
+ $shown = get_pconfig(App::$profile['uid'],'system','display_friend_count');
if($shown === false)
$shown = 25;
if($shown == 0)
return;
- $is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false);
+ $is_owner = ((local_channel() && local_channel() == App::$profile['uid']) ? true : false);
$sql_extra = '';
$abook_flags = " and abook_pending = 0 and abook_self = 0 ";
@@ -808,12 +808,12 @@ function contact_block() {
$sql_extra = " and xchan_hidden = 0 ";
}
- if((! is_array($a->profile)) || ($a->profile['hide_friends']))
+ if((! is_array(App::$profile)) || (App::$profile['hide_friends']))
return $o;
$r = q("SELECT COUNT(abook_id) 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(count($r)) {
$total = intval($r[0]['total']);
@@ -826,7 +826,7 @@ function contact_block() {
$randfunc = db_getfunc('RAND');
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d $abook_flags and abook_archived = 0 and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra ORDER BY $randfunc LIMIT %d",
- intval($a->profile['uid']),
+ intval(App::$profile['uid']),
intval($shown)
);
@@ -843,7 +843,7 @@ function contact_block() {
$tpl = get_markup_template('contact_block.tpl');
$o = replace_macros($tpl, array(
'$contacts' => $contacts,
- '$nickname' => $a->profile['channel_address'],
+ '$nickname' => App::$profile['channel_address'],
'$viewconnections' => (($total > $shown) ? sprintf(t('View all %s connections'),$total) : ''),
'$micropro' => $micropro,
));
@@ -1787,7 +1787,7 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
);
$a = get_app();
- if($a->is_sys) {
+ if(App::$is_sys) {
$x[] = 'application/x-php';
}
else {
@@ -1838,7 +1838,7 @@ function lang_selector() {
}
$ll = substr($l,5);
$ll = substr($ll,0,strrpos($ll,'/'));
- $selected = (($ll === $a->language && (x($_SESSION, 'language'))) ? $ll : $selected);
+ $selected = (($ll === App::$language && (x($_SESSION, 'language'))) ? $ll : $selected);
$lang_options[$ll] = get_language_name($ll, $ll) . " ($ll)";
}
}
@@ -2260,10 +2260,10 @@ function json_decode_plus($s) {
*/
function design_tools() {
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
$sys = false;
- if(get_app()->is_sys && is_site_admin()) {
+ if(App::$is_sys && is_site_admin()) {
require_once('include/identity.php');
$channel = get_sys_channel();
$sys = true;
@@ -2520,7 +2520,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
// $r is set if we found something
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if($r) {
$profile = $r[0]['xchan_url'];
@@ -2550,7 +2550,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
if($g && $exclusive) {
$access_tag .= 'gid:' . $g[0]['hash'];
}
- $channel = get_app()->get_channel();
+ $channel = App::get_channel();
if($channel) {
$newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . z_root() . '/channel/' . $channel['channel_address'] . ']' . $newname . '[/zrl]';
$body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
@@ -2608,7 +2608,7 @@ function linkify_tags($a, &$body, $uid, $diaspora = false) {
if($fullnametagged)
continue;
- $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $a->profile_uid , $tag, $diaspora);
+ $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : App::$profile_uid , $tag, $diaspora);
$results[] = array('success' => $success, 'access_tag' => $access_tag);
if($success['replaced']) $tagged[] = $tag;
}
diff --git a/include/widgets.php b/include/widgets.php
index 014160867..4aba14f04 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -13,13 +13,13 @@ require_once('include/Contact.php');
function widget_profile($args) {
$a = get_app();
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- return profile_sidebar($a->profile, $block, true);
+ return profile_sidebar(App::$profile, $block, true);
}
function widget_zcard($args) {
$a = get_app();
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- $channel = channelx_by_n($a->profile_uid);
+ $channel = channelx_by_n(App::$profile_uid);
return get_zcard($channel,get_observer_hash(),array('width' => 875));
}
@@ -34,7 +34,7 @@ function widget_tagcloud($args) {
$o = '';
//$tab = 0;
$a = get_app();
- $uid = $a->profile_uid;
+ $uid = App::$profile_uid;
$count = ((x($args,'count')) ? intval($args['count']) : 24);
$flags = 0;
$type = TERM_CATEGORY;
@@ -85,7 +85,7 @@ function widget_collections($args) {
$each = 'group';
$edit = false;
$current = 0;
- $abook_id = get_app()->poi['abook_xchan'];
+ $abook_id = App::$poi['abook_xchan'];
$wmode = 1;
break;
default:
@@ -165,7 +165,7 @@ function widget_follow($args) {
return '';
$a = get_app();
- $uid =$a->channel['channel_id'];
+ $uid =App::$channel['channel_id'];
$r = q("select count(*) as total from abook where abook_channel = %d and abook_self = 0 ",
intval($uid)
);
@@ -238,7 +238,7 @@ function widget_savedsearch($arr) {
$search = '';
}
- $srchurl = $a->query_string;
+ $srchurl = App::$query_string;
$srchurl = rtrim(preg_replace('/searchsave\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$hasq = ((strpos($srchurl,'?') !== false) ? true : false);
@@ -316,7 +316,7 @@ function widget_filer($arr) {
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
- '$base' => z_root() . '/' . $a->cmd
+ '$base' => z_root() . '/' . App::$cmd
));
}
@@ -325,11 +325,11 @@ function widget_archive($arr) {
$o = '';
$a = get_app();
- if(! $a->profile_uid) {
+ if(! App::$profile_uid) {
return '';
}
- $uid = $a->profile_uid;
+ $uid = App::$profile_uid;
if(! feature_enabled($uid,'archives'))
return '';
@@ -345,7 +345,7 @@ function widget_archive($arr) {
if(! $visible_years)
$visible_years = 5;
- $url = z_root() . '/' . $a->cmd;
+ $url = z_root() . '/' . App::$cmd;
$ret = list_post_dates($uid,$wall,$mindate);
@@ -371,33 +371,33 @@ function widget_archive($arr) {
function widget_fullprofile($arr) {
$a = get_app();
- if(! $a->profile['profile_uid'])
+ if(! App::$profile['profile_uid'])
return;
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- return profile_sidebar($a->profile, $block);
+ return profile_sidebar(App::$profile, $block);
}
function widget_shortprofile($arr) {
$a = get_app();
- if(! $a->profile['profile_uid'])
+ if(! App::$profile['profile_uid'])
return;
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- return profile_sidebar($a->profile, $block, true, true);
+ return profile_sidebar(App::$profile, $block, true, true);
}
function widget_categories($arr) {
$a = get_app();
- if($a->profile['profile_uid'] && (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_stream')))
+ if(App::$profile['profile_uid'] && (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_stream')))
return '';
$cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
- $srchurl = $a->query_string;
+ $srchurl = App::$query_string;
$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
@@ -408,14 +408,14 @@ function widget_categories($arr) {
function widget_tagcloud_wall($arr) {
$a = get_app();
- if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash']))
+ if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return '';
- if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream'))
+ if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return '';
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
- if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
- return wtagblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
+ if(feature_enabled(App::$profile['profile_uid'], 'tagadelic'))
+ return wtagblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
return '';
}
@@ -423,14 +423,14 @@ function widget_tagcloud_wall($arr) {
function widget_catcloud_wall($arr) {
$a = get_app();
- if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash']))
+ if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return '';
- if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream'))
+ if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return '';
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
- return catblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
+ return catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
}
@@ -487,7 +487,7 @@ function widget_settings_menu($arr) {
return;
$a = get_app();
- $channel = $a->get_channel();
+ $channel = App::get_channel();
$abook_self_id = 0;
@@ -660,7 +660,7 @@ function widget_conversations($arr) {
require_once('include/message.php');
// private_messages_list() can do other more complicated stuff, for now keep it simple
- $r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']);
+ $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']);
if(! $r) {
info( t('No messages.') . EOL);
@@ -735,8 +735,8 @@ function widget_design_tools($arr) {
// mod menu doesn't load a profile. For any modules which load a profile, check it.
// otherwise local_channel() is sufficient for permissions.
- if($a->profile['profile_uid'])
- if(($a->profile['profile_uid'] != local_channel()) && (! $a->is_sys))
+ if(App::$profile['profile_uid'])
+ if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys))
return '';
if(! local_channel())
@@ -754,20 +754,20 @@ function widget_findpeople($arr) {
function widget_photo_albums($arr) {
$a = get_app();
- if(! $a->profile['profile_uid'])
+ if(! App::$profile['profile_uid'])
return '';
- $channelx = channelx_by_n($a->profile['profile_uid']);
- if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_storage')))
+ $channelx = channelx_by_n(App::$profile['profile_uid']);
+ if((! $channelx) || (! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_storage')))
return '';
require_once('include/photos.php');
- return photos_album_widget($channelx, $a->get_observer());
+ return photos_album_widget($channelx, App::get_observer());
}
function widget_vcard($arr) {
require_once ('include/Contact.php');
- return vcard_from_xchan('', get_app()->get_observer());
+ return vcard_from_xchan('', App::get_observer());
}
@@ -785,24 +785,24 @@ function widget_dirtags($arr) {
}
function widget_menu_preview($arr) {
- if(! get_app()->data['menu_item'])
+ if(! App::$data['menu_item'])
return;
require_once('include/menu.php');
- return menu_render(get_app()->data['menu_item']);
+ return menu_render(App::$data['menu_item']);
}
function widget_chatroom_list($arr) {
$a = get_app();
require_once("include/chat.php");
- $r = chatroom_list($a->profile['profile_uid']);
+ $r = chatroom_list(App::$profile['profile_uid']);
if($r) {
return replace_macros(get_markup_template('chatroomlist.tpl'), array(
'$header' => t('Chat Rooms'),
'$baseurl' => z_root(),
- '$nickname' => $a->profile['channel_address'],
+ '$nickname' => App::$profile['channel_address'],
'$items' => $r,
'$overview' => t('Overview')
));
@@ -853,7 +853,7 @@ function widget_item($arr) {
if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = get_app()->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
@@ -1002,14 +1002,14 @@ function widget_cover_photo($arr) {
$a = get_app();
- if($a->module == 'channel' && $_REQUEST['mid'])
+ if(App::$module == 'channel' && $_REQUEST['mid'])
return '';
$channel_id = 0;
if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = $a->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
@@ -1065,13 +1065,13 @@ function widget_photo_rand($arr) {
if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = get_app()->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
$scale = ((array_key_exists('scale',$arr)) ? intval($arr['scale']) : 0);
- $ret = photos_list_photos(array('channel_id' => $channel_id),get_app()->get_observer(),$album);
+ $ret = photos_list_photos(array('channel_id' => $channel_id),App::get_observer(),$album);
$filtered = array();
if($ret['success'] && $ret['photos'])
@@ -1115,7 +1115,7 @@ function widget_random_block($arr) {
if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = get_app()->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
@@ -1161,7 +1161,7 @@ function widget_rating($arr) {
if($arr['target'])
$hash = $arr['target'];
else
- $hash = $a->poi['xchan_hash'];
+ $hash = App::$poi['xchan_hash'];
if(! $hash)
return;
@@ -1170,7 +1170,7 @@ function widget_rating($arr) {
$remote = false;
if(remote_channel() && ! local_channel()) {
- $ob = $a->get_observer();
+ $ob = App::get_observer();
if($ob && $ob['xchan_url']) {
$p = parse_url($ob['xchan_url']);
if($p) {
@@ -1184,7 +1184,7 @@ function widget_rating($arr) {
$self = false;
if(local_channel()) {
- $channel = $a->get_channel();
+ $channel = App::get_channel();
if($hash == $channel['channel_hash'])
$self = true;
@@ -1213,7 +1213,7 @@ function widget_rating($arr) {
// used by site ratings pages to provide a return link
function widget_pubsites($arr) {
- if(get_app()->poi)
+ if(App::$poi)
return;
return '<div class="widget"><ul class="nav nav-pills"><li><a href="pubsites">' . t('Public Hubs') . '</a></li></ul></div>';
}
@@ -1354,7 +1354,7 @@ function widget_admin($arr) {
$plugin = $h['name'];
$plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
// temp plugins with admin
- $a->plugins_admin[] = $plugin;
+ App::$plugins_admin[] = $plugin;
}
}
@@ -1382,7 +1382,7 @@ function widget_admin($arr) {
function widget_album($args) {
- $owner_uid = get_app()->profile_uid;
+ $owner_uid = App::$profile_uid;
$sql_extra = permissions_sql($owner_uid);
@@ -1441,7 +1441,7 @@ function widget_album($args) {
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
- $imagelink = (z_root() . '/photos/' . get_app()->profile['channel_address'] . '/image/' . $rr['resource_id']);
+ $imagelink = (z_root() . '/photos/' . App::$profile['channel_address'] . '/image/' . $rr['resource_id']);
$photos[] = array(
@@ -1467,7 +1467,7 @@ function widget_album($args) {
'$album_id' => rand(),
'$album_edit' => array(t('Edit Album'), $album_edit),
'$can_post' => false,
- '$upload' => array(t('Upload'), z_root() . '/photos/' . get_app()->profile['channel_address'] . '/upload/' . bin2hex($album)),
+ '$upload' => array(t('Upload'), z_root() . '/photos/' . App::$profile['channel_address'] . '/upload/' . bin2hex($album)),
'$order' => false,
'$upload_form' => $upload_form,
'$usage' => $usage_message
diff --git a/include/zot.php b/include/zot.php
index d8cae3954..fa3563085 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -181,7 +181,7 @@ function zot_finger($webbie, $channel = null, $autofallback = true) {
if (strpos($webbie,'@') === false) {
$address = $webbie;
- $host = get_app()->get_hostname();
+ $host = App::get_hostname();
} else {
$address = substr($webbie,0,strpos($webbie,'@'));
$host = substr($webbie,strpos($webbie,'@')+1);
@@ -941,7 +941,7 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
}
if(($changed) || ($ud_flags == UPDATE_FLAGS_FORCED)) {
- $guid = random_string() . '@' . get_app()->get_hostname();
+ $guid = random_string() . '@' . App::get_hostname();
update_modtime($xchan_hash,$guid,$address,$ud_flags);
logger('import_xchan: changed: ' . $what,LOGGER_DEBUG);
}
@@ -1527,7 +1527,7 @@ function allowed_public_recips($msg) {
return $recips;
if(strpos($scope,'site:') === 0) {
- if(($scope === 'site: ' . get_app()->get_hostname()) && ($msg['notify']['sender']['url'] === z_root()))
+ if(($scope === 'site: ' . App::get_hostname()) && ($msg['notify']['sender']['url'] === z_root()))
return $recips;
else
return array();
@@ -1606,7 +1606,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
$channel = $r[0];
- $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
+ $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . App::get_hostname() . '>');
/* blacklisted channels get a permission denied, no special message to tip them off */
@@ -2085,7 +2085,7 @@ function process_mail_delivery($sender, $arr, $deliveries) {
}
$channel = $r[0];
- $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
+ $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . App::get_hostname() . '>');
/* blacklisted channels get a permission denied, no special message to tip them off */
@@ -2227,7 +2227,7 @@ function process_location_delivery($sender,$arr,$deliveries) {
$x = sync_locations($sender,$arr,true);
logger('process_location_delivery: results: ' . print_r($x,true), LOGGER_DEBUG);
if($x['changed']) {
- $guid = random_string() . '@' . get_app()->get_hostname();
+ $guid = random_string() . '@' . App::get_hostname();
update_modtime($sender['hash'],$sender['guid'],$arr['locations'][0]['address'],UPDATE_FLAGS_UPDATED);
}
}
@@ -2690,7 +2690,7 @@ function import_directory_profile($hash, $profile, $addr, $ud_flags = UPDATE_FLA
call_hooks('import_directory_profile', $d);
if (($d['update']) && (! $suppress_update))
- update_modtime($arr['xprof_hash'],random_string() . '@' . get_app()->get_hostname(), $addr, $ud_flags);
+ update_modtime($arr['xprof_hash'],random_string() . '@' . App::get_hostname(), $addr, $ud_flags);
return $d['update'];
}
@@ -2969,7 +2969,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
$synchubs = array();
foreach($h as $x) {
- if($x['hubloc_host'] == $a->get_hostname())
+ if($x['hubloc_host'] == App::get_hostname())
continue;
$synchubs[] = $x;
@@ -2991,8 +2991,8 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
$info['type'] = 'channel_sync';
$info['encoding'] = 'red'; // note: not zot, this packet is very red specific
- if(array_key_exists($uid,$a->config) && array_key_exists('transient',$a->config[$uid])) {
- $settings = $a->config[$uid]['transient'];
+ if(array_key_exists($uid,App::$config) && array_key_exists('transient',App::$config[$uid])) {
+ $settings = App::$config[$uid]['transient'];
if($settings) {
$info['config'] = $settings;
}
@@ -3490,7 +3490,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(array_key_exists('item',$arr) && is_array($arr['item'][0])) {
$DR = new Zotlabs\Zot\DReport(z_root(),$d['hash'],$d['hash'],$arr['item'][0]['message_id'],'channel sync processed');
- $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
+ $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . App::get_hostname() . '>');
}
else
$DR = new Zotlabs\Zot\DReport(z_root(),$d['hash'],$d['hash'],'sync packet','channel sync delivered');
@@ -3918,7 +3918,7 @@ function zotinfo($arr) {
$a = get_app();
$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($r)
foreach($r as $rr)
@@ -3983,11 +3983,11 @@ function check_zotinfo($channel,$locations,&$ret) {
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()),
intval(1),
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')),
dbesc('zot')