aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-27 16:09:44 -0700
committerredmatrix <git@macgirvin.com>2016-05-27 16:09:44 -0700
commit0919c1eb61ed0ae16810063aabcfd620a425b22a (patch)
tree7926a44cd55d1774dfeaec437fa57cc40e3a9c81 /boot.php
parent551cf8ee9413c5c57e7b71d6016466e598636900 (diff)
downloadvolse-hubzilla-0919c1eb61ed0ae16810063aabcfd620a425b22a.tar.gz
volse-hubzilla-0919c1eb61ed0ae16810063aabcfd620a425b22a.tar.bz2
volse-hubzilla-0919c1eb61ed0ae16810063aabcfd620a425b22a.zip
check for session before querying session vars
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php37
1 files changed, 27 insertions, 10 deletions
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);
}