diff --git a/mozilla/tools/reporter/app/login/index.php b/mozilla/tools/reporter/app/login/index.php index 10d575584d1..2fcf890624b 100644 --- a/mozilla/tools/reporter/app/login/index.php +++ b/mozilla/tools/reporter/app/login/index.php @@ -35,85 +35,44 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -require_once("../../config.inc.php"); -require_once('DB.php'); -require_once($config['app_path'].'/includes/iolib.inc.php'); -require_once($config['app_path'].'/includes/security.inc.php'); -// Start Session +require_once('../../config.inc.php'); +require_once($config['base_path'].'/includes/iolib.inc.php'); +require_once($config['base_path'].'/includes/db.inc.php'); +require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php'); +require_once($config['base_path'].'/includes/security.inc.php'); + // start the session session_name('reportSessID'); session_start(); header("Cache-control: private"); //IE 6 Fix printheaders(); -include($config['app_path'].'/includes/header.inc.php'); -include($config['app_path'].'/includes/message.inc.php'); - -if (isset($_POST['redirect'])){ - $redirect = $_POST['redirect']; -} -else if (isset($_GET['redirect'])){ - $redirect = $_GET['redirect']; -} -else { - $redirect = $config['app_url']; -} - - if ($_SESSION['login'] != true){ - // submit form? - if (isset($_POST['submit_login'])){ + if(isset($_POST['do_login'])){ + $login = false; - // Open DB - PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrors'); - $db =& DB::connect($config['db_dsn']); + $db = NewDBConnection($config['db_dsn']); + $db->SetFetchMode(ADODB_FETCH_ASSOC); - $loginCheck = false; - $loginCheck = $userlib->login($_POST['username'], $_POST['password']); + $login = $securitylib->login($_POST['username'], $_POST['password']); - // disconnect database - $db->disconnect(); + $db->Close(); - if ($loginCheck[0] == true){ - header("Location: ".$redirect); - exit; - } else { - $error = true; - ?>Login Failed - - - - - -
-
- Login -
- - - - - - - - - -
/>
- - -
-
-
-
Administrator Login
-

Contact Robert Accettura if you need an admin account. This is for special circumstances only.

