本文整理汇总了PHP中CTempFile::GetAbsoluteRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP CTempFile::GetAbsoluteRoot方法的具体用法?PHP CTempFile::GetAbsoluteRoot怎么用?PHP CTempFile::GetAbsoluteRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTempFile
的用法示例。
在下文中一共展示了CTempFile::GetAbsoluteRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ResizeImageDeleteCache
function ResizeImageDeleteCache($arFile)
{
$temp_dir = CTempFile::GetAbsoluteRoot() . "/";
if (strpos($arFile["tmp_name"], $temp_dir) === 0) {
if (file_exists($arFile["tmp_name"])) {
unlink($arFile["tmp_name"]);
}
}
}
示例2: makeFileArrayFromArray
private static function makeFileArrayFromArray($file_array, $description = null, $options = array())
{
$result = false;
if (is_uploaded_file($file_array["tmp_name"])) {
$result = $file_array;
if (!is_null($description)) {
$result["description"] = $description;
}
} elseif (strlen($file_array["tmp_name"]) > 0 && strpos($file_array["tmp_name"], CTempFile::GetAbsoluteRoot()) === 0) {
$io = CBXVirtualIo::GetInstance();
$absPath = $io->CombinePath("/", $file_array["tmp_name"]);
$tmpPath = CTempFile::GetAbsoluteRoot() . "/";
if (strpos($absPath, $tmpPath) === 0) {
$result = $file_array;
$result["tmp_name"] = $absPath;
$result["error"] = intval($result["error"]);
if (!is_null($description)) {
$result["description"] = $description;
}
}
} elseif (strlen($file_array["tmp_name"]) > 0) {
$io = CBXVirtualIo::GetInstance();
$normPath = $io->CombinePath("/", $file_array["tmp_name"]);
$absPath = $io->CombinePath($_SERVER["DOCUMENT_ROOT"], $normPath);
$tmpPath = CTempFile::GetAbsoluteRoot() . "/";
if (strpos($absPath, $tmpPath) === 0) {
$result = $file_array;
$result["tmp_name"] = $absPath;
$result["error"] = intval($result["error"]);
if (!is_null($description)) {
$result["description"] = $description;
}
}
} else {
$emptyFile = array("name" => null, "type" => null, "tmp_name" => null, "error" => 4, "size" => 0);
if ($file_array == $emptyFile) {
$result = $emptyFile;
if (!is_null($description)) {
$result["description"] = $description;
}
}
}
return $result;
}
示例3: Unlock
public static function Unlock()
{
$lock_filename = CTempFile::GetAbsoluteRoot() . '/sharepoint.lock.txt';
if (file_exists($lock_filename)) {
@unlink($lock_filename);
}
return true;
}
示例4: SetOption
public static function SetOption($name = '', $value = false, $serialize = true)
{
if ($serialize) {
$value = serialize($value);
}
$abs_path = CTempFile::GetAbsoluteRoot() . "/cal_convert/" . $name . ".tmp";
$io = CBXVirtualIo::GetInstance();
$fileIo = $io->GetFile($abs_path);
$io->CreateDirectory($fileIo->GetPath());
$f = fopen($abs_path, "wb");
fwrite($f, $value);
fclose($f);
}
示例5: generatePath
protected static function generatePath()
{
$tmpName = md5(mt_rand() . mt_rand());
$dir = rtrim(CTempFile::GetDirectoryName(2, 'webdav'), '/') . '/';
CheckDirPath($dir);
//make folder recursive
$pathItems = explode(CTempFile::GetAbsoluteRoot(), $dir . $tmpName);
return array(array_pop($pathItems), $tmpName);
}
示例6: checkBitrixTempPath
/**
* Check Bitrix temporary directory path.
*
* @since 15.5.4
* @return string
*/
protected function checkBitrixTempPath()
{
$io = CBXVirtualIo::GetInstance();
$path = CTempFile::GetAbsoluteRoot();
$path = $io->CombinePath($path);
$documentRoot = self::getParam("DOCUMENT_ROOT", $_SERVER["DOCUMENT_ROOT"]);
$documentRoot = $io->CombinePath($documentRoot);
if (strpos($path, $documentRoot) === 0) {
$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_BITRIX_TMP_DIR", CSecurityCriticalLevel::MIDDLE, getMessage("SECURITY_SITE_CHECKER_BITRIX_TMP_DIR_ADDITIONAL", array("#DIR#" => $path)));
return static::STATUS_FAILED;
}
return static::STATUS_PASSED;
}