diff options
Diffstat (limited to 'Zotlabs/Storage')
-rw-r--r-- | Zotlabs/Storage/BasicAuth.php | 13 | ||||
-rw-r--r-- | Zotlabs/Storage/Directory.php | 18 | ||||
-rw-r--r-- | Zotlabs/Storage/File.php | 2 |
3 files changed, 29 insertions, 4 deletions
diff --git a/Zotlabs/Storage/BasicAuth.php b/Zotlabs/Storage/BasicAuth.php index d23f3d848..3fd1bcc1f 100644 --- a/Zotlabs/Storage/BasicAuth.php +++ b/Zotlabs/Storage/BasicAuth.php @@ -34,6 +34,14 @@ class BasicAuth extends DAV\Auth\Backend\AbstractBasic { * @var int $channel_id */ public $channel_id = 0; + + /** + * @brief channel_account_id of the current channel of the logged-in account. + * + * @var int $channel_account_id + */ + public $channel_account_id = 0; + /** * @brief channel_hash of the current channel of the logged-in account. * @@ -127,6 +135,7 @@ class BasicAuth extends DAV\Auth\Backend\AbstractBasic { */ protected function setAuthenticated($channel) { $this->channel_name = $channel['channel_address']; + $this->channel_account_id = $channel['channel_account_id']; $this->channel_id = $channel['channel_id']; $this->channel_hash = $this->observer = $channel['channel_hash']; @@ -139,8 +148,8 @@ class BasicAuth extends DAV\Auth\Backend\AbstractBasic { } } - $_SESSION['uid'] = $channel['channel_id']; - $_SESSION['account_id'] = $channel['channel_account_id']; + $_SESSION['uid'] = $this->channel_id; + $_SESSION['account_id'] = $this->channel_account_id; $_SESSION['authenticated'] = true; return true; } diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index 683887b31..333251f69 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -173,7 +173,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo intval($this->auth->owner_id) ); - $x = attach_syspaths($this->auth->owner_id,$this->folder_hash); + $x = attach_syspaths($this->auth->owner_id, $this->folder_hash); $y = q("update attach set display_path = '%s' where hash = '%s' and uid = %d", dbesc($x['path']), @@ -181,6 +181,20 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo intval($this->auth->owner_id) ); + $z = q("select hash from attach where folder = '%s' and uid = %d", + dbesc($this->folder_hash), + intval($this->auth->owner_id) + ); + + if($z) { + foreach ($z as $zz) { + $rs = attach_move($this->auth->owner_id, $zz['hash'], $this->folder_hash, '', false); + if(!$rs['success']) { + break; + } + } + } + $ch = channelx_by_n($this->auth->owner_id); if ($ch) { $sync = attach_export_data($ch, $this->folder_hash); @@ -481,7 +495,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo } - public function moveInto($targetName,$sourcePath, DAV\INode $sourceNode) { + public function moveInto($targetName, $sourcePath, DAV\INode $sourceNode) { $channel_id = $this->auth->owner_id; // Files have $sourceNode->data['hash'] set. For directories rely on $sourceNode->folder_hash. diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php index dc60a72ae..ff379e2e9 100644 --- a/Zotlabs/Storage/File.php +++ b/Zotlabs/Storage/File.php @@ -38,6 +38,8 @@ class File extends DAV\Node implements DAV\IFile { */ private $name; + public $os_path; + public $folder_hash; /** * Sets up the node, expects a full path name. |