[xoops-cvslog 2692] CVS update: xoops2jp/html/class/smarty/plugins

Back to archive index

NobuNobu nobun****@users*****
2006年 4月 9日 (日) 10:24:03 JST


Index: xoops2jp/html/class/smarty/plugins/resource.db.php
diff -u xoops2jp/html/class/smarty/plugins/resource.db.php:1.1 xoops2jp/html/class/smarty/plugins/resource.db.php:1.1.8.1
--- xoops2jp/html/class/smarty/plugins/resource.db.php:1.1	Thu Sep  9 14:14:50 2004
+++ xoops2jp/html/class/smarty/plugins/resource.db.php	Sun Apr  9 10:24:03 2006
@@ -8,8 +8,28 @@
  * Purpose:  Fetches templates from a database
  * -------------------------------------------------------------
  */
+
+function smarty_resource_db_systemTpl($tpl_name)
+{
+    // Replace Legacy System Template name to Legacy Module Template name
+    static $patterns = null;
+    static $replacements = null;
+    if (!$patterns) {
+        $root=&XCube_Root::getSingleton();
+        $systemTemplates = explode(',',$root->getSiteConfig('Legacy_RenderSystem','SystemTemplate',''));
+        $prefix = $root->getSiteConfig('Legacy_RenderSystem','SystemTemplatePrefix','legacy');
+        $patterns = preg_replace('/^\s*([^\s]*)\s*$/e', '"/".preg_quote("\1","/")."/"', $systemTemplates);
+        $replacements = preg_replace('/^\s*system_([^\s]*)\s*/', $prefix.'_\1', $systemTemplates);
+    }
+    if ($patterns) {
+        $tpl_name = preg_replace($patterns, $replacements,$tpl_name);
+    }
+    return $tpl_name;
+}
+
 function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
 {
+    $tpl_name = smarty_resource_db_systemTpl($tpl_name);
     $tplfile_handler =& xoops_gethandler('tplfile');
 	$tplobj =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], null, null, null, $tpl_name, true);
 	if (count($tplobj) > 0) {
@@ -65,6 +85,7 @@
 
 function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
 {
+    $tpl_name = smarty_resource_db_systemTpl($tpl_name);
     $tplfile_handler =& xoops_gethandler('tplfile');
     $tplobj =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], null, null, null, $tpl_name, false);
 	if (count($tplobj) > 0) {


xoops-cvslog メーリングリストの案内
Back to archive index