Merge branch 'master' of https://github.com/redmatrix/hubzilla into contextual-help

This commit is contained in:
Andrew Manning 2016-04-03 21:36:29 -04:00
commit 0523b4b2f1
292 changed files with 67169 additions and 65597 deletions

View file

@ -6,21 +6,21 @@ class System {
function get_platform_name() {
$a = get_app();
if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['platform_name'])
return $a->config['system']['platform_name'];
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['platform_name'])
return \App::$config['system']['platform_name'];
return PLATFORM_NAME;
}
function get_project_version() {
$a = get_app();
if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version'])
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['hide_version'])
return '';
return RED_VERSION;
}
function get_update_version() {
$a = get_app();
if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version'])
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['hide_version'])
return '';
return DB_UPDATE_VERSION;
}
@ -28,15 +28,15 @@ class System {
function get_notify_icon() {
$a = get_app();
if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['email_notify_icon_url'])
return $a->config['system']['email_notify_icon_url'];
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['email_notify_icon_url'])
return \App::$config['system']['email_notify_icon_url'];
return z_root() . '/images/hz-white-32.png';
}
function get_site_icon() {
$a = get_app();
if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['site_icon_url'])
return $a->config['system']['site_icon_url'];
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['site_icon_url'])
return \App::$config['system']['site_icon_url'];
return z_root() . '/images/hz-32.png';
}

View file

@ -243,7 +243,7 @@ class Browser extends DAV\Browser\Plugin {
));
$a = get_app();
$a->page['content'] = $html;
\App::$page['content'] = $html;
load_pdl($a);
$theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";

View file

