|
From: Benjamin C. <bc...@us...> - 2002-03-28 20:47:13
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv17805
Modified Files:
include.php upgrade.php
Log Message:
Add the ability to restrict the bug tracker from anonymous browsing
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- include.php 26 Mar 2002 18:40:27 -0000 1.102
+++ include.php 28 Mar 2002 20:47:06 -0000 1.103
@@ -186,8 +186,9 @@
// Check to see if the user is trying to login
if (isset($_pv['dologin'])) {
- if (isset($_pv['sendpass'])) {
- list($email, $password) = $db->getRow("select email, password from ".TBL_AUTH_USER." where login = '{$_pv['username']}' and active > 0");
+ 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->set_var('loginerror', '<div class="error">Invalid login</div>');
} else {
@@ -200,10 +201,12 @@
$password), sprintf("From: %s\nContent-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n",ADMIN_EMAIL, $STRING['lang_charset']));
$t->set_var('loginerror',
'<div class="result">Your password has been emailed to you</div>');
+ $emailsuccess = true;
}
} else {
if (!$u = $auth->auth_validatelogin()) {
$t->set_var('loginerror', '<div class="error">Invalid login</div>');
+ $username = $_pv['username'];
}
}
@@ -217,6 +220,12 @@
}
}
+}
+
+if (FORCE_LOGIN and !$u and
+ !strstr($HTTP_SERVER_VARS['SCRIPT_NAME'], 'newaccount.php')) {
+ include(INSTALL_PATH.'/templates/'.THEME.'/login.html');
+ exit;
}
$op = isset($_gv['op']) ? $_gv['op'] : (isset($_pv['op']) ? $_pv['op'] : '');
Index: upgrade.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/upgrade.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- upgrade.php 26 Mar 2002 18:43:25 -0000 1.16
+++ upgrade.php 28 Mar 2002 20:47:06 -0000 1.17
@@ -57,6 +57,7 @@
}
$db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('RECALL_LOGIN','0','Enable use of cookies to store username between logins','bool')");
$db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('SHOW_PROJECT_SUMMARIES', '1', 'Itemize bug stats by project on the home page', 'bool')");
+ $db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('FORCE_LOGIN', '1', 'Force users to login before being able to use the bug tracker', 'bool')");
}
include 'templates/default/upgrade-finished.html';
}
|