diff --git a/core/database.class.php b/core/database.class.php index 27603f93..83f2da29 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -389,6 +389,13 @@ class Database { return $row[0]; } + /** + * get the ID of the last inserted row + */ + public function get_last_insert_id() { + return $this->get_last_insert_id(); + } + /** * Create a table from pseudo-SQL diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 89db7d83..90176d1d 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -611,7 +611,7 @@ class Image { $tags_ok = true; foreach($tag_querylets as $tq) { - $tag_ids = $database->db->GetCol( + $tag_ids = $database->get_col( $database->engine->scoreql_to_sql( "SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" ), @@ -912,7 +912,7 @@ class Tag { } else { global $database; - $newtags = $database->db->GetCol("SELECT tag FROM tags WHERE tag LIKE ?", array($tag)); + $newtags = $database->get_col("SELECT tag FROM tags WHERE tag LIKE ?", array($tag)); if(count($newtags) > 0) { $resolved = $newtags; } else { diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 0c46694b..88e22433 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -122,7 +122,7 @@ class AliasEditor extends SimpleExtension { private function get_alias_csv($database) { $csv = ""; - $aliases = $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"); + $aliases = $database->get_pairs("SELECT oldtag, newtag FROM aliases"); foreach($aliases as $old => $new) { $csv .= "$old,$new\n"; } diff --git a/ext/comment/main.php b/ext/comment/main.php index 5d8c9a63..3219d036 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -450,7 +450,7 @@ class CommentList extends SimpleExtension { "INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment) ". "VALUES(?, ?, ?, now(), ?)", array($image_id, $user->id, $_SERVER['REMOTE_ADDR'], $comment)); - $cid = $database->db->lastInsertId(); + $cid = $database->get_last_insert_id(); log_info("comment", "Comment #$cid added to Image #$image_id"); } } diff --git a/ext/image/main.php b/ext/image/main.php index 7815649c..e8418aaf 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -250,7 +250,7 @@ class ImageIO extends SimpleExtension { $image->id = $database->get_one("SELECT id FROM images WHERE hash=?", array($image->hash)); } else { - $image->id = $database->db->lastInsertId(); + $image->id = $database->get_last_insert_id(); } log_info("image", "Uploaded Image #{$image->id} ({$image->hash})"); diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 53abb9c9..b84bd87a 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -312,7 +312,7 @@ class TagList implements Extension { $tag = str_replace("?", "_", $tag); $tag_ids = $database->get_col("SELECT id FROM tags WHERE tag LIKE :tag", array("tag"=>$tag)); // $search_tags = array_merge($search_tags, - // $database->db->GetCol("SELECT tag FROM tags WHERE tag LIKE :tag", array("tag"=>$tag))); + // $database->get_col("SELECT tag FROM tags WHERE tag LIKE :tag", array("tag"=>$tag))); $tag_id_array = array_merge($tag_id_array, $tag_ids); $tags_ok = count($tag_ids) > 0; if(!$tags_ok) break; diff --git a/ext/user/main.php b/ext/user/main.php index d3eca23d..82713d58 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -304,7 +304,7 @@ class UserPage extends SimpleExtension { $database->Execute( "INSERT INTO users (name, pass, joindate, email, admin) VALUES (?, ?, now(), ?, ?)", array($event->username, $hash, $email, $admin)); - $uid = $database->db->lastInsertId(); + $uid = $database->get_last_insert_id(); log_info("user", "Created User #$uid ({$event->username})"); }