diff options
Diffstat (limited to 'Zotlabs/Storage/File.php')
-rw-r--r-- | Zotlabs/Storage/File.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php index 5a70a99f1..d2bca3964 100644 --- a/Zotlabs/Storage/File.php +++ b/Zotlabs/Storage/File.php @@ -9,8 +9,8 @@ use Sabre\DAV; * * It provides all functions to work with files in Red's cloud through DAV protocol. * - * @extends \Sabre\DAV\Node - * @implements \Sabre\DAV\IFile + * @extends \\Sabre\\DAV\\Node + * @implements \\Sabre\\DAV\\IFile * * @link http://github.com/friendica/red * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT) @@ -20,20 +20,20 @@ class File extends DAV\Node implements DAV\IFile { /** * The file from attach table. * - * @var array - * data - * flags - * filename (string) - * filetype (string) + * @var array $data + * * data + * * flags + * * filename (string) + * * filetype (string) */ private $data; /** - * @see \Sabre\DAV\Auth\Backend\BackendInterface - * @var \RedMatrix\RedDAV\RedBasicAuth + * @see \\Sabre\\DAV\\Auth\\Backend\\BackendInterface + * @var \\Zotlabs\\Storage\\BasicAuth $auth */ private $auth; /** - * @var string + * @var string $name */ private $name; @@ -65,8 +65,8 @@ class File extends DAV\Node implements DAV\IFile { /** * @brief Renames the file. * - * @throw Sabre\DAV\Exception\Forbidden - * @param string $name The new name of the file. + * @throw "\Sabre\DAV\Exception\Forbidden" + * @param string $newName The new name of the file. * @return void */ public function setName($newName) { @@ -95,7 +95,7 @@ class File extends DAV\Node implements DAV\IFile { $ch = channelx_by_n($this->auth->owner_id); if($ch) { $sync = attach_export_data($ch,$this->data['hash']); - if($sync) + if($sync) build_sync_packet($ch['channel_id'],array('file' => array($sync))); } } @@ -138,7 +138,7 @@ class File extends DAV\Node implements DAV\IFile { $album = $f1[0]['filename']; $direct = $f1[0]; } - } + } $fname = dbunescbin($d[0]['content']); if(strpos($fname,'store') === false) $f = 'store/' . $this->auth->owner_nick . '/' . $fname ; @@ -151,11 +151,11 @@ class File extends DAV\Node implements DAV\IFile { logger('filename: ' . $f . ' size: ' . $size, LOGGER_DEBUG); } $gis = @getimagesize($f); - logger('getimagesize: ' . print_r($gis,true), LOGGER_DATA); + logger('getimagesize: ' . print_r($gis,true), LOGGER_DATA); if(($gis) && ($gis[2] === IMAGETYPE_GIF || $gis[2] === IMAGETYPE_JPEG || $gis[2] === IMAGETYPE_PNG)) { $is_photo = 1; } - } + } else { // this shouldn't happen any more $r = q("UPDATE attach SET content = '%s' WHERE hash = '%s' AND uid = %d", @@ -222,7 +222,7 @@ class File extends DAV\Node implements DAV\IFile { $sync = attach_export_data($c[0],$this->data['hash']); - if($sync) + if($sync) build_sync_packet($c[0]['channel_id'],array('file' => array($sync))); } @@ -322,16 +322,16 @@ class File extends DAV\Node implements DAV\IFile { * This method checks the permissions and then calls attach_delete() function * to actually remove the file. * - * @throw \Sabre\DAV\Exception\Forbidden + * @throw "\Sabre\DAV\Exception\Forbidden" */ public function delete() { logger('delete file ' . basename($this->name), LOGGER_DEBUG); - if ((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) { + if((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) { throw new DAV\Exception\Forbidden('Permission denied.'); } - if ($this->auth->owner_id !== $this->auth->channel_id) { + if($this->auth->owner_id !== $this->auth->channel_id) { if (($this->auth->observer !== $this->data['creator']) || intval($this->data['is_dir'])) { throw new DAV\Exception\Forbidden('Permission denied.'); } @@ -340,14 +340,14 @@ class File extends DAV\Node implements DAV\IFile { if(get_pconfig($this->auth->owner_id,'system','os_delete_prohibit') && \App::$module == 'dav') { throw new DAV\Exception\Forbidden('Permission denied.'); } - + attach_delete($this->auth->owner_id, $this->data['hash']); $ch = channelx_by_n($this->auth->owner_id); if($ch) { - $sync = attach_export_data($ch,$this->data['hash'],true); - if($sync) - build_sync_packet($ch['channel_id'],array('file' => array($sync))); + $sync = attach_export_data($ch, $this->data['hash'], true); + if($sync) + build_sync_packet($ch['channel_id'], array('file' => array($sync))); } } } |