]> source.dussan.org Git - nextcloud-server.git/commitdiff
Style cleanup files_sharing
authorBart Visscher <bartv@thisnet.nl>
Thu, 14 Feb 2013 21:37:49 +0000 (22:37 +0100)
committerBart Visscher <bartv@thisnet.nl>
Thu, 21 Feb 2013 22:46:50 +0000 (23:46 +0100)
apps/files_sharing/appinfo/update.php
apps/files_sharing/lib/cache.php
apps/files_sharing/lib/permissions.php
apps/files_sharing/lib/share/file.php
apps/files_sharing/lib/share/folder.php
apps/files_sharing/lib/sharedstorage.php
apps/files_sharing/public.php
apps/files_sharing/templates/public.php

index 1d22b32b503100f337393356f7d7d3aeacf4d5b8..48e41e9304889fe1c1356ded114ffb6b08f299c7 100644 (file)
@@ -52,7 +52,10 @@ if (version_compare($installedVersion, '0.3', '<')) {
                        }
                        catch (Exception $e) {
                                $update_error = true;
-                               OCP\Util::writeLog('files_sharing', 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")', OCP\Util::WARN);
+                               OCP\Util::writeLog('files_sharing',
+                                       'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith
+                                       .'" (error is "'.$e->getMessage().'")',
+                                       OCP\Util::WARN);
                        }
                        OC_Util::tearDownFS();
                }
