diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index e36c40ee..869e7de6 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -476,6 +476,18 @@ class Image { $this->delete_tags_from_image(); // insert each new tags foreach($tags as $tag) { + if(preg_match("/^source=(.*)$/i", $tag, $matches)) { + $this->set_source($matches[1]); + continue; + } + if(preg_match("/^pool=(.*)$/i", $tag, $matches)) { + if(class_exists("Pools")) { + $pls = new Pools(); + $pls->add_post_from_tag($matches[1], $this->id); + } + continue; + } + $id = $database->get_one( $database->scoreql_to_sql( "SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" diff --git a/ext/pools/main.php b/ext/pools/main.php index 6bb9a24d..22ac55d8 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -293,6 +293,23 @@ class Pools extends Extension { } } + 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 -------------- */ /* ------------------------------------------------- */ @@ -362,7 +379,7 @@ class Pools extends Extension { */ private function add_pool() { global $user, $database; - #throw new PoolCreationException("Pool needs a title"); + if($user->is_anonymous()) { throw new PoolCreationException("You must be registered and logged in to add a image."); } @@ -372,6 +389,7 @@ class Pools extends Extension { if($this->get_single_pool_from_title($_POST["title"])) { throw new PoolCreationException("A pool using this title already exists."); } + $public = $_POST["public"] == "Y" ? "Y" : "N"; $database->execute(" INSERT INTO pools (user_id, public, title, description, date) diff --git a/ext/pools/theme.php b/ext/pools/theme.php index 269b9a1c..3b2e315c 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -350,7 +350,7 @@ class PoolsTheme extends Themelet { "". ""; - $pools[0]['description'] = ""; //This is a rogue fix to avoid showing the description twice. + $pools[0]['description'] = ""; //This is a rough fix to avoid showing the description twice. $this->display_top($pools, "Editing Pool", true); $page->add_block(new Block("Editing Description", $desc_html, "main", 28)); $page->add_block(new Block("Editing Posts", $pool_images, "main", 30));