* adjust for session file name and fix error.
This commit is contained in:
@@ -2636,6 +2636,7 @@ class ztSessionHandler
|
||||
{
|
||||
public $sessSavePath;
|
||||
public $tagID;
|
||||
public $sessionFile;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
@@ -2649,6 +2650,23 @@ class ztSessionHandler
|
||||
$this->tagID = $tagID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get session file.
|
||||
*
|
||||
* @param string $id
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSessionFile($id)
|
||||
{
|
||||
if(!empty($this->sessionFile)) return $this->sessionFile;
|
||||
|
||||
$fileName = "sess_$id";
|
||||
if($this->tagID) $fileName = "sess_" . md5($id . $this->tagID);
|
||||
$this->sessionFile = $this->sessSavePath . '/' . $fileName;
|
||||
return $this->sessionFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open
|
||||
*
|
||||
@@ -2683,7 +2701,7 @@ class ztSessionHandler
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
$sessFile = "$this->sessSavePath/sess_$id" . $this->tagID;
|
||||
$sessFile = $this->getSessionFile($id);
|
||||
if(!file_exists($sessFile))
|
||||
{
|
||||
($this->tagID and file_exists("$this->sessSavePath/sess_$id")) ? copy("$this->sessSavePath/sess_$id", $sessFile) : touch($sessFile);
|
||||
@@ -2701,7 +2719,7 @@ class ztSessionHandler
|
||||
*/
|
||||
public function write($id, $sessData)
|
||||
{
|
||||
$sessFile = "$this->sessSavePath/sess_$id" . $this->tagID;
|
||||
$sessFile = $this->getSessionFile($id);
|
||||
if(file_put_contents($sessFile, $sessData)) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -2715,7 +2733,7 @@ class ztSessionHandler
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$sessFile = "$this->sessSavePath/sess_$id" . $this->tagID;
|
||||
$sessFile = $this->getSessionFile($id);
|
||||
@unlink($sessFile);
|
||||
touch($sessFile);
|
||||
return true;
|
||||
|
||||
@@ -69,7 +69,7 @@ class apiModel extends model
|
||||
$param = ltrim($param, ',');
|
||||
}
|
||||
$url = rtrim($host, '/') . inlink('getModel', "moduleName=$moduleName&methodName=$methodName¶ms=$param", 'json');
|
||||
$url .= substr($url, '?') === false ? '?' : '&';
|
||||
$url .= strpos($url, '?') === false ? '?' : '&';
|
||||
$url .= $this->config->sessionVar . '=' . session_id();
|
||||
}
|
||||
else
|
||||
@@ -80,7 +80,7 @@ class apiModel extends model
|
||||
$param = ltrim($param, '&');
|
||||
}
|
||||
$url = rtrim($host, '/') . helper::createLink($moduleName, $methodName, $param, 'json');
|
||||
$url .= substr($url, '?') === false ? '?' : '&';
|
||||
$url .= strpos($url, '?') === false ? '?' : '&';
|
||||
$url .= $this->config->sessionVar . '=' . session_id();
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
if(common::hasPriv('file', 'download'))
|
||||
{
|
||||
$downloadLink = $this->createLink('file', 'download', 'fileID=' . $file->id);
|
||||
$downloadLink .= substr($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= $sessionString;
|
||||
echo html::a($downloadLink, "<i class='icon icon-export'></i>", '', "class='btn-icon' style='margin-right: 10px;' title=\"{$lang->doc->download}\"");
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
$fileID = $file->id;
|
||||
$url = helper::createLink('file', 'download', 'fileID=' . $fileID);
|
||||
$url .= substr($url, '?') === false ? '?' : '&';
|
||||
$url .= strpos($url, '?') === false ? '?' : '&';
|
||||
$url .= session_name() . '=' . session_id();
|
||||
?>
|
||||
<div class='file'>
|
||||
|
||||
@@ -131,7 +131,7 @@ js::set('docID', $doc->id);
|
||||
if(common::hasPriv('file', 'download'))
|
||||
{
|
||||
$downloadLink = $this->createLink('file', 'download', 'fileID=' . $file->id);
|
||||
$downloadLink .= substr($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= $sessionString;
|
||||
echo html::a($downloadLink, "<i class='icon icon-export'></i>", '', "class='btn-icon' style='margin-right: 10px;' title=\"{$lang->doc->download}\"");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id");
|
||||
$downloadLink .= substr($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= $sessionString;
|
||||
echo "<li title='{$uploadDate}'>" . html::a($downloadLink, $fileTitle . " <span class='text-muted'>({$fileSize})</span>", '_blank', "onclick=\"return downloadFile($file->id, '$file->extension', $imageWidth, '$file->title')\"");
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ class mail extends control
|
||||
$idList = join('|', $this->post->mailIDList);
|
||||
|
||||
$confirmLink = inlink('batchDelete', "confirm=yes");
|
||||
$confirmLink .= substr($confirmLink, '?') === false ? '?' : '&';
|
||||
$confirmLink .= strpos($confirmLink, '?') === false ? '?' : '&';
|
||||
$confirmLink .= "idList=$idList";
|
||||
die(js::confirm($this->lang->mail->confirmDelete, $confirmLink));
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ class repoModel extends model
|
||||
{
|
||||
session_start();
|
||||
$uri = $this->app->getURI(true);
|
||||
if(!empty($_GET) and $this->config->requestType == 'PATH_INFO') $uri .= (substr($uri, '?') === false ? '?' : '&') . http_build_query($_GET);
|
||||
if(!empty($_GET) and $this->config->requestType == 'PATH_INFO') $uri .= (strpos($uri, '?') === false ? '?' : '&') . http_build_query($_GET);
|
||||
|
||||
$backKey = 'repo' . ucfirst(strtolower($type));
|
||||
$this->session->set($backKey, $uri);
|
||||
|
||||
@@ -836,7 +836,7 @@ class task extends control
|
||||
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->session->set('estimateList', $uri, 'execution');
|
||||
if(isonlybody()) $this->session->set('estimateList', $uri . (substr($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution');
|
||||
if(isonlybody()) $this->session->set('estimateList', $uri . (strpos($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution');
|
||||
|
||||
$this->view->task = $this->task->getById($taskID);
|
||||
$this->view->estimates = $this->task->getTaskEstimate($taskID);
|
||||
|
||||
@@ -816,18 +816,19 @@ class user extends control
|
||||
die(helper::removeUTF8Bom(json_encode(array('status' => 'success') + $data)));
|
||||
}
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['result'] = 'success';
|
||||
if(strpos($this->referer, $loginLink) === false and
|
||||
strpos($this->referer, $denyLink) === false and
|
||||
strpos($this->referer, 'block') === false and $this->referer
|
||||
)
|
||||
{
|
||||
$response['locate'] = $this->referer;
|
||||
$response['locate'] = $this->referer;
|
||||
if(helper::isWithTID() and strpos($response['locate'], 'tid=') === false) $response['locate'] .= (strpos($response['locate'], '?') === false ? '?' : '&') . "tid={$this->get->tid}";
|
||||
return $this->send($response);
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : '');
|
||||
$response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : '');
|
||||
return $this->send($response);
|
||||
}
|
||||
}
|
||||
@@ -897,12 +898,13 @@ class user extends control
|
||||
$response['result'] = 'success';
|
||||
if(common::hasPriv($module, $method))
|
||||
{
|
||||
$response['locate'] = $this->post->referer;
|
||||
$response['locate'] = $this->post->referer;
|
||||
if(helper::isWithTID() and strpos($response['locate'], 'tid=') === false) $response['locate'] .= (strpos($response['locate'], '?') === false ? '?' : '&') . "tid={$this->get->tid}";
|
||||
return $this->send($response);
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : '');
|
||||
$response['locate'] = $this->config->webRoot . (helper::isWithTID() ? "?tid={$this->get->tid}" : '');
|
||||
return $this->send($response);
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1049,7 @@ class user extends control
|
||||
|
||||
/* Remove the real path for security reason. */
|
||||
$pathPos = strrpos($this->app->getBasePath(), DIRECTORY_SEPARATOR, -2);
|
||||
$resetFileName = substr($resetFileName, $pathPos+1);
|
||||
$resetFileName = substr($resetFileName, $pathPos + 1);
|
||||
|
||||
$this->view->title = $this->lang->user->resetPassword;
|
||||
$this->view->status = 'reset';
|
||||
|
||||
@@ -112,7 +112,7 @@ class userModel extends model
|
||||
$moreLinkParams = "params={$params}&usersToAppended={$usersToAppended}";
|
||||
|
||||
$moreLink = helper::createLink('user', 'ajaxGetMore');
|
||||
$moreLink .= substr($moreLink, '?') === false ? '?' : '&';
|
||||
$moreLink .= strpos($moreLink, '?') === false ? '?' : '&';
|
||||
$moreLink .= "params=" . base64_encode($moreLinkParams);
|
||||
$this->config->user->moreLink = $moreLink;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user