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: Ken T. <ke...@us...> - 2003-10-12 05:13:59
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory sc8-pr-cvs1:/tmp/cvs-serv3270/templates/default
Modified Files:
Tag: htmltemplates
bugform.html
Log Message:
eliminate spaces at start of desc. field
Index: bugform.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugform.html,v
retrieving revision 1.9.4.2
retrieving revision 1.9.4.3
diff -u -r1.9.4.2 -r1.9.4.3
--- bugform.html 1 Sep 2003 13:38:31 -0000 1.9.4.2
+++ bugform.html 12 Oct 2003 05:13:54 -0000 1.9.4.3
@@ -48,7 +48,7 @@
<?php echo translate("Description"); ?>:
</td>
<td>
- <textarea name="description" cols="50" rows="8" wrap="virtual"> <?php echo htmlspecialchars(stripslashes($description)) ?></textarea>
+ <textarea name="description" cols="50" rows="8" wrap="virtual"><?php echo htmlspecialchars(stripslashes($description)) ?></textarea>
</td>
</tr>
<tr>
|
|
From: Benjamin C. <bc...@us...> - 2003-09-16 11:39:38
|
Update of /cvsroot/phpbt/phpbt/inc
In directory sc8-pr-cvs1:/tmp/cvs-serv1578/inc
Modified Files:
Tag: htmltemplates
functions.php
Log Message:
Cleanup, conversion to gettext
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v
retrieving revision 1.44.2.1
retrieving revision 1.44.2.2
diff -u -r1.44.2.1 -r1.44.2.2
--- functions.php 30 Aug 2003 22:10:52 -0000 1.44.2.1
+++ functions.php 16 Sep 2003 11:39:34 -0000 1.44.2.2
@@ -2,7 +2,7 @@
// functions.php - Set up global functions
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -25,29 +25,29 @@
///
/// Show text to the browser - escape hatch
function show_text($text, $iserror = false) {
- global $t;
+ global $t;
$t->assign(array(
'text' => $text,
'iserror' => $iserror
));
- $t->wrap('error.html');
+ $t->render('error.html', '');
}
$select['priority'] = array(
- 1 => '1 - Low',
- 2 => '2',
- 3 => '3 - Medium',
- 4 => '4',
- 5 => '5 - High'
- );
+ 1 => '1 - Low',
+ 2 => '2',
+ 3 => '3 - Medium',
+ 4 => '4',
+ 5 => '5 - High'
+ );
///
/// Build a select box with the item matching $value selected
function build_select($box, $selected = '', $project = 0) {
- global $db, $select, $perm, $STRING, $restricted_projects, $QUERY;
+ global $db, $select, $perm, $restricted_projects, $QUERY;
- // create hash to map tablenames
+ // create hash to map tablenames
$cfgDatabase = array(
'group' => TBL_AUTH_GROUP,
'project' => TBL_PROJECT,
@@ -58,267 +58,265 @@
'version' => TBL_VERSION,
'database' => TBL_DATABASE,
'site' => TBL_SITE
- );
+ );
- $text = '';
+ $text = '';
- if (isset($cfgDatabase[$box])) {
+ if (isset($cfgDatabase[$box])) {
$querystart = "select {$box}_id, {$box}_name from $cfgDatabase[$box]";
$querymid = ' where sort_order > 0 order by sort_order';
$queries = array(
- 'group' => $querystart.' where group_name <> \'User\' order by group_name',
- 'severity' => $querystart.$querymid,
- 'site' => $querystart.$querymid,
- 'status' => $querystart.$querymid,
- 'resolution' => $querystart.$querymid,
- 'project' => $perm->have_perm('Admin')
- ? $querystart." where ".
- ($selected ? "(active > 0 or project_id in ($selected))" : 'active > 0').
- " order by {$box}_name"
+ 'group' => $querystart.' where group_name <> \'User\' order by group_name',
+ 'severity' => $querystart.$querymid,
+ 'site' => $querystart.$querymid,
+ 'status' => $querystart.$querymid,
+ 'resolution' => $querystart.$querymid,
+ 'project' => $perm->have_perm('Admin')
+ ? $querystart." where ".
+ ($selected ? "(active > 0 or project_id in ($selected))" : 'active > 0').
+ " order by {$box}_name"
: $querystart." where project_id not in ($restricted_projects)".
- " and ".
- ($selected ? " (active > 0 or project_id in ($selected))" : 'active > 0').
- " order by {$box}_name",
- 'component' => $querystart." where project_id = $project and active = 1 order by {$box}_name",
- 'version' => $querystart." where project_id = $project and active = 1 order by {$box}_id desc",
- 'database' => $querystart.$querymid
+ " and ".
+ ($selected ? " (active > 0 or project_id in ($selected))" : 'active > 0').
+ " order by {$box}_name",
+ 'component' => $querystart." where project_id = $project and active = 1 order by {$box}_name",
+ 'version' => $querystart." where project_id = $project and active = 1 order by {$box}_id desc",
+ 'database' => $querystart.$querymid
);
- }
+ }
- switch($box) {
- case 'user_filter':
- foreach ($STRING['user_filter'] as $k => $v) {
- $text .= sprintf("<option value=\"%d\"%s>%s</option>",
- $k, ($k == $selected ? ' selected' : ''), $v);
- }
- break;
- case 'group':
- if ($project) { // If we are building for project admin page
- if (!count($selected) or (count($selected) && in_array(0, $selected))) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text = "<option value=\"all\"$sel>All Groups</option>";
- }
- $rs = $db->query($queries[$box]);
- while ($rs->fetchInto($row)) {
- if (count($selected) && in_array($row[$box.'_id'], $selected)) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= '<option value="'.
- $row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
- }
- break;
- case 'database': $text = '<option value="0">None</option>';
- case 'severity':
- case 'status':
- case 'resolution':
- case 'project':
- case 'site':
- case 'component':
- case 'version':
- $rs = $db->query($queries[$box]);
- while ($rs->fetchInto($row)) {
- if ($selected == $row[$box.'_id'] and $selected != '') {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= '<option value="'.
- $row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
- }
- break;
- 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 ($selected == '' and isset($row['Regex']) and
- preg_match($row['Regex'],$GLOBALS['HTTP_USER_AGENT'])) {
- $sel = ' selected';
- } elseif ($selected == $row[$box.'_id']) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= '<option value="'.$row[$box.'_id']."\"$sel>".$row[$box.'_name']."</option>";
- }
- break;
- 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 g.assignable > 0 order by login");
- while ($rs->fetchInto($row)) {
- // either singular matches, or array matches are acceptable
- if (($selected == $row['user_id']) || in_array($row['user_id'], $selected)) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= "<option value=\"{$row['user_id']}\"$sel>".
- maskemail($row['login'])."</option>";
- }
- break;
- case 'reporter':
- global $u;
- $rs = $db->query("select u.user_id, login from ".TBL_AUTH_USER." u where u.active > 0 order by login");
- while ($rs->fetchInto($row)) {
- // either singular matches, or array matches are acceptable
- if ($u == $row['user_id']) {
- $sel = ' selected';
- } else {
- $sel = '';
+ switch($box) {
+ case 'user_filter':
+ foreach ($STRING['user_filter'] as $k => $v) {
+ $text .= sprintf("<option value=\"%d\"%s>%s</option>",
+ $k, ($k == $selected ? ' selected' : ''), $v);
+ }
+ break;
+ case 'group':
+ if ($project) { // If we are building for project admin page
+ if (!count($selected) or (count($selected) && in_array(0, $selected))) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text = "<option value=\"all\"$sel>All Groups</option>";
+ }
+ $rs = $db->query($queries[$box]);
+ while ($rs->fetchInto($row)) {
+ if (count($selected) && in_array($row[$box.'_id'], $selected)) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= '<option value="'.
+ $row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
+ }
+ break;
+ case 'database': $text = '<option value="0">None</option>';
+ case 'severity':
+ case 'status':
+ case 'resolution':
+ case 'project':
+ case 'site':
+ case 'component':
+ case 'version':
+ $rs = $db->query($queries[$box]);
+ while ($rs->fetchInto($row)) {
+ if ($selected == $row[$box.'_id'] and $selected != '') {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= '<option value="'.
+ $row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
+ }
+ break;
+ 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 ($selected == '' and isset($row['Regex']) and
+ preg_match($row['Regex'],$GLOBALS['HTTP_USER_AGENT'])) {
+ $sel = ' selected';
+ } elseif ($selected == $row[$box.'_id']) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= '<option value="'.$row[$box.'_id']."\"$sel>".$row[$box.'_name']."</option>";
+ }
+ break;
+ 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 g.assignable > 0 order by login");
+ while ($rs->fetchInto($row)) {
+ // either singular matches, or array matches are acceptable
+ if (($selected == $row['user_id']) || in_array($row['user_id'], $selected)) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"{$row['user_id']}\"$sel>".
+ maskemail($row['login'])."</option>";
+ }
+ break;
+ case 'reporter':
+ global $u;
+ $rs = $db->query("select u.user_id, login from ".TBL_AUTH_USER." u where u.active > 0 order by login");
+ while ($rs->fetchInto($row)) {
+ // either singular matches, or array matches are acceptable
+ if ($u == $row['user_id']) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"{$row['user_id']}\"$sel>".
+ maskemail($row['login'])."</option>";
+ }
+ break;
+ case 'bug_cc':
+ $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>';
+ }
+ // Pad the sucker
+ $text .= '<option value="" disabled>';
+ for ($i = 0; $i < 30; $i++) {
+ $text .= ' ';
+ }
+ $text .= '</option>';
+ break;
+ case 'LANGUAGE' :
+ $dir = opendir('languages');
+ while (false !== ($file = readdir($dir))) {
+ if ($file != '.' && $file != '..' && $file != 'CVS' && substr($file, -3) == 'php') {
+ $filelist[] = str_replace('.php', '', $file);
+ }
+ }
+ closedir($dir);
+ sort($filelist);
+ foreach ($filelist as $file) {
+ if ($file == $selected) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"$file\"$sel>$file</option>";
+ }
+ break;
+ case 'THEME' :
+ $dir = opendir('templates');
+ while (false !== ($file = readdir($dir))) {
+ if ($file != '.' && $file != '..' && $file != 'CVS') {
+ $filelist[] = str_replace('.php', '', $file);
+ }
+ }
+ closedir($dir);
+ sort($filelist);
+ foreach ($filelist as $file) {
+ if ($file == $selected) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"$file\"$sel>$file</option>";
+ }
+ break;
+ case 'STYLE' :
+ $dir = opendir('styles');
+ while (false !== ($file = readdir($dir))) {
+ if ($file != '.' && $file != '..' && $file != 'CVS') {
+ $filelist[] = str_replace('.css', '', $file);
+ }
+ }
+ closedir($dir);
+ sort($filelist);
+ foreach ($filelist as $file) {
+ if ($file == $selected) {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"$file\"$sel>$file</option>";
+ }
+ break;
+ case 'BUG_UNCONFIRMED' :
+ case 'BUG_PROMOTED' :
+ case 'BUG_ASSIGNED' :
+ case 'BUG_REOPENED' :
+ case 'BUG_CLOSED' :
+ static $bug_status_list = array();
+
+ if (empty($bug_status_list)) {
+ $bug_status_list = $db->getAssoc("select status_id, status_name from ".TBL_STATUS." order by status_name");
+ }
+ foreach ($bug_status_list as $id => $name) {
+ $sel = $id == $selected ? ' selected' : '';
+ $text .= "<option value=\"$id\"$sel>$name</option>";
+ }
+ break;
+ case 'GROUP_ASSIGN_TO' :
+ static $group_list = array();
+
+ if (empty($group_list)) {
+ $group_list = $db->getAssoc("select group_id, group_name from ".TBL_AUTH_GROUP." order by group_name");
+ }
+ foreach ($group_list as $id => $name) {
+ $sel = $id == $selected ? ' selected' : '';
+ $text .= "<option value=\"$id\"$sel>$name</option>";
+ }
+ break;
+ default :
+ $deadarray = $select[$box];
+ while(list($val,$item) = each($deadarray)) {
+ if ($selected == $val and $selected != '') {
+ $sel = ' selected';
+ } else {
+ $sel = '';
+ }
+ $text .= "<option value=\"$val\"$sel>$item</option>";
}
- $text .= "<option value=\"{$row['user_id']}\"$sel>".
- maskemail($row['login'])."</option>";
- }
- break;
- case 'bug_cc':
- $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>';
- }
- // Pad the sucker
- $text .= '<option value="" disabled>';
- for ($i = 0; $i < 30; $i++) {
- $text .= ' ';
- }
- $text .= '</option>';
- break;
- case 'LANGUAGE' :
- $dir = opendir('languages');
- while (false !== ($file = readdir($dir))) {
- if ($file != '.' && $file != '..' && $file != 'CVS' && substr($file, -3) == 'php') {
- $filelist[] = str_replace('.php', '', $file);
- }
- }
- closedir($dir);
- sort($filelist);
- foreach ($filelist as $file) {
- if ($file == $selected) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= "<option value=\"$file\"$sel>$file</option>";
- }
- break;
- case 'THEME' :
- $dir = opendir('templates');
- while (false !== ($file = readdir($dir))) {
- if ($file != '.' && $file != '..' && $file != 'CVS') {
- $filelist[] = str_replace('.php', '', $file);
- }
- }
- closedir($dir);
- sort($filelist);
- foreach ($filelist as $file) {
- if ($file == $selected) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= "<option value=\"$file\"$sel>$file</option>";
- }
- break;
- case 'STYLE' :
- $dir = opendir('styles');
- while (false !== ($file = readdir($dir))) {
- if ($file != '.' && $file != '..' && $file != 'CVS') {
- $filelist[] = str_replace('.css', '', $file);
- }
- }
- closedir($dir);
- sort($filelist);
- foreach ($filelist as $file) {
- if ($file == $selected) {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= "<option value=\"$file\"$sel>$file</option>";
- }
- break;
- case 'BUG_UNCONFIRMED' :
- case 'BUG_PROMOTED' :
- case 'BUG_ASSIGNED' :
- case 'BUG_REOPENED' :
- case 'BUG_CLOSED' :
- static $bug_status_list = array();
-
- if (empty($bug_status_list)) {
- $bug_status_list = $db->getAssoc("select status_id, status_name".
- " from ".TBL_STATUS." order by status_name");
- }
- foreach ($bug_status_list as $id => $name) {
- $sel = $id == $selected ? ' selected' : '';
- $text .= "<option value=\"$id\"$sel>$name</option>";
- }
- break;
- case 'GROUP_ASSIGN_TO' :
- static $group_list = array();
-
- if (empty($group_list)) {
- $group_list = $db->getAssoc("select group_id, group_name".
- " from ".TBL_AUTH_GROUP." order by group_name");
- }
- foreach ($group_list as $id => $name) {
- $sel = $id == $selected ? ' selected' : '';
- $text .= "<option value=\"$id\"$sel>$name</option>";
- }
- break;
- default :
- $deadarray = $select[$box];
- while(list($val,$item) = each($deadarray)) {
- if ($selected == $val and $selected != '') {
- $sel = ' selected';
- } else {
- $sel = '';
- }
- $text .= "<option value=\"$val\"$sel>$item</option>";
- }
- break;
- }
- echo ($text);
+ break;
+ }
+ echo ($text);
}
///
/// Return human-friendly text for a value
function lookup($var, $val) {
- global $db;
+ global $db;
- switch($var) {
- case 'assigned_to' :
- return maskemail($db->getOne("select login from ".TBL_AUTH_USER." where user_id = $val"));
- break;
- }
+ switch($var) {
+ case 'assigned_to' :
+ return maskemail($db->getOne("select login from ".TBL_AUTH_USER." where user_id = $val"));
+ break;
+ }
}
///
/// Divide the results of a database query into multiple pages
function multipages($nr, $page, $urlstr) {
- global $me, $selrange, $t, $u, $db, $perm;
+ global $me, $selrange, $t, $u, $db, $perm;
- $pages = '';
- if (!$page) $page = 1;
- if ($page == 'all') {
- $selrange = $nr;
- $llimit = 0;
- $page = 0;
- } else {
- if ($perm->check_auth('group', 'Users'))
- $selrange = $db->getOne('select def_results from '.TBL_USER_PREF.' where user_id = '.$u);
- $llimit = ($page-1)*$selrange;
- }
- if ($nr) $npages = ceil($nr/$selrange);
- else $npages = 0;
- if ($npages == 1) $pages = 1;
- else {
- for ($i=1; $i<=$npages; $i++) {
- $pages .= $i != $page ? " <a href='$me?page=$i&$urlstr'>$i</a> " : " $i ";
- $pages .= $i != $npages ? '|' : '';
- }
- }
+ $pages = '';
+ if (!$page) $page = 1;
+ if ($page == 'all') {
+ $selrange = $nr;
+ $llimit = 0;
+ $page = 0;
+ } else {
+ if ($perm->check_auth('group', 'Users'))
+ $selrange = $db->getOne('select def_results from '.TBL_USER_PREF.' where user_id = '.$u);
+ $llimit = ($page-1)*$selrange;
+ }
+ if ($nr) $npages = ceil($nr/$selrange);
+ else $npages = 0;
+ if ($npages == 1) $pages = 1;
+ else {
+ for ($i=1; $i<=$npages; $i++) {
+ $pages .= $i != $page ? " <a href='$me?page=$i&$urlstr'>$i</a> " : " $i ";
+ $pages .= $i != $npages ? '|' : '';
+ }
+ }
$t->assign(array(
'pages' => $pages,
'first' => $llimit+1,
@@ -326,21 +324,21 @@
'total' => $nr
));
- return array($selrange, $llimit);
+ return array($selrange, $llimit);
}
///
/// Sets variables in the templates for the column headers to sort database results
function sorting_headers($url, $headers, $order, $sort, $urlstr = '') {
- global $t;
+ global $t;
- while(list($k, $v) = each($headers)) {
+ while(list($k, $v) = each($headers)) {
$theader[$k]['url'] = "$url?order=$v&sort=".
- ($order == $v ? ($sort == 'asc' ? 'desc' : 'asc') : 'asc').
- ($urlstr ? '&'.$urlstr : '');
- $theader[$k]['color'] = $order == $v ? '#bbbbbb' : '#eeeeee';
- $theader[$k]['class'] = $order == $v ? 'selected' : '';
- }
+ ($order == $v ? ($sort == 'asc' ? 'desc' : 'asc') : 'asc').
+ ($urlstr ? '&'.$urlstr : '');
+ $theader[$k]['color'] = $order == $v ? '#bbbbbb' : '#eeeeee';
+ $theader[$k]['class'] = $order == $v ? 'selected' : '';
+ }
$t->assign('headers', $theader);
}
@@ -349,93 +347,91 @@
/// (From zend.com user Rival7)
function genpassword($length){
- srand((double)microtime()*1000000);
+ srand((double)microtime()*1000000);
- $vowels = array("a", "e", "i", "o", "u");
- $cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", "cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl");
- $password = '';
+ $vowels = array("a", "e", "i", "o", "u");
+ $cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", "cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl");
+ $password = '';
- $num_vowels = count($vowels);
- $num_cons = count($cons);
+ $num_vowels = count($vowels);
+ $num_cons = count($cons);
- for($i = 0; $i < $length; $i++){
- $password .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)];
- }
+ for($i = 0; $i < $length; $i++){
+ $password .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)];
+ }
- return substr($password, 0, $length);
+ return substr($password, 0, $length);
}
///
/// Wrap text - Picked up somewhere on the net - probably zend.com
function textwrap($text, $wrap=72, $break="\n"){
- $len = strlen($text);
- if ($len > $wrap) {
- $h = '';
- $lastWhite = 0;
- $lastChar = 0;
- $lastBreak = 0;
- while ($lastChar < $len) {
- $char = substr($text, $lastChar, 1);
- if (($lastChar - $lastBreak > $wrap) && ($lastWhite > $lastBreak)) {
- $h .= substr($text, $lastBreak, ($lastWhite - $lastBreak)) . $break;
- $lastChar = $lastWhite + 1;
- $lastBreak = $lastChar;
- }
- /* You may wish to include other characters as valid whitespace... */
- if ($char == ' ' || $char == chr(13) || $char == chr(10))
- $lastWhite = $lastChar;
- $lastChar = $lastChar + 1;
- }
- $h .= substr($text, $lastBreak);
- }
- else $h = $text;
- return $h;
+ $len = strlen($text);
+ if ($len > $wrap) {
+ $h = '';
+ $lastWhite = 0;
+ $lastChar = 0;
+ $lastBreak = 0;
+ while ($lastChar < $len) {
+ $char = substr($text, $lastChar, 1);
+ if (($lastChar - $lastBreak > $wrap) && ($lastWhite > $lastBreak)) {
+ $h .= substr($text, $lastBreak, ($lastWhite - $lastBreak)) . $break;
+ $lastChar = $lastWhite + 1;
+ $lastBreak = $lastChar;
+ }
+ /* You may wish to include other characters as valid whitespace... */
+ if ($char == ' ' || $char == chr(13) || $char == chr(10))
+ $lastWhite = $lastChar;
+ $lastChar = $lastChar + 1;
+ }
+ $h .= substr($text, $lastBreak);
+ }
+ else $h = $text;
+ return $h;
}
///
/// Return a delimited list if there is more than one element in $ary, otherwise
/// return the lone element as the list
function delimit_list($delimiter, $ary) {
- if (isset($ary[1])) return join($delimiter, $ary);
- elseif (isset($ary[0])) return ($ary[0]);
- else return '';
+ if (isset($ary[1])) return join($delimiter, $ary);
+ elseif (isset($ary[0])) return ($ary[0]);
+ else return '';
}
///
/// Check the validity of an email address
/// (From zend.com user russIndr)
function bt_valid_email($email) {
- return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email);
+ return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email);
}
///
/// If the constant is set do a little email masking to make harvesting a little harder
function maskemail($email) {
- global $_sv;
- if (HIDE_EMAIL && empty($_sv['uid'])) {
- return '******';
- } elseif (MASK_EMAIL) {
- return str_replace('@', ' at ', str_replace('.', ' dot ', $email));
- } else {
- return $email;
- }
+ if (HIDE_EMAIL && empty($_SESSION['uid'])) {
+ return '******';
+ } elseif (MASK_EMAIL) {
+ return str_replace('@', ' at ', str_replace('.', ' dot ', $email));
+ } else {
+ return $email;
+ }
}
///
/// Build the javascript for the dynamic project -> component -> version select boxes
function build_project_js($no_all = false) {
- global $db, $u, $perm, $_sv, $QUERY;
+ global $db, $u, $perm, $QUERY;
$js = ''; $js2 = '';
// Build the javascript-powered select boxes
if ($perm->have_perm('Admin')) {
- $rs = $db->query("select project_id, project_name from ".TBL_PROJECT.
- " where active = 1 order by project_name");
+ $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'],
- delimit_list(',', $_sv['group_ids'])));
+ @join(',', $_SESSION['group_ids'])));
}
while (list($pid, $pname) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
$pname = addslashes($pname);
@@ -445,8 +441,7 @@
$js2 = "closedversions['$pname'] = new Array(".
((!isset($no_all) or !$no_all) ? "new Array('','All'),"
: "new Array(0, 'Choose One'),");
- $rs2 = $db->query("select version_name, version_id from ".TBL_VERSION.
- " where project_id = $pid and active = 1");
+ $rs2 = $db->query("select version_name, version_id from ".TBL_VERSION." where project_id = $pid and active = 1");
while (list($version,$vid) = $rs2->fetchRow(DB_FETCHMODE_ORDERED)) {
$version = addslashes($version);
$js .= "new Array($vid,'$version'),";
@@ -461,8 +456,7 @@
// Component array
$js .= "components['$pname'] = new Array(";
$js .= (!isset($no_all) || !$no_all) ? "new Array('','All')," : '';
- $rs2 = $db->query("select component_name, component_id from ".TBL_COMPONENT.
- " where project_id = $pid and active = 1");
+ $rs2 = $db->query("select component_name, component_id from ".TBL_COMPONENT." where project_id = $pid and active = 1");
while (list($comp,$cid) = $rs2->fetchRow(DB_FETCHMODE_ORDERED)) {
$comp = addslashes($comp);
$js .= "new Array($cid,'$comp'),";
@@ -486,8 +480,8 @@
case 'ibase' : $retstr = delimit_list(' || ', $pieces); break;
case 'fbsql' : $retstr = 'CONCAT('. delimit_list(', ', $pieces).')'; break;
default : $retstr = delimit_list(' + ', $pieces); break;
- }
- return $retstr;
+ }
+ return $retstr;
}
// Dump a var
@@ -517,79 +511,79 @@
wise it's not converted and it's returned as space (32 decimal). */
function qp_enc($input, $line_max = 76) {
- // Initialize variables
- $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
- $eol = "\n";
- $escape = "=";
- $output = "";
- // Do "dos2unix" and split $input into $lines by end of line
- $lines = split("\n", str_replace("\r\n", "\n", $input));
- // Loop throught $lines
- while( list(, $line) = each($lines) ) {
- // Trim each line from right side
- $line = rtrim($line);
- // Place line length to $linlen
- $linlen = strlen($line);
- // Initialize $newline
- $newline = "";
- // Loop throught each line and process each character of the line
- for($i = 0; $i < $linlen; $i++) {
- // Place each character of $line to $c
- $c = substr($line, $i, 1);
- // Place decimal value of $c to $dec
- $dec = ord($c);
- // If $c equals to space (" ") and we are at the end of line place
- // space (" ") to $c
- if (($dec == 32) && ($i == ($linlen - 1))) {
- $c = "=20";
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
- // Or if $c is not printable character in ascii, convert the
- // character to it's quoted-printable value
- $h2 = floor($dec/16); $h1 = floor($dec%16);
- $c = $escape.$hex["$h2"].$hex["$h1"];
- }
- // If we are at the maximum line length, add whole line (converted)
- // with end of line character to $output
- if ( (strlen($newline) + strlen($c)) >= $line_max ) {
- $output .= $newline.$escape.$eol;
- // And initialize $newline as empty
+ // Initialize variables
+ $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+ $eol = "\n";
+ $escape = "=";
+ $output = "";
+ // Do "dos2unix" and split $input into $lines by end of line
+ $lines = split("\n", str_replace("\r\n", "\n", $input));
+ // Loop throught $lines
+ while( list(, $line) = each($lines) ) {
+ // Trim each line from right side
+ $line = rtrim($line);
+ // Place line length to $linlen
+ $linlen = strlen($line);
+ // Initialize $newline
$newline = "";
- }
- // Add converted (or ascii) character to $newline
- $newline .= $c;
- }
- // Add $newline with end of line character to output
- $output .= $newline.$eol;
- }
- // Return trimmed output
- return (trim($output));
+ // Loop throught each line and process each character of the line
+ for($i = 0; $i < $linlen; $i++) {
+ // Place each character of $line to $c
+ $c = substr($line, $i, 1);
+ // Place decimal value of $c to $dec
+ $dec = ord($c);
+ // If $c equals to space (" ") and we are at the end of line place
+ // space (" ") to $c
+ if (($dec == 32) && ($i == ($linlen - 1))) {
+ $c = "=20";
+ } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
+ // Or if $c is not printable character in ascii, convert the
+ // character to it's quoted-printable value
+ $h2 = floor($dec/16); $h1 = floor($dec%16);
+ $c = $escape.$hex["$h2"].$hex["$h1"];
+ }
+ // If we are at the maximum line length, add whole line (converted)
+ // with end of line character to $output
+ if ( (strlen($newline) + strlen($c)) >= $line_max ) {
+ $output .= $newline.$escape.$eol;
+ // And initialize $newline as empty
+ $newline = "";
+ }
+ // Add converted (or ascii) character to $newline
+ $newline .= $c;
+ }
+ // Add $newline with end of line character to output
+ $output .= $newline.$eol;
+ }
+ // Return trimmed output
+ return (trim($output));
}
// mailer with use of quoted-printable encoding (if configured so)
function qp_mail($to, $subject = 'No subject', $body, $headers = '') {
- global $STRING;
+ global $STRING;
- if ($headers != '') {
- $headers .= "\n";
- // There have to be no newline at the end of $headers
- }
+ if ($headers != '') {
+ $headers .= "\n";
+ // There have to be no newline at the end of $headers
+ }
if (false/*HTML_EMAIL*/) {
$headers .= "Content-Type: text/html; charset=\"".$STRING['lang_charset']."\"\nContent-Transfer-Encoding: ";
} else {
$headers .= "Content-Type: text/plain; charset=\"".$STRING['lang_charset']."\"\nContent-Transfer-Encoding: ";
}
- // If configured to send MIME encoded emails
- if (SEND_MIME_EMAIL) {
- $retval = mail ($to, $subject, qp_enc($body), $headers.
- "quoted-printable\nMIME-Version: 1.0");
- } else {
- $retval = mail ($to, $subject, $body, $headers.
- "8bit");
- }
+ // If configured to send MIME encoded emails
+ if (SEND_MIME_EMAIL) {
+ $retval = mail ($to, $subject, qp_enc($body), $headers.
+ "quoted-printable\nMIME-Version: 1.0");
+ } else {
+ $retval = mail ($to, $subject, $body, $headers.
+ "8bit");
+ }
- // Returns true if mail is eccepted for delivery, otherwise return false
- return ($retval);
+ // Returns true if mail is eccepted for delivery, otherwise return false
+ return ($retval);
}
function translate($string, $plural = false) {
@@ -603,13 +597,13 @@
// Generate a testable WHERE expression for closed bugs
function in_closed($column) {
global $db;
-
+
$closed_statuses = array(0);
-
+
foreach($db->getAll('SELECT status_id FROM '.TBL_STATUS.' WHERE bug_open = 0') as $row) {
$closed_statuses[] = (int)$row['status_id'];
}
-
+
return '('.$column.' in ('.(@join(', ', $closed_statuses)).'))';
}
|
|
From: Benjamin C. <bc...@us...> - 2003-09-16 11:39:38
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv1578
Modified Files:
Tag: htmltemplates
query.php user.php
Log Message:
Cleanup, conversion to gettext
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.98.2.1
retrieving revision 1.98.2.2
diff -u -r1.98.2.1 -r1.98.2.2
--- query.php 30 Aug 2003 22:07:12 -0000 1.98.2.1
+++ query.php 16 Sep 2003 11:39:33 -0000 1.98.2.2
@@ -2,7 +2,7 @@
// query.php - Query the bug database
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -27,8 +27,7 @@
function delete_saved_query($queryid) {
global $db, $u, $me;
- $db->query("delete from ".TBL_SAVED_QUERY." where user_id = $u
- and saved_query_id = $queryid");
+ $db->query("delete from ".TBL_SAVED_QUERY." where user_id = $u and saved_query_id = $queryid");
if (!empty($_GET['form']) and $_GET['form'] == 'advanced') {
header("Location: $me?op=query&form=advanced");
} else {
@@ -37,7 +36,7 @@
}
function show_query() {
- global $db, $t, $TITLE, $u;
+ global $db, $t, $u;
if ($u != 'nobody') {
// Grab the saved queries if there are any
@@ -47,9 +46,9 @@
// Show the advanced query form
if (!empty($_GET['form']) and $_GET['form'] == 'advanced') {
- $t->render('queryform.html', translate('Query Bugs'));
+ $t->render('queryform.html', translate("Query Bugs"));
} else { // or show the simple one
- $t->render('queryform-simple.html', translate('Query Bugs'));
+ $t->render('queryform-simple.html', translate("Query Bugs"));
}
}
@@ -138,7 +137,7 @@
switch (${$searchfield."_type"}) {
case 'like' : $cond = "like '%".$$searchfield."%'"; break;
case 'rlike' : $cond = "rlike '".$$searchfield."'"; break;
- case 'not rlike' :$cond = "not rlike '".$$searchfield."'"; break;
+ case 'not rlike' : $cond = "not rlike '".$$searchfield."'"; break;
}
$fields[] = "$searchfield $cond".
($searchfield == 'description'
@@ -210,8 +209,7 @@
}
function list_items($assignedto = 0, $reportedby = 0, $open = 0) {
- global $me, $db, $t, $select, $TITLE, $STRING, $u,
- $default_db_fields, $all_db_fields, $QUERY;
+ global $me, $db, $t, $select, $u, $default_db_fields, $all_db_fields, $QUERY;
$query_db_fields = array(
'bug_id' => 'bug_id',
@@ -274,18 +272,11 @@
$savedquerystring = ereg_replace('&savedqueryname=.*(&?)', '\1', $_SERVER['QUERY_STRING']);
$savedquerystring .= '&op=doquery';
if ($savedqueryoverride) { // Updating an existing query
- $db->query("update ".TBL_SAVED_QUERY." set saved_query_string = ".
- $db->quote(stripslashes($savedquerystring)).
- " where user_id = $u and saved_query_name = ".
- $db->quote(stripslashes($savedqueryname)));
+ $db->query("update ".TBL_SAVED_QUERY." set saved_query_string = ".$db->quote(stripslashes($savedquerystring))." where user_id = $u and saved_query_name = ".$db->quote(stripslashes($savedqueryname)));
} else { // Adding a new saved query
$nextid = $db->getOne("select max(saved_query_id)+1 from ".TBL_SAVED_QUERY." where user_id = $u");
$nextid = $nextid ? $nextid : 1;
- $db->query("insert into ".TBL_SAVED_QUERY.
- " (saved_query_id, user_id, saved_query_name, saved_query_string)
- values (".join(', ', array($nextid, $u,
- $db->quote(stripslashes($savedqueryname)),
- $db->quote(stripslashes($savedquerystring)))).")");
+ $db->query("insert into ".TBL_SAVED_QUERY." (saved_query_id, user_id, saved_query_name, saved_query_string) values (".join(', ', array($nextid, $u, $db->quote(stripslashes($savedqueryname)), $db->quote(stripslashes($savedquerystring)))).")");
}
}
if (!isset($order)) {
@@ -297,11 +288,8 @@
$sort = 'asc';
}
}
- if (!session_is_registered('queryinfo')) {
- session_register('queryinfo');
- $_SESSION['queryinfo'] = array();
- }
-
+
+ if (empty($_SESSION['queryinfo'])) $_SESSION['queryinfo'] = array();
$_SESSION['queryinfo']['order'] = $order;
$_SESSION['queryinfo']['sort'] = $sort;
@@ -319,7 +307,7 @@
list($selrange, $llimit) = multipages($nr, $page, "order=$order&sort=$sort");
$desired_fields = !empty($_SESSION['db_fields']) ?
- $_SESSION['db_fields'] : $default_db_fields;
+ $_SESSION['db_fields'] : $default_db_fields;
$query_fields = array('bug_id as bug_link_id', 'severity.severity_color');
foreach ($desired_fields as $field) {
@@ -341,7 +329,7 @@
sorting_headers($me, $headers, $order, $sort, "page=$page".
(!empty($paramstr) ? $paramstr : ''));
- $t->render('buglist.html', translate('Bug List'));
+ $t->render('buglist.html', translate("Bug List"));
}
$reportedby = !empty($_GET['reportedby']) ? $_GET['reportedby'] : 0;
@@ -351,8 +339,14 @@
if (isset($_GET['op'])) switch($_GET['op']) {
case 'query' : show_query(); break;
case 'doquery' : $_SESSION['queryinfo'] = array(); list_items(); break;
- case 'delquery' : delete_saved_query($_GET['queryid']); break;
- case 'mybugs' : list_items($assignedto, $reportedby, $open); break;
+ case 'delquery' :
+ if ($auth->is_authenticated()) delete_saved_query($_GET['queryid']);
+ else show_query();
+ break;
+ case 'mybugs' :
+ if ($auth->is_authenticated()) list_items($assignedto, $reportedby, $open);
+ else show_query();
+ break;
default : show_query(); break;
}
else list_items($assignedto, $reportedby, $open);
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/user.php,v
retrieving revision 1.28.4.1
retrieving revision 1.28.4.2
diff -u -r1.28.4.1 -r1.28.4.2
--- user.php 30 Aug 2003 22:07:12 -0000 1.28.4.1
+++ user.php 16 Sep 2003 11:39:34 -0000 1.28.4.2
@@ -10,12 +10,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// phpBugTracker is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with phpBugTracker; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -25,137 +25,139 @@
include 'include.php';
function delete_vote($bug_id) {
- global $db, $u, $me, $now;
-
- $db->query("delete from ".TBL_BUG_VOTE." where user_id = $u and bug_id = $bug_id");
- header("Location: $me?r=$now");
+ global $db, $u, $me, $now;
+
+ $db->query("delete from ".TBL_BUG_VOTE." where user_id = $u and bug_id = $bug_id");
+ header("Location: $me?r=$now");
}
function change_bug_list_columns($column_list) {
- global $db, $u, $t, $HTTP_SESSION_VARS, $STRING;
-
- $HTTP_SESSION_VARS['db_fields'] = $column_list;
- $column_list = serialize($column_list);
- $db->query("update ".TBL_AUTH_USER." set bug_list_fields = '$column_list' where user_id = $u");
- show_text($STRING['USER_PREF']['ColumnPreferencesSaved']);
+ global $db, $u, $t;
+
+ $_SESSION['db_fields'] = $column_list;
+ $column_list = serialize($column_list);
+ $db->query("update ".TBL_AUTH_USER." set bug_list_fields = '$column_list' where user_id = $u");
+ show_text(translate("Your bug list column preferences have been saved"));
}
function change_password($pass1, $pass2) {
- global $t, $db, $u, $STRING;
+ global $t, $db, $u;
+
+ if (!$pass1 = trim($pass1)) {
+ $error = translate("Please enter a password");
+ } elseif ($pass1 != $pass2) {
+ $error = translate("Those passwords don't match -- please try again");
+ } else {
+ $error = false;
+ }
+
+ if ($error) {
+ show_preferences_form($error);
+ return;
+ }
+
+ if (ENCRYPT_PASS) {
+ $mpassword = md5($pass1);
+ } else {
+ $mpassword = $pass1;
+ }
- if (!$pass1 = trim($pass1)) {
- $error = $STRING['givepassword'];
- } elseif ($pass1 != $pass2) {
- $error = $STRING['passwordmatch'];
- } else {
- $error = false;
- }
-
- if ($error) {
- show_preferences_form($error);
- return;
- }
-
- if (ENCRYPT_PASS) {
- $mpassword = md5($pass1);
- } else {
- $mpassword = $pass1;
- }
+ $db->query("update ".TBL_AUTH_USER." set password = '$mpassword' where user_id = $u");
- $db->query("update ".TBL_AUTH_USER." set password = '$mpassword' where user_id = $u");
- $t->assign('changetext', translate('Password changed'));
- $t->render('changessaved.html', translate('Changes Saved'));
+ $t->assign('changetext', translate("Password changed"));
+ $t->render('changessaved.html', translate("Changes Saved"));
}
// Save changes to a user's preferences
function change_preferences($prefs) {
- global $db, $u, $t, $STRING;
+ global $db, $u, $t;
- $updates = array();
- $old_prefs = $db->getRow("select * from ".TBL_USER_PREF." where user_id = $u");
+ $updates = array();
+ $old_prefs = $db->getRow("select * from ".TBL_USER_PREF." where user_id = $u");
- array_shift($old_prefs); // Drop the user_id field
- $updates = array();
- foreach ($old_prefs as $pref => $val) {
- if ($pref == 'def_results') continue;
- if (in_array($pref, $prefs) and !$val) {
- $updates[] = "$pref = 1";
- } elseif (!in_array($pref, $prefs) and $val) {
- $updates[] = "$pref = 0";
+ array_shift($old_prefs); // Drop the user_id field
+ $updates = array();
+ foreach ($old_prefs as $pref => $val) {
+ if ($pref == 'def_results') continue;
+ if (in_array($pref, $prefs) and !$val) {
+ $updates[] = "$pref = 1";
+ } elseif (!in_array($pref, $prefs) and $val) {
+ $updates[] = "$pref = 0";
+ }
}
- }
$updates[] = 'def_results = '.(int)$prefs['def_results']; // override previous set
-
- if (count($updates)) {
- $db->query("update ".TBL_USER_PREF.' set '.@join(', ', $updates).
- " where user_id = $u");
- }
- $t->assign('changetext', translate('Preferences changed'));
- $t->render('changessaved.html', translate('Changes Saved'));
+ if (count($updates)) {
+ $db->query("update ".TBL_USER_PREF.' set '.@join(', ', $updates)." where user_id = $u");
+ }
+
+ $t->assign('changetext', translate("Preferences changed"));
+ $t->render('changessaved.html', translate("Changes Saved"));
}
function show_preferences_form($error = '') {
- global $t, $all_db_fields, $default_db_fields, $_sv, $db, $u, $STRING;
+ global $t, $all_db_fields, $default_db_fields, $db, $u;
- // Display the votes (if any)
- $t->assign('votes',
- $db->getAll("select * from ".TBL_BUG_VOTE." where user_id = $u"));
-
- // Display current preference settings
- $pref_labels = array(
- 'email_notices' => $STRING['USER_PREF']['ReceiveNotifications'],
- 'saved_queries' => $STRING['USER_PREF']['ShowSavedQueries']
- );
-
- $prefs = $db->getRow("select * from ".TBL_USER_PREF." where user_id = $u");
- foreach ($pref_labels as $pref => $label) {
- $preferences[] = array(
- 'pref' => $pref,
- 'label' => $label,
- 'checked' => $prefs[$pref]
- );
+ // Display the votes (if any)
+ $t->assign('votes',
+ $db->getAll("select * from ".TBL_BUG_VOTE." where user_id = $u"));
+
+ // Display current preference settings
+ $pref_labels = array(
+ 'email_notices' => translate("Receive notifications of bug changes via email"),
+ 'saved_queries' => translate("Show saved queries on the homepage")
+ );
+
+ $prefs = $db->getRow("select * from ".TBL_USER_PREF." where user_id = $u");
+ foreach ($pref_labels as $pref => $label) {
+ $preferences[] = array(
+ 'pref' => $pref,
+ 'label' => $label,
+ 'checked' => $prefs[$pref]
+ );
}
-
+
$def_results = $prefs['def_results'];
- $t->assign(array(
- 'error' => $error,
- 'my_fields' => $_sv['db_fields'] ? $_sv['db_fields'] : $default_db_fields,
- 'field_titles' => $all_db_fields,
- 'preferences' => $preferences,
- 'def_results' => $def_results
- ));
-
- $t->render('user.html', translate('User preferences'));
+ $t->assign(array(
+ 'error' => $error,
+ 'my_fields' => $_SESSION['db_fields'] ? $_SESSION['db_fields'] : $default_db_fields,
+ 'field_titles' => $all_db_fields,
+ 'preferences' => $preferences,
+ 'def_results' => $def_results
+ ));
+
+ $t->render('user.html', translate("User preferences"));
}
$perm->check_group('User');
-if (isset($_gv['op'])) {
- switch ($_gv['op']) {
- case 'delvote':
- delete_vote($_gv['bugid']);
- break;
- }
-} elseif (isset($_pv['do'])) {
- switch ($_pv['do']) {
- case 'changepassword':
- change_password($_pv['pass1'], $_pv['pass2']);
- break;
- case 'changecolumnlist':
- change_bug_list_columns($_pv['column_list']);
- break;
- case 'changeprefs':
- change_preferences(isset($_pv['preferences']) ? array_merge($_pv['preferences'], array('def_results' => $_pv['def_results'])) : array());
- break;
- default:
- show_preferences_form();
- }
+if (isset($_GET['op'])) {
+ switch ($_GET['op']) {
+ case 'delvote':
+ delete_vote($_GET['bugid']);
+ break;
+ }
+} elseif (isset($_POST['do'])) {
+ switch ($_POST['do']) {
+ case 'changepassword':
+ change_password($_POST['pass1'], $_POST['pass2']);
+ break;
+ case 'changecolumnlist':
+ change_bug_list_columns($_POST['column_list']);
+ break;
+ case 'changeprefs':
+ change_preferences(isset($_POST['preferences'])
+ ? array_merge($_POST['preferences'], array('def_results' => $_POST['def_results']))
+ : array());
+ break;
+ default:
+ show_preferences_form();
+ }
} else {
- show_preferences_form();
+ show_preferences_form();
}
?>
|
|
From: Ken T. <ke...@us...> - 2003-09-14 22:27:29
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv11954
Modified Files:
Tag: htmltemplates
newaccount.php
Log Message:
missing close-parenthesis
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.32.6.1
retrieving revision 1.32.6.2
diff -u -r1.32.6.1 -r1.32.6.2
--- newaccount.php 5 Sep 2003 12:19:21 -0000 1.32.6.1
+++ newaccount.php 14 Sep 2003 22:27:26 -0000 1.32.6.2
@@ -62,9 +62,9 @@
$db->query("insert into ".TBL_USER_PREF." (user_id) values ($user_id)");
qp_mail($_POST['email'],
- translate("phpBugTracker Login",
+ translate("phpBugTracker Login"),
sprintf(translate("Your phpBugTracker password is %s"), $password),
- sprintf("From: %s",ADMIN_EMAIL));
+ sprintf("From: %s", ADMIN_EMAIL));
$t->render('newaccountsuccess.html', translate("New account created"));
}
|
|
From: Ken T. <ke...@to...> - 2003-09-14 22:17:06
|
Thanks! Fixed in CVS. Alessandro Pisani wrote: >pgsql.in schema is currently missing the bug_open field, which causes an error >trying to run phpbt: > >DB Error: no such field >SELECT status_id FROM phpbt_status WHERE bug_open = 0 [nativecode=ERROR: >Attribute "bug_open" not found ] > >fixable adding: >bug_open smallint NOT NULL default '1', > >to schemas/pgsql.in > >bye, >Alessandro > > > |
|
From: Ken T. <ke...@us...> - 2003-09-14 22:16:29
|
Update of /cvsroot/phpbt/phpbt/schemas In directory sc8-pr-cvs1:/tmp/cvs-serv9211/schemas Modified Files: pgsql.in Log Message: added missing bug_open column (alextxm at tin.it) Index: pgsql.in =================================================================== RCS file: /cvsroot/phpbt/phpbt/schemas/pgsql.in,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- pgsql.in 4 Jun 2003 18:47:21 -0000 1.43 +++ pgsql.in 14 Sep 2003 22:16:24 -0000 1.44 @@ -220,6 +220,7 @@ status_name varchar(30) NOT NULL DEFAULT '', status_desc TEXT DEFAULT '' NOT NULL, sort_order INT2 NOT NULL DEFAULT '0', + bug_open INT2 NOT NULL default '1', PRIMARY KEY (status_id) ); |
|
From: Alessandro P. <al...@ti...> - 2003-09-14 22:09:48
|
pgsql.in schema is currently missing the bug_open field, which causes an error trying to run phpbt: DB Error: no such field SELECT status_id FROM phpbt_status WHERE bug_open = 0 [nativecode=ERROR: Attribute "bug_open" not found ] fixable adding: bug_open smallint NOT NULL default '1', to schemas/pgsql.in bye, Alessandro -- Alessandro Pisani (TXM) - alextxm at tin dot it ICQ: 2209087 - AIM: TXM J578 "It's a great thing when you realize you still have the ability to surprise yourself. It makes you wonder what else you can do, that you have forgotten about." - Lester Burnam [from "American Beauty"] |
|
From: Benjamin C. <bc...@us...> - 2003-09-05 12:19:25
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv19785
Modified Files:
Tag: htmltemplates
newaccount.php
Log Message:
gettext conversion
Index: newaccount.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/newaccount.php,v
retrieving revision 1.32
retrieving revision 1.32.6.1
diff -u -r1.32 -r1.32.6.1
--- newaccount.php 19 May 2002 16:59:16 -0000 1.32
+++ newaccount.php 5 Sep 2003 12:19:21 -0000 1.32.6.1
@@ -2,7 +2,7 @@
// newaccount.php - Set up new user accounts
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -26,27 +26,25 @@
include 'include.php';
function do_form() {
- global $db, $t, $_pv, $STRING, $now, $u;
+ global $db, $t, $now, $u;
if (NEW_ACCOUNTS_DISABLED) {
- $t->wrap('newaccount-disabled.html');
+ $t->render('newaccount-disabled.html');
return;
}
- if (!EMAIL_IS_LOGIN && !$_pv['login'] = trim($_pv['login']))
- $error = $STRING['givelogin'];
- 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']}' ".
- (!empty($_pv['login']) ? "or login = '{$_pv['login']}'" : '')))
- $error = $STRING['loginused'];
+ if (!EMAIL_IS_LOGIN && !$_POST['login'] = trim($_POST['login']))
+ $error = translate("Please enter a login");
+ elseif (!$_POST['email'] or !bt_valid_email($_POST['email']))
+ $error = translate("Please enter a valid email");
+ elseif ($db->getOne("select user_id from ".TBL_AUTH_USER." where email = '{$_POST['email']}' ".(!empty($_POST['login']) ? "or login = '{$_POST['login']}'" : '')))
+ $error = translate("That login has already been used");
if (!empty($error)) {
show_form($error);
return;
}
- $firstname = htmlspecialchars($_pv['firstname']);
- $lastname = htmlspecialchars($_pv['lastname']);
+ $firstname = htmlspecialchars($_POST['firstname']);
+ $lastname = htmlspecialchars($_POST['lastname']);
$password = genpassword(10);
if (ENCRYPT_PASS) {
$mpassword = $db->quote(md5($password));
@@ -54,39 +52,34 @@
$mpassword = $db->quote(stripslashes($password));
}
if (EMAIL_IS_LOGIN) {
- $login = $_pv['email'];
+ $login = $_POST['email'];
} else {
- $login = $_pv['login'];
+ $login = $_POST['login'];
}
$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 (".join(', ', array($user_id, $db->quote(stripslashes($login)),
- $db->quote(stripslashes($firstname)),
- $db->quote(stripslashes($lastname)), $db->quote($_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.
- " where group_name = 'User'");
+ $db->query("insert into ".TBL_AUTH_USER." (user_id, login, first_name, last_name, email, password, active, created_date, last_modified_date) values (".join(', ', array($user_id, $db->quote(stripslashes($login)), $db->quote(stripslashes($firstname)), $db->quote(stripslashes($lastname)), $db->quote($_POST['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." where group_name = 'User'");
$db->query("insert into ".TBL_USER_PREF." (user_id) values ($user_id)");
- qp_mail($_pv['email'], $STRING['newacctsubject'], sprintf($STRING['newacctmessage'], $password),
- sprintf("From: %s",ADMIN_EMAIL));
+ qp_mail($_POST['email'],
+ translate("phpBugTracker Login",
+ sprintf(translate("Your phpBugTracker password is %s"), $password),
+ sprintf("From: %s",ADMIN_EMAIL));
- $t->wrap('newaccountsuccess.html', 'accountcreated');
+ $t->render('newaccountsuccess.html', translate("New account created"));
}
function show_form($error = '') {
- global $t, $_pv;
+ global $t, $_POST;
if (NEW_ACCOUNTS_DISABLED) {
- $t->wrap('newaccount-disabled.html');
+ $t->render('newaccount-disabled.html');
} else {
- $t->wrap('newaccount.html', 'newaccount');
+ $t->render('newaccount.html', translate("Create new account"));
}
}
-if (isset($_pv['createaccount'])) do_form();
+if (isset($_POST['createaccount'])) do_form();
else show_form();
?>
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 12:14:40
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv18859
Modified Files:
Tag: htmltemplates
logout.php
Log Message:
Updating copyright
Index: logout.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/logout.php,v
retrieving revision 1.8
retrieving revision 1.8.6.1
diff -u -r1.8 -r1.8.6.1
--- logout.php 3 Apr 2002 01:00:52 -0000 1.8
+++ logout.php 5 Sep 2003 12:14:36 -0000 1.8.6.1
@@ -2,7 +2,7 @@
// logout.php - Clear the authentication of a user
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 12:14:07
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv18796
Modified Files:
Tag: htmltemplates
install.php
Log Message:
Switching the template calls
Index: install.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/install.php,v
retrieving revision 1.39.2.2
retrieving revision 1.39.2.3
diff -u -r1.39.2.2 -r1.39.2.3
--- install.php 5 Sep 2003 12:11:32 -0000 1.39.2.2
+++ install.php 5 Sep 2003 12:14:04 -0000 1.39.2.3
@@ -250,7 +250,7 @@
global $t, $_POST;
$t->assign('login', $_POST['admin_login']);
- $t->display('install-complete.html');
+ $t->render('install-complete.html');
}
function show_front($error = '') {
@@ -259,7 +259,7 @@
$t->assign($_POST);
$t->assign('error', $error);
$t->assign('default_email', 'phpbt@'.$HTTP_SERVER_VARS['SERVER_NAME']);
- $t->display('install.html');
+ $t->render('install.html');
}
if (isset($_POST['op'])) {
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 12:12:13
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv18511
Modified Files:
Tag: htmltemplates
config-dist.php
Log Message:
Removing smarty
Index: config-dist.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config-dist.php,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -r1.26 -r1.26.2.1
--- config-dist.php 24 Jul 2003 04:47:13 -0000 1.26
+++ config-dist.php 5 Sep 2003 12:12:10 -0000 1.26.2.1
@@ -1,7 +1,7 @@
<?php
// config.php - Set up configuration options
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -27,10 +27,6 @@
define ('DB_DATABASE', '{db_database}'); // database name
define ('DB_USER', '{db_user}'); // username for database connection
define ('DB_PASSWORD', '{db_pass}'); // password for database connection
-
-// Smarty templates location (leave blank if Smarty is in include path)
-// If not blank, make sure the trailing slash is present.
-define ('SMARTY_PATH', '{smarty_path}');
// Database Table Config
// you can change either the prefix of the table names or each table name individually
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 12:11:37
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv18351
Modified Files:
Tag: htmltemplates
install.php
Log Message:
cleanup, dumping smarty
Index: install.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/install.php,v
retrieving revision 1.39.2.1
retrieving revision 1.39.2.2
diff -u -r1.39.2.1 -r1.39.2.2
--- install.php 30 Aug 2003 22:07:12 -0000 1.39.2.1
+++ install.php 5 Sep 2003 12:11:32 -0000 1.39.2.2
@@ -3,7 +3,7 @@
// install.php -- Web-based installation script
// Thanks to the phpBB crew for an example on how this can be done.
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -23,35 +23,34 @@
// ------------------------------------------------------------------------
// $Id$
-// Location of smarty templates class
-define ('SMARTY_PATH','./inc/smarty/');
+// Template class
+class template {
+ var $vars;
-if (!@include(SMARTY_PATH . 'Smarty.class.php')) { // Template class
- include('templates/default/base/smartymissing.html');
- exit;
-}
-if (!@is_writeable('c_templates')) {
- include('templates/default/base/templatesperm.html');
- exit;
-}
+ function template() {
+ $this->vars = array();
+ }
-// Template class
-class extSmarty extends Smarty {
+ function render($content_template, $page_title, $wrap_file = '') {
+ extract($this->vars);
+ $path = defined('TEMPLATE_PATH')
+ ? './templates/'.THEME.'/'.TEMPLATE_PATH.'/'
+ : './templates/'.THEME.'/';
+ include($wrap_file ? $path.$wrap_file : $path.'wrap.html');
+ }
- function fetch($_smarty_tpl_file, $_smarty_cache_id = null, $_smarty_compile_id = null, $_smarty_display = false) {
- error_reporting(E_ALL ^ E_NOTICE); // Clobber Smarty warnings
- return Smarty::fetch($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_display);
+ function assign($var, $value = '') {
+ if (is_array($var)) {
+ foreach ($var as $k => $v) {
+ $this->vars[$k] = $v;
+ }
+ } else {
+ $this->vars[$var] = $value;
+ }
}
}
-$t = new extSmarty;
-$t->template_dir = 'templates/default';
-$t->compile_dir = 'c_templates';
-$t->config_dir = '.';
-$t->register_function('build_select', 'build_select');
-
-$_gv =& $HTTP_GET_VARS;
-$_pv =& $HTTP_POST_VARS;
+$t = new template();
$db_types = array(
'mysql' => 'MySQL',
@@ -61,49 +60,47 @@
ini_set("magic_quotes_runtime", 0); // runtime quotes will kill the included sql
ini_set("magic_quotes_sybase", 0);
-if (!empty($_pv)) {
+if (!empty($_POST)) {
$tables = array(
'/^#.*/' => '',
'/^--.*/' => '',
- '/TBL_ACTIVE_SESSIONS/' => $_pv['tbl_prefix'].'active_sessions',
- '/TBL_DB_SEQUENCE/' => $_pv['tbl_prefix'].'db_sequence',
- '/TBL_ATTACHMENT/' => $_pv['tbl_prefix'].'attachment',
- '/TBL_AUTH_GROUP/' => $_pv['tbl_prefix'].'auth_group',
- '/TBL_AUTH_PERM/' => $_pv['tbl_prefix'].'auth_perm',
- '/TBL_AUTH_USER/' => $_pv['tbl_prefix'].'auth_user',
- '/TBL_BUG_CC/' => $_pv['tbl_prefix'].'bug_cc',
- '/TBL_BUG_DEPENDENCY/' => $_pv['tbl_prefix'].'bug_dependency',
- '/TBL_BUG_GROUP/' => $_pv['tbl_prefix'].'bug_group',
- '/TBL_BUG_HISTORY/' => $_pv['tbl_prefix'].'bug_history',
- '/TBL_BUG_VOTE/' => $_pv['tbl_prefix'].'bug_vote',
- '/TBL_BUG/' => $_pv['tbl_prefix'].'bug',
- '/TBL_COMMENT/' => $_pv['tbl_prefix'].'comment',
- '/TBL_COMPONENT/' => $_pv['tbl_prefix'].'component',
- '/TBL_CONFIGURATION/' => $_pv['tbl_prefix'].'configuration',
- '/TBL_GROUP_PERM/' => $_pv['tbl_prefix'].'group_perm',
- '/TBL_OS/' => $_pv['tbl_prefix'].'os',
- '/TBL_PROJECT_GROUP/' => $_pv['tbl_prefix'].'project_group',
- '/TBL_PROJECT_PERM/' => $_pv['tbl_prefix'].'project_perm',
- '/TBL_PROJECT/' => $_pv['tbl_prefix'].'project',
- '/TBL_RESOLUTION/' => $_pv['tbl_prefix'].'resolution',
- '/TBL_SAVED_QUERY/' => $_pv['tbl_prefix'].'saved_query',
- '/TBL_SEVERITY/' => $_pv['tbl_prefix'].'severity',
- '/TBL_STATUS/' => $_pv['tbl_prefix'].'status',
- '/TBL_USER_GROUP/' => $_pv['tbl_prefix'].'user_group',
- '/TBL_USER_PERM/' => $_pv['tbl_prefix'].'user_perm',
- '/TBL_USER_PREF/' => $_pv['tbl_prefix'].'user_pref',
- '/TBL_VERSION/' => $_pv['tbl_prefix'].'version',
- '/TBL_PROJECT_PERM/' => $_pv['tbl_prefix'].'project_perm',
- '/TBL_DATABASE/' => $_pv['tbl_prefix'].'database_server',
- '/TBL_SITE/' => $_pv['tbl_prefix'].'site',
- '/OPTION_ADMIN_EMAIL/' => $_pv['admin_login'],
- '/OPTION_ADMIN_PASS/' => $_pv['encrypt_pass'] ? md5($_pv['admin_pass'])
- : $_pv['admin_pass'],
- '/OPTION_PHPBT_EMAIL/' => $_pv['phpbt_email'],
- '/OPTION_ENCRYPT_PASS/' => $_pv['encrypt_pass'],
- '/OPTION_INSTALL_URL/' => 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].
- dirname($HTTP_SERVER_VARS['SCRIPT_NAME']),
- );
+ '/TBL_ACTIVE_SESSIONS/' => $_POST['tbl_prefix'].'active_sessions',
+ '/TBL_DB_SEQUENCE/' => $_POST['tbl_prefix'].'db_sequence',
+ '/TBL_ATTACHMENT/' => $_POST['tbl_prefix'].'attachment',
+ '/TBL_AUTH_GROUP/' => $_POST['tbl_prefix'].'auth_group',
+ '/TBL_AUTH_PERM/' => $_POST['tbl_prefix'].'auth_perm',
+ '/TBL_AUTH_USER/' => $_POST['tbl_prefix'].'auth_user',
+ '/TBL_BUG_CC/' => $_POST['tbl_prefix'].'bug_cc',
+ '/TBL_BUG_DEPENDENCY/' => $_POST['tbl_prefix'].'bug_dependency',
+ '/TBL_BUG_GROUP/' => $_POST['tbl_prefix'].'bug_group',
+ '/TBL_BUG_HISTORY/' => $_POST['tbl_prefix'].'bug_history',
+ '/TBL_BUG_VOTE/' => $_POST['tbl_prefix'].'bug_vote',
+ '/TBL_BUG/' => $_POST['tbl_prefix'].'bug',
+ '/TBL_COMMENT/' => $_POST['tbl_prefix'].'comment',
+ '/TBL_COMPONENT/' => $_POST['tbl_prefix'].'component',
+ '/TBL_CONFIGURATION/' => $_POST['tbl_prefix'].'configuration',
+ '/TBL_GROUP_PERM/' => $_POST['tbl_prefix'].'group_perm',
+ '/TBL_OS/' => $_POST['tbl_prefix'].'os',
+ '/TBL_PROJECT_GROUP/' => $_POST['tbl_prefix'].'project_group',
+ '/TBL_PROJECT_PERM/' => $_POST['tbl_prefix'].'project_perm',
+ '/TBL_PROJECT/' => $_POST['tbl_prefix'].'project',
+ '/TBL_RESOLUTION/' => $_POST['tbl_prefix'].'resolution',
+ '/TBL_SAVED_QUERY/' => $_POST['tbl_prefix'].'saved_query',
+ '/TBL_SEVERITY/' => $_POST['tbl_prefix'].'severity',
+ '/TBL_STATUS/' => $_POST['tbl_prefix'].'status',
+ '/TBL_USER_GROUP/' => $_POST['tbl_prefix'].'user_group',
+ '/TBL_USER_PERM/' => $_POST['tbl_prefix'].'user_perm',
+ '/TBL_USER_PREF/' => $_POST['tbl_prefix'].'user_pref',
+ '/TBL_VERSION/' => $_POST['tbl_prefix'].'version',
+ '/TBL_PROJECT_PERM/' => $_POST['tbl_prefix'].'project_perm',
+ '/TBL_DATABASE/' => $_POST['tbl_prefix'].'database_server',
+ '/TBL_SITE/' => $_POST['tbl_prefix'].'site',
+ '/OPTION_ADMIN_EMAIL/' => $_POST['admin_login'],
+ '/OPTION_ADMIN_PASS/' => $_POST['encrypt_pass'] ? md5($_POST['admin_pass']) : $_POST['admin_pass'],
+ '/OPTION_PHPBT_EMAIL/' => $_POST['phpbt_email'],
+ '/OPTION_ENCRYPT_PASS/' => $_POST['encrypt_pass'],
+ '/OPTION_INSTALL_URL/' => 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].dirname($HTTP_SERVER_VARS['SCRIPT_NAME']),
+ );
}
@include_once('config.php');
@@ -114,32 +111,27 @@
function build_select($selected = 0) {
global $db_types;
- $text = '';
foreach ($db_types as $val => $item) {
if ($selected == $val and $selected != '') $sel = ' selected';
else $sel = '';
- $text .= "<option value=\"$val\"$sel>$item</option>";
+ echo "<option value=\"$val\"$sel>$item</option>";
}
- echo $text;
}
///
/// Check the validity of an email address
/// (From zend.com user russIndr)
function bt_valid_email($email) {
- return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email);
+ return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$', $email);
}
function grab_config_file() {
- global $t, $_pv;
+ global $t, $_POST;
- foreach ($_pv as $key => $val) {
+ foreach ($_POST as $key => $val) {
$patterns[] = '{'.$key.'}';
$replacements[] = $val;
}
- // Smarty
- $patterns[] = '{smarty_path}';
- $replacements[] = SMARTY_PATH;
$contents = join('', file('config-dist.php'));
return str_replace($patterns, $replacements, $contents);
@@ -173,21 +165,21 @@
}
function create_tables() {
- global $_pv, $tables;
+ global $_POST, $tables;
- $db = test_database($_pv);
+ $db = test_database($_POST);
$db->setOption('optimize', 'portability');
- $q_temp_ary = file('schemas/'.$_pv['db_type'].'.in');
+ $q_temp_ary = file('schemas/'.$_POST['db_type'].'.in');
$queries = preg_replace(array_keys($tables), array_values($tables),
- $q_temp_ary);
+ $q_temp_ary);
$do_query = '';
foreach ($queries as $query) {
// First, collect multi-line queries into one line, then run the query
$do_query .= chop($query);
if (empty($do_query) or substr($do_query, -1) != ';') continue;
- if ($_pv['db_type'] == 'oci8' ) {
- $do_query = substr($do_query, 0, -1);
+ if ($_POST['db_type'] == 'oci8' ) {
+ $do_query = substr($do_query, 0, -1);
}
$db->query(stripslashes($do_query));
$do_query = '';
@@ -201,27 +193,27 @@
}
function check_vars() {
- global $_pv;
+ global $_POST;
$error = '';
- if (!$_pv['db_host'] = trim($_pv['db_host'])) {
- $error = 'Please enter the host name for your database server';
- } elseif (!$_pv['db_database'] = trim($_pv['db_database'])) {
- $error = 'Please enter the name of the database you will be using';
- } elseif (!$_pv['db_user'] = trim($_pv['db_user'])) {
- $error = 'Please enter the user name for connecting to the database';
- } elseif (!$_pv['phpbt_email'] = trim($_pv['phpbt_email'])) {
- $error = 'Please enter the phpBT email address';
- } elseif (!$_pv['admin_login'] = trim($_pv['admin_login'])) {
- $error = 'Please enter the 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';
- } elseif (!$_pv['admin_pass2'] = trim($_pv['admin_pass2'])) {
- $error = 'Please confirm the admin password';
- } elseif ($_pv['admin_pass'] != $_pv['admin_pass2']) {
- $error = 'The admin passwords don\'t match';
+ if (!$_POST['db_host'] = trim($_POST['db_host'])) {
+ $error = translate("Please enter the host name for your database server");
+ } elseif (!$_POST['db_database'] = trim($_POST['db_database'])) {
+ $error = translate("Please enter the name of the database you will be using");
+ } elseif (!$_POST['db_user'] = trim($_POST['db_user'])) {
+ $error = translate("Please enter the user name for connecting to the database");
+ } elseif (!$_POST['phpbt_email'] = trim($_POST['phpbt_email'])) {
+ $error = translate("Please enter the phpBT email address");
+ } elseif (!$_POST['admin_login'] = trim($_POST['admin_login'])) {
+ $error = translate("Please enter the admin login");
+ } elseif (!bt_valid_email($_POST['admin_login'])) {
+ $error = translate("Please use a valid email address for the admin login");
+ } elseif (!$_POST['admin_pass'] = trim($_POST['admin_pass'])) {
+ $error = translate("Please enter the admin password");
+ } elseif (!$_POST['admin_pass2'] = trim($_POST['admin_pass2'])) {
+ $error = translate("Please confirm the admin password");
+ } elseif ($_POST['admin_pass'] != $_POST['admin_pass2']) {
+ $error = translate("The admin passwords don't match");
}
if (!empty($error)) {
@@ -236,9 +228,9 @@
if (!check_vars()) return;
create_tables();
- header('Content-Type: text/x-delimtext; name="config.php"');
- header('Content-disposition: attachment; filename=config.php');
- echo grab_config_file();
+ header('Content-Type: text/x-delimtext; name="config.php"');
+ header('Content-disposition: attachment; filename=config.php');
+ echo grab_config_file();
}
function save_config_file() {
@@ -246,7 +238,7 @@
if (!check_vars()) return;
create_tables();
if (!$fp = @fopen('config.php', 'w')) {
- show_front('Error writing to config.php');
+ show_front(translate("Error writing to config.php"));
} else {
fwrite($fp, grab_config_file());
fclose($fp);
@@ -255,29 +247,29 @@
}
function show_finished() {
- global $t, $_pv;
+ global $t, $_POST;
- $t->assign('login', $_pv['admin_login']);
+ $t->assign('login', $_POST['admin_login']);
$t->display('install-complete.html');
}
function show_front($error = '') {
- global $t, $_pv, $select, $HTTP_SERVER_VARS;
+ global $t, $_POST, $select, $HTTP_SERVER_VARS;
- $t->assign($_pv);
+ $t->assign($_POST);
$t->assign('error', $error);
$t->assign('default_email', 'phpbt@'.$HTTP_SERVER_VARS['SERVER_NAME']);
$t->display('install.html');
}
-if (isset($_pv['op'])) {
- switch ($_pv['op']) {
+if (isset($_POST['op'])) {
+ switch ($_POST['op']) {
case 'save_config_file' : save_config_file(); break;
case 'dump_config_file' : dump_config_file(); break;
}
-} elseif (isset($_gv['op'])) {
- switch ($_gv['op']) {
- case 'dbtest' : test_database($_gv, true); break;
+} elseif (isset($_GET['op'])) {
+ switch ($_GET['op']) {
+ case 'dbtest' : test_database($_GET, true); break;
}
} else {
show_front();
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 11:59:56
|
Update of /cvsroot/phpbt/phpbt/inc
In directory sc8-pr-cvs1:/tmp/cvs-serv15527/inc
Modified Files:
Tag: htmltemplates
auth.php
Log Message:
Cleanup
Index: auth.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/auth.php,v
retrieving revision 1.18
retrieving revision 1.18.4.1
diff -u -r1.18 -r1.18.4.1
--- auth.php 7 Apr 2003 21:58:30 -0000 1.18
+++ auth.php 5 Sep 2003 11:59:52 -0000 1.18.4.1
@@ -2,7 +2,7 @@
// auth.php - Authentication and permission objects
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -10,194 +10,173 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// phpBugTracker is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with phpBugTracker; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ------------------------------------------------------------------------
-// Based on and/or directly from PHPlib, which is
+// Based on and/or directly from PHPlib, which is
// Copyright (c) 1998-2000 NetUSE AG -- Boris Erdmann, Kristian Koehntopp
class uauth {
var $lifetime = 0; // In minutes -- 0 for no expiration until browser closed
var $classname = 'uauth';
-
+
function uauth() {
- global $HTTP_SESSION_VARS, $group_ids, $uname, $db_fields, $group, $perms,
- $uid, $exp;
-
- if (!isset($HTTP_SESSION_VARS['group_ids'])) {
- if (phpversion() <= '4.0.6') {
- $group_ids = array(0);
- $uname = '';
- $db_fields = array();
- $group = array();
- $perms = array();
- $uid = 0;
- $exp = 0;
- session_register(array('group_ids', 'uname', 'db_fields', 'group',
- 'perms', 'uid', 'exp'));
- }
- $HTTP_SESSION_VARS['group_ids'] = array(0);
+ global $group_ids, $uname, $db_fields, $group, $perms,
+ $uid, $exp;
+
+ if (!isset($_SESSION['group_ids'])) {
+ $_SESSION['group_ids'] = array(0);
}
-
+
if ($this->is_authenticated()) {
- if ($HTTP_SESSION_VARS['uid']) {
- $HTTP_SESSION_VARS['exp'] = time() + (60 * $this->lifetime);
+ if ($_SESSION['uid']) {
+ $_SESSION['exp'] = time() + (60 * $this->lifetime);
}
}
}
function is_authenticated() {
- global $HTTP_SESSION_VARS;
-
- if (isset($HTTP_SESSION_VARS['uid']) && $HTTP_SESSION_VARS['uid'] &&
- ($this->lifetime <= 0 || time() < $HTTP_SESSION_VARS['exp'])) {
- return $HTTP_SESSION_VARS['uid'];
+
+ if (isset($_SESSION['uid']) && $_SESSION['uid'] && ($this->lifetime <= 0 || time() < $_SESSION['exp'])) {
+ return $_SESSION['uid'];
} else {
return false;
}
}
-
+
function auth_validatelogin() {
- global $_pv, $db, $select, $emailpass, $emailsuccess, $STRING,
- $HTTP_SESSION_VARS, $uid;
+ global $db, $select, $emailpass, $emailsuccess, $uid;
+
+ extract($_POST);
+ if (!$username) return 0;
+ $_SESSION['uname'] = $username;
+ if (ENCRYPT_PASS) {
+ $password = md5($password);
+ }
+ $u = $db->getRow("select * from ".TBL_AUTH_USER." where login = '$username' and password = '$password' and active > 0");
+ if (!$u or DB::isError($u)) {
+ return 0;
+ } else {
+ $_SESSION['db_fields'] = @unserialize($u['bug_list_fields']);
- extract($_pv);
- if (!$username) return 0;
- $HTTP_SESSION_VARS['uname'] = $username;
- if (ENCRYPT_PASS) {
- $password = md5($password);
- }
- $u = $db->getRow("select * from ".TBL_AUTH_USER." where login = '$username' and password = '$password' and active > 0");
- if (!$u or DB::isError($u)) {
- return 0;
- } else {
- $HTTP_SESSION_VARS['db_fields'] = @unserialize($u['bug_list_fields']);
-
- // Grab group assignments and permissions based on groups
- $rs = $db->query("select u.group_id, group_name from ".TBL_USER_GROUP.
- " u, ".TBL_AUTH_GROUP." a where user_id = {$u['user_id']} ".
- 'and u.group_id = a.group_id');
+ // Grab group assignments and permissions based on groups
+ $rs = $db->query("select u.group_id, group_name from ".TBL_USER_GROUP." u, ".TBL_AUTH_GROUP." a where user_id = {$u['user_id']} and u.group_id = a.group_id");
while (list($groupid, $groupname) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
- $HTTP_SESSION_VARS['group_ids'][] = $groupid;
- $HTTP_SESSION_VARS['group'][$groupname] = true;
+ $_SESSION['group_ids'][] = $groupid;
+ $_SESSION['group'][$groupname] = true;
}
- $perms = $db->getCol("select perm_name from ".TBL_AUTH_PERM." ap, ".
- TBL_GROUP_PERM." gp where group_id in (".
- delimit_list(',', $HTTP_SESSION_VARS['group_ids']).") and gp.perm_id = ap.perm_id");
- foreach ($perms as $perm) {
- $HTTP_SESSION_VARS['perms'][$perm] = true;
- }
- $HTTP_SESSION_VARS['uid'] = $u['user_id'];
-
- return $u['user_id'];
- }
- }
-
+ $perms = $db->getCol("select perm_name from ".TBL_AUTH_PERM." ap, ".TBL_GROUP_PERM." gp where group_id in (".@join(',', $_SESSION['group_ids']).") and gp.perm_id = ap.perm_id");
+ foreach ($perms as $perm) {
+ $_SESSION['perms'][$perm] = true;
+ }
+ $_SESSION['uid'] = $u['user_id'];
+
+ return $u['user_id'];
+ }
+ }
+
function unauth() {
- global $HTTP_SESSION_VARS;
-
- $HTTP_SESSION_VARS['uid'] = 0;
- $HTTP_SESSION_VARS['perms'] = array();
- $HTTP_SESSION_VARS['exp'] = 0;
- $HTTP_SESSION_VARS['group'] = array();
- $HTTP_SESSION_VARS['group_ids'] = array(0);
- $HTTP_SESSION_VARS['db_fields'] = array();
- }
+
+ $_SESSION['uid'] = 0;
+ $_SESSION['perms'] = array();
+ $_SESSION['exp'] = 0;
+ $_SESSION['group'] = array();
+ $_SESSION['group_ids'] = array(0);
+ $_SESSION['db_fields'] = array();
+ }
}
class uperm {
- var $classname = 'uperm';
- var $permissions = array ();
+ var $classname = 'uperm';
+ var $permissions = array ();
+
+ function check($p) {
+
+ if (!$this->have_perm($p)) {
+ if (!isset($_SESSION['perms']) ) {
+ $_SESSION['perms'] = '';
+ }
+ $this->perm_invalid($_SESSION['perms'], $p);
+ exit();
+ }
+ }
+
+ function check_proj($project_id) {
+ global $db;
+
+ if ($this->have_perm_proj($project_id)) {
+ return true;
+ } else {
+ $this->perm_invalid($_SESSION['perms'], $p);
+ exit();
+ }
+ }
- function check($p) {
- global $HTTP_SESSION_VARS;
+ function have_perm_proj($project_id) {
+ global $db;
- if (!$this->have_perm($p)) {
- if (!isset($HTTP_SESSION_VARS['perms']) ) {
- $HTTP_SESSION_VARS['perms'] = '';
- }
- $this->perm_invalid($HTTP_SESSION_VARS['perms'], $p);
- exit();
- }
- }
-
- function check_proj($project_id) {
- global $db;
-
- if ($this->have_perm_proj($project_id)) {
- return true;
- } else {
- $this->perm_invalid($HTTP_SESSION_VARS['perms'], $p);
- exit();
- }
- }
-
- function have_perm_proj($project_id) {
- global $db;
-
- if ($this->have_perm('Admin')) {
- return true;
- }
-
- if ( $db->getCol('SELECT user_id FROM '.TBL_PROJECT_PERM.' WHERE user_id = '.$_SESSION['uid']." AND project_id = $project_id") ) {
- return true;
- } else {
- return false;
- }
- }
-
- function check_auth($auth_var, $reqs) {
- global $HTTP_SESSION_VARS;
-
- // Administrators always pass
- if (@isset($HTTP_SESSION_VARS[$auth_var]['Admin'])) {
- return true;
- }
-
- if (is_array($reqs)) {
- foreach ($reqs as $req) {
- if (!@isset($HTTP_SESSION_VARS[$auth_var][$req])) {
- return false;
- }
- }
- } else {
- if (!@isset($HTTP_SESSION_VARS[$auth_var][$reqs])) {
- return false;
- }
- }
-
- // Didn't fail on any requirements? Then the user passes the check
- return true;
- }
-
-
- function in_group($req_groups) {
- return $this->check_auth('group', $req_groups);
- }
-
-
- function have_perm($req_perms) {
- return $this->check_auth('perms', $req_perms);
- }
-
-
- function perm_invalid($actual_perms, $required_perms) {
- global $t;
-
- $t->wrap('badperm.html');
- }
+ if ($this->have_perm('Admin')) {
+ return true;
+ }
+
+ if ( $db->getCol('SELECT user_id FROM '.TBL_PROJECT_PERM.' WHERE user_id = '.$_SESSION['uid']." AND project_id = $project_id") ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function check_auth($auth_var, $reqs) {
+
+ // Administrators always pass
+ if (@isset($_SESSION[$auth_var]['Admin'])) {
+ return true;
+ }
+
+ if (is_array($reqs)) {
+ foreach ($reqs as $req) {
+ if (!@isset($_SESSION[$auth_var][$req])) {
+ return false;
+ }
+ }
+ } else {
+ if (!@isset($_SESSION[$auth_var][$reqs])) {
+ return false;
+ }
+ }
+
+ // Didn't fail on any requirements? Then the user passes the check
+ return true;
+ }
+
+
+ function in_group($req_groups) {
+ return $this->check_auth('group', $req_groups);
+ }
+
+
+ function have_perm($req_perms) {
+ return $this->check_auth('perms', $req_perms);
+ }
+
+
+ function perm_invalid($actual_perms, $required_perms) {
+ global $t;
+
+ $t->wrap('badperm.html');
+ }
function check_group($group) {
global $t;
- if (!$this->check_auth('group', $group)) {
+ if (!$this->check_auth('group', $group)) {
$t->assign('group', $group);
$t->wrap('badgroup.html');
exit();
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 11:59:22
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv15463
Modified Files:
Tag: htmltemplates
index.php
Log Message:
gettext conversion
Index: index.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/index.php,v
retrieving revision 1.39.2.1
retrieving revision 1.39.2.2
diff -u -r1.39.2.1 -r1.39.2.2
--- index.php 30 Aug 2003 22:07:12 -0000 1.39.2.1
+++ index.php 5 Sep 2003 11:59:17 -0000 1.39.2.2
@@ -2,7 +2,7 @@
// index.php - Front page
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -34,8 +34,7 @@
}
// Grab the data
- $rs = $db->query("select status_id, count(status_id) as count from ".TBL_BUG.
- " where project_id not in ($restricted_projects) group by status_id");
+ $rs = $db->query("select status_id, count(status_id) as count from ".TBL_BUG." where project_id not in ($restricted_projects) group by status_id");
while ($rs->fetchInto($row)) {
$stats[$row['status_id']]['count'] = $row['count'];
}
@@ -44,7 +43,6 @@
}
function build_image($restricted_projects) {
- global $STRING;
error_reporting(0); // Force this, just in case
include_once JPGRAPH_PATH.'jpgraph.php';
@@ -63,7 +61,7 @@
}
if (!$totalbugs) {
- return $STRING['nobugs'];
+ return translate("No bugs found");
}
// Create the Pie Graph.
@@ -71,8 +69,7 @@
$graph->SetShadow();
// Set A title for the plot
- $graph->title->Set(sprintf("Bug Summary (%d bug%s)",
- $totalbugs, $totalbugs == 1 ? '' : 's'));
+ $graph->title->Set(translate("Bug Summary"));
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->legend->Pos(0.03, 0.5, 'right', 'center');
@@ -93,7 +90,7 @@
if (SHOW_PROJECT_SUMMARIES) {
$querystring = $QUERY['index-projsummary-1'];
- $resfields = array('Project','Open');
+ $resfields = array(translate("Project"), translate("Open"));
// Grab the resolutions from the database
$rs = $db->query($QUERY['index-projsummary-2'].
@@ -105,7 +102,7 @@
$resfields[] = $fieldname;
$querystring .= $countquery;
}
- $resfields[] = 'Total';
+ $resfields[] = translate("Total");
$db->setOption('optimize', 'performance'); // For Oracle to do this loop
$aProjects = array(
@@ -132,13 +129,14 @@
$sOpenStatusQuery = '&status%5B%5D='.@join('&status%5B%5D=', array(BUG_UNCONFIRMED, BUG_PROMOTED,
BUG_ASSIGNED, BUG_REOPENED));
+ // QUESTION: Will this still work with using translate('Project')?
foreach ($aProjects['projects'] as $iProjectNumberKey => $value1) {
foreach ($aProjects['projects'][$iProjectNumberKey] as $sResolutionKey => $value2) {
- if ($sResolutionKey != "Project" && $sResolutionKey != "Total" && $sResolutionKey != "Open") {
+ if ($sResolutionKey != translate("Project") && $sResolutionKey != translate("Total") && $sResolutionKey != translate("Open")) {
$aProjects['projects'][$iProjectNumberKey][$sResolutionKey] = "<A HREF='query.php?resolution%5B%5D=" . $aResolutionsToIds[$sResolutionKey] . "&projects=" . $aProjectsToIds[$aProjects['projects'][$iProjectNumberKey]["Project"]] . "&op=doquery'>" . $aProjects['projects'][$iProjectNumberKey][$sResolutionKey] . "</A>";
- } elseif ($sResolutionKey == "Open") {
+ } elseif ($sResolutionKey == translate("Open")) {
$aProjects['projects'][$iProjectNumberKey][$sResolutionKey] = "<A HREF='query.php?projects=" . $aProjectsToIds[$aProjects['projects'][$iProjectNumberKey]["Project"]] . $sOpenStatusQuery . "&op=doquery'>" . $aProjects['projects'][$iProjectNumberKey][$sResolutionKey] . "</A>";
- } elseif ($sResolutionKey == "Total") {
+ } elseif ($sResolutionKey == translate("Total")) {
$aProjects['projects'][$iProjectNumberKey][$sResolutionKey] = "<A HREF='query.php?projects=" . $aProjectsToIds[$aProjects['projects'][$iProjectNumberKey]["Project"]] . "&op=doquery'>" . $aProjects['projects'][$iProjectNumberKey][$sResolutionKey] . "</A>";
}
}
@@ -153,16 +151,10 @@
// Show the recently added and closed bugs
$t->assign('recentbugs',
- $db->getAll($db->modifyLimitQuery("select bug_id, title, project_name from ".TBL_BUG.
- ' b, '.TBL_PROJECT." p where b.project_id not in ($restricted_projects)".
- ' and b.project_id = p.project_id order by b.created_date desc', 0, 5)));
+ $db->getAll($db->modifyLimitQuery("select bug_id, title, project_name from ".TBL_BUG.' b, '.TBL_PROJECT." p where b.project_id not in ($restricted_projects) and b.project_id = p.project_id order by b.created_date desc", 0, 5)));
$t->assign('closedbugs',
- $db->getAll($db->modifyLimitQuery('select b.bug_id, title, project_name from '.TBL_BUG.' b, '.
- TBL_PROJECT.' p'.
- " where b.project_id not in ($restricted_projects)".
- ' and '.in_closed('status_id').
- ' and b.project_id = p.project_id order by close_date desc', 0, 5)));
+ $db->getAll($db->modifyLimitQuery('select b.bug_id, title, project_name from '.TBL_BUG.' b, '.TBL_PROJECT." p where b.project_id not in ($restricted_projects) and ".in_closed('status_id').' and b.project_id = p.project_id order by close_date desc', 0, 5)));
if ($u != 'nobody') {
$pref = $db->GetOne('select saved_queries from '.TBL_USER_PREF." where user_id='".$u."'");
@@ -174,6 +166,6 @@
}
$t->assign('restricted_projects', $restricted_projects);
-$t->render('index.html', translate('Home'));
+$t->render('index.html', translate("Home"));
?>
|
|
From: Benjamin C. <bc...@us...> - 2003-09-05 11:59:17
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv15366
Modified Files:
Tag: htmltemplates
include.php
Log Message:
Cleanup. Gettext conversion. Dumping smarty
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.126.4.1
retrieving revision 1.126.4.2
diff -u -r1.126.4.1 -r1.126.4.2
--- include.php 30 Aug 2003 22:07:12 -0000 1.126.4.1
+++ include.php 5 Sep 2003 11:58:48 -0000 1.126.4.2
@@ -2,7 +2,7 @@
// include.php - Set up global variables
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -27,12 +27,12 @@
@ini_set("session.save_handler", "files");
if (!@include('config.php')) {
- header("Location: install.php");
- exit();
+ header("Location: install.php");
+ exit();
}
if (!defined('DB_HOST')) { // Installation hasn't been completed
- header("Location: install.php");
- exit();
+ header("Location: install.php");
+ exit();
}
// Grab the global functions
@@ -47,7 +47,7 @@
'database' => DB_DATABASE,
'username' => DB_USER,
'password' => DB_PASSWORD
- );
+ );
$db = DB::Connect($dsn);
if (DB::isError($db)) {
die($db->message.'<br>'.$db->userinfo);
@@ -59,50 +59,45 @@
// Set up the configuration variables
$rs = $db->query('select varname, varvalue from '.TBL_CONFIGURATION);
while (list($k, $v) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
- define($k, $v);
+ define($k, $v);
}
-define('OPEN_BUG_STATUSES', join(', ', array(BUG_UNCONFIRMED, BUG_PROMOTED,
- BUG_ASSIGNED, BUG_REOPENED)));
+define('OPEN_BUG_STATUSES', join(', ',
+ array(BUG_UNCONFIRMED, BUG_PROMOTED, BUG_ASSIGNED, BUG_REOPENED)));
require_once ('inc/db/'.DB_TYPE.'.php');
-// Localization - include the file with the desired language
-include 'languages/'.LANGUAGE.'.php';
-
$me = $HTTP_SERVER_VARS['PHP_SELF'];
$selrange = 30;
$now = time();
-$_gv =& $HTTP_GET_VARS;
-$_pv =& $HTTP_POST_VARS;
$all_db_fields = array(
- 'bug_id' => 'ID',
- 'title' => 'Title',
- 'description' => 'Description',
- 'url' => 'URL',
- 'severity_name' => 'Severity',
- 'priority' => 'Priority',
- 'status_name' => 'Status',
- 'resolution_name' => 'Resolution',
- 'closed_in_version_name' => 'Closed in Version',
- 'to_be_closed_in_version_name' => 'To be Closed in Version',
- 'database_name' => 'Database',
- 'site_name' => 'Site',
- 'reporter' => 'Reporter',
- 'owner' => 'Owner',
- 'created_date' => 'Created Date',
- 'lastmodifier' => 'Last Modified By',
- 'last_modified_date' => 'Last Modified Date',
- 'project_name' => 'Project',
- 'version_name' => 'Version',
- 'component_name' => 'Component',
- 'os_name' => 'OS',
- 'browser_string' => 'Browser',
- 'close_date' => 'Closed Date'
- );
+ 'bug_id' => 'ID',
+ 'title' => 'Title',
+ 'description' => 'Description',
+ 'url' => 'URL',
+ 'severity_name' => 'Severity',
+ 'priority' => 'Priority',
+ 'status_name' => 'Status',
+ 'resolution_name' => 'Resolution',
+ 'closed_in_version_name' => 'Closed in Version',
+ 'to_be_closed_in_version_name' => 'To be Closed in Version',
+ 'database_name' => 'Database',
+ 'site_name' => 'Site',
+ 'reporter' => 'Reporter',
+ 'owner' => 'Owner',
+ 'created_date' => 'Created Date',
+ 'lastmodifier' => 'Last Modified By',
+ 'last_modified_date' => 'Last Modified Date',
+ 'project_name' => 'Project',
+ 'version_name' => 'Version',
+ 'component_name' => 'Component',
+ 'os_name' => 'OS',
+ 'browser_string' => 'Browser',
+ 'close_date' => 'Closed Date'
+ );
$default_db_fields = array('bug_id', 'title', 'reporter', 'owner',
- 'severity_name', 'priority', 'status_name', 'resolution_name');
+ 'severity_name', 'priority', 'status_name', 'resolution_name');
// Template class
@@ -115,9 +110,9 @@
function render($content_template, $page_title, $wrap_file = '') {
extract($this->vars);
- $path = defined('TEMPLATE_PATH')
- ? './templates/'.THEME.'/'.TEMPLATE_PATH.'/'
- : './templates/'.THEME.'/';
+ $path = defined('TEMPLATE_PATH')
+ ? './templates/'.THEME.'/'.TEMPLATE_PATH.'/'
+ : './templates/'.THEME.'/';
include($wrap_file ? $path.$wrap_file : $path.'wrap.html');
}
@@ -133,11 +128,7 @@
}
$t = new template();
-$t->assign(array(
- 'STRING' => $STRING,
- 'TITLE' => $TITLE,
- 'STYLE' => STYLE
- ));
+$t->assign('STYLE', STYLE);
if (defined('TEMPLATE_PATH')) {
$t->assign('template_path', '../templates/'.THEME.'/'.TEMPLATE_PATH);
@@ -158,44 +149,45 @@
}
if (!defined('NO_AUTH')) {
- session_start();
- $_sv =& $HTTP_SESSION_VARS;
- $auth = new uauth;
- $perm = new uperm;
- $u = isset($_sv['uid']) ? $_sv['uid'] : 0;
+ session_start();
+ $auth = new uauth;
+ $perm = new uperm;
+ $u = isset($_SESSION['uid']) ? $_SESSION['uid'] : 0;
}
// Check to see if the user is trying to login
-if (isset($_pv['dologin'])) {
- if (!empty($_pv['sendpass'])) {
- $username = $_pv['username'];
- list($email, $password) = $db->getRow("select email, password from ".TBL_AUTH_USER." where login = '{$_pv['username']}' and active > 0", null, DB_FETCHMODE_ORDERED);
- if (!$email) {
- $t->assign('loginerror', '<div class="error">Invalid login</div>');
- } else {
- if (ENCRYPT_PASS) {
- $password = genpassword(10);
- $mpassword = md5($password);
- $db->query("update ".TBL_AUTH_USER." set password = '$mpassword' where login = '$username'");
- }
- qp_mail($email, $STRING['newacctsubject'], sprintf($STRING['newacctmessage'], $password),
- sprintf("From: %s",ADMIN_EMAIL));
- $t->assign('loginerror',
- '<div class="result">Your password has been emailed to you</div>');
+if (isset($_POST['dologin'])) {
+ if (!empty($_POST['sendpass'])) {
+ $username = $_POST['username'];
+ list($email, $password) = $db->getRow("select email, password from ".TBL_AUTH_USER." where login = '{$_POST['username']}' and active > 0", null, DB_FETCHMODE_ORDERED);
+ if (!$email) {
+ $t->assign('loginerror', '<div class="error">'.translate("Invalid login").'</div>');
+ } else {
+ if (ENCRYPT_PASS) {
+ $password = genpassword(10);
+ $mpassword = md5($password);
+ $db->query("update ".TBL_AUTH_USER." set password = '$mpassword' where login = '$username'");
+ }
+ qp_mail($email,
+ translate("phpBugTracker Login"),
+ sprintf(translate("Your phpBugTracker password is %s"), $password),
+ sprintf("From: %s", ADMIN_EMAIL));
+ $t->assign('loginerror',
+ '<div class="result">'.translate("Your password has been emailed to you").'</div>');
$emailsuccess = true;
- }
- } else {
- if (!$u = $auth->auth_validatelogin()) {
- $t->assign('loginerror', '<div class="error">Invalid login</div>');
- $username = $_pv['username'];
- }
- }
+ }
+ } else {
+ if (!$u = $auth->auth_validatelogin()) {
+ $t->assign('loginerror', '<div class="error">'.translate("Invalid login").'</div>');
+ $username = $_POST['username'];
+ }
+ }
// "Remember me" handling
if (RECALL_LOGIN) {
- if (!empty($_pv["savecookie"])) {
- setcookie('phpbt_user', $_pv["username"], $now + 18144000); // 3 week expiration
- } elseif (!empty($HTTP_COOKIE_VARS['phpbt_user'])) {
+ if (!empty($_POST["savecookie"])) {
+ setcookie('phpbt_user', $_POST["username"], $now + 18144000); // 3 week expiration
+ } elseif (!empty($_COOKIE['phpbt_user'])) {
// Clear the cookie if the cookie is populated and the box wasn't checked
setcookie('phpbt_user');
}
@@ -204,19 +196,17 @@
}
if (!empty($u)) {
- 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);
- $t->assign(array(
- 'owner_open' => $owner_open ? $owner_open : 0,
- 'owner_closed' => $owner_closed ? $owner_closed : 0,
- 'reporter_open' => $reporter_open ? $reporter_open : 0,
- 'reporter_closed' => $reporter_closed ? $reporter_closed : 0,
+ 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);
+ $t->assign(array(
+ 'owner_open' => $owner_open ? $owner_open : 0,
+ 'owner_closed' => $owner_closed ? $owner_closed : 0,
+ 'reporter_open' => $reporter_open ? $reporter_open : 0,
+ 'reporter_closed' => $reporter_closed ? $reporter_closed : 0,
'perm' => $perm,
- ));
+ ));
}
if (defined('FORCE_LOGIN') and FORCE_LOGIN and !$u and !defined('NO_AUTH')) {
@@ -224,19 +214,17 @@
exit;
}
-$op = isset($_gv['op']) ? $_gv['op'] : (isset($_pv['op']) ? $_pv['op'] : '');
+$op = !empty($_REQUEST['op']) ? $_REQUEST['op'] : '';
if (!defined('NO_AUTH')) {
// Check to see if we have projects that shouldn't be visible to the user
$restricted_projects = '0';
if (!$perm->have_perm('Admin')) {
- $viewable_projects = delimit_list(',',
- $db->getCol("select project_id from ".TBL_PROJECT_GROUP.
- " where group_id in (".delimit_list(',', $_sv['group_ids']).")"));
+ $viewable_projects = @join(',',
+ $db->getCol("select project_id from ".TBL_PROJECT_GROUP." where group_id in (".delimit_list(',', $_SESSION['group_ids']).")"));
$viewable_projects = $viewable_projects ? $viewable_projects : '0';
$matching_projects = delimit_list(',',
- $db->getCol("select project_id from ".TBL_PROJECT_GROUP.
- " where project_id not in ($viewable_projects) group by project_id"));
+ $db->getCol("select project_id from ".TBL_PROJECT_GROUP." where project_id not in ($viewable_projects) group by project_id"));
if ($matching_projects) {
$restricted_projects .= ",$matching_projects";
}
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:51:17
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv17467
Modified Files:
Tag: htmltemplates
config.php
Log Message:
Changing copyright
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.38.2.2
retrieving revision 1.38.2.3
diff -u -r1.38.2.2 -r1.38.2.3
--- config.php 1 Sep 2003 13:50:45 -0000 1.38.2.2
+++ config.php 1 Sep 2003 13:51:12 -0000 1.38.2.3
@@ -2,7 +2,7 @@
// config.php - Set up configuration options
// ------------------------------------------------------------------------
-// Copyright (c) 2001 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:50:49
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv17261
Modified Files:
Tag: htmltemplates
config.php
Log Message:
Undoing commit mistake
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.38.2.1
retrieving revision 1.38.2.2
diff -u -r1.38.2.1 -r1.38.2.2
--- config.php 1 Sep 2003 13:48:18 -0000 1.38.2.1
+++ config.php 1 Sep 2003 13:50:45 -0000 1.38.2.2
@@ -27,9 +27,9 @@
// Database Config
define ('DB_TYPE', 'mysql'); // using PHPlib file naming
define ('DB_HOST', 'localhost');
-define ('DB_DATABASE', 'bug_tracker');
+define ('DB_DATABASE', 'BugTracker');
define ('DB_USER', 'root');
-define ('DB_PASSWORD', 'howdy');
+define ('DB_PASSWORD', '');
// Smarty templates location (leave blank if Smarty is in include path)
// If not blank, make sure the trailing slash is present.
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:48:22
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory sc8-pr-cvs1:/tmp/cvs-serv16600/templates/default
Modified Files:
Tag: htmltemplates
bugdisplay-printable.html bugdisplay.html
Log Message:
Changed the way printable view works
Index: bugdisplay-printable.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugdisplay-printable.html,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.2
diff -u -r1.11.4.1 -r1.11.4.2
--- bugdisplay-printable.html 30 Aug 2003 22:00:32 -0000 1.11.4.1
+++ bugdisplay-printable.html 1 Sep 2003 13:48:18 -0000 1.11.4.2
@@ -47,9 +47,23 @@
<br>
<?php echo translate("URL"); ?>: <?php echo $url; ?>
<br>
-<?php echo translate("Depends on bugs"); ?>: <?php echo $bug_dependencies; ?>
+<?php echo translate("Depends on bugs"); ?>:
+<?php for ($i = 0, $count = count($bug_dependencies); $i < $count; $i++) {
+ printf('<a href="bug.php?op=show&bugid=%d" class="%s">#%d</a>%s',
+ $bug_dependencies[$i]['bug_id'],
+ ($bug_dependencies[$i]['bug_open'] ? 'open_bug_number' : 'closed_bug_number'),
+ $bug_dependencies[$i]['bug_id'],
+ ($i < $count - 1 ? ', ' : ''));
+} ?>
<br>
-<?php echo translate("Blocks bugs"); ?>: <?php echo $rev_bug_dependencies; ?>
+<?php echo translate("Blocks bugs"); ?>:
+<?php for ($i = 0, $count = count($bug_blocks); $i < $count; $i++) {
+ printf('<a href="bug.php?op=show&bugid=%d" class="%s">#%d</a>%s',
+ $bug_blocks[$i]['bug_id'],
+ ($bug_blocks[$i]['bug_open'] ? 'open_bug_number' : 'closed_bug_number'),
+ $bug_blocks[$i]['bug_id'],
+ ($i < $count - 1 ? ', ' : ''));
+} ?>
<br>
<br>
<?php echo translate("Comments"); ?>:
Index: bugdisplay.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugdisplay.html,v
retrieving revision 1.45.4.2
retrieving revision 1.45.4.3
diff -u -r1.45.4.2 -r1.45.4.3
--- bugdisplay.html 1 Sep 2003 13:40:31 -0000 1.45.4.2
+++ bugdisplay.html 1 Sep 2003 13:48:18 -0000 1.45.4.3
@@ -165,7 +165,7 @@
</tr>
</table>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
- <tr>
+ <tr class="noprint">
<td valign="top"><?php echo translate("Additional comments"); ?>:<br><br>
<textarea name="comments" rows="6" cols="55" wrap="virtual" <?php echo $disabled ?>><?php echo $_POST['comments']; ?></textarea>
<br><br>
@@ -236,8 +236,7 @@
<?php if (!empty($error['vote'])) echo "<div class=\"error\">{$error['vote']}</div>" ?>
<b><a href="<?php echo $_SERVER['PHP_SELF']; ?>?op=vote&bugid=<?php echo $bug_id; ?>" onClick="if (<?php echo $already_voted; ?>) { alert ('<?php echo translate("You have already voted for this bug"); ?>'); return false; }"><?php echo translate("Vote for this bug"); ?></a></b> |
<b><a href="<?php echo $_SERVER['PHP_SELF']; ?>?op=viewvotes&bugid=<?php echo $bug_id; ?>"><?php echo translate("View votes"); ?> (<?php echo $num_votes; ?>)</a></b> |
- <b><a href="<?php echo $_SERVER['PHP_SELF']; ?>?op=history&bugid=<?php echo $bug_id; ?>"><?php echo translate("View bug history"); ?></a></b> |
- <b><a href="<?php echo $_SERVER['PHP_SELF']; ?>?op=print&bugid=<?php echo $bug_id; ?>"><?php echo translate("Printable view"); ?></a></b>
+ <b><a href="<?php echo $_SERVER['PHP_SELF']; ?>?op=history&bugid=<?php echo $bug_id; ?>"><?php echo translate("View bug history"); ?></a></b>
</div>
<br><br>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:48:22
|
Update of /cvsroot/phpbt/phpbt/styles
In directory sc8-pr-cvs1:/tmp/cvs-serv16600/styles
Modified Files:
Tag: htmltemplates
default.css print.css
Log Message:
Changed the way printable view works
Index: default.css
===================================================================
RCS file: /cvsroot/phpbt/phpbt/styles/default.css,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -u -r1.4.4.1 -r1.4.4.2
--- default.css 30 Aug 2003 22:08:50 -0000 1.4.4.1
+++ default.css 1 Sep 2003 13:48:18 -0000 1.4.4.2
@@ -251,3 +251,7 @@
.pagination {
padding: 5px;
}
+
+a.closed_bug_number {
+ text-decoration: line-through;
+}
Index: print.css
===================================================================
RCS file: /cvsroot/phpbt/phpbt/styles/print.css,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -r1.1 -r1.1.6.1
--- print.css 13 Sep 2002 19:10:32 -0000 1.1
+++ print.css 1 Sep 2003 13:48:18 -0000 1.1.6.1
@@ -222,6 +222,6 @@
font-weight: bold;
}
-.bugdisplaylinks {
+.bugdisplaylinks, .noprint {
display: none;
-}
\ No newline at end of file
+}
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:48:22
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv16600
Modified Files:
Tag: htmltemplates
config.php
Log Message:
Changed the way printable view works
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -u -r1.38 -r1.38.2.1
--- config.php 24 Jul 2003 04:47:13 -0000 1.38
+++ config.php 1 Sep 2003 13:48:18 -0000 1.38.2.1
@@ -27,9 +27,9 @@
// Database Config
define ('DB_TYPE', 'mysql'); // using PHPlib file naming
define ('DB_HOST', 'localhost');
-define ('DB_DATABASE', 'BugTracker');
+define ('DB_DATABASE', 'bug_tracker');
define ('DB_USER', 'root');
-define ('DB_PASSWORD', '');
+define ('DB_PASSWORD', 'howdy');
// Smarty templates location (leave blank if Smarty is in include path)
// If not blank, make sure the trailing slash is present.
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:40:35
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory sc8-pr-cvs1:/tmp/cvs-serv15391/templates/default
Modified Files:
Tag: htmltemplates
bugdisplay.html
Log Message:
Cleaned up bug dependency display
Index: bugdisplay.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugdisplay.html,v
retrieving revision 1.45.4.1
retrieving revision 1.45.4.2
diff -u -r1.45.4.1 -r1.45.4.2
--- bugdisplay.html 30 Aug 2003 22:00:32 -0000 1.45.4.1
+++ bugdisplay.html 1 Sep 2003 13:40:31 -0000 1.45.4.2
@@ -139,8 +139,24 @@
</tr><tr>
<td colspan="2" valign="top">
<?php if (!empty($error['add_dep'])) echo "<div class=\"error\">{$error['add_dep']}</div>"; ?>
- <?php echo translate("Depends on bugs"); ?>: <?php echo $bug_dependencies; ?><br>
- <?php echo translate("Blocks bugs"); ?>: <?php echo $rev_bug_dependencies; ?><br>
+ <?php echo translate("Depends on bugs"); ?>:
+ <?php for ($i = 0, $count = count($bug_dependencies); $i < $count; $i++) {
+ printf('<a href="bug.php?op=show&bugid=%d" class="%s">#%d</a>%s',
+ $bug_dependencies[$i]['bug_id'],
+ ($bug_dependencies[$i]['bug_open'] ? 'open_bug_number' : 'closed_bug_number'),
+ $bug_dependencies[$i]['bug_id'],
+ ($i < $count - 1 ? ', ' : ''));
+ } ?>
+ <br>
+ <?php echo translate("Blocks bugs"); ?>:
+ <?php for ($i = 0, $count = count($bug_blocks); $i < $count; $i++) {
+ printf('<a href="bug.php?op=show&bugid=%d" class="%s">#%d</a>%s',
+ $bug_blocks[$i]['bug_id'],
+ ($bug_blocks[$i]['bug_open'] ? 'open_bug_number' : 'closed_bug_number'),
+ $bug_blocks[$i]['bug_id'],
+ ($i < $count - 1 ? ', ' : ''));
+ } ?>
+ <br>
<?php echo translate("Add dependency"); ?>: <input type="text" name="add_dependency" size="5" <?php echo $disabled ?>><br>
<?php echo translate("Remove dependency"); ?>: <input type="text" name="del_dependency" size="5" <?php echo $disabled ?>><br><br></td>
<td colspan="2" valign="top">
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:40:14
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv15310
Modified Files:
Tag: htmltemplates
bug.php
Log Message:
Cleaned up code and bug dependency display
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.134.2.1
retrieving revision 1.134.2.2
diff -u -r1.134.2.1 -r1.134.2.2
--- bug.php 30 Aug 2003 22:07:12 -0000 1.134.2.1
+++ bug.php 1 Sep 2003 13:40:09 -0000 1.134.2.2
@@ -2,7 +2,7 @@
// bug.php - All the interactions with a bug
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -29,58 +29,49 @@
function vote_view($bug_id) {
global $u, $db, $t, $STRING;
- $t->assign('votes', $db->getAll('select login, v.created_date '.
- 'from '.TBL_AUTH_USER.' u, '.TBL_BUG_VOTE." v ".
- "where u.user_id = v.user_id and bug_id = $bug_id ".
- 'order by v.created_date'));
- $t->render('bugvotes.html', translate('Bug Votes'));
+ $t->assign('votes', $db->getAll('select login, v.created_date '.'from '.TBL_AUTH_USER.' u, '.TBL_BUG_VOTE." v where u.user_id = v.user_id and bug_id = $bug_id order by v.created_date"));
+ $t->render('bugvotes.html', translate("Bug Votes"));
}
///
/// Add a vote to a bug to (possibly) promote it
function vote_bug($bug_id) {
- global $u, $db, $now, $_pv, $STRING;
+ global $u, $db, $now;
// Check to see if the user already voted on this bug
- if ($db->getOne("select count(*) from ".TBL_BUG_VOTE.
- " where bug_id = $bug_id and user_id = $u")) {
- show_bug($bug_id, array('vote' => $STRING['already_voted']));
+ if ($db->getOne("select count(*) from ".TBL_BUG_VOTE." where bug_id = $bug_id and user_id = $u")) {
+ show_bug($bug_id, array('vote' => translate("You have already voted for this bug")));
return;
}
// Check whether the user has used his allotment of votes (if there is a max)
- if (MAX_USER_VOTES and $db->getOne("select count(*) from ".TBL_BUG_VOTE.
- " where user_id = $u") >= MAX_USER_VOTES) {
- show_bug($bug_id, array('vote' => $STRING['too_many_votes']));
+ if (MAX_USER_VOTES and
+ $db->getOne("select count(*) from ".TBL_BUG_VOTE." where user_id = $u") >= MAX_USER_VOTES) {
+ show_bug($bug_id, array('vote' => translate("You have reached the maximum number of votes per user")));
return;
}
// Record the vote
- $db->query("insert into ".TBL_BUG_VOTE." (user_id, bug_id, created_date)
- values ($u, $bug_id, $now)");
+ $db->query("insert into ".TBL_BUG_VOTE." (user_id, bug_id, created_date) values ($u, $bug_id, $now)");
// Proceed only if promoting by votes is turned on
if (PROMOTE_VOTES) {
// Has this bug already been promoted?
- $bug_is_new = $db->getOne("select count(*) from ".TBL_BUG." b, ".
- TBL_STATUS." s where bug_id = $bug_id and b.status_id = s.status_id and
- status_name = 'New'");
+ $bug_is_new = $db->getOne("select count(*) from ".TBL_BUG." b, ".TBL_STATUS." s where bug_id = $bug_id and b.status_id = s.status_id and status_name = 'New'");
// If a number of votes are required to promote a bug, check for promotion
- if (!$bug_is_new and $db->getOne("select count(*) from ".
- TBL_BUG_VOTE." where bug_id = $bug_id") == PROMOTE_VOTES) {
+ if (!$bug_is_new and $db->getOne("select count(*) from ".TBL_BUG_VOTE." where bug_id = $bug_id") == PROMOTE_VOTES) {
$status_id = BUG_PROMOTED;
$buginfo = $db->getOne("select * from ".TBL_BUG." where bug_id = $bug_id");
- $changedfields = array('status_id' => $status_id);
+ $changedfields = array('status_id' => $status_id);
do_changedfields($u, $buginfo, $changedfields);
}
}
- if (isset($_pv['pos'])) {
- $posinfo = "&pos={$_pv['pos']}";
+ if (isset($_POST['pos'])) {
+ $posinfo = "&pos={$_POST['pos']}";
} else {
$posinfo = '';
}
- header("Location: bug.php?op=show&bugid=$bug_id$posinfo");
-
+ header("Location: bug.php?op=show&bugid=$bug_id$posinfo");
}
///
@@ -108,18 +99,18 @@
global $db, $t, $STRING, $QUERY;
if (!is_numeric($bugid)) {
- show_text($STRING['nobughistory']);
+ show_text(translate("There is no history for this bug"));
return;
}
$t->assign('history', $db->getAll(sprintf($QUERY['bug-history'], $bugid)));
- $t->render('bughistory.html', translate('Bug History'));
+ $t->render('bughistory.html', translate("Bug History"));
}
///
/// 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, $QUERY, $_pv;
+ 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);
@@ -128,20 +119,16 @@
$template = $newbug ? "bugemail-newbug.$template_ext" : "bugemail.$template_ext";
foreach(array('title','url','priority') 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 (". join(', ', array($buginfo['bug_id'], $db->quote($field),
- $db->quote(stripslashes($buginfo[$field])),
- $db->quote(stripslashes($cf[$field])), $u, $now)).")");
- $t->assign(array(
+ $db->query('insert into '.TBL_BUG_HISTORY.' (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->assign(array(
$field => stripslashes($cf[$field]),
$field.'_stat' => '!'
- ));
+ ));
} else {
- $t->assign(array(
+ $t->assign(array(
$field => stripslashes($buginfo[$field]),
$field.'_stat' => ' '
- ));
+ ));
}
}
@@ -161,21 +148,15 @@
foreach($cfgDatabase as $field => $table) {
if (isset($buginfo[$field.'_id'])) {
- $oldvalue = $db->getOne("select ${field}_name from $table".
- " where ${field}_id = {$buginfo[$field.'_id']}");
+ $oldvalue = $db->getOne("select ${field}_name from $table"." where ${field}_id = {$buginfo[$field.'_id']}");
}
if (empty($oldvalue)) $oldvalue = 'None';
if (isset($cf[$field.'_id'])) {
- $newvalue = $db->getOne("select ${field}_name from $table".
- " where ${field}_id = {$cf[$field.'_id']}");
- if (empty($newvalue)) $newvalue = 'None';
+ $newvalue = $db->getOne("select ${field}_name from $table where ${field}_id = {$cf[$field.'_id']}");
+ if (empty($newvalue)) $newvalue = 'None';
- $db->query('insert into '.TBL_BUG_HISTORY.
- ' (bug_id, changed_field, old_value, new_value, created_by, created_date)'.
- " values (". join(', ', array($buginfo['bug_id'], $db->quote($STRING['BUGDISPLAY'][$field]),
- $db->quote(stripslashes($oldvalue)),
- $db->quote(stripslashes($newvalue)), $u, $now)).")");
+ $db->query('insert into '.TBL_BUG_HISTORY.' (bug_id, changed_field, old_value, new_value, created_by, created_date) values ('. join(', ', array($buginfo['bug_id'], $db->quote($STRING['BUGDISPLAY'][$field]), $db->quote(stripslashes($oldvalue)), $db->quote(stripslashes($newvalue)), $u, $now)).")");
$t->assign(array(
$field.'_id' => stripslashes($newvalue),
$field.'_id_stat' => '!'
@@ -194,19 +175,15 @@
foreach($versions as $field => $field_name) {
if (isset($buginfo[$field.'_id'])) {
- $oldvalue = $db->getOne('select version_name from '.$cfgDatabase['version'].
- ' where version_id = '.$buginfo[$field.'_id']);
+ $oldvalue = $db->getOne('select version_name from '.$cfgDatabase['version'].' where version_id = '.$buginfo[$field.'_id']);
}
if (empty($oldvalue)) $oldvalue = 'None';
if (isset($cf[$field.'_id'])) {
- $newvalue = $db->getOne('select version_name from '.$cfgDatabase['version'].
- ' where version_id = '.$cf[$field.'_id']);
+ $newvalue = $db->getOne('select version_name from '.$cfgDatabase['version'].' where version_id = '.$cf[$field.'_id']);
if (empty($newvalue)) $newvalue = 'None';
- $db->query('insert into '.TBL_BUG_HISTORY.
- ' (bug_id, changed_field, old_value, new_value, created_by, created_date)'.
- " values (". join(', ', array($buginfo['bug_id'], $db->quote($STRING['BUGDISPLAY'][$field_name]),
+ $db->query('insert into '.TBL_BUG_HISTORY.' (bug_id, changed_field, old_value, new_value, created_by, created_date) values ('. join(', ', array($buginfo['bug_id'], $db->quote($STRING['BUGDISPLAY'][$field_name]),
$db->quote(stripslashes($oldvalue)),
$db->quote(stripslashes($newvalue)), $u, $now)).")");
$t->assign(array(
@@ -222,41 +199,28 @@
}
// See if the assignment has changed -- grab the email for notifications either way
- list($assignedto, $emailassignedto) = $db->getRow('select email, email_notices from '.
- TBL_AUTH_USER." u, ".TBL_USER_PREF.' p where u.user_id = '.
- (!empty($cf['assigned_to']) ? $cf['assigned_to'] : $buginfo['assigned_to']).
- " and u.user_id = p.user_id", DB_FETCHMODE_ORDERED);
+ list($assignedto, $emailassignedto) = $db->getRow('select email, email_notices from '.TBL_AUTH_USER." u, ".TBL_USER_PREF.' p where u.user_id = '.(!empty($cf['assigned_to']) ? $cf['assigned_to'] : $buginfo['assigned_to'])." and u.user_id = p.user_id", DB_FETCHMODE_ORDERED);
if (!empty($cf['assigned_to'])) {
$assignedtostat = '!';
- $oldassignedto = $db->getOne('select email from '.
- TBL_AUTH_USER.' u where u.user_id = '.$buginfo['assigned_to']);
+ $oldassignedto = $db->getOne('select email from '.TBL_AUTH_USER.' u where u.user_id = '.$buginfo['assigned_to']);
if (is_null($oldassignedto)) {
$oldassignedto = '';
}
- $db->query('insert into '.TBL_BUG_HISTORY.
- ' (bug_id, changed_field, old_value, new_value, created_by, created_date)'.
- " values (". join(', ', array($buginfo['bug_id'],
- $db->quote($STRING['BUGDISPLAY']['assignedto']),
- $db->quote($oldassignedto), $db->quote($assignedto), $u, $now)).")");
+ $db->query('insert into '.TBL_BUG_HISTORY.' (bug_id, changed_field, old_value, new_value, created_by, created_date) values ('. join(', ', array($buginfo['bug_id'], $db->quote($STRING['BUGDISPLAY']['assignedto']), $db->quote($oldassignedto), $db->quote($assignedto), $u, $now)).")");
} else {
$assignedtostat = ' ';
}
- if (!empty($_pv['suppress_email'])) return; // Don't send email if silent update requested.
+ if (!empty($_POST['suppress_email'])) return; // Don't send email if silent update requested.
// Reporter never changes
- $reporter = $db->getOne('select email from '.TBL_AUTH_USER.
- " u, ".TBL_USER_PREF." p where u.user_id = {$buginfo['created_by']} ".
- "and u.user_id = p.user_id and email_notices = 1");
+ $reporter = $db->getOne('select email from '.TBL_AUTH_USER." u, ".TBL_USER_PREF." p where u.user_id = {$buginfo['created_by']} and u.user_id = p.user_id and email_notices = 1");
$reporterstat = ' ';
// If there are new comments grab the comments immediately before the latest
if ($comments or $newbug) {
- $rs = $db->limitQuery('select u.login, c.comment_text, c.created_date'.
- ' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER.' u'.
- " where bug_id = {$buginfo['bug_id']} and c.created_by = u.user_id".
- ' order by created_date desc', 0, 2);
+ $rs = $db->limitQuery('select u.login, c.comment_text, c.created_date from '.TBL_COMMENT.' c, '.TBL_AUTH_USER." u where bug_id = {$buginfo['bug_id']} and c.created_by = u.user_id order by created_date desc", 0, 2);
$rs->fetchInto($row);
$t->assign(array(
'newpostedby' => $row['login'],
@@ -268,10 +232,7 @@
// If this comment is the first additional comment after the creation of the
// bug then we need to grab the bug's description as the previous comment
if ($rs->numRows() < 2) {
- list($by, $on, $comments) = $db->getRow('select u.login, b.created_date, b.description'.
- ' from '.TBL_BUG.' b, '.TBL_AUTH_USER.' u'.
- " where b.created_by = u.user_id and bug_id = {$buginfo['bug_id']}",
- null, DB_FETCHMODE_ORDERED);
+ list($by, $on, $comments) = $db->getRow('select u.login, b.created_date, b.description from '.TBL_BUG.' b, '.TBL_AUTH_USER." u where b.created_by = u.user_id and bug_id = {$buginfo['bug_id']}", null, DB_FETCHMODE_ORDERED);
$t->assign(array(
'oldpostedby' => $by,
'oldpostedon' => date(TIME_FORMAT,$on).' on '.date(DATE_FORMAT,$on),
@@ -315,7 +276,8 @@
'bugid' => $buginfo['bug_id'],
'siteroot' => INSTALL_URL,
'bugurl' => INSTALL_URL."/bug.php?op=show&bugid={$buginfo['bug_id']}",
- 'priority' => $select['priority'][(!empty($cf['priority']) ? $cf['priority'] : $buginfo['priority'])],
+ 'priority' => $select['priority'][(!empty($cf['priority'])
+ ? $cf['priority'] : $buginfo['priority'])],
'priority_stat' => !empty($cf['priority']) ? '!' : ' ',
'reporter' => $reporter,
'reporter_stat' => $reporterstat,
@@ -332,14 +294,14 @@
}
function update_bug($bugid = 0) {
- global $db, $t, $u, $STRING, $perm, $now, $_pv;
+ global $db, $t, $u, $perm, $now;
// Pull bug from database to determine changed fields and for user validation
$buginfo = $db->getRow("select * from ".TBL_BUG." where bug_id = $bugid");
$changedfields = array();
- if (isset($_pv)) {
- foreach ($_pv as $k => $v) {
+ if (isset($_POST)) {
+ foreach ($_POST as $k => $v) {
$$k = $v;
if ($k == 'url') {
if (($v == 'http://') || ($v == 'https://')) {
@@ -359,35 +321,31 @@
// Should we allow changes to be made to this bug by this user?
if (STRICT_UPDATING and !($u == $buginfo['assigned_to'] or
$u == $buginfo['created_by'] or $perm->have_perm('Manager'))) {
- show_bug($bugid,array('status' => $STRING['bugbadperm']));
+ show_bug($bugid,array('status' => translate("You can not change this bug")));
return;
}
// Check for more than one person modifying the bug at the same time
if ($last_modified_date != $buginfo['last_modified_date']) {
- show_bug($bugid, array('status' => $STRING['datecollision']));
+ show_bug($bugid, array('status' => translate("Someone has updated this bug since you viewed it. The bug info has been reloaded with the latest changes.")));
return;
}
// Add CC if specified
if ($add_cc) {
- if (!$cc_uid = $db->getOne("select user_id from ".TBL_AUTH_USER.
- " where login = ".$db->quote(stripslashes($add_cc)))) {
- show_bug($bugid,array('status' => $STRING['nouser']));
+ if (!$cc_uid = $db->getOne("select user_id from ".TBL_AUTH_USER." where login = ".$db->quote(stripslashes($add_cc)))) {
+ show_bug($bugid,array('status' => translate("That user does not exist")));
return;
}
- $cc_already = $db->getOne('select user_id from '.TBL_BUG_CC.
- " where bug_id = $bugid and user_id = $cc_uid");
+ $cc_already = $db->getOne('select user_id from '.TBL_BUG_CC." where bug_id = $bugid and user_id = $cc_uid");
if (!$cc_already && $cc_uid != $buginfo['created_by']) {
- $db->query("insert into ".TBL_BUG_CC." (bug_id, user_id, created_by,
- created_date) values ($bugid, $cc_uid, $u, $now)");
+ $db->query("insert into ".TBL_BUG_CC." (bug_id, user_id, created_by, created_date) values ($bugid, $cc_uid, $u, $now)");
}
}
// Remove CCs if requested
if (isset($remove_cc) and $remove_cc[0]) {
- $db->query('delete from '.TBL_BUG_CC." where bug_id = $bugid and user_id in (".
- delimit_list(',', $remove_cc).')');
+ $db->query('delete from '.TBL_BUG_CC." where bug_id = $bugid and user_id in (".@join(',', $remove_cc).')');
}
// Add dependency if requested
@@ -396,62 +354,43 @@
// Validate the bug number
if (!is_numeric($add_dependency)) {
- show_bug($bugid, array('add_dep' => $STRING['nobug']));
+ show_bug($bugid, array('add_dep' => translate("That bug does not exist")));
return;
}
if (!$db->getOne('select count(*) from '.TBL_BUG." where bug_id = $add_dependency")) {
- show_bug($bugid, array('add_dep' => $STRING['nobug']));
+ show_bug($bugid, array('add_dep' => translate("That bug does not exist")));
return;
}
// Check if the dependency has already been added
- if ($db->getOne('select count(*) from '.TBL_BUG_DEPENDENCY.
- " where bug_id = $bugid and depends_on = $add_dependency")) {
- show_bug($bugid, array('add_dep' => $STRING['dupe_dependency']));
+ if ($db->getOne('select count(*) from '.TBL_BUG_DEPENDENCY." where bug_id = $bugid and depends_on = $add_dependency")) {
+ show_bug($bugid, array('add_dep' => translate("That bug dependency has already been added")));
return;
}
// Add it
- $db->query("insert into ".TBL_BUG_DEPENDENCY.
- " (bug_id, depends_on) values($bugid, $add_dependency)");
+ $db->query("insert into ".TBL_BUG_DEPENDENCY." (bug_id, depends_on) values($bugid, $add_dependency)");
}
// Remove dependency if requested
if (!empty($del_dependency)) {
$del_dependency = preg_replace('/\D/', '', $del_dependency);
if (is_numeric($del_dependency)) {
- $db->query("delete from ".TBL_BUG_DEPENDENCY.
- " where bug_id = $bugid and depends_on = $del_dependency");
+ $db->query("delete from ".TBL_BUG_DEPENDENCY." where bug_id = $bugid and depends_on = $del_dependency");
}
}
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, ".
- $db->quote(stripslashes($comments)).", $u, $now)");
+ $db->query("insert into ".TBL_COMMENT." (comment_id, bug_id, comment_text, created_by, created_date) values (".$db->nextId(TBL_COMMENT).", $bugid, ".$db->quote(stripslashes($comments)).", $u, $now)");
}
- // Allow for removing of some items from the bug page
- $priority = $priority ? $priority : 0;
- $os_id = $os_id ? $os_id : 0;
- $severity_id = $severity_id ? $severity_id : 0;
-
if (is_closed($status_id)) {
$closed_query = ", close_date = $now";
} else {
$closed_query = '';
}
- $db->query("update ".TBL_BUG." set title = ".$db->quote(stripslashes($title)).
- ', url = '.$db->quote(stripslashes($url)).", severity_id = $severity_id, ".
- "priority = $priority, status_id = $status_id, ".
- "database_id = $database_id, to_be_closed_in_version_id = $to_be_closed_in_version_id, ".
- 'closed_in_version_id = '.$closed_in_version_id.', '.
- 'site_id ='.$site_id.', '.
- "resolution_id = $resolution_id, assigned_to = $assigned_to, ".
- "project_id = $project_id, version_id = $version_id, ".
- "component_id = $component_id, os_id = $os_id, last_modified_by = $u, ".
- "last_modified_date = $now $closed_query where bug_id = $bugid");
+ $db->query("update ".TBL_BUG." set title = ".$db->quote(stripslashes($title)).', url = '.$db->quote(stripslashes($url)).", severity_id = ".(int)$severity_id.", priority = ".(int)$priority.", status_id = ".(int)$status_id.", database_id = ".(int)$database_id.", to_be_closed_in_version_id = ".(int)$to_be_closed_in_version_id.", closed_in_version_id = ".(int)$closed_in_version_id.', site_id ='.(int)$site_id.", resolution_id = ".(int)$resolution_id.", assigned_to = ".(int)$assigned_to.", project_id = $project_id, version_id = $version_id, component_id = ".(int)$component_id.", os_id = ".(int)$os_id.", last_modified_by = $u, last_modified_date = $now $closed_query where bug_id = $bugid");
// If the project has changed, move any attachments
if (!empty($changedfields['project_id'])) {
@@ -466,29 +405,26 @@
}
function add_attachment($bugid, $description) {
- global $db, $HTTP_POST_FILES, $now, $u, $STRING, $t, $_pv;
+ global $db, $now, $u, $t;
- if (!isset($HTTP_POST_FILES['attachment']) ||
- $HTTP_POST_FILES['attachment']['tmp_name'] == 'none') {
+ if (!isset($_FILES['attachment']) ||
+ $_FILES['attachment']['tmp_name'] == 'none') {
return;
}
// Check the upload size. If the size was greater than the max in
// php.ini, the file won't even be set and will fail at the check above
- if ($HTTP_POST_FILES['attachment']['size'] > ATTACHMENT_MAX_SIZE) {
+ if ($_FILES['attachment']['size'] > ATTACHMENT_MAX_SIZE) {
return;
}
$projectid = $db->getOne("select project_id from ".TBL_BUG." where bug_id = $bugid");
if (!$projectid) {
- show_text($STRING['nobug'], true);
return;
}
// Check for a previously-uploaded attachment with the same name, bug, and project
- $rs = $db->query("select a.bug_id, project_id from ".TBL_ATTACHMENT." a, ".
- TBL_BUG." b where file_name = '{$HTTP_POST_FILES['attachment']['name']}' ".
- "and a.bug_id = b.bug_id");
+ $rs = $db->query("select a.bug_id, project_id from ".TBL_ATTACHMENT." a, ".TBL_BUG." b where file_name = '{$_FILES['attachment']['name']}' and a.bug_id = b.bug_id");
while ($rs->fetchInto($ainfo)) {
if ($bugid == $ainfo['bug_id'] && $projectid == $ainfo['project_id']) {
return;
@@ -496,8 +432,8 @@
}
$filepath = ATTACHMENT_PATH;
- $tmpfilename = $HTTP_POST_FILES['attachment']['tmp_name'];
- $filename = "$bugid-{$HTTP_POST_FILES['attachment']['name']}";
+ $tmpfilename = $_FILES['attachment']['tmp_name'];
+ $filename = "$bugid-{$_FILES['attachment']['name']}";
if (!is_dir($filepath)) {
return;
@@ -511,28 +447,15 @@
@mkdir("$filepath/$projectid", 0775);
}
- if (!@move_uploaded_file($HTTP_POST_FILES['attachment']['tmp_name'],
+ if (!@move_uploaded_file($_FILES['attachment']['tmp_name'],
"$filepath/$projectid/$filename")) {
return;
}
@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 (".
- join(', ', array($db->nextId(TBL_ATTACHMENT), $bugid,
- $db->quote($HTTP_POST_FILES['attachment']['name']),
- $db->quote(stripslashes($description)),
- $HTTP_POST_FILES['attachment']['size'],
- $db->quote($HTTP_POST_FILES['attachment']['type']), $u, $now)).")");
-
- if ($_pv['use_js']) {
- $t->display('admin/edit-submit.html');
- } else {
- header("Location: bug.php?op=show&bugid=$bugid");
- }
+ $db->query("insert into ".TBL_ATTACHMENT." (attachment_id, bug_id, file_name, description, file_size, mime_type, created_by, created_date) values (".join(', ', array($db->nextId(TBL_ATTACHMENT), $bugid, $db->quote($_FILES['attachment']['name']), $db->quote(stripslashes($description)), $_FILES['attachment']['size'], $db->quote($_FILES['attachment']['type']), $u, $now)).")");
}
-
///
/// Move attachments from one project directory to another
function move_attachments($bug_id, $old_project, $new_project) {
@@ -543,86 +466,51 @@
@mkdir("$filepath/$new_project", 0775);
}
- $rs = $db->query("select attachment_id, file_name from ".TBL_ATTACHMENT.
- " where bug_id = $bug_id");
+ $rs = $db->query("select attachment_id, file_name from ".TBL_ATTACHMENT." where bug_id = $bug_id");
while ($row = $rs->fetchRow()) {
@rename("$filepath/$old_project/$bug_id-{$row['file_name']}",
"$filepath/$new_project/$bug_id-{$row['file_name']}");
}
}
-
-
-
function do_form($bugid = 0) {
- global $db, $me, $u, $_pv, $_gv, $STRING, $now, $HTTP_SERVER_VARS;
+ global $db, $me, $u, $now;
$error = '';
// Validation
- if (!$_pv['title'] = htmlspecialchars(trim($_pv['title']))) {
- $error = $STRING['givesummary'];
- } elseif (!$_pv['description'] = htmlspecialchars(trim($_pv['description']))) {
- $error = $STRING['givedesc'];
+ if (!$_POST['title'] = htmlspecialchars(trim($_POST['title']))) {
+ $error = translate("Please enter a summary");
+ } elseif (!$_POST['description'] = htmlspecialchars(trim($_POST['description']))) {
+ $error = translate("Please enter a description");
}
if ($error) {
- $_gv['project'] = $_pv['project'];
+ $_GET['project'] = $_POST['project'];
show_form($bugid, $error);
return;
}
- while (list($k,$v) = each($_pv)) {
- $$k = $v;
- }
-
+ extract($_POST);
if ($url == 'http://') {
$url = '';
}
- // Allow for removing of some items from the bug page
- $priority = $priority ? $priority : 0;
- $os = $os ? $os : 0;
- $severity = $severity ? $severity : 0;
-
- if (!$bugid) {
- $bugid = $db->nextId(TBL_BUG);
-
- // Check to see if this bug's component has an owner and should be assigned
- if ($owner = $db->getOne("select owner from ".TBL_COMPONENT." c where component_id = $component")) {
- $status = BUG_ASSIGNED;
- } else {
- $owner = 0;
- // If we aren't using voting to promote, then auto-promote to New
- $status = PROMOTE_VOTES ? BUG_UNCONFIRMED : BUG_PROMOTED;
- }
-
- $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, site_id, database_id, version_id, '.
- '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.', '.
- $site.', '.$database.', '.$version.', '.$component.', '.$os.', '.
- $db->quote(stripslashes($HTTP_SERVER_VARS['HTTP_USER_AGENT'])).')');
- $buginfo = $db->getRow('select * from '.TBL_BUG." where bug_id = $bugid");
- do_changedfields($u, $buginfo);
+ // Check to see if this bug's component has an owner and should be assigned
+ if ($owner = $db->getOne("select owner from ".TBL_COMPONENT." c where component_id = $component")) {
+ $status = BUG_ASSIGNED;
} else {
- $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', ".
- 'database_id = '.$database.', site_id = '.$site.', '.
- "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'");
+ $owner = 0;
+ // If we aren't using voting to promote, then auto-promote to New
+ $status = PROMOTE_VOTES ? BUG_UNCONFIRMED : BUG_PROMOTED;
}
- if (isset($_pv['at_description']))
- add_attachment($bugid, $_pv['at_description']); //attachment (initial)
+ $bugid = $db->nextId(TBL_BUG);
+
+ $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, site_id, database_id, version_id, component_id, os_id, browser_string) values ('.$bugid.', '.join(', ', array($db->quote(stripslashes($title)), $db->quote(stripslashes($description)), $db->quote(stripslashes($url)))).', '.(int)$severity.', '.(int)$priority.', '.(int)$status.', '.$owner.', '.$u.', '.$now.', '.$u.', '.$now.', '.$project.', '.(int)$site.', '.(int)$database.', '.(int)$version.', '.(int)$component.', '.(int)$os.', '.$db->quote(stripslashes($_SERVER['HTTP_USER_AGENT'])).')');
+ $buginfo = $db->getRow('select * from '.TBL_BUG." where bug_id = $bugid");
+ do_changedfields($u, $buginfo);
+
+ if (isset($_POST['at_description']))
+ add_attachment($bugid, $_POST['at_description']); //attachment (initial)
if (isset($another)) {
header("Location: $me?op=add&project=$project");
@@ -638,50 +526,41 @@
if ($bugid && !$error) {
$t->assign($db->getRow("select * from ".TBL_BUG." where bug_id = '$bugid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
$t->assign(array(
'error' => $error,
'project' => $_GET['project'],
'projectname' => $projectname
));
}
- $t->render('bugform.html', translate('Create Bug'));
+ $t->render('bugform.html', translate("Create Bug"));
}
function show_bug_printable($bugid) {
- global $db, $me, $t, $select, $TITLE, $QUERY, $restricted_projects;
+ global $db, $me, $t, $select, $QUERY, $restricted_projects;
if (!is_numeric($bugid) or
!$row = $db->getRow(sprintf($QUERY['bug-printable'], $bugid,
$restricted_projects))) {
- show_text($STRING['bugbadnum'],true);
+ show_text(translate("That bug does not exist"), true);
exit;
}
$t->assign($row);
$t->assign(array(
- 'bug_dependencies' => delimit_list(', ', $db->getCol('select '.
- db_concat("'<a href=\"$me?op=show&bugid='", 'depends_on', '\'">#\'',
- 'depends_on', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY.
- " where bug_id = $bugid")),
- 'rev_bug_dependencies' => delimit_list(', ', $db->getCol('select '.
- db_concat("'<a href=\"$me?op=show&bugid='", 'bug_id', '\'">#\'',
- 'bug_id', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY.
- " where depends_on = $bugid"))
+ 'bug_dependencies' => @join(', ', $db->getCol('select '.db_concat("'<a href=\"$me?op=show&bugid='", 'depends_on', '\'">#\'','depends_on', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY." where bug_id = $bugid")),
+ 'rev_bug_dependencies' => @join(', ', $db->getCol('select '.db_concat("'<a href=\"$me?op=show&bugid='", 'bug_id', '\'">#\'','bug_id', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY." where depends_on = $bugid"))
));
// Show the comments
- $t->assign('comments', $db->getAll('select comment_text, c.created_date, login'.
- ' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER.
- " where bug_id = $bugid and c.created_by = user_id order by c.created_date"
- ));
- $t->render('bugdisplay-printable.html', translate('View Bug'));
+ $t->assign('comments', $db->getAll('select comment_text, c.created_date, login from '.TBL_COMMENT.' c, '.TBL_AUTH_USER." where bug_id = $bugid and c.created_by = user_id order by c.created_date"));
+ $t->render('bugdisplay-printable.html', translate("View Bug"));
}
///
/// Grab the links for the previous and next bugs in the list
function prev_next_links($bugid, $pos) {
- global $dsn, $_sv, $QUERY, $t;
+ global $dsn, $QUERY, $t;
// Create a new db connection because of the limit query affecting later queries
$db = DB::Connect($dsn);
@@ -691,7 +570,7 @@
$db->setOption('optimize', 'portability');
$db->setErrorHandling(PEAR_ERROR_CALLBACK, "handle_db_error");
- if (!isset($_sv['queryinfo']['query']) || !$_sv['queryinfo']['query']) {
+ if (!isset($_SESSION['queryinfo']['query']) || !$_SESSION['queryinfo']['query']) {
return array('', '');
}
@@ -703,8 +582,8 @@
$limit = 1;
}
$rs = $db->limitQuery(sprintf($QUERY['bug-prev-next'],
- $_sv['queryinfo']['query'], $bugid, $_sv['queryinfo']['order'],
- $_sv['queryinfo']['sort']), $offset, $limit);
+ $_SESSION['queryinfo']['query'], $bugid, $_SESSION['queryinfo']['order'],
+ $_SESSION['queryinfo']['sort']), $offset, $limit);
list($firstid, $chunks) = $rs->fetchRow();
list($secondid, $chunks) = $rs->fetchRow();
@@ -724,61 +603,31 @@
}
function show_bug($bugid = 0, $error = array()) {
- global $db, $me, $t, $STRING, $TITLE, $u, $_gv, $_pv, $QUERY, $restricted_projects;
+ global $db, $me, $t, $u, $QUERY, $restricted_projects;
if (!ereg('^[0-9]+$',$bugid) or
!$row = $db->getRow(sprintf($QUERY['bug-show-bug'], $bugid,
$restricted_projects))) {
- show_text($STRING['bugbadnum'],true);
+ show_text(translate("That bug does not exist"), true);
return;
}
- prev_next_links($bugid, isset($_gv['pos']) ? $_gv['pos'] : 0);
+ prev_next_links($bugid, isset($_GET['pos']) ? $_GET['pos'] : 0);
$t->assign($row);
// Override the database values with posted values if there were errors
- if (count($error)) $t->assign($_pv);
+ if (count($error)) $t->assign($_POST);
- $bug_dependencies = $db->query('SELECT '.TBL_BUG.'.status_id, '.
- TBL_BUG.'.bug_id FROM '.
- TBL_BUG.', '.TBL_BUG_DEPENDENCY.' WHERE '.TBL_BUG.'.bug_id = '.
- TBL_BUG_DEPENDENCY.'.depends_on AND '.TBL_BUG_DEPENDENCY.
- '.bug_id = '.$bugid);
-
- $bug_dependencies_display = array();
- if ($bug_dependencies->numRows()) {
- while ($bug_dependencies->fetchInto($dependency)) {
- $bug_dependencies_display[] =
- '<a href="'.$me.'?op=show&bugid='.$dependency['bug_id'].
- '">'.($dependency['status_id'] == 5 ? '<strike>':'').'#'.
- $dependency['bug_id'].($dependency['status_id'] == 5 ? '</strike>':'').'</a>';
- }
- }
+ $bug_dependencies = $db->getAll("select b.bug_id, s.bug_open from ".TBL_BUG_DEPENDENCY." d, ".TBL_BUG." b, ".TBL_STATUS." s where d.bug_id = $bugid and d.depends_on = b.bug_id and b.status_id = s.status_id");
- $bug_blocks = $db->query('SELECT '.TBL_BUG.'.status_id, '.
- TBL_BUG.'.bug_id FROM '.
- TBL_BUG.', '.TBL_BUG_DEPENDENCY.' WHERE '.TBL_BUG.'.bug_id = '.
- TBL_BUG_DEPENDENCY.'.bug_id AND '.TBL_BUG_DEPENDENCY.
- '.depends_on = '.$bugid);
-
- $bug_blocks_display = array();
- if ($bug_blocks->numRows()) {
- while ($bug_blocks->fetchInto($block)) {
- $bug_blocks_display[] =
- '<a href="'.$me.'?op=show&bugid='.$block['bug_id'].
- '">'.($block['status_id'] == 5 ? '<strike>':'').'#'.
- $block['bug_id'].($block['status_id'] == 5 ? '</strike>':'').'</a>';
- }
- }
+ $bug_blocks = $db->getAll("select b.bug_id, s.bug_open from ".TBL_BUG_DEPENDENCY." d, ".TBL_BUG." b, ".TBL_STATUS." s where d.depends_on = $bugid and d.bug_id = b.bug_id and b.status_id = s.status_id");
$t->assign(array(
'error' => $error,
- 'already_voted' => $db->getOne("select count(*) from ".TBL_BUG_VOTE.
- " where bug_id = $bugid and user_id = $u"),
- 'num_votes' => $db->getOne("select count(*) from ".TBL_BUG_VOTE.
- " where bug_id = $bugid"),
- 'bug_dependencies' => implode(', ', $bug_dependencies_display),
- 'rev_bug_dependencies' => implode(', ', $bug_blocks_display)
+ 'already_voted' => $db->getOne("select count(*) from ".TBL_BUG_VOTE." where bug_id = $bugid and user_id = $u"),
+ 'num_votes' => $db->getOne("select count(*) from ".TBL_BUG_VOTE." where bug_id = $bugid"),
+ 'bug_dependencies' => $bug_dependencies,
+ 'bug_blocks' => $bug_blocks
));
// Show the attachments
@@ -795,16 +644,14 @@
// Show the comments
$t->assign(array(
'attachments' => $attachments,
- 'comments' => $db->getAll('select comment_text, c.created_date, login'.
- ' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER.
- " where bug_id = $bugid and c.created_by = user_id order by c.created_date")
+ 'comments' => $db->getAll('select comment_text, c.created_date, login'.' from '.TBL_COMMENT.' c, '.TBL_AUTH_USER." where bug_id = $bugid and c.created_by = user_id order by c.created_date")
));
- $t->render('bugdisplay.html', translate('View Bug'));
+ $t->render('bugdisplay.html', translate("View Bug"));
}
function show_projects() {
- global $db, $t, $STRING, $perm, $restricted_projects, $_gv;
+ global $db, $t, $perm, $restricted_projects;
// Show only active projects with at least one component
if ($perm->have_perm('Admin')) { // Show admins all projects
@@ -813,15 +660,11 @@
$p_query = " and p.project_id not in ($restricted_projects)";
}
$projects = array();
- $projects = $db->getAll('select p.project_id, p.project_name, p.project_desc, p.created_date
- from '.TBL_PROJECT.' p, '.TBL_COMPONENT.
- ' c where p.active = 1 and p.project_id = c.project_id'.$p_query.
- ' group by p.project_id, p.project_name, p.project_desc, p.created_date'.
- ' order by project_name');
+ $projects = $db->getAll('select p.project_id, p.project_name, p.project_desc, p.created_date from '.TBL_PROJECT.' p, '.TBL_COMPONENT.' c where p.active = 1 and p.project_id = c.project_id'.$p_query.' group by p.project_id, p.project_name, p.project_desc, p.created_date order by project_name');
switch (count($projects)) {
case 0 :
- show_text($STRING['noprojects'], true);
+ show_text(translate("No projects found"), true);
return;
case 1 :
$_GET['project'] = $projects[0]['project_id'];
@@ -829,40 +672,40 @@
break;
default :
$t->assign('projects', $projects);
- $t->render('projectlist.html', translate('Select Project'));
+ $t->render('projectlist.html', translate("Select Project"));
}
}
-if ($op) {
- switch($op) {
+if (!empty($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
case 'history':
- show_history($_gv['bugid']);
+ show_history($_GET['bugid']);
break;
case 'add':
$perm->check('Editbug');
- if (isset($_gv['project'])) {
+ if (isset($_GET['project'])) {
show_form();
} else {
show_projects();
}
break;
case 'show':
- show_bug($_gv['bugid']);
+ show_bug($_GET['bugid']);
break;
case 'update':
- update_bug($_pv['bugid']);
+ update_bug($_POST['bugid']);
break;
case 'do':
- do_form($_pv['bugid']);
+ do_form($_POST['bugid']);
break;
case 'print':
- show_bug_printable($_gv['bugid']);
+ show_bug_printable($_GET['bugid']);
break;
case 'vote':
- vote_bug($_gv['bugid']);
+ vote_bug($_GET['bugid']);
break;
case 'viewvotes':
- vote_view($_gv['bugid']);
+ vote_view($_GET['bugid']);
break;
}
} else {
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:38:34
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory sc8-pr-cvs1:/tmp/cvs-serv15006/templates/default
Modified Files:
Tag: htmltemplates
bugform.html
Log Message:
Cleaned up the description field
Index: bugform.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/bugform.html,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -u -r1.9.4.1 -r1.9.4.2
--- bugform.html 30 Aug 2003 22:00:32 -0000 1.9.4.1
+++ bugform.html 1 Sep 2003 13:38:31 -0000 1.9.4.2
@@ -48,9 +48,7 @@
<?php echo translate("Description"); ?>:
</td>
<td>
- <textarea name="description" cols="50" rows="8" wrap="virtual">
- <?php echo htmlspecialchars(stripslashes($description)) ?>
- </textarea>
+ <textarea name="description" cols="50" rows="8" wrap="virtual"> <?php echo htmlspecialchars(stripslashes($description)) ?></textarea>
</td>
</tr>
<tr>
|
|
From: Benjamin C. <bc...@us...> - 2003-09-01 13:38:12
|
Update of /cvsroot/phpbt/phpbt/templates/default
In directory sc8-pr-cvs1:/tmp/cvs-serv14940/templates/default
Modified Files:
Tag: htmltemplates
projectlist.html
Log Message:
Fixed a bug
Index: projectlist.html
===================================================================
RCS file: /cvsroot/phpbt/phpbt/templates/default/projectlist.html,v
retrieving revision 1.3.6.1
retrieving revision 1.3.6.2
diff -u -r1.3.6.1 -r1.3.6.2
--- projectlist.html 30 Aug 2003 22:00:34 -0000 1.3.6.1
+++ projectlist.html 1 Sep 2003 13:38:04 -0000 1.3.6.2
@@ -7,7 +7,7 @@
<?php printf('<a href="bug.php?op=add&project=%d">%s</a>:', $projects[$i]['project_id'], stripslashes($projects[$i]['project_name'])); ?>
</td>
<td valign="top">
- <?php echo nl2br(stripslashes($projects[$i]['project_desc']));
+ <?php echo nl2br(stripslashes($projects[$i]['project_desc'])); ?>
</td>
</tr>
<?php } ?>
|
|
From: Ken T. <ke...@to...> - 2003-08-31 05:05:26
|
ben,
nice changes on the gettext front. translate("foo"); is already looking
much better... :-)
ken
|