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


PHP Storage::getUidAndFilename方法代码示例

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


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

示例1: getAllVersions

 /**
  * Gets all versions of a note
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  * @CORS
  *
  * @return array
  */
 public function getAllVersions()
 {
     $source = $this->request->getParam("file_name", "");
     list($uid, $filename) = Storage::getUidAndFilename($source);
     $versions = Storage::getVersions($uid, $filename, $source);
     $versionsResults = array();
     if (is_array($versions) && count($versions) > 0) {
         require_once __DIR__ . '/../3rdparty/finediff/finediff.php';
         $users_view = new View('/' . $uid);
         $currentData = $users_view->file_get_contents('files/' . $filename);
         //            $previousData = $currentData;
         //            $versions = array_reverse( $versions, true );
         foreach ($versions as $versionData) {
             // get timestamp of version
             $mtime = (int) $versionData["version"];
             // get filename of note version
             $versionFileName = 'files_versions/' . $filename . '.v' . $mtime;
             // load the data from the file
             $data = $users_view->file_get_contents($versionFileName);
             // calculate diff between versions
             $opcodes = \FineDiff::getDiffOpcodes($currentData, $data);
             $html = \FineDiff::renderDiffToHTMLFromOpcodes($currentData, $opcodes);
             $versionsResults[] = array("timestamp" => $mtime, "humanReadableTimestamp" => $versionData["humanReadableTimestamp"], "diffHtml" => $html, "data" => $data);
             //                $previousData = $data;
         }
         //            $versionsResults = array_reverse( $versionsResults );
     }
     return array("file_name" => $source, "versions" => $versionsResults);
 }
开发者ID:pbek,项目名称:qownnotesapi,代码行数:38,代码来源:noteapicontroller.php

示例2: array_key_exists

}
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : 44;
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : 44;
$version = array_key_exists('version', $_GET) ? $_GET['version'] : '';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
if ($file === '' && $version === '') {
    \OC_Response::setStatus(400);
    //400 Bad Request
    \OC_Log::write('versions-preview', 'No file parameter was passed', \OC_Log::DEBUG);
    exit;
}
if ($maxX === 0 || $maxY === 0) {
    \OC_Response::setStatus(400);
    //400 Bad Request
    \OC_Log::write('versions-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
    exit;
}
try {
    list($user, $file) = \OCA\Files_Versions\Storage::getUidAndFilename($file);
    $preview = new \OC\Preview($user, 'files_versions', $file . '.v' . $version);
    $mimetype = \OC_Helper::getFileNameMimeType($file);
    $preview->setMimetype($mimetype);
    $preview->setMaxX($maxX);
    $preview->setMaxY($maxY);
    $preview->setScalingUp($scalingUp);
    $preview->showPreview();
} catch (\Exception $e) {
    \OC_Response::setStatus(500);
    \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
}
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:31,代码来源:preview.php

示例3: wopiGetFile

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @PublicPage
  * Given an access token and a fileId, returns the contents of the file.
  * Expects a valid token in access_token parameter.
  */
 public function wopiGetFile($fileId)
 {
     $token = $this->request->getParam('access_token');
     $arr = explode('_', $fileId, 2);
     $version = '0';
     if (count($arr) == 2) {
         $fileId = $arr[0];
         $version = $arr[1];
     }
     \OC::$server->getLogger()->debug('Getting contents of file {fileId}, version {version} by token {token}.', ['app' => $this->appName, 'fileId' => $fileId, 'version' => $version, 'token' => $token]);
     $row = new Db\Wopi();
     $row->loadBy('token', $token);
     //TODO: Support X-WOPIMaxExpectedSize header.
     $res = $row->getPathForToken($fileId, $version, $token);
     $ownerid = $res['owner'];
     // Login the user to see his mount locations
     $this->loginUser($ownerid);
     $filename = '';
     // If some previous version is requested, fetch it from Files_Version app
     if ($version !== '0') {
         \OCP\JSON::checkAppEnabled('files_versions');
         // Setup the FS
         \OC_Util::tearDownFS();
         \OC_Util::setupFS($ownerid, '/' . $ownerid . '/files');
         list($ownerid, $filename) = \OCA\Files_Versions\Storage::getUidAndFilename($res['path']);
         $filename = '/files_versions/' . $filename . '.v' . $version;
         \OC_Util::tearDownFS();
     } else {
         $filename = '/files' . $res['path'];
     }
     // Close the session created for user login
     \OC::$server->getSession()->close();
     return new DownloadResponse($this->request, $ownerid, $filename);
 }
开发者ID:owncloud,项目名称:richdocuments,代码行数:41,代码来源:documentcontroller.php


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