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


PHP Filesystem::is_dir方法代码示例

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


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

示例1: Add

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function Add()
 {
     \OCP\JSON::setContentTypeHeader('application/json');
     if (isset($_POST['FILE']) && strlen($_POST['FILE']) > 0 && Tools::CheckURL($_POST['FILE']) && isset($_POST['OPTIONS'])) {
         try {
             $Target = Tools::CleanString(substr($_POST['FILE'], strrpos($_POST['FILE'], '/') + 1));
             // If target file exists, create a new one
             if (\OC\Files\Filesystem::file_exists($this->DownloadsFolder . '/' . $Target)) {
                 $Target = time() . '_' . $Target;
             }
             // Create the target file if the downloader is Aria2
             if ($this->WhichDownloader == 0) {
                 \OC\Files\Filesystem::touch($this->DownloadsFolder . '/' . $Target);
             } else {
                 if (!\OC\Files\Filesystem::is_dir($this->DownloadsFolder)) {
                     \OC\Files\Filesystem::mkdir($this->DownloadsFolder);
                 }
             }
             // Build OPTIONS array
             $OPTIONS = array('dir' => $this->AbsoluteDownloadsFolder, 'out' => $Target, 'follow-torrent' => false);
             if (isset($_POST['OPTIONS']['FTPUser']) && strlen(trim($_POST['OPTIONS']['FTPUser'])) > 0 && isset($_POST['OPTIONS']['FTPPasswd']) && strlen(trim($_POST['OPTIONS']['FTPPasswd'])) > 0) {
                 $OPTIONS['ftp-user'] = $_POST['OPTIONS']['FTPUser'];
                 $OPTIONS['ftp-passwd'] = $_POST['OPTIONS']['FTPPasswd'];
             }
             if (isset($_POST['OPTIONS']['FTPPasv']) && strlen(trim($_POST['OPTIONS']['FTPPasv'])) > 0) {
                 $OPTIONS['ftp-pasv'] = strcmp($_POST['OPTIONS']['FTPPasv'], "true") == 0 ? true : false;
             }
             if (!$this->ProxyOnlyWithYTDL && !is_null($this->ProxyAddress) && $this->ProxyPort > 0 && $this->ProxyPort <= 65536) {
                 $OPTIONS['all-proxy'] = rtrim($this->ProxyAddress, '/') . ':' . $this->ProxyPort;
                 if (!is_null($this->ProxyUser) && !is_null($this->ProxyPasswd)) {
                     $OPTIONS['all-proxy-user'] = $this->ProxyUser;
                     $OPTIONS['all-proxy-passwd'] = $this->ProxyPasswd;
                 }
             }
             $AddURI = $this->WhichDownloader == 0 ? Aria2::AddUri(array($_POST['FILE']), array('Params' => $OPTIONS)) : CURL::AddUri($_POST['FILE'], $OPTIONS);
             if (isset($AddURI['result']) && !is_null($AddURI['result'])) {
                 $SQL = 'INSERT INTO `*PREFIX*ocdownloader_queue` (`UID`, `GID`, `FILENAME`, `PROTOCOL`, `STATUS`, `TIMESTAMP`) VALUES (?, ?, ?, ?, ?, ?)';
                 if ($this->DbType == 1) {
                     $SQL = 'INSERT INTO *PREFIX*ocdownloader_queue ("UID", "GID", "FILENAME", "PROTOCOL", "STATUS", "TIMESTAMP") VALUES (?, ?, ?, ?, ?, ?)';
                 }
                 $Query = \OCP\DB::prepare($SQL);
                 $Result = $Query->execute(array($this->CurrentUID, $AddURI['result'], $Target, strtoupper(substr($_POST['FILE'], 0, strpos($_POST['FILE'], ':'))), 1, time()));
                 sleep(1);
                 $Status = $this->WhichDownloader == 0 ? Aria2::TellStatus($AddURI['result']) : CURL::TellStatus($AddURI['result']);
                 $Progress = 0;
                 if ($Status['result']['totalLength'] > 0) {
                     $Progress = $Status['result']['completedLength'] / $Status['result']['totalLength'];
                 }
                 $ProgressString = Tools::GetProgressString($Status['result']['completedLength'], $Status['result']['totalLength'], $Progress);
                 return new JSONResponse(array('ERROR' => false, 'MESSAGE' => (string) $this->L10N->t('Download started'), 'GID' => $AddURI['result'], 'PROGRESSVAL' => round($Progress * 100, 2) . '%', 'PROGRESS' => is_null($ProgressString) ? (string) $this->L10N->t('N/A') : $ProgressString, 'STATUS' => isset($Status['result']['status']) ? (string) $this->L10N->t(ucfirst($Status['result']['status'])) : (string) $this->L10N->t('N/A'), 'STATUSID' => Tools::GetDownloadStatusID($Status['result']['status']), 'SPEED' => isset($Status['result']['downloadSpeed']) ? Tools::FormatSizeUnits($Status['result']['downloadSpeed']) . '/s' : (string) $this->L10N->t('N/A'), 'FILENAME' => strlen($Target) > 40 ? substr($Target, 0, 40) . '...' : $Target, 'PROTO' => strtoupper(substr($_POST['FILE'], 0, strpos($_POST['FILE'], ':'))), 'ISTORRENT' => false));
             } else {
                 return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t($this->WhichDownloader == 0 ? 'Returned GID is null ! Is Aria2c running as a daemon ?' : 'An error occurred while running the CURL download')));
             }
         } catch (Exception $E) {
             return new JSONResponse(array('ERROR' => true, 'MESSAGE' => $E->getMessage()));
         }
     } else {
         return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Please check the URL you\'ve just provided')));
     }
 }
