• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Files\Helper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OCA\Files\Helper的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: rename

 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     // rename to non-existing folder is denied
     if (!$this->view->file_exists($dir)) {
         $result['data'] = array('message' => (string) $this->l10n->t('The target folder has been moved or deleted.', array($dir)), 'code' => 'targetnotfound');
         // rename to existing file is denied
     } else {
         if ($this->view->file_exists($dir . '/' . $newname)) {
             $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
         } else {
             if ($newname !== '.' and $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)) {
                 // successful rename
                 $meta = $this->view->getFileInfo($dir . '/' . $newname);
                 $fileinfo = \OCA\Files\Helper::formatFileInfo($meta);
                 $result['success'] = true;
                 $result['data'] = $fileinfo;
             } else {
                 // rename failed
                 $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
             }
         }
     }
     return $result;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:33,代码来源:app.php


示例2: rename

 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     // rename to "/Shared" is denied
     if ($dir === '/' and $newname === 'Shared') {
         $result['data'] = array('message' => $this->l10n->t("Invalid folder name. Usage of 'Shared' is reserved."));
         // rename to existing file is denied
     } else {
         if ($this->view->file_exists($dir . '/' . $newname)) {
             $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
         } else {
             if ($newname !== '.' and !($dir === '/' and $oldname === 'Shared') and $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)) {
                 // successful rename
                 $meta = $this->view->getFileInfo($dir . '/' . $newname);
                 if ($meta['mimetype'] === 'httpd/unix-directory') {
                     $meta['type'] = 'dir';
                 } else {
                     $meta['type'] = 'file';
                 }
                 $fileinfo = array('id' => $meta['fileid'], 'mime' => $meta['mimetype'], 'size' => $meta['size'], 'etag' => $meta['etag'], 'directory' => $dir, 'name' => $newname, 'isPreviewAvailable' => \OC::$server->getPreviewManager()->isMimeSupported($meta['mimetype']), 'icon' => \OCA\Files\Helper::determineIcon($meta));
                 $result['success'] = true;
                 $result['data'] = $fileinfo;
             } else {
                 // rename failed
                 $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
             }
         }
     }
     return $result;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:38,代码来源:app.php


示例3: testGetFilesByTagMultiple

 public function testGetFilesByTagMultiple()
 {
     $tagName = 'MyTagName';
     $fileInfo1 = new FileInfo('/root.txt', $this->getMockBuilder('\\OC\\Files\\Storage\\Storage')->disableOriginalConstructor()->getMock(), '/var/www/root.txt', ['mtime' => 55, 'mimetype' => 'application/pdf', 'size' => 1234, 'etag' => 'MyEtag'], $this->getMockBuilder('\\OCP\\Files\\Mount\\IMountPoint')->disableOriginalConstructor()->getMock());
     $fileInfo2 = new FileInfo('/root.txt', $this->getMockBuilder('\\OC\\Files\\Storage\\Storage')->disableOriginalConstructor()->getMock(), '/var/www/some/sub.txt', ['mtime' => 999, 'mimetype' => 'application/binary', 'size' => 9876, 'etag' => 'SubEtag'], $this->getMockBuilder('\\OCP\\Files\\Mount\\IMountPoint')->disableOriginalConstructor()->getMock());
     $this->tagService->expects($this->once())->method('getFilesByTag')->with($this->equalTo([$tagName]))->will($this->returnValue([$fileInfo1, $fileInfo2]));
     $expected = new DataResponse(['files' => [['id' => null, 'parentId' => null, 'date' => \OCP\Util::formatDate(55), 'mtime' => 55000, 'icon' => \OCA\Files\Helper::determineIcon($fileInfo1), 'name' => 'root.txt', 'permissions' => null, 'mimetype' => 'application/pdf', 'size' => 1234, 'type' => 'file', 'etag' => 'MyEtag', 'path' => '/', 'tags' => [['MyTagName']]], ['id' => null, 'parentId' => null, 'date' => \OCP\Util::formatDate(999), 'mtime' => 999000, 'icon' => \OCA\Files\Helper::determineIcon($fileInfo2), 'name' => 'root.txt', 'permissions' => null, 'mimetype' => 'application/binary', 'size' => 9876, 'type' => 'file', 'etag' => 'SubEtag', 'path' => '/', 'tags' => [['MyTagName']]]]]);
     $this->assertEquals($expected, $this->apiController->getFilesByTag([$tagName]));
 }
