|
From: Benjamin C. <bc...@us...> - 2001-10-30 14:23:15
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv6635
Modified Files:
bug.php query.php
Log Message:
Getting more PG friendly
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- bug.php 2001/10/26 12:02:37 1.51
+++ bug.php 2001/10/30 14:23:12 1.52
@@ -52,9 +52,8 @@
return;
}
- $q->query('select bh.*, login from '.TBL_BUG_HISTORY.' bh left join '
- .TBL_AUTH_USER.' on bh.created_by = user_id'
- ." where bug_id = $bugid");
+ $q->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()) {
show_text($STRING['nobughistory']);
return;
@@ -303,9 +302,9 @@
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)");
+ ." 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)");
+ ." values (".$q->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'");
$statusfield = 'Resolved';
@@ -336,7 +335,7 @@
if ($comments) {
$comments = strip_tags($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)");
+ ." values (".$q->nextid(TBL_COMMENT).", $bugid, '$comments', $u, $now)");
}
$q->query("update ".TBL_BUG." set title = '$title', url = '$url', severity_id = $severity_id, priority = $priority, ".($status_id ? "status_id = $status_id, " : ''). ($changeresolution ? "resolution_id = $resolution_id, " : ''). ($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");
@@ -432,11 +431,14 @@
global $q, $me, $t, $project, $STRING, $u, $perm;
if (!ereg('^[0-9]+$',$bugid) or
- !$row = $q->grab('select b.*, reporter.login as reporter, owner.login as owner, status_name, resolution_name'
- .' from '.TBL_BUG.' b left join '.TBL_RESOLUTION.' r using(resolution_id),'
- .TBL_SEVERITY.' sv, '.TBL_STATUS.' st 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'
- ." where bug_id = '$bugid' and b.severity_id = sv.severity_id and b.status_id = st.status_id")) {
+ !$row = $q->grab('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
+ left join '.TBL_RESOLUTION.' r on b.resolution_id = r.resolution_id,'.
+ TBL_SEVERITY.' sv, '.TBL_STATUS." st
+ where bug_id = '$bugid' and b.severity_id = sv.severity_id
+ and b.status_id = st.status_id")) {
show_text($STRING['bugbadnum'],true);
return;
}
@@ -563,9 +565,11 @@
global $me, $q, $t, $project, $STRING;
// Show only active projects with at least one component
- $q->query('select p.* from '.TBL_PROJECT.' p, '.TBL_COMPONENT
- .' c where p.active and p.project_id = c.project_id group by p.project_id
- order by project_name');
+ $q->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 group by
+ p.project_id, p.project_name, p.project_desc, p.created_date
+ order by project_name');
switch ($q->num_rows()) {
case 0 :
$t->set_var('rows',$STRING['noprojects']);
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- query.php 2001/10/30 05:19:54 1.35
+++ query.php 2001/10/30 14:23:12 1.36
@@ -48,7 +48,7 @@
// Version array
$js .= "versions['$pname'] = new Array(new Array('','All'),";
$nq->query("select version_name, version_id from ".TBL_VERSION.
- " where project_id = $pid and active");
+ " where project_id = $pid and active = 1");
while (list($version,$vid) = $nq->grab()) {
$js .= "new Array($vid,'$version'),";
}
@@ -58,7 +58,7 @@
// Component array
$js .= "components['$pname'] = new Array(new Array('','All'),";
$nq->query("select component_name, component_id from ".TBL_COMPONENT.
- " where project_id = $pid and active");
+ " where project_id = $pid and active = 1");
while (list($comp,$cid) = $nq->grab()) {
$js .= "new Array($cid,'$comp'),";
}
@@ -109,19 +109,19 @@
$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;
- $query[] = 'bug.status_id in ('.delimit_list(',',$status).')';
+ $query[] = 'b.status_id in ('.delimit_list(',',$status).')';
if ($assignedto) {
$query[] = "assigned_to = {$auth->auth['uid']}";
} else {
- $query[] = "bug.created_by = {$auth->auth['uid']}";
+ $query[] = "b.created_by = {$auth->auth['uid']}";
}
} else {
// Select boxes
- if ($status) $flags[] = 'bug.status_id in ('.delimit_list(',',$status).')';
- if ($resolution) $flags[] = 'bug.resolution_id in ('.delimit_list(',',$resolution).')';
- if ($os) $flags[] = 'bug.os_id in ('.delimit_list(',',$os).')';
- if ($priority) $flags[] = 'bug.priority in ('.delimit_list(',',$priority).')';
- if ($severity) $flags[] = 'bug.severity_id in ('.delimit_list(',',$severity).')';
+ if ($status) $flags[] = 'b.status_id in ('.delimit_list(',',$status).')';
+ if ($resolution) $flags[] = 'b.resolution_id in ('.delimit_list(',',$resolution).')';
+ if ($os) $flags[] = 'b.os_id in ('.delimit_list(',',$os).')';
+ if ($priority) $flags[] = 'b.priority in ('.delimit_list(',',$priority).')';
+ if ($severity) $flags[] = 'b.severity_id in ('.delimit_list(',',$severity).')';
if ($flags) $query[] = '('.delimit_list(' or ',$flags).')';
// Email field(s)
@@ -175,8 +175,8 @@
if ($savedqueryname) {
$savedquerystring = ereg_replace('&savedqueryname=.*(&?)', '\\1', $GLOBALS['QUERY_STRING']);
$q->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')");
+ " (saved_query_id, user_id, saved_query_name, saved_query_string)
+ values (".$q->nextid(TBL_SAVED_QUERY).", $u, '$savedqueryname', '$savedquerystring')");
}
if (!$order) {
$order = 'bug_id';
@@ -185,10 +185,10 @@
if (!$querystring or $op) {
build_query($assignedto, $reportedby, $open);
}
- $nr = $q->grab_field("select count(*) from ".TBL_BUG." bug"
- ." left join ".TBL_AUTH_USER." owner on bug.assigned_to = owner.user_id"
- ." left join ".TBL_AUTH_USER." reporter on bug.created_by = reporter.user_id "
- .($querystring != '' ? "where $querystring": ''));
+ $nr = $q->grab_field('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 '.
+ ($querystring != '' ? "where $querystring": ''));
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
"order=$order&sort=$sort");
@@ -201,20 +201,20 @@
'project' => build_select('project'),
'TITLE' => $TITLE['buglist']));
- $q->limit_query("select bug.*, reporter.login as reporter, owner.login as owner,
- lastmodifier.login as lastmodifier, project_name, severity_name,
- status_name, os_name, version_name, component_name, resolution_name, severity_color"
- ." from ".TBL_BUG." bug left join ".TBL_RESOLUTION." resolution using (resolution_id),"
- . TBL_SEVERITY." severity, ".TBL_STATUS." status, ".TBL_OS." os, ".TBL_VERSION." version, "
- . TBL_COMPONENT." component, ".TBL_PROJECT." project"
- ." left join ".TBL_AUTH_USER." owner on bug.assigned_to = owner.user_id"
- ." left join ".TBL_AUTH_USER." reporter on bug.created_by = reporter.user_id"
- ." left join ".TBL_AUTH_USER." lastmodifier on bug.last_modified_by = lastmodifier.user_id"
- ." where bug.severity_id = severity.severity_id and bug.status_id = status.status_id"
- ." and bug.os_id = os.os_id and bug.version_id = version.version_id"
- ." and bug.component_id = component.component_id and bug.project_id = project.project_id "
- . ($querystring != '' ? "and $querystring " : '')
- ." order by $order $sort", $selrange, $llimit);
+ $q->limit_query('select b.*, reporter.login as reporter, owner.login as owner,
+ lastmodifier.login as lastmodifier, project_name, severity_name, 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
+ left join '.TBL_AUTH_USER.' reporter on b.created_by = reporter.user_id
+ left join '.TBL_AUTH_USER.' lastmodifier on b.last_modified_by = lastmodifier.user_id
+ left join '.TBL_RESOLUTION.' resolution on b.resolution_id = resolution.resolution_id, '.
+ TBL_SEVERITY.' severity, '.TBL_STATUS.' status, '.TBL_OS.' os, '.
+ TBL_VERSION.' version, '.TBL_COMPONENT.' component, '.TBL_PROJECT.' project
+ where b.severity_id = severity.severity_id and b.status_id = status.status_id
+ 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 '.
+ ($querystring != '' ? "and $querystring " : '').
+ "order by $order $sort", $selrange, $llimit);
$headers = array(
'bug_id' => 'bug_id',
|