aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-09-19 03:06:16 +0000
committerrvelices <rv-github@modusoptimus.com>2007-09-19 03:06:16 +0000
commitbb07324f762708142f2158da1a8060f9f812c28b (patch)
tree98f93531d43dd10f31816e14e5b1827bee62eaa2 /include
parentb34b7c6b28a7d34488f4ca5947a618be10028b3d (diff)
- fix: quick search error if the query term contained " or '
- optimized sql query in sync_users (called every time on admin page) - a lot faster when #user_cache_categories is big - added function Template->delete_block_vars (opposite of assign_block_vars) git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2094 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/category_cats.inc.php10
-rw-r--r--include/template.php37
2 files changed, 42 insertions, 5 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 3ef955b4c..82d1eb11d 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -223,13 +223,13 @@ if (count($categories) > 0)
'<br />'
),
'DESCRIPTION' =>
- trigger_event('render_category_literal_description',
- trigger_event('render_category_description',
+ trigger_event('render_category_literal_description',
+ trigger_event('render_category_description',
@$category['comment'])),
'NAME' => $name,
)
);
-
+
//plugins need to add/modify sth in this loop ?
trigger_action('loc_index_category_thumbnail',
$category, 'categories.category' );
@@ -314,8 +314,8 @@ if (count($categories) > 0)
}
$template->assign_var_from_handle('CATEGORIES', 'thumbnails');
- unset( $template->_tpldata['thumbnails.'] );//maybe write a func for that
+ $template->delete_block_vars('thumbnails', true); // category_default reuse them
}
trigger_action('loc_end_index_category_thumbnails', $categories);
}
-?>
+?> \ No newline at end of file
diff --git a/include/template.php b/include/template.php
index 0e8f626f0..7d93237e6 100644
--- a/include/template.php
+++ b/include/template.php
@@ -296,6 +296,43 @@ class Template {
}
/**
+ * Block-level variable deletion. Deletes the last block iteration.
+ * if all is true - all blocks are removed
+ * return true if a deletion occured
+ */
+ function delete_block_vars($blockname, $all=false)
+ {
+ $blocks = explode('.', $blockname);
+ $blockcount = count($blocks);
+ $str = '$this->_tpldata';
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ $str .= '[\'' . $blocks[$i] . '.\']';
+ eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:-1;');
+ if ($lastiteration==-1)
+ {
+ return false;
+ }
+ if ($i==$blockcount-1)
+ {
+ break;
+ }
+ $str .= '[' . $lastiteration . ']';
+ }
+
+ if ($all==true or $lastiteration==0)
+ {
+ $str ='unset('.$str.');';
+ }
+ else
+ {
+ $str ='unset('.$str.'['.$lastiteration.']);';
+ }
+ eval($str);
+ return true;
+ }
+
+ /**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
*/