From 79328da9a86d8df4510eb47c0147df2f365ab3b9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 24 Mar 2013 19:38:49 +0100 Subject: [PATCH] themes folder outside app dir. images handled by themes-asset controller. --- htdocs/application/.htaccess | 1 + htdocs/application/config/routes.php | 3 +- .../application/controllers/theme_assets.php | 33 ++++++++++++++---- htdocs/application/core/MY_Loader.php | 4 +-- .../themes/default/css/codemirror.css | 0 .../themes/default/css/diff.css | 0 .../themes/default/css/embed.css | 0 .../themes/default/css/fonts.css | 0 .../themes/default/css/iphone.css | 0 .../themes/default/css/main.css | 0 .../themes/default/css/print.css | 0 .../themes/default/css/raw.css | 0 .../themes/default/css/reset.css | 0 .../themes/default/images/bg-x.png | Bin .../themes/default/images/button.png | Bin .../themes/default/views/about.php | 0 .../themes/default/views/api_help.php | 0 .../themes/default/views/auth/login_form.php | 0 .../themes/default/views/defaults/footer.php | 0 .../default/views/defaults/footer_message.php | 0 .../themes/default/views/defaults/header.php | 2 +- .../default/views/defaults/paste_form.php | 0 .../themes/default/views/defaults/stats.php | 0 .../themes/default/views/home.php | 0 .../themes/default/views/index.html | 0 .../themes/default/views/iphone/footer.php | 0 .../themes/default/views/iphone/header.php | 0 .../themes/default/views/iphone/recent.php | 0 .../themes/default/views/iphone/view.php | 0 .../themes/default/views/list.php | 0 .../themes/default/views/list_blocked_ips.php | 0 .../themes/default/views/list_ips.php | 0 .../themes/default/views/spam_detail.php | 0 .../themes/default/views/trends.php | 0 .../themes/default/views/view/api.php | 0 .../themes/default/views/view/captcha.php | 0 .../themes/default/views/view/download.php | 0 .../themes/default/views/view/embed.php | 0 .../themes/default/views/view/raw.php | 0 .../themes/default/views/view/rss.php | 0 .../themes/default/views/view/view.php | 0 .../themes/default/views/view/view_footer.php | 0 .../themes/gabdark/css/main.css | 0 .../themes/gabdark3/css/main.css | 0 44 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 htdocs/application/.htaccess rename htdocs/{application => }/themes/default/css/codemirror.css (100%) rename htdocs/{application => }/themes/default/css/diff.css (100%) rename htdocs/{application => }/themes/default/css/embed.css (100%) rename htdocs/{application => }/themes/default/css/fonts.css (100%) rename htdocs/{application => }/themes/default/css/iphone.css (100%) rename htdocs/{application => }/themes/default/css/main.css (100%) rename htdocs/{application => }/themes/default/css/print.css (100%) rename htdocs/{application => }/themes/default/css/raw.css (100%) rename htdocs/{application => }/themes/default/css/reset.css (100%) rename htdocs/{application => }/themes/default/images/bg-x.png (100%) rename htdocs/{application => }/themes/default/images/button.png (100%) rename htdocs/{application => }/themes/default/views/about.php (100%) rename htdocs/{application => }/themes/default/views/api_help.php (100%) rename htdocs/{application => }/themes/default/views/auth/login_form.php (100%) rename htdocs/{application => }/themes/default/views/defaults/footer.php (100%) rename htdocs/{application => }/themes/default/views/defaults/footer_message.php (100%) rename htdocs/{application => }/themes/default/views/defaults/header.php (97%) rename htdocs/{application => }/themes/default/views/defaults/paste_form.php (100%) rename htdocs/{application => }/themes/default/views/defaults/stats.php (100%) rename htdocs/{application => }/themes/default/views/home.php (100%) rename htdocs/{application => }/themes/default/views/index.html (100%) rename htdocs/{application => }/themes/default/views/iphone/footer.php (100%) rename htdocs/{application => }/themes/default/views/iphone/header.php (100%) rename htdocs/{application => }/themes/default/views/iphone/recent.php (100%) rename htdocs/{application => }/themes/default/views/iphone/view.php (100%) rename htdocs/{application => }/themes/default/views/list.php (100%) rename htdocs/{application => }/themes/default/views/list_blocked_ips.php (100%) rename htdocs/{application => }/themes/default/views/list_ips.php (100%) rename htdocs/{application => }/themes/default/views/spam_detail.php (100%) rename htdocs/{application => }/themes/default/views/trends.php (100%) rename htdocs/{application => }/themes/default/views/view/api.php (100%) rename htdocs/{application => }/themes/default/views/view/captcha.php (100%) rename htdocs/{application => }/themes/default/views/view/download.php (100%) rename htdocs/{application => }/themes/default/views/view/embed.php (100%) rename htdocs/{application => }/themes/default/views/view/raw.php (100%) rename htdocs/{application => }/themes/default/views/view/rss.php (100%) rename htdocs/{application => }/themes/default/views/view/view.php (100%) rename htdocs/{application => }/themes/default/views/view/view_footer.php (100%) rename htdocs/{application => }/themes/gabdark/css/main.css (100%) rename htdocs/{application => }/themes/gabdark3/css/main.css (100%) diff --git a/htdocs/application/.htaccess b/htdocs/application/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/htdocs/application/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/htdocs/application/config/routes.php b/htdocs/application/config/routes.php index 46c678a..f6ba8d7 100644 --- a/htdocs/application/config/routes.php +++ b/htdocs/application/config/routes.php @@ -64,7 +64,8 @@ $route['iphone/view/:any'] = 'iphone/view'; $route['404_override'] = 'main/error_404'; -$route['application/themes/:any'] = 'theme_assets/css'; +$route['themes/:any/css/:any'] = 'theme_assets/css'; +$route['themes/:any/images/:any'] = 'theme_assets/images'; /* End of file routes.php */ /* Location: ./application/config/routes.php */ diff --git a/htdocs/application/controllers/theme_assets.php b/htdocs/application/controllers/theme_assets.php index fce89d1..5cd496e 100755 --- a/htdocs/application/controllers/theme_assets.php +++ b/htdocs/application/controllers/theme_assets.php @@ -4,6 +4,7 @@ * Function list: * - __construct() * - css() + * - images() * Classes list: * - Theme_assets extends CI_Controller */ @@ -19,22 +20,40 @@ class Theme_assets extends CI_Controller function css() { $theme = config_item('theme'); - $css_file = $this->uri->segment(5); - $css_file = str_replace('.css', '', $css_file); + $css_file = $this->uri->segment(4); //file path - $file_path = 'application/themes/' . $theme . '/css/' . $css_file . '.css'; + $file_path = 'themes/' . $theme . '/css/' . $css_file; //fallback to default css if view in theme not found if (!file_exists($file_path)) { - $file_path = 'application/themes/default/css/' . $css_file . '.css'; + $file_path = 'themes/default/css/' . $css_file; } - //get and send - $contents = file_get_contents($file_path); + //send header('Content-type: text/css'); - echo $contents; + readfile($file_path); + } + + function images() + { + $theme = config_item('theme'); + $image_file = $this->uri->segment(4); + + //file path + $file_path = 'themes/' . $theme . '/images/' . $image_file; + + //fallback to default css if view in theme not found + + if (!file_exists($file_path)) + { + $file_path = 'themes/default/images/' . $image_file; + } + + //send + header('Content-type: ' . mime_content_type($file_path)); + readfile($file_path); } } diff --git a/htdocs/application/core/MY_Loader.php b/htdocs/application/core/MY_Loader.php index 7ad411a..cdfbc4b 100644 --- a/htdocs/application/core/MY_Loader.php +++ b/htdocs/application/core/MY_Loader.php @@ -30,14 +30,14 @@ class MY_Loader extends CI_Loader //fallback to default view if view in theme not found - if (!file_exists('application/' . $view_path)) + if (!file_exists($view_path)) { $view_path = 'themes/default/views/' . $view . '.php'; } //return return $this->_ci_load(array( - '_ci_view' => '../' . $view_path, + '_ci_view' => '../../' . $view_path, '_ci_vars' => $this->_ci_object_to_array($vars) , '_ci_return' => $return )); diff --git a/htdocs/application/themes/default/css/codemirror.css b/htdocs/themes/default/css/codemirror.css similarity index 100% rename from htdocs/application/themes/default/css/codemirror.css rename to htdocs/themes/default/css/codemirror.css diff --git a/htdocs/application/themes/default/css/diff.css b/htdocs/themes/default/css/diff.css similarity index 100% rename from htdocs/application/themes/default/css/diff.css rename to htdocs/themes/default/css/diff.css diff --git a/htdocs/application/themes/default/css/embed.css b/htdocs/themes/default/css/embed.css similarity index 100% rename from htdocs/application/themes/default/css/embed.css rename to htdocs/themes/default/css/embed.css diff --git a/htdocs/application/themes/default/css/fonts.css b/htdocs/themes/default/css/fonts.css similarity index 100% rename from htdocs/application/themes/default/css/fonts.css rename to htdocs/themes/default/css/fonts.css diff --git a/htdocs/application/themes/default/css/iphone.css b/htdocs/themes/default/css/iphone.css similarity index 100% rename from htdocs/application/themes/default/css/iphone.css rename to htdocs/themes/default/css/iphone.css diff --git a/htdocs/application/themes/default/css/main.css b/htdocs/themes/default/css/main.css similarity index 100% rename from htdocs/application/themes/default/css/main.css rename to htdocs/themes/default/css/main.css diff --git a/htdocs/application/themes/default/css/print.css b/htdocs/themes/default/css/print.css similarity index 100% rename from htdocs/application/themes/default/css/print.css rename to htdocs/themes/default/css/print.css diff --git a/htdocs/application/themes/default/css/raw.css b/htdocs/themes/default/css/raw.css similarity index 100% rename from htdocs/application/themes/default/css/raw.css rename to htdocs/themes/default/css/raw.css diff --git a/htdocs/application/themes/default/css/reset.css b/htdocs/themes/default/css/reset.css similarity index 100% rename from htdocs/application/themes/default/css/reset.css rename to htdocs/themes/default/css/reset.css diff --git a/htdocs/application/themes/default/images/bg-x.png b/htdocs/themes/default/images/bg-x.png similarity index 100% rename from htdocs/application/themes/default/images/bg-x.png rename to htdocs/themes/default/images/bg-x.png diff --git a/htdocs/application/themes/default/images/button.png b/htdocs/themes/default/images/button.png similarity index 100% rename from htdocs/application/themes/default/images/button.png rename to htdocs/themes/default/images/button.png diff --git a/htdocs/application/themes/default/views/about.php b/htdocs/themes/default/views/about.php similarity index 100% rename from htdocs/application/themes/default/views/about.php rename to htdocs/themes/default/views/about.php diff --git a/htdocs/application/themes/default/views/api_help.php b/htdocs/themes/default/views/api_help.php similarity index 100% rename from htdocs/application/themes/default/views/api_help.php rename to htdocs/themes/default/views/api_help.php diff --git a/htdocs/application/themes/default/views/auth/login_form.php b/htdocs/themes/default/views/auth/login_form.php similarity index 100% rename from htdocs/application/themes/default/views/auth/login_form.php rename to htdocs/themes/default/views/auth/login_form.php diff --git a/htdocs/application/themes/default/views/defaults/footer.php b/htdocs/themes/default/views/defaults/footer.php similarity index 100% rename from htdocs/application/themes/default/views/defaults/footer.php rename to htdocs/themes/default/views/defaults/footer.php diff --git a/htdocs/application/themes/default/views/defaults/footer_message.php b/htdocs/themes/default/views/defaults/footer_message.php similarity index 100% rename from htdocs/application/themes/default/views/defaults/footer_message.php rename to htdocs/themes/default/views/defaults/footer_message.php diff --git a/htdocs/application/themes/default/views/defaults/header.php b/htdocs/themes/default/views/defaults/header.php similarity index 97% rename from htdocs/application/themes/default/views/defaults/header.php rename to htdocs/themes/default/views/defaults/header.php index a89bc1c..b44104c 100755 --- a/htdocs/application/themes/default/views/defaults/header.php +++ b/htdocs/themes/default/views/defaults/header.php @@ -19,7 +19,7 @@ $theme = $this->config->item('theme'); //Carabiner $this->carabiner->config(array( 'script_dir' => 'static/js/', - 'style_dir' => 'application/themes/' . $theme . '/css/', + 'style_dir' => 'themes/' . $theme . '/css/', 'cache_dir' => 'static/asset/', 'base_uri' => base_url(), 'combine' => true, diff --git a/htdocs/application/themes/default/views/defaults/paste_form.php b/htdocs/themes/default/views/defaults/paste_form.php similarity index 100% rename from htdocs/application/themes/default/views/defaults/paste_form.php rename to htdocs/themes/default/views/defaults/paste_form.php diff --git a/htdocs/application/themes/default/views/defaults/stats.php b/htdocs/themes/default/views/defaults/stats.php similarity index 100% rename from htdocs/application/themes/default/views/defaults/stats.php rename to htdocs/themes/default/views/defaults/stats.php diff --git a/htdocs/application/themes/default/views/home.php b/htdocs/themes/default/views/home.php similarity index 100% rename from htdocs/application/themes/default/views/home.php rename to htdocs/themes/default/views/home.php diff --git a/htdocs/application/themes/default/views/index.html b/htdocs/themes/default/views/index.html similarity index 100% rename from htdocs/application/themes/default/views/index.html rename to htdocs/themes/default/views/index.html diff --git a/htdocs/application/themes/default/views/iphone/footer.php b/htdocs/themes/default/views/iphone/footer.php similarity index 100% rename from htdocs/application/themes/default/views/iphone/footer.php rename to htdocs/themes/default/views/iphone/footer.php diff --git a/htdocs/application/themes/default/views/iphone/header.php b/htdocs/themes/default/views/iphone/header.php similarity index 100% rename from htdocs/application/themes/default/views/iphone/header.php rename to htdocs/themes/default/views/iphone/header.php diff --git a/htdocs/application/themes/default/views/iphone/recent.php b/htdocs/themes/default/views/iphone/recent.php similarity index 100% rename from htdocs/application/themes/default/views/iphone/recent.php rename to htdocs/themes/default/views/iphone/recent.php diff --git a/htdocs/application/themes/default/views/iphone/view.php b/htdocs/themes/default/views/iphone/view.php similarity index 100% rename from htdocs/application/themes/default/views/iphone/view.php rename to htdocs/themes/default/views/iphone/view.php diff --git a/htdocs/application/themes/default/views/list.php b/htdocs/themes/default/views/list.php similarity index 100% rename from htdocs/application/themes/default/views/list.php rename to htdocs/themes/default/views/list.php diff --git a/htdocs/application/themes/default/views/list_blocked_ips.php b/htdocs/themes/default/views/list_blocked_ips.php similarity index 100% rename from htdocs/application/themes/default/views/list_blocked_ips.php rename to htdocs/themes/default/views/list_blocked_ips.php diff --git a/htdocs/application/themes/default/views/list_ips.php b/htdocs/themes/default/views/list_ips.php similarity index 100% rename from htdocs/application/themes/default/views/list_ips.php rename to htdocs/themes/default/views/list_ips.php diff --git a/htdocs/application/themes/default/views/spam_detail.php b/htdocs/themes/default/views/spam_detail.php similarity index 100% rename from htdocs/application/themes/default/views/spam_detail.php rename to htdocs/themes/default/views/spam_detail.php diff --git a/htdocs/application/themes/default/views/trends.php b/htdocs/themes/default/views/trends.php similarity index 100% rename from htdocs/application/themes/default/views/trends.php rename to htdocs/themes/default/views/trends.php diff --git a/htdocs/application/themes/default/views/view/api.php b/htdocs/themes/default/views/view/api.php similarity index 100% rename from htdocs/application/themes/default/views/view/api.php rename to htdocs/themes/default/views/view/api.php diff --git a/htdocs/application/themes/default/views/view/captcha.php b/htdocs/themes/default/views/view/captcha.php similarity index 100% rename from htdocs/application/themes/default/views/view/captcha.php rename to htdocs/themes/default/views/view/captcha.php diff --git a/htdocs/application/themes/default/views/view/download.php b/htdocs/themes/default/views/view/download.php similarity index 100% rename from htdocs/application/themes/default/views/view/download.php rename to htdocs/themes/default/views/view/download.php diff --git a/htdocs/application/themes/default/views/view/embed.php b/htdocs/themes/default/views/view/embed.php similarity index 100% rename from htdocs/application/themes/default/views/view/embed.php rename to htdocs/themes/default/views/view/embed.php diff --git a/htdocs/application/themes/default/views/view/raw.php b/htdocs/themes/default/views/view/raw.php similarity index 100% rename from htdocs/application/themes/default/views/view/raw.php rename to htdocs/themes/default/views/view/raw.php diff --git a/htdocs/application/themes/default/views/view/rss.php b/htdocs/themes/default/views/view/rss.php similarity index 100% rename from htdocs/application/themes/default/views/view/rss.php rename to htdocs/themes/default/views/view/rss.php diff --git a/htdocs/application/themes/default/views/view/view.php b/htdocs/themes/default/views/view/view.php similarity index 100% rename from htdocs/application/themes/default/views/view/view.php rename to htdocs/themes/default/views/view/view.php diff --git a/htdocs/application/themes/default/views/view/view_footer.php b/htdocs/themes/default/views/view/view_footer.php similarity index 100% rename from htdocs/application/themes/default/views/view/view_footer.php rename to htdocs/themes/default/views/view/view_footer.php diff --git a/htdocs/application/themes/gabdark/css/main.css b/htdocs/themes/gabdark/css/main.css similarity index 100% rename from htdocs/application/themes/gabdark/css/main.css rename to htdocs/themes/gabdark/css/main.css diff --git a/htdocs/application/themes/gabdark3/css/main.css b/htdocs/themes/gabdark3/css/main.css similarity index 100% rename from htdocs/application/themes/gabdark3/css/main.css rename to htdocs/themes/gabdark3/css/main.css