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


PHP Filesystem::isCreatable方法代码示例

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


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

示例1: createDirectory

 /**
  * Creates a new subdirectory
  *
  * @param string $name
  * @throws Sabre_DAV_Exception_Forbidden
  * @return void
  */
 public function createDirectory($name)
 {
     if ($name === 'Shared' && empty($this->path)) {
         throw new \Sabre_DAV_Exception_Forbidden();
     }
     if (!\OC\Files\Filesystem::isCreatable($this->path)) {
         throw new \Sabre_DAV_Exception_Forbidden();
     }
     $newPath = $this->path . '/' . $name;
     if (!\OC\Files\Filesystem::mkdir($newPath)) {
         throw new Sabre_DAV_Exception_Forbidden('Could not create directory ' . $newPath);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:directory.php

示例2: count

 // information about storage capacities
 $storageInfo = OC_Helper::getStorageInfo($dir);
 $maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
 $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
 // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
 $encryptionInitStatus = 2;
 if (OC_App::isEnabled('files_encryption')) {
     $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
     $encryptionInitStatus = $session->getInitialized();
 }
 $trashEnabled = \OCP\App::isEnabled('files_trashbin');
 $trashEmpty = true;
 if ($trashEnabled) {
     $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
 }
 $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
 $fileHeader = (!isset($files) or count($files) > 0);
 $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad;
 OCP\Util::addscript('files', 'fileactions');
 OCP\Util::addscript('files', 'files');
 OCP\Util::addscript('files', 'keyboardshortcuts');
 $tmpl = new OCP\Template('files', 'index', 'user');
 $tmpl->assign('fileList', $list->fetchPage());
 $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
 $tmpl->assign('dir', $dir);
 $tmpl->assign('isCreatable', $isCreatable);
 $tmpl->assign('permissions', $permissions);
 $tmpl->assign('files', $files);
 $tmpl->assign('trash', $trashEnabled);
 $tmpl->assign('trashEmpty', $trashEmpty);
 $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:index.php

示例3: isCreatable

 /**
  * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
  */
 public static function isCreatable($path)
 {
     return \OC\Files\Filesystem::isCreatable($path);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:7,代码来源:filesystem.php

示例4: getDirPermissions

 /**
  * Returns the numeric permissions for the given directory.
  * @param string $dir directory without trailing slash
  * @return numeric permissions
  */
 public static function getDirPermissions($dir)
 {
     $permissions = \OCP\PERMISSION_READ;
     if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
         $permissions |= \OCP\PERMISSION_CREATE;
     }
     if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
         $permissions |= \OCP\PERMISSION_UPDATE;
     }
     if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
         $permissions |= \OCP\PERMISSION_DELETE;
     }
     if (\OC\Files\Filesystem::isSharable($dir . '/')) {
         $permissions |= \OCP\PERMISSION_SHARE;
     }
     return $permissions;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:22,代码来源:helper.php

示例5: doCompile

 /**
  * Compile Latex File
  *
  * @NoAdminRequired
  *
  * @param string $path
  * @param string $filename
  * @param string $compiler
  * @return DataResponse
  */
 public function doCompile($path, $filename, $compiler)
 {
     $success = 'success';
     $error = 'error';
     try {
         set_time_limit(0);
         //scanning can take ages
         // If they've set the compiler to something other than an allowable option....
         if (!($compiler === 'xelatex' || $compiler === 'pdflatex' || $compiler === 'latex')) {
             $compiler = 'latex';
         }
         // The real directory file
         $workdir = dirname(\OC\Files\Filesystem::getLocalFile(stripslashes($path) . $filename));
         $info = pathinfo($filename);
         $fileext = '.' . $info['extension'];
         $projectname = trim(basename($filename, $fileext));
         $pdffile = $projectname . '.pdf';
         $dvifile = $projectname . '.dvi';
         $psfile = $projectname . '.ps';
         $tocfile = $projectname . '.toc';
         $logfile = $projectname . '.log';
         $bibfile = $projectname;
         // Bibtex File is without extension
         // As we will write pdf/ps file(s) in the $path, we need to known if it's writable
         if (!\OC\Files\Filesystem::isCreatable(stripslashes($path))) {
             return new JSONResponse(array('data' => array('message' => 'As you don\'t have write permission in the owner directory, it\'s not possible to create output latex files.', 'output' => '')), Http::STATUS_BAD_REQUEST);
         }
         // Command to jump into directory
         $cd_command = "cd " . str_replace(' ', '\\ ', trim($workdir));
         // PDFLatex command preparation
         if ($compiler == 'xelatex' || $compiler == 'pdflatex') {
             $latex_command = $compiler . ' ' . $filename;
             $bibtex_command = 'bibtex ' . $bibfile;
         } else {
             $latex_command = "latex -output-directory={$outpath}  {$filename} ; cd {$outpath}; dvips  {$dvifile} ; ps2pdf {$psfile}";
         }
         $output = "<b>========BEGIN COMPILE========</b>\n{$psfile} \n";
         $output .= $cd_command . "\n";
         $output .= getcwd() . "\n";
         // First Compile
         $output .= shell_exec($cd_command . " && pwd");
         $return = shell_exec($cd_command . " && " . $latex_command);
         $output .= getcwd() . "\n";
         // For BibTeX
         if ($compiler == 'pdflatex') {
             // Second compile step with bibtex
             $return .= shell_exec($cd_command . " && " . $bibtex_command);
             // compile again after bibtex
             $return .= shell_exec($cd_command . " && " . $latex_command);
         }
         $logfile = $workdir . '/' . $logfile;
         $log = file_get_contents($logfile);
         while (preg_match('/Return to get cross-references right/', $log) || preg_match('/No file ' . $tocfile . '/', $log)) {
             $return .= shell_exec($cd_command . " && " . $this->latex_command);
             $log = file_get_contents($logfile);
         }
         // ! at begining of a line indicate an error!
         $errors = preg_grep("/^!/", explode("\n", $log));
         if (empty($errors) === false) {
             $log_array = explode("\n", $log);
             $error = "\n";
             foreach ($errors as $line => $msg) {
                 for ($i = $line; $i <= $line + 5; $i++) {
                     $error .= $log_array[$i] . "\n";
                 }
             }
             return new JSONResponse(array('data' => array('message' => $this->l->t('Compile failed with errors') . ' - <br/>', 'output' => nl2br($output . " % " . $latex_command . "\n" . $error)), 'status' => $error), Http::STATUS_OK);
         }
         // No PDF File !?
         if (!file_exists($workdir . '/' . $pdffile)) {
             return new JSONResponse(array('data' => array('message' => $this->l->t('Compile failed with errors') . ':<br/>', 'output' => nl2br($output . " % " . $latex_command . "\n" . file_get_contents($outpath . '/' . $logfile))), 'status' => $error), Http::STATUS_OK);
         }
         $output .= $return;
         $output .= "\n========END COMPILE==========\n";
         $oc_workdir = stripslashes(\OC\Files\Filesystem::getLocalPath($workdir));
         $target = \OCP\Files::buildNotExistingFileName($oc_workdir, $pdffile);
         $target = \OC\Files\Filesystem::normalizePath($target);
         $meta = \OC\Files\Filesystem::getFileInfo($target);
         if ($compiler === 'latex') {
             $target = \OCP\Files::buildNotExistingFileName($oc_workdir, $psfile);
             $target = \OC\Files\Filesystem::normalizePath($target);
             $meta = \OC\Files\Filesystem::getFileInfo($target);
         }
         return new JSONResponse(array('data' => array('output' => nl2br($output), 'path' => $path, 'pdffile' => $pdffile, 'psfile' => $psfile, 'logfile' => $logfile), 'status' => $success), Http::STATUS_OK);
     } catch (\Exception $e) {
         return new DataResponse(['message' => $e], Http::STATUS_BAD_REQUEST);
     }
 }
开发者ID:Aypac,项目名称:files_latexeditor,代码行数:98,代码来源:compilecontroller.php

示例6: intval

    $permissions |= OCP\PERMISSION_DELETE;
}
if (\OC\Files\Filesystem::isSharable($dir . '/')) {
    $permissions |= OCP\PERMISSION_SHARE;
}
if ($needUpgrade) {
    OCP\Util::addscript('files', 'upgrade');
    $tmpl = new OCP\Template('files', 'upgrade', 'user');
    $tmpl->printPage();
} else {
    // information about storage capacities
    $storageInfo = OC_Helper::getStorageInfo();
    $maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
    OCP\Util::addscript('files', 'fileactions');
    OCP\Util::addscript('files', 'files');
    OCP\Util::addscript('files', 'keyboardshortcuts');
    $tmpl = new OCP\Template('files', 'index', 'user');
    $tmpl->assign('fileList', $list->fetchPage());
    $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
    $tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($dir));
    $tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/'));
    $tmpl->assign('permissions', $permissions);
    $tmpl->assign('files', $files);
    $tmpl->assign('trash', \OCP\App::isEnabled('files_trashbin'));
    $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
    $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
    $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
    $tmpl->assign('usedSpacePercent', (int) $storageInfo['relative']);
    $tmpl->assign('isPublic', false);
    $tmpl->printPage();
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:index.php


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