From 0919c1eb61ed0ae16810063aabcfd620a425b22a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 27 May 2016 16:09:44 -0700 Subject: check for session before querying session vars --- boot.php | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1c3938cb4..c3036b6d7 100755 --- a/boot.php +++ b/boot.php @@ -1768,7 +1768,9 @@ function get_account_id() { * @return int|bool channel_id or false */ function local_channel() { - if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'uid'))) + if(session_id() + && array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated'] + && array_key_exists('uid',$_SESSION) && intval($_SESSION['uid'])) return intval($_SESSION['uid']); return false; @@ -1799,7 +1801,9 @@ function local_user() { * @return string|bool visitor_id or false */ function remote_channel() { - if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) + if(session_id() + && array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated'] + && array_key_exists('visitor_id',$_SESSION) && intval($_SESSION['visitor_id'])) return $_SESSION['visitor_id']; return false; @@ -1824,6 +1828,9 @@ function remote_user() { * @param string $s Text to display */ function notice($s) { + if(! session_id()) + return; + if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array(); // ignore duplicated error messages which haven't yet been displayed @@ -1847,7 +1854,10 @@ function notice($s) { * @param string $s Text to display */ function info($s) { - if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); + if(! session_id()) + return; + if(! x($_SESSION, 'sysmsg_info')) + $_SESSION['sysmsg_info'] = array(); if(App::$interactive) $_SESSION['sysmsg_info'][] = $s; } @@ -1933,6 +1943,10 @@ function proc_run(){ * @brief Checks if we are running on M$ Windows. * * @return bool true if we run on M$ Windows + * + * It's possible you might be able to run on WAMP or XAMPP, and this + * has been accomplished, but is not officially supported. Good luck. + * */ function is_windows() { return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false); @@ -1948,6 +1962,9 @@ function is_windows() { function is_site_admin() { + if(! session_id()) + return false; + if($_SESSION['delegate']) return false; @@ -1968,6 +1985,9 @@ function is_site_admin() { */ function is_developer() { + if(! session_id()) + return false; + if((intval($_SESSION['authenticated'])) && (is_array(App::$account)) && (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER)) @@ -1986,7 +2006,7 @@ function load_contact_links($uid) { // logger('load_contact_links'); - $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ", + $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ", intval($uid) ); if($r) { @@ -2009,6 +2029,7 @@ function load_contact_links($uid) { * * @return string */ + function build_querystring($params, $name = null) { $ret = ''; foreach($params as $key => $val) { @@ -2051,8 +2072,9 @@ function dba_timer() { /** * @brief Returns xchan_hash from the observer. * - * @return string Empty if no observer, otherwise xchan_hash from observer + * @return empty string if no observer, otherwise xchan_hash from observer */ + function get_observer_hash() { $observer = App::get_observer(); if(is_array($observer)) @@ -2109,8 +2131,6 @@ function load_pdl(&$a) { App::$comanche = new Zotlabs\Render\Comanche(); - // require_once('include/comanche.php'); - if (! count(App::$layout)) { $arr = array('module' => App::$module, 'layout' => ''); @@ -2131,13 +2151,10 @@ function load_pdl(&$a) { App::$pdl = $s; } } - } function exec_pdl(&$a) { -// require_once('include/comanche.php'); - if(App::$pdl) { App::$comanche->parse(App::$pdl,1); } -- cgit v1.2.3 From ac4688eac087854bf8cb0c893d7a79052ad63a20 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 27 May 2016 23:57:47 -0700 Subject: allow objs to represent inventory --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index c3036b6d7..fec908ce0 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '1.7.1' ); define ( 'ZOT_REVISION', 1.1 ); -define ( 'DB_UPDATE_VERSION', 1168 ); +define ( 'DB_UPDATE_VERSION', 1169 ); /** @@ -691,7 +691,7 @@ function startup() { class ZotlabsAutoloader { static public function loader($className) { $filename = str_replace('\\', '/', $className) . ".php"; - if (file_exists($filename)) { + if(file_exists($filename)) { include($filename); if (class_exists($className)) { return TRUE; @@ -702,7 +702,7 @@ class ZotlabsAutoloader { if(! $arr[0]) $arr = array_shift($arr); $filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php"); - if (file_exists($filename)) { + if(file_exists($filename)) { include($filename); if (class_exists($className)) { return TRUE; -- cgit v1.2.3