merge~
This commit is contained in:
commit
03204859c1
13 changed files with 151 additions and 108 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
>
|
||||
<param name='movie' value='$ilink'/>
|
||||
<param name='quality' value='high' />
|
||||
|
@ -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'></embed>
|
||||
</object>";
|
||||
$page->add_block(new Block("Flash Animation", $html, "main", 0));
|
||||
|
|
33
contrib/holiday/main.php
Normal file
33
contrib/holiday/main.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Name: Holiday Theme
|
||||
* Author: DakuTree <thedakutree@codeanimu.net>
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -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*/
|
20
contrib/holiday/theme.php
Normal file
20
contrib/holiday/theme.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
class HolidayTheme extends Themelet {
|
||||
public function display_holiday($date) {
|
||||
global $page;
|
||||
if($date){
|
||||
$csssheet = "<link rel='stylesheet' href='".get_base_href()."/contrib/holiday/stylesheets/";
|
||||
|
||||
// April Fools
|
||||
// Flips the entire page upside down!
|
||||
// TODO: Make it possible for the user to turn this off!
|
||||
if(date('d/m') == '01/04'){
|
||||
$csssheet .= "aprilfools.css";
|
||||
}
|
||||
|
||||
$csssheet .= "' type='text/css'>";
|
||||
$page->add_html_header("$csssheet");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -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());
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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("<li>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);}
|
||||
}
|
||||
|
|
|
@ -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("<link rel='stylesheet' href='".get_base_href()."/ext/upload/_style.css' type='text/css'>");
|
||||
|
||||
$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("<link rel='stylesheet' href='".get_base_href()."/ext/upload/_style.css' type='text/css'>");
|
||||
$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 .= "
|
||||
<tr>
|
||||
<td width='60'><form><input id='radio_buttona' type='radio' name='method' value='file' checked='checked' onclick='javascript:document.getElementById("url0").style.display = "none";document.getElementById("url0").value = "";document.getElementById("data0").style.display = ""' /> File<br>";
|
||||
<td width='60'><form><input id='radio_button_a' type='radio' name='method' value='file' checked='checked' onclick='$js1' /> File<br>";
|
||||
if($tl_enabled) {
|
||||
$upload_list .="
|
||||
<input id='radio_buttonb' type='radio' name='method' value='url' onclick='javascript:document.getElementById("data0").style.display = "none";document.getElementById("data0").value = "";document.getElementById("url0").style.display = ""' /> URL</ br></td></form>
|
||||
<td><input id='data0' name='data0' class='wid' type='file'><input id='url0' name='url0' class='wid' type='text' style='display:none'></td>
|
||||
<input id='radio_button_b' type='radio' name='method' value='url' onclick='$js2' /> URL</ br></td></form>
|
||||
<td><input id='data' name='data' class='wid' type='file'><input id='url' name='url' class='wid' type='text' style='display:none'></td>
|
||||
";
|
||||
} else {
|
||||
$upload_list .= "</form></td>
|
||||
|
|
|
@ -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 = "<link rel='stylesheet' href='$data_href/themes/$theme_name/holidays/";
|
||||
|
||||
// April Fools
|
||||
// Flips the entire page upside down!
|
||||
// TODO: Make it possible for the user to turn this off!
|
||||
if(date('d/m') == '01/04'){
|
||||
$csssheet .= "style_aprilfools.css";
|
||||
$holtag = "april_fools";
|
||||
}
|
||||
$csssheet .= "' type='text/css'>";
|
||||
//Optional! Uses a random image with a size lower then 800x91 & using the holiday tag and sticks it at top of page like a banner.
|
||||
/*$banner = "<div>";
|
||||
if(file_exists("ext/random_image")){
|
||||
$banner .= "<center><img src='$data_href/random_image/download/size<800x91+$holtag'></center>";
|
||||
}
|
||||
$banner .= "</div>";*/
|
||||
}else{
|
||||
$banner = "";
|
||||
}
|
||||
|
||||
$menu = "<div class='menu'>
|
||||
<script type='text/javascript' src='$data_href/themes/$theme_name/wz_tooltip.js'></script>
|
||||
|
@ -180,14 +153,6 @@ class Layout {
|
|||
$main_block_html = "<div id='body'>$main_block_html</div>";
|
||||
}
|
||||
|
||||
// This is required for the holiday feature.
|
||||
if(empty($csssheet)){
|
||||
$csssheet = "";
|
||||
}
|
||||
if(empty($banner)){
|
||||
$holiday = "";
|
||||
}
|
||||
|
||||
print <<<EOD
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
|
@ -195,12 +160,12 @@ class Layout {
|
|||
<title>{$page->title}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
||||
$csssheet
|
||||
|
||||
$header_html
|
||||
</head>
|
||||
|
||||
<body>
|
||||
$banner
|
||||
|
||||
$menu
|
||||
$custom_sublinks
|
||||
|
||||
|
|
|
@ -107,12 +107,20 @@ class CustomUserPageTheme extends UserPageTheme {
|
|||
<input type='hidden' name='name' value='{$duser->name}'>
|
||||
<input type='hidden' name='id' value='{$duser->id}'>
|
||||
<table style='width: 300px;'>
|
||||
<tr><td colspan='2'>Change Password</td></tr>
|
||||
<tr><th colspan='2'>Change Password</th></tr>
|
||||
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
|
||||
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
|
||||
<tr><td colspan='2'><input type='Submit' value='Change Password'></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<p><form action='".make_link("user_admin/change_email")."' method='POST'>
|
||||
<input type='hidden' name='id' value='{$duser->id}'>
|
||||
<table style='width: 300px;'>
|
||||
<tr><th colspan='2'>Change Email</th></tr>
|
||||
<tr><td>Address</td><td><input type='text' name='address' value='".html_escape($duser->email)."'></td></tr>
|
||||
<tr><td colspan='2'><input type='Submit' value='Set'></td></tr>
|
||||
</table>
|
||||
</form></p>
|
||||
";
|
||||
|
||||
if($user->is_admin()) {
|
||||
|
|
Reference in a new issue