Fixes to work with the new crypto class.

This commit is contained in:
skeeter 2001-06-16 19:04:44 +00:00
parent 7e2334d9c7
commit 51e871070c

View File

@ -388,7 +388,7 @@
// Changed by Skeeter 2001 Mar 04 0400Z // Changed by Skeeter 2001 Mar 04 0400Z
// This was not properly decoding structures saved into session data properly // This was not properly decoding structures saved into session data properly
// $data = $phpgw->common->decrypt($data); // $data = $phpgw->common->decrypt($data);
// $data = stripslashes($data); // return stripslashes($data);
return $phpgw->crypto->decrypt($data); return $phpgw->crypto->decrypt($data);
} else { } else {
@ -396,25 +396,18 @@
. "sessionid = '".$this->sessionid."' and loginid = '".$this->account_id."'" . "sessionid = '".$this->sessionid."' and loginid = '".$this->account_id."'"
. "and app = '".$appname."' and location = '".$location."'",__LINE__,__FILE__); . "and app = '".$appname."' and location = '".$location."'",__LINE__,__FILE__);
$encrypteddata = $phpgw->crypto->encrypt($data);
if ($phpgw->db->num_rows()==0) { if ($phpgw->db->num_rows()==0) {
// I added these into seperate steps for easier debugging
$data = $phpgw->crypto->encrypt($data);
$data = addslashes($data);
$phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content,session_dla) " $phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content,session_dla) "
. "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname . "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname
. "','".$location."','".$data."','" . time() . "')",__LINE__,__FILE__); . "','".$location."','".$encrypteddata."','" . time() . "')",__LINE__,__FILE__);
} else { } else {
$data = $phpgw->crypto->encrypt($data); $phpgw->db->query("update phpgw_app_sessions set content = '".$encrypteddata."'"
$data = addslashes($data);
$phpgw->db->query("update phpgw_app_sessions set content = '".$data."'"
. "where sessionid = '".$this->sessionid."'" . "where sessionid = '".$this->sessionid."'"
. "and loginid = '".$this->account_id."' and app = '".$appname."'" . "and loginid = '".$this->account_id."' and app = '".$appname."'"
. "and location = '".$location."'",__LINE__,__FILE__); . "and location = '".$location."'",__LINE__,__FILE__);
} }
return $data;
return unserialize($data);
} }
} }