@ -53,7 +53,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
logger('directory ' . $ext_path, LOGGER_DATA);
$this->ext_path = $ext_path;
// remove "/cloud" from the beginning of the path
$modulename = get_app()->module;
$modulename = \App::$module;
$this->red_path = ((strpos($ext_path, '/' . $modulename) === 0) ? substr($ext_path, strlen($modulename) + 1) : $ext_path);
if (! $this->red_path) {
$this->red_path = '/';
@ -114,7 +114,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
throw new DAV\Exception\Forbidden('Permission denied.');
}
$modulename = get_app()->module;
$modulename = \App::$module;
if ($this->red_path === '/' && $name === $modulename) {
return new Directory('/' . $modulename, $this->auth);
}
@ -332,7 +332,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
require_once('include/photos.php');
$args = array( 'resource_id' => $hash, 'album' => $album, 'os_path' => $f, 'filename' => $name, 'getimagesize' => $x, 'directory' => $direct);
$p = photo_upload($c[0],get_app()->get_observer(),$args);
$p = photo_upload($c[0],\App::get_observer(),$args);
}
}
@ -393,7 +393,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
public function childExists($name) {
// On /cloud we show a list of available channels.
// @todo what happens if no channels are available?
$modulename = get_app()->module;
$modulename = \App::$module;
if ($this->red_path === '/' && $name === $modulename) {
//logger('We are at ' $modulename . ' show a channel list', LOGGER_DEBUG);
return true;
@ -417,7 +417,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
logger('GetDir: ' . $this->ext_path, LOGGER_DEBUG);
$this->auth->log();
$modulename = get_app()->module;
$modulename = \App::$module;
$file = $this->ext_path;

View file

@ -173,7 +173,7 @@ class File extends DAV\Node implements DAV\IFile {
if($is_photo) {
require_once('include/photos.php');
$args = array( 'resource_id' => $this->data['hash'], 'album' => $album, 'os_path' => $f, 'filename' => $r[0]['filename'], 'getimagesize' => $gis, 'directory' => $direct );
$p = photo_upload($c[0],get_app()->get_observer(),$args);
$p = photo_upload($c[0],\App::get_observer(),$args);
}
// update the folder's lastmodified timestamp

View file

@ -9,9 +9,9 @@ class Router {
/**
*
* We have already parsed the server path into $a->argc and $a->argv
* We have already parsed the server path into App::$argc and App::$argv
*
* $a->argv[0] is our module name. We will load the file mod/{$a->argv[0]}.php
* App::$argv[0] is our module name. We will load the file mod/{App::$argv[0]}.php
* and use it for handling our URL request.
* The module file contains a few functions that we call in various circumstances
* and in the following order:
@ -25,7 +25,9 @@ class Router {
* further processing.
*/
if(strlen($a->module)) {
$module = \App::$module;
if(strlen($module)) {
/**
*
@ -34,14 +36,14 @@ class Router {
*
*/
if(is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
include_once("addon/{$a->module}/{$a->module}.php");
if(function_exists($a->module . '_module'))
$a->module_loaded = true;
if(is_array(\App::$plugins) && in_array($module,\App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
include_once("addon/{$module}/{$module}.php");
if(function_exists($module . '_module'))
\App::$module_loaded = true;
}
if((strpos($a->module,'admin') === 0) && (! is_site_admin())) {
$a->module_loaded = false;
if((strpos($module,'admin') === 0) && (! is_site_admin())) {
\App::$module_loaded = false;
notice( t('Permission denied.') . EOL);
goaway(z_root());
}
@ -51,17 +53,19 @@ class Router {
* Otherwise, look for the standard program module in the 'mod' directory
*/
if(! $a->module_loaded) {
if(file_exists("mod/site/{$a->module}.php")) {
include_once("mod/site/{$a->module}.php");
$a->module_loaded = true;
if(! (\App::$module_loaded)) {
if(file_exists("mod/site/{$module}.php")) {
include_once("mod/site/{$module}.php");
\App::$module_loaded = true;
}
elseif(file_exists("mod/{$a->module}.php")) {
include_once("mod/{$a->module}.php");
$a->module_loaded = true;
elseif(file_exists("mod/{$module}.php")) {
include_once("mod/{$module}.php");
\App::$module_loaded = true;
}
else logger("mod/{$module}.php not found.");
}
/**
* This provides a place for plugins to register module handlers which don't otherwise exist on the system.
* If the plugin sets 'installed' to true we won't throw a 404 error for the specified module even if
@ -69,10 +73,10 @@ class Router {
* The plugin should catch at least one of the module hooks for this URL.
*/
$x = array('module' => $a->module, 'installed' => false);
$x = array('module' => $module, 'installed' => false);
call_hooks('module_loaded', $x);
if($x['installed'])
$a->module_loaded = true;
\App::$module_loaded = true;
/**
* The URL provided does not resolve to a valid module.
@ -85,28 +89,28 @@ class Router {
* Otherwise we are going to emit a 404 not found.
*/
if(! $a->module_loaded) {
if(! (\App::$module_loaded)) {
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
if((x($_SERVER, 'QUERY_STRING')) && preg_match('/{[0-9]}/', $_SERVER['QUERY_STRING']) !== 0) {
killme();
}
if((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && $a->config['system']['dreamhost_error_hack']) {
if((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && \App::$config['system']['dreamhost_error_hack']) {
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']);
goaway(z_root() . $_SERVER['REQUEST_URI']);
}
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
header($_SERVER['SERVER_PROTOCOL'] . ' 404 ' . t('Not Found'));
$tpl = get_markup_template('404.tpl');
$a->page['content'] = replace_macros($tpl, array(
\App::$page['content'] = replace_macros($tpl, array(
'$message' => t('Page not found.')
));
// pretend this is a module so it will initialise the theme
$a->module = '404';
$a->module_loaded = true;
\App::$module = '404';
\App::$module_loaded = true;
}
}
}
@ -118,8 +122,8 @@ class Router {
* Call module functions
*/
if($a->module_loaded) {
$a->page['page_title'] = $a->module;
if(\App::$module_loaded) {
\App::$page['page_title'] = \App::$module;
$placeholder = '';
/**
@ -129,11 +133,11 @@ class Router {
* to over-ride them.
*/
if(function_exists($a->module . '_init')) {
if(function_exists(\App::$module . '_init')) {
$arr = array('init' => true, 'replace' => false);
call_hooks($a->module . '_mod_init', $arr);
call_hooks(\App::$module . '_mod_init', $arr);
if(! $arr['replace']) {
$func = $a->module . '_init';
$func = \App::$module . '_init';
$func($a);
}
}
@ -167,32 +171,32 @@ class Router {
$func = str_replace('-', '_', current_theme()) . '_init';
$func($a);
}
elseif (x($a->theme_info, 'extends') && file_exists('view/theme/' . $a->theme_info['extends'] . '/php/theme.php')) {
require_once('view/theme/' . $a->theme_info['extends'] . '/php/theme.php');
if(function_exists(str_replace('-', '_', $a->theme_info['extends']) . '_init')) {
$func = str_replace('-', '_', $a->theme_info['extends']) . '_init';
elseif (x(\App::$theme_info, 'extends') && file_exists('view/theme/' . \App::$theme_info['extends'] . '/php/theme.php')) {
require_once('view/theme/' . \App::$theme_info['extends'] . '/php/theme.php');
if(function_exists(str_replace('-', '_', \App::$theme_info['extends']) . '_init')) {
$func = str_replace('-', '_', \App::$theme_info['extends']) . '_init';
$func($a);
}
}
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
&& (function_exists($a->module . '_post'))
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error)
&& (function_exists(\App::$module . '_post'))
&& (! x($_POST, 'auth-params'))) {
call_hooks($a->module . '_mod_post', $_POST);
$func = $a->module . '_post';
call_hooks(\App::$module . '_mod_post', $_POST);
$func = \App::$module . '_post';
$func($a);
}
if((! $a->error) && (function_exists($a->module . '_content'))) {
$arr = array('content' => $a->page['content'], 'replace' => false);
call_hooks($a->module . '_mod_content', $arr);
$a->page['content'] = $arr['content'];
if((! \App::$error) && (function_exists(\App::$module . '_content'))) {
$arr = array('content' => \App::$page['content'], 'replace' => false);
call_hooks(\App::$module . '_mod_content', $arr);
\App::$page['content'] = $arr['content'];
if(! $arr['replace']) {
$func = $a->module . '_content';
$func = \App::$module . '_content';
$arr = array('content' => $func($a));
}
call_hooks($a->module . '_mod_aftercontent', $arr);
$a->page['content'] .= $arr['content'];
call_hooks(\App::$module . '_mod_aftercontent', $arr);
\App::$page['content'] .= $arr['content'];
}
}
}

View file

@ -132,7 +132,7 @@ class Auth {
// tell them to logout if they're logged in locally as anything but the target remote account
// in which case just shut up because they don't need to be doing this at all.
if (get_app()->channel['channel_hash'] == $hubloc['xchan_hash']) {
if (\App::$channel['channel_hash'] == $hubloc['xchan_hash']) {
return true;
}
else {
@ -242,9 +242,9 @@ class Auth {
$arr = array('xchan' => $hubloc, 'url' => $this->desturl, 'session' => $_SESSION);
call_hooks('magic_auth_success',$arr);
get_app()->set_observer($hubloc);
\App::set_observer($hubloc);
require_once('include/security.php');
get_app()->set_groups(init_groups_visitor($_SESSION['visitor_id']));
\App::set_groups(init_groups_visitor($_SESSION['visitor_id']));
info(sprintf( t('Welcome %s. Remote authentication successful.'),$hubloc['xchan_name']));
logger('mod_zot: auth success from ' . $hubloc['xchan_addr']);
$this->success = true;
@ -341,5 +341,5 @@ class Auth {
* Service_class can be used by cooperating sites to provide different access rights based on account rights and subscription plans. It is
* a string whose contents are not defined by protocol. Example: "basic" or "gold".
*
* @param[in,out] App &$a
* @param[in,out] \App &$a
*/

620
boot.php

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@ view/php/default.php
<html>
<head>
<title><?php if(x($page,'title')) echo $page['title'] ?></title>
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>
<script>var baseurl="<?php echo z_root() ?>";</script>
<?php if(x($page,'htmlhead')) echo $page['htmlhead'] ?>
</head>
<body>

View file

@ -38,7 +38,7 @@ Inside it, put the following information - edit as needed
function mytheme_init(&$a) {
$a->theme_info['extends'] = 'redbasic';
App::$theme_info['extends'] = 'redbasic';
}
@ -79,7 +79,7 @@ If you want to use the redbasic schemas for your derived theme, you have to do a
Do everything as above, but don't create view/theme/mytheme/php/style.php, but copy instead view/theme/redbasic/php/style.php to view/theme/mytheme/php/style.php. Modify that file and remove (or comment out) these two lines:
if(local_channel() && $a->channel && $a->channel['channel_theme'] != 'redbasic')
if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'redbasic')
set_pconfig(local_channel(), 'redbasic', 'schema', '---');
Also add this line at the bottom:

View file

@ -12,7 +12,7 @@ There are certain scenarios where you might want your own directory-server that
* On the hub that will be the Directory Server, open the .htconfig.php file and set:
`$a->config['system']['directory_mode'] = DIRECTORY_MODE_PRIMARY;`
`App::$config['system']['directory_mode'] = DIRECTORY_MODE_PRIMARY;`
By default it should already be set as **DIRECTORY_MODE_NORMAL**, so just edit that line to say **DIRECTORY_MODE_PRIMARY**

View file

@ -21,7 +21,7 @@ Returns the global app structure ($a).
* App::get_observer()
(App:: is usually assigned to the global $a), so $a->get_observer() or get_app()->get_observer() - returns an xchan structure representing the current viewer if authenticated (locally or remotely).
(App:: is usually assigned to the global $a), so App::get_observer() or App::get_observer() - returns an xchan structure representing the current viewer if authenticated (locally or remotely).
* get_config($family,$key), get_pconfig($uid,$family,$key)

View file

@ -242,7 +242,7 @@ Befor you register a first user switch off the registration mails.
Open /var/www/.htconfig.php
and make sure "0" is set in this line
[code]
$a->config['system']['verify_email'] = 0;
App::$config['system']['verify_email'] = 0;
[/code]
You should be able to change the file as "yourself" (instead of using root or www-data).

View file

@ -30,7 +30,7 @@ To configure this, please look in your .htconfig.php file for the following text
// DIRECTORY_MODE_PRIMARY = main directory server
// DIRECTORY_MODE_STANDALONE = "off the grid" or private directory services
$a->config['system']['directory_mode'] = DIRECTORY_MODE_STANDALONE;
App::$config['system']['directory_mode'] = DIRECTORY_MODE_STANDALONE;
[/code]

View file

@ -8,22 +8,22 @@ $a is a class defined in boot.php and passed all around $Projectname as a global
We don't ever create more than one instance and always modify the elements of the single instance. The mechanics of this are somewhat tricky. If you have a function that is passed $a and needs to modify $a you need to declare it as a reference with '&' e.g.
[code]function foo(&$a) { $a->something = 'x'; // whatever };
[code]function foo(&$a) { App::$something = 'x'; // whatever };
*or* access it within your function as a global variable via get_app()
function foo() {
$a = get_app();
$a->something = 'x';
App::$something = 'x';
}
function foo($a) { $a->something = 'x'; };
function foo($a) { App::$something = 'x'; };
will *not* change the global app state.
function foo() {
get_app()->something = 'x';
App::$something = 'x';
}
[/code]

View file

@ -8,5 +8,5 @@ The hook data for this call consists of an array
This element contains the HTML content which was prepared for this page by calling the module_content() function. It is invoked after the content has been created. It does not contain the result of AJAX or asynchronous page load calls.
The current module may be determined by lookin at $a->module
The current module may be determined by lookin at App::$module

View file

@ -6,5 +6,5 @@ The hook data for this call consists of an array
This element contains the HTML content before calling the module_content() function. It is invoked before the content region has been populated. This may or may not be empty as there may be other processes or addons generating content prior to your hook handler is run. Be certain to preserve any current content. Typically anything you add here will be placed at the top of the content region of the page, but in any event prior to the main content region being generated.
The current module may be determined by lookin at $a->module
The current module may be determined by lookin at App::$module

View file

@ -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,
@ -235,7 +235,7 @@ function account_remove($account_id,$local = true,$unset_session=true) {
unset($_SESSION['authenticated']);
unset($_SESSION['uid']);
notice( sprintf(t("User '%s' deleted"),$account_email) . EOL);
goaway(get_app()->get_baseurl());
goaway(z_root());
}
return $r;
@ -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'])
);
}
}
@ -390,7 +390,7 @@ function channel_remove($channel_id, $local = true, $unset_session=false) {
if($channel_id == local_channel() && $unset_session) {
nuke_session();
goaway($a->get_baseurl());
goaway(z_root());
}
}

View file

@ -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:

View file

@ -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;

View file

@ -97,7 +97,7 @@ class Item extends BaseObject {
$mode = $conv->get_mode();
if(local_channel() && $observer['xchan_hash'] === $item['author_xchan'])
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
$edpost = array(z_root()."/editpost/".$item['id'], t("Edit"));
else
$edpost = false;
@ -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
));

View file

@ -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

View file

@ -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;
}

View file

@ -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;

View file

@ -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,12 +171,12 @@ require_once('include/api_auth.php');
$arr['$user'] = $user_info;
$arr['$rss'] = array(
'alternate' => $user_info['url'],
'self' => $a->get_baseurl(). "/". $a->query_string,
'base' => $a->get_baseurl(),
'self' => z_root(). "/". App::$query_string,
'base' => z_root(),
'updated' => api_date(null),
'atom_updated' => datetime_convert('UTC','UTC','now',ATOM_TIME),
'language' => $user_info['language'],
'logo' => $a->get_baseurl()."/images/rm-64.png",
'logo' => z_root()."/images/rm-64.png",
);
return $arr;
@ -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)){
@ -318,7 +318,7 @@ require_once('include/api_auth.php');
'location' => ($usr) ? $usr[0]['channel_location'] : '',
'profile_image_url' => $uinfo[0]['xchan_photo_l'],
'url' => $uinfo[0]['xchan_url'],
'contact_url' => $a->get_baseurl() . "/connections/".$uinfo[0]['abook_id'],
'contact_url' => z_root() . "/connections/".$uinfo[0]['abook_id'],
'protected' => false,
'friends_count' => intval($countfriends),
'created_at' => api_date($uinfo[0]['abook_created']),
@ -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,8 +1272,8 @@ 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['link']['url'] = $a->get_baseurl()."/".$user_info["screen_name"]."/all";
$as['title'] = App::$config['sitename']." Home Timeline";
$as['link']['url'] = z_root()."/".$user_info["screen_name"]."/all";
return($as);
break;
}
@ -1333,8 +1333,8 @@ 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['link']['url'] = $a->get_baseurl()."/";
$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 = $a->get_baseurl() . '/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,8 +1561,8 @@ require_once('include/api_auth.php');
break;
case "as":
$as = api_format_as($a, $ret, $user_info);
$as["title"] = $a->config['sitename']." Mentions";
$as['link']['url'] = $a->get_baseurl()."/";
$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,8 +1783,8 @@ 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['link']['url'] = $a->get_baseurl()."/".$user_info["screen_name"]."/all";
$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"];
@ -1857,7 +1857,7 @@ require_once('include/api_auth.php');
$items[] = $singleitem;
}
$as['items'] = $items;
$as['link']['url'] = $a->get_baseurl()."/".$user_info["screen_name"]."/all";
$as['link']['url'] = z_root()."/".$user_info["screen_name"]."/all";
$as['link']['rel'] = "alternate";
$as['link']['type'] = "text/html";
return($as);
@ -1978,8 +1978,8 @@ require_once('include/api_auth.php');
'entities' => '',
'objecttype' => (($item['obj_type']) ? $item['obj_type'] : ACTIVITY_OBJ_NOTE),
'verb' => (($item['verb']) ? $item['verb'] : ACTIVITY_POST),
'self' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
'edit' => $a->get_baseurl()."/api/statuses/show/".$item['id'].".".$type,
'self' => z_root()."/api/statuses/show/".$item['id'].".".$type,
'edit' => z_root()."/api/statuses/show/".$item['id'].".".$type,
);
$status = array_merge($status, $status2);
@ -2088,8 +2088,8 @@ require_once('include/api_auth.php');
load_config('system');
$name = get_config('system','sitename');
$server = $a->get_hostname();
$logo = $a->get_baseurl() . '/images/rm-64.png';
$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');
$private = ((get_config('system','block_public')) ? 'true' : 'false');
@ -2097,7 +2097,7 @@ require_once('include/api_auth.php');
if(get_config('system','api_import_size'))
$texlimit = string(get_config('system','api_import_size'));
$ssl = ((get_config('system','have_ssl')) ? 'true' : 'false');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',$a->get_baseurl()) : '');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',z_root()) : '');
$config = array(
'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@ -2270,9 +2270,9 @@ require_once('include/api_auth.php');
if ($page<0) $page=0;
$start = $page*$count;
$channel = $a->get_channel();
$channel = App::get_channel();
$profile_url = $a->get_baseurl() . '/channel/' . $channel['channel_address'];
$profile_url = z_root() . '/channel/' . $channel['channel_address'];
if ($box=="sentbox") {
$sql_extra = "`from_xchan`='".dbesc( $channel['channel_hash'] )."'";
}

View file

@ -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();

View file

@ -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'));

View file

@ -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) {

View file

@ -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))) {

View file

@ -473,7 +473,7 @@ function format_event_diaspora($ev) {
$ev['start'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['start'] , $bd_format)))
. '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
. '](' . z_root() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
if(! $ev['nofinish'])
$o .= t('Finishes:') . ' ' . '['
@ -481,7 +481,7 @@ function format_event_diaspora($ev) {
$ev['finish'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format )))
. '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n";
. '](' . z_root() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n";
if(strlen($ev['location']))
$o .= t('Location:') . bb2diaspora($ev['location'])

View file

@ -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) {
@ -850,7 +850,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
// crypt
if (strpos($Text,'[/crypt]') !== false) {
$x = random_string();
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism",'<br /><div id="' . $x . '"><img src="' .$a->get_baseurl() . '/images/lock_icon.gif" onclick="red_decrypt(\'rot13\',\'\',\'$1\',\'#' . $x . '\');" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br /></div>', $Text);
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism",'<br /><div id="' . $x . '"><img src="' .z_root() . '/images/lock_icon.gif" onclick="red_decrypt(\'rot13\',\'\',\'$1\',\'#' . $x . '\');" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br /></div>', $Text);
$Text = preg_replace_callback("/\[crypt (.*?)\](.*?)\[\/crypt\]/ism", 'bb_parse_crypt', $Text);
}
@ -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);
// }

View file

@ -202,7 +202,7 @@ function chatroom_list($uid) {
require_once('include/security.php');
$sql_extra = permissions_sql($uid);
$r = q("select cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name, cr_id order by cr_name",
$r = q("select allow_cid, allow_gid, deny_cid, deny_gid, cr_name, cr_expire, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name, cr_id order by cr_name",
intval($uid)
);

View file

@ -9,17 +9,21 @@ function cli_startup() {
global $a, $db, $default_timezone;
if(is_null($a)) {
$a = new App;
$a = new miniApp;
}
App::init();
if(is_null($db)) {
@include(".htconfig.php");
$a->convert();
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 +34,7 @@ function cli_startup() {
load_config('system');
$a->set_baseurl(get_config('system','baseurl'));
App::set_baseurl(get_config('system','baseurl'));
load_hooks();

View file

@ -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;
}

View file

@ -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]
);
}
@ -287,27 +287,38 @@ function get_pconfig($uid, $family, $key, $instore = false) {
function set_pconfig($uid, $family, $key, $value) {
global $a;
// this catches subtle errors where this function has been called
// with local_channel() when not logged in (which returns false)
// and throws an error in array_key_exists below.
// we provide a function backtrace in the logs so that we can find
// and fix the calling function.
if($uid === false) {
btlogger('UID is FALSE!', LOGGER_NORMAL, LOG_ERR);
return;
}
// manage array value
$dbvalue = ((is_array($value)) ? serialize($value) : $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),
@ -332,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;
@ -349,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
@ -364,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),
@ -380,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
@ -392,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)
@ -403,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'];
}
}
}
@ -417,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.
*
@ -435,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]
);
}
@ -473,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),
@ -497,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;
@ -507,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
@ -522,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),

View file

@ -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)
@ -126,7 +126,7 @@ function common_friends_visitor_widget($profile_uid) {
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t),
'$base' => $a->get_baseurl(),
'$base' => z_root(),
'$uid' => $profile_uid,
'$cid' => $observer,
'$linkmore' => (($t > 5) ? 'true' : ''),

View file

@ -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']))
@ -844,12 +844,12 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$o .= replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl($ssl_state),
'$baseurl' => z_root(),
'$photo_item' => $content_html,
'$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 = $a->get_baseurl($ssl_state) . '/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'] : '');
}
@ -925,19 +925,19 @@ function item_photo_menu($item){
$profile_link = chanlink_hash($item['author_xchan']);
if($item['uid'] > 0)
$pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan'];
$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'];
if($contact) {
$poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $contact['abook_id'];
$poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
if (! intval($contact['abook_self']))
$contact_url = $a->get_baseurl($ssl_state) . '/connedit/' . $contact['abook_id'];
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $contact['abook_id'];
$contact_url = z_root() . '/connedit/' . $contact['abook_id'];
$posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
$clean_url = normalise_link($item['author-link']);
}
@ -1159,9 +1159,9 @@ 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' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''),
'$geotag' => $geotag,
@ -1202,8 +1202,8 @@ 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),
'$action' => $a->get_baseurl(true) . '/item',
'$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,
'$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link name')),
@ -1246,7 +1246,7 @@ function status_editor($a, $x, $popup = false) {
'$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
'$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
'$post_id' => '',
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
'$public' => t('Public post'),
@ -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 = '';
@ -1617,8 +1617,8 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if (x($_GET, 'tab'))
$tab = notags(trim($_GET['tab']));
$url = $a->get_baseurl() . '/channel/' . $nickname;
$pr = $a->get_baseurl() . '/profile/' . $nickname;
$url = z_root() . '/channel/' . $nickname;
$pr = z_root() . '/profile/' . $nickname;
$tabs = array(
array(
@ -1644,14 +1644,14 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if ($p['view_storage']) {
$tabs[] = array(
'label' => t('Photos'),
'url' => $a->get_baseurl() . '/photos/' . $nickname,
'url' => z_root() . '/photos/' . $nickname,
'sel' => ((argv(0) == 'photos') ? 'active' : ''),
'title' => t('Photo Albums'),
'id' => 'photo-tab',
);
$tabs[] = array(
'label' => t('Files'),
'url' => $a->get_baseurl() . '/cloud/' . $nickname,
'url' => z_root() . '/cloud/' . $nickname,
'sel' => ((argv(0) == 'cloud' || argv(0) == 'sharedwithme') ? 'active' : ''),
'title' => t('Files and Storage'),
'id' => 'files-tab',
@ -1661,7 +1661,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if($p['view_stream'] && $cal_link) {
$tabs[] = array(
'label' => t('Events'),
'url' => $a->get_baseurl() . $cal_link,
'url' => z_root() . $cal_link,
'sel' => ((argv(0) == 'cal' || argv(0) == 'events') ? 'active' : ''),
'title' => t('Events'),
'id' => 'event-tab',
@ -1675,7 +1675,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if ($has_chats) {
$tabs[] = array(
'label' => t('Chatrooms'),
'url' => $a->get_baseurl() . '/chat/' . $nickname,
'url' => z_root() . '/chat/' . $nickname,
'sel' => ((argv(0) == 'chat') ? 'active' : '' ),
'title' => t('Chatrooms'),
'id' => 'chat-tab',
@ -1688,7 +1688,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if ($is_owner && $has_bookmarks) {
$tabs[] = array(
'label' => t('Bookmarks'),
'url' => $a->get_baseurl() . '/bookmarks',
'url' => z_root() . '/bookmarks',
'sel' => ((argv(0) == 'bookmarks') ? 'active' : ''),
'title' => t('Saved Bookmarks'),
'id' => 'bookmarks-tab',
@ -1698,7 +1698,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
if ($p['write_pages'] && feature_enabled($uid,'webpages')) {
$tabs[] = array(
'label' => t('Webpages'),
'url' => $a->get_baseurl() . '/webpages/' . $nickname,
'url' => z_root() . '/webpages/' . $nickname,
'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
'title' => t('Manage Webpages'),
'id' => 'webpages-tab',

View file

@ -25,16 +25,7 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
if(! $verify) {
while($msg = openssl_error_string())
logger('openssl_verify: ' . $msg,LOGGER_NORMAL,LOG_ERR);
logger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
// provide a backtrace so that we can debug key issues
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if($stack) {
foreach($stack as $s) {
logger('stack: ' . basename($s['file']) . ':' . $s['line'] . ':' . $s['function'] . '()',LOGGER_DEBUG,LOG_ERR);
}
}
}
btlogger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
}
return $verify;

View file

@ -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') .'"'
)));

View file

@ -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));
}

View file

@ -56,13 +56,13 @@ function notification($params) {
$banner = t('$Projectname Notification');
$product = t('$projectname'); // PLATFORM_NAME;
$siteurl = $a->get_baseurl(true);
$siteurl = z_root();
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');
$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,':'));
@ -419,12 +419,12 @@ function notification($params) {
return;
}
$itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
$itemlink = z_root() . '/notify/view/' . $notify_id;
$msg = str_replace('$itemlink',$itemlink,$epreamble);
// 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);

View file

@ -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)

View file

@ -174,7 +174,6 @@ function channel_total() {
*/
function create_identity($arr) {
$a = get_app();
$ret = array('success' => false);
if(! $arr['account_id']) {
@ -275,7 +274,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 +301,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')
@ -321,10 +320,10 @@ function create_identity($arr) {
dbesc($guid),
dbesc($sig),
dbesc($key['pubkey']),
dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"),
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"),
dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"),
dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()),
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'] . '@' . 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']),
@ -347,8 +346,8 @@ function create_identity($arr) {
1,
$publish,
dbesc($ret['channel']['channel_name']),
dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"),
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}")
dbesc(z_root() . "/photo/profile/l/{$newuid}"),
dbesc(z_root() . "/photo/profile/m/{$newuid}")
);
if($role_permissions) {
@ -780,14 +779,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 +825,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 +884,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'];
}
/*
@ -914,7 +913,6 @@ function profile_load(&$a, $nickname, $profile = '') {
function profile_edit_menu($uid) {
$a = get_app();
$ret = array();
$is_owner = (($uid == local_channel()) ? true : false);
@ -929,11 +927,11 @@ function profile_edit_menu($uid) {
$multi_profiles = feature_enabled(local_channel(), 'multi_profiles');
if($multi_profiles) {
$ret['multi'] = 1;
$ret['edit'] = array($a->get_baseurl(). '/profiles', t('Edit Profiles'), '', t('Edit'));
$ret['edit'] = array(z_root(). '/profiles', t('Edit Profiles'), '', t('Edit'));
$ret['menu']['cr_new'] = t('Create New Profile');
}
else {
$ret['edit'] = array($a->get_baseurl() . '/profiles/' . $uid, t('Edit Profile'), '', t('Edit'));
$ret['edit'] = array(z_root() . '/profiles/' . $uid, t('Edit Profile'), '', t('Edit'));
}
$r = q("SELECT * FROM profile WHERE uid = %d",
@ -976,9 +974,7 @@ function profile_edit_menu($uid) {
*/
function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = false) {
$a = get_app();
$observer = $a->get_observer();
$observer = App::get_observer();
$o = '';
$location = false;
@ -1010,7 +1006,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
@ -1112,7 +1108,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
*/
function get_birthdays() {
$a = get_app();
$o = '';
if(! local_channel())
@ -1159,12 +1154,12 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$url = $rr['url'];
if($rr['network'] === NETWORK_DFRN) {
$sparkle = " sparkle";
$url = $a->get_baseurl() . '/redir/' . $rr['cid'];
$url = z_root() . '/redir/' . $rr['cid'];
}
$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;
}
@ -1172,7 +1167,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
}
$tpl = get_markup_template("birthdays_reminder.tpl");
return replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$baseurl' => z_root(),
'$classtoday' => $classtoday,
'$count' => $total,
'$event_reminders' => t('Birthday Reminders'),
@ -1191,8 +1186,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
require_once('include/bbcode.php');
$a = get_app();
if(! local_channel())
return $o;
@ -1214,15 +1207,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 +1224,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;
}
@ -1244,7 +1237,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa
$tpl = get_markup_template("events_reminder.tpl");
return replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$baseurl' => z_root(),
'$classtoday' => $classtoday,
'$count' => count($r),
'$event_reminders' => t('Event Reminders'),
@ -1256,15 +1249,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 +1276,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 +1300,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 +1390,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 +1433,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 +1443,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 +1624,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 +1642,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 +1848,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",

View file

@ -636,6 +636,7 @@ function sync_events($channel,$events) {
function import_menus($channel,$menus) {
if($channel && $menus) {
foreach($menus as $menu) {
$m = array();
@ -681,6 +682,8 @@ function import_menus($channel,$menus) {
}
}
}
}

View file

@ -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;
@ -2966,7 +2966,7 @@ function send_status_notifications($post_id,$item) {
if($unfollowed)
return;
$link = get_app()->get_baseurl() . '/display/' . $item['mid'];
$link = z_root() . '/display/' . $item['mid'];
$y = q("select id from notify where link = '%s' and uid = %d limit 1",
dbesc($link),
@ -3848,8 +3848,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray = get_atom_elements($feed,$item,$author);
if($contact['xchan_network'] === 'rss') {
$res['public_policy'] = 'specific';
$res['comment_policy'] = 'none';
$datarray['public_policy'] = 'specific';
$datarray['comment_policy'] = 'none';
}
if((! x($author,'author_name')) || ($author['author_is_feed']))
@ -3911,8 +3911,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray = get_atom_elements($feed,$item,$author);
if($contact['xchan_network'] === 'rss') {
$res['public_policy'] = 'specific';
$res['comment_policy'] = 'none';
$datarray['public_policy'] = 'specific';
$datarray['comment_policy'] = 'none';
}
@ -3932,6 +3932,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray['author_xchan'] = '';
if(activity_match($datarray['verb'],ACTIVITY_FOLLOW) && $datarray['obj_type'] === ACTIVITY_OBJ_PERSON) {
$cb = array('item' => $datarray,'channel' => $importer, 'xchan' => null, 'author' => $author, 'caught' => false);
call_hooks('follow_from_feed',$cb);
if($cb['caught']) {
if($cb['return_code'])
http_status_exit($cb['return_code']);
continue;
}
}
if($author['author_link'] != $contact['xchan_url']) {
$x = import_author_unknown(array('name' => $author['author_name'],'url' => $author['author_link'],'photo' => array('src' => $author['author_photo'])));
if($x)
@ -4284,10 +4294,9 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
}
function fix_private_photos($s, $uid, $item = null, $cid = 0) {
$a = get_app();
logger('fix_private_photos', LOGGER_DEBUG);
$site = substr($a->get_baseurl(),strpos($a->get_baseurl(),'://'));
$site = substr(z_root(),strpos(z_root(),'://'));
$orig_body = $s;
$new_body = '';
@ -4567,8 +4576,6 @@ function drop_items($items) {
function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = false) {
$a = get_app();
// locate item to be deleted
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
@ -4579,7 +4586,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
if(! $interactive)
return 0;
notice( t('Item not found.') . EOL);
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
goaway(z_root() . '/' . $_SESSION['return_url']);
}
$item = $r[0];
@ -4602,7 +4609,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;
@ -4652,13 +4659,13 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
if((intval($item['item_wall']) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1))
proc_run('php','include/notifier.php','drop',$notify_id);
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
goaway(z_root() . '/' . $_SESSION['return_url']);
}
else {
if(! $interactive)
return 0;
notice( t('Permission denied.') . EOL);
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
goaway(z_root() . '/' . $_SESSION['return_url']);
}
}
@ -5067,8 +5074,6 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$result = array('success' => false);
$a = get_app();
$sql_extra = '';
$sql_nets = '';
$sql_options = '';
@ -5191,8 +5196,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']))
@ -5462,7 +5467,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;

View file

@ -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';

View file

@ -35,11 +35,11 @@ function menu_element($menu) {
$arr['edited'] = $menu['menu']['menu_edited'];
$arr['baseurl'] = z_root();
if($menu['menu_flags']) {
if($menu['menu']['menu_flags']) {
$arr['flags'] = array();
if($menu['menu_flags'] & MENU_BOOKMARK)
if($menu['menu']['menu_flags'] & MENU_BOOKMARK)
$arr['flags'][] = 'bookmark';
if($menu['menu_flags'] & MENU_SYSTEM)
if($menu['menu']['menu_flags'] & MENU_SYSTEM)
$arr['flags'][] = 'system';
}
if($menu['items']) {
@ -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);

View file

@ -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));
@ -169,7 +169,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$r = attach_by_hash_nodata($hash,$rev);
if($r['success']) {
$attachments[] = array(
'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
'href' => z_root() . '/attach/' . $r['data']['hash'],
'length' => $r['data']['filesize'],
'type' => $r['data']['filetype'],
'title' => urlencode($r['data']['filename']),
@ -225,7 +225,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if(count($images)) {
foreach($images as $image) {
if(! stristr($image,$a->get_baseurl() . '/photo/'))
if(! stristr($image,z_root() . '/photo/'))
continue;
$image_uri = substr($image,strrpos($image,'/') + 1);
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));

View file

@ -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,8 +55,8 @@ EOT;
if($banner === false)
$banner = get_config('system','sitename');
$a->page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
'$baseurl' => $a->get_baseurl(),
App::$page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
'$baseurl' => z_root(),
'$sitelocation' => $sitelocation,
'$banner' => $banner
));
@ -92,10 +92,8 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
require_once('include/chat.php');
$has_chats = chatroom_list_count(local_channel());
if(! UNO)
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'] . (($has_chats) ? '' : '/new'), t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
require_once('include/menu.php');
@ -138,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')) {
require_once('mod/help.php');
@ -242,25 +240,25 @@ EOT;
// turned off until somebody discovers this and figures out a good location for it.
$powered_by = '';
// $powered_by = '<strong>red<img class="smiley" src="' . $a->get_baseurl() . '/images/rm-16.png" alt="r#" />matrix</strong>';
// $powered_by = '<strong>red<img class="smiley" src="' . z_root() . '/images/rm-16.png" alt="r#" />matrix</strong>';
$tpl = get_markup_template('nav.tpl');
$a->page['nav'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
App::$page['nav'] .= replace_macros($tpl, array(
'$baseurl' => z_root(),
'$sitelocation' => $sitelocation,
'$nav' => $x['nav'],
'$banner' => $banner,
'$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']);
}
/*
@ -269,7 +267,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,
@ -283,5 +281,5 @@ function nav_set_selected($item){
'manage' => null,
'register' => null,
);
$a->nav_sel[$item] = 'active';
App::$nav_sel[$item] = 'active';
}

View file

@ -602,7 +602,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
continue;
}
$hostname = str_replace('www.','',substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3));
$hostname = str_replace('www.','',substr(z_root(),strpos(z_root(),'://')+3));
if(stristr($mtch[3],$hostname))
continue;
@ -1144,21 +1144,23 @@ function discover_by_webbie($webbie) {
$avatar = '';
$pubkey = '';
if(array_key_exists('address',$x))
$address = $x['address'];
if(array_key_exists('location',$x))
$location = $x['location'];
if(array_key_exists('nickname',$x))
$nickname = $x['nickname'];
if(is_array($x)) {
if(array_key_exists('address',$x))
$address = $x['address'];
if(array_key_exists('location',$x))
$location = $x['location'];
if(array_key_exists('nickname',$x))
$nickname = $x['nickname'];
}
if(! $x)
$probe_old = true;
if($probe_old) {
$x = old_webfinger($webbie);
if($x) {
$y = old_webfinger($webbie);
if($y) {
logger('old_webfinger: ' . print_r($x,true));
foreach($x as $link) {
foreach($y as $link) {
if($link['@attributes']['rel'] === NAMESPACE_DFRN)
$dfrn = unamp($link['@attributes']['href']);
if($link['@attributes']['rel'] === 'salmon')
@ -1854,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;
@ -1928,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']);
}
}
}
@ -1947,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)
@ -1987,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);

View file

@ -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;

View file

@ -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);
}
@ -195,7 +195,7 @@ function oembed_format_object($j){
}
$ret.=replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$baseurl' => z_root(),
'$embedurl'=>$embedurl,
'$escapedhtml'=>base64_encode($jhtml),
'$tw'=>$tw,

View file

@ -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);

View file

@ -679,9 +679,9 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
if($r === false)
$photo_failure = true;
$photo = $a->get_baseurl() . '/photo/' . $hash . '-4';
$thumb = $a->get_baseurl() . '/photo/' . $hash . '-5';
$micro = $a->get_baseurl() . '/photo/' . $hash . '-6';
$photo = z_root() . '/photo/' . $hash . '-4';
$thumb = z_root() . '/photo/' . $hash . '-5';
$micro = z_root() . '/photo/' . $hash . '-6';
}
else {
logger('import_xchan_photo: invalid image from ' . $photo);
@ -689,9 +689,9 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
}
}
if($photo_failure) {
$photo = $a->get_baseurl() . '/' . get_default_profile_photo();
$thumb = $a->get_baseurl() . '/' . get_default_profile_photo(80);
$micro = $a->get_baseurl() . '/' . get_default_profile_photo(48);
$photo = z_root() . '/' . get_default_profile_photo();
$thumb = z_root() . '/' . get_default_profile_photo(80);
$micro = z_root() . '/' . get_default_profile_photo(48);
$type = 'image/png';
}

View file

@ -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);
}

View file

@ -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;
}
}
@ -495,10 +495,10 @@ function get_theme_screenshot($theme) {
$exts = array('.png', '.jpg');
foreach($exts as $ext) {
if(file_exists('view/theme/' . $theme . '/img/screenshot' . $ext))
return($a->get_baseurl() . '/view/theme/' . $theme . '/img/screenshot' . $ext);
return(z_root() . '/view/theme/' . $theme . '/img/screenshot' . $ext);
}
return($a->get_baseurl() . '/images/blank.png');
return(z_root() . '/images/blank.png');
}
/**
@ -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;
}

View file

@ -14,21 +14,19 @@
*/
function authenticate_success($user_record, $login_initial = false, $interactive = false, $return = false, $update_lastlog = false) {
$a = get_app();
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
$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 +38,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 +57,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
@ -68,14 +66,14 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$return_url = '';
unset($_SESSION['login_return_url']);
goaway($a->get_baseurl() . '/' . $return_url);
goaway(z_root() . '/' . $return_url);
}
/* 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 +114,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']);
@ -127,10 +125,10 @@ function change_channel($change_channel) {
);
if($x) {
$_SESSION['my_url'] = $x[0]['xchan_url'];
$_SESSION['my_address'] = $r[0]['channel_address'] . '@' . substr(get_app()->get_baseurl(), strpos(get_app()->get_baseurl(), '://') + 3);
$_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 +291,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 +318,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
@ -360,10 +358,9 @@ function public_permissions_sql($observer_hash) {
* so this mechanism brings in some damage control (the attacker would be able to forge a request to a form of this type, but not to forms of other types).
*/
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::$observer['xchan_guid'] . ((local_channel()) ? App::$channel['channel_prvkey'] : '') . session_id() . $timestamp . $typename);
return $timestamp . '.' . $sec_hash;
}
@ -374,12 +371,10 @@ function check_form_security_token($typename = '', $formname = 'form_security_to
$max_livetime = 10800; // 3 hours
$a = get_app();
$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::$observer['xchan_guid'] . ((local_channel()) ? App::$channel['channel_prvkey'] : '') . session_id() . $x[0] . $typename);
return ($sec_hash == $x[1]);
}
@ -389,17 +384,15 @@ 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::$observer['xchan_name'] . ' - 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($a->get_baseurl() . $err_redirect );
goaway(z_root() . $err_redirect );
}
}
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::$observer['xchan_name'] . ' - form element ' . $typename);
logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
header('HTTP/1.1 403 Forbidden');
killme();