开发者ID:samj1912,项目名称:repo,代码行数:9,代码来源:apicontrollertest.php


示例4: testSortByName

 /**
  * @dataProvider sortDataProvider
  */
 public function testSortByName($sort, $sortDescending, $expectedOrder)
 {
     $files = self::getTestFileList();
     $files = \OCA\Files\Helper::sortFiles($files, $sort, $sortDescending);
     $fileNames = array();
     foreach ($files as $fileInfo) {
         $fileNames[] = $fileInfo->getName();
     }
     $this->assertEquals($expectedOrder, $fileNames);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:13,代码来源:helper.php


示例5: getTrashFiles

 /**
  * Retrieves the contents of a trash bin directory.
  * @param string $dir path to the directory inside the trashbin
  * or empty to retrieve the root of the trashbin
  * @return array of files
  */
 public static function getTrashFiles($dir)
 {
     $result = array();
     $user = \OCP\User::getUser();
     if ($dir && $dir !== '/') {
         $view = new \OC_Filesystemview('/' . $user . '/files_trashbin/files');
         $dirContent = $view->opendir($dir);
         if ($dirContent === false) {
             return null;
         }
         if (is_resource($dirContent)) {
             while (($entryName = readdir($dirContent)) !== false) {
                 if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) {
                     $pos = strpos($dir . '/', '/', 1);
                     $tmp = substr($dir, 0, $pos);
                     $pos = strrpos($tmp, '.d');
                     $timestamp = substr($tmp, $pos + 2);
                     $result[] = array('id' => $entryName, 'timestamp' => $timestamp, 'mime' => $view->getMimeType($dir . '/' . $entryName), 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file', 'location' => $dir);
                 }
             }
             closedir($dirContent);
         }
     } else {
         $query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE `user` = ?');
         $result = $query->execute(array($user))->fetchAll();
     }
     $files = array();
     $id = 0;
     foreach ($result as $r) {
         $i = array();
         $i['id'] = $id++;
         $i['name'] = $r['id'];
         $i['date'] = \OCP\Util::formatDate($r['timestamp']);
         $i['timestamp'] = $r['timestamp'];
         $i['etag'] = $i['timestamp'];
         // dummy etag
         $i['mimetype'] = $r['mime'];
         $i['type'] = $r['type'];
         if ($i['type'] === 'file') {
             $fileinfo = pathinfo($r['id']);
             $i['basename'] = $fileinfo['filename'];
             $i['extension'] = isset($fileinfo['extension']) ? '.' . $fileinfo['extension'] : '';
         }
         $i['directory'] = $r['location'];
         if ($i['directory'] === '/') {
             $i['directory'] = '';
         }
         $i['permissions'] = \OCP\PERMISSION_READ;
         $i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($r['mime']);
         $i['icon'] = \OCA\Files\Helper::determineIcon($i);
         $files[] = $i;
     }
     usort($files, array('\\OCA\\Files\\Helper', 'fileCmp'));
     return $files;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:61,代码来源:helper.php


示例6: determineIcon

function determineIcon($file, $sharingRoot, $sharingToken)
{
    // for folders we simply reuse the files logic
    if ($file['type'] == 'dir') {
        return \OCA\Files\Helper::determineIcon($file);
    }
    $relativePath = substr($file['path'], 6);
    $relativePath = substr($relativePath, strlen($sharingRoot));
    if ($file['isPreviewAvailable']) {
        return OCP\publicPreview_icon($relativePath, $sharingToken) . '&c=' . $file['etag'];
    }
    return OCP\mimetype_icon($file['mimetype']);
}
开发者ID:hjimmy,项目名称:owncloud,代码行数:13,代码来源:public.php


示例7: getChildInfo

/**
 * @param \OCP\Files\FileInfo $dir
 * @param \OC\Files\View $view
 * @return array
 */
function getChildInfo($dir, $view)
{
    $children = $view->getDirectoryContent($dir->getPath());
    $result = array();
    foreach ($children as $child) {
        $formated = \OCA\Files\Helper::formatFileInfo($child);
        if ($child->getType() === 'dir') {
            $formated['children'] = getChildInfo($child, $view);
        }
        $formated['mtime'] = $formated['mtime'] / 1000;
        $result[] = $formated;
    }
    return $result;
}
开发者ID:samj1912,项目名称:repo,代码行数:19,代码来源:shareinfo.php


示例8: formatFileInfos

 /**
  * Format file infos for JSON
  * @param \OCP\Files\FileInfo[] $fileInfos file infos
  */
 public static function formatFileInfos($fileInfos)
 {
     $files = array();
     $id = 0;
     foreach ($fileInfos as $i) {
         $entry = \OCA\Files\Helper::formatFileInfo($i);
         $entry['id'] = $id++;
         $entry['etag'] = $entry['mtime'];
         // add fake etag, it is only needed to identify the preview image
         $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
         $files[] = $entry;
     }
     return $files;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:18,代码来源:helper.php


示例9: formatFileInfos

 /**
  * Format file infos for JSON
  * @param \OCP\Files\FileInfo[] $fileInfos file infos
  */
 public static function formatFileInfos($fileInfos)
 {
     $files = array();
     $id = 0;
     foreach ($fileInfos as $i) {
         $entry = \OCA\Files\Helper::formatFileInfo($i);
         $entry['id'] = $id++;
         $entry['etag'] = $entry['mtime'];
         // add fake etag, it is only needed to identify the preview image
         $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
         if (\OCP\App::isEnabled('files_encryption')) {
             $entry['isPreviewAvailable'] = false;
         }
         $files[] = $entry;
     }
     return $files;
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:21,代码来源:helper.php


示例10: rename

 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     try {
         // check if the new name is conform to file name restrictions
         $this->view->verifyPath($dir, $newname);
     } catch (\OCP\Files\InvalidPathException $ex) {
         $result['data'] = array('message' => $this->l10n->t($ex->getMessage()), 'code' => 'invalidname');
         return $result;
     }
     $normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname);
     $normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
     // rename to non-existing folder is denied
     if (!$this->view->file_exists($normalizedOldPath)) {
         $result['data'] = array('message' => $this->l10n->t('%s could not be renamed as it has been deleted', array($oldname)), 'code' => 'sourcenotfound', 'oldname' => $oldname, 'newname' => $newname);
     } else {
         if (!$this->view->file_exists($dir)) {
             $result['data'] = array('message' => (string) $this->l10n->t('The target folder has been moved or deleted.', array($dir)), 'code' => 'targetnotfound');
             // rename to existing file is denied
         } else {
             if ($this->view->file_exists($normalizedNewPath)) {
                 $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
             } else {
                 if ($newname !== '.' and $this->view->rename($normalizedOldPath, $normalizedNewPath)) {
                     // successful rename
                     $meta = $this->view->getFileInfo($normalizedNewPath);
                     $meta = \OCA\Files\Helper::populateTags(array($meta));
                     $fileInfo = \OCA\Files\Helper::formatFileInfo(current($meta));
                     $fileInfo['path'] = dirname($normalizedNewPath);
                     $result['success'] = true;
                     $result['data'] = $fileInfo;
                 } else {
                     // rename failed
                     $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
                 }
             }
         }
     }
     return $result;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:48,代码来源:app.php


示例11: getFiles

 /**
  * Retrieves the contents of the given directory and
  * returns it as a sorted array.
  * @param string $dir path to the directory
  * @return array of files
  */
 public static function getFiles($dir)
 {
     $content = \OC\Files\Filesystem::getDirectoryContent($dir);
     $files = array();
     foreach ($content as $i) {
         $i['date'] = \OCP\Util::formatDate($i['mtime']);
         if ($i['type'] === 'file') {
             $fileinfo = pathinfo($i['name']);
             $i['basename'] = $fileinfo['filename'];
             if (!empty($fileinfo['extension'])) {
                 $i['extension'] = '.' . $fileinfo['extension'];
             } else {
                 $i['extension'] = '';
             }
         }
         $i['directory'] = $dir;
         $i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($i['mimetype']);
         $i['icon'] = \OCA\Files\Helper::determineIcon($i);
         $files[] = $i;
     }
     usort($files, array('\\OCA\\Files\\Helper', 'fileCmp'));
     return $files;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:29,代码来源:helper.php


示例12: manipulateDeleteTime

 /**
  * @param OCP\Files\FileInfo[] $files
  * @param string $trashRoot
  * @param integer $expireDate
  */
 private function manipulateDeleteTime($files, $trashRoot, $expireDate)
 {
     $counter = 0;
     foreach ($files as &$file) {
         // modify every second file
         $counter = ($counter + 1) % 2;
         if ($counter === 1) {
             $source = $trashRoot . '/files/' . $file['name'] . '.d' . $file['mtime'];
             $target = \OC\Files\Filesystem::normalizePath($trashRoot . '/files/' . $file['name'] . '.d' . $expireDate);
             $this->rootView->rename($source, $target);
             $file['mtime'] = $expireDate;
         }
     }
     return \OCA\Files\Helper::sortFiles($files, 'mtime');
 }
开发者ID:loulancn,项目名称:core,代码行数:20,代码来源:trashbin.php


示例13: create

 /**
  * @NoAdminRequired
  */
 public function create()
 {
     $mimetype = $this->request->post['mimetype'];
     $filename = $this->request->post['filename'];
     $dir = $this->request->post['dir'];
     $view = new View('/' . $this->uid . '/files');
     if (!$dir) {
         $dir = '/';
     }
     $basename = $this->l10n->t('New Document.odt');
     switch ($mimetype) {
         case 'application/vnd.oasis.opendocument.spreadsheet':
             $basename = $this->l10n->t('New Spreadsheet.ods');
             break;
         case 'application/vnd.oasis.opendocument.presentation':
             $basename = $this->l10n->t('New Presentation.odp');
             break;
         default:
             // to be safe
             $mimetype = 'application/vnd.oasis.opendocument.text';
             break;
     }
     if (!$filename) {
         $path = Helper::getNewFileName($view, $dir . '/' . $basename);
     } else {
         $path = $dir . '/' . $filename;
     }
     $content = '';
     if (class_exists('\\OC\\Files\\Type\\TemplateManager')) {
         $manager = \OC_Helper::getFileTemplateManager();
         $content = $manager->getTemplate($mimetype);
     }
     if (!$content) {
         $content = file_get_contents(dirname(__DIR__) . self::ODT_TEMPLATE_PATH);
     }
     $discovery_parsed = null;
     try {
         $discovery = $this->getDiscovery();
         $loadEntities = libxml_disable_entity_loader(true);
         $discovery_parsed = simplexml_load_string($discovery);
         libxml_disable_entity_loader($loadEntities);
         if ($discovery_parsed === false) {
             $this->cache->remove('discovery.xml');
             $wopiRemote = $this->appConfig->getAppValue('wopi_url');
             return array('status' => 'error', 'message' => $this->l10n->t('Collabora Online: discovery.xml from "%s" is not a well-formed XML string.', array($wopiRemote)), 'hint' => $this->l10n->t('Please contact the "%s" administrator.', array($wopiRemote)));
         }
     } catch (ResponseException $e) {
         return array('status' => 'error', 'message' => $e->getMessage(), 'hint' => $e->getHint());
     }
     if ($content && $view->file_put_contents($path, $content)) {
         $info = $view->getFileInfo($path);
         $ret = $this->getWopiSrcUrl($discovery_parsed, $mimetype);
         $response = array('status' => 'success', 'fileid' => $info['fileid'], 'urlsrc' => $ret['urlsrc'], 'action' => $ret['action'], 'lolang' => $this->settings->getUserValue($this->uid, 'core', 'lang', 'en'), 'data' => \OCA\Files\Helper::formatFileInfo($info));
     } else {
         $response = array('status' => 'error', 'message' => (string) $this->l10n->t('Can\'t create document'));
     }
     return $response;
 }
开发者ID:owncloud,项目名称:richdocuments,代码行数:61,代码来源:documentcontroller.php


示例14: catch

                        $data['directory'] = $returnedDir;
                        $result[] = $data;
                    }
                } else {
                    $error = $l->t('Upload failed. Could not find uploaded file');
                }
            } catch (Exception $ex) {
                $error = $ex->getMessage();
            }
        } else {
            // file already exists
            $meta = \OC\Files\Filesystem::getFileInfo($target);
            if ($meta === false) {
                $error = $l->t('Upload failed. Could not get file info.');
            } else {
                $data = \OCA\Files\Helper::formatFileInfo($meta);
                $data['permissions'] = $data['permissions'] & $allowedPermissions;
                $data['status'] = 'existserror';
                $data['originalname'] = $files['tmp_name'][$i];
                $data['uploadMaxFilesize'] = $maxUploadFileSize;
                $data['maxHumanFilesize'] = $maxHumanFileSize;
                $data['permissions'] = $meta['permissions'] & $allowedPermissions;
                $data['directory'] = $returnedDir;
                $result[] = $data;
            }
        }
    }
} else {
    $error = $l->t('Invalid directory.');
}
if ($error === false) {
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:upload.php


示例15: formatFileInfo

 /**
  * Formats the file info to be returned as JSON to the client.
  *
  * @param \OCP\Files\FileInfo $i
  * @return array formatted file info
  */
 public static function formatFileInfo(FileInfo $i)
 {
     $entry = array();
     $entry['id'] = $i['fileid'];
     $entry['parentId'] = $i['parent'];
     $entry['date'] = \OCP\Util::formatDate($i['mtime']);
     $entry['mtime'] = $i['mtime'] * 1000;
     // only pick out the needed attributes
     $entry['icon'] = \OCA\Files\Helper::determineIcon($i);
     if (\OC::$server->getPreviewManager()->isAvailable($i)) {
         $entry['isPreviewAvailable'] = true;
     }
     $entry['name'] = $i->getName();
     $entry['permissions'] = $i['permissions'];
     $entry['mimetype'] = $i['mimetype'];
     $entry['size'] = $i['size'];
     $entry['type'] = $i['type'];
     $entry['etag'] = $i['etag'];
     if (isset($i['tags'])) {
         $entry['tags'] = $i['tags'];
     }
     if (isset($i['displayname_owner'])) {
         $entry['shareOwner'] = $i['displayname_owner'];
     }
     if (isset($i['is_share_mount_point'])) {
         $entry['isShareMountPoint'] = $i['is_share_mount_point'];
     }
     $mountType = null;
     if ($i->isShared()) {
         $mountType = 'shared';
     } else {
         if ($i->isMounted()) {
             $mountType = 'external';
         }
     }
     if ($mountType !== null) {
         if ($i->getInternalPath() === '') {
             $mountType .= '-root';
         }
         $entry['mountType'] = $mountType;
     }
     if (isset($i['extraData'])) {
         $entry['extraData'] = $i['extraData'];
     }
     return $entry;
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:52,代码来源:helper.php


示例16: stripslashes

\OC::$server->getSession()->close();
// Get data
$dir = stripslashes($_POST["dir"]);
$allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : false;
// delete all files in dir ?
if ($allFiles === 'true') {
    $files = array();
    $fileList = \OC\Files\Filesystem::getDirectoryContent($dir);
    foreach ($fileList as $fileInfo) {
        $files[] = $fileInfo['name'];
    }
} else {
    $files = isset($_POST["file"]) ? $_POST["file"] : $_POST["files"];
    $files = json_decode($files);
}
$filesWithError = '';
$success = true;
//Now delete
foreach ($files as $file) {
    if (\OC\Files\Filesystem::file_exists($dir . '/' . $file) && !\OC\Files\Filesystem::unlink($dir . '/' . $file)) {
        $filesWithError .= $file . "\n";
        $success = false;
    }
}
// get array with updated storage stats (e.g. max file size) after upload
$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
if ($success) {
    OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));
} else {
    OCP\JSON::error(array("data" => array_merge(array("message" => "Could not delete:\n" . $filesWithError), $storageStats)));
}
开发者ID:Combustible,项目名称:core,代码行数:31,代码来源:delete.php