-
- assign('error', 'Incorrect Username or Password'); + } + + if(!isset($content)){ + $content = initializeTemplate(); + } + displayPage($content, 'login', 'login.tpl'); + exit; } else { - header("Location: ".$redirect); + header('Location: '.$config['base_url']); } -include($config['app_path'].'/includes/footer.inc.php'); -?> +?> \ No newline at end of file diff --git a/mozilla/tools/reporter/app/logout/index.php b/mozilla/tools/reporter/app/logout/index.php index ee7c3007d18..20cd72a4713 100644 --- a/mozilla/tools/reporter/app/logout/index.php +++ b/mozilla/tools/reporter/app/logout/index.php @@ -37,7 +37,7 @@ * ***** END LICENSE BLOCK ***** */ require_once('../../config.inc.php'); -require_once($config['app_path'].'/includes/iolib.inc.php'); +require_once($config['base_path'].'/includes/iolib.inc.php'); // start the session session_name('reportSessID'); @@ -48,16 +48,10 @@ printheaders(); $_SESSION = array(); session_destroy(); -if (isset($_GET['redirect'])){ - $redirect = $_GET['redirect']; -} else { - $redirect = $config['app_url']; -} - if($_SESSION['username']){ - // not sure if this could ever happen, but just incase. + // not sure if this could ever happen, but just in case. echo 'Failed to logout'; } else { - header("Location: ".$redirect); + header("Location: ".$config['base_url']); } ?> diff --git a/mozilla/tools/reporter/app/styles/style.css b/mozilla/tools/reporter/app/styles/style.css index 958d68bad75..8c6b1d7cf2c 100644 --- a/mozilla/tools/reporter/app/styles/style.css +++ b/mozilla/tools/reporter/app/styles/style.css @@ -1,140 +1,139 @@ body { - margin: 0 30px 2em 30px; - color: #333; - background: #fff url("img/body_back.gif") repeat-x; - font-size: 100%; + margin: 0 30px 2em 30px; + color: #333; + background: #fff url("img/body_back.gif") repeat-x; + font-size: 100%; } body, td, th, h3, input, pre { /* redundant rules for bad browsers */ - font-family: verdana, sans-serif; - voice-family: "\"}\""; - voice-family: inherit; + font-family: verdana, sans-serif; + voice-family: "\"}\""; + voice-family: inherit; } #container { - width: 100%; - margin: 0 auto; + width: 100%; + margin: 0 auto; } #page { - padding: 15px 0 0 0; + padding: 15px 0 0 0; } #content { - background: url("img/page-background.gif") repeat-x top left; - font-size: 0.8em; + background: url("img/page-background.gif") repeat-x top left; + font-size: 0.8em; } #mozilla-org { - position: relative; - height: 25px; + position: relative; + height: 25px; } #mozilla-org a { - position: absolute; - right: 0; - top: 0; - display: block; - width: 110px; - height: 25px; - background: url("img/mozilla-org.gif") no-repeat; - text-decoration: none; - text-indent: -5000em; + position: absolute; + right: 0; + top: 0; + display: block; + width: 110px; + height: 25px; + background: url("img/mozilla-org.gif") no-repeat; + text-decoration: none; + text-indent: -5000em; } .skipLink { - display: none; + display: none; } #reporterSearch label { - font-weight: bold; + font-weight: bold; } #reporterSearch .label { - text-align: right; + text-align: right; } #reporterQuery { - font-size: 0.9em; + font-size: 0.9em; } #reporterQuery .header { - background-color: #ddd; - color: #666; - text-align: left; + background-color: #ddd; + color: #666; + text-align: left; } #reporterQuery .header a { - color: #666; - text-decoration: none; + color: #666; + text-decoration: none; } #reporterQuery td { - border-bottom: 1px solid #eee; - padding: 1px 0 1px 0; - font-size: 0.9em; + border-bottom: 1px solid #eee; + padding: 1px 0 1px 0; + font-size: 0.9em; } #reporterReport .header{ - background-color: #eee; - width: 100%; - text-align: center; - font-weight: bold; - padding: 4px 0 4px 0; + background-color: #eee; + width: 100%; + text-align: center; + font-weight: bold; + padding: 4px 0 4px 0; } #reporterReport div { - margin-bottom: 3px; + margin-bottom: 3px; } #reporterReport .title { - float: left; - width: 9em; - padding: 0 .5em; - text-align: right; - font-weight: bold; + float: left; + width: 9em; + padding: 0 .5em; + text-align: right; + font-weight: bold; } #reporterReport .data { - overflow: auto; + overflow: auto; } - #header{ - margin: 20px 0 16px 0; - bottom: 1px solid #eee; - } - #header h1 { - display: inline; - font-size: 2.2em; - } +#header{ + margin: 20px 0 16px 0; + bottom: 1px solid #eee; +} +#header h1 { + display: inline; + font-size: 2.2em; +} +#header #logo { + margin: 0; + float: left; + width: 500px; +} - #header #logo { - margin: 0; - float: left; - width: 500px; - } - - #header #logo a { - text-decoration: none; - color: #000; - } +#header #logo a { + text-decoration: none; + color: #000; +} - #header a img { - border: 0; - } - #header #navbox { - float: right; - margin-top: 8px; - margin-right: 15px; +#header a img { + border: 0; +} +#header #navbox { + float: right; + margin-top: 8px; + margin-right: 15px; background-color: #eee; border: 1px solid #333; font-size: 0.8em; - } + } - #navbox ul { - padding: 0 0 0 8px; - } - #navbox li { + #navbox ul { + padding: 0 0 0 8px; + } + #navbox li { display: inline; margin: 0; padding: 0 8px 0 0; @@ -143,24 +142,46 @@ body, td, th, h3, input, pre { /* redundant rules for bad browsers */ } .navigation { - text-align: center; - margin: 12px auto 5px auto; + text-align: center; + margin: 12px auto 5px auto; } .navigation .currentPage { - font-weight: bold; + font-weight: bold; } .navigation a { - text-decoration: none; - color: #000; + text-decoration: none; + color: #000; } .navigation a:hover { - border-bottom: 2px solid #000; + border-bottom: 2px solid #000; +} + +#login_form label{ + float: left; + width: 9em; + padding: 0 .5em; + text-align: right; + font-weight: bold; +} + +#login_leftcol{ + float: left; + width: 45%; + padding: 2px 9px 5px 9px; + +} + +#login_rightcol { + float: right; + width: 45%; + padding: 2px 9px 5px 9px; } /* + #reporter_note { border: 1px solid #ccc; background: #eee; diff --git a/mozilla/tools/reporter/includes/iolib.inc.php b/mozilla/tools/reporter/includes/iolib.inc.php index 9d2f1281022..b719fd9c120 100644 --- a/mozilla/tools/reporter/includes/iolib.inc.php +++ b/mozilla/tools/reporter/includes/iolib.inc.php @@ -61,12 +61,12 @@ function initializeTemplate(){ function templateStandardVars($object){ - global $config, $userlib; + global $config, $securitylib; $object->assign('base_url', $config['base_url']); $object->assign('app_url', $config['base_url'].'/app'); $object->assign('charset', 'utf-8'); - $object->assign('is_admin', $userlib->isLoggedIn()); + $object->assign('is_admin', $securitylib->isLoggedIn()); return $object; } @@ -117,7 +117,7 @@ function strMiddleReduceWordSensitive($string, $max = 50, $rep = '[...]') { } return $return; return substr($string, 0, $start) . $rep . substr($string, - $end); -} +} function resolveProblemTypes($q){ global $problemTypes; diff --git a/mozilla/tools/reporter/includes/security.inc.php b/mozilla/tools/reporter/includes/security.inc.php index 446130e81fb..6c6ea0be8e9 100644 --- a/mozilla/tools/reporter/includes/security.inc.php +++ b/mozilla/tools/reporter/includes/security.inc.php @@ -36,32 +36,38 @@ * * ***** END LICENSE BLOCK ***** */ -class userlib { +class securitylib { -function login($username, $password){ - global $db; + function login($username, $password){ + global $db; - $data =& $db->getRow("SELECT user.user_id, user.user_username, user.user_password, user.user_realname, user.user_status - FROM user - WHERE user.user_username = ".$db->quote($username)." AND user.user_password = md5(".$db->quote($password).")", DB_FETCHMODE_ASSOC); - if ($data['user_status'] == 1){ - $_SESSION['user_id'] = $data['user_id']; - $_SESSION['user_realname'] = $data['user_realname']; - $_SESSION['user_username'] = $data['user_username']; - $_SESSION['login'] = true; - return array(true, ''); + $data = $db->Execute("SELECT user.user_id, user.user_username, user.user_password, user.user_realname, user.user_status + FROM user + WHERE user.user_username = ".$db->quote($username)." + AND user.user_password = PASSWORD(".$db->quote($password).") + AND user.user_status = 1"); + if(!$data || $data->EOF){ + return false; + } + if ($data->fields['user_status'] == 1){ + $_SESSION['user_id'] = $data->fields['user_id']; + $_SESSION['user_realname'] = $data->fields['user_realname']; + $_SESSION['user_username'] = $data->fields['user_username']; + $_SESSION['login'] = true; + session_regenerate_id(); + return true; + } + return false; } - return array(false, 'Bad Status'); -} -function isLoggedIn(){ - if ($_SESSION['user_username'] && $_SESSION['login'] == true){ - return true; + function isLoggedIn(){ + if ($_SESSION['user_username'] && $_SESSION['login'] == true){ + return true; + } + return false; } - return false; -} // End Class } -$userlib = new userlib; -?> +$securitylib = new securitylib; +?> \ No newline at end of file diff --git a/mozilla/tools/reporter/templates/layout.tpl b/mozilla/tools/reporter/templates/layout.tpl index 5465a992c38..072392316b5 100644 --- a/mozilla/tools/reporter/templates/layout.tpl +++ b/mozilla/tools/reporter/templates/layout.tpl @@ -23,7 +23,13 @@