summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSam Tuke <samtuke@jack-laptop.(none)>2012-04-27 13:23:58 +0100
committerSam Tuke <samtuke@jack-laptop.(none)>2012-04-27 13:23:58 +0100
commita1b309a42adb3090782c602960e9b96e6ae6e858 (patch)
tree9ed19a43b052c2837d2145623b6a4d6f3711d25c /apps
parent80c850d018baceca3a6197a7c21651c58d0edc25 (diff)
parent0aaf6d16a54f697fc51e075a3308716c1bc95762 (diff)
downloadnextcloud-server-a1b309a42adb3090782c602960e9b96e6ae6e858.tar.gz
nextcloud-server-a1b309a42adb3090782c602960e9b96e6ae6e858.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'apps')
-rw-r--r--apps/bookmarks/addBm.php2
-rw-r--r--apps/bookmarks/ajax/addBookmark.php4
-rw-r--r--apps/bookmarks/ajax/delBookmark.php2
-rw-r--r--apps/bookmarks/ajax/editBookmark.php2
-rw-r--r--apps/bookmarks/ajax/recordClick.php2
-rw-r--r--apps/bookmarks/ajax/updateList.php2
-rw-r--r--apps/bookmarks/index.php2
-rw-r--r--apps/bookmarks/js/bookmarks.js10
-rw-r--r--apps/bookmarks/templates/list.php2
-rw-r--r--apps/calendar/ajax/calendar/activation.php2
-rw-r--r--apps/calendar/ajax/calendar/delete.php2
-rw-r--r--apps/calendar/ajax/calendar/edit.form.php2
-rw-r--r--apps/calendar/ajax/calendar/edit.php2
-rw-r--r--apps/calendar/ajax/calendar/new.form.php2
-rw-r--r--apps/calendar/ajax/calendar/new.php2
-rw-r--r--apps/calendar/ajax/calendar/overview.php2
-rw-r--r--apps/calendar/ajax/calendar/update.php2
-rw-r--r--apps/calendar/ajax/categories/rescan.php2
-rw-r--r--apps/calendar/ajax/changeview.php2
-rw-r--r--apps/calendar/ajax/event/delete.php2
-rw-r--r--apps/calendar/ajax/event/edit.form.php2
-rw-r--r--apps/calendar/ajax/event/edit.php2
-rw-r--r--apps/calendar/ajax/event/move.php2
-rw-r--r--apps/calendar/ajax/event/new.form.php2
-rw-r--r--apps/calendar/ajax/event/new.php2
-rw-r--r--apps/calendar/ajax/event/resize.php2
-rwxr-xr-xapps/calendar/ajax/events.php2
-rw-r--r--apps/calendar/ajax/import/dialog.php2
-rw-r--r--apps/calendar/ajax/import/import.php3
-rw-r--r--apps/calendar/ajax/settings/getfirstday.php2
-rw-r--r--apps/calendar/ajax/settings/gettimezonedetection.php2
-rwxr-xr-xapps/calendar/ajax/settings/guesstimezone.php2
-rw-r--r--apps/calendar/ajax/settings/setfirstday.php2
-rw-r--r--apps/calendar/ajax/settings/settimeformat.php2
-rw-r--r--apps/calendar/ajax/settings/settimezone.php2
-rw-r--r--apps/calendar/ajax/settings/timeformat.php2
-rw-r--r--apps/calendar/ajax/settings/timezonedetection.php2
-rw-r--r--apps/calendar/ajax/share/changepermission.php2
-rw-r--r--apps/calendar/ajax/share/dropdown.php2
-rw-r--r--apps/calendar/ajax/share/share.php2
-rw-r--r--apps/calendar/ajax/share/unshare.php2
-rw-r--r--apps/calendar/caldav.php2
-rw-r--r--apps/calendar/export.php2
-rw-r--r--apps/calendar/index.php6
-rw-r--r--apps/calendar/templates/part.editevent.php6
-rw-r--r--apps/calendar/templates/part.newevent.php2
-rw-r--r--apps/contacts/ajax/activation.php2
-rw-r--r--apps/contacts/ajax/addbook.php2
-rw-r--r--apps/contacts/ajax/addcontact.php2
-rw-r--r--apps/contacts/ajax/addproperty.php2
-rw-r--r--apps/contacts/ajax/categories/categoriesfor.php2
-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.php2
-rw-r--r--apps/contacts/ajax/chooseaddressbook.php2
-rw-r--r--apps/contacts/ajax/contactdetails.php2
-rw-r--r--apps/contacts/ajax/contacts.php2
-rw-r--r--apps/contacts/ajax/createaddressbook.php2
-rw-r--r--apps/contacts/ajax/cropphoto.php2
-rw-r--r--apps/contacts/ajax/deletebook.php2
-rw-r--r--apps/contacts/ajax/deletecard.php2
-rw-r--r--apps/contacts/ajax/deleteproperty.php2
-rw-r--r--apps/contacts/ajax/editaddress.php2
-rw-r--r--apps/contacts/ajax/editaddressbook.php2
-rw-r--r--apps/contacts/ajax/editname.php2
-rw-r--r--apps/contacts/ajax/getdetails.php2
-rw-r--r--apps/contacts/ajax/importdialog.php2
-rw-r--r--apps/contacts/ajax/loadcard.php2
-rw-r--r--apps/contacts/ajax/loadintro.php2
-rw-r--r--apps/contacts/ajax/loadphoto.php2
-rw-r--r--apps/contacts/ajax/newcontact.php2
-rw-r--r--apps/contacts/ajax/savecrop.php2
-rw-r--r--apps/contacts/ajax/saveproperty.php2
-rw-r--r--apps/contacts/ajax/updateaddressbook.php2
-rw-r--r--apps/contacts/ajax/uploadphoto.php2
-rw-r--r--apps/contacts/carddav.php2
-rw-r--r--apps/contacts/css/contacts.css23
-rw-r--r--apps/contacts/dynphoto.php2
-rw-r--r--apps/contacts/export.php2
-rw-r--r--apps/contacts/import.php2
-rw-r--r--apps/contacts/index.php2
-rw-r--r--apps/contacts/js/contacts.js8
-rw-r--r--apps/contacts/photo.php2
-rw-r--r--apps/contacts/templates/index.php4
-rw-r--r--apps/contacts/thumbnail.php2
-rw-r--r--apps/external/ajax/setsites.php2
-rw-r--r--apps/external/index.php2
-rw-r--r--apps/files/admin.php60
-rw-r--r--apps/files/ajax/autocomplete.php56
-rw-r--r--apps/files/ajax/delete.php29
-rw-r--r--apps/files/ajax/download.php37
-rw-r--r--apps/files/ajax/list.php46
-rw-r--r--apps/files/ajax/mimeicon.php11
-rw-r--r--apps/files/ajax/move.php20
-rw-r--r--apps/files/ajax/newfile.php47
-rw-r--r--apps/files/ajax/newfolder.php22
-rw-r--r--apps/files/ajax/rawlist.php26
-rw-r--r--apps/files/ajax/rename.php21
-rw-r--r--apps/files/ajax/scan.php37
-rw-r--r--apps/files/ajax/timezone.php6
-rw-r--r--apps/files/ajax/upload.php64
-rw-r--r--apps/files/appinfo/app.php10
-rw-r--r--apps/files/css/files.css91
-rw-r--r--apps/files/download.php49
-rw-r--r--apps/files/index.php102
-rw-r--r--apps/files/js/admin.js23
-rw-r--r--apps/files/js/fileactions.js167
-rw-r--r--apps/files/js/filelist.js233
-rw-r--r--apps/files/js/files.js745
-rw-r--r--apps/files/js/jquery.fileupload.js866
-rw-r--r--apps/files/js/jquery.iframe-transport.js165
-rw-r--r--apps/files/js/timezone.js12
-rw-r--r--apps/files/l10n/ar.php23
-rw-r--r--apps/files/l10n/bg_BG.php19
-rw-r--r--apps/files/l10n/ca.php23
-rw-r--r--apps/files/l10n/cs_CZ.php23
-rw-r--r--apps/files/l10n/da.php23
-rw-r--r--apps/files/l10n/de.php23
-rw-r--r--apps/files/l10n/el.php23
-rw-r--r--apps/files/l10n/eo.php19
-rw-r--r--apps/files/l10n/es.php23
-rw-r--r--apps/files/l10n/et_EE.php23
-rw-r--r--apps/files/l10n/eu.php19
-rw-r--r--apps/files/l10n/fr.php23
-rw-r--r--apps/files/l10n/gl.php23
-rw-r--r--apps/files/l10n/he.php19
-rw-r--r--apps/files/l10n/hr.php19
-rw-r--r--apps/files/l10n/hu_HU.php19
-rw-r--r--apps/files/l10n/ia.php17
-rw-r--r--apps/files/l10n/id.php13
-rw-r--r--apps/files/l10n/it.php23
-rw-r--r--apps/files/l10n/ja_JP.php23
-rw-r--r--apps/files/l10n/lb.php19
-rw-r--r--apps/files/l10n/lt_LT.php19
-rw-r--r--apps/files/l10n/ms_MY.php13
-rw-r--r--apps/files/l10n/nb_NO.php13
-rw-r--r--apps/files/l10n/nl.php23
-rw-r--r--apps/files/l10n/nn_NO.php19
-rw-r--r--apps/files/l10n/pl.php23
-rw-r--r--apps/files/l10n/pt_BR.php19
-rw-r--r--apps/files/l10n/ro.php23
-rw-r--r--apps/files/l10n/ru.php23
-rw-r--r--apps/files/l10n/sk_SK.php23
-rw-r--r--apps/files/l10n/sl.php19
-rw-r--r--apps/files/l10n/sr.php23
-rw-r--r--apps/files/l10n/sr@latin.php19
-rw-r--r--apps/files/l10n/sv.php19
-rw-r--r--apps/files/l10n/th_TH.php23
-rw-r--r--apps/files/l10n/tr.php19
-rw-r--r--apps/files/l10n/xgettextfiles5
-rw-r--r--apps/files/l10n/zh_CN.php23
-rw-r--r--apps/files/settings.php60
-rw-r--r--apps/files/templates/admin.php19
-rw-r--r--apps/files/templates/index.php79
-rw-r--r--apps/files/templates/part.breadcrumb.php6
-rw-r--r--apps/files/templates/part.list.php33
-rw-r--r--apps/files/webdav.php52
-rw-r--r--apps/files_imageviewer/css/jquery.fancybox-1.3.4.css66
-rw-r--r--apps/files_sharing/ajax/getitem.php2
-rw-r--r--apps/files_sharing/ajax/setpermissions.php2
-rw-r--r--apps/files_sharing/ajax/share.php2
-rw-r--r--apps/files_sharing/ajax/unshare.php2
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php2
-rw-r--r--apps/files_sharing/list.php2
-rw-r--r--apps/files_texteditor/ajax/loadfile.php2
-rw-r--r--apps/files_texteditor/ajax/mtime.php2
-rw-r--r--apps/files_texteditor/ajax/savefile.php2
-rw-r--r--apps/gallery/ajax/createAlbum.php2
-rw-r--r--apps/gallery/ajax/galleryOp.php2
-rw-r--r--apps/gallery/ajax/sharing.php2
-rw-r--r--apps/gallery/ajax/thumbnail.php2
-rw-r--r--apps/gallery/css/sharing.css2
-rw-r--r--apps/gallery/index.php2
-rw-r--r--apps/gallery/lib/album.php2
-rw-r--r--apps/gallery/lib/images_utils.php2
-rw-r--r--apps/gallery/sharing.php2
-rw-r--r--apps/gallery/templates/index.php2
-rw-r--r--apps/inc.php1
-rw-r--r--apps/media/ajax/api.php8
-rw-r--r--apps/media/ajax/autoupdate.php2
-rw-r--r--apps/media/index.php6
-rw-r--r--apps/media/server/xml.server.php6
-rw-r--r--apps/media/tomahawk.php4
-rw-r--r--apps/remoteStorage/WebDAV.php2
-rw-r--r--apps/remoteStorage/ajax/revokeToken.php2
-rw-r--r--apps/remoteStorage/auth.php2
-rw-r--r--apps/user_migrate/ajax/export.php2
-rw-r--r--apps/user_webfinger/webfinger.php2
188 files changed, 4160 insertions, 184 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php
index 861b677222d..27e01bb3baf 100644
--- a/apps/bookmarks/addBm.php
+++ b/apps/bookmarks/addBm.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 8cda7f0f060..ceeb034ec9d 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -24,12 +24,12 @@
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
-require_once('../bookmarksHelper.php');
+require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php');
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
OC_JSON::success(array('data' => $id)); \ No newline at end of file
diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php
index 4aef86e771b..655d9f825d9 100644
--- a/apps/bookmarks/ajax/delBookmark.php
+++ b/apps/bookmarks/ajax/delBookmark.php
@@ -24,7 +24,7 @@
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php
index 35f30ebcb7a..a834cd216e6 100644
--- a/apps/bookmarks/ajax/editBookmark.php
+++ b/apps/bookmarks/ajax/editBookmark.php
@@ -24,7 +24,7 @@
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php
index e6fdfe043e1..a542f636d8c 100644
--- a/apps/bookmarks/ajax/recordClick.php
+++ b/apps/bookmarks/ajax/recordClick.php
@@ -24,7 +24,7 @@
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php
index 487e0d290e3..6aa951bbb65 100644
--- a/apps/bookmarks/ajax/updateList.php
+++ b/apps/bookmarks/ajax/updateList.php
@@ -25,7 +25,7 @@
//no apps or filesystem
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php
index 50fea3fddbd..4d604a4fd55 100644
--- a/apps/bookmarks/index.php
+++ b/apps/bookmarks/index.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js
index 16ed14c89b2..38b8c43eb7d 100644
--- a/apps/bookmarks/js/bookmarks.js
+++ b/apps/bookmarks/js/bookmarks.js
@@ -20,7 +20,7 @@ function getBookmarks() {
}
$.ajax({
- url: 'ajax/updateList.php',
+ url: OC.filePath('bookmarks', 'ajax', 'updateList.php'),
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
success: function(bookmarks){
if (bookmarks.data.length) {
@@ -63,7 +63,7 @@ function addOrEditBookmark(event) {
if (id == 0) {
$.ajax({
- url: 'ajax/addBookmark.php',
+ url: OC.filePath('bookmarks', 'ajax', 'addBookmark.php'),
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(response){
$('.bookmarks_input').val('');
@@ -75,7 +75,7 @@ function addOrEditBookmark(event) {
}
else {
$.ajax({
- url: 'ajax/editBookmark.php',
+ url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
success: function(){
$('.bookmarks_input').val('');
@@ -92,7 +92,7 @@ function addOrEditBookmark(event) {
function delBookmark(event) {
var record = $(this).parent().parent();
$.ajax({
- url: 'ajax/delBookmark.php',
+ url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
data: 'url=' + encodeURIComponent($(this).parent().parent().children('.bookmark_url:first').text()),
success: function(data){
record.remove();
@@ -164,7 +164,7 @@ function updateOnBottom() {
function recordClick(event) {
$.ajax({
- url: 'ajax/recordClick.php',
+ url: OC.filePath('bookmarks', 'ajax', 'recordClick.php'),
data: 'url=' + encodeURIComponent($(this).attr('href')),
});
}
diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
index 1abdbb7f838..9fe9ee7a9a9 100644
--- a/apps/bookmarks/templates/list.php
+++ b/apps/bookmarks/templates/list.php
@@ -20,7 +20,7 @@
<div id="firstrun" style="display: none;">
<?php
echo $l->t('You have no bookmarks');
- require_once('bookmarklet.php');
+ require_once(OC::$APPSROOT . '/apps/bookmarks/templates/bookmarklet.php');
createBookmarklet();
?>
</div>
diff --git a/apps/calendar/ajax/calendar/activation.php b/apps/calendar/ajax/calendar/activation.php
index 7677d85aff3..c93a0495717 100644
--- a/apps/calendar/ajax/calendar/activation.php
+++ b/apps/calendar/ajax/calendar/activation.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['calendarid'];
diff --git a/apps/calendar/ajax/calendar/delete.php b/apps/calendar/ajax/calendar/delete.php
index a2f5311731c..4bef912333c 100644
--- a/apps/calendar/ajax/calendar/delete.php
+++ b/apps/calendar/ajax/calendar/delete.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/calendar/edit.form.php b/apps/calendar/ajax/calendar/edit.form.php
index 8922b3eba4e..d3f9629f1ae 100644
--- a/apps/calendar/ajax/calendar/edit.form.php
+++ b/apps/calendar/ajax/calendar/edit.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/calendar/edit.php b/apps/calendar/ajax/calendar/edit.php
index 8922b3eba4e..d3f9629f1ae 100644
--- a/apps/calendar/ajax/calendar/edit.php
+++ b/apps/calendar/ajax/calendar/edit.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/calendar/new.form.php b/apps/calendar/ajax/calendar/new.form.php
index fa014351f77..3de56460c2d 100644
--- a/apps/calendar/ajax/calendar/new.form.php
+++ b/apps/calendar/ajax/calendar/new.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php
index 228e6247724..ada28a9fc07 100644
--- a/apps/calendar/ajax/calendar/new.php
+++ b/apps/calendar/ajax/calendar/new.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/calendar/ajax/calendar/overview.php b/apps/calendar/ajax/calendar/overview.php
index dd55f3e018f..f66d1eae8f8 100644
--- a/apps/calendar/ajax/calendar/overview.php
+++ b/apps/calendar/ajax/calendar/overview.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
$l10n = OC_L10N::get('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php
index f400c8c14b4..9bb1307a845 100644
--- a/apps/calendar/ajax/calendar/update.php
+++ b/apps/calendar/ajax/calendar/update.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php
index 0fd878ed8f9..9273986cad4 100644
--- a/apps/calendar/ajax/categories/rescan.php
+++ b/apps/calendar/ajax/categories/rescan.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php
index 76e29cbe265..736a5625530 100644
--- a/apps/calendar/ajax/changeview.php
+++ b/apps/calendar/ajax/changeview.php
@@ -5,8 +5,6 @@
* later.
* See the COPYING-README file.
*/
-
-require_once ('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$view = $_GET['v'];
diff --git a/apps/calendar/ajax/event/delete.php b/apps/calendar/ajax/event/delete.php
index fd7b709393a..3b726651641 100644
--- a/apps/calendar/ajax/event/delete.php
+++ b/apps/calendar/ajax/event/delete.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php
index 97b0907c839..e963da32958 100644
--- a/apps/calendar/ajax/event/edit.form.php
+++ b/apps/calendar/ajax/event/edit.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php
index f65b67b84ac..172488f6241 100644
--- a/apps/calendar/ajax/event/edit.php
+++ b/apps/calendar/ajax/event/edit.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php
index 63995602de2..75d174c13e1 100644
--- a/apps/calendar/ajax/event/move.php
+++ b/apps/calendar/ajax/event/move.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php
index 91b95546569..62087e9a817 100644
--- a/apps/calendar/ajax/event/new.form.php
+++ b/apps/calendar/ajax/event/new.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
diff --git a/apps/calendar/ajax/event/new.php b/apps/calendar/ajax/event/new.php
index 7070bbf05d7..5e8c305e97a 100644
--- a/apps/calendar/ajax/event/new.php
+++ b/apps/calendar/ajax/event/new.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php
index 75d6e0b2547..260b6914426 100644
--- a/apps/calendar/ajax/event/resize.php
+++ b/apps/calendar/ajax/event/resize.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
index 5b3d26b53b7..8adaa4c98f3 100755
--- a/apps/calendar/ajax/events.php
+++ b/apps/calendar/ajax/events.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once ('../../../lib/base.php');
+
require_once('when/When.php');
OC_JSON::checkLoggedIn();
diff --git a/apps/calendar/ajax/import/dialog.php b/apps/calendar/ajax/import/dialog.php
index 16ec54d14a2..0c1a8f94943 100644
--- a/apps/calendar/ajax/import/dialog.php
+++ b/apps/calendar/ajax/import/dialog.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$tmpl = new OC_Template('calendar', 'part.import');
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
index 4d5e7340aef..5848cac448d 100644
--- a/apps/calendar/ajax/import/import.php
+++ b/apps/calendar/ajax/import/import.php
@@ -7,7 +7,6 @@
*/
//check for calendar rights or create new one
ob_start();
-require_once ('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$nl="\r\n";
@@ -127,4 +126,4 @@ sleep(3);
if(is_writable('import_tmp/')){
unlink($progressfile);
}
-OC_JSON::success(); \ No newline at end of file
+OC_JSON::success();
diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php
index cab5870509a..63218dcd028 100644
--- a/apps/calendar/ajax/settings/getfirstday.php
+++ b/apps/calendar/ajax/settings/getfirstday.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
$firstday = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstday', 'mo');
OC_JSON::encodedPrint(array('firstday' => $firstday));
diff --git a/apps/calendar/ajax/settings/gettimezonedetection.php b/apps/calendar/ajax/settings/gettimezonedetection.php
index 11255fe8ef3..b9555900a0e 100644
--- a/apps/calendar/ajax/settings/gettimezonedetection.php
+++ b/apps/calendar/ajax/settings/gettimezonedetection.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php
index c02b8d10b8d..c0b4ef65263 100755
--- a/apps/calendar/ajax/settings/guesstimezone.php
+++ b/apps/calendar/ajax/settings/guesstimezone.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php
index 3b652212205..3b1b5481db4 100644
--- a/apps/calendar/ajax/settings/setfirstday.php
+++ b/apps/calendar/ajax/settings/setfirstday.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
if(isset($_POST["firstday"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php
index 8f65447065c..374825a5d40 100644
--- a/apps/calendar/ajax/settings/settimeformat.php
+++ b/apps/calendar/ajax/settings/settimeformat.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php
index 8dda28335f7..b0ca9dcd944 100644
--- a/apps/calendar/ajax/settings/settimezone.php
+++ b/apps/calendar/ajax/settings/settimezone.php
@@ -7,7 +7,7 @@
*/
// Init owncloud
-require_once('../../../../lib/base.php');
+
$l=OC_L10N::get('calendar');
diff --git a/apps/calendar/ajax/settings/timeformat.php b/apps/calendar/ajax/settings/timeformat.php
index e0dbe8d3cd7..728b7155efe 100644
--- a/apps/calendar/ajax/settings/timeformat.php
+++ b/apps/calendar/ajax/settings/timeformat.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24");
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
diff --git a/apps/calendar/ajax/settings/timezonedetection.php b/apps/calendar/ajax/settings/timezonedetection.php
index f67bab901e7..d29c5568e49 100644
--- a/apps/calendar/ajax/settings/timezonedetection.php
+++ b/apps/calendar/ajax/settings/timezonedetection.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
if($_POST['timezonedetection'] == 'on'){
diff --git a/apps/calendar/ajax/share/changepermission.php b/apps/calendar/ajax/share/changepermission.php
index 41d49e7b521..faf2a13c56b 100644
--- a/apps/calendar/ajax/share/changepermission.php
+++ b/apps/calendar/ajax/share/changepermission.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
$id = strip_tags($_GET['id']);
$idtype = strip_tags($_GET['idtype']);
$permission = (int) strip_tags($_GET['permission']);
diff --git a/apps/calendar/ajax/share/dropdown.php b/apps/calendar/ajax/share/dropdown.php
index eb396d38fd9..85530c163ed 100644
--- a/apps/calendar/ajax/share/dropdown.php
+++ b/apps/calendar/ajax/share/dropdown.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
$user = OC_USER::getUser();
$calid = $_GET['calid'];
$calendar = OC_Calendar_Calendar::find($calid);
diff --git a/apps/calendar/ajax/share/share.php b/apps/calendar/ajax/share/share.php
index 2e81040b477..70f1ec26ae6 100644
--- a/apps/calendar/ajax/share/share.php
+++ b/apps/calendar/ajax/share/share.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
$id = strip_tags($_GET['id']);
$idtype = strip_tags($_GET['idtype']);
switch($idtype){
diff --git a/apps/calendar/ajax/share/unshare.php b/apps/calendar/ajax/share/unshare.php
index 5bedbaaf0a6..c68fc23a6cb 100644
--- a/apps/calendar/ajax/share/unshare.php
+++ b/apps/calendar/ajax/share/unshare.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
$id = strip_tags($_GET['id']);
$idtype = strip_tags($_GET['idtype']);
switch($idtype){
diff --git a/apps/calendar/caldav.php b/apps/calendar/caldav.php
index b710b99ea43..7210b25879f 100644
--- a/apps/calendar/caldav.php
+++ b/apps/calendar/caldav.php
@@ -8,8 +8,8 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
+require_once('../inc.php');
-require_once('../../lib/base.php');
OC_Util::checkAppEnabled('calendar');
// Backends
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index 95cba03906f..0972ee0f788 100644
--- a/apps/calendar/export.php
+++ b/apps/calendar/export.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once ('../../lib/base.php');
+
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
diff --git a/apps/calendar/index.php b/apps/calendar/index.php
index c44de7f07df..417d2b6c225 100644
--- a/apps/calendar/index.php
+++ b/apps/calendar/index.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once ('../../lib/base.php');
+
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
@@ -22,8 +22,8 @@ foreach($calendars as $calendar){
$eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
}
-$eventSources[] = array('url' => 'ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');
-$eventSources[] = array('url' => 'ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
+$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');
+$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions();
diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php
index 58314db1a6b..102366f8f08 100644
--- a/apps/calendar/templates/part.editevent.php
+++ b/apps/calendar/templates/part.editevent.php
@@ -5,9 +5,9 @@
<?php echo $this->inc("part.eventform"); ?>
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">
- <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/event/edit.php');">
- <input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/event/delete.php');">
- <input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['eventid'] ?>';">
+ <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('?app=calendar&getfile=ajax/event/edit.php');">
+ <input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('?app=calendar&getfile=ajax/event/delete.php');">
+ <input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='?app=calendar&getfile=export.php?eventid=<?php echo $_['eventid'] ?>';">
</span>
</form>
</div>
diff --git a/apps/calendar/templates/part.newevent.php b/apps/calendar/templates/part.newevent.php
index 11416260344..f4bb867b180 100644
--- a/apps/calendar/templates/part.newevent.php
+++ b/apps/calendar/templates/part.newevent.php
@@ -3,7 +3,7 @@
<?php echo $this->inc("part.eventform"); ?>
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">
- <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/event/new.php');">
+ <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('?app=calendar&getfile=ajax/event/new.php');">
</span>
</form>
</div>
diff --git a/apps/contacts/ajax/activation.php b/apps/contacts/ajax/activation.php
index d69e3dba3f8..06d1a7e24fc 100644
--- a/apps/contacts/ajax/activation.php
+++ b/apps/contacts/ajax/activation.php
@@ -7,7 +7,7 @@
* See the COPYING-README file.
*/
-require_once ("../../../lib/base.php");
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/addbook.php b/apps/contacts/ajax/addbook.php
index f5852183cc3..f466d57e12e 100644
--- a/apps/contacts/ajax/addbook.php
+++ b/apps/contacts/ajax/addbook.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$book = array(
diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php
index 68da54655ae..152277181bb 100644
--- a/apps/contacts/ajax/addcontact.php
+++ b/apps/contacts/ajax/addcontact.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/addcontact.php: '.$msg, OC_Log::DEBUG);
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index d2c0291e8c6..9a5e59692d6 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/categories/categoriesfor.php b/apps/contacts/ajax/categories/categoriesfor.php
index c02c37914a2..39a7758c8fb 100644
--- a/apps/contacts/ajax/categories/categoriesfor.php
+++ b/apps/contacts/ajax/categories/categoriesfor.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/categories/delete.php b/apps/contacts/ajax/categories/delete.php
index 3ba5aa16068..3cc2dea6638 100644
--- a/apps/contacts/ajax/categories/delete.php
+++ b/apps/contacts/ajax/categories/delete.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/categories/list.php b/apps/contacts/ajax/categories/list.php
index 64d74c82e69..98c1c705180 100644
--- a/apps/contacts/ajax/categories/list.php
+++ b/apps/contacts/ajax/categories/list.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/categories/rescan.php b/apps/contacts/ajax/categories/rescan.php
index 5f1057bab44..09208c3f685 100644
--- a/apps/contacts/ajax/categories/rescan.php
+++ b/apps/contacts/ajax/categories/rescan.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/chooseaddressbook.php b/apps/contacts/ajax/chooseaddressbook.php
index d6080791299..b47c872e9aa 100644
--- a/apps/contacts/ajax/chooseaddressbook.php
+++ b/apps/contacts/ajax/chooseaddressbook.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/contactdetails.php b/apps/contacts/ajax/contactdetails.php
index 03895c862aa..13c3f80c3b5 100644
--- a/apps/contacts/ajax/contactdetails.php
+++ b/apps/contacts/ajax/contactdetails.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/contactdetails.php: '.$msg, OC_Log::DEBUG);
diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php
index cf86764105f..3e75e4c80e3 100644
--- a/apps/contacts/ajax/contacts.php
+++ b/apps/contacts/ajax/contacts.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php
index 28944fe864c..5cdb9b49ef8 100644
--- a/apps/contacts/ajax/createaddressbook.php
+++ b/apps/contacts/ajax/createaddressbook.php
@@ -6,7 +6,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/cropphoto.php b/apps/contacts/ajax/cropphoto.php
index 878fb5610c6..96e66ffb69c 100644
--- a/apps/contacts/ajax/cropphoto.php
+++ b/apps/contacts/ajax/cropphoto.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php
index 46d8deb4868..b80df526f95 100644
--- a/apps/contacts/ajax/deletebook.php
+++ b/apps/contacts/ajax/deletebook.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php
index 5675aef5f15..98cdb85f0fc 100644
--- a/apps/contacts/ajax/deletecard.php
+++ b/apps/contacts/ajax/deletecard.php
@@ -26,7 +26,7 @@ function bailOut($msg) {
}
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
index ab0958cac58..73786cb10cf 100644
--- a/apps/contacts/ajax/deleteproperty.php
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/editaddress.php b/apps/contacts/ajax/editaddress.php
index 4e6456f6045..73f34ef5c6c 100644
--- a/apps/contacts/ajax/editaddress.php
+++ b/apps/contacts/ajax/editaddress.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/editaddressbook.php b/apps/contacts/ajax/editaddressbook.php
index a6262f39b23..ef797778d95 100644
--- a/apps/contacts/ajax/editaddressbook.php
+++ b/apps/contacts/ajax/editaddressbook.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$addressbook = OC_Contacts_App::getAddressbook($_GET['bookid']);
diff --git a/apps/contacts/ajax/editname.php b/apps/contacts/ajax/editname.php
index 31bdd125675..9e4d6814620 100644
--- a/apps/contacts/ajax/editname.php
+++ b/apps/contacts/ajax/editname.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
function bailOut($msg) {
diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php
index 4819916f4c3..aac69f4c52e 100644
--- a/apps/contacts/ajax/getdetails.php
+++ b/apps/contacts/ajax/getdetails.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/importdialog.php b/apps/contacts/ajax/importdialog.php
index 280e462f662..cde6bb2f5c4 100644
--- a/apps/contacts/ajax/importdialog.php
+++ b/apps/contacts/ajax/importdialog.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$tmpl = new OC_Template('contacts', 'part.import');
diff --git a/apps/contacts/ajax/loadcard.php b/apps/contacts/ajax/loadcard.php
index 037fe2a6df2..4b2a65db911 100644
--- a/apps/contacts/ajax/loadcard.php
+++ b/apps/contacts/ajax/loadcard.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/loadcard.php: '.$msg, OC_Log::DEBUG);
diff --git a/apps/contacts/ajax/loadintro.php b/apps/contacts/ajax/loadintro.php
index 8e5673655a1..7185c5cbe0a 100644
--- a/apps/contacts/ajax/loadintro.php
+++ b/apps/contacts/ajax/loadintro.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/loadintro.php: '.$msg, OC_Log::DEBUG);
diff --git a/apps/contacts/ajax/loadphoto.php b/apps/contacts/ajax/loadphoto.php
index 2f95cdc9328..c076d97a7c2 100644
--- a/apps/contacts/ajax/loadphoto.php
+++ b/apps/contacts/ajax/loadphoto.php
@@ -20,7 +20,7 @@
*
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
diff --git a/apps/contacts/ajax/newcontact.php b/apps/contacts/ajax/newcontact.php
index fcfd12ca80d..36c37e039e9 100644
--- a/apps/contacts/ajax/newcontact.php
+++ b/apps/contacts/ajax/newcontact.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/newcontact.php: '.$msg, OC_Log::DEBUG);
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index d003834ef8c..c1a0e2b0583 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -22,7 +22,7 @@
* Remember to delete tmp file at some point.
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
OC_Log::write('contacts','ajax/savecrop.php: Huzzah!!!', OC_Log::DEBUG);
// Check if we are a user
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index 99d55e7927a..e459ed733d8 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php
index 211df84b1d1..06028db479a 100644
--- a/apps/contacts/ajax/updateaddressbook.php
+++ b/apps/contacts/ajax/updateaddressbook.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/contacts/ajax/uploadphoto.php b/apps/contacts/ajax/uploadphoto.php
index 15d4718241e..082776f7f27 100644
--- a/apps/contacts/ajax/uploadphoto.php
+++ b/apps/contacts/ajax/uploadphoto.php
@@ -20,7 +20,7 @@
*
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
// Firefox and Konqueror tries to download application/json for me. --Arthur
diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php
index 654aeb66a72..1a11ccdb3f7 100644
--- a/apps/contacts/carddav.php
+++ b/apps/contacts/carddav.php
@@ -22,8 +22,8 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
+require_once('../inc.php');
-require_once('../../lib/base.php');
OC_Util::checkAppEnabled('contacts');
// Backends
diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css
index ae96c5e4e9f..e3d2cfbdd66 100644
--- a/apps/contacts/css/contacts.css
+++ b/apps/contacts/css/contacts.css
@@ -11,7 +11,7 @@
#actionbar { height: 30px; width: 60px; position: fixed; right: 0px; top: 4em; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; }
#contacts_deletecard {position:absolute;top:15px;right:25px;}
#contacts_downloadcard {position:absolute;top:15px;right:50px;}
-#contacts_propertymenu_button { position:absolute;top:15px;right:150px; background:url('../../../core/img/actions/add.svg') no-repeat center; }
+#contacts_propertymenu_button { position:absolute;top:15px;right:150px; background:url('%webroot%/core/img/actions/add.svg') no-repeat center; }
#contacts_propertymenu { background-color: #fff; position:absolute;top:40px;right:150px; overflow:hidden; text-overflow:ellipsis; /*border: thin solid #1d2d44;*/ -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; }
#contacts_propertymenu li { display: block; font-weight: bold; height: 20px; width: 100px; }
#contacts_propertymenu li a { padding: 3px; display: block }
@@ -35,20 +35,20 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
#address.form dl { min-width: 10em; }
.droptarget { margin: 0.5em; padding: 0.5em; border: thin solid #ccc; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
.droppable { margin: 0.5em; padding: 0.5em; border: thin dashed #333; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
-.loading { background: url('../../../core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
-.ui-autocomplete-loading { background: url('../../../core/img/loading.gif') right center no-repeat; }
+.loading { background: url('%webroot%/core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
+.ui-autocomplete-loading { background: url('%webroot%/core/img/loading.gif') right center no-repeat; }
.float { float: left; }
.listactions { height: 1em; width:60px; float: left; clear: right; }
.add,.edit,.delete,.mail, .globe, .upload, .cloud { cursor: pointer; width: 20px; height: 20px; margin: 0; float: left; position:relative; opacity: 0.1; }
.add:hover,.edit:hover,.delete:hover,.mail:hover, .globe:hover, .upload:hover, .cloud:hover { opacity: 1.0 }
-.add { background:url('../../../core/img/actions/add.svg') no-repeat center; clear: both; }
-.delete { background:url('../../../core/img/actions/delete.svg') no-repeat center; }
-.edit { background:url('../../../core/img/actions/rename.svg') no-repeat center; }
-.mail { background:url('../../../core/img/actions/mail.svg') no-repeat center; }
-.upload { background:url('../../../core/img/actions/upload.svg') no-repeat center; }
-.cloud { background:url('../../../core/img/places/picture.svg') no-repeat center; }
+.add { background:url('%webroot%/core/img/actions/add.svg') no-repeat center; clear: both; }
+.delete { background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
+.edit { background:url('%webroot%/core/img/actions/rename.svg') no-repeat center; }
+.mail { background:url('%webroot%/core/img/actions/mail.svg') no-repeat center; }
+.upload { background:url('%webroot%/core/img/actions/upload.svg') no-repeat center; }
+.cloud { background:url('%webroot%/core/img/places/picture.svg') no-repeat center; }
/*.globe { background:url('../img/globe.svg') no-repeat center; }*/
-.globe { background:url('../../../core/img/actions/public.svg') no-repeat center; }
+.globe { background:url('%webroot%/core/img/actions/public.svg') no-repeat center; }
.transparent{ opacity: 0.6; }
#edit_name_dialog { padding:0; }
#edit_name_dialog > input { width: 15em; }
@@ -65,7 +65,7 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
.contactpart legend { width:auto; padding:.3em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
#cropbox { margin: auto; }
-#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; margin: 0.3em; background: url(../../../core/img/loading.gif) no-repeat center center; display: block; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; }
+#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; margin: 0.3em; background: url('%webroot%/core/img/loading.gif') no-repeat center center; display: block; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; }
#contacts_details_photo:hover { background: #fff; cursor: default; }
#phototools { position:absolute; margin: 5px 0 0 10px; width:auto; height:22px; padding:0px; background-color:#fff; list-style-type:none; border-radius: 0.5em; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; }
#phototools li { display: inline; }
@@ -101,4 +101,3 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
.propertylist li > select { float: left; max-width: 8em; }
.typelist { float: left; max-width: 10em; } /* for multiselect */
.addresslist { clear: both; }
-
diff --git a/apps/contacts/dynphoto.php b/apps/contacts/dynphoto.php
index 2beac15e143..c1646e483de 100644
--- a/apps/contacts/dynphoto.php
+++ b/apps/contacts/dynphoto.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../lib/base.php');
+
$tmp_path = $_GET['tmp_path'];
$maxsize = isset($_GET['maxsize']) ? $_GET['maxsize'] : -1;
header("Cache-Control: no-cache, no-store, must-revalidate");
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index fb3e0a41ae7..95d02a9afd4 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once ("../../lib/base.php");
+
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL;
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index 45f1b0c53dc..8e0a427399b 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -7,7 +7,7 @@
*/
//check for addressbooks rights or create new one
ob_start();
-require_once ('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$nl = "\n";
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 4039b8afd3d..d5545e76197 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -6,7 +6,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index e649e1744c3..edb7da70407 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -302,7 +302,7 @@ Contacts={
Contacts.UI.loadHandlers();
Contacts.UI.Card.loadContact(jsondata.data);
$('#leftcontent .active').removeClass('active');
- var item = '<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url(thumbnail.php?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+Contacts.UI.Card.fn+'</a></li>';
+ var item = '<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+Contacts.UI.Card.fn+'</a></li>';
var added = false;
$('#leftcontent ul li').each(function(){
if ($(this).text().toLowerCase() > Contacts.UI.Card.fn.toLowerCase()) {
@@ -1528,12 +1528,12 @@ Contacts={
lazyupdate:function(){
$('#contacts li').live('inview', function(){
if (!$(this).find('a').attr('style')) {
- $(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
+ $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat');
}
});
},
refreshThumbnail:function(id){
- $('#contacts [data-id="'+id+'"]').find('a').css('background','url(thumbnail.php?id='+id+'&refresh=1'+Math.random()+') no-repeat');
+ $('#contacts [data-id="'+id+'"]').find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+id+'&refresh=1'+Math.random()+') no-repeat');
}
}
}
@@ -1592,7 +1592,7 @@ $(document).ready(function(){
// whole part of element is visible
if (!$(this).find('a').attr('style')) {
//alert($(this).data('id') + ' has background: ' + $(this).attr('style'));
- $(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
+ $(this).find('a').css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+$(this).data('id')+') no-repeat');
}/* else {
alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url'));
}*/
diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php
index 117d0a9808f..c19ccccbc7f 100644
--- a/apps/contacts/photo.php
+++ b/apps/contacts/photo.php
@@ -9,7 +9,7 @@
*/
// Init owncloud
-require_once('../../lib/base.php');
+
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 256d10afc07..d7aabbe76a5 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -16,8 +16,8 @@
</div>
<div id="bottomcontrols">
<form>
- <img class="svg" id="contacts_newcontact" src="img/contact-new.svg" alt="<?php echo $l->t('Add Contact'); ?>" title="<?php echo $l->t('Add Contact'); ?>" />
- <img class="svg" id="chooseaddressbook" src="../../core/img/actions/settings.svg" alt="<?php echo $l->t('Addressbooks'); ?>" title="<?php echo $l->t('Addressbooks'); ?>" />
+ <img class="svg" id="contacts_newcontact" src="<?php echo OC_Helper::linkTo('contacts', 'img/contact-new.svg'); ?>" alt="<?php echo $l->t('Add Contact'); ?>" title="<?php echo $l->t('Add Contact'); ?>" />
+ <img class="svg" id="chooseaddressbook" src="core/img/actions/settings.svg" alt="<?php echo $l->t('Addressbooks'); ?>" title="<?php echo $l->t('Addressbooks'); ?>" />
</form>
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php
index 28b8eba22c9..13f16954caf 100644
--- a/apps/contacts/thumbnail.php
+++ b/apps/contacts/thumbnail.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
//OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
diff --git a/apps/external/ajax/setsites.php b/apps/external/ajax/setsites.php
index 0537b7ea581..3223bf68d9b 100644
--- a/apps/external/ajax/setsites.php
+++ b/apps/external/ajax/setsites.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+
OC_Util::checkAdminUser();
$sites = array();
diff --git a/apps/external/index.php b/apps/external/index.php
index 1c20f59eaff..0baa62a94b6 100644
--- a/apps/external/index.php
+++ b/apps/external/index.php
@@ -20,7 +20,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-require_once('../../lib/base.php');
+
require_once('lib/external.php');
OC_Util::checkLoggedIn();
diff --git a/apps/files/admin.php b/apps/files/admin.php
new file mode 100644
index 00000000000..bdea70506fb
--- /dev/null
+++ b/apps/files/admin.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+// Init owncloud
+
+
+OC_Util::checkAdminUser();
+
+$htaccessWorking=(getenv('htaccessWorking')=='true');
+
+$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$maxUploadFilesize = OC_Helper::humanFileSize(min($upload_max_filesize, $post_max_size));
+if($_POST) {
+ if(isset($_POST['maxUploadSize'])){
+ if(($setMaxSize = OC_Files::setUploadLimit(OC_Helper::computerFileSize($_POST['maxUploadSize']))) !== false) {
+ $maxUploadFilesize = OC_Helper::humanFileSize($setMaxSize);
+ }
+ }
+ if(isset($_POST['maxZipInputSize'])) {
+ $maxZipInputSize=$_POST['maxZipInputSize'];
+ OC_Config::setValue('maxZipInputSize', OC_Helper::computerFileSize($maxZipInputSize));
+ }
+ if(isset($_POST['submitFilesAdminSettings'])) {
+ OC_Config::setValue('allowZipDownload', isset($_POST['allowZipDownload']));
+ }
+}
+$maxZipInputSize = OC_Helper::humanFileSize(OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB')));
+$allowZipDownload = intval(OC_Config::getValue('allowZipDownload', true));
+
+OC_App::setActiveNavigationEntry( "files_administration" );
+
+$tmpl = new OC_Template( 'files', 'admin' );
+$tmpl->assign( 'htaccessWorking', $htaccessWorking );
+$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
+$tmpl->assign( 'maxPossibleUploadSize', OC_Helper::humanFileSize(PHP_INT_MAX));
+$tmpl->assign( 'allowZipDownload', $allowZipDownload);
+$tmpl->assign( 'maxZipInputSize', $maxZipInputSize);
+return $tmpl->fetchPage(); \ No newline at end of file
diff --git a/apps/files/ajax/autocomplete.php b/apps/files/ajax/autocomplete.php
new file mode 100644
index 00000000000..8cdb6188a02
--- /dev/null
+++ b/apps/files/ajax/autocomplete.php
@@ -0,0 +1,56 @@
+<?php
+//provide auto completion of paths for use with jquer ui autocomplete
+
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get data
+$query = $_GET['term'];
+$dirOnly=(isset($_GET['dironly']))?($_GET['dironly']=='true'):false;
+
+if($query[0]!='/'){
+ $query='/'.$query;
+}
+
+if(substr($query,-1,1)=='/'){
+ $base=$query;
+}else{
+ $base=dirname($query);
+}
+
+$query=substr($query,strlen($base));
+
+if($base!='/'){
+ $query=substr($query,1);
+}
+$queryLen=strlen($query);
+$query=strtolower($query);
+
+// echo "$base - $query";
+
+$files=array();
+
+if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){
+ $dh = OC_Filesystem::opendir($base);
+ if($dh){
+ if(substr($base,-1,1)!='/'){
+ $base=$base.'/';
+ }
+ while (($file = readdir($dh)) !== false) {
+ if ($file != "." && $file != ".."){
+ if(substr(strtolower($file),0,$queryLen)==$query){
+ $item=$base.$file;
+ if((!$dirOnly or OC_Filesystem::is_dir($item))){
+ $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item);
+ }
+ }
+ }
+ }
+ }
+}
+OC_JSON::encodedPrint($files);
+
+?>
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
new file mode 100644
index 00000000000..d8a01d7acf1
--- /dev/null
+++ b/apps/files/ajax/delete.php
@@ -0,0 +1,29 @@
+<?php
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get data
+$dir = stripslashes($_GET["dir"]);
+$files = isset($_GET["file"]) ? stripslashes($_GET["file"]) : stripslashes($_GET["files"]);
+
+$files = explode(';', $files);
+$filesWithError = '';
+$success = true;
+//Now delete
+foreach($files as $file) {
+ if( !OC_Files::delete( $dir, $file )){
+ $filesWithError .= $file . "\n";
+ $success = false;
+ }
+}
+
+if($success) {
+ OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
+} else {
+ OC_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
new file mode 100644
index 00000000000..65c04c36faf
--- /dev/null
+++ b/apps/files/ajax/download.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+// only need filesystem apps
+$RUNTIME_APPTYPES=array('filesystem');
+
+// Init owncloud
+
+
+// Check if we are a user
+OC_Util::checkLoggedIn();
+
+$files = $_GET["files"];
+$dir = $_GET["dir"];
+
+OC_Files::get($dir,$files);
+?>
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
new file mode 100644
index 00000000000..83914332a7d
--- /dev/null
+++ b/apps/files/ajax/list.php
@@ -0,0 +1,46 @@
+<?php
+
+// only need filesystem apps
+$RUNTIME_APPTYPES=array('filesystem');
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Load the files
+$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
+$data = array();
+
+// Make breadcrumb
+if($doBreadcrumb){
+ $breadcrumb = array();
+ $pathtohere = "/";
+ foreach( explode( "/", $dir ) as $i ){
+ if( $i != "" ){
+ $pathtohere .= "$i/";
+ $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
+ }
+ }
+
+ $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
+ $breadcrumbNav->assign( "breadcrumb", $breadcrumb );
+
+ $data['breadcrumb'] = $breadcrumbNav->fetchPage();
+}
+
+// make filelist
+$files = array();
+foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
+ $i["date"] = OC_Util::formatDate($i["mtime"] );
+ $files[] = $i;
+}
+
+$list = new OC_Template( "files", "part.list", "" );
+$list->assign( "files", $files );
+$data = array('files' => $list->fetchPage());
+
+OC_JSON::success(array('data' => $data));
+
+?>
diff --git a/apps/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php
new file mode 100644
index 00000000000..57898cd82d9
--- /dev/null
+++ b/apps/files/ajax/mimeicon.php
@@ -0,0 +1,11 @@
+<?php
+
+// no need for apps
+$RUNTIME_NOAPPS=false;
+
+// Init owncloud
+
+
+print OC_Helper::mimetypeIcon($_GET['mime']);
+
+?>
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
new file mode 100644
index 00000000000..0ad314f873c
--- /dev/null
+++ b/apps/files/ajax/move.php
@@ -0,0 +1,20 @@
+<?php
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get data
+$dir = stripslashes($_GET["dir"]);
+$file = stripslashes($_GET["file"]);
+$target = stripslashes($_GET["target"]);
+
+
+if(OC_Files::move($dir,$file,$target,$file)){
+ OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
+}else{
+ OC_JSON::error(array("data" => array( "message" => "Could not move $file" )));
+}
+
+?>
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
new file mode 100644
index 00000000000..472b577a32a
--- /dev/null
+++ b/apps/files/ajax/newfile.php
@@ -0,0 +1,47 @@
+<?php
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get the params
+$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
+$filename = isset( $_POST['filename'] ) ? stripslashes($_POST['filename']) : '';
+$content = isset( $_POST['content'] ) ? $_POST['content'] : '';
+$source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : '';
+
+if($filename == '') {
+ OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
+ exit();
+}
+
+if($source){
+ if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){
+ OC_JSON::error(array("data" => array( "message" => "Not a valid source" )));
+ exit();
+ }
+ $sourceStream=fopen($source,'rb');
+ $target=$dir.'/'.$filename;
+ $result=OC_Filesystem::file_put_contents($target,$sourceStream);
+ if($result){
+ $mime=OC_Filesystem::getMimetype($target);
+ OC_JSON::success(array("data" => array('mime'=>$mime)));
+ exit();
+ }else{
+ OC_JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
+ exit();
+ }
+}
+
+
+if(OC_Files::newFile($dir, $filename, 'file')) {
+ if($content){
+ OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
+ }
+ OC_JSON::success(array("data" => array('content'=>$content)));
+ exit();
+}
+
+
+OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php
new file mode 100644
index 00000000000..2aff95e5b35
--- /dev/null
+++ b/apps/files/ajax/newfolder.php
@@ -0,0 +1,22 @@
+<?php
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get the params
+$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
+$foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : '';
+
+if(trim($foldername) == '') {
+ OC_JSON::error(array("data" => array( "message" => "Empty Foldername" )));
+ exit();
+}
+
+if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) {
+ OC_JSON::success(array("data" => array()));
+ exit();
+}
+
+OC_JSON::error(array("data" => array( "message" => "Error when creating the folder" )));
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
new file mode 100644
index 00000000000..8f1990d1b8f
--- /dev/null
+++ b/apps/files/ajax/rawlist.php
@@ -0,0 +1,26 @@
+<?php
+
+// only need filesystem apps
+$RUNTIME_APPTYPES=array('filesystem');
+
+// Init owncloud
+
+require_once('../../lib/template.php');
+
+OC_JSON::checkLoggedIn();
+
+// Load the files
+$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
+
+// make filelist
+$files = array();
+foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){
+ $i["date"] = OC_Util::formatDate($i["mtime"] );
+ $i['mimetype_icon'] = $i['type'] == 'dir' ? mimetype_icon('dir'): mimetype_icon($i['mimetype']);
+ $files[] = $i;
+}
+
+OC_JSON::success(array('data' => $files));
+
+?>
diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php
new file mode 100644
index 00000000000..dc5d3962abd
--- /dev/null
+++ b/apps/files/ajax/rename.php
@@ -0,0 +1,21 @@
+<?php
+
+// Init owncloud
+
+
+OC_JSON::checkLoggedIn();
+
+// Get data
+$dir = stripslashes($_GET["dir"]);
+$file = stripslashes($_GET["file"]);
+$newname = stripslashes($_GET["newname"]);
+
+// Delete
+if( OC_Files::move( $dir, $file, $dir, $newname )) {
+ OC_JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
+}
+else{
+ OC_JSON::error(array("data" => array( "message" => "Unable to rename file" )));
+}
+
+?>
diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php
new file mode 100644
index 00000000000..a227dcc3ffc
--- /dev/null
+++ b/apps/files/ajax/scan.php
@@ -0,0 +1,37 @@
+<?php
+
+set_time_limit(0);//scanning can take ages
+
+$force=isset($_GET['force']) and $_GET['force']=='true';
+$dir=isset($_GET['dir'])?$_GET['dir']:'';
+$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
+
+if(!$checkOnly){
+ $eventSource=new OC_EventSource();
+}
+
+
+//create the file cache if necesary
+if($force or !OC_FileCache::inCache('')){
+ if(!$checkOnly){
+ OC_DB::beginTransaction();
+ OC_FileCache::scan($dir,$eventSource);
+ OC_FileCache::clean();
+ OC_DB::commit();
+ $eventSource->send('success',true);
+ }else{
+ OC_JSON::success(array('data'=>array('done'=>true)));
+ exit;
+ }
+}else{
+ if($checkOnly){
+ OC_JSON::success(array('data'=>array('done'=>false)));
+ exit;
+ }
+ if(isset($eventSource)){
+ $eventSource->send('success',false);
+ }else{
+ exit;
+ }
+}
+$eventSource->close(); \ No newline at end of file
diff --git a/apps/files/ajax/timezone.php b/apps/files/ajax/timezone.php
new file mode 100644
index 00000000000..8e1d2aa1ec1
--- /dev/null
+++ b/apps/files/ajax/timezone.php
@@ -0,0 +1,6 @@
+<?php
+ // FIXME: this should start a secure session if forcessl is enabled
+ // see lib/base.php for an example
+ session_start();
+ $_SESSION['timezone'] = $_GET['time'];
+?>
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
new file mode 100644
index 00000000000..c60e1a3752a
--- /dev/null
+++ b/apps/files/ajax/upload.php
@@ -0,0 +1,64 @@
+<?php
+
+// Init owncloud
+
+
+// Firefox and Konqueror tries to download application/json for me. --Arthur
+OC_JSON::setContentTypeHeader('text/plain');
+
+OC_JSON::checkLoggedIn();
+
+if (!isset($_FILES['files'])) {
+ OC_JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" )));
+ exit();
+}
+foreach ($_FILES['files']['error'] as $error) {
+ if ($error != 0) {
+ $l=OC_L10N::get('files');
+ $errors = array(
+ UPLOAD_ERR_OK=>$l->t("There is no error, the file uploaded with success"),
+ UPLOAD_ERR_INI_SIZE=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),
+ UPLOAD_ERR_FORM_SIZE=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
+ UPLOAD_ERR_PARTIAL=>$l->t("The uploaded file was only partially uploaded"),
+ UPLOAD_ERR_NO_FILE=>$l->t("No file was uploaded"),
+ UPLOAD_ERR_NO_TMP_DIR=>$l->t("Missing a temporary folder"),
+ UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'),
+ );
+ OC_JSON::error(array("data" => array( "message" => $errors[$error] )));
+ exit();
+ }
+}
+$files=$_FILES['files'];
+
+$dir = $_POST['dir'];
+$dir .= '/';
+$error='';
+
+$totalSize=0;
+foreach($files['size'] as $size){
+ $totalSize+=$size;
+}
+if($totalSize>OC_Filesystem::free_space('/')){
+ OC_JSON::error(array("data" => array( "message" => "Not enough space available" )));
+ exit();
+}
+
+$result=array();
+if(strpos($dir,'..') === false){
+ $fileCount=count($files['name']);
+ for($i=0;$i<$fileCount;$i++){
+ $target = OC_Helper::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
+ if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){
+ $meta=OC_FileCache::getCached($target);
+ $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target));
+ }
+ }
+ OC_JSON::encodedPrint($result);
+ exit();
+}else{
+ $error='invalid dir';
+}
+
+OC_JSON::error(array('data' => array('error' => $error, "file" => $fileName)));
+
+?>
diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php
new file mode 100644
index 00000000000..c4a2ee7407a
--- /dev/null
+++ b/apps/files/appinfo/app.php
@@ -0,0 +1,10 @@
+<?php
+
+
+$l=OC_L10N::get('files');
+
+OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
+
+OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") ));
+
+OC_Search::registerProvider('OC_Search_Provider_File');
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
new file mode 100644
index 00000000000..a135f7ded5b
--- /dev/null
+++ b/apps/files/css/files.css
@@ -0,0 +1,91 @@
+/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
+ This file is licensed under the Affero General Public License version 3 or later.
+ See the COPYING-README file. */
+
+/* FILE MENU */
+.actions { padding:.3em; float:left; height:2em; }
+.actions input, .actions button, .actions .button { margin:0; }
+#file_menu { right:0; position:absolute; top:0; }
+#file_menu a { display:block; float:left; background-image:none; text-decoration:none; }
+.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; }
+#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
+.file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; }
+.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;}
+.file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; }
+#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; }
+#new.active { border-bottom-left-radius:0; border-bottom:none; background:#f8f8f8 }
+#new>a{ padding-left:1em; padding-right:1em; }
+#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; }
+#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em }
+#new>ul>li>p { cursor:pointer; }
+#new>ul>li>input { padding:0.3em; margin:-0.3em; }
+
+#file_newfolder_name { background-image:url('%webroot%/core/img/places/folder.svg'); font-weight:normal; width:7em; }
+.file_upload_start, .file_upload_filename { font-size:1em; }
+#file_newfolder_submit, #file_upload_submit { width:3em; }
+.file_upload_target { display:none; }
+
+.file_upload_start { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;}
+.file_upload_filename.active { border-bottom-right-radius:0 }
+.file_upload_filename { position: relative; z-index:100; padding-left: 0.8em; padding-right: 0.8em; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; }
+.file_upload_filename img { position: absolute; top: 0.4em; left: 0.4em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
+
+#upload { position:absolute; right:13.5em; top:0em; }
+#upload #uploadprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; }
+
+.file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; }
+
+/* FILE TABLE */
+#emptyfolder { position:absolute; margin:10em 0 0 10em; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0; }
+.emptyfolder #new, .emptyfolder .file_upload_filename { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; }
+table { position:relative; top:37px; width:100%; }
+tbody tr { background-color:#fff; height:2.5em; }
+tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#f8f8f8; }
+tbody tr.selected { background-color:#eee; }
+tbody a { color:#000; }
+span.extension, span.uploading, td.date { color:#999; }
+span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
+tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; color:#777; }
+div.crumb { float:left; display:block; background:no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em; }
+div.crumb:first-child { padding-left:1em; }
+div.crumb.last { font-weight:bold; }
+table tr.mouseOver td { background-color:#eee; }
+table th { height:2em; padding:0 .5em; color:#999; }
+table th .name { float:left; margin-left:.5em; }
+table th.multiselect { background:#ddd; color:#000; font-weight:bold; }
+table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; }
+table td { border-bottom:1px solid #eee; font-style:normal; background-position:1em .5em; background-repeat:no-repeat; }
+table th#headerSize, table td.filesize { width:3em; padding:0 1em; text-align:right; }
+table th#headerDate, table td.date { width:11em; padding:0 .1em 0 1em; text-align:left; }
+table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; }
+table td.filename a.name { display:block; height:1.5em; vertical-align:middle; margin-left:3em; }
+table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; }
+table td.filename a.name input, table td.filename a.name form { width:100%; cursor:text; }
+table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 0; }
+table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; }
+// TODO fix usability bug (accidental file/folder selection)
+table td.filename .nametext { width:70%; overflow:hidden; }
+table td.filename .uploadtext { font-weight:normal; margin-left:.5em; }
+table td.filename form { float:left; font-size:.85em; }
+table thead.fixed tr{ position:fixed; top:6.5em; z-index:49; -moz-box-shadow:0 -3px 7px #ddd; -webkit-box-shadow:0 -3px 7px #ddd; box-shadow:0 -3px 7px #ddd; }
+table thead.fixed { height:2em; }
+#fileList tr td.filename>input[type=checkbox]:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
+#fileList tr td.filename>input[type="checkbox"]:hover:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; }
+#fileList tr td.filename>input[type="checkbox"]:checked:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
+#fileList tr td.filename { -webkit-transition:background-image 500ms; -moz-transition:background-image 500ms; -o-transition:background-image 500ms; transition:background-image 500ms; }
+#select_all { float:left; margin:.3em 0.6em 0 .5em; }
+#uploadsize-message,#delete-confirm { display:none; }
+.fileactions { position:relative; top:.3em; right:-4em; font-size:.8em; }
+#fileList .fileactions a.action img { position:relative; top:.2em; }
+#fileList a.action { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; }
+a.action.delete { float:right; }
+a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
+.selectedActions { display:none; float:right; }
+.selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; }
+.selectedActions a img { position:relative; top:.3em; }
+
+/* add breadcrumb divider to the File item in navigation panel */
+#navigation>ul>li:first-child { background:url('%webroot%/core/img/breadcrumb-start.svg') no-repeat 12.5em 0px; width:12.5em; padding-right:1em; position:fixed; }
+#navigation>ul>li:first-child+li { padding-top:2.9em; }
+
+#scanning-message{ top:40%; left:40%; position:absolute; display:none }
diff --git a/apps/files/download.php b/apps/files/download.php
new file mode 100644
index 00000000000..ec4a6e1fc9c
--- /dev/null
+++ b/apps/files/download.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+// Init owncloud
+
+
+// Check if we are a user
+OC_Util::checkLoggedIn();
+
+$filename = $_GET["file"];
+
+if(!OC_Filesystem::file_exists($filename)){
+ header("HTTP/1.0 404 Not Found");
+ $tmpl = new OC_Template( '', '404', 'guest' );
+ $tmpl->assign('file',$filename);
+ $tmpl->printPage();
+ exit;
+}
+
+$ftype=OC_Filesystem::getMimeType( $filename );
+
+header('Content-Type:'.$ftype);
+header('Content-Disposition: attachment; filename="'.basename($filename).'"');
+OC_Response::disableCaching();
+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
new file mode 100644
index 00000000000..8464db30f01
--- /dev/null
+++ b/apps/files/index.php
@@ -0,0 +1,102 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+// Check if we are a user
+OC_Util::checkLoggedIn();
+
+// Load the files we need
+OC_Util::addStyle( "files", "files" );
+OC_Util::addScript( "files", "jquery.iframe-transport" );
+OC_Util::addScript( "files", "jquery.fileupload" );
+OC_Util::addScript( "files", "files" );
+OC_Util::addScript( 'files', 'filelist' );
+OC_Util::addScript( 'files', 'fileactions' );
+if(!isset($_SESSION['timezone'])){
+ OC_Util::addScript( 'files', 'timezone' );
+}
+OC_App::setActiveNavigationEntry( "files_index" );
+// Load the files
+$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
+// Redirect if directory does not exist
+if(!OC_Filesystem::is_dir($dir.'/')) {
+ header("Location: ".$_SERVER['PHP_SELF']."");
+}
+
+$files = array();
+foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
+ $i["date"] = OC_Util::formatDate($i["mtime"] );
+ if($i['type']=='file'){
+ $fileinfo=pathinfo($i['name']);
+ $i['basename']=$fileinfo['filename'];
+ if (!empty($fileinfo['extension'])) {
+ $i['extension']='.' . $fileinfo['extension'];
+ }
+ else {
+ $i['extension']='';
+ }
+ }
+ if($i['directory']=='/'){
+ $i['directory']='';
+ }
+ $files[] = $i;
+}
+
+// Make breadcrumb
+$breadcrumb = array();
+$pathtohere = "";
+foreach( explode( "/", $dir ) as $i ){
+ if( $i != "" ){
+ $pathtohere .= "/".str_replace('+','%20', urlencode($i));
+ $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
+ }
+}
+
+// make breadcrumb und filelist markup
+$list = new OC_Template( "files", "part.list", "" );
+$list->assign( "files", $files );
+$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
+$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php")."?file=");
+$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
+$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
+$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
+
+$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
+
+$freeSpace=OC_Filesystem::free_space('/');
+$freeSpace=max($freeSpace,0);
+$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
+
+$tmpl = new OC_Template( "files", "index", "user" );
+$tmpl->assign( "fileList", $list->fetchPage() );
+$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() );
+$tmpl->assign( 'dir', $dir);
+$tmpl->assign( 'readonly', !OC_Filesystem::is_writable($dir));
+$tmpl->assign( "files", $files );
+$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
+$tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
+$tmpl->assign( 'allowZipDownload', intval(OC_Config::getValue('allowZipDownload', true)));
+$tmpl->printPage();
+
+?>
diff --git a/apps/files/js/admin.js b/apps/files/js/admin.js
new file mode 100644
index 00000000000..bfa96670635
--- /dev/null
+++ b/apps/files/js/admin.js
@@ -0,0 +1,23 @@
+function switchPublicFolder()
+{
+ var publicEnable = $('#publicEnable').is(':checked');
+ var sharingaimGroup = $('input:radio[name=sharingaim]'); //find all radiobuttons of that group
+ $.each(sharingaimGroup, function(index, sharingaimItem) {
+ sharingaimItem.disabled = !publicEnable; //set all buttons to the correct state
+ });
+}
+
+$(document).ready(function(){
+ switchPublicFolder(); // Execute the function after loading DOM tree
+ $('#publicEnable').click(function(){
+ switchPublicFolder(); // To get rid of onClick()
+ });
+
+ $('#allowZipDownload').bind('change', function() {
+ if($('#allowZipDownload').attr('checked')) {
+ $('#maxZipInputSize').removeAttr('disabled');
+ } else {
+ $('#maxZipInputSize').attr('disabled', 'disabled');
+ }
+ });
+});
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
new file mode 100644
index 00000000000..68268a7d3a9
--- /dev/null
+++ b/apps/files/js/fileactions.js
@@ -0,0 +1,167 @@
+FileActions={
+ actions:{},
+ defaults:{},
+ icons:{},
+ currentFile:null,
+ register:function(mime,name,icon,action){
+ if(!FileActions.actions[mime]){
+ FileActions.actions[mime]={};
+ }
+ FileActions.actions[mime][name]=action;
+ FileActions.icons[name]=icon;
+ },
+ setDefault:function(mime,name){
+ FileActions.defaults[mime]=name;
+ },
+ get:function(mime,type){
+ var actions={};
+ if(FileActions.actions.all){
+ actions=$.extend( actions, FileActions.actions.all )
+ }
+ if(mime){
+ if(FileActions.actions[mime]){
+ actions=$.extend( actions, FileActions.actions[mime] )
+ }
+ var mimePart=mime.substr(0,mime.indexOf('/'));
+ if(FileActions.actions[mimePart]){
+ actions=$.extend( actions, FileActions.actions[mimePart] )
+ }
+ }
+ if(type){//type is 'dir' or 'file'
+ if(FileActions.actions[type]){
+ actions=$.extend( actions, FileActions.actions[type] )
+ }
+ }
+ return actions;
+ },
+ getDefault:function(mime,type){
+ if(mime){
+ var mimePart=mime.substr(0,mime.indexOf('/'));
+ }
+ var name=false;
+ if(mime && FileActions.defaults[mime]){
+ name=FileActions.defaults[mime];
+ }else if(mime && FileActions.defaults[mimePart]){
+ name=FileActions.defaults[mimePart];
+ }else if(type && FileActions.defaults[type]){
+ name=FileActions.defaults[type];
+ }else{
+ name=FileActions.defaults.all;
+ }
+ var actions=this.get(mime,type);
+ return actions[name];
+ },
+ display:function(parent){
+ FileActions.currentFile=parent;
+ $('#fileList span.fileactions, #fileList td.date a.action').remove();
+ var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
+ var file=FileActions.getCurrentFile();
+ if($('tr').filterAttr('data-file',file).data('renaming')){
+ return;
+ }
+ parent.children('a.name').append('<span class="fileactions" />');
+ var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
+ for(name in actions){
+ if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){
+ var img=FileActions.icons[name];
+ if(img.call){
+ img=img(file);
+ }
+ var html='<a href="#" class="action" style="display:none">';
+ if(img) { html+='<img src="'+img+'"/> '; }
+ html += name+'</a>';
+ var element=$(html);
+ element.data('action',name);
+ element.click(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ var action=actions[$(this).data('action')];
+ var currentFile=FileActions.getCurrentFile();
+ FileActions.hide();
+ action(currentFile);
+ });
+ element.hide();
+ parent.find('a.name>span.fileactions').append(element);
+ }
+ }
+ if(actions['Delete']){
+ var img=FileActions.icons['Delete'];
+ if(img.call){
+ img=img(file);
+ }
+ var html='<a href="#" original-title="Delete" class="action delete" style="display:none" />';
+ var element=$(html);
+ if(img){
+ element.append($('<img src="'+img+'"/>'));
+ }
+ element.data('action','Delete');
+ element.click(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ var action=actions[$(this).data('action')];
+ var currentFile=FileActions.getCurrentFile();
+ FileActions.hide();
+ action(currentFile);
+ });
+ element.hide();
+ parent.parent().children().last().append(element);
+ }
+ $('#fileList .action').css('-o-transition-property','none');//temporarly disable
+ $('#fileList .action').fadeIn(200,function(){
+ $('#fileList .action').css('-o-transition-property','opacity');
+ });
+ return false;
+ },
+ hide:function(){
+ $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200,function(){
+ $(this).remove();
+ });
+ },
+ getCurrentFile:function(){
+ return FileActions.currentFile.parent().attr('data-file');
+ },
+ getCurrentMimeType:function(){
+ return FileActions.currentFile.parent().attr('data-mime');
+ },
+ getCurrentType:function(){
+ return FileActions.currentFile.parent().attr('data-type');
+ }
+}
+
+$(document).ready(function(){
+ if($('#allowZipDownload').val() == 1){
+ var downloadScope = 'all';
+ } else {
+ var downloadScope = 'file';
+ }
+ FileActions.register(downloadScope,'Download',function(){return OC.imagePath('core','actions/download')},function(filename){
+ window.location=OC.filePath('files', 'ajax', 'download.php') + '?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val());
+ });
+});
+
+FileActions.register('all','Delete',function(){return OC.imagePath('core','actions/delete')},function(filename){
+ if(Files.cancelUpload(filename)) {
+ if(filename.substr){
+ filename=[filename];
+ }
+ $.each(filename,function(index,file){
+ var filename = $('tr').filterAttr('data-file',file);
+ filename.hide();
+ filename.find('input[type="checkbox"]').removeAttr('checked');
+ filename.removeClass('selected');
+ });
+ procesSelection();
+ }else{
+ FileList.do_delete(filename);
+ }
+});
+
+FileActions.register('all','Rename',function(){return OC.imagePath('core','actions/rename')},function(filename){
+ FileList.rename(filename);
+});
+
+FileActions.register('dir','Open','',function(filename){
+ window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
+});
+
+FileActions.setDefault('dir','Open');
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
new file mode 100644
index 00000000000..febdfc473b1
--- /dev/null
+++ b/apps/files/js/filelist.js
@@ -0,0 +1,233 @@
+FileList={
+ useUndo:true,
+ update:function(fileListHtml) {
+ $('#fileList').empty().html(fileListHtml);
+ },
+ addFile:function(name,size,lastModified,loading){
+ var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png');
+ var html='<tr data-type="file" data-size="'+size+'">';
+ if(name.indexOf('.')!=-1){
+ var basename=name.substr(0,name.lastIndexOf('.'));
+ var extension=name.substr(name.lastIndexOf('.'));
+ }else{
+ var basename=name;
+ var extension=false;
+ }
+ html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />';
+ html+='<a class="name" href="download.php?file='+$('#dir').val()+'/'+name+'"><span class="nametext">'+basename
+ if(extension){
+ html+='<span class="extension">'+extension+'</span>';
+ }
+ html+='</span></a></td>';
+ if(size!='Pending'){
+ simpleSize=simpleFileSize(size);
+ }else{
+ simpleSize='Pending';
+ }
+ sizeColor = Math.round(200-size/(1024*1024)*2);
+ lastModifiedTime=Math.round(lastModified.getTime() / 1000);
+ modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*14);
+ html+='<td class="filesize" title="'+humanFileSize(size)+'" style="color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')">'+simpleSize+'</td>';
+ html+='<td class="date"><span class="modified" title="'+formatDate(lastModified)+'" style="color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')">'+relative_modified_date(lastModified.getTime() / 1000)+'</span></td>';
+ html+='</tr>';
+ FileList.insertElement(name,'file',$(html).attr('data-file',name));
+ if(loading){
+ $('tr').filterAttr('data-file',name).data('loading',true);
+ }else{
+ $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions);
+ }
+ },
+ addDir:function(name,size,lastModified){
+ html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name});
+ td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
+ td.append('<input type="checkbox" />');
+ var link_elem = $('<a></a>').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
+ link_elem.append($('<span></span>').addClass('nametext').text(name));
+ link_elem.append($('<span></span>').attr({'class': 'uploadtext', 'currentUploads': 0}));
+ td.append(link_elem);
+ html.append(td);
+ if(size!='Pending'){
+ simpleSize=simpleFileSize(size);
+ }else{
+ simpleSize='Pending';
+ }
+ sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2));
+ lastModifiedTime=Math.round(lastModified.getTime() / 1000);
+ modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5);
+ td = $('<td></td>').attr({ "class": "filesize", "title": humanFileSize(size), "style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'}).text(simpleSize);
+ html.append(td);
+
+ td = $('<td></td>').attr({ "class": "date" });
+ td.append($('<span></span>').attr({ "class": "modified", "title": formatDate(lastModified), "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text( relative_modified_date(lastModified.getTime() / 1000) ));
+ html.append(td);
+ FileList.insertElement(name,'dir',html);
+ $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions);
+ $('tr').filterAttr('data-file',name).find('td.filename').droppable(folderDropOptions);
+ },
+ refresh:function(data) {
+ result = jQuery.parseJSON(data.responseText);
+ if(typeof(result.data.breadcrumb) != 'undefined'){
+ updateBreadcrumb(result.data.breadcrumb);
+ }
+ FileList.update(result.data.files);
+ resetFileActionPanel();
+ },
+ remove:function(name){
+ $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy');
+ $('tr').filterAttr('data-file',name).remove();
+ if($('tr[data-file]').length==0){
+ $('#emptyfolder').show();
+ $('.file_upload_filename').addClass('highlight');
+ }
+ },
+ insertElement:function(name,type,element){
+ //find the correct spot to insert the file or folder
+ var fileElements=$('tr[data-file][data-type="'+type+'"]');
+ var pos;
+ if(name.localeCompare($(fileElements[0]).attr('data-file'))<0){
+ pos=-1;
+ }else if(name.localeCompare($(fileElements[fileElements.length-1]).attr('data-file'))>0){
+ pos=fileElements.length-1;
+ }else{
+ for(var pos=0;pos<fileElements.length-1;pos++){
+ if(name.localeCompare($(fileElements[pos]).attr('data-file'))>0 && name.localeCompare($(fileElements[pos+1]).attr('data-file'))<0){
+ break;
+ }
+ }
+ }
+ if(fileElements.length){
+ if(pos==-1){
+ $(fileElements[0]).before(element);
+ }else{
+ $(fileElements[pos]).after(element);
+ }
+ }else if(type=='dir' && $('tr[data-file]').length>0){
+ $('tr[data-file]').first().before(element);
+ }else{
+ $('#fileList').append(element);
+ }
+ $('#emptyfolder').hide();
+ $('.file_upload_filename').removeClass('highlight');
+ },
+ loadingDone:function(name){
+ var tr=$('tr').filterAttr('data-file',name);
+ tr.data('loading',false);
+ var mime=tr.data('mime');
+ tr.attr('data-mime',mime);
+ getMimeIcon(mime,function(path){
+ tr.find('td.filename').attr('style','background-image:url('+path+')');
+ });
+ tr.find('td.filename').draggable(dragOptions);
+ },
+ isLoading:function(name){
+ return $('tr').filterAttr('data-file',name).data('loading');
+ },
+ rename:function(name){
+ var tr=$('tr').filterAttr('data-file',name);
+ tr.data('renaming',true);
+ var td=tr.children('td.filename');
+ var input=$('<input class="filename"></input>').val(name);
+ var form=$('<form></form>')
+ form.append(input);
+ td.children('a.name').text('');
+ td.children('a.name').append(form)
+ input.focus();
+ form.submit(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ var newname=input.val();
+ tr.attr('data-file',newname);
+ td.children('a.name').empty();
+ var path = td.children('a.name').attr('href');
+ td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname)));
+ if(newname.indexOf('.')>0){
+ basename=newname.substr(0,newname.lastIndexOf('.'));
+ }else{
+ basename=newname;
+ }
+ var span=$('<span class="nametext"></span>');
+ span.text(basename);
+ td.children('a.name').append(span);
+ if(newname.indexOf('.')>0){
+ span.append($('<span class="extension">'+newname.substr(newname.lastIndexOf('.'))+'</span>'));
+ }
+ $.get(OC.filePath('files','ajax','rename.php'), { dir : $('#dir').val(), newname: newname, file: name },function(){
+ tr.data('renaming',false);
+ });
+ return false;
+ });
+ input.click(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ });
+ input.blur(function(){
+ form.trigger('submit');
+ });
+ },
+ do_delete:function(files){
+ if(FileList.deleteFiles || !FileList.useUndo){//finish any ongoing deletes first
+ FileList.finishDelete(function(){
+ FileList.do_delete(files);
+ });
+ return;
+ }
+ if(files.substr){
+ files=[files];
+ }
+ $.each(files,function(index,file){
+ var files = $('tr').filterAttr('data-file',file);
+ files.hide();
+ files.find('input[type="checkbox"]').removeAttr('checked');
+ files.removeClass('selected');
+ });
+ procesSelection();
+ FileList.deleteCanceled=false;
+ FileList.deleteFiles=files;
+ $('#notification').text(t('files','undo deletion'));
+ $('#notification').data('deletefile',true);
+ $('#notification').fadeIn();
+ },
+ finishDelete:function(ready,sync){
+ if(!FileList.deleteCanceled && FileList.deleteFiles){
+ var fileNames=FileList.deleteFiles.join(';');
+ $.ajax({
+ url: 'ajax/delete.php',
+ async:!sync,
+ data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(fileNames),
+ complete: function(data){
+ boolOperationFinished(data, function(){
+ $('#notification').fadeOut();
+ $.each(FileList.deleteFiles,function(index,file){
+ FileList.remove(file);
+ });
+ FileList.deleteCanceled=true;
+ FileList.deleteFiles=null;
+ if(ready){
+ ready();
+ }
+ });
+ }
+ });
+ }
+ }
+}
+
+$(document).ready(function(){
+ $('#notification').hide();
+ $('#notification').click(function(){
+ if($('#notification').data('deletefile'))
+ {
+ $.each(FileList.deleteFiles,function(index,file){
+ $('tr').filterAttr('data-file',file).show();
+// alert(file);
+ });
+ FileList.deleteCanceled=true;
+ FileList.deleteFiles=null;
+ }
+ $('#notification').fadeOut();
+ });
+ FileList.useUndo=('onbeforeunload' in window)
+ $(window).bind('beforeunload', function (){
+ FileList.finishDelete(null,true);
+ });
+});
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
new file mode 100644
index 00000000000..2dce00035e1
--- /dev/null
+++ b/apps/files/js/files.js
@@ -0,0 +1,745 @@
+var uploadingFiles = {};
+Files={
+ cancelUpload:function(filename) {
+ if(uploadingFiles[filename]) {
+ uploadingFiles[filename].abort();
+ delete uploadingFiles[filename];
+ return true;
+ }
+ return false;
+ },
+ cancelUploads:function() {
+ $.each(uploadingFiles,function(index,file) {
+ if(typeof file['abort'] === 'function') {
+ file.abort();
+ var filename = $('tr').filterAttr('data-file',index);
+ filename.hide();
+ filename.find('input[type="checkbox"]').removeAttr('checked');
+ filename.removeClass('selected');
+ } else {
+ $.each(file,function(i,f) {
+ f.abort();
+ delete file[i];
+ });
+ }
+ delete uploadingFiles[index];
+ });
+ procesSelection();
+ }
+}
+$(document).ready(function() {
+ $('#fileList tr').each(function(){
+ //little hack to set unescape filenames in attribute
+ $(this).attr('data-file',decodeURIComponent($(this).attr('data-file')));
+ });
+
+ if($('tr[data-file]').length==0){
+ $('.file_upload_filename').addClass('highlight');
+ }
+
+ $('#file_action_panel').attr('activeAction', false);
+
+ //drag/drop of files
+ $('#fileList tr td.filename').draggable(dragOptions);
+ $('#fileList tr[data-type="dir"][data-write="true"] td.filename').droppable(folderDropOptions);
+ $('div.crumb:not(.last)').droppable(crumbDropOptions);
+ $('ul#apps>li:first-child').data('dir','');
+ if($('div.crumb').length){
+ $('ul#apps>li:first-child').droppable(crumbDropOptions);
+ }
+
+ // Triggers invisible file input
+ $('.file_upload_button_wrapper').live('click', function() {
+ $(this).parent().children('.file_upload_start').trigger('click');
+ return false;
+ });
+
+ // Sets the file-action buttons behaviour :
+ $('tr').live('mouseenter',function(event) {
+ FileActions.display($(this).children('td.filename'));
+ });
+ $('tr').live('mouseleave',function(event) {
+ FileActions.hide();
+ });
+
+ var lastChecked;
+
+ // Sets the file link behaviour :
+ $('td.filename a').live('click',function(event) {
+ event.preventDefault();
+ if (event.ctrlKey || event.shiftKey) {
+ if (event.shiftKey) {
+ var last = $(lastChecked).parent().parent().prevAll().length;
+ var first = $(this).parent().parent().prevAll().length;
+ var start = Math.min(first, last);
+ var end = Math.max(first, last);
+ var rows = $(this).parent().parent().parent().children('tr');
+ for (var i = start; i < end; i++) {
+ $(rows).each(function(index) {
+ if (index == i) {
+ var checkbox = $(this).children().children('input:checkbox');
+ $(checkbox).attr('checked', 'checked');
+ $(checkbox).parent().parent().addClass('selected');
+ }
+ });
+ }
+ }
+ var checkbox = $(this).parent().children('input:checkbox');
+ lastChecked = checkbox;
+ if ($(checkbox).attr('checked')) {
+ $(checkbox).removeAttr('checked');
+ $(checkbox).parent().parent().removeClass('selected');
+ $('#select_all').removeAttr('checked');
+ } else {
+ $(checkbox).attr('checked', 'checked');
+ $(checkbox).parent().parent().toggleClass('selected');
+ var selectedCount=$('td.filename input:checkbox:checked').length;
+ if (selectedCount == $('td.filename input:checkbox').length) {
+ $('#select_all').attr('checked', 'checked');
+ }
+ }
+ procesSelection();
+ } else {
+ var filename=$(this).parent().parent().attr('data-file');
+ var tr=$('tr').filterAttr('data-file',filename);
+ var renaming=tr.data('renaming');
+ if(!renaming && !FileList.isLoading(filename)){
+ var mime=$(this).parent().parent().data('mime');
+ var type=$(this).parent().parent().data('type');
+ var action=FileActions.getDefault(mime,type);
+ if(action){
+ action(filename);
+ }
+ }
+ }
+
+ });
+
+ // Sets the select_all checkbox behaviour :
+ $('#select_all').click(function() {
+ if($(this).attr('checked')){
+ // Check all
+ $('td.filename input:checkbox').attr('checked', true);
+ $('td.filename input:checkbox').parent().parent().addClass('selected');
+ }else{
+ // Uncheck all
+ $('td.filename input:checkbox').attr('checked', false);
+ $('td.filename input:checkbox').parent().parent().removeClass('selected');
+ }
+ procesSelection();
+ });
+
+ $('td.filename input:checkbox').live('change',function(event) {
+ if (event.shiftKey) {
+ var last = $(lastChecked).parent().parent().prevAll().length;
+ var first = $(this).parent().parent().prevAll().length;
+ var start = Math.min(first, last);
+ var end = Math.max(first, last);
+ var rows = $(this).parent().parent().parent().children('tr');
+ for (var i = start; i < end; i++) {
+ $(rows).each(function(index) {
+ if (index == i) {
+ var checkbox = $(this).children().children('input:checkbox');
+ $(checkbox).attr('checked', 'checked');
+ $(checkbox).parent().parent().addClass('selected');
+ }
+ });
+ }
+ }
+ var selectedCount=$('td.filename input:checkbox:checked').length;
+ $(this).parent().parent().toggleClass('selected');
+ if(!$(this).attr('checked')){
+ $('#select_all').attr('checked',false);
+ }else{
+ if(selectedCount==$('td.filename input:checkbox').length){
+ $('#select_all').attr('checked',true);
+ }
+ }
+ procesSelection();
+ });
+
+ $('#file_newfolder_name').click(function(){
+ if($('#file_newfolder_name').val() == 'New Folder'){
+ $('#file_newfolder_name').val('');
+ }
+ });
+
+ $('.download').click('click',function(event) {
+ var files=getSelectedFiles('name').join(';');
+ var dir=$('#dir').val()||'/';
+ $('#notification').text(t('files','generating ZIP-file, it may take some time.'));
+ $('#notification').fadeIn();
+ window.location=OC.filePath('files', 'ajax', 'download.php') + '?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir);
+ return false;
+ });
+
+ $('.delete').click(function(event) {
+ var files=getSelectedFiles('name');
+ event.preventDefault();
+ FileList.do_delete(files);
+ return false;
+ });
+
+ // drag&drop support using jquery.fileupload
+ // TODO use OC.dialogs
+ $(document).bind('drop dragover', function (e) {
+ e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
+ });
+
+ $(function() {
+ $('.file_upload_start').fileupload({
+ dropZone: $('#content'), // restrict dropZone to content div
+ add: function(e, data) {
+ var files = data.files;
+ var totalSize=0;
+ if(files){
+ for(var i=0;i<files.length;i++){
+ totalSize+=files[i].size;
+ if(FileList.deleteFiles && FileList.deleteFiles.indexOf(files[i].name)!=-1){//finish delete if we are uploading a deleted file
+ FileList.finishDelete(function(){
+ $('.file_upload_start').change();
+ });
+ return;
+ }
+ }
+ }
+ if(totalSize>$('#max_upload').val()){
+ $( '#uploadsize-message' ).dialog({
+ modal: true,
+ buttons: {
+ Close: function() {
+ $( this ).dialog( 'close' );
+ }
+ }
+ });
+ }else{
+ if($.support.xhrFileUpload) {
+ for(var i=0;i<files.length;i++){
+ var fileName = files[i].name
+ var dropTarget = $(e.originalEvent.target).closest('tr');
+ if(dropTarget && dropTarget.attr('data-type') === 'dir') { // drag&drop upload to folder
+ var dirName = dropTarget.attr('data-file')
+ var jqXHR = $('.file_upload_start').fileupload('send', {files: files[i],
+ formData: function(form) {
+ var formArray = form.serializeArray();
+ formArray[1]['value'] = dirName;
+ return formArray;
+ }}).success(function(result, textStatus, jqXHR) {
+ var response;
+ response=jQuery.parseJSON(result);
+ if(response[0] == undefined || response[0].status != 'success') {
+ $('#notification').text(t('files', response.data.message));
+ $('#notification').fadeIn();
+ }
+ var file=response[0];
+ delete uploadingFiles[dirName][file.name];
+ var currentUploads = parseInt(uploadtext.attr('currentUploads'));
+ currentUploads -= 1;
+ uploadtext.attr('currentUploads', currentUploads);
+ if(currentUploads === 0) {
+ var img = OC.imagePath('core', 'filetypes/folder.png');
+ var tr=$('tr').filterAttr('data-file',dirName);
+ tr.find('td.filename').attr('style','background-image:url('+img+')');
+ uploadtext.text('');
+ uploadtext.hide();
+ } else {
+ uploadtext.text(currentUploads + ' files uploading')
+ }
+ })
+ .error(function(jqXHR, textStatus, errorThrown) {
+ if(errorThrown === 'abort') {
+ var currentUploads = parseInt(uploadtext.attr('currentUploads'));
+ currentUploads -= 1;
+ uploadtext.attr('currentUploads', currentUploads);
+ if(currentUploads === 0) {
+ var img = OC.imagePath('core', 'filetypes/folder.png');
+ var tr=$('tr').filterAttr('data-file',dirName);
+ tr.find('td.filename').attr('style','background-image:url('+img+')');
+ uploadtext.text('');
+ uploadtext.hide();
+ } else {
+ uploadtext.text(currentUploads + ' files uploading')
+ }
+ $('#notification').hide();
+ $('#notification').text(t('files', 'Upload cancelled.'));
+ $('#notification').fadeIn();
+ }
+ });
+ //TODO test with filenames containing slashes
+ if(uploadingFiles[dirName] === undefined) {
+ uploadingFiles[dirName] = {};
+ }
+ uploadingFiles[dirName][fileName] = jqXHR;
+ } else {
+ var jqXHR = $('.file_upload_start').fileupload('send', {files: files[i]})
+ .success(function(result, textStatus, jqXHR) {
+ var response;
+ response=jQuery.parseJSON(result);
+ if(response[0] != undefined && response[0].status == 'success') {
+ var file=response[0];
+ delete uploadingFiles[file.name];
+ $('tr').filterAttr('data-file',file.name).data('mime',file.mime);
+ var size = $('tr').filterAttr('data-file',file.name).find('td.filesize').text();
+ if(size==t('files','Pending')){
+ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size);
+ }
+ FileList.loadingDone(file.name);
+ } else {
+ $('#notification').text(t('files', response.data.message));
+ $('#notification').fadeIn();
+ $('#fileList > tr').not('[data-mime]').fadeOut();
+ $('#fileList > tr').not('[data-mime]').remove();
+ }
+ })
+ .error(function(jqXHR, textStatus, errorThrown) {
+ if(errorThrown === 'abort') {
+ $('#notification').hide();
+ $('#notification').text(t('files', 'Upload cancelled.'));
+ $('#notification').fadeIn();
+ }
+ });
+ uploadingFiles[files[i].name] = jqXHR;
+ }
+ }
+ }else{
+ data.submit().success(function(data, status) {
+ response = jQuery.parseJSON(data[0].body.innerText);
+ if(response[0] != undefined && response[0].status == 'success') {
+ var file=response[0];
+ delete uploadingFiles[file.name];
+ $('tr').filterAttr('data-file',file.name).data('mime',file.mime);
+ var size = $('tr').filterAttr('data-file',file.name).find('td.filesize').text();
+ if(size==t('files','Pending')){
+ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size);
+ }
+ FileList.loadingDone(file.name);
+ } else {
+ $('#notification').text(t('files', response.data.message));
+ $('#notification').fadeIn();
+ $('#fileList > tr').not('[data-mime]').fadeOut();
+ $('#fileList > tr').not('[data-mime]').remove();
+ }
+ });
+ }
+
+ var date=new Date();
+ if(files){
+ for(var i=0;i<files.length;i++){
+ if(files[i].size>0){
+ var size=files[i].size;
+ }else{
+ var size=t('files','Pending');
+ }
+ if(files && !dirName){
+ FileList.addFile(getUniqueName(files[i].name),size,date,true);
+ } else if(dirName) {
+ var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext')
+ var currentUploads = parseInt(uploadtext.attr('currentUploads'));
+ currentUploads += 1;
+ uploadtext.attr('currentUploads', currentUploads);
+ if(currentUploads === 1) {
+ var img = OC.imagePath('core', 'loading.gif');
+ var tr=$('tr').filterAttr('data-file',dirName);
+ tr.find('td.filename').attr('style','background-image:url('+img+')');
+ uploadtext.text('1 file uploading');
+ uploadtext.show();
+ } else {
+ uploadtext.text(currentUploads + ' files uploading')
+ }
+ }
+ }
+ }else{
+ var filename=this.value.split('\\').pop(); //ie prepends C:\fakepath\ in front of the filename
+ FileList.addFile(getUniqueName(filename),'Pending',date,true);
+ }
+ }
+ },
+ fail: function(e, data) {
+ // TODO: cancel upload & display error notification
+ },
+ progress: function(e, data) {
+ // TODO: show nice progress bar in file row
+ },
+ progressall: function(e, data) {
+ var progress = (data.loaded/data.total)*100;
+ $('#uploadprogressbar').progressbar('value',progress);
+ },
+ start: function(e, data) {
+ $('#uploadprogressbar').progressbar({value:0});
+ $('#uploadprogressbar').fadeIn();
+ if(data.dataType != 'iframe ') {
+ $('#upload input.stop').show();
+ }
+ },
+ stop: function(e, data) {
+ if(data.dataType != 'iframe ') {
+ $('#upload input.stop').hide();
+ }
+ $('#uploadprogressbar').progressbar('value',100);
+ $('#uploadprogressbar').fadeOut();
+ }
+ })
+ });
+
+ //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used)
+ if(navigator.userAgent.search(/konqueror/i)==-1){
+ $('.file_upload_start').attr('multiple','multiple')
+ }
+
+ //if the breadcrumb is to long, start by replacing foldernames with '...' except for the current folder
+ var crumb=$('div.crumb').first();
+ while($('div.controls').height()>40 && crumb.next('div.crumb').length>0){
+ crumb.children('a').text('...');
+ crumb=crumb.next('div.crumb');
+ }
+ //if that isn't enough, start removing items from the breacrumb except for the current folder and it's parent
+ var crumb=$('div.crumb').first();
+ var next=crumb.next('div.crumb');
+ while($('div.controls').height()>40 && next.next('div.crumb').length>0){
+ crumb.remove();
+ crumb=next;
+ next=crumb.next('div.crumb');
+ }
+ //still not enough, start shorting down the current folder name
+ var crumb=$('div.crumb>a').last();
+ while($('div.controls').height()>40 && crumb.text().length>6){
+ var text=crumb.text()
+ text=text.substr(0,text.length-6)+'...';
+ crumb.text(text);
+ }
+
+ $(window).click(function(){
+ $('#new>ul').hide();
+ $('#new').removeClass('active');
+ $('button.file_upload_filename').removeClass('active');
+ $('#new li').each(function(i,element){
+ if($(element).children('p').length==0){
+ $(element).children('input').remove();
+ $(element).append('<p>'+$(element).data('text')+'</p>');
+ }
+ });
+ });
+ $('#new').click(function(event){
+ event.stopPropagation();
+ });
+ $('#new>a').click(function(){
+ $('#new>ul').toggle();
+ $('#new').toggleClass('active');
+ $('button.file_upload_filename').toggleClass('active');
+ });
+ $('#new li').click(function(){
+ if($(this).children('p').length==0){
+ return;
+ }
+
+ $('#new li').each(function(i,element){
+ if($(element).children('p').length==0){
+ $(element).children('input').remove();
+ $(element).append('<p>'+$(element).data('text')+'</p>');
+ }
+ });
+
+ var type=$(this).data('type');
+ var text=$(this).children('p').text();
+ $(this).data('text',text);
+ $(this).children('p').remove();
+ var input=$('<input>');
+ $(this).append(input);
+ input.focus();
+ input.change(function(){
+ var name=$(this).val();
+ switch(type){
+ case 'file':
+ $.post(
+ OC.filePath('files','ajax','newfile.php'),
+ {dir:$('#dir').val(),filename:name,content:" \n"},
+ function(data){
+ var date=new Date();
+ FileList.addFile(name,0,date);
+ var tr=$('tr').filterAttr('data-file',name);
+ tr.data('mime','text/plain');
+ getMimeIcon('text/plain',function(path){
+ tr.find('td.filename').attr('style','background-image:url('+path+')');
+ });
+ }
+ );
+ break;
+ case 'folder':
+ $.post(
+ OC.filePath('files','ajax','newfolder.php'),
+ {dir:$('#dir').val(),foldername:name},
+ function(data){
+ var date=new Date();
+ FileList.addDir(name,0,date);
+ }
+ );
+ break;
+ case 'web':
+ if(name.substr(0,8)!='https://' && name.substr(0,7)!='http://'){
+ name='http://'.name;
+ }
+ var localName=name;
+ if(localName.substr(localName.length-1,1)=='/'){//strip /
+ localName=localName.substr(0,localName.length-1)
+ }
+ if(localName.indexOf('/')){//use last part of url
+ localName=localName.split('/').pop();
+ }else{//or the domain
+ localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.','');
+ }
+ $.post(
+ OC.filePath('files','ajax','newfile.php'),
+ {dir:$('#dir').val(),source:name,filename:localName},
+ function(result){
+ if(result.status == 'success'){
+ var date=new Date();
+ FileList.addFile(localName,0,date);
+ var tr=$('tr').filterAttr('data-file',localName);
+ tr.data('mime',result.data.mime);
+ getMimeIcon(result.data.mime,function(path){
+ tr.find('td.filename').attr('style','background-image:url('+path+')');
+ });
+ }else{
+
+ }
+ }
+ );
+ break;
+ }
+ var li=$(this).parent();
+ $(this).remove();
+ li.append('<p>'+li.data('text')+'</p>');
+ $('#new>a').click();
+ });
+ });
+
+ //check if we need to scan the filesystem
+ $.get(OC.filePath('files','ajax','scan.php'),{checkonly:'true'}, function(response) {
+ if(response.data.done){
+ scanFiles();
+ }
+ }, "json");
+});
+
+function scanFiles(force,dir){
+ if(!dir){
+ dir='';
+ }
+ force=!!force; //cast to bool
+ scanFiles.scanning=true;
+ $('#scanning-message').show();
+ $('#fileList').remove();
+ var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir});
+ scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource);
+ scannerEventSource.listen('scanning',function(data){
+ $('#scan-count').text(data.count+' files scanned');
+ $('#scan-current').text(data.file+'/');
+ });
+ scannerEventSource.listen('success',function(success){
+ scanFiles.scanning=false;
+ if(success){
+ window.location.reload();
+ }else{
+ alert('error while scanning');
+ }
+ });
+}
+scanFiles.scanning=false;
+
+function boolOperationFinished(data, callback) {
+ result = jQuery.parseJSON(data.responseText);
+ if(result.status == 'success'){
+ callback.call();
+ } else {
+ alert(result.data.message);
+ }
+}
+
+function updateBreadcrumb(breadcrumbHtml) {
+ $('p.nav').empty().html(breadcrumbHtml);
+}
+
+//options for file drag/dropp
+var dragOptions={
+ distance: 20, revert: 'invalid', opacity: 0.7,
+ stop: function(event, ui) {
+ $('#fileList tr td.filename').addClass('ui-draggable');
+ }
+};
+var folderDropOptions={
+ drop: function( event, ui ) {
+ var file=ui.draggable.parent().data('file');
+ var target=$(this).text().trim();
+ var dir=$('#dir').val();
+ $.ajax({
+ url: OC.filePath('files', 'ajax', 'move.php'),
+ data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(dir)+'/'+encodeURIComponent(target),
+ complete: function(data){boolOperationFinished(data, function(){
+ var el = $('#fileList tr').filterAttr('data-file',file).find('td.filename');
+ el.draggable('destroy');
+ FileList.remove(file);
+ });}
+ });
+ }
+}
+var crumbDropOptions={
+ drop: function( event, ui ) {
+ var file=ui.draggable.text().trim();
+ var target=$(this).data('dir');
+ var dir=$('#dir').val();
+ while(dir.substr(0,1)=='/'){//remove extra leading /'s
+ dir=dir.substr(1);
+ }
+ dir='/'+dir;
+ if(dir.substr(-1,1)!='/'){
+ dir=dir+'/';
+ }
+ if(target==dir || target+'/'==dir){
+ return;
+ }
+ $.ajax({
+ url: OC.filePath('files', 'ajax', 'move.php'),
+ data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(target),
+ complete: function(data){boolOperationFinished(data, function(){
+ FileList.remove(file);
+ });}
+ });
+ },
+ tolerance: 'pointer'
+}
+
+function procesSelection(){
+ var selected=getSelectedFiles();
+ var selectedFiles=selected.filter(function(el){return el.type=='file'});
+ var selectedFolders=selected.filter(function(el){return el.type=='dir'});
+ if(selectedFiles.length==0 && selectedFolders.length==0){
+ $('#headerName>span.name').text(t('files','Name'));
+ $('#headerSize').text(t('files','Size'));
+ $('#modified').text(t('files','Modified'));
+ $('th').removeClass('multiselect');
+ $('.selectedActions').hide();
+ $('thead').removeClass('fixed');
+ $('#headerName').css('width','auto');
+ $('#headerSize').css('width','auto');
+ $('#headerDate').css('width','auto');
+ $('table').css('padding-top','0');
+ }else{
+ var width={name:$('#headerName').css('width'),size:$('#headerSize').css('width'),date:$('#headerDate').css('width')};
+ $('#headerName').css('width',width.name);
+ $('#headerSize').css('width',width.size);
+ $('#headerDate').css('width',width.date);
+ $('.selectedActions').show();
+ var totalSize=0;
+ for(var i=0;i<selectedFiles.length;i++){
+ totalSize+=selectedFiles[i].size;
+ };
+ for(var i=0;i<selectedFolders.length;i++){
+ totalSize+=selectedFolders[i].size;
+ };
+ simpleSize=simpleFileSize(totalSize);
+ $('#headerSize').text(simpleSize);
+ $('#headerSize').attr('title',humanFileSize(totalSize));
+ var selection='';
+ if(selectedFolders.length>0){
+ if(selectedFolders.length==1){
+ selection+='1 '+t('files','folder');
+ }else{
+ selection+=selectedFolders.length+' '+t('files','folders');
+ }
+ if(selectedFiles.length>0){
+ selection+=' & ';
+ }
+ }
+ if(selectedFiles.length>0){
+ if(selectedFiles.length==1){
+ selection+='1 '+t('files','file');
+ }else{
+ selection+=selectedFiles.length+' '+t('files','files');
+ }
+ }
+ $('#headerName>span.name').text(selection);
+ $('#modified').text('');
+ $('th').addClass('multiselect');
+ }
+}
+
+/**
+ * @brief get a list of selected files
+ * @param string property (option) the property of the file requested
+ * @return array
+ *
+ * possible values for property: name, mime, size and type
+ * if property is set, an array with that property for each file is returnd
+ * if it's ommited an array of objects with all properties is returned
+ */
+function getSelectedFiles(property){
+ var elements=$('td.filename input:checkbox:checked').parent().parent();
+ var files=[];
+ elements.each(function(i,element){
+ var file={
+ name:$(element).attr('data-file'),
+ mime:$(element).data('mime'),
+ type:$(element).data('type'),
+ size:$(element).data('size'),
+ };
+ if(property){
+ files.push(file[property]);
+ }else{
+ files.push(file);
+ }
+ });
+ return files;
+}
+
+function relative_modified_date(timestamp) {
+ var timediff = Math.round((new Date()).getTime() / 1000) - timestamp;
+ var diffminutes = Math.round(timediff/60);
+ var diffhours = Math.round(diffminutes/60);
+ var diffdays = Math.round(diffhours/24);
+ var diffmonths = Math.round(diffdays/31);
+ var diffyears = Math.round(diffdays/365);
+ if(timediff < 60) { return t('files','seconds ago'); }
+ else if(timediff < 120) { return '1 '+t('files','minute ago'); }
+ else if(timediff < 3600) { return diffminutes+' '+t('files','minutes ago'); }
+ //else if($timediff < 7200) { return '1 hour ago'; }
+ //else if($timediff < 86400) { return $diffhours.' hours ago'; }
+ else if(timediff < 86400) { return t('files','today'); }
+ else if(timediff < 172800) { return t('files','yesterday'); }
+ else if(timediff < 2678400) { return diffdays+' '+t('files','days ago'); }
+ else if(timediff < 5184000) { return t('files','last month'); }
+ //else if($timediff < 31556926) { return $diffmonths.' months ago'; }
+ else if(timediff < 31556926) { return t('files','months ago'); }
+ else if(timediff < 63113852) { return t('files','last year'); }
+ else { return diffyears+' '+t('files','years ago'); }
+}
+
+function getMimeIcon(mime, ready){
+ if(getMimeIcon.cache[mime]){
+ ready(getMimeIcon.cache[mime]);
+ }else{
+ $.get( OC.filePath('files','ajax','mimeicon.php')+'?mime='+mime, function(path){
+ getMimeIcon.cache[mime]=path;
+ ready(getMimeIcon.cache[mime]);
+ });
+ }
+}
+getMimeIcon.cache={};
+
+function getUniqueName(name){
+ if($('tr').filterAttr('data-file',name).length>0){
+ var parts=name.split('.');
+ var extension=parts.pop();
+ var base=parts.join('.');
+ numMatch=base.match(/\((\d+)\)/);
+ var num=2;
+ if(numMatch && numMatch.length>0){
+ num=parseInt(numMatch[numMatch.length-1])+1;
+ base=base.split('(')
+ base.pop();
+ base=base.join('(').trim();
+ }
+ name=base+' ('+num+').'+extension;
+ return getUniqueName(name);
+ }
+ return name;
+}
diff --git a/apps/files/js/jquery.fileupload.js b/apps/files/js/jquery.fileupload.js
new file mode 100644
index 00000000000..a89e9dc2c44
--- /dev/null
+++ b/apps/files/js/jquery.fileupload.js
@@ -0,0 +1,866 @@
+/*
+ * jQuery File Upload Plugin 5.9
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/*jslint nomen: true, unparam: true, regexp: true */
+/*global define, window, document, Blob, FormData, location */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'jquery.ui.widget'
+ ], factory);
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+
+ // The FileReader API is not actually used, but works as feature detection,
+ // as e.g. Safari supports XHR file uploads via the FormData API,
+ // but not non-multipart XHR file uploads:
+ $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
+ $.support.xhrFormDataFileUpload = !!window.FormData;
+
+ // The fileupload widget listens for change events on file input fields defined
+ // via fileInput setting and paste or drop events of the given dropZone.
+ // In addition to the default jQuery Widget methods, the fileupload widget
+ // exposes the "add" and "send" methods, to add or directly send files using
+ // the fileupload API.
+ // By default, files added via file input selection, paste, drag & drop or
+ // "add" method are uploaded immediately, but it is possible to override
+ // the "add" callback option to queue file uploads.
+ $.widget('blueimp.fileupload', {
+
+ options: {
+ // The namespace used for event handler binding on the dropZone and
+ // fileInput collections.
+ // If not set, the name of the widget ("fileupload") is used.
+ namespace: undefined,
+ // The drop target collection, by the default the complete document.
+ // Set to null or an empty collection to disable drag & drop support:
+ dropZone: $(document),
+ // The file input field collection, that is listened for change events.
+ // If undefined, it is set to the file input fields inside
+ // of the widget element on plugin initialization.
+ // Set to null or an empty collection to disable the change listener.
+ fileInput: undefined,
+ // By default, the file input field is replaced with a clone after
+ // each input field change event. This is required for iframe transport
+ // queues and allows change events to be fired for the same file
+ // selection, but can be disabled by setting the following option to false:
+ replaceFileInput: true,
+ // The parameter name for the file form data (the request argument name).
+ // If undefined or empty, the name property of the file input field is
+ // used, or "files[]" if the file input name property is also empty:
+ paramName: undefined,
+ // By default, each file of a selection is uploaded using an individual
+ // request for XHR type uploads. Set to false to upload file
+ // selections in one request each:
+ singleFileUploads: true,
+ // To limit the number of files uploaded with one XHR request,
+ // set the following option to an integer greater than 0:
+ limitMultiFileUploads: undefined,
+ // Set the following option to true to issue all file upload requests
+ // in a sequential order:
+ sequentialUploads: false,
+ // To limit the number of concurrent uploads,
+ // set the following option to an integer greater than 0:
+ limitConcurrentUploads: undefined,
+ // Set the following option to true to force iframe transport uploads:
+ forceIframeTransport: false,
+ // Set the following option to the location of a redirect url on the
+ // origin server, for cross-domain iframe transport uploads:
+ redirect: undefined,
+ // The parameter name for the redirect url, sent as part of the form
+ // data and set to 'redirect' if this option is empty:
+ redirectParamName: undefined,
+ // Set the following option to the location of a postMessage window,
+ // to enable postMessage transport uploads:
+ postMessage: undefined,
+ // By default, XHR file uploads are sent as multipart/form-data.
+ // The iframe transport is always using multipart/form-data.
+ // Set to false to enable non-multipart XHR uploads:
+ multipart: true,
+ // To upload large files in smaller chunks, set the following option
+ // to a preferred maximum chunk size. If set to 0, null or undefined,
+ // or the browser does not support the required Blob API, files will
+ // be uploaded as a whole.
+ maxChunkSize: undefined,
+ // When a non-multipart upload or a chunked multipart upload has been
+ // aborted, this option can be used to resume the upload by setting
+ // it to the size of the already uploaded bytes. This option is most
+ // useful when modifying the options object inside of the "add" or
+ // "send" callbacks, as the options are cloned for each file upload.
+ uploadedBytes: undefined,
+ // By default, failed (abort or error) file uploads are removed from the
+ // global progress calculation. Set the following option to false to
+ // prevent recalculating the global progress data:
+ recalculateProgress: true,
+
+ // Additional form data to be sent along with the file uploads can be set
+ // using this option, which accepts an array of objects with name and
+ // value properties, a function returning such an array, a FormData
+ // object (for XHR file uploads), or a simple object.
+ // The form of the first fileInput is given as parameter to the function:
+ formData: function (form) {
+ return form.serializeArray();
+ },
+
+ // The add callback is invoked as soon as files are added to the fileupload
+ // widget (via file input selection, drag & drop, paste or add API call).
+ // If the singleFileUploads option is enabled, this callback will be
+ // called once for each file in the selection for XHR file uplaods, else
+ // once for each file selection.
+ // The upload starts when the submit method is invoked on the data parameter.
+ // The data object contains a files property holding the added files
+ // and allows to override plugin options as well as define ajax settings.
+ // Listeners for this callback can also be bound the following way:
+ // .bind('fileuploadadd', func);
+ // data.submit() returns a Promise object and allows to attach additional
+ // handlers using jQuery's Deferred callbacks:
+ // data.submit().done(func).fail(func).always(func);
+ add: function (e, data) {
+ data.submit();
+ },
+
+ // Other callbacks:
+ // Callback for the submit event of each file upload:
+ // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
+ // Callback for the start of each file upload request:
+ // send: function (e, data) {}, // .bind('fileuploadsend', func);
+ // Callback for successful uploads:
+ // done: function (e, data) {}, // .bind('fileuploaddone', func);
+ // Callback for failed (abort or error) uploads:
+ // fail: function (e, data) {}, // .bind('fileuploadfail', func);
+ // Callback for completed (success, abort or error) requests:
+ // always: function (e, data) {}, // .bind('fileuploadalways', func);
+ // Callback for upload progress events:
+ // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
+ // Callback for global upload progress events:
+ // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
+ // Callback for uploads start, equivalent to the global ajaxStart event:
+ // start: function (e) {}, // .bind('fileuploadstart', func);
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
+ // stop: function (e) {}, // .bind('fileuploadstop', func);
+ // Callback for change events of the fileInput collection:
+ // change: function (e, data) {}, // .bind('fileuploadchange', func);
+ // Callback for paste events to the dropZone collection:
+ // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
+ // Callback for drop events of the dropZone collection:
+ // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
+ // Callback for dragover events of the dropZone collection:
+ // dragover: function (e) {}, // .bind('fileuploaddragover', func);
+
+ // The plugin options are used as settings object for the ajax calls.
+ // The following are jQuery ajax settings required for the file uploads:
+ processData: false,
+ contentType: false,
+ cache: false
+ },
+
+ // A list of options that require a refresh after assigning a new value:
+ _refreshOptionsList: [
+ 'namespace',
+ 'dropZone',
+ 'fileInput',
+ 'multipart',
+ 'forceIframeTransport'
+ ],
+
+ _isXHRUpload: function (options) {
+ return !options.forceIframeTransport &&
+ ((!options.multipart && $.support.xhrFileUpload) ||
+ $.support.xhrFormDataFileUpload);
+ },
+
+ _getFormData: function (options) {
+ var formData;
+ if (typeof options.formData === 'function') {
+ return options.formData(options.form);
+ } else if ($.isArray(options.formData)) {
+ return options.formData;
+ } else if (options.formData) {
+ formData = [];
+ $.each(options.formData, function (name, value) {
+ formData.push({name: name, value: value});
+ });
+ return formData;
+ }
+ return [];
+ },
+
+ _getTotal: function (files) {
+ var total = 0;
+ $.each(files, function (index, file) {
+ total += file.size || 1;
+ });
+ return total;
+ },
+
+ _onProgress: function (e, data) {
+ if (e.lengthComputable) {
+ var total = data.total || this._getTotal(data.files),
+ loaded = parseInt(
+ e.loaded / e.total * (data.chunkSize || total),
+ 10
+ ) + (data.uploadedBytes || 0);
+ this._loaded += loaded - (data.loaded || data.uploadedBytes || 0);
+ data.lengthComputable = true;
+ data.loaded = loaded;
+ data.total = total;
+ // Trigger a custom progress event with a total data property set
+ // to the file size(s) of the current upload and a loaded data
+ // property calculated accordingly:
+ this._trigger('progress', e, data);
+ // Trigger a global progress event for all current file uploads,
+ // including ajax calls queued for sequential file uploads:
+ this._trigger('progressall', e, {
+ lengthComputable: true,
+ loaded: this._loaded,
+ total: this._total
+ });
+ }
+ },
+
+ _initProgressListener: function (options) {
+ var that = this,
+ xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
+ // Accesss to the native XHR object is required to add event listeners
+ // for the upload progress event:
+ if (xhr.upload) {
+ $(xhr.upload).bind('progress', function (e) {
+ var oe = e.originalEvent;
+ // Make sure the progress event properties get copied over:
+ e.lengthComputable = oe.lengthComputable;
+ e.loaded = oe.loaded;
+ e.total = oe.total;
+ that._onProgress(e, options);
+ });
+ options.xhr = function () {
+ return xhr;
+ };
+ }
+ },
+
+ _initXHRData: function (options) {
+ var formData,
+ file = options.files[0],
+ // Ignore non-multipart setting if not supported:
+ multipart = options.multipart || !$.support.xhrFileUpload;
+ if (!multipart || options.blob) {
+ // For non-multipart uploads and chunked uploads,
+ // file meta data is not part of the request body,
+ // so we transmit this data as part of the HTTP headers.
+ // For cross domain requests, these headers must be allowed
+ // via Access-Control-Allow-Headers or removed using
+ // the beforeSend callback:
+ options.headers = $.extend(options.headers, {
+ 'X-File-Name': file.name,
+ 'X-File-Type': file.type,
+ 'X-File-Size': file.size
+ });
+ if (!options.blob) {
+ // Non-chunked non-multipart upload:
+ options.contentType = file.type;
+ options.data = file;
+ } else if (!multipart) {
+ // Chunked non-multipart upload:
+ options.contentType = 'application/octet-stream';
+ options.data = options.blob;
+ }
+ }
+ if (multipart && $.support.xhrFormDataFileUpload) {
+ if (options.postMessage) {
+ // window.postMessage does not allow sending FormData
+ // objects, so we just add the File/Blob objects to
+ // the formData array and let the postMessage window
+ // create the FormData object out of this array:
+ formData = this._getFormData(options);
+ if (options.blob) {
+ formData.push({
+ name: options.paramName,
+ value: options.blob
+ });
+ } else {
+ $.each(options.files, function (index, file) {
+ formData.push({
+ name: options.paramName,
+ value: file
+ });
+ });
+ }
+ } else {
+ if (options.formData instanceof FormData) {
+ formData = options.formData;
+ } else {
+ formData = new FormData();
+ $.each(this._getFormData(options), function (index, field) {
+ formData.append(field.name, field.value);
+ });
+ }
+ if (options.blob) {
+ formData.append(options.paramName, options.blob, file.name);
+ } else {
+ $.each(options.files, function (index, file) {
+ // File objects are also Blob instances.
+ // This check allows the tests to run with
+ // dummy objects:
+ if (file instanceof Blob) {
+ formData.append(options.paramName, file, file.name);
+ }
+ });
+ }
+ }
+ options.data = formData;
+ }
+ // Blob reference is not needed anymore, free memory:
+ options.blob = null;
+ },
+
+ _initIframeSettings: function (options) {
+ // Setting the dataType to iframe enables the iframe transport:
+ options.dataType = 'iframe ' + (options.dataType || '');
+ // The iframe transport accepts a serialized array as form data:
+ options.formData = this._getFormData(options);
+ // Add redirect url to form data on cross-domain uploads:
+ if (options.redirect && $('<a></a>').prop('href', options.url)
+ .prop('host') !== location.host) {
+ options.formData.push({
+ name: options.redirectParamName || 'redirect',
+ value: options.redirect
+ });
+ }
+ },
+
+ _initDataSettings: function (options) {
+ if (this._isXHRUpload(options)) {
+ if (!this._chunkedUpload(options, true)) {
+ if (!options.data) {
+ this._initXHRData(options);
+ }
+ this._initProgressListener(options);
+ }
+ if (options.postMessage) {
+ // Setting the dataType to postmessage enables the
+ // postMessage transport:
+ options.dataType = 'postmessage ' + (options.dataType || '');
+ }
+ } else {
+ this._initIframeSettings(options, 'iframe');
+ }
+ },
+
+ _initFormSettings: function (options) {
+ // Retrieve missing options from the input field and the
+ // associated form, if available:
+ if (!options.form || !options.form.length) {
+ options.form = $(options.fileInput.prop('form'));
+ }
+ if (!options.paramName) {
+ options.paramName = options.fileInput.prop('name') ||
+ 'files[]';
+ }
+ if (!options.url) {
+ options.url = options.form.prop('action') || location.href;
+ }
+ // The HTTP request method must be "POST" or "PUT":
+ options.type = (options.type || options.form.prop('method') || '')
+ .toUpperCase();
+ if (options.type !== 'POST' && options.type !== 'PUT') {
+ options.type = 'POST';
+ }
+ },
+
+ _getAJAXSettings: function (data) {
+ var options = $.extend({}, this.options, data);
+ this._initFormSettings(options);
+ this._initDataSettings(options);
+ return options;
+ },
+
+ // Maps jqXHR callbacks to the equivalent
+ // methods of the given Promise object:
+ _enhancePromise: function (promise) {
+ promise.success = promise.done;
+ promise.error = promise.fail;
+ promise.complete = promise.always;
+ return promise;
+ },
+
+ // Creates and returns a Promise object enhanced with
+ // the jqXHR methods abort, success, error and complete:
+ _getXHRPromise: function (resolveOrReject, context, args) {
+ var dfd = $.Deferred(),
+ promise = dfd.promise();
+ context = context || this.options.context || promise;
+ if (resolveOrReject === true) {
+ dfd.resolveWith(context, args);
+ } else if (resolveOrReject === false) {
+ dfd.rejectWith(context, args);
+ }
+ promise.abort = dfd.promise;
+ return this._enhancePromise(promise);
+ },
+
+ // Uploads a file in multiple, sequential requests
+ // by splitting the file up in multiple blob chunks.
+ // If the second parameter is true, only tests if the file
+ // should be uploaded in chunks, but does not invoke any
+ // upload requests:
+ _chunkedUpload: function (options, testOnly) {
+ var that = this,
+ file = options.files[0],
+ fs = file.size,
+ ub = options.uploadedBytes = options.uploadedBytes || 0,
+ mcs = options.maxChunkSize || fs,
+ // Use the Blob methods with the slice implementation
+ // according to the W3C Blob API specification:
+ slice = file.webkitSlice || file.mozSlice || file.slice,
+ upload,
+ n,
+ jqXHR,
+ pipe;
+ if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
+ options.data) {
+ return false;
+ }
+ if (testOnly) {
+ return true;
+ }
+ if (ub >= fs) {
+ file.error = 'uploadedBytes';
+ return this._getXHRPromise(
+ false,
+ options.context,
+ [null, 'error', file.error]
+ );
+ }
+ // n is the number of blobs to upload,
+ // calculated via filesize, uploaded bytes and max chunk size:
+ n = Math.ceil((fs - ub) / mcs);
+ // The chunk upload method accepting the chunk number as parameter:
+ upload = function (i) {
+ if (!i) {
+ return that._getXHRPromise(true, options.context);
+ }
+ // Upload the blobs in sequential order:
+ return upload(i -= 1).pipe(function () {
+ // Clone the options object for each chunk upload:
+ var o = $.extend({}, options);
+ o.blob = slice.call(
+ file,
+ ub + i * mcs,
+ ub + (i + 1) * mcs
+ );
+ // Store the current chunk size, as the blob itself
+ // will be dereferenced after data processing:
+ o.chunkSize = o.blob.size;
+ // Process the upload data (the blob and potential form data):
+ that._initXHRData(o);
+ // Add progress listeners for this chunk upload:
+ that._initProgressListener(o);
+ jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context))
+ .done(function () {
+ // Create a progress event if upload is done and
+ // no progress event has been invoked for this chunk:
+ if (!o.loaded) {
+ that._onProgress($.Event('progress', {
+ lengthComputable: true,
+ loaded: o.chunkSize,
+ total: o.chunkSize
+ }), o);
+ }
+ options.uploadedBytes = o.uploadedBytes +=
+ o.chunkSize;
+ });
+ return jqXHR;
+ });
+ };
+ // Return the piped Promise object, enhanced with an abort method,
+ // which is delegated to the jqXHR object of the current upload,
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
+ pipe = upload(n);
+ pipe.abort = function () {
+ return jqXHR.abort();
+ };
+ return this._enhancePromise(pipe);
+ },
+
+ _beforeSend: function (e, data) {
+ if (this._active === 0) {
+ // the start callback is triggered when an upload starts
+ // and no other uploads are currently running,
+ // equivalent to the global ajaxStart event:
+ this._trigger('start');
+ }
+ this._active += 1;
+ // Initialize the global progress values:
+ this._loaded += data.uploadedBytes || 0;
+ this._total += this._getTotal(data.files);
+ },
+
+ _onDone: function (result, textStatus, jqXHR, options) {
+ if (!this._isXHRUpload(options)) {
+ // Create a progress event for each iframe load:
+ this._onProgress($.Event('progress', {
+ lengthComputable: true,
+ loaded: 1,
+ total: 1
+ }), options);
+ }
+ options.result = result;
+ options.textStatus = textStatus;
+ options.jqXHR = jqXHR;
+ this._trigger('done', null, options);
+ },
+
+ _onFail: function (jqXHR, textStatus, errorThrown, options) {
+ options.jqXHR = jqXHR;
+ options.textStatus = textStatus;
+ options.errorThrown = errorThrown;
+ this._trigger('fail', null, options);
+ if (options.recalculateProgress) {
+ // Remove the failed (error or abort) file upload from
+ // the global progress calculation:
+ this._loaded -= options.loaded || options.uploadedBytes || 0;
+ this._total -= options.total || this._getTotal(options.files);
+ }
+ },
+
+ _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
+ this._active -= 1;
+ options.textStatus = textStatus;
+ if (jqXHRorError && jqXHRorError.always) {
+ options.jqXHR = jqXHRorError;
+ options.result = jqXHRorResult;
+ } else {
+ options.jqXHR = jqXHRorResult;
+ options.errorThrown = jqXHRorError;
+ }
+ this._trigger('always', null, options);
+ if (this._active === 0) {
+ // The stop callback is triggered when all uploads have
+ // been completed, equivalent to the global ajaxStop event:
+ this._trigger('stop');
+ // Reset the global progress values:
+ this._loaded = this._total = 0;
+ }
+ },
+
+ _onSend: function (e, data) {
+ var that = this,
+ jqXHR,
+ slot,
+ pipe,
+ options = that._getAJAXSettings(data),
+ send = function (resolve, args) {
+ that._sending += 1;
+ jqXHR = jqXHR || (
+ (resolve !== false &&
+ that._trigger('send', e, options) !== false &&
+ (that._chunkedUpload(options) || $.ajax(options))) ||
+ that._getXHRPromise(false, options.context, args)
+ ).done(function (result, textStatus, jqXHR) {
+ that._onDone(result, textStatus, jqXHR, options);
+ }).fail(function (jqXHR, textStatus, errorThrown) {
+ that._onFail(jqXHR, textStatus, errorThrown, options);
+ }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
+ that._sending -= 1;
+ that._onAlways(
+ jqXHRorResult,
+ textStatus,
+ jqXHRorError,
+ options
+ );
+ if (options.limitConcurrentUploads &&
+ options.limitConcurrentUploads > that._sending) {
+ // Start the next queued upload,
+ // that has not been aborted:
+ var nextSlot = that._slots.shift();
+ while (nextSlot) {
+ if (!nextSlot.isRejected()) {
+ nextSlot.resolve();
+ break;
+ }
+ nextSlot = that._slots.shift();
+ }
+ }
+ });
+ return jqXHR;
+ };
+ this._beforeSend(e, options);
+ if (this.options.sequentialUploads ||
+ (this.options.limitConcurrentUploads &&
+ this.options.limitConcurrentUploads <= this._sending)) {
+ if (this.options.limitConcurrentUploads > 1) {
+ slot = $.Deferred();
+ this._slots.push(slot);
+ pipe = slot.pipe(send);
+ } else {
+ pipe = (this._sequence = this._sequence.pipe(send, send));
+ }
+ // Return the piped Promise object, enhanced with an abort method,
+ // which is delegated to the jqXHR object of the current upload,
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
+ pipe.abort = function () {
+ var args = [undefined, 'abort', 'abort'];
+ if (!jqXHR) {
+ if (slot) {
+ slot.rejectWith(args);
+ }
+ return send(false, args);
+ }
+ return jqXHR.abort();
+ };
+ return this._enhancePromise(pipe);
+ }
+ return send();
+ },
+
+ _onAdd: function (e, data) {
+ var that = this,
+ result = true,
+ options = $.extend({}, this.options, data),
+ limit = options.limitMultiFileUploads,
+ fileSet,
+ i;
+ if (!(options.singleFileUploads || limit) ||
+ !this._isXHRUpload(options)) {
+ fileSet = [data.files];
+ } else if (!options.singleFileUploads && limit) {
+ fileSet = [];
+ for (i = 0; i < data.files.length; i += limit) {
+ fileSet.push(data.files.slice(i, i + limit));
+ }
+ }
+ data.originalFiles = data.files;
+ $.each(fileSet || data.files, function (index, element) {
+ var files = fileSet ? element : [element],
+ newData = $.extend({}, data, {files: files});
+ newData.submit = function () {
+ newData.jqXHR = this.jqXHR =
+ (that._trigger('submit', e, this) !== false) &&
+ that._onSend(e, this);
+ return this.jqXHR;
+ };
+ return (result = that._trigger('add', e, newData));
+ });
+ return result;
+ },
+
+ // File Normalization for Gecko 1.9.1 (Firefox 3.5) support:
+ _normalizeFile: function (index, file) {
+ if (file.name === undefined && file.size === undefined) {
+ file.name = file.fileName;
+ file.size = file.fileSize;
+ }
+ },
+
+ _replaceFileInput: function (input) {
+ var inputClone = input.clone(true);
+ $('<form></form>').append(inputClone)[0].reset();
+ // Detaching allows to insert the fileInput on another form
+ // without loosing the file input value:
+ input.after(inputClone).detach();
+ // Avoid memory leaks with the detached file input:
+ $.cleanData(input.unbind('remove'));
+ // Replace the original file input element in the fileInput
+ // collection with the clone, which has been copied including
+ // event handlers:
+ this.options.fileInput = this.options.fileInput.map(function (i, el) {
+ if (el === input[0]) {
+ return inputClone[0];
+ }
+ return el;
+ });
+ // If the widget has been initialized on the file input itself,
+ // override this.element with the file input clone:
+ if (input[0] === this.element[0]) {
+ this.element = inputClone;
+ }
+ },
+
+ _onChange: function (e) {
+ var that = e.data.fileupload,
+ data = {
+ files: $.each($.makeArray(e.target.files), that._normalizeFile),
+ fileInput: $(e.target),
+ form: $(e.target.form)
+ };
+ if (!data.files.length) {
+ // If the files property is not available, the browser does not
+ // support the File API and we add a pseudo File object with
+ // the input value as name with path information removed:
+ data.files = [{name: e.target.value.replace(/^.*\\/, '')}];
+ }
+ if (that.options.replaceFileInput) {
+ that._replaceFileInput(data.fileInput);
+ }
+ if (that._trigger('change', e, data) === false ||
+ that._onAdd(e, data) === false) {
+ return false;
+ }
+ },
+
+ _onPaste: function (e) {
+ var that = e.data.fileupload,
+ cbd = e.originalEvent.clipboardData,
+ items = (cbd && cbd.items) || [],
+ data = {files: []};
+ $.each(items, function (index, item) {
+ var file = item.getAsFile && item.getAsFile();
+ if (file) {
+ data.files.push(file);
+ }
+ });
+ if (that._trigger('paste', e, data) === false ||
+ that._onAdd(e, data) === false) {
+ return false;
+ }
+ },
+
+ _onDrop: function (e) {
+ var that = e.data.fileupload,
+ dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
+ data = {
+ files: $.each(
+ $.makeArray(dataTransfer && dataTransfer.files),
+ that._normalizeFile
+ )
+ };
+ if (that._trigger('drop', e, data) === false ||
+ that._onAdd(e, data) === false) {
+ return false;
+ }
+ e.preventDefault();
+ },
+
+ _onDragOver: function (e) {
+ var that = e.data.fileupload,
+ dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;
+ if (that._trigger('dragover', e) === false) {
+ return false;
+ }
+ if (dataTransfer) {
+ dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';
+ }
+ e.preventDefault();
+ },
+
+ _initEventHandlers: function () {
+ var ns = this.options.namespace;
+ if (this._isXHRUpload(this.options)) {
+ this.options.dropZone
+ .bind('dragover.' + ns, {fileupload: this}, this._onDragOver)
+ .bind('drop.' + ns, {fileupload: this}, this._onDrop)
+ .bind('paste.' + ns, {fileupload: this}, this._onPaste);
+ }
+ this.options.fileInput
+ .bind('change.' + ns, {fileupload: this}, this._onChange);
+ },
+
+ _destroyEventHandlers: function () {
+ var ns = this.options.namespace;
+ this.options.dropZone
+ .unbind('dragover.' + ns, this._onDragOver)
+ .unbind('drop.' + ns, this._onDrop)
+ .unbind('paste.' + ns, this._onPaste);
+ this.options.fileInput
+ .unbind('change.' + ns, this._onChange);
+ },
+
+ _setOption: function (key, value) {
+ var refresh = $.inArray(key, this._refreshOptionsList) !== -1;
+ if (refresh) {
+ this._destroyEventHandlers();
+ }
+ $.Widget.prototype._setOption.call(this, key, value);
+ if (refresh) {
+ this._initSpecialOptions();
+ this._initEventHandlers();
+ }
+ },
+
+ _initSpecialOptions: function () {
+ var options = this.options;
+ if (options.fileInput === undefined) {
+ options.fileInput = this.element.is('input:file') ?
+ this.element : this.element.find('input:file');
+ } else if (!(options.fileInput instanceof $)) {
+ options.fileInput = $(options.fileInput);
+ }
+ if (!(options.dropZone instanceof $)) {
+ options.dropZone = $(options.dropZone);
+ }
+ },
+
+ _create: function () {
+ var options = this.options,
+ dataOpts = $.extend({}, this.element.data());
+ dataOpts[this.widgetName] = undefined;
+ $.extend(options, dataOpts);
+ options.namespace = options.namespace || this.widgetName;
+ this._initSpecialOptions();
+ this._slots = [];
+ this._sequence = this._getXHRPromise(true);
+ this._sending = this._active = this._loaded = this._total = 0;
+ this._initEventHandlers();
+ },
+
+ destroy: function () {
+ this._destroyEventHandlers();
+ $.Widget.prototype.destroy.call(this);
+ },
+
+ enable: function () {
+ $.Widget.prototype.enable.call(this);
+ this._initEventHandlers();
+ },
+
+ disable: function () {
+ this._destroyEventHandlers();
+ $.Widget.prototype.disable.call(this);
+ },
+
+ // This method is exposed to the widget API and allows adding files
+ // using the fileupload API. The data parameter accepts an object which
+ // must have a files property and can contain additional options:
+ // .fileupload('add', {files: filesList});
+ add: function (data) {
+ if (!data || this.options.disabled) {
+ return;
+ }
+ data.files = $.each($.makeArray(data.files), this._normalizeFile);
+ this._onAdd(null, data);
+ },
+
+ // This method is exposed to the widget API and allows sending files
+ // using the fileupload API. The data parameter accepts an object which
+ // must have a files property and can contain additional options:
+ // .fileupload('send', {files: filesList});
+ // The method returns a Promise object for the file upload call.
+ send: function (data) {
+ if (data && !this.options.disabled) {
+ data.files = $.each($.makeArray(data.files), this._normalizeFile);
+ if (data.files.length) {
+ return this._onSend(null, data);
+ }
+ }
+ return this._getXHRPromise(false, data && data.context);
+ }
+
+ });
+
+}));
diff --git a/apps/files/js/jquery.iframe-transport.js b/apps/files/js/jquery.iframe-transport.js
new file mode 100644
index 00000000000..d85c0c11297
--- /dev/null
+++ b/apps/files/js/jquery.iframe-transport.js
@@ -0,0 +1,165 @@
+/*
+ * jQuery Iframe Transport Plugin 1.3
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/*jslint unparam: true, nomen: true */
+/*global define, window, document */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery'], factory);
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+
+ // Helper variable to create unique names for the transport iframes:
+ var counter = 0;
+
+ // The iframe transport accepts three additional options:
+ // options.fileInput: a jQuery collection of file input fields
+ // options.paramName: the parameter name for the file form data,
+ // overrides the name property of the file input field(s)
+ // options.formData: an array of objects with name and value properties,
+ // equivalent to the return data of .serializeArray(), e.g.:
+ // [{name: 'a', value: 1}, {name: 'b', value: 2}]
+ $.ajaxTransport('iframe', function (options) {
+ if (options.async && (options.type === 'POST' || options.type === 'GET')) {
+ var form,
+ iframe;
+ return {
+ send: function (_, completeCallback) {
+ form = $('<form style="display:none;"></form>');
+ // javascript:false as initial iframe src
+ // prevents warning popups on HTTPS in IE6.
+ // IE versions below IE8 cannot set the name property of
+ // elements that have already been added to the DOM,
+ // so we set the name along with the iframe HTML markup:
+ iframe = $(
+ '<iframe src="javascript:false;" name="iframe-transport-' +
+ (counter += 1) + '"></iframe>'
+ ).bind('load', function () {
+ var fileInputClones;
+ iframe
+ .unbind('load')
+ .bind('load', function () {
+ var response;
+ // Wrap in a try/catch block to catch exceptions thrown
+ // when trying to access cross-domain iframe contents:
+ try {
+ response = iframe.contents();
+ // Google Chrome and Firefox do not throw an
+ // exception when calling iframe.contents() on
+ // cross-domain requests, so we unify the response:
+ if (!response.length || !response[0].firstChild) {
+ throw new Error();
+ }
+ } catch (e) {
+ response = undefined;
+ }
+ // The complete callback returns the
+ // iframe content document as response object:
+ completeCallback(
+ 200,
+ 'success',
+ {'iframe': response}
+ );
+ // Fix for IE endless progress bar activity bug
+ // (happens on form submits to iframe targets):
+ $('<iframe src="javascript:false;"></iframe>')
+ .appendTo(form);
+ form.remove();
+ });
+ form
+ .prop('target', iframe.prop('name'))
+ .prop('action', options.url)
+ .prop('method', options.type);
+ if (options.formData) {
+ $.each(options.formData, function (index, field) {
+ $('<input type="hidden"/>')
+ .prop('name', field.name)
+ .val(field.value)
+ .appendTo(form);
+ });
+ }
+ if (options.fileInput && options.fileInput.length &&
+ options.type === 'POST') {
+ fileInputClones = options.fileInput.clone();
+ // Insert a clone for each file input field:
+ options.fileInput.after(function (index) {
+ return fileInputClones[index];
+ });
+ if (options.paramName) {
+ options.fileInput.each(function () {
+ $(this).prop('name', options.paramName);
+ });
+ }
+ // Appending the file input fields to the hidden form
+ // removes them from their original location:
+ form
+ .append(options.fileInput)
+ .prop('enctype', 'multipart/form-data')
+ // enctype must be set as encoding for IE:
+ .prop('encoding', 'multipart/form-data');
+ }
+ form.submit();
+ // Insert the file input fields at their original location
+ // by replacing the clones with the originals:
+ if (fileInputClones && fileInputClones.length) {
+ options.fileInput.each(function (index, input) {
+ var clone = $(fileInputClones[index]);
+ $(input).prop('name', clone.prop('name'));
+ clone.replaceWith(input);
+ });
+ }
+ });
+ form.append(iframe).appendTo(document.body);
+ },
+ abort: function () {
+ if (iframe) {
+ // javascript:false as iframe src aborts the request
+ // and prevents warning popups on HTTPS in IE6.
+ // concat is used to avoid the "Script URL" JSLint error:
+ iframe
+ .unbind('load')
+ .prop('src', 'javascript'.concat(':false;'));
+ }
+ if (form) {
+ form.remove();
+ }
+ }
+ };
+ }
+ });
+
+ // The iframe transport returns the iframe content document as response.
+ // The following adds converters from iframe to text, json, html, and script:
+ $.ajaxSetup({
+ converters: {
+ 'iframe text': function (iframe) {
+ return $(iframe[0].body).text();
+ },
+ 'iframe json': function (iframe) {
+ return $.parseJSON($(iframe[0].body).text());
+ },
+ 'iframe html': function (iframe) {
+ return $(iframe[0].body).html();
+ },
+ 'iframe script': function (iframe) {
+ return $.globalEval($(iframe[0].body).text());
+ }
+ }
+ });
+
+}));
diff --git a/apps/files/js/timezone.js b/apps/files/js/timezone.js
new file mode 100644
index 00000000000..4749417199d
--- /dev/null
+++ b/apps/files/js/timezone.js
@@ -0,0 +1,12 @@
+//send the clients time zone to the server
+$(document).ready(function() {
+ var visitortimezone = (-new Date().getTimezoneOffset()/60);
+ $.ajax({
+ type: "GET",
+ url: OC.filePath('files', 'ajax', 'timezone.php'),
+ data: 'time='+ visitortimezone,
+ success: function(){
+ location.reload();
+ }
+ });
+}); \ No newline at end of file
diff --git a/apps/files/l10n/ar.php b/apps/files/l10n/ar.php
new file mode 100644
index 00000000000..50edc0d6979
--- /dev/null
+++ b/apps/files/l10n/ar.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "تم ترفيع الملفات بنجاح.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "حجم الملف الذي تريد ترفيعه أعلى مما upload_max_filesize يسمح به في ملف php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "حجم الملف الذي تريد ترفيعه أعلى مما MAX_FILE_SIZE يسمح به في واجهة ال HTML.",
+"The uploaded file was only partially uploaded" => "تم ترفيع جزء من الملفات الذي تريد ترفيعها فقط",
+"No file was uploaded" => "لم يتم ترفيع أي من الملفات",
+"Missing a temporary folder" => "المجلد المؤقت غير موجود",
+"Files" => "الملفات",
+"Maximum upload size" => "الحد الأقصى لحجم الملفات التي يمكن رفعها",
+"New" => "جديد",
+"Text file" => "ملف",
+"Folder" => "مجلد",
+"From the web" => "من الوب",
+"Upload" => "إرفع",
+"Nothing in here. Upload something!" => "لا يوجد شيء هنا. إرفع بعض الملفات!",
+"Name" => "الاسم",
+"Download" => "تحميل",
+"Size" => "حجم",
+"Modified" => "معدل",
+"Delete" => "محذوف",
+"Upload too large" => "حجم الترفيع أعلى من المسموح",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "حجم الملفات التي تريد ترفيعها أعلى من المسموح على الخادم."
+);
diff --git a/apps/files/l10n/bg_BG.php b/apps/files/l10n/bg_BG.php
new file mode 100644
index 00000000000..027a7698203
--- /dev/null
+++ b/apps/files/l10n/bg_BG.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Файлът е качен успешно",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Файлът който се опитвате да качите, надвишава зададените стойности в upload_max_filesize в PHP.INI",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Файлът който се опитвате да качите надвишава стойностите в MAX_FILE_SIZE в HTML формата.",
+"The uploaded file was only partially uploaded" => "Файлът е качен частично",
+"No file was uploaded" => "Фахлът не бе качен",
+"Missing a temporary folder" => "Липсва временната папка",
+"Files" => "Файлове",
+"Maximum upload size" => "Макс. размер за качване",
+"Upload" => "Качване",
+"Nothing in here. Upload something!" => "Няма нищо, качете нещо!",
+"Name" => "Име",
+"Download" => "Изтегляне",
+"Size" => "Размер",
+"Modified" => "Променено",
+"Delete" => "Изтриване",
+"Upload too large" => "Файлът е прекалено голям",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Файловете които се опитвате да качите са по-големи от позволеното за сървъра."
+);
diff --git a/apps/files/l10n/ca.php b/apps/files/l10n/ca.php
new file mode 100644
index 00000000000..b85b36f5c02
--- /dev/null
+++ b/apps/files/l10n/ca.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "El fitxer s'ha pujat correctament",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "El fitxer de pujada excedeix la directiva upload_max_filesize establerta a php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "El fitxer de pujada excedeix la directiva MAX_FILE_SIZE especificada al formulari HTML",
+"The uploaded file was only partially uploaded" => "El fitxer només s'ha pujat parcialment",
+"No file was uploaded" => "El fitxer no s'ha pujat",
+"Missing a temporary folder" => "S'ha perdut un fitxer temporal",
+"Files" => "Fitxers",
+"Maximum upload size" => "Mida màxima de pujada",
+"New" => "Nou",
+"Text file" => "Fitxer de text",
+"Folder" => "Carpeta",
+"From the web" => "Des de la web",
+"Upload" => "Puja",
+"Nothing in here. Upload something!" => "Res per aquí. Pugeu alguna cosa!",
+"Name" => "Nom",
+"Download" => "Baixa",
+"Size" => "Mida",
+"Modified" => "Modificat",
+"Delete" => "Esborra",
+"Upload too large" => "La pujada és massa gran",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Els fitxers que esteu intentant pujar excedeixen la mida màxima de pujada del servidor"
+);
diff --git a/apps/files/l10n/cs_CZ.php b/apps/files/l10n/cs_CZ.php
new file mode 100644
index 00000000000..5d26b26604a
--- /dev/null
+++ b/apps/files/l10n/cs_CZ.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Soubor byl odeslán úspěšně",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Odeslaný soubor přesáhl velikostí parametr upload_max_filesize v php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Odeslaný soubor přesáhl velikostí parametr MAX_FILE_SIZE specifikovaný v HTML formuláři",
+"The uploaded file was only partially uploaded" => "Soubor byl odeslán pouze částečně",
+"No file was uploaded" => "Soubor nebyl odeslán",
+"Missing a temporary folder" => "Chybí adresář pro sočasné soubory",
+"Files" => "Soubory",
+"Maximum upload size" => "Maximální velikost ukládaných souborů",
+"New" => "Nový",
+"Text file" => "Textový soubor",
+"Folder" => "Adresář",
+"From the web" => "Z webu",
+"Upload" => "Uložit",
+"Nothing in here. Upload something!" => "Žádný obsah. Uložte si něco!",
+"Name" => "Název",
+"Download" => "Stáhnout",
+"Size" => "Velikost",
+"Modified" => "Změněno",
+"Delete" => "Vymazat",
+"Upload too large" => "Příliš velký soubor",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Soubory, které se snažíte uložit, překračují maximální velikosti uploadu na tomto serveru."
+);
diff --git a/apps/files/l10n/da.php b/apps/files/l10n/da.php
new file mode 100644
index 00000000000..f86a98d44c1
--- /dev/null
+++ b/apps/files/l10n/da.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Der er ingen fejl, filen blev uploadet med success",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Den uploadede fil overskrider upload_max_filesize direktivet i php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Den uploadede fil overskrider MAX_FILE_SIZE -direktivet som er specificeret i HTML-formularen",
+"The uploaded file was only partially uploaded" => "Den uploadede file blev kun delvist uploadet",
+"No file was uploaded" => "Ingen fil blev uploadet",
+"Missing a temporary folder" => "Mangler en midlertidig mappe",
+"Files" => "Filer",
+"Maximum upload size" => "Maksimal upload-størrelse",
+"New" => "Ny",
+"Text file" => "Tekstfil",
+"Folder" => "Mappe",
+"From the web" => "Fra nettet",
+"Upload" => "Upload",
+"Nothing in here. Upload something!" => "Her er tomt. Upload noget!",
+"Name" => "Navn",
+"Download" => "Download",
+"Size" => "Størrelse",
+"Modified" => "Ændret",
+"Delete" => "Slet",
+"Upload too large" => "Upload for stor",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filerne, du prøver at uploade, er større end den maksimale størrelse for fil-upload på denne server."
+);
diff --git a/apps/files/l10n/de.php b/apps/files/l10n/de.php
new file mode 100644
index 00000000000..94d312c3e9e
--- /dev/null
+++ b/apps/files/l10n/de.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Datei hochgeladen.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Die hochgeladene Datei ist zu groß.",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Die hochgeladene Datei ist zu groß.",
+"The uploaded file was only partially uploaded" => "Die Datei wurde nur teilweise hochgeladen.",
+"No file was uploaded" => "Es wurde keine Datei hochgeladen.",
+"Missing a temporary folder" => "Temporärer Ordner fehlt.",
+"Files" => "Dateien",
+"Maximum upload size" => "Maximale Größe",
+"New" => "Neu",
+"Text file" => "Text Datei",
+"Folder" => "Ordner",
+"From the web" => "Aus dem Netz",
+"Upload" => "Hochladen",
+"Nothing in here. Upload something!" => "Alles leer. Lad’ was hoch!",
+"Name" => "Name",
+"Download" => "Herunterladen",
+"Size" => "Größe",
+"Modified" => "Bearbeitet",
+"Delete" => "Löschen",
+"Upload too large" => "Upload zu groß",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Die Datei überschreitet die Maximalgröße für Uploads auf diesem Server."
+);
diff --git a/apps/files/l10n/el.php b/apps/files/l10n/el.php
new file mode 100644
index 00000000000..27a80fcc98c
--- /dev/null
+++ b/apps/files/l10n/el.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Δεν υπάρχει λάθος, το αρχείο που μεταφορτώθηκε επιτυχώς",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Το αρχείο που μεταφορτώθηκε υπερβαίνει την οδηγία μέγιστου επιτρεπτού μεγέθους \"upload_max_filesize\" του php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Το αρχείο υπερβαίνει την οδηγία μέγιστου επιτρεπτού μεγέθους \"MAX_FILE_SIZE\" που έχει οριστεί στην html φόρμα",
+"The uploaded file was only partially uploaded" => "Το αρχείο μεταφορώθηκε μόνο εν μέρει",
+"No file was uploaded" => "Το αρχείο δεν μεταφορτώθηκε",
+"Missing a temporary folder" => "Λείπει ένας προσωρινός φάκελος",
+"Files" => "Αρχεία",
+"Maximum upload size" => "Μέγιστο μέγεθος μεταφόρτωσης",
+"New" => "Νέο",
+"Text file" => "Αρχείο κειμένου",
+"Folder" => "Φάκελος",
+"From the web" => "Από τον ιστό",
+"Upload" => "Μεταφόρτωση",
+"Nothing in here. Upload something!" => "Δεν υπάρχει τίποτα εδώ. Ανέβασε κάτι!",
+"Name" => "Όνομα",
+"Download" => "Λήψη",
+"Size" => "Μέγεθος",
+"Modified" => "Τροποποιήθηκε",
+"Delete" => "Διαγραφή",
+"Upload too large" => "Πολύ μεγάλο το αρχείο προς μεταφόρτωση",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Τα αρχεία που προσπαθείτε να ανεβάσετε υπερβαίνουν το μέγιστο μέγεθος μεταφόρτωσης αρχείων σε αυτόν το διακομιστή."
+);
diff --git a/apps/files/l10n/eo.php b/apps/files/l10n/eo.php
new file mode 100644
index 00000000000..42dc4f1280e
--- /dev/null
+++ b/apps/files/l10n/eo.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Ne estas eraro, la dosiero alŝutiĝis sukcese",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "La dosiero alŝutita superas la regulon upload_max_filesize el php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "La dosiero alŝutita superas laregulon MAX_FILE_SIZE, kiu estas difinita en la HTML-formularo",
+"The uploaded file was only partially uploaded" => "La alŝutita dosiero nur parte alŝutiĝis",
+"No file was uploaded" => "Neniu dosiero estas alŝutita",
+"Missing a temporary folder" => "Mankas tempa dosierujo",
+"Files" => "Dosieroj",
+"Maximum upload size" => "Maksimuma alŝutogrando",
+"Upload" => "Alŝuti",
+"Nothing in here. Upload something!" => "Nenio estas ĉi tie. Alŝutu ion!",
+"Name" => "Nomo",
+"Download" => "Elŝuti",
+"Size" => "Grando",
+"Modified" => "Modifita",
+"Delete" => "Forigi",
+"Upload too large" => "Elŝuto tro larĝa",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "La dosieroj, kiujn vi provas alŝuti, transpasas la maksimuman grandon por dosieralŝutoj en ĉi tiu servilo."
+);
diff --git a/apps/files/l10n/es.php b/apps/files/l10n/es.php
new file mode 100644
index 00000000000..11665ac3c32
--- /dev/null
+++ b/apps/files/l10n/es.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "No hubo ningún error, el archivo se subió con éxito",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "El archivo que intentas subir sobrepasa el tamaño definido por la variable upload_max_filesize en php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "El archivo que intentas subir sobrepasa el tamaño definido por la variable MAX_FILE_SIZE especificada en el formulario HTML",
+"The uploaded file was only partially uploaded" => "El archivo que intentas subir solo se subió parcialmente",
+"No file was uploaded" => "No se subió ningún archivo",
+"Missing a temporary folder" => "Falta un directorio temporal",
+"Files" => "Archivos",
+"Maximum upload size" => "Tamaño máximo de subida",
+"New" => "Nuevo",
+"Text file" => "Archivo de texto",
+"Folder" => "Carpeta",
+"From the web" => "Desde la web",
+"Upload" => "Subir",
+"Nothing in here. Upload something!" => "Aquí no hay nada. ¡Sube algo!",
+"Name" => "Nombre",
+"Download" => "Descargar",
+"Size" => "Tamaño",
+"Modified" => "Modificado",
+"Delete" => "Eliminado",
+"Upload too large" => "El archivo es demasiado grande",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Los archivos que estás intentando subir sobrepasan el tamaño máximo permitido por este servidor."
+);
diff --git a/apps/files/l10n/et_EE.php b/apps/files/l10n/et_EE.php
new file mode 100644
index 00000000000..415eb632312
--- /dev/null
+++ b/apps/files/l10n/et_EE.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Ühtegi viga pole, fail on üles laetud",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Üles laetud faili suurus ületab php.ini määratud upload_max_filesize suuruse",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Üles laetud faili suurus ületab HTML vormis määratud upload_max_filesize suuruse",
+"The uploaded file was only partially uploaded" => "Fail laeti üles ainult osaliselt",
+"No file was uploaded" => "Ühtegi faili ei laetud üles",
+"Missing a temporary folder" => "Ajutiste failide kaust puudub",
+"Files" => "Failid",
+"Maximum upload size" => "Maksimaalne üleslaadimise suurus",
+"New" => "Uus",
+"Text file" => "Tekstifail",
+"Folder" => "Kaust",
+"From the web" => "Veebist",
+"Upload" => "Lae üles",
+"Nothing in here. Upload something!" => "Siin pole midagi. Lae midagi üles!",
+"Name" => "Nimi",
+"Download" => "Lae alla",
+"Size" => "Suurus",
+"Modified" => "Muudetud",
+"Delete" => "Kustuta",
+"Upload too large" => "Üleslaadimine on liiga suur",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Failid, mida sa proovid üles laadida, ületab serveri poolt üleslaetavatele failidele määratud maksimaalse suuruse."
+);
diff --git a/apps/files/l10n/eu.php b/apps/files/l10n/eu.php
new file mode 100644
index 00000000000..b9873e6c3fa
--- /dev/null
+++ b/apps/files/l10n/eu.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Ez da arazorik izan, fitxategia ongi igo da",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Igotako fitxategiaren tamaina php.ini-ko upload_max_filesize direktiban adierazitakoa baino handiagoa da",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Igotako fitxategiaren tamaina HTML inprimakiko MAX_FILESIZE direktiban adierazitakoa baino handiagoa da",
+"The uploaded file was only partially uploaded" => "Igotako fitxategiaren zati bat baino gehiago ez da igo",
+"No file was uploaded" => "Ez da fitxategirik igo",
+"Missing a temporary folder" => "Aldi baterako karpeta falta da",
+"Files" => "Fitxategiak",
+"Maximum upload size" => "Igo daitekeen gehienezko tamaina",
+"Upload" => "Igo",
+"Nothing in here. Upload something!" => "Ez dago ezer. Igo zerbait!",
+"Name" => "Izena",
+"Download" => "Deskargatu",
+"Size" => "Tamaina",
+"Modified" => "Aldatuta",
+"Delete" => "Ezabatu",
+"Upload too large" => "Igotakoa handiegia da",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Igotzen saiatzen ari zaren fitxategiak zerbitzari honek igotzeko onartzen duena baino handiagoak dira."
+);
diff --git a/apps/files/l10n/fr.php b/apps/files/l10n/fr.php
new file mode 100644
index 00000000000..cf90223a06a
--- /dev/null
+++ b/apps/files/l10n/fr.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Aucune erreur, le fichier a été téléversé avec succès",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Le fichier téléversé excède la valeur de upload_max_filesize spécifiée dans php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Le fichier téléversé excède la valeur de MAX_FILE_SIZE spécifiée dans le formulaire HTML",
+"The uploaded file was only partially uploaded" => "Le fichier n'a été que partiellement téléversé",
+"No file was uploaded" => "Aucun fichier n'a été téléversé",
+"Missing a temporary folder" => "Il manque un répertoire temporaire",
+"Files" => "Fichiers",
+"Maximum upload size" => "Taille max. d'envoi",
+"New" => "Nouveau",
+"Text file" => "Fichier texte",
+"Folder" => "Dossier",
+"From the web" => "Depuis le web",
+"Upload" => "Envoyer",
+"Nothing in here. Upload something!" => "Il n'y a rien ici ! Envoyez donc quelque chose :)",
+"Name" => "Nom",
+"Download" => "Téléchargement",
+"Size" => "Taille",
+"Modified" => "Modifié",
+"Delete" => "Supprimer",
+"Upload too large" => "Fichier trop volumineux",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Les fichiers que vous essayez d'envoyer dépassent la taille maximale permise par ce serveur."
+);
diff --git a/apps/files/l10n/gl.php b/apps/files/l10n/gl.php
new file mode 100644
index 00000000000..83cf93be795
--- /dev/null
+++ b/apps/files/l10n/gl.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Non hai erros, o ficheiro subeuse con éxito",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "O ficheiro subido supera a directiva upload_max_filesize no php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "O ficheiro subido supera a directiva MAX_FILE_SIZE que foi indicada no formulario HTML",
+"The uploaded file was only partially uploaded" => "O ficheiro subido foi só parcialmente subido",
+"No file was uploaded" => "Non se subeu ningún ficheiro",
+"Missing a temporary folder" => "Falta un cartafol temporal",
+"Files" => "Ficheiros",
+"Maximum upload size" => "Tamaño máximo de subida",
+"New" => "Novo",
+"Text file" => "Ficheiro de texto",
+"Folder" => "Cartafol",
+"From the web" => "Desde a rede",
+"Upload" => "Subir",
+"Nothing in here. Upload something!" => "Nada por aquí. Sube algo!",
+"Name" => "Nome",
+"Download" => "Baixar",
+"Size" => "Tamaño",
+"Modified" => "Modificado",
+"Delete" => "Eliminar",
+"Upload too large" => "Subida demasiado grande",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Os ficheiros que tratas de subir superan o tamaño máximo permitido neste servidor"
+);
diff --git a/apps/files/l10n/he.php b/apps/files/l10n/he.php
new file mode 100644
index 00000000000..79ae1edb7a5
--- /dev/null
+++ b/apps/files/l10n/he.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "לא אירעה תקלה, הקבצים הועלו בהצלחה",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "הקובץ שהועלה חרג מההנחיה upload_max_filesize בקובץ php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "הקובץ שהועלה חרג מההנחיה MAX_FILE_SIZE שצוינה בטופס ה־HTML",
+"The uploaded file was only partially uploaded" => "הקובץ שהועלה הועלה בצורה חלקית",
+"No file was uploaded" => "לא הועלו קבצים",
+"Missing a temporary folder" => "תיקייה זמנית חסרה",
+"Files" => "קבצים",
+"Maximum upload size" => "גודל העלאה מקסימלי",
+"Upload" => "העלאה",
+"Nothing in here. Upload something!" => "אין כאן שום דבר. אולי ברצונך להעלות משהו?",
+"Name" => "שם",
+"Download" => "הורדה",
+"Size" => "גודל",
+"Modified" => "זמן שינוי",
+"Delete" => "מחיקה",
+"Upload too large" => "העלאה גדולה מידי",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "הקבצים שניסית להעלות חרגו מהגודל המקסימלי להעלאת קבצים על שרת זה."
+);
diff --git a/apps/files/l10n/hr.php b/apps/files/l10n/hr.php
new file mode 100644
index 00000000000..670e87f6557
--- /dev/null
+++ b/apps/files/l10n/hr.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Datoteka je poslana uspješno i bez pogrešaka",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Poslana datoteka izlazi iz okvira upload_max_size direktive postavljene u php.ini konfiguracijskoj datoteci",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Poslana datoteka izlazi iz okvira MAX_FILE_SIZE direktive postavljene u HTML obrascu",
+"The uploaded file was only partially uploaded" => "Datoteka je poslana samo djelomično",
+"No file was uploaded" => "Ni jedna datoteka nije poslana",
+"Missing a temporary folder" => "Nedostaje privremena mapa",
+"Files" => "Datoteke",
+"Maximum upload size" => "Maksimalna veličina prijenosa",
+"Upload" => "Pošalji",
+"Nothing in here. Upload something!" => "Nema ničega u ovoj mapi. Pošalji nešto!",
+"Name" => "Naziv",
+"Download" => "Preuzmi",
+"Size" => "Veličina",
+"Modified" => "Zadnja promjena",
+"Delete" => "Briši",
+"Upload too large" => "Prijenos je preobiman",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Datoteke koje pokušavate prenijeti prelaze maksimalnu veličinu za prijenos datoteka na ovom poslužitelju."
+);
diff --git a/apps/files/l10n/hu_HU.php b/apps/files/l10n/hu_HU.php
new file mode 100644
index 00000000000..a176ffce647
--- /dev/null
+++ b/apps/files/l10n/hu_HU.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Nincs hiba, a fájl sikeresen feltöltve.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "A feltöltött file meghaladja az upload_max_filesize direktívát a php.ini-ben.",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "A feltöltött fájl meghaladja a MAX_FILE_SIZE direktívát ami meghatározott a HTML form-ban.",
+"The uploaded file was only partially uploaded" => "Az eredeti fájl csak részlegesen van feltöltve.",
+"No file was uploaded" => "Nem lett fájl feltöltve.",
+"Missing a temporary folder" => "Hiányzik az ideiglenes könyvtár",
+"Files" => "Fájlok",
+"Maximum upload size" => "Maximális feltölthető fájlméret",
+"Upload" => "Feltöltés",
+"Nothing in here. Upload something!" => "Töltsön fel egy fájlt.",
+"Name" => "Név",
+"Download" => "Letöltés",
+"Size" => "Méret",
+"Modified" => "Módosítva",
+"Delete" => "Törlés",
+"Upload too large" => "Feltöltés túl nagy",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "A fájlokat amit próbálsz feltölteni meghaladta a legnagyobb fájlméretet ezen a szerveren."
+);
diff --git a/apps/files/l10n/ia.php b/apps/files/l10n/ia.php
new file mode 100644
index 00000000000..8753b871c9e
--- /dev/null
+++ b/apps/files/l10n/ia.php
@@ -0,0 +1,17 @@
+<?php $TRANSLATIONS = array(
+"The uploaded file was only partially uploaded" => "Le file incargate solmente esseva incargate partialmente",
+"No file was uploaded" => "Nulle file esseva incargate",
+"Files" => "Files",
+"Maximum upload size" => "Dimension maxime de incargamento",
+"New" => "Nove",
+"Text file" => "File de texto",
+"Folder" => "Dossier",
+"Upload" => "Incargar",
+"Nothing in here. Upload something!" => "Nihil hic. Incarga alcun cosa!",
+"Name" => "Nomine",
+"Download" => "Discargar",
+"Size" => "Dimension",
+"Modified" => "Modificate",
+"Delete" => "Deler",
+"Upload too large" => "Incargamento troppo longe"
+);
diff --git a/apps/files/l10n/id.php b/apps/files/l10n/id.php
new file mode 100644
index 00000000000..902eeeb4ec2
--- /dev/null
+++ b/apps/files/l10n/id.php
@@ -0,0 +1,13 @@
+<?php $TRANSLATIONS = array(
+"Files" => "Berkas",
+"Maximum upload size" => "Ukuran unggah maksimum",
+"Upload" => "Unggah",
+"Nothing in here. Upload something!" => "Tidak ada apa-apa di sini. Unggah sesuatu!",
+"Name" => "Nama",
+"Download" => "Unduh",
+"Size" => "Ukuran",
+"Modified" => "Dimodifikasi",
+"Delete" => "Hapus",
+"Upload too large" => "Unggahan terlalu besar",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Berkas yang anda coba unggah melebihi ukuran maksimum untuk pengunggahan berkas di server ini."
+);
diff --git a/apps/files/l10n/it.php b/apps/files/l10n/it.php
new file mode 100644
index 00000000000..919ff0b5aae
--- /dev/null
+++ b/apps/files/l10n/it.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Non ci sono errori, file caricato con successo",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Il file caricato supera il valore upload_max_filesize in php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Il file caricato supera il valore MAX_FILE_SIZE definito nel form HTML",
+"The uploaded file was only partially uploaded" => "Il file è stato parzialmente caricato",
+"No file was uploaded" => "Nessun file è stato caricato",
+"Missing a temporary folder" => "Cartella temporanea mancante",
+"Files" => "File",
+"Maximum upload size" => "Dimensione massima upload",
+"New" => "Nuovo",
+"Text file" => "File di testo",
+"Folder" => "Cartella",
+"From the web" => "Dal web",
+"Upload" => "Carica",
+"Nothing in here. Upload something!" => "Non c'è niente qui. Carica qualcosa!",
+"Name" => "Nome",
+"Download" => "Scarica",
+"Size" => "Dimensione",
+"Modified" => "Modificato",
+"Delete" => "Cancella",
+"Upload too large" => "Il file caricato è troppo grande",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "I file che stai provando a caricare superano la dimensione massima consentita su questo server."
+);
diff --git a/apps/files/l10n/ja_JP.php b/apps/files/l10n/ja_JP.php
new file mode 100644
index 00000000000..24c4e36ee6e
--- /dev/null
+++ b/apps/files/l10n/ja_JP.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "エラーはありません。ファイルのアップロードは成功しました。",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "アップロードされたファイルはphp.iniのupload_max_filesizeに設定されたサイズを超えています",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "アップロードされたファイルはHTMLのフォームに設定されたMAX_FILE_SIZEに設定されたサイズを超えています",
+"The uploaded file was only partially uploaded" => "ファイルは一部分しかアップロードされませんでした",
+"No file was uploaded" => "ファイルはアップロードされませんでした",
+"Missing a temporary folder" => "テンポラリフォルダが見つかりません",
+"Files" => "ファイル",
+"Maximum upload size" => "最大アップロードサイズ",
+"New" => "新規作成",
+"Text file" => "テキストファイル",
+"Folder" => "フォルダ",
+"From the web" => "ウェブ経由",
+"Upload" => "アップロード",
+"Nothing in here. Upload something!" => "ここには何もありません。何かアップロードしてください。",
+"Name" => "名前",
+"Download" => "ダウンロード",
+"Size" => "サイズ",
+"Modified" => "更新日時",
+"Delete" => "削除",
+"Upload too large" => "ファイルサイズが大きすぎます",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "アップロードしようとしているファイルはサーバで規定された最大サイズを超えています"
+);
diff --git a/apps/files/l10n/lb.php b/apps/files/l10n/lb.php
new file mode 100644
index 00000000000..43956fcd63e
--- /dev/null
+++ b/apps/files/l10n/lb.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Keen Feeler, Datei ass komplett ropgelueden ginn",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Déi ropgelueden Datei ass méi grouss wei d'upload_max_filesize Eegenschaft an der php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Déi ropgelueden Datei ass méi grouss wei d'MAX_FILE_SIZE Eegenschaft déi an der HTML form uginn ass",
+"The uploaded file was only partially uploaded" => "Déi ropgelueden Datei ass nëmmen hallef ropgelueden ginn",
+"No file was uploaded" => "Et ass keng Datei ropgelueden ginn",
+"Missing a temporary folder" => "Et feelt en temporären Dossier",
+"Files" => "Dateien",
+"Maximum upload size" => "Maximum Upload Gréisst ",
+"Upload" => "Eroplueden",
+"Nothing in here. Upload something!" => "Hei ass näischt. Lued eppes rop!",
+"Name" => "Numm",
+"Download" => "Eroflueden",
+"Size" => "Gréisst",
+"Modified" => "Geännert",
+"Delete" => "Läschen",
+"Upload too large" => "Upload ze grouss",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Déi Dateien déi Dir probéiert erop ze lueden sinn méi grouss wei déi Maximal Gréisst déi op dësem Server erlaabt ass."
+);
diff --git a/apps/files/l10n/lt_LT.php b/apps/files/l10n/lt_LT.php
new file mode 100644
index 00000000000..1bec35e0f8c
--- /dev/null
+++ b/apps/files/l10n/lt_LT.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Klaidų nėra, failas įkeltas sėkmingai",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Įkeliamo failo dydis viršija upload_max_filesize parametrą php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Įkeliamo failo dydis viršija MAX_FILE_SIZE parametrą, kuris yra nustatytas HTML formoje",
+"The uploaded file was only partially uploaded" => "Failas buvo įkeltas tik dalinai",
+"No file was uploaded" => "Nebuvo įkeltas nė vienas failas",
+"Missing a temporary folder" => "Nėra laikinojo katalogo",
+"Files" => "Failai",
+"Maximum upload size" => "Maksimalus failo dydis",
+"Upload" => "Įkelti",
+"Nothing in here. Upload something!" => "Čia tuščia. Įkelkite ką nors!",
+"Name" => "Pavadinimas",
+"Download" => "Atsisiųsti",
+"Size" => "Dydis",
+"Modified" => "Pakeista",
+"Delete" => "Ištrinti",
+"Upload too large" => "Įkėlimui failas per didelis",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Bandomų įkelti failų dydis viršija maksimalų leidžiamą šiame serveryje"
+);
diff --git a/apps/files/l10n/ms_MY.php b/apps/files/l10n/ms_MY.php
new file mode 100644
index 00000000000..038ffd521a0
--- /dev/null
+++ b/apps/files/l10n/ms_MY.php
@@ -0,0 +1,13 @@
+<?php $TRANSLATIONS = array(
+"Files" => "fail",
+"Maximum upload size" => "Saiz maksimum muat naik",
+"Upload" => "Muat naik",
+"Nothing in here. Upload something!" => "Tiada apa-apa di sini. Muat naik sesuatu!",
+"Name" => "Nama ",
+"Download" => "Muat turun",
+"Size" => "Saiz",
+"Modified" => "Dimodifikasi",
+"Delete" => "Padam",
+"Upload too large" => "Muat naik terlalu besar",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Fail yang cuba dimuat naik melebihi saiz maksimum fail upload server"
+);
diff --git a/apps/files/l10n/nb_NO.php b/apps/files/l10n/nb_NO.php
new file mode 100644
index 00000000000..c4ef4989a58
--- /dev/null
+++ b/apps/files/l10n/nb_NO.php
@@ -0,0 +1,13 @@
+<?php $TRANSLATIONS = array(
+"Files" => "Filer",
+"Maximum upload size" => "Maksimum opplastingsstørrelse",
+"Upload" => "Last opp",
+"Nothing in here. Upload something!" => "Ingenting her. Last opp noe!",
+"Name" => "Navn",
+"Download" => "Last ned",
+"Size" => "Størrelse",
+"Modified" => "Endret",
+"Delete" => "Slett",
+"Upload too large" => "Opplasting for stor",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filene du prøver å laste opp er for store for å laste opp til denne serveren."
+);
diff --git a/apps/files/l10n/nl.php b/apps/files/l10n/nl.php
new file mode 100644
index 00000000000..36b4695a476
--- /dev/null
+++ b/apps/files/l10n/nl.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Geen fout opgetreden, bestand successvol geupload.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Het geüploade bestand is groter dan de upload_max_filesize instelling in php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Het geüploade bestand is groter dan de MAX_FILE_SIZE richtlijn die is opgegeven in de HTML-formulier",
+"The uploaded file was only partially uploaded" => "Het bestand is slechts gedeeltelijk geupload",
+"No file was uploaded" => "Geen bestand geüpload",
+"Missing a temporary folder" => "Een tijdelijke map mist",
+"Files" => "Bestanden",
+"Maximum upload size" => "Maximale bestandsgrootte voor uploads",
+"New" => "Nieuw",
+"Text file" => "Tekstbestand",
+"Folder" => "Map",
+"From the web" => "Van het internet",
+"Upload" => "Upload",
+"Nothing in here. Upload something!" => "Er bevindt zich hier niets. Upload een bestand!",
+"Name" => "Naam",
+"Download" => "Download",
+"Size" => "Bestandsgrootte",
+"Modified" => "Laatst aangepast",
+"Delete" => "Verwijder",
+"Upload too large" => "Bestanden te groot",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "De bestanden die u probeert te uploaden zijn groter dan de maximaal toegestane bestandsgrootte voor deze server."
+);
diff --git a/apps/files/l10n/nn_NO.php b/apps/files/l10n/nn_NO.php
new file mode 100644
index 00000000000..34f2f6be960
--- /dev/null
+++ b/apps/files/l10n/nn_NO.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Ingen feil, fila vart lasta opp",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Den opplasta fila er større enn variabelen upload_max_filesize i php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Den opplasta fila er større enn variabelen MAX_FILE_SIZE i HTML-skjemaet",
+"The uploaded file was only partially uploaded" => "Fila vart berre delvis lasta opp",
+"No file was uploaded" => "Ingen filer vart lasta opp",
+"Missing a temporary folder" => "Manglar ei mellombels mappe",
+"Files" => "Filer",
+"Maximum upload size" => "Maksimal opplastingsstorleik",
+"Upload" => "Last opp",
+"Nothing in here. Upload something!" => "Ingenting her. Last noko opp!",
+"Name" => "Namn",
+"Download" => "Last ned",
+"Size" => "Storleik",
+"Modified" => "Endra",
+"Delete" => "Slett",
+"Upload too large" => "For stor opplasting",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filene du prøver å laste opp er større enn maksgrensa til denne tenaren."
+);
diff --git a/apps/files/l10n/pl.php b/apps/files/l10n/pl.php
new file mode 100644
index 00000000000..d110f52ab1d
--- /dev/null
+++ b/apps/files/l10n/pl.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Brak błędu, plik przesłany z sukcesem",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Przesłany plik przekracza ustawienie upload_max_filesize w pliku php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Przesłany plik przekracza MAX_FILE_SIZE ustawienia, które zostało określono w formularzu HTML",
+"The uploaded file was only partially uploaded" => "Plik został przesłany tylko częściowo.",
+"No file was uploaded" => "Żaden plik nie został przesłany",
+"Missing a temporary folder" => "Brakuje folderu tymczasowego",
+"Files" => "Pliki",
+"Maximum upload size" => "Maksymalna wielkość przesyłanego pliku",
+"New" => "Nowy",
+"Text file" => "Plik tekstowy",
+"Folder" => "Katalog",
+"From the web" => "Z Internetu",
+"Upload" => "Prześlij",
+"Nothing in here. Upload something!" => "Nic tu nie ma. Prześlij jakieś pliki!",
+"Name" => "Nazwa",
+"Download" => "Ściąganie",
+"Size" => "Wielkość",
+"Modified" => "Zmodyfikowano",
+"Delete" => "Skasuj",
+"Upload too large" => "Przesyłany plik jest za duży",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Pliki które próbujesz przesłać, przekraczają maksymalną, dopuszczalną wielkość."
+);
diff --git a/apps/files/l10n/pt_BR.php b/apps/files/l10n/pt_BR.php
new file mode 100644
index 00000000000..57b1af2ae6d
--- /dev/null
+++ b/apps/files/l10n/pt_BR.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Não houve nenhum erro, o arquivo foi transferido com sucesso",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "O tamanho do arquivo excede o limed especifiicado em upload_max_filesize no php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "O arquivo carregado excede o MAX_FILE_SIZE que foi especificado no formulário HTML",
+"The uploaded file was only partially uploaded" => "O arquivo foi transferido parcialmente",
+"No file was uploaded" => "Nenhum arquivo foi transferido",
+"Missing a temporary folder" => "Pasta temporária não encontrada",
+"Files" => "Arquivos",
+"Maximum upload size" => "Tamanho máximo para carregar",
+"Upload" => "Carregar",
+"Nothing in here. Upload something!" => "Nada aqui.Carregar alguma coisa!",
+"Name" => "Nome",
+"Download" => "Baixar",
+"Size" => "Tamanho",
+"Modified" => "Modificado",
+"Delete" => "Excluir",
+"Upload too large" => "Arquivo muito grande",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Os arquivos que você está tentando carregar excedeu o tamanho máximo para arquivos no servidor."
+);
diff --git a/apps/files/l10n/ro.php b/apps/files/l10n/ro.php
new file mode 100644
index 00000000000..9d8d6e2d5df
--- /dev/null
+++ b/apps/files/l10n/ro.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Nu am întâmpinat nici eroare, fișierul a fost încărcat cu success",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Fișierul are o dimensiune mai mare decât cea specificată în variabila upload_max_filesize din php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Fișierul are o dimensiune mai mare decât variabile MAX_FILE_SIZE specificată în formularul HTML",
+"The uploaded file was only partially uploaded" => "Fișierul a fost încărcat doar parțial",
+"No file was uploaded" => "Nu a fost încărcat nici un fișier",
+"Missing a temporary folder" => "Lipsă folder temporar",
+"Files" => "Fișiere",
+"Maximum upload size" => "Dimensiunea maximă",
+"New" => "Nou",
+"Text file" => "Fișier text",
+"Folder" => "Dosar",
+"From the web" => "De pe internet",
+"Upload" => "Încarcă",
+"Nothing in here. Upload something!" => "Nici un fișier, încarcă ceva!",
+"Name" => "Nume",
+"Download" => "Descarcă",
+"Size" => "Dimensiune",
+"Modified" => "Modificat",
+"Delete" => "Șterge",
+"Upload too large" => "Fișierul este prea mare",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "A fost depășită limita maximă pentru încărcare."
+);
diff --git a/apps/files/l10n/ru.php b/apps/files/l10n/ru.php
new file mode 100644
index 00000000000..88a6d8ee19c
--- /dev/null
+++ b/apps/files/l10n/ru.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Файл успешно загружен",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Файл превышает допустимые размеры (описаны как upload_max_filesize в php.ini)",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Файл превышает размер MAX_FILE_SIZE, указаный в HTML-форме",
+"The uploaded file was only partially uploaded" => "Файл был частично загружен",
+"No file was uploaded" => "Файл не был загружен",
+"Missing a temporary folder" => "Невозможно найти временную директорию",
+"Files" => "Файлы",
+"Maximum upload size" => "Максимальный размер файла",
+"New" => "Новый",
+"Text file" => "Текстовый файл",
+"Folder" => "Папка",
+"From the web" => "Из интернета",
+"Upload" => "Закачать",
+"Nothing in here. Upload something!" => "Здесь ничего нет. Закачайте что-нибудь!",
+"Name" => "Название",
+"Download" => "Скачать",
+"Size" => "Размер",
+"Modified" => "Изменен",
+"Delete" => "Удалить",
+"Upload too large" => "Файл слишком большой",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Файлы, которые Вы пытаетесь закачать, превышают лимит для файлов на этом сервере."
+);
diff --git a/apps/files/l10n/sk_SK.php b/apps/files/l10n/sk_SK.php
new file mode 100644
index 00000000000..0d91ae35a51
--- /dev/null
+++ b/apps/files/l10n/sk_SK.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Nenastala žiadna chyba, súbor bol úspešne nahraný",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Nahraný súbor presiahol direktívu upload_max_filesize v php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Nahrávaný súbor presiahol MAX_FILE_SIZE direktívu, ktorá bola špecifikovaná v HTML formulári",
+"The uploaded file was only partially uploaded" => "Nahrávaný súbor bol iba čiastočne nahraný",
+"No file was uploaded" => "Žiaden súbor nebol nahraný",
+"Missing a temporary folder" => "Chýbajúci dočasný priečinok",
+"Files" => "Súbory",
+"Maximum upload size" => "Maximálna veľkosť nahratia",
+"New" => "Nový",
+"Text file" => "Textový súbor",
+"Folder" => "Priečinok",
+"From the web" => "Z webu",
+"Upload" => "Nahrať",
+"Nothing in here. Upload something!" => "Nič tu nie je. Nahrakte niečo!",
+"Name" => "Meno",
+"Download" => "Stiahnuť",
+"Size" => "Veľkosť",
+"Modified" => "Upravené",
+"Delete" => "Odstrániť",
+"Upload too large" => "Nahrávanie príliš veľké",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Súbory ktoré sa snažíte nahrať presahujú maximálnu veľkosť pre nahratie súborov na tento server."
+);
diff --git a/apps/files/l10n/sl.php b/apps/files/l10n/sl.php
new file mode 100644
index 00000000000..5a09e0fe20b
--- /dev/null
+++ b/apps/files/l10n/sl.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "datoteka je bila naložena uspešno.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Velikost željene naložene datoteke je prevelika. (upload_max_filesize - php.ini) Kontaktirajte Administratorja.",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Velikost željene naložene datoteke je prevelika. (MAX_FILE_SIZE - html formi) Kontaktirajte Administratorja.",
+"The uploaded file was only partially uploaded" => "Datoteka je bila le delno naložena.",
+"No file was uploaded" => "Naloženih ni bilo nič Datotek.",
+"Missing a temporary folder" => "Ni potrebne začasne datoteke. (temporary folder)",
+"Files" => "Datoteke",
+"Maximum upload size" => "Maksimalna velikost",
+"Upload" => "Naloži gor",
+"Nothing in here. Upload something!" => "Naloženih še ni bilo nič datotek.",
+"Name" => "Ime",
+"Download" => "Naloži dol",
+"Size" => "Velikost",
+"Modified" => "Urejeno",
+"Delete" => "Izbriši",
+"Upload too large" => "Nalaganje ni mogoče, ker je preveliko.",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Datoteke ki jih želiš naložiti presegajo maksimalno velikost na tem strežniku. Kontaktirajte Administratorja."
+);
diff --git a/apps/files/l10n/sr.php b/apps/files/l10n/sr.php
new file mode 100644
index 00000000000..7e2ac3b1366
--- /dev/null
+++ b/apps/files/l10n/sr.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Нема грешке, фајл је успешно послат",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Послати фајл превазилази директиву upload_max_filesize из ",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Послати фајл превазилази директиву MAX_FILE_SIZE која је наведена у ХТМЛ форми",
+"The uploaded file was only partially uploaded" => "Послати фајл је само делимично отпремљен!",
+"No file was uploaded" => "Ниједан фајл није послат",
+"Missing a temporary folder" => "Недостаје привремена фасцикла",
+"Files" => "Фајлови",
+"Maximum upload size" => "Максимална величина пошиљке",
+"New" => "Нови",
+"Text file" => "текстуални фајл",
+"Folder" => "фасцикла",
+"From the web" => "са веба",
+"Upload" => "Пошаљи",
+"Nothing in here. Upload something!" => "Овде нема ничег. Пошаљите нешто!",
+"Name" => "Име",
+"Download" => "Преузми",
+"Size" => "Величина",
+"Modified" => "Задња измена",
+"Delete" => "Обриши",
+"Upload too large" => "Пошиљка је превелика",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Фајлови које желите да пошаљете превазилазе ограничење максималне величине пошиљке на овом серверу."
+);
diff --git a/apps/files/l10n/sr@latin.php b/apps/files/l10n/sr@latin.php
new file mode 100644
index 00000000000..1b5addbc571
--- /dev/null
+++ b/apps/files/l10n/sr@latin.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Nema greške, fajl je uspešno poslat",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Poslati fajl prevazilazi direktivu upload_max_filesize iz ",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Poslati fajl prevazilazi direktivu MAX_FILE_SIZE koja je navedena u HTML formi",
+"The uploaded file was only partially uploaded" => "Poslati fajl je samo delimično otpremljen!",
+"No file was uploaded" => "Nijedan fajl nije poslat",
+"Missing a temporary folder" => "Nedostaje privremena fascikla",
+"Files" => "Fajlovi",
+"Maximum upload size" => "Maksimalna veličina pošiljke",
+"Upload" => "Pošalji",
+"Nothing in here. Upload something!" => "Ovde nema ničeg. Pošaljite nešto!",
+"Name" => "Ime",
+"Download" => "Preuzmi",
+"Size" => "Veličina",
+"Modified" => "Zadnja izmena",
+"Delete" => "Obriši",
+"Upload too large" => "Pošiljka je prevelika",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Fajlovi koje želite da pošaljete prevazilaze ograničenje maksimalne veličine pošiljke na ovom serveru."
+);
diff --git a/apps/files/l10n/sv.php b/apps/files/l10n/sv.php
new file mode 100644
index 00000000000..dfd32f3f5c2
--- /dev/null
+++ b/apps/files/l10n/sv.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Inga fel uppstod. Filen laddades upp utan problem",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Den uppladdade filen överskrider upload_max_filesize direktivet i php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Den uppladdade filen överstiger MAX_FILE_SIZE direktivet som anges i HTML-formulär",
+"The uploaded file was only partially uploaded" => "Den uppladdade filen var endast delvist uppladdad",
+"No file was uploaded" => "Ingen fil blev uppladdad",
+"Missing a temporary folder" => "Saknar en tillfällig mapp",
+"Files" => "Filer",
+"Maximum upload size" => "Maximal storlek att lägga upp",
+"Upload" => "Ladda upp",
+"Nothing in here. Upload something!" => "Ingenting här. Ladda upp något!",
+"Name" => "Namn",
+"Download" => "Ladda ned",
+"Size" => "Storlek",
+"Modified" => "Ändrad",
+"Delete" => "Ta bort",
+"Upload too large" => "För stor uppladdning",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Filerna du försöker ladda upp överstiger den maximala storleken för filöverföringar på servern."
+);
diff --git a/apps/files/l10n/th_TH.php b/apps/files/l10n/th_TH.php
new file mode 100644
index 00000000000..e7e2fb94b1e
--- /dev/null
+++ b/apps/files/l10n/th_TH.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "ไม่มีข้อผิดพลาดใดๆ ไฟล์ถูกอัพโหลดเรียบร้อยแล้ว",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "ไฟล์ที่อัพโหลดมีขนาดเกินคำสั่ง upload_max_filesize ที่ระบุเอาไว้ในไฟล์ php.ini",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "ไฟล์ที่อัพโหลดมีขนาดเกินคำสั่ง MAX_FILE_SIZE ที่ระบุเอาไว้ในรูปแบบคำสั่งในภาษา HTML",
+"The uploaded file was only partially uploaded" => "ไฟล์ที่อัพโหลดยังไม่ได้ถูกอัพโหลดอย่างสมบูรณ์",
+"No file was uploaded" => "ยังไม่มีไฟล์ที่ถูกอัพโหลด",
+"Missing a temporary folder" => "แฟ้มเอกสารชั่วคราวเกิดการสูญหาย",
+"Files" => "ไฟล์",
+"Maximum upload size" => "ขนาดไฟล์สูงสุดที่อัพโหลดได้",
+"New" => "อัพโหลดไฟล์ใหม่",
+"Text file" => "ไฟล์ข้อความ",
+"Folder" => "แฟ้มเอกสาร",
+"From the web" => "จากเวป",
+"Upload" => "อัพโหลด",
+"Nothing in here. Upload something!" => "ยังไม่มีไฟล์ใดๆอยู่ที่นี่ กรุณาอัพโหลดไฟล์!",
+"Name" => "ชื่อ",
+"Download" => "ดาวน์โหลด",
+"Size" => "ขนาด",
+"Modified" => "ปรับปรุงล่าสุด",
+"Delete" => "ลบ",
+"Upload too large" => "ไฟล์ที่อัพโหลดมีขนาดใหญ่เกินไป",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "ไฟล์ที่คุณพยายามที่จะอัพโหลดมีขนาดเกินกว่าขนาดสูงสุดที่กำหนดไว้ให้อัพโหลดได้สำหรับเซิร์ฟเวอร์นี้"
+);
diff --git a/apps/files/l10n/tr.php b/apps/files/l10n/tr.php
new file mode 100644
index 00000000000..5fc46056175
--- /dev/null
+++ b/apps/files/l10n/tr.php
@@ -0,0 +1,19 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "Bir hata yok, dosya başarıyla yüklendi",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "Yüklenen dosya php.ini de belirtilen upload_max_filesize sınırını aşıyor",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Yüklenen dosya HTML formundaki MAX_FILE_SIZE sınırını aşıyor",
+"The uploaded file was only partially uploaded" => "Yüklenen dosyanın sadece bir kısmı yüklendi",
+"No file was uploaded" => "Hiç dosya yüklenmedi",
+"Missing a temporary folder" => "Geçici bir klasör eksik",
+"Files" => "Dosyalar",
+"Maximum upload size" => "Maksimum yükleme boyutu",
+"Upload" => "Yükle",
+"Nothing in here. Upload something!" => "Burada hiçbir şey yok. Birşeyler yükleyin!",
+"Name" => "Ad",
+"Download" => "İndir",
+"Size" => "Boyut",
+"Modified" => "Değiştirilme",
+"Delete" => "Sil",
+"Upload too large" => "Yüklemeniz çok büyük",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Yüklemeye çalıştığınız dosyalar bu sunucudaki maksimum yükleme boyutunu aşıyor."
+);
diff --git a/apps/files/l10n/xgettextfiles b/apps/files/l10n/xgettextfiles
new file mode 100644
index 00000000000..9e22680e455
--- /dev/null
+++ b/apps/files/l10n/xgettextfiles
@@ -0,0 +1,5 @@
+../appinfo/app.php
+../templates/index.php
+../templates/part.list.php
+../js/filelist.js
+../js/files.js
diff --git a/apps/files/l10n/zh_CN.php b/apps/files/l10n/zh_CN.php
new file mode 100644
index 00000000000..ab23a55d29e
--- /dev/null
+++ b/apps/files/l10n/zh_CN.php
@@ -0,0 +1,23 @@
+<?php $TRANSLATIONS = array(
+"There is no error, the file uploaded with success" => "没有发生错误,文件上传成功。",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini" => "上传的文件大小超过了php.ini 中指定的upload_max_filesize",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "上传的文件超过了在HTML 表单中指定的MAX_FILE_SIZE",
+"The uploaded file was only partially uploaded" => "只上传了文件的一部分",
+"No file was uploaded" => "文件没有上传",
+"Missing a temporary folder" => "缺少临时目录",
+"Files" => "文件",
+"Maximum upload size" => "最大上传大小",
+"New" => "新建",
+"Text file" => "文本文件",
+"Folder" => "文件夹",
+"From the web" => "来自网络",
+"Upload" => "上传",
+"Nothing in here. Upload something!" => "这里还什么都没有。上传些东西吧!",
+"Name" => "名称",
+"Download" => "下载",
+"Size" => "大小",
+"Modified" => "修改日期",
+"Delete" => "删除",
+"Upload too large" => "上传文件过大",
+"The files you are trying to upload exceed the maximum size for file uploads on this server." => "您正尝试上传的文件超过了此服务器可以上传的最大大小"
+);
diff --git a/apps/files/settings.php b/apps/files/settings.php
new file mode 100644
index 00000000000..41017c064ef
--- /dev/null
+++ b/apps/files/settings.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+// Init owncloud
+
+
+// Check if we are a user
+OC_Util::checkLoggedIn();
+
+// Load the files we need
+OC_Util::addStyle( "files", "files" );
+OC_Util::addScript( "files", "files" );
+
+// Load the files
+$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+
+$files = array();
+foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
+ $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] );
+ $files[] = $i;
+}
+
+// Make breadcrumb
+$breadcrumb = array();
+$pathtohere = "/";
+foreach( explode( "/", $dir ) as $i ){
+ if( $i != "" ){
+ $pathtohere .= "$i/";
+ $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
+ }
+}
+
+// return template
+$tmpl = new OC_Template( "files", "index", "user" );
+$tmpl->assign( 'files', $files );
+$tmpl->assign( "breadcrumb", $breadcrumb );
+$tmpl->printPage();
+
+?>
diff --git a/apps/files/templates/admin.php b/apps/files/templates/admin.php
new file mode 100644
index 00000000000..01fe1105260
--- /dev/null
+++ b/apps/files/templates/admin.php
@@ -0,0 +1,19 @@
+<?php OC_Util::addScript('files','admin'); ?>
+
+<form name="filesForm" action='#' method='post'>
+ <fieldset class="personalblock">
+ <legend><strong><?php echo $l->t('File handling');?></strong></legend>
+ <?php if($_['htaccessWorking']):?>
+ <label for="maxUploadSize"><?php echo $l->t( 'Maximum upload size' ); ?> </label><input name='maxUploadSize' id="maxUploadSize" value='<?php echo $_['uploadMaxFilesize'] ?>'/>(<?php echo $l->t('max. possible: '); echo $_['maxPossibleUploadSize'] ?>)<br/>
+ <?php endif;?>
+ <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1" title="<?php echo $l->t( 'Needed for multi-file and folder downloads.' ); ?>"<?php if ($_['allowZipDownload']) echo ' checked="checked"'; ?> /> <label for="allowZipDownload"><?php echo $l->t( 'Enable ZIP-download' ); ?></label> <br/>
+
+ <input name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php echo $_['maxZipInputSize'] ?>' title="<?php echo $l->t( '0 is unlimited' ); ?>"<?php if (!$_['allowZipDownload']) echo ' disabled="disabled"'; ?> />
+ <label for="maxZipInputSize"><?php echo $l->t( 'Maximum input size for ZIP files' ); ?> </label><br />
+
+ <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" value="Save"/>
+ </fieldset>
+</form>
+
+
+
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
new file mode 100644
index 00000000000..fc385e1ed3a
--- /dev/null
+++ b/apps/files/templates/index.php
@@ -0,0 +1,79 @@
+<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}table td{position:static !important;}</style><![endif]-->
+<div id="controls">
+ <?php echo($_['breadcrumb']); ?>
+ <?php if (!isset($_['readonly']) || !$_['readonly']):?>
+ <div class="actions <?php if (isset($_['files']) and ! $_['readonly'] and count($_['files'])==0):?>emptyfolder<?php endif; ?>">
+ <div id='new' class='button'>
+ <a><?php echo $l->t('New');?></a>
+ <ul class="popup popupTop">
+ <li style="background-image:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li>
+ <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
+ <li style="background-image:url('<?php echo image_path('core','actions/public.png') ?>')" data-type='web'><p><?php echo $l->t('From url');?></p></li>
+ </ul>
+ </div>
+ <div class="file_upload_wrapper svg">
+ <form data-upload-id='1' class="file_upload_form" action="<?php echo OC_Helper::linkto('files', 'ajax/upload.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target_1">
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
+ <input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
+ <input type="hidden" name="dir" value="<?php echo htmlentities($_['dir']) ?>" id="dir">
+ <button class="file_upload_filename">&nbsp;<img class='svg action' alt="Upload" src="<?php echo image_path("core", "actions/upload.svg"); ?>" /></button>
+ <input class="file_upload_start" type="file" name='files[]'/>
+ <a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
+ <iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
+ </form>
+ </div>
+ <div id="upload">
+ <div id="uploadprogressbar"></div>
+ <input type="button" class="stop" style="display:none" value="<?php echo $l->t('Cancel upload');?>" onclick="javascript:Files.cancelUploads();" />
+ </div>
+
+ </div>
+ <div id="file_action_panel"></div>
+ <?php else:?>
+ <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
+ <?php endif;?>
+</div>
+<div id='notification'></div>
+
+<?php if (isset($_['files']) and ! $_['readonly'] and count($_['files'])==0):?>
+ <div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div>
+<?php endif; ?>
+
+<table>
+ <thead>
+ <tr>
+ <th id='headerName'>
+ <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" id="select_all" /><?php } ?>
+ <span class='name'><?php echo $l->t( 'Name' ); ?></span>
+ <span class='selectedActions'>
+ <a href="" class="share"><img class='svg' alt="Share" src="<?php echo image_path("core", "actions/share.svg"); ?>" /> <?php echo $l->t('Share')?></a>
+ <?php if($_['allowZipDownload']) : ?>
+ <a href="" class="download"><img class='svg' alt="Download" src="<?php echo image_path("core", "actions/download.svg"); ?>" /> <?php echo $l->t('Download')?></a>
+ <?php endif; ?>
+ </span>
+ </th>
+ <th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
+ <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete all')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th>
+ </tr>
+ </thead>
+ <tbody id="fileList" data-readonly="<?php echo $_['readonly'];?>">
+ <?php echo($_['fileList']); ?>
+ </tbody>
+</table>
+<div id="editor"></div>
+<div id="uploadsize-message" title="<?php echo $l->t('Upload too large')?>">
+ <p>
+ <?php echo $l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?>
+ </p>
+</div>
+<div id="scanning-message">
+ <h3>
+ <?php echo $l->t('Files are being scanned, please wait.');?> <span id='scan-count'></span>
+ </h3>
+ <p>
+ <?php echo $l->t('Current scanning');?> <span id='scan-current'></span>
+ </p>
+</div>
+
+<!-- config hints for javascript -->
+<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php echo $_['allowZipDownload']; ?>" />
diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php
new file mode 100644
index 00000000000..16da6bb97b4
--- /dev/null
+++ b/apps/files/templates/part.breadcrumb.php
@@ -0,0 +1,6 @@
+ <?php for($i=0; $i<count($_["breadcrumb"]); $i++):
+ $crumb = $_["breadcrumb"][$i]; ?>
+ <div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo $crumb["dir"];?>' style='background-image:url("<?php echo image_path('core','breadcrumb.png');?>")'>
+ <a href="<?php echo $_['baseURL'].$crumb["dir"]; ?>"><?php echo htmlentities($crumb["name"]); ?></a>
+ </div>
+ <?php endfor;?> \ No newline at end of file
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
new file mode 100644
index 00000000000..b2db4cbb8df
--- /dev/null
+++ b/apps/files/templates/part.list.php
@@ -0,0 +1,33 @@
+ <?php foreach($_['files'] as $file):
+ $write = ($file['writable']) ? 'true' : 'false';
+ $simple_file_size = simple_file_size($file['size']);
+ $simple_size_color = intval(200-$file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey; megabytes*2
+ if($simple_size_color<0) $simple_size_color = 0;
+ $relative_modified_date = relative_modified_date($file['mtime']);
+ $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
+ if($relative_date_color>200) $relative_date_color = 200;
+ $name = str_replace('+','%20',urlencode($file['name']));
+ $name = str_replace('%2F','/', $name);
+ $directory = str_replace('+','%20',urlencode($file['directory']));
+ $directory = str_replace('%2F','/', $directory); ?>
+ <tr data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-write='<?php echo $write;?>'>
+ <td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mimetype']); ?>)">
+ <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
+ <a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$directory.'/'.$name; else echo $_['downloadURL'].$directory.'/'.$name; ?>" title="">
+ <span class="nametext">
+ <?php if($file['type'] == 'dir'):?>
+ <?php echo htmlspecialchars($file['name']);?>
+ <?php else:?>
+ <?php echo htmlspecialchars($file['basename']);?><span class='extension'><?php echo $file['extension'];?></span>
+ <?php endif;?>
+ </span>
+ <?php if($file['type'] == 'dir'):?>
+ <span class="uploadtext" currentUploads="0">
+ </span>
+ <?php endif;?>
+ </a>
+ </td>
+ <td class="filesize" title="<?php echo human_file_size($file['size']); ?>" style="color:rgb(<?php echo $simple_size_color.','.$simple_size_color.','.$simple_size_color ?>)"><?php echo $simple_file_size; ?></td>
+ <td class="date"><span class="modified" title="<?php echo $file['date']; ?>" style="color:rgb(<?php echo $relative_date_color.','.$relative_date_color.','.$relative_date_color ?>)"><?php echo $relative_modified_date; ?></span></td>
+ </tr>
+ <?php endforeach; ?>
diff --git a/apps/files/webdav.php b/apps/files/webdav.php
new file mode 100644
index 00000000000..940bbfef52e
--- /dev/null
+++ b/apps/files/webdav.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @author Jakob Sack
+ * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ * @copyright 2011 Jakob Sack kde@jakobsack.de
+ *
+ * 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/>.
+ *
+ */
+
+// Do not load FS ...
+$RUNTIME_NOSETUPFS = true;
+require_once('../inc.php');
+
+// only need filesystem apps
+$RUNTIME_APPTYPES=array('filesystem','authentication');
+
+
+
+// Backends
+$authBackend = new OC_Connector_Sabre_Auth();
+$lockBackend = new OC_Connector_Sabre_Locks();
+
+// Create ownCloud Dir
+$publicDir = new OC_Connector_Sabre_Directory('');
+
+// Fire up server
+$server = new Sabre_DAV_Server($publicDir);
+$server->setBaseUri(OC::$APPSWEBROOT.'/apps/files/webdav.php');
+
+// Load plugins
+$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
+$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
+$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
+
+// And off we go!
+$server->exec();
diff --git a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
index 1dfd9b95d35..5fdf7af14cb 100644
--- a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
+++ b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
@@ -35,7 +35,7 @@
left: 0;
width: 40px;
height: 480px;
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
}
#fancybox-overlay {
@@ -99,7 +99,7 @@
right: -15px;
width: 30px;
height: 30px;
- background: transparent url('../img/fancybox.png') -40px 0px;
+ background: transparent url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -40px 0px;
cursor: pointer;
z-index: 1103;
display: none;
@@ -137,7 +137,7 @@
width: 35%;
cursor: pointer;
outline: none;
- background: transparent url('../img/blank.gif');
+ background: transparent url('%appswebroot%/apps/files_imageviewer/img/blank.gif');
z-index: 1102;
display: none;
}
@@ -163,12 +163,12 @@
}
#fancybox-left-ico {
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -30px;
}
#fancybox-right-ico {
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -60px;
}
@@ -199,13 +199,13 @@
top: -20px;
left: 0;
width: 100%;
- background-image: url('../img/fancybox-x.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png');
}
#fancybox-bg-ne {
top: -20px;
right: -20px;
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -162px;
}
@@ -213,14 +213,14 @@
top: 0;
right: -20px;
height: 100%;
- background-image: url('../img/fancybox-y.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-y.png');
background-position: -20px 0px;
}
#fancybox-bg-se {
bottom: -20px;
right: -20px;
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -182px;
}
@@ -228,14 +228,14 @@
bottom: -20px;
left: 0;
width: 100%;
- background-image: url('../img/fancybox-x.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png');
background-position: 0px -20px;
}
#fancybox-bg-sw {
bottom: -20px;
left: -20px;
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -142px;
}
@@ -243,13 +243,13 @@
top: 0;
left: -20px;
height: 100%;
- background-image: url('../img/fancybox-y.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-y.png');
}
#fancybox-bg-nw {
top: -20px;
left: -20px;
- background-image: url('../img/fancybox.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
background-position: -40px -122px;
}
@@ -282,7 +282,7 @@
#fancybox-title-over {
padding: 10px;
- background-image: url('../img/fancy_title_over.png');
+ background-image: url('%appswebroot%/apps/files_imageviewer/img/fancy_title_over.png');
display: block;
}
@@ -306,7 +306,7 @@
#fancybox-title-float-left {
padding: 0 0 0 15px;
- background: url('../img/fancybox.png') -40px -90px no-repeat;
+ background: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -40px -90px no-repeat;
}
#fancybox-title-float-main {
@@ -314,25 +314,25 @@
line-height: 29px;
font-weight: bold;
padding: 0 0 3px 0;
- background: url('../img/fancybox-x.png') 0px -40px;
+ background: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png') 0px -40px;
}
#fancybox-title-float-right {
padding: 0 0 0 15px;
- background: url('../img/fancybox.png') -55px -90px no-repeat;
+ background: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -55px -90px no-repeat;
}
/* IE6 */
-.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_close.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_close.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_nav_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_nav_right.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_nav_left.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_nav_right.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
-.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_main.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_right.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
+.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_left.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_main.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_right.png', sizingMethod='scale'); }
.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
height: expression(this.parentNode.clientHeight + "px");
@@ -343,17 +343,17 @@
top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
}
-#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_loading.png', sizingMethod='scale'); }
+#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_loading.png', sizingMethod='scale'); }
/* IE6, IE7, IE8 */
.fancybox-ie .fancybox-bg { background: transparent !important; }
-.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_n.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_ne.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_e.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_se.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_s.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_sw.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_w.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_nw.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_n.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_ne.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_e.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_se.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_s.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_sw.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_w.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_nw.png', sizingMethod='scale'); }
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index ba01adffb9a..c838895efbe 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -1,7 +1,7 @@
<?php
//$RUNTIME_NOAPPS = true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkAppEnabled('files_sharing');
require_once('../lib_share.php');
diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php
index 200202c704c..d46f6f0c7b4 100644
--- a/apps/files_sharing/ajax/setpermissions.php
+++ b/apps/files_sharing/ajax/setpermissions.php
@@ -1,7 +1,7 @@
<?php
//$RUNTIME_NOAPPS = true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkAppEnabled('files_sharing');
require_once('../lib_share.php');
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index 9b10260da5a..cd9166913cb 100644
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -1,7 +1,7 @@
<?php
//$RUNTIME_NOAPPS = true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkAppEnabled('files_sharing');
require_once('../lib_share.php');
diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php
index d8a72a00efe..150d6504863 100644
--- a/apps/files_sharing/ajax/unshare.php
+++ b/apps/files_sharing/ajax/unshare.php
@@ -1,7 +1,7 @@
<?php
//$RUNTIME_NOAPPS = true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkAppEnabled('files_sharing');
require_once('../lib_share.php');
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 38b673ee51b..cc22a0cd1a7 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -1,7 +1,7 @@
<?php
//$RUNTIME_NOAPPS = true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php
index 721620dc922..a9006faf1a9 100644
--- a/apps/files_sharing/list.php
+++ b/apps/files_sharing/list.php
@@ -20,7 +20,7 @@
*
*/
-require_once('../../lib/base.php');
+
require_once('lib_share.php');
OC_Util::checkLoggedIn();
diff --git a/apps/files_texteditor/ajax/loadfile.php b/apps/files_texteditor/ajax/loadfile.php
index 8ece844aa29..a946e26f210 100644
--- a/apps/files_texteditor/ajax/loadfile.php
+++ b/apps/files_texteditor/ajax/loadfile.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
diff --git a/apps/files_texteditor/ajax/mtime.php b/apps/files_texteditor/ajax/mtime.php
index df90a68ca7a..436592c383f 100644
--- a/apps/files_texteditor/ajax/mtime.php
+++ b/apps/files_texteditor/ajax/mtime.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php
index 57a948478f5..9f67cc4b4e6 100644
--- a/apps/files_texteditor/ajax/savefile.php
+++ b/apps/files_texteditor/ajax/savefile.php
@@ -21,7 +21,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php
index 152f5834bcb..ca02c3ae209 100644
--- a/apps/gallery/ajax/createAlbum.php
+++ b/apps/gallery/ajax/createAlbum.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 1b3ad48f561..98cf71ec14f 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -22,7 +22,7 @@
*/
header('Content-type: text/html; charset=UTF-8') ;
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');
diff --git a/apps/gallery/ajax/sharing.php b/apps/gallery/ajax/sharing.php
index fba85fa34ee..ce56d652c60 100644
--- a/apps/gallery/ajax/sharing.php
+++ b/apps/gallery/ajax/sharing.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../../lib/base.php');
+
if (!isset($_GET['token']) || !isset($_GET['operation'])) {
OC_JSON::error(array('cause' => 'Not enought arguments'));
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php
index 184171f8fca..bf42fd2becb 100644
--- a/apps/gallery/ajax/thumbnail.php
+++ b/apps/gallery/ajax/thumbnail.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');
diff --git a/apps/gallery/css/sharing.css b/apps/gallery/css/sharing.css
index eaac82ebd60..d061fc3e6c1 100644
--- a/apps/gallery/css/sharing.css
+++ b/apps/gallery/css/sharing.css
@@ -5,4 +5,4 @@ div.gallery_box:hover { color: black; }
div.gallery_box h1 {font-size: 17px; font-weight: normal;}
div#breadcrumb { border: 0; width: 70%; margin: 0 auto; padding: 25px 0; font-family: Verdana; text-align: center;}
span.breadcrumbelement { margin: 10px; margin-right: 0; cursor: pointer;}
-span.inside { background-image: url('../img/breadcrumb.png'); padding-left: 20px; background-position: left; background-repeat: no-repeat;}
+span.inside { background-image: url('%appswebroot%/apps/gallery/img/breadcrumb.png'); padding-left: 20px; background-position: left; background-repeat: no-repeat;}
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index 7de7c094142..8c45cfb19fc 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -21,7 +21,7 @@
*
*/
-require_once('../../lib/base.php');
+
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('gallery');
diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php
index ef361a37913..efc545f0205 100644
--- a/apps/gallery/lib/album.php
+++ b/apps/gallery/lib/album.php
@@ -92,7 +92,7 @@ class OC_Gallery_Album {
}
public static function changeThumbnailPath($oldname, $newname) {
- require_once('../../../lib/base.php');
+
$thumbpath = OC::$CONFIG_DATADIRECTORY.'/../gallery/';
rename($thumbpath.$oldname.'.png', $thumbpath.$newname.'.png');
}
diff --git a/apps/gallery/lib/images_utils.php b/apps/gallery/lib/images_utils.php
index 126298913be..6f3959a342d 100644
--- a/apps/gallery/lib/images_utils.php
+++ b/apps/gallery/lib/images_utils.php
@@ -22,7 +22,7 @@
*/
if (file_exists('../../../lib/base.php'))
- require_once('../../../lib/base.php');
+
elseif (file_exists('lib/base.php'))
require_once('lib/base.php');
diff --git a/apps/gallery/sharing.php b/apps/gallery/sharing.php
index d7430becf43..2739f63d4e0 100644
--- a/apps/gallery/sharing.php
+++ b/apps/gallery/sharing.php
@@ -25,7 +25,7 @@ if (!isset($_GET['token']) || empty($_GET['token'])) {
exit;
}
-require_once('../../lib/base.php');
+
OC_Util::checkAppEnabled('gallery');
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index cf654b68c0b..43ba5131864 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -24,7 +24,7 @@ $l = OC_L10N::get('gallery');
</div>
</div>
<div id="g-album-loading" class="crumb" style="display:none">
- <img src="img/loading.gif">
+ <img src="<?php echo OC_Helper::linkto('gallery', 'img/loading.gif'); ?>">
</div>
</div>
<div id="gallery_list">
diff --git a/apps/inc.php b/apps/inc.php
new file mode 100644
index 00000000000..cbfab014173
--- /dev/null
+++ b/apps/inc.php
@@ -0,0 +1 @@
+<?php require_once('/Applications/MAMP/htdocs/owncloud/lib/base.php'); ?> \ No newline at end of file
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php
index 9d9c14deb17..9c7b3efce75 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -23,10 +23,9 @@
header('Content-type: text/html; charset=UTF-8') ;
-require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('media');
-require_once('../lib_collection.php');
-require_once('../lib_scanner.php');
+require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
+require_once(OC::$APPSROOT . '/apps/media/lib_scanner.php');
error_reporting(E_ALL); //no script error reporting because of getID3
@@ -127,5 +126,4 @@ if($arguments['action']){
exit;
}
}
-
-?>
+?> \ No newline at end of file
diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php
index a78b5e25dd1..ea7c5006e70 100644
--- a/apps/media/ajax/autoupdate.php
+++ b/apps/media/ajax/autoupdate.php
@@ -27,7 +27,7 @@ header('Content-type: text/html; charset=UTF-8') ;
$RUNTIME_NOAPPS=true;
$RUNTIME_NOSETUPFS=true;
-require_once('../../../lib/base.php');
+
OC_JSON::checkAppEnabled('media');
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
diff --git a/apps/media/index.php b/apps/media/index.php
index 419d4ae0bde..cdb347628bf 100644
--- a/apps/media/index.php
+++ b/apps/media/index.php
@@ -22,14 +22,14 @@
*/
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('media');
-require_once('lib_collection.php');
-require_once('lib_scanner.php');
+require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
+require_once(OC::$APPSROOT . '/apps/media/lib_scanner.php');
OC_Util::addScript('media','player');
OC_Util::addScript('media','music');
diff --git a/apps/media/server/xml.server.php b/apps/media/server/xml.server.php
index cb9b68fc422..deb189fbede 100644
--- a/apps/media/server/xml.server.php
+++ b/apps/media/server/xml.server.php
@@ -21,11 +21,11 @@
*
*/
+require_once('../../inc.php');
-require_once('../../../lib/base.php');
OC_Util::checkAppEnabled('media');
-require_once('../lib_collection.php');
-require_once('../lib_ampache.php');
+ require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
+ require_once(OC::$APPSROOT . '/apps/media/lib_ampache.php');
$arguments=$_POST;
if(!isset($_POST['action']) and isset($_GET['action'])){
diff --git a/apps/media/tomahawk.php b/apps/media/tomahawk.php
index 6dd41233f12..019e80b0f24 100644
--- a/apps/media/tomahawk.php
+++ b/apps/media/tomahawk.php
@@ -22,10 +22,10 @@
*/
$_POST=$_GET; //debug
+require_once('../inc.php');
-require_once('../../lib/base.php');
OC_JSON::checkAppEnabled('media');
-require_once('lib_collection.php');
+require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
$user=isset($_POST['user'])?$_POST['user']:'';
$pass=isset($_POST['pass'])?$_POST['pass']:'';
diff --git a/apps/remoteStorage/WebDAV.php b/apps/remoteStorage/WebDAV.php
index cad465181a9..3522d1ed683 100644
--- a/apps/remoteStorage/WebDAV.php
+++ b/apps/remoteStorage/WebDAV.php
@@ -29,7 +29,7 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
-require_once('../../lib/base.php');
+
OC_Util::checkAppEnabled('remoteStorage');
require_once('Sabre/autoload.php');
require_once('lib_remoteStorage.php');
diff --git a/apps/remoteStorage/ajax/revokeToken.php b/apps/remoteStorage/ajax/revokeToken.php
index ca56cf560ec..376fe29b3e7 100644
--- a/apps/remoteStorage/ajax/revokeToken.php
+++ b/apps/remoteStorage/ajax/revokeToken.php
@@ -29,7 +29,7 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
-require_once('../../../lib/base.php');
+
OC_Util::checkAppEnabled('remoteStorage');
require_once('Sabre/autoload.php');
require_once('../lib_remoteStorage.php');
diff --git a/apps/remoteStorage/auth.php b/apps/remoteStorage/auth.php
index 2be648642a1..69d7cfc3b93 100644
--- a/apps/remoteStorage/auth.php
+++ b/apps/remoteStorage/auth.php
@@ -29,7 +29,7 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
-require_once('../../lib/base.php');
+
OC_Util::checkAppEnabled('remoteStorage');
require_once('Sabre/autoload.php');
require_once('lib_remoteStorage.php');
diff --git a/apps/user_migrate/ajax/export.php b/apps/user_migrate/ajax/export.php
index 86745d6b162..99503cad142 100644
--- a/apps/user_migrate/ajax/export.php
+++ b/apps/user_migrate/ajax/export.php
@@ -21,7 +21,7 @@
*
*/
// Init owncloud
-require_once('../../../lib/base.php');
+
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
index 9ada473ca87..51686111bf7 100644
--- a/apps/user_webfinger/webfinger.php
+++ b/apps/user_webfinger/webfinger.php
@@ -25,7 +25,7 @@ $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
$WEBROOT=substr($SUBURI,0,-34);
*/
-require_once('../../lib/base.php');
+
$request = urldecode($_GET['q']);
if($_GET['q']) {
$reqParts = explode('@', $request);