From: garvinhicking <garvinhicking>
Date: Tue, 21 Aug 2007 10:26:07 +0000 (+0000)
Subject: Allow variying template 'okey'
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ea8d5d8b6092ed71ee0364c3583cf41bdec212e8;p=s9y.git

Allow variying template 'okey'
---

diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php
index 3b55656..f76fb40 100644
--- a/include/functions_config.inc.php
+++ b/include/functions_config.inc.php
@@ -1969,10 +1969,15 @@ function serendipity_setFormToken($type = 'form') {
  * @param   array   Referenced variable coming from the config.inc.php file, where the config values will be stored in
  * @return  array   Final return array with default values
  */
-function &serendipity_loadThemeOptions(&$template_config) {
+function &serendipity_loadThemeOptions(&$template_config, $okey = '') {
     global $serendipity;
+    
+    if (empty($okey)) {
+        $okey = $serendipity['template'];
+    }
+
     $_template_vars =& serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}options
-                                             WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'", false, 'assoc', false, 'name', 'value');
+                                             WHERE okey = 't_" . serendipity_db_escape_string($okey) . "'", false, 'assoc', false, 'name', 'value');
     if (!is_array($_template_vars)) {
         $template_vars = array();
     } else {
diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php
index a625b16..8903f33 100644
--- a/include/functions_smarty.inc.php
+++ b/include/functions_smarty.inc.php
@@ -873,7 +873,7 @@ function serendipity_smarty_init($vars = array()) {
             $template_vars =& $template_loaded_config;
             $serendipity['smarty']->assign_by_ref('template_option', $template_vars);
         } elseif (is_array($template_config)) {
-            $template_vars =& serendipity_loadThemeOptions($template_config);
+            $template_vars =& serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
             $serendipity['smarty']->assign_by_ref('template_option', $template_vars);
         }
     }