You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(34) |
Aug
(215) |
Sep
(180) |
Oct
(135) |
Nov
(105) |
Dec
(81) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(76) |
Feb
(22) |
Mar
(154) |
Apr
(149) |
May
(128) |
Jun
(94) |
Jul
(14) |
Aug
(24) |
Sep
(77) |
Oct
(52) |
Nov
(22) |
Dec
(6) |
| 2003 |
Jan
(4) |
Feb
(10) |
Mar
(6) |
Apr
(29) |
May
(10) |
Jun
(37) |
Jul
(39) |
Aug
(13) |
Sep
(23) |
Oct
(3) |
Nov
(7) |
Dec
(2) |
| 2004 |
Jan
|
Feb
(10) |
Mar
(4) |
Apr
|
May
(35) |
Jun
(4) |
Jul
(17) |
Aug
(6) |
Sep
(14) |
Oct
(18) |
Nov
(2) |
Dec
(14) |
| 2005 |
Jan
(9) |
Feb
(30) |
Mar
(6) |
Apr
|
May
(38) |
Jun
(23) |
Jul
(21) |
Aug
(76) |
Sep
(50) |
Oct
(51) |
Nov
(13) |
Dec
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:54:13
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory usw-pr-cvs1:/tmp/cvs-serv23687/templates/default
Modified Files:
newaccount.html
Log Message:
Cleanup
Index: newaccount.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/newaccount.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- newaccount.html 3 Apr 2002 00:57:51 -0000 1.3
+++ newaccount.html 3 Apr 2002 18:54:08 -0000 1.4
@@ -1,6 +1,6 @@
{include file="header.html" page_title="Create a New Account"}
<h2>Create a new account</h2>
-<form action="{me}" method="post">
+<form action="{$SCRIPT_NAME}" method="post">
<input type="hidden" name="createaccount" value="1">
<table border="0">
{if $error}
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:52:36
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory usw-pr-cvs1:/tmp/cvs-serv23259/templates/default
Modified Files:
header.html
Log Message:
Added link for creating a new account
Index: header.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/header.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- header.html 3 Apr 2002 18:18:03 -0000 1.2
+++ header.html 3 Apr 2002 18:52:31 -0000 1.3
@@ -33,6 +33,11 @@
<div class="navbox" onMouseOver="this.className='navboxselected'" onMouseOut="this.className='navbox'" onClick="document.location.href='report.php'">
<a href="report.php" class="sidenavlink">View Reports</a>
</div>
+ {if not NEW_ACCOUNTS_DISABLED}
+ <div class="navbox" onMouseOver="this.className='navboxselected'" onMouseOut="this.className='navbox'" onClick="document.location.href='newaccount.php'">
+ <a href="newaccount.php" class="sidenavlink">Create a new account</a>
+ </div>
+ {/if}
<div class="navbox" onMouseOver="this.className='navboxselected'" onMouseOut="this.className='navbox'" onClick="document.location.href='docs/html/userguide.html'">
<a href="docs/html/userguide.html" class="sidenavlink">Read Documentation</a>
</div>
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:45:57
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv21251
Modified Files:
include.php
Log Message:
Cleanup
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- include.php 3 Apr 2002 01:00:52 -0000 1.106
+++ include.php 3 Apr 2002 18:45:50 -0000 1.107
@@ -113,7 +113,11 @@
$t->register_function('build_select', 'build_select');
$t->register_function('project_js', 'build_project_js');
$t->register_modifier('date', 'bt_date');
-$t->assign('STRING', $STRING);
+$t->assign(array(
+ 'STRING' => $STRING,
+ 'TITLE' => $TITLE,
+ 'STYLE' => STYLE
+ ));
if (defined('TEMPLATE_PATH')) {
$t->assign('template_path', '../templates/'.THEME.'/'.TEMPLATE_PATH);
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:45:32
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory usw-pr-cvs1:/tmp/cvs-serv21138/templates/default
Modified Files:
bugform.html
Log Message:
Smarty conversion
Index: bugform.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugform.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- bugform.html 30 Jan 2002 17:06:19 -0000 1.3
+++ bugform.html 3 Apr 2002 18:45:27 -0000 1.4
@@ -1,81 +1,85 @@
+{include file="header.html" page_title="$TITLE[enterbug]"}
<form action="bug.php" method="post">
-<input type="hidden" name="bugid" value="{bugid}">
-<input type="hidden" name="project" value="{project}">
+<input type="hidden" name="bugid" value="0">
+<input type="hidden" name="project" value="{$project}">
<input type="hidden" name="op" value="do">
<table border="0">
-<tr>
- <td colspan="2"><font color="#ff0000">{error}</font></td>
-</tr>
-<tr>
- <td align="right" valign="top">Project:</td>
- <td>{projectname}</td>
-</tr>
-<tr>
- <td align="right" valign="top">Version:</td>
- <td>
- <select name="version">
- {version}
- </select>
- </td>
-</tr>
-
-<tr>
- <td align="right" valign="top">Summary:</td>
- <td><input type="text" size="50" maxlength="100" name="title" value="{title}"></td>
-</tr>
-<tr>
- <td align="right" valign="top">Description:</td>
- <td><textarea name="description" cols="50" rows="8" wrap=virtual>{description}</textarea></td>
-</tr>
-<tr>
- <td align="right" valign="top">{urllabel}:</td>
- <td><input type="text" size="30" maxlength="255" name="url" value="{url}"></td>
-</tr>
-
-<tr>
- <td align="right" valign="top">Severity:</td>
- <td>
- <select name="severity">
- {severity}
- </select>
- </td>
-</tr>
-
-<tr>
- <td align="right" valign="top">Priority:</td>
- <td>
- <select name="priority">
- {priority}
- </select>
- </td>
-</tr>
-
-<tr>
- <td align="right" valign="top">Component:</td>
- <td>
- <select name="component">
- {component}
- </select>
- </td>
-</tr>
-
-<tr>
- <td align="right" valign="top">OS:</td>
- <td>
- <select name="os">
- {os}
- </select>
- </td>
-</tr>
-<tr>
- <td align="right" valign="top">
- Add another:
- </td>
- <td valign="top">
- <input type="checkbox" name="another" value="1">
- </td>
-</tr>
+ {if $error}
+ <tr>
+ <td colspan="2" class="error">{$error}</td>
+ </tr>
+ {/if}
+ <tr>
+ <td align="right" valign="top">Project:</td>
+ <td>{$projectname|stripslashes}</td>
+ </tr>
+ <tr>
+ <td align="right" valign="top">Version:</td>
+ <td>
+ <select name="version">
+ {build_select box=version selected=$version project=$project}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Summary:</td>
+ <td><input type="text" size="50" maxlength="100" name="title" value="{$title|stripslashes|htmlentities}"></td>
+ </tr>
+ <tr>
+ <td align="right" valign="top">Description:</td>
+ <td><textarea name="description" cols="50" rows="8" wrap=virtual>{$description|stripslashes|htmlentities}</textarea></td>
+ </tr>
+ <tr>
+ <td align="right" valign="top">URL:</td>
+ <td><input type="text" size="30" maxlength="255" name="url" value="{$url}"></td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Severity:</td>
+ <td>
+ <select name="severity">
+ {build_select box=severity selected=$severity}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Priority:</td>
+ <td>
+ <select name="priority">
+ {build_select box=priority selected=$priority}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Component:</td>
+ <td>
+ <select name="component">
+ {build_select box=component selected=$component project=$project}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">OS:</td>
+ <td>
+ <select name="os">
+ {build_select box=os selected=$os}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td align="right" valign="top">
+ Add another:
+ </td>
+ <td valign="top">
+ <input type="checkbox" name="another" value="1">
+ </td>
+ </tr>
</table>
<input type="submit" name="submit" value="Submit">
</form>
+{include file="footer.html"}
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:45:32
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv21138
Modified Files:
bug.php
Log Message:
Smarty conversion
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- bug.php 3 Apr 2002 01:00:52 -0000 1.92
+++ bug.php 3 Apr 2002 18:45:27 -0000 1.93
@@ -522,66 +522,18 @@
function show_form($bugid = 0, $error = '') {
global $db, $me, $t, $_gv, $_pv, $TITLE;
- if (isset($_gv['project'])) {
- $project = $_gv['project'];
- }
-
- if (isset($_pv)) {
- foreach ($_pv as $k => $v) $$k = $v;
- }
-
- $t->set_file('content','bugform.html');
- $projectname = $db->getOne("select project_name from ".TBL_PROJECT." where project_id = $project");
+ $projectname = $db->getOne("select project_name from ".TBL_PROJECT." where project_id = {$_gv['project']}");
if ($bugid && !$error) {
- $row = $db->getRow("select * from ".TBL_BUG." where bug_id = '$bugid'");
- $t->set_var(array(
- 'bugid' => $bugid,
- 'TITLE' => $TITLE['editbug'],
- 'title' => htmlentities(stripslashes($row['title'])),
- 'description' => htmlentities(stripslashes($row['description'])),
- 'url' => $row['url'],
- 'urllabel' => $row['url'] ? "<a href='{$row['url']}'>URL</a>" : 'URL',
- 'severity' => build_select('severity',$row['severity_id']),
- 'priority' => build_select('priority',$row['priority']),
- 'status' => build_select('status',$row['status_id']),
- 'resolution' => build_select('resolution',$row['resolution_id']),
- 'assignedto' => $row['assigned_to'],
- 'createdby' => $row['created_by'],
- 'createddate' => date(DATE_FORMAT,$row['created_date']),
- 'lastmodifieddate' => $row['last_modified_date'],
- 'project' => $row['project_id'],
- 'projectname' => $projectname,
- 'version' => build_select('version',$row['version_id'],$row['project_id']),
- 'component' => build_select('component',$row['component_id'],$row['project_id']),
- 'os' => build_select('os',$row['os_id']),
- 'browserstring' => $row['browser_string']));
+ $t->assign($db->getRow("select * from ".TBL_BUG." where bug_id = '$bugid'"));
} else {
- $t->set_var(array(
- 'TITLE' => $TITLE['enterbug'],
- 'error' => $error,
- 'bugid' => $bugid,
- 'title' => isset($title) ? htmlentities(stripslashes($title)) : '',
- 'description' => isset($description) ?
- htmlentities(stripslashes($description)) : '',
- 'url' => isset($url) ? $url : 'http://',
- 'urllabel' => isset($url) ? "<a href='$url'>URL</a>" : 'URL',
- 'severity' => build_select('severity',(isset($severity) ? $severity : 0)),
- 'priority' => build_select('priority',(isset($priority) ? $priority : 0)),
- 'status' => build_select('status',(isset($status) ? $status : 0)),
- 'resolution' => build_select('resolution',
- (isset($resolution) ? $resolution : 0)),
- 'assignedto' => isset($assignedto) ? $assignedto : '',
- 'createdby' => isset($createdby),
- 'createddate' => isset($createddate),
- 'lastmodifieddate' => isset($lastmodifieddate),
- 'project' => $project,
- 'projectname' => $projectname,
- 'version' => build_select('version',
- (isset($version) ? $version : 0),$project),
- 'component' => build_select('component',
- (isset($component) ? $component : 0),$project),
- 'os' => build_select('os',(isset($os) ? $os : 0))));
+ $t->assign($_pv);
+ $t->assign(array(
+ 'error' => $error,
+ 'project' => $_gv['project'],
+ 'projectname' => $projectname
+ ));
}
+ $t->display('bugform.html');
}
function show_bug_printable($bugid) {
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 18:16:13
|
Update of /cvsroot/phpbt/phpbt/styles In directory usw-pr-cvs1:/tmp/cvs-serv13182/styles Log Message: Directory /cvsroot/phpbt/phpbt/styles added to the repository |
|
From: Ben C. <php...@be...> - 2002-04-03 01:05:12
|
I just committed some significant changes -- switching the templates over to smarty. If you have customized templates in the default directory that you want to keep, make sure to make a backup copy before updating your checkout. A _lot_ changed with this conversion, so please bang away on the code. This is the last major thing I'm going to do before the next release, which I'm planning on doing next week. Bugs found before the release (as opposed to after) would be much preferred! :) |
|
From: Benjamin C. <bc...@us...> - 2002-04-03 01:01:40
|
Update of /cvsroot/phpbt/phpbt In directory usw-pr-cvs1:/tmp/cvs-serv15950 Modified Files: config-dist.php Log Message: Updating copyright notices Index: config-dist.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/config-dist.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- config-dist.php 29 Mar 2002 18:25:37 -0000 1.11 +++ config-dist.php 3 Apr 2002 01:01:38 -0000 1.12 @@ -1,7 +1,7 @@ <?php // config.php - Set up configuration options // ------------------------------------------------------------------------ -// Copyright (c) 2001 The phpBugTracker Group +// Copyright (c) 2001, 2002 The phpBugTracker Group // ------------------------------------------------------------------------ // This file is part of phpBugTracker // |
|
From: Benjamin C. <bc...@us...> - 2002-04-03 01:01:06
|
Update of /cvsroot/phpbt/phpbt/inc
In directory usw-pr-cvs1:/tmp/cvs-serv15790
Modified Files:
auth.php functions.php
Log Message:
Switching to smarty templates. Updating copyright notices
Index: auth.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/auth.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- auth.php 27 Mar 2002 20:48:32 -0000 1.13
+++ auth.php 3 Apr 2002 01:01:04 -0000 1.14
@@ -2,7 +2,7 @@
// auth.php - Authentication and permission objects
// ------------------------------------------------------------------------
-// Copyright (c) 2001 The phpBugTracker Group
+// Copyright (c) 2001, 2002 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -30,16 +30,6 @@
function uauth() {
global $HTTP_SESSION_VARS;
- #if (!session_is_registered('auth')) {
- # session_register('auth');
- # $HTTP_SESSION_VARS['auth'] = array();
- #}
-
- #$a =& $HTTP_SESSION_VARS['auth'];
- #$this->auth =& $a->auth;
- #$this->auth =& $HTTP_SESSION_VARS['auth'];
-
-
if (!isset($HTTP_SESSION_VARS['group_ids'])) {
$HTTP_SESSION_VARS['group_ids'] = array(0);
}
@@ -163,17 +153,15 @@
function perm_invalid($actual_perms, $required_perms) {
global $t;
- $t->set_file('content','badperm.html');
- $t->pparse('main',array('content','wrap','main'));
+ $t->display('badperm.html');
}
function check_group($group) {
global $t;
if (!$this->check_auth('group', $group)) {
- $t->set_file('content', 'badgroup.html');
- $t->set_var('group', $group);
- $t->pparse('main',array('content','wrap','main'));
+ $t->assign('group', $group);
+ $t->display('badgroup.html');
exit();
}
}
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- functions.php 1 Apr 2002 15:42:41 -0000 1.15
+++ functions.php 3 Apr 2002 01:01:04 -0000 1.16
@@ -2,7 +2,7 @@
// functions.php - Set up global functions
// ------------------------------------------------------------------------
-// Copyright (c) 2001 The phpBugTracker Group
+// Copyright (c) 2001, 2002 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -27,9 +27,11 @@
function show_text($text, $iserror = false) {
global $t;
- $t->set_file('content','error.html');
- if (!$iserror) $t->set_var('text',$text);
- else $t->set_var('text',"<font color=red>$text</font>");
+ $t->assign(array(
+ 'text' => $text,
+ 'iserror' => $iserror
+ ));
+ $t->display('error.html');
}
$select['priority'] = array(
@@ -42,10 +44,13 @@
///
/// Build a select box with the item matching $value selected
-function build_select($box, $value = '', $project = 0) {
+function build_select($params) {
global $db, $select, $perm, $STRING, $restricted_projects, $QUERY;
- //create hash to map tablenames
+ extract($params);
+ if (!isset($selected)) $selected = '';
+
+ //create hash to map tablenames
$cfgDatabase = array(
'group' => TBL_AUTH_GROUP,
'project' => TBL_PROJECT,
@@ -77,12 +82,12 @@
case 'user_filter' :
foreach ($STRING['user_filter'] as $k => $v) {
$text .= sprintf("<option value=\"%d\"%s>%s</option>",
- $k, ($k == $value ? ' selected' : ''), $v);
+ $k, ($k == $selected ? ' selected' : ''), $v);
}
break;
case 'group' :
if ($project) { // If we are building for project admin page
- if (!count($value) or (count($value) && in_array(0, $value))) {
+ if (!count($selected) or (count($selected) && in_array(0, $selected))) {
$sel = ' selected';
} else {
$sel = '';
@@ -91,7 +96,7 @@
}
$rs = $db->query($queries[$box]);
while ($rs->fetchInto($row)) {
- if (count($value) && in_array($row[$box.'_id'], $value)) $sel = ' selected';
+ if (count($selected) && in_array($row[$box.'_id'], $selected)) $sel = ' selected';
else $sel = '';
$text .= '<option value="'.
$row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
@@ -105,7 +110,7 @@
case 'version' :
$rs = $db->query($queries[$box]);
while ($rs->fetchInto($row)) {
- if ($value == $row[$box.'_id'] and $value != '') $sel = ' selected';
+ if ($selected == $row[$box.'_id'] and $selected != '') $sel = ' selected';
else $sel = '';
$text .= '<option value="'.
$row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
@@ -114,9 +119,9 @@
case 'os' :
$rs = $db->query("select {$box}_id, {$box}_name, regex from ".TBL_OS." where sort_order > 0 order by sort_order");
while ($rs->fetchInto($row)) {
- if ($value == '' and isset($row['Regex']) and
+ if ($selected == '' and isset($row['Regex']) and
preg_match($row['Regex'],$GLOBALS['HTTP_USER_AGENT'])) $sel = ' selected';
- elseif ($value == $row[$box.'_id']) $sel = ' selected';
+ elseif ($selected == $row[$box.'_id']) $sel = ' selected';
else $sel = '';
$text .= '<option value="'.
$row[$box.'_id']."\"$sel>".$row[$box.'_name']."</option>";
@@ -125,13 +130,13 @@
case 'owner' :
$rs = $db->query("select u.user_id, login from ".TBL_AUTH_USER." u, ".TBL_USER_GROUP." ug, ".TBL_AUTH_GROUP." g where u.active > 0 and u.user_id = ug.user_id and ug.group_id = g.group_id and group_name = 'Developer' order by login");
while ($rs->fetchInto($row)) {
- if ($value == $row['user_id']) $sel = ' selected';
+ if ($selected == $row['user_id']) $sel = ' selected';
else $sel = '';
$text .= "<option value=\"{$row['user_id']}\"$sel>{$row['login']}</option>";
}
break;
case 'bug_cc' :
- $rs = $db->query(sprintf($QUERY['functions-bug-cc'], $value));
+ $rs = $db->query(sprintf($QUERY['functions-bug-cc'], $selected));
while (list($uid, $user) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$text .= "<option value=\"$uid\">".maskemail($user).'</option>';
}
@@ -153,7 +158,7 @@
closedir($dir);
sort($filelist);
foreach ($filelist as $file) {
- if ($file == $value) {
+ if ($file == $selected) {
$sel = ' selected';
} else {
$sel = '';
@@ -171,7 +176,7 @@
closedir($dir);
sort($filelist);
foreach ($filelist as $file) {
- if ($file == $value) {
+ if ($file == $selected) {
$sel = ' selected';
} else {
$sel = '';
@@ -182,19 +187,19 @@
default :
$deadarray = $select[$box];
while(list($val,$item) = each($deadarray)) {
- if ($value == $val and $value != '') $sel = ' selected';
+ if ($selected == $val and $selected != '') $sel = ' selected';
else $sel = '';
$text .= "<option value=\"$val\"$sel>$item</option>";
}
break;
}
- return $text;
+ echo $text;
}
///
/// Divide the results of a database query into multiple pages
function multipages($nr, $page, $urlstr) {
- global $me, $selrange;
+ global $me, $selrange, $t;
$pages = '';
if (!$page) $page = 1;
@@ -215,7 +220,14 @@
$pages .= $i != $npages ? '|' : '';
}
}
- return array($selrange, $llimit, $npages, $pages);
+ $t->assign(array(
+ 'pages' => $pages,
+ 'first' => $llimit+1,
+ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
+ 'total' => $nr
+ ));
+
+ return array($selrange, $llimit);
}
///
@@ -224,12 +236,13 @@
global $t;
while(list($k, $v) = each($headers)) {
- $t->set_var($k.'url', "$url?order=$v&sort=".
+ $theader[$k]['url'] = "$url?order=$v&sort=".
($order == $v ? ($sort == 'asc' ? 'desc' : 'asc') : 'asc').
- ($urlstr ? '&'.$urlstr : ''));
- $t->set_var($k.'color', $order == $v ? '#bbbbbb' : '#eeeeee');
- $t->set_var($k.'class', $order == $v ? 'head-selected' : 'head');
+ ($urlstr ? '&'.$urlstr : '');
+ $theader[$k]['color'] = $order == $v ? '#bbbbbb' : '#eeeeee';
+ $theader[$k]['class'] = $order == $v ? 'selected' : '';
}
+ $t->assign('headers', $theader);
}
///
@@ -349,7 +362,7 @@
if (substr($js,-1) == ',') $js = substr($js,0,-1);
$js .= ");\n";
}
- return $js;
+ echo $js;
}
///
@@ -382,6 +395,11 @@
// Handle a database error
function handle_db_error(&$obj) {
die($obj->message.'<br>'.$obj->userinfo);
+}
+
+// Date() wrapper for smarty
+function bt_date($string, $format) {
+ return date($format, $string);
}
?>
|
|
From: Benjamin C. <bc...@us...> - 2002-04-03 01:01:06
|
Update of /cvsroot/phpbt/phpbt/inc/db In directory usw-pr-cvs1:/tmp/cvs-serv15790/db Modified Files: mysql.php oci8.php pgsql.php Log Message: Switching to smarty templates. Updating copyright notices Index: mysql.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/db/mysql.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mysql.php 29 Mar 2002 18:25:38 -0000 1.2 +++ mysql.php 3 Apr 2002 01:01:04 -0000 1.3 @@ -116,10 +116,7 @@ '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 ', - 'query-list-bugs' => '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 '. + 'query-list-bugs' => 'select %s '. '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 '. Index: oci8.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/db/oci8.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- oci8.php 29 Mar 2002 18:25:38 -0000 1.1 +++ oci8.php 3 Apr 2002 01:01:04 -0000 1.2 @@ -118,11 +118,7 @@ 'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter '. 'where b.assigned_to = owner.user_id(+) '. 'and b.created_by = reporter.user_id(+) ', - 'query-list-bugs' => 'select b.*, reporter.login as reporter, '. - 'owner.login as owner, lastmodifier.login as lastmodifier, '. - 'project.project_name, severity.severity_name, severity.severity_color, '. - 'status.status_name, os.os_name, version.version_name,'. - 'component.component_name, resolution.resolution_name '. + 'query-list-bugs' => 'select %s '. 'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' lastmodifier, '. TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter, '. TBL_SEVERITY.' severity, '.TBL_STATUS.' status, '.TBL_OS.' os, '. Index: pgsql.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/db/pgsql.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- pgsql.php 29 Mar 2002 18:25:38 -0000 1.3 +++ pgsql.php 3 Apr 2002 01:01:04 -0000 1.4 @@ -116,10 +116,7 @@ '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 ', - 'query-list-bugs' => '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 '. + 'query-list-bugs' => 'select %s '. '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 '. |
|
From: Benjamin C. <bc...@us...> - 2002-04-01 15:42:46
|
Update of /cvsroot/phpbt/phpbt/inc In directory usw-pr-cvs1:/tmp/cvs-serv16912/inc Modified Files: functions.php Log Message: Changed the name of the valid_email function to reduce conflicts and changed the validation regex to allow longer TLDs Index: functions.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- functions.php 29 Mar 2002 23:55:14 -0000 1.14 +++ functions.php 1 Apr 2002 15:42:41 -0000 1.15 @@ -292,8 +292,8 @@ /// /// Check the validity of an email address /// (From zend.com user russIndr) -function valid_email($email) { - return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $email); +function bt_valid_email($email) { + return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email); } /// |
|
From: Benjamin C. <bc...@us...> - 2002-04-01 15:42:44
|
Update of /cvsroot/phpbt/phpbt In directory usw-pr-cvs1:/tmp/cvs-serv16912 Modified Files: install.php newaccount.php Log Message: Changed the name of the valid_email function to reduce conflicts and changed the validation regex to allow longer TLDs Index: install.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/install.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- install.php 26 Mar 2002 17:30:20 -0000 1.17 +++ install.php 1 Apr 2002 15:42:40 -0000 1.18 @@ -93,8 +93,8 @@ /// /// Check the validity of an email address /// (From zend.com user russIndr) -function valid_email($email) { - return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $email); +function bt_valid_email($email) { + return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email); } function grab_config_file() { @@ -151,7 +151,7 @@ $error = 'Please enter the phpBT email address'; } elseif (!$_pv['admin_login'] = trim($_pv['admin_login'])) { $error = 'Please enter the admin login'; - } elseif (!valid_email($_pv['admin_login'])) { + } elseif (!bt_valid_email($_pv['admin_login'])) { $error = 'Please use a valid email address for the admin login'; } elseif (!$_pv['admin_pass'] = trim($_pv['admin_pass'])) { $error = 'Please enter the admin password'; Index: newaccount.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- newaccount.php 30 Mar 2002 20:06:27 -0000 1.27 +++ newaccount.php 1 Apr 2002 15:42:40 -0000 1.28 @@ -35,7 +35,7 @@ if (!EMAIL_IS_LOGIN && !$_pv['login'] = trim($_pv['login'])) $error = $STRING['givelogin']; - elseif (!$_pv['email'] or !valid_email($_pv['email'])) + elseif (!$_pv['email'] or !bt_valid_email($_pv['email'])) $error = $STRING['giveemail']; elseif ($db->getOne("select user_id from ".TBL_AUTH_USER. " where email = '{$_pv['email']}' ". |
|
From: Benjamin C. <bc...@us...> - 2002-04-01 15:42:44
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv16912/admin
Modified Files:
user.php
Log Message:
Changed the name of the valid_email function to reduce conflicts and changed the validation regex to allow longer TLDs
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- user.php 30 Mar 2002 20:37:47 -0000 1.44
+++ user.php 1 Apr 2002 15:42:41 -0000 1.45
@@ -32,7 +32,7 @@
// Validation
if (!EMAIL_IS_LOGIN && !$_pv['flogin'] = trim($_pv['flogin'])) {
$error = $STRING['givelogin'];
- } elseif (!valid_email($_pv['femail'])) {
+ } elseif (!bt_valid_email($_pv['femail'])) {
$error = $STRING['giveemail'];
} elseif (!$_pv['fpassword'] = trim($_pv['fpassword'])) {
$error = $STRING['givepassword'];
|
|
From: Benjamin C. <bc...@us...> - 2002-03-30 20:37:53
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv30065/admin
Modified Files:
user.php
Log Message:
Admin user preferences
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- user.php 30 Mar 2002 19:12:30 -0000 1.43
+++ user.php 30 Mar 2002 20:37:47 -0000 1.44
@@ -42,6 +42,7 @@
return;
}
if (!isset($_pv['factive'])) $_pv['factive'] = 0;
+ if (!isset($_pv['fe_notice'])) $_pv['fe_notice'] = 0;
if (EMAIL_IS_LOGIN) {
$login = $_pv['femail'];
@@ -70,6 +71,10 @@
values ('$new_user_id' ,'$group', $u, $now)");
}
}
+ // Add to prefs
+ $db->query("INSERT INTO ".TBL_USER_PREF." (user_id, email_notices)
+ VALUES ($new_user_id, '{$_pv['fe_notice']}')");
+
// And add to the user group
$db->query("insert into ".TBL_USER_GROUP.
" (user_id, group_id, created_by, created_date)
@@ -92,7 +97,11 @@
", last_name = ".$db->quote(stripslashes($_pv['flastname'])).
", login = ".$db->quote(stripslashes($login)).
", email = '{$_pv['femail']}', $pquery active = {$_pv['factive']} ".
- "where user_id = '$userid'");
+ "where user_id = $userid");
+
+ // Update preferences
+ $db->query("update ".TBL_USER_PREF.
+ " set email_notices = {$_pv['fe_notice']} where user_id = $userid");
// Update group memberships
// Get user's groups (without dropping the user group)
@@ -132,7 +141,8 @@
if ($userid && !$error) {
- $row = $db->getRow("select * from ".TBL_AUTH_USER." where user_id = '$userid'");
+ $row = $db->getRow('select * from '.TBL_AUTH_USER." u, ".
+ TBL_USER_PREF." p where u.user_id = $userid and u.user_id = p.user_id");
// Get user's groups
$user_groups = $db->getCol('select group_id from '.TBL_USER_GROUP.
@@ -147,10 +157,11 @@
'femail' => $row['email'],
'fpassword' => $row['password'],
'factive' => $row['active'] ? 'checked' : '',
+ 'fe_notice' => $row['email_notices'] ? 'checked' : '',
'fusergroup' => build_select('group', $user_groups),
// Whether or not this user has admin rights
'hadadmin' => $db->getOne('select count(*) from '.TBL_USER_GROUP.
- " where user_id = {$row['user_id']} and group_id = 1")
+ " where user_id = $userid and group_id = 1")
));
} else {
$t->set_var(array(
@@ -166,6 +177,8 @@
'fpassword' => isset($_pv['fpassword']) ? $_pv['fpassword'] :
genpassword(10),
'factive' => isset($_pv['factive']) ? ($_pv['factive'] ? 'checked' : '')
+ : 'checked',
+ 'fe_notice' => isset($_pv['fe_notice']) ? ($_pv['fe_notice'] ? 'checked' : '')
: 'checked',
'fusergroup' => build_select('group', (isset($_pv['fusergroup']) ?
$_pv['fusergroup'] : array())),
|
|
From: Benjamin C. <bc...@us...> - 2002-03-30 20:37:52
|
Update of /cvsroot/phpbt/phpbt/templates/default/admin
In directory usw-pr-cvs1:/tmp/cvs-serv30065/templates/default/admin
Modified Files:
userlist.html
Log Message:
Admin user preferences
Index: userlist.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/admin/userlist.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- userlist.html 6 Mar 2002 04:17:54 -0000 1.4
+++ userlist.html 30 Mar 2002 20:37:47 -0000 1.5
@@ -102,6 +102,10 @@
<td align="right" valign="top">Active:</td>
<td><input type="checkbox" name="factive" value="1" {factive}></td>
</tr>
+ <tr>
+ <td align="right" valign="top">Email Notify:</td>
+ <td><input type="checkbox" name="fe_notice" value="1" {fe_notice}></td>
+ </tr>
</table>
<div align="right">
<input type='submit' name='submit' value='Submit'>
|
|
From: Benjamin C. <bc...@us...> - 2002-03-30 20:06:31
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv21089
Modified Files:
newaccount.php
Log Message:
Insert to the preferences table
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- newaccount.php 30 Mar 2002 19:12:27 -0000 1.26
+++ newaccount.php 30 Mar 2002 20:06:27 -0000 1.27
@@ -68,6 +68,8 @@
" (user_id, group_id, created_by, created_date)
select $user_id, group_id, 0, $now from ".TBL_AUTH_GROUP.
" where group_name = 'User'");
+ $db->query("insert into ".TBL_USER_PREF." (user_id) values ($user_id)");
+
mail($_pv['email'], $STRING['newacctsubject'], sprintf($STRING['newacctmessage'],
$password), sprintf("From: %s\nContent-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n",ADMIN_EMAIL, $STRING['lang_charset']));
$t->set_file('content','newaccountsuccess.html');
|
|
From: Benjamin C. <bc...@us...> - 2002-03-30 19:28:18
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv2273
Modified Files:
attachment.php bug.php newaccount.php query.php
Log Message:
Strip slashes from magic_quotes_gpc and then use $db->quote(). Needs some testing
Index: attachment.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/attachment.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- attachment.php 17 Mar 2002 01:44:24 -0000 1.13
+++ attachment.php 30 Mar 2002 19:12:26 -0000 1.14
@@ -117,10 +117,11 @@
@chmod("$filepath/$projectid/$filename", 0766);
$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)");
+ join(', ', array($db->nextId(TBL_ATTACHMENT), $bugid,
+ $HTTP_POST_FILES['attachment']['name'],
+ $db->quote(stripslashes($description)),
+ $HTTP_POST_FILES['attachment']['size'],
+ $HTTP_POST_FILES['attachment']['type'], $u, $now)).")");
$t->set_file('content', 'bugattachmentsuccess.html');
$t->set_var('bugid', $bugid);
}
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- bug.php 29 Mar 2002 18:25:37 -0000 1.90
+++ bug.php 30 Mar 2002 19:12:27 -0000 1.91
@@ -164,10 +164,10 @@
foreach(array('title','url') as $field) {
if (isset($cf[$field])) {
$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])
- ."', $u, $now)");
+ .' (bug_id, changed_field, old_value, new_value, created_by, created_date)'
+ ." values (". join(', ', array($buginfo['bug_id'], $db->quote($field),
+ $db->quote(stripslashes($buginfo[$field])),
+ $db->quote(stripslashes($cf[$field])), $u, $now)).")");
$t->set_var(array(
$field => stripslashes($cf[$field]),
$field.'_stat' => '!'
@@ -199,8 +199,9 @@
." where ${field}_id = {$cf[$field.'_id']}");
$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)");
+ ." values (". join(', ', array($buginfo['bug_id'], $db->quote($field),
+ $db->quote(stripslashes($oldvalue)),
+ $db->quote(stripslashes($newvalue)), $u, $now)).")");
$t->set_var(array(
$field.'_id' => stripslashes($newvalue),
$field.'_id_stat' => '!'
@@ -463,7 +464,8 @@
if ($comments) {
//$comments = strip_tags($comments); -- Uncomment this if you want no <> content in the comments
$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)");
+ ." values (".$db->nextId(TBL_COMMENT).", $bugid, ".
+ $db->quote(stripslashes($comments)).", $u, $now)");
}
// Allow for removing of some items from the bug page
@@ -471,7 +473,15 @@
$os_id = $os_id ? $os_id : 0;
$severity_id = $severity_id ? $severity_id : 0;
- $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");
+ $db->query("update ".TBL_BUG." set title = ".$db->quote(stripslashes($title)).
+ ', url = '.$db->quote(stripslashes($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);
@@ -519,14 +529,26 @@
$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']}')");
+ component_id, os_id, browser_string) values ($bugid, ".
+ join(', ', array($db->quote(stripslashes($title)),
+ $db->quote(stripslashes($description)),
+ $db->quote(stripslashes($url)))).
+ ", $severity, $priority, $status, $owner, $u, $now, $u, $now, $project, ".
+ "$version, $component, $os, '{$HTTP_SERVER_VARS['HTTP_USER_AGENT']}')");
$buginfo = $db->getRow('select * from '.TBL_BUG." where bug_id = $bugid");
do_changedfields($u, $buginfo);
} else {
- $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'");
+ $db->query("update ".TBL_BUG.
+ " set title = ".$db->quote(stripslashes($title)).
+ ", description = ".$db->quote(stripslashes($description)).
+ ", url = ".$db->quote(stripslashes($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");
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- newaccount.php 28 Mar 2002 22:14:44 -0000 1.25
+++ newaccount.php 30 Mar 2002 19:12:27 -0000 1.26
@@ -49,9 +49,9 @@
$lastname = htmlspecialchars($_pv['lastname']);
$password = genpassword(10);
if (ENCRYPT_PASS) {
- $mpassword = md5($password);
+ $mpassword = $db->quote(md5($password));
} else {
- $mpassword = $password;
+ $mpassword = $db->quote(stripslashes($password));
}
if (EMAIL_IS_LOGIN) {
$login = $_pv['email'];
@@ -60,7 +60,10 @@
}
$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)");
+ ." values (".join(', ', array($user_id, $db->quote(stripslashes($login)),
+ $db->quote(stripslashes($firstname)),
+ $db->quote(stripslashes($lastname)), $_pv['email'], $mpassword, 1,
+ $now, $now)).")");
$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.
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- query.php 29 Mar 2002 18:25:37 -0000 1.65
+++ query.php 30 Mar 2002 19:12:27 -0000 1.66
@@ -174,7 +174,9 @@
$nextid = $nextid ? $nextid : 1;
$db->query("insert into ".TBL_SAVED_QUERY.
" (saved_query_id, user_id, saved_query_name, saved_query_string)
- values ($nextid, $u, '$savedqueryname', '$savedquerystring')");
+ values (".join(', ', array($nextid, $u,
+ $db->quote(stripslashes($savedqueryname)),
+ $db->quote(stripslashes($savedquerystring)))).")");
}
if (!isset($order)) {
if (isset($HTTP_SESSION_VARS['queryinfo']['order'])) {
|
|
From: Benjamin C. <bc...@us...> - 2002-03-30 19:28:17
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv2273/admin
Modified Files:
group.php os.php project.php resolution.php severity.php
status.php user.php
Log Message:
Strip slashes from magic_quotes_gpc and then use $db->quote(). Needs some testing
Index: group.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/group.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- group.php 29 Mar 2002 18:25:37 -0000 1.6
+++ group.php 30 Mar 2002 19:12:28 -0000 1.7
@@ -51,11 +51,12 @@
if (!$groupid) {
$db->query("insert into ".TBL_AUTH_GROUP.
" (group_id, group_name, created_by, created_date, last_modified_by, last_modified_date)"
- ." values (".$db->nextId(TBL_AUTH_GROUP).", '$fname', $u, $now, $u, $now)");
+ ." values (".$db->nextId(TBL_AUTH_GROUP).", ".
+ $db->quote(stripslashes($fname)).", $u, $now, $u, $now)");
} else {
$db->query("update ".TBL_AUTH_GROUP.
- " set group_name = '$fname', last_modified_by = $u,
- last_modified_date = $now where group_id = '$groupid'");
+ " set group_name = ".$db->quote(stripslashes($fname)).
+ ", last_modified_by = $u, last_modified_date = $now where group_id = '$groupid'");
}
header("Location: $me?");
}
Index: os.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/os.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- os.php 29 Mar 2002 18:25:38 -0000 1.23
+++ os.php 30 Mar 2002 19:12:28 -0000 1.24
@@ -53,9 +53,12 @@
if ($error) { list_items($osid, $error); return; }
if (!$osid) {
- $db->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) values (".$db->nextId(TBL_OS).", '$fname', '$fregex', '$fsortorder')");
+ $db->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) ".
+ "values (".$db->nextId(TBL_OS).", ".$db->quote(stripslashes($fname)).
+ ", '$fregex', '$fsortorder')");
} else {
- $db->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 = ".$db->quote(stripslashes($fname)).
+ ", regex = '$fregex', sort_order = '$fsortorder' where os_id = '$osid'");
}
header("Location: $me?");
}
Index: project.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- project.php 29 Mar 2002 18:25:38 -0000 1.35
+++ project.php 30 Mar 2002 19:12:29 -0000 1.36
@@ -39,11 +39,13 @@
if (!$versionid) {
$db->query('insert into '.TBL_VERSION
." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$db->nextId(TBL_VERSION).", $projectid, '$vf_version', $vf_active, $u, $now)");
+ values (".$db->nextId(TBL_VERSION).", $projectid, ".
+ $db->quote(stripslashes($vf_version)).", $vf_active, $u, $now)");
} else {
$db->query('update '.TBL_VERSION
- ." set project_id = $projectid, version_name = '$vf_version',
- active = $vf_active where version_id = '$versionid'");
+ ." set project_id = $projectid, version_name = ".
+ $db->quote(stripslashes($vf_version)).
+ ", active = $vf_active where version_id = '$versionid'");
}
header("Location: project.php?op=edit&id=$projectid");
}
@@ -112,13 +114,16 @@
$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 (".$db->nextId(TBL_COMPONENT).", $projectid, '$cf_name',
- '$cf_description', $cf_owner, $cf_active, $u, $now, $u, $now)");
+ values (".$db->nextId(TBL_COMPONENT).", $projectid, ".
+ $db->quote(stripslashes($cf_name)).", ".
+ $db->quote(stripslashes($cf_description)).
+ ", $cf_owner, $cf_active, $u, $now, $u, $now)");
} else {
$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'");
+ ." set component_name = ".$db->quote(stripslashes($cf_name)).
+ ', component_desc = '.$db->quote(stripslashes($cf_description)).
+ ", owner = $cf_owner, active = $cf_active, last_modified_by = $u, ".
+ "last_modified_date = $now where component_id = $componentid");
}
header("Location: project.php?op=edit&id=$projectid");
}
@@ -209,19 +214,24 @@
$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)");
+ values ($projectid , ".$db->quote(stripslashes($name)).", ".
+ $db->quote(stripslashes($description)).", $active, $u, $now)");
$db->query('insert into '.TBL_VERSION
." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$db->nextId(TBL_VERSION).", $projectid, '$vf_version', 1, $u, $now)");
+ values (".$db->nextId(TBL_VERSION).", $projectid, ".
+ $db->quote(stripslashes($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 (".$db->nextId(TBL_COMPONENT).", $projectid, '$cf_name',
- '$cf_description', $cf_owner, 1, $u, $now, $u, $now)");
+ values (".$db->nextId(TBL_COMPONENT).", $projectid, ".
+ $db->quote(stripslashes($cf_name)).", ".
+ $db->quote(stripslashes($cf_description)).
+ ", $cf_owner, 1, $u, $now, $u, $now)");
} else {
$db->query('update '.TBL_PROJECT
- ." set project_name = '$name', project_desc = '$description',
- active = $active where project_id = $projectid");
+ ." set project_name = ".$db->quote(stripslashes($name)).
+ ", project_desc = ".$db->quote(stripslashes($description)).
+ ", active = $active where project_id = $projectid");
}
// Handle project -> group relationship
Index: resolution.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/resolution.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- resolution.php 29 Mar 2002 18:25:38 -0000 1.24
+++ resolution.php 30 Mar 2002 19:12:30 -0000 1.25
@@ -57,11 +57,14 @@
if (!$resolutionid) {
$db->query("insert into ".TBL_RESOLUTION.
" (resolution_id, resolution_name, resolution_desc, sort_order)"
- ." values (".$db->nextId(TBL_RESOLUTION).", '$fname', '$fdescription', '$fsortorder')");
+ ." values (".$db->nextId(TBL_RESOLUTION).", ".
+ $db->quote(stripslashes($fname)).', '.
+ $db->quote(stripslashes($fdescription)).', '.$fsortorder.')');
} else {
$db->query("update ".TBL_RESOLUTION.
- " set resolution_name = '$fname', resolution_desc = '$fdescription',
- sort_order = '$fsortorder' where resolution_id = '$resolutionid'");
+ ' set resolution_name = '.$db->quote(stripslashes($fname)).
+ ', resolution_desc = '.$db->quote(stripslashes($fdescription)).
+ ", sort_order = $fsortorder where resolution_id = $resolutionid");
}
header("Location: $me?");
}
Index: severity.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/severity.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- severity.php 29 Mar 2002 18:25:38 -0000 1.20
+++ severity.php 30 Mar 2002 19:12:30 -0000 1.21
@@ -57,11 +57,16 @@
if (!$severityid) {
$db->query("insert into ".TBL_SEVERITY.
" (severity_id, severity_name, severity_desc, sort_order, severity_color)
- values (".$db->nextId(TBL_SEVERITY).", '$fname', '$fdescription', '$fsortorder', '$fcolor')");
+ values (".$db->nextId(TBL_SEVERITY).', '.
+ $db->quote(stripslashes($fname)).', '.
+ $db->quote(stripslashes($fdescription)).", $fsortorder, ".
+ $db->quote(stripslashes($fcolor)).')');
} else {
- $db->query("update ".TBL_SEVERITY." set severity_name = '$fname',
- severity_desc = '$fdescription', sort_order = '$fsortorder',
- severity_color = '$fcolor' where severity_id = '$severityid'");
+ $db->query("update ".TBL_SEVERITY.
+ " set severity_name = ".$db->quote(stripslashes($fname)).
+ ', severity_desc = '.$db->quote(stripslashes($fdescription)).
+ ", sort_order = $fsortorder, severity_color = ".
+ $db->quote(stripslashes($fcolor))." where severity_id = $severityid");
}
header("Location: $me?");
}
Index: status.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/status.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- status.php 29 Mar 2002 18:25:38 -0000 1.24
+++ status.php 30 Mar 2002 19:12:30 -0000 1.25
@@ -57,11 +57,14 @@
if (!$statusid) {
$db->query("insert into ".TBL_STATUS.
" (status_id, status_name, status_desc, sort_order) values (".
- $db->nextId(TBL_STATUS).", '$fname', '$fdescription', '$fsortorder')");
+ $db->nextId(TBL_STATUS).', '.
+ $db->quote(stripslashes($fname)).', '.
+ $db->quote(stripslashes($fdescription)).", '$fsortorder')");
} else {
$db->query("update ".TBL_STATUS.
- " set status_name = '$fname', status_desc = '$fdescription',
- sort_order = '$fsortorder' where status_id = '$statusid'");
+ " set status_name = ".$db->quote(stripslashes($fname)).
+ ', status_desc = '.$db->quote(stripslashes($fdescription)).
+ ", sort_order = $fsortorder where status_id = $statusid");
}
header("Location: $me?");
}
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- user.php 29 Mar 2002 18:25:38 -0000 1.42
+++ user.php 30 Mar 2002 19:12:30 -0000 1.43
@@ -50,15 +50,17 @@
}
if (!$userid) {
- if (ENCRYPT_PASS) $mpassword = md5($_pv['fpassword']);
- else $mpassword = $_pv['fpassword'];
+ if (ENCRYPT_PASS) $mpassword = $db->quote(md5($_pv['fpassword']));
+ else $mpassword = $db->quote(stripslashes($_pv['fpassword']));
$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']}',
- '$login', '{$_pv['femail']}', '$mpassword', {$_pv['factive']}, $u, $now,
- $u, $now)");
+ values (".join(', ', array($new_user_id,
+ $db->quote(stripslashes($_pv['ffirstname'])),
+ $db->quote(stripslashes($_pv['flastname'])),
+ $db->quote(stripslashes($login)), $_pv['femail'], $mpassword,
+ $_pv['factive'], $u, $now, $u, $now)).')');
// Add to the selected groups
if (isset($_pv['fusergroup']) and is_array($_pv['fusergroup']) and
$_pv['fusergroup'][0]) {
@@ -83,12 +85,14 @@
$pquery = '';
}
} else {
- $pquery = "password = '{$_pv['fpassword']}',";
+ $pquery = "password = ".$db->quote(stripslashes($_pv['fpassword'])).",";
}
- $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'");
+ $db->query("update ".TBL_AUTH_USER.
+ " set first_name = ".$db->quote(stripslashes($_pv['ffirstname'])).
+ ", last_name = ".$db->quote(stripslashes($_pv['flastname'])).
+ ", login = ".$db->quote(stripslashes($login)).
+ ", email = '{$_pv['femail']}', $pquery active = {$_pv['factive']} ".
+ "where user_id = '$userid'");
// Update group memberships
// Get user's groups (without dropping the user group)
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 23:55:17
|
Update of /cvsroot/phpbt/phpbt/inc
In directory usw-pr-cvs1:/tmp/cvs-serv3805/inc
Modified Files:
functions.php
Log Message:
Oops
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- functions.php 29 Mar 2002 18:25:38 -0000 1.13
+++ functions.php 29 Mar 2002 23:55:14 -0000 1.14
@@ -322,7 +322,8 @@
$rs = $db->query("select project_id, project_name from ".TBL_PROJECT.
" where active = 1 order by project_name");
} else {
- $rs = $db->query(sprintf($QUERY['functions-project-js'], $_sv['group_ids']));
+ $rs = $db->query(sprintf($QUERY['functions-project-js'],
+ delimit_list(',', $_sv['group_ids'])));
}
while (list($pid, $pname) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$pname = addslashes($pname);
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 22:43:42
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv17846
Modified Files:
index.php report.php
Log Message:
Slight fixes for oracle
Index: index.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/index.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- index.php 29 Mar 2002 18:25:37 -0000 1.27
+++ index.php 29 Mar 2002 22:43:38 -0000 1.28
@@ -131,7 +131,7 @@
// Grab the resolutions from the database
$rs = $db->query($QUERY['index-projsummary-2'].
db_concat($QUERY['index-projsummary-3'], 'resolution_id',
- $QUERY['index-projsummary-4'], 'resolution_name' ,"'\"'").
+ $QUERY['index-projsummary-4'], 'resolution_name', "'\"' ").
$QUERY['index-projsummary-5']);
while (list($fieldname, $countquery) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$resfields[] = $fieldname;
Index: report.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/report.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- report.php 29 Mar 2002 18:25:37 -0000 1.22
+++ report.php 29 Mar 2002 22:43:38 -0000 1.23
@@ -38,7 +38,7 @@
// Grab the resolutions from the database
$rs = $db->query($QUERY['report-resbyeng-2'].
db_concat($QUERY['report-resbyeng-3'], 'resolution_id',
- $QUERY['report-resbyeng-4'], 'resolution_name' ,"'\"'").
+ $QUERY['report-resbyeng-4'], 'resolution_name', "'\"' ").
$QUERY['report-resbyeng-5']);
while (list($fieldname, $countquery) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$resfields[] = $fieldname;
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 18:28:57
|
Update of /cvsroot/phpbt/phpbt/schemas
In directory usw-pr-cvs1:/tmp/cvs-serv21220/schemas
Modified Files:
mysql.in oci8.in pgsql.in
Log Message:
Force login option
Index: mysql.in
===================================================================
RCS file: /cvsroot/phpbt/phpbt/schemas/mysql.in,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mysql.in 26 Mar 2002 18:43:25 -0000 1.20
+++ mysql.in 29 Mar 2002 18:28:54 -0000 1.21
@@ -294,6 +294,7 @@
INSERT INTO TBL_CONFIGURATION VALUES ('NEW_ACCOUNTS_DISABLED', '0', 'Only admins can create new user accounts - newaccount.php is disabled', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('RECALL_LOGIN', '0', 'Enable use of cookies to store username between logins', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('SHOW_PROJECT_SUMMARIES', '1', 'Itemize bug stats by project on the home page', 'bool');
+INSERT INTO TBL_CONFIGURATION VALUES ('FORCE_LOGIN', '0', 'Force users to login before being able to use the bug tracker', 'bool');
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');
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');
INSERT INTO TBL_CONFIGURATION VALUES ('ATTACHMENT_PATH','attachments','Sub-dir of the INSTALLPATH - Needs to be writeable by the web process','string');
Index: oci8.in
===================================================================
RCS file: /cvsroot/phpbt/phpbt/schemas/oci8.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- oci8.in 29 Mar 2002 17:40:07 -0000 1.7
+++ oci8.in 29 Mar 2002 18:28:54 -0000 1.8
@@ -293,6 +293,7 @@
INSERT INTO TBL_CONFIGURATION VALUES ('NEW_ACCOUNTS_DISABLED', '0', 'Only admins can create new user accounts - newaccount.php is disabled', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('RECALL_LOGIN', '0', 'Enable use of cookies to store username between logins', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('SHOW_PROJECT_SUMMARIES', '1', 'Itemize bug stats by project on the home page', 'bool');
+INSERT INTO TBL_CONFIGURATION VALUES ('FORCE_LOGIN', '0', 'Force users to login before being able to use the bug tracker', 'bool');
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');
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');
INSERT INTO TBL_CONFIGURATION VALUES ('ATTACHMENT_PATH','attachments','Sub-dir of the INSTALLPATH - Needs to be writeable by the web process','string');
Index: pgsql.in
===================================================================
RCS file: /cvsroot/phpbt/phpbt/schemas/pgsql.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- pgsql.in 26 Mar 2002 18:43:25 -0000 1.22
+++ pgsql.in 29 Mar 2002 18:28:54 -0000 1.23
@@ -290,6 +290,7 @@
INSERT INTO TBL_CONFIGURATION VALUES ('NEW_ACCOUNTS_DISABLED', '0', 'Only admins can create new user accounts - newaccount.php is disabled', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('RECALL_LOGIN', '0', 'Enable use of cookies to store username between logins', 'bool');
INSERT INTO TBL_CONFIGURATION VALUES ('SHOW_PROJECT_SUMMARIES', '1', 'Itemize bug stats by project on the home page', 'bool');
+INSERT INTO TBL_CONFIGURATION VALUES ('FORCE_LOGIN', '0', 'Force users to login before being able to use the bug tracker', 'bool');
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');
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');
INSERT INTO TBL_CONFIGURATION VALUES ('ATTACHMENT_PATH','attachments','Sub-dir of the INSTALLPATH - Needs to be writeable by the web process','string');
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 18:25:41
|
Update of /cvsroot/phpbt/phpbt/inc/db
In directory usw-pr-cvs1:/tmp/cvs-serv20053/inc/db
Modified Files:
mysql.php pgsql.php
Added Files:
oci8.php
Log Message:
Database independence... ooo-eee!
--- NEW FILE: oci8.php ---
<?php
$QUERY = array(
'admin-list-groups' => 'select ag.group_id, ag.group_name, ag.locked, '.
'count(ug.group_id) as count '.
'from '.TBL_AUTH_GROUP.' ag, '.TBL_USER_GROUP.' ug,'.TBL_AUTH_USER.' au '.
'where ag.group_id = ug.group_id(+) and ug.user_id = au.user_id(+) '.
'group by ag.group_id, ag.group_name, ag.locked '.
'order by %s %s',
'admin-list-oses' => 'select s.os_id, s.os_name, s.regex, s.sort_order, '.
'count(b.bug_id) as bug_count '.
'from '.TBL_OS.' s, '.TBL_BUG.' b '.
'where s.os_id = b.os_id(+) '.
'group by s.os_id, s.os_name, s.regex, s.sort_order '.
'order by s.%s %s',
'admin-show-version' => 'select v.*, p.project_name as project_name '.
'from '.TBL_VERSION.' v, '.TBL_PROJECT.' p '.
'where p.project_id = v.project_id(+) and version_id = \'%s\'',
'admin-show-component' => 'select c.*, p.project_name as project_name '.
'from '.TBL_COMPONENT.' c, '.TBL_PROJECT.' p '.
'where p.project_id = c.project_id(+) and component_id = \'%s\'',
'admin-list-resolutions' => 'select s.resolution_id, resolution_name, '.
'resolution_desc, sort_order, count(bug_id) as bug_count '.
'from '.TBL_RESOLUTION.' s, '.TBL_BUG.' b '.
'where s.resolution_id = b.resolution_id(+) '.
'group by s.resolution_id, resolution_name, resolution_desc, sort_order '.
'order by %s %s',
'admin-list-severities' => 'select s.severity_id, severity_name, '.
'severity_desc, severity_color, sort_order, count(bug_id) as bug_count '.
'from '.TBL_SEVERITY.' s, '.TBL_BUG.' b '.
'where s.severity_id = b.severity_id(+) '.
'group by s.severity_id, severity_name, severity_desc, severity_color, '.
'sort_order '.
'order by %s %s',
'admin-list-statuses' => 'select s.status_id, status_name, status_desc, '.
'sort_order, count(bug_id) as bug_count '.
'from '.TBL_STATUS.' s, '.TBL_BUG.' b '.
'where s.status_id = b.status_id(+) '.
'group by s.status_id, status_name, status_desc, sort_order '.
'order by %s %s',
'admin-user-groups' => 'select ug.group_id '.
'from '.TBL_USER_GROUP.' ug, ' . TBL_AUTH_GROUP.' g '.
'where g.group_id = ug.group_id(+) and user_id = %s '.
'and group_name <> \'User\'',
'bug-history' => 'select bh.*, login '.
'from '.TBL_BUG_HISTORY.' bh, '.TBL_AUTH_USER .
' where user_id = bh.created_by(+) and bug_id = %s',
'bug-cc-list' => 'select email '.
'from '.TBL_BUG_CC.' bc, ' . TBL_AUTH_USER.' u, ' . TBL_USER_PREF.' p '.
'where u.user_id = bc.user_id(+) and u.user_id = p.user_id '.
'and email_notices = 1 and bug_id = %s',
'bug-printable' => 'select b.*, reporter.login as reporter, '.
'owner.login as owner, p.project_name, c.component_name, '.
'v.version_name, s.severity_name, o.os_name, s.status_name, '.
'r.resolution_name '.
'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' owner, '.
TBL_AUTH_USER.' reporter, '.TBL_RESOLUTION.' r, '.TBL_SEVERITY.' sv, '.
TBL_STATUS. ' st, ' . TBL_OS.' os, '.TBL_VERSION.' v, '.
TBL_COMPONENT.' c, ' . TBL_PROJECT.' p ',
'where b.assigned_to = owner.user_id(+) '.
'and b.created_by = reporter.user_id(+) '.
'and b.resolution_id = r.resolution_id(+) and b.os_id = os.os_id '.
'and b.version_id = v.version_id and b.component_id = c.component_id '.
'and b.project_id = p.project_id and b.severity_id = sv.severity_id '.
'and b.status_id = st.status_id and bug_id = %s',
'bug-prev-next' => 'select b.bug_id, reporter.login as reporter, '.
'owner.login as owner '.
'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter, '.
TBL_AUTH_USER.' lastmodifier, ' . TBL_RESOLUTION.' resolution, '.
TBL_SEVERITY.' severity, ' . TBL_STATUS.' status, '.TBL_OS.' os, '.
TBL_VERSION.' version, '.TBL_COMPONENT.' component, '.
TBL_PROJECT.' project '.
'where b.assigned_to = owner.user_id(+) '.
'and b.created_by = reporter.user_id(+) '.
'and b.last_modified_by = lastmodifier.user_id(+) '.
'and b.resolution_id = resolution.resolution_id(+) '.
'and 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 and %s and bug_id <> %s '.
'order by %s %s, bug_id asc',
'bug-show-bug' => 'select b.*, reporter.login as reporter, '.
'owner.login as owner, r.resolution_name, st.status_name '.
'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter, '.
TBL_RESOLUTION.' r, '.TBL_SEVERITY.' sv, '.TBL_STATUS.' st '.
'where b.resolution_id = r.resolution_id(+) '.
'and b.assigned_to = owner.user_id(+) '.
'and b.created_by = reporter.user_id(+) '.
'and b.severity_id = sv.severity_id and b.status_id = st.status_id '.
'and bug_id = %s',
'functions-bug-cc' => 'select b.user_id, login '.
'from '.TBL_BUG_CC.' b, '. TBL_AUTH_USER.
' where phpbt_auth_user.user_id = b.user_id(+) and bug_id = %s',
'functions-project-js' => 'select p.project_id, project_name '.
'from ' . TBL_PROJECT . ' p, ' . TBL_PROJECT_GROUP . ' pg '.
'where p.project_id = pg.project_id(+) and active = 1 '.
'and (pg.project_id is null or pg.group_id in (%s)) '.
'group by p.project_id, p.project_name order by project_name',
'include-template-owner' => "SELECT sum(decode( s.status_name, 'Unconfirmed', 1, 'New', 1, 'Assigned', 1, 'Reopened', 1, 0 )) ".
'from '.TBL_BUG.' b, '.TBL_STATUS.' s '.
'where b.status_id = s.status_id (+) and b.assigned_to = %s',
'include-template-reporter' => "SELECT sum(decode( s.status_name, 'Unconfirmed', 1, 'New', 1, 'Assigned', 1, 'Reopened', 1, 0 )) ".
'from '.TBL_BUG.' b, ' . TBL_STATUS.' s '.
'where b.status_id = s.status_id (+) and b.created_by = %s',
'index-projsummary-1' => 'select b.project_id, p.project_name as "Project", '.
'sum(decode( b.resolution_id, 0, 1, 0)) as "Open"',
'index-projsummary-2' => "select b.resolution_name, ",
'index-projsummary-3' => "', sum(decode( b.resolution_id, '",
'index-projsummary-4' => "', 1, 0)) as \"'",
'index-projsummary-5' => "from ".TBL_RESOLUTION." b",
'index-projsummary-6' => "%s, count(bug_id) as \"Total\" ".
'from '.TBL_BUG . ' b, '.TBL_PROJECT.' p '.
'where b.project_id = p.project_id(+) and b.project_id not in (%s) '.
'group by b.project_id, p.project_name '.
'order by p.project_name',
'query-list-bugs-count' => 'select count(*) '.
'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter '.
'where b.assigned_to = owner.user_id(+) '.
'and b.created_by = reporter.user_id(+) ',
'query-list-bugs' => 'select b.*, reporter.login as reporter, '.
'owner.login as owner, lastmodifier.login as lastmodifier, '.
'project.project_name, severity.severity_name, severity.severity_color, '.
'status.status_name, os.os_name, version.version_name,'.
'component.component_name, resolution.resolution_name '.
'from '.TBL_BUG.' b, '.TBL_AUTH_USER.' lastmodifier, '.
TBL_AUTH_USER.' owner, '.TBL_AUTH_USER.' reporter, '.
TBL_SEVERITY.' severity, '.TBL_STATUS.' status, '.TBL_OS.' os, '.
TBL_VERSION.' version, '.TBL_COMPONENT.' component, '.
TBL_PROJECT.' project, ' . TBL_RESOLUTION.' resolution '.
'where b.assigned_to = owner.user_id(+) '.
'and b.created_by = reporter.user_id(+) '.
'and b.last_modified_by = lastmodifier.user_id(+) '.
'and b.resolution_id = resolution.resolution_id(+) '.
'and 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 %s '.
'order by %s %s, bug_id asc',
'report-resbyeng-1' => 'select email as "Assigned To", '.
'sum(decode( b.resolution_id, 0, 1, 0)) as "Open"',
'report-resbyeng-2' => "select b.resolution_name, ",
'report-resbyeng-3' => "', sum(decode( b.resolution_id, '",
'report-resbyeng-4' => "', 1, 0)) as \"'",
'report-resbyeng-5' => "from ".TBL_RESOLUTION." b",
'report-resbyeng-6' => '%s, count(bug_id) as "Total" '.
'from '.TBL_BUG . ' b, '.TBL_AUTH_USER.' u '.
'where b.assigned_to = u.user_id(+) %s '.
'group by assigned_to, u.email',
'report-resbyeng-where' => 'and',
);
?>
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/db/mysql.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mysql.php 30 Nov 2001 06:06:17 -0000 1.1
+++ mysql.php 29 Mar 2002 18:25:38 -0000 1.2
@@ -1,426 +1,149 @@
<?php
-/*
- * Session Management for PHP3
- *
- * Copyright (c) 1998,1999 NetUSE GmbH
- * Boris Erdmann, Kristian Koehntopp
- *
- * db_sql.inc,v 1.12 2001/10/12 16:19:29 layne_weathers
- *
- */
-class DB_Sql {
-
- /* public: connection parameters */
- var $Host = "";
- var $Database = "";
- var $User = "";
- var $Password = "";
+$QUERY = array(
+ 'admin-list-groups' => '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 %s %s',
+ 'admin-list-oses' => '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 %s %s',
+ 'admin-show-version' => 'select v.*, p.project_name as project_name '.
+ 'from '.TBL_VERSION.' v left join '.TBL_PROJECT.' p using(project_id) '.
+ 'where version_id = \'%s\'',
+ 'admin-show-component' => 'select c.*, p.project_name as project_name '.
+ 'from '.TBL_COMPONENT.' c left join '.TBL_PROJECT.' p using (project_id) '.
+ 'where component_id = \'%s\'',
+ 'admin-list-resolutions' => '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 %s %s',
+ 'admin-list-severities' => '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 %s %s',
+ 'admin-list-statuses' => '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 %s %s',
+ 'admin-user-groups' => 'select ug.group_id '.
+ 'from '.TBL_USER_GROUP.' ug left join '.TBL_AUTH_GROUP.' g using (group_id) '.
+ 'where user_id = %s and group_name <> \'User\'',
+ 'bug-history' => 'select bh.*, login '.
+ 'from '.TBL_BUG_HISTORY.' bh '.
+ 'left join '. TBL_AUTH_USER.' on bh.created_by = user_id '.
+ 'where bug_id = %s',
+ 'bug-cc-list' => 'select email '.
+ 'from '.TBL_BUG_CC.' left join '. TBL_AUTH_USER.' u using(user_id), '.
+ TBL_USER_PREF.' p '.
+ 'where bug_id = %s and u.user_id = p.user_id and email_notices = 1',
+ 'bug-printable' => '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 '.
+ '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, '.TBL_OS.' os, '. TBL_VERSION.' v, '.
+ TBL_COMPONENT.' c, '.TBL_PROJECT.' p '.
+ 'where bug_id = %s and b.severity_id = sv.severity_id '.
+ 'and b.os_id = os.os_id and b.version_id = v.version_id '.
+ 'and b.component_id = c.component_id and b.project_id = p.project_id '.
+ 'and b.status_id = st.status_id',
+ 'bug-prev-next' => '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 '.
+ '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 and %s '.
+ 'and bug_id <> %s '.
+ 'order by %s %s, bug_id asc',
+ 'bug-show-bug' => '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 = %s and b.severity_id = sv.severity_id '.
+ 'and b.status_id = st.status_id',
+ 'functions-bug-cc' => 'select b.user_id, login '.
+ 'from '.TBL_BUG_CC.' b left join '. TBL_AUTH_USER.' using(user_id) '.
+ 'where bug_id = %s',
+ 'functions-project-js' => 'select p.project_id, project_name '.
+ 'from '.TBL_PROJECT. ' p '.
+ 'left join '.TBL_PROJECT_GROUP.' pg using(project_id) '.
+ 'where active = 1 and (pg.project_id is null or pg.group_id in (%s)) '.
+ 'group by p.project_id, p.project_name '.
+ 'order by project_name',
+ 'include-template-owner' => "SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) , ".
+ "sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ".
+ "from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) ".
+ "where assigned_to = %s",
+ 'include-template-reporter' => "SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) , ".
+ "sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ".
+ "from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) ".
+ "where created_by = %s",
+ 'index-projsummary-1' => 'select project_name as "Project", '.
+ 'sum(case when resolution_id = 0 then 1 else 0 end) as "Open"',
+ 'index-projsummary-2' => "select resolution_name, ",
+ 'index-projsummary-3' => "', sum(case when resolution_id = '",
+ 'index-projsummary-4' => "' then 1 else 0 end) as \"'",
+ 'index-projsummary-5' => " from ".TBL_RESOLUTION,
+ 'index-projsummary-6' => '%s, count(bug_id) as "Total" '.
+ 'from '.TBL_BUG. ' b left join '.TBL_PROJECT.' p using (project_id) '.
+ 'where b.project_id not in (%s) group by b.project_id, project_name '.
+ 'order by project_name',
+ 'query-list-bugs-count' => '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 ',
+ 'query-list-bugs' => '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 '.
+ '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 %s '.
+ 'order by %s %s, bug_id asc',
+ 'report-resbyeng-1' => 'select email as "Assigned To", '.
+ 'sum(case when resolution_id = 0 then 1 else 0 end) as "Open"',
+ 'report-resbyeng-2' => "select resolution_name, ",
+ 'report-resbyeng-3' => "', sum(case when resolution_id = '",
+ 'report-resbyeng-4' => "' then 1 else 0 end) as \"'",
+ 'report-resbyeng-5' => " from ".TBL_RESOLUTION,
+ 'report-resbyeng-6' => '%s, count(bug_id) as "Total" '.
+ 'from '.TBL_BUG. ' b '.
+ 'left join '.TBL_AUTH_USER.' u on assigned_to = user_id %s '.
+ 'group by assigned_to, u.email',
+ 'report-resbyeng-where' => 'where',
+ );
- /* public: configuration parameters */
- var $Auto_Free = 0; ## Set to 1 to automatically free results
- var $Debug = 0; ## Set to 1 for debugging messages
- var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore error, but spit a warning)
- var $Seq_Table = "db_sequence"; ## Name of the sequence table
- var $Seq_ID_Col = "p_nextid"; ## Name of the Sequence ID column in $Seq_Table
- var $Seq_Name_Col = "p_seq_name"; ## Name of the Sequence Name column in $Seq_Table
-
- /* public: result array and current row number */
- var $Record = array();
- var $Row = 0;
-
- /* public: current error number and error text */
- var $Errno = 0;
- var $Error = "";
-
- /* public: this is an api revision, not a CVS revision. */
- var $type = "mysql";
- var $revision = "1.2";
-
- /* private: link and query handles */
- var $Link_ID = 0;
- var $Query_ID = 0;
-
-
- /* public: constructor */
- function DB_Sql($query = "") {
- $this->query($query);
- }
-
- /* public: some trivial reporting */
- function link_id() {
- return $this->Link_ID;
- }
-
- function query_id() {
- return $this->Query_ID;
- }
-
- /* public: connection management */
- function connect($Database = "", $Host = "", $User = "", $Password = "") {
- /* Handle defaults */
- if ("" == $Database)
- $Database = $this->Database;
- if ("" == $Host)
- $Host = $this->Host;
- if ("" == $User)
- $User = $this->User;
- if ("" == $Password)
- $Password = $this->Password;
-
- /* establish connection, select database */
- if ( 0 == $this->Link_ID ) {
- $this->Link_ID=mysql_pconnect($Host, $User, $Password);
- if (!$this->Link_ID) {
- $this->halt("pconnect($Host, $User, \$Password) failed.");
- return 0;
- }
- }
-
- if (!@mysql_select_db($Database,$this->Link_ID)) {
- $this->halt("cannot use database ".$Database);
- return 0;
- }
-
- return $this->Link_ID;
- }
-
- /* public: discard the query result */
- function free() {
- @mysql_free_result($this->Query_ID);
- $this->Query_ID = 0;
- }
-
- /* public: perform a query */
- function query($Query_String) {
- /* No empty queries, please, since PHP4 chokes on them. */
- if ($Query_String == "")
- /* The empty query string is passed on from the constructor,
- * when calling the class without a query, e.g. in situations
- * like these: '$db = new DB_Sql_Subclass;'
- */
- return 0;
-
- if (!$this->connect()) {
- return 0; /* we already complained in connect() about that. */
- }
-
- # New query, discard previous result.
- if ($this->Query_ID) {
- $this->free();
- }
-
- if ($this->Debug)
- printf("Debug: query = %s<br>\n", $Query_String);
-
- $this->Query_ID = @mysql_query($Query_String,$this->Link_ID);
- $this->Row = 0;
- $this->check_error();
- if (!$this->Query_ID) {
- $this->halt("Invalid SQL: ".$Query_String);
- }
-
- # Will return nada if it fails. That's fine.
- return $this->Query_ID;
- }
-
- /* public: walk result set */
- function next_record() {
- if (!$this->Query_ID) {
- $this->halt("next_record called with no query pending.");
- return 0;
- }
-
- $this->Record = @mysql_fetch_array($this->Query_ID);
- $this->Row += 1;
- $this->check_error();
-
- $stat = is_array($this->Record);
- if (!$stat && $this->Auto_Free) {
- $this->free();
- }
- return $stat;
- }
-
- /* public: position in result set */
- function seek($pos = 0) {
- $status = @mysql_data_seek($this->Query_ID, $pos);
- if ($status)
- $this->Row = $pos;
- else {
- $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
-
- /* half assed attempt to save the day,
- * but do not consider this documented or even
- * desirable behaviour.
- */
- @mysql_data_seek($this->Query_ID, $this->num_rows());
- $this->Row = $this->num_rows();
- return 0;
- }
-
- return 1;
- }
-
- /* public: table locking */
- function lock($table, $mode = "write") {
- $query = "lock tables ";
- if (is_array($table)) {
- while (list($key,$value) = each($table)) {
- if (!is_int($key)) {
- // texts key are "read", "read local", "write", "low priority write"
- $query .= "$value $key, ";
- } else {
- $query .= "$value $mode, ";
- }
- }
- $query = substr($query,0,-2);
- } else {
- $query .= "$table $mode";
- }
- $res = $this->query($query);
- if (!$res) {
- $this->halt("lock() failed.");
- return 0;
- }
- return $res;
- }
-
- function unlock() {
- $res = $this->query("unlock tables");
- if (!$res) {
- $this->halt("unlock() failed.");
- }
- return $res;
- }
-
- /* public: evaluate the result (size, width) */
- function affected_rows() {
- return @mysql_affected_rows($this->Link_ID);
- }
-
- function num_rows() {
- return @mysql_num_rows($this->Query_ID);
- }
-
- function num_fields() {
- return @mysql_num_fields($this->Query_ID);
- }
-
- /* public: shorthand notation */
- function nf() {
- return $this->num_rows();
- }
-
- function np() {
- print $this->num_rows();
- }
-
- function f($Name) {
- if (isset($this->Record[$Name])) {
- return $this->Record[$Name];
- }
- return "";
- }
-
- function p($Name) {
- print $this->f($Name);
- }
-
- /* public: sequence numbers */
- function nextid($seq_name) {
- if (!$this->connect()) {
- return 0; /* we already complained in connect() about that. */
- }
-
- if ($this->lock($this->Seq_Table)) {
- /* get sequence number (locked) and increment */
- $q = sprintf("select %s from %s where %s = '%s'",
- $this->Seq_ID_Col,
- $this->Seq_Table,
- $this->Seq_Name_Col,
- $seq_name);
- $id = @mysql_query($q, $this->Link_ID);
- $res = @mysql_fetch_array($id);
-
- /* No current value, make one */
- if (!is_array($res)) {
- $currentid = 0;
- $q = sprintf("insert into %s ( %s, %s ) values('%s', %s)",
- $this->Seq_Table,
- $this->Seq_Name_Col,
- $this->Seq_ID_Col,
- $seq_name,
- $currentid);
- $id = @mysql_query($q, $this->Link_ID);
- } else {
- $currentid = $res[$this->Seq_ID_Col];
- }
- $nextid = $currentid + 1;
- $q = sprintf("update %s set %s = '%s' where %s = '%s'",
- $this->Seq_Table,
- $this->Seq_ID_Col,
- $nextid,
- $this->Seq_Name_Col,
- $seq_name);
- $id = @mysql_query($q, $this->Link_ID);
- $this->unlock();
- } else {
- $this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
- return 0;
- }
- return $nextid;
- }
-
- /* public: return table metadata */
- function metadata($table = "", $full = false) {
- $count = 0;
- $id = 0;
- $res = array();
-
- /*
- * Due to compatibility problems with Table we changed the behavior
- * of metadata();
- * If $full is set, metadata returns additional information
- *
- * This information is always returned:
- * $result[]:
- * [0]["table"] table name
- * [0]["name"] field name
- * [0]["type"] field type
- * [0]["len"] field length
- * [0]["flags"] field flags
- *
- * If $full is set this information is also returned:
- * $result[]:
- * ["num_fields"] number of metadata records
- * [0]["php_type"] the corresponding PHP-type
- * [0]["php_subtype"] the subtype of PHP-type
- * ["meta"][field name] index of field named "field name"
- * This one could be used if you have a field name, but no index.
- * Test: if (isset($result['meta']['myfield'])) { ...
- * [unique] = field names which have an unique key, separated by space
- */
-
- // if no $table specified, assume that we are working with a query result
- if ($table) {
- if (!$this->connect()) {
- return 0; /* we already complained in connect() about that. */
- }
- $id = @mysql_list_fields($this->Database, $table);
- if (!$id) {
- $this->halt("Metadata query failed.");
- return false;
- }
- } else {
- $id = $this->Query_ID;
- if (!$id) {
- $this->halt("No query specified.");
- return false;
- }
- }
-
- $count = @mysql_num_fields($id);
-
- for ($i=0; $i<$count; $i++) {
- $res[$i]["table"] = @mysql_field_table ($id, $i);
- $res[$i]["name"] = @mysql_field_name ($id, $i);
- $res[$i]["type"] = @mysql_field_type ($id, $i);
- $res[$i]["len"] = @mysql_field_len ($id, $i);
- $res[$i]["flags"] = @mysql_field_flags ($id, $i);
- }
-
- if ($full) {
- $uniq = array();
- $res["num_fields"] = $count;
-
- for ($i=0; $i<$count; $i++) {
- $res["meta"][$res[$i]["name"]] = $i;
- switch ($res[$i]["type"]) {
- case "var string":
- case "string" :
- case "char" :
- $res[$i]["php_type"]="string";
- $res[$i]["php_subtype"]="";
- break;
- case "timestamp" :
- case "datetime" :
- case "date" :
- case "time" :
- $res[$i]["php_type"]="string";
- $res[$i]["php_subtype"]="date";
- break;
- case "blob" :
- $res[$i]["php_type"]="string";
- $res[$i]["php_subtype"]="blob";
- break;
- case "real" :
- $res[$i]["php_type"]="double";
- $res[$i]["php_subtype"]="";
- break;
- case "long" :
- default :
- $res[$i]["php_type"]="int";
- $res[$i]["php_subtype"]="";
- break;
- }
- if ( ereg("(unique_key|primary_key)",$res[$i]["flags"]) ) {
- $uniq[]=$res[$i]["name"];
- }
- }
- $res["unique"]=join(" ",$uniq);
- }
-
- // free the result only if we were called on a table
- if ($table) {
- @mysql_free_result($id);
- }
- return $res;
- }
-
- /* public: find available table names */
- function table_names() {
- if (!$this->connect()) {
- return 0; /* we already complained in connect() about that. */
- }
-
- $h = @mysql_query("show tables", $this->Link_ID);
- $i = 0;
- while ($info = @mysql_fetch_row($h)) {
- $return[$i]["table_name"] = $info[0];
- $return[$i]["tablespace_name"] = $this->Database;
- $return[$i]["database"] = $this->Database;
- $i++;
- }
-
- @mysql_free_result($h);
- return $return;
- }
-
- /* private: error handling */
- function check_error() {
- $this->Error = @mysql_error();
- $this->Errno = @mysql_errno();
- }
-
- function halt($msg) {
- $this->Error = @mysql_error($this->Link_ID);
- $this->Errno = @mysql_errno($this->Link_ID);
- if ($this->Halt_On_Error == "no")
- return;
-
- $this->haltmsg($msg);
-
- if ($this->Halt_On_Error != "report")
- die("Session halted.");
- }
-
- function haltmsg($msg) {
- printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
- printf("<b>MySQL Error</b>: %s (%s)<br>\n",
- $this->Errno,
- $this->Error);
- }
-
-}
?>
Index: pgsql.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/db/pgsql.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pgsql.php 4 Dec 2001 14:32:23 -0000 1.2
+++ pgsql.php 29 Mar 2002 18:25:38 -0000 1.3
@@ -1,229 +1,149 @@
<?php
-/*
- * Session Management for PHP3
- *
- * Copyright (c) 1998,1999 NetUSE GmbH
- * Boris Erdmann, Kristian Koehntopp
- *
- * db_sql.inc,v 1.4 2000/07/01 22:08:35 kir
- *
- */
-class DB_Sql {
- var $Host = "";
- var $Port = "";
- var $Database = "";
- var $User = "";
- var $Password = "";
+$QUERY = array(
+ 'admin-list-groups' => '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 %s %s',
+ 'admin-list-oses' => '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 %s %s',
+ 'admin-show-version' => 'select v.*, p.project_name as project_name '.
+ 'from '.TBL_VERSION.' v left join '.TBL_PROJECT.' p using(project_id) '.
+ 'where version_id = \'%s\'',
+ 'admin-show-component' => 'select c.*, p.project_name as project_name '.
+ 'from '.TBL_COMPONENT.' c left join '.TBL_PROJECT.' p using (project_id) '.
+ 'where component_id = \'%s\'',
+ 'admin-list-resolutions' => '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 %s %s',
+ 'admin-list-severities' => '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 %s %s',
+ 'admin-list-statuses' => '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 %s %s',
+ 'admin-user-groups' => 'select ug.group_id '.
+ 'from '.TBL_USER_GROUP.' ug left join '.TBL_AUTH_GROUP.' g using (group_id) '.
+ 'where user_id = %s and group_name <> \'User\'',
+ 'bug-history' => 'select bh.*, login '.
+ 'from '.TBL_BUG_HISTORY.' bh '.
+ 'left join '. TBL_AUTH_USER.' on bh.created_by = user_id '.
+ 'where bug_id = %s',
+ 'bug-cc-list' => 'select email '.
+ 'from '.TBL_BUG_CC.' left join '. TBL_AUTH_USER.' u using(user_id), '.
+ TBL_USER_PREF.' p '.
+ 'where bug_id = %s and u.user_id = p.user_id and email_notices = 1',
+ 'bug-printable' => '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 '.
+ '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, '.TBL_OS.' os, '. TBL_VERSION.' v, '.
+ TBL_COMPONENT.' c, '.TBL_PROJECT.' p '.
+ 'where bug_id = %s and b.severity_id = sv.severity_id '.
+ 'and b.os_id = os.os_id and b.version_id = v.version_id '.
+ 'and b.component_id = c.component_id and b.project_id = p.project_id '.
+ 'and b.status_id = st.status_id',
+ 'bug-prev-next' => '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 '.
+ '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 and %s '.
+ 'and bug_id <> %s '.
+ 'order by %s %s, bug_id asc',
+ 'bug-show-bug' => '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 = %s and b.severity_id = sv.severity_id '.
+ 'and b.status_id = st.status_id',
+ 'functions-bug-cc' => 'select b.user_id, login '.
+ 'from '.TBL_BUG_CC.' b left join '. TBL_AUTH_USER.' using(user_id) '.
+ 'where bug_id = %s',
+ 'functions-project-js' => 'select p.project_id, project_name '.
+ 'from '.TBL_PROJECT. ' p '.
+ 'left join '.TBL_PROJECT_GROUP.' pg using(project_id) '.
+ 'where active = 1 and (pg.project_id is null or pg.group_id in (%s)) '.
+ 'group by p.project_id, p.project_name '.
+ 'order by project_name',
+ 'include-template-owner' => "SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) , ".
+ "sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ".
+ "from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) ".
+ "where assigned_to = %s",
+ 'include-template-reporter' => "SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) , ".
+ "sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ".
+ "from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) ".
+ "where created_by = %s",
+ 'index-projsummary-1' => 'select project_name as "Project", '.
+ 'sum(case when resolution_id = 0 then 1 else 0 end) as "Open"',
+ 'index-projsummary-2' => "select resolution_name, ",
+ 'index-projsummary-3' => "', sum(case when resolution_id = '",
+ 'index-projsummary-4' => "' then 1 else 0 end) as \"'",
+ 'index-projsummary-5' => " from ".TBL_RESOLUTION,
+ 'index-projsummary-6' => '%s, count(bug_id) as "Total" '.
+ 'from '.TBL_BUG. ' b left join '.TBL_PROJECT.' p using (project_id) '.
+ 'where b.project_id not in (%s) group by b.project_id, project_name '.
+ 'order by project_name',
+ 'query-list-bugs-count' => '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 ',
+ 'query-list-bugs' => '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 '.
+ '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 %s '.
+ 'order by %s %s, bug_id asc',
+ 'report-resbyeng-1' => 'select email as "Assigned To", '.
+ 'sum(case when resolution_id = 0 then 1 else 0 end) as "Open"',
+ 'report-resbyeng-2' => "select resolution_name, ",
+ 'report-resbyeng-3' => "', sum(case when resolution_id = '",
+ 'report-resbyeng-4' => "' then 1 else 0 end) as \"'",
+ 'report-resbyeng-5' => " from ".TBL_RESOLUTION,
+ 'report-resbyeng-6' => '%s, count(bug_id) as "Total" '.
+ 'from '.TBL_BUG. ' b '.
+ 'left join '.TBL_AUTH_USER.' u on assigned_to = user_id %s '.
+ 'group by assigned_to, u.email',
+ 'report-resbyeng-where' => 'where',
+ );
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
- var $Row = 0;
-
- var $Seq_Table = "db_sequence";
-
- var $Errno = 0;
- var $Error = "";
- var $Debug = 0;
-
- var $Auto_Free = 0; # Set this to 1 for automatic pg_freeresult on
- # last record.
-
- function ifadd($add, $me) {
- if("" != $add) return " ".$me.$add;
- }
-
- /* public: constructor */
- function DB_Sql($query = "") {
- $this->query($query);
- }
-
-
- function connect() {
- if ( 0 == $this->Link_ID ) {
- $cstr = "dbname=".$this->Database.
- $this->ifadd($this->Host, "host=").
- $this->ifadd($this->Port, "port=").
- $this->ifadd($this->User, "user=").
- $this->ifadd($this->Password, "password=");
- $this->Link_ID=pg_pconnect($cstr);
- if (!$this->Link_ID) {
- $this->halt("Link-ID == false, pconnect failed");
- }
- }
- }
-
- function query($Query_String) {
-
- /* No empty queries, please, since PHP4 chokes on them. */
- if ($Query_String == "")
- /* The empty query string is passed on from the constructor,
- * when calling the class without a query, e.g. in situations
- * like these: '$db = new DB_Sql_Subclass;'
- */
- return 0;
-
- $this->connect();
-
- if ($this->Debug) printf("<br>Debug: query = %s<br>\n", $Query_String);
-
- $this->Query_ID = pg_Exec($this->Link_ID, $Query_String);
- $this->Row = 0;
-
- $this->Error = pg_ErrorMessage($this->Link_ID);
- $this->Errno = ($this->Error == "")?0:1;
- if (!$this->Query_ID) {
- $this->halt("Invalid SQL: ".$Query_String);
- }
-
- return $this->Query_ID;
- }
-
- function next_record() {
- $this->Record = @pg_fetch_array($this->Query_ID, $this->Row++);
-
- $this->Error = pg_ErrorMessage($this->Link_ID);
- $this->Errno = ($this->Error == "")?0:1;
-
- $stat = is_array($this->Record);
- if (!$stat && $this->Auto_Free) {
- pg_freeresult($this->Query_ID);
- $this->Query_ID = 0;
- }
- return $stat;
- }
-
- function seek($pos) {
- $this->Row = $pos;
- }
-
- function lock($table, $mode = "write") {
- if ($mode == "write") {
- $result = pg_Exec($this->Link_ID, "lock table $table");
- } else {
- $result = 1;
- }
- return $result;
- }
-
- function unlock() {
- return pg_Exec($this->Link_ID, "commit");
- }
-
-
- /* public: sequence numbers */
- function nextid($seq_name) {
- $this->connect();
-
- if ($this->lock($this->Seq_Table)) {
- /* get sequence number (locked) and increment */
- $q = sprintf("select nextid from %s where seq_name = '%s'",
- $this->Seq_Table,
- $seq_name);
- $id = @pg_Exec($this->Link_ID, $q);
- $res = @pg_Fetch_Array($id, 0);
-
- /* No current value, make one */
- if (!is_array($res)) {
- $currentid = 0;
- $q = sprintf("insert into %s values('%s', %s)",
- $this->Seq_Table,
- $seq_name,
- $currentid);
- $id = @pg_Exec($this->Link_ID, $q);
- } else {
- $currentid = $res["nextid"];
- }
- $nextid = $currentid + 1;
- $q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
- $this->Seq_Table,
- $nextid,
- $seq_name);
- $id = @pg_Exec($this->Link_ID, $q);
- $this->unlock();
- } else {
- $this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
- return 0;
- }
- return $nextid;
- }
-
-
-
- function metadata($table) {
- $count = 0;
- $id = 0;
- $res = array();
-
- $this->connect();
- $id = pg_exec($this->Link_ID, "select * from $table");
- if ($id < 0) {
- $this->Error = pg_ErrorMessage($id);
- $this->Errno = 1;
- $this->halt("Metadata query failed.");
- }
- $count = pg_NumFields($id);
-
- for ($i=0; $i<$count; $i++) {
- $res[$i]["table"] = $table;
- $res[$i]["name"] = pg_FieldName ($id, $i);
- $res[$i]["type"] = pg_FieldType ($id, $i);
- $res[$i]["len"] = pg_FieldSize ($id, $i);
- $res[$i]["flags"] = "";
- }
-
- pg_FreeResult($id);
- return $res;
- }
-
- function affected_rows() {
- return pg_cmdtuples($this->Query_ID);
- }
-
- function num_rows() {
- return pg_numrows($this->Query_ID);
- }
-
- function num_fields() {
- return pg_numfields($this->Query_ID);
- }
-
- function nf() {
- return $this->num_rows();
- }
-
- function np() {
- print $this->num_rows();
- }
-
- function f($Name) {
- return $this->Record[$Name];
- }
-
- function p($Name) {
- print $this->Record[$Name];
- }
-
- function halt($msg) {
- printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
- printf("<b>PostgreSQL Error</b>: %s (%s)<br>\n",
- $this->Errno,
- $this->Error);
- die("Session halted.");
- }
-
- function table_names() {
- $this->query("select relname from pg_class where relkind = 'r' and not relname like 'pg_%'");
- $i=0;
- while ($this->next_record())
- {
- $return[$i]["table_name"]= $this->f(0);
- $return[$i]["tablespace_name"]=$this->Database;
- $return[$i]["database"]=$this->Database;
- $i++;
- }
- return $return;
- }
-}
?>
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 18:25:41
|
Update of /cvsroot/phpbt/phpbt/inc
In directory usw-pr-cvs1:/tmp/cvs-serv20053/inc
Modified Files:
functions.php
Log Message:
Database independence... ooo-eee!
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- functions.php 26 Mar 2002 18:40:27 -0000 1.12
+++ functions.php 29 Mar 2002 18:25:38 -0000 1.13
@@ -43,7 +43,7 @@
///
/// Build a select box with the item matching $value selected
function build_select($box, $value = '', $project = 0) {
- global $db, $select, $perm, $STRING, $restricted_projects;
+ global $db, $select, $perm, $STRING, $restricted_projects, $QUERY;
//create hash to map tablenames
$cfgDatabase = array(
@@ -131,8 +131,7 @@
}
break;
case 'bug_cc' :
- $rs = $db->query('select b.user_id, login from '.TBL_BUG_CC.' b left join '.
- TBL_AUTH_USER." using(user_id) where bug_id = $value");
+ $rs = $db->query(sprintf($QUERY['functions-bug-cc'], $value));
while (list($uid, $user) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$text .= "<option value=\"$uid\">".maskemail($user).'</option>';
}
@@ -314,7 +313,7 @@
///
/// Build the javascript for the dynamic project -> component -> version select boxes
function build_project_js() {
- global $db, $u, $perm, $_sv;
+ global $db, $u, $perm, $_sv, $QUERY;
$js = '';
@@ -323,11 +322,7 @@
$rs = $db->query("select project_id, project_name from ".TBL_PROJECT.
" where active = 1 order by project_name");
} else {
- $rs = $db->query('select p.project_id, project_name from '.TBL_PROJECT.
- ' p left join '.TBL_PROJECT_GROUP.' pg using(project_id)
- where active = 1 and (pg.project_id is null or pg.group_id in ('.
- delimit_list(',', $_sv['group_ids']).')) group by
- p.project_id, p.project_name order by project_name');
+ $rs = $db->query(sprintf($QUERY['functions-project-js'], $_sv['group_ids']));
}
while (list($pid, $pname) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$pname = addslashes($pname);
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 18:25:41
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv20053/admin
Modified Files:
group.php os.php project.php resolution.php severity.php
status.php user.php
Log Message:
Database independence... ooo-eee!
Index: group.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/group.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- group.php 17 Mar 2002 01:38:31 -0000 1.5
+++ group.php 29 Mar 2002 18:25:37 -0000 1.6
@@ -81,7 +81,7 @@
function list_items($groupid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
$t->set_file('content','grouplist.html');
$t->set_block('content','row','rows');
@@ -109,9 +109,7 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $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",
+ $rs = $db->limitQuery(sprintf($QUERY['admin-list-groups'], $order, $sort),
$llimit, $selrange);
if (!$rs->numRows()) {
Index: os.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/os.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- os.php 17 Mar 2002 01:38:31 -0000 1.22
+++ os.php 29 Mar 2002 18:25:38 -0000 1.23
@@ -85,7 +85,7 @@
function list_items($osid = 0, $error = '') {
- global $db, $me, $t, $_gv, $STRING, $TITLE;
+ global $db, $me, $t, $_gv, $STRING, $TITLE, $QUERY;
$t->set_file('content','oslist.html');
$t->set_block('content','row','rows');
@@ -113,11 +113,8 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $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", $llimit, $selrange);
+ $rs = $db->limitQuery(sprintf($QUERY['admin-list-oses'], $order, $sort),
+ $llimit, $selrange);
if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['nooses']}</td></tr>");
Index: project.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- project.php 28 Mar 2002 22:26:06 -0000 1.34
+++ project.php 29 Mar 2002 18:25:38 -0000 1.35
@@ -49,14 +49,12 @@
}
function show_version($versionid = 0, $error = '') {
- global $db, $t, $_pv, $STRING;
+ global $db, $t, $_pv, $STRING, $QUERY;
foreach ($_pv as $k => $v) $$k = $v;
if ($versionid && !$error) {
- $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'");
+ $row = $db->getRow(sprintf($QUERY['admin-show-version'], $versionid));
$t->set_var(array(
'vf_error' => '',
'versionid' => $row['version_id'],
@@ -126,14 +124,12 @@
}
function show_component($componentid = 0, $error = '') {
- global $db, $t, $_pv, $STRING;
+ global $db, $t, $_pv, $STRING, $QUERY;
foreach ($_pv as $k => $v) $$k = $v;
if ($componentid && !$error) {
- $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'");
+ $row = $db->getRow(sprintf($QUERY['admin-show-component'], $componentid));
$t->set_var(array(
'cf_error' => '',
'componentid' => $row['component_id'],
Index: resolution.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/resolution.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- resolution.php 17 Mar 2002 01:38:31 -0000 1.23
+++ resolution.php 29 Mar 2002 18:25:38 -0000 1.24
@@ -92,7 +92,7 @@
function list_items($resolutionid = 0, $error = '') {
- global $me, $db, $t, $STRING, $TITLE, $_gv;
+ global $me, $db, $t, $STRING, $TITLE, $_gv, $QUERY;
$t->set_file('content','resolutionlist.html');
$t->set_block('content','row','rows');
@@ -119,11 +119,8 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $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", $llimit, $selrange);
+ $rs = $db->limitQuery(sprintf($QUERY['admin-list-resolutions'], $order, $sort),
+ $llimit, $selrange);
if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['noresolutions']}</td></tr>");
Index: severity.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/severity.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- severity.php 17 Mar 2002 01:38:31 -0000 1.19
+++ severity.php 29 Mar 2002 18:25:38 -0000 1.20
@@ -95,7 +95,7 @@
function list_items($severityid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
$t->set_file('content','severitylist.html');
$t->set_block('content','row','rows');
@@ -122,11 +122,8 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $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", $llimit, $selrange);
+ $rs = $db->limitQuery(sprintf($QUERY['admin-list-severities'], $order, $sort),
+ $llimit, $selrange);
if (!$rs->numRows()) {
Index: status.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/status.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- status.php 17 Mar 2002 01:38:31 -0000 1.23
+++ status.php 29 Mar 2002 18:25:38 -0000 1.24
@@ -92,7 +92,7 @@
function list_items($statusid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
$t->set_file('content','statuslist.html');
$t->set_block('content','row','rows');
@@ -119,10 +119,8 @@
'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
'records' => $nr));
- $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", $llimit, $selrange);
+ $rs = $db->limitQuery(sprintf($QUERY['admin-list-statuses'], $order, $sort),
+ $llimit, $selrange);
if (!$rs->numRows()) {
$t->set_var('rows',"<tr><td>{$STRING['nostatuses']}</td></tr>");
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- user.php 17 Mar 2002 01:38:31 -0000 1.41
+++ user.php 29 Mar 2002 18:25:38 -0000 1.42
@@ -26,7 +26,7 @@
include '../include.php';
function do_form($userid = 0) {
- global $db, $me, $_pv, $STRING, $now, $u;
+ global $db, $me, $_pv, $STRING, $now, $u, $QUERY;
$error = '';
// Validation
@@ -92,9 +92,7 @@
// Update group memberships
// Get user's groups (without dropping the user group)
- $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'");
+ $user_groups = $db->getCol(sprintf($QUERY['admin-user-groups'], $userid));
// Compute differences between old and new
if (!isset($user_groups) or !is_array($user_groups)) {
|
|
From: Benjamin C. <bc...@us...> - 2002-03-29 18:25:40
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv20053
Modified Files:
bug.php config-dist.php config.php include.php index.php
query.php report.php
Log Message:
Database independence... ooo-eee!
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- bug.php 26 Mar 2002 17:27:48 -0000 1.89
+++ bug.php 29 Mar 2002 18:25:37 -0000 1.90
@@ -121,15 +121,14 @@
///
/// Show the activity for a bug
function show_history($bugid) {
- global $db, $t, $STRING;
+ global $db, $t, $STRING, $QUERY;
if (!is_numeric($bugid)) {
show_text($STRING['nobughistory']);
return;
}
- $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");
+ $rs = $db->query(sprintf($QUERY['bug-history'], $bugid));
if (!$rs->numRows()) {
show_text($STRING['nobughistory']);
return;
@@ -155,7 +154,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 $db, $t, $u, $select, $now, $STRING;
+ global $db, $t, $u, $select, $now, $STRING, $QUERY;
// It's a new bug if the changedfields array is empty and there are no comments
$newbug = (!count($cf) and !$comments);
@@ -274,10 +273,7 @@
$maillist[] = $assignedto;
// Collect the CCs
- if ($ccs = $db->getCol('select email from '.TBL_BUG_CC.' left join '.
- TBL_AUTH_USER." u using(user_id), ".TBL_USER_PREF." p ".
- "where bug_id = {$buginfo['bug_id']} and u.user_id = p.user_id ".
- "and email_notices = 1")) {
+ if ($ccs = $db->getCol(sprintf($QUERY['bug-cc-list'], $buginfo['bug_id']))) {
array_push($maillist, $ccs);
}
@@ -602,22 +598,10 @@
}
function show_bug_printable($bugid) {
- global $db, $me, $t, $select, $TITLE;
+ global $db, $me, $t, $select, $TITLE, $QUERY;
if (!is_numeric($bugid) or
- !$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
- 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, '.TBL_OS.' os, '.
- TBL_VERSION.' v, '.TBL_COMPONENT.' c, '.TBL_PROJECT." p
- where bug_id = '$bugid' and b.severity_id = sv.severity_id
- and b.os_id = os.os_id and b.version_id = v.version_id
- and b.component_id = c.component_id and b.project_id = p.project_id
- and b.status_id = st.status_id")) {
+ !$row = $db->getRow(sprintf($QUERY['bug-printable'], $bugid))) {
show_text($STRING['bugbadnum'],true);
exit;
}
@@ -673,7 +657,7 @@
///
/// Grab the links for the previous and next bugs in the list
function prev_next_links($bugid, $pos) {
- global $db, $_sv, $STRING;
+ global $db, $_sv, $STRING, $QUERY;
if (!isset($_sv['queryinfo']['query']) || !$_sv['queryinfo']['query']) {
return array('', '');
@@ -687,19 +671,9 @@
$offset = $pos;
$limit = 1;
}
- $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
- 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 '.
- "and {$_sv['queryinfo']['query']} and bug_id <> $bugid
- order by {$_sv['queryinfo']['order']} {$_sv['queryinfo']['sort']}, bug_id asc", $offset, $limit);
+ $rs = $db->limitQuery(sprintf($QUERY['bug-prev-next'],
+ $_sv['queryinfo']['query'], $bugid, $_sv['queryinfo']['order'],
+ $_sv['queryinfo']['sort']), $offset, $limit);
list($firstid, $chunks) = $rs->fetchRow(DB_FETCHMODE_ORDERED);
list($secondid, $chunks) = $rs->fetchRow(DB_FETCHMODE_ORDERED);
@@ -724,17 +698,10 @@
}
function show_bug($bugid = 0, $error = array()) {
- global $db, $me, $t, $STRING, $TITLE, $u, $perm, $_gv;
+ global $db, $me, $t, $STRING, $TITLE, $u, $perm, $_gv, $QUERY;
if (!ereg('^[0-9]+$',$bugid) or
- !$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
- 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")) {
+ !$row = $db->getRow(sprintf($QUERY['bug-show-bug'], $bugid))) {
show_text($STRING['bugbadnum'],true);
return;
}
Index: config-dist.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config-dist.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- config-dist.php 21 Mar 2002 13:44:54 -0000 1.10
+++ config-dist.php 29 Mar 2002 18:25:37 -0000 1.11
@@ -62,6 +62,7 @@
define ('ONEDAY', 86400);
+require_once (INSTALL_PATH.'/inc/db/'.DB_TYPE.'.php');
require_once (INSTALL_PATH.'/inc/auth.php');
require_once (INSTALL_PATH.'/inc/template.php');
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- config.php 21 Mar 2002 13:44:54 -0000 1.26
+++ config.php 29 Mar 2002 18:25:37 -0000 1.27
@@ -64,6 +64,7 @@
define ('ONEDAY', 86400);
+require_once (INSTALL_PATH.'/inc/db/'.DB_TYPE.'.php');
require_once (INSTALL_PATH.'/inc/auth.php');
require_once (INSTALL_PATH.'/inc/template.php');
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- include.php 28 Mar 2002 22:14:44 -0000 1.104
+++ include.php 29 Mar 2002 18:25:37 -0000 1.105
@@ -97,21 +97,19 @@
class templateclass extends Template {
function pparse($target, $handle, $append = false) {
- global $_sv, $perm, $db, $HTTP_COOKIE_VARS;
+ global $_sv, $perm, $db, $HTTP_COOKIE_VARS, $QUERY;
$u = isset($_sv['uid']) ? $_sv['uid'] : 0;
$this->set_block('wrap', 'logoutblock', 'loblock');
$this->set_block('wrap', 'loginblock', 'liblock');
$this->set_block('wrap', 'adminnavblock', 'anblock');
if ($u) {
- list($owner_open, $owner_closed) = $db->getRow("SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ,"
- ."sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END )"
- ."from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) where assigned_to = $u",
- DB_FETCHMODE_ORDERED);
- list($reporter_open, $reporter_closed) = $db->getRow("SELECT sum(CASE WHEN status_name in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END ) ,"
- ."sum(CASE WHEN status_name not in ('Unconfirmed','New','Assigned','Reopened') THEN 1 ELSE 0 END )"
- ."from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) where created_by = $u",
- DB_FETCHMODE_ORDERED);
+ list($owner_open, $owner_closed) =
+ $db->getRow(sprintf($QUERY['include-template-owner'], $u),
+ DB_FETCHMODE_ORDERED);
+ list($reporter_open, $reporter_closed) =
+ $db->getRow(sprintf($QUERY['include-template-reporter'], $u),
+ DB_FETCHMODE_ORDERED);
$this->set_var(array(
'loggedinas' => $_sv['uname'],
'liblock' => '',
Index: index.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/index.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- index.php 28 Mar 2002 22:26:06 -0000 1.26
+++ index.php 29 Mar 2002 18:25:37 -0000 1.27
@@ -125,24 +125,22 @@
$t->set_block('projectsummaryblock', 'projectrow', 'prows');
$t->set_block('projectrow', 'col', 'cols');
if (SHOW_PROJECT_SUMMARIES) {
- $querystring = 'select project_name as "Project", sum(case when resolution_id = 0 then 1 else 0 end) as "Open"';
+ $querystring = $QUERY['index-projsummary-1'];
$resfields = array('Project','Open');
// Grab the resolutions from the database
- $rs = $db->query("select resolution_name, ".
- db_concat("', sum(case when resolution_id = '", 'resolution_id',
- "' then 1 else 0 end) as \"'", 'resolution_name' ,"'\"'").
- " from ".TBL_RESOLUTION);
+ $rs = $db->query($QUERY['index-projsummary-2'].
+ db_concat($QUERY['index-projsummary-3'], 'resolution_id',
+ $QUERY['index-projsummary-4'], 'resolution_name' ,"'\"'").
+ $QUERY['index-projsummary-5']);
while (list($fieldname, $countquery) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$resfields[] = $fieldname;
$querystring .= $countquery;
}
$resfields[] = 'Total';
- $rs = $db->query("$querystring, count(bug_id) as \"Total\" from ".TBL_BUG.
- " b left join ".TBL_PROJECT." p using (project_id)".
- " where b.project_id not in ($restricted_projects) group by b.project_id,".
- " project_name order by project_name");
+ $rs = $db->query(sprintf($QUERY['index-projsummary-6'], $querystring,
+ $restricted_projects));
if (!$rs->numRows()) {
$t->set_var('projblock', '');
} else {
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- query.php 28 Mar 2002 19:13:21 -0000 1.64
+++ query.php 29 Mar 2002 18:25:37 -0000 1.65
@@ -156,7 +156,8 @@
function list_items($assignedto = 0, $reportedby = 0, $open = 0) {
global $me, $db, $t, $select, $TITLE, $STRING, $_gv, $u,
- $default_db_fields, $all_db_fields, $HTTP_SESSION_VARS, $HTTP_SERVER_VARS;
+ $default_db_fields, $all_db_fields, $HTTP_SESSION_VARS, $HTTP_SERVER_VARS,
+ $QUERY;
$t->set_file('content','buglist.html');
$t->set_block('content','row','rows');
@@ -196,10 +197,9 @@
$HTTP_SESSION_VARS['queryinfo'] = array();
}
- $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($HTTP_SESSION_VARS['queryinfo']['query']) ? "where {$HTTP_SESSION_VARS['queryinfo']['query']}": ''));
+ $nr = $db->getOne($QUERY['query-list-bugs-count'].
+ (!empty($HTTP_SESSION_VARS['queryinfo']['query'])
+ ? "where {$HTTP_SESSION_VARS['queryinfo']['query']}": ''));
$HTTP_SESSION_VARS['queryinfo']['numrows'] = $nr;
list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
@@ -213,20 +213,10 @@
'project' => build_select('project'),
'TITLE' => $TITLE['buglist']));
- $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
- 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 '.
- (!empty($HTTP_SESSION_VARS['queryinfo']['query']) ? "and {$HTTP_SESSION_VARS['queryinfo']['query']} " : '').
- "order by $order $sort, bug_id asc", $llimit, $selrange);
+ $rs = $db->limitQuery(sprintf($QUERY['query-list-bugs'],
+ (!empty($HTTP_SESSION_VARS['queryinfo']['query'])
+ ? "and {$HTTP_SESSION_VARS['queryinfo']['query']} " : ''),
+ $order, $sort), $llimit, $selrange);
$headers = array(
'bug_id' => 'bug_id',
Index: report.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/report.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- report.php 27 Mar 2002 18:01:33 -0000 1.21
+++ report.php 29 Mar 2002 18:25:37 -0000 1.22
@@ -25,21 +25,21 @@
include 'include.php';
function resolution_by_engineer($projectid = 0) {
- global $db, $t, $restricted_projects, $perm;
+ global $db, $t, $restricted_projects, $perm, $QUERY;
$t->set_block('content', 'row', 'rows');
$t->set_block('row', 'col', 'cols');
$t->set_var('reporttitle', 'Bug resolutions');
// Start off our query
- $querystring = 'select email as "Assigned To", sum(case when resolution_id = 0 then 1 else 0 end) as "Open"';
+ $querystring = $QUERY['report-resbyeng-1'];
$resfields = array('Assigned To','Open');
// Grab the resolutions from the database
- $rs = $db->query("select resolution_name, ".
- db_concat("', sum(case when resolution_id = '", 'resolution_id',
- "' then 1 else 0 end) as \"'", 'resolution_name' ,"'\"'").
- " from ".TBL_RESOLUTION);
+ $rs = $db->query($QUERY['report-resbyeng-2'].
+ db_concat($QUERY['report-resbyeng-3'], 'resolution_id',
+ $QUERY['report-resbyeng-4'], 'resolution_name' ,"'\"'").
+ $QUERY['report-resbyeng-5']);
while (list($fieldname, $countquery) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$resfields[] = $fieldname;
$querystring .= $countquery;
@@ -47,16 +47,16 @@
$resfields[] = 'Total';
if ($projectid && is_numeric($projectid)) {
- $projectquery = "where project_id = $projectid";
+ $projectquery = $QUERY['report-resbyeng-where']." project_id = $projectid";
} elseif (!$perm->have_perm('Admin')) {
- $projectquery = "where project_id not in ($restricted_projects)";
+ $projectquery = $QUERY['report-resbyeng-where'].
+ " project_id not in ($restricted_projects)";
} else {
$projectquery = '';
}
- $rs = $db->query("$querystring, count(bug_id) as \"Total\" from ".TBL_BUG.
- " b left join ".TBL_AUTH_USER." u on assigned_to = user_id $projectquery ".
- "group by assigned_to, u.email");
+ $rs = $db->query(sprintf($QUERY['report-resbyeng-6'], $querystring,
+ $projectquery));
if (!$rs->numRows()) {
$t->set_var('rows', 'No data to display');
} else {
|