本文整理汇总了PHP中Tinebase_Core::getSessionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::getSessionId方法的具体用法?PHP Tinebase_Core::getSessionId怎么用?PHP Tinebase_Core::getSessionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Core
的用法示例。
在下文中一共展示了Tinebase_Core::getSessionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadImage
/**
* upload image
*
* @param string $base64
*/
public function uploadImage($base64 = 'no')
{
$tmpFile = tempnam(Tinebase_Core::getTempDir(), '');
$file = new Zend_Form_Element_File('file');
$maxsize = $file->getMaxFileSize();
$sessionId = Tinebase_Core::getSessionId();
if (move_uploaded_file($_FILES['upload']['tmp_name'], $tmpFile)) {
$image_id = str_replace(Tinebase_Core::getTempDir() . '/', '', $tmpFile);
$image_size = filesize($tmpFile);
if ($base64 === 'yes') {
// converts image to base64
try {
$image = file_get_contents($tmpFile);
$encoded_data = base64_encode($image);
echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '", "base64":"' . $encoded_data . '"}';
} catch (Exception $e) {
echo '{"success":false, "error":' . $e . description . '}';
}
} else {
echo '{"success":true , "id":"' . $image_id . '", "session_id":"' . $sessionId . '", "size":"' . $image_size . '", "path":"' . $tmpFile . '"}';
}
} else {
echo '{"success":false, "method":"uploadImage", "maxsize":"' . $maxsize . '"}';
}
}
示例2: setSessionId
/**
* set session id for current request in accesslog
*
* @param Tinebase_Model_AccessLog $accessLog
*/
public function setSessionId(Tinebase_Model_AccessLog $accessLog)
{
if (in_array($accessLog->clienttype, array(Tinebase_Server_WebDAV::REQUEST_TYPE, ActiveSync_Server_Http::REQUEST_TYPE))) {
try {
$previousAccessLog = Tinebase_AccessLog::getInstance()->getPreviousAccessLog($accessLog);
$accessLog->sessionid = $previousAccessLog->sessionid;
} catch (Tinebase_Exception_NotFound $tenf) {
// ignore
}
}
if (empty($accessLog->sessionid)) {
$accessLog->sessionid = Tinebase_Core::getSessionId();
} else {
Tinebase_Core::set(Tinebase_Core::SESSIONID, $accessLog->sessionid);
}
}
示例3: createTempFile
/**
* create new temp file
*
* @param string $_path
* @param string $_name
* @param string $_type
* @param double $_size
* @param integer $_error
* @return Tinebase_Model_TempFile
*/
public function createTempFile($_path, $_name = 'tempfile.tmp', $_type = 'unknown', $_size = 0, $_error = 0)
{
// sanitize filename (convert to utf8)
$filename = Tinebase_Helper::mbConvertTo($_name);
$id = Tinebase_Model_TempFile::generateUID();
$tempFile = new Tinebase_Model_TempFile(array('id' => $id, 'session_id' => Tinebase_Core::getSessionId(false), 'time' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG), 'path' => $_path, 'name' => $filename, 'type' => !empty($_type) ? $_type : 'unknown', 'error' => !empty($_error) ? $_error : 0, 'size' => !empty($_size) ? (double) $_size : (double) filesize($_path)));
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " tempfile data: " . print_r($tempFile->toArray(), TRUE));
}
$this->create($tempFile);
return $tempFile;
}