Commit 7332694f0e4e886f6173829467473f42b2f5ccee
1 parent
de96e310
KTS-2272
"Missing result variable in login.php" Fixed. Added res variable. Committed By: Kevin Fourie Reviewed By: Jalaloedien Abrahams git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7081 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
20 additions
and
20 deletions
login.php
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * $Id$ |
| 4 | - * | |
| 4 | + * | |
| 5 | 5 | * This page handles logging a user into the dms. |
| 6 | 6 | * This page displays the login form, and performs the business logic login processing. |
| 7 | 7 | * |
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 10 | 10 | * compliance with the License. You may obtain a copy of the License at |
| 11 | 11 | * http://www.knowledgetree.com/KPL |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * Software distributed under the License is distributed on an "AS IS" |
| 14 | 14 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 15 | 15 | * See the License for the specific language governing rights and |
| ... | ... | @@ -20,9 +20,9 @@ |
| 20 | 20 | * (ii) the KnowledgeTree copyright notice |
| 21 | 21 | * in the same form as they appear in the distribution. See the License for |
| 22 | 22 | * requirements. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The Original Code is: KnowledgeTree Open Source |
| 25 | - * | |
| 25 | + * | |
| 26 | 26 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 27 | 27 | * (Pty) Ltd, trading as KnowledgeTree. |
| 28 | 28 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -86,7 +86,7 @@ class LoginPageDispatcher extends KTDispatcher { |
| 86 | 86 | $redirect = KTUtil::arrayGet($_REQUEST, 'redirect'); |
| 87 | 87 | |
| 88 | 88 | // DEPRECATED initialise page-level authorisation array |
| 89 | - $_SESSION["pageAccess"] = NULL; | |
| 89 | + $_SESSION["pageAccess"] = NULL; | |
| 90 | 90 | |
| 91 | 91 | $cookietest = KTUtil::randomString(); |
| 92 | 92 | setcookie("CookieTestCookie", $cookietest, 0); |
| ... | ... | @@ -122,10 +122,10 @@ class LoginPageDispatcher extends KTDispatcher { |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | KTInterceptorRegistry::checkInterceptorsForTakeOver(); |
| 125 | - | |
| 125 | + | |
| 126 | 126 | $this->check(); // bounce here, potentially. |
| 127 | 127 | header('Content-type: text/html; charset=UTF-8'); |
| 128 | - | |
| 128 | + | |
| 129 | 129 | $errorMessage = KTUtil::arrayGet($_REQUEST, 'errorMessage'); |
| 130 | 130 | $redirect = KTUtil::arrayGet($_REQUEST, 'redirect'); |
| 131 | 131 | |
| ... | ... | @@ -157,21 +157,21 @@ class LoginPageDispatcher extends KTDispatcher { |
| 157 | 157 | 'selected_language' => $sLanguageSelect, |
| 158 | 158 | 'disclaimer' => $sDisclaimer, |
| 159 | 159 | ); |
| 160 | - return $oTemplate->render($aTemplateData); | |
| 160 | + return $oTemplate->render($aTemplateData); | |
| 161 | 161 | } |
| 162 | - | |
| 162 | + | |
| 163 | 163 | function simpleRedirectToMain($errorMessage, $url, $params) { |
| 164 | 164 | $params[] = 'errorMessage='. urlencode($errorMessage); |
| 165 | 165 | $url .= '?' . join('&', $params); |
| 166 | 166 | redirect($url); |
| 167 | 167 | exit(0); |
| 168 | 168 | } |
| 169 | - | |
| 169 | + | |
| 170 | 170 | function do_login() { |
| 171 | 171 | $aExtra = array(); |
| 172 | 172 | $oUser =& KTInterceptorRegistry::checkInterceptorsForAuthenticated(); |
| 173 | 173 | if (is_a($oUser, 'User')) { |
| 174 | - $this->performLogin($oUser); | |
| 174 | + $res = $this->performLogin($oUser); | |
| 175 | 175 | if ($res) { |
| 176 | 176 | $oUser = array($res); |
| 177 | 177 | } |
| ... | ... | @@ -194,23 +194,23 @@ class LoginPageDispatcher extends KTDispatcher { |
| 194 | 194 | $language = $default->defaultLanguage; |
| 195 | 195 | } |
| 196 | 196 | setcookie("kt_language", $language, 2147483647, '/'); |
| 197 | - | |
| 197 | + | |
| 198 | 198 | $redirect = KTUtil::arrayGet($_REQUEST, 'redirect'); |
| 199 | - | |
| 199 | + | |
| 200 | 200 | $url = $_SERVER["PHP_SELF"]; |
| 201 | 201 | $queryParams = array(); |
| 202 | - | |
| 202 | + | |
| 203 | 203 | if ($redirect !== null) { |
| 204 | 204 | $queryParams[] = 'redirect=' . urlencode($redirect); |
| 205 | 205 | } |
| 206 | - | |
| 206 | + | |
| 207 | 207 | $username = KTUtil::arrayGet($_REQUEST,'username'); |
| 208 | 208 | $password = KTUtil::arrayGet($_REQUEST,'password'); |
| 209 | - | |
| 209 | + | |
| 210 | 210 | if (empty($username)) { |
| 211 | 211 | $this->simpleRedirectToMain(_kt('Please enter your username.'), $url, $queryParams); |
| 212 | 212 | } |
| 213 | - | |
| 213 | + | |
| 214 | 214 | $oUser =& User::getByUsername($username); |
| 215 | 215 | if (PEAR::isError($oUser) || ($oUser === false)) { |
| 216 | 216 | if (is_a($oUser, 'ktentitynoobjects')) { |
| ... | ... | @@ -237,7 +237,7 @@ class LoginPageDispatcher extends KTDispatcher { |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $res = $this->performLogin($oUser); |
| 240 | - | |
| 240 | + | |
| 241 | 241 | if ($res) { |
| 242 | 242 | $this->simpleRedirectToMain($res->getMessage(), $url, $queryParams); |
| 243 | 243 | exit(0); |
| ... | ... | @@ -284,13 +284,13 @@ class LoginPageDispatcher extends KTDispatcher { |
| 284 | 284 | if ($redirect !== null) { |
| 285 | 285 | $queryParams[] = 'redirect='. urlencode($redirect); |
| 286 | 286 | } |
| 287 | - | |
| 287 | + | |
| 288 | 288 | if ($cookieTest !== $cookieVerify) { |
| 289 | 289 | Session::destroy(); |
| 290 | 290 | $this->simpleRedirectToMain(_kt('You must have cookies enabled to use the document management system.'), $url, $queryParams); |
| 291 | 291 | exit(0); |
| 292 | 292 | } |
| 293 | - | |
| 293 | + | |
| 294 | 294 | // check for a location to forward to |
| 295 | 295 | if ($redirect !== null) { |
| 296 | 296 | $url = $redirect; | ... | ... |