more pdo compat

This commit is contained in:
Shish
2011-01-01 16:28:04 +00:00
parent 7684def0f8
commit d6baeab977
16 changed files with 93 additions and 86 deletions

View File

@ -286,7 +286,7 @@ class UserPage extends SimpleExtension {
"Username contains invalid characters. Allowed characters are ".
"letters, numbers, dash, and underscore");
}
else if($database->db->GetRow("SELECT * FROM users WHERE name = ?", array($name))) {
else if($database->get_row("SELECT * FROM users WHERE name = ?", array($name))) {
throw new UserCreationException("That username is already taken");
}
}
@ -298,7 +298,7 @@ class UserPage extends SimpleExtension {
$email = (!empty($event->email)) ? $event->email : null;
// if there are currently no admins, the new user should be one
$need_admin = ($database->db->GetOne("SELECT COUNT(*) FROM users WHERE admin IN ('Y', 't', '1')") == 0);
$need_admin = ($database->get_one("SELECT COUNT(*) FROM users WHERE admin IN ('Y', 't', '1')") == 0);
$admin = $need_admin ? 'Y' : 'N';
$database->Execute(
@ -427,28 +427,28 @@ class UserPage extends SimpleExtension {
// ips {{{
private function count_upload_ips($duser) {
global $database;
$rows = $database->db->GetAssoc("
$rows = $database->get_pairs("
SELECT
owner_ip,
COUNT(images.id) AS count,
MAX(posted) AS most_recent
FROM images
WHERE owner_id=?
WHERE owner_id=:id
GROUP BY owner_ip
ORDER BY most_recent DESC", array($duser->id), false, true);
ORDER BY most_recent DESC", array("id"=>$duser->id));
return $rows;
}
private function count_comment_ips($duser) {
global $database;
$rows = $database->db->GetAssoc("
$rows = $database->get_pairs("
SELECT
owner_ip,
COUNT(comments.id) AS count,
MAX(posted) AS most_recent
FROM comments
WHERE owner_id=?
WHERE owner_id=:id
GROUP BY owner_ip
ORDER BY most_recent DESC", array($duser->id), false, true);
ORDER BY most_recent DESC", array("id"=>$duser->id));
return $rows;
}
// }}}