|
From: Benjamin C. <bc...@us...> - 2002-03-17 01:44:27
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv5222
Modified Files:
attachment.php bug.php index.php newaccount.php query.php
upgrade.php user.php
Log Message:
Switching to PEAR::DB -- mostly untested
Index: attachment.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/attachment.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- attachment.php 19 Jan 2002 15:11:26 -0000 1.12
+++ attachment.php 17 Mar 2002 01:44:24 -0000 1.13
@@ -25,26 +25,26 @@
include 'include.php';
function del_attachment($attachid) {
- global $q;
+ global $db;
if (list($filename, $mimetype) = grab_attachment($attachid)) {
- $q->query("delete from ".TBL_ATTACHMENT." where attachment_id = $attachid");
+ $db->query("delete from ".TBL_ATTACHMENT." where attachment_id = $attachid");
unlink($filename);
header("Location: bug.php?op=show&bugid=$attachid");
}
}
function grab_attachment($attachid) {
- global $q, $STRING;
+ global $db, $STRING;
if (!is_numeric($attachid)) {
show_text($STRING['bad_attachment'], true);
return false;
}
- $ainfo = $q->grab("select a.bug_id, file_name, mime_type, project_id"
- ." from ".TBL_ATTACHMENT." a, ".TBL_BUG." b"
- ." where attachment_id = $attachid and a.bug_id = b.bug_id");
- if ($q->num_rows() != 1) {
+ $ainfo = $db->getRow("select a.bug_id, file_name, mime_type, project_id"
+ ." from ".TBL_ATTACHMENT." a, ".TBL_BUG." b"
+ ." where attachment_id = $attachid and a.bug_id = b.bug_id");
+ if (empty($ainfo)) {
show_text($STRING['bad_attachment'], true);
return false;
}
@@ -58,7 +58,7 @@
}
function add_attachment($bugid, $description) {
- global $q, $HTTP_POST_FILES, $now, $u, $STRING, $t;
+ global $db, $HTTP_POST_FILES, $now, $u, $STRING, $t;
if (!isset($HTTP_POST_FILES['attachment']) ||
$HTTP_POST_FILES['attachment']['tmp_name'] == 'none') {
@@ -73,16 +73,17 @@
return;
}
- $projectid = $q->grab_field("select project_id from ".TBL_BUG." where bug_id = $bugid");
+ $projectid = $db->getOne("select project_id from ".TBL_BUG." where bug_id = $bugid");
if (!$projectid) {
show_text($STRING['nobug'], true);
return;
}
// Check for a previously-uploaded attachment with the same name, bug, and project
- $q->query("select a.bug_id, project_id from ".TBL_ATTACHMENT." a, ".TBL_BUG." b"
- ." where file_name = '{$HTTP_POST_FILES['attachment']['name']}' and a.bug_id = b.bug_id");
- while ($ainfo = $q->grab()) {
+ $rs = $db->query("select a.bug_id, project_id from ".TBL_ATTACHMENT." a, ".
+ TBL_BUG." b where file_name = '{$HTTP_POST_FILES['attachment']['name']}' ".
+ "and a.bug_id = b.bug_id");
+ while ($rs->fetchInto($ainfo)) {
if ($bugid == $ainfo['bug_id'] && $projectid == $ainfo['project_id']) {
show_attachment_form($bugid, $STRING['dupe_attachment']);
return;
@@ -114,13 +115,18 @@
}
@chmod("$filepath/$projectid/$filename", 0766);
- $q->query("insert into ".TBL_ATTACHMENT." (attachment_id, bug_id, file_name, description, file_size, mime_type, created_by, created_date) values (".$q->nextid(TBL_ATTACHMENT).", $bugid, '{$HTTP_POST_FILES['attachment']['name']}', '$description', {$HTTP_POST_FILES['attachment']['size']}, '{$HTTP_POST_FILES['attachment']['type']}', $u, $now)");
+ $db->query("insert into ".TBL_ATTACHMENT." (attachment_id, bug_id, file_name, ".
+ "description, file_size, mime_type, created_by, created_date) values (".
+ $db->nextId(TBL_ATTACHMENT).", $bugid, ".
+ "'{$HTTP_POST_FILES['attachment']['name']}', '$description', ".
+ "{$HTTP_POST_FILES['attachment']['size']}, ".
+ "'{$HTTP_POST_FILES['attachment']['type']}', $u, $now)");
$t->set_file('content', 'bugattachmentsuccess.html');
$t->set_var('bugid', $bugid);
}
function show_attachment_form($bugid, $error = '') {
- global $q, $t, $STRING;
+ global $db, $t, $STRING;
$t->set_file('content', 'bugattachmentform.html');
if (!is_numeric($bugid)) {
@@ -128,7 +134,7 @@
return;
}
- $bugexists = $q->grab_field("select count(*) from ".TBL_BUG." where bug_id = $bugid");
+ $bugexists = $db->getOne("select count(*) from ".TBL_BUG." where bug_id = $bugid");
if (!$bugexists) {
show_text($STRING['nobug'], true);
return;
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- bug.php 11 Mar 2002 18:28:35 -0000 1.83
+++ bug.php 17 Mar 2002 01:44:24 -0000 1.84
@@ -27,19 +27,19 @@
///
/// View the votes for a bug
function vote_view($bug_id) {
- global $u, $q, $t, $STRING;
+ global $u, $db, $t, $STRING;
$t->set_file('content', 'bugvotes.html');
$t->set_block('content', 'row', 'rows');
- $q->query('select login, v.created_date from '.TBL_AUTH_USER.' u, '.
+ $rs = $db->query('select login, v.created_date from '.TBL_AUTH_USER.' u, '.
TBL_BUG_VOTE." v where u.user_id = v.user_id and bug_id = $bug_id".
' order by v.created_date');
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows', "<tr><td colspan=\"2\" align=\"center\">{$STRING['no_votes']}</td></tr>");
} else {
$i = 0;
- while (list($login, $date) = $q->grab()) {
+ while (list($login, $date) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
@@ -55,37 +55,37 @@
///
/// Add a vote to a bug to (possibly) promote it
function vote_bug($bug_id) {
- global $u, $q, $now, $_pv, $STRING;
+ global $u, $db, $now, $_pv, $STRING;
// Check to see if the user already voted on this bug
- if ($q->grab_field("select count(*) from ".TBL_BUG_VOTE.
+ if ($db->getOne("select count(*) from ".TBL_BUG_VOTE.
" where bug_id = $bug_id and user_id = $u")) {
show_bug($bug_id, array('vote' => $STRING['already_voted']));
return;
}
// Check whether the user has used his allotment of votes (if there is a max)
- if (MAX_USER_VOTES and $q->grab_field("select count(*) from ".TBL_BUG_VOTE.
+ if (MAX_USER_VOTES and $db->getOne("select count(*) from ".TBL_BUG_VOTE.
" where user_id = $u") >= MAX_USER_VOTES) {
show_bug($bug_id, array('vote' => $STRING['too_many_votes']));
return;
}
// Record the vote
- $q->query("insert into ".TBL_BUG_VOTE." (user_id, bug_id, created_date)
+ $db->query("insert into ".TBL_BUG_VOTE." (user_id, bug_id, created_date)
values ($u, $bug_id, $now)");
// Proceed only if promoting by votes is turned on
if (PROMOTE_VOTES) {
// Has this bug already been promoted?
- $bug_is_new = $q->grab_field("select count(*) from ".TBL_BUG." b, ".
+ $bug_is_new = $db->getOne("select count(*) from ".TBL_BUG." b, ".
TBL_STATUS." s where bug_id = $bug_id and b.status_id = s.status_id and
status_name = 'New'");
// If a number of votes are required to promote a bug, check for promotion
- if (!$bug_is_new and $q->grab_field("select count(*) from ".
+ if (!$bug_is_new and $db->getOne("select count(*) from ".
TBL_BUG_VOTE." where bug_id = $bug_id") == PROMOTE_VOTES) {
- $status_id = $q->grab_field("select status_id from ".TBL_STATUS." where status_name = 'New'");
- $buginfo = $q->grab("select * from ".TBL_BUG." where bug_id = $bug_id");
+ $status_id = $db->getOne("select status_id from ".TBL_STATUS." where status_name = 'New'");
+ $buginfo = $db->getOne("select * from ".TBL_BUG." where bug_id = $bug_id");
$changedfields = array('status_id' => $status_id);
do_changedfields($u, $buginfo, $changedfields);
}
@@ -121,16 +121,16 @@
///
/// Show the activity for a bug
function show_history($bugid) {
- global $q, $t, $STRING;
+ global $db, $t, $STRING;
if (!is_numeric($bugid)) {
show_text($STRING['nobughistory']);
return;
}
- $q->query('select bh.*, login from '.TBL_BUG_HISTORY.' bh left join '.
+ $rs = $db->query('select bh.*, login from '.TBL_BUG_HISTORY.' bh left join '.
TBL_AUTH_USER." on bh.created_by = user_id where bug_id = $bugid");
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
show_text($STRING['nobughistory']);
return;
}
@@ -138,7 +138,7 @@
$t->set_file('content','bughistory.html');
$t->set_block('content', 'row', 'rows');
$t->set_var('bugid', $bugid);
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
@@ -155,7 +155,7 @@
///
/// Send the email about changes to the bug and log the changes in the DB
function do_changedfields($userid, &$buginfo, $cf = array(), $comments = '') {
- global $q, $t, $u, $select, $now, $STRING;
+ global $db, $t, $u, $select, $now, $STRING;
// It's a new bug if the changedfields array is empty and there are no comments
$newbug = (!count($cf) and !$comments);
@@ -164,7 +164,7 @@
$t->set_block('emailout','commentblock', 'cblock');
foreach(array('title','url') as $field) {
if (isset($cf[$field])) {
- $q->query('insert into '.TBL_BUG_HISTORY
+ $db->query('insert into '.TBL_BUG_HISTORY
.' (bug_id, changed_field, old_value, new_value, created_by, created_date)'
." values ({$buginfo['bug_id']}, '$field', '"
.addslashes($buginfo[$field])."', '".addslashes($cf[$field])
@@ -193,12 +193,12 @@
);
foreach($cfgDatabase as $field => $table) {
- $oldvalue = $q->grab_field("select ${field}_name from $table"
+ $oldvalue = $db->getOne("select ${field}_name from $table"
." where ${field}_id = {$buginfo[$field.'_id']}");
if (!empty($cf[$field.'_id'])) {
- $newvalue = $q->grab_field("select ${field}_name from $table"
+ $newvalue = $db->getOne("select ${field}_name from $table"
." where ${field}_id = {$cf[$field.'_id']}");
- $q->query('insert into '.TBL_BUG_HISTORY
+ $db->query('insert into '.TBL_BUG_HISTORY
.' (bug_id, changed_field, old_value, new_value, created_by, created_date)'
." values ({$buginfo['bug_id']}, '$field', '".addslashes($oldvalue).
"', '".addslashes($newvalue)."', $u, $now)");
@@ -215,21 +215,21 @@
}
// Reporter never changes;
- $reporter = $q->grab_field('select email from '.TBL_AUTH_USER
+ $reporter = $db->getOne('select email from '.TBL_AUTH_USER
." where user_id = {$buginfo['created_by']}");
$reporterstat = ' ';
- $assignedto = $q->grab_field('select email from '.TBL_AUTH_USER
+ $assignedto = $db->getOne('select email from '.TBL_AUTH_USER
.' where user_id = '
.(!empty($cf['assigned_to']) ? $cf['assigned_to'] : $buginfo['assigned_to']));
$assignedtostat = !empty($cf['assigned_to']) ? '!' : ' ';
// If there are new comments grab the comments immediately before the latest
if ($comments or $newbug) {
- $q->query('select u.login, c.comment_text, c.created_date'
+ $rs = $db->query('select u.login, c.comment_text, c.created_date'
.' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER.' u'
." where bug_id = {$buginfo['bug_id']} and c.created_by = u.user_id"
.' order by created_date desc limit 2');
- $row = $q->grab();
+ $rs->fetchInto($row);
$t->set_var(array(
'newpostedby' => $row['login'],
'newpostedon' => date(TIME_FORMAT, $row['created_date']).' on '.
@@ -238,17 +238,18 @@
));
// If this comment is the first additional comment after the creation of the
// bug then we need to grab the bug's description as the previous comment
- if ($q->num_rows() < 2) {
- list($by, $on, $comments) = $q->grab('select u.login, b.created_date, b.description'
+ if ($rs->numRows() < 2) {
+ list($by, $on, $comments) = $db->getRow('select u.login, b.created_date, b.description'
.' from '.TBL_BUG.' b, '.TBL_AUTH_USER.' u'
- ." where b.created_by = u.user_id and bug_id = {$buginfo['bug_id']}");
+ ." where b.created_by = u.user_id and bug_id = {$buginfo['bug_id']}",
+ null, DB_FETCHMODE_ORDERED);
$t->set_var(array(
'oldpostedby' => $by,
'oldpostedon' => date(TIME_FORMAT,$on).' on '.date(DATE_FORMAT,$on),
'oldcomments' => textwrap(format_comments($comments),72)
));
} else {
- $row = $q->grab();
+ $rs->fetchInto($row);
$t->set_var(array(
'oldpostedby' => $row['login'],
'oldpostedon' => date(TIME_FORMAT,$row['created_date']).' on '.
@@ -269,11 +270,10 @@
$maillist[] = $assignedto;
// Collect the CCs
- $q->query('select email from '.TBL_BUG_CC.' left join '.TBL_AUTH_USER.
- " using(user_id) where bug_id = {$buginfo['bug_id']}");
- while ($cc_email = $q->grab_field()) {
- $maillist[] = $cc_email;
- }
+ if ($ccs = $db->getCol('select email from '.TBL_BUG_CC.' left join '.
+ TBL_AUTH_USER." using(user_id) where bug_id = {$buginfo['bug_id']}")) {
+ array_push($maillist, $ccs);
+ }
// Later add a watcher (such as QA person) check here
$toemail = delimit_list(', ',$maillist);
@@ -298,10 +298,10 @@
}
function update_bug($bugid = 0) {
- global $q, $t, $u, $STRING, $perm, $now, $_pv;
+ global $db, $t, $u, $STRING, $perm, $now, $_pv;
// Pull bug from database to determine changed fields and for user validation
- $buginfo = $q->grab("select * from ".TBL_BUG." where bug_id = $bugid");
+ $buginfo = $db->getRow("select * from ".TBL_BUG." where bug_id = $bugid");
$changedfields = array();
if (isset($_pv)) {
@@ -331,7 +331,7 @@
} else { // text box
$assign_user_query = " where login = '$reassignto'";
}
- if (!$assignedto = $q->grab_field("select user_id from ".TBL_AUTH_USER.
+ if (!$assignedto = $db->getOne("select user_id from ".TBL_AUTH_USER.
$assign_user_query)) {
show_bug($bugid,array('status' => $STRING['nouser']));
return;
@@ -345,22 +345,22 @@
// Add CC if specified
if ($add_cc) {
- if (!$cc_uid = $q->grab_field("select user_id from ".TBL_AUTH_USER.
+ if (!$cc_uid = $db->getOne("select user_id from ".TBL_AUTH_USER.
" where login = '$add_cc'")) {
show_bug($bugid,array('status' => $STRING['nouser']));
return;
}
- $cc_already = $q->grab_field('select user_id from '.TBL_BUG_CC.
+ $cc_already = $db->getOne('select user_id from '.TBL_BUG_CC.
" where bug_id = $bugid and user_id = $cc_uid");
if (!$cc_already && $cc_uid != $buginfo['created_by']) {
- $q->query("insert into ".TBL_BUG_CC." (bug_id, user_id, created_by,
+ $db->query("insert into ".TBL_BUG_CC." (bug_id, user_id, created_by,
created_date) values ($bugid, $cc_uid, $u, $now)");
}
}
// Remove CCs if requested
if (isset($remove_cc) and count($remove_cc)) {
- $q->query('delete from '.TBL_BUG_CC." where bug_id = $bugid
+ $db->query('delete from '.TBL_BUG_CC." where bug_id = $bugid
and user_id in (".delimit_list(',', $remove_cc).')');
}
@@ -369,7 +369,7 @@
case 'unchanged' : break;
case 'assign' : $assignedto = $u; $statusfield = 'Assigned'; break;
case 'reassign' :
- if (!$assignedto = $q->grab_field("select user_id from ".TBL_AUTH_USER.
+ if (!$assignedto = $db->getOne("select user_id from ".TBL_AUTH_USER.
$assign_user_query)) {
show_bug($bugid,array('status' => $STRING['nouser']));
return;
@@ -379,23 +379,23 @@
break;
}
case 'reassigntocomponent' :
- $assignedto = $q->grab_field("select owner from ".TBL_COMPONENT." where component_id = $component_id");
+ $assignedto = $db->getOne("select owner from ".TBL_COMPONENT." where component_id = $component_id");
$statusfield = 'Assigned'; break;
case 'dupe' :
$changeresolution = true;
if ($dupenum == $bugid) {
show_bug($bugid,array('status' => $STRING['dupeofself']));
return;
- } elseif (!$q->grab_field("select bug_id from ".TBL_BUG." where bug_id = $dupenum")) {
+ } elseif (!$db->getOne("select bug_id from ".TBL_BUG." where bug_id = $dupenum")) {
show_bug($bugid,array('status' => $STRING['nobug']));
return;
}
- $q->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
- ." values (".$q->nextid(TBL_COMMENT).", $dupenum, 'Bug #$bugid has been marked a duplicate of this bug', $u, $now)");
- $q->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
- ." values (".$q->nextid(TBL_COMMENT).", $bugid, 'This bug is a duplicate of bug #$dupenum', $u, $now)");
+ $db->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
+ ." values (".$db->nextId(TBL_COMMENT).", $dupenum, 'Bug #$bugid has been marked a duplicate of this bug', $u, $now)");
+ $db->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
+ ." values (".$db->nextId(TBL_COMMENT).", $bugid, 'This bug is a duplicate of bug #$dupenum', $u, $now)");
$statusfield = 'Duplicate';
- $resolution_id = $q->grab_field("select resolution_id from ".TBL_RESOLUTION." where resolution_name = 'Duplicate'");
+ $resolution_id = $db->getOne("select resolution_id from ".TBL_RESOLUTION." where resolution_name = 'Duplicate'");
$statusfield = 'Resolved';
break;
case 'resolve' :
@@ -415,7 +415,7 @@
break;
}
if (isset($statusfield)) {
- $status_id = $q->grab_field("select status_id from ".TBL_STATUS." where status_name = '$statusfield'");
+ $status_id = $db->getOne("select status_id from ".TBL_STATUS." where status_name = '$statusfield'");
$changedfields['status_id'] = $status_id;
}
if ($changeresolution) {
@@ -423,8 +423,8 @@
}
if ($comments) {
//$comments = strip_tags($comments); -- Uncomment this if you want no <> content in the comments
- $q->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
- ." values (".$q->nextid(TBL_COMMENT).", $bugid, '$comments', $u, $now)");
+ $db->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date)"
+ ." values (".$db->nextId(TBL_COMMENT).", $bugid, '$comments', $u, $now)");
}
// Allow for removing of some items from the bug page
@@ -432,7 +432,7 @@
$os_id = $os_id ? $os_id : 0;
$severity_id = $severity_id ? $severity_id : 0;
- $q->query("update ".TBL_BUG." set title = '$title', url = '$url', severity_id = $severity_id, priority = $priority, ".(isset($status_id) ? "status_id = $status_id, " : ''). ($changeresolution ? "resolution_id = $resolution_id, " : ''). (isset($assignedto) ? "assigned_to = $assignedto, " : '')." project_id = $project_id, version_id = $version_id, component_id = $component_id, os_id = $os_id, last_modified_by = $u, last_modified_date = $now where bug_id = $bugid");
+ $db->query("update ".TBL_BUG." set title = '$title', url = '$url', severity_id = $severity_id, priority = $priority, ".(isset($status_id) ? "status_id = $status_id, " : ''). ($changeresolution ? "resolution_id = $resolution_id, " : ''). (isset($assignedto) ? "assigned_to = $assignedto, " : '')." project_id = $project_id, version_id = $version_id, component_id = $component_id, os_id = $os_id, last_modified_by = $u, last_modified_date = $now where bug_id = $bugid");
if (count($changedfields) or !empty($comments)) {
do_changedfields($u, $buginfo, $changedfields, $comments);
@@ -441,7 +441,7 @@
}
function do_form($bugid = 0) {
- global $q, $me, $u, $_pv, $STRING, $now, $HTTP_SERVER_VARS;
+ global $db, $me, $u, $_pv, $STRING, $now, $HTTP_SERVER_VARS;
$error = '';
// Validation
@@ -461,12 +461,12 @@
$severity = $severity ? $severity : 0;
if (!$bugid) {
- $bugid = $q->nextid(TBL_BUG);
+ $bugid = $db->nextId(TBL_BUG);
// Check to see if this bug's component has an owner and should be assigned
- if ($owner = $q->grab_field("select owner from ".TBL_COMPONENT.
+ if ($owner = $db->getOne("select owner from ".TBL_COMPONENT.
" c where component_id = $component")) {
- $status = $q->grab_field("select status_id from ".TBL_STATUS." where status_name = 'Assigned'");
+ $status = $db->getOne("select status_id from ".TBL_STATUS." where status_name = 'Assigned'");
} else {
$owner = 0;
// If we aren't using voting to promote, then auto-promote to New
@@ -475,26 +475,26 @@
} else {
$stat_to_assign = 'New';
}
- $status = $q->grab_field("select status_id from ".TBL_STATUS." where status_name = '$stat_to_assign'");
+ $status = $db->getOne("select status_id from ".TBL_STATUS." where status_name = '$stat_to_assign'");
}
- $q->query("insert into ".TBL_BUG." (bug_id, title, description, url,
+ $db->query("insert into ".TBL_BUG." (bug_id, title, description, url,
severity_id, priority, status_id, assigned_to, created_by, created_date,
last_modified_by, last_modified_date, project_id, version_id,
component_id, os_id, browser_string) values ($bugid, '$title',
'$description', '$url', $severity, $priority, $status, $owner, $u,
$now, $u, $now, $project, $version, $component, '$os',
'{$HTTP_SERVER_VARS['HTTP_USER_AGENT']}')");
- $buginfo = $q->grab('select * from '.TBL_BUG." where bug_id = $bugid");
+ $buginfo = $db->getRow('select * from '.TBL_BUG." where bug_id = $bugid");
do_changedfields($u, $buginfo);
} else {
- $q->query("update ".TBL_BUG." set title = '$title', description = '$description', url = '$url', severity_id = '$severity', priority = '$priority', status_id = $status, assigned_to = '$assignedto', project_id = $project, version_id = $version, component_id = $component, os_id = '$os', browser_string = '{$GLOBALS['HTTP_USER_AGENT']}' last_modified_by = $u, last_modified_date = $time where bug_id = '$bugid'");
+ $db->query("update ".TBL_BUG." set title = '$title', description = '$description', url = '$url', severity_id = '$severity', priority = '$priority', status_id = $status, assigned_to = '$assignedto', project_id = $project, version_id = $version, component_id = $component, os_id = '$os', browser_string = '{$GLOBALS['HTTP_USER_AGENT']}' last_modified_by = $u, last_modified_date = $time where bug_id = '$bugid'");
}
if (isset($another)) header("Location: $me?op=add&project=$project");
else header("Location: query.php");
}
function show_form($bugid = 0, $error = '') {
- global $q, $me, $t, $_gv, $_pv, $TITLE;
+ global $db, $me, $t, $_gv, $_pv, $TITLE;
if (isset($_gv['project'])) {
$project = $_gv['project'];
@@ -505,9 +505,9 @@
}
$t->set_file('content','bugform.html');
- $projectname = $q->grab_field("select project_name from ".TBL_PROJECT." where project_id = $project");
+ $projectname = $db->getOne("select project_name from ".TBL_PROJECT." where project_id = $project");
if ($bugid && !$error) {
- $row = $q->grab("select * from ".TBL_BUG." where bug_id = '$bugid'");
+ $row = $db->getRow("select * from ".TBL_BUG." where bug_id = '$bugid'");
$t->set_var(array(
'bugid' => $bugid,
'TITLE' => $TITLE['editbug'],
@@ -558,10 +558,10 @@
}
function show_bug_printable($bugid) {
- global $q, $t, $select, $TITLE;
+ global $db, $t, $select, $TITLE;
if (!is_numeric($bugid) or
- !$row = $q->grab('select b.*, reporter.login as reporter,
+ !$row = $db->getRow('select b.*, reporter.login as reporter,
owner.login as owner, project_name, component_name, version_name,
severity_name, os_name, status_name, resolution_name
from '.TBL_BUG.' b
@@ -603,13 +603,13 @@
));
// Show the comments
- $q->query('select comment_text, c.created_date, login'
+ $rs = $db->query('select comment_text, c.created_date, login'
.' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER
." where bug_id = $bugid and c.created_by = user_id order by c.created_date");
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows','');
} else {
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'rdescription' => nl2br(format_comments(
htmlspecialchars($row['comment_text']))),
@@ -625,7 +625,7 @@
///
/// Grab the links for the previous and next bugs in the list
function prev_next_links($bugid, $pos) {
- global $q, $_sv, $STRING;
+ global $db, $_sv, $STRING;
if (!isset($_sv['queryinfo']['query']) || !$_sv['queryinfo']['query']) {
return array('', '');
@@ -639,7 +639,7 @@
$offset = $pos;
$limit = 1;
}
- $q->limit_query('select bug_id, reporter.login as reporter, owner.login as owner
+ $rs = $db->limitQuery('select bug_id, reporter.login as reporter, owner.login as owner
from '.TBL_BUG.' b
left join '.TBL_AUTH_USER.' owner on b.assigned_to = owner.user_id
left join '.TBL_AUTH_USER.' reporter on b.created_by = reporter.user_id
@@ -651,10 +651,10 @@
and b.os_id = os.os_id and b.version_id = version.version_id
and b.component_id = component.component_id and b.project_id = project.project_id '.
"and {$_sv['queryinfo']['query']} and bug_id <> $bugid
- order by {$_sv['queryinfo']['order']} {$_sv['queryinfo']['sort']}, bug_id asc", $limit, $offset);
+ order by {$_sv['queryinfo']['order']} {$_sv['queryinfo']['sort']}, bug_id asc", $offset, $limit);
- $firstid = $q->grab_field();
- $secondid = $q->grab_field();
+ $firstid = $db->getOne();
+ $secondid = $db->getOne();
if ($pos) {
if ($firstid) {
@@ -676,10 +676,10 @@
}
function show_bug($bugid = 0, $error = array()) {
- global $q, $me, $t, $STRING, $TITLE, $u, $perm, $_gv;
+ global $db, $me, $t, $STRING, $TITLE, $u, $perm, $_gv;
if (!ereg('^[0-9]+$',$bugid) or
- !$row = $q->grab('select b.*, reporter.login as reporter, owner.login as owner, status_name, resolution_name
+ !$row = $db->getRow('select b.*, reporter.login as reporter, owner.login as owner, status_name, resolution_name
from '.TBL_BUG.' b
left join '.TBL_AUTH_USER.' owner on b.assigned_to = owner.user_id
left join '.TBL_AUTH_USER.' reporter on b.created_by = reporter.user_id
@@ -735,10 +735,10 @@
'nextlink' => $nextlink,
'prevnextsep' => $prevlink && $nextlink ? ' | ' : '',
'pos' => isset($_gv['pos']) ? $_gv['pos'] : 0,
- 'already_voted' => $q->grab_field("select count(*) from ".TBL_BUG_VOTE.
+ 'already_voted' => $db->getOne("select count(*) from ".TBL_BUG_VOTE.
" where bug_id = $bugid and user_id = $u"),
'already_voted_string' => $STRING['already_voted'],
- 'num_votes' => $q->grab_field("select count(*) from ".TBL_BUG_VOTE.
+ 'num_votes' => $db->getOne("select count(*) from ".TBL_BUG_VOTE.
" where bug_id = $bugid")
));
switch($row['status_name']) {
@@ -767,12 +767,12 @@
$t->set_var('js', build_project_js());
// Show the attachments
- $q->query("select * from ".TBL_ATTACHMENT." where bug_id = $bugid");
- if (!$q->num_rows()) {
+ $rs = $db->query("select * from ".TBL_ATTACHMENT." where bug_id = $bugid");
+ if (!$rs->numRows()) {
$t->set_var('attrows', '<tr><td colspan="5" align="center">No attachments</td></tr>');
} else {
$j = 0;
- while ($att = $q->grab()) {
+ while ($rs->fetchInto($att)) {
if (@is_readable(INSTALL_PATH.'/'.ATTACHMENT_PATH."/{$row['project_id']}/$bugid-{$att['file_name']}")) {
$action = "<a href='attachment.php?attachid={$att['attachment_id']}'>View</a>";
if ($perm->have_perm('Administrator')) {
@@ -804,14 +804,14 @@
}
// Show the comments
- $q->query('select comment_text, c.created_date, login'
+ $rs = $db->query('select comment_text, c.created_date, login'
.' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER
." where bug_id = $bugid and c.created_by = user_id order by c.created_date");
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows','');
} else {
$i = 1;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
@@ -827,7 +827,7 @@
}
function show_projects() {
- global $me, $q, $t, $STRING, $TITLE, $perm, $auth, $restricted_projects, $_gv;
+ global $me, $db, $t, $STRING, $TITLE, $perm, $auth, $restricted_projects, $_gv;
// Show only active projects with at least one component
if ($perm->have_perm('Admin')) { // Show admins all projects
@@ -835,18 +835,18 @@
} else { // Filter out projects that can't be seen by this user
$p_query = " and p.project_id not in ($restricted_projects)";
}
- $q->query('select p.project_id, p.project_name, p.project_desc, p.created_date
+ $rs = $db->query('select p.project_id, p.project_name, p.project_desc, p.created_date
from '.TBL_PROJECT.' p, '.TBL_COMPONENT.
' c where p.active = 1 and p.project_id = c.project_id'.$p_query.
' group by p.project_id, p.project_name, p.project_desc, p.created_date'.
' order by project_name');
- switch ($q->num_rows()) {
+ switch ($rs->numRows()) {
case 0 :
$t->set_var('content',"<div class=\"error\">{$STRING['noprojects']}</div>");
return;
case 1 :
- $row = $q->grab();
+ $rs->fetchInto($row);
$_gv['project'] = $row['project_id'];
show_form();
break;
@@ -854,7 +854,7 @@
$t->set_file('content','projectlist.html');
$t->set_block('content','row','rows');
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'id' => $row['project_id'],
'name' => $row['project_name'],
Index: index.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/index.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- index.php 14 Mar 2002 16:01:20 -0000 1.18
+++ index.php 17 Mar 2002 01:44:24 -0000 1.19
@@ -34,18 +34,18 @@
$t->set_var('TITLE',$TITLE['home']);
function grab_data($restricted_projects) {
- global $q;
+ global $db;
// Grab the legend
- $q->query("select status_id, status_name from ".TBL_STATUS." order by sort_order");
- while ($row = $q->grab()) {
+ $rs = $db->query("select status_id, status_name from ".TBL_STATUS." order by sort_order");
+ while ($rs->fetchInto($row)) {
$stats[$row['status_id']]['name'] = $row['status_name'];
}
// Grab the data
- $q->query("select status_id, count(status_id) as count from ".TBL_BUG.
+ $rs = $db->query("select status_id, count(status_id) as count from ".TBL_BUG.
" where project_id not in ($restricted_projects) group by status_id");
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$stats[$row['status_id']]['count'] = $row['count'];
}
@@ -117,13 +117,13 @@
}
// Show the recently added and closed bugs
-$q->query("select bug_id, title from ".TBL_BUG.
+$rs = $db->query("select bug_id, title from ".TBL_BUG.
" where project_id not in ($restricted_projects)".
' order by created_date desc limit 5');
-if (!$q->num_rows()) {
+if (!$rs->numRows()) {
$t->set_var('recentrows', $STRING['nobugs']);
} else {
- while (list($bugid, $title) = $q->grab()) {
+ while (list($bugid, $title) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$t->set_var(array(
'title' => stripslashes($title),
'bugid' => $bugid
@@ -131,14 +131,14 @@
$t->parse('recentrows', 'recentrow', true);
}
}
-$q->query('select b.bug_id, title from '.TBL_BUG.' b, '.TBL_BUG_HISTORY.
+$rs = $db->query('select b.bug_id, title from '.TBL_BUG.' b, '.TBL_BUG_HISTORY.
" h where project_id not in ($restricted_projects) and b.bug_id = h.bug_id".
" and changed_field = 'status' and new_value = 'Closed'".
' order by h.created_date desc limit 5');
-if (!$q->num_rows()) {
+if (!$rs->numRows()) {
$t->set_var('closerows', $STRING['nobugs']);
} else {
- while (list($bugid, $title) = $q->grab()) {
+ while (list($bugid, $title) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$t->set_var(array(
'title' => stripslashes($title),
'bugid' => $bugid
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- newaccount.php 13 Dec 2001 14:00:35 -0000 1.23
+++ newaccount.php 17 Mar 2002 01:44:24 -0000 1.24
@@ -25,7 +25,7 @@
include 'include.php';
function do_form() {
- global $q, $t, $_pv, $STRING, $now, $u;
+ global $db, $t, $_pv, $STRING, $now, $u;
if (NEW_ACCOUNTS_DISABLED) {
$t->set_file('content', 'newaccount-disabled');
@@ -36,7 +36,7 @@
$error = $STRING['givelogin'];
elseif (!$_pv['email'] or !valid_email($_pv['email']))
$error = $STRING['giveemail'];
- elseif ($q->grab_field("select user_id from ".TBL_AUTH_USER.
+ elseif ($db->getOne("select user_id from ".TBL_AUTH_USER.
" where email = '{$_pv['email']}' ".
(!empty($_pv['login']) ? "or login = '{$_pv['login']}'" : '')))
$error = $STRING['loginused'];
@@ -57,10 +57,10 @@
} else {
$login = $_pv['login'];
}
- $user_id = $q->nextid(TBL_AUTH_USER);
- $q->query("insert into ".TBL_AUTH_USER." (user_id, login, first_name, last_name, email, password, active, created_date, last_modified_date)"
+ $user_id = $db->nextId(TBL_AUTH_USER);
+ $db->query("insert into ".TBL_AUTH_USER." (user_id, login, first_name, last_name, email, password, active, created_date, last_modified_date)"
." values ($user_id, '$login', '$firstname', '$lastname', '{$_pv['email']}', '$mpassword', 1, $now, $now)");
- $q->query("insert into ".TBL_USER_GROUP.
+ $db->query("insert into ".TBL_USER_GROUP.
" (user_id, group_id, created_by, created_date)
select $user_id, group_id, 0, $now from ".TBL_AUTH_GROUP.
" where group_name = 'User'");
@@ -70,7 +70,7 @@
}
function show_form($error = '') {
- global $q, $t, $_pv;
+ global $t, $_pv;
if (NEW_ACCOUNTS_DISABLED) {
$t->set_file('content', 'newaccount-disabled.html');
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- query.php 5 Mar 2002 23:04:21 -0000 1.59
+++ query.php 17 Mar 2002 01:44:24 -0000 1.60
@@ -25,15 +25,15 @@
include 'include.php';
function delete_saved_query($queryid) {
- global $q, $u, $me;
+ global $db, $u, $me;
- $q->query("delete from ".TBL_SAVED_QUERY." where user_id = $u
+ $db->query("delete from ".TBL_SAVED_QUERY." where user_id = $u
and saved_query_id = $queryid");
header("Location: $me?op=query");
}
function show_query() {
- global $q, $t, $TITLE, $u;
+ global $db, $t, $TITLE, $u;
$t->set_file('content','queryform.html');
$t->set_block('content', 'savequeryblock', 'sqblock');
@@ -41,11 +41,11 @@
if ($u != 'nobody') {
// Grab the saved queries if there are any
- $q->query("select * from ".TBL_SAVED_QUERY." where user_id = '$u'");
- if (!$q->num_rows()) {
+ $rs = $db->query("select * from ".TBL_SAVED_QUERY." where user_id = '$u'");
+ if (!$rs->numRows()) {
$t->set_var('rows','');
} else {
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'savedquerystring' => $row['saved_query_string'],
'savedqueryname' => stripslashes($row['saved_query_name']),
@@ -73,15 +73,15 @@
}
function build_query($assignedto, $reportedby, $open) {
- global $q, $auth, $_gv, $perm, $restricted_projects;
+ global $db, $auth, $_gv, $perm, $restricted_projects;
foreach ($_gv as $k => $v) { $$k = $v; }
// Open bugs assigned to the user -- a hit list
if ($assignedto || $reportedby) {
- $q->query("select status_id from ".TBL_STATUS." where status_name ".
- ($open ? '' : 'not ')."in ('Unconfirmed', 'New', 'Assigned', 'Reopened')");
- while ($statusid = $q->grab_field()) $status[] = $statusid;
+ $status = $db->getCol("select status_id from ".TBL_STATUS.
+ " where status_name ".($open ? '' : 'not ').
+ "in ('Unconfirmed', 'New', 'Assigned', 'Reopened')");
$query[] = 'b.status_id in ('.delimit_list(',',$status).')';
if ($assignedto) {
$query[] = "assigned_to = {$auth->auth['uid']}";
@@ -150,7 +150,7 @@
}
function list_items($assignedto = 0, $reportedby = 0, $open = 0) {
- global $me, $q, $t, $select, $TITLE, $STRING, $_gv, $u, $auth,
+ global $me, $db, $t, $select, $TITLE, $STRING, $_gv, $u, $auth,
$default_db_fields, $all_db_fields, $_sv, $HTTP_SERVER_VARS;
$t->set_file('content','buglist.html');
@@ -164,9 +164,11 @@
// Save the query if requested
if (!empty($savedqueryname)) {
$savedquerystring = ereg_replace('&savedqueryname=.*(&?)', '\\1', $HTTP_SERVER_VARS['QUERY_STRING']);
- $q->query("insert into ".TBL_SAVED_QUERY.
+ $nextid = $db->getOne("select max(saved_query_id)+1 from ".TBL_SAVED_QUERY." where user_id = $u");
+ $nextid = $nextid ? $nextid : 1;
+ $db->query("insert into ".TBL_SAVED_QUERY.
" (saved_query_id, user_id, saved_query_name, saved_query_string)
- values (".$q->nextid(TBL_SAVED_QUERY).", $u, '$savedqueryname', '$savedquerystring')");
+ values ($nextid, $u, '$savedqueryname', '$savedquerystring')");
}
if (!isset($order)) {
if (isset($_sv['queryinfo']['order'])) {
@@ -189,7 +191,7 @@
$_sv['queryinfo'] = array();
}
- $nr = $q->grab_field('select count(*) from '.TBL_BUG.' b
+ $nr = $db->getOne('select count(*) from '.TBL_BUG.' b
left join '.TBL_AUTH_USER.' owner on b.assigned_to = owner.user_id
left join '.TBL_AUTH_USER.' reporter on b.created_by = reporter.user_id '.
(!empty($_sv['queryinfo']['query']) ? "where {$_sv['queryinfo']['query']}": ''));
@@ -206,7 +208,7 @@
'project' => build_select('project'),
'TITLE' => $TITLE['buglist']));
- $q->limit_query('select b.*, reporter.login as reporter, owner.login as owner,
+ $rs = $db->limitQuery('select b.*, reporter.login as reporter, owner.login as owner,
lastmodifier.login as lastmodifier, project_name, severity_name, severity_color, status_name,
os_name, version_name, component_name, resolution_name from '.TBL_BUG.' b
left join '.TBL_AUTH_USER.' owner on b.assigned_to = owner.user_id
@@ -219,7 +221,7 @@
and b.os_id = os.os_id and b.version_id = version.version_id
and b.component_id = component.component_id and b.project_id = project.project_id '.
(!empty($_sv['queryinfo']['query']) ? "and {$_sv['queryinfo']['query']} " : '').
- "order by $order $sort, bug_id asc", $selrange, $llimit);
+ "order by $order $sort, bug_id asc", $llimit, $selrange);
$headers = array(
'bug_id' => 'bug_id',
@@ -244,7 +246,7 @@
sorting_headers($me, $headers, $order, $sort, "page=$page");
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var(array(
'rows' => "<tr><td>{$STRING['nobugs']}</td></tr>",
'numcols' => "1"));
@@ -267,7 +269,7 @@
$pos = 0;
// Data rows
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$bgcolor = USE_SEVERITY_COLOR ? $row['severity_color'] :
((++$i % 2 == 0) ? '#dddddd' : '#ffffff');
$trclass = USE_SEVERITY_COLOR ? '' : ($i % 2 ? '' : 'alt');
Index: upgrade.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/upgrade.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- upgrade.php 13 Mar 2002 16:36:28 -0000 1.10
+++ upgrade.php 17 Mar 2002 01:44:24 -0000 1.11
@@ -26,19 +26,19 @@
include 'include.php';
function upgrade() {
- global $q;
+ global $db;
- $upgraded = $q->grab_field('select varvalue from '.TBL_CONFIGURATION.
+ $upgraded = $db->getOne('select varvalue from '.TBL_CONFIGURATION.
" where varname = 'PROMOTE_VOTES'");
if (!$upgraded) {
// Add the bug_vote table and insert the new configuration options
if (DB_TYPE == 'pgsql') {
- $q->query("CREATE TABLE ".TBL_BUG_VOTE." ( user_id INT4 NOT NULL DEFAULT '0', bug_id INT4 NOT NULL DEFAULT '0', created_date INT8 NOT NULL DEFAULT '0', PRIMARY KEY (user_id,bug_id) );");
+ $db->query("CREATE TABLE ".TBL_BUG_VOTE." ( user_id INT4 NOT NULL DEFAULT '0', bug_id INT4 NOT NULL DEFAULT '0', created_date INT8 NOT NULL DEFAULT '0', PRIMARY KEY (user_id,bug_id) );");
} else {
- $q->query("create table ".TBL_BUG_VOTE." ( user_id int(10) unsigned NOT NULL default '0', bug_id int(10) unsigned NOT NULL default '0', created_date bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (user_id, bug_id), KEY bug_id (bug_id) )");
+ $db->query("create table ".TBL_BUG_VOTE." ( user_id int(10) unsigned NOT NULL default '0', bug_id int(10) unsigned NOT NULL default '0', created_date bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (user_id, bug_id), KEY bug_id (bug_id) )");
}
- $q->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('PROMOTE_VOTES', 5, 'The number of votes required to promote a bug from Unconfirmed to New (Set to 0 to disable promotions by voting)', 'string')");
- $q->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('MAX_USER_VOTES', 5, 'The maximum number of votes a user can cast across all bugs (Set to 0 to have no limit)', 'string')");
+ $db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('PROMOTE_VOTES', 5, 'The number of votes required to promote a bug from Unconfirmed to New (Set to 0 to disable promotions by voting)', 'string')");
+ $db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('MAX_USER_VOTES', 5, 'The maximum number of votes a user can cast across all bugs (Set to 0 to have no limit)', 'string')");
}
include 'templates/default/upgrade-finished.html';
}
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/user.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- user.php 28 Feb 2002 18:23:31 -0000 1.19
+++ user.php 17 Mar 2002 01:44:24 -0000 1.20
@@ -25,24 +25,24 @@
include 'include.php';
function delete_vote($bug_id) {
- global $q, $u, $me, $now;
+ global $db, $u, $me, $now;
- $q->query("delete from ".TBL_BUG_VOTE." where user_id = $u and bug_id = $bug_id");
+ $db->query("delete from ".TBL_BUG_VOTE." where user_id = $u and bug_id = $bug_id");
header("Location: $me?r=$now");
}
function change_bug_list_columns($column_list) {
- global $q, $u, $t, $auth;
+ global $db, $u, $t, $auth;
$auth->auth['db_fields'] = $column_list;
$column_list = serialize($column_list);
- $q->query("update ".TBL_AUTH_USER." set bug_list_fields = '$column_list' where user_id = $u");
+ $db->query("update ".TBL_AUTH_USER." set bug_list_fields = '$column_list' where user_id = $u");
//$t->set_file('content', 'columnlistchanged.html');
show_text('Your bug list column preferences have been saved');
}
function change_password($pass1, $pass2) {
- global $t, $q, $u, $STRING;
+ global $t, $db, $u, $STRING;
if (!$pass1 = trim($pass1)) $error = $STRING['givepassword'];
elseif ($pass1 != $pass2) $error = $STRING['passwordmatch'];
@@ -58,12 +58,12 @@
$mpassword = $pass1;
}
- $q->query("update ".TBL_AUTH_USER." set password = '$mpassword' where user_id = $u");
+ $db->query("update ".TBL_AUTH_USER." set password = '$mpassword' where user_id = $u");
$t->set_file('content', 'passwordchanged.html');
}
function show_preferences_form($error = '') {
- global $t, $pass1, $pass2, $all_db_fields, $default_db_fields, $auth, $q, $u;
+ global $t, $pass1, $pass2, $all_db_fields, $default_db_fields, $auth, $db, $u;
$t->set_file('content', 'user.html');
$t->set_block('content', 'column_list_row', 'list_rows');
@@ -91,12 +91,12 @@
}
// Display the votes (if any)
- $q->query("select * from ".TBL_BUG_VOTE." where user_id = $u");
- if (!$q->num_rows()) {
+ $rs = $db->query("select * from ".TBL_BUG_VOTE." where user_id = $u");
+ if (!$rs->numRows()) {
$t->set_var('votesb', ' ');
} else {
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
|