Skip to content
Snippets Groups Projects
Commit 6d588f07 authored by Preexo's avatar Preexo
Browse files

added all missing Session -> Session2 updates

parent c4fc2f17
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ ini_set('include_path',ini_get('include_path'). PATH_SEPARATOR . '../..'); ...@@ -13,7 +13,7 @@ ini_set('include_path',ini_get('include_path'). PATH_SEPARATOR . '../..');
require_once 'include/utils/utils.php'; require_once 'include/utils/utils.php';
require_once('include/utils/CommonUtils.php'); require_once('include/utils/CommonUtils.php');
require_once("config.inc.php"); require_once("config.inc.php");
require_once("libraries/HTTP_Session/Session.php"); require_once("libraries/HTTP_Session2/HTTP/Session2.php");
require_once('include/database/PearDatabase.php'); require_once('include/database/PearDatabase.php');
require_once 'include/Webservices/Utils.php'; require_once 'include/Webservices/Utils.php';
require_once("modules/Users/Users.php"); require_once("modules/Users/Users.php");
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* All Rights Reserved. * All Rights Reserved.
*************************************************************************************/ *************************************************************************************/
require_once("libraries/HTTP_Session/Session.php"); require_once("libraries/HTTP_Session2/HTTP/Session2.php");
// Later may we can move this to config file. // Later may we can move this to config file.
global $maxWebServiceSessionLifeSpan, $maxWebServiceSessionIdleTime; global $maxWebServiceSessionLifeSpan, $maxWebServiceSessionIdleTime;
...@@ -34,37 +34,37 @@ ...@@ -34,37 +34,37 @@
$this->maxLife = $now + $maxWebServiceSessionLifeSpan; $this->maxLife = $now + $maxWebServiceSessionLifeSpan;
$this->idleLife = $now + $maxWebServiceSessionIdleTime; $this->idleLife = $now + $maxWebServiceSessionIdleTime;
HTTP_Session::useCookies(false); //disable cookie usage. may this could be moved out constructor? HTTP_Session2::useCookies(false); //disable cookie usage. may this could be moved out constructor?
// only first invocation of following method, which is setExpire // only first invocation of following method, which is setExpire
//have an effect and any further invocation will be have no effect. //have an effect and any further invocation will be have no effect.
HTTP_Session::setExpire($this->maxLife); HTTP_Session2::setExpire($this->maxLife);
// this method replaces the new with old time if second params is true // this method replaces the new with old time if second params is true
//otherwise it subtracts the time from previous time //otherwise it subtracts the time from previous time
HTTP_Session::setIdle($this->idleLife, true); HTTP_Session2::setIdle($this->idleLife, true);
} }
function isValid(){ function isValid(){
$valid = true; $valid = true;
// expired // expired
if (HTTP_Session::isExpired()) { if (HTTP_Session2::isExpired()) {
$valid = false; $valid = false;
HTTP_Session::destroy(); HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSLIFEOVER,"Session has life span over please login again"); throw new WebServiceException(WebServiceErrorCode::$SESSLIFEOVER,"Session has life span over please login again");
} }
// idled // idled
if (HTTP_Session::isIdle()) { if (HTTP_Session2::isIdle()) {
$valid = false; $valid = false;
HTTP_Session::destroy(); HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSIONIDLE,"Session has been invalidated to due lack activity"); throw new WebServiceException(WebServiceErrorCode::$SESSIONIDLE,"Session has been invalidated to due lack activity");
} }
//echo "<br>is new: ", HTTP_Session::isNew(); //echo "<br>is new: ", HTTP_Session2::isNew();
//invalid sessionId provided. //invalid sessionId provided.
//echo "<br>get: ",$this->get($this->sessionVar); //echo "<br>get: ",$this->get($this->sessionVar);
if(!$this->get($this->sessionVar) && !HTTP_Session::isNew()){ if(!$this->get($this->sessionVar) && !HTTP_Session2::isNew()){
$valid = false; $valid = false;
HTTP_Session::destroy(); HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid"); throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid");
} }
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
function startSession($sid = null,$adoptSession=false){ function startSession($sid = null,$adoptSession=false){
// if($sid){ // if($sid){
// HTTP_Session::id($sid); // HTTP_Session2::id($sid);
// } // }
if(!$sid || strlen($sid) ===0){ if(!$sid || strlen($sid) ===0){
...@@ -82,15 +82,15 @@ ...@@ -82,15 +82,15 @@
} }
//session name is used for guessing the session id by http_session so pass null. //session name is used for guessing the session id by http_session so pass null.
HTTP_Session::start(null, $sid); HTTP_Session2::start(null, $sid);
$newSID = HTTP_Session::id(); $newSID = HTTP_Session2::id();
if(!$sid || $adoptSession==true){ if(!$sid || $adoptSession==true){
$this->set($this->sessionVar,"true"); $this->set($this->sessionVar,"true");
}else{ }else{
if(!$this->get($this->sessionVar)){ if(!$this->get($this->sessionVar)){
HTTP_Session::destroy(); HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid"); throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid");
$newSID = null; $newSID = null;
} }
...@@ -105,18 +105,18 @@ ...@@ -105,18 +105,18 @@
} }
function getSessionId(){ function getSessionId(){
return HTTP_Session::id(); return HTTP_Session2::id();
} }
function set($var_name, $var_value){ function set($var_name, $var_value){
//TODO test setRef and getRef combination //TODO test setRef and getRef combination
//echo "<br>setting name: ",$var_name," :value: ",$var_value; //echo "<br>setting name: ",$var_name," :value: ",$var_value;
HTTP_Session::set($var_name, $var_value); HTTP_Session2::set($var_name, $var_value);
} }
function get($name){ function get($name){
//echo "<br> getting for: ",$name," :value: ",HTTP_Session::get($name); //echo "<br> getting for: ",$name," :value: ",HTTP_Session2::get($name);
return HTTP_Session::get($name); return HTTP_Session2::get($name);
} }
FUNCTION getError(){ FUNCTION getError(){
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
} }
function destroy(){ function destroy(){
HTTP_Session::destroy(); HTTP_Session2::destroy();
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions created by vtiger are Copyright (C) vtiger. * Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved. * All Rights Reserved.
************************************************************************************/ ************************************************************************************/
include_once 'libraries/HTTP_Session/Session.php'; include_once 'libraries/HTTP_Session2/HTTP/Session2.php';
class Mobile_API_Session { class Mobile_API_Session {
...@@ -20,24 +20,24 @@ class Mobile_API_Session { ...@@ -20,24 +20,24 @@ class Mobile_API_Session {
static function init($sessionid = false) { static function init($sessionid = false) {
if(empty($sessionid)) { if(empty($sessionid)) {
HTTP_Session::start(null, null); HTTP_Session2::start(null, null);
$sessionid = HTTP_Session::id(); $sessionid = HTTP_Session2::id();
} else { } else {
HTTP_Session::start(null, $sessionid); HTTP_Session2::start(null, $sessionid);
} }
if(HTTP_Session::isIdle() || HTTP_Session::isExpired()) { if(HTTP_Session2::isIdle() || HTTP_Session2::isExpired()) {
return false; return false;
} }
return $sessionid; return $sessionid;
} }
static function get($key, $defvalue = '') { static function get($key, $defvalue = '') {
return HTTP_Session::get($key, $defvalue); return HTTP_Session2::get($key, $defvalue);
} }
static function set($key, $value) { static function set($key, $value) {
HTTP_Session::set($key, $value); HTTP_Session2::set($key, $value);
} }
} }
\ No newline at end of file
...@@ -45,7 +45,7 @@ class Mobile_Index_Controller { ...@@ -45,7 +45,7 @@ class Mobile_Index_Controller {
static function process(Mobile_API_Request $request) { static function process(Mobile_API_Request $request) {
$operation = $request->getOperation(); $operation = $request->getOperation();
$sessionid = HTTP_Session::detectId(); //$request->getSession(); $sessionid = HTTP_Session2::detectId(); //$request->getSession();
if (empty($operation)) $operation = 'login'; if (empty($operation)) $operation = 'login';
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class Mobile_UI_Logout extends Mobile_WS_Controller { class Mobile_UI_Logout extends Mobile_WS_Controller {
function process(Mobile_API_Request $request) { function process(Mobile_API_Request $request) {
HTTP_Session::destroy(HTTP_Session::detectId()); HTTP_Session2::destroy(HTTP_Session2::detectId());
header('Location: index.php'); header('Location: index.php');
exit; exit;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
include_once 'vtlib/Vtiger/Module.php'; include_once 'vtlib/Vtiger/Module.php';
include_once 'includes/main/WebUI.php'; include_once 'includes/main/WebUI.php';
require_once("libraries/HTTP_Session/Session.php"); require_once("libraries/HTTP_Session2/HTTP/Session2.php");
require_once 'include/Webservices/Utils.php'; require_once 'include/Webservices/Utils.php';
require_once("include/Webservices/State.php"); require_once("include/Webservices/State.php");
require_once("include/Webservices/OperationManager.php"); require_once("include/Webservices/OperationManager.php");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment