|
From: Benjamin C. <bc...@us...> - 2001-08-08 04:01:49
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv16292
Modified Files:
bug.php include.php query.php strings-en.php
Log Message:
Anonymous browsing wrap-up -- It should work now (tm)
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- bug.php 2001/08/07 13:50:07 1.17
+++ bug.php 2001/08/08 04:01:46 1.18
@@ -324,7 +324,7 @@
}
function show_bug($bugid = 0, $error = '') {
- global $q, $me, $t, $project, $STRING;
+ global $q, $me, $t, $project, $STRING, $u;
if (!ereg('^[0-9]+$',$bugid) or !$row = $q->grab("select BugID, Title, Reporter.Email as Reporter, Owner.Email as Owner, Project, Version, Severity, Bug.CreatedDate, Bug.LastModifiedDate, Status.Name as Status, Priority, Bug.Description, Resolution.Name as Resolution, URL, Component, OS from Bug, Severity, Status left join User Owner on Bug.AssignedTo = Owner.UserID left join User Reporter on Bug.CreatedBy = Reporter.UserID left join Resolution on Resolution = ResolutionID where BugID = '$bugid' and Severity = SeverityID and Status = StatusID")) {
show_text($STRING['bugbadnum'],true);
@@ -361,7 +361,9 @@
'component' => build_select('Component',$row['Component'],$row['Project']),
'os' => build_select('OS',$row['OS']),
'browserstring' => $row['BrowserString'],
- 'bugresolution' => build_select('Resolution')
+ 'bugresolution' => build_select('Resolution'),
+ 'submit' => $u == 'nobody' ? $STRING['logintomodify'] :
+ '<input type="submit" value="Submit">'
));
switch($row['Status']) {
case 'Unconfirmed' :
@@ -442,6 +444,7 @@
switch($op) {
case 'history' : show_history($bugid); break;
case 'add' :
+ $perm->check('User');
if ($project) show_form();
else show_projects();
break;
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- include.php 2001/08/07 13:48:52 1.17
+++ include.php 2001/08/08 04:01:46 1.18
@@ -92,21 +92,6 @@
global $username, $password, $q, $select, $emailpass, $emailsuccess, $STRING;
if (!$username) return 'nobody';
- if ($emailpass) {
- list($email, $password) = $q->grab("select Email, Password from User where Email = '$username' and UserLevel > 0");
- if (!$q->num_rows()) {
- return false;
- }
- if (ENCRYPTPASS) {
- $password = genpassword(10);
- $mpassword = md5($password);
- $q->query("update User set Password = '$mpassword' where Email = '$username'");
- }
- mail($email, $STRING['newacctsubject'], sprintf($STRING['newacctmessage'],
- $password), 'From: '.ADMINEMAIL);
- $emailsuccess = true;
- return false;
- }
$this->auth['uname'] = $username;
if (ENCRYPTPASS) {
$password = md5($password);
@@ -404,9 +389,34 @@
// Check to see if the user is trying to login
if (isset($HTTP_POST_VARS['login'])) {
- $auth->auth['uid'] = $auth->auth_validatelogin();
- if ($auth->auth['uid'] == 'nobody') {
- $t->set_var('loginerror', 'Invalid login');
+ if (isset($HTTP_POST_VARS['sendpass'])) {
+ list($email, $password) = $q->grab("select Email, Password from User where Email = '$username' and UserLevel > 0");
+ if (!$q->num_rows()) {
+ $t->set_var(array(
+ 'loginerrorcolor' => '#ff0000',
+ 'loginerror' => 'Invalid login<br>'
+ ));
+ } else {
+ if (ENCRYPTPASS) {
+ $password = genpassword(10);
+ $mpassword = md5($password);
+ $q->query("update User set Password = '$mpassword' where Email = '$username'");
+ }
+ mail($email, $STRING['newacctsubject'], sprintf($STRING['newacctmessage'],
+ $password), 'From: '.ADMINEMAIL);
+ $t->set_var(array(
+ 'loginerrorcolor' => '#0000ff',
+ 'loginerror' => 'Your password has been emailed to you<br>'
+ ));
+ }
+ } else {
+ $auth->auth['uid'] = $auth->auth_validatelogin();
+ if ($auth->auth['uid'] == 'nobody') {
+ $t->set_var(array(
+ 'loginerrorcolor' => '#ff0000',
+ 'loginerror' => 'Invalid login<br>'
+ ));
+ }
}
}
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- query.php 2001/08/07 13:50:07 1.9
+++ query.php 2001/08/08 04:01:46 1.10
@@ -17,7 +17,8 @@
$nq = new dbclass;
$t->set_file('content','queryform.html');
- $t->set_block('content','row','rows');
+ $t->set_block('content', 'savequeryblock', 'sqblock');
+ $t->set_block('savequeryblock','row','rows');
// Build the javascript-powered select boxes
$q->query("select ProjectID, Name from Project where Active order by Name");
@@ -41,19 +42,24 @@
$js .= ");\n";
}
- // Grab the saved queries if there are any
- $q->query("select * from SavedQuery where UserID = $u");
- if (!$q->num_rows()) {
- $t->set_var('rows','');
- } else {
- while ($row = $q->grab()) {
- $t->set_var(array(
- 'savedquerystring' => $row['SavedQueryString'],
- 'savedqueryname' => stripslashes($row['SavedQueryName']),
- 'savedqueryid' => $row['SavedQueryID']
- ));
- $t->parse('rows', 'row', true);
+ if ($u != 'nobody') {
+ // Grab the saved queries if there are any
+ $q->query("select * from SavedQuery where UserID = '$u'");
+ if (!$q->num_rows()) {
+ $t->set_var('rows','');
+ } else {
+ while ($row = $q->grab()) {
+ $t->set_var(array(
+ 'savedquerystring' => $row['SavedQueryString'],
+ 'savedqueryname' => stripslashes($row['SavedQueryName']),
+ 'savedqueryid' => $row['SavedQueryID']
+ ));
+ $t->parse('rows', 'row', true);
+ }
}
+ $t->parse('sqblock', 'savequeryblock', true);
+ } else {
+ $t->set_var('sqblock', '');
}
$t->set_var(array(
Index: strings-en.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/strings-en.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- strings-en.php 2001/08/06 03:28:32 1.8
+++ strings-en.php 2001/08/08 04:01:46 1.9
@@ -30,7 +30,8 @@
'bugbadnum' => 'That bug does not exist',
'datecollision' => 'Someone has updated this bug since you viewed it. The bug info has been reloaded with the latest changes.',
'passwordmatch' => 'Those passwords don\'t match -- please try again',
- 'nobughistory' => 'There is no history for that bug'
+ 'nobughistory' => 'There is no history for that bug',
+ 'logintomodify' => 'You must be logged in to modify this bug'
);
// Page titles
|