Minahito
minah****@users*****
2006年 4月 28日 (金) 18:17:44 JST
Index: xoops2jp/html/modules/base/kernel/Legacy_AdminRenderSystem.class.php diff -u xoops2jp/html/modules/base/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.4 xoops2jp/html/modules/base/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.5 --- xoops2jp/html/modules/base/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.4 Fri Apr 28 15:46:46 2006 +++ xoops2jp/html/modules/base/kernel/Legacy_AdminRenderSystem.class.php Fri Apr 28 18:17:44 2006 @@ -101,14 +101,16 @@ { $this->mController =& $controller; - $this->mSmarty=new Legacy_AdminSmarty(); + $this->mSmarty =& new Legacy_AdminSmarty(); - $this->mSmarty->assign(array("xoops_url"=>XOOPS_URL, - "xoops_rootpath"=>XOOPS_ROOT_PATH, - "xoops_langcode"=>_LANGCODE, - "xoops_charset"=>_CHARSET, - "xoops_version"=>XOOPS_VERSION, - "xoops_upload_url"=>XOOPS_UPLOAD_URL)); + $this->mSmarty->assign(array( + "xoops_url" => XOOPS_URL, + "xoops_rootpath" => XOOPS_ROOT_PATH, + "xoops_langcode" => _LANGCODE, + "xoops_charset" => _CHARSET, + "xoops_version" => XOOPS_VERSION, + "xoops_upload_url" => XOOPS_UPLOAD_URL) + ); } @@ -239,7 +241,6 @@ } $modulePath = XOOPS_MODULE_PATH . "/" . $dirname . "/admin/templates/" . $string; - if (file_exists($modulePath)) { return XOOPS_MODULE_URL . "/" . $dirname . "/admin/templates/" . $string; } @@ -251,24 +252,81 @@ function Legacy_function_stylesheet($params, &$smarty) { $file = $params['file']; + if (strstr($file, "..") !== false) { + return; + } + + $infoArr = Legacy_get_ovveride_file($file, "stylesheets/"); + + // TEMP + // TODO We must return FALLBACK_URL here. + if ($infoArr['file'] != null) { + $request = array(); + foreach ($infoArr as $key => $value) { + if ($value != null) { + $request[] = "${key}=${value}"; + } + } + $url = XOOPS_MODULE_URL . "/base/admin/css.php?" . implode("&", $request); + print '<link rel="stylesheet" type="text/css" media="all" href="' . $url . '" />'; + } +} +function Legacy_get_ovveride_file($file, $prefix = null) +{ $root =& XCube_Root::getSingleton(); + $modController =& $root->mController->getModuleController(); + $moduleObject =& $modController->getXoopsModule(); + $theme = $root->mSiteConfig['Legacy']['Theme']; - // TODO We must remove Hard-Coding - $themePath = XOOPS_THEME_PATH . "/" . $theme . "/" . $file; - if (file_exists($themePath)) { - $url = XOOPS_MODULE_URL . "/base/admin/css.php?theme=${theme}&file=${file}"; + $ret = array(); + $ret['theme'] = $theme; + $ret['file'] = $file; + + $file = $prefix . $file; + + if (!is_object($moduleObject)) { + $themePath = XOOPS_THEME_PATH . "/" . $theme . "/" . $file; + if (file_exists($themePath)) { + return $ret; + } + + $ret['theme'] = null; + return $ret; } else { - $url = XOOPS_MODULE_URL . "/base/admin/css.php?file=${file}"; - } + $dirname = $moduleObject->get('dirname'); + + $ret['dirname'] = $dirname; - // TEMP - // TODO We must return FALLBACK_URL here. + $themePath = XOOPS_THEME_PATH . "/" . $theme . "/modules/" . $dirname . "/" . $file; + if (file_exists($themePath)) { + return $ret; + } + + $themePath = XOOPS_THEME_PATH . "/" . $theme . "/" . $file; + if (file_exists($themePath)) { + $ret['dirname'] = null; + return $ret; + } + + $ret['theme'] = null; - print '<link rel="stylesheet" type="text/css" media="all" href="' . $url . '" />'; -} + $modulePath = XOOPS_MODULE_PATH . "/" . $dirname . "/admin/templates/" . $file; + if (file_exists($modulePath)) { + return $ret; + } + + $ret['dirname'] = null; + if (file_exists(LEGACY_ADMIN_RENDER_FALLBACK_PATH . "/" . $file)) { + return $ret; + } + + $ret['file'] =null; + return $ret; + } +} ?> \ No newline at end of file