From e0e008fb8d894c7fe56fbb88fa96224c0796ea75 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 17 Mar 2012 02:26:52 -0700 Subject: [PATCH 1/2] template processor broken with foreach k=>v and k is integer 0 --- include/template_processor.php | 2 +- mod/admin.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/template_processor.php b/include/template_processor.php index 7f7b0b55bd..93bf391c5f 100755 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -96,7 +96,7 @@ $this->_push_stack(); $r = $this->r; $r[$varname] = $v; - if ($keyname!='') $r[$keyname] = $k; + if ($keyname!='') $r[$keyname] = (($k === 0) ? '0' : $k); $ret .= $this->replace($args[3], $r); $this->_pop_stack(); } diff --git a/mod/admin.php b/mod/admin.php index 88ccad6d3e..a64b269035 100755 --- a/mod/admin.php +++ b/mod/admin.php @@ -308,7 +308,7 @@ function admin_page_site(&$a) { SSL_POLICY_FULL => t("Force all links to use SSL"), SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)") ); - + $t = get_markup_template("admin_site.tpl"); return replace_macros($t, array( '$title' => t('Administration'), @@ -325,7 +325,7 @@ function admin_page_site(&$a) { '$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles"), $theme_choices), - '$ssl_policy' => array('ssl_policy', t("SSL link policy"), get_config('system','ssl_policy'), t("Determines whether generated links should be forced to use SSL"), $ssl_choices), + '$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices), '$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")), '$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices), From 26258bca77aa3385dacf36874f7f5603eaef9a6b Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 17 Mar 2012 02:36:59 -0700 Subject: [PATCH 2/2] compare ssl_policy precisely in case somebody was bitten by template processor bug --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 836900fc4a..b0a6311703 100755 --- a/boot.php +++ b/boot.php @@ -385,7 +385,7 @@ class App { $scheme = $this->scheme; if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) { - if($this->config['system']['ssl_policy'] == SSL_POLICY_FULL) + if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL)) $scheme = 'https'; // We need to populate the $ssl flag across the entire program before turning this on.