return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Get the directory for the given app. | |||||
* If the app is defined in multiple directories, the first one is taken. (false if not found) | |||||
*/ | |||||
* Get the directory for the given app. | |||||
* If the app is defined in multiple directories, the first one is taken. (false if not found) | |||||
* @param string $appid | |||||
* @return string|false | |||||
*/ | |||||
public static function getAppPath($appid) { | public static function getAppPath($appid) { | ||||
if( ($dir = self::findAppInDirectories($appid)) != false) { | if( ($dir = self::findAppInDirectories($appid)) != false) { | ||||
return $dir['path'].'/'.$appid; | return $dir['path'].'/'.$appid; | ||||
} | } | ||||
/** | /** | ||||
* Get the path for the given app on the access | |||||
* If the app is defined in multiple directories, the first one is taken. (false if not found) | |||||
*/ | |||||
* Get the path for the given app on the access | |||||
* If the app is defined in multiple directories, the first one is taken. (false if not found) | |||||
* @param string $appid | |||||
* @return string|false | |||||
*/ | |||||
public static function getAppWebPath($appid) { | public static function getAppWebPath($appid) { | ||||
if( ($dir = self::findAppInDirectories($appid)) != false) { | if( ($dir = self::findAppInDirectories($appid)) != false) { | ||||
return OC::$WEBROOT.$dir['url'].'/'.$appid; | return OC::$WEBROOT.$dir['url'].'/'.$appid; | ||||
/** | /** | ||||
* get the last version of the app, either from appinfo/version or from appinfo/info.xml | * get the last version of the app, either from appinfo/version or from appinfo/info.xml | ||||
* @param string $appid | |||||
* @return string | * @return string | ||||
*/ | */ | ||||
public static function getAppVersion($appid) { | public static function getAppVersion($appid) { |
/** | /** | ||||
* Returns the cache storage for the logged in user | * Returns the cache storage for the logged in user | ||||
* @return cache storage | |||||
* @return \OC\Files\View cache storage | |||||
*/ | */ | ||||
protected function getStorage() { | protected function getStorage() { | ||||
if (isset($this->storage)) { | if (isset($this->storage)) { |
* Returns a specific child node, referenced by its name | * Returns a specific child node, referenced by its name | ||||
* | * | ||||
* @param string $name | * @param string $name | ||||
* @param OC\Files\FileInfo $info | |||||
* @throws Sabre_DAV_Exception_FileNotFound | * @throws Sabre_DAV_Exception_FileNotFound | ||||
* @return Sabre_DAV_INode | * @return Sabre_DAV_INode | ||||
*/ | */ |
* | * | ||||
* @param string $f target path | * @param string $f target path | ||||
* | * | ||||
* @return assembled file size | |||||
* @return integer assembled file size | |||||
* | * | ||||
* @throws \OC\InsufficientStorageException when file could not be fully | * @throws \OC\InsufficientStorageException when file could not be fully | ||||
* assembled due to lack of free space | * assembled due to lack of free space | ||||
/** | /** | ||||
* Returns the size of the chunks already present | * Returns the size of the chunks already present | ||||
* @return size in bytes | |||||
* @return integer size in bytes | |||||
*/ | */ | ||||
public function getCurrentSize() { | public function getCurrentSize() { | ||||
$cache = $this->getCache(); | $cache = $this->getCache(); | ||||
* | * | ||||
* @param string $path target path | * @param string $path target path | ||||
* | * | ||||
* @return assembled file size or false if file could not be created | |||||
* @return boolean assembled file size or false if file could not be created | |||||
* | * | ||||
* @throws \OC\InsufficientStorageException when file could not be fully | * @throws \OC\InsufficientStorageException when file could not be fully | ||||
* assembled due to lack of free space | * assembled due to lack of free space | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
return false; | |||||
} | } | ||||
} | } |
return false; | return false; | ||||
} | } | ||||
/** | |||||
* @param string $path | |||||
*/ | |||||
protected function getCachedFile($path) { | protected function getCachedFile($path) { | ||||
if (!isset($this->cachedFiles[$path])) { | if (!isset($this->cachedFiles[$path])) { | ||||
$this->cachedFiles[$path] = $this->toTmpFile($path); | $this->cachedFiles[$path] = $this->toTmpFile($path); |
$this->mapper->copy($fullPath1, $fullPath2); | $this->mapper->copy($fullPath1, $fullPath2); | ||||
} | } | ||||
/** | |||||
* @param string $path | |||||
*/ | |||||
private function stripLeading($path) { | private function stripLeading($path) { | ||||
if(strpos($path, '/') === 0) { | if(strpos($path, '/') === 0) { | ||||
$path = substr($path, 1); | $path = substr($path, 1); |
/** | /** | ||||
* @brief Constructor. | * @brief Constructor. | ||||
* @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by | |||||
* @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by | |||||
* an imagecreate* function. | * an imagecreate* function. | ||||
* @return \OC_Image False on error | * @return \OC_Image False on error | ||||
*/ | */ | ||||
/** | /** | ||||
* @brief Returns the MIME type of the image or an empty string if no image is loaded. | * @brief Returns the MIME type of the image or an empty string if no image is loaded. | ||||
* @return int | |||||
* @return string | |||||
*/ | */ | ||||
public function mimeType() { | public function mimeType() { | ||||
return $this->valid() ? $this->mimeType : ''; | return $this->valid() ? $this->mimeType : ''; | ||||
/** | /** | ||||
* @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function. | * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function. | ||||
* @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ). | |||||
* @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ). | |||||
* @return resource|false An image resource or false on error | * @return resource|false An image resource or false on error | ||||
*/ | */ | ||||
public function load($imageRef) { | public function load($imageRef) { |
* of trusted domains. If no trusted domains have been configured, returns | * of trusted domains. If no trusted domains have been configured, returns | ||||
* true. | * true. | ||||
* This is used to prevent Host Header Poisoning. | * This is used to prevent Host Header Poisoning. | ||||
* @param string $host | |||||
* @param string $domain | |||||
* @return bool true if the given domain is trusted or if no trusted domains | * @return bool true if the given domain is trusted or if no trusted domains | ||||
* have been configured | * have been configured | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the overwritehost setting from the config if set and | * Returns the overwritehost setting from the config if set and | ||||
* if the overwrite condition is met | * if the overwrite condition is met | ||||
* @return overwritehost value or null if not defined or the defined condition | |||||
* @return string|null overwritehost value or null if not defined or the defined condition | |||||
* isn't met | * isn't met | ||||
*/ | */ | ||||
public static function getOverwriteHost() { | public static function getOverwriteHost() { |
/** | /** | ||||
* Specify POST as the method to use with this route | * Specify POST as the method to use with this route | ||||
* @return \OC\Route\Route | |||||
*/ | */ | ||||
public function post() { | public function post() { | ||||
$this->method('POST'); | $this->method('POST'); | ||||
/** | /** | ||||
* Specify GET as the method to use with this route | * Specify GET as the method to use with this route | ||||
* @return \OC\Route\Route | |||||
*/ | */ | ||||
public function get() { | public function get() { | ||||
$this->method('GET'); | $this->method('GET'); | ||||
/** | /** | ||||
* Specify PUT as the method to use with this route | * Specify PUT as the method to use with this route | ||||
* @return \OC\Route\Route | |||||
*/ | */ | ||||
public function put() { | public function put() { | ||||
$this->method('PUT'); | $this->method('PUT'); | ||||
/** | /** | ||||
* Specify DELETE as the method to use with this route | * Specify DELETE as the method to use with this route | ||||
* @return \OC\Route\Route | |||||
*/ | */ | ||||
public function delete() { | public function delete() { | ||||
$this->method('DELETE'); | $this->method('DELETE'); | ||||
/** | /** | ||||
* Specify PATCH as the method to use with this route | * Specify PATCH as the method to use with this route | ||||
* @return \OC\Route\Route | |||||
*/ | */ | ||||
public function patch() { | public function patch() { | ||||
$this->method('PATCH'); | $this->method('PATCH'); | ||||
* The action to execute when this route matches, includes a file like | * The action to execute when this route matches, includes a file like | ||||
* it is called directly | * it is called directly | ||||
* @param $file | * @param $file | ||||
* @return void | |||||
*/ | */ | ||||
public function actionInclude($file) { | public function actionInclude($file) { | ||||
$function = create_function('$param', | $function = create_function('$param', |
return $this->routingFiles; | return $this->routingFiles; | ||||
} | } | ||||
/** | |||||
* @return string | |||||
*/ | |||||
public function getCacheKey() { | public function getCacheKey() { | ||||
if (!isset($this->cacheKey)) { | if (!isset($this->cacheKey)) { | ||||
$files = $this->getRoutingFiles(); | $files = $this->getRoutingFiles(); | ||||
/** | /** | ||||
* loads the api routes | * loads the api routes | ||||
* @return void | |||||
*/ | */ | ||||
public function loadRoutes($app = null) { | public function loadRoutes($app = null) { | ||||
if ($this->loaded) { | if ($this->loaded) { | ||||
* Sets the collection to use for adding routes | * Sets the collection to use for adding routes | ||||
* | * | ||||
* @param string $name Name of the collection to use. | * @param string $name Name of the collection to use. | ||||
* @return void | |||||
*/ | */ | ||||
public function useCollection($name) { | public function useCollection($name) { | ||||
$this->collection = $this->getCollection($name); | $this->collection = $this->getCollection($name); | ||||
* | * | ||||
* @param string $url The url to find | * @param string $url The url to find | ||||
* @throws \Exception | * @throws \Exception | ||||
* @return void | |||||
*/ | */ | ||||
public function match($url) { | public function match($url) { | ||||
if (substr($url, 0, 6) === '/apps/') { | if (substr($url, 0, 6) === '/apps/') { | ||||
/** | /** | ||||
* Get the url generator | * Get the url generator | ||||
* @return \Symfony\Component\Routing\Generator\UrlGenerator | |||||
* | * | ||||
*/ | */ | ||||
public function getGenerator() { | public function getGenerator() { |
* @brief Creates an url using a defined route | * @brief Creates an url using a defined route | ||||
* @param $route | * @param $route | ||||
* @param array $parameters | * @param array $parameters | ||||
* @return | |||||
* @internal param array $args with param=>value, will be appended to the returned url | * @internal param array $args with param=>value, will be appended to the returned url | ||||
* @returns string the url | |||||
* @return string the url | |||||
* | * | ||||
* Returns a url to the given app and file. | * Returns a url to the given app and file. | ||||
*/ | */ |