/www/source/parsepath.php
PHP | 63 lines | 52 code | 1 blank | 10 comment | 1 complexity | a652e3e37c19703638e248a2024b25bb MD5 | raw file
Possible License(s): LGPL-3.0
- <?php
- /*
- +-----------------------------------------------------------------------------+
- | $Id: parsepath.php 2010-05-24 12:37:44Z Bleakwind $
- | Parse template and some other thing
- | Copyright (c) 2003-2010 Bleakwind (www.weaverdream.com)
- | http://www.weaverdream.com/
- | Release under the GNU Lesser General Public License Version 3 (LGPLv3):
- | http://www.gnu.org/licenses/lgpl.html
- +-----------------------------------------------------------------------------+
- */
-
- if (!defined( 'ENTRY_INDEX')) {
- echo "<h1>Forbidden</h1><p>You don't have permission to access on this server.</p>";
- exit;
- }
-
- // Parse path
- if (empty($new_template)) {
- $CONFIGURE['common']['template_filename'] = $sys->get['act'].".htm";
-
- $CONFIGURE['common']['sub_path'] = "";
-
- $CONFIGURE['common']['template_path'] = $CONFIGURE['common']['sub_path']."/";
- $CONFIGURE['common']['template_path_filename'] = $CONFIGURE['common']['sub_path']."/".$CONFIGURE['common']['template_filename'];
-
- $template_name = substr($CONFIGURE['common']['template_path_filename'], 1);
- } else {
- $CONFIGURE['common']['sub_split'] = explode("/", $new_template);
- $CONFIGURE['common']['template_filename'] = end($CONFIGURE['common']['sub_split']);
-
- $CONFIGURE['common']['sub_path_split'] = $CONFIGURE['common']['sub_split'];
- array_pop($CONFIGURE['common']['sub_path_split']);
- if (!empty($CONFIGURE['common']['sub_path_split'])) {
- $CONFIGURE['common']['sub_path'] = "/".implode("/", $CONFIGURE['common']['sub_path_split'])."/";
- } else {
- $CONFIGURE['common']['sub_path'] = "";
- }
-
- if (substr($CONFIGURE['common']['template_filename'], -4, 4) == ".htm") {
- $new_css = $CONFIGURE['common']['sub_path']."{\$dir_css}/".substr($CONFIGURE['common']['template_filename'], 0, -4).".css";
- $new_js = $CONFIGURE['common']['sub_path']."{\$dir_js}/".substr($CONFIGURE['common']['template_filename'], 0, -4).".js";
- } elseif (substr($CONFIGURE['common']['template_filename'], -5, 5) == ".html") {
- $new_css = $CONFIGURE['common']['sub_path']."{\$dir_css}/".substr($CONFIGURE['common']['template_filename'], 0, -5).".css";
- $new_js = $CONFIGURE['common']['sub_path']."{\$dir_js}/".substr($CONFIGURE['common']['template_filename'], 0, -5).".js";
- }
-
- $CONFIGURE['common']['template_path'] = $CONFIGURE['common']['sub_path']."/";
- $CONFIGURE['common']['template_path_filename'] = $CONFIGURE['common']['sub_path']."/".$CONFIGURE['common']['template_filename'];
-
- $template_name = substr($CONFIGURE['common']['template_path_filename'], 1);
- }
- $public_var['dir_template'] = "template/".$TEMPLATE[$CONFIG['template']]['dir'];
- $public_var['dir_images'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_images}";
- $public_var['dir_css'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_css}";
- $public_var['dir_js'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_js}";
- $public_var['dir_flash'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_flash}";
- $SETTING['dir_template'] = "template/".$TEMPLATE[$CONFIG['template']]['dir'];
- $SETTING['dir_images'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_images}";
- $SETTING['dir_css'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_css}";
- $SETTING['dir_js'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_js}";
- $SETTING['dir_flash'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_flash}";
- ?>