Skip to content
Snippets Groups Projects
Commit c2f1ad1d authored by Prasad's avatar Prasad
Browse files

Merge branch 'fix_notices_warnings' into 'master'

added all missing Session -> Session2 updates

See merge request !63
parents 12aa4322 6d588f07
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 . '../..');
require_once 'include/utils/utils.php';
require_once('include/utils/CommonUtils.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/Webservices/Utils.php';
require_once("modules/Users/Users.php");
......
......@@ -8,7 +8,7 @@
* 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.
global $maxWebServiceSessionLifeSpan, $maxWebServiceSessionIdleTime;
......@@ -34,37 +34,37 @@
$this->maxLife = $now + $maxWebServiceSessionLifeSpan;
$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
//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
//otherwise it subtracts the time from previous time
HTTP_Session::setIdle($this->idleLife, true);
HTTP_Session2::setIdle($this->idleLife, true);
}
function isValid(){
$valid = true;
// expired
if (HTTP_Session::isExpired()) {
if (HTTP_Session2::isExpired()) {
$valid = false;
HTTP_Session::destroy();
HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSLIFEOVER,"Session has life span over please login again");
}
// idled
if (HTTP_Session::isIdle()) {
if (HTTP_Session2::isIdle()) {
$valid = false;
HTTP_Session::destroy();
HTTP_Session2::destroy();
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.
//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;
HTTP_Session::destroy();
HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid");
}
......@@ -74,7 +74,7 @@
function startSession($sid = null,$adoptSession=false){
// if($sid){
// HTTP_Session::id($sid);
// HTTP_Session2::id($sid);
// }
if(!$sid || strlen($sid) ===0){
......@@ -82,15 +82,15 @@
}
//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){
$this->set($this->sessionVar,"true");
}else{
if(!$this->get($this->sessionVar)){
HTTP_Session::destroy();
HTTP_Session2::destroy();
throw new WebServiceException(WebServiceErrorCode::$SESSIONIDINVALID,"Session Identifier provided is Invalid");
$newSID = null;
}
......@@ -105,18 +105,18 @@
}
function getSessionId(){
return HTTP_Session::id();
return HTTP_Session2::id();
}
function set($var_name, $var_value){
//TODO test setRef and getRef combination
//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){
//echo "<br> getting for: ",$name," :value: ",HTTP_Session::get($name);
return HTTP_Session::get($name);
//echo "<br> getting for: ",$name," :value: ",HTTP_Session2::get($name);
return HTTP_Session2::get($name);
}
FUNCTION getError(){
......@@ -124,7 +124,7 @@
}
function destroy(){
HTTP_Session::destroy();
HTTP_Session2::destroy();
}
}
......
......@@ -7,7 +7,7 @@
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
include_once 'libraries/HTTP_Session/Session.php';
include_once 'libraries/HTTP_Session2/HTTP/Session2.php';
class Mobile_API_Session {
......@@ -20,24 +20,24 @@ class Mobile_API_Session {
static function init($sessionid = false) {
if(empty($sessionid)) {
HTTP_Session::start(null, null);
$sessionid = HTTP_Session::id();
HTTP_Session2::start(null, null);
$sessionid = HTTP_Session2::id();
} 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 $sessionid;
}
static function get($key, $defvalue = '') {
return HTTP_Session::get($key, $defvalue);
return HTTP_Session2::get($key, $defvalue);
}
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 {
static function process(Mobile_API_Request $request) {
$operation = $request->getOperation();
$sessionid = HTTP_Session::detectId(); //$request->getSession();
$sessionid = HTTP_Session2::detectId(); //$request->getSession();
if (empty($operation)) $operation = 'login';
......
......@@ -11,7 +11,7 @@
class Mobile_UI_Logout extends Mobile_WS_Controller {
function process(Mobile_API_Request $request) {
HTTP_Session::destroy(HTTP_Session::detectId());
HTTP_Session2::destroy(HTTP_Session2::detectId());
header('Location: index.php');
exit;
}
......
......@@ -23,7 +23,7 @@
include_once 'vtlib/Vtiger/Module.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/State.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