コード例 #1
0
ファイル: file.php プロジェクト: k-kalashnikov/geekcon_new
 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
0
ファイル: iblock.php プロジェクト: andy-profi/bxApiDocs
 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
0
 public static function Unlock()
 {
     $lock_filename = CTempFile::GetAbsoluteRoot() . '/sharepoint.lock.txt';
     if (file_exists($lock_filename)) {
         @unlink($lock_filename);
     }
     return true;
 }
コード例 #4
0
 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
0
ファイル: webdavtmpfile.php プロジェクト: DarneoStudio/bitrix
 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
0
ファイル: environment.php プロジェクト: DarneoStudio/bitrix
 /**
  * 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;
 }