index 9655e44787517b928af7f7101e5d92ca0a6d794c..fb0f6c7b5a6bd3b4fb4f8cad64b4f7e900471bac 100644 (file)
@@ -71,8 +71,9 @@ class Shared_Cache extends Cache {
                        }
                } else {
                        $query = \OC_DB::prepare(
-                               'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
-                               FROM `*PREFIX*filecache` WHERE `fileid` = ?');
+                               'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
+                               .' `size`, `mtime`, `encrypted`'
+                               .' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
                        $result = $query->execute(array($file));
                        $data = $result->fetchRow();
                        $data['fileid'] = (int)$data['fileid'];
index 2b068ff93502f45ed68151b472ce9f7ca4826257..72c1ec96c46a1fe4861f37cdb482fd6853be0a99 100644 (file)
@@ -33,7 +33,8 @@ class Shared_Permissions extends Permissions {
                if ($fileId == -1) {
                        return \OCP\PERMISSION_READ;
                }
-               $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE, null, true);
+               $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE,
+                       null, true);
                if ($source) {
                        return $source['permissions'];
                } else {
index 6d3c55a008f0bdaf85fc14674f6a3f55f7d01f51..0aeb763d89ad21d0c99d44f22f1940ef32501158 100644 (file)
@@ -72,7 +72,11 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
        public function formatItems($items, $format, $parameters = null) {
                if ($format == self::FORMAT_SHARED_STORAGE) {
                        // Only 1 item should come through for this format call
-                       return array('path' => $items[key($items)]['path'], 'permissions' => $items[key($items)]['permissions'], 'uid_owner' => $items[key($items)]['uid_owner']);
+                       return array(
+                               'path' => $items[key($items)]['path'],
+                               'permissions' => $items[key($items)]['permissions'],
+                               'uid_owner' => $items[key($items)]['uid_owner']
+                       );
                } else if ($format == self::FORMAT_GET_FOLDER_CONTENTS) {
                        $files = array();
                        foreach ($items as $item) {
@@ -99,7 +103,13 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
                                }
                                $size += (int)$item['size'];
                        }
-                       return array('fileid' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size);
+                       return array(
+                               'fileid' => -1,
+                               'name' => 'Shared',
+                               'mtime' => $mtime,
+                               'mimetype' => 'httpd/unix-directory',
+                               'size' => $size
+                       );
                } else if ($format == self::FORMAT_OPENDIR) {
                        $files = array();
                        foreach ($items as $item) {
index 11c8c6b1e8066bd7d84dfbee563a5982607d3486..4426beec6368fa34e17b60f3d114ca6a5b47e2e6 100644 (file)
@@ -33,7 +33,8 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
                }
                while (!empty($parents)) {
                        $parents = "'".implode("','", $parents)."'";
-                       $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache` WHERE `parent` IN ('.$parents.')');
+                       $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache`'
+                               .' WHERE `parent` IN ('.$parents.')');
                        $result = $query->execute();
                        $parents = array();
                        while ($file = $result->fetchRow()) {
@@ -47,4 +48,4 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
                return $children;
        }
 
-}
\ No newline at end of file
+}
index 65812b7e2fdeeb2b579f941688d359b9cfe8860c..c7521949da1fd2fe0eec3cb300ce0393b851560c 100644 (file)
@@ -240,7 +240,8 @@ class Shared extends \OC\Files\Storage\Common {
        public function file_put_contents($path, $data) {
                if ($source = $this->getSourcePath($path)) {
                        // Check if permission is granted
-                       if (($this->file_exists($path) && !$this->isUpdatable($path)) || ($this->is_dir($path) && !$this->isCreatable($path))) {
+                       if (($this->file_exists($path) && !$this->isUpdatable($path))
+                               || ($this->is_dir($path) && !$this->isCreatable($path))) {
                                return false;
                        }
                        $info = array(
@@ -390,9 +391,12 @@ class Shared extends \OC\Files\Storage\Common {
        }
 
        public static function setup($options) {
-               if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || \OCP\Share::getItemsSharedWith('file')) {
+               if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user']
+                       || \OCP\Share::getItemsSharedWith('file')) {
                        $user_dir = $options['user_dir'];
-                       \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
+                       \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared',
+                               array('sharedFolder' => '/Shared'),
+                               $user_dir.'/Shared/');
                }
        }
 
index 38d598f7780849e06ed14d8da0819b730a1c52a1..f265a7dd0144df934d210e7fcd3c79a499dca7b5 100644 (file)
@@ -171,7 +171,9 @@ if (isset($path)) {
                        $list->assign('files', $files, false);
                        $list->assign('disableSharing', true);
                        $list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
-                       $list->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=', false);
+                       $list->assign('downloadURL',
+                               OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=',
+                               false);
                        $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
                        $breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
                        $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
@@ -188,7 +190,8 @@ if (isset($path)) {
                        $folder->assign('usedSpacePercent', 0);
                        $tmpl->assign('folder', $folder->fetchPage(), false);
                        $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
-                       $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
+                       $tmpl->assign('downloadURL',
+                               OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
                } else {
                        $tmpl->assign('dir', $dir);
 
index 7776fd63b3c2656a130e47349c2c5d470c49d062..f9ff12679bcc7772fc0299c7eec1621ea44fef79 100644 (file)
@@ -3,15 +3,20 @@
 <input type="hidden" name="filename" value="<?php echo $_['filename'] ?>" id="filename">
 <input type="hidden" name="mimetype" value="<?php echo $_['mimetype'] ?>" id="mimetype">
 <header><div id="header">
-       <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg" src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
+       <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg"
+               src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
        <div class="header-right">
        <?php if (isset($_['folder'])): ?>
-               <span id="details"><?php echo $l->t('%s shared the folder %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
+               <span id="details"><?php echo $l->t('%s shared the folder %s with you',
+                       array($_['displayName'], $_['fileTarget'])) ?></span>
        <?php else: ?>
-               <span id="details"><?php echo $l->t('%s shared the file %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
+               <span id="details"><?php echo $l->t('%s shared the file %s with you',
+                       array($_['displayName'], $_['fileTarget'])) ?></span>
        <?php endif; ?>
                <?php if (!isset($_['folder']) || $_['allowZipDownload']): ?>
-                       <a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
+                       <a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img
+                               class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
+                               /><?php echo $l->t('Download')?></a>
                <?php endif; ?>
        </div>
 </div></header>
                <ul id="noPreview">
                        <li class="error">
                                <?php echo $l->t('No preview available for').' '.$_['fileTarget']; ?><br />
-                               <a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
+                               <a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download"
+                                       src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
+                                       /><?php echo $l->t('Download')?></a>
                        </li>
                </ul>
        <?php endif; ?>
 </div>
-<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash; <?php echo $l->t('web services under your control'); ?></p></footer>
+<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash;
+<?php echo $l->t('web services under your control'); ?></p></footer>