summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--3rdparty/Sabre/DAV/Client.php7
-rw-r--r--apps/bookmarks/ajax/addBookmark.php2
-rw-r--r--apps/bookmarks/ajax/delBookmark.php2
-rw-r--r--apps/bookmarks/ajax/editBookmark.php2
-rw-r--r--apps/bookmarks/lib/bookmarks.php3
-rw-r--r--apps/calendar/appinfo/remote.php2
-rw-r--r--apps/calendar/settings.php1
-rw-r--r--apps/calendar/templates/settings.php6
-rw-r--r--apps/contacts/ajax/addbook.php1
-rw-r--r--apps/contacts/ajax/categories/categoriesfor.php1
-rw-r--r--apps/contacts/ajax/categories/delete.php2
-rw-r--r--apps/contacts/ajax/categories/list.php2
-rw-r--r--apps/contacts/ajax/categories/rescan.php19
-rw-r--r--apps/contacts/ajax/currentphoto.php2
-rw-r--r--apps/contacts/ajax/editaddress.php2
-rw-r--r--apps/contacts/ajax/editaddressbook.php1
-rw-r--r--apps/contacts/ajax/editname.php2
-rw-r--r--apps/contacts/ajax/importaddressbook.php2
-rw-r--r--apps/contacts/ajax/importdialog.php1
-rw-r--r--apps/contacts/ajax/oc_photo.php2
-rw-r--r--apps/contacts/ajax/uploadimport.php3
-rw-r--r--apps/contacts/ajax/uploadphoto.php1
-rw-r--r--apps/contacts/appinfo/app.php1
-rw-r--r--apps/contacts/appinfo/remote.php1
-rw-r--r--apps/contacts/export.php6
-rw-r--r--apps/contacts/import.php13
-rw-r--r--apps/contacts/index.php33
-rw-r--r--apps/contacts/js/contacts.js28
-rw-r--r--apps/contacts/lib/VCFExportPlugin.php100
-rw-r--r--apps/contacts/lib/addressbook.php15
-rw-r--r--apps/contacts/lib/app.php21
-rw-r--r--apps/contacts/lib/connector_sabre.php4
-rw-r--r--apps/contacts/settings.php2
-rw-r--r--apps/contacts/templates/index.php2
-rw-r--r--apps/contacts/templates/part.importaddressbook.php1
-rw-r--r--apps/contacts/templates/settings.php6
-rw-r--r--apps/external/ajax/setsites.php2
-rw-r--r--apps/external/index.php1
-rw-r--r--apps/external/lib/external.php2
-rw-r--r--apps/external/settings.php1
-rw-r--r--apps/files/ajax/autocomplete.php2
-rw-r--r--apps/files/ajax/delete.php3
-rw-r--r--apps/files/ajax/download.php1
-rw-r--r--apps/files/ajax/list.php2
-rw-r--r--apps/files/ajax/mimeicon.php2
-rw-r--r--apps/files/ajax/move.php3
-rw-r--r--apps/files/ajax/newfile.php1
-rw-r--r--apps/files/ajax/newfolder.php1
-rw-r--r--apps/files/ajax/rawlist.php2
-rw-r--r--apps/files/ajax/rename.php3
-rw-r--r--apps/files/ajax/timezone.php2
-rw-r--r--apps/files/ajax/upload.php3
-rw-r--r--apps/files/download.php1
-rw-r--r--apps/files/index.php3
-rw-r--r--apps/files/settings.php2
-rw-r--r--apps/files_encryption/js/settings.js4
-rw-r--r--apps/files_encryption/templates/settings.php2
-rw-r--r--apps/files_external/ajax/addMountPoint.php4
-rw-r--r--apps/files_external/ajax/addRootCertificate.php18
-rw-r--r--apps/files_external/ajax/removeMountPoint.php4
-rw-r--r--apps/files_external/ajax/removeRootCertificate.php3
-rwxr-xr-xapps/files_external/lib/config.php27
-rw-r--r--apps/files_external/lib/webdav.php14
-rw-r--r--apps/files_external/templates/settings.php4
-rw-r--r--apps/files_external/tests/amazons3.php3
-rw-r--r--apps/files_imageviewer/appinfo/app.php2
-rw-r--r--apps/files_pdfviewer/appinfo/app.php1
-rw-r--r--apps/files_pdfviewer/js/pdfjs/viewer.js11
-rw-r--r--apps/files_sharing/ajax/email.php4
-rw-r--r--apps/files_sharing/ajax/getitem.php2
-rw-r--r--apps/files_sharing/ajax/getstatuses.php2
-rw-r--r--apps/files_sharing/ajax/setpermissions.php3
-rw-r--r--apps/files_sharing/ajax/share.php3
-rw-r--r--apps/files_sharing/ajax/toggleresharing.php2
-rw-r--r--apps/files_sharing/ajax/unshare.php3
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php2
-rw-r--r--apps/files_sharing/get.php1
-rw-r--r--apps/files_sharing/lib_share.php2
-rw-r--r--apps/files_sharing/list.php2
-rw-r--r--apps/files_texteditor/ajax/savefile.php1
-rw-r--r--apps/files_texteditor/appinfo/app.php1
-rw-r--r--apps/files_versions/ajax/togglesettings.php2
-rw-r--r--apps/files_versions/history.php2
-rw-r--r--apps/files_versions/lib/hooks.php72
-rw-r--r--apps/files_versions/lib/versions.php9
-rw-r--r--apps/files_versions/settings.php1
-rw-r--r--apps/gallery/ajax/createAlbum.php2
-rw-r--r--apps/gallery/ajax/galleryOp.php1
-rw-r--r--apps/gallery/ajax/viewImage.php32
-rw-r--r--apps/gallery/css/styles.css4
-rw-r--r--apps/gallery/css/supersized.css25
-rw-r--r--apps/gallery/css/supersized.shutter.css74
-rw-r--r--apps/gallery/img/supersized/back.pngbin0 -> 2629 bytes
-rw-r--r--apps/gallery/img/supersized/bg-black.pngbin0 -> 1074 bytes
-rw-r--r--apps/gallery/img/supersized/bg-hover.pngbin0 -> 960 bytes
-rw-r--r--apps/gallery/img/supersized/button-tray-down.pngbin0 -> 1506 bytes
-rw-r--r--apps/gallery/img/supersized/button-tray-up.pngbin0 -> 1466 bytes
-rw-r--r--apps/gallery/img/supersized/forward.pngbin0 -> 2614 bytes
-rw-r--r--apps/gallery/img/supersized/nav-bg.pngbin0 -> 995 bytes
-rw-r--r--apps/gallery/img/supersized/nav-dot.pngbin0 -> 1901 bytes
-rw-r--r--apps/gallery/img/supersized/pause.pngbin0 -> 1131 bytes
-rw-r--r--apps/gallery/img/supersized/play.pngbin0 -> 1562 bytes
-rw-r--r--apps/gallery/img/supersized/progress-back.pngbin0 -> 929 bytes
-rw-r--r--apps/gallery/img/supersized/progress-bar.pngbin0 -> 929 bytes
-rw-r--r--apps/gallery/img/supersized/progress.gifbin0 -> 2608 bytes
-rw-r--r--apps/gallery/img/supersized/supersized-logo.pngbin0 -> 3982 bytes
-rw-r--r--apps/gallery/img/supersized/thumb-back.pngbin0 -> 2122 bytes
-rw-r--r--apps/gallery/img/supersized/thumb-forward.pngbin0 -> 2118 bytes
-rw-r--r--apps/gallery/index.php9
-rw-r--r--apps/gallery/js/albums.js2
-rw-r--r--apps/gallery/js/jquery.easing.min.js71
-rw-r--r--apps/gallery/js/slideshow.js58
-rw-r--r--apps/gallery/js/supersized.3.2.7.js930
-rw-r--r--apps/gallery/js/supersized.3.2.7.min.js13
-rw-r--r--apps/gallery/js/supersized.shutter.js337
-rw-r--r--apps/gallery/js/supersized.shutter.min.js14
-rw-r--r--apps/gallery/lib/hooks_handlers.php2
-rw-r--r--apps/gallery/lib/images_utils.php2
-rw-r--r--apps/gallery/lib/managers.php60
-rw-r--r--apps/gallery/lib/photo.php105
-rw-r--r--apps/gallery/lib/tiles.php4
-rw-r--r--apps/gallery/lib/tiles_test.php2
-rw-r--r--apps/gallery/templates/index.php52
-rw-r--r--apps/gallery/templates/view_album.php8
-rw-r--r--apps/media/ajax/api.php1
-rw-r--r--apps/media/ajax/autoupdate.php1
-rw-r--r--apps/media/index.php2
-rw-r--r--apps/media/lib_ampache.php2
-rw-r--r--apps/media/lib_collection.php2
-rw-r--r--apps/media/settings.php1
-rw-r--r--apps/remoteStorage/settings.php1
-rw-r--r--apps/user_migrate/appinfo/app.php1
-rw-r--r--apps/user_openid/phpmyid.php1
-rw-r--r--apps/user_openid/user.php3
-rw-r--r--apps/user_webfinger/webfinger.php1
-rw-r--r--core/ajax/grouplist.php2
-rw-r--r--core/ajax/translations.php1
-rw-r--r--core/ajax/userlist.php2
-rw-r--r--core/ajax/validateuser.php2
-rw-r--r--core/ajax/vcategories/add.php2
-rw-r--r--core/ajax/vcategories/delete.php2
-rw-r--r--core/ajax/vcategories/edit.php2
-rw-r--r--core/js/js.js2
-rw-r--r--core/strings.php1
-rw-r--r--lib/MDB2/Driver/Function/sqlite3.php1
-rw-r--r--lib/MDB2/Driver/Manager/sqlite3.php1
-rw-r--r--lib/MDB2/Driver/sqlite3.php2
-rw-r--r--lib/connector/sabre/client.php171
-rw-r--r--lib/connector/sabre/file.php2
-rw-r--r--lib/image.php80
-rw-r--r--lib/log/owncloud.php43
-rw-r--r--lib/public/app.php3
-rw-r--r--lib/public/config.php2
-rw-r--r--lib/public/db.php2
-rw-r--r--lib/public/files.php2
-rw-r--r--lib/public/json.php2
-rw-r--r--lib/public/response.php2
-rw-r--r--lib/public/template.php3
-rw-r--r--lib/public/user.php3
-rw-r--r--lib/public/util.php2
-rw-r--r--lib/setup.php2
-rw-r--r--lib/updater.php1
-rw-r--r--lib/user.php8
-rw-r--r--lib/vcategories.php7
-rw-r--r--ocs/providers.php3
-rw-r--r--ocs/v1.php2
-rw-r--r--search/ajax/search.php2
-rw-r--r--search/index.php2
-rw-r--r--settings/ajax/changepassword.php4
-rw-r--r--settings/ajax/creategroup.php4
-rw-r--r--settings/ajax/createuser.php3
-rw-r--r--settings/ajax/disableapp.php1
-rw-r--r--settings/ajax/enableapp.php1
-rw-r--r--settings/ajax/lostpassword.php4
-rw-r--r--settings/ajax/openid.php3
-rw-r--r--settings/ajax/removegroup.php3
-rw-r--r--settings/ajax/removeuser.php3
-rw-r--r--settings/ajax/setlanguage.php3
-rw-r--r--settings/ajax/setloglevel.php1
-rw-r--r--settings/ajax/setquota.php2
-rw-r--r--settings/ajax/togglegroups.php3
-rw-r--r--settings/apps.php2
-rw-r--r--settings/help.php2
-rw-r--r--settings/personal.php4
-rw-r--r--settings/users.php3
-rw-r--r--status.php3
-rw-r--r--webapps.php2
188 files changed, 2340 insertions, 448 deletions
diff --git a/.gitignore b/.gitignore
index e2ff07d14d8..ae636931706 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,9 @@ RCS/*
# netbeans
nbproject
+# phpStorm
+.idea
+
# geany
*.geany
diff --git a/3rdparty/Sabre/DAV/Client.php b/3rdparty/Sabre/DAV/Client.php
index d257c86da10..075e84caa1d 100644
--- a/3rdparty/Sabre/DAV/Client.php
+++ b/3rdparty/Sabre/DAV/Client.php
@@ -22,7 +22,6 @@ class Sabre_DAV_Client {
protected $userName;
protected $password;
protected $proxy;
- protected $capath;
/**
* Constructor
@@ -50,10 +49,6 @@ class Sabre_DAV_Client {
'proxy'
);
- $this->capath = '';
- if (isset($settings['capath'])) {
- $this->capath = $settings['capath'];
- }
foreach($validSettings as $validSetting) {
if (isset($settings[$validSetting])) {
@@ -259,8 +254,6 @@ class Sabre_DAV_Client {
//CURLOPT_SSL_VERIFYPEER => false,
);
- if ($this->capath != '') $curlSettings[CURLOPT_CAPATH] = $this->capath;
-
switch ($method) {
case 'PUT':
$curlSettings[CURLOPT_PUT] = true;
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 6b5a0f71d4e..483716405a1 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php');
diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php
index 5a067701c9f..f40f02ebab7 100644
--- a/apps/bookmarks/ajax/delBookmark.php
+++ b/apps/bookmarks/ajax/delBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
$id = $_POST['id'];
diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php
index 439b680dc20..0b37d161af1 100644
--- a/apps/bookmarks/ajax/editBookmark.php
+++ b/apps/bookmarks/ajax/editBookmark.php
@@ -28,6 +28,8 @@ $RUNTIME_NOSETUPFS=true;
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
OCP\JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php
index e0005968f31..86fba45a50c 100644
--- a/apps/bookmarks/lib/bookmarks.php
+++ b/apps/bookmarks/lib/bookmarks.php
@@ -145,5 +145,4 @@ class OC_Bookmarks_Bookmarks{
$result = $query->execute();
return true;
}
-}
-?>
+} \ No newline at end of file
diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php
index 7ab546245f6..e8f9e80c7a8 100644
--- a/apps/calendar/appinfo/remote.php
+++ b/apps/calendar/appinfo/remote.php
@@ -34,6 +34,6 @@ $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
$server->addPlugin(new Sabre_CalDAV_Plugin());
$server->addPlugin(new Sabre_DAVACL_Plugin());
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
-
+$server->addPlugin(new Sabre_CalDAV_ICSExportPlugin());
// And off we go!
$server->exec();
diff --git a/apps/calendar/settings.php b/apps/calendar/settings.php
index a18b1ca9f42..eaa20c6c9b4 100644
--- a/apps/calendar/settings.php
+++ b/apps/calendar/settings.php
@@ -10,6 +10,7 @@ $tmpl = new OCP\Template( 'calendar', 'settings');
$timezone=OCP\Config::getUserValue(OCP\USER::getUser(),'calendar','timezone','');
$tmpl->assign('timezone',$timezone);
$tmpl->assign('timezones',DateTimeZone::listIdentifiers());
+$tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false);
OCP\Util::addscript('calendar','settings');
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index 6d018f15110..28c357621a8 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -56,6 +56,12 @@
<dd><code><?php echo OCP\Util::linkToRemote('caldav'); ?></code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
<dd><code><?php echo OCP\Util::linkToRemote('caldav'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
+ <dt><?php echo $l->t('Read only iCalendar link(s)'); ?></dt>
+ <dd>
+ <?php foreach($_['calendars'] as $calendar) { ?>
+ <a href="<?php echo OCP\Util::linkToRemote('caldav').'calendars/'.OCP\USER::getUser().'/'.rawurlencode($calendar['uri']) ?>?export"><?php echo $calendar['displayname'] ?></a><br />
+ <?php } ?>
+ </dd>
</dl>
</fieldset>
</form>
diff --git a/apps/contacts/ajax/addbook.php b/apps/contacts/ajax/addbook.php
index 70f47cc8123..751185b44fd 100644
--- a/apps/contacts/ajax/addbook.php
+++ b/apps/contacts/ajax/addbook.php
@@ -17,4 +17,3 @@ $tmpl = new OCP\Template('contacts', 'part.editaddressbook');
$tmpl->assign('new', true);
$tmpl->assign('addressbook', $book);
$tmpl->printPage();
-?>
diff --git a/apps/contacts/ajax/categories/categoriesfor.php b/apps/contacts/ajax/categories/categoriesfor.php
index 846af300de8..6b6fcad0ebb 100644
--- a/apps/contacts/ajax/categories/categoriesfor.php
+++ b/apps/contacts/ajax/categories/categoriesfor.php
@@ -25,4 +25,3 @@ foreach($vcard->children as $property){
}
}
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
-?>
diff --git a/apps/contacts/ajax/categories/delete.php b/apps/contacts/ajax/categories/delete.php
index 76c23d6487d..7c3261446bb 100644
--- a/apps/contacts/ajax/categories/delete.php
+++ b/apps/contacts/ajax/categories/delete.php
@@ -45,5 +45,3 @@ $catman->delete($categories, $cards);
debug('After delete: '.print_r($catman->categories(), true));
OC_Contacts_VCard::updateDataByID($cards);
OCP\JSON::success(array('data' => array('categories'=>$catman->categories())));
-
-?>
diff --git a/apps/contacts/ajax/categories/list.php b/apps/contacts/ajax/categories/list.php
index 3ae7635390c..f234116ba8c 100644
--- a/apps/contacts/ajax/categories/list.php
+++ b/apps/contacts/ajax/categories/list.php
@@ -13,5 +13,3 @@ OCP\JSON::checkAppEnabled('contacts');
$categories = OC_Contacts_App::getCategories();
OCP\JSON::success(array('data' => array('categories'=>$categories)));
-
-?>
diff --git a/apps/contacts/ajax/categories/rescan.php b/apps/contacts/ajax/categories/rescan.php
index 48ec165381f..fd875a965dc 100644
--- a/apps/contacts/ajax/categories/rescan.php
+++ b/apps/contacts/ajax/categories/rescan.php
@@ -10,24 +10,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-require_once('../loghandler.php');
-
-$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
-if(count($addressbooks) == 0) {
- bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
-}
-$addressbookids = array();
-foreach($addressbooks as $addressbook) {
- $addressbookids[] = $addressbook['id'];
-}
-$contacts = OC_Contacts_VCard::all($addressbookids);
-if(count($contacts) == 0) {
- bailOut(OC_Contacts_App::$l10n->t('No contacts found.'));
-}
-
-OC_Contacts_App::scanCategories($contacts);
+OC_Contacts_App::scanCategories();
$categories = OC_Contacts_App::getCategories();
OCP\JSON::success(array('data' => array('categories'=>$categories)));
-
-?>
diff --git a/apps/contacts/ajax/currentphoto.php b/apps/contacts/ajax/currentphoto.php
index b10e752c453..8f60eca08ec 100644
--- a/apps/contacts/ajax/currentphoto.php
+++ b/apps/contacts/ajax/currentphoto.php
@@ -51,5 +51,3 @@ if( is_null($contact)) {
bailOut(OC_Contacts_App::$l10n->t('The loading photo is not valid.'));
}
}
-
-?>
diff --git a/apps/contacts/ajax/editaddress.php b/apps/contacts/ajax/editaddress.php
index 2d7aba11b0e..1eb9429d79c 100644
--- a/apps/contacts/ajax/editaddress.php
+++ b/apps/contacts/ajax/editaddress.php
@@ -39,5 +39,3 @@ $tmpl->assign('adr_types',$adr_types);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum)));
-
-?>
diff --git a/apps/contacts/ajax/editaddressbook.php b/apps/contacts/ajax/editaddressbook.php
index 7a9b757ae0d..4bc77302e5b 100644
--- a/apps/contacts/ajax/editaddressbook.php
+++ b/apps/contacts/ajax/editaddressbook.php
@@ -14,4 +14,3 @@ $tmpl = new OCP\Template("contacts", "part.editaddressbook");
$tmpl->assign('new', false);
$tmpl->assign('addressbook', $addressbook);
$tmpl->printPage();
-?>
diff --git a/apps/contacts/ajax/editname.php b/apps/contacts/ajax/editname.php
index 868ca222e0a..9e7c090eeed 100644
--- a/apps/contacts/ajax/editname.php
+++ b/apps/contacts/ajax/editname.php
@@ -32,5 +32,3 @@ if($id) {
}
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page'=>$page)));
-
-?>
diff --git a/apps/contacts/ajax/importaddressbook.php b/apps/contacts/ajax/importaddressbook.php
index f93bbfa4d9d..6b5b06681ce 100644
--- a/apps/contacts/ajax/importaddressbook.php
+++ b/apps/contacts/ajax/importaddressbook.php
@@ -18,6 +18,6 @@ $maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
$tmpl = new OCP\Template('contacts', 'part.importaddressbook');
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
+$tmpl->assign('requesttoken', $_SERVER['HTTP_REQUESTTOKEN']);
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->printpage();
-?>
diff --git a/apps/contacts/ajax/importdialog.php b/apps/contacts/ajax/importdialog.php
index 5f8805a6106..691522538fb 100644
--- a/apps/contacts/ajax/importdialog.php
+++ b/apps/contacts/ajax/importdialog.php
@@ -13,4 +13,3 @@ $tmpl = new OCP\Template('contacts', 'part.import');
$tmpl->assign('path', $_POST['path']);
$tmpl->assign('filename', $_POST['filename']);
$tmpl->printpage();
-?>
diff --git a/apps/contacts/ajax/oc_photo.php b/apps/contacts/ajax/oc_photo.php
index 5c50ba92dbe..710179fffcc 100644
--- a/apps/contacts/ajax/oc_photo.php
+++ b/apps/contacts/ajax/oc_photo.php
@@ -58,5 +58,3 @@ if(OC_Cache::set($tmpkey, $image->data(), 600)) {
} else {
bailOut('Couldn\'t save temporary image: '.$tmpkey);
}
-
-?>
diff --git a/apps/contacts/ajax/uploadimport.php b/apps/contacts/ajax/uploadimport.php
index 9511520828f..80b282f38a3 100644
--- a/apps/contacts/ajax/uploadimport.php
+++ b/apps/contacts/ajax/uploadimport.php
@@ -70,6 +70,3 @@ if(file_exists($file['tmp_name'])) {
} else {
bailOut('Temporary file: \''.$file['tmp_name'].'\' has gone AWOL?');
}
-
-
-?>
diff --git a/apps/contacts/ajax/uploadphoto.php b/apps/contacts/ajax/uploadphoto.php
index 8545ca84eee..6bb3fe8a5e0 100644
--- a/apps/contacts/ajax/uploadphoto.php
+++ b/apps/contacts/ajax/uploadphoto.php
@@ -102,4 +102,3 @@ if(file_exists($file['tmp_name'])) {
} else {
bailOut('Temporary file: \''.$file['tmp_name'].'\' has gone AWOL?');
}
-?>
diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php
index 64fe00eef10..33e89c3e9be 100644
--- a/apps/contacts/appinfo/app.php
+++ b/apps/contacts/appinfo/app.php
@@ -4,6 +4,7 @@ OC::$CLASSPATH['OC_Contacts_Addressbook'] = 'apps/contacts/lib/addressbook.php';
OC::$CLASSPATH['OC_Contacts_VCard'] = 'apps/contacts/lib/vcard.php';
OC::$CLASSPATH['OC_Contacts_Hooks'] = 'apps/contacts/lib/hooks.php';
OC::$CLASSPATH['OC_Connector_Sabre_CardDAV'] = 'apps/contacts/lib/connector_sabre.php';
+OC::$CLASSPATH['Sabre_CardDAV_VCFExportPlugin'] = 'apps/contacts/lib/VCFExportPlugin.php';
OC::$CLASSPATH['OC_Search_Provider_Contacts'] = 'apps/contacts/lib/search.php';
OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Contacts_Hooks', 'createUser');
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser');
diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php
index 5add3bc6889..09c2de17990 100644
--- a/apps/contacts/appinfo/remote.php
+++ b/apps/contacts/appinfo/remote.php
@@ -49,6 +49,7 @@ $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
$server->addPlugin(new Sabre_CardDAV_Plugin());
$server->addPlugin(new Sabre_DAVACL_Plugin());
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
+$server->addPlugin(new Sabre_CardDAV_VCFExportPlugin());
// And off we go!
$server->exec();
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index ba7b06e40d2..eb506506c42 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -19,11 +19,12 @@ if(isset($bookid)){
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
$start = 0;
- while($cardobjects = OC_Contacts_VCard::all($bookid, $start, 20)){
+ $batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'export_batch_size', 20);
+ while($cardobjects = OC_Contacts_VCard::all($bookid, $start, $batchsize)){
foreach($cardobjects as $card) {
echo $card['carddata'] . $nl;
}
- $start += 20;
+ $start += $batchsize;
}
}elseif(isset($contactid)){
$data = OC_Contacts_App::getContactObject($contactid);
@@ -31,4 +32,3 @@ if(isset($bookid)){
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
echo $data['carddata'];
}
-?>
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index c95fd970fe1..93c47ef2667 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -12,6 +12,7 @@ OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
session_write_close();
+$cr = "\r";
$nl = "\n";
global $progresskey;
@@ -35,20 +36,20 @@ if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
}
if(!$file) {
- OCP\JSON::error(array('message' => 'Import file was empty.'));
+ OCP\JSON::error(array('data' => array('message' => 'Import file was empty.')));
exit();
}
if(isset($_POST['method']) && $_POST['method'] == 'new'){
$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']);
if(!$id) {
- OCP\JSON::error(array('message' => 'Error creating address book.'));
+ OCP\JSON::error(array('data' => array('message' => 'Error creating address book.')));
exit();
}
OC_Contacts_Addressbook::setActive($id, 1);
}else{
$id = $_POST['id'];
if(!$id) {
- OCP\JSON::error(array('message' => 'Error getting the ID of the address book.'));
+ OCP\JSON::error(array('data' => array('message' => 'Error getting the ID of the address book.')));
exit();
}
OC_Contacts_App::getAddressbook($id); // is owner access check
@@ -56,6 +57,10 @@ if(isset($_POST['method']) && $_POST['method'] == 'new'){
//analyse the contacts file
writeProgress('40');
$lines = explode($nl, $file);
+if(count($lines) == 1) { // Mac eol
+ $lines = explode($cr, $file);
+}
+
$inelement = false;
$parts = array();
$card = array();
@@ -77,7 +82,7 @@ writeProgress('70');
$imported = 0;
$failed = 0;
if(!count($parts) > 0) {
- OCP\JSON::error(array('message' => 'No contacts to import in .'.$_POST['file'].' Please check if the file is corrupted.'));
+ OCP\JSON::error(array('data' => array('message' => 'No contacts to import in .'.$_POST['file'].' Please check if the file is corrupted.')));
exit();
}
foreach($parts as $part){
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 0b4f89b30c0..c1e33252f56 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -14,28 +14,16 @@ OCP\App::checkAppEnabled('contacts');
// Get active address books. This creates a default one if none exists.
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$contacts = OC_Contacts_VCard::all($ids);
+$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0 ? true : false); // just to check if there are any contacts.
if($contacts === false) {
OCP\Util::writeLog('contacts','index.html: No contacts found.',OCP\Util::DEBUG);
}
-$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
-
// Load the files we need
OCP\App::setActiveNavigationEntry( 'contacts_index' );
// Load a specific user?
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
-$details = array();
-
-if(is_null($id) && count($contacts) > 0) {
- $id = $contacts[0]['id'];
-}
-unset($contacts);
-if(!is_null($id)) {
- $vcard = OC_Contacts_App::getContactVCard($id);
- $details = OC_Contacts_VCard::structureContact($vcard);
-}
$property_types = OC_Contacts_App::getAddPropertyOptions();
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
@@ -63,15 +51,12 @@ OCP\Util::addStyle('contacts','jquery.Jcrop');
OCP\Util::addStyle('contacts','contacts');
$tmpl = new OCP\Template( "contacts", "index", "user" );
-$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
-$tmpl->assign('property_types', $property_types);
-$tmpl->assign('phone_types', $phone_types);
-$tmpl->assign('email_types', $email_types);
-$tmpl->assign('categories', $categories);
-$tmpl->assign('addressbooks', $addressbooks);
-$tmpl->assign('details', $details );
-$tmpl->assign('id',$id);
+$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
+$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize), false);
+$tmpl->assign('property_types', $property_types, false);
+$tmpl->assign('phone_types', $phone_types, false);
+$tmpl->assign('email_types', $email_types, false);
+$tmpl->assign('categories', $categories, false);
+$tmpl->assign('has_contacts', $has_contacts, false);
+$tmpl->assign('id',$id, false);
$tmpl->printPage();
-
-?>
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 39ef14e5062..dd194db0161 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -316,7 +316,7 @@ Contacts={
$('#contacts li[data-id="'+newid+'"]').addClass('active');
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
if(jsondata.status == 'success'){
- $('#contacts h3[data-id="'+bookid+'"]').trigger('click');
+ $('#contacts ul[data-id="'+bookid+'"]').slideDown(300);
Contacts.UI.Card.loadContact(jsondata.data, bookid);
} else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@@ -326,7 +326,8 @@ Contacts={
}
// Make sure proper DOM is loaded.
- if(!$('#card')[0] && newid) {
+ if(!$('#card').length && newid) {
+ console.log('Loading card DOM');
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{requesttoken:requesttoken},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').html(jsondata.data.page).ready(function() {
@@ -339,6 +340,7 @@ Contacts={
});
}
else if(!newid) {
+ console.log('Loading intro');
// load intro page
$.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
if(jsondata.status == 'success'){
@@ -370,6 +372,7 @@ Contacts={
return $('<li data-id="'+data.id+'" data-bookid="'+data.addressbookid+'" role="button"><a href="'+OC.linkTo('contacts', 'index.php')+'&id='+data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+data.id+') no-repeat scroll 0% 0% transparent;">'+data.displayname+'</a></li>');
},
add:function(n, fn, aid, isnew){ // add a new contact
+ console.log('Adding ' + fn);
aid = aid?aid:$('#contacts h3.active').first().data('id');
var localAddcontact = function(n, fn, aid, isnew) {
$.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid, isnew: isnew },
@@ -413,8 +416,8 @@ Contacts={
});
}
- var card = $('#card')[0];
- if(!card) {
+ if(!$('#card').length) {
+ console.log('Loading card DOM');
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{'requesttoken': requesttoken},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').html(jsondata.data.page).ready(function() {
@@ -660,7 +663,7 @@ Contacts={
return false;
}
container = $(obj).parents('.propertycontainer').first(); // get the parent holding the metadata.
- Contacts.UI.loading(container, true);
+ Contacts.UI.loading(obj, true);
var checksum = container.data('checksum');
var name = container.data('element');
var fields = container.find('input.contacts_property,select.contacts_property').serializeArray();
@@ -683,7 +686,7 @@ Contacts={
var q = container.find('input.contacts_property,select.contacts_property,textarea.contacts_property').serialize();
if(q == '' || q == undefined) {
OC.dialogs.alert(t('contacts', 'Couldn\'t serialize elements.'), t('contacts', 'Error'));
- Contacts.UI.loading(container, false);
+ Contacts.UI.loading(obj, false);
return false;
}
q = q + '&id=' + this.id + '&name=' + name;
@@ -695,13 +698,13 @@ Contacts={
if(jsondata.status == 'success'){
container.data('checksum', jsondata.data.checksum);
Contacts.UI.Card.savePropertyInternal(name, fields, checksum, jsondata.data.checksum);
- Contacts.UI.loading(container, false);
+ Contacts.UI.loading(obj, false);
$(obj).removeAttr('disabled');
return true;
}
else{
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- Contacts.UI.loading(container, false);
+ Contacts.UI.loading(obj, false);
$(obj).removeAttr('disabled');
return false;
}
@@ -714,13 +717,13 @@ Contacts={
container.data('checksum', jsondata.data.checksum);
// TODO: savePropertyInternal doesn't know about new fields
//Contacts.UI.Card.savePropertyInternal(name, fields, checksum, jsondata.data.checksum);
- Contacts.UI.loading(container, false);
+ Contacts.UI.loading(obj, false);
$(obj).removeAttr('disabled');
return true;
}
else{
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
- Contacts.UI.loading(container, false);
+ Contacts.UI.loading(obj, false);
$(obj).removeAttr('disabled');
return false;
}
@@ -1393,6 +1396,7 @@ Contacts={
function(jsondata) {
if (jsondata.status == 'success'){
$(obj).closest('tr').remove();
+ $('#contacts h3[data-id="'+bookid+'"],#contacts ul[data-id="'+bookid+'"]').remove();
Contacts.UI.Contacts.update();
} else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@@ -1603,10 +1607,10 @@ Contacts={
firstrun = true;
if($('#contacts h3').length == 0) {
- $('#contacts').html('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts" data-id="'+b+'"></ul>');
+ $('#contacts').html('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts hidden" data-id="'+b+'"></ul>');
} else {
if(!$('#contacts h3[data-id="'+b+'"]').length) {
- $('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts" data-id="'+b+'"></ul>')
+ $('<h3 class="addressbook" data-id="'+b+'">'+book.displayname+'</h3><ul class="contacts hidden" data-id="'+b+'"></ul>')
.appendTo('#contacts');
}
}
diff --git a/apps/contacts/lib/VCFExportPlugin.php b/apps/contacts/lib/VCFExportPlugin.php
new file mode 100644
index 00000000000..6554cb258e8
--- /dev/null
+++ b/apps/contacts/lib/VCFExportPlugin.php
@@ -0,0 +1,100 @@
+<?php
+
+/**
+ * VCF Exporter
+ *
+ * This plugin adds the ability to export entire address books as .vcf files.
+ * This is useful for clients that don't support CardDAV yet. They often do
+ * support vcf files.
+ *
+ * @package Sabre
+ * @subpackage CardDAV
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Sabre_CardDAV_VCFExportPlugin extends Sabre_DAV_ServerPlugin {
+
+ /**
+ * Reference to Server class
+ *
+ * @var Sabre_DAV_Server
+ */
+ private $server;
+
+ /**
+ * Initializes the plugin and registers event handlers
+ *
+ * @param Sabre_DAV_Server $server
+ * @return void
+ */
+ public function initialize(Sabre_DAV_Server $server) {
+
+ $this->server = $server;
+ $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'), 90);
+
+ }
+
+ /**
+ * 'beforeMethod' event handles. This event handles intercepts GET requests ending
+ * with ?export
+ *
+ * @param string $method
+ * @param string $uri
+ * @return bool
+ */
+ public function beforeMethod($method, $uri) {
+
+ if ($method!='GET') return;
+ if ($this->server->httpRequest->getQueryString()!='export') return;
+
+ // splitting uri
+ list($uri) = explode('?',$uri,2);
+
+ $node = $this->server->tree->getNodeForPath($uri);
+
+ if (!($node instanceof Sabre_CardDAV_IAddressBook)) return;
+
+ // Checking ACL, if available.
+ if ($aclPlugin = $this->server->getPlugin('acl')) {
+ $aclPlugin->checkPrivileges($uri, '{DAV:}read');
+ }
+
+ $this->server->httpResponse->setHeader('Content-Type','text/directory');
+ $this->server->httpResponse->sendStatus(200);
+
+ $nodes = $this->server->getPropertiesForPath($uri, array(
+ '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data',
+ ),1);
+
+ $this->server->httpResponse->sendBody($this->generateVCF($nodes));
+
+ // Returning false to break the event chain
+ return false;
+
+ }
+
+ /**
+ * Merges all vcard objects, and builds one big vcf export
+ *
+ * @param array $nodes
+ * @return string
+ */
+ public function generateVCF(array $nodes) {
+ $objects = array();
+
+ foreach($nodes as $node) {
+
+ if (!isset($node[200]['{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data'])) {
+ continue;
+ }
+ $nodeData = $node[200]['{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data'];
+ $objects[] = $nodeData;
+
+ }
+
+ return implode("\r\n", $objects);
+
+ }
+
+}
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 40675efd8b4..a31ee25461d 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -83,7 +83,7 @@ class OC_Contacts_Addressbook{
$activeaddressbooks = self::all($uid, true);
$ids = array();
foreach($activeaddressbooks as $addressbook) {
- $ids[] = $addressbook['userid'];
+ $ids[] = $addressbook['id'];
}
return $ids;
}
@@ -148,10 +148,17 @@ class OC_Contacts_Addressbook{
* @return insertid
*/
public static function add($uid,$name,$description=''){
- $all = self::all($uid);
+ try {
+ $stmt = OCP\DB::prepare( 'SELECT uri FROM *PREFIX*contacts_addressbooks WHERE userid = ? ' );
+ $result = $stmt->execute(array($uid));
+ } catch(Exception $e) {
+ OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' exception: '.$e->getMessage(),OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.' uid: '.$uid,OCP\Util::DEBUG);
+ return false;
+ }
$uris = array();
- foreach($all as $i){
- $uris[] = $i['uri'];
+ while($row = $result->fetchRow()){
+ $uris[] = $row['uri'];
}
$uri = self::createURI($name, $uris );
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 25461877e62..f125ec0293c 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -196,16 +196,19 @@ class OC_Contacts_App {
foreach($vcaddressbooks as $vcaddressbook) {
$vcaddressbookids[] = $vcaddressbook['id'];
}
- $vccontacts = OC_Contacts_VCard::all($vcaddressbookids);
- }
- }
- if(is_array($vccontacts) && count($vccontacts) > 0) {
- $cards = array();
- foreach($vccontacts as $vccontact) {
- $cards[] = $vccontact['carddata'];
+ $start = 0;
+ $batchsize = 10;
+ while($vccontacts = OC_Contacts_VCard::all($vcaddressbookids, $start, $batchsize)){
+ $cards = array();
+ foreach($vccontacts as $vccontact) {
+ $cards[] = $vccontact['carddata'];
+ }
+ OCP\Util::writeLog('contacts',__CLASS__.'::'.__METHOD__.', scanning: '.$batchsize.' starting from '.$start,OCP\Util::DEBUG);
+ // only reset on first batch.
+ self::getVCategories()->rescan($cards, true, ($start==0?true:false));
+ $start += $batchsize;
+ }
}
-
- self::$categories->rescan($cards);
}
}
diff --git a/apps/contacts/lib/connector_sabre.php b/apps/contacts/lib/connector_sabre.php
index c967e906601..99b94fc767e 100644
--- a/apps/contacts/lib/connector_sabre.php
+++ b/apps/contacts/lib/connector_sabre.php
@@ -138,7 +138,9 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
foreach($data as $i){
$cards[] = array(
'id' => $i['id'],
- 'carddata' => $i['carddata'],
+ //'carddata' => $i['carddata'],
+ 'size' => strlen($i['carddata']),
+ 'etag' => md5($i['carddata']),
'uri' => $i['uri'],
'lastmodified' => $i['lastmodified'] );
}
diff --git a/apps/contacts/settings.php b/apps/contacts/settings.php
index c88fed0b4d6..a079499381b 100644
--- a/apps/contacts/settings.php
+++ b/apps/contacts/settings.php
@@ -1,6 +1,6 @@
<?php
$tmpl = new OCP\Template( 'contacts', 'settings');
+$tmpl->assign('addressbooks', OC_Contacts_Addressbook::all(OCP\USER::getUser()), false);
return $tmpl->fetchPage();
-?>
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index a8fb6c57c2c..5b49b68e954 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -16,7 +16,7 @@
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
<?php
- if ($_['id']){
+ if($_['has_contacts']){
echo $this->inc('part.contact');
}
else{
diff --git a/apps/contacts/templates/part.importaddressbook.php b/apps/contacts/templates/part.importaddressbook.php
index 01f8dd77d0a..8ceb5f3538b 100644
--- a/apps/contacts/templates/part.importaddressbook.php
+++ b/apps/contacts/templates/part.importaddressbook.php
@@ -12,6 +12,7 @@
<th><?php echo $l->t('Select address book to import to:') ?></th>
<td>
<form id="import_upload_form" action="<?php echo OCP\Util::linkTo('contacts', 'ajax/uploadimport.php'); ?>" method="post" enctype="multipart/form-data" target="import_upload_target">
+ <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>">
<select id="book" name="book" class="float">
<?php
$contacts_options = OC_Contacts_Addressbook::all(OCP\USER::getUser());
diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php
index 216003b6c69..f520559d143 100644
--- a/apps/contacts/templates/settings.php
+++ b/apps/contacts/templates/settings.php
@@ -7,6 +7,12 @@
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?></code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
<dd><code><?php echo OCP\Util::linkToRemote('carddav'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
+ <dt><?php echo $l->t('Read only vCard directory link(s)'); ?></dt>
+ <dd>
+ <?php foreach($_['addressbooks'] as $addressbook) { ?>
+ <a href="<?php echo OCP\Util::linkToRemote('carddav').'addressbooks/'.OCP\USER::getUser().'/'.rawurlencode($addressbook['uri']) ?>?export"><?php echo $addressbook['displayname'] ?></a><br />
+ <?php } ?>
+ </dd>
</dl>
Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
</fieldset>
diff --git a/apps/external/ajax/setsites.php b/apps/external/ajax/setsites.php
index 772863974ae..0f9e061d0e0 100644
--- a/apps/external/ajax/setsites.php
+++ b/apps/external/ajax/setsites.php
@@ -8,6 +8,7 @@
OCP\User::checkAdminUser();
+OCP\JSON::callCheck();
$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
@@ -22,4 +23,3 @@ else
OCP\Config::setAppValue('external', 'sites', json_encode($sites));
echo 'true';
-?>
diff --git a/apps/external/index.php b/apps/external/index.php
index 81819e76e2f..3b6f06e1bff 100644
--- a/apps/external/index.php
+++ b/apps/external/index.php
@@ -40,4 +40,3 @@ if (isset($_GET['id'])) {
$tmpl->printPage();
}
}
-?>
diff --git a/apps/external/lib/external.php b/apps/external/lib/external.php
index 9fff5d5569a..d13a7cf6dd7 100644
--- a/apps/external/lib/external.php
+++ b/apps/external/lib/external.php
@@ -32,5 +32,3 @@ class OC_External {
}
}
-
-?>
diff --git a/apps/external/settings.php b/apps/external/settings.php
index c109733e548..488444c119a 100644
--- a/apps/external/settings.php
+++ b/apps/external/settings.php
@@ -7,4 +7,3 @@ OCP\Util::addscript( "external", "admin" );
$tmpl = new OCP\Template( 'external', 'settings');
return $tmpl->fetchPage();
-?>
diff --git a/apps/files/ajax/autocomplete.php b/apps/files/ajax/autocomplete.php
index 7ff34da96b3..e504bb24bf8 100644
--- a/apps/files/ajax/autocomplete.php
+++ b/apps/files/ajax/autocomplete.php
@@ -52,5 +52,3 @@ if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){
}
}
OCP\JSON::encodedPrint($files);
-
-?>
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
index ed155de0dc7..695f803884e 100644
--- a/apps/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -4,6 +4,7 @@
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get data
$dir = stripslashes($_GET["dir"]);
@@ -25,5 +26,3 @@ if($success) {
} else {
OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
}
-
-?>
diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php
index e9373f5f6ac..b9a4ddaf5e7 100644
--- a/apps/files/ajax/download.php
+++ b/apps/files/ajax/download.php
@@ -34,4 +34,3 @@ $files = $_GET["files"];
$dir = $_GET["dir"];
OC_Files::get($dir, $files, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
-?>
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index f0600a179d0..dae0c1a828d 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -42,5 +42,3 @@ $list->assign( "files", $files, false );
$data = array('files' => $list->fetchPage());
OCP\JSON::success(array('data' => $data));
-
-?>
diff --git a/apps/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php
index 57898cd82d9..80d50f84528 100644
--- a/apps/files/ajax/mimeicon.php
+++ b/apps/files/ajax/mimeicon.php
@@ -7,5 +7,3 @@ $RUNTIME_NOAPPS=false;
print OC_Helper::mimetypeIcon($_GET['mime']);
-
-?>
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
index 945fe4e7b82..3d4003a8edc 100644
--- a/apps/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -4,6 +4,7 @@
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get data
$dir = stripslashes($_GET["dir"]);
@@ -16,5 +17,3 @@ if(OC_Files::move($dir,$file,$target,$file)){
}else{
OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
}
-
-?>
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index edb78414872..7236deb65c9 100644
--- a/apps/files/ajax/newfile.php
+++ b/apps/files/ajax/newfile.php
@@ -4,6 +4,7 @@
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get the params
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php
index c5c37914c6a..ae92bcf09bb 100644
--- a/apps/files/ajax/newfolder.php
+++ b/apps/files/ajax/newfolder.php
@@ -4,6 +4,7 @@
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get the params
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index 7cb02f79673..d159f6e152f 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -22,5 +22,3 @@ foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){
}
OCP\JSON::success(array('data' => $files));
-
-?>
diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php
index e2fa3d54a61..45448279fa1 100644
--- a/apps/files/ajax/rename.php
+++ b/apps/files/ajax/rename.php
@@ -4,6 +4,7 @@
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get data
$dir = stripslashes($_GET["dir"]);
@@ -17,5 +18,3 @@ if( OC_Files::move( $dir, $file, $dir, $newname )) {
else{
OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
}
-
-?>
diff --git a/apps/files/ajax/timezone.php b/apps/files/ajax/timezone.php
index cafb5074ece..0be441a36a2 100644
--- a/apps/files/ajax/timezone.php
+++ b/apps/files/ajax/timezone.php
@@ -3,4 +3,4 @@
// see lib/base.php for an example
//session_start();
$_SESSION['timezone'] = $_GET['time'];
-?>
+ \ No newline at end of file
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index b779924cfb4..74e6eb560d8 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -7,6 +7,7 @@
OCP\JSON::setContentTypeHeader('text/plain');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
if (!isset($_FILES['files'])) {
OCP\JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" )));
@@ -59,5 +60,3 @@ if(strpos($dir,'..') === false){
}
OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName)));
-
-?>
diff --git a/apps/files/download.php b/apps/files/download.php
index 2b5d4e2d876..4e2478d1ad7 100644
--- a/apps/files/download.php
+++ b/apps/files/download.php
@@ -46,4 +46,3 @@ header('Content-Length: '.OC_Filesystem::filesize($filename));
@ob_end_clean();
OC_Filesystem::readfile( $filename );
-?>
diff --git a/apps/files/index.php b/apps/files/index.php
index ed36c5edab0..79bed8e357e 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -40,6 +40,7 @@ $dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if(!OC_Filesystem::is_dir($dir.'/')) {
header('Location: '.$_SERVER['PHP_SELF'].'');
+ exit();
}
$files = array();
@@ -98,5 +99,3 @@ $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign( 'allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->printPage();
-
-?>
diff --git a/apps/files/settings.php b/apps/files/settings.php
index e5a66239ebd..cd6dd8c1616 100644
--- a/apps/files/settings.php
+++ b/apps/files/settings.php
@@ -56,5 +56,3 @@ $tmpl = new OCP\Template( "files", "index", "user" );
$tmpl->assign( 'files', $files );
$tmpl->assign( "breadcrumb", $breadcrumb );
$tmpl->printPage();
-
-?>
diff --git a/apps/files_encryption/js/settings.js b/apps/files_encryption/js/settings.js
index 37d62265c94..8cc433246cb 100644
--- a/apps/files_encryption/js/settings.js
+++ b/apps/files_encryption/js/settings.js
@@ -17,8 +17,8 @@ $(document).ready(function(){
OC.AppConfig.setValue('files_encryption','type_blacklist',blackList);
}
- $('#enbale_encryption').change(function(){
- var checked=$('#enbale_encryption').is(':checked');
+ $('#enable_encryption').change(function(){
+ var checked=$('#enable_encryption').is(':checked');
OC.AppConfig.setValue('files_encryption','enable_encryption',(checked)?'true':'false');
})
}) \ No newline at end of file
diff --git a/apps/files_encryption/templates/settings.php b/apps/files_encryption/templates/settings.php
index 25b5a06f56c..79780d694cf 100644
--- a/apps/files_encryption/templates/settings.php
+++ b/apps/files_encryption/templates/settings.php
@@ -7,6 +7,6 @@
<option selected="selected" value="<?php echo $type;?>"><?php echo $type;?></option>
<?php endforeach;?>
</select>
- <input type='checkbox' id='enbale_encryption' <?php if($_['encryption_enabled']){echo 'checked="checked"';} ?>></input><label for='enbale_encryption'><?php echo $l->t('Enable Encryption')?></label>
+ <input type='checkbox' id='enable_encryption' <?php if($_['encryption_enabled']){echo 'checked="checked"';} ?>></input><label for='enable_encryption'><?php echo $l->t('Enable Encryption')?></label>
</fieldset>
</form>
diff --git a/apps/files_external/ajax/addMountPoint.php b/apps/files_external/ajax/addMountPoint.php
index 549cb6a3427..e08f805942f 100644
--- a/apps/files_external/ajax/addMountPoint.php
+++ b/apps/files_external/ajax/addMountPoint.php
@@ -1,6 +1,8 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
+OCP\JSON::callCheck();
+
if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkLoggedIn();
$isPersonal = true;
@@ -9,5 +11,3 @@ if ($_POST['isPersonal'] == 'true') {
$isPersonal = false;
}
OC_Mount_Config::addMountPoint($_POST['mountPoint'], $_POST['class'], $_POST['classOptions'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
-
-?>
diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php
index 33cd64d2c7a..d28a7d24b2d 100644
--- a/apps/files_external/ajax/addRootCertificate.php
+++ b/apps/files_external/ajax/addRootCertificate.php
@@ -4,9 +4,25 @@ OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$from = $_FILES['rootcert_import']['tmp_name'];
-$to = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$_FILES['rootcert_import']['name'];
+$path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/';
+if(!file_exists($path)) mkdir($path,0700,true);
+$to = $path.$_FILES['rootcert_import']['name'];
move_uploaded_file($from, $to);
+//check if it is a PEM certificate, otherwise convert it if possible
+$fh = fopen($to, 'r');
+$data = fread($fh, filesize($to));
+fclose($fh);
+if (!strpos($data, 'BEGIN CERTIFICATE')) {
+ $pem = chunk_split(base64_encode($data), 64, "\n");
+ $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
+ $fh = fopen($to, 'w');
+ fwrite($fh, $pem);
+ fclose($fh);
+}
+
+OC_Mount_Config::createCertificateBundle();
+
header("Location: settings/personal.php");
exit;
?> \ No newline at end of file
diff --git a/apps/files_external/ajax/removeMountPoint.php b/apps/files_external/ajax/removeMountPoint.php
index b77b306bcb5..aa446426202 100644
--- a/apps/files_external/ajax/removeMountPoint.php
+++ b/apps/files_external/ajax/removeMountPoint.php
@@ -1,6 +1,8 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
+OCP\JSON::callCheck();
+
if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkLoggedIn();
$isPersonal = true;
@@ -9,5 +11,3 @@ if ($_POST['isPersonal'] == 'true') {
$isPersonal = false;
}
OC_Mount_Config::removeMountPoint($_POST['mountPoint'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
-
-?>
diff --git a/apps/files_external/ajax/removeRootCertificate.php b/apps/files_external/ajax/removeRootCertificate.php
index 05f2fdef2d1..a00922f4210 100644
--- a/apps/files_external/ajax/removeRootCertificate.php
+++ b/apps/files_external/ajax/removeRootCertificate.php
@@ -4,6 +4,7 @@ OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$cert = $_POST['cert'];
-$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$cert;
+$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'.$cert;
unlink($file);
+OC_Mount_Config::createCertificateBundle();
?> \ No newline at end of file
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 4e82e6b2548..5630df77a91 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -244,7 +244,8 @@ class OC_Mount_Config {
*/
public static function getCertificates() {
$view = \OCP\Files::getStorage('files_external');
- $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
+ $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/';
+ if (!is_dir($path)) mkdir($path);
$result = array();
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
@@ -252,6 +253,30 @@ class OC_Mount_Config {
}
return $result;
}
+
+ /**
+ * creates certificate bundle
+ */
+ public static function createCertificateBundle() {
+ $view = \OCP\Files::getStorage("files_external");
+ $path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
+
+ $certs = OC_Mount_Config::getCertificates();
+ $fh_certs = fopen($path."/rootcerts.crt", 'w');
+ foreach ($certs as $cert) {
+ $file=$path.'/uploads/'.$cert;
+ $fh = fopen($file, "r");
+ $data = fread($fh, filesize($file));
+ fclose($fh);
+ if (strpos($data, 'BEGIN CERTIFICATE')) {
+ fwrite($fh_certs, $data);
+ }
+ }
+
+ fclose($fh_certs);
+
+ return true;
+ }
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 32dd26ae6c3..3d13518f57b 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -36,18 +36,20 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$this->root.='/';
}
- $capath = '';
- if($caview = \OCP\Files::getStorage('files_external')) {
- $capath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("");
- }
$settings = array(
'baseUri' => $this->createBaseUri(),
'userName' => $this->user,
'password' => $this->password,
- 'capath' => $capath,
);
- $this->client = new Sabre_DAV_Client($settings);
+ $this->client = new OC_Connector_Sabre_Client($settings);
+
+ if($caview = \OCP\Files::getStorage('files_external')) {
+ $certPath=\OCP\Config::getSystemValue('datadirectory').$caview->getAbsolutePath("").'rootcerts.crt';
+ if (file_exists($certPath)) {
+ $this->client->addTrustedCertificates($certPath);
+ }
+ }
//create the root folder if necesary
$this->mkdir('');
}
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index 8f8fe8d527f..e8bc94790dc 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -1,4 +1,4 @@
-<form id="files_external" method="post" enctype="multipart/form-data" action="/owncloud/?app=files_external&getfile=ajax%2FaddRootCertificate.php">
+<form id="files_external" method="post" enctype="multipart/form-data" action="<?php echo OCP\Util::linkTo('files_external', 'ajax/addRootCertificate.php'); ?>">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('External Storage'); ?></strong></legend>
<table id="externalStorage" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
@@ -81,7 +81,7 @@
</table>
<br />
- <?php if (!$_['isAdminPage'] && false): // disabled until sabredav can handle uploaded ca certs ?>
+ <?php if (!$_['isAdminPage']): ?>
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
<thead>
<tr>
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index d0084c94afd..b9b4cf65bd6 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -45,6 +45,3 @@ if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['r
}
}
}
-
-?>
-
diff --git a/apps/files_imageviewer/appinfo/app.php b/apps/files_imageviewer/appinfo/app.php
index 6c8d8c30cad..6184585cff3 100644
--- a/apps/files_imageviewer/appinfo/app.php
+++ b/apps/files_imageviewer/appinfo/app.php
@@ -4,5 +4,3 @@ OCP\Util::addscript( 'files_imageviewer', 'lightbox' );
OCP\Util::addscript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
OCP\Util::addscript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
-
-?>
diff --git a/apps/files_pdfviewer/appinfo/app.php b/apps/files_pdfviewer/appinfo/app.php
index c8ca2dc8d94..e4771ee517f 100644
--- a/apps/files_pdfviewer/appinfo/app.php
+++ b/apps/files_pdfviewer/appinfo/app.php
@@ -6,4 +6,3 @@ OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/compatibility');
OCP\Util::addscript( 'files_pdfviewer', 'viewer');
OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/build/pdf');
OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/viewer');
-?>
diff --git a/apps/files_pdfviewer/js/pdfjs/viewer.js b/apps/files_pdfviewer/js/pdfjs/viewer.js
index f49257d7929..90dd1eef020 100644
--- a/apps/files_pdfviewer/js/pdfjs/viewer.js
+++ b/apps/files_pdfviewer/js/pdfjs/viewer.js
@@ -1432,7 +1432,7 @@ var DocumentOutlineView = function documentOutlineView(outline) {
queue.push({parent: itemsDiv, items: item.items});
}
- levelData.parent.appendChild(div);
+// levelData.parent.appendChild(div);
}
}
};
@@ -1751,10 +1751,9 @@ function updateThumbViewArea() {
}
window.addEventListener('resize', function webViewerResize(evt) {
- if (PDFView.initialized &&
+ if (PDFView.initialized && PDFView.active &&
(document.getElementById('pageWidthOption').selected ||
- document.getElementById('pageFitOption').selected ||
- document.getElementById('pageAutoOption').selected))
+ document.getElementById('pageFitOption').selected ))
PDFView.parseScale(document.getElementById('scaleSelect').value);
updateViewarea();
});
@@ -1788,8 +1787,8 @@ window.addEventListener('change', function webViewerChange(evt) {
document.title = file.name;
// URL does not reflect proper document location - hiding some icons.
- document.getElementById('viewBookmark').setAttribute('hidden', 'true');
- document.getElementById('download').setAttribute('hidden', 'true');
+// document.getElementById('viewBookmark').setAttribute('hidden', 'true');
+// document.getElementById('download').setAttribute('hidden', 'true');
}, true);
function selectScaleOption(value) {
diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php
index 523c3d2078b..ca63f540f93 100644
--- a/apps/files_sharing/ajax/email.php
+++ b/apps/files_sharing/ajax/email.php
@@ -1,6 +1,8 @@
<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_sharing');
+OCP\JSON::callCheck();
+
$user = OCP\USER::getUser();
// TODO translations
$type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
@@ -9,5 +11,3 @@ $link = $_POST['link'];
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
-
-?>
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index 94f0890d706..ff6c29b6a0a 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -64,5 +64,3 @@ while ($path != $userDirectory) {
}
OCP\JSON::success(array('data' => $item));
-
-?>
diff --git a/apps/files_sharing/ajax/getstatuses.php b/apps/files_sharing/ajax/getstatuses.php
index 488cab13bc9..1be4d9a0d9c 100644
--- a/apps/files_sharing/ajax/getstatuses.php
+++ b/apps/files_sharing/ajax/getstatuses.php
@@ -20,5 +20,3 @@ if ($rows = OC_Share::getMySharedItems()) {
}
OCP\JSON::success(array('data' => $items));
-
-?>
diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php
index 4d19cd40f2d..0a2cf78f765 100644
--- a/apps/files_sharing/ajax/setpermissions.php
+++ b/apps/files_sharing/ajax/setpermissions.php
@@ -2,6 +2,7 @@
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$source = '/'.OCP\USER::getUser().'/files'.$_POST['source'];
$uid_shared_with = $_POST['uid_shared_with'];
@@ -9,5 +10,3 @@ $permissions = $_POST['permissions'];
OC_Share::setPermissions($source, $uid_shared_with, $permissions);
OCP\JSON::success();
-
-?>
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index 1ee8c3f791a..3f224d1b67b 100644
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -2,6 +2,7 @@
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$userDirectory = '/'.OCP\USER::getUser().'/files';
$sources = explode(';', $_POST['sources']);
@@ -34,5 +35,3 @@ foreach ($sources as $source) {
}
}
}
-
-?>
diff --git a/apps/files_sharing/ajax/toggleresharing.php b/apps/files_sharing/ajax/toggleresharing.php
index 673f00c5d18..7da4fdfeea8 100644
--- a/apps/files_sharing/ajax/toggleresharing.php
+++ b/apps/files_sharing/ajax/toggleresharing.php
@@ -7,5 +7,3 @@ if ($_POST['resharing'] == true) {
} else {
OCP\Config::setAppValue('files_sharing', 'resharing', 'no');
}
-
-?>
diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php
index d50e7963a05..02a59c4016b 100644
--- a/apps/files_sharing/ajax/unshare.php
+++ b/apps/files_sharing/ajax/unshare.php
@@ -2,11 +2,10 @@
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$source = '/'.OCP\USER::getUser().'/files'.$_POST['source'];
$uid_shared_with = $_POST['uid_shared_with'];
OC_Share::unshare($source, $uid_shared_with);
OCP\JSON::success();
-
-?>
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 0e1bf6d588e..388a4844b95 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -28,5 +28,3 @@ $users[] = "</optgroup>";
$groups[] = "</optgroup>";
$users = array_merge($users, $groups);
OCP\JSON::encodedPrint($users);
-
-?>
diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php
index 40a90a1530c..70a5162d382 100644
--- a/apps/files_sharing/get.php
+++ b/apps/files_sharing/get.php
@@ -86,4 +86,3 @@ if (isset($_GET['token']) && $source = OC_Share::getSource($_GET['token'])) {
$tmpl->printPage();
die();
}
-?>
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 6e092269250..0237acfc1ac 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -513,5 +513,3 @@ class OC_Share {
}
}
-
-?>
diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php
index 2fd24840d36..54704c942fd 100644
--- a/apps/files_sharing/list.php
+++ b/apps/files_sharing/list.php
@@ -33,5 +33,3 @@ OCP\Util::addscript("files_sharing", "list");
$tmpl = new OCP\Template("files_sharing", "list", "user");
$tmpl->assign("shared_items", OC_Share::getMySharedItems());
$tmpl->printPage();
-
-?>
diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php
index 961db7105e3..f3ac323e32f 100644
--- a/apps/files_texteditor/ajax/savefile.php
+++ b/apps/files_texteditor/ajax/savefile.php
@@ -26,6 +26,7 @@
// Check if we are a user
OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get paramteres
$filecontents = isset($_POST['filecontents']) ? $_POST['filecontents'] : false;
diff --git a/apps/files_texteditor/appinfo/app.php b/apps/files_texteditor/appinfo/app.php
index c745170018e..1f9773bca3a 100644
--- a/apps/files_texteditor/appinfo/app.php
+++ b/apps/files_texteditor/appinfo/app.php
@@ -4,4 +4,3 @@ OCP\Util::addStyle( 'files_texteditor', 'DroidSansMono/stylesheet' );
OCP\Util::addStyle( 'files_texteditor', 'style' );
OCP\Util::addscript( 'files_texteditor', 'editor');
OCP\Util::addscript( 'files_texteditor', 'aceeditor/ace');
-?>
diff --git a/apps/files_versions/ajax/togglesettings.php b/apps/files_versions/ajax/togglesettings.php
index d513d12dd6c..86f614c5c89 100644
--- a/apps/files_versions/ajax/togglesettings.php
+++ b/apps/files_versions/ajax/togglesettings.php
@@ -7,5 +7,3 @@ if (OCP\Config::getSystemValue('versions', 'true')=='true') {
} else {
OCP\Config::setSystemValue('versions', 'true');
}
-
-?>
diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php
index e3332d7cdb6..b2ae8d232e4 100644
--- a/apps/files_versions/history.php
+++ b/apps/files_versions/history.php
@@ -71,5 +71,3 @@ if ( isset( $_GET['path'] ) ) {
}
$tmpl->printPage( );
-
-?>
diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php
index b43fdb9fd33..f93d4dabe22 100644
--- a/apps/files_versions/lib/hooks.php
+++ b/apps/files_versions/lib/hooks.php
@@ -30,43 +30,41 @@ class Hooks {
}
}
- /**
- * @brief Erase versions of deleted file
- * @param array
- *
- * This function is connected to the delete signal of OC_Filesystem
- * cleanup the versions directory if the actual file gets deleted
- */
- public static function remove_hook($params) {
- $rel_path = $params['path'];
- $abs_path = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_path.'.v';
- if(Storage::isversioned($rel_path)) {
- $versions = Storage::getVersions($rel_path);
- foreach ($versions as $v){
- unlink($abs_path . $v['version']);
- }
- }
- }
-
- /**
- * @brief rename/move versions of renamed/moved files
- * @param array with oldpath and newpath
- *
- * This function is connected to the rename signal of OC_Filesystem and adjust the name and location
- * of the stored versions along the actual file
- */
- public static function rename_hook($params) {
- $rel_oldpath = $params['oldpath'];
- $abs_oldpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_oldpath.'.v';
- $abs_newpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$params['newpath'].'.v';
- if(Storage::isversioned($rel_oldpath)) {
- $versions = Storage::getVersions($rel_oldpath);
- foreach ($versions as $v){
- rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']);
- }
- }
+ /**
+ * @brief Erase versions of deleted file
+ * @param array
+ *
+ * This function is connected to the delete signal of OC_Filesystem
+ * cleanup the versions directory if the actual file gets deleted
+ */
+ public static function remove_hook($params) {
+ $rel_path = $params['path'];
+ $abs_path = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_path.'.v';
+ if(Storage::isversioned($rel_path)) {
+ $versions = Storage::getVersions($rel_path);
+ foreach ($versions as $v){
+ unlink($abs_path . $v['version']);
+ }
+ }
+ }
+
+ /**
+ * @brief rename/move versions of renamed/moved files
+ * @param array with oldpath and newpath
+ *
+ * This function is connected to the rename signal of OC_Filesystem and adjust the name and location
+ * of the stored versions along the actual file
+ */
+ public static function rename_hook($params) {
+ $rel_oldpath = $params['oldpath'];
+ $abs_oldpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$rel_oldpath.'.v';
+ $abs_newpath = \OCP\Config::getSystemValue('datadirectory').'/'.\OCP\User::getUser()."/versions".$params['newpath'].'.v';
+ if(Storage::isversioned($rel_oldpath)) {
+ $versions = Storage::getVersions($rel_oldpath);
+ foreach ($versions as $v){
+ rename($abs_oldpath.$v['version'], $abs_newpath.$v['version']);
+ }
+ }
}
}
-
-?>
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 5611e538ad8..723c27577a7 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -33,7 +33,7 @@ class Storage {
const DEFAULTFOLDER='versions';
const DEFAULTBLACKLIST='avi mp3 mpg mp4 ctmp';
const DEFAULTMAXFILESIZE=1048576; // 10MB
- const DEFAULTMININTERVAL=1; // 2 min
+ const DEFAULTMININTERVAL=60; // 1 min
const DEFAULTMAXVERSIONS=50;
private $view;
@@ -239,10 +239,9 @@ class Storage {
$versions[$i]['version'] = ( end( $parts ) );
// if file with modified date exists, flag it in array as currently enabled version
- $curFile['fileName'] = basename( $parts[0] );
- $curFile['filePath'] = \OCP\Config::getSystemValue('datadirectory').\OC_Filesystem::getRoot().'/'.$curFile['fileName'];
-
- ( \md5_file( $ma ) == \md5_file( $curFile['filePath'] ) ? $versions[$i]['fileMatch'] = 1 : $versions[$i]['fileMatch'] = 0 );
+ $files_view = \OCP\Files::getStorage('files');
+ $local_file = $files_view->getLocalFile($filename);
+ ( \md5_file( $ma ) == \md5_file( $local_file ) ? $versions[$i]['fileMatch'] = 1 : $versions[$i]['fileMatch'] = 0 );
}
diff --git a/apps/files_versions/settings.php b/apps/files_versions/settings.php
index 5f9e60fc589..f2873b8f7c2 100644
--- a/apps/files_versions/settings.php
+++ b/apps/files_versions/settings.php
@@ -7,4 +7,3 @@ OCP\Util::addscript( 'files_versions', 'versions' );
$tmpl = new OCP\Template( 'files_versions', 'settings');
return $tmpl->fetchPage();
-?>
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php
index 61e2e9ae2e9..5bfa5aa9a93 100644
--- a/apps/gallery/ajax/createAlbum.php
+++ b/apps/gallery/ajax/createAlbum.php
@@ -28,5 +28,3 @@ OCP\JSON::checkAppEnabled('gallery');
OC_Gallery_Album::create(OCP\USER::getUser(), $_GET['album_name']);
OCP\JSON::success(array('name' => $_GET['album_name']));
-
-?>
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 7cbe3e46e21..ab8c64e28ad 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -186,4 +186,3 @@ if ($_GET['operation']) {
OCP\JSON::error(array('cause' => 'Unknown operation'));
}
}
-?>
diff --git a/apps/gallery/ajax/viewImage.php b/apps/gallery/ajax/viewImage.php
new file mode 100644
index 00000000000..daf0ab741f0
--- /dev/null
+++ b/apps/gallery/ajax/viewImage.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * ownCloud - gallery application
+ *
+ * @author Ike Devolder
+ * @copyright 2012 Ike Devolder
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
+
+$img = $_GET['img'];
+
+$image = OC_Gallery_Photo::getViewImage($img);
+if ($image) {
+ OCP\Response::enableCaching(3600 * 24); // 24 hour
+ $image->show();
+}
diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css
index dcef1f08c6d..63f645662dd 100644
--- a/apps/gallery/css/styles.css
+++ b/apps/gallery/css/styles.css
@@ -1,11 +1,11 @@
#gallerycontent { margin-top: 2.8em; overflow: visible; }
-#g-settings {position: absolute; left 13.5em; top: 0;}
+#g-settings {position: absolute; left: 13.5em; top: 0;}
div#controls input[type=button] { -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; opacity: 1; position:absolute; right:13.5em; top:0em; }
input[type=button]:disabled { opacity: 0.5 }
.ui-dialog tr {background-color: #eee;}
.ui-dialog input {width: 90%;}
-div.gallery_div {position:relative; display: inline-block; height: 152px; width: 150px; margin: 5px;}
+div.gallery_div {position:relative; display: inline-block; height: 150px; width: 150px; margin: 5px;}
div.miniature_border {position:absolute; height: 150px; -moz-transition-duration: 0.2s; -o-transition-duration:0.2s; -webkit-transition-duration: .2s; background-position: 50%;}
div.line {display:inline-block; border: 0; width: auto; height: 160px}
div.gallery_div img{position:absolute; top: 1; left: 0; -moz-transition-duration: 0.3s; -o-transition-duration:0.3s; -webkit-transition-duration: 0.3s; height:150px; width: auto;}
diff --git a/apps/gallery/css/supersized.css b/apps/gallery/css/supersized.css
new file mode 100644
index 00000000000..57ee7e23a50
--- /dev/null
+++ b/apps/gallery/css/supersized.css
@@ -0,0 +1,25 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Site : www.buildinternet.com/project/supersized
+
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+#supersized-holder #supersized-loader { display:none; position:absolute; top:50%; left:50%; z-index:0; width:60px; height:60px; margin:-30px 0 0 -30px; text-indent:-999em; background:url('%appswebroot%/gallery/img/supersized/progress.gif') no-repeat center center;}
+
+#supersized-holder #supersized { visibility:hidden; display:block; position:fixed; left:0; top:0; overflow:hidden; z-index:200; height:100%; width:100%; }
+#supersized-holder #supersized img { width:auto; height:auto; position:relative; display:none; outline:none; border:none; }
+#supersized-holder #supersized.speed img { -ms-interpolation-mode:nearest-neighbor; image-rendering: -moz-crisp-edges; } /*Speed*/
+#supersized-holder #supersized.quality img { -ms-interpolation-mode:bicubic; image-rendering: optimizeQuality; } /*Quality*/
+
+#supersized-holder #supersized li { display:block; list-style:none; z-index:150; position:fixed; overflow:hidden; top:0; left:0; width:100%; height:100%; background:#111; }
+#supersized-holder #supersized a { width:100%; height:100%; display:block; }
+#supersized-holder #supersized li.prevslide { z-index:160; }
+#supersized-holder #supersized li.activeslide { z-index:170; }
+#supersized-holder #supersized li.image-loading { background:#111 url('%appswebroot%/gallery/img/supersized/progress.gif') no-repeat center center; width:100%; height:100%; }
+#supersized-holder #supersized li.image-loading img{ visibility:hidden; }
+#supersized-holder #supersized li.prevslide img, #supersized-holder #supersized li.activeslide img{ display:inline; }
diff --git a/apps/gallery/css/supersized.shutter.css b/apps/gallery/css/supersized.shutter.css
new file mode 100644
index 00000000000..428c254c3b2
--- /dev/null
+++ b/apps/gallery/css/supersized.shutter.css
@@ -0,0 +1,74 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Site : www.buildinternet.com/project/supersized
+
+ Theme : Shutter 1.2
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+
+/* Controls Bar
+----------------------------*/
+#slideshow-content #slideshow-controls-wrapper { margin:0 auto; height:42px; width:100%; bottom:0px; left:0; z-index:204; background:url('%appswebroot%/gallery/img/supersized/nav-bg.png') repeat-x; position:fixed; }
+#slideshow-content #slideshow-controls { overflow:hidden; height:100%; position:relative; text-align:left; z-index:205; }
+#slideshow-content #slidecounter { float:left; color:#999; font:14px "Helvetica Neue", Helvetica, Arial, sans-serif; text-shadow:#000 0 -1px 0; margin:0px 10px 0 15px; line-height:42px; }
+#slideshow-content #slidecaption { overflow:hidden; float:left; color:#FFF; font:400 14px "Helvetica Neue", Helvetica, Arial, sans-serif; text-shadow:#000 1px 1px 2px; margin:0 20px 0 0; line-height:42px; }
+
+/*#navigation { float:right; margin:0px 20px 0 0; }*/
+#slideshow-content #play-button{ float:left; margin-top:1px;border-right:1px solid #333; background:url('%appswebroot%/gallery/img/supersized/bg-hover.png') repeat-x 0 44px; }
+#slideshow-content #play-button:hover{ background-position:0 1px; cursor:pointer; }
+
+#slideshow-content #prevslide, #nextslide{ position:fixed; height:43px; width:43px; top:50%; margin-top:-21px; opacity:0.6; z-index:204; }
+#slideshow-content #prevslide{ left:10px; background:url('%appswebroot%/gallery/img/supersized/back.png'); }
+#slideshow-content #nextslide{ right:10px; background:url('%appswebroot%/gallery/img/supersized/forward.png'); }
+#slideshow-content #prevslide:active, #nextslide:active{ margin-top:-19px; }
+#slideshow-content #prevslide:hover, #nextslide:hover{ cursor:pointer; }
+
+#slideshow-content ul#slide-list{ padding:15px 0; float:left; position:absolute; left:50%; }
+#slideshow-content ul#slide-list li{ list-style:none; width:12px; height:12px; float:left; margin:0 5px 0 0; }
+#slideshow-content ul#slide-list li.current-slide a, ul#slide-list li.current-slide a:hover{ background-position:0 0px; }
+#slideshow-content ul#slide-list li a{ display:block; width:12px; height:12px; background:url('%appswebroot%/gallery/img/supersized/nav-dot.png') no-repeat 0 -24px; }
+#slideshow-content ul#slide-list li a:hover{ background-position:0 -12px; cursor:pointer; }
+
+#slideshow-content #tray-button{ float:right; margin-top:1px; border-left:1px solid #333; background:url('%appswebroot%/gallery/img/supersized/bg-hover.png') repeat-x 0 44px; }
+#slideshow-content #tray-button:hover{ background-position:0 1px; cursor:pointer; }
+
+
+/* Progress Bar
+----------------------------*/
+#slideshow-content #progress-back{ z-index:205; position:fixed; bottom:42px; left:0; height:8px; width:100%; background:url('%appswebroot%/gallery/img/supersized/progress-back.png') repeat-x; }
+#slideshow-content #progress-bar{ position:relative; height:8px; width:100%; background:url('%appswebroot%/gallery/img/supersized/progress-bar.png') repeat-x; }
+
+
+/* Thumbnail Navigation
+----------------------------*/
+#slideshow-content #nextthumb, #slideshow-content #prevthumb { z-index:202; display:none; position:fixed; bottom:61px; height:75px; width:100px; overflow:hidden; background:#ddd; border:1px solid #fff; -webkit-box-shadow:0 0 5px #000; }
+#slideshow-content #nextthumb { right:12px; }
+#slideshow-content #prevthumb { left:12px; }
+#slideshow-content #nextthumb img, #slideshow-content #prevthumb img { width:150px; height:auto; }
+#slideshow-content #nextthumb:active, #slideshow-content #prevthumb:active { bottom:59px; }
+#slideshow-content #nextthumb:hover, #slideshow-content #prevthumb:hover { cursor:pointer; }
+
+
+/* Thumbnail Tray
+----------------------------*/
+#slideshow-content #thumb-tray{ position:fixed; z-index:203; bottom:0; left:0; background:url('%appswebroot%/gallery/img/supersized/bg-black.png'); height:150px; width:100%; overflow:hidden; text-align:center; -moz-box-shadow: 0px 0px 4px #000; -webkit-box-shadow: 0px 0px 4px #000; box-shadow: 0px 0px 4px #000; }
+
+#slideshow-content #thumb-back, #slideshow-content #thumb-forward{ position:absolute; z-index:5; bottom:42px; height:108px; width:40px; }
+#slideshow-content #thumb-back{ left:0; background: url('%appswebroot%/gallery/img/supersized/thumb-back.png') no-repeat center center;}
+#slideshow-content #thumb-forward{ right:0; background:url('%appswebroot%/gallery/img/supersized/thumb-forward.png') no-repeat center center;}
+#slideshow-content #thumb-back:hover, #slideshow-content #thumb-forward:hover{ cursor:pointer; background-color:rgba(256,256,256, 0.1); }
+#slideshow-content #thumb-back:hover{ border-right:1px solid rgba(256,256,256, 0.2); }
+#slideshow-content #thumb-forward:hover{ border-left:1px solid rgba(256,256,256, 0.2); }
+
+
+#slideshow-content ul#thumb-list{ display:inline-block; list-style:none; position:relative; left:0px; padding:0 0px; }
+#slideshow-content ul#thumb-list li{ background:#111; list-style:none; display:inline; width:150px; height:108px; overflow:hidden; float:left; margin:0; }
+#slideshow-content ul#thumb-list li img { width:200px; height:auto; opacity:0.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; filter:alpha(opacity=60); -webkit-transition: all 100ms ease-in-out; -moz-transition: all 100ms ease-in-out; -o-transition: all 100ms ease-in-out; -ms-transition: all 100ms ease-in-out; transition: all 100ms ease-in-out; }
+#slideshow-content ul#thumb-list li.current-thumb img, #slideshow-content ul#thumb-list li:hover img{ opacity:1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); }
+#slideshow-content ul#thumb-list li:hover{ cursor:pointer; }
+
diff --git a/apps/gallery/img/supersized/back.png b/apps/gallery/img/supersized/back.png
new file mode 100644
index 00000000000..44cd0ae703c
--- /dev/null
+++ b/apps/gallery/img/supersized/back.png
Binary files differ
diff --git a/apps/gallery/img/supersized/bg-black.png b/apps/gallery/img/supersized/bg-black.png
new file mode 100644
index 00000000000..8c2f00140d6
--- /dev/null
+++ b/apps/gallery/img/supersized/bg-black.png
Binary files differ
diff --git a/apps/gallery/img/supersized/bg-hover.png b/apps/gallery/img/supersized/bg-hover.png
new file mode 100644
index 00000000000..1ca2022e106
--- /dev/null
+++ b/apps/gallery/img/supersized/bg-hover.png
Binary files differ
diff --git a/apps/gallery/img/supersized/button-tray-down.png b/apps/gallery/img/supersized/button-tray-down.png
new file mode 100644
index 00000000000..99b92aef122
--- /dev/null
+++ b/apps/gallery/img/supersized/button-tray-down.png
Binary files differ
diff --git a/apps/gallery/img/supersized/button-tray-up.png b/apps/gallery/img/supersized/button-tray-up.png
new file mode 100644
index 00000000000..7cc57785f0a
--- /dev/null
+++ b/apps/gallery/img/supersized/button-tray-up.png
Binary files differ
diff --git a/apps/gallery/img/supersized/forward.png b/apps/gallery/img/supersized/forward.png
new file mode 100644
index 00000000000..e2084ab3faf
--- /dev/null
+++ b/apps/gallery/img/supersized/forward.png
Binary files differ
diff --git a/apps/gallery/img/supersized/nav-bg.png b/apps/gallery/img/supersized/nav-bg.png
new file mode 100644
index 00000000000..800f904ddc7
--- /dev/null
+++ b/apps/gallery/img/supersized/nav-bg.png
Binary files differ
diff --git a/apps/gallery/img/supersized/nav-dot.png b/apps/gallery/img/supersized/nav-dot.png
new file mode 100644
index 00000000000..a28a50789f3
--- /dev/null
+++ b/apps/gallery/img/supersized/nav-dot.png
Binary files differ
diff --git a/apps/gallery/img/supersized/pause.png b/apps/gallery/img/supersized/pause.png
new file mode 100644
index 00000000000..a2c21a51cee
--- /dev/null
+++ b/apps/gallery/img/supersized/pause.png
Binary files differ
diff --git a/apps/gallery/img/supersized/play.png b/apps/gallery/img/supersized/play.png
new file mode 100644
index 00000000000..16e53f86745
--- /dev/null
+++ b/apps/gallery/img/supersized/play.png
Binary files differ
diff --git a/apps/gallery/img/supersized/progress-back.png b/apps/gallery/img/supersized/progress-back.png
new file mode 100644
index 00000000000..68cd45b6706
--- /dev/null
+++ b/apps/gallery/img/supersized/progress-back.png
Binary files differ
diff --git a/apps/gallery/img/supersized/progress-bar.png b/apps/gallery/img/supersized/progress-bar.png
new file mode 100644
index 00000000000..49ebb0513b7
--- /dev/null
+++ b/apps/gallery/img/supersized/progress-bar.png
Binary files differ
diff --git a/apps/gallery/img/supersized/progress.gif b/apps/gallery/img/supersized/progress.gif
new file mode 100644
index 00000000000..f3e45e0569c
--- /dev/null
+++ b/apps/gallery/img/supersized/progress.gif
Binary files differ
diff --git a/apps/gallery/img/supersized/supersized-logo.png b/apps/gallery/img/supersized/supersized-logo.png
new file mode 100644
index 00000000000..b1243a29784
--- /dev/null
+++ b/apps/gallery/img/supersized/supersized-logo.png
Binary files differ
diff --git a/apps/gallery/img/supersized/thumb-back.png b/apps/gallery/img/supersized/thumb-back.png
new file mode 100644
index 00000000000..3c969ebd527
--- /dev/null
+++ b/apps/gallery/img/supersized/thumb-back.png
Binary files differ
diff --git a/apps/gallery/img/supersized/thumb-forward.png b/apps/gallery/img/supersized/thumb-forward.png
new file mode 100644
index 00000000000..afe451c75d0
--- /dev/null
+++ b/apps/gallery/img/supersized/thumb-forward.png
Binary files differ
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index b8aadacb47f..ce79f8f8782 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -30,8 +30,14 @@ OCP\App::setActiveNavigationEntry( 'gallery_index' );
OCP\Util::addStyle('files', 'files');
OCP\Util::addStyle('gallery', 'styles');
OCP\Util::addScript('gallery', 'pictures');
+OCP\Util::addStyle( 'gallery', 'supersized' );
+OCP\Util::addStyle( 'gallery', 'supersized.shutter' );
+OCP\Util::addScript('gallery', 'slideshow');
+OCP\Util::addScript('gallery', 'jquery.easing.min');
+OCP\Util::addScript('gallery', 'supersized.3.2.7.min');
+OCP\Util::addScript('gallery', 'supersized.shutter.min');
-include('gallery/lib/tiles.php');
+include 'gallery/lib/tiles.php';
$root = !empty($_GET['root']) ? $_GET['root'] : '/';
$images = \OC_FileCache::searchByMime('image', null, '/'.\OCP\USER::getUser().'/files'.$root);
@@ -97,4 +103,3 @@ $tmpl = new OCP\Template( 'gallery', 'index', 'user' );
$tmpl->assign('root', $root, false);
$tmpl->assign('tl', $tl, false);
$tmpl->printPage();
-?>
diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js
index 413c71471a3..62d3f783ece 100644
--- a/apps/gallery/js/albums.js
+++ b/apps/gallery/js/albums.js
@@ -79,7 +79,7 @@ Albums={
});
element.append(local);
}
- var photoDisplayTemplate = '<div class="gallery_box"><div class="dummy"></div><div><a rel="images" href="'+OC.linkTo('files','download.php')+'?file=URLPATH"><img src="'+OC.filePath('gallery','ajax','thumbnail.php')+'?img=IMGPATH"></a></div></div>';
+ var photoDisplayTemplate = '<div class="gallery_box"><div class="dummy"></div><div><a rel="images" href="'+OC.linkTo('gallery/ajax','viewImage.php')+'?img=URLPATH"><img src="'+OC.filePath('gallery','ajax','thumbnail.php')+'?img=IMGPATH"></a></div></div>';
for (var i in Albums.photos) {
element.append(photoDisplayTemplate.replace("IMGPATH", escape(Albums.photos[i])).replace("URLPATH", escape(Albums.photos[i])));
}
diff --git a/apps/gallery/js/jquery.easing.min.js b/apps/gallery/js/jquery.easing.min.js
new file mode 100644
index 00000000000..bbf8410391a
--- /dev/null
+++ b/apps/gallery/js/jquery.easing.min.js
@@ -0,0 +1,71 @@
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright å© 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright å© 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */ \ No newline at end of file
diff --git a/apps/gallery/js/slideshow.js b/apps/gallery/js/slideshow.js
new file mode 100644
index 00000000000..88e89f39ff0
--- /dev/null
+++ b/apps/gallery/js/slideshow.js
@@ -0,0 +1,58 @@
+$(document).ready(function(){
+
+ $.endSlideshow = function () {
+ if($.supersized.vars.slideshow_interval){
+ clearInterval($.supersized.vars.slideshow_interval);
+ };
+
+ $('#supersized-holder').remove();
+ $('#slideshow-content').hide();
+ $('#thumb-list').remove();
+ }
+
+ // add slideshow in holder div
+ $('#slideshow input.start').click(function(){
+
+ var images=[];
+ $('#gallerycontent div a').each(function(i,a){
+ images.push({image : a.href, title : a.title, thumb : a.children[0].src, url : 'javascript:$.endSlideshow()'});
+ });
+
+ if (images.length <= 0) {
+ return;
+ }
+
+ $('body').append("<div id='supersized-holder'></div>");
+ $('#supersized-loader').remove();
+ $('#supersized').remove();
+ $('#supersized-holder').append("<div id='supersized-loader'></div><ul id='supersized'></ul>");
+ $('#supersized').show();
+ $('#slideshow-content').show();
+
+
+ jQuery(function($){
+
+ $.supersized({
+
+ // Functionality
+ slide_interval : 3000, // Length between transitions
+ transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
+ transition_speed : 700, // Speed of transition
+
+ // Components
+ slide_links : 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
+ slides : images // Slideshow Images
+
+ });
+ });
+
+ });
+
+ //close slideshow on esc and remove holder
+ $(document).keyup(function(e) {
+ if (e.keyCode == 27) { // esc
+ $.endSlideshow();
+ }
+ });
+
+});
diff --git a/apps/gallery/js/supersized.3.2.7.js b/apps/gallery/js/supersized.3.2.7.js
new file mode 100644
index 00000000000..f5a1c0bbc2d
--- /dev/null
+++ b/apps/gallery/js/supersized.3.2.7.js
@@ -0,0 +1,930 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Site : www.buildinternet.com/project/supersized
+
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+
+(function($){
+
+ /* Place Supersized Elements
+ ----------------------------*/
+ $(document).ready(function() {
+ $('body').append('<div id="supersized-loader"></div><ul id="supersized"></ul>');
+ });
+
+
+ $.supersized = function(options){
+
+ /* Variables
+ ----------------------------*/
+ var el = '#supersized',
+ base = this;
+ // Access to jQuery and DOM versions of element
+ base.$el = $(el);
+ base.el = el;
+ vars = $.supersized.vars;
+ // Add a reverse reference to the DOM object
+ base.$el.data("supersized", base);
+ api = base.$el.data('supersized');
+
+ base.init = function(){
+ // Combine options and vars
+ $.supersized.vars = $.extend($.supersized.vars, $.supersized.themeVars);
+ $.supersized.vars.options = $.extend({},$.supersized.defaultOptions, $.supersized.themeOptions, options);
+ base.options = $.supersized.vars.options;
+
+ base._build();
+ };
+
+
+ /* Build Elements
+ ----------------------------*/
+ base._build = function(){
+ // Add in slide markers
+ var thisSlide = 0,
+ slideSet = '',
+ markers = '',
+ markerContent,
+ thumbMarkers = '',
+ thumbImage;
+
+ while(thisSlide <= base.options.slides.length-1){
+ //Determine slide link content
+ switch(base.options.slide_links){
+ case 'num':
+ markerContent = thisSlide;
+ break;
+ case 'name':
+ markerContent = base.options.slides[thisSlide].title;
+ break;
+ case 'blank':
+ markerContent = '';
+ break;
+ }
+
+ slideSet = slideSet+'<li class="slide-'+thisSlide+'"></li>';
+
+ if(thisSlide == base.options.start_slide-1){
+ // Slide links
+ if (base.options.slide_links)markers = markers+'<li class="slide-link-'+thisSlide+' current-slide"><a>'+markerContent+'</a></li>';
+ // Slide Thumbnail Links
+ if (base.options.thumb_links){
+ base.options.slides[thisSlide].thumb ? thumbImage = base.options.slides[thisSlide].thumb : thumbImage = base.options.slides[thisSlide].image;
+ thumbMarkers = thumbMarkers+'<li class="thumb'+thisSlide+' current-thumb"><img src="'+thumbImage+'"/></li>';
+ };
+ }else{
+ // Slide links
+ if (base.options.slide_links) markers = markers+'<li class="slide-link-'+thisSlide+'" ><a>'+markerContent+'</a></li>';
+ // Slide Thumbnail Links
+ if (base.options.thumb_links){
+ base.options.slides[thisSlide].thumb ? thumbImage = base.options.slides[thisSlide].thumb : thumbImage = base.options.slides[thisSlide].image;
+ thumbMarkers = thumbMarkers+'<li class="thumb'+thisSlide+'"><img src="'+thumbImage+'"/></li>';
+ };
+ }
+ thisSlide++;
+ }
+
+ if (base.options.slide_links) $(vars.slide_list).html(markers);
+ if (base.options.thumb_links && vars.thumb_tray.length){
+ $(vars.thumb_tray).append('<ul id="'+vars.thumb_list.replace('#','')+'">'+thumbMarkers+'</ul>');
+ }
+
+ $(base.el).append(slideSet);
+
+ // Add in thumbnails
+ if (base.options.thumbnail_navigation){
+ // Load previous thumbnail
+ vars.current_slide - 1 < 0 ? prevThumb = base.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
+ $(vars.prev_thumb).show().html($("<img/>").attr("src", base.options.slides[prevThumb].image));
+
+ // Load next thumbnail
+ vars.current_slide == base.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
+ $(vars.next_thumb).show().html($("<img/>").attr("src", base.options.slides[nextThumb].image));
+ }
+
+ base._start(); // Get things started
+ };
+
+
+ /* Initialize
+ ----------------------------*/
+ base._start = function(){
+
+ // Determine if starting slide random
+ if (base.options.start_slide){
+ vars.current_slide = base.options.start_slide - 1;
+ }else{
+ vars.current_slide = Math.floor(Math.random()*base.options.slides.length); // Generate random slide number
+ }
+
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+
+ // Set slideshow quality (Supported only in FF and IE, no Webkit)
+ if (base.options.performance == 3){
+ base.$el.addClass('speed'); // Faster transitions
+ } else if ((base.options.performance == 1) || (base.options.performance == 2)){
+ base.$el.addClass('quality'); // Higher image quality
+ }
+
+ // Shuffle slide order if needed
+ if (base.options.random){
+ arr = base.options.slides;
+ for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x); // Fisher-Yates shuffle algorithm (jsfromhell.com/array/shuffle)
+ base.options.slides = arr;
+ }
+
+ /*-----Load initial set of images-----*/
+
+ if (base.options.slides.length > 1){
+ if(base.options.slides.length > 2){
+ // Set previous image
+ vars.current_slide - 1 < 0 ? loadPrev = base.options.slides.length - 1 : loadPrev = vars.current_slide - 1; // If slide is 1, load last slide as previous
+ var imageLink = (base.options.slides[loadPrev].url) ? "href='" + base.options.slides[loadPrev].url + "'" : "";
+
+ var imgPrev = $('<img src="'+base.options.slides[loadPrev].image+'"/>');
+ var slidePrev = base.el+' li:eq('+loadPrev+')';
+ imgPrev.appendTo(slidePrev).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading prevslide');
+
+ imgPrev.load(function(){
+ $(this).data('origWidth', $(this).width()).data('origHeight', $(this).height());
+ base.resizeNow(); // Resize background image
+ }); // End Load
+ }
+ } else {
+ // Slideshow turned off if there is only one slide
+ base.options.slideshow = 0;
+ }
+
+ // Set current image
+ imageLink = (api.getField('url')) ? "href='" + api.getField('url') + "'" : "";
+ var img = $('<img src="'+api.getField('image')+'"/>');
+
+ var slideCurrent= base.el+' li:eq('+vars.current_slide+')';
+ img.appendTo(slideCurrent).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading activeslide');
+
+ img.load(function(){
+ base._origDim($(this));
+ base.resizeNow(); // Resize background image
+ base.launch();
+ if( typeof theme != 'undefined' && typeof theme._init == "function" ) theme._init(); // Load Theme
+ });
+
+ if (base.options.slides.length > 1){
+ // Set next image
+ vars.current_slide == base.options.slides.length - 1 ? loadNext = 0 : loadNext = vars.current_slide + 1; // If slide is last, load first slide as next
+ imageLink = (base.options.slides[loadNext].url) ? "href='" + base.options.slides[loadNext].url + "'" : "";
+
+ var imgNext = $('<img src="'+base.options.slides[loadNext].image+'"/>');
+ var slideNext = base.el+' li:eq('+loadNext+')';
+ imgNext.appendTo(slideNext).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading');
+
+ imgNext.load(function(){
+ $(this).data('origWidth', $(this).width()).data('origHeight', $(this).height());
+ base.resizeNow(); // Resize background image
+ }); // End Load
+ }
+ /*-----End load initial images-----*/
+
+ // Hide elements to be faded in
+ base.$el.css('visibility','hidden');
+ $('.load-item').hide();
+
+ };
+
+
+ /* Launch Supersized
+ ----------------------------*/
+ base.launch = function(){
+
+ base.$el.css('visibility','visible');
+ $('#supersized-loader').remove(); //Hide loading animation
+
+ // Call theme function for before slide transition
+ if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('next');
+ $('.load-item').show();
+
+ // Keyboard Navigation
+ if (base.options.keyboard_nav){
+ $(document.documentElement).keyup(function (event) {
+
+ if(vars.in_animation) return false; // Abort if currently animating
+
+ // Left Arrow or Down Arrow
+ if ((event.keyCode == 37) || (event.keyCode == 40)) {
+ clearInterval(vars.slideshow_interval); // Stop slideshow, prevent buildup
+ base.prevSlide();
+
+ // Right Arrow or Up Arrow
+ } else if ((event.keyCode == 39) || (event.keyCode == 38)) {
+ clearInterval(vars.slideshow_interval); // Stop slideshow, prevent buildup
+ base.nextSlide();
+
+ // Spacebar
+ } else if (event.keyCode == 32 && !vars.hover_pause) {
+ clearInterval(vars.slideshow_interval); // Stop slideshow, prevent buildup
+ base.playToggle();
+ }
+
+ });
+ }
+
+ // Pause when hover on image
+ if (base.options.slideshow && base.options.pause_hover){
+ $(base.el).hover(function() {
+ if(vars.in_animation) return false; // Abort if currently animating
+ vars.hover_pause = true; // Mark slideshow paused from hover
+ if(!vars.is_paused){
+ vars.hover_pause = 'resume'; // It needs to resume afterwards
+ base.playToggle();
+ }
+ }, function() {
+ if(vars.hover_pause == 'resume'){
+ base.playToggle();
+ vars.hover_pause = false;
+ }
+ });
+ }
+
+ if (base.options.slide_links){
+ // Slide marker clicked
+ $(vars.slide_list+'> li').click(function(){
+
+ index = $(vars.slide_list+'> li').index(this);
+ targetSlide = index + 1;
+
+ base.goTo(targetSlide);
+ return false;
+
+ });
+ }
+
+ // Thumb marker clicked
+ if (base.options.thumb_links){
+ $(vars.thumb_list+'> li').click(function(){
+
+ index = $(vars.thumb_list+'> li').index(this);
+ targetSlide = index + 1;
+
+ api.goTo(targetSlide);
+ return false;
+
+ });
+ }
+
+ // Start slideshow if enabled
+ if (base.options.slideshow && base.options.slides.length > 1){
+
+ // Start slideshow if autoplay enabled
+ if (base.options.autoplay && base.options.slides.length > 1){
+ vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval); // Initiate slide interval
+ }else{
+ vars.is_paused = true; // Mark as paused
+ }
+
+ //Prevent navigation items from being dragged
+ $('.load-item img').bind("contextmenu mousedown",function(){
+ return false;
+ });
+
+ }
+
+ // Adjust image when browser is resized
+ $(window).resize(function(){
+ base.resizeNow();
+ });
+
+ };
+
+
+ /* Resize Images
+ ----------------------------*/
+ base.resizeNow = function(){
+
+ return base.$el.each(function() {
+ // Resize each image seperately
+ $('img', base.el).each(function(){
+
+ thisSlide = $(this);
+ var ratio = (thisSlide.data('origHeight')/thisSlide.data('origWidth')).toFixed(2); // Define image ratio
+
+ // Gather browser size
+ var browserwidth = base.$el.width(),
+ browserheight = base.$el.height(),
+ offset;
+
+ /*-----Resize Image-----*/
+ if (base.options.fit_always){ // Fit always is enabled
+ if ((browserheight/browserwidth) > ratio){
+ resizeWidth();
+ } else {
+ resizeHeight();
+ }
+ }else{ // Normal Resize
+ if ((browserheight <= base.options.min_height) && (browserwidth <= base.options.min_width)){ // If window smaller than minimum width and height
+
+ if ((browserheight/browserwidth) > ratio){
+ base.options.fit_landscape && ratio < 1 ? resizeWidth(true) : resizeHeight(true); // If landscapes are set to fit
+ } else {
+ base.options.fit_portrait && ratio >= 1 ? resizeHeight(true) : resizeWidth(true); // If portraits are set to fit
+ }
+
+ } else if (browserwidth <= base.options.min_width){ // If window only smaller than minimum width
+
+ if ((browserheight/browserwidth) > ratio){
+ base.options.fit_landscape && ratio < 1 ? resizeWidth(true) : resizeHeight(); // If landscapes are set to fit
+ } else {
+ base.options.fit_portrait && ratio >= 1 ? resizeHeight() : resizeWidth(true); // If portraits are set to fit
+ }
+
+ } else if (browserheight <= base.options.min_height){ // If window only smaller than minimum height
+
+ if ((browserheight/browserwidth) > ratio){
+ base.options.fit_landscape && ratio < 1 ? resizeWidth() : resizeHeight(true); // If landscapes are set to fit
+ } else {
+ base.options.fit_portrait && ratio >= 1 ? resizeHeight(true) : resizeWidth(); // If portraits are set to fit
+ }
+
+ } else { // If larger than minimums
+
+ if ((browserheight/browserwidth) > ratio){
+ base.options.fit_landscape && ratio < 1 ? resizeWidth() : resizeHeight(); // If landscapes are set to fit
+ } else {
+ base.options.fit_portrait && ratio >= 1 ? resizeHeight() : resizeWidth(); // If portraits are set to fit
+ }
+
+ }
+ }
+ /*-----End Image Resize-----*/
+
+
+ /*-----Resize Functions-----*/
+
+ function resizeWidth(minimum){
+ if (minimum){ // If minimum height needs to be considered
+ if(thisSlide.width() < browserwidth || thisSlide.width() < base.options.min_width ){
+ if (thisSlide.width() * ratio >= base.options.min_height){
+ thisSlide.width(base.options.min_width);
+ thisSlide.height(thisSlide.width() * ratio);
+ }else{
+ resizeHeight();
+ }
+ }
+ }else{
+ if (base.options.min_height >= browserheight && !base.options.fit_landscape){ // If minimum height needs to be considered
+ if (browserwidth * ratio >= base.options.min_height || (browserwidth * ratio >= base.options.min_height && ratio <= 1)){ // If resizing would push below minimum height or image is a landscape
+ thisSlide.width(browserwidth);
+ thisSlide.height(browserwidth * ratio);
+ } else if (ratio > 1){ // Else the image is portrait
+ thisSlide.height(base.options.min_height);
+ thisSlide.width(thisSlide.height() / ratio);
+ } else if (thisSlide.width() < browserwidth) {
+ thisSlide.width(browserwidth);
+ thisSlide.height(thisSlide.width() * ratio);
+ }
+ }else{ // Otherwise, resize as normal
+ thisSlide.width(browserwidth);
+ thisSlide.height(browserwidth * ratio);
+ }
+ }
+ };
+
+ function resizeHeight(minimum){
+ if (minimum){ // If minimum height needs to be considered
+ if(thisSlide.height() < browserheight){
+ if (thisSlide.height() / ratio >= base.options.min_width){
+ thisSlide.height(base.options.min_height);
+ thisSlide.width(thisSlide.height() / ratio);
+ }else{
+ resizeWidth(true);
+ }
+ }
+ }else{ // Otherwise, resized as normal
+ if (base.options.min_width >= browserwidth){ // If minimum width needs to be considered
+ if (browserheight / ratio >= base.options.min_width || ratio > 1){ // If resizing would push below minimum width or image is a portrait
+ thisSlide.height(browserheight);
+ thisSlide.width(browserheight / ratio);
+ } else if (ratio <= 1){ // Else the image is landscape
+ thisSlide.width(base.options.min_width);
+ thisSlide.height(thisSlide.width() * ratio);
+ }
+ }else{ // Otherwise, resize as normal
+ thisSlide.height(browserheight);
+ thisSlide.width(browserheight / ratio);
+ }
+ }
+ };
+
+ /*-----End Resize Functions-----*/
+
+ if (thisSlide.parents('li').hasClass('image-loading')){
+ $('.image-loading').removeClass('image-loading');
+ }
+
+ // Horizontally Center
+ if (base.options.horizontal_center){
+ $(this).css('left', (browserwidth - $(this).width())/2);
+ }
+
+ // Vertically Center
+ if (base.options.vertical_center){
+ $(this).css('top', (browserheight - $(this).height())/2);
+ }
+
+ });
+
+ // Basic image drag and right click protection
+ if (base.options.image_protect){
+
+ $('img', base.el).bind("contextmenu mousedown",function(){
+ return false;
+ });
+
+ }
+
+ return false;
+
+ });
+
+ };
+
+
+ /* Next Slide
+ ----------------------------*/
+ base.nextSlide = function(){
+
+ if(vars.in_animation || !api.options.slideshow) return false; // Abort if currently animating
+ else vars.in_animation = true; // Otherwise set animation marker
+
+ clearInterval(vars.slideshow_interval); // Stop slideshow
+
+ var slides = base.options.slides, // Pull in slides array
+ liveslide = base.$el.find('.activeslide'); // Find active slide
+ $('.prevslide').removeClass('prevslide');
+ liveslide.removeClass('activeslide').addClass('prevslide'); // Remove active class & update previous slide
+
+ // Get the slide number of new slide
+ vars.current_slide + 1 == base.options.slides.length ? vars.current_slide = 0 : vars.current_slide++;
+
+ var nextslide = $(base.el+' li:eq('+vars.current_slide+')'),
+ prevslide = base.$el.find('.prevslide');
+
+ // If hybrid mode is on drop quality for transition
+ if (base.options.performance == 1) base.$el.removeClass('quality').addClass('speed');
+
+
+ /*-----Load Image-----*/
+
+ loadSlide = false;
+
+ vars.current_slide == base.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1; // Determine next slide
+
+ var targetList = base.el+' li:eq('+loadSlide+')';
+ if (!$(targetList).html()){
+
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+
+ imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : ""; // If link exists, build it
+ var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>');
+
+ img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
+
+ img.load(function(){
+ base._origDim($(this));
+ base.resizeNow();
+ }); // End Load
+ };
+
+ // Update thumbnails (if enabled)
+ if (base.options.thumbnail_navigation == 1){
+
+ // Load previous thumbnail
+ vars.current_slide - 1 < 0 ? prevThumb = base.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
+ $(vars.prev_thumb).html($("<img/>").attr("src", base.options.slides[prevThumb].image));
+
+ // Load next thumbnail
+ nextThumb = loadSlide;
+ $(vars.next_thumb).html($("<img/>").attr("src", base.options.slides[nextThumb].image));
+
+ }
+
+
+
+ /*-----End Load Image-----*/
+
+
+ // Call theme function for before slide transition
+ if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('next');
+
+ //Update slide markers
+ if (base.options.slide_links){
+ $('.current-slide').removeClass('current-slide');
+ $(vars.slide_list +'> li' ).eq(vars.current_slide).addClass('current-slide');
+ }
+
+ nextslide.css('visibility','hidden').addClass('activeslide'); // Update active slide
+
+ switch(base.options.transition){
+ case 0: case 'none': // No transition
+ nextslide.css('visibility','visible'); vars.in_animation = false; base.afterAnimation();
+ break;
+ case 1: case 'fade': // Fade
+ nextslide.animate({opacity : 0},0).css('visibility','visible').animate({opacity : 1, avoidTransforms : false}, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 2: case 'slideTop': // Slide Top
+ nextslide.animate({top : -base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 3: case 'slideRight': // Slide Right
+ nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 4: case 'slideBottom': // Slide Bottom
+ nextslide.animate({top : base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 5: case 'slideLeft': // Slide Left
+ nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 6: case 'carouselRight': // Carousel Right
+ nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ liveslide.animate({ left: -base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
+ break;
+ case 7: case 'carouselLeft': // Carousel Left
+ nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ liveslide.animate({ left: base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
+ break;
+ }
+ return false;
+ };
+
+
+ /* Previous Slide
+ ----------------------------*/
+ base.prevSlide = function(){
+
+ if(vars.in_animation || !api.options.slideshow) return false; // Abort if currently animating
+ else vars.in_animation = true; // Otherwise set animation marker
+
+ clearInterval(vars.slideshow_interval); // Stop slideshow
+
+ var slides = base.options.slides, // Pull in slides array
+ liveslide = base.$el.find('.activeslide'); // Find active slide
+ $('.prevslide').removeClass('prevslide');
+ liveslide.removeClass('activeslide').addClass('prevslide'); // Remove active class & update previous slide
+
+ // Get current slide number
+ vars.current_slide == 0 ? vars.current_slide = base.options.slides.length - 1 : vars.current_slide-- ;
+
+ var nextslide = $(base.el+' li:eq('+vars.current_slide+')'),
+ prevslide = base.$el.find('.prevslide');
+
+ // If hybrid mode is on drop quality for transition
+ if (base.options.performance == 1) base.$el.removeClass('quality').addClass('speed');
+
+
+ /*-----Load Image-----*/
+
+ loadSlide = vars.current_slide;
+
+ var targetList = base.el+' li:eq('+loadSlide+')';
+ if (!$(targetList).html()){
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+ imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : ""; // If link exists, build it
+ var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>');
+
+ img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
+
+ img.load(function(){
+ base._origDim($(this));
+ base.resizeNow();
+ }); // End Load
+ };
+
+ // Update thumbnails (if enabled)
+ if (base.options.thumbnail_navigation == 1){
+
+ // Load previous thumbnail
+ //prevThumb = loadSlide;
+ loadSlide == 0 ? prevThumb = base.options.slides.length - 1 : prevThumb = loadSlide - 1;
+ $(vars.prev_thumb).html($("<img/>").attr("src", base.options.slides[prevThumb].image));
+
+ // Load next thumbnail
+ vars.current_slide == base.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
+ $(vars.next_thumb).html($("<img/>").attr("src", base.options.slides[nextThumb].image));
+ }
+
+ /*-----End Load Image-----*/
+
+
+ // Call theme function for before slide transition
+ if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('prev');
+
+ //Update slide markers
+ if (base.options.slide_links){
+ $('.current-slide').removeClass('current-slide');
+ $(vars.slide_list +'> li' ).eq(vars.current_slide).addClass('current-slide');
+ }
+
+ nextslide.css('visibility','hidden').addClass('activeslide'); // Update active slide
+
+ switch(base.options.transition){
+ case 0: case 'none': // No transition
+ nextslide.css('visibility','visible'); vars.in_animation = false; base.afterAnimation();
+ break;
+ case 1: case 'fade': // Fade
+ nextslide.animate({opacity : 0},0).css('visibility','visible').animate({opacity : 1, avoidTransforms : false}, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 2: case 'slideTop': // Slide Top (reverse)
+ nextslide.animate({top : base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 3: case 'slideRight': // Slide Right (reverse)
+ nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 4: case 'slideBottom': // Slide Bottom (reverse)
+ nextslide.animate({top : -base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 5: case 'slideLeft': // Slide Left (reverse)
+ nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ break;
+ case 6: case 'carouselRight': // Carousel Right (reverse)
+ nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ liveslide.animate({left : 0}, 0 ).animate({ left: base.$el.width(), avoidTransforms : false}, base.options.transition_speed );
+ break;
+ case 7: case 'carouselLeft': // Carousel Left (reverse)
+ nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
+ liveslide.animate({left : 0}, 0 ).animate({ left: -base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
+ break;
+ }
+ return false;
+ };
+
+
+ /* Play/Pause Toggle
+ ----------------------------*/
+ base.playToggle = function(){
+
+ if (vars.in_animation || !api.options.slideshow) return false; // Abort if currently animating
+
+ if (vars.is_paused){
+
+ vars.is_paused = false;
+
+ // Call theme function for play
+ if( typeof theme != 'undefined' && typeof theme.playToggle == "function" ) theme.playToggle('play');
+
+ // Resume slideshow
+ vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
+
+ }else{
+
+ vars.is_paused = true;
+
+ // Call theme function for pause
+ if( typeof theme != 'undefined' && typeof theme.playToggle == "function" ) theme.playToggle('pause');
+
+ // Stop slideshow
+ clearInterval(vars.slideshow_interval);
+
+ }
+
+ return false;
+
+ };
+
+
+ /* Go to specific slide
+ ----------------------------*/
+ base.goTo = function(targetSlide){
+ if (vars.in_animation || !api.options.slideshow) return false; // Abort if currently animating
+
+ var totalSlides = base.options.slides.length;
+
+ // If target outside range
+ if(targetSlide < 0){
+ targetSlide = totalSlides;
+ }else if(targetSlide > totalSlides){
+ targetSlide = 1;
+ }
+ targetSlide = totalSlides - targetSlide + 1;
+
+ clearInterval(vars.slideshow_interval); // Stop slideshow, prevent buildup
+
+ // Call theme function for goTo trigger
+ if (typeof theme != 'undefined' && typeof theme.goTo == "function" ) theme.goTo();
+
+ if (vars.current_slide == totalSlides - targetSlide){
+ if(!(vars.is_paused)){
+ vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
+ }
+ return false;
+ }
+
+ // If ahead of current position
+ if(totalSlides - targetSlide > vars.current_slide ){
+
+ // Adjust for new next slide
+ vars.current_slide = totalSlides-targetSlide-1;
+ vars.update_images = 'next';
+ base._placeSlide(vars.update_images);
+
+ //Otherwise it's before current position
+ }else if(totalSlides - targetSlide < vars.current_slide){
+
+ // Adjust for new prev slide
+ vars.current_slide = totalSlides-targetSlide+1;
+ vars.update_images = 'prev';
+ base._placeSlide(vars.update_images);
+
+ }
+
+ // set active markers
+ if (base.options.slide_links){
+ $(vars.slide_list +'> .current-slide').removeClass('current-slide');
+ $(vars.slide_list +'> li').eq((totalSlides-targetSlide)).addClass('current-slide');
+ }
+
+ if (base.options.thumb_links){
+ $(vars.thumb_list +'> .current-thumb').removeClass('current-thumb');
+ $(vars.thumb_list +'> li').eq((totalSlides-targetSlide)).addClass('current-thumb');
+ }
+
+ };
+
+
+ /* Place Slide
+ ----------------------------*/
+ base._placeSlide = function(place){
+
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+
+ loadSlide = false;
+
+ if (place == 'next'){
+
+ vars.current_slide == base.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1; // Determine next slide
+
+ var targetList = base.el+' li:eq('+loadSlide+')';
+
+ if (!$(targetList).html()){
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+
+ imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : ""; // If link exists, build it
+ var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>');
+
+ img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
+
+ img.load(function(){
+ base._origDim($(this));
+ base.resizeNow();
+ }); // End Load
+ };
+
+ base.nextSlide();
+
+ }else if (place == 'prev'){
+
+ vars.current_slide - 1 < 0 ? loadSlide = base.options.slides.length - 1 : loadSlide = vars.current_slide - 1; // Determine next slide
+
+ var targetList = base.el+' li:eq('+loadSlide+')';
+
+ if (!$(targetList).html()){
+ // If links should open in new window
+ var linkTarget = base.options.new_window ? ' target="_blank"' : '';
+
+ imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : ""; // If link exists, build it
+ var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>');
+
+ img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
+
+ img.load(function(){
+ base._origDim($(this));
+ base.resizeNow();
+ }); // End Load
+ };
+ base.prevSlide();
+ }
+
+ };
+
+
+ /* Get Original Dimensions
+ ----------------------------*/
+ base._origDim = function(targetSlide){
+ targetSlide.data('origWidth', targetSlide.width()).data('origHeight', targetSlide.height());
+ };
+
+
+ /* After Slide Animation
+ ----------------------------*/
+ base.afterAnimation = function(){
+
+ // If hybrid mode is on swap back to higher image quality
+ if (base.options.performance == 1){
+ base.$el.removeClass('speed').addClass('quality');
+ }
+
+ // Update previous slide
+ if (vars.update_images){
+ vars.current_slide - 1 < 0 ? setPrev = base.options.slides.length - 1 : setPrev = vars.current_slide-1;
+ vars.update_images = false;
+ $('.prevslide').removeClass('prevslide');
+ $(base.el+' li:eq('+setPrev+')').addClass('prevslide');
+ }
+
+ vars.in_animation = false;
+
+ // Resume slideshow
+ if (!vars.is_paused && base.options.slideshow){
+ vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
+ if (base.options.stop_loop && vars.current_slide == base.options.slides.length - 1 ) base.playToggle();
+ }
+
+ // Call theme function for after slide transition
+ if (typeof theme != 'undefined' && typeof theme.afterAnimation == "function" ) theme.afterAnimation();
+
+ return false;
+
+ };
+
+ base.getField = function(field){
+ return base.options.slides[vars.current_slide][field];
+ };
+
+ // Make it go!
+ base.init();
+ };
+
+
+ /* Global Variables
+ ----------------------------*/
+ $.supersized.vars = {
+
+ // Elements
+ thumb_tray : '#thumb-tray', // Thumbnail tray
+ thumb_list : '#thumb-list', // Thumbnail list
+ slide_list : '#slide-list', // Slide link list
+
+ // Internal variables
+ current_slide : 0, // Current slide number
+ in_animation : false, // Prevents animations from stacking
+ is_paused : false, // Tracks paused on/off
+ hover_pause : false, // If slideshow is paused from hover
+ slideshow_interval : false, // Stores slideshow timer
+ update_images : false, // Trigger to update images after slide jump
+ options : {} // Stores assembled options list
+
+ };
+
+
+ /* Default Options
+ ----------------------------*/
+ $.supersized.defaultOptions = {
+
+ // Functionality
+ slideshow : 1, // Slideshow on/off
+ autoplay : 1, // Slideshow starts playing automatically
+ start_slide : 1, // Start slide (0 is random)
+ stop_loop : 0, // Stops slideshow on last slide
+ random : 0, // Randomize slide order (Ignores start slide)
+ slide_interval : 5000, // Length between transitions
+ transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
+ transition_speed : 750, // Speed of transition
+ new_window : 1, // Image links open in new window/tab
+ pause_hover : 0, // Pause slideshow on hover
+ keyboard_nav : 1, // Keyboard navigation on/off
+ performance : 1, // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
+ image_protect : 1, // Disables image dragging and right click with Javascript
+
+ // Size & Position
+ fit_always : 0, // Image will never exceed browser width or height (Ignores min. dimensions)
+ fit_landscape : 0, // Landscape images will not exceed browser width
+ fit_portrait : 1, // Portrait images will not exceed browser height
+ min_width : 0, // Min width allowed (in pixels)
+ min_height : 0, // Min height allowed (in pixels)
+ horizontal_center : 1, // Horizontally center background
+ vertical_center : 1, // Vertically center background
+
+
+ // Components
+ slide_links : 1, // Individual links for each slide (Options: false, 'num', 'name', 'blank')
+ thumb_links : 1, // Individual thumb links for each slide
+ thumbnail_navigation : 0 // Thumbnail navigation
+
+ };
+
+ $.fn.supersized = function(options){
+ return this.each(function(){
+ (new $.supersized(options));
+ });
+ };
+
+})(jQuery);
+
diff --git a/apps/gallery/js/supersized.3.2.7.min.js b/apps/gallery/js/supersized.3.2.7.min.js
new file mode 100644
index 00000000000..b9cea9cee1c
--- /dev/null
+++ b/apps/gallery/js/supersized.3.2.7.min.js
@@ -0,0 +1,13 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Site : www.buildinternet.com/project/supersized
+
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+
+(function(a){a(document).ready(function(){a("body").append('<div id="supersized-loader"></div><ul id="supersized"></ul>')});a.supersized=function(b){var c="#supersized",d=this;d.$el=a(c);d.el=c;vars=a.supersized.vars;d.$el.data("supersized",d);api=d.$el.data("supersized");d.init=function(){a.supersized.vars=a.extend(a.supersized.vars,a.supersized.themeVars);a.supersized.vars.options=a.extend({},a.supersized.defaultOptions,a.supersized.themeOptions,b);d.options=a.supersized.vars.options;d._build()};d._build=function(){var g=0,e="",j="",h,f="",i;while(g<=d.options.slides.length-1){switch(d.options.slide_links){case"num":h=g;break;case"name":h=d.options.slides[g].title;break;case"blank":h="";break}e=e+'<li class="slide-'+g+'"></li>';if(g==d.options.start_slide-1){if(d.options.slide_links){j=j+'<li class="slide-link-'+g+' current-slide"><a>'+h+"</a></li>"}if(d.options.thumb_links){d.options.slides[g].thumb?i=d.options.slides[g].thumb:i=d.options.slides[g].image;f=f+'<li class="thumb'+g+' current-thumb"><img src="'+i+'"/></li>'}}else{if(d.options.slide_links){j=j+'<li class="slide-link-'+g+'" ><a>'+h+"</a></li>"}if(d.options.thumb_links){d.options.slides[g].thumb?i=d.options.slides[g].thumb:i=d.options.slides[g].image;f=f+'<li class="thumb'+g+'"><img src="'+i+'"/></li>'}}g++}if(d.options.slide_links){a(vars.slide_list).html(j)}if(d.options.thumb_links&&vars.thumb_tray.length){a(vars.thumb_tray).append('<ul id="'+vars.thumb_list.replace("#","")+'">'+f+"</ul>")}a(d.el).append(e);if(d.options.thumbnail_navigation){vars.current_slide-1<0?prevThumb=d.options.slides.length-1:prevThumb=vars.current_slide-1;a(vars.prev_thumb).show().html(a("<img/>").attr("src",d.options.slides[prevThumb].image));vars.current_slide==d.options.slides.length-1?nextThumb=0:nextThumb=vars.current_slide+1;a(vars.next_thumb).show().html(a("<img/>").attr("src",d.options.slides[nextThumb].image))}d._start()};d._start=function(){if(d.options.start_slide){vars.current_slide=d.options.start_slide-1}else{vars.current_slide=Math.floor(Math.random()*d.options.slides.length)}var o=d.options.new_window?' target="_blank"':"";if(d.options.performance==3){d.$el.addClass("speed")}else{if((d.options.performance==1)||(d.options.performance==2)){d.$el.addClass("quality")}}if(d.options.random){arr=d.options.slides;for(var h,m,k=arr.length;k;h=parseInt(Math.random()*k),m=arr[--k],arr[k]=arr[h],arr[h]=m){}d.options.slides=arr}if(d.options.slides.length>1){if(d.options.slides.length>2){vars.current_slide-1<0?loadPrev=d.options.slides.length-1:loadPrev=vars.current_slide-1;var g=(d.options.slides[loadPrev].url)?"href='"+d.options.slides[loadPrev].url+"'":"";var q=a('<img src="'+d.options.slides[loadPrev].image+'"/>');var n=d.el+" li:eq("+loadPrev+")";q.appendTo(n).wrap("<a "+g+o+"></a>").parent().parent().addClass("image-loading prevslide");q.load(function(){a(this).data("origWidth",a(this).width()).data("origHeight",a(this).height());d.resizeNow()})}}else{d.options.slideshow=0}g=(api.getField("url"))?"href='"+api.getField("url")+"'":"";var l=a('<img src="'+api.getField("image")+'"/>');var f=d.el+" li:eq("+vars.current_slide+")";l.appendTo(f).wrap("<a "+g+o+"></a>").parent().parent().addClass("image-loading activeslide");l.load(function(){d._origDim(a(this));d.resizeNow();d.launch();if(typeof theme!="undefined"&&typeof theme._init=="function"){theme._init()}});if(d.options.slides.length>1){vars.current_slide==d.options.slides.length-1?loadNext=0:loadNext=vars.current_slide+1;g=(d.options.slides[loadNext].url)?"href='"+d.options.slides[loadNext].url+"'":"";var e=a('<img src="'+d.options.slides[loadNext].image+'"/>');var p=d.el+" li:eq("+loadNext+")";e.appendTo(p).wrap("<a "+g+o+"></a>").parent().parent().addClass("image-loading");e.load(function(){a(this).data("origWidth",a(this).width()).data("origHeight",a(this).height());d.resizeNow()})}d.$el.css("visibility","hidden");a(".load-item").hide()};d.launch=function(){d.$el.css("visibility","visible");a("#supersized-loader").remove();if(typeof theme!="undefined"&&typeof theme.beforeAnimation=="function"){theme.beforeAnimation("next")}a(".load-item").show();if(d.options.keyboard_nav){a(document.documentElement).keyup(function(e){if(vars.in_animation){return false}if((e.keyCode==37)||(e.keyCode==40)){clearInterval(vars.slideshow_interval);d.prevSlide()}else{if((e.keyCode==39)||(e.keyCode==38)){clearInterval(vars.slideshow_interval);d.nextSlide()}else{if(e.keyCode==32&&!vars.hover_pause){clearInterval(vars.slideshow_interval);d.playToggle()}}}})}if(d.options.slideshow&&d.options.pause_hover){a(d.el).hover(function(){if(vars.in_animation){return false}vars.hover_pause=true;if(!vars.is_paused){vars.hover_pause="resume";d.playToggle()}},function(){if(vars.hover_pause=="resume"){d.playToggle();vars.hover_pause=false}})}if(d.options.slide_links){a(vars.slide_list+"> li").click(function(){index=a(vars.slide_list+"> li").index(this);targetSlide=index+1;d.goTo(targetSlide);return false})}if(d.options.thumb_links){a(vars.thumb_list+"> li").click(function(){index=a(vars.thumb_list+"> li").index(this);targetSlide=index+1;api.goTo(targetSlide);return false})}if(d.options.slideshow&&d.options.slides.length>1){if(d.options.autoplay&&d.options.slides.length>1){vars.slideshow_interval=setInterval(d.nextSlide,d.options.slide_interval)}else{vars.is_paused=true}a(".load-item img").bind("contextmenu mousedown",function(){return false})}a(window).resize(function(){d.resizeNow()})};d.resizeNow=function(){return d.$el.each(function(){a("img",d.el).each(function(){thisSlide=a(this);var f=(thisSlide.data("origHeight")/thisSlide.data("origWidth")).toFixed(2);var e=d.$el.width(),h=d.$el.height(),i;if(d.options.fit_always){if((h/e)>f){g()}else{j()}}else{if((h<=d.options.min_height)&&(e<=d.options.min_width)){if((h/e)>f){d.options.fit_landscape&&f<1?g(true):j(true)}else{d.options.fit_portrait&&f>=1?j(true):g(true)}}else{if(e<=d.options.min_width){if((h/e)>f){d.options.fit_landscape&&f<1?g(true):j()}else{d.options.fit_portrait&&f>=1?j():g(true)}}else{if(h<=d.options.min_height){if((h/e)>f){d.options.fit_landscape&&f<1?g():j(true)}else{d.options.fit_portrait&&f>=1?j(true):g()}}else{if((h/e)>f){d.options.fit_landscape&&f<1?g():j()}else{d.options.fit_portrait&&f>=1?j():g()}}}}}function g(k){if(k){if(thisSlide.width()<e||thisSlide.width()<d.options.min_width){if(thisSlide.width()*f>=d.options.min_height){thisSlide.width(d.options.min_width);thisSlide.height(thisSlide.width()*f)}else{j()}}}else{if(d.options.min_height>=h&&!d.options.fit_landscape){if(e*f>=d.options.min_height||(e*f>=d.options.min_height&&f<=1)){thisSlide.width(e);thisSlide.height(e*f)}else{if(f>1){thisSlide.height(d.options.min_height);thisSlide.width(thisSlide.height()/f)}else{if(thisSlide.width()<e){thisSlide.width(e);thisSlide.height(thisSlide.width()*f)}}}}else{thisSlide.width(e);thisSlide.height(e*f)}}}function j(k){if(k){if(thisSlide.height()<h){if(thisSlide.height()/f>=d.options.min_width){thisSlide.height(d.options.min_height);thisSlide.width(thisSlide.height()/f)}else{g(true)}}}else{if(d.options.min_width>=e){if(h/f>=d.options.min_width||f>1){thisSlide.height(h);thisSlide.width(h/f)}else{if(f<=1){thisSlide.width(d.options.min_width);thisSlide.height(thisSlide.width()*f)}}}else{thisSlide.height(h);thisSlide.width(h/f)}}}if(thisSlide.parents("li").hasClass("image-loading")){a(".image-loading").removeClass("image-loading")}if(d.options.horizontal_center){a(this).css("left",(e-a(this).width())/2)}if(d.options.vertical_center){a(this).css("top",(h-a(this).height())/2)}});if(d.options.image_protect){a("img",d.el).bind("contextmenu mousedown",function(){return false})}return false})};d.nextSlide=function(){if(vars.in_animation||!api.options.slideshow){return false}else{vars.in_animation=true}clearInterval(vars.slideshow_interval);var h=d.options.slides,e=d.$el.find(".activeslide");a(".prevslide").removeClass("prevslide");e.removeClass("activeslide").addClass("prevslide");vars.current_slide+1==d.options.slides.length?vars.current_slide=0:vars.current_slide++;var g=a(d.el+" li:eq("+vars.current_slide+")"),i=d.$el.find(".prevslide");if(d.options.performance==1){d.$el.removeClass("quality").addClass("speed")}loadSlide=false;vars.current_slide==d.options.slides.length-1?loadSlide=0:loadSlide=vars.current_slide+1;var k=d.el+" li:eq("+loadSlide+")";if(!a(k).html()){var j=d.options.new_window?' target="_blank"':"";imageLink=(d.options.slides[loadSlide].url)?"href='"+d.options.slides[loadSlide].url+"'":"";var f=a('<img src="'+d.options.slides[loadSlide].image+'"/>');f.appendTo(k).wrap("<a "+imageLink+j+"></a>").parent().parent().addClass("image-loading").css("visibility","hidden");f.load(function(){d._origDim(a(this));d.resizeNow()})}if(d.options.thumbnail_navigation==1){vars.current_slide-1<0?prevThumb=d.options.slides.length-1:prevThumb=vars.current_slide-1;a(vars.prev_thumb).html(a("<img/>").attr("src",d.options.slides[prevThumb].image));nextThumb=loadSlide;a(vars.next_thumb).html(a("<img/>").attr("src",d.options.slides[nextThumb].image))}if(typeof theme!="undefined"&&typeof theme.beforeAnimation=="function"){theme.beforeAnimation("next")}if(d.options.slide_links){a(".current-slide").removeClass("current-slide");a(vars.slide_list+"> li").eq(vars.current_slide).addClass("current-slide")}g.css("visibility","hidden").addClass("activeslide");switch(d.options.transition){case 0:case"none":g.css("visibility","visible");vars.in_animation=false;d.afterAnimation();break;case 1:case"fade":g.animate({opacity:0},0).css("visibility","visible").animate({opacity:1,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 2:case"slideTop":g.animate({top:-d.$el.height()},0).css("visibility","visible").animate({top:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 3:case"slideRight":g.animate({left:d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 4:case"slideBottom":g.animate({top:d.$el.height()},0).css("visibility","visible").animate({top:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 5:case"slideLeft":g.animate({left:-d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 6:case"carouselRight":g.animate({left:d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});e.animate({left:-d.$el.width(),avoidTransforms:false},d.options.transition_speed);break;case 7:case"carouselLeft":g.animate({left:-d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});e.animate({left:d.$el.width(),avoidTransforms:false},d.options.transition_speed);break}return false};d.prevSlide=function(){if(vars.in_animation||!api.options.slideshow){return false}else{vars.in_animation=true}clearInterval(vars.slideshow_interval);var h=d.options.slides,e=d.$el.find(".activeslide");a(".prevslide").removeClass("prevslide");e.removeClass("activeslide").addClass("prevslide");vars.current_slide==0?vars.current_slide=d.options.slides.length-1:vars.current_slide--;var g=a(d.el+" li:eq("+vars.current_slide+")"),i=d.$el.find(".prevslide");if(d.options.performance==1){d.$el.removeClass("quality").addClass("speed")}loadSlide=vars.current_slide;var k=d.el+" li:eq("+loadSlide+")";if(!a(k).html()){var j=d.options.new_window?' target="_blank"':"";imageLink=(d.options.slides[loadSlide].url)?"href='"+d.options.slides[loadSlide].url+"'":"";var f=a('<img src="'+d.options.slides[loadSlide].image+'"/>');f.appendTo(k).wrap("<a "+imageLink+j+"></a>").parent().parent().addClass("image-loading").css("visibility","hidden");f.load(function(){d._origDim(a(this));d.resizeNow()})}if(d.options.thumbnail_navigation==1){loadSlide==0?prevThumb=d.options.slides.length-1:prevThumb=loadSlide-1;a(vars.prev_thumb).html(a("<img/>").attr("src",d.options.slides[prevThumb].image));vars.current_slide==d.options.slides.length-1?nextThumb=0:nextThumb=vars.current_slide+1;a(vars.next_thumb).html(a("<img/>").attr("src",d.options.slides[nextThumb].image))}if(typeof theme!="undefined"&&typeof theme.beforeAnimation=="function"){theme.beforeAnimation("prev")}if(d.options.slide_links){a(".current-slide").removeClass("current-slide");a(vars.slide_list+"> li").eq(vars.current_slide).addClass("current-slide")}g.css("visibility","hidden").addClass("activeslide");switch(d.options.transition){case 0:case"none":g.css("visibility","visible");vars.in_animation=false;d.afterAnimation();break;case 1:case"fade":g.animate({opacity:0},0).css("visibility","visible").animate({opacity:1,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 2:case"slideTop":g.animate({top:d.$el.height()},0).css("visibility","visible").animate({top:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 3:case"slideRight":g.animate({left:-d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 4:case"slideBottom":g.animate({top:-d.$el.height()},0).css("visibility","visible").animate({top:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 5:case"slideLeft":g.animate({left:d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});break;case 6:case"carouselRight":g.animate({left:-d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});e.animate({left:0},0).animate({left:d.$el.width(),avoidTransforms:false},d.options.transition_speed);break;case 7:case"carouselLeft":g.animate({left:d.$el.width()},0).css("visibility","visible").animate({left:0,avoidTransforms:false},d.options.transition_speed,function(){d.afterAnimation()});e.animate({left:0},0).animate({left:-d.$el.width(),avoidTransforms:false},d.options.transition_speed);break}return false};d.playToggle=function(){if(vars.in_animation||!api.options.slideshow){return false}if(vars.is_paused){vars.is_paused=false;if(typeof theme!="undefined"&&typeof theme.playToggle=="function"){theme.playToggle("play")}vars.slideshow_interval=setInterval(d.nextSlide,d.options.slide_interval)}else{vars.is_paused=true;if(typeof theme!="undefined"&&typeof theme.playToggle=="function"){theme.playToggle("pause")}clearInterval(vars.slideshow_interval)}return false};d.goTo=function(f){if(vars.in_animation||!api.options.slideshow){return false}var e=d.options.slides.length;if(f<0){f=e}else{if(f>e){f=1}}f=e-f+1;clearInterval(vars.slideshow_interval);if(typeof theme!="undefined"&&typeof theme.goTo=="function"){theme.goTo()}if(vars.current_slide==e-f){if(!(vars.is_paused)){vars.slideshow_interval=setInterval(d.nextSlide,d.options.slide_interval)}return false}if(e-f>vars.current_slide){vars.current_slide=e-f-1;vars.update_images="next";d._placeSlide(vars.update_images)}else{if(e-f<vars.current_slide){vars.current_slide=e-f+1;vars.update_images="prev";d._placeSlide(vars.update_images)}}if(d.options.slide_links){a(vars.slide_list+"> .current-slide").removeClass("current-slide");a(vars.slide_list+"> li").eq((e-f)).addClass("current-slide")}if(d.options.thumb_links){a(vars.thumb_list+"> .current-thumb").removeClass("current-thumb");a(vars.thumb_list+"> li").eq((e-f)).addClass("current-thumb")}};d._placeSlide=function(e){var h=d.options.new_window?' target="_blank"':"";loadSlide=false;if(e=="next"){vars.current_slide==d.options.slides.length-1?loadSlide=0:loadSlide=vars.current_slide+1;var g=d.el+" li:eq("+loadSlide+")";if(!a(g).html()){var h=d.options.new_window?' target="_blank"':"";imageLink=(d.options.slides[loadSlide].url)?"href='"+d.options.slides[loadSlide].url+"'":"";var f=a('<img src="'+d.options.slides[loadSlide].image+'"/>');f.appendTo(g).wrap("<a "+imageLink+h+"></a>").parent().parent().addClass("image-loading").css("visibility","hidden");f.load(function(){d._origDim(a(this));d.resizeNow()})}d.nextSlide()}else{if(e=="prev"){vars.current_slide-1<0?loadSlide=d.options.slides.length-1:loadSlide=vars.current_slide-1;var g=d.el+" li:eq("+loadSlide+")";if(!a(g).html()){var h=d.options.new_window?' target="_blank"':"";imageLink=(d.options.slides[loadSlide].url)?"href='"+d.options.slides[loadSlide].url+"'":"";var f=a('<img src="'+d.options.slides[loadSlide].image+'"/>');f.appendTo(g).wrap("<a "+imageLink+h+"></a>").parent().parent().addClass("image-loading").css("visibility","hidden");f.load(function(){d._origDim(a(this));d.resizeNow()})}d.prevSlide()}}};d._origDim=function(e){e.data("origWidth",e.width()).data("origHeight",e.height())};d.afterAnimation=function(){if(d.options.performance==1){d.$el.removeClass("speed").addClass("quality")}if(vars.update_images){vars.current_slide-1<0?setPrev=d.options.slides.length-1:setPrev=vars.current_slide-1;vars.update_images=false;a(".prevslide").removeClass("prevslide");a(d.el+" li:eq("+setPrev+")").addClass("prevslide")}vars.in_animation=false;if(!vars.is_paused&&d.options.slideshow){vars.slideshow_interval=setInterval(d.nextSlide,d.options.slide_interval);if(d.options.stop_loop&&vars.current_slide==d.options.slides.length-1){d.playToggle()}}if(typeof theme!="undefined"&&typeof theme.afterAnimation=="function"){theme.afterAnimation()}return false};d.getField=function(e){return d.options.slides[vars.current_slide][e]};d.init()};a.supersized.vars={thumb_tray:"#thumb-tray",thumb_list:"#thumb-list",slide_list:"#slide-list",current_slide:0,in_animation:false,is_paused:false,hover_pause:false,slideshow_interval:false,update_images:false,options:{}};a.supersized.defaultOptions={slideshow:1,autoplay:1,start_slide:1,stop_loop:0,random:0,slide_interval:5000,transition:1,transition_speed:750,new_window:1,pause_hover:0,keyboard_nav:1,performance:1,image_protect:1,fit_always:0,fit_landscape:0,fit_portrait:1,min_width:0,min_height:0,horizontal_center:1,vertical_center:1,slide_links:1,thumb_links:1,thumbnail_navigation:0};a.fn.supersized=function(b){return this.each(function(){(new a.supersized(b))})}})(jQuery); \ No newline at end of file
diff --git a/apps/gallery/js/supersized.shutter.js b/apps/gallery/js/supersized.shutter.js
new file mode 100644
index 00000000000..cc3025a94a3
--- /dev/null
+++ b/apps/gallery/js/supersized.shutter.js
@@ -0,0 +1,337 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Theme : Shutter 1.1
+
+ Site : www.buildinternet.com/project/supersized
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+
+(function($){
+
+ theme = {
+
+
+ /* Initial Placement
+ ----------------------------*/
+ _init : function(){
+
+ // Center Slide Links
+ if (api.options.slide_links) $(vars.slide_list).css('margin-left', -$(vars.slide_list).width()/2);
+
+ // Start progressbar if autoplay enabled
+ if (api.options.autoplay){
+ if (api.options.progress_bar) theme.progressBar();
+ }else{
+ if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play.png"); // If pause play button is image, swap src
+ if (api.options.progress_bar) $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); // Place progress bar
+ }
+
+
+ /* Thumbnail Tray
+ ----------------------------*/
+ // Hide tray off screen
+ $(vars.thumb_tray).animate({bottom : -$(vars.thumb_tray).height()}, 0 );
+
+ // Thumbnail Tray Toggle
+ $(vars.tray_button).toggle(function(){
+ $(vars.thumb_tray).stop().animate({bottom : 0, avoidTransforms : true}, 300 );
+ if ($(vars.tray_arrow).attr('src')) $(vars.tray_arrow).attr("src", vars.image_path + "button-tray-down.png");
+ return false;
+ }, function() {
+ $(vars.thumb_tray).stop().animate({bottom : -$(vars.thumb_tray).height(), avoidTransforms : true}, 300 );
+ if ($(vars.tray_arrow).attr('src')) $(vars.tray_arrow).attr("src", vars.image_path + "button-tray-up.png");
+ return false;
+ });
+
+ // Make thumb tray proper size
+ $(vars.thumb_list).width($('> li', vars.thumb_list).length * $('> li', vars.thumb_list).outerWidth(true)); //Adjust to true width of thumb markers
+
+ // Display total slides
+ if ($(vars.slide_total).length){
+ $(vars.slide_total).html(api.options.slides.length);
+ }
+
+
+ /* Thumbnail Tray Navigation
+ ----------------------------*/
+ if (api.options.thumb_links){
+ //Hide thumb arrows if not needed
+ if ($(vars.thumb_list).width() <= $(vars.thumb_tray).width()){
+ $(vars.thumb_back +','+vars.thumb_forward).fadeOut(0);
+ }
+
+ // Thumb Intervals
+ vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true);
+ vars.thumb_page = 0;
+
+ // Cycle thumbs forward
+ $(vars.thumb_forward).click(function(){
+ if (vars.thumb_page - vars.thumb_interval <= -$(vars.thumb_list).width()){
+ vars.thumb_page = 0;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }else{
+ vars.thumb_page = vars.thumb_page - vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }
+ });
+
+ // Cycle thumbs backwards
+ $(vars.thumb_back).click(function(){
+ if (vars.thumb_page + vars.thumb_interval > 0){
+ vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval;
+ if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }else{
+ vars.thumb_page = vars.thumb_page + vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }
+ });
+
+ }
+
+
+ /* Navigation Items
+ ----------------------------*/
+ $(vars.next_slide).click(function() {
+ api.nextSlide();
+ });
+
+ $(vars.prev_slide).click(function() {
+ api.prevSlide();
+ });
+
+ // Full Opacity on Hover
+ if(jQuery.support.opacity){
+ $(vars.prev_slide +','+vars.next_slide).mouseover(function() {
+ $(this).stop().animate({opacity:1},100);
+ }).mouseout(function(){
+ $(this).stop().animate({opacity:0.6},100);
+ });
+ }
+
+ if (api.options.thumbnail_navigation){
+ // Next thumbnail clicked
+ $(vars.next_thumb).click(function() {
+ api.nextSlide();
+ });
+ // Previous thumbnail clicked
+ $(vars.prev_thumb).click(function() {
+ api.prevSlide();
+ });
+ }
+
+ $(vars.play_button).click(function() {
+ api.playToggle();
+ });
+
+
+ /* Thumbnail Mouse Scrub
+ ----------------------------*/
+ if (api.options.mouse_scrub){
+ $(vars.thumb_tray).mousemove(function(e) {
+ var containerWidth = $(vars.thumb_tray).width(),
+ listWidth = $(vars.thumb_list).width();
+ if (listWidth > containerWidth){
+ var mousePos = 1,
+ diff = e.pageX - mousePos;
+ if (diff > 10 || diff < -10) {
+ mousePos = e.pageX;
+ newX = (containerWidth - listWidth) * (e.pageX/containerWidth);
+ diff = parseInt(Math.abs(parseInt($(vars.thumb_list).css('left'))-newX )).toFixed(0);
+ $(vars.thumb_list).stop().animate({'left':newX}, {duration:diff*3, easing:'easeOutExpo'});
+ }
+ }
+ });
+ }
+
+
+ /* Window Resize
+ ----------------------------*/
+ $(window).resize(function(){
+
+ // Delay progress bar on resize
+ if (api.options.progress_bar && !vars.in_animation){
+ if (vars.slideshow_interval) clearInterval(vars.slideshow_interval);
+ if (api.options.slides.length - 1 > 0) clearInterval(vars.slideshow_interval);
+
+ $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 );
+
+ if (!vars.progressDelay && api.options.slideshow){
+ // Delay slideshow from resuming so Chrome can refocus images
+ vars.progressDelay = setTimeout(function() {
+ if (!vars.is_paused){
+ theme.progressBar();
+ vars.slideshow_interval = setInterval(api.nextSlide, api.options.slide_interval);
+ }
+ vars.progressDelay = false;
+ }, 1000);
+ }
+ }
+
+ // Thumb Links
+ if (api.options.thumb_links && vars.thumb_tray.length){
+ // Update Thumb Interval & Page
+ vars.thumb_page = 0;
+ vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true);
+
+ // Adjust thumbnail markers
+ if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){
+ $(vars.thumb_back +','+vars.thumb_forward).fadeIn('fast');
+ $(vars.thumb_list).stop().animate({'left':0}, 200);
+ }else{
+ $(vars.thumb_back +','+vars.thumb_forward).fadeOut('fast');
+ }
+
+ }
+ });
+
+
+ },
+
+
+ /* Go To Slide
+ ----------------------------*/
+ goTo : function(){
+ if (api.options.progress_bar && !vars.is_paused){
+ $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 );
+ theme.progressBar();
+ }
+ },
+
+ /* Play & Pause Toggle
+ ----------------------------*/
+ playToggle : function(state){
+
+ if (state =='play'){
+ // If image, swap to pause
+ if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "pause.png");
+ if (api.options.progress_bar && !vars.is_paused) theme.progressBar();
+ }else if (state == 'pause'){
+ // If image, swap to play
+ if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play.png");
+ if (api.options.progress_bar && vars.is_paused)$(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 );
+ }
+
+ },
+
+
+ /* Before Slide Transition
+ ----------------------------*/
+ beforeAnimation : function(direction){
+ if (api.options.progress_bar && !vars.is_paused) $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 );
+
+ /* Update Fields
+ ----------------------------*/
+ // Update slide caption
+ if ($(vars.slide_caption).length){
+ (api.getField('title')) ? $(vars.slide_caption).html(api.getField('title')) : $(vars.slide_caption).html('');
+ }
+ // Update slide number
+ if (vars.slide_current.length){
+ $(vars.slide_current).html(vars.current_slide + 1);
+ }
+
+
+ // Highlight current thumbnail and adjust row position
+ if (api.options.thumb_links){
+
+ $('.current-thumb').removeClass('current-thumb');
+ $('li', vars.thumb_list).eq(vars.current_slide).addClass('current-thumb');
+
+ // If thumb out of view
+ if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){
+ // If next slide direction
+ if (direction == 'next'){
+ if (vars.current_slide == 0){
+ vars.thumb_page = 0;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left >= vars.thumb_interval){
+ vars.thumb_page = vars.thumb_page - vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }
+ // If previous slide direction
+ }else if(direction == 'prev'){
+ if (vars.current_slide == api.options.slides.length - 1){
+ vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval;
+ if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left < 0){
+ if (vars.thumb_page + vars.thumb_interval > 0) return false;
+ vars.thumb_page = vars.thumb_page + vars.thumb_interval;
+ $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'});
+ }
+ }
+ }
+
+
+ }
+
+ },
+
+
+ /* After Slide Transition
+ ----------------------------*/
+ afterAnimation : function(){
+ if (api.options.progress_bar && !vars.is_paused) theme.progressBar(); // Start progress bar
+ },
+
+
+ /* Progress Bar
+ ----------------------------*/
+ progressBar : function(){
+ $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ).animate({left:0}, api.options.slide_interval);
+ }
+
+
+ };
+
+
+ /* Theme Specific Variables
+ ----------------------------*/
+ $.supersized.themeVars = {
+
+ // Internal Variables
+ progress_delay : false, // Delay after resize before resuming slideshow
+ thumb_page : false, // Thumbnail page
+ thumb_interval : false, // Thumbnail interval
+ image_path : OC.webroot+"/apps/gallery/img/supersized/", // Default image path
+
+ // General Elements
+ play_button : '#pauseplay', // Play/Pause button
+ next_slide : '#nextslide', // Next slide button
+ prev_slide : '#prevslide', // Prev slide button
+ next_thumb : '#nextthumb', // Next slide thumb button
+ prev_thumb : '#prevthumb', // Prev slide thumb button
+
+ slide_caption : '#slidecaption', // Slide caption
+ slide_current : '.slidenumber', // Current slide number
+ slide_total : '.totalslides', // Total Slides
+ slide_list : '#slide-list', // Slide jump list
+
+ thumb_tray : '#thumb-tray', // Thumbnail tray
+ thumb_list : '#thumb-list', // Thumbnail list
+ thumb_forward : '#thumb-forward', // Cycles forward through thumbnail list
+ thumb_back : '#thumb-back', // Cycles backwards through thumbnail list
+ tray_arrow : '#tray-arrow', // Thumbnail tray button arrow
+ tray_button : '#tray-button', // Thumbnail tray button
+
+ progress_bar : '#progress-bar' // Progress bar
+
+ };
+
+ /* Theme Specific Options
+ ----------------------------*/
+ $.supersized.themeOptions = {
+
+ progress_bar : 1, // Timer for each slide
+ mouse_scrub : 0 // Thumbnails move with mouse
+
+ };
+
+
+})(jQuery);
diff --git a/apps/gallery/js/supersized.shutter.min.js b/apps/gallery/js/supersized.shutter.min.js
new file mode 100644
index 00000000000..52ea4a3384a
--- /dev/null
+++ b/apps/gallery/js/supersized.shutter.min.js
@@ -0,0 +1,14 @@
+/*
+
+ Supersized - Fullscreen Slideshow jQuery Plugin
+ Version : 3.2.7
+ Theme : Shutter 1.1
+
+ Site : www.buildinternet.com/project/supersized
+ Author : Sam Dunn
+ Company : One Mighty Roar (www.onemightyroar.com)
+ License : MIT License / GPL License
+
+*/
+
+(function(a){theme={_init:function(){if(api.options.slide_links){a(vars.slide_list).css("margin-left",-a(vars.slide_list).width()/2)}if(api.options.autoplay){if(api.options.progress_bar){theme.progressBar()}}else{if(a(vars.play_button).attr("src")){a(vars.play_button).attr("src",vars.image_path+"play.png")}if(api.options.progress_bar){a(vars.progress_bar).stop().animate({left:-a(window).width()},0)}}a(vars.thumb_tray).animate({bottom:-a(vars.thumb_tray).height()},0);a(vars.tray_button).toggle(function(){a(vars.thumb_tray).stop().animate({bottom:0,avoidTransforms:true},300);if(a(vars.tray_arrow).attr("src")){a(vars.tray_arrow).attr("src",vars.image_path+"button-tray-down.png")}return false},function(){a(vars.thumb_tray).stop().animate({bottom:-a(vars.thumb_tray).height(),avoidTransforms:true},300);if(a(vars.tray_arrow).attr("src")){a(vars.tray_arrow).attr("src",vars.image_path+"button-tray-up.png")}return false});a(vars.thumb_list).width(a("> li",vars.thumb_list).length*a("> li",vars.thumb_list).outerWidth(true));if(a(vars.slide_total).length){a(vars.slide_total).html(api.options.slides.length)}if(api.options.thumb_links){if(a(vars.thumb_list).width()<=a(vars.thumb_tray).width()){a(vars.thumb_back+","+vars.thumb_forward).fadeOut(0)}vars.thumb_interval=Math.floor(a(vars.thumb_tray).width()/a("> li",vars.thumb_list).outerWidth(true))*a("> li",vars.thumb_list).outerWidth(true);vars.thumb_page=0;a(vars.thumb_forward).click(function(){if(vars.thumb_page-vars.thumb_interval<=-a(vars.thumb_list).width()){vars.thumb_page=0;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}else{vars.thumb_page=vars.thumb_page-vars.thumb_interval;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}});a(vars.thumb_back).click(function(){if(vars.thumb_page+vars.thumb_interval>0){vars.thumb_page=Math.floor(a(vars.thumb_list).width()/vars.thumb_interval)*-vars.thumb_interval;if(a(vars.thumb_list).width()<=-vars.thumb_page){vars.thumb_page=vars.thumb_page+vars.thumb_interval}a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}else{vars.thumb_page=vars.thumb_page+vars.thumb_interval;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}})}a(vars.next_slide).click(function(){api.nextSlide()});a(vars.prev_slide).click(function(){api.prevSlide()});if(jQuery.support.opacity){a(vars.prev_slide+","+vars.next_slide).mouseover(function(){a(this).stop().animate({opacity:1},100)}).mouseout(function(){a(this).stop().animate({opacity:0.6},100)})}if(api.options.thumbnail_navigation){a(vars.next_thumb).click(function(){api.nextSlide()});a(vars.prev_thumb).click(function(){api.prevSlide()})}a(vars.play_button).click(function(){api.playToggle()});if(api.options.mouse_scrub){a(vars.thumb_tray).mousemove(function(f){var c=a(vars.thumb_tray).width(),g=a(vars.thumb_list).width();if(g>c){var b=1,d=f.pageX-b;if(d>10||d<-10){b=f.pageX;newX=(c-g)*(f.pageX/c);d=parseInt(Math.abs(parseInt(a(vars.thumb_list).css("left"))-newX)).toFixed(0);a(vars.thumb_list).stop().animate({left:newX},{duration:d*3,easing:"easeOutExpo"})}}})}a(window).resize(function(){if(api.options.progress_bar&&!vars.in_animation){if(vars.slideshow_interval){clearInterval(vars.slideshow_interval)}if(api.options.slides.length-1>0){clearInterval(vars.slideshow_interval)}a(vars.progress_bar).stop().animate({left:-a(window).width()},0);if(!vars.progressDelay&&api.options.slideshow){vars.progressDelay=setTimeout(function(){if(!vars.is_paused){theme.progressBar();vars.slideshow_interval=setInterval(api.nextSlide,api.options.slide_interval)}vars.progressDelay=false},1000)}}if(api.options.thumb_links&&vars.thumb_tray.length){vars.thumb_page=0;vars.thumb_interval=Math.floor(a(vars.thumb_tray).width()/a("> li",vars.thumb_list).outerWidth(true))*a("> li",vars.thumb_list).outerWidth(true);if(a(vars.thumb_list).width()>a(vars.thumb_tray).width()){a(vars.thumb_back+","+vars.thumb_forward).fadeIn("fast");a(vars.thumb_list).stop().animate({left:0},200)}else{a(vars.thumb_back+","+vars.thumb_forward).fadeOut("fast")}}})},goTo:function(b){if(api.options.progress_bar&&!vars.is_paused){a(vars.progress_bar).stop().animate({left:-a(window).width()},0);theme.progressBar()}},playToggle:function(b){if(b=="play"){if(a(vars.play_button).attr("src")){a(vars.play_button).attr("src",vars.image_path+"pause.png")}if(api.options.progress_bar&&!vars.is_paused){theme.progressBar()}}else{if(b=="pause"){if(a(vars.play_button).attr("src")){a(vars.play_button).attr("src",vars.image_path+"play.png")}if(api.options.progress_bar&&vars.is_paused){a(vars.progress_bar).stop().animate({left:-a(window).width()},0)}}}},beforeAnimation:function(b){if(api.options.progress_bar&&!vars.is_paused){a(vars.progress_bar).stop().animate({left:-a(window).width()},0)}if(a(vars.slide_caption).length){(api.getField("title"))?a(vars.slide_caption).html(api.getField("title")):a(vars.slide_caption).html("")}if(vars.slide_current.length){a(vars.slide_current).html(vars.current_slide+1)}if(api.options.thumb_links){a(".current-thumb").removeClass("current-thumb");a("li",vars.thumb_list).eq(vars.current_slide).addClass("current-thumb");if(a(vars.thumb_list).width()>a(vars.thumb_tray).width()){if(b=="next"){if(vars.current_slide==0){vars.thumb_page=0;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}else{if(a(".current-thumb").offset().left-a(vars.thumb_tray).offset().left>=vars.thumb_interval){vars.thumb_page=vars.thumb_page-vars.thumb_interval;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}}}else{if(b=="prev"){if(vars.current_slide==api.options.slides.length-1){vars.thumb_page=Math.floor(a(vars.thumb_list).width()/vars.thumb_interval)*-vars.thumb_interval;if(a(vars.thumb_list).width()<=-vars.thumb_page){vars.thumb_page=vars.thumb_page+vars.thumb_interval}a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}else{if(a(".current-thumb").offset().left-a(vars.thumb_tray).offset().left<0){if(vars.thumb_page+vars.thumb_interval>0){return false}vars.thumb_page=vars.thumb_page+vars.thumb_interval;a(vars.thumb_list).stop().animate({left:vars.thumb_page},{duration:500,easing:"easeOutExpo"})}}}}}}},afterAnimation:function(){if(api.options.progress_bar&&!vars.is_paused){theme.progressBar()}},progressBar:function(){a(vars.progress_bar).stop().animate({left:-a(window).width()},0).animate({left:0},api.options.slide_interval)}};a.supersized.themeVars={progress_delay:false,thumb_page:false,thumb_interval:false,image_path:OC.webroot+"/apps/gallery/img/supersized/",play_button:"#pauseplay",next_slide:"#nextslide",prev_slide:"#prevslide",next_thumb:"#nextthumb",prev_thumb:"#prevthumb",slide_caption:"#slidecaption",slide_current:".slidenumber",slide_total:".totalslides",slide_list:"#slide-list",thumb_tray:"#thumb-tray",thumb_list:"#thumb-list",thumb_forward:"#thumb-forward",thumb_back:"#thumb-back",tray_arrow:"#tray-arrow",tray_button:"#tray-button",progress_bar:"#progress-bar"};a.supersized.themeOptions={progress_bar:1,mouse_scrub:0}})(jQuery);
diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php
index 093979834da..3bafdb5cf4d 100644
--- a/apps/gallery/lib/hooks_handlers.php
+++ b/apps/gallery/lib/hooks_handlers.php
@@ -38,5 +38,3 @@ class OC_Gallery_Hooks_Handlers {
//TODO: implement this
}
}
-
-?>
diff --git a/apps/gallery/lib/images_utils.php b/apps/gallery/lib/images_utils.php
index ac3a383c977..f5e37cf1dee 100644
--- a/apps/gallery/lib/images_utils.php
+++ b/apps/gallery/lib/images_utils.php
@@ -60,5 +60,3 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $
imagedestroy($process);
imagedestroy($myImage);
}
-
-?>
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php
index 17eb741a660..b6ade3d1b1e 100644
--- a/apps/gallery/lib/managers.php
+++ b/apps/gallery/lib/managers.php
@@ -2,7 +2,7 @@
namespace OC\Pictures;
-class DatabaseManager {
+class DatabaseManager {
private static $instance = null;
protected $cache = array();
const TAG = 'DatabaseManager';
@@ -25,6 +25,16 @@ class DatabaseManager {
}
}
+ public function setFileData($path, $width, $height) {
+ $stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
+ $stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height));
+ $ret = array('path' => $path, 'width' => $width, 'height' => $height);
+ unset($image);
+ $dir = dirname($path);
+ $this->cache[$dir][$path] = $ret;
+ return $ret;
+ }
+
public function getFileData($path) {
$gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery';
$path = $gallery_path.$path;
@@ -39,9 +49,7 @@ class DatabaseManager {
if (!$image->loadFromFile($path)) {
return false;
}
- $stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
- $stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height()));
- $ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height());
+ $ret = $this->setFileData($path, $image->width(), $image->height());
unset($image);
$this->cache[$dir][$path] = $ret;
return $ret;
@@ -54,6 +62,7 @@ class ThumbnailsManager {
private static $instance = null;
const TAG = 'ThumbnailManager';
+ const THUMBNAIL_HEIGHT = 150;
public static function getInstance() {
if (self::$instance === null)
@@ -62,9 +71,9 @@ class ThumbnailsManager {
}
public function getThumbnail($path) {
- $gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery';
- if (file_exists($gallery_path.$path)) {
- return new \OC_Image($gallery_path.$path);
+ $gallery_storage = \OCP\Files::getStorage('gallery');
+ if ($gallery_storage->file_exists($path)) {
+ return new \OC_Image($gallery_storage->getLocalFile($path));
}
if (!\OC_Filesystem::file_exists($path)) {
\OC_Log::write(self::TAG, 'File '.$path.' don\'t exists', \OC_Log::WARN);
@@ -73,27 +82,39 @@ class ThumbnailsManager {
$image = new \OC_Image();
$image->loadFromFile(\OC_Filesystem::getLocalFile($path));
if (!$image->valid()) return false;
-
+
$image->fixOrientation();
-
- $ret = $image->preciseResize(floor((150*$image->width())/$image->height()), 150);
+
+ $ret = $image->preciseResize( floor((self::THUMBNAIL_HEIGHT*$image->width())/$image->height()), self::THUMBNAIL_HEIGHT );
if (!$ret) {
\OC_Log::write(self::TAG, 'Couldn\'t resize image', \OC_Log::ERROR);
unset($image);
return false;
}
-
- $image->save($gallery_path.'/'.$path);
+ $l = $gallery_storage->getLocalFile($path);
+
+ $image->save($l);
return $image;
}
-
+
+ public function getThumbnailWidth($image) {
+ return floor((self::THUMBNAIL_HEIGHT*$image->widthTopLeft())/$image->heightTopLeft());
+ }
+
public function getThumbnailInfo($path) {
$arr = DatabaseManager::getInstance()->getFileData($path);
if (!$arr) {
- $thubnail = $this->getThumbnail($path);
- unset($thubnail);
- $arr = DatabaseManager::getInstance()->getFileData($path);
+ if (!\OC_Filesystem::file_exists($path)) {
+ \OC_Log::write(self::TAG, 'File '.$path.' don\'t exists', \OC_Log::WARN);
+ return false;
+ }
+ $image = new \OC_Image();
+ $image->loadFromFile(\OC_Filesystem::getLocalFile($path));
+ if (!$image->valid()) {
+ return false;
+ }
+ $arr = DatabaseManager::getInstance()->setFileData($path, $this->getThumbnailWidth($image), self::THUMBNAIL_HEIGHT);
}
$ret = array('filepath' => $arr['path'],
'width' => $arr['width'],
@@ -102,13 +123,12 @@ class ThumbnailsManager {
}
public function delete($path) {
- $thumbnail = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser()."/gallery".$path;
- if (file_exists($thumbnail)) {
- unlink($thumbnail);
+ $thumbnail_storage = \OCP\Files::getStorage('gallery');
+ if ($thumbnail_storage->file_exists($path)) {
+ $thumbnail_storage->unlink($path);
}
}
private function __construct() {}
}
-?>
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index f9527cb5fdb..3b4e74641b3 100644
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -1,53 +1,55 @@
<?php
/**
-* ownCloud - gallery application
-*
-* @author Bartek Przybylski
-* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
+ * ownCloud - gallery application
+ *
+ * @author Bartek Przybylski
+ * @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
class OC_Gallery_Photo {
- public static function create($albumId, $img){
+
+ public static function create($albumId, $img) {
$stmt = OCP\DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');
$stmt->execute(array($albumId, $img));
}
- public static function find($albumId, $img=null){
+
+ public static function find($albumId, $img = null) {
$sql = 'SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ?';
$args = array($albumId);
- if (!is_null($img)){
+ if (!is_null($img)) {
$sql .= ' AND file_path = ?';
$args[] = $img;
}
$stmt = OCP\DB::prepare($sql);
return $stmt->execute($args);
}
- public static function findForAlbum($owner, $album_name){
+
+ public static function findForAlbum($owner, $album_name) {
$stmt = OCP\DB::prepare('SELECT *'
- .' FROM *PREFIX*gallery_photos photos,'
- .' *PREFIX*gallery_albums albums'
- .' WHERE albums.uid_owner = ?'
- .' AND albums.album_name = ?'
- .' AND photos.album_id = albums.album_id');
+ .' FROM *PREFIX*gallery_photos photos,'
+ .' *PREFIX*gallery_albums albums'
+ .' WHERE albums.uid_owner = ?'
+ .' AND albums.album_name = ?'
+ .' AND photos.album_id = albums.album_id');
return $stmt->execute(array($owner, $album_name));
}
- public static function removeByPath($path, $album_id) {
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
+ public static function removeByPath($path, $album_id) {
+ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
$stmt->execute(array($path, $album_id));
}
@@ -67,19 +69,20 @@ class OC_Gallery_Photo {
}
public static function getThumbnail($image_name, $owner = null) {
- if (!$owner) $owner = OCP\USER::getUser();
+ if (!$owner)
+ $owner = OCP\USER::getUser();
$view = OCP\Files::getStorage('gallery');
$save_dir = dirname($image_name);
if (!$view->is_dir($save_dir)) {
$view->mkdir($save_dir);
}
- $view->chroot($view->getRoot().'/'.$save_dir);
+ $view->chroot($view->getRoot() . '/' . $save_dir);
$thumb_file = basename($image_name);
if ($view->file_exists($thumb_file)) {
$image = new OC_Image($view->fopen($thumb_file, 'r'));
} else {
$image_path = OC_Filesystem::getLocalFile($image_name);
- if(!file_exists($image_path)) {
+ if (!file_exists($image_path)) {
return null;
}
$image = new OC_Image($image_path);
@@ -91,7 +94,38 @@ class OC_Gallery_Photo {
}
if ($image->valid()) {
return $image;
- }else{
+ } else {
+ $image->destroy();
+ }
+ return null;
+ }
+
+ public static function getViewImage($image_name, $owner = null) {
+ if (!$owner) $owner = OCP\USER::getUser();
+ $save_dir = OCP\Config::getSystemValue("datadirectory") . '/' . $owner . '/gallery';
+ $save_dir .= dirname($image_name) . '/view/';
+ $image_path = $image_name;
+ $view_file = $save_dir . basename($image_name);
+ if (!is_dir($save_dir)) {
+ mkdir($save_dir, 0777, true);
+ }
+ if (file_exists($view_file)) {
+ $image = new OC_Image($view_file);
+ } else {
+ $image_path = OC_Filesystem::getLocalFile($image_path);
+ if (!file_exists($image_path)) {
+ return null;
+ }
+ $image = new OC_Image($image_path);
+ if ($image->valid()) {
+ $image->resize(1200);
+ $image->fixOrientation();
+ $image->save($view_file);
+ }
+ }
+ if ($image->valid()) {
+ return $image;
+ } else {
$image->destroy();
}
return null;
@@ -100,4 +134,5 @@ class OC_Gallery_Photo {
public static function getGalleryRoot() {
return OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '');
}
+
}
diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php
index 5efe0d7a299..754734e609e 100644
--- a/apps/gallery/lib/tiles.php
+++ b/apps/gallery/lib/tiles.php
@@ -95,7 +95,7 @@ class TileSingle extends TileBase {
public function get($extra = '') {
// !HACK! file path needs to be encoded twice because files app decode twice url, so any special chars like + or & in filename
// !HACK! will result in failing of opening them
- return '<a rel="images" title="'.htmlentities(basename($this->getPath())).'" href="'.\OCP\Util::linkTo('files', 'download.php').'?file='.urlencode(urlencode($this->getPath())).'"><img rel="images" src="'.\OCP\Util::linkTo('gallery', 'ajax/thumbnail.php').'&filepath='.urlencode($this->getPath()).'" '.$extra.'></a>';
+ return '<a rel="images" title="'.htmlentities(basename($this->getPath())).'" href="'.\OCP\Util::linkTo('gallery','ajax/viewImage.php').'?img='.urlencode(urlencode($this->getPath())).'"><img rel="images" src="'.\OCP\Util::linkTo('gallery', 'ajax/thumbnail.php').'&filepath='.urlencode($this->getPath()).'" '.$extra.'></a>';
}
public function getMiniatureSrc() {
@@ -174,5 +174,3 @@ class TileStack extends TileBase {
private $tiles_array;
private $stack_name;
}
-
-?>
diff --git a/apps/gallery/lib/tiles_test.php b/apps/gallery/lib/tiles_test.php
index 022a88f75cc..02d567c628d 100644
--- a/apps/gallery/lib/tiles_test.php
+++ b/apps/gallery/lib/tiles_test.php
@@ -83,5 +83,3 @@ if ($ts->getCount() != 0) {
}
echo $tl->get();
-
-?>
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index c90932cefd0..b2efd5342ff 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -22,7 +22,10 @@ $(document).ready(function() {
}
}
-?><br/>
+?>
+ <div id="slideshow">
+ <input type="button" class="start" value="<?php echo $l->t('Slideshow')?>" />
+ </div>
</div>
<div id="gallerycontent">
<?php
@@ -32,3 +35,50 @@ echo $_['tl']->get();
?>
</div>
+
+<!-- start supersized block -->
+<div id="slideshow-content" style="display:none;">
+
+ <!--Thumbnail Navigation-->
+ <div id="prevthumb"></div>
+ <div id="nextthumb"></div>
+
+ <!--Arrow Navigation-->
+ <a id="prevslide" class="load-item"></a>
+ <a id="nextslide" class="load-item"></a>
+
+ <div id="thumb-tray" class="load-item">
+ <div id="thumb-back"></div>
+ <div id="thumb-forward"></div>
+ </div>
+
+ <!--Time Bar-->
+ <div id="progress-back" class="load-item">
+ <div id="progress-bar"></div>
+ </div>
+
+ <!--Control Bar-->
+ <div id="slideshow-controls-wrapper" class="load-item">
+ <div id="slideshow-controls">
+
+ <a id="play-button"><img id="pauseplay" src="<?php echo OCP\image_path('gallery', 'supersized/pause.png'); ?>"/></a>
+
+ <!--Slide counter-->
+ <div id="slidecounter">
+ <span class="slidenumber"></span> / <span class="totalslides"></span>
+ </div>
+
+ <!--Slide captions displayed here-->
+ <div id="slidecaption"></div>
+
+ <!--Thumb Tray button-->
+ <a id="tray-button"><img id="tray-arrow" src="<?php echo OCP\image_path('gallery', 'supersized/button-tray-up.png'); ?>"/></a>
+
+ <!--Navigation-->
+ <!--
+ <ul id="slide-list"></ul>
+ -->
+ </div>
+ </div>
+
+</div><!-- end supersized block -->
diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php
index c16ed69c065..00e891103f1 100644
--- a/apps/gallery/templates/view_album.php
+++ b/apps/gallery/templates/view_album.php
@@ -1,9 +1,9 @@
<?php
OCP\Util::addStyle('gallery', 'styles');
-OCP\Util::addscript('gallery', 'albums');
-OCP\Util::addscript('gallery', 'album_cover');
-OCP\Util::addscript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
-OCP\Util::addscript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
+OCP\Util::addScript('gallery', 'albums');
+OCP\Util::addScript('gallery', 'album_cover');
+OCP\Util::addScript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
+OCP\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');
?>
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php
index 23abc579272..7f5cdb22c12 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -131,4 +131,3 @@ if($arguments['action']){
exit;
}
}
-?>
diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php
index 3122c7e6754..c2dbf27a004 100644
--- a/apps/media/ajax/autoupdate.php
+++ b/apps/media/ajax/autoupdate.php
@@ -35,4 +35,3 @@ $autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
OCP\Config::setUserValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate);
OCP\JSON::success(array('data' => $autoUpdate));
-?>
diff --git a/apps/media/index.php b/apps/media/index.php
index fb51aa0b17a..ae85abc8aab 100644
--- a/apps/media/index.php
+++ b/apps/media/index.php
@@ -40,5 +40,3 @@ OCP\App::setActiveNavigationEntry( 'media_index' );
$tmpl = new OCP\Template( 'media', 'music', 'user' );
$tmpl->printPage();
-?>
-
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index 255e6f468f8..d35cca150b2 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -419,5 +419,3 @@ class OC_MEDIA_AMPACHE{
echo('</root>');
}
}
-
-?>
diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php
index 598c08d32e2..e65930f551d 100644
--- a/apps/media/lib_collection.php
+++ b/apps/media/lib_collection.php
@@ -387,5 +387,3 @@ class OC_MEDIA_COLLECTION{
$query->execute(array($newPath,$oldPath));
}
}
-
-?>
diff --git a/apps/media/settings.php b/apps/media/settings.php
index 227298fafec..53738f02f9f 100644
--- a/apps/media/settings.php
+++ b/apps/media/settings.php
@@ -3,4 +3,3 @@
$tmpl = new OCP\Template( 'media', 'settings');
return $tmpl->fetchPage();
-?>
diff --git a/apps/remoteStorage/settings.php b/apps/remoteStorage/settings.php
index 9c48549fe6d..3be8b0984d8 100644
--- a/apps/remoteStorage/settings.php
+++ b/apps/remoteStorage/settings.php
@@ -4,4 +4,3 @@ require_once('lib_remoteStorage.php');
$tmpl = new OCP\Template( 'remoteStorage', 'settings');
return $tmpl->fetchPage();
-?>
diff --git a/apps/user_migrate/appinfo/app.php b/apps/user_migrate/appinfo/app.php
index 9d314b59ce7..366c4004932 100644
--- a/apps/user_migrate/appinfo/app.php
+++ b/apps/user_migrate/appinfo/app.php
@@ -31,4 +31,3 @@ $entry = array(
'href' => OCP\Util::linkTo( "user_migrate", "admin.php" ),
'name' => 'Import'
);
-?>
diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php
index 5aaab642856..13fd31c47ca 100644
--- a/apps/user_openid/phpmyid.php
+++ b/apps/user_openid/phpmyid.php
@@ -1705,4 +1705,3 @@ $run_mode = (isset($_REQUEST['openid_mode'])
debug("Run mode: $run_mode at: " . time());
debug($_REQUEST, 'Request params');
call_user_func($run_mode . '_mode');
-?>
diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php
index 392424795f8..d25b95259e0 100644
--- a/apps/user_openid/user.php
+++ b/apps/user_openid/user.php
@@ -45,6 +45,3 @@ if(!OCP\User::userExists($USERNAME)){
$IDENTITY=OCP\Util::linkToAbsolute( "user_openid", "user.php" ).'/'.$USERNAME;
require_once 'phpmyid.php';
-
-
-?>
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
index 6b64a7e2860..e5b7f042d5a 100644
--- a/apps/user_webfinger/webfinger.php
+++ b/apps/user_webfinger/webfinger.php
@@ -58,4 +58,3 @@ foreach($apps as $app) {
}
}
echo "]}";
-?>
diff --git a/core/ajax/grouplist.php b/core/ajax/grouplist.php
index cc15102bbc3..e3e92fcfa16 100644
--- a/core/ajax/grouplist.php
+++ b/core/ajax/grouplist.php
@@ -45,5 +45,3 @@ foreach( OC_Group::getGroups() as $i ){
}
OC_JSON::encodedPrint($groups);
-
-?>
diff --git a/core/ajax/translations.php b/core/ajax/translations.php
index a6433b1964a..2bd6b7ed634 100644
--- a/core/ajax/translations.php
+++ b/core/ajax/translations.php
@@ -29,4 +29,3 @@ $app = $_POST["app"];
$l = OC_L10N::get( $app );
OC_JSON::success(array('data' => $l->getTranslations()));
-?>
diff --git a/core/ajax/userlist.php b/core/ajax/userlist.php
index c8168eaf460..85ca004ae66 100644
--- a/core/ajax/userlist.php
+++ b/core/ajax/userlist.php
@@ -44,5 +44,3 @@ foreach( OC_User::getUsers() as $i ){
}
OC_JSON::encodedPrint($users);
-
-?>
diff --git a/core/ajax/validateuser.php b/core/ajax/validateuser.php
index 258bd50fcad..78ec451fac2 100644
--- a/core/ajax/validateuser.php
+++ b/core/ajax/validateuser.php
@@ -36,5 +36,3 @@ if(!isset($_SERVER['PHP_AUTH_USER'])){
OC_JSON::encodedPrint(array("username" => $_SERVER["PHP_AUTH_USER"], "user_valid" => "false"));
}
}
-
-?>
diff --git a/core/ajax/vcategories/add.php b/core/ajax/vcategories/add.php
index a58489228d8..e69f8bb726b 100644
--- a/core/ajax/vcategories/add.php
+++ b/core/ajax/vcategories/add.php
@@ -39,5 +39,3 @@ if($categories->hasCategory($category)) {
}
OC_JSON::success(array('data' => array('categories'=>$categories->categories())));
-
-?>
diff --git a/core/ajax/vcategories/delete.php b/core/ajax/vcategories/delete.php
index 75def433d30..a41fa083c38 100644
--- a/core/ajax/vcategories/delete.php
+++ b/core/ajax/vcategories/delete.php
@@ -34,5 +34,3 @@ if(is_null($categories)) {
$vcategories = new OC_VCategories($app);
$vcategories->delete($categories);
OC_JSON::success(array('data' => array('categories'=>$vcategories->categories())));
-
-?>
diff --git a/core/ajax/vcategories/edit.php b/core/ajax/vcategories/edit.php
index 252b3d3454c..3e5540cbc22 100644
--- a/core/ajax/vcategories/edit.php
+++ b/core/ajax/vcategories/edit.php
@@ -31,5 +31,3 @@ $categories = $vcategories->categories();
debug(print_r($categories, true));
$tmpl->assign('categories',$categories);
$tmpl->printpage();
-
-?>
diff --git a/core/js/js.js b/core/js/js.js
index d6483b2c225..df834157cdb 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -518,5 +518,5 @@ function formatDate(date){
}
var monthNames = [ t('files','January'), t('files','February'), t('files','March'), t('files','April'), t('files','May'), t('files','June'),
t('files','July'), t('files','August'), t('files','September'), t('files','October'), t('files','November'), t('files','December') ];
- return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+date.getMinutes();
+ return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes();
}
diff --git a/core/strings.php b/core/strings.php
index 8c3f64ef14f..01ab3866089 100644
--- a/core/strings.php
+++ b/core/strings.php
@@ -7,4 +7,3 @@ $l->t("Users");
$l->t("Apps");
$l->t("Admin");
$l->t("Help");
-?>
diff --git a/lib/MDB2/Driver/Function/sqlite3.php b/lib/MDB2/Driver/Function/sqlite3.php
index a013aea165a..1af262fd7a7 100644
--- a/lib/MDB2/Driver/Function/sqlite3.php
+++ b/lib/MDB2/Driver/Function/sqlite3.php
@@ -134,4 +134,3 @@ class MDB2_Driver_Function_sqlite3 extends MDB2_Driver_Function_Common
// }}}
}
-?>
diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php
index 8f4e1312eb8..10255a3619a 100644
--- a/lib/MDB2/Driver/Manager/sqlite3.php
+++ b/lib/MDB2/Driver/Manager/sqlite3.php
@@ -1360,4 +1360,3 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common
// }}}
}
-?>
diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php
index 39d3fb6727d..25927aff637 100644
--- a/lib/MDB2/Driver/sqlite3.php
+++ b/lib/MDB2/Driver/sqlite3.php
@@ -1332,5 +1332,3 @@ class MDB2_Statement_sqlite3 extends MDB2_Statement_Common
$this->free();
}
}
-
-?>
diff --git a/lib/connector/sabre/client.php b/lib/connector/sabre/client.php
new file mode 100644
index 00000000000..87f9d59b3ae
--- /dev/null
+++ b/lib/connector/sabre/client.php
@@ -0,0 +1,171 @@
+<?php
+
+/**
+ * ownCloud
+ *
+ * @author Bjoern Schiessle
+ * @copyright 2012 Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+class OC_Connector_Sabre_Client extends Sabre_DAV_Client {
+
+ protected $trustedCertificates;
+
+ /**
+ * Add trusted root certificates to the webdav client.
+ *
+ * The parameter certificates should be a absulute path to a file which contains
+ * all trusted certificates
+ *
+ * @param string $certificates
+ */
+ public function addTrustedCertificates($certificates) {
+ $this->trustedCertificates = $certificates;
+ }
+
+ /**
+ * Copied from SabreDAV with some modification to use user defined curlSettings
+ * Performs an actual HTTP request, and returns the result.
+ *
+ * If the specified url is relative, it will be expanded based on the base
+ * url.
+ *
+ * The returned array contains 3 keys:
+ * * body - the response body
+ * * httpCode - a HTTP code (200, 404, etc)
+ * * headers - a list of response http headers. The header names have
+ * been lowercased.
+ *
+ * @param string $method
+ * @param string $url
+ * @param string $body
+ * @param array $headers
+ * @return array
+ */
+ public function request($method, $url = '', $body = null, $headers = array()) {
+
+ $url = $this->getAbsoluteUrl($url);
+
+ $curlSettings = array(
+ CURLOPT_RETURNTRANSFER => true,
+ // Return headers as part of the response
+ CURLOPT_HEADER => true,
+ CURLOPT_POSTFIELDS => $body,
+ // Automatically follow redirects
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_MAXREDIRS => 5,
+ CURLOPT_SSL_VERIFYPEER => true,
+ //CURLOPT_SSL_VERIFYPEER => false,
+ );
+
+ if($this->trustedCertificates) {
+ $curlSettings[CURLOPT_CAINFO] = $this->trustedCertificates;
+ }
+
+ switch ($method) {
+ case 'PUT':
+ $curlSettings[CURLOPT_PUT] = true;
+ break;
+ case 'HEAD' :
+
+ // do not read body with HEAD requests (this is neccessary because cURL does not ignore the body with HEAD
+ // requests when the Content-Length header is given - which in turn is perfectly valid according to HTTP
+ // specs...) cURL does unfortunately return an error in this case ("transfer closed transfer closed with
+ // ... bytes remaining to read") this can be circumvented by explicitly telling cURL to ignore the
+ // response body
+ $curlSettings[CURLOPT_NOBODY] = true;
+ $curlSettings[CURLOPT_CUSTOMREQUEST] = 'HEAD';
+ break;
+
+ default:
+ $curlSettings[CURLOPT_CUSTOMREQUEST] = $method;
+ break;
+
+ }
+
+ // Adding HTTP headers
+ $nHeaders = array();
+ foreach($headers as $key=>$value) {
+
+ $nHeaders[] = $key . ': ' . $value;
+
+ }
+ $curlSettings[CURLOPT_HTTPHEADER] = $nHeaders;
+
+ if ($this->proxy) {
+ $curlSettings[CURLOPT_PROXY] = $this->proxy;
+ }
+
+ if ($this->userName) {
+ $curlSettings[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC | CURLAUTH_DIGEST;
+ $curlSettings[CURLOPT_USERPWD] = $this->userName . ':' . $this->password;
+ }
+
+ list(
+ $response,
+ $curlInfo,
+ $curlErrNo,
+ $curlError
+ ) = $this->curlRequest($url, $curlSettings);
+
+ $headerBlob = substr($response, 0, $curlInfo['header_size']);
+ $response = substr($response, $curlInfo['header_size']);
+
+ // In the case of 100 Continue, or redirects we'll have multiple lists
+ // of headers for each separate HTTP response. We can easily split this
+ // because they are separated by \r\n\r\n
+ $headerBlob = explode("\r\n\r\n", trim($headerBlob, "\r\n"));
+
+ // We only care about the last set of headers
+ $headerBlob = $headerBlob[count($headerBlob)-1];
+
+ // Splitting headers
+ $headerBlob = explode("\r\n", $headerBlob);
+
+ $headers = array();
+ foreach($headerBlob as $header) {
+ $parts = explode(':', $header, 2);
+ if (count($parts)==2) {
+ $headers[strtolower(trim($parts[0]))] = trim($parts[1]);
+ }
+ }
+
+ $response = array(
+ 'body' => $response,
+ 'statusCode' => $curlInfo['http_code'],
+ 'headers' => $headers
+ );
+
+ if ($curlErrNo) {
+ throw new Sabre_DAV_Exception('[CURL] Error while making request: ' . $curlError . ' (error code: ' . $curlErrNo . ')');
+ }
+
+ if ($response['statusCode']>=400) {
+ switch ($response['statusCode']) {
+ case 404:
+ throw new Sabre_DAV_Exception_NotFound('Resource ' . $url . ' not found.');
+ break;
+
+ default:
+ throw new Sabre_DAV_Exception('HTTP error response. (errorcode ' . $response['statusCode'] . ')');
+ }
+ }
+
+ return $response;
+
+ }
+} \ No newline at end of file
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index dd25df78c29..e4dc8c93445 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -42,7 +42,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function get() {
- return OC_Filesystem::fopen($this->path,'r');
+ return OC_Filesystem::readfile($this->path);
}
diff --git a/lib/image.php b/lib/image.php
index e5c59bacdc5..01e843d8316 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -108,6 +108,56 @@ class OC_Image {
}
/**
+ * @brief Returns the width when the image orientation is top-left.
+ * @returns int
+ */
+ public function widthTopLeft() {
+ $o = $this->getOrientation();
+ OC_Log::write('core','OC_Image->widthTopLeft() Orientation: '.$o, OC_Log::DEBUG);
+ switch($o) {
+ case -1:
+ case 1:
+ case 2: // Not tested
+ case 3:
+ case 4: // Not tested
+ return $this->width();
+ break;
+ case 5: // Not tested
+ case 6:
+ case 7: // Not tested
+ case 8:
+ return $this->height();
+ break;
+ }
+ return $this->width();
+ }
+
+ /**
+ * @brief Returns the height when the image orientation is top-left.
+ * @returns int
+ */
+ public function heightTopLeft() {
+ $o = $this->getOrientation();
+ OC_Log::write('core','OC_Image->heightTopLeft() Orientation: '.$o, OC_Log::DEBUG);
+ switch($o) {
+ case -1:
+ case 1:
+ case 2: // Not tested
+ case 3:
+ case 4: // Not tested
+ return $this->height();
+ break;
+ case 5: // Not tested
+ case 6:
+ case 7: // Not tested
+ case 8:
+ return $this->width();
+ break;
+ }
+ return $this->height();
+ }
+
+ /**
* @brief Outputs the image.
* @returns bool
*/
@@ -209,34 +259,46 @@ class OC_Image {
/**
* (I'm open for suggestions on better method name ;)
- * @brief Fixes orientation based on EXIF data.
- * @returns bool.
+ * @brief Get the orientation based on EXIF data.
+ * @returns The orientation or -1 if no EXIF data is available.
*/
- public function fixOrientation() {
+ public function getOrientation() {
if(!is_callable('exif_read_data')){
OC_Log::write('core','OC_Image->fixOrientation() Exif module not enabled.', OC_Log::DEBUG);
- return false;
+ return -1;
}
if(!$this->valid()) {
OC_Log::write('core','OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG);
- return false;
+ return -1;
}
if(is_null($this->filepath) || !is_readable($this->filepath)) {
OC_Log::write('core','OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
- return false;
+ return -1;
}
$exif = @exif_read_data($this->filepath, 'IFD0');
if(!$exif) {
- return false;
+ return -1;
}
if(!isset($exif['Orientation'])) {
- return true; // Nothing to fix
+ return -1;
}
- $o = $exif['Orientation'];
+ return $exif['Orientation'];
+ }
+
+ /**
+ * (I'm open for suggestions on better method name ;)
+ * @brief Fixes orientation based on EXIF data.
+ * @returns bool.
+ */
+ public function fixOrientation() {
+ $o = $this->getOrientation();
OC_Log::write('core','OC_Image->fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
$rotate = 0;
$flip = false;
switch($o) {
+ case -1:
+ return false; //Nothing to fix
+ break;
case 1:
$rotate = 0;
$flip = false;
diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php
index 92914af8fca..9eb21832c55 100644
--- a/lib/log/owncloud.php
+++ b/lib/log/owncloud.php
@@ -63,25 +63,40 @@ class OC_Log_Owncloud {
self::init();
$minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN );
$entries = array();
- $handle = @fopen(self::$logFile, 'r');
+ $handle = @fopen(self::$logFile, 'rb');
if ($handle) {
- // Just a guess to set the file pointer to the right spot
- $maxLineLength = 150;
- fseek($handle, -($limit * $maxLineLength + $offset * $maxLineLength), SEEK_END);
- // Skip first line, because it is most likely a partial line
- fgets($handle);
- while (!feof($handle)) {
- $line = fgets($handle);
- if (!empty($line)) {
- $entry = json_decode($line);
- if ($entry->level >= $minLevel) {
- $entries[] = $entry;
+ fseek($handle, 0, SEEK_END);
+ $pos = ftell($handle);
+ $line = '';
+ $entriesCount = 0;
+ $lines = 0;
+ // Loop through each character of the file looking for new lines
+ while ($pos >= 0 && $entriesCount < $limit) {
+ fseek($handle, $pos);
+ $ch = fgetc($handle);
+ if ($ch == "\n" || $pos == 0) {
+ if ($line != '') {
+ // Add the first character if at the start of the file, because it doesn't hit the else in the loop
+ if ($pos == 0) {
+ $line = $ch.$line;
+ }
+ $entry = json_decode($line);
+ // Add the line as an entry if it is passed the offset and is equal or above the log level
+ if ($entry->level >= $minLevel) {
+ $lines++;
+ if ($lines > $offset) {
+ $entries[] = $entry;
+ $entriesCount++;
+ }
+ }
+ $line = '';
}
+ } else {
+ $line = $ch.$line;
}
+ $pos--;
}
fclose($handle);
- // Extract the needed entries and reverse the order
- $entries = array_reverse(array_slice($entries, -($limit + $offset), $limit));
}
return $entries;
}
diff --git a/lib/public/app.php b/lib/public/app.php
index 9e2108818bf..38c51af9cdb 100644
--- a/lib/public/app.php
+++ b/lib/public/app.php
@@ -158,6 +158,3 @@ class App {
}
-
-
-?>
diff --git a/lib/public/config.php b/lib/public/config.php
index 9f5abe672cb..ab01902ffe6 100644
--- a/lib/public/config.php
+++ b/lib/public/config.php
@@ -134,5 +134,3 @@ class Config {
}
-
-?>
diff --git a/lib/public/db.php b/lib/public/db.php
index f7564c0bb6a..3a33f7674d8 100644
--- a/lib/public/db.php
+++ b/lib/public/db.php
@@ -91,5 +91,3 @@ class DB {
}
-
-?>
diff --git a/lib/public/files.php b/lib/public/files.php
index fc3004434ba..32b3f036744 100644
--- a/lib/public/files.php
+++ b/lib/public/files.php
@@ -115,5 +115,3 @@ class Files {
}
-
-?>
diff --git a/lib/public/json.php b/lib/public/json.php
index b6edbd65bd5..1bc1e3ab4d5 100644
--- a/lib/public/json.php
+++ b/lib/public/json.php
@@ -105,5 +105,3 @@ class JSON {
}
}
-
-?>
diff --git a/lib/public/response.php b/lib/public/response.php
index cc2137c5cae..8dff3bcd354 100644
--- a/lib/public/response.php
+++ b/lib/public/response.php
@@ -105,5 +105,3 @@ class Response {
}
-
-?>
diff --git a/lib/public/template.php b/lib/public/template.php
index b89088bdd06..a0ed618cb2c 100644
--- a/lib/public/template.php
+++ b/lib/public/template.php
@@ -104,6 +104,3 @@ function html_select_options($options, $selected, $params=array()) {
class Template extends \OC_Template {
}
-
-
-?>
diff --git a/lib/public/user.php b/lib/public/user.php
index a0c069f7379..713e366b968 100644
--- a/lib/public/user.php
+++ b/lib/public/user.php
@@ -120,6 +120,3 @@ class User {
}
-
-
-?>
diff --git a/lib/public/util.php b/lib/public/util.php
index 41121091544..43f9e3cee5d 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -321,5 +321,3 @@ class Util {
return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));
}
}
-
-?>
diff --git a/lib/setup.php b/lib/setup.php
index bad0f5301c7..2f73c486c9c 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -380,5 +380,3 @@ class OC_Setup {
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/index.html', '');
}
}
-
-?>
diff --git a/lib/updater.php b/lib/updater.php
index 5d97178c30e..332cea03bfc 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -84,4 +84,3 @@ class OC_Updater{
}
}
-?>
diff --git a/lib/user.php b/lib/user.php
index d02c1208a8d..f1903093d6d 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -345,17 +345,13 @@ class OC_User {
* @return boolean
*/
public static function userExists($uid){
- static $user_exists_checked = null;
- if (!is_null($user_exists_checked)) {
- return $user_exists_checked;
- }
foreach(self::$_usedBackends as $backend){
$result=$backend->userExists($uid);
if($result===true){
- return $user_exists_checked = true;
+ return true;
}
}
- return $user_exists_checked = false;
+ return false;
}
/**
diff --git a/lib/vcategories.php b/lib/vcategories.php
index 8157c343868..d15b7b166ea 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -131,8 +131,10 @@ class OC_VCategories {
* }
* $categories->rescan($objects);
*/
- public function rescan($objects, $sync=true) {
- $this->categories = array();
+ public function rescan($objects, $sync=true, $reset=true) {
+ if($reset === true) {
+ $this->categories = array();
+ }
foreach($objects as $object) {
//OC_Log::write('core','OC_VCategories::rescan: '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
$vobject = OC_VObject::parse($object);
@@ -221,4 +223,3 @@ class OC_VCategories {
}
}
-?>
diff --git a/ocs/providers.php b/ocs/providers.php
index adaa28db6cd..f9cafd20b01 100644
--- a/ocs/providers.php
+++ b/ocs/providers.php
@@ -40,6 +40,3 @@ echo('
</provider>
</providers>
');
-
-
-?>
diff --git a/ocs/v1.php b/ocs/v1.php
index 77dd75b9fc2..ab0dc80f4ba 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -24,5 +24,3 @@
require_once('../lib/base.php');
@ob_clean();
OC_OCS::handle();
-
-?>
diff --git a/search/ajax/search.php b/search/ajax/search.php
index 326724d60c4..95ddfedf8ba 100644
--- a/search/ajax/search.php
+++ b/search/ajax/search.php
@@ -35,5 +35,3 @@ if($query){
}else{
echo 'false';
}
-
-?>
diff --git a/search/index.php b/search/index.php
index 518695c56d2..de55aec3999 100644
--- a/search/index.php
+++ b/search/index.php
@@ -49,5 +49,3 @@ foreach($results as $result){
$tmpl = new OC_Template( 'search', 'index', 'user' );
$tmpl->assign('resultTypes',$resultTypes);
$tmpl->printPage();
-
-?>
diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php
index 860ea987871..4ba6813517b 100644
--- a/settings/ajax/changepassword.php
+++ b/settings/ajax/changepassword.php
@@ -9,6 +9,8 @@ $oldPassword=isset($_POST["oldpassword"])?$_POST["oldpassword"]:'';
// Check if we are a user
OC_JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+
if( (!OC_Group::inGroup( OC_User::getUser(), 'admin' ) && ($username!=OC_User::getUser() || !OC_User::checkPassword($username,$oldPassword)))) {
OC_JSON::error( array( "data" => array( "message" => "Authentication error" )));
exit();
@@ -21,5 +23,3 @@ if( OC_User::setPassword( $username, $password )){
else{
OC_JSON::error(array("data" => array( "message" => "Unable to change password" )));
}
-
-?>
diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php
index 57d82e7bd94..af8ad3dd8c0 100644
--- a/settings/ajax/creategroup.php
+++ b/settings/ajax/creategroup.php
@@ -9,6 +9,8 @@ if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' ))
exit();
}
+OCP\JSON::callCheck();
+
$groupname = $_POST["groupname"];
// Does the group exist?
@@ -24,5 +26,3 @@ if( OC_Group::createGroup( $groupname )){
else{
OC_JSON::error(array("data" => array( "message" => "Unable to add group" )));
}
-
-?>
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php
index 6714711bc87..c56df4bc15a 100644
--- a/settings/ajax/createuser.php
+++ b/settings/ajax/createuser.php
@@ -8,6 +8,7 @@ if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' ))
OC_JSON::error(array("data" => array( "message" => "Authentication error" )));
exit();
}
+OCP\JSON::callCheck();
$groups = array();
if( isset( $_POST["groups"] )){
@@ -35,5 +36,3 @@ try {
} catch (Exception $exception) {
OC_JSON::error(array("data" => array( "message" => $exception->getMessage())));
}
-
-?>
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
index 53e9be379e1..cc006988707 100644
--- a/settings/ajax/disableapp.php
+++ b/settings/ajax/disableapp.php
@@ -2,6 +2,7 @@
// Init owncloud
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader();
OC_App::disable($_POST['appid']);
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
index cb116ebe4e8..bd53a50210c 100644
--- a/settings/ajax/enableapp.php
+++ b/settings/ajax/enableapp.php
@@ -3,6 +3,7 @@
// Init owncloud
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
OC_JSON::setContentTypeHeader();
if(OC_App::enable($_POST['appid'])){
diff --git a/settings/ajax/lostpassword.php b/settings/ajax/lostpassword.php
index c6df8551f52..803a424854c 100644
--- a/settings/ajax/lostpassword.php
+++ b/settings/ajax/lostpassword.php
@@ -2,8 +2,8 @@
// Init owncloud
require_once('../../lib/base.php');
-
OC_JSON::checkLoggedIn();
+OCP\JSON::callCheck();
$l=OC_L10N::get('core');
@@ -15,5 +15,3 @@ if( isset( $_POST['email'] ) && filter_var( $_POST['email'], FILTER_VALIDATE_EMA
}else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") )));
}
-
-?>
diff --git a/settings/ajax/openid.php b/settings/ajax/openid.php
index 58d071255c2..bf4ead06020 100644
--- a/settings/ajax/openid.php
+++ b/settings/ajax/openid.php
@@ -6,6 +6,7 @@ require_once('../../lib/base.php');
$l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn();
+OCP\JSON::callCheck();
OC_JSON::checkAppEnabled('user_openid');
// Get data
@@ -16,5 +17,3 @@ if( isset( $_POST['identity'] ) ){
}else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
}
-
-?>
diff --git a/settings/ajax/removegroup.php b/settings/ajax/removegroup.php
index 4d364781894..f8c2065956c 100644
--- a/settings/ajax/removegroup.php
+++ b/settings/ajax/removegroup.php
@@ -4,6 +4,7 @@
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
$name = $_POST["groupname"];
@@ -14,5 +15,3 @@ if( OC_Group::deleteGroup( $name )){
else{
OC_JSON::error(array("data" => array( "message" => "Unable to delete group" )));
}
-
-?>
diff --git a/settings/ajax/removeuser.php b/settings/ajax/removeuser.php
index 2c288997a1f..230815217c3 100644
--- a/settings/ajax/removeuser.php
+++ b/settings/ajax/removeuser.php
@@ -4,6 +4,7 @@
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
$username = $_POST["username"];
@@ -14,5 +15,3 @@ if( OC_User::deleteUser( $username )){
else{
OC_JSON::error(array("data" => array( "message" => "Unable to delete user" )));
}
-
-?>
diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php
index e3b00c3bc80..54b103cd4fe 100644
--- a/settings/ajax/setlanguage.php
+++ b/settings/ajax/setlanguage.php
@@ -6,6 +6,7 @@ require_once('../../lib/base.php');
$l=OC_L10N::get('settings');
OC_JSON::checkLoggedIn();
+OCP\JSON::callCheck();
// Get data
@@ -21,5 +22,3 @@ if( isset( $_POST['lang'] ) ){
}else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
}
-
-?>
diff --git a/settings/ajax/setloglevel.php b/settings/ajax/setloglevel.php
index 298cbd64738..4b97ba2aa32 100644
--- a/settings/ajax/setloglevel.php
+++ b/settings/ajax/setloglevel.php
@@ -7,6 +7,7 @@
require_once('../../lib/base.php');
OC_Util::checkAdminUser();
+OCP\JSON::callCheck();
OC_Config::setValue( 'loglevel', $_POST['level'] );
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
index f59017600ac..2b412c0f2fd 100644
--- a/settings/ajax/setquota.php
+++ b/settings/ajax/setquota.php
@@ -9,6 +9,7 @@
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
$username = isset($_POST["username"])?$_POST["username"]:'';
@@ -34,4 +35,3 @@ if($username){
}
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota)));
-?>
diff --git a/settings/ajax/togglegroups.php b/settings/ajax/togglegroups.php
index 7773c1049c3..95338ed0267 100644
--- a/settings/ajax/togglegroups.php
+++ b/settings/ajax/togglegroups.php
@@ -4,6 +4,7 @@
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
$success = true;
$error = "add user to";
@@ -37,5 +38,3 @@ if( $success ){
else{
OC_JSON::error(array("data" => array( "message" => "Unable to $error group $group" )));
}
-
-?>
diff --git a/settings/apps.php b/settings/apps.php
index f4ae8b8d977..762395c031b 100644
--- a/settings/apps.php
+++ b/settings/apps.php
@@ -97,5 +97,3 @@ $appid = (isset($_GET['appid'])?strip_tags($_GET['appid']):'');
$tmpl->assign('appid',$appid);
$tmpl->printPage();
-
-?>
diff --git a/settings/help.php b/settings/help.php
index f0abed8f558..b1dc1c5be77 100644
--- a/settings/help.php
+++ b/settings/help.php
@@ -25,5 +25,3 @@ $tmpl->assign( "kbe", $kbe );
$tmpl->assign( "pagecount", $pagecount );
$tmpl->assign( "page", $page );
$tmpl->printPage();
-
-?>
diff --git a/settings/personal.php b/settings/personal.php
index 26a9f601d9a..d82db0d0e7e 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -17,7 +17,7 @@ OC_App::setActiveNavigationEntry( 'personal' );
// calculate the disc space
$rootInfo=OC_FileCache::get('');
-$sharedInfo=OC_FileCache::get('/Shared');
+$sharedInfo=OC_FileCache::get('/Shared');
$used=$rootInfo['size']-$sharedInfo['size'];
$free=OC_Filesystem::free_space();
$total=$free+$used;
@@ -61,5 +61,3 @@ foreach($forms as $form){
$tmpl->append('forms',$form);
}
$tmpl->printPage();
-
-?>
diff --git a/settings/users.php b/settings/users.php
index 026a30a750c..c3259d2a3f1 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -48,6 +48,3 @@ $tmpl->assign( 'quota_preset', $quotaPreset);
$tmpl->assign( 'default_quota', $defaultQuota);
$tmpl->assign( 'share_notice', $shareNotice);
$tmpl->printPage();
-
-?>
-
diff --git a/status.php b/status.php
index 2d31702ecb3..f314a3a1c6f 100644
--- a/status.php
+++ b/status.php
@@ -29,6 +29,3 @@ if(OC_Config::getValue('installed')==1) $installed='true'; else $installed='fals
$values=array('installed'=>$installed,'version'=>implode('.',OC_Util::getVersion()),'versionstring'=>OC_Util::getVersionString(),'edition'=>OC_Util::getEditionString());
echo(json_encode($values));
-
-
-?>
diff --git a/webapps.php b/webapps.php
index b5fee9bf85f..82e677a51c7 100644
--- a/webapps.php
+++ b/webapps.php
@@ -52,5 +52,3 @@ if(!OC_User::login($authuser,$authpw)){
}
-
-?>