aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php4
-rw-r--r--include/category_cats.inc.php4
-rw-r--r--include/template.php37
-rw-r--r--qsearch.php2
4 files changed, 42 insertions, 5 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 3614c0904..23cf41180 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1159,7 +1159,7 @@ SELECT user_id
foreach ($tables as $table)
{
$query = '
-SELECT user_id
+SELECT DISTINCT user_id
FROM '.$table.'
;';
$to_delete = array_diff(
@@ -1989,4 +1989,4 @@ UPDATE '.USER_CACHE_TABLE.'
pwg_query($query);
trigger_action('invalidate_user_cache');
}
-?>
+?> \ No newline at end of file
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 80efcd184..a5fe848e5 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -385,8 +385,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.
*/
diff --git a/qsearch.php b/qsearch.php
index a7fc1d956..2635ea31a 100644
--- a/qsearch.php
+++ b/qsearch.php
@@ -43,7 +43,7 @@ $query ='
INSERT INTO '.SEARCH_TABLE.'
(rules, last_seen)
VALUES
- (\''.serialize($search).'\', NOW() )
+ (\''.addslashes(serialize($search)).'\', NOW() )
;';
pwg_query($query);