PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/www/source/parsepath.php

http://firmkernel.googlecode.com/
PHP | 63 lines | 52 code | 1 blank | 10 comment | 1 complexity | a652e3e37c19703638e248a2024b25bb MD5 | raw file
Possible License(s): LGPL-3.0
  1. <?php
  2. /*
  3. +-----------------------------------------------------------------------------+
  4. | $Id: parsepath.php 2010-05-24 12:37:44Z Bleakwind $
  5. | Parse template and some other thing
  6. | Copyright (c) 2003-2010 Bleakwind (www.weaverdream.com)
  7. | http://www.weaverdream.com/
  8. | Release under the GNU Lesser General Public License Version 3 (LGPLv3):
  9. | http://www.gnu.org/licenses/lgpl.html
  10. +-----------------------------------------------------------------------------+
  11. */
  12. if (!defined( 'ENTRY_INDEX')) {
  13. echo "<h1>Forbidden</h1><p>You don't have permission to access on this server.</p>";
  14. exit;
  15. }
  16. // Parse path
  17. if (empty($new_template)) {
  18. $CONFIGURE['common']['template_filename'] = $sys->get['act'].".htm";
  19. $CONFIGURE['common']['sub_path'] = "";
  20. $CONFIGURE['common']['template_path'] = $CONFIGURE['common']['sub_path']."/";
  21. $CONFIGURE['common']['template_path_filename'] = $CONFIGURE['common']['sub_path']."/".$CONFIGURE['common']['template_filename'];
  22. $template_name = substr($CONFIGURE['common']['template_path_filename'], 1);
  23. } else {
  24. $CONFIGURE['common']['sub_split'] = explode("/", $new_template);
  25. $CONFIGURE['common']['template_filename'] = end($CONFIGURE['common']['sub_split']);
  26. $CONFIGURE['common']['sub_path_split'] = $CONFIGURE['common']['sub_split'];
  27. array_pop($CONFIGURE['common']['sub_path_split']);
  28. if (!empty($CONFIGURE['common']['sub_path_split'])) {
  29. $CONFIGURE['common']['sub_path'] = "/".implode("/", $CONFIGURE['common']['sub_path_split'])."/";
  30. } else {
  31. $CONFIGURE['common']['sub_path'] = "";
  32. }
  33. if (substr($CONFIGURE['common']['template_filename'], -4, 4) == ".htm") {
  34. $new_css = $CONFIGURE['common']['sub_path']."{\$dir_css}/".substr($CONFIGURE['common']['template_filename'], 0, -4).".css";
  35. $new_js = $CONFIGURE['common']['sub_path']."{\$dir_js}/".substr($CONFIGURE['common']['template_filename'], 0, -4).".js";
  36. } elseif (substr($CONFIGURE['common']['template_filename'], -5, 5) == ".html") {
  37. $new_css = $CONFIGURE['common']['sub_path']."{\$dir_css}/".substr($CONFIGURE['common']['template_filename'], 0, -5).".css";
  38. $new_js = $CONFIGURE['common']['sub_path']."{\$dir_js}/".substr($CONFIGURE['common']['template_filename'], 0, -5).".js";
  39. }
  40. $CONFIGURE['common']['template_path'] = $CONFIGURE['common']['sub_path']."/";
  41. $CONFIGURE['common']['template_path_filename'] = $CONFIGURE['common']['sub_path']."/".$CONFIGURE['common']['template_filename'];
  42. $template_name = substr($CONFIGURE['common']['template_path_filename'], 1);
  43. }
  44. $public_var['dir_template'] = "template/".$TEMPLATE[$CONFIG['template']]['dir'];
  45. $public_var['dir_images'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_images}";
  46. $public_var['dir_css'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_css}";
  47. $public_var['dir_js'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_js}";
  48. $public_var['dir_flash'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_flash}";
  49. $SETTING['dir_template'] = "template/".$TEMPLATE[$CONFIG['template']]['dir'];
  50. $SETTING['dir_images'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_images}";
  51. $SETTING['dir_css'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_css}";
  52. $SETTING['dir_js'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_js}";
  53. $SETTING['dir_flash'] = "template/".$TEMPLATE[$CONFIG['template']]['dir']."/{\$dir_flash}";
  54. ?>