From 04a7d6384ef5ae137019286c3819fef1d5afcf6b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:27:38 +0100 Subject: [PATCH 1/5] No need to set $a->theme_info = array() everywhere if you can define it in App itself. Signed-off-by: Roland Haeder --- boot.php | 5 +++-- view/theme/decaf-mobile/theme.php | 1 - view/theme/duepuntozero/theme.php | 1 - view/theme/facepark/theme.php | 1 - view/theme/frost-mobile/theme.php | 1 - view/theme/frost/theme.php | 1 - view/theme/quattro/theme.php | 2 -- view/theme/smoothly/theme.php | 1 - view/theme/vier/theme.php | 2 -- 9 files changed, 3 insertions(+), 12 deletions(-) diff --git a/boot.php b/boot.php index d82669f231..4b2e83f18a 100644 --- a/boot.php +++ b/boot.php @@ -465,11 +465,12 @@ class App { public $plugins; public $apps = array(); public $identities; - public $is_mobile; - public $is_tablet; + public $is_mobile = false; + public $is_tablet = false; public $is_friendica_app; public $performance = array(); public $callstack = array(); + public $theme_info = array(); public $nav_sel; diff --git a/view/theme/decaf-mobile/theme.php b/view/theme/decaf-mobile/theme.php index 1a32fb724d..9b1c1daa61 100644 --- a/view/theme/decaf-mobile/theme.php +++ b/view/theme/decaf-mobile/theme.php @@ -10,7 +10,6 @@ */ function decaf_mobile_init(&$a) { - $a->theme_info = array(); $a->sourcename = 'Friendica mobile web'; $a->videowidth = 250; $a->videoheight = 200; diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php index ba3f25d3e2..50d57f91e5 100644 --- a/view/theme/duepuntozero/theme.php +++ b/view/theme/duepuntozero/theme.php @@ -2,7 +2,6 @@ function duepuntozero_init(&$a) { -$a->theme_info = array(); set_template_engine($a, 'smarty3'); $colorset = get_pconfig( local_user(), 'duepuntozero','colorset'); diff --git a/view/theme/facepark/theme.php b/view/theme/facepark/theme.php index e7203c6641..e6255f118a 100644 --- a/view/theme/facepark/theme.php +++ b/view/theme/facepark/theme.php @@ -1,7 +1,6 @@ theme_info = array(); set_template_engine($a, 'smarty3'); $a->page['htmlhead'] .= <<< EOT diff --git a/view/theme/frost-mobile/theme.php b/view/theme/frost-mobile/theme.php index beec924934..29a990f7b8 100644 --- a/view/theme/frost-mobile/theme.php +++ b/view/theme/frost-mobile/theme.php @@ -10,7 +10,6 @@ */ function frost_mobile_init(&$a) { - $a->theme_info = array(); $a->sourcename = 'Friendica mobile web'; $a->videowidth = 250; $a->videoheight = 200; diff --git a/view/theme/frost/theme.php b/view/theme/frost/theme.php index 868a840dee..1093a04729 100644 --- a/view/theme/frost/theme.php +++ b/view/theme/frost/theme.php @@ -10,7 +10,6 @@ */ function frost_init(&$a) { - $a->theme_info = array(); $a->videowidth = 400; $a->videoheight = 330; $a->theme_thread_allow = false; diff --git a/view/theme/quattro/theme.php b/view/theme/quattro/theme.php index a1cd29ee72..0b67c6b49a 100644 --- a/view/theme/quattro/theme.php +++ b/view/theme/quattro/theme.php @@ -8,8 +8,6 @@ */ function quattro_init(&$a) { - $a->theme_info = array(); - $a->page['htmlhead'] .= ''; $a->page['htmlhead'] .= '';; } diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index d3ebbc1d15..0dae3a6e47 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -11,7 +11,6 @@ */ function smoothly_init(&$a) { - $a->theme_info = array(); set_template_engine($a, 'smarty3'); $cssFile = null; diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 7f6ead079f..925ac76a1f 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -19,8 +19,6 @@ function vier_init(&$a) { set_template_engine($a, 'smarty3'); - $a->theme_info = array(); - if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()) { vier_community_info(); From f10d2afca0edfef804aa95affe77bba99a603b3b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:32:19 +0100 Subject: [PATCH 2/5] Prevent some E_NOTICE in boot.php Signed-off-by: Roland Haeder --- boot.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/boot.php b/boot.php index d82669f231..44fbcda735 100644 --- a/boot.php +++ b/boot.php @@ -1046,11 +1046,21 @@ class App { function save_timestamp($stamp, $value) { $duration = (float)(microtime(true)-$stamp); + if (!isset($this->performance[$value])) { + // Prevent ugly E_NOTICE + $this->performance[$value] = 0; + } + $this->performance[$value] += (float)$duration; $this->performance["marktime"] += (float)$duration; $callstack = $this->callstack(); + if (!isset($this->callstack[$value][$callstack])) { + // Prevent ugly E_NOTICE + $this->callstack[$value][$callstack] = 0; + } + $this->callstack[$value][$callstack] += (float)$duration; } From 04eacb64703c8d2a590c64da7ed5fae80ac26769 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:36:23 +0100 Subject: [PATCH 3/5] Prevent some E_NOTICE in identity.php Signed-off-by: Roland Haeder --- include/identity.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/identity.php b/include/identity.php index aba69bae49..888a09ee6f 100644 --- a/include/identity.php +++ b/include/identity.php @@ -237,6 +237,7 @@ function profile_sidebar($profile, $block = 0) { if ($connect AND ($profile['network'] != NETWORK_DFRN) AND !isset($profile['remoteconnect'])) $connect = false; + $remoteconnect = NULL; if (isset($profile['remoteconnect'])) $remoteconnect = $profile['remoteconnect']; @@ -292,9 +293,9 @@ function profile_sidebar($profile, $block = 0) { // check if profile is a forum if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP) - || (intval($profile['forum'])) - || (intval($profile['prv'])) - || (intval($profile['community']))) + || (isset($profile['forum']) && intval($profile['forum'])) + || (isset($profile['prv']) && intval($profile['prv'])) + || (isset($profile['community']) && intval($profile['community']))) $account_type = t('Forum'); else $account_type = ""; From 8616f0cc3526b0f0ca3d16800984e118c5d56d94 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:49:07 +0100 Subject: [PATCH 4/5] Don't miss to add exit() after header('Location: bla') as header() does *NOT* exit the script quickly enough. Always use an explicit exit() or you get real trouble. Signed-off-by: Roland Haeder --- index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index e364389b2c..625c2d82dc 100644 --- a/index.php +++ b/index.php @@ -72,7 +72,8 @@ if(!$install) { (intval(get_config('system','ssl_policy')) == SSL_POLICY_FULL) AND (substr($a->get_baseurl(), 0, 8) == "https://")) { header("HTTP/1.1 302 Moved Temporarily"); - header("location: ".$a->get_baseurl()."/".$a->query_string); + header("Location: ".$a->get_baseurl()."/".$a->query_string); + exit(); } require_once("include/session.php"); From 08abdfda684c6b9215109da6f999351f81c00ac3 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:49:56 +0100 Subject: [PATCH 5/5]
and or are not self-closing tags. Signed-off-by: Roland Haeder --- view/templates/dfrn_request.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view/templates/dfrn_request.tpl b/view/templates/dfrn_request.tpl index 3b96d3eefd..5225bd60b2 100644 --- a/view/templates/dfrn_request.tpl +++ b/view/templates/dfrn_request.tpl @@ -18,13 +18,13 @@ {{/if}} {{if $request}} - + {{else}} - + {{/if}} {{if $photo}} - + {{/if}} {{if $url}}
{{$url_label}}
{{$url}}
{{/if}}