diff options
author | Frank Karlitschek <frank@owncloud.org> | 2012-05-01 18:50:31 +0200 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2012-05-01 18:50:31 +0200 |
commit | 70cea18cce0fcdb4d8118ff2d7abccc922417a6a (patch) | |
tree | 7f8c476cb75b38fea3ed4ad555f00885f6da2670 /apps/files_sharing | |
parent | dc7cdda5ccc7d40bf9865e1af5a7846782ec700b (diff) | |
download | nextcloud-server-70cea18cce0fcdb4d8118ff2d7abccc922417a6a.tar.gz nextcloud-server-70cea18cce0fcdb4d8118ff2d7abccc922417a6a.zip |
ported getUser
Diffstat (limited to 'apps/files_sharing')
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/ajax/email.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/ajax/getitem.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/ajax/setpermissions.php | 2 | ||||
-rwxr-xr-x | apps/files_sharing/ajax/share.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/ajax/unshare.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/ajax/userautocomplete.php | 2 | ||||
-rwxr-xr-x | apps/files_sharing/lib_share.php | 36 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/files_sharing/sharedstorage.php | 2 |
8 files changed, 25 insertions, 25 deletions
diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php index 145026bbcd1..c0835f4946e 100644..100755 --- a/apps/files_sharing/ajax/email.php +++ b/apps/files_sharing/ajax/email.php @@ -1,7 +1,7 @@ <?php OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('files_sharing'); -$user = OC_User::getUser(); +$user = OCP\USER::getUser(); // TODO translations $subject = $user + ' ' + 'shared a file with you'; $link = $_POST['link'] + '&f=' + $_POST['f']; diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index 6f8d5247580..b15a81e6086 100644..100755 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -5,7 +5,7 @@ OC_JSON::checkAppEnabled('files_sharing'); require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php'); -$userDirectory = "/".OC_User::getUser()."/files"; +$userDirectory = "/".OCP\USER::getUser()."/files"; $source = $userDirectory.$_GET['source']; $path = $source; $users = array(); diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php index 60302d034f7..fc907bd7517 100644..100755 --- a/apps/files_sharing/ajax/setpermissions.php +++ b/apps/files_sharing/ajax/setpermissions.php @@ -5,7 +5,7 @@ OC_JSON::checkAppEnabled('files_sharing'); require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php'); -$source = "/".OC_User::getUser()."/files".$_GET['source']; +$source = "/".OCP\USER::getUser()."/files".$_GET['source']; $uid_shared_with = $_GET['uid_shared_with']; $permissions = $_GET['permissions']; OC_Share::setPermissions($source, $uid_shared_with, $permissions); diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index c704f653c11..fe1c9e07984 100755 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -5,7 +5,7 @@ OC_JSON::checkAppEnabled('files_sharing'); require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php'); -$userDirectory = "/".OC_User::getUser()."/files"; +$userDirectory = "/".OCP\USER::getUser()."/files"; $sources = explode(";", $_POST['sources']); $uid_shared_with = $_POST['uid_shared_with']; $permissions = $_POST['permissions']; diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php index 7e99b5fe374..061d31e2a98 100644..100755 --- a/apps/files_sharing/ajax/unshare.php +++ b/apps/files_sharing/ajax/unshare.php @@ -5,7 +5,7 @@ OC_JSON::checkAppEnabled('files_sharing'); require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php'); -$source = "/".OC_User::getUser()."/files".$_GET['source']; +$source = "/".OCP\USER::getUser()."/files".$_GET['source']; $uid_shared_with = $_GET['uid_shared_with']; OC_Share::unshare($source, $uid_shared_with); diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php index cc22a0cd1a7..83fdc3bdf4d 100644..100755 --- a/apps/files_sharing/ajax/userautocomplete.php +++ b/apps/files_sharing/ajax/userautocomplete.php @@ -8,7 +8,7 @@ OC_JSON::checkAppEnabled('files_sharing'); $users = array(); $groups = array(); -$self = OC_User::getUser(); +$self = OCP\USER::getUser(); $userGroups = OC_Group::getUserGroups($self); $users[] = "<optgroup label='Users'>"; $groups[] = "<optgroup label='Groups'>"; diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index c5127c59cbd..0ccfea180c6 100755 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -39,7 +39,7 @@ class OC_Share { * @param $permissions The permissions, use the constants WRITE and DELETE */ public function __construct($source, $uid_shared_with, $permissions) { - $uid_owner = OC_User::getUser(); + $uid_owner = OCP\USER::getUser(); $query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)"); if ($uid_shared_with == self::PUBLICLINK) { $token = sha1("$uid_shared_with-$source"); @@ -99,7 +99,7 @@ class OC_Share { } $query->execute(array($uid_owner, $uid, $source, $target, $permissions)); // Add file to filesystem cache - $userDirectory = "/".OC_User::getUser()."/files"; + $userDirectory = "/".OCP\USER::getUser()."/files"; $data = OC_Filecache::get(substr($source, strlen($userDirectory))); $parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?'); $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow(); @@ -145,7 +145,7 @@ class OC_Share { $in .= ", '".$uid."@".$group."'"; } } else { - $uid = OC_User::getUser(); + $uid = OCP\USER::getUser(); $in .= "'".$uid."'"; $groups = OC_Group::getUserGroups($uid); foreach ($groups as $group) { @@ -170,7 +170,7 @@ class OC_Share { $source = $folders['source'].substr($oldTarget, strlen($folders['target'])); $item = self::getItem($folders['target']); $query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)"); - $query->execute(array($item[0]['uid_owner'], OC_User::getUser(), $source, $newTarget, $item[0]['permissions'])); + $query->execute(array($item[0]['uid_owner'], OCP\USER::getUser(), $source, $newTarget, $item[0]['permissions'])); } /** @@ -181,7 +181,7 @@ class OC_Share { public static function getItem($target) { $target = self::cleanPath($target); $query = OC_DB::prepare("SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1"); - return $query->execute(array($target, OC_User::getUser()))->fetchAll(); + return $query->execute(array($target, OCP\USER::getUser()))->fetchAll(); } /** @@ -192,11 +192,11 @@ class OC_Share { public static function getMySharedItem($source) { $source = self::cleanPath($source); $query = OC_DB::prepare("SELECT uid_shared_with, permissions FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ?"); - $result = $query->execute(array($source, OC_User::getUser()))->fetchAll(); + $result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll(); if (count($result) > 0) { return $result; } else if ($originalSource = self::getSource($source)) { - return $query->execute(array($originalSource, OC_User::getUser()))->fetchAll(); + return $query->execute(array($originalSource, OCP\USER::getUser()))->fetchAll(); } else { return false; } @@ -208,7 +208,7 @@ class OC_Share { */ public static function getMySharedItems() { $query = OC_DB::prepare("SELECT uid_shared_with, source, permissions FROM *PREFIX*sharing WHERE uid_owner = ?"); - return $query->execute(array(OC_User::getUser()))->fetchAll(); + return $query->execute(array(OCP\USER::getUser()))->fetchAll(); } /** @@ -282,7 +282,7 @@ class OC_Share { public static function getTarget($source) { $source = self::cleanPath($source); $query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ? LIMIT 1"); - $result = $query->execute(array($source, OC_User::getUser()))->fetchAll(); + $result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll(); if (count($result) > 0) { return $result[0]['target']; } else { @@ -331,7 +331,7 @@ class OC_Share { */ public static function getTokenFromSource($source) { $query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with = ? AND uid_owner = ? LIMIT 1"); - $result = $query->execute(array($source, self::PUBLICLINK, OC_User::getUser()))->fetchAll(); + $result = $query->execute(array($source, self::PUBLICLINK, OCP\USER::getUser()))->fetchAll(); if (count($result) > 0) { return $result[0]['target']; } else { @@ -366,7 +366,7 @@ class OC_Share { public static function setPermissions($source, $uid_shared_with, $permissions) { $source = self::cleanPath($source); $query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with)); - $query->execute(array($permissions, strlen($source), $source, OC_User::getUser())); + $query->execute(array($permissions, strlen($source), $source, OCP\USER::getUser())); } /** @@ -380,7 +380,7 @@ class OC_Share { public static function unshare($source, $uid_shared_with) { $source = self::cleanPath($source); $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with)); - $query->execute(array(strlen($source), $source, OC_User::getUser())); + $query->execute(array(strlen($source), $source, OCP\USER::getUser())); } /** @@ -407,12 +407,12 @@ class OC_Share { * @param $arguments Array of arguments passed from OC_Hook */ public static function deleteItem($arguments) { - $source = "/".OC_User::getUser()."/files".self::cleanPath($arguments['path']); + $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']); if ($target = self::getTarget($source)) { // Forward hook to notify of changes to target file OC_Hook::emit("OC_Filesystem", "post_delete", array('path' => $target)); $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?"); - $query->execute(array(strlen($source), $source, OC_User::getUser())); + $query->execute(array(strlen($source), $source, OCP\USER::getUser())); } } @@ -422,14 +422,14 @@ class OC_Share { * @param $arguments Array of arguments passed from OC_Hook */ public static function renameItem($arguments) { - $oldSource = "/".OC_User::getUser()."/files".self::cleanPath($arguments['oldpath']); - $newSource = "/".OC_User::getUser()."/files".self::cleanPath($arguments['newpath']); + $oldSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['oldpath']); + $newSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['newpath']); $query = OC_DB::prepare("UPDATE *PREFIX*sharing SET source = REPLACE(source, ?, ?) WHERE uid_owner = ?"); - $query->execute(array($oldSource, $newSource, OC_User::getUser())); + $query->execute(array($oldSource, $newSource, OCP\USER::getUser())); } public static function updateItem($arguments) { - $source = "/".OC_User::getUser()."/files".self::cleanPath($arguments['path']); + $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']); if ($target = self::getTarget($source)) { // Forward hook to notify of changes to target file OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target)); diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 845659588ef..f64d52551ff 100644..100755 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -25,7 +25,7 @@ require_once( 'lib_share.php' ); if (OC_Filesystem::$loaded and !OC_Filesystem::is_dir('/Shared')) { OC_Filesystem::mkdir('/Shared'); } -OC_Filesystem::mount('OC_Filestorage_Shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared'),'/'.OC_User::getUser().'/files/Shared/'); +OC_Filesystem::mount('OC_Filestorage_Shared',array('datadir'=>'/'.OCP\USER::getUser().'/files/Shared'),'/'.OCP\USER::getUser().'/files/Shared/'); /** * Convert target path to source path and pass the function call to the correct storage provider |