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("
  • Rating: (.*)<\/li>")[1]; var srx="http://" + document.location.hostname + document.location.href.match("\/post\/show\/[0-9]+\/"); - var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)"); - if(filesze[2] == "MB"){var filesze = filesze[1] * 1024;}else{var filesze = filesze[2].match("[0-9]+");} - if(tag.search(/\bflash\b/)==-1){ + + if(tag.search(/\bflash\b/)===-1){ + var filesze=document.getElementById("stats").innerHTML.match("[0-9] \\(((?:\.*[0-9])) ([a-zA-Z]+)"); + if(filesze[2] == "MB"){var filesze = filesze[1] * 1024;}else{var filesze = filesze[2].match("[0-9]+");} + if(supext.search(document.getElementById("highres").href.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){ if(filesze <= maxsze){ - location.href=ste+document.getElementById("highres").href+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx; + location.href=ste+document.getElementById("highres").href+"&tags="+tag+"&rating="+rtg+"&source="+srx; }else{alert(toobig);} }else{alert(notsup);} }else{ - if(supext.search(document.getElementById("highres").href.match("http\:\/\/.*\\.([a-z0-9]+)")[1]) !== -1){ - if(filesze <= maxsze){ - location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+tag+"&rating="+rtg[1]+"&source="+srx; - }else{alert(toobig);} + if(supext.search("swf") !== -1){ + location.href=ste+document.getElementsByName("movie")[0].value+"&tags="+tag+"&rating="+rtg+"&source="+srx; }else{alert(notsup);} } } @@ -45,7 +45,7 @@ else if(document.getElementsByTagName("title")[0].innerHTML.search("Image [0-9.- }else{alert(notsup);} }else{ var mov = document.location.hostname+document.getElementsByName("movie")[0].value; - if(supext.search(mov.match(".*\\.([a-z0-9]+)")[1]) !== -1){ + if(supext.search("swf") !== -1){ location.href=ste+mov+"&tags="+tag+"&source="+srx; }else{alert(notsup);} } diff --git a/ext/upload/theme.php b/ext/upload/theme.php index fc6d5f59..993a40c5 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -10,9 +10,10 @@ class UploadTheme extends Themelet { } public function display_page(Page $page) { - global $config; - $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); + global $config, $page; + $page->add_html_header(""); + $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); // Uploader 2.0! $upload_list = ""; for($i=0; $i<$config->get_int('upload_count'); $i++) @@ -167,17 +168,28 @@ class UploadTheme extends Themelet { /* only allows 1 file to be uploaded - for replacing another image file */ public function display_replace_page(Page $page, $image_id) { - global $config; + global $config, $page; + $page->add_html_header(""); $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); + $js2 = 'javascript:$(function() { + $("#data").hide(); + $("#data").val(""); + $("#url").show(); });'; + + $js1 = 'javascript:$(function() { + $("#url").hide(); + $("#url").val(""); + $("#data").show(); });'; + $upload_list = ''; $upload_list .= " -
    File
    "; + File
    "; if($tl_enabled) { $upload_list .=" - URL
    - + URL + "; } else { $upload_list .= " diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index 363f466b..44e1ec08 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -23,33 +23,6 @@ class Layout { foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } - - /* Holiday Stuff! - If the current day is one of the set holidays, it will use a seperate stylesheet. Aswell as a few extra things depending on the day. - This only adds April Fools for now. - TODO: Add setup block to make the whole holiday thing "optional". / Choose what holidays you wish to use. - */ - if(/*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'*/){ - - $csssheet = "$main_block_html"; } - // This is required for the holiday feature. - if(empty($csssheet)){ - $csssheet = ""; - } - if(empty($banner)){ - $holiday = ""; - } - print << @@ -195,12 +160,12 @@ class Layout { {$page->title} - $csssheet + $header_html - $banner + $menu $custom_sublinks diff --git a/themes/lite/user.theme.php b/themes/lite/user.theme.php index e6241a8e..7f6d6440 100644 --- a/themes/lite/user.theme.php +++ b/themes/lite/user.theme.php @@ -107,12 +107,20 @@ class CustomUserPageTheme extends UserPageTheme { - +
    Change Password
    Change Password
    Password
    Repeat Password
    +

    + + + + + +
    Change Email
    Address
    +

    "; if($user->is_admin()) {