forked from Cavemanon/cavepaintings
use wrapped database execute function
git-svn-id: file:///home/shish/svn/shimmie2/trunk@129 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
@@ -24,7 +24,7 @@ class AliasEditor extends Extension {
|
||||
else if($event->get_arg(0) == "remove") {
|
||||
if(isset($_POST['oldtag'])) {
|
||||
global $database;
|
||||
$database->db->Execute("DELETE FROM aliases WHERE oldtag=?", array($_POST['oldtag']));
|
||||
$database->Execute("DELETE FROM aliases WHERE oldtag=?", array($_POST['oldtag']));
|
||||
|
||||
global $page;
|
||||
$page->set_mode("redirect");
|
||||
@@ -41,7 +41,7 @@ class AliasEditor extends Extension {
|
||||
|
||||
if(is_a($event, 'AddAliasEvent')) {
|
||||
global $database;
|
||||
$database->db->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag));
|
||||
$database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag));
|
||||
|
||||
global $page;
|
||||
$page->set_mode("redirect");
|
||||
|
@@ -130,7 +130,7 @@ class CommentList extends Extension {
|
||||
protected function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
$database->db->Execute("CREATE TABLE `comments` (
|
||||
$database->Execute("CREATE TABLE `comments` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`image_id` int(11) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
@@ -162,7 +162,7 @@ class CommentList extends Extension {
|
||||
ORDER BY latest DESC
|
||||
LIMIT ?,?
|
||||
";
|
||||
$result = $database->db->Execute($get_threads, array($start, $threads_per_page));
|
||||
$result = $database->Execute($get_threads, array($start, $threads_per_page));
|
||||
|
||||
|
||||
$total_pages = (int)($database->db->GetOne("SELECT COUNT(distinct image_id) AS count FROM comments") / 10);
|
||||
@@ -257,7 +257,7 @@ class CommentList extends Extension {
|
||||
global $config;
|
||||
|
||||
$html = "";
|
||||
$result = $database->db->Execute($query, $args);
|
||||
$result = $database->Execute($query, $args);
|
||||
while(!$result->EOF) {
|
||||
$comment = new Comment($result->fields);
|
||||
$html .= $comment->to_html($trim);
|
||||
@@ -275,7 +275,7 @@ class CommentList extends Extension {
|
||||
$window = int_escape($config->get_int('comment_window'));
|
||||
$max = int_escape($config->get_int('comment_limit'));
|
||||
|
||||
$result = $database->db->Execute("SELECT * FROM comments WHERE owner_ip = ? ".
|
||||
$result = $database->Execute("SELECT * FROM comments WHERE owner_ip = ? ".
|
||||
"AND posted > date_sub(now(), interval ? minute)",
|
||||
Array($_SERVER['REMOTE_ADDR'], $window));
|
||||
$recent_comments = $result->RecordCount();
|
||||
@@ -343,7 +343,7 @@ class CommentList extends Extension {
|
||||
"Akismet thinks that your comment is spam. Try rewriting the comment?"));
|
||||
}
|
||||
else {
|
||||
$database->db->Execute(
|
||||
$database->Execute(
|
||||
"INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment) ".
|
||||
"VALUES(?, ?, ?, now(), ?)",
|
||||
array($image_id, $user->id, $_SERVER['REMOTE_ADDR'], $comment));
|
||||
@@ -354,12 +354,12 @@ class CommentList extends Extension {
|
||||
|
||||
private function delete_comments($image_id) {
|
||||
global $database;
|
||||
$database->db->Execute("DELETE FROM comments WHERE image_id=?", array($image_id));
|
||||
$database->Execute("DELETE FROM comments WHERE image_id=?", array($image_id));
|
||||
}
|
||||
|
||||
private function delete_comment($comment_id) {
|
||||
global $database;
|
||||
$database->db->Execute("DELETE FROM comments WHERE id=?", array($comment_id));
|
||||
$database->Execute("DELETE FROM comments WHERE id=?", array($comment_id));
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ class IPBan extends Extension {
|
||||
protected function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
$database->db->Execute("CREATE TABLE bans (
|
||||
$database->Execute("CREATE TABLE bans (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ip char(15) default NULL,
|
||||
date datetime default NULL,
|
||||
@@ -119,14 +119,14 @@ class IPBan extends Extension {
|
||||
|
||||
public function add_ip_ban($ip, $reason) {
|
||||
global $database;
|
||||
$database->db->Execute(
|
||||
$database->Execute(
|
||||
"INSERT INTO bans (ip, reason, date) VALUES (?, ?, now())",
|
||||
array($ip, $reason));
|
||||
}
|
||||
|
||||
public function remove_ip_ban($ip) {
|
||||
global $database;
|
||||
$database->db->Execute("DELETE FROM bans WHERE ip = ?", array($ip));
|
||||
$database->Execute("DELETE FROM bans WHERE ip = ?", array($ip));
|
||||
}
|
||||
// }}}
|
||||
// admin page HTML {{{
|
||||
|
@@ -84,7 +84,7 @@ class TagList extends Extension {
|
||||
global $config;
|
||||
|
||||
$tags_min = $config->get_int('tags_min');
|
||||
$result = $database->db->Execute(
|
||||
$result = $database->Execute(
|
||||
"SELECT tag,COUNT(image_id) AS count FROM tags GROUP BY tag HAVING count > ? ORDER BY tag",
|
||||
array($tags_min));
|
||||
|
||||
@@ -108,7 +108,7 @@ class TagList extends Extension {
|
||||
global $config;
|
||||
|
||||
$tags_min = $config->get_int('tags_min');
|
||||
$result = $database->db->Execute(
|
||||
$result = $database->Execute(
|
||||
"SELECT tag,COUNT(image_id) AS count FROM tags GROUP BY tag HAVING count > ? ORDER BY tag",
|
||||
array($tags_min));
|
||||
|
||||
@@ -135,7 +135,7 @@ class TagList extends Extension {
|
||||
global $config;
|
||||
|
||||
$tags_min = $config->get_int('tags_min');
|
||||
$result = $database->db->Execute(
|
||||
$result = $database->Execute(
|
||||
"SELECT tag,COUNT(image_id) AS count FROM tags GROUP BY tag HAVING count > ? ORDER BY count DESC, tag ASC",
|
||||
array($tags_min)
|
||||
);
|
||||
@@ -165,7 +165,7 @@ class TagList extends Extension {
|
||||
|
||||
$n = 0;
|
||||
$html = "";
|
||||
$result = $database->db->Execute($query, $args);
|
||||
$result = $database->Execute($query, $args);
|
||||
while(!$result->EOF) {
|
||||
$row = $result->fields;
|
||||
$tag = $row['tag'];
|
||||
|
Reference in New Issue
Block a user