示例17: read

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @return TemplateResponse
  */
 public function read($id)
 {
     $attachements_info = [];
     $message = $this->connect->messages()->getById((int) $id);
     $parent = $this->connect->messages()->getById((int) $message['rid']);
     if (!empty($message['attachements'])) {
         $attach = [];
         try {
             $attach = json_decode($message['attachements'], true);
         } catch (\Exception $e) {
             var_dump('Exception: ' . $e->getMessage());
         }
         foreach ($attach as $at) {
             $file = $this->connect->files()->getInfoById($at);
             $fileInfo = false;
             $filePath = str_replace('files/', '', $file['path']);
             try {
                 $fileInfo = \OC\Files\Filesystem::getFileInfo($filePath);
             } catch (\Exception $e) {
             }
             //var_dump($file);
             if (!$fileInfo) {
                 $itemSource = \OCP\Share::getItemSharedWithBySource('file', $at);
                 if (is_array($itemSource) && !empty($itemSource)) {
                     $fileInfo = \OC\Files\Filesystem::getFileInfo($itemSource['file_target']);
                     $filePath = $itemSource['file_target'];
                 }
             }
             if (!$fileInfo) {
                 continue;
             }
             $icon = '/core/img/filetypes/image.svg';
             // \OCA\Files\Helper::determineIcon($fileInfo);
             $attachements_info[] = ['preview' => $icon, 'link' => "/remote.php/webdav/{$filePath}", 'file' => $file, 'info' => \OCA\Files\Helper::formatFileInfo($fileInfo)];
         }
     }
     Helper::cookies('goto_message', $message['rid'] == 0 ? $message['id'] : $parent['id'], 0, '/');
     $data = ['menu' => 'all', 'content' => 'read', 'message' => $message, 'parent' => $parent, 'attachements_info' => $attachements_info];
     return new TemplateResponse($this->appName, 'main', $data);
 }