开发者ID:samosito,项目名称:ocdownloader,代码行数:64,代码来源:ftpdownloader.php

示例2: testSetGetShareFolder

 /**
  * test set and get share folder
  */
 function testSetGetShareFolder()
 {
     $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder());
     \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder');
     $sharedFolder = \OCA\Files_Sharing\Helper::getShareFolder();
     $this->assertSame('/Shared/Folder', \OCA\Files_Sharing\Helper::getShareFolder());
     $this->assertTrue(\OC\Files\Filesystem::is_dir($sharedFolder));
     // cleanup
     \OCP\Config::deleteSystemValue('share_folder');
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:13,代码来源:helper.php

示例3: ClearCache

 public static function ClearCache($parameters)
 {
     if (is_array($parameters)) {
         if (\OC\Files\Filesystem::is_dir($parameters['path'] . '/') || basename(getenv('REQUEST_URI')) == 'newfolder.php') {
             $cache = new OC\Cache\UserCache();
             $parent = $_POST['dir'];
             $cache->remove('files_tree_cache' . $parent);
         } else {
             // Nothing to do here
         }
     }
 }
开发者ID:ukitiyan,项目名称:files_tree,代码行数:12,代码来源:hooks.php

示例4: verifyMountPoint

 /**
  * check if the parent folder exists otherwise move the mount point up
  */
 private function verifyMountPoint(&$share, $user)
 {
     $mountPoint = basename($share['file_target']);
     $parent = dirname($share['file_target']);
     if (!\OC\Files\Filesystem::is_dir($parent)) {
         $parent = Helper::getShareFolder();
     }
     $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(\OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), array(), new \OC\Files\View('/' . $user . '/files'));
     if ($newMountPoint !== $share['file_target']) {
         self::updateFileTarget($newMountPoint, $share);
         $share['file_target'] = $newMountPoint;
         $share['unique_name'] = true;
     }
     return $newMountPoint;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:18,代码来源:sharedmount.php

