當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MOXMAN_Util_PathUtils::toUnixPath方法代碼示例

本文整理匯總了PHP中MOXMAN_Util_PathUtils::toUnixPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP MOXMAN_Util_PathUtils::toUnixPath方法的具體用法?PHP MOXMAN_Util_PathUtils::toUnixPath怎麽用?PHP MOXMAN_Util_PathUtils::toUnixPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MOXMAN_Util_PathUtils的用法示例。


在下文中一共展示了MOXMAN_Util_PathUtils::toUnixPath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: verifyPath

 /**
  * Verifies the input path against various exploits and throws exceptions if one is found.
  *
  * @param String $path Path to verify.
  * @param String $fileType File type to verify path against. Values: dir or file.
  */
 public function verifyPath($path, $fileType = null)
 {
     // Verfiy that the path doesn't have any abnormalities
     if (preg_match('/\\\\|\\.\\.\\/|[\\x00-\\x19]/', $path)) {
         throw new MOXMAN_Exception("Specified path has invalid characters.");
     }
     $path = MOXMAN_Util_PathUtils::toUnixPath($path);
     if (preg_match('~IIS/(\\d+\\.\\d+)~', $_SERVER['SERVER_SOFTWARE'], $matches)) {
         $version = floatval($matches[1]);
         if ($version < 7) {
             if (strpos($path, ';') !== false) {
                 if ($this->getConfig()->get("filesystem.local.warn_semicolon", true)) {
                     throw new MOXMAN_Exception("IIS 6 doesn't support semicolon in paths for security reasons.", MOXMAN_Exception::INVALID_FILE_NAME);
                 }
             }
             if (preg_match('/\\.[^\\/]+\\//', $path) || $fileType == "dir" && strpos($path, '.') !== false) {
                 if ($this->getConfig()->get("filesystem.local.warn_dot_dirs", true)) {
                     throw new MOXMAN_Exception("IIS 6 don't support dots in directory names for security reasons.", MOXMAN_Exception::INVALID_FILE_NAME);
                 }
             }
         }
     } else {
         if (preg_match('/.(php|inc|php\\d+|phtml|php[st])\\.[^\\/]+/', $path)) {
             if ($this->getConfig()->get("filesystem.local.warn_double_exts", true)) {
                 throw new MOXMAN_Exception("Double extensions is not allowed for security reasons.", MOXMAN_Exception::INVALID_FILE_NAME);
             }
         }
     }
 }
開發者ID:shainmcalindon,項目名稱:boothsgardenstudios,代碼行數:35,代碼來源:FileSystem.php

示例2: childPath

 /**
  * Sanitize a child path
  *
  * @param String $path String to check against.
  * @return String Sanitized path according to rules.
  */
 public static function childPath($path)
 {
     $path = MOXMAN_Util_PathUtils::toUnixPath($path);
     $path = preg_replace('/[\\x00-\\x19?"|><];|:/', '', $path);
     $pathExp = explode("/", $path);
     $pathOut = array();
     foreach ($pathExp as $exp) {
         $exp = trim($exp);
         if ($exp != "." && $exp != "..") {
             $pathOut[] = $exp;
         }
     }
     $path = implode("/", $pathOut);
     $path = preg_replace("/\\/+/", '/', $path);
     return $path;
 }
開發者ID:codekanzlei,項目名稱:cake-cktools,代碼行數:22,代碼來源:Sanitize.php


注:本文中的MOXMAN_Util_PathUtils::toUnixPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。