diff options
Diffstat (limited to 'boot.php')
-rwxr-xr-x | boot.php | 43 |
1 files changed, 30 insertions, 13 deletions
@@ -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 ); /** @@ -692,7 +692,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; @@ -703,7 +703,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; @@ -1769,7 +1769,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; @@ -1800,7 +1802,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; @@ -1825,6 +1829,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 @@ -1848,7 +1855,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; } @@ -1934,6 +1944,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); @@ -1949,6 +1963,9 @@ function is_windows() { function is_site_admin() { + if(! session_id()) + return false; + if($_SESSION['delegate']) return false; @@ -1969,6 +1986,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)) @@ -1987,7 +2007,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) { @@ -2010,6 +2030,7 @@ function load_contact_links($uid) { * * @return string */ + function build_querystring($params, $name = null) { $ret = ''; foreach($params as $key => $val) { @@ -2052,8 +2073,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)) @@ -2110,8 +2132,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' => ''); @@ -2132,13 +2152,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); } |