Changeset 1200
- Timestamp:
- 08/03/2008 11:44:32 PM (2 years ago)
- Files:
-
- 1 modified
-
branches/1.1.6.6/actions/usersettings.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1.6.6/actions/usersettings.php
r868 r1200 99 99 if (!defined('RETRIEVE_PASSWORD_MESSAGE')) define('RETRIEVE_PASSWORD_MESSAGE', "If you need a password reminder, click [[PasswordForgotten here]]. --- You can login here using your password reminder."); 100 100 if (!defined('TEMP_PASSWORD_LABEL')) define('TEMP_PASSWORD_LABEL', "Password reminder:"); 101 if (!defined('USERSETTINGS_REDIRECT_AFTER_LOGIN_LABEL')) define('USERSETTINGS_REDIRECT_AFTER_LOGIN_LABEL', 'Redirect to %s after login'); // %s page to redirect to 101 102 102 103 //initialize variables … … 133 134 $params = ($this->config['rewrite_mode'] == 1) ? '?' : '&'; 134 135 136 $regex_referrer = '@^'.preg_quote($this->config['base_url'], '@').'([^\/\?&]*)@i'; 137 if (isset($_SERVER['HTTP_REFERER']) && preg_match($regex_referrer, $_SERVER['HTTP_REFERER'], $match)) 138 { 139 if (strcasecmp($this->tag, $match[1])) 140 { 141 $_SESSION['go_back'] = $_SERVER['HTTP_REFERER']; 142 //We save the tag of the referring page, this tag is to be shown in label <Go back to ...>. We must use a session here because if the user 143 //Refresh the page by hitting <Enter> on the address bar, the value would be lost. 144 $_SESSION['go_back_tag'] = $match[1]; 145 } 146 } 147 135 148 // BEGIN *** Logout *** 136 149 // is user trying to log out? … … 404 417 default: 405 418 $this->SetUser($existingUser); 406 $this->Redirect($url, ''); 419 if ((isset($_SESSION['go_back'])) && (isset($_POST['do_redirect']))) 420 { 421 $go_back = $_SESSION['go_back']; 422 unset($_SESSION['go_back']); 423 unset($_SESSION['go_back_tag']); 424 $this->Redirect($go_back); 425 } 426 else 427 { 428 $this->Redirect($url, ''); 429 } 407 430 } 408 431 } … … 487 510 // log in 488 511 $this->SetUser($this->LoadUser($name)); 489 $params .= 'registered=true'; 490 $this->Redirect($url.$params); 512 if ((isset($_SESSION['go_back'])) && (isset($_POST['do_redirect']))) 513 { 514 $go_back = $_SESSION['go_back']; 515 unset($_SESSION['go_back']); 516 unset($_SESSION['go_back_tag']); 517 $this->Redirect($go_back); 518 } 519 else 520 { 521 $params .= 'registered=true'; 522 $this->Redirect($url.$params); 523 } 491 524 } 492 525 // END *** Register *** … … 561 594 <td><input <?php echo $password_highlight; ?> type="password" name="password" size="40" /></td> 562 595 </tr> 596 <?php 597 if (isset($_SESSION['go_back'])) 598 { 599 ?> 600 <tr> 601 <td align="right"><?php printf(USERSETTINGS_REDIRECT_AFTER_LOGIN_LABEL, $_SESSION['go_back_tag']); ?></td> 602 <td><input type='checkbox' name='do_redirect' id='do_redirect'<?php if(isset($_POST['do_redirect']) || empty($_POST)) echo 'checked="checked"'; ?> /> 603 </tr> 604 <?php 605 } 606 ?> 563 607 <tr> 564 608 <td> </td>