当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Filesystem::isValidPath方法代码示例

本文整理汇总了PHP中OC_Filesystem::isValidPath方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Filesystem::isValidPath方法的具体用法?PHP OC_Filesystem::isValidPath怎么用?PHP OC_Filesystem::isValidPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Filesystem的用法示例。


在下文中一共展示了OC_Filesystem::isValidPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: file_assemble

 public function file_assemble($path)
 {
     $absolutePath = OC_Filesystem::normalizePath(OC_Filesystem::getView()->getAbsolutePath($path));
     $data = '';
     // use file_put_contents as method because that best matches what this function does
     if (OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data) && OC_Filesystem::isValidPath($path)) {
         $path = OC_Filesystem::getView()->getRelativePath($absolutePath);
         $exists = OC_Filesystem::file_exists($path);
         $run = true;
         if (!$exists) {
             OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
         }
         OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
         if (!$run) {
             return false;
         }
         $target = OC_Filesystem::fopen($path, 'w');
         if ($target) {
             $count = $this->assemble($target);
             fclose($target);
             if (!$exists) {
                 OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_create, array(OC_Filesystem::signal_param_path => $path));
             }
             OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array(OC_Filesystem::signal_param_path => $path));
             OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
             return $count > 0;
         } else {
             return false;
         }
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:filechunking.php

示例2: basicOperation

 /**
  * @brief abstraction layer for basic filesystem functions: wrapper for OC_Filestorage
  * @param string $operation
  * @param string #path
  * @param array (optional) hooks
  * @param mixed (optional) $extraParam
  * @return mixed
  *
  * This method takes requests for basic filesystem functions (e.g. reading & writing
  * files), processes hooks and proxies, sanitises paths, and finally passes them on to
  * OC_Filestorage for delegation to a storage backend for execution
  */
 private function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
 {
     $postFix = substr($path, -1, 1) === '/' ? '/' : '';
     $absolutePath = OC_Filesystem::normalizePath($this->getAbsolutePath($path));
     if (OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and OC_Filesystem::isValidPath($path)) {
         $path = $this->getRelativePath($absolutePath);
         if ($path == null) {
             return false;
         }
         $internalPath = $this->getInternalPath($path . $postFix);
         $run = $this->runHooks($hooks, $path);
         if ($run and $storage = $this->getStorage($path . $postFix)) {
             if (!is_null($extraParam)) {
                 $result = $storage->{$operation}($internalPath, $extraParam);
             } else {
                 $result = $storage->{$operation}($internalPath);
             }
             $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
             if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
                 if ($operation != 'fopen') {
                     //no post hooks for fopen, the file stream is still open
                     $this->runHooks($hooks, $path, true);
                 }
             }
             return $result;
         }
     }
     return null;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:41,代码来源:filesystemview.php

示例3: basicOperation

 /**
  * abstraction for running most basic operations
  * @param string $operation
  * @param string #path
  * @param array (optional) hooks
  * @param mixed (optional) $extraParam
  * @return mixed
  */
 private function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
 {
     $absolutePath = $this->getAbsolutePath($path);
     if (OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and OC_Filesystem::isValidPath($path)) {
         $path = $this->getRelativePath($absolutePath);
         if ($path == null) {
             return false;
         }
         $internalPath = $this->getInternalPath($path);
         $run = true;
         if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
             foreach ($hooks as $hook) {
                 if ($hook != 'read') {
                     OC_Hook::emit(OC_Filesystem::CLASSNAME, $hook, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
                 } else {
                     OC_Hook::emit(OC_Filesystem::CLASSNAME, $hook, array(OC_Filesystem::signal_param_path => $path));
                 }
             }
         }
         if ($run and $storage = $this->getStorage($path)) {
             if (!is_null($extraParam)) {
                 $result = $storage->{$operation}($internalPath, $extraParam);
             } else {
                 $result = $storage->{$operation}($internalPath);
             }
             $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
             if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
                 if ($operation != 'fopen') {
                     //no post hooks for fopen, the file stream is still open
                     foreach ($hooks as $hook) {
                         if ($hook != 'read') {
                             OC_Hook::emit(OC_Filesystem::CLASSNAME, 'post_' . $hook, array(OC_Filesystem::signal_param_path => $path));
                         }
                     }
                 }
             }
             return $result;
         }
     }
     return null;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:49,代码来源:filesystemview.php

示例4: substr

     } else {
         if (!isset($_SESSION['public_link_authenticated']) || $_SESSION['public_link_authenticated'] !== $linkItem['id']) {
             // Prompt for password
             $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest');
             $tmpl->assign('URL', $url);
             $tmpl->printPage();
             exit;
         }
     }
 }
 $basePath = substr($pathAndUser['path'], strlen('/' . $fileOwner . '/files'));
 $path = $basePath;
 if (isset($_GET['path'])) {
     $path .= $_GET['path'];
 }
 if (!$path || !OC_Filesystem::isValidPath($path) || !OC_Filesystem::file_exists($path)) {
     OCP\Util::writeLog('share', 'Invalid path ' . $path . ' for share id ' . $linkItem['id'], \OCP\Util::ERROR);
     header('HTTP/1.0 404 Not Found');
     $tmpl = new OCP\Template('', '404', 'guest');
     $tmpl->printPage();
     exit;
 }
 $dir = dirname($path);
 $file = basename($path);
 // Download the file
 if (isset($_GET['download'])) {
     if (isset($_GET['path']) && $_GET['path'] !== '') {
         if (isset($_GET['files'])) {
             // download selected files
             OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
         } else {
开发者ID:ryanshoover,项目名称:core,代码行数:31,代码来源:public.php


注:本文中的OC_Filesystem::isValidPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。