From eaacbc7b2d224524eac6def04e9b721949afd4b8 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 20 Oct 2006 02:17:53 +0000 Subject: - put back config['session_length'] disappeared in r1493 but has always been used in the code (generates mysql errors on session garbage collector) - fix auto_login (die mysql when session timed out, but user has remember) - when a user reconnects from identification.php, the remember cookie was not deleted - fix all redirect warnings/errors (many changes - mainly in common.inc.php and user.inc.php) - reduced $conf['remember_me_length'] to 60 days, because now at each auto login the 60 days countdown restarts git-svn-id: http://piwigo.org/svn/trunk@1568 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/template.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'include/template.php') diff --git a/include/template.php b/include/template.php index d93700b7a..df9c9a013 100644 --- a/include/template.php +++ b/include/template.php @@ -59,13 +59,22 @@ class Template { // output var $output = ''; + var $themeconf = array(); + /** * Constructor. Simply sets the root dir. * */ - function Template($root = ".") + function Template($root = ".", $theme= "") { - $this->set_rootdir($root); + if ( $this->set_rootdir($root) ) + { + if ( !empty( $theme ) ) + { + include($root.'/theme/'.$theme.'/themeconf.inc.php'); + $this->themeconf = $themeconf; + } + } } /** @@ -311,14 +320,14 @@ class Template { { die("Template->loadfile(): File $filename for handle $handle is empty"); } - + $this->uncompiled_code[$handle] = $str; - + return true; } - - - + + + /** * Compiles the given string of code, and returns the result in a string. * @@ -331,7 +340,7 @@ class Template { // PWG specific : communication between template and $lang $code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code); // PWG specific : expand themeconf.inc.php variables - $code = preg_replace('/\{themeconf:([^}]+)\}/e', "get_themeconf('$1')", $code); + $code = preg_replace('/\{themeconf:([^}]+)\}/e', '$this->get_themeconf(\'$1\')', $code); $code = preg_replace('/\{pwg_root\}/e', "get_root_url()", $code); // replace \ with \\ and then ' with \'. @@ -525,6 +534,10 @@ class Template { return $varref; } + function get_themeconf($key) + { + return isset($this->themeconf[$key]) ? $this->themeconf[$key] : ''; + } } ?> -- cgit v1.2.3