diff --git a/.gitignore b/.gitignore index b1d70c05..8b9f72d0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ sql.log shimmie.log !lib/images ext/admin +ext/amazon_s3 ext/artists ext/autocomplete ext/ban_words @@ -28,6 +29,7 @@ ext/handle_flash ext/handle_ico ext/handle_mp3 ext/handle_svg +ext/holiday ext/home ext/image_hash_ban ext/ipban @@ -44,6 +46,7 @@ ext/random_image ext/rating ext/regen_thumb ext/report_image +ext/resize ext/res_limit ext/rss_comments ext/rss_images @@ -56,7 +59,7 @@ ext/tagger ext/tag_history ext/text_score ext/tips -ext/amazon_s3 +ext/twitter_soc ext/upload_cmd ext/wiki ext/word_filter diff --git a/contrib/handle_flash/theme.php b/contrib/handle_flash/theme.php index a0e8cbb4..aec6bb9f 100644 --- a/contrib/handle_flash/theme.php +++ b/contrib/handle_flash/theme.php @@ -9,6 +9,7 @@ class FlashFileHandlerTheme extends Themelet { codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' height='{$image->height}' width='{$image->width}' + wmode='opaque' > @@ -16,6 +17,7 @@ class FlashFileHandlerTheme extends Themelet { pluginspage='http://www.macromedia.com/go/getflashplayer' height='{$image->height}' width='{$image->width}' + wmode='opaque' type='application/x-shockwave-flash'> "; $page->add_block(new Block("Flash Animation", $html, "main", 0)); diff --git a/contrib/holiday/main.php b/contrib/holiday/main.php new file mode 100644 index 00000000..598e2a89 --- /dev/null +++ b/contrib/holiday/main.php @@ -0,0 +1,33 @@ + + * Link: http://www.codeanimu.net + * License: GPLv2 + * Description: Use an additional stylesheet on certain holidays. + */ +class Holiday extends SimpleExtension { + public function onInitExt(Event $event) { + global $config; + $config->set_default_bool("holiday_aprilfools", false); + } + + public function onSetupBuilding(Event $event) { + global $config; + $sb = new SetupBlock("Holiday Theme"); + $sb->add_bool_option("holiday_aprilfools", "Enable April Fools"); + $event->panel->add_block($sb); + } + + public function onPageRequest(Event $event) { + global $config; + $date = /*date('d/m') == '01/01' ||date('d/m') == '14/02' || */date('d/m') == '01/04'/* || date('d/m') == '24/12' || date('d/m') == '25/12' || date('d/m') == '31/12'*/; + if($date){ + if($config->get_bool("holiday_aprilfools")){ + $this->theme->display_holiday($date); + } + } + } + +} +?> diff --git a/themes/lite/holidays/style_aprilfools.css b/contrib/holiday/stylesheets/aprilfools.css similarity index 67% rename from themes/lite/holidays/style_aprilfools.css rename to contrib/holiday/stylesheets/aprilfools.css index 0f3f3080..9250c688 100644 --- a/themes/lite/holidays/style_aprilfools.css +++ b/contrib/holiday/stylesheets/aprilfools.css @@ -1,18 +1,8 @@ - /* - If you wish to play about with colors, the main two colors to replace are: - Main color: #CEDFF0 - Secondary color: #E3EFFA - */ - BODY { - background: #F0F7FF; - font-family: sans-serif; - font-size: 14px; - margin: 0px; /* It's a bit crazy but, april fools is supposed to be crazy. This flips the entire page upside down. TODO: Add a way for the user to disable this */ - + -webkit-transform: rotate(-180deg); /*Safari*/ -moz-transform: rotate(-180deg); /*Firefox*/ -o-transform: rotate(-180deg); /*Opera*/ diff --git a/contrib/holiday/theme.php b/contrib/holiday/theme.php new file mode 100644 index 00000000..2012f3ee --- /dev/null +++ b/contrib/holiday/theme.php @@ -0,0 +1,20 @@ +"; + $page->add_html_header("$csssheet"); + } + } +} +?> diff --git a/contrib/rating/main.php b/contrib/rating/main.php index f456fdf3..32a90747 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -64,7 +64,7 @@ class Ratings implements Extension { } if($event instanceof RatingSetEvent) { - $this->set_rating($event->image->id, $event->rating); + $this->set_rating($event->image->id, $event->rating, $event->image->rating); } if($event instanceof ImageInfoBoxBuildingEvent) { @@ -205,9 +205,12 @@ class Ratings implements Extension { } } - private function set_rating($image_id, $rating) { + private function set_rating($image_id, $rating, $old_rating) { global $database; - $database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id)); + if($old_rating != $rating){ + $database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id)); + log_info("core-image", "Rating for Image #{$image_id} set to: ".$this->theme->rating_to_name($rating)); + } } } add_event_listener(new Ratings()); diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 23730451..e1495b91 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -363,23 +363,29 @@ class Image { /** * Set the image's source URL */ - public function set_source($source) { + public function set_source($source, $old_source) { global $database; if(empty($source)) $source = null; - $database->execute("UPDATE images SET source=:source WHERE id=:id", array("source"=>$source, "id"=>$this->id)); + if($old_source != $source){ + $database->execute("UPDATE images SET source=:source WHERE id=:id", array("source"=>$source, "id"=>$this->id)); + log_info("core-image", "Source for Image #{$this->id} set to: ".$source); + } } public function is_locked() { return ($this->locked === true || $this->locked == "Y" || $this->locked == "t"); } - public function set_locked($tf) { + public function set_locked($tf, $old_sln) { global $database; $ln = $tf ? "Y" : "N"; $sln = $database->engine->scoreql_to_sql("SCORE_BOOL_$ln"); $sln = str_replace("'", "", $sln); $sln = str_replace('"', "", $sln); - $database->execute("UPDATE images SET locked=:yn WHERE id=:id", array("yn"=>$sln, "id"=>$this->id)); + if($old_sln != $sln){ + $database->execute("UPDATE images SET locked=:yn WHERE id=:id", array("yn"=>$sln, "id"=>$this->id)); + log_info("core-image", "Setting Image #{$this->id} lock to: {$event->locked}".$sln); + } } /** @@ -398,47 +404,49 @@ class Image { /** * Set the tags for this image */ - public function set_tags($tags) { + public function set_tags($tags, $old_tags) { global $database; $tags = Tag::resolve_list($tags); assert(is_array($tags)); assert(count($tags) > 0); - - // delete old - $this->delete_tags_from_image(); - - // insert each new tags - foreach($tags as $tag) { - $id = $database->get_one( - $database->engine->scoreql_to_sql( - "SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" - ), - array("tag"=>$tag)); - if(empty($id)) { - // a new tag - $database->execute( - "INSERT INTO tags(tag) VALUES (:tag)", + $new_tags = implode(" ", $tags); + if($old_tags != $new_tags){ + // delete old + $this->delete_tags_from_image(); + // insert each new tags + foreach($tags as $tag) { + $id = $database->get_one( + $database->engine->scoreql_to_sql( + "SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" + ), array("tag"=>$tag)); + if(empty($id)) { + // a new tag + $database->execute( + "INSERT INTO tags(tag) VALUES (:tag)", + array("tag"=>$tag)); + $database->execute( + "INSERT INTO image_tags(image_id, tag_id) + VALUES(:id, (SELECT id FROM tags WHERE tag = :tag))", + array("id"=>$this->id, "tag"=>$tag)); + } + else { + // user of an existing tag + $database->execute( + "INSERT INTO image_tags(image_id, tag_id) VALUES(:iid, :tid)", + array("iid"=>$this->id, "tid"=>$id)); + } $database->execute( - "INSERT INTO image_tags(image_id, tag_id) - VALUES(:id, (SELECT id FROM tags WHERE tag = :tag))", - array("id"=>$this->id, "tag"=>$tag)); + $database->engine->scoreql_to_sql( + "UPDATE tags SET count = count + 1 WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" + ), + array("tag"=>$tag)); } - else { - // user of an existing tag - $database->execute( - "INSERT INTO image_tags(image_id, tag_id) VALUES(:iid, :tid)", - array("iid"=>$this->id, "tid"=>$id)); - } - $database->execute( - $database->engine->scoreql_to_sql( - "UPDATE tags SET count = count + 1 WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" - ), - array("tag"=>$tag)); - } - log_info("core-image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags)); + log_info("core-image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags)); + $database->cache->delete("image-{$this->id}-tags"); + } } /** diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 9cea8ced..afdfdbe1 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -91,20 +91,19 @@ class TagEdit implements Extension { if($event instanceof TagSetEvent) { if($user->is_admin() || !$event->image->is_locked()) { - $event->image->set_tags($event->tags); + $event->image->set_tags($event->tags, $event->image->get_tag_list()); } } if($event instanceof SourceSetEvent) { if($user->is_admin() || !$event->image->is_locked()) { - $event->image->set_source($event->source); + $event->image->set_source($event->source, $event->image->source); } } if($event instanceof LockSetEvent) { if($user->is_admin()) { - log_debug("tag_edit", "Setting Image #{$event->image->id} lock to: {$event->locked}"); - $event->image->set_locked($event->locked); + $event->image->set_locked($event->locked, $event->image->locked); } } diff --git a/ext/upload/style.css b/ext/upload/_style.css similarity index 100% rename from ext/upload/style.css rename to ext/upload/_style.css diff --git a/ext/upload/bookmarklet.js b/ext/upload/bookmarklet.js index 05646134..2838bdca 100644 --- a/ext/upload/bookmarklet.js +++ b/ext/upload/bookmarklet.js @@ -12,19 +12,19 @@ if(document.getElementById("post_tags") !== null){ if (typeof tag !=="ftp://ftp." && chk !==1){var tag=document.getElementById("post_tags").value;} var rtg=document.getElementById("stats").innerHTML.match("