当前位置: 首页>>代码示例>>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;未经允许,请勿转载。