示例5: Save

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function Save()
 {
     \OCP\JSON::setContentTypeHeader('application/json');
     $Error = false;
     $Message = '';
     if (isset($_POST['KEY']) && strlen(trim($_POST['KEY'])) > 0 && isset($_POST['VAL']) && strlen(trim($_POST['VAL'])) > 0) {
         $PostKey = str_replace('OCD', '', $_POST['KEY']);
         $PostValue = ltrim(trim(str_replace(' ', '\\ ', $_POST['VAL'])), '/');
         if (in_array($PostKey, $this->OCDSettingKeys)) {
             $this->Settings->SetKey($PostKey);
             // Pre-Save process
             if (strcmp($PostKey, 'DownloadsFolder') == 0 || strcmp($PostKey, 'TorrentsFolder') == 0) {
                 // check folder exists, if not create it
                 if (!\OC\Files\Filesystem::is_dir($PostValue)) {
                     // Create the target file
                     \OC\Files\Filesystem::mkdir($PostValue);
                     $Message .= $this->L10N->t('The folder doesn\'t exist. It has been created.');
                 }
             }
             if (strlen(trim($PostValue)) <= 0) {
                 $PostValue = null;
             }
             if ($this->Settings->CheckIfKeyExists()) {
                 $this->Settings->UpdateValue($PostValue);
             } else {
                 $this->Settings->InsertValue($PostValue);
             }
         } else {
             $Error = true;
             $Message = $this->L10N->t('Unknown field');
         }
     } else {
         $Error = true;
         $Message = $this->L10N->t('Undefined field');
     }
     return new JSONResponse(array('ERROR' => $Error, 'MESSAGE' => strlen(trim($Message)) == 0 ? (string) $this->L10N->t('Saved') : $Message));
 }
开发者ID:venjek,项目名称:ocdownloader,代码行数:41,代码来源:personalsettings.php

示例6: addDirRecursive

 /**
  * Stream directory recursively
  * @param string $dir
  * @param string $internalDir
  */
 public function addDirRecursive($dir, $internalDir = '')
 {
     $dirname = basename($dir);
     $rootDir = $internalDir . $dirname;
     if (!empty($rootDir)) {
         $this->streamerInstance->addEmptyDir($rootDir);
     }
     $internalDir .= $dirname . '/';
     // prevent absolute dirs
     $internalDir = ltrim($internalDir, '/');
     $files = \OC\Files\Filesystem::getDirectoryContent($dir);
     foreach ($files as $file) {
         $filename = $file['name'];
         $file = $dir . '/' . $filename;
         if (\OC\Files\Filesystem::is_file($file)) {
             $filesize = \OC\Files\Filesystem::filesize($file);
             $fh = \OC\Files\Filesystem::fopen($file, 'r');
             $this->addFileFromStream($fh, $internalDir . $filename, $filesize);
             fclose($fh);
         } elseif (\OC\Files\Filesystem::is_dir($file)) {
             $this->addDirRecursive($file, $internalDir);
         }
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:29,代码来源:Streamer.php

示例7: getFile

 /**
  * get file
  *
  * @param string $user
  * @param int $fileSource
  * @return array with internal path of the file and a absolute link to it
  */
 private function getFile($user, $fileSource)
 {
     \OC_Util::setupFS($user);
     $file = \OC\Files\Filesystem::getPath($fileSource);
     $args = \OC\Files\Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file);
     $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args);
     return array($file, $link);
 }
开发者ID:nougad,项目名称:core,代码行数:15,代码来源:server2server.php

