Merge branch 'master' of git://github.com/shish/shimmie2

This commit is contained in:
green-ponies (jgen) 2012-02-05 11:32:48 -05:00
commit 15929f7264
5 changed files with 20 additions and 10 deletions

View file

@ -92,7 +92,7 @@ class IPBan extends SimpleExtension {
public function onRemoveIPBan($event) {
global $database;
$database->Execute("DELETE FROM bans WHERE id = :id", array("id"=>$event->id));
$database->cache->delete("ip_bans");
$database->cache->delete("ip_bans_sorted");
}
// installer {{{
@ -261,7 +261,7 @@ class IPBan extends SimpleExtension {
global $database;
$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->cache->delete("ip_bans");
$database->cache->delete("ip_bans_sorted");
log_info("ipban", "'$user->name' has banned '$ip' because '$reason' until '$end'");
}
// }}}

View file

@ -111,13 +111,19 @@ class Image {
assert(is_numeric($start));
assert(is_numeric($limit));
assert(is_array($tags));
global $database;
global $database, $user;
$images = array();
if($start < 0) $start = 0;
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->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);

View file

@ -173,7 +173,6 @@ class CommentList extends SimpleExtension {
$h_comment_rate = sprintf("%.1f", ($i_comment_count / $i_days_old));
$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);
$this->theme->display_user_comments($recent);
}

View file

@ -144,12 +144,17 @@ class CommentListTheme extends Themelet {
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
$anoncode = "";
if($h_name == "Anonymous" && $this->anon_id >= 0) {
$anoncode = '<sup>'.$this->anon_id.'</sup>';
$this->anon_id++;
if($h_name == "Anonymous") {
$anoncode = "";
if($this->anon_id >= 0) {
$anoncode = '<sup>'.$this->anon_id.'</sup>';
$this->anon_id++;
}
$h_userlink = $h_name . $anoncode;
}
else {
$h_userlink = '<a href="'.make_link('user/'.$h_name).'">'.$h_name.'</a>';
}
$h_userlink = '<a href="'.make_link('user/'.$h_name).'">'.$h_name.'</a>'.$anoncode;
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
$h_dellink = $user->is_admin() ?

View file

@ -158,7 +158,7 @@ class UserPage extends SimpleExtension {
$this->theme->display_error($page, "Not Logged In",
"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));
}
else {