pull a bunch of r34 tweaks intro trunk
git-svn-id: file:///home/shish/svn/shimmie2/trunk@959 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
8ac2428820
commit
c741ea216f
@ -46,8 +46,9 @@ class Image_Hash_Ban extends Extension {
|
|||||||
if(is_a($event, 'DataUploadEvent')) {
|
if(is_a($event, 'DataUploadEvent')) {
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
if ($database->db->GetOne("SELECT COUNT(*) FROM image_bans WHERE hash = ?", $event->hash) == 1) {
|
$row = $database->db->GetRow("SELECT * FROM image_bans WHERE hash = ?", $event->hash);
|
||||||
$event->veto("This image has been banned!");
|
if($row) {
|
||||||
|
$event->veto("Image ".html_escape($row["hash"])." has been banned, reason: ".format_text($row["reason"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,12 @@ function _count_execs($db, $sql, $inputarray) {
|
|||||||
global $_execs;
|
global $_execs;
|
||||||
if(DEBUG) {
|
if(DEBUG) {
|
||||||
$fp = fopen("sql.log", "a");
|
$fp = fopen("sql.log", "a");
|
||||||
fwrite($fp, preg_replace('/\s+/msi', ' ', $sql)."\n");
|
if(is_array($inputarray)) {
|
||||||
|
fwrite($fp, preg_replace('/\s+/msi', ' ', $sql)." -- ".join(", ", $inputarray)."\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fwrite($fp, preg_replace('/\s+/msi', ' ', $sql)."\n");
|
||||||
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
if (!is_array($inputarray)) $_execs++;
|
if (!is_array($inputarray)) $_execs++;
|
||||||
@ -262,6 +267,12 @@ function move_upload_to_archive($event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function format_text($string) {
|
||||||
|
$tfe = new TextFormattingEvent($string);
|
||||||
|
send_event($tfe);
|
||||||
|
return $tfe->formatted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||||
* Debugging functions *
|
* Debugging functions *
|
||||||
@ -287,9 +298,13 @@ function get_debug_info() {
|
|||||||
}
|
}
|
||||||
$i_files = count(get_included_files());
|
$i_files = count(get_included_files());
|
||||||
global $_execs;
|
global $_execs;
|
||||||
|
global $database;
|
||||||
|
$hits = $database->cache_hits;
|
||||||
|
$miss = $database->cache_misses;
|
||||||
$debug = "<br>Took $i_utime + $i_stime seconds and {$i_mem}MB of RAM";
|
$debug = "<br>Took $i_utime + $i_stime seconds and {$i_mem}MB of RAM";
|
||||||
$debug .= "; Used $i_files files and $_execs queries";
|
$debug .= "; Used $i_files files and $_execs queries";
|
||||||
$debug .= "; Sent $_event_count events";
|
$debug .= "; Sent $_event_count events";
|
||||||
|
$debug .= "; $hits cache hits and $miss misses";
|
||||||
|
|
||||||
return $debug;
|
return $debug;
|
||||||
}
|
}
|
||||||
|
@ -343,6 +343,12 @@ class CommentList extends Extension {
|
|||||||
else if($this->is_dupe($image_id, $comment)) {
|
else if($this->is_dupe($image_id, $comment)) {
|
||||||
$event->veto("Someone already made that comment on that image -- try and be more original?");
|
$event->veto("Someone already made that comment on that image -- try and be more original?");
|
||||||
}
|
}
|
||||||
|
else if(strlen($comment) > 9000) {
|
||||||
|
$event->veto("Comment too long~");
|
||||||
|
}
|
||||||
|
else if(strlen($comment)/strlen(gzcompress($comment)) > 10) {
|
||||||
|
$event->veto("Comment too repetitive~");
|
||||||
|
}
|
||||||
else if($user->is_anonymous() && $this->is_spam($comment)) {
|
else if($user->is_anonymous() && $this->is_spam($comment)) {
|
||||||
$event->veto("Akismet thinks that your comment is spam. Try rewriting the comment, or logging in.");
|
$event->veto("Akismet thinks that your comment is spam. Try rewriting the comment, or logging in.");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user