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/gallery | |
parent | dc7cdda5ccc7d40bf9865e1af5a7846782ec700b (diff) | |
download | nextcloud-server-70cea18cce0fcdb4d8118ff2d7abccc922417a6a.tar.gz nextcloud-server-70cea18cce0fcdb4d8118ff2d7abccc922417a6a.zip |
ported getUser
Diffstat (limited to 'apps/gallery')
-rwxr-xr-x[-rw-r--r--] | apps/gallery/ajax/createAlbum.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/ajax/galleryOp.php | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/appinfo/app.php | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/index.php | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/lib/album.php | 6 | ||||
-rwxr-xr-x | apps/gallery/lib/hooks_handlers.php | 28 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/lib/photo.php | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/lib/scanner.php | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | apps/gallery/templates/index.php | 2 |
9 files changed, 41 insertions, 41 deletions
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php index ca02c3ae209..eaf5c296de9 100644..100755 --- a/apps/gallery/ajax/createAlbum.php +++ b/apps/gallery/ajax/createAlbum.php @@ -25,7 +25,7 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); -OC_Gallery_Album::create(OC_User::getUser(), $_GET['album_name']); +OC_Gallery_Album::create(OCP\USER::getUser(), $_GET['album_name']); OC_JSON::success(array('name' => $_GET['album_name'])); diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index 98cf71ec14f..aaf4a7d8658 100644..100755 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -28,15 +28,15 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); function handleRename($oldname, $newname) { - OC_Gallery_Album::rename($oldname, $newname, OC_User::getUser()); + OC_Gallery_Album::rename($oldname, $newname, OCP\USER::getUser()); OC_Gallery_Album::changeThumbnailPath($oldname, $newname); } function handleRemove($name) { - $album_id = OC_Gallery_Album::find(OC_User::getUser(), $name); + $album_id = OC_Gallery_Album::find(OCP\USER::getUser(), $name); $album_id = $album_id->fetchRow(); $album_id = $album_id['album_id']; - OC_Gallery_Album::remove(OC_User::getUser(), $name); + OC_Gallery_Album::remove(OCP\USER::getUser(), $name); OC_Gallery_Photo::removeByAlbumId($album_id); } @@ -74,25 +74,25 @@ function handleStoreSettings($root, $order) { return; } - $current_root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/'); + $current_root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); $root = trim($root); $root = rtrim($root, '/').'/'; $rescan = $current_root==$root?'no':'yes'; - OC_Preferences::setValue(OC_User::getUser(), 'gallery', 'root', $root); - OC_Preferences::setValue(OC_User::getUser(), 'gallery', 'order', $order); + OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'root', $root); + OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'order', $order); OC_JSON::success(array('rescan' => $rescan)); } function handleGetGallery($path) { $a = array(); - $root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/'); + $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); $path = utf8_decode(rtrim($root.$path,'/')); if($path == '') $path = '/'; $pathLen = strlen($path); - $result = OC_Gallery_Album::find(OC_User::getUser(), null, $path); + $result = OC_Gallery_Album::find(OCP\USER::getUser(), null, $path); $album_details = $result->fetchRow(); - $result = OC_Gallery_Album::find(OC_User::getUser(), null, null, $path); + $result = OC_Gallery_Album::find(OCP\USER::getUser(), null, null, $path); while ($r = $result->fetchRow()) { $album_name = $r['album_name']; @@ -126,8 +126,8 @@ function handleGetGallery($path) { function handleShare($path, $share, $recursive) { $recursive = $recursive == 'true' ? 1 : 0; - $owner = OC_User::getUser(); - $root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/'); + $owner = OCP\USER::getUser(); + $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); $path = utf8_decode(rtrim($root.$path,'/')); if($path == '') $path = '/'; $r = OC_Gallery_Album::find($owner, null, $path); diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php index b8e7c14fcaf..3eec805957f 100644..100755 --- a/apps/gallery/appinfo/app.php +++ b/apps/gallery/appinfo/app.php @@ -44,7 +44,7 @@ OC_App::addNavigationEntry( array( class OC_GallerySearchProvider extends OC_Search_Provider{ function search($query){ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?'); - $result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%')); + $result = $stmt->execute(array(OCP\USER::getUser(),'%'.$query.'%')); $results=array(); while($row=$result->fetchRow()){ $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries'); diff --git a/apps/gallery/index.php b/apps/gallery/index.php index 8c45cfb19fc..cc6faa1406b 100644..100755 --- a/apps/gallery/index.php +++ b/apps/gallery/index.php @@ -27,12 +27,12 @@ OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('gallery'); OC_App::setActiveNavigationEntry( 'gallery_index' ); -if (!file_exists(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery')) { - mkdir(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery'); +if (!file_exists(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery')) { + mkdir(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery'); } if (!isset($_GET['view'])) { - $result = OC_Gallery_Album::find(OC_User::getUser()); + $result = OC_Gallery_Album::find(OCP\USER::getUser()); $r = array(); while ($row = $result->fetchRow()) @@ -42,7 +42,7 @@ if (!isset($_GET['view'])) { $tmpl->assign('r', $r); $tmpl->printPage(); } else { - $result = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $_GET['view']); + $result = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $_GET['view']); $photos = array(); while ($p = $result->fetchRow()) diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index efc545f0205..8775cd52e11 100644..100755 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -30,10 +30,10 @@ class OC_Gallery_Album { } public static function cleanup() { - $albums = self::find(OC_User::getUser()); + $albums = self::find(OCP\USER::getUser()); while ($r = $albums->fetchRow()) { OC_Gallery_Photo::removeByAlbumId($r['album_id']); - self::remove(OC_User::getUser(), $r['album_name']); + self::remove(OCP\USER::getUser(), $r['album_name']); } } @@ -108,7 +108,7 @@ class OC_Gallery_Album { $path .= '%'; $sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?'; $stmt = OC_DB::prepare($sql); - $result = $stmt->execute(array(OC_User::getUser(), $path))->fetchRow(); + $result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow(); return $result['size']; } } diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 9257bbce628..525afc4127e 100755 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -53,13 +53,13 @@ class OC_Gallery_Hooks_Handlers { $new_album_name = 'main'; OCP\Util::writeLog(self::$APP_TAG, 'Creating new album '.$new_album_name, OCP\Util::DEBUG); - OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path); + OC_Gallery_Album::create(OCP\USER::getUser(), $new_album_name, $path); - return OC_Gallery_Album::find(OC_User::getUser(), null, $path); + return OC_Gallery_Album::find(OCP\USER::getUser(), null, $path); } public static function pathInRoot($path) { - $root = OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/'); + $root = OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root; } @@ -69,10 +69,10 @@ class OC_Gallery_Hooks_Handlers { if (!self::isPhoto($fullpath)) return; - $a = OC_Gallery_Album::find(OC_User::getUser(), null, dirname($fullpath)); + $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath)); if (!($r = $a->fetchRow())) { - OC_Gallery_Album::create(OC_User::getUser(), basename(dirname($fullpath)), dirname($fullpath)); - $a = OC_Gallery_Album::find(OC_User::getUser(), null, dirname($fullpath)); + OC_Gallery_Album::create(OCP\USER::getUser(), basename(dirname($fullpath)), dirname($fullpath)); + $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath)); $r = $a->fetchRow(); } $albumId = $r['album_id']; @@ -86,14 +86,14 @@ class OC_Gallery_Hooks_Handlers { $fullpath = rtrim(dirname($fullpath),'/').'/'.basename($fullpath); if (OC_Filesystem::is_dir($fullpath)) { - OC_Gallery_Album::remove(OC_User::getUser(), null, $fullpath); + OC_Gallery_Album::remove(OCP\USER::getUser(), null, $fullpath); } elseif (self::isPhoto($fullpath)) { - $a = OC_Gallery_Album::find(OC_User::getUser(), null, rtrim(dirname($fullpath),'/')); + $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, rtrim(dirname($fullpath),'/')); if (($r = $a->fetchRow())) { OC_Gallery_Photo::removeByPath($fullpath, $r['album_id']); - $p = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $r['album_name']); + $p = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $r['album_name']); if (!($p->fetchRow())) { - OC_Gallery_Album::remove(OC_User::getUser(), null, dirname($fullpath)); + OC_Gallery_Album::remove(OCP\USER::getUser(), null, dirname($fullpath)); } } } @@ -103,7 +103,7 @@ class OC_Gallery_Hooks_Handlers { $oldpath = $params[OC_Filesystem::signal_param_oldpath]; $newpath = $params[OC_Filesystem::signal_param_newpath]; if (OC_Filesystem::is_dir($newpath.'/') && self::directoryContainsPhotos($newpath)) { - OC_Gallery_Album::changePath($oldpath, $newpath, OC_User::getUser()); + OC_Gallery_Album::changePath($oldpath, $newpath, OCP\USER::getUser()); } elseif (self::isPhoto($newpath)) { $olddir = dirname($oldpath); $newdir = dirname($newpath); @@ -116,7 +116,7 @@ class OC_Gallery_Hooks_Handlers { $oldAlbumId; if ($olddir == $newdir) { // album changing is not needed - $albums = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir); + $albums = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir); $album = $albums->fetchRow(); if (!$album) { $albums = self::createAlbum($newdir); @@ -124,8 +124,8 @@ class OC_Gallery_Hooks_Handlers { } $newAlbumId = $oldAlbumId = $album['album_id']; } else { - $newalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $newdir); - $oldalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir); + $newalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $newdir); + $oldalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir); if (!($newalbum = $newalbum->fetchRow())) { $newalbum = self::createAlbum($newdir); diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 5098e1a2ed2..455ac5036d9 100644..100755 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -67,7 +67,7 @@ class OC_Gallery_Photo { } public static function getThumbnail($image_name, $owner = null) { - if (!$owner) $owner = OC_User::getUser(); + if (!$owner) $owner = OCP\USER::getUser(); $save_dir = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/'; $save_dir .= dirname($image_name). '/'; $image_path = $image_name; @@ -98,6 +98,6 @@ class OC_Gallery_Photo { } public static function getGalleryRoot() { - return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', ''); + return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', ''); } } diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 0317f943e5d..9cf8c113d1f 100644..100755 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -24,7 +24,7 @@ class OC_Gallery_Scanner { public static function getGalleryRoot() { - return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/'); + return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); } public static function getScanningRoot() { return OC_Filesystem::getRoot().self::getGalleryRoot(); @@ -43,7 +43,7 @@ class OC_Gallery_Scanner { public static function scan($eventSource) { $paths = self::findPaths(); $eventSource->send('count', count($paths)+1); - $owner = OC_User::getUser(); + $owner = OCP\USER::getUser(); foreach ($paths as $path) { $name = self::createName($path); $images = self::findFiles($path); @@ -81,7 +81,7 @@ class OC_Gallery_Scanner { $image->destroy(); } } - imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png'); + imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery/' . $albumName.'.png'); imagedestroy($thumbnail); } @@ -96,7 +96,7 @@ class OC_Gallery_Scanner { $p = $paths[$i-1]; foreach ($a as $e) { $p .= ($p == '/'?'':'/').$e; - OC_Gallery_Album::create(OC_User::getUser(), $e, $p); + OC_Gallery_Album::create(OCP\USER::getUser(), $e, $p); $arr = OC_FileCache::searchByMime('image','', OC_Filesystem::getRoot().$p); $step = floor(count($arr)/10); if ($step == 0) $step = 1; diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php index cf3d9188e65..078333ab21e 100644..100755 --- a/apps/gallery/templates/index.php +++ b/apps/gallery/templates/index.php @@ -9,7 +9,7 @@ OC_Util::addScript('files_imageviewer', 'jquery.fancybox-1.3.4.pack'); OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' ); $l = OC_L10N::get('gallery'); ?> -<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'order', 'ASC'); ?>';</script> +<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'order', 'ASC'); ?>';</script> <div id="controls"> <div id="scan"> <div id="scanprogressbar"></div> |