diff --git a/ext/pools/main.php b/ext/pools/main.php
index 8ef17423..d67c1e7f 100644
--- a/ext/pools/main.php
+++ b/ext/pools/main.php
@@ -319,29 +319,22 @@ class Pools extends Extension {
$matches = array();
if(preg_match("/^pool[=|:](.*)$/i", $event->term, $matches)) {
- $this->add_post_from_tag($matches[1], $event->id);
+ $poolTag = (string) str_replace("_", " ", $matches[1]);
+
+ if(ctype_digit($poolTag)){ //Assume tag is poolID
+ if($this->get_single_pool($poolTag)){
+ $this->add_post($poolTag, $event->id, true);
+ }
+ }else{ //Assume tag is poolTitle
+ if($pool = $this->get_single_pool_from_title($poolTag)){
+ $this->add_post($pool['id'], $event->id, true);
+ }
+ }
}
if(!empty($matches)) $event->metatag = true;
}
- public function add_post_from_tag(/*str*/ $poolTag, /*int*/ $imageID){
- $poolTag = str_replace("_", " ", $poolTag);
- //First check if pool tag is a title
- if(ctype_digit($poolTag)){
- //If string only contains numeric characters, assume it is $poolID
- if($this->get_single_pool($poolTag)){ //Make sure pool exists
- $this->add_post($poolTag, $imageID);
- }
- }else{
- //If string doesn't contain only numeric characters, check to see if tag is title.
- $pool = $this->get_single_pool_from_title($poolTag);
- if($pool){
- $this->add_post($pool['id'], $imageID);
- }
- }
- }
-
/* ------------------------------------------------- */
/* -------------- Private Functions -------------- */
/* ------------------------------------------------- */
@@ -842,9 +835,9 @@ class Pools extends Extension {
/*
* HERE WE ADD A SIMPLE POST FROM POOL
- * USED WITH FOREACH IN revert_history()
+ * USED WITH FOREACH IN revert_history() & onTagTermParse()
*/
- private function add_post(/*int*/ $poolID, /*int*/ $imageID) {
+ private function add_post(/*int*/ $poolID, /*int*/ $imageID, $history=false) {
global $database;
if(!$this->check_post($poolID, $imageID)) {
@@ -855,19 +848,29 @@ class Pools extends Extension {
}
$database->execute("UPDATE pools SET posts=(SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid) WHERE id=:pid", array("pid"=>$poolID));
+
+ if($history){
+ $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", array("pid"=>$poolID));
+ $this->add_history($poolID, 1, $imageID, $count);
+ }
}
/*
* HERE WE REMOVE A SIMPLE POST FROM POOL
- * USED WITH FOREACH IN revert_history()
+ * USED WITH FOREACH IN revert_history() & onTagTermParse()
*/
- private function delete_post(/*int*/ $poolID, /*int*/ $imageID) {
+ private function delete_post(/*int*/ $poolID, /*int*/ $imageID, $history=false) {
global $database;
$database->execute("DELETE FROM pool_images WHERE pool_id = :pid AND image_id = :iid", array("pid"=>$poolID, "iid"=>$imageID));
$database->execute("UPDATE pools SET posts=(SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid) WHERE id=:pid", array("pid"=>$poolID));
+
+ if($history){
+ $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", array("pid"=>$poolID));
+ $this->add_history($poolID, 0, $imageID, $count);
+ }
}
}
diff --git a/ext/pools/theme.php b/ext/pools/theme.php
index 444e76b5..138cc0eb 100644
--- a/ext/pools/theme.php
+++ b/ext/pools/theme.php
@@ -412,8 +412,15 @@ class PoolsTheme extends Themelet {
$html .= "";
+ $nav_html = '
+ Index
+
Create Pool
+
Pool Changes
+ ';
+
$page->set_title("Recent Changes");
$page->set_heading("Recent Changes");
+ $page->add_block(new Block("Navigation", $nav_html, "left", 10));
$page->add_block(new Block("Recent Changes", $html, "main", 10));
$this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages);