|
From: Benjamin C. <bc...@us...> - 2002-03-17 01:38:34
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv3843
Modified Files:
configure.php group.php os.php project.php resolution.php
severity.php status.php user.php
Log Message:
Changing to PEAR::DB -- somewhat tested
Index: configure.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/configure.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configure.php 26 Jan 2002 16:46:52 -0000 1.4
+++ configure.php 17 Mar 2002 01:38:31 -0000 1.5
@@ -26,15 +26,15 @@
include '../include.php';
function save_options() {
- global $q, $HTTP_POST_VARS;
+ global $db, $HTTP_POST_VARS;
foreach ($HTTP_POST_VARS as $k => $v) {
- $q->query('update '.TBL_CONFIGURATION." set varvalue = '$v' where varname = '$k'");
+ $db->query('update '.TBL_CONFIGURATION." set varvalue = '$v' where varname = '$k'");
}
}
function list_options() {
- global $q, $t;
+ global $db, $t;
$t->set_file('content', 'configure.html');
$t->set_block('content', 'row', 'rows');
@@ -43,8 +43,8 @@
$t->set_block('row', 'radioblock', 'radio');
$i = 0;
- $q->query('select * from '.TBL_CONFIGURATION);
- while ($row = $q->grab()) {
+ $rs = $db->query('select * from '.TBL_CONFIGURATION);
+ while ($rs->fetchInto($row)) {
$t->set_var($row);
$t->set_var('trclass', ++$i % 2 ? '' : 'alt');
Index: group.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/group.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- group.php 26 Jan 2002 16:46:52 -0000 1.4
+++ group.php 17 Mar 2002 01:38:31 -0000 1.5
@@ -26,20 +26,20 @@
include '../include.php';
function purge_group($groupid = 0) {
- global $q;
+ global $db;
- $q->query("delete from ".TBL_USER_GROUP." where group_id = $groupid");
+ $db->query("delete from ".TBL_USER_GROUP." where group_id = $groupid");
}
function del_group($groupid = 0) {
- global $q;
+ global $db;
purge_group($groupid);
- $q->query("delete from ".TBL_AUTH_GROUP." where group_id = $groupid");
+ $db->query("delete from ".TBL_AUTH_GROUP." where group_id = $groupid");
}
function do_form($groupid = 0) {
- global $q, $me, $_pv, $STRING, $u, $now;
+ global $db, $me, $_pv, $STRING, $u, $now;
extract($_pv);
$error = '';
@@ -49,11 +49,11 @@
if ($error) { list_items($groupid, $error); return; }
if (!$groupid) {
- $q->query("insert into ".TBL_AUTH_GROUP.
+ $db->query("insert into ".TBL_AUTH_GROUP.
" (group_id, group_name, created_by, created_date, last_modified_by, last_modified_date)"
- ." values (".$q->nextid(TBL_AUTH_GROUP).", '$fname', $u, $now, $u, $now)");
+ ." values (".$db->nextId(TBL_AUTH_GROUP).", '$fname', $u, $now, $u, $now)");
} else {
- $q->query("update ".TBL_AUTH_GROUP.
+ $db->query("update ".TBL_AUTH_GROUP.
" set group_name = '$fname', last_modified_by = $u,
last_modified_date = $now where group_id = '$groupid'");
}
@@ -61,10 +61,10 @@
}
function show_form($groupid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
if ($groupid && !$error) {
- $row = $q->grab("select * from ".TBL_AUTH_GROUP.
+ $row = $db->getRow("select * from ".TBL_AUTH_GROUP.
" where group_id = '$groupid'");
$t->set_var(array(
'action' => $STRING['edit'],
@@ -81,7 +81,7 @@
function list_items($groupid = 0, $error = '') {
- global $me, $q, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE;
$t->set_file('content','grouplist.html');
$t->set_block('content','row','rows');
@@ -98,7 +98,7 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->grab_field("select count(*) from ".TBL_AUTH_GROUP);
+ $nr = $db->getOne("select count(*) from ".TBL_AUTH_GROUP);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -109,12 +109,12 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query("select ag.group_id, group_name, locked, count(ug.group_id) as count from ".
+ $rs = $db->limitQuery("select ag.group_id, group_name, locked, count(ug.group_id) as count from ".
TBL_AUTH_GROUP." ag left join ".TBL_USER_GROUP." ug using (group_id) left join ".
TBL_AUTH_USER." using (user_id) group by ag.group_id, group_name, locked order by $order $sort",
- $selrange, $llimit);
+ $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
// This should never happen, as admin, user, and developer groups must exist
$t->set_var('rows',"");
return;
@@ -128,7 +128,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
Index: os.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/os.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- os.php 5 Mar 2002 23:54:15 -0000 1.21
+++ os.php 17 Mar 2002 01:38:31 -0000 1.22
@@ -26,24 +26,24 @@
include '../include.php';
function del_item($osid = 0) {
- global $q, $me;
+ global $db, $me;
if ($osid) {
// Make sure we are going after a valid record
- $itemexists = $q->grab_field('select count(*) from '.TBL_OS.
+ $itemexists = $db->getOne('select count(*) from '.TBL_OS.
" where os_id = $osid");
// Are there any bugs tied to this one?
- $bugcount = $q->grab_field('select count(*) from '.TBL_BUG.
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
" where os_id = $osid");
if ($itemexists and !$bugcount) {
- $q->query('delete from '.TBL_OS." where os_id = $osid");
+ $db->query('delete from '.TBL_OS." where os_id = $osid");
}
}
header("Location: $me?");
}
function do_form($osid = 0) {
- global $q, $me, $_pv, $STRING;
+ global $db, $me, $_pv, $STRING;
extract($_pv);
$error = '';
@@ -53,19 +53,19 @@
if ($error) { list_items($osid, $error); return; }
if (!$osid) {
- $q->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) values (".$q->nextid(TBL_OS).", '$fname', '$fregex', '$fsortorder')");
+ $db->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) values (".$db->nextId(TBL_OS).", '$fname', '$fregex', '$fsortorder')");
} else {
- $q->query("update ".TBL_OS." set os_name = '$fname', regex = '$fregex', sort_order = '$fsortorder' where os_id = '$osid'");
+ $db->query("update ".TBL_OS." set os_name = '$fname', regex = '$fregex', sort_order = '$fsortorder' where os_id = '$osid'");
}
header("Location: $me?");
}
function show_form($osid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
extract($_pv);
if ($osid && !$error) {
- $row = $q->grab("select * from ".TBL_OS." where os_id = '$osid'");
+ $row = $db->getRow("select * from ".TBL_OS." where os_id = '$osid'");
$t->set_var(array(
'action' => $STRING['edit'],
'fosid' => $row['os_id'],
@@ -85,7 +85,7 @@
function list_items($osid = 0, $error = '') {
- global $q, $me, $db, $t, $_gv, $STRING, $TITLE;
+ global $db, $me, $t, $_gv, $STRING, $TITLE;
$t->set_file('content','oslist.html');
$t->set_block('content','row','rows');
@@ -102,7 +102,7 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->grab_field("select count(*) from ".TBL_OS);
+ $nr = $db->getOne("select count(*) from ".TBL_OS);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -113,13 +113,13 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query('select s.os_id, os_name, regex, sort_order,'.
+ $rs = $db->limitQuery('select s.os_id, os_name, regex, sort_order,'.
' count(bug_id) as bug_count from '.TBL_OS.
' s left join '.TBL_BUG.' using (os_id) group by s.os_id,'.
' os_name, regex, sort_order'.
- " order by $order $sort", $selrange, $llimit);
+ " order by $order $sort", $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['nooses']}</td></tr>");
return;
}
@@ -133,7 +133,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
Index: project.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- project.php 2 Mar 2002 18:08:55 -0000 1.31
+++ project.php 17 Mar 2002 01:38:31 -0000 1.32
@@ -26,7 +26,7 @@
include '../include.php';
function save_version($versionid = 0) {
- global $q, $me, $_pv, $STRING, $now, $u;
+ global $db, $me, $_pv, $STRING, $now, $u;
$error = '';
// Validation
@@ -37,11 +37,11 @@
foreach ($_pv as $k => $v) $$k = $v;
if (!$vf_active) $vf_active = 0;
if (!$versionid) {
- $q->query('insert into '.TBL_VERSION
+ $db->query('insert into '.TBL_VERSION
." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$q->nextid(TBL_VERSION).", $projectid, '$vf_version', $vf_active, $u, $now)");
+ values (".$db->nextId(TBL_VERSION).", $projectid, '$vf_version', $vf_active, $u, $now)");
} else {
- $q->query('update '.TBL_VERSION
+ $db->query('update '.TBL_VERSION
." set project_id = $projectid, version_name = '$vf_version',
active = $vf_active where version_id = '$versionid'");
}
@@ -49,12 +49,12 @@
}
function show_version($versionid = 0, $error = '') {
- global $q, $t, $_pv, $STRING;
+ global $db, $t, $_pv, $STRING;
foreach ($_pv as $k => $v) $$k = $v;
if ($versionid && !$error) {
- $row = $q->grab("select v.*, p.project_name as project_name"
+ $row = $db->getRow("select v.*, p.project_name as project_name"
." from ".TBL_VERSION." v left join ".TBL_PROJECT." p using(project_id)"
." where version_id = '$versionid'");
$t->set_var(array(
@@ -74,16 +74,16 @@
}
function list_versions($projectid) {
- global $q, $t, $STRING;
+ global $db, $t, $STRING;
- $q->query("select * from ".TBL_VERSION." where project_id = $projectid");
- if (!$q->num_rows()) {
+ $rs = $db->query("select * from ".TBL_VERSION." where project_id = $projectid");
+ if (!$rs->numRows()) {
$t->set_var('verrows',"<tr><td colspan='2' align='center'>{$STRING['noversions']}</td></tr>");
return;
}
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
@@ -97,7 +97,7 @@
}
function save_component($componentid = 0) {
- global $q, $me, $_pv, $u, $STRING, $now;
+ global $db, $me, $_pv, $u, $STRING, $now;
$error = '';
// Validation
@@ -111,13 +111,13 @@
if (!$cf_owner) $cf_owner = 0;
if (!$cf_active) $cf_active = 0;
if (!$componentid) {
- $q->query('insert into '.TBL_COMPONENT
+ $db->query('insert into '.TBL_COMPONENT
." (component_id, project_id, component_name, component_desc, owner,
active, created_by, created_date, last_modified_by, last_modified_date)
- values (".$q->nextid(TBL_COMPONENT).", $projectid, '$cf_name',
+ values (".$db->nextId(TBL_COMPONENT).", $projectid, '$cf_name',
'$cf_description', $cf_owner, $cf_active, $u, $now, $u, $now)");
} else {
- $q->query('update '.TBL_COMPONENT
+ $db->query('update '.TBL_COMPONENT
." set component_name = '$cf_name', component_desc = '$cf_description',
owner = $cf_owner, active = $cf_active, last_modified_by = $u,
last_modified_date = $now where component_id = '$componentid'");
@@ -126,12 +126,12 @@
}
function show_component($componentid = 0, $error = '') {
- global $q, $t, $_pv, $STRING;
+ global $db, $t, $_pv, $STRING;
foreach ($_pv as $k => $v) $$k = $v;
if ($componentid && !$error) {
- $row = $q->grab('select c.*, p.project_name as project_name
+ $row = $db->getRow('select c.*, p.project_name as project_name
from '.TBL_COMPONENT.' c left join '.TBL_PROJECT." p using (project_id)
where component_id = '$componentid'");
$t->set_var(array(
@@ -155,16 +155,16 @@
}
function list_components($projectid) {
- global $q, $t, $STRING;
+ global $db, $t, $STRING;
- $q->query("select * from ".TBL_COMPONENT." where project_id = $projectid");
- if (!$q->num_rows()) {
+ $rs = $db->query("select * from ".TBL_COMPONENT." where project_id = $projectid");
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td colspan='2' align='center'>{$STRING['nocomponents']}</td></tr>");
return;
}
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
@@ -182,7 +182,7 @@
}
function save_project($projectid = 0) {
- global $q, $me, $u, $STRING, $now, $_pv;
+ global $db, $me, $u, $STRING, $now, $_pv;
$error = '';
// Validation
@@ -210,32 +210,32 @@
foreach ($_pv as $k => $v) $$k = $v;
if (!isset($active)) $active = 0;
if (!$projectid) {
- $projectid = $q->nextid(TBL_PROJECT);
- $q->query('insert into '.TBL_PROJECT
+ $projectid = $db->nextId(TBL_PROJECT);
+ $db->query('insert into '.TBL_PROJECT
." (project_id, project_name, project_desc, active, created_by, created_date)
values ($projectid , '$name', '$description', $active, $u, $now)");
- $q->query('insert into '.TBL_VERSION
+ $db->query('insert into '.TBL_VERSION
." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$q->nextid(TBL_VERSION).", $projectid, '$vf_version', 1, $u, $now)");
- $q->query('insert into '.TBL_COMPONENT
+ values (".$db->nextId(TBL_VERSION).", $projectid, '$vf_version', 1, $u, $now)");
+ $db->query('insert into '.TBL_COMPONENT
." (component_id, project_id, component_name, component_desc, owner,
active, created_by, created_date, last_modified_by, last_modified_date)
- values (".$q->nextid(TBL_COMPONENT).", $projectid, '$cf_name',
+ values (".$db->nextId(TBL_COMPONENT).", $projectid, '$cf_name',
'$cf_description', $cf_owner, 1, $u, $now, $u, $now)");
} else {
- $q->query('update '.TBL_PROJECT
+ $db->query('update '.TBL_PROJECT
." set project_name = '$name', project_desc = '$description',
active = $active where project_id = $projectid");
}
// Handle project -> group relationship
- $old_usergroup = $q->grab_field_set('select group_id from '.TBL_PROJECT_GROUP.
+ $old_usergroup = $db->getCol('select group_id from '.TBL_PROJECT_GROUP.
" where project_id = $projectid");
if (isset($usergroup) and is_array($usergroup) and count($usergroup)) {
if (in_array('all', $usergroup)) {
// User selected 'All groups'
if (count($old_usergroup)) {
- $q->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid");
+ $db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid");
}
} else {
// Compute differences between old and new
@@ -244,13 +244,13 @@
if (count($remove_from)) {
foreach ($remove_from as $group) {
- $q->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid
+ $db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid
and group_id = $group");
}
}
if (count($add_to)) {
foreach ($add_to as $group) {
- $q->query("insert into ".TBL_PROJECT_GROUP
+ $db->query("insert into ".TBL_PROJECT_GROUP
." (project_id, group_id, created_by, created_date)
values ('$projectid' ,'$group', $u, $now)");
}
@@ -258,19 +258,19 @@
}
} elseif (count($old_usergroup)) {
// User selected nothing, so consider it 'All groups'
- $q->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid");
+ $db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid");
}
header("Location: $me?op=edit&id=$projectid");
}
function show_project($projectid = 0, $error = array()) {
- global $q, $me, $t, $name, $description, $active, $TITLE, $_gv;
+ global $db, $me, $t, $name, $description, $active, $TITLE, $_gv;
- $proj_groups = $q->grab_field_set('select group_id from '.TBL_PROJECT_GROUP.
+ $proj_groups = $db->getCol('select group_id from '.TBL_PROJECT_GROUP.
" where project_id = $projectid");
if ($projectid && !$error) {
- $row = $q->grab('select * from '.TBL_PROJECT
+ $row = $db->getRow('select * from '.TBL_PROJECT
." where project_id = $projectid");
$t->set_var(array(
'projectid' => $row['project_id'],
@@ -308,13 +308,13 @@
}
function list_projects() {
- global $me, $q, $t, $selrange, $order, $sort, $STRING, $TITLE, $page;
+ global $me, $db, $t, $selrange, $order, $sort, $STRING, $TITLE, $page;
$t->set_file('content','projectlist.html');
$t->set_block('content','row','rows');
if (!$order) { $order = '1'; $sort = 'asc'; }
- $nr = $q->grab_field("select count(*) from ".TBL_PROJECT);
+ $nr = $db->getOne("select count(*) from ".TBL_PROJECT);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -327,10 +327,10 @@
'TITLE' => $TITLE['project']
));
- $q->limit_query("select * from ".TBL_PROJECT." order by $order $sort",
- $selrange, $llimit);
+ $rs = $db->limitQuery("select * from ".TBL_PROJECT." order by $order $sort",
+ $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['noprojects']}</td></tr>");
return;
}
@@ -346,7 +346,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
Index: resolution.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/resolution.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- resolution.php 5 Mar 2002 23:54:15 -0000 1.22
+++ resolution.php 17 Mar 2002 01:38:31 -0000 1.23
@@ -26,24 +26,24 @@
include '../include.php';
function del_item($resolutionid = 0) {
- global $q, $me;
+ global $db, $me;
if ($resolutionid) {
// Make sure we are going after a valid record
- $itemexists = $q->grab_field('select count(*) from '.TBL_RESOLUTION.
+ $itemexists = $db->getOne('select count(*) from '.TBL_RESOLUTION.
" where resolution_id = $resolutionid");
// Are there any bugs tied to this one?
- $bugcount = $q->grab_field('select count(*) from '.TBL_BUG.
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
" where resolution_id = $resolutionid");
if ($itemexists and !$bugcount) {
- $q->query('delete from '.TBL_RESOLUTION." where resolution_id = $resolutionid");
+ $db->query('delete from '.TBL_RESOLUTION." where resolution_id = $resolutionid");
}
}
header("Location: $me?");
}
function do_form($resolutionid = 0) {
- global $q, $me, $_pv, $STRING;
+ global $db, $me, $_pv, $STRING;
extract($_pv);
$error = '';
@@ -55,11 +55,11 @@
if ($error) { list_items($resolutionid, $error); return; }
if (!$resolutionid) {
- $q->query("insert into ".TBL_RESOLUTION.
+ $db->query("insert into ".TBL_RESOLUTION.
" (resolution_id, resolution_name, resolution_desc, sort_order)"
- ." values (".$q->nextid(TBL_RESOLUTION).", '$fname', '$fdescription', '$fsortorder')");
+ ." values (".$db->nextId(TBL_RESOLUTION).", '$fname', '$fdescription', '$fsortorder')");
} else {
- $q->query("update ".TBL_RESOLUTION.
+ $db->query("update ".TBL_RESOLUTION.
" set resolution_name = '$fname', resolution_desc = '$fdescription',
sort_order = '$fsortorder' where resolution_id = '$resolutionid'");
}
@@ -67,11 +67,11 @@
}
function show_form($resolutionid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
extract($_pv);
if ($resolutionid && !$error) {
- $row = $q->grab("select * from ".TBL_RESOLUTION.
+ $row = $db->getRow("select * from ".TBL_RESOLUTION.
" where resolution_id = '$resolutionid'");
$t->set_var(array(
'action' => $STRING['edit'],
@@ -92,7 +92,7 @@
function list_items($resolutionid = 0, $error = '') {
- global $me, $q, $t, $STRING, $TITLE, $_gv;
+ global $me, $db, $t, $STRING, $TITLE, $_gv;
$t->set_file('content','resolutionlist.html');
$t->set_block('content','row','rows');
@@ -108,7 +108,7 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->query("select count(*) from ".TBL_RESOLUTION);
+ $nr = $db->getOne("select count(*) from ".TBL_RESOLUTION);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -119,13 +119,13 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query('select s.resolution_id, resolution_name, resolution_desc,'.
+ $rs = $db->limitQuery('select s.resolution_id, resolution_name, resolution_desc,'.
' sort_order, count(bug_id) as bug_count from '.TBL_RESOLUTION.
' s left join '.TBL_BUG.' using (resolution_id) group by s.resolution_id,'.
' resolution_name, resolution_desc, sort_order'.
- " order by $order $sort", $selrange, $llimit);
+ " order by $order $sort", $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['noresolutions']}</td></tr>");
return;
}
@@ -139,7 +139,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
Index: severity.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/severity.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- severity.php 5 Mar 2002 23:54:15 -0000 1.18
+++ severity.php 17 Mar 2002 01:38:31 -0000 1.19
@@ -26,24 +26,24 @@
include '../include.php';
function del_item($severityid = 0) {
- global $q, $me;
+ global $db, $me;
if ($severityid) {
// Make sure we are going after a valid record
- $itemexists = $q->grab_field('select count(*) from '.TBL_SEVERITY.
+ $itemexists = $db->getOne('select count(*) from '.TBL_SEVERITY.
" where severity_id = $severityid");
// Are there any bugs tied to this one?
- $bugcount = $q->grab_field('select count(*) from '.TBL_BUG.
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
" where severity_id = $severityid");
if ($itemexists and !$bugcount) {
- $q->query('delete from '.TBL_SEVERITY." where severity_id = $severityid");
+ $db->query('delete from '.TBL_SEVERITY." where severity_id = $severityid");
}
}
header("Location: $me?");
}
function do_form($severityid = 0) {
- global $q, $me, $_pv, $STRING;
+ global $db, $me, $_pv, $STRING;
extract($_pv);
$error = '';
@@ -55,11 +55,11 @@
if ($error) { list_items($severityid, $error); return; }
if (!$severityid) {
- $q->query("insert into ".TBL_SEVERITY.
+ $db->query("insert into ".TBL_SEVERITY.
" (severity_id, severity_name, severity_desc, sort_order, severity_color)
- values (".$q->nextid(TBL_SEVERITY).", '$fname', '$fdescription', '$fsortorder', '$fcolor')");
+ values (".$db->nextId(TBL_SEVERITY).", '$fname', '$fdescription', '$fsortorder', '$fcolor')");
} else {
- $q->query("update ".TBL_SEVERITY." set severity_name = '$fname',
+ $db->query("update ".TBL_SEVERITY." set severity_name = '$fname',
severity_desc = '$fdescription', sort_order = '$fsortorder',
severity_color = '$fcolor' where severity_id = '$severityid'");
}
@@ -67,10 +67,10 @@
}
function show_form($severityid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
if ($severityid && !$error) {
- $row = $q->grab("select * from ".TBL_SEVERITY.
+ $row = $db->getRow("select * from ".TBL_SEVERITY.
" where severity_id = '$severityid'");
$t->set_var(array(
'action' => $STRING['edit'],
@@ -95,7 +95,7 @@
function list_items($severityid = 0, $error = '') {
- global $me, $q, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE;
$t->set_file('content','severitylist.html');
$t->set_block('content','row','rows');
@@ -111,7 +111,7 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->query("select count(*) from ".TBL_SEVERITY);
+ $nr = $db->getOne("select count(*) from ".TBL_SEVERITY);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -122,14 +122,14 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query('select s.severity_id, severity_name, severity_desc,'.
+ $rs = $db->limitQuery('select s.severity_id, severity_name, severity_desc,'.
' severity_color, sort_order, count(bug_id) as bug_count from '.TBL_SEVERITY.
' s left join '.TBL_BUG.' using (severity_id) group by s.severity_id,'.
' severity_name, severity_desc, severity_color, sort_order'.
- " order by $order $sort", $selrange, $llimit);
+ " order by $order $sort", $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['noseverities']}</td></tr>");
return;
}
@@ -144,7 +144,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => USE_SEVERITY_COLOR ? $row['severity_color'] :
((++$i % 2 == 0) ? '#dddddd' : ''),
Index: status.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/status.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- status.php 5 Mar 2002 23:54:15 -0000 1.22
+++ status.php 17 Mar 2002 01:38:31 -0000 1.23
@@ -26,24 +26,24 @@
include '../include.php';
function del_item($statusid = 0) {
- global $q, $me;
+ global $db, $me;
if ($statusid) {
// Make sure we are going after a valid record
- $itemexists = $q->grab_field('select count(*) from '.TBL_STATUS.
+ $itemexists = $db->getOne('select count(*) from '.TBL_STATUS.
" where status_id = $statusid");
// Are there any bugs tied to this one?
- $bugcount = $q->grab_field('select count(*) from '.TBL_BUG.
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
" where status_id = $statusid");
if ($itemexists and !$bugcount) {
- $q->query('delete from '.TBL_STATUS." where status_id = $statusid");
+ $db->query('delete from '.TBL_STATUS." where status_id = $statusid");
}
}
header("Location: $me?");
}
function do_form($statusid = 0) {
- global $q, $me, $_pv, $STRING;
+ global $db, $me, $_pv, $STRING;
extract($_pv);
$error = '';
@@ -55,11 +55,11 @@
if ($error) { list_items($statusid, $error); return; }
if (!$statusid) {
- $q->query("insert into ".TBL_STATUS.
+ $db->query("insert into ".TBL_STATUS.
" (status_id, status_name, status_desc, sort_order) values (".
- $q->nextid(TBL_STATUS).", '$fname', '$fdescription', '$fsortorder')");
+ $db->nextId(TBL_STATUS).", '$fname', '$fdescription', '$fsortorder')");
} else {
- $q->query("update ".TBL_STATUS.
+ $db->query("update ".TBL_STATUS.
" set status_name = '$fname', status_desc = '$fdescription',
sort_order = '$fsortorder' where status_id = '$statusid'");
}
@@ -67,11 +67,11 @@
}
function show_form($statusid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
extract($_pv);
if ($statusid && !$error) {
- $row = $q->grab("select * from ".TBL_STATUS.
+ $row = $db->getRow("select * from ".TBL_STATUS.
" where status_id = '$statusid'");
$t->set_var(array(
'action' => $STRING['edit'],
@@ -92,7 +92,7 @@
function list_items($statusid = 0, $error = '') {
- global $me, $q, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE;
$t->set_file('content','statuslist.html');
$t->set_block('content','row','rows');
@@ -108,7 +108,7 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->query("select count(*) from ".TBL_STATUS);
+ $nr = $db->getOne("select count(*) from ".TBL_STATUS);
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -119,12 +119,12 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query('select s.status_id, status_name, status_desc,'.
+ $rs = $db->limitQuery('select s.status_id, status_name, status_desc,'.
' sort_order, count(bug_id) as bug_count from '.TBL_STATUS.' s left join '.
TBL_BUG.' using (status_id) group by s.status_id, status_name, status_desc,'.
- " sort_order order by $order $sort", $selrange, $llimit);
+ " sort_order order by $order $sort", $llimit, $selrange);
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['nostatuses']}</td></tr>");
return;
}
@@ -138,7 +138,7 @@
sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
+ while ($rs->fetchInto($row)) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- user.php 6 Mar 2002 04:17:54 -0000 1.40
+++ user.php 17 Mar 2002 01:38:31 -0000 1.41
@@ -26,7 +26,7 @@
include '../include.php';
function do_form($userid = 0) {
- global $q, $me, $_pv, $STRING, $now, $u;
+ global $db, $me, $_pv, $STRING, $now, $u;
$error = '';
// Validation
@@ -52,8 +52,8 @@
if (!$userid) {
if (ENCRYPT_PASS) $mpassword = md5($_pv['fpassword']);
else $mpassword = $_pv['fpassword'];
- $new_user_id = $q->nextid(TBL_AUTH_USER);
- $q->query('insert into '.TBL_AUTH_USER
+ $new_user_id = $db->nextId(TBL_AUTH_USER);
+ $db->query('insert into '.TBL_AUTH_USER
." (user_id, first_name, last_name, login, email, password, active,
created_by, created_date, last_modified_by, last_modified_date)
values ($new_user_id, '{$_pv['ffirstname']}', '{$_pv['flastname']}',
@@ -63,19 +63,19 @@
if (isset($_pv['fusergroup']) and is_array($_pv['fusergroup']) and
$_pv['fusergroup'][0]) {
foreach ($_pv['fusergroup'] as $group) {
- $q->query("insert into ".TBL_USER_GROUP
+ $db->query("insert into ".TBL_USER_GROUP
." (user_id, group_id, created_by, created_date)
values ('$new_user_id' ,'$group', $u, $now)");
}
}
// And add to the user group
- $q->query("insert into ".TBL_USER_GROUP.
+ $db->query("insert into ".TBL_USER_GROUP.
" (user_id, group_id, created_by, created_date)
select $new_user_id, group_id, $u, $now from ".TBL_AUTH_GROUP.
" where group_name = 'User'");
} else {
if (ENCRYPT_PASS) {
- $oldpass = $q->grab_field("select password from ".TBL_AUTH_USER
+ $oldpass = $db->getOne("select password from ".TBL_AUTH_USER
." where user_id = $userid");
if ($oldpass != $_pv['fpassword']) {
$pquery = "password = '".md5($_pv['fpassword'])."',";
@@ -85,19 +85,17 @@
} else {
$pquery = "password = '{$_pv['fpassword']}',";
}
- $q->query("update ".TBL_AUTH_USER." set first_name = '{$_pv['ffirstname']}',
+ $db->query("update ".TBL_AUTH_USER." set first_name = '{$_pv['ffirstname']}',
last_name = '{$_pv['flastname']}', login = '$login',
email = '{$_pv['femail']}', $pquery active = {$_pv['factive']}
where user_id = '$userid'");
// Update group memberships
// Get user's groups (without dropping the user group)
- $q->query('select ug.group_id from '.TBL_USER_GROUP.' ug left join '
- .TBL_AUTH_GROUP.' g using (group_id) '
+ $user_groups = $db->getCol('select ug.group_id from '.
+ TBL_USER_GROUP.' ug left join '.TBL_AUTH_GROUP.' g using (group_id) '
." where user_id = $userid and group_name <> 'User'");
- while ($group_id = $q->grab_field()) {
- $user_groups[] = $group_id;
- }
+
// Compute differences between old and new
if (!isset($user_groups) or !is_array($user_groups)) {
$user_groups = array();
@@ -112,13 +110,13 @@
if (count($remove_from)) {
foreach ($remove_from as $group) {
- $q->query('delete from '.TBL_USER_GROUP
+ $db->query('delete from '.TBL_USER_GROUP
." where user_id = $userid and group_id = $group");
}
}
if (count($add_to)) {
foreach ($add_to as $group) {
- $q->query("insert into ".TBL_USER_GROUP
+ $db->query("insert into ".TBL_USER_GROUP
." (user_id, group_id, created_by, created_date)
values ('$userid' ,'$group', $u, $now)");
}
@@ -128,17 +126,15 @@
}
function show_form($userid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $db, $me, $t, $_pv, $STRING;
if ($userid && !$error) {
- $row = $q->grab("select * from ".TBL_AUTH_USER." where user_id = '$userid'");
+ $row = $db->getRow("select * from ".TBL_AUTH_USER." where user_id = '$userid'");
// Get user's groups
- $q->query('select group_id from '.TBL_USER_GROUP." where user_id = {$row['user_id']}");
- while ($group_id = $q->grab_field()) {
- $user_groups[] = $group_id;
- }
+ $user_groups = $db->getCol('select group_id from '.TBL_USER_GROUP.
+ " where user_id = {$row['user_id']}");
$t->set_var(array(
'action' => $STRING['edit'],
@@ -151,7 +147,7 @@
'factive' => $row['active'] ? 'checked' : '',
'fusergroup' => build_select('group', $user_groups),
// Whether or not this user has admin rights
- 'hadadmin' => $q->grab_field('select count(*) from '.TBL_USER_GROUP.
+ 'hadadmin' => $db->getOne('select count(*) from '.TBL_USER_GROUP.
" where user_id = {$row['user_id']} and group_id = 1")
));
} else {
@@ -176,7 +172,7 @@
));
}
// The number of admins in the system
- $t->set_var('numadmins', $q->grab_field('select count(*) from '.TBL_USER_GROUP.
+ $t->set_var('numadmins', $db->getOne('select count(*) from '.TBL_USER_GROUP.
' where group_id = 1'));
// Show the login field only if login is not tied to email address
@@ -188,7 +184,7 @@
}
function list_items($userid = 0, $error = '') {
- global $me, $q, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE;
$t->set_file('content', 'userlist.html');
$t->set_block('content', 'row', 'rows');
@@ -211,7 +207,7 @@
case 2 : $filter_query = ' where active = 0'; break;
default : $filter_query = '';
}
- $nr = $q->grab_field("select count(*) from ".TBL_AUTH_USER.$filter_query);
+ $nr = $db->getOne("select count(*) from ".TBL_AUTH_USER.$filter_query);
list($selrange, $llimit, $npages, $pages) = multipages($nr, $page,
"order=$order&sort=$sort&filter=$user_filter");
@@ -222,9 +218,9 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $q->limit_query("select user_id, first_name, last_name,
+ $rs = $db->limitQuery("select user_id, first_name, last_name,
email, login, created_date, active from ".TBL_AUTH_USER
- ."$filter_query order by $order $sort", $selrange, $llimit);
+ ."$filter_query order by $order $sort", $llimit, $selrange);
$headers = array(
'userid' => 'user_id',
@@ -237,11 +233,11 @@
sorting_headers($me, $headers, $order, $sort, "page=$page&filter=$user_filter");
- if (!$q->num_rows()) {
+ if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['nousers']}</td></tr>");
} 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',
|