Skip to content

Commit

Permalink
Implement SessionInvalid exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed May 7, 2012
1 parent 622cdfa commit 5304b94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/Session/SessionInvalid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Session;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class SessionInvalid extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_SESSION_NOT_VALID, null, false);
parent::__construct(ERROR_SESSION_NOT_VALID, $errorMessage, null);
$this->responseCode = 500;
}
}
11 changes: 2 additions & 9 deletions application/core/session_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@
*
* @uses config_api.php
* @uses constant_inc.php
* @uses error_api.php
* @uses gpc_api.php
* @uses php_api.php
*/

use MantisBT\Exception\Session\SessionHandlerInvalid;
use MantisBT\Exception\Session\SessionInvalid;
use MantisBT\Exception\Session\SessionVariableNotFound;

require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'error_api.php' );
require_api( 'gpc_api.php' );
require_api( 'php_api.php' );

Expand Down Expand Up @@ -230,13 +229,7 @@ function session_validate( $p_session ) {
# Check a continued session request
if ( $t_user_ip != $t_last_ip ) {
session_clean();

trigger_error( ERROR_SESSION_NOT_VALID, WARNING );

$t_url = config_get_global( 'path' ) . config_get_global( 'default_home_page' );
echo "\t<meta http-equiv=\"Refresh\" content=\"4;URL=$t_url\" />\n";

die();
throw new SessionInvalid();
}
}
}
Expand Down

0 comments on commit 5304b94

Please sign in to comment.