View file

@ -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));
}

View file

@ -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

View file

@ -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)));

View file

@ -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">';

View file

@ -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'];
$url = $a->get_baseurl() . '/' . $stripped;
$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'];
$url = $a->get_baseurl() . '/' . $stripped;
//$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');
@ -569,6 +569,25 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
}
// like logger() but with a function backtrace to pinpoint certain classes
// of problems which show up deep in the calling stack
function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
logger($msg, $level, $priority);
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if($stack) {
for($x = 1; $x < count($stack); $x ++) {
logger('stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()',$level, $priority);
}
}
}
}
function log_priority_str($priority) {
$parr = array(
LOG_EMERG => 'LOG_EMERG',
@ -606,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');
@ -766,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 ";
@ -789,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']);
@ -807,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)
);
@ -824,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,
));
@ -881,7 +900,7 @@ function search($s,$id='search-box',$url='/search',$save = false) {
return replace_macros(get_markup_template('searchbox.tpl'),array(
'$s' => $s,
'$id' => $id,
'$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url,
'$action_url' => z_root() . $url,
'$search_label' => t('Search'),
'$save_label' => t('Save'),
'$savedsearch' => feature_enabled(local_channel(),'savedsearch')
@ -1062,41 +1081,41 @@ function list_smilies() {
);
$icons = array(
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;/3" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-cool.gif" alt="8-)" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />',
'<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . $a->get_baseurl() . '/images/rm-32.png" alt="' . urlencode('red#matrix') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . $a->get_baseurl() . '/images/rm-32.png" alt="' . urlencode('red#') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . $a->get_baseurl() . '/images/rm-32.png" alt="r#" />matrix</strong></a>'
'<img class="smiley" src="' . z_root() . '/images/smiley-heart.gif" alt="&lt;3" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-brokenheart.gif" alt="&lt;/3" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-smile.gif" alt=":-)" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-wink.gif" alt=";-)" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-frown.gif" alt=":-(" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-tongue-out.gif" alt=":-P" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-tongue-out.gif" alt=":-p" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-kiss.gif" alt=":-\"" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-kiss.gif" alt=":-\"" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-kiss.gif" alt=":-x" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-kiss.gif" alt=":-X" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-laughing.gif" alt=":-D" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-surprised.gif" alt="8-|" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-surprised.gif" alt="8-O" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-surprised.gif" alt=":-O" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-Oo.gif" alt="o.O" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-Oo.gif" alt="O.o" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-Oo.gif" alt="o_O" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-Oo.gif" alt="O_o" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-cry.gif" alt=":\'(" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-undecided.gif" alt=":-/" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-embarassed.gif" alt=":-[" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-cool.gif" alt="8-)" />',
'<img class="smiley" src="' . z_root() . '/images/beer_mug.gif" alt=":beer" />',
'<img class="smiley" src="' . z_root() . '/images/beer_mug.gif" alt=":homebrew" />',
'<img class="smiley" src="' . z_root() . '/images/coffee.gif" alt=":coffee" />',
'<img class="smiley" src="' . z_root() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img class="smiley" src="' . z_root() . '/images/like.gif" alt=":like" />',
'<img class="smiley" src="' . z_root() . '/images/dislike.gif" alt=":dislike" />',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#matrix') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="' . urlencode('red#') . '" />matrix</strong></a>',
'<a href="http://getzot.com"><strong>red<img class="smiley bb_rm-logo" src="' . z_root() . '/images/rm-32.png" alt="r#" />matrix</strong></a>'
);
@ -1173,7 +1192,7 @@ function preg_heart($x) {
$t = '';
for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
$t .= '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="&lt;3" />';
$t .= '<img class="smiley" src="' . z_root() . '/images/smiley-heart.gif" alt="&lt;3" />';
$r = str_replace($x[0],$t,$x[0]);
@ -1701,12 +1720,12 @@ function feed_hublinks() {
function feed_salmonlinks($nick) {
$a = get_app();
$salmon = '<link rel="salmon" href="' . xmlify($a->get_baseurl() . '/salmon/' . $nick) . '" />' . "\n" ;
$salmon = '<link rel="salmon" href="' . xmlify(z_root() . '/salmon/' . $nick) . '" />' . "\n" ;
// old style links that status.net still needed as of 12/2010
$salmon .= ' <link rel="http://salmon-protocol.org/ns/salmon-replies" href="' . xmlify($a->get_baseurl() . '/salmon/' . $nick) . '" />' . "\n" ;
$salmon .= ' <link rel="http://salmon-protocol.org/ns/salmon-mention" href="' . xmlify($a->get_baseurl() . '/salmon/' . $nick) . '" />' . "\n" ;
$salmon .= ' <link rel="http://salmon-protocol.org/ns/salmon-replies" href="' . xmlify(z_root() . '/salmon/' . $nick) . '" />' . "\n" ;
$salmon .= ' <link rel="http://salmon-protocol.org/ns/salmon-mention" href="' . xmlify(z_root() . '/salmon/' . $nick) . '" />' . "\n" ;
return $salmon;
}
@ -1768,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 {
@ -1819,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)";
}
}
@ -2241,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;
@ -2354,8 +2373,8 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
$url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
$newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
$url = z_root() . '/search?tag=' . rawurlencode($basetag);
$newtag = '#[zrl=' . z_root() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
//replace tag by the link. Make sure to not replace something in the middle of a word
// The '=' is needed to not replace color codes if the code is also used as a tag
// Much better would be to somehow completely avoiding things in e.g. [color]-tags.
@ -2501,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'];
@ -2531,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);
@ -2589,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;
}

View file

@ -11,15 +11,15 @@ require_once('include/attach.php');
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));
}
@ -33,8 +33,8 @@ 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:
@ -164,8 +164,7 @@ function widget_follow($args) {
if(! local_channel())
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)
);
@ -210,8 +209,6 @@ function widget_savedsearch($arr) {
if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
return '';
$a = get_app();
$search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $search) {
@ -238,7 +235,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);
@ -295,7 +292,6 @@ function widget_filer($arr) {
if(! local_channel())
return '';
$a = get_app();
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
@ -316,20 +312,19 @@ function widget_filer($arr) {
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
'$base' => z_root() . '/' . $a->cmd
'$base' => z_root() . '/' . App::$cmd
));
}
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 +340,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);
@ -370,34 +365,34 @@ 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);
@ -406,31 +401,31 @@ 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 '';
}
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');
}
@ -486,8 +481,8 @@ function widget_settings_menu($arr) {
if(! local_channel())
return;
$a = get_app();
$channel = $a->get_channel();
$channel = App::get_channel();
$abook_self_id = 0;
@ -501,16 +496,22 @@ function widget_settings_menu($arr) {
if($abk)
$abook_self_id = $abk[0]['abook_id'];
$hublocs = q("select count(*) as total from hubloc where hubloc_hash = '%s'",
dbesc($channel['channel_hash'])
);
$hublocs = (($hublocs[0]['total'] > 1) ? true : false);
$tabs = array(
array(
'label' => t('Account settings'),
'url' => $a->get_baseurl(true).'/settings/account',
'url' => z_root().'/settings/account',
'selected' => ((argv(1) === 'account') ? 'active' : ''),
),
array(
'label' => t('Channel settings'),
'url' => $a->get_baseurl(true).'/settings/channel',
'url' => z_root().'/settings/channel',
'selected' => ((argv(1) === 'channel') ? 'active' : ''),
),
@ -519,42 +520,50 @@ function widget_settings_menu($arr) {
if(get_features()) {
$tabs[] = array(
'label' => t('Additional features'),
'url' => $a->get_baseurl(true).'/settings/features',
'url' => z_root().'/settings/features',
'selected' => ((argv(1) === 'features') ? 'active' : ''),
);
}
$tabs[] = array(
'label' => t('Feature/Addon settings'),
'url' => $a->get_baseurl(true).'/settings/featured',
'url' => z_root().'/settings/featured',
'selected' => ((argv(1) === 'featured') ? 'active' : ''),
);
$tabs[] = array(
'label' => t('Display settings'),
'url' => $a->get_baseurl(true).'/settings/display',
'url' => z_root().'/settings/display',
'selected' => ((argv(1) === 'display') ? 'active' : ''),
);
$tabs[] = array(
'label' => t('Connected apps'),
'url' => $a->get_baseurl(true) . '/settings/oauth',
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
if($hublocs) {
$tabs[] = array(
'label' => t('Manage locations'),
'url' => z_root() . '/locs',
'selected' => ((argv(1) === 'locs') ? 'active' : ''),
);
}
// IF can go away when UNO export and import is fully functional
if(! UNO) {
$tabs[] = array(
'label' => t('Export channel'),
'url' => $a->get_baseurl(true) . '/uexport',
'url' => z_root() . '/uexport',
'selected' => ''
);
}
$tabs[] = array(
'label' => t('Connected apps'),
'url' => z_root() . '/settings/oauth',
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
'url' => $a->get_baseurl(true) . '/connedit/' . $abook_self_id,
'url' => z_root() . '/connedit/' . $abook_self_id,
'selected' => ''
);
}
@ -562,7 +571,7 @@ function widget_settings_menu($arr) {
if(feature_enabled(local_channel(),'premium_channel')) {
$tabs[] = array(
'label' => t('Premium Channel Settings'),
'url' => $a->get_baseurl(true) . '/connect/' . $channel['channel_address'],
'url' => z_root() . '/connect/' . $channel['channel_address'],
'selected' => ''
);
}
@ -570,7 +579,7 @@ function widget_settings_menu($arr) {
if(feature_enabled(local_channel(),'channel_sources')) {
$tabs[] = array(
'label' => t('Channel Sources'),
'url' => $a->get_baseurl(true) . '/sources',
'url' => z_root() . '/sources',
'selected' => ''
);
}
@ -588,28 +597,27 @@ function widget_mailmenu($arr) {
if (! local_channel())
return;
$a = get_app();
return replace_macros(get_markup_template('message_side.tpl'), array(
'$title' => t('Private Mail Menu'),
'$combined'=>array(
'label' => t('Combined View'),
'url' => $a->get_baseurl(true) . '/mail/combined',
'url' => z_root() . '/mail/combined',
'sel' => (argv(1) == 'combined'),
),
'$inbox'=>array(
'label' => t('Inbox'),
'url' => $a->get_baseurl(true) . '/mail/inbox',
'url' => z_root() . '/mail/inbox',
'sel' => (argv(1) == 'inbox'),
),
'$outbox'=>array(
'label' => t('Outbox'),
'url' => $a->get_baseurl(true) . '/mail/outbox',
'url' => z_root() . '/mail/outbox',
'sel' => (argv(1) == 'outbox'),
),
'$new'=>array(
'label' => t('New Message'),
'url' => $a->get_baseurl(true) . '/mail/new',
'url' => z_root() . '/mail/new',
'sel'=> (argv(1) == 'new'),
)
));
@ -620,8 +628,6 @@ function widget_conversations($arr) {
if (! local_channel())
return;
$a = get_app();
if(argc() > 1) {
switch(argv(1)) {
@ -646,7 +652,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);
@ -721,8 +727,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())
@ -738,22 +744,21 @@ 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());
}
@ -771,24 +776,35 @@ 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']);
return replace_macros(get_markup_template('chatroomlist.tpl'), array(
'$header' => t('Chat Rooms'),
'$baseurl' => z_root(),
'$nickname' => $a->profile['channel_address'],
'$items' => $r,
$r = chatroom_list(App::$profile['profile_uid']);
if($r) {
return replace_macros(get_markup_template('chatroomlist.tpl'), array(
'$header' => t('Chatrooms'),
'$baseurl' => z_root(),
'$nickname' => App::$profile['channel_address'],
'$items' => $r,
'$overview' => t('Overview')
));
}
}
function widget_chatroom_members() {
$o = replace_macros(get_markup_template('chatroom_members.tpl'), array(
'$header' => t('Chat Members')
));
return $o;
}
function widget_bookmarkedchats($arr) {
@ -835,7 +851,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 '';
@ -981,17 +997,15 @@ function widget_cover_photo($arr) {
require_once('include/identity.php');
$o = '';
$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 '';
@ -1047,13 +1061,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'])
@ -1097,7 +1111,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 '';
@ -1133,7 +1147,7 @@ function widget_random_block($arr) {
function widget_rating($arr) {
$a = get_app();
$poco_rating = get_config('system','poco_rating_enable');
if((! $poco_rating) && ($poco_rating !== false)) {
@ -1143,7 +1157,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;
@ -1152,7 +1166,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) {
@ -1166,7 +1180,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;
@ -1195,7 +1209,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>';
}
@ -1203,8 +1217,6 @@ function widget_pubsites($arr) {
function widget_forums($arr) {
$a = get_app();
if(! local_channel())
return '';
@ -1306,8 +1318,6 @@ function widget_admin($arr) {
return login(false);
}
$a = get_app();
$o = '';
// array( url, name, extra css classes )
@ -1336,7 +1346,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;
}
}
@ -1364,7 +1374,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);
@ -1423,7 +1433,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(
@ -1449,7 +1459,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

View file

@ -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')

View file

@ -16,7 +16,10 @@ if(file_exists('.htsite.php'))
include('.htsite.php');
// our global App object
$a = new App;
$a = new miniApp;
App::init();
/*
* Load the configuration file which contains our DB credentials.
@ -24,15 +27,17 @@ $a = new App;
* installation mode.
*/
$a->install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
App::$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
$a->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set($a->timezone);
$a->convert();
App::$timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set(App::$timezone);
/*
@ -41,8 +46,8 @@ date_default_timezone_set($a->timezone);
require_once('include/dba/dba_driver.php');
if(! $a->install) {
$db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, $a->install);
if(! App::$install) {
$db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, App::$install);
if(! $db->connected) {
system_unavailable();
}
@ -64,8 +69,8 @@ if(! $a->install) {
}
$a->language = get_best_language();
load_translation_table($a->language,$a->install);
App::$language = get_best_language();
load_translation_table(App::$language,App::$install);
/**
@ -93,19 +98,19 @@ if(array_key_exists('system_language',$_POST)) {
unset($_SESSION['language']);
}
if((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
$a->language = $_SESSION['language'];
load_translation_table($a->language);
App::$language = $_SESSION['language'];
load_translation_table(App::$language);
}
if((x($_GET,'zid')) && (! $a->install)) {
$a->query_string = strip_zids($a->query_string);
if((x($_GET,'zid')) && (! App::$install)) {
App::$query_string = strip_zids(App::$query_string);
if(! local_channel()) {
$_SESSION['my_address'] = $_GET['zid'];
zid_init($a);
}
}
if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login'))
if((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (App::$module === 'login'))
require('include/auth.php');
if(! x($_SESSION, 'sysmsg'))
@ -121,41 +126,41 @@ if(! x($_SESSION, 'sysmsg_info'))
*/
if($a->install) {
if(App::$install) {
/* Allow an exception for the view module so that pcss will be interpreted during installation */
if($a->module != 'view')
$a->module = 'setup';
if(App::$module != 'view')
App::$module = 'setup';
}
else
check_config($a);
nav_set_selected('nothing');
$arr = array('app_menu' => $a->get_apps());
$arr = array('app_menu' => App::get_apps());
call_hooks('app_menu', $arr);
$a->set_apps($arr['app_menu']);
App::set_apps($arr['app_menu']);
$Router = new Zotlabs\Web\Router($a);
/* initialise content region */
if(! x($a->page, 'content'))
$a->page['content'] = '';
if(! x(App::$page, 'content'))
App::$page['content'] = '';
if(! ($a->module === 'setup')) {
if(! (App::$module === 'setup')) {
/* set JS cookie */
if($_COOKIE['jsAvailable'] != 1) {
$a->page['content'] .= '<script>document.cookie="jsAvailable=1; path=/"; var jsMatch = /\&JS=1/; if (!jsMatch.exec(location.href)) { location.href = location.href + "&JS=1"; }</script>';
App::$page['content'] .= '<script>document.cookie="jsAvailable=1; path=/"; var jsMatch = /\&JS=1/; if (!jsMatch.exec(location.href)) { location.href = location.href + "&JS=1"; }</script>';
/* emulate JS cookie if cookies are not accepted */
if ($_GET['JS'] == 1) {
$_COOKIE['jsAvailable'] = 1;
}
}
call_hooks('page_content_top', $a->page['content']);
call_hooks('page_content_top', App::$page['content']);
}
$Router->Dispatch($a);
@ -166,11 +171,11 @@ $Router->Dispatch($a);
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
} elseif(local_channel()) {
$homebase = $a->get_baseurl() . '/channel/' . $a->channel['channel_address'];
$homebase = z_root() . '/channel/' . App::$channel['channel_address'];
}
if(isset($homebase)) {
$a->page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
// now that we've been through the module content, see if the page reported
@ -181,7 +186,7 @@ if(stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
}
call_hooks('page_end', $a->page['content']);
call_hooks('page_end', App::$page['content']);
construct_page($a);

View file

@ -220,11 +220,11 @@ You can generally find the location of PHP by executing "which php". If you
have troubles with this section please contact your hosting provider for
assistance. Hubzilla will not work correctly if you cannot perform this step.
You should also be sure that $a->config['system']['php_path'] is set correctly
You should also be sure that App::$config['system']['php_path'] is set correctly
in your .htconfig.php file, it should look like (changing it to the correct
PHP location):
$a->config['system']['php_path'] = '/usr/local/php55/bin/php';
App::$config['system']['php_path'] = '/usr/local/php55/bin/php';
#####################################################################
@ -353,7 +353,7 @@ are NOT called with -d suhosin.executor.func.blacklist=none.
So the simple solution is to put the correct parameters into .htconfig.php:
// Location of PHP command line processor
$a->config['system']['php_path'] = '/usr/bin/php -d suhosin.executor.func.blacklist=none
App::$config['system']['php_path'] = '/usr/bin/php -d suhosin.executor.func.blacklist=none
-d suhosin.executor.eval.blacklist=none';

View file

@ -41,9 +41,9 @@ $default_timezone = 'America/Los_Angeles';
// What is your site name? DO NOT ADD A TRAILING SLASH!
$a->config['system']['baseurl'] = 'https://myredsite.example';
$a->config['system']['sitename'] = "Hubzilla";
$a->config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';
App::$config['system']['baseurl'] = 'https://myredsite.example';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';
// These lines set additional security headers to be sent with all responses
@ -51,8 +51,8 @@ $a->config['system']['location_hash'] = 'if the auto install failed, put a uniqu
// this header. content_security_policy may need to be disabled if you wish to
// run the piwik analytics plugin or include other offsite resources on a page
$a->config['system']['transport_security_header'] = 1;
$a->config['system']['content_security_policy'] = 1;
App::$config['system']['transport_security_header'] = 1;
App::$config['system']['content_security_policy'] = 1;
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
@ -65,13 +65,13 @@ $a->config['system']['content_security_policy'] = 1;
// In order to perform system administration via the admin panel, admin_email
// must precisely match the email address of the person logged in.
$a->config['system']['register_policy'] = REGISTER_OPEN;
$a->config['system']['register_text'] = '';
$a->config['system']['admin_email'] = '';
App::$config['system']['register_policy'] = REGISTER_OPEN;
App::$config['system']['register_text'] = '';
App::$config['system']['admin_email'] = '';
// Location of PHP command line processor
$a->config['system']['php_path'] = 'php';
App::$config['system']['php_path'] = 'php';
// Configure how we communicate with directory servers.
@ -80,7 +80,7 @@ $a->config['system']['php_path'] = 'php';
// DIRECTORY_MODE_PRIMARY = main directory server (you do not want this unless you are operating your own realm. one per realm.)
// DIRECTORY_MODE_STANDALONE = "off the grid" or private directory services (only local site members in directory)
$a->config['system']['directory_mode'] = DIRECTORY_MODE_NORMAL;
App::$config['system']['directory_mode'] = DIRECTORY_MODE_NORMAL;
// PHP error logging setup

View file

@ -1,9 +1,25 @@
v2.5.0-beta (2015-11-15)
------------------------
v2.6.1 (2016-02-17)
-------------------
internal refactor of the "grid" system, providing increased flexbility for plugins like
[fullcalendar-scheduler](https://github.com/fullcalendar/fullcalendar-scheduler/releases)
- make nowIndicator positioning refresh on window resize
v2.6.0 (2016-01-07)
-------------------
- current time indicator (#414)
- bundled with most recent version of moment (2.11.0)
- UMD wrapper around lang files now handles commonjs (#2918)
- fix bug where external event dragging would not respect eventOverlap
- fix bug where external event dropping would not render the whole-day highlight
v2.5.0 (2015-11-30)
-------------------
- internal timezone refactor. fixes #2396, #2900, #2945, #2711
- internal "grid" system refactor. improved API for plugins.
v2.4.0 (2015-08-16)

View file

@ -1,5 +1,5 @@
/*!
* FullCalendar v2.5.0-beta Stylesheet
* FullCalendar v2.6.1 Stylesheet
* Docs & License: http://fullcalendar.io/
* (c) 2015 Adam Shaw
*/
@ -672,6 +672,15 @@ a.fc-more:hover {
padding: 10px;
}
/* Now Indicator
--------------------------------------------------------------------------------------------------*/
.fc-now-indicator {
position: absolute;
border: 0 solid red;
}
/* Toolbar
--------------------------------------------------------------------------------------------------*/
@ -888,27 +897,46 @@ a.fc-more:hover {
z-index: 2;
}
.fc-time-grid .fc-bgevent-skeleton,
.fc-time-grid .fc-content-col {
position: relative; /* because now-indicator lives directly inside */
}
.fc-time-grid .fc-content-skeleton {
position: absolute;
z-index: 3;
top: 0;
left: 0;
right: 0;
}
.fc-time-grid .fc-bgevent-skeleton {
/* divs within a cell within the fc-content-skeleton */
.fc-time-grid .fc-business-container {
position: relative;
z-index: 1;
}
.fc-time-grid .fc-bgevent-container {
position: relative;
z-index: 2;
}
.fc-time-grid .fc-highlight-container {
position: relative;
z-index: 3;
}
.fc-time-grid .fc-highlight-skeleton {
.fc-time-grid .fc-event-container {
position: relative;
z-index: 4;
}
.fc-time-grid .fc-content-skeleton {
.fc-time-grid .fc-now-indicator-line {
z-index: 5;
}
.fc-time-grid .fc-helper-skeleton {
.fc-time-grid .fc-helper-container { /* also is fc-event-container */
position: relative;
z-index: 6;
}
@ -948,11 +976,6 @@ a.fc-more:hover {
/* TimeGrid Event Containment
--------------------------------------------------------------------------------------------------*/
.fc-time-grid .fc-event-container, /* a div within a cell within the fc-content-skeleton */
.fc-time-grid .fc-bgevent-container { /* a div within a cell within the fc-bgevent-skeleton */
position: relative;
}
.fc-ltr .fc-time-grid .fc-event-container { /* space on the sides of events for LTR (default) */
margin: 0 2.5% 0 2px;
}
@ -1067,3 +1090,35 @@ be a descendant of the grid when it is being dragged.
.fc-time-grid-event .fc-resizer:after {
content: "=";
}
/* Now Indicator
--------------------------------------------------------------------------------------------------*/
.fc-time-grid .fc-now-indicator-line {
border-top-width: 1px;
left: 0;
right: 0;
}
/* arrow on axis */
.fc-time-grid .fc-now-indicator-arrow {
margin-top: -5px; /* vertically center on top coordinate */
}
.fc-ltr .fc-time-grid .fc-now-indicator-arrow {
left: 0;
/* triangle pointing right... */
border-width: 5px 0 5px 6px;
border-top-color: transparent;
border-bottom-color: transparent;
}
.fc-rtl .fc-time-grid .fc-now-indicator-arrow {
right: 0;
/* triangle pointing left... */
border-width: 5px 6px 5px 0;
border-top-color: transparent;
border-bottom-color: transparent;
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*!
* FullCalendar v2.5.0-beta Print Stylesheet
* FullCalendar v2.6.1 Print Stylesheet
* Docs & License: http://fullcalendar.io/
* (c) 2015 Adam Shaw
*/
@ -42,11 +42,17 @@ tbody,
background: #fff !important;
}
/* kill the overlaid, absolutely-positioned common components */
/* kill the overlaid, absolutely-positioned components */
/* common... */
.fc-bg,
.fc-bgevent-skeleton,
.fc-highlight-skeleton,
.fc-helper-skeleton {
.fc-helper-skeleton,
/* for timegrid. within cells within table skeletons... */
.fc-bgevent-container,
.fc-business-container,
.fc-highlight-container,
.fc-helper-container {
display: none;
}

View file

@ -1,5 +1,5 @@
/*!
* FullCalendar v2.5.0-beta Google Calendar Plugin
* FullCalendar v2.6.1 Google Calendar Plugin
* Docs & License: http://fullcalendar.io/
* (c) 2015 Adam Shaw
*/

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,61 @@
Changelog
=========
### 2.12.0 [See full changelog](https://gist.github.com/ichernev/6e5bfdf8d6522fc4ac73)
## Enhancements:
* [#2932](https://github.com/moment/moment/pull/2932) List loaded locales
* [#2818](https://github.com/moment/moment/pull/2818) Parse ISO-8061 duration containing both day and week values
* [#2774](https://github.com/moment/moment/pull/2774) Implement locale inheritance and locale updating
## Bugfixes:
* [#2970](https://github.com/moment/moment/pull/2970) change add subtract to handle decimal values by rounding
* [#2887](https://github.com/moment/moment/pull/2887) Fix toJSON casting of invalid moment
* [#2897](https://github.com/moment/moment/pull/2897) parse string arguments for month() correctly, closes #2884
* [#2946](https://github.com/moment/moment/pull/2946) Fix usage suggestions for min and max
## New locales:
* [#2917](https://github.com/moment/moment/pull/2917) Locale Punjabi(Gurmukhi) India format conversion
And more
### 2.11.2 (Fix ReDoS attack vector)
* [#2939](https://github.com/moment/moment/pull/2939) use full-string match to speed up aspnet regex match
### 2.11.1 [See full changelog](https://gist.github.com/ichernev/8ec3ee25b749b4cff3c2)
## Bugfixes:
* [#2881](https://github.com/moment/moment/pull/2881) Revert "Merge pull request #2746 from mbad0la:develop" Sep->Sept
* [#2868](https://github.com/moment/moment/pull/2868) Add format and parse token Y, so it actually works
* [#2865](https://github.com/moment/moment/pull/2865) Use typeof checks for undefined for global variables
* [#2858](https://github.com/moment/moment/pull/2858) Fix Date mocking regression introduced in 2.11.0
* [#2864](https://github.com/moment/moment/pull/2864) Include changelog in npm release
* [#2830](https://github.com/moment/moment/pull/2830) dep: add grunt-cli
* [#2869](https://github.com/moment/moment/pull/2869) Fix months parsing for some locales
### 2.11.0 [See full changelog](https://gist.github.com/ichernev/6594bc29719dde6b2f66)
* [#2624](https://github.com/moment/moment/pull/2624) Proper handling of invalid moments
* [#2634](https://github.com/moment/moment/pull/2634) Fix strict month parsing issue in cs,ru,sk
* [#2735](https://github.com/moment/moment/pull/2735) Reset the locale back to 'en' after defining all locales in min/locales.js
* [#2702](https://github.com/moment/moment/pull/2702) Week rework
* [#2746](https://github.com/moment/moment/pull/2746) Changed September Abbreviation to "Sept" in locale-specific english
files and default locale file
* [#2646](https://github.com/moment/moment/pull/2646) Fix [#2645](https://github.com/moment/moment/pull/2645) - invalid dates pre-1970
* [#2641](https://github.com/moment/moment/pull/2641) Implement basic format and comma as ms separator in ISO 8601
* [#2665](https://github.com/moment/moment/pull/2665) Implement stricter weekday parsing
* [#2700](https://github.com/moment/moment/pull/2700) Add [Hh]mm and [Hh]mmss formatting tokens, so you can parse 123 with
hmm for example
* [#2565](https://github.com/moment/moment/pull/2565) [#2835](https://github.com/moment/moment/pull/2835) Expose arguments used for moment creation with creationData
(fix [#2443](https://github.com/moment/moment/pull/2443))
* [#2648](https://github.com/moment/moment/pull/2648) fix issue [#2640](https://github.com/moment/moment/pull/2640): support instanceof operator
* [#2709](https://github.com/moment/moment/pull/2709) Add isSameOrAfter and isSameOrBefore comparison methods
* [#2721](https://github.com/moment/moment/pull/2721) Fix moment creation from object with strings values
* [#2740](https://github.com/moment/moment/pull/2740) Enable 'd hh:mm:ss.sss' format for durations
* [#2766](https://github.com/moment/moment/pull/2766) [#2833](https://github.com/moment/moment/pull/2833) Alternate Clock Source Support
### 2.10.6
[#2515](https://github.com/moment/moment/pull/2515) Fix regression introduced
@ -44,7 +99,7 @@ languages:
* [2097](https://github.com/moment/moment/issues/2097) add ar-tn locale
deprecations:
* [2074](https://github.com/moment/moment/issues/2074) Implement `moment.fn.utcOffset`, deprecate `momen.fn.zone`
* [2074](https://github.com/moment/moment/issues/2074) Implement `moment.fn.utcOffset`, deprecate `moment.fn.zone`
features:
* [2088](https://github.com/moment/moment/issues/2088) add moment.fn.isBetween
@ -271,7 +326,7 @@ Bugfix: Fixed parsing of first century dates
Bugfix: Parsing 10Sep2001 should work as expected
Bugfix: Fixed wierdness with `moment.utc()` parsing.
Bugfix: Fixed weirdness with `moment.utc()` parsing.
Changed language ordinal method to return the number + ordinal instead of just the ordinal.

View file

@ -1,4 +1,4 @@
Copyright (c) 2011-2015 Tim Wood, Iskren Chernev, Moment.js contributors
Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View file

@ -1,18 +1,18 @@
[![Join the chat at https://gitter.im/moment/moment](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/moment/moment?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url]
[![Coverage Status](https://coveralls.io/repos/moment/moment/badge.svg?branch=master)](https://coveralls.io/r/moment/moment?branch=master)
[![Coverage Status](https://coveralls.io/repos/moment/moment/badge.svg?branch=develop)](https://coveralls.io/r/moment/moment?branch=develop)
A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
## [Documentation](http://momentjs.com/docs/)
## Port to ES6 (version 2.10.0)
## Port to ECMAScript 6 (version 2.10.0)
Moment 2.10.0 does not bring any new features, but the code is now written in
es6 modules and placed inside `src/`. Previously `moment.js`, `locale/*.js` and
ECMAScript 6 modules and placed inside `src/`. Previously `moment.js`, `locale/*.js` and
`test/moment/*.js`, `test/locale/*.js` contained the source of the project. Now
the source is in `src/`, temporary build (es5) files are placed under
the source is in `src/`, temporary build (ECMAScript 5) files are placed under
`build/umd/` (for running tests during development), and the `moment.js` and
`locale/*.js` files are updated only on release.

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -25,36 +25,36 @@ function _well_known_init(&$a){
switch(argv(1)) {
case 'zot-info':
$a->argc -= 1;
array_shift($a->argv);
$a->argv[0] = 'zfinger';
App::$argc -= 1;
array_shift(App::$argv);
App::$argv[0] = 'zfinger';
require_once('mod/zfinger.php');
zfinger_init($a);
break;
case 'webfinger':
$a->argc -= 1;
array_shift($a->argv);
$a->argv[0] = 'wfinger';
App::$argc -= 1;
array_shift(App::$argv);
App::$argv[0] = 'wfinger';
require_once('mod/wfinger.php');
wfinger_init($a);
break;
case 'host-meta':
$a->argc -= 1;
array_shift($a->argv);
$a->argv[0] = 'hostxrd';
App::$argc -= 1;
array_shift(App::$argv);
App::$argv[0] = 'hostxrd';
require_once('mod/hostxrd.php');
hostxrd_init($a);
break;
default:
if(file_exists($a->cmd)) {
echo file_get_contents($a->cmd);
if(file_exists(App::$cmd)) {
echo file_get_contents(App::$cmd);
killme();
}
elseif(file_exists($a->cmd . '.php'))
require_once($a->cmd . '.php');
elseif(file_exists(App::$cmd . '.php'))
require_once(App::$cmd . '.php');
break;
}

View file

@ -23,7 +23,7 @@ function achievements_content(&$a) {
$owner = intval($r[0]['channel_id']);
}
$observer = $a->get_observer();
$observer = App::get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($owner,$ob_hash);
if(! $perms['view_profile']) {

View file

@ -40,7 +40,7 @@ function admin_post(&$a){
$func($a);
}
}
goaway($a->get_baseurl(true) . '/admin/plugins/' . argv(2) );
goaway(z_root() . '/admin/plugins/' . argv(2) );
break;
case 'themes':
$theme = argv(2);
@ -54,7 +54,7 @@ function admin_post(&$a){
info(t('Theme settings updated.'));
if(is_ajax()) return;
goaway($a->get_baseurl(true) . '/admin/themes/' . $theme );
goaway(z_root() . '/admin/themes/' . $theme );
break;
case 'logs':
admin_page_logs_post($a);
@ -77,7 +77,7 @@ function admin_post(&$a){
}
}
goaway($a->get_baseurl(true) . '/admin' );
goaway(z_root() . '/admin' );
}
/**
@ -196,7 +196,7 @@ function admin_page_summary(&$a) {
$queues = array( 'label' => t('Message queues'), 'queue' => $queue );
// If no plugins active return 0, otherwise list of plugin names
$plugins = (count($a->plugins) == 0) ? count($a->plugins) : $a->plugins;
$plugins = (count(App::$plugins) == 0) ? count(App::$plugins) : App::$plugins;
// Could be extended to provide also other alerts to the admin
$alertmsg = '';
@ -337,7 +337,7 @@ function admin_page_site_post(&$a){
set_config('system','curl_timeout', $timeout);
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl(true) . '/admin/site' );
goaway(z_root() . '/admin/site' );
}
/**
@ -460,7 +460,7 @@ function admin_page_site(&$a) {
'$corporate' => t('Policies'),
'$advanced' => t('Advanced'),
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
@ -514,7 +514,7 @@ function admin_page_hubloc_post(&$a){
$hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post';
//perform ping
$m = zot_build_packet($a->get_channel(),'ping');
$m = zot_build_packet(App::get_channel(),'ping');
$r = zot_zot($hublocurl,$m);
//handle results and set the hubloc flags in db to make results visible
$r2 = $r['body'];
@ -536,7 +536,7 @@ function admin_page_hubloc_post(&$a){
//after repair set hubloc flags to 0
}
goaway($a->get_baseurl(true) . '/admin/hubloc' );
goaway(z_root() . '/admin/hubloc' );
}
function trim_array_elems($arr) {
@ -659,7 +659,7 @@ function admin_page_hubloc(&$a) {
if(! $hubloc){
notice( t('No server found') . EOL);
goaway($a->get_baseurl(true) . '/admin/hubloc');
goaway(z_root() . '/admin/hubloc');
}
$t = get_markup_template('admin_hubloc.tpl');
@ -671,7 +671,7 @@ function admin_page_hubloc(&$a) {
'$queues' => $queues,
//'$accounts' => $accounts, /*$accounts is empty here*/
'$pending' => array( t('Pending registrations'), $pending),
'$plugins' => array( t('Active plugins'), $a->plugins ),
'$plugins' => array( t('Active plugins'), App::$plugins ),
'$form_security_token' => get_form_security_token('admin_hubloc')
));
}
@ -733,7 +733,7 @@ function admin_page_dbsync(&$a) {
if(intval(get_config('system','db_version')) <= intval(argv(3)))
set_config('system','db_version',intval(argv(3)) + 1);
info( t('Update has been marked successful') . EOL);
goaway($a->get_baseurl(true) . '/admin/dbsync');
goaway(z_root() . '/admin/dbsync');
}
if(argc() > 2 && intval(argv(2))) {
@ -771,7 +771,7 @@ function admin_page_dbsync(&$a) {
return '<div class="generic-content-wrapper-styled"><h3>' . t('No failed updates.') . '</h3></div>';
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
'$base' => $a->get_baseurl(true),
'$base' => z_root(),
'$banner' => t('Failed Updates'),
'$desc' => '',
'$mark' => t('Mark success (if update was manually applied)'),
@ -871,7 +871,7 @@ function admin_page_users_post($a) {
}
}
goaway($a->get_baseurl(true) . '/admin/users' );
goaway(z_root() . '/admin/users' );
}
/**
@ -893,7 +893,7 @@ function admin_page_users(&$a){
if (! $account) {
notice( t('Account not found') . EOL);
goaway($a->get_baseurl(true) . '/admin/users' );
goaway(z_root() . '/admin/users' );
}
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
@ -924,7 +924,7 @@ function admin_page_users(&$a){
break;
}
goaway($a->get_baseurl(true) . '/admin/users' );
goaway(z_root() . '/admin/users' );
}
/* get pending */
@ -936,8 +936,8 @@ function admin_page_users(&$a){
$total = q("SELECT count(*) as total FROM account");
if (count($total)) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
App::set_pager_total($total[0]['total']);
App::set_pager_itemspage(100);
}
@ -958,8 +958,8 @@ function admin_page_users(&$a){
"FROM account as ac where true $serviceclass $order limit %d offset %d ",
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
intval($a->pager['itemspage']),
intval($a->pager['start'])
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
// function _setup_users($e){
@ -1003,7 +1003,7 @@ function admin_page_users(&$a){
'$form_security_token' => get_form_security_token("admin_users"),
// values //
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$pending' => $pending,
'$users' => $users,
@ -1053,7 +1053,7 @@ function admin_page_channels_post(&$a) {
notice( sprintf( tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)) );
}
goaway($a->get_baseurl(true) . '/admin/channels' );
goaway(z_root() . '/admin/channels' );
}
/**
@ -1071,7 +1071,7 @@ function admin_page_channels(&$a){
if (! $channel) {
notice( t('Channel not found') . EOL);
goaway($a->get_baseurl(true) . '/admin/channels' );
goaway(z_root() . '/admin/channels' );
}
switch(argv(2)) {
@ -1110,22 +1110,22 @@ function admin_page_channels(&$a){
default:
break;
}
goaway($a->get_baseurl(true) . '/admin/channels' );
goaway(z_root() . '/admin/channels' );
}
/* get channels */
$total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0");
if($total) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
App::set_pager_total($total[0]['total']);
App::set_pager_itemspage(100);
}
$order = " order by channel_name asc ";
$channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ",
intval($a->pager['itemspage']),
intval($a->pager['start'])
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
if($channels) {
@ -1163,7 +1163,7 @@ function admin_page_channels(&$a){
'$form_security_token' => get_form_security_token("admin_channels"),
// values //
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$channels' => $channels,
));
$o .= paginate($a);
@ -1183,14 +1183,14 @@ function admin_page_plugins(&$a){
/*
* Single plugin
*/
if ($a->argc == 3){
$plugin = $a->argv[2];
if (App::$argc == 3){
$plugin = App::$argv[2];
if (!is_file("addon/$plugin/$plugin.php")){
notice( t("Item not found.") );
return '';
}
$enabled = in_array($plugin,$a->plugins);
$enabled = in_array($plugin,App::$plugins);
$info = get_plugin_info($plugin);
$x = check_plugin_versions($info);
@ -1198,11 +1198,11 @@ function admin_page_plugins(&$a){
if($enabled && ! $x) {
$enabled = false;
$idz = array_search($plugin, $a->plugins);
$idz = array_search($plugin, App::$plugins);
if ($idz !== false) {
unset($a->plugins[$idz]);
unset(App::$plugins[$idz]);
uninstall_plugin($plugin);
set_config("system","addon", implode(", ",$a->plugins));
set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@ -1211,23 +1211,23 @@ function admin_page_plugins(&$a){
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
// Toggle plugin status
$idx = array_search($plugin, $a->plugins);
$idx = array_search($plugin, App::$plugins);
if ($idx !== false){
unset($a->plugins[$idx]);
unset(App::$plugins[$idx]);
uninstall_plugin($plugin);
info( sprintf( t("Plugin %s disabled."), $plugin ) );
} else {
$a->plugins[] = $plugin;
App::$plugins[] = $plugin;
install_plugin($plugin);
info( sprintf( t("Plugin %s enabled."), $plugin ) );
}
set_config("system","addon", implode(", ",$a->plugins));
goaway($a->get_baseurl(true) . '/admin/plugins' );
set_config("system","addon", implode(", ",App::$plugins));
goaway(z_root() . '/admin/plugins' );
}
// display plugin details
require_once('library/markdown.php');
if (in_array($plugin, $a->plugins)){
if (in_array($plugin, App::$plugins)){
$status = 'on';
$action = t('Disable');
} else {
@ -1264,7 +1264,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$plugin' => $plugin,
'$status' => $status,
@ -1298,18 +1298,18 @@ function admin_page_plugins(&$a){
if (is_dir($file)){
list($tmp, $id) = array_map('trim', explode('/', $file));
$info = get_plugin_info($id);
$enabled = in_array($id,$a->plugins);
$enabled = in_array($id,App::$plugins);
$x = check_plugin_versions($info);
// disable plugins which are installed but incompatible versions
if($enabled && ! $x) {
$enabled = false;
$idz = array_search($id, $a->plugins);
$idz = array_search($id, App::$plugins);
if ($idz !== false) {
unset($a->plugins[$idz]);
unset(App::$plugins[$idz]);
uninstall_plugin($id);
set_config("system","addon", implode(", ",$a->plugins));
set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@ -1324,7 +1324,7 @@ function admin_page_plugins(&$a){
'$title' => t('Administration'),
'$page' => t('Plugins'),
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$function' => 'plugins',
'$plugins' => $plugins,
'$disabled' => t('Disabled - version incompatibility'),
@ -1428,8 +1428,8 @@ function admin_page_themes(&$a){
* Single theme
*/
if ($a->argc == 3){
$theme = $a->argv[2];
if (App::$argc == 3){
$theme = App::$argv[2];
if(! is_dir("view/theme/$theme")){
notice( t("Item not found.") );
return '';
@ -1448,7 +1448,7 @@ function admin_page_themes(&$a){
info( sprintf('Theme %s disabled.', $theme));
set_config('system', 'allowed_themes', $s);
goaway($a->get_baseurl(true) . '/admin/themes' );
goaway(z_root() . '/admin/themes' );
}
// display theme details
@ -1486,7 +1486,7 @@ function admin_page_themes(&$a){
'$page' => t('Themes'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$plugin' => $theme,
'$status' => $status,
@ -1519,7 +1519,7 @@ function admin_page_themes(&$a){
'$title' => t('Administration'),
'$page' => t('Themes'),
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$function' => 'themes',
'$plugins' => $xthemes,
'$experimental' => t('[Experimental]'),
@ -1548,7 +1548,7 @@ function admin_page_logs_post(&$a) {
}
info( t('Log settings updated.') );
goaway($a->get_baseurl(true) . '/admin/logs' );
goaway(z_root() . '/admin/logs' );
}
/**
@ -1606,7 +1606,7 @@ readable.");
'$submit' => t('Submit'),
'$clear' => t('Clear'),
'$data' => $data,
'$baseurl' => $a->get_baseurl(true),
'$baseurl' => z_root(),
'$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data...

View file

@ -27,7 +27,7 @@ function api_post(&$a) {
return;
}
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_channel()) {
if(count(App::$user) && x(App::$user,'uid') && App::$user['uid'] != local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
@ -35,13 +35,13 @@ function api_post(&$a) {
}
function api_content(&$a) {
if($a->cmd=='api/oauth/authorize'){
if(App::$cmd=='api/oauth/authorize'){
/*
* api/oauth/authorize interact with the user. return a standard page
*/
$a->page['template'] = "minimal";
App::$page['template'] = "minimal";
// get consumer/client from request token
try {

View file

@ -67,7 +67,7 @@ function appman_content(&$a) {
return;
}
$channel = $a->get_channel();
$channel = App::get_channel();
$app = null;
$embed = null;
if($_REQUEST['appid']) {

View file

@ -9,7 +9,7 @@ function apps_content(&$a) {
else
$mode = 'list';
$_SESSION['return_url'] = $a->cmd;
$_SESSION['return_url'] = App::$cmd;
$apps = array();

View file

@ -10,15 +10,15 @@ function block_init(&$a) {
$profile = 0;
profile_load($a,$which,$profile);
if($a->profile['profile_uid'])
head_set_icon($a->profile['thumb']);
if(App::$profile['profile_uid'])
head_set_icon(App::$profile['thumb']);
}
function block_content(&$a) {
if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_pages')) {
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_pages')) {
notice( t('Permission denied.') . EOL);
return;
}

View file

@ -9,7 +9,7 @@ function blocks_init(&$a) {
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
$a->is_sys = true;
App::$is_sys = true;
}
}
@ -25,24 +25,24 @@ function blocks_init(&$a) {
function blocks_content(&$a) {
if(! $a->profile) {
if(! App::$profile) {
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
App::$error = 404;
return;
}
$which = argv(1);
$_SESSION['return_url'] = $a->query_string;
$_SESSION['return_url'] = App::$query_string;
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = $a->get_observer();
$observer = App::get_observer();
$channel = $a->get_channel();
$channel = App::get_channel();
if($a->is_sys && is_site_admin()) {
if(App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
@ -86,7 +86,7 @@ function blocks_content(&$a) {
$x = array(
'webpage' => ITEM_TYPE_BLOCK,
'is_owner' => true,
'nickname' => $a->profile['channel_address'],
'nickname' => App::$profile['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'bang' => '',
'showacl' => false,

View file

@ -7,7 +7,7 @@ function bookmarks_init(&$a) {
if(! $item_id)
return;
$u = $a->get_channel();
$u = App::get_channel();
$item_normal = item_normal();
@ -53,7 +53,7 @@ function bookmarks_content(&$a) {
require_once('include/menu.php');
require_once('include/conversation.php');
$channel = $a->get_channel();
$channel = App::get_channel();
$o = profile_tabs($a,true,$channel['channel_address']);

View file

@ -13,7 +13,7 @@ function branchtopic_init(&$a) {
if(! $item_id)
return;
$channel = $a->get_channel();
$channel = App::get_channel();
if(! $channel)
return;

View file

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/datetime.php');
require_once('include/event.php');
require_once('include/items.php');
require_once('Contact.php');
require_once('include/Contact.php');
function cal_init(&$a) {
@ -25,16 +25,16 @@ function cal_init(&$a) {
if(! $channelx)
return;
$a->data['channel'] = $channelx;
App::$data['channel'] = $channelx;
$observer = $a->get_observer();
$a->data['observer'] = $observer;
$observer = App::get_observer();
App::$data['observer'] = $observer;
$observer_xchan = (($observer) ? $observer['xchan_hash'] : '');
head_set_icon($a->data['channel']['xchan_photo_s']);
head_set_icon(App::$data['channel']['xchan_photo_s']);
$a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . (($a->data['channel']) ? $a->data['channel']['channel_id'] : 0) . "; </script>" ;
App::$page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . ((App::$data['channel']) ? App::$data['channel']['channel_id'] : 0) . "; </script>" ;
}
@ -70,11 +70,11 @@ function cal_content(&$a) {
$first_day = (($first_day) ? $first_day : 0);
$htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => $a->get_baseurl(),
App::$page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => z_root(),
'$module_url' => '/cal/' . $channel['channel_address'],
'$modparams' => 2,
'$lang' => $a->language,
'$lang' => App::$language,
'$first_day' => $first_day
));
@ -87,7 +87,7 @@ function cal_content(&$a) {
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
// logger('args: ' . print_r($a->argv,true));
// logger('args: ' . print_r(App::$argv,true));
if(argc() > 3 && intval(argv(2)) && intval(argv(3))) {
$mode = 'view';
@ -243,7 +243,7 @@ function cal_content(&$a) {
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
if(! x($links,$j))
$links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
$links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j;
}
}
@ -321,11 +321,11 @@ function cal_content(&$a) {
$nick = $channel['channel_address'];
$o = replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$new_event' => array($a->get_baseurl().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
'$previus' => array($a->get_baseurl()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array($a->get_baseurl()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''),
'$export' => array($a->get_baseurl()."/cal/$nick/$y/$m/export",t('Export'),'',''),
'$baseurl' => z_root(),
'$new_event' => array(z_root().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
'$previus' => array(z_root()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array(z_root()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''),
'$export' => array(z_root()."/cal/$nick/$y/$m/export",t('Export'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events,
'$upload' => t('Import'),

View file

@ -16,7 +16,7 @@ function channel_init(&$a) {
$which = argv(1);
if(! $which) {
if(local_channel()) {
$channel = $a->get_channel();
$channel = App::get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
}
@ -27,19 +27,19 @@ function channel_init(&$a) {
}
$profile = 0;
$channel = $a->get_channel();
$channel = App::get_channel();
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
}
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n" ;
App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n" ;
// Not yet ready for prime time
// $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->get_baseurl() . '/id/' . $which .'?f=" />' . "\r\n" ;
// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $a->get_baseurl() . '/channel/' . $which .'" />' . "\r\n" ;
// App::$page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ;
// App::$page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ;
// Run profile_load() here to make sure the theme is set before
// we start loading content
@ -75,27 +75,27 @@ function channel_content(&$a, $update = 0, $load = false) {
if($update) {
// Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $a->profile_uid = $update;
App::$profile['profile_uid'] = App::$profile_uid = $update;
}
else {
if($a->profile['profile_uid'] == local_channel()) {
if(App::$profile['profile_uid'] == local_channel()) {
nav_set_selected('home');
}
}
$is_owner = (((local_channel()) && ($a->profile['profile_uid'] == local_channel())) ? true : false);
$is_owner = (((local_channel()) && (App::$profile['profile_uid'] == local_channel())) ? true : false);
$channel = $a->get_channel();
$observer = $a->get_observer();
$channel = App::get_channel();
$observer = App::get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($a->profile['profile_uid'],$ob_hash);
$perms = get_all_perms(App::$profile['profile_uid'],$ob_hash);
if(! $perms['view_stream']) {
// We may want to make the target of this redirect configurable
if($perms['view_profile']) {
notice( t('Insufficient permissions. Request redirected to profile page.') . EOL);
goaway (z_root() . "/profile/" . $a->profile['channel_address']);
goaway (z_root() . "/profile/" . App::$profile['channel_address']);
}
notice( t('Permission denied.') . EOL);
return;
@ -104,9 +104,9 @@ function channel_content(&$a, $update = 0, $load = false) {
if(! $update) {
$o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
$o .= profile_tabs($a, $is_owner, App::$profile['channel_address']);
$o .= common_friends_visitor_widget($a->profile['profile_uid']);
$o .= common_friends_visitor_widget(App::$profile['profile_uid']);
if($channel && $is_owner) {
$channel_acl = array(
@ -124,15 +124,15 @@ function channel_content(&$a, $update = 0, $load = false) {
$x = array(
'is_owner' => $is_owner,
'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig($a->profile['profile_uid'],'system','use_browser_location')))) ? true : false),
'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''),
'nickname' => $a->profile['channel_address'],
'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''),
'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''),
'nickname' => App::$profile['channel_address'],
'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''),
'showacl' => (($is_owner) ? 'yes' : ''),
'bang' => '',
'visitor' => (($is_owner || $observer) ? true : false),
'profile_uid' => $a->profile['profile_uid']
'profile_uid' => App::$profile['profile_uid']
);
$o .= status_editor($a,$x);
@ -146,18 +146,18 @@ function channel_content(&$a, $update = 0, $load = false) {
*/
$item_normal = item_normal();
$sql_extra = item_permissions_sql($a->profile['profile_uid']);
$sql_extra = item_permissions_sql(App::$profile['profile_uid']);
if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid))
if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
$page_mode = 'list';
else
$page_mode = 'client';
$abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " ";
$abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
$a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n";
App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . App::$query_string) . '" title="oembed" />' . "\r\n";
if($update && $_SESSION['loadtime'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
@ -170,7 +170,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
dbesc($mid . '%'),
intval($a->profile['profile_uid'])
intval(App::$profile['profile_uid'])
);
} else {
$r = q("SELECT distinct parent AS `item_id`, created from item
@ -180,7 +180,7 @@ function channel_content(&$a, $update = 0, $load = false) {
AND (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra
ORDER BY created DESC",
intval($a->profile['profile_uid'])
intval(App::$profile['profile_uid'])
);
$_SESSION['loadtime'] = datetime_convert();
}
@ -203,15 +203,15 @@ function channel_content(&$a, $update = 0, $load = false) {
}
$itemspage = get_pconfig(local_channel(),'system','itemspage');
$a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
if($load || ($_COOKIE['jsAvailable'] != 1)) {
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid),
intval($a->profile['profile_uid'])
intval(App::$profile['profile_uid'])
);
if (! $r) {
notice( t('Permission denied.') . EOL);
@ -225,7 +225,7 @@ function channel_content(&$a, $update = 0, $load = false) {
AND (abook_blocked = 0 or abook.abook_flags is null)
$sql_extra $sql_extra2
ORDER BY created DESC $pager_sql ",
intval($a->profile['profile_uid'])
intval(App::$profile['profile_uid'])
);
}
}
@ -243,7 +243,7 @@ function channel_content(&$a, $update = 0, $load = false) {
WHERE `item`.`uid` = %d $item_normal
AND `item`.`parent` IN ( %s )
$sql_extra ",
intval($a->profile['profile_uid']),
intval(App::$profile['profile_uid']),
dbesc($parents_str)
);
@ -266,19 +266,19 @@ function channel_content(&$a, $update = 0, $load = false) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
$maxheight = get_pconfig($a->profile['profile_uid'],'system','channel_divmore_height');
$maxheight = get_pconfig(App::$profile['profile_uid'],'system','channel_divmore_height');
if(! $maxheight)
$maxheight = 400;
$o .= '<div id="live-channel"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . $a->profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . $a->pager['page']
$o .= "<script> var profile_uid = " . App::$profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'channel',
'$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'),
'$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'),
'$gid' => '0',
'$cid' => '0',
'$cmin' => '0',
@ -290,7 +290,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'$nouveau' => '0',
'$wall' => '1',
'$fh' => '0',
'$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1),
'$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => '',
'$order' => '',
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
@ -344,7 +344,7 @@ function channel_content(&$a, $update = 0, $load = false) {
if((! $update) || ($_COOKIE['jsAvailable'] != 1)) {
$o .= alt_pager($a,count($items));
if ($mid && $items[0]['title'])
$a->page['title'] = $items[0]['title'] . " - " . $a->page['title'];
App::$page['title'] = $items[0]['title'] . " - " . App::$page['title'];
}
if($mid)

View file

@ -5,7 +5,7 @@ require_once('include/zot.php');
function chanview_content(&$a) {
$observer = $a->get_observer();
$observer = App::get_observer();
$xchan = null;
$r = null;
@ -38,7 +38,7 @@ function chanview_content(&$a) {
);
}
if($r) {
$a->poi = $r[0];
App::$poi = $r[0];
}
@ -47,7 +47,7 @@ function chanview_content(&$a) {
// address, we can and should try to import it. If it's just a hash, we can't continue, but we
// probably wouldn't have a hash if we don't already have an xchan for this channel.
if(! $a->poi) {
if(! App::$poi) {
logger('mod_chanview: fallback');
// This is hackish - construct a zot address from the url
if($_REQUEST['url']) {
@ -67,13 +67,13 @@ function chanview_content(&$a) {
dbesc($_REQUEST['address'])
);
if($r)
$a->poi = $r[0];
App::$poi = $r[0];
}
}
}
if(! $a->poi) {
if(! App::$poi) {
// We don't know who this is, and we can't figure it out from the URL
// On the plus side, there's a good chance we know somebody else at that
// hub so sending them there with a Zid will probably work anyway.
@ -82,8 +82,8 @@ function chanview_content(&$a) {
$url = zid($url);
}
if ($a->poi) {
$url = $a->poi['xchan_url'];
if (App::$poi) {
$url = App::$poi['xchan_url'];
if($observer)
$url = zid($url);
}

View file

@ -10,7 +10,7 @@ function chat_init(&$a) {
$which = argv(1);
if(! $which) {
if(local_channel()) {
$channel = $a->get_channel();
$channel = App::get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
}
@ -21,14 +21,14 @@ function chat_init(&$a) {
}
$profile = 0;
$channel = $a->get_channel();
$channel = App::get_channel();
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
}
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which .'" />' . "\r\n" ;
// Run profile_load() here to make sure the theme is set before
// we start loading content
@ -45,7 +45,7 @@ function chat_post(&$a) {
if((! $room) || (! local_channel()))
return;
$channel = $a->get_channel();
$channel = App::get_channel();
if($_POST['action'] === 'drop') {
@ -86,16 +86,16 @@ function chat_post(&$a) {
function chat_content(&$a) {
if(local_channel())
$channel = $a->get_channel();
$channel = App::get_channel();
$ob = $a->get_observer();
$ob = App::get_observer();
$observer = get_observer_hash();
if(! $observer) {
notice( t('Permission denied.') . EOL);
return;
}
if(! perm_is_allowed($a->profile['profile_uid'],$observer,'chat')) {
if(! perm_is_allowed(App::$profile['profile_uid'],$observer,'chat')) {
notice( t('Permission denied.') . EOL);
return;
}
@ -159,8 +159,9 @@ function chat_content(&$a) {
return;
$x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1",
intval($room_id),
intval($a->profile['profile_uid'])
intval(App::$profile['profile_uid'])
);
if($x) {
$acl = new Zotlabs\Access\AccessList(false);
$acl->set($x[0]);
@ -175,6 +176,11 @@ function chat_content(&$a) {
return;
}
$cipher = get_pconfig(local_channel(),'system','default_cipher');
if(! $cipher)
$cipher = 'aes256';
$o = replace_macros(get_markup_template('chat.tpl'),array(
'$is_owner' => ((local_channel() && local_channel() == $x[0]['cr_uid']) ? true : false),
'$room_name' => $room_name,
@ -183,53 +189,59 @@ function chat_content(&$a) {
'$nickname' => argv(1),
'$submit' => t('Submit'),
'$leave' => t('Leave Room'),
'$drop' => t('Delete This Room'),
'$drop' => t('Delete Room'),
'$away' => t('I am away right now'),
'$online' => t('I am online'),
'$bookmark_link' => $bookmark_link,
'$bookmark' => t('Bookmark this room')
'$bookmark' => t('Bookmark this room'),
'$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false),
'$cipher' => $cipher,
'$linkurl' => t('Please enter a link URL:'),
'$encrypt' => t('Encrypt text'),
'$insert' => t('Insert web link')
));
return $o;
}
if(local_channel() && argc() > 2 && argv(2) === 'new') {
$acl = new Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get();
require_once('include/acl_selectors.php');
$o = replace_macros(get_markup_template('chatroom_new.tpl'),array(
'$header' => t('New Chatroom'),
'$name' => array('room_name',t('Chatroom Name'),'', ''),
'$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''),
'$permissions' => t('Permissions'),
'$acl' => populate_acl($channel_acl,false),
'$submit' => t('Submit')
));
return $o;
}
require_once('include/conversation.php');
$o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
$o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']);
require_once('include/widgets.php');
$acl = new Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get();
$lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
require_once('include/acl_selectors.php');
$chatroom_new = '';
if(local_channel()) {
$chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array(
'$header' => t('New Chatroom'),
'$name' => array('room_name',t('Chatroom name'),'', ''),
'$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''),
'$permissions' => t('Permissions'),
'$acl' => populate_acl($channel_acl,false),
'$lockstate' => $lockstate,
'$submit' => t('Submit')
));
}
$rooms = chatroom_list(App::$profile['profile_uid']);
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array(
'$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']),
'$header' => sprintf( t('%1$s\'s Chatrooms'), App::$profile['name']),
'$name' => t('Name'),
'$baseurl' => z_root(),
'$nickname' => $channel['channel_address'],
'$rooms' => widget_chatroom_list(array()),
'$newroom' => t('New Chatroom'),
'$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0)
'$nickname' => App::$profile['channel_address'],
'$rooms' => $rooms,
'$norooms' => t('No chatrooms available'),
'$newroom' => t('Create New'),
'$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0),
'$chatroom_new' => $chatroom_new,
'$expire' => t('Expiration'),
'$expire_unit' => t('min') //minutes
));
return $o;

View file

@ -8,16 +8,16 @@ function chatsvc_init(&$a) {
$ret = array('success' => false);
$a->data['chat']['room_id'] = intval($_REQUEST['room_id']);
App::$data['chat']['room_id'] = intval($_REQUEST['room_id']);
$x = q("select cr_uid from chatroom where cr_id = %d and cr_id != 0 limit 1",
intval($a->data['chat']['room_id'])
intval(App::$data['chat']['room_id'])
);
if(! $x)
json_return_and_die($ret);
$a->data['chat']['uid'] = $x[0]['cr_uid'];
App::$data['chat']['uid'] = $x[0]['cr_uid'];
if(! perm_is_allowed($a->data['chat']['uid'],get_observer_hash(),'chat')) {
if(! perm_is_allowed(App::$data['chat']['uid'],get_observer_hash(),'chat')) {
json_return_and_die($ret);
}
@ -27,22 +27,22 @@ function chatsvc_post(&$a) {
$ret = array('success' => false);
$room_id = $a->data['chat']['room_id'];
$room_id = App::$data['chat']['room_id'];
$text = escape_tags($_REQUEST['chat_text']);
if(! $text)
return;
$sql_extra = permissions_sql($a->data['chat']['uid']);
$sql_extra = permissions_sql(App::$data['chat']['uid']);
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra",
intval($a->data['chat']['uid']),
intval($a->data['chat']['room_id'])
intval(App::$data['chat']['uid']),
intval(App::$data['chat']['room_id'])
);
if(! $r)
json_return_and_die($ret);
$arr = array(
'chat_room' => $a->data['chat']['room_id'],
'chat_room' => App::$data['chat']['room_id'],
'chat_xchan' => get_observer_hash(),
'chat_text' => $text
);
@ -51,7 +51,7 @@ function chatsvc_post(&$a) {
$x = q("insert into chat ( chat_room, chat_xchan, created, chat_text )
values( %d, '%s', '%s', '%s' )",
intval($a->data['chat']['room_id']),
intval(App::$data['chat']['room_id']),
dbesc(get_observer_hash()),
dbesc(datetime_convert()),
dbesc($arr['chat_text'])
@ -64,13 +64,13 @@ function chatsvc_post(&$a) {
function chatsvc_content(&$a) {
$status = strip_tags($_REQUEST['status']);
$room_id = intval($a->data['chat']['room_id']);
$room_id = intval(App::$data['chat']['room_id']);
$stopped = ((x($_REQUEST,'stopped') && intval($_REQUEST['stopped'])) ? true : false);
if($status && $room_id) {
$x = q("select channel_address from channel where channel_id = %d limit 1",
intval($a->data['chat']['uid'])
intval(App::$data['chat']['uid'])
);
$r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'",
@ -90,11 +90,11 @@ function chatsvc_content(&$a) {
$ret = array('success' => false);
$sql_extra = permissions_sql($a->data['chat']['uid']);
$sql_extra = permissions_sql(App::$data['chat']['uid']);
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra",
intval($a->data['chat']['uid']),
intval($a->data['chat']['room_id'])
intval(App::$data['chat']['uid']),
intval(App::$data['chat']['room_id'])
);
if(! $r)
json_return_and_die($ret);
@ -102,28 +102,30 @@ function chatsvc_content(&$a) {
$inroom = array();
$r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name",
intval($a->data['chat']['room_id'])
intval(App::$data['chat']['room_id'])
);
if($r) {
foreach($r as $rr) {
switch($rr['cp_status']) {
case 'away':
$status = t('Away');
$status_class = 'away';
break;
case 'online':
default:
$status = t('Online');
$status_class = 'online';
break;
}
$inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], status => $status);
$inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], 'status' => $status, 'status_class' => $status_class);
}
}
$chats = array();
$r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created",
intval($a->data['chat']['room_id']),
intval(App::$data['chat']['room_id']),
intval($lastseen)
);
if($r) {
@ -135,7 +137,8 @@ function chatsvc_content(&$a) {
'name' => $rr['xchan_name'],
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'),
'text' => smilies(bbcode($rr['chat_text']))
'text' => smilies(bbcode($rr['chat_text'])),
'self' => ((get_observer_hash() == $rr['chat_xchan']) ? 'self' : '')
);
}
}
@ -143,7 +146,7 @@ function chatsvc_content(&$a) {
$r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'",
dbesc(datetime_convert()),
intval($a->data['chat']['room_id']),
intval(App::$data['chat']['room_id']),
dbesc(get_observer_hash()),
dbesc($_SERVER['REMOTE_ADDR'])
);

View file

@ -30,7 +30,7 @@ function cloud_init(&$a) {
$profile = 0;
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
if ($which)
profile_load($a, $which, $profile);
@ -41,7 +41,7 @@ function cloud_init(&$a) {
if ($ob_hash) {
if (local_channel()) {
$channel = $a->get_channel();
$channel = App::get_channel();
$auth->setCurrentUser($channel['channel_address']);
$auth->channel_id = $channel['channel_id'];
$auth->channel_hash = $channel['channel_hash'];
@ -77,7 +77,7 @@ function cloud_init(&$a) {
if($_SERVER['REQUEST_METHOD'] === 'GET') {
try {
$x = RedFileData('/' . $a->cmd, $auth);
$x = RedFileData('/' . App::$cmd, $auth);
}
catch(\Exception $e) {
if($e instanceof Sabre\DAV\Exception\Forbidden) {

View file

@ -8,7 +8,7 @@ function common_init(&$a) {
$channel_id = intval(argv(1));
else {
notice( t('No channel.') . EOL );
$a->error = 404;
App::$error = 404;
return;
}
@ -25,27 +25,27 @@ function common_content(&$a) {
$o = '';
if(! $a->profile['profile_uid'])
if(! App::$profile['profile_uid'])
return;
$observer_hash = get_observer_hash();
if(! perm_is_allowed($a->profile['profile_uid'],$observer_hash,'view_contacts')) {
if(! perm_is_allowed(App::$profile['profile_uid'],$observer_hash,'view_contacts')) {
notice( t('Permission denied.') . EOL);
return;
}
$o .= '<h2>' . t('Common connections') . '</h2>';
$t = count_common_friends($a->profile['profile_uid'],$observer_hash);
$t = count_common_friends(App::$profile['profile_uid'],$observer_hash);
if(! $t) {
notice( t('No connections in common.') . EOL);
return $o;
}
$r = common_friends($a->profile['profile_uid'],$observer_hash);
$r = common_friends(App::$profile['profile_uid'],$observer_hash);
if($r) {

View file

@ -11,7 +11,7 @@ function connect_init(&$a) {
$which = argv(1);
else {
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
App::$error = 404;
return;
}
@ -20,20 +20,20 @@ function connect_init(&$a) {
);
if($r)
$a->data['channel'] = $r[0];
App::$data['channel'] = $r[0];
profile_load($a,$which,'');
}
function connect_post(&$a) {
if(! array_key_exists('channel', $a->data))
if(! array_key_exists('channel', App::$data))
return;
$edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false);
if($edit) {
$has_premium = (($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0);
$has_premium = ((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0);
$premium = (($_POST['premium']) ? intval($_POST['premium']) : 0);
$text = escape_tags($_POST['text']);
@ -43,25 +43,25 @@ function connect_post(&$a) {
intval(PAGE_PREMIUM),
intval(local_channel())
);
proc_run('php','include/notifier.php','refresh_all',$a->data['channel']['channel_id']);
proc_run('php','include/notifier.php','refresh_all',App::$data['channel']['channel_id']);
}
set_pconfig($a->data['channel']['channel_id'],'system','selltext',$text);
set_pconfig(App::$data['channel']['channel_id'],'system','selltext',$text);
// reload the page completely to get fresh data
goaway(z_root() . '/' . $a->query_string);
goaway(z_root() . '/' . App::$query_string);
}
$url = '';
$observer = $a->get_observer();
$observer = App::get_observer();
if(($observer) && ($_POST['submit'] === t('Continue'))) {
if($observer['xchan_follow'])
$url = sprintf($observer['xchan_follow'],urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname()));
$url = sprintf($observer['xchan_follow'],urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname()));
if(! $url) {
$r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1",
dbesc($observer['xchan_hash'])
);
if($r)
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname());
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname());
}
}
if($url)
@ -75,16 +75,16 @@ function connect_post(&$a) {
function connect_content(&$a) {
$edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false);
$edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false);
$text = get_pconfig($a->data['channel']['channel_id'],'system','selltext');
$text = get_pconfig(App::$data['channel']['channel_id'],'system','selltext');
if($edit) {
$o = replace_macros(get_markup_template('sellpage_edit.tpl'),array(
'$header' => t('Premium Channel Setup'),
'$address' => $a->data['channel']['channel_address'],
'$premium' => array('premium', t('Enable premium channel connection restrictions'),(($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''),
'$address' => App::$data['channel']['channel_address'],
'$premium' => array('premium', t('Enable premium channel connection restrictions'),((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''),
'$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'),
'$text' => $text,
'$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'),
@ -102,7 +102,7 @@ function connect_content(&$a) {
$submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array(
'$continue' => t('Continue'),
'$address' => $a->data['channel']['channel_address']
'$address' => App::$data['channel']['channel_address']
));
$o = replace_macros(get_markup_template('sellpage_view.tpl'),array(
@ -115,7 +115,7 @@ function connect_content(&$a) {
));
$arr = array('channel' => $a->data['channel'],'observer' => $a->get_observer(), 'sellpage' => $o, 'submit' => $submit);
$arr = array('channel' => App::$data['channel'],'observer' => App::get_observer(), 'sellpage' => $o, 'submit' => $submit);
call_hooks('connect_premium', $arr);
$o = $arr['sellpage'];

View file

@ -13,7 +13,7 @@ function connections_init(&$a) {
if(! local_channel())
return;
$channel = $a->get_channel();
$channel = App::get_channel();
if($channel)
head_set_icon($channel['xchan_photo_s']);
@ -40,7 +40,7 @@ function connections_content(&$a) {
$all = false;
if(! $_REQUEST['aj'])
$_SESSION['return_url'] = $a->query_string;
$_SESSION['return_url'] = App::$query_string;
$search_flags = '';
$head = '';
@ -82,14 +82,14 @@ function connections_content(&$a) {
$head = t('New');
$pending = true;
nav_set_selected('intros');
$a->argv[1] = 'pending';
App::$argv[1] = 'pending';
}
else {
$head = t('All');
$search_flags = '';
$all = true;
$a->argc = 1;
unset($a->argv[1]);
App::$argc = 1;
unset(App::$argv[1]);
}
nav_set_selected('intros');
break;
@ -211,15 +211,15 @@ function connections_content(&$a) {
intval(local_channel())
);
if($r) {
$a->set_pager_total($r[0]['total']);
App::set_pager_total($r[0]['total']);
$total = $r[0]['total'];
}
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ",
intval(local_channel()),
intval($a->pager['itemspage']),
intval($a->pager['start'])
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
$contacts = array();
@ -304,7 +304,7 @@ function connections_content(&$a) {
'$finding' => (($searching) ? t('Connections search') . ": '" . $search . "'" : ""),
'$submit' => t('Find'),
'$edit' => t('Edit'),
'$cmd' => $a->cmd,
'$cmd' => App::$cmd,
'$contacts' => $contacts,
'$paginate' => paginate($a),

View file

@ -32,11 +32,11 @@ function connedit_init(&$a) {
intval(argv(1))
);
if($r) {
$a->poi = $r[0];
App::$poi = $r[0];
}
}
$channel = $a->get_channel();
$channel = App::get_channel();
if($channel)
head_set_icon($channel['xchan_photo_s']);
@ -55,7 +55,7 @@ function connedit_post(&$a) {
if(! $contact_id)
return;
$channel = $a->get_channel();
$channel = App::get_channel();
// TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the
// connection enable is toggled to a special autopost url and set permissions immediately, leaving
@ -73,7 +73,7 @@ function connedit_post(&$a) {
if(! $orig_record) {
notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl(true) . '/connections');
goaway(z_root() . '/connections');
return; // NOTREACHED
}
@ -224,8 +224,8 @@ function connedit_post(&$a) {
else
notice( t('Failed to update connection record.') . EOL);
if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms
&& (! intval($a->poi['abook_self']))) {
if(App::$poi && App::$poi['abook_my_perms'] != $abook_my_perms
&& (! intval(App::$poi['abook_self']))) {
proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id);
}
@ -235,7 +235,7 @@ function connedit_post(&$a) {
require_once('include/group.php');
$g = group_rec_byhash(local_channel(),$default_group);
if($g)
group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']);
group_add_member(local_channel(),'',App::$poi['abook_xchan'],$g['id']);
}
// Check if settings permit ("post new friend activity" is allowed, and
@ -259,19 +259,19 @@ function connedit_post(&$a) {
$xarr['item_private'] = (($xarr['allow_cid']||$xarr['allow_gid']||$xarr['deny_cid']||$xarr['deny_gid']) ? 1 : 0);
$obj = array(
'type' => ACTIVITY_OBJ_PERSON,
'title' => $a->poi['xchan_name'],
'id' => $a->poi['xchan_hash'],
'title' => App::$poi['xchan_name'],
'id' => App::$poi['xchan_hash'],
'link' => array(
array('rel' => 'alternate', 'type' => 'text/html', 'href' => $a->poi['xchan_url']),
array('rel' => 'photo', 'type' => $a->poi['xchan_photo_mimetype'], 'href' => $a->poi['xchan_photo_l'])
array('rel' => 'alternate', 'type' => 'text/html', 'href' => App::$poi['xchan_url']),
array('rel' => 'photo', 'type' => App::$poi['xchan_photo_mimetype'], 'href' => App::$poi['xchan_photo_l'])
),
);
$xarr['object'] = json_encode($obj);
$xarr['obj_type'] = ACTIVITY_OBJ_PERSON;
$xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . $a->poi['xchan_url'] . ']' . $a->poi['xchan_name'] . '[/zrl]';
$xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . App::$poi['xchan_url'] . ']' . App::$poi['xchan_name'] . '[/zrl]';
$xarr['body'] .= "\n\n\n" . '[zrl=' . $a->poi['xchan_url'] . '][zmg=80x80]' . $a->poi['xchan_photo_m'] . '[/zmg][/zrl]';
$xarr['body'] .= "\n\n\n" . '[zrl=' . App::$poi['xchan_url'] . '][zmg=80x80]' . App::$poi['xchan_photo_m'] . '[/zmg][/zrl]';
post_activity_item($xarr);
@ -292,11 +292,11 @@ function connedit_post(&$a) {
intval($contact_id)
);
if($r) {
$a->poi = $r[0];
App::$poi = $r[0];
}
if($new_friend) {
$arr = array('channel_id' => local_channel(), 'abook' => $a->poi);
$arr = array('channel_id' => local_channel(), 'abook' => App::$poi);
call_hooks('accept_follow', $arr);
}
@ -306,7 +306,7 @@ function connedit_post(&$a) {
connedit_clone($a);
if(($_REQUEST['pending']) && (!$_REQUEST['done']))
goaway($a->get_baseurl(true) . '/connections/ifpending');
goaway(z_root() . '/connections/ifpending');
return;
@ -319,23 +319,23 @@ function connedit_post(&$a) {
function connedit_clone(&$a) {
if(! $a->poi)
if(! App::$poi)
return;
$channel = $a->get_channel();
$channel = App::get_channel();
$r = q("SELECT abook.*, xchan.*
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
intval(local_channel()),
intval($a->poi['abook_id'])
intval(App::$poi['abook_id'])
);
if($r) {
$a->poi = $r[0];
App::$poi = $r[0];
}
$clone = $a->poi;
$clone = App::$poi;
unset($clone['abook_id']);
unset($clone['abook_account']);
@ -363,7 +363,7 @@ function connedit_content(&$a) {
return login();
}
$channel = $a->get_channel();
$channel = App::get_channel();
$my_perms = get_channel_default_perms(local_channel());
$role = get_pconfig(local_channel(),'system','permissions_role');
if($role) {
@ -405,19 +405,19 @@ function connedit_content(&$a) {
if(! count($orig_record)) {
notice( t('Could not access address book record.') . EOL);
goaway($a->get_baseurl(true) . '/connections');
goaway(z_root() . '/connections');
}
if($cmd === 'update') {
// pull feed and consume it, which should subscribe to the hub.
proc_run('php',"include/poller.php","$contact_id");
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'refresh') {
if($orig_record[0]['xchan_network'] === 'zot') {
if(! zot_refresh($orig_record[0],get_app()->get_channel()))
if(! zot_refresh($orig_record[0],App::get_channel()))
notice( t('Refresh failed - channel is currently unavailable.') );
}
else {
@ -425,7 +425,7 @@ function connedit_content(&$a) {
// if you are on a different network we'll force a refresh of the connection basic info
proc_run('php','include/notifier.php','permission_update',$contact_id);
}
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'block') {
@ -434,7 +434,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'ignore') {
@ -443,7 +443,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'archive') {
@ -452,7 +452,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'hide') {
@ -461,7 +461,7 @@ function connedit_content(&$a) {
}
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
// We'll prevent somebody from unapproving an already approved contact.
@ -475,7 +475,7 @@ function connedit_content(&$a) {
else
notice(t('Unable to set address book parameters.') . EOL);
}
goaway($a->get_baseurl(true) . '/connedit/' . $contact_id);
goaway(z_root() . '/connedit/' . $contact_id);
}
@ -499,16 +499,16 @@ function connedit_content(&$a) {
info( t('Connection has been removed.') . EOL );
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
goaway($a->get_baseurl(true) . '/contacts');
goaway(z_root() . '/' . $_SESSION['return_url']);
goaway(z_root() . '/contacts');
}
}
if($a->poi) {
if(App::$poi) {
$contact_id = $a->poi['abook_id'];
$contact = $a->poi;
$contact_id = App::$poi['abook_id'];
$contact = App::$poi;
$buttons = array(
@ -521,21 +521,21 @@ function connedit_content(&$a) {
'refresh' => array(
'label' => t('Refresh Permissions'),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/refresh',
'sel' => '',
'title' => t('Fetch updated permissions'),
),
'recent' => array(
'label' => t('Recent Activity'),
'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'],
'url' => z_root() . '/network/?f=&cid=' . $contact['abook_id'],
'sel' => '',
'title' => t('View recent posts and comments'),
),
'block' => array(
'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/block',
'sel' => (intval($contact['abook_blocked']) ? 'active' : ''),
'title' => t('Block (or Unblock) all communications with this connection'),
'info' => (intval($contact['abook_blocked']) ? t('This connection is blocked!') : ''),
@ -543,7 +543,7 @@ function connedit_content(&$a) {
'ignore' => array(
'label' => (intval($contact['abook_ignored']) ? t('Unignore') : t('Ignore')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/ignore',
'sel' => (intval($contact['abook_ignored']) ? 'active' : ''),
'title' => t('Ignore (or Unignore) all inbound communications from this connection'),
'info' => (intval($contact['abook_ignored']) ? t('This connection is ignored!') : ''),
@ -551,7 +551,7 @@ function connedit_content(&$a) {
'archive' => array(
'label' => (intval($contact['abook_archived']) ? t('Unarchive') : t('Archive')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/archive',
'sel' => (intval($contact['abook_archived']) ? 'active' : ''),
'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'),
'info' => (intval($contact['abook_archived']) ? t('This connection is archived!') : ''),
@ -559,7 +559,7 @@ function connedit_content(&$a) {
'hide' => array(
'label' => (intval($contact['abook_hidden']) ? t('Unhide') : t('Hide')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/hide',
'sel' => (intval($contact['abook_hidden']) ? 'active' : ''),
'title' => t('Hide or Unhide this connection from your other connections'),
'info' => (intval($contact['abook_hidden']) ? t('This connection is hidden!') : ''),
@ -567,7 +567,7 @@ function connedit_content(&$a) {
'delete' => array(
'label' => t('Delete'),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop',
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/drop',
'sel' => '',
'title' => t('Delete this connection'),
),
@ -645,7 +645,7 @@ function connedit_content(&$a) {
$perms = array();
$channel = $a->get_channel();
$channel = App::get_channel();
$global_perms = get_perms();
$existing = get_all_perms(local_channel(),$contact['abook_xchan']);

View file

@ -24,7 +24,7 @@ function cover_photo_init(&$a) {
return;
}
$channel = $a->get_channel();
$channel = App::get_channel();
profile_load($a,$channel['channel_address']);
}
@ -42,7 +42,7 @@ function cover_photo_post(&$a) {
return;
}
$channel = $a->get_channel();
$channel = App::get_channel();
check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo');
@ -155,7 +155,7 @@ function cover_photo_post(&$a) {
return;
}
$channel = $a->get_channel();
$channel = App::get_channel();
send_cover_photo_activity($channel,$base_image,$profile);
@ -174,7 +174,7 @@ function cover_photo_post(&$a) {
require_once('include/attach.php');
$res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash));
$res = attach_store(App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash));
logger('attach_store: ' . print_r($res,true));
@ -274,7 +274,7 @@ function cover_photo_content(&$a) {
return;
}
$channel = $a->get_channel();
$channel = App::get_channel();
$newuser = false;
@ -341,12 +341,12 @@ function cover_photo_content(&$a) {
}
if(! x($a->data,'imagecrop')) {
if(! x(App::$data,'imagecrop')) {
$tpl = get_markup_template('cover_photo.tpl');
$o .= replace_macros($tpl,array(
'$user' => $a->channel['channel_address'],
'$user' => App::$channel['channel_address'],
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
'$title' => t('Upload Cover Photo'),
@ -354,7 +354,7 @@ function cover_photo_content(&$a) {
'$profiles' => $profiles,
'$form_security_token' => get_form_security_token("cover_photo"),
// FIXME - yuk
'$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/photos/' . $a->channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
'$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>')
));
call_hooks('cover_photo_content_end', $o);
@ -362,14 +362,14 @@ function cover_photo_content(&$a) {
return $o;
}
else {
$filename = $a->data['imagecrop'] . '-3';
$filename = App::$data['imagecrop'] . '-3';
$resolution = 3;
$tpl = get_markup_template("cropcover.tpl");
$o .= replace_macros($tpl,array(
'$filename' => $filename,
'$profile' => intval($_REQUEST['profile']),
'$resource' => $a->data['imagecrop'] . '-3',
'$image_url' => $a->get_baseurl() . '/photo/' . $filename,
'$resource' => App::$data['imagecrop'] . '-3',
'$image_url' => z_root() . '/photo/' . $filename,
'$title' => t('Crop Image'),
'$desc' => t('Please adjust the image cropping for optimum viewing.'),
'$form_security_token' => get_form_security_token("cover_photo"),
@ -409,9 +409,9 @@ function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){
}
$a->data['imagecrop'] = $hash;
$a->data['imagecrop_resolution'] = $smallest;
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
App::$data['imagecrop'] = $hash;
App::$data['imagecrop_resolution'] = $smallest;
App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
return;
}

Some files were not shown because too many files have changed in this diff Show more