aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2021-02-18 21:42:15 -0800
committernobody <nobody@zotlabs.com>2021-02-18 21:42:15 -0800
commit5664f5e0a2042287e81564d85816fdce6f1614a2 (patch)
treeead6d70c6fb6ca1aada92eea2f3c723456cf5f8c
parent136bc13ff6081a17782ef757c2e979e16333d663 (diff)
parentd50381c9c67e097cf3eae73f0311191acca8f0a5 (diff)
downloadvolse-hubzilla-5664f5e0a2042287e81564d85816fdce6f1614a2.tar.gz
volse-hubzilla-5664f5e0a2042287e81564d85816fdce6f1614a2.tar.bz2
volse-hubzilla-5664f5e0a2042287e81564d85816fdce6f1614a2.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
-rw-r--r--Zotlabs/Web/Router.php85
-rw-r--r--Zotlabs/Web/WebServer.php8
-rw-r--r--Zotlabs/Zot/Receiver.php1
-rw-r--r--boot.php18
-rw-r--r--include/bbcode.php68
-rw-r--r--include/help.php1
-rw-r--r--include/nav.php341
-rw-r--r--include/plugin.php5
-rw-r--r--include/security.php1
-rw-r--r--include/zid.php12
-rw-r--r--include/zot.php3
11 files changed, 278 insertions, 265 deletions
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index 96bf131b8..a6a841ccb 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Web;
+use App;
use Zotlabs\Extend\Route;
use Exception;
@@ -43,7 +44,7 @@ class Router {
*/
function __construct() {
- $module = \App::$module;
+ $module = App::$module;
$modname = "Zotlabs\\Module\\" . ucfirst($module);
if(strlen($module)) {
@@ -60,7 +61,7 @@ class Router {
include_once($route[0]);
if(class_exists($modname)) {
$this->controller = new $modname;
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
}
}
@@ -68,15 +69,15 @@ class Router {
// legacy plugins - this can be removed when they have all been converted
- if(! (\App::$module_loaded)) {
- if(is_array(\App::$plugins) && in_array($module,\App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
+ if(! (App::$module_loaded)) {
+ if(is_array(App::$plugins) && in_array($module, App::$plugins) && file_exists("addon/{$module}/{$module}.php")) {
include_once("addon/{$module}/{$module}.php");
if(class_exists($modname)) {
$this->controller = new $modname;
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
elseif(function_exists($module . '_module')) {
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
}
}
@@ -86,40 +87,40 @@ class Router {
* Otherwise, look for the standard program module
*/
- if(! (\App::$module_loaded)) {
+ if(! (App::$module_loaded)) {
try {
$filename = 'Zotlabs/SiteModule/'. ucfirst($module). '.php';
if(file_exists($filename)) {
// This won't be picked up by the autoloader, so load it explicitly
require_once($filename);
$this->controller = new $modname;
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
else {
$filename = 'Zotlabs/Module/'. ucfirst($module). '.php';
if(file_exists($filename)) {
$this->controller = new $modname;
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
}
- if(! \App::$module_loaded)
- throw new \Exception('Module not found');
+ if(! App::$module_loaded)
+ throw new Exception('Module not found');
}
- catch(\Exception $e) {
+ catch(Exception $e) {
if(file_exists("mod/site/{$module}.php")) {
include_once("mod/site/{$module}.php");
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
elseif(file_exists("mod/{$module}.php")) {
include_once("mod/{$module}.php");
- \App::$module_loaded = true;
+ App::$module_loaded = true;
}
}
}
$x = [
'module' => $module,
- 'installed' => \App::$module_loaded,
+ 'installed' => App::$module_loaded,
'controller' => $this->controller
];
/**
@@ -136,7 +137,7 @@ class Router {
*/
call_hooks('module_loaded', $x);
if($x['installed']) {
- \App::$module_loaded = true;
+ App::$module_loaded = true;
$this->controller = $x['controller'];
}
@@ -144,7 +145,7 @@ class Router {
* The URL provided does not resolve to a valid module.
*/
- if(! (\App::$module_loaded)) {
+ if(! (App::$module_loaded)) {
// undo the setting of a letsencrypt acme-challenge rewrite rule
// which blocks access to our .well-known routes.
@@ -160,7 +161,7 @@ class Router {
$x = [
'module' => $module,
- 'installed' => \App::$module_loaded,
+ 'installed' => App::$module_loaded,
'controller' => $this->controller
];
call_hooks('page_not_found',$x);
@@ -181,14 +182,14 @@ class Router {
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
$tpl = get_markup_template('404.tpl');
- \App::$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
- \App::$module = '404';
- \App::$module_loaded = true;
- \App::$error = true;
+ App::$module = '404';
+ App::$module_loaded = true;
+ App::$error = true;
}
}
}
@@ -203,9 +204,9 @@ class Router {
* Call module functions
*/
- if(\App::$module_loaded) {
+ if(App::$module_loaded) {
- \App::$page['page_title'] = \App::$module;
+ App::$page['page_title'] = App::$module;
$placeholder = '';
/*
@@ -216,13 +217,13 @@ class Router {
*/
$arr = array('init' => true, 'replace' => false);
- call_hooks(\App::$module . '_mod_init', $arr);
+ call_hooks(App::$module . '_mod_init', $arr);
if(! $arr['replace']) {
if($this->controller && method_exists($this->controller,'init')) {
$this->controller->init();
}
- elseif(function_exists(\App::$module . '_init')) {
- $func = \App::$module . '_init';
+ elseif(function_exists(App::$module . '_init')) {
+ $func = App::$module . '_init';
$func($a);
}
}
@@ -258,41 +259,41 @@ class Router {
$func = str_replace('-', '_', $current_theme[0]) . '_init';
$func($a);
}
- 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';
+ 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') && (! \App::$error) && (! x($_POST, 'auth-params'))) {
- call_hooks(\App::$module . '_mod_post', $_POST);
+ if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! App::$error) && (! x($_POST, 'auth-params'))) {
+ call_hooks(App::$module . '_mod_post', $_POST);
if($this->controller && method_exists($this->controller,'post')) {
$this->controller->post();
}
- elseif(function_exists(\App::$module . '_post')) {
- $func = \App::$module . '_post';
+ elseif(function_exists(App::$module . '_post')) {
+ $func = App::$module . '_post';
$func($a);
}
}
- if(! \App::$error) {
- $arr = array('content' => \App::$page['content'], 'replace' => false);
- call_hooks(\App::$module . '_mod_content', $arr);
+ if(! App::$error) {
+ $arr = array('content' => App::$page['content'], 'replace' => false);
+ call_hooks(App::$module . '_mod_content', $arr);
if(! $arr['replace']) {
if($this->controller && method_exists($this->controller,'get')) {
$arr = array('content' => $this->controller->get());
}
- elseif(function_exists(\App::$module . '_content')) {
- $func = \App::$module . '_content';
+ elseif(function_exists(App::$module . '_content')) {
+ $func = App::$module . '_content';
$arr = array('content' => $func($a));
}
}
- call_hooks(\App::$module . '_mod_aftercontent', $arr);
- \App::$page['content'] = (($arr['replace']) ? $arr['content'] : \App::$page['content'] . $arr['content']);
+ call_hooks(App::$module . '_mod_aftercontent', $arr);
+ App::$page['content'] = ((isset($arr['replace'])) ? $arr['content'] : App::$page['content'] . $arr['content']);
}
}
}
diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php
index ac792dd69..de0d5a883 100644
--- a/Zotlabs/Web/WebServer.php
+++ b/Zotlabs/Web/WebServer.php
@@ -112,7 +112,7 @@ class WebServer {
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
- if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
+ if(isset($_SESSION['sysmsg']) && is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
@@ -137,9 +137,9 @@ class WebServer {
private function create_channel_links() {
- /* Initialise the Link: response header if this is a channel page.
+ /* Initialise the Link: response header if this is a channel page.
* This cannot be done inside the channel module because some protocol
- * addons over-ride the module functions and these links are common
+ * addons over-ride the module functions and these links are common
* to all protocol drivers; thus doing it here avoids duplication.
*/
@@ -156,7 +156,7 @@ class WebServer {
'url' => z_root() . '/.well-known/webfinger?f=&resource=acct%3A' . argv(1) . '%40' . \App::get_hostname()
],
];
- $x = [ 'channel_address' => argv(1), 'channel_links' => \App::$channel_links ];
+ $x = [ 'channel_address' => argv(1), 'channel_links' => \App::$channel_links ];
call_hooks('channel_links', $x );
\App::$channel_links = $x['channel_links'];
header('Link: ' . \App::get_channel_links());
diff --git a/Zotlabs/Zot/Receiver.php b/Zotlabs/Zot/Receiver.php
index 7fc445f66..f0378b650 100644
--- a/Zotlabs/Zot/Receiver.php
+++ b/Zotlabs/Zot/Receiver.php
@@ -32,6 +32,7 @@ class Receiver {
$this->encrypted = ((array_key_exists('iv',$data)) ? true : false);
if($this->encrypted) {
+ $data['encrypted'] = true;
$this->data = @json_decode(@Crypto::unencapsulate($data,$prvkey),true);
}
if(! $this->data)
diff --git a/boot.php b/boot.php
index 1e84a36a6..7a98b8589 100644
--- a/boot.php
+++ b/boot.php
@@ -684,14 +684,18 @@ function sys_boot() {
function startup() {
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
+ error_reporting(E_ALL & ~E_NOTICE);
+
+ if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
+ error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
+ }
// Some hosting providers block/disable this
@set_time_limit(0);
if(function_exists ('ini_set')) {
// This has to be quite large to deal with embedded private photos
- @ini_set('pcre.backtrack_limit', 500000);
+ //@ini_set('pcre.backtrack_limit', 500000);
// Use cookies to store the session ID on the client side
@ini_set('session.use_only_cookies', 1);
@@ -1759,7 +1763,7 @@ function shutdown() {
*/
function get_account_id() {
- if(intval($_SESSION['account_id']))
+ if(isset($_SESSION['account_id']))
return intval($_SESSION['account_id']);
if(App::$account)
@@ -2066,12 +2070,10 @@ function is_site_admin() {
if(! session_id())
return false;
- if($_SESSION['delegate'])
+ if(isset($_SESSION['delegate']))
return false;
- if((intval($_SESSION['authenticated']))
- && (is_array(App::$account))
- && (App::$account['account_roles'] & ACCOUNT_ROLE_ADMIN))
+ if(isset($_SESSION['authenticated']) && is_array(App::$account) && (App::$account['account_roles'] & ACCOUNT_ROLE_ADMIN))
return true;
return false;
@@ -2253,6 +2255,8 @@ function load_pdl() {
$n = 'mod_' . App::$module . '.pdl' ;
$u = App::$comanche->get_channel_id();
+ $s = '';
+
if($u)
$s = get_pconfig($u, 'system', $n);
if(! $s)
diff --git a/include/bbcode.php b/include/bbcode.php
index 6bb33671e..4580516a5 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -80,7 +80,7 @@ function tryoembed($match) {
return $match[0];
$html = oembed_format_object($o);
- return $html;
+ return $html;
}
@@ -92,7 +92,7 @@ function nakedoembed($match) {
// this function no longer performs oembed on naked links
// because they author may have created naked links intentionally.
// Now it just strips zids on naked links.
-
+
return str_replace($url,$strip_url,$match[0]);
}
@@ -283,7 +283,7 @@ function bb_svg($match) {
$params = str_replace(['<br>', '&quot;'], [ '', '"'],$match[1]);
$Text = str_replace([ '[',']' ], [ '<','>' ], $match[2]);
-
+
$output = '<svg' . (($params) ? $params : ' width="100%" height="480" ') . '>' . str_replace(['<br>', '&quot;', '&nbsp;'], [ '', '"', ' '],$Text) . '</svg>';
$purify = new SvgSanitizer();
@@ -641,24 +641,24 @@ function bb_definitionList($match) {
// The bbcode transformation will be:
// [*=term-text] description-text => </dd> <dt>term-text<dt><dd> description-text
- // then after all replacements have been made, the extra </dd> at the start of the
+ // then after all replacements have been made, the extra </dd> at the start of the
// first line can be removed. HTML5 allows the tag to be missing from the end of the last line.
// Using '(?<!\\\)' to allow backslash-escaped closing braces to appear in the term-text.
$closeDescriptionTag = "</dd>\n";
$eatLeadingSpaces = '(?:&nbsp;|[ \t])*'; // prevent spaces infront of [*= from adding another line to the previous element
$listElements = preg_replace('/^(\n|<br \/>)/', '', $match[2]); // ltrim the first newline
$listElements = preg_replace(
- '/' . $eatLeadingSpaces . '\[\*=([[:print:]]*?)(?<!\\\)\]/uism',
- $closeDescriptionTag . '<dt>$1</dt><dd>',
+ '/' . $eatLeadingSpaces . '\[\*=([[:print:]]*?)(?<!\\\)\]/uism',
+ $closeDescriptionTag . '<dt>$1</dt><dd>',
$listElements
);
// Unescape any \] inside the <dt> tags
$listElements = preg_replace_callback('/<dt>(.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements);
-
+
// Remove the extra </dd> at the start of the string, if there is one.
$firstOpenTag = strpos($listElements, '<dd>');
$firstCloseTag = strpos($listElements, $closeDescriptionTag);
- if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) {
+ if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) {
$listElements = preg_replace( '/<\/dd>/ism', '', $listElements, 1);
}
@@ -802,7 +802,7 @@ function bb_imgoptions($match) {
// $Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text);
// alt text cannot contain ']'
-
+
// [img|zmg=wwwxhhh float=left|right alt=alt text]url[/img|zmg]
$local_match = null;
@@ -818,7 +818,7 @@ function bb_imgoptions($match) {
if ($x) {
$alt = $matches[1];
}
-
+
$x = preg_match("/alt=\&quot\;(.*?)\&quot\;/ism", $attributes, $matches);
if ($x) {
$alt = $matches[1];
@@ -828,7 +828,7 @@ function bb_imgoptions($match) {
if ($x) {
$width = $matches[1];
}
-
+
$x = preg_match("/width=\&quot\;(.*?)\&quot\;/ism", $attributes, $matches);
if ($x) {
$width = $matches[1];
@@ -838,7 +838,7 @@ function bb_imgoptions($match) {
if ($x) {
$height = $matches[1];
}
-
+
$x = preg_match("/height=\&quot\;(.*?)\&quot\;/ism", $attributes, $matches);
if ($x) {
$height = $matches[1];
@@ -848,14 +848,14 @@ function bb_imgoptions($match) {
if ($x) {
$style = $matches[1];
}
-
+
$x = preg_match("/style=\&quot\;(.*?)\&quot\;/ism", $attributes, $matches);
if ($x) {
$style = $matches[1];
}
// legacy img options
-
+
if ($match[2] === '=') {
// pull out (optional) legacy size declarations first
if (preg_match("/([0-9]*)x([0-9]*)/ism",$match[3],$local_match)) {
@@ -873,16 +873,16 @@ function bb_imgoptions($match) {
$float = 'right';
$match[3] = substr($match[3],$n + 11);
}
-
+
// finally alt text which extends to the close of the tag
if ((! $alt) && ($n = strpos($match[3],'alt=') !== false)) {
$alt = substr($match[3],$n + 4);
}
// now assemble the resulting img tag from these components
-
+
$output = '<img ' . (($match[1] === 'z') ? 'class="zrl" loading="eager"' : '') . ' ';
-
+
if ($width) {
$style .= 'width: 100%; max-width: ' . $width . 'px; ';
}
@@ -892,13 +892,13 @@ function bb_imgoptions($match) {
if ($float) {
$style .= 'float: ' . $float . '; ';
}
-
+
$output .= (($style) ? 'style="' . $style . '" ' : '') . 'alt="' . htmlentities(($alt) ? $alt : t('Image/photo'),ENT_COMPAT,'UTF-8') . '" ';
$output .= 'src="' . $match[4] . '" >';
-
+
return $output;
-
+
}
function bb_code_protect($s) {
@@ -935,7 +935,7 @@ function bb_code_options($match) {
}
if($pre) {
return '<pre><code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code></pre>';
- } else {
+ } else {
return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>';
}
}
@@ -949,7 +949,7 @@ function bb_fixtable_lf($match) {
// remove extraneous whitespace between table element tags since newlines will all
// be converted to '<br />' and turn your neatly crafted tables into a whole lot of
// empty space.
-
+
$x = preg_replace("/\]\s+\[/",'][',$match[1]);
return '[table]' . $x . '[/table]';
@@ -991,7 +991,7 @@ function parseIdentityAwareHTML($Text) {
}
if (strpos($Text,'[pre]') !== false) {
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
- }
+ }
// process [observer] tags before we do anything else because we might
// be stripping away stuff that then doesn't need to be worked on anymore
@@ -1012,7 +1012,7 @@ function parseIdentityAwareHTML($Text) {
$Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text);
$Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text);
}
- }
+ }
// replace [observer.baseurl]
if ($observer) {
$s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">';
@@ -1033,11 +1033,11 @@ function parseIdentityAwareHTML($Text) {
$Text = str_replace('[observer.webname]','',$Text);
$Text = str_replace('[observer.photo]','', $Text);
}
-
+
$Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text);
-
- // Unhide all [noparse] contained bbtags unspacefying them
+
+ // Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
if (strpos($Text,'[noparse]') !== false) {
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text);
@@ -1251,7 +1251,7 @@ function bbcode($Text, $options = []) {
$Text = preg_replace("/\[map\]/", '<div class="map"></div>', $Text);
}
}
-
+
// Check for bold text
if (strpos($Text,'[b]') !== false) {
$Text = preg_replace("(\[b\](.*?)\[\/b\])ism", '<strong>$1</strong>', $Text);
@@ -1377,8 +1377,8 @@ function bbcode($Text, $options = []) {
$Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>', $Text);
// [dl] tags have an optional [dl terms="bi"] form where bold/italic/underline/mono/large
- // etc. style may be specified for the "terms" in the definition list. The quotation marks
- // are also optional. The regex looks intimidating, but breaks down as:
+ // etc. style may be specified for the "terms" in the definition list. The quotation marks
+ // are also optional. The regex looks intimidating, but breaks down as:
// "[dl" <optional-whitespace> <optional-termStyles> "]" <matchGroup2> "[/dl]"
// where optional-termStyles are: "terms=" <optional-quote> <matchGroup1> <optional-quote>
$Text = preg_replace_callback('/\[dl[[:space:]]*(?:terms=(?:&quot;|")?([a-zA-Z]+)(?:&quot;|")?)?\](.*?)\[\/dl\]/ism', 'bb_definitionList', $Text);
@@ -1417,7 +1417,7 @@ function bbcode($Text, $options = []) {
if(strpos($Text,'[/summary]') !== false) {
- $Text = preg_replace_callback("/^(.*?)\[summary\](.*?)\[\/summary\](.*?)$/ism", 'bb_summary', $Text);
+ $Text = preg_replace_callback("/^(.*?)\[summary\](.*?)\[\/summary\](.*?)$/is", 'bb_summary', $Text);
}
// Check for [spoiler] text
@@ -1564,7 +1564,7 @@ function bbcode($Text, $options = []) {
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// Replace the event-start section with the entire formatted event. The other bbcode is stripped.
- // Summary (e.g. title) is required, earlier revisions only required description (in addition to
+ // Summary (e.g. title) is required, earlier revisions only required description (in addition to
// start which is always required). Allow desc with a missing summary for compatibility.
if ((x($ev,'desc') || x($ev,'summary')) && x($ev,'dtstart')) {
@@ -1573,7 +1573,7 @@ function bbcode($Text, $options = []) {
$sub = str_replace('$',"\0",$sub);
- $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
+ $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
$Text = preg_replace("/\[event\](.*?)\[\/event\]/ism",'',$Text);
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
@@ -1588,7 +1588,7 @@ function bbcode($Text, $options = []) {
}
- // Unhide all [noparse] contained bbtags unspacefying them
+ // Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
if (strpos($Text,'[noparse]') !== false) {
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text);
diff --git a/include/help.php b/include/help.php
index ebf1ccc08..38facb04a 100644
--- a/include/help.php
+++ b/include/help.php
@@ -285,6 +285,7 @@ function load_context_help() {
$path = App::$cmd;
$args = App::$argv;
$lang = App::$language;
+ $context_help = '';
if(! isset($lang) || !is_dir('doc/context/' . $lang . '/')) {
$lang = 'en';
diff --git a/include/nav.php b/include/nav.php
index b2a061661..1ad8dad58 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -14,39 +14,41 @@ function nav($template = 'default') {
*
*/
- if(!(x(App::$page,'nav')))
- App::$page['nav'] = '';
-
+ App::$page['nav'] = App::$page['nav'] ?? '';
+ App::$page['htmlhead'] = App::$page['htmlhead'] ?? '';
App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acl' . '\');});</script>';
-
$is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false);
+ $observer = [];
+ $sitelocation = '';
- if(local_channel()) {
- $channel = App::get_channel();
+ if (local_channel()) {
+ $channel = App::get_channel();
$observer = App::get_observer();
- $prof = q("select id from profile where uid = %d and is_default = 1",
+
+ $prof = q("select id from profile where uid = %d and is_default = 1",
intval($channel['channel_id'])
);
- if(! $_SESSION['delegate']) {
+ if (empty($_SESSION['delegate'])) {
$chans = q("select channel_name, channel_id from channel where channel_account_id = %d and channel_removed = 0 order by channel_name ",
intval(get_account_id())
);
}
$sitelocation = (($is_owner) ? '' : App::$profile['reddress']);
}
- elseif(remote_channel()) {
- $observer = App::get_observer();
+ elseif (remote_channel()) {
+ $observer = App::get_observer();
$sitelocation = ((App::$profile['reddress']) ? App::$profile['reddress'] : '@' . App::get_hostname());
}
require_once('include/conversation.php');
- $nav_apps = [];
- $navbar_apps = [];
+ $nav_apps = [];
+ $navbar_apps = [];
$channel_apps = [];
-
- $channel_apps[] = channel_apps($is_owner, App::$profile['channel_address']);
+
+ if (isset(App::$profile['channel_address']))
+ $channel_apps[] = channel_apps($is_owner, App::$profile['channel_address']);
/**
@@ -55,117 +57,121 @@ function nav($template = 'default') {
*
*/
- $banner = get_config('system','banner');
+ $banner = get_config('system', 'banner');
- if($banner === false)
- $banner = get_config('system','sitename');
-
- call_hooks('get_banner',$banner);
+ if ($banner === false)
+ $banner = get_config('system', 'sitename');
- App::$page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
+ call_hooks('get_banner', $banner);
+
+ App::$page['header'] = App::$page['header'] ?? '';
+ App::$page['header'] .= replace_macros(get_markup_template('hdr.tpl'), [
//we could additionally use this to display important system notifications e.g. for updates
- ));
+ ]);
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = [];
- if(can_view_public_stream())
+ if (can_view_public_stream())
$nav['pubs'] = true;
/**
* Display login or logout
- */
+ */
- $nav['usermenu'] = [];
- $userinfo = null;
+ $nav['usermenu'] = [];
$nav['loginmenu'] = [];
+ $userinfo = [];
- if($observer) {
+ if ($observer) {
$userinfo = [
- 'icon' => $observer['xchan_photo_m'].'?rev='.strtotime($observer['xchan_photo_date']),
+ 'icon' => $observer['xchan_photo_m'] . '?rev=' . strtotime($observer['xchan_photo_date']),
'name' => $observer['xchan_addr'],
];
}
- elseif(! $_SESSION['authenticated']) {
+ elseif (empty($_SESSION['authenticated'])) {
$nav['remote_login'] = remote_login();
- $nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'),'rmagic_nav_btn');
+ $nav['loginmenu'][] = ['rmagic', t('Remote authentication'), '', t('Click to authenticate to your home hub'), 'rmagic_nav_btn'];
}
- if(local_channel()) {
+ if (local_channel()) {
- if(! $_SESSION['delegate']) {
- $nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage your channels'),'manage_nav_btn');
- }
- if(Apps::system_app_installed(local_channel(), 'Privacy Groups'))
- $nav['group'] = array('group', t('Privacy Groups'),"", t('Manage your privacy groups'),'group_nav_btn');
+ if (empty($_SESSION['delegate'])) {
+ $nav['manage'] = ['manage', t('Channel Manager'), "", t('Manage your channels'), 'manage_nav_btn'];
+ }
+ if (Apps::system_app_installed(local_channel(), 'Privacy Groups'))
+ $nav['group'] = ['group', t('Privacy Groups'), "", t('Manage your privacy groups'), 'group_nav_btn'];
- $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn');
+ $nav['settings'] = ['settings', t('Settings'), "", t('Account/Channel Settings'), 'settings_nav_btn'];
-
- if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select'))
+
+ if ($chans && count($chans) > 1 && feature_enabled(local_channel(), 'nav_channel_select'))
$nav['channels'] = $chans;
- $nav['logout'] = ['logout',t('Logout'), "", t('End this session'),'logout_nav_btn'];
-
+ $nav['logout'] = ['logout', t('Logout'), "", t('End this session'), 'logout_nav_btn'];
+
// user menu
- $nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), ((\App::$nav_sel['raw_name'] == 'Profile') ? 'active' : ''), t('Your profile page'),'profile_nav_btn'];
+ $nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), ((App::$nav_sel['raw_name'] == 'Profile') ? 'active' : ''), t('Your profile page'), 'profile_nav_btn'];
- if(feature_enabled(local_channel(),'multi_profiles'))
- $nav['usermenu'][] = ['profiles', t('Edit Profiles'), ((\App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : '') , t('Manage/Edit profiles'),'profiles_nav_btn'];
+ if (feature_enabled(local_channel(), 'multi_profiles'))
+ $nav['usermenu'][] = ['profiles', t('Edit Profiles'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Manage/Edit profiles'), 'profiles_nav_btn'];
else
- $nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'), ((\App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Edit your profile'),'profiles_nav_btn'];
+ $nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Edit your profile'), 'profiles_nav_btn'];
}
else {
- if(! get_account_id()) {
- if(App::$module === 'channel') {
- $nav['login'] = login(true,'main-login',false,false);
- $nav['loginmenu'][] = ['login',t('Login'),'',t('Sign in'),''];
+ if (!get_account_id()) {
+ if (App::$module === 'channel') {
+ $nav['login'] = login(true, 'main-login', false, false);
+ $nav['loginmenu'][] = ['login', t('Login'), '', t('Sign in'), ''];
}
else {
- $nav['login'] = login(true,'main-login',false,false);
- $nav['loginmenu'][] = ['login',t('Login'),'',t('Sign in'),'login_nav_btn'];
+ $nav['login'] = login(true, 'main-login', false, false);
+ $nav['loginmenu'][] = ['login', t('Login'), '', t('Sign in'), 'login_nav_btn'];
+
App::$page['content'] .= replace_macros(get_markup_template('nav_login.tpl'),
- [
- '$nav' => $nav,
+ [
+ '$nav' => $nav,
'userinfo' => $userinfo
]
);
}
}
else
- $nav['alogout'] = ['logout',t('Logout'), "", t('End this session'),'logout_nav_btn'];
+ $nav['alogout'] = ['logout', t('Logout'), "", t('End this session'), 'logout_nav_btn'];
}
$my_url = get_my_url();
- if(! $my_url) {
+ if (!$my_url) {
$observer = App::get_observer();
- $my_url = (($observer) ? $observer['xchan_url'] : '');
+ $my_url = (($observer) ? $observer['xchan_url'] : '');
}
$homelink_arr = parse_url($my_url);
- $homelink = $homelink_arr['scheme'] . '://' . $homelink_arr['host'];
+ $scheme = $homelink_arr['scheme'] ?? '';
+ $host = $homelink_arr['host'] ?? '';
+ $homelink = $scheme . '://' . $host;
- if(! $is_owner) {
- $nav['rusermenu'] = array(
+ if (!$is_owner) {
+ $nav['rusermenu'] = [
$homelink,
t('Take me home'),
'logout',
((local_channel()) ? t('Logout') : t('Log me out of this site'))
- );
+ ];
}
- if(((get_config('system','register_policy') == REGISTER_OPEN) || (get_config('system','register_policy') == REGISTER_APPROVE)) && (! $_SESSION['authenticated']))
- $nav['register'] = ['register',t('Register'), "", t('Create an account'),'register_nav_btn'];
+ if (((get_config('system', 'register_policy') == REGISTER_OPEN) || (get_config('system', 'register_policy') == REGISTER_APPROVE)) && (empty($_SESSION['authenticated'])))
+ $nav['register'] = ['register', t('Register'), "", t('Create an account'), 'register_nav_btn'];
- if(! get_config('system','hide_help')) {
- $help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
- $context_help = '';
- $enable_context_help = ((intval(get_config('system','enable_context_help')) === 1 || get_config('system','enable_context_help') === false) ? true : false);
- if($enable_context_help === true) {
+ if (!get_config('system', 'hide_help')) {
+ $help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
+ $context_help = '';
+ $enable_context_help = ((intval(get_config('system', 'enable_context_help')) === 1 || get_config('system', 'enable_context_help') === false) ? true : false);
+ if ($enable_context_help === true) {
require_once('include/help.php');
$context_help = load_context_help();
//point directly to /help if $context_help is empty - this can be removed once we have context help for all modules
@@ -174,7 +180,7 @@ function nav($template = 'default') {
$nav['help'] = [$help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help];
}
- switch(App::$module) {
+ switch (App::$module) {
case 'network':
$search_form_action = 'network';
break;
@@ -190,32 +196,32 @@ function nav($template = 'default') {
/**
* Admin page
*/
- if (is_site_admin()) {
- $nav['admin'] = array('admin/', t('Admin'), "", t('Site Setup and Configuration'),'admin_nav_btn');
- }
+ if (is_site_admin()) {
+ $nav['admin'] = ['admin/', t('Admin'), "", t('Site Setup and Configuration'), 'admin_nav_btn'];
+ }
- $x = array('nav' => $nav, 'usermenu' => $userinfo );
+ $x = ['nav' => $nav, 'usermenu' => $userinfo];
call_hooks('nav', $x);
- // Not sure the best place to put this on the page. So I'm implementing it but leaving it
- // turned off until somebody discovers this and figures out a good location for it.
+ // Not sure the best place to put this on the page. So I'm implementing it but leaving it
+ // turned off until somebody discovers this and figures out a good location for it.
$powered_by = '';
- $url = '';
+ $url = '';
$settings_url = '';
- if(App::$profile_uid && App::$nav_sel['raw_name']) {
+ if (App::$profile_uid && App::$nav_sel['raw_name']) {
$active_app = q("SELECT app_url FROM app WHERE app_channel = %d AND app_name = '%s' LIMIT 1",
intval(App::$profile_uid),
dbesc(App::$nav_sel['raw_name'])
);
- if($active_app) {
- if(strpos($active_app[0]['app_url'], ',')) {
+ if ($active_app) {
+ if (strpos($active_app[0]['app_url'], ',')) {
$urls = explode(',', $active_app[0]['app_url']);
- $url = trim($urls[0]);
- if($is_owner)
+ $url = trim($urls[0]);
+ if ($is_owner)
$settings_url = trim($urls[1]);
}
else {
@@ -224,42 +230,39 @@ function nav($template = 'default') {
}
}
- if(! $settings_url && isset(App::$nav_sel['settings_url']))
+ if (!$settings_url && isset(App::$nav_sel['settings_url']))
$settings_url = App::$nav_sel['settings_url'];
$pinned_list = [];
- $syslist = [];
//app bin
- if($is_owner) {
- if(get_pconfig(local_channel(), 'system','import_system_apps') !== datetime_convert('UTC','UTC','now','Y-m-d')) {
+ if ($is_owner) {
+ if (get_pconfig(local_channel(), 'system', 'import_system_apps') !== datetime_convert('UTC', 'UTC', 'now', 'Y-m-d')) {
Apps::import_system_apps();
- set_pconfig(local_channel(), 'system','import_system_apps', datetime_convert('UTC','UTC','now','Y-m-d'));
+ set_pconfig(local_channel(), 'system', 'import_system_apps', datetime_convert('UTC', 'UTC', 'now', 'Y-m-d'));
}
- if(get_pconfig(local_channel(), 'system','force_import_system_apps') !== STD_VERSION) {
+ if (get_pconfig(local_channel(), 'system', 'force_import_system_apps') !== STD_VERSION) {
Apps::import_system_apps();
- set_pconfig(local_channel(), 'system','force_import_system_apps', STD_VERSION);
+ set_pconfig(local_channel(), 'system', 'force_import_system_apps', STD_VERSION);
}
- $list = Apps::app_list(local_channel(), false, [ 'nav_pinned_app' ]);
- if($list) {
- foreach($list as $li) {
+ $list = Apps::app_list(local_channel(), false, ['nav_pinned_app']);
+ if ($list) {
+ foreach ($list as $li) {
$pinned_list[] = Apps::app_encode($li);
}
}
Apps::translate_system_apps($pinned_list);
- usort($pinned_list,'Zotlabs\\Lib\\Apps::app_name_compare');
-
- $pinned_list = Apps::app_order(local_channel(),$pinned_list, 'nav_pinned_app');
-
+ usort($pinned_list, 'Zotlabs\\Lib\\Apps::app_name_compare');
+ $pinned_list = Apps::app_order(local_channel(), $pinned_list, 'nav_pinned_app');
$syslist = [];
- $list = Apps::app_list(local_channel(), false, [ 'nav_featured_app' ]);
+ $list = Apps::app_list(local_channel(), false, ['nav_featured_app']);
- if($list) {
- foreach($list as $li) {
+ if ($list) {
+ foreach ($list as $li) {
$syslist[] = Apps::app_encode($li);
}
}
@@ -270,85 +273,83 @@ function nav($template = 'default') {
$syslist = Apps::get_system_apps(true);
}
- usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
-
- $syslist = Apps::app_order(local_channel(),$syslist, 'nav_featured_app');
+ usort($syslist, 'Zotlabs\\Lib\\Apps::app_name_compare');
+ $syslist = Apps::app_order(local_channel(), $syslist, 'nav_featured_app');
- if($pinned_list) {
- foreach($pinned_list as $app) {
- if(\App::$nav_sel['name'] == $app['name'])
+ if ($pinned_list) {
+ foreach ($pinned_list as $app) {
+ if (App::$nav_sel['name'] == $app['name'])
$app['active'] = true;
- if($is_owner) {
- $navbar_apps[] = Apps::app_render($app,'navbar');
+ if ($is_owner) {
+ $navbar_apps[] = Apps::app_render($app, 'navbar');
}
- elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) {
- $navbar_apps[] = Apps::app_render($app,'navbar');
+ elseif (!$is_owner && strpos($app['requires'], 'local_channel') === false) {
+ $navbar_apps[] = Apps::app_render($app, 'navbar');
}
}
}
-
- if($syslist) {
- foreach($syslist as $app) {
- if(\App::$nav_sel['name'] == $app['name'])
+ if ($syslist) {
+ foreach ($syslist as $app) {
+ if (isset(App::$nav_sel['name']) && App::$nav_sel['name'] == $app['name'])
$app['active'] = true;
- if($is_owner) {
- $nav_apps[] = Apps::app_render($app,'nav');
+ if ($is_owner) {
+ $nav_apps[] = Apps::app_render($app, 'nav');
}
- elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) {
- $nav_apps[] = Apps::app_render($app,'nav');
+ elseif (!$is_owner && isset($app['requires']) && strpos($app['requires'], 'local_channel') === false) {
+ $nav_apps[] = Apps::app_render($app, 'nav');
}
}
}
- $c = theme_include('navbar_' . purify_filename($template) . '.css');
+ $c = theme_include('navbar_' . purify_filename($template) . '.css');
$tpl = get_markup_template('navbar_' . purify_filename($template) . '.tpl');
- if($c && $tpl) {
+ if ($c && $tpl) {
head_add_css('navbar_' . $template . '.css');
}
- if(! $tpl) {
+ if (!$tpl) {
$tpl = get_markup_template('navbar_default.tpl');
}
- App::$page['nav'] .= replace_macros($tpl, array(
- '$baseurl' => z_root(),
- '$fulldocs' => t('Help'),
- '$sitelocation' => $sitelocation,
- '$nav' => $x['nav'],
- '$banner' => $banner,
+ App::$page['nav'] .= replace_macros($tpl, [
+ '$baseurl' => z_root(),
+ '$fulldocs' => t('Help'),
+ '$sitelocation' => $sitelocation,
+ '$nav' => $x['nav'],
+ '$banner' => $banner,
'$emptynotifications' => t('Loading'),
- '$userinfo' => $x['usermenu'],
- '$localuser' => local_channel(),
- '$is_owner' => $is_owner,
- '$sel' => App::$nav_sel,
- '$powered_by' => $powered_by,
- '$help' => t('@name, !forum, #tag, ?doc, content'),
- '$pleasewait' => t('Please wait...'),
- '$nav_apps' => $nav_apps,
- '$navbar_apps' => $navbar_apps,
- '$channel_menu' => get_pconfig(App::$profile_uid,'system','channel_menu',get_config('system','channel_menu')),
- '$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''),
- '$channel_apps' => $channel_apps,
- '$addapps' => t('Add Apps'),
- '$orderapps' => t('Arrange Apps'),
- '$sysapps_toggle' => t('Toggle System Apps'),
- '$url' => (($url) ? $url : z_root() . '/' . App::$cmd),
- '$settings_url' => $settings_url
- ));
-
- if(x($_SESSION, 'reload_avatar') && $observer) {
- // The avatar has been changed on the server but the browser doesn't know that,
+ '$userinfo' => $x['usermenu'],
+ '$localuser' => local_channel(),
+ '$is_owner' => $is_owner,
+ '$sel' => App::$nav_sel,
+ '$powered_by' => $powered_by,
+ '$help' => t('@name, !forum, #tag, ?doc, content'),
+ '$pleasewait' => t('Please wait...'),
+ '$nav_apps' => $nav_apps,
+ '$navbar_apps' => $navbar_apps,
+ '$channel_menu' => get_pconfig(App::$profile_uid, 'system', 'channel_menu', get_config('system', 'channel_menu')),
+ '$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''),
+ '$channel_apps' => $channel_apps,
+ '$addapps' => t('Add Apps'),
+ '$orderapps' => t('Arrange Apps'),
+ '$sysapps_toggle' => t('Toggle System Apps'),
+ '$url' => (($url) ? $url : z_root() . '/' . App::$cmd),
+ '$settings_url' => $settings_url
+ ]);
+
+ if (x($_SESSION, 'reload_avatar') && $observer) {
+ // The avatar has been changed on the server but the browser doesn't know that,
// force the browser to reload the image from the server instead of its cache.
$tpl = get_markup_template('force_image_reload.tpl');
- App::$page['nav'] .= replace_macros($tpl, array(
+ App::$page['nav'] .= replace_macros($tpl, [
'$imgUrl' => $observer['xchan_photo_m']
- ));
+ ]);
unset($_SESSION['reload_avatar']);
}
@@ -358,9 +359,9 @@ function nav($template = 'default') {
/*
* Set a menu item in navbar as selected
- *
+ *
*/
-function nav_set_selected($raw_name, $settings_url = ''){
+function nav_set_selected($raw_name, $settings_url = '') {
App::$nav_sel['raw_name'] = $raw_name;
$item = ['name' => $raw_name];
@@ -368,7 +369,7 @@ function nav_set_selected($raw_name, $settings_url = ''){
App::$nav_sel['name'] = $item['name'];
- if($settings_url)
+ if ($settings_url)
App::$nav_sel['settings_url'] = z_root() . '/' . $settings_url;
}
@@ -376,20 +377,20 @@ function channel_apps($is_owner = false, $nickname = null) {
// Don't provide any channel apps if we're running as the sys channel
- if(App::$is_sys)
+ if (App::$is_sys)
return '';
$channel = App::get_channel();
- if($channel && is_null($nickname))
+ if ($channel && is_null($nickname))
$nickname = $channel['channel_address'];
- $uid = ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : local_channel());
+ $uid = ((isset(App::$profile['profile_uid'])) ? App::$profile['profile_uid'] : local_channel());
- if(! get_pconfig($uid, 'system', 'channelapps','1'))
- return;
+ if (!get_pconfig($uid, 'system', 'channelapps', '1'))
+ return;
- if($uid == local_channel()) {
+ if ($uid == local_channel()) {
return;
}
else {
@@ -410,7 +411,7 @@ function channel_apps($is_owner = false, $nickname = null) {
$has_webpages = (($r) ? true : false);
- if(x($_GET, 'tab'))
+ if (x($_GET, 'tab'))
$tab = notags(trim($_GET['tab']));
$url = z_root() . '/channel/' . $nickname;
@@ -427,7 +428,7 @@ function channel_apps($is_owner = false, $nickname = null) {
],
];
- $p = get_all_perms($uid,get_observer_hash());
+ $p = get_all_perms($uid, get_observer_hash());
if ($p['view_profile']) {
$tabs[] = [
@@ -458,7 +459,7 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
- if($p['view_stream'] && $cal_link) {
+ if ($p['view_stream'] && $cal_link) {
$tabs[] = [
'label' => t('Calendar'),
'url' => z_root() . $cal_link,
@@ -470,13 +471,13 @@ function channel_apps($is_owner = false, $nickname = null) {
}
- if ($p['chat'] && Apps::system_app_installed($uid,'Chatrooms')) {
+ if ($p['chat'] && Apps::system_app_installed($uid, 'Chatrooms')) {
$has_chats = Chatroom::list_count($uid);
if ($has_chats) {
$tabs[] = [
'label' => t('Chatrooms'),
'url' => z_root() . '/chat/' . $nickname,
- 'sel' => ((argv(0) == 'chat') ? 'active' : '' ),
+ 'sel' => ((argv(0) == 'chat') ? 'active' : ''),
'title' => t('Chatrooms'),
'id' => 'chat-tab',
'icon' => 'comments-o'
@@ -484,7 +485,7 @@ function channel_apps($is_owner = false, $nickname = null) {
}
}
- $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
+ $has_bookmarks = menu_list_count(local_channel(), '', MENU_BOOKMARK) + menu_list_count(local_channel(), '', MENU_SYSTEM | MENU_BOOKMARK);
if ($is_owner && $has_bookmarks) {
$tabs[] = [
'label' => t('Bookmarks'),
@@ -496,10 +497,10 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
- if($p['view_pages'] && Apps::system_app_installed($uid, 'Cards')) {
+ if ($p['view_pages'] && Apps::system_app_installed($uid, 'Cards')) {
$tabs[] = [
'label' => t('Cards'),
- 'url' => z_root() . '/cards/' . $nickname ,
+ 'url' => z_root() . '/cards/' . $nickname,
'sel' => ((argv(0) == 'cards') ? 'active' : ''),
'title' => t('View Cards'),
'id' => 'cards-tab',
@@ -507,10 +508,10 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
- if($p['view_pages'] && Apps::system_app_installed($uid, 'Articles')) {
+ if ($p['view_pages'] && Apps::system_app_installed($uid, 'Articles')) {
$tabs[] = [
'label' => t('Articles'),
- 'url' => z_root() . '/articles/' . $nickname ,
+ 'url' => z_root() . '/articles/' . $nickname,
'sel' => ((argv(0) == 'articles') ? 'active' : ''),
'title' => t('View Articles'),
'id' => 'articles-tab',
@@ -519,7 +520,7 @@ function channel_apps($is_owner = false, $nickname = null) {
}
- if($has_webpages && Apps::system_app_installed($uid, 'Webpages')) {
+ if ($has_webpages && Apps::system_app_installed($uid, 'Webpages')) {
$tabs[] = [
'label' => t('Webpages'),
'url' => z_root() . '/page/' . $nickname . '/home',
@@ -529,7 +530,7 @@ function channel_apps($is_owner = false, $nickname = null) {
'icon' => 'newspaper-o'
];
}
-
+
if ($p['view_wiki'] && Apps::system_app_installed($uid, 'Wiki')) {
$tabs[] = [
@@ -542,11 +543,11 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
- $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
+ $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs];
- call_hooks('channel_apps', $arr);
+ call_hooks('channel_apps', $arr);
- return replace_macros(get_markup_template('profile_tabs.tpl'),
+ return replace_macros(get_markup_template('profile_tabs.tpl'),
[
'$tabs' => $arr['tabs'],
'$name' => App::$profile['channel_name'],
diff --git a/include/plugin.php b/include/plugin.php
index 269903373..5b041f228 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -929,8 +929,9 @@ function script_path() {
}
function head_add_js($src, $priority = 0) {
- if(! is_array(App::$js_sources[$priority]))
- App::$js_sources[$priority] = array();
+ if(isset(App::$js_sources[$priority]) && !is_array(App::$js_sources[$priority]))
+ App::$js_sources[$priority] = [];
+
App::$js_sources[$priority][] = $src;
}
diff --git a/include/security.php b/include/security.php
index 40905925f..066b1dcf4 100644
--- a/include/security.php
+++ b/include/security.php
@@ -18,6 +18,7 @@ function authenticate_success($user_record, $channel = null, $login_initial = fa
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
$lastlog_updated = false;
+ $uid_to_load = null;
if (x($user_record, 'account_id')) {
App::$account = $user_record;
diff --git a/include/zid.php b/include/zid.php
index e24b0035d..75414a691 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -58,7 +58,7 @@ function zid($s, $address = '') {
$mine_parsed = parse_url($mine);
$s_parsed = parse_url($s);
- if($mine_parsed['host'] === $s_parsed['host'])
+ if(isset($mine_parsed['host']) && isset($s_parsed['host']) && $mine_parsed['host'] === $s_parsed['host'])
$url_match = true;
if ($mine && $myaddr && (! $url_match))
@@ -209,21 +209,21 @@ function red_zrl_callback($matches) {
// Catch and exclude trailing punctuation
preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
$matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
-
+
$zrl = is_matrix_url($matches[2]);
-
+
$t = strip_zids($matches[2]);
if($t !== $matches[2]) {
$zrl = true;
$matches[2] = $t;
}
-
+
if($matches[1] === '#^')
$matches[1] = '';
-
+
if($zrl)
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
-
+
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
}
diff --git a/include/zot.php b/include/zot.php
index 84bf3f9b2..634561fa3 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1131,6 +1131,7 @@ function zot_process_response($hub, $arr, $outq) {
if(is_array($x) && array_key_exists('delivery_report',$x) && is_array($x['delivery_report'])) {
if(array_key_exists('iv',$x['delivery_report'])) {
+ $x['delivery_report']['encrypted'] = true;
$j = Crypto::unencapsulate($x['delivery_report'],get_config('system','prvkey'));
if($j) {
$x['delivery_report'] = json_decode($j,true);
@@ -1317,6 +1318,7 @@ function zot_import($arr, $sender_url) {
}
if(array_key_exists('iv', $data)) {
+ $data['encrypted'] = true;
$data = json_decode(Crypto::unencapsulate($data,get_config('system','prvkey')),true);
}
@@ -1345,6 +1347,7 @@ function zot_import($arr, $sender_url) {
$result = null;
if(array_key_exists('iv',$i['notify'])) {
+ $i['notify']['encrypted'] = true;
$i['notify'] = json_decode(Crypto::unencapsulate($i['notify'],get_config('system','prvkey')),true);
}