added missing spaces/curly braces

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 14:28:43 +01:00 committed by Roland Haeder
parent ddb5a8ea78
commit f173322539
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
4 changed files with 317 additions and 237 deletions

458
boot.php

File diff suppressed because it is too large Load diff

View file

@ -28,17 +28,17 @@ $a->backend = false;
/** /**
* *
* Load the configuration file which contains our DB credentials. * Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in installation mode. * Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode.
* *
*/ */
$install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true); $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
@include(".htconfig.php"); // Only load config if found, don't surpress errors
if (!$install) {
include(".htconfig.php");
}
/** /**
* *
@ -48,7 +48,7 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
require_once("include/dba.php"); require_once("include/dba.php");
if(!$install) { if (!$install) {
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install); $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
@ -117,12 +117,12 @@ if (x($_SESSION,'authenticated') && !x($_SESSION,'language')) {
if (dbm::is_result($r)) $_SESSION['language'] = $r[0]['language']; if (dbm::is_result($r)) $_SESSION['language'] = $r[0]['language'];
} }
if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { if ((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
$lang = $_SESSION['language']; $lang = $_SESSION['language'];
load_translation_table($lang); load_translation_table($lang);
} }
if((x($_GET,'zrl')) && (!$install && !$maintenance)) { if ((x($_GET,'zrl')) && (!$install && !$maintenance)) {
// Only continue when the given profile link seems valid // Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters // Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") AND if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") AND
@ -223,7 +223,7 @@ if ((local_user()) || (! $privateapps === "1")) {
* further processing. * further processing.
*/ */
if(strlen($a->module)) { if (strlen($a->module)) {
/** /**
* *
@ -233,12 +233,14 @@ if(strlen($a->module)) {
*/ */
// Compatibility with the Android Diaspora client // Compatibility with the Android Diaspora client
if ($a->module == "stream") if ($a->module == "stream") {
$a->module = "network"; $a->module = "network";
}
// Compatibility with the Firefox App // Compatibility with the Firefox App
if (($a->module == "users") AND ($a->cmd == "users/sign_in")) if (($a->module == "users") AND ($a->cmd == "users/sign_in")) {
$a->module = "login"; $a->module = "login";
}
$privateapps = get_config('config','private_addons'); $privateapps = get_config('config','private_addons');
@ -246,11 +248,11 @@ if(strlen($a->module)) {
//Check if module is an app and if public access to apps is allowed or not //Check if module is an app and if public access to apps is allowed or not
if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") { if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
info( t("You must be logged in to use addons. ")); info( t("You must be logged in to use addons. "));
} } else {
else {
include_once("addon/{$a->module}/{$a->module}.php"); include_once("addon/{$a->module}/{$a->module}.php");
if(function_exists($a->module . '_module')) if (function_exists($a->module . '_module')) {
$a->module_loaded = true; $a->module_loaded = true;
}
} }
} }
@ -320,29 +322,29 @@ if (!$install && !$maintenance) {
* Call module functions * Call module functions
*/ */
if($a->module_loaded) { if ($a->module_loaded) {
$a->page['page_title'] = $a->module; $a->page['page_title'] = $a->module;
$placeholder = ''; $placeholder = '';
if(function_exists($a->module . '_init')) { if (function_exists($a->module . '_init')) {
call_hooks($a->module . '_mod_init', $placeholder); call_hooks($a->module . '_mod_init', $placeholder);
$func = $a->module . '_init'; $func = $a->module . '_init';
$func($a); $func($a);
} }
if(function_exists(str_replace('-','_',current_theme()) . '_init')) { if (function_exists(str_replace('-','_',current_theme()) . '_init')) {
$func = str_replace('-','_',current_theme()) . '_init'; $func = str_replace('-','_',current_theme()) . '_init';
$func($a); $func($a);
} }
// elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) { // elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
// require_once("view/theme/".$a->theme_info["extends"]."/theme.php"); // require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
// if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) { // if (function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
// $func = str_replace('-','_',$a->theme_info["extends"]) . '_init'; // $func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
// $func($a); // $func($a);
// } // }
// } // }
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error) if (($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
&& (function_exists($a->module . '_post')) && (function_exists($a->module . '_post'))
&& (! x($_POST,'auth-params'))) { && (! x($_POST,'auth-params'))) {
call_hooks($a->module . '_mod_post', $_POST); call_hooks($a->module . '_mod_post', $_POST);
@ -350,13 +352,13 @@ if($a->module_loaded) {
$func($a); $func($a);
} }
if((! $a->error) && (function_exists($a->module . '_afterpost'))) { if ((! $a->error) && (function_exists($a->module . '_afterpost'))) {
call_hooks($a->module . '_mod_afterpost',$placeholder); call_hooks($a->module . '_mod_afterpost',$placeholder);
$func = $a->module . '_afterpost'; $func = $a->module . '_afterpost';
$func($a); $func($a);
} }
if((! $a->error) && (function_exists($a->module . '_content'))) { if ((! $a->error) && (function_exists($a->module . '_content'))) {
$arr = array('content' => $a->page['content']); $arr = array('content' => $a->page['content']);
call_hooks($a->module . '_mod_content', $arr); call_hooks($a->module . '_mod_content', $arr);
$a->page['content'] = $arr['content']; $a->page['content'] = $arr['content'];
@ -366,7 +368,7 @@ if($a->module_loaded) {
$a->page['content'] .= $arr['content']; $a->page['content'] .= $arr['content'];
} }
if(function_exists(str_replace('-','_',current_theme()) . '_content_loaded')) { if (function_exists(str_replace('-','_',current_theme()) . '_content_loaded')) {
$func = str_replace('-','_',current_theme()) . '_content_loaded'; $func = str_replace('-','_',current_theme()) . '_content_loaded';
$func($a); $func($a);
} }
@ -392,18 +394,20 @@ $a->init_page_end();
// If you're just visiting, let javascript take you home // If you're just visiting, let javascript take you home
if(x($_SESSION,'visitor_home')) if (x($_SESSION,'visitor_home')) {
$homebase = $_SESSION['visitor_home']; $homebase = $_SESSION['visitor_home'];
elseif(local_user()) } elseif (local_user()) {
$homebase = 'profile/' . $a->user['nickname']; $homebase = 'profile/' . $a->user['nickname'];
}
if(isset($homebase)) if (isset($homebase)) {
$a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>'; $a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>';
}
// now that we've been through the module content, see if the page reported // 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. // a permission problem and if so, a 403 response would seem to be in order.
if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) { if (stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.')); header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
} }
@ -413,13 +417,13 @@ if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) {
* *
*/ */
/*if(x($_SESSION,'sysmsg')) { /*if (x($_SESSION,'sysmsg')) {
$a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n" $a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
. ((x($a->page,'content')) ? $a->page['content'] : ''); . ((x($a->page,'content')) ? $a->page['content'] : '');
$_SESSION['sysmsg']=""; $_SESSION['sysmsg']="";
unset($_SESSION['sysmsg']); unset($_SESSION['sysmsg']);
} }
if(x($_SESSION,'sysmsg_info')) { if (x($_SESSION,'sysmsg_info')) {
$a->page['content'] = "<div id=\"sysmsg_info\" class=\"info-message\">{$_SESSION['sysmsg_info']}</div>\r\n" $a->page['content'] = "<div id=\"sysmsg_info\" class=\"info-message\">{$_SESSION['sysmsg_info']}</div>\r\n"
. ((x($a->page,'content')) ? $a->page['content'] : ''); . ((x($a->page,'content')) ? $a->page['content'] : '');
$_SESSION['sysmsg_info']=""; $_SESSION['sysmsg_info']="";
@ -437,7 +441,7 @@ call_hooks('page_end', $a->page['content']);
* *
*/ */
if($a->module != 'install' && $a->module != 'maintenance') { if ($a->module != 'install' && $a->module != 'maintenance') {
nav($a); nav($a);
} }
@ -445,27 +449,27 @@ if($a->module != 'install' && $a->module != 'maintenance') {
* Add a "toggle mobile" link if we're using a mobile device * Add a "toggle mobile" link if we're using a mobile device
*/ */
if($a->is_mobile || $a->is_tablet) { if ($a->is_mobile || $a->is_tablet) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) { if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$link = 'toggle_mobile?address=' . curPageURL(); $link = 'toggle_mobile?address=' . curPageURL();
} } else {
else {
$link = 'toggle_mobile?off=1&address=' . curPageURL(); $link = 'toggle_mobile?off=1&address=' . curPageURL();
} }
$a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array( $a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
'$toggle_link' => $link, '$toggle_link' => $link,
'$toggle_text' => t('toggle mobile') '$toggle_text' => t('toggle mobile')
)); ));
} }
/** /**
* Build the page - now that we have all the components * Build the page - now that we have all the components
*/ */
if(!$a->theme['stylesheet']) if (!$a->theme['stylesheet']) {
$stylesheet = current_theme_url(); $stylesheet = current_theme_url();
else } else {
$stylesheet = $a->theme['stylesheet']; $stylesheet = $a->theme['stylesheet'];
}
$a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']); $a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet)); //$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
@ -499,8 +503,9 @@ if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
echo substr($target->saveHTML(), 6, -8); echo substr($target->saveHTML(), 6, -8);
if (!$a->is_backend()) if (!$a->is_backend()) {
session_write_close(); session_write_close();
}
exit; exit;
} }
@ -519,7 +524,7 @@ if (isset($_GET["mode"])) {
} }
// If there is no page template use the default page template // If there is no page template use the default page template
if(!$template) { if (!$template) {
$template = theme_include("default.php"); $template = theme_include("default.php");
} }

View file

@ -15,7 +15,8 @@
*/ */
if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
echo $_SERVER["argv"][1]; echo $_SERVER["argv"][1];
else } else {
echo ''; echo '';
}

View file

@ -148,7 +148,7 @@ function update_1014() {
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$ph = new Photo($rr['data']); $ph = new Photo($rr['data']);
if($ph->is_valid()) { if ($ph->is_valid()) {
$ph->scaleImage(48); $ph->scaleImage(48);
$ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0)); $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
} }
@ -1671,7 +1671,7 @@ function update_1190() {
$plugins = get_config('system','addon'); $plugins = get_config('system','addon');
$plugins_arr = array(); $plugins_arr = array();
if($plugins) { if ($plugins) {
$plugins_arr = explode(",",str_replace(" ", "",$plugins)); $plugins_arr = explode(",",str_replace(" ", "",$plugins));
$idx = array_search($plugin, $plugins_arr); $idx = array_search($plugin, $plugins_arr);