示例8: isset

 OCP\Util::addScript('files_sharing', 'public');
 OCP\Util::addScript('files', 'fileactions');
 OCP\Util::addScript('files', 'jquery.iframe-transport');
 OCP\Util::addScript('files', 'jquery.fileupload');
 $maxUploadFilesize = OCP\Util::maxUploadFilesize($path);
 $tmpl = new OCP\Template('files_sharing', 'public', 'base');
 $tmpl->assign('displayName', \OCP\User::getDisplayName($shareOwner));
 $tmpl->assign('filename', $file);
 $tmpl->assign('directory_path', $linkItem['file_target']);
 $tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path));
 $tmpl->assign('dirToken', $linkItem['token']);
 $tmpl->assign('sharingToken', $token);
 $tmpl->assign('protected', isset($linkItem['share_with']) ? 'true' : 'false');
 $urlLinkIdentifiers = (isset($token) ? '&t=' . $token : '') . (isset($_GET['dir']) ? '&dir=' . $_GET['dir'] : '') . (isset($_GET['file']) ? '&file=' . $_GET['file'] : '');
 // Show file list
 if (\OC\Files\Filesystem::is_dir($path)) {
     $tmpl->assign('dir', $getPath);
     OCP\Util::addStyle('files', 'files');
     OCP\Util::addStyle('files', 'upload');
     OCP\Util::addScript('files', 'filesummary');
     OCP\Util::addScript('files', 'breadcrumb');
     OCP\Util::addScript('files', 'files');
     OCP\Util::addScript('files', 'filelist');
     OCP\Util::addscript('files', 'keyboardshortcuts');
     $files = array();
     $rootLength = strlen($basePath) + 1;
     $maxUploadFilesize = OCP\Util::maxUploadFilesize($path);
     $freeSpace = OCP\Util::freeSpace($path);
     $uploadLimit = OCP\Util::uploadLimit();
     $folder = new OCP\Template('files', 'list', '');
     $folder->assign('dir', $getPath);
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:31,代码来源:public.php

示例9: store

 /**
  * store a new version of a file.
  */
 public static function store($filename)
 {
     if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
         // if the file gets streamed we need to remove the .part extension
         // to get the right target
         $ext = pathinfo($filename, PATHINFO_EXTENSION);
         if ($ext === 'part') {
             $filename = substr($filename, 0, strlen($filename) - 5);
         }
         // we only handle existing files
         if (!Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) {
             return false;
         }
         list($uid, $filename) = self::getUidAndFilename($filename);
         $files_view = new View('/' . $uid . '/files');
         $users_view = new View('/' . $uid);
         // no use making versions for empty files
         if ($files_view->filesize($filename) === 0) {
             return false;
         }
         // create all parent folders
         self::createMissingDirectories($filename, $users_view);
         self::scheduleExpire($uid, $filename);
         // store a new version of a file
         $mtime = $users_view->filemtime('files/' . $filename);
         $users_view->copy('files/' . $filename, 'files_versions/' . $filename . '.v' . $mtime);
         // call getFileInfo to enforce a file cache entry for the new version
         $users_view->getFileInfo('files_versions/' . $filename . '.v' . $mtime);
     }
 }
开发者ID:gvde,项目名称:core,代码行数:33,代码来源:storage.php

示例10: ListTorrentFiles

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function ListTorrentFiles()
 {
     \OCP\JSON::setContentTypeHeader('application/json');
     try {
         if (!\OC\Files\Filesystem::is_dir($this->TorrentsFolder)) {
             \OC\Files\Filesystem::mkdir($this->TorrentsFolder);
         }
         $this->TorrentsFolder = \OC\Files\Filesystem::normalizePath($this->TorrentsFolder);
         $Files = \OCA\Files\Helper::getFiles($this->TorrentsFolder, 'name', 'desc');
         $Files = \OCA\Files\Helper::formatFileInfos($Files);
         return new JSONResponse(array('ERROR' => false, 'FILES' => $Files));
     } catch (Exception $E) {
         return new JSONResponse(array('ERROR' => true, 'MESSAGE' => $E->getMessage()));
     }
 }
开发者ID:samosito,项目名称:ocdownloader,代码行数:19,代码来源:btdownloader.php

