Merge branch 'master' of git://github.com/shish/shimmie2
This commit is contained in:
commit
15929f7264
5 changed files with 20 additions and 10 deletions
|
@ -92,7 +92,7 @@ class IPBan extends SimpleExtension {
|
||||||
public function onRemoveIPBan($event) {
|
public function onRemoveIPBan($event) {
|
||||||
global $database;
|
global $database;
|
||||||
$database->Execute("DELETE FROM bans WHERE id = :id", array("id"=>$event->id));
|
$database->Execute("DELETE FROM bans WHERE id = :id", array("id"=>$event->id));
|
||||||
$database->cache->delete("ip_bans");
|
$database->cache->delete("ip_bans_sorted");
|
||||||
}
|
}
|
||||||
|
|
||||||
// installer {{{
|
// installer {{{
|
||||||
|
@ -261,7 +261,7 @@ class IPBan extends SimpleExtension {
|
||||||
global $database;
|
global $database;
|
||||||
$sql = "INSERT INTO bans (ip, reason, end_timestamp, banner_id) VALUES (:ip, :reason, :end, :admin_id)";
|
$sql = "INSERT INTO bans (ip, reason, end_timestamp, banner_id) VALUES (:ip, :reason, :end, :admin_id)";
|
||||||
$database->Execute($sql, array("ip"=>$ip, "reason"=>$reason, "end"=>strtotime($end), "admin_id"=>$user->id));
|
$database->Execute($sql, array("ip"=>$ip, "reason"=>$reason, "end"=>strtotime($end), "admin_id"=>$user->id));
|
||||||
$database->cache->delete("ip_bans");
|
$database->cache->delete("ip_bans_sorted");
|
||||||
log_info("ipban", "'$user->name' has banned '$ip' because '$reason' until '$end'");
|
log_info("ipban", "'$user->name' has banned '$ip' because '$reason' until '$end'");
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
|
@ -111,13 +111,19 @@ class Image {
|
||||||
assert(is_numeric($start));
|
assert(is_numeric($start));
|
||||||
assert(is_numeric($limit));
|
assert(is_numeric($limit));
|
||||||
assert(is_array($tags));
|
assert(is_array($tags));
|
||||||
global $database;
|
global $database, $user;
|
||||||
|
|
||||||
$images = array();
|
$images = array();
|
||||||
|
|
||||||
if($start < 0) $start = 0;
|
if($start < 0) $start = 0;
|
||||||
if($limit < 1) $limit = 1;
|
if($limit < 1) $limit = 1;
|
||||||
|
|
||||||
|
if(SPEED_HAX) {
|
||||||
|
if($user->is_anonymous() and count($tags) > 3) {
|
||||||
|
die("Anonymous users may only search for up to 3 tags at a time"); // FIXME: throw an exception?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$querylet = Image::build_search_querylet($tags);
|
$querylet = Image::build_search_querylet($tags);
|
||||||
$querylet->append(new Querylet("ORDER BY images.id DESC LIMIT :limit OFFSET :offset", array("limit"=>$limit, "offset"=>$start)));
|
$querylet->append(new Querylet("ORDER BY images.id DESC LIMIT :limit OFFSET :offset", array("limit"=>$limit, "offset"=>$start)));
|
||||||
#var_dump($querylet->sql); var_dump($querylet->variables);
|
#var_dump($querylet->sql); var_dump($querylet->variables);
|
||||||
|
|
|
@ -173,7 +173,6 @@ class CommentList extends SimpleExtension {
|
||||||
$h_comment_rate = sprintf("%.1f", ($i_comment_count / $i_days_old));
|
$h_comment_rate = sprintf("%.1f", ($i_comment_count / $i_days_old));
|
||||||
$event->add_stats("Comments made: $i_comment_count, $h_comment_rate per day");
|
$event->add_stats("Comments made: $i_comment_count, $h_comment_rate per day");
|
||||||
|
|
||||||
global $user;
|
|
||||||
$recent = $this->get_user_recent_comments($event->display_user->id, 10);
|
$recent = $this->get_user_recent_comments($event->display_user->id, 10);
|
||||||
$this->theme->display_user_comments($recent);
|
$this->theme->display_user_comments($recent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,12 +144,17 @@ class CommentListTheme extends Themelet {
|
||||||
$i_comment_id = int_escape($comment->comment_id);
|
$i_comment_id = int_escape($comment->comment_id);
|
||||||
$i_image_id = int_escape($comment->image_id);
|
$i_image_id = int_escape($comment->image_id);
|
||||||
|
|
||||||
|
if($h_name == "Anonymous") {
|
||||||
$anoncode = "";
|
$anoncode = "";
|
||||||
if($h_name == "Anonymous" && $this->anon_id >= 0) {
|
if($this->anon_id >= 0) {
|
||||||
$anoncode = '<sup>'.$this->anon_id.'</sup>';
|
$anoncode = '<sup>'.$this->anon_id.'</sup>';
|
||||||
$this->anon_id++;
|
$this->anon_id++;
|
||||||
}
|
}
|
||||||
$h_userlink = '<a href="'.make_link('user/'.$h_name).'">'.$h_name.'</a>'.$anoncode;
|
$h_userlink = $h_name . $anoncode;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$h_userlink = '<a href="'.make_link('user/'.$h_name).'">'.$h_name.'</a>';
|
||||||
|
}
|
||||||
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
|
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
|
||||||
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
|
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
|
||||||
$h_dellink = $user->is_admin() ?
|
$h_dellink = $user->is_admin() ?
|
||||||
|
|
|
@ -158,7 +158,7 @@ class UserPage extends SimpleExtension {
|
||||||
$this->theme->display_error($page, "Not Logged In",
|
$this->theme->display_error($page, "Not Logged In",
|
||||||
"You aren't logged in. First do that, then you can see your stats.");
|
"You aren't logged in. First do that, then you can see your stats.");
|
||||||
}
|
}
|
||||||
else if(!is_null($display_user)) {
|
else if(!is_null($display_user) && ($display_user->id != $config->get_int("anon_id"))) {
|
||||||
send_event(new UserPageBuildingEvent($display_user));
|
send_event(new UserPageBuildingEvent($display_user));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Reference in a new issue