|
From: Benjamin C. <bc...@us...> - 2001-11-14 14:28:09
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv7707
Modified Files:
bug.php include.php query.php user.php
Log Message:
Code cleanup
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- bug.php 2001/11/14 04:39:23 1.60
+++ bug.php 2001/11/14 14:28:06 1.61
@@ -27,7 +27,8 @@
///
/// Beautify the bug comments
function format_comments($comments) {
-
+ global $me;
+
// Set up the regex replacements
$patterns = array(
'/(bug)[[:space:]]*(#?)([0-9]+)/i', // matches bug #nn
@@ -447,7 +448,7 @@
}
function show_bug_printable($bugid) {
- global $q, $t, $select;
+ global $q, $t, $select, $TITLE;
if (!is_numeric($bugid) or
!$row = $q->grab('select b.*, reporter.login as reporter,
@@ -478,7 +479,7 @@
'severity' => $row['severity_name'],
'priority' => $select['priority'][$row['priority']],
'status' => $row['status_name'],
- 'resolution' => $row['resolution_name'] ? $row['resolution_name'] : '',
+ 'resolution' => !empty($row['resolution_name']) ? $row['resolution_name'] : '',
'owner' => maskemail($row['owner']),
'reporter' => maskemail($row['reporter']),
'createddate' => date(DATE_FORMAT,$row['created_date']),
@@ -500,8 +501,6 @@
} else {
while ($row = $q->grab()) {
$t->set_var(array(
- 'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
- 'trclass' => $i % 2 ? '' : 'alt',
'rdescription' => nl2br(format_comments(
htmlspecialchars($row['comment_text']))),
'rreporter' => maskemail($row['login']),
@@ -562,8 +561,8 @@
return array($prevlink, $nextlink);
}
-function show_bug($bugid = 0, $error = '') {
- global $q, $me, $t, $project, $STRING, $u, $perm, $_gv;
+function show_bug($bugid = 0, $error = array()) {
+ global $q, $me, $t, $project, $STRING, $TITLE, $u, $perm, $_gv;
if (!ereg('^[0-9]+$',$bugid) or
!$row = $q->grab('select b.*, reporter.login as reporter, owner.login as owner, status_name, resolution_name
@@ -589,7 +588,7 @@
list($prevlink, $nextlink) = prev_next_links($bugid, $_gv['pos']);
$t->set_var(array(
- 'statuserr' => $error['status'] ? $error['status'].'<br><br>' : '',
+ 'statuserr' => isset($error['status']) ? $error['status'].'<br><br>' : '',
'bugid' => $bugid,
'TITLE' => "{$TITLE['editbug']} #$bugid",
'title' => stripslashes($row['title']),
@@ -599,7 +598,7 @@
'severity' => build_select('severity',$row['severity_id']),
'priority' => build_select('priority',$row['priority']),
'status' => $row['status_name'],
- 'resolution' => $row['resolution_name'] ? $row['resolution_name'] : '',
+ 'resolution' => !empty($row['resolution_name']) ? $row['resolution_name'] : '',
'owner' => maskemail($row['owner']),
'reporter' => maskemail($row['reporter']),
'createddate' => date(DATE_FORMAT,$row['created_date']),
@@ -650,6 +649,7 @@
if (!$q->num_rows()) {
$t->set_var('attrows', '<tr><td colspan="5" align="center">No attachments</td></tr>');
} else {
+ $j = 0;
while ($att = $q->grab()) {
if (is_readable(INSTALL_PATH.'/'.ATTACHMENT_PATH."/{$row['project_id']}/$bugid-{$att['file_name']}")) {
$action = "<a href='attachment.php?attachid={$att['attachment_id']}'>View</a>";
@@ -688,6 +688,7 @@
if (!$q->num_rows()) {
$t->set_var('rows','');
} else {
+ $i = 1;
while ($row = $q->grab()) {
$t->set_var(array(
'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- include.php 2001/11/14 04:58:06 1.75
+++ include.php 2001/11/14 14:28:06 1.76
@@ -143,7 +143,7 @@
function pparse($target, $handle, $append = false) {
global $auth, $perm, $q;
- $u = $auth->auth['uid'];
+ $u = isset($auth->auth['uid']) ? $auth->auth['uid'] : 0;
$this->set_block('wrap', 'logoutblock', 'loblock');
$this->set_block('wrap', 'loginblock', 'liblock');
$this->set_block('wrap', 'adminnavblock', 'anblock');
@@ -435,8 +435,8 @@
/// 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 ($ary[1]) return join($delimiter, $ary);
- elseif ($ary[0]) return ($ary[0]);
+ if (isset($ary[1])) return join($delimiter, $ary);
+ elseif (isset($ary[0])) return ($ary[0]);
else return '';
}
@@ -464,7 +464,7 @@
// Begin every page with a page_open
if (!defined('NO_AUTH')) {
page_open(array('sess' => 'usess', 'auth' => 'uauth', 'perm' => 'uperm'));
- $u = $auth->auth['uid'];
+ $u = isset($auth->auth['uid']) ? $auth->auth['uid'] : 0;
}
// Check to see if the user is trying to login
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- query.php 2001/11/14 04:58:06 1.41
+++ query.php 2001/11/14 14:28:06 1.42
@@ -194,7 +194,7 @@
$queryinfo['order'] = $order;
$queryinfo['sort'] = $sort;
- if (!$queryinfo['query'] or $op) {
+ if (empty($queryinfo['query']) or $op) {
$queryinfo['query'] = build_query($assignedto, $reportedby, $open);
}
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/user.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- user.php 2001/11/13 03:53:04 1.17
+++ user.php 2001/11/14 14:28:06 1.18
@@ -75,7 +75,7 @@
$t->set_var(array(
'column_name' => $field,
'column_title' => $title,
- 'checked' => $checked[$field] ? 'checked' : ''
+ 'checked' => !empty($checked[$field]) ? 'checked' : ''
));
$t->parse('list_rows', 'column_list_row', true);
}
@@ -84,7 +84,7 @@
$t->set_file('wrap', 'wrap.html');
$perm->check_group('User');
-if ($do) switch ($do) {
+if (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;
default : show_preferences_form();
|