示例11: Add

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function Add()
 {
     \OCP\JSON::setContentTypeHeader('application/json');
     if (isset($_POST['FILE']) && strlen($_POST['FILE']) > 0 && Tools::CheckURL($_POST['FILE']) && isset($_POST['OPTIONS'])) {
         try {
             if (!$this->AllowProtocolYT && !\OC_User::isAdminUser($this->CurrentUID)) {
                 throw new \Exception((string) $this->L10N->t('You are not allowed to use the YouTube protocol'));
             }
             $YouTube = new YouTube($this->YTDLBinary, $_POST['FILE']);
             if (!is_null($this->ProxyAddress) && $this->ProxyPort > 0 && $this->ProxyPort <= 65536) {
                 $YouTube->SetProxy($this->ProxyAddress, $this->ProxyPort);
             }
             if (isset($_POST['OPTIONS']['YTForceIPv4']) && strcmp($_POST['OPTIONS']['YTForceIPv4'], 'false') == 0) {
                 $YouTube->SetForceIPv4(false);
             }
             // Extract Audio YES
             if (isset($_POST['OPTIONS']['YTExtractAudio']) && strcmp($_POST['OPTIONS']['YTExtractAudio'], 'true') == 0) {
                 $VideoData = $YouTube->GetVideoData(true);
                 if (!isset($VideoData['AUDIO']) || !isset($VideoData['FULLNAME'])) {
                     return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Unable to retrieve true YouTube audio URL')));
                 }
                 $DL = array('URL' => $VideoData['AUDIO'], 'FILENAME' => Tools::CleanString($VideoData['FULLNAME']), 'TYPE' => 'YT Audio');
             } else {
                 $VideoData = $YouTube->GetVideoData();
                 if (!isset($VideoData['VIDEO']) || !isset($VideoData['FULLNAME'])) {
                     return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Unable to retrieve true YouTube video URL')));
                 }
                 $DL = array('URL' => $VideoData['VIDEO'], 'FILENAME' => Tools::CleanString($VideoData['FULLNAME']), 'TYPE' => 'YT Video');
             }
             // If target file exists, create a new one
             if (\OC\Files\Filesystem::file_exists($this->DownloadsFolder . '/' . $DL['FILENAME'])) {
                 $DL['FILENAME'] = time() . '_' . $DL['FILENAME'];
             }
             // Create the target file if the downloader is ARIA2
             if ($this->WhichDownloader == 0) {
                 \OC\Files\Filesystem::touch($this->DownloadsFolder . '/' . $DL['FILENAME']);
             } else {
                 if (!\OC\Files\Filesystem::is_dir($this->DownloadsFolder)) {
                     \OC\Files\Filesystem::mkdir($this->DownloadsFolder);
                 }
             }
             $OPTIONS = array('dir' => $this->AbsoluteDownloadsFolder, 'out' => $DL['FILENAME']);
             if (!is_null($this->ProxyAddress) && $this->ProxyPort > 0 && $this->ProxyPort <= 65536) {
                 $OPTIONS['all-proxy'] = rtrim($this->ProxyAddress, '/') . ':' . $this->ProxyPort;
                 if (!is_null($this->ProxyUser) && !is_null($this->ProxyPasswd)) {
                     $OPTIONS['all-proxy-user'] = $this->ProxyUser;
                     $OPTIONS['all-proxy-passwd'] = $this->ProxyPasswd;
                 }
             }
             if (!is_null($this->MaxDownloadSpeed) && $this->MaxDownloadSpeed > 0) {
                 $OPTIONS['max-download-limit'] = $this->MaxDownloadSpeed . 'K';
             }
             $AddURI = $this->WhichDownloader == 0 ? Aria2::AddUri(array($DL['URL']), array('Params' => $OPTIONS)) : CURL::AddUri($DL['URL'], $OPTIONS);
             if (isset($AddURI['result']) && !is_null($AddURI['result'])) {
                 $SQL = 'INSERT INTO `*PREFIX*ocdownloader_queue` (`UID`, `GID`, `FILENAME`, `PROTOCOL`, `STATUS`, `TIMESTAMP`) VALUES (?, ?, ?, ?, ?, ?)';
                 if ($this->DbType == 1) {
                     $SQL = 'INSERT INTO *PREFIX*ocdownloader_queue ("UID", "GID", "FILENAME", "PROTOCOL", "STATUS", "TIMESTAMP") VALUES (?, ?, ?, ?, ?, ?)';
                 }
                 $Query = \OCP\DB::prepare($SQL);
                 $Result = $Query->execute(array($this->CurrentUID, $AddURI['result'], $DL['FILENAME'], $DL['TYPE'], 1, time()));
                 sleep(1);
                 $Status = Aria2::TellStatus($AddURI['result']);
                 $Progress = 0;
                 if ($Status['result']['totalLength'] > 0) {
                     $Progress = $Status['result']['completedLength'] / $Status['result']['totalLength'];
                 }
                 $ProgressString = Tools::GetProgressString($Status['result']['completedLength'], $Status['result']['totalLength'], $Progress);
                 return new JSONResponse(array('ERROR' => false, 'MESSAGE' => (string) $this->L10N->t('Download started'), 'GID' => $AddURI['result'], 'PROGRESSVAL' => round($Progress * 100, 2) . '%', 'PROGRESS' => is_null($ProgressString) ? (string) $this->L10N->t('N/A') : $ProgressString, 'STATUS' => isset($Status['result']['status']) ? (string) $this->L10N->t(ucfirst($Status['result']['status'])) : (string) $this->L10N->t('N/A'), 'STATUSID' => Tools::GetDownloadStatusID($Status['result']['status']), 'SPEED' => isset($Status['result']['downloadSpeed']) ? Tools::FormatSizeUnits($Status['result']['downloadSpeed']) . '/s' : (string) $this->L10N->t('N/A'), 'FILENAME' => strlen($DL['FILENAME']) > 40 ? substr($DL['FILENAME'], 0, 40) . '...' : $DL['FILENAME'], 'PROTO' => $DL['TYPE'], 'ISTORRENT' => false));
             } else {
                 return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Returned GID is null ! Is Aria2c running as a daemon ?')));
             }
         } catch (Exception $E) {
             return new JSONResponse(array('ERROR' => true, 'MESSAGE' => $E->getMessage()));
         }
     } else {
         return new JSONResponse(array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Please check the URL you\'ve just provided')));
     }
 }