开发者ID:raceface2nd,项目名称:owncollab,代码行数:45,代码来源:maincontroller.php


示例18: array

$data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password);
$linkItem = $data['linkItem'];
// Load the files
$dir = $data['realPath'];
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
    \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
    \OCP\JSON::error(array('success' => false));
    exit;
}
$data = array();
// make filelist
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$formattedFiles = array();
foreach ($files as $file) {
    $entry = \OCA\Files\Helper::formatFileInfo($file);
    unset($entry['directory']);
    // for now
    $entry['permissions'] = \OCP\PERMISSION_READ;
    $formattedFiles[] = $entry;
}
$data['directory'] = $relativePath;
$data['files'] = $formattedFiles;
$data['dirToken'] = $linkItem['token'];
$permissions = $linkItem['permissions'];
// if globally disabled
if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
    // only allow reading
    $permissions = \OCP\PERMISSION_READ;
}
$data['permissions'] = $permissions;
开发者ID:olucao,项目名称:owncloud-core,代码行数:31,代码来源:list.php


示例19: isset

OCP\JSON::checkLoggedIn();
\OC::$session->close();
$l = OC_L10N::get('files');
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$dir = \OC\Files\Filesystem::normalizePath($dir);
try {
    $dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
    if (!$dirInfo || !$dirInfo->getType() === 'dir') {
        header("HTTP/1.0 404 Not Found");
        exit;
    }
    $data = array();
    $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
    $permissions = $dirInfo->getPermissions();
    $sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
    $sortDirection = isset($_GET['sortdirection']) ? $_GET['sortdirection'] === 'desc' : false;
    // make filelist
    $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
    $data['directory'] = $dir;
    $data['files'] = \OCA\Files\Helper::formatFileInfos($files);
    $data['permissions'] = $permissions;
    OCP\JSON::success(array('data' => $data));
} catch (\OCP\Files\StorageNotAvailableException $e) {
    OCP\JSON::error(array('data' => array('exception' => '\\OCP\\Files\\StorageNotAvailableException', 'message' => $l->t('Storage not available'))));
} catch (\OCP\Files\StorageInvalidException $e) {
    OCP\JSON::error(array('data' => array('exception' => '\\OCP\\Files\\StorageInvalidException', 'message' => $l->t('Storage invalid'))));
} catch (\Exception $e) {
    OCP\JSON::error(array('data' => array('exception' => '\\Exception', 'message' => $l->t('Unknown error'))));
}
开发者ID:olucao,项目名称:owncloud-core,代码行数:30,代码来源:list.php


示例20: isset

// Init owncloud
OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
    header("HTTP/1.0 404 Not Found");
    exit;
}
$doBreadcrumb = isset($_GET['breadcrumb']);
$data = array();
$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
$permissions = \OCA\Files\Helper::getDirPermissions($dir);
// Make breadcrumb
if ($doBreadcrumb) {
    $breadcrumb = \OCA\Files\Helper::makeBreadcrumb($dir);
    $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
    $breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
    $breadcrumbNav->assign('baseURL', $baseUrl);
    $data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
$files = \OCA\Files\Helper::getFiles($dir);
$list = new OCP\Template("files", "part.list", "");
$list->assign('files', $files, false);
$list->assign('baseURL', $baseUrl, false);
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
$list->assign('isPublic', false);
$data['files'] = $list->fetchPage();
$data['permissions'] = $permissions;
OCP\JSON::success(array('data' => $data));
开发者ID:hjimmy,项目名称:owncloud,代码行数:31,代码来源:list.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Lib\StorageConfig类代码示例发布时间:2022-05-23
下一篇:
PHP Encryption\Helper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap