PDO compat for comments
This commit is contained in:
		
							parent
							
								
									8e2f2a4600
								
							
						
					
					
						commit
						68585bb8c8
					
				@ -339,9 +339,9 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
		$window = int_escape($config->get_int('comment_window'));
 | 
							$window = int_escape($config->get_int('comment_window'));
 | 
				
			||||||
		$max = int_escape($config->get_int('comment_limit'));
 | 
							$max = int_escape($config->get_int('comment_limit'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$result = $database->Execute("SELECT * FROM comments WHERE owner_ip = ? ".
 | 
							$result = $database->Execute("SELECT * FROM comments WHERE owner_ip = :remote_id ".
 | 
				
			||||||
				"AND posted > date_sub(now(), interval ? minute)",
 | 
									"AND posted > date_sub(now(), interval :window minute)",
 | 
				
			||||||
				Array($_SERVER['REMOTE_ADDR'], $window));
 | 
									Array("remote_ip"=>$_SERVER['REMOTE_ADDR'], "window"=>$window));
 | 
				
			||||||
		$recent_comments = $result->RecordCount();
 | 
							$recent_comments = $result->RecordCount();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return ($recent_comments >= $max);
 | 
							return ($recent_comments >= $max);
 | 
				
			||||||
@ -397,7 +397,7 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private function is_dupe($image_id, $comment) {
 | 
						private function is_dupe($image_id, $comment) {
 | 
				
			||||||
		global $database;
 | 
							global $database;
 | 
				
			||||||
		return ($database->get_row("SELECT * FROM comments WHERE image_id=? AND comment=?", array($image_id, $comment)));
 | 
							return ($database->get_row("SELECT * FROM comments WHERE image_id=:image_id AND comment=:comment", array("image_id"=>$image_id, "comment"=>$comment)));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private function add_comment_wrapper($image_id, $user, $comment, $event) {
 | 
						private function add_comment_wrapper($image_id, $user, $comment, $event) {
 | 
				
			||||||
@ -448,8 +448,8 @@ class CommentList extends SimpleExtension {
 | 
				
			|||||||
		else {
 | 
							else {
 | 
				
			||||||
			$database->Execute(
 | 
								$database->Execute(
 | 
				
			||||||
					"INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment) ".
 | 
										"INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment) ".
 | 
				
			||||||
					"VALUES(?, ?, ?, now(), ?)",
 | 
										"VALUES(:image_id, :user_id, :remote_addr, now(), :comment)",
 | 
				
			||||||
					array($image_id, $user->id, $_SERVER['REMOTE_ADDR'], $comment));
 | 
										array("image_id"=>$image_id, "user_id"=>$user->id, "remote_addr"=>$_SERVER['REMOTE_ADDR'], "comment"=>$comment));
 | 
				
			||||||
			$cid = $database->get_last_insert_id();
 | 
								$cid = $database->get_last_insert_id();
 | 
				
			||||||
			log_info("comment", "Comment #$cid added to Image #$image_id");
 | 
								log_info("comment", "Comment #$cid added to Image #$image_id");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user