开发者ID:venjek,项目名称:ocdownloader,代码行数:82,代码来源:ytdownloader.php

示例12: parserFileHandler

 private function parserFileHandler($files, $userForSharing)
 {
     $saveFiles = ['file_fileid' => [], 'shared_with' => []];
     if ($this->loginVirtualUser()) {
         $innerDir = date("Ymd", time());
         foreach ($files as $file) {
             if (!\OC\Files\Filesystem::is_dir('/Talks')) {
                 \OC\Files\Filesystem::mkdir('/Talks');
             }
             if (!\OC\Files\Filesystem::is_dir('/Talks/' . $innerDir)) {
                 \OC\Files\Filesystem::mkdir('/Talks/' . $innerDir);
             }
             if (is_file($file['tmpfile'])) {
                 try {
                     chmod($file['tmpfile'], 0755);
                 } catch (\Exception $e) {
                 }
                 $filePathTo = '/Talks/' . $innerDir . '/' . $file['filename'];
                 $fileInfoExist = \OC\Files\Filesystem::getFileInfo($filePathTo, false);
                 if ($fileInfoExist) {
                     $filePathTo = '/Talks/' . $innerDir . '/' . time() . '-' . $file['filename'];
                 }
                 $saved = \OC\Files\Filesystem::file_put_contents($filePathTo, file_get_contents($file['tmpfile']));
                 if ($saved) {
                     unlink($file['tmpfile']);
                     $saveFilesInfo = \OC\Files\Filesystem::getFileInfo($filePathTo);
                     Helper::mailParserLoger('FILES INFO: ' . json_encode($saveFilesInfo));
                     $saveFiles['file_fileid'][] = $saveFilesInfo['fileid'];
                     $saveFiles['shared_with'][] = $this->shareFileToUsers($saveFilesInfo, $userForSharing);
                     //todo mails sands
                 }
             }
         }
     }
     return $saveFiles;
 }
