From 2d1675dd1df6203eb5c629782d8f6256a6a99198 Mon Sep 17 00:00:00 2001 From: Leblanc Simon Date: Sat, 21 Mar 2009 18:29:28 +0000 Subject: [PATCH] Feature request #2655585 and bug in template RSS --- cache.class.php | 19 ++++++++++++++----- conf/configuration-dist.php | 5 ----- gallery.php | 4 ++-- rss.php | 4 ++-- strip_manager.php | 4 ++-- template/rss/template.rss | 2 +- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cache.class.php b/cache.class.php index 94ba917..6da6aeb 100644 --- a/cache.class.php +++ b/cache.class.php @@ -22,6 +22,12 @@ class STRIPIT_Cache */ var $template; + /** + * template name + * @var string + */ + var $template_name; + /** * name of strip * @var string @@ -57,6 +63,7 @@ class STRIPIT_Cache { $this->cache_folder = ''; $this->template = ''; + $this->template_name = ''; $this->page = ''; $this->strip_folder = ''; $this->stats = array(); @@ -69,6 +76,7 @@ class STRIPIT_Cache * * @param string $page Name of the strip for HTML or number of strip for RSS * @param string $template Name of the template file + * @param string $template_name Name of the template * @param string $strip_folder Name of the strip folder * @param string $cache_folder Name of the folder where the cache file is save * @param string $language The language to use @@ -76,15 +84,16 @@ class STRIPIT_Cache * @access public * @return bool True if all is OK, false else */ - function init($page, $template, $strip_folder, $cache_folder, $language, $is_rss = false) + function init($page, $template, $template_name, $strip_folder, $cache_folder, $language, $is_rss = false) { + $this->template_name = $template_name; $this->_getName($page, $language, $is_rss); $this->template = $template; $this->strip_folder = $strip_folder; $this->cache_data = ''; - if (!empty($cache_folder)) { - $this->cache_folder = $this->template.'/'.$cache_folder; + if (!empty($cache_folder) && file_exists($cache_folder)) { + $this->cache_folder = $cache_folder; } else { $this->cache_folder = $this->template.'/cache'; } @@ -300,9 +309,9 @@ class STRIPIT_Cache function _getName($page, $language, $is_rss) { if ($is_rss) { - $this->page = $page.'_'.$language.'_cache_rss.php'; + $this->page = $page.'_'.$this->template_name.'_'.$language.'_cache_rss.php'; } else { - $this->page = $page.'_'.$language.'_cache_html.php'; + $this->page = $page.'_'.$this->template_name.'_'.$language.'_cache_html.php'; } } } diff --git a/conf/configuration-dist.php b/conf/configuration-dist.php index 3787d9f..239e253 100644 --- a/conf/configuration-dist.php +++ b/conf/configuration-dist.php @@ -93,11 +93,6 @@ class configuration */ var $use_cache = true; - /** - * cache folder (in the template folder) - */ - var $cache_folder = 'cache'; - /** * HTML template folder */ diff --git a/gallery.php b/gallery.php index 8b7f54b..5659fb2 100644 --- a/gallery.php +++ b/gallery.php @@ -109,9 +109,9 @@ class gallery_manager $template_folder = $this->general->template_folder.'/'.$this->general->template_name; $strip_folder = $this->strip_manager->strips_path; - $cache_folder = $this->general->cache_folder; + $cache_folder = $this->strip_manager->options['compileDir']; $language = $this->general->language; - if ($cache->init('gallery-'.$limit.'-'.$page, $template_folder, $strip_folder, $cache_folder, $language)) { + if ($cache->init('gallery-'.$limit.'-'.$page, $template_folder, $this->general->template_name, $strip_folder, $cache_folder, $language)) { if ($cache->isInCache()) { // the page is in cache, show cache $cache->getCache(); diff --git a/rss.php b/rss.php index 656a354..864f03e 100644 --- a/rss.php +++ b/rss.php @@ -110,8 +110,8 @@ class rss_manager $template_folder = $this->general->template_folder.'/'.$this->general->template_rss; $strip_folder = $this->strip_manager->strips_path; - $cache_folder = $this->general->cache_folder; - if ($cache->init($limit, $template_folder, $strip_folder, $cache_folder, '', true)) { + $cache_folder = $this->strip_manager->options['compileDir']; + if ($cache->init($limit, $template_folder, $this->general->template_rss, $strip_folder, $cache_folder, '', true)) { if ($cache->isInCache()) { // the page is in cache, show cache $cache->getCache(); diff --git a/strip_manager.php b/strip_manager.php index da1c303..d42e1f7 100644 --- a/strip_manager.php +++ b/strip_manager.php @@ -326,9 +326,9 @@ class strip_manager $template_folder = $this->general->template_folder.'/'.$this->general->template_name; $strip_folder = $this->strips_path; - $cache_folder = $this->general->cache_folder; + $cache_folder = $this->options['compileDir']; $language = $this->general->language; - if ($cache->init($get_strip, $template_folder, $strip_folder, $cache_folder, $language)) { + if ($cache->init($get_strip, $template_folder, $this->general->template_name, $strip_folder, $cache_folder, $language)) { if ($cache->isInCache()) { // the page is in cache, show cache $cache->getCache(); diff --git a/template/rss/template.rss b/template/rss/template.rss index fce6d7e..dcc94db 100644 --- a/template/rss/template.rss +++ b/template/rss/template.rss @@ -34,7 +34,7 @@ <a title="{lang.source_rss}" - href="{general.url}/{strip.nav_base_url}{strip.current_id}<" + href="{general.url}/{strip.nav_base_url}{strip.current_id}" > <img src="{general.url}/{strip.img_src}" alt="{general.text}" /> </a>