开发者ID:raceface2nd,项目名称:owncollab,代码行数:36,代码来源:apicontroller.php

示例13: getShareFolder

 /**
  * get default share folder
  *
  * @return string
  */
 public static function getShareFolder()
 {
     $shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
     $shareFolder = Filesystem::normalizePath($shareFolder);
     if (!Filesystem::file_exists($shareFolder)) {
         $dir = '';
         $subdirs = explode('/', $shareFolder);
         foreach ($subdirs as $subdir) {
             $dir = $dir . '/' . $subdir;
             if (!Filesystem::is_dir($dir)) {
                 Filesystem::mkdir($dir);
             }
         }
     }
     return $shareFolder;
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:21,代码来源:helper.php

示例14: validateZipDownload

 /**
  * checks if the selected files are within the size constraint. If not, outputs an error page.
  *
  * @param dir   $dir
  * @param files $files
  */
 static function validateZipDownload($dir, $files)
 {
     if (!OC_Config::getValue('allowZipDownload', true)) {
         $l = OC_L10N::get('lib');
         header("HTTP/1.0 409 Conflict");
         OC_Template::printErrorPage($l->t('ZIP download is turned off.'), $l->t('Files need to be downloaded one by one.') . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>');
         exit;
     }
     $zipLimit = OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB'));
     if ($zipLimit > 0) {
         $totalsize = 0;
         if (!is_array($files)) {
             $files = array($files);
         }
         foreach ($files as $file) {
             $path = $dir . '/' . $file;
             if (\OC\Files\Filesystem::is_dir($path)) {
                 foreach (\OC\Files\Filesystem::getDirectoryContent($path) as $i) {
                     $totalsize += $i['size'];
                 }
             } else {
                 $totalsize += \OC\Files\Filesystem::filesize($path);
             }
         }
         if ($totalsize > $zipLimit) {
             $l = OC_L10N::get('lib');
             header("HTTP/1.0 409 Conflict");
             OC_Template::printErrorPage($l->t('Selected files too large to generate zip file.'), $l->t('Please download the files separately in smaller chunks or kindly ask your administrator.') . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>');
             exit;
         }
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:38,代码来源:files.php

示例15: downloadShare

 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @param string $token
  * @param string $files
  * @param string $path
  * @return void|RedirectResponse
  */
 public function downloadShare($token, $files = null, $path = '')
 {
     \OC_User::setIncognitoMode(true);
     $linkItem = OCP\Share::getShareByToken($token, false);
     // Share is password protected - check whether the user is permitted to access the share
     if (isset($linkItem['share_with'])) {
         if (!Helper::authenticate($linkItem)) {
             return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate', array('token' => $token)));
         }
     }
     $originalSharePath = self::getPath($token);
     if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) {
         $originalSharePath = Filesystem::normalizePath($originalSharePath . $path);
         $type = \OC\Files\Filesystem::is_dir($originalSharePath) ? 'folder' : 'file';
         $args = $type === 'folder' ? array('dir' => $originalSharePath) : array('dir' => dirname($originalSharePath), 'scrollto' => basename($originalSharePath));
         $linkToFile = \OCP\Util::linkToAbsolute('files', 'index.php', $args);
         $subject = $type === 'folder' ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
         $this->activityManager->publishActivity('files_sharing', $subject, array($originalSharePath), '', array(), $originalSharePath, $linkToFile, $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM);
     }
     if (!is_null($files)) {
         // download selected files
         $files_list = json_decode($files);
         // in case we get only a single file
         if ($files_list === NULL) {
             $files_list = array($files);
         }
         // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
         // after dispatching the request which results in a "Cannot modify header information" notice.
         OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
         exit;
     } else {
         // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
         // after dispatching the request which results in a "Cannot modify header information" notice.
         OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD');
         exit;
     }
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:46,代码来源:sharecontroller.php


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