summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/bookmarks/addBm.php2
-rw-r--r--apps/bookmarks/ajax/addBookmark.php2
-rw-r--r--apps/bookmarks/ajax/delBookmark.php2
-rw-r--r--apps/bookmarks/ajax/editBookmark.php2
-rw-r--r--apps/bookmarks/ajax/recordClick.php2
-rw-r--r--apps/bookmarks/ajax/updateList.php2
-rw-r--r--apps/bookmarks/index.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.php2
-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/import.php2
-rw-r--r--apps/calendar/index.php2
-rw-r--r--apps/calendar/resettimezone.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/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/photo.php2
-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.php (renamed from files/admin.php)2
-rw-r--r--apps/files/ajax/autocomplete.php (renamed from files/ajax/autocomplete.php)2
-rw-r--r--apps/files/ajax/delete.php (renamed from files/ajax/delete.php)2
-rw-r--r--apps/files/ajax/download.php (renamed from files/ajax/download.php)2
-rw-r--r--apps/files/ajax/list.php (renamed from files/ajax/list.php)2
-rw-r--r--apps/files/ajax/mimeicon.php (renamed from files/ajax/mimeicon.php)2
-rw-r--r--apps/files/ajax/move.php (renamed from files/ajax/move.php)2
-rw-r--r--apps/files/ajax/newfile.php (renamed from files/ajax/newfile.php)2
-rw-r--r--apps/files/ajax/newfolder.php (renamed from files/ajax/newfolder.php)2
-rw-r--r--apps/files/ajax/rawlist.php (renamed from files/ajax/rawlist.php)2
-rw-r--r--apps/files/ajax/rename.php (renamed from files/ajax/rename.php)2
-rw-r--r--apps/files/ajax/scan.php (renamed from files/ajax/scan.php)2
-rw-r--r--apps/files/ajax/timezone.php (renamed from files/ajax/timezone.php)0
-rw-r--r--apps/files/ajax/upload.php (renamed from files/ajax/upload.php)2
-rw-r--r--apps/files/appinfo/app.php (renamed from files/appinfo/app.php)0
-rw-r--r--apps/files/css/files.css (renamed from files/css/files.css)0
-rw-r--r--apps/files/download.php (renamed from files/download.php)2
-rw-r--r--apps/files/index.php (renamed from files/index.php)4
-rw-r--r--apps/files/js/admin.js (renamed from files/js/admin.js)0
-rw-r--r--apps/files/js/fileactions.js (renamed from files/js/fileactions.js)0
-rw-r--r--apps/files/js/filelist.js (renamed from files/js/filelist.js)0
-rw-r--r--apps/files/js/files.js (renamed from files/js/files.js)0
-rw-r--r--apps/files/js/timezone.js (renamed from files/js/timezone.js)0
-rw-r--r--apps/files/l10n/ar.php (renamed from files/l10n/ar.php)0
-rw-r--r--apps/files/l10n/bg_BG.php (renamed from files/l10n/bg_BG.php)0
-rw-r--r--apps/files/l10n/ca.php (renamed from files/l10n/ca.php)0
-rw-r--r--apps/files/l10n/cs_CZ.php (renamed from files/l10n/cs_CZ.php)0
-rw-r--r--apps/files/l10n/da.php (renamed from files/l10n/da.php)0
-rw-r--r--apps/files/l10n/de.php (renamed from files/l10n/de.php)0
-rw-r--r--apps/files/l10n/el.php (renamed from files/l10n/el.php)0
-rw-r--r--apps/files/l10n/eo.php (renamed from files/l10n/eo.php)0
-rw-r--r--apps/files/l10n/es.php (renamed from files/l10n/es.php)0
-rw-r--r--apps/files/l10n/et_EE.php (renamed from files/l10n/et_EE.php)0
-rw-r--r--apps/files/l10n/eu.php (renamed from files/l10n/eu.php)0
-rw-r--r--apps/files/l10n/fr.php (renamed from files/l10n/fr.php)0
-rw-r--r--apps/files/l10n/gl.php (renamed from files/l10n/gl.php)0
-rw-r--r--apps/files/l10n/he.php (renamed from files/l10n/he.php)0
-rw-r--r--apps/files/l10n/hr.php (renamed from files/l10n/hr.php)0
-rw-r--r--apps/files/l10n/hu_HU.php (renamed from files/l10n/hu_HU.php)0
-rw-r--r--apps/files/l10n/ia.php (renamed from files/l10n/ia.php)0
-rw-r--r--apps/files/l10n/id.php (renamed from files/l10n/id.php)0
-rw-r--r--apps/files/l10n/it.php (renamed from files/l10n/it.php)0
-rw-r--r--apps/files/l10n/ja_JP.php (renamed from files/l10n/ja_JP.php)0
-rw-r--r--apps/files/l10n/lb.php (renamed from files/l10n/lb.php)0
-rw-r--r--apps/files/l10n/lt_LT.php (renamed from files/l10n/lt_LT.php)0
-rw-r--r--apps/files/l10n/ms_MY.php (renamed from files/l10n/ms_MY.php)0
-rw-r--r--apps/files/l10n/nb_NO.php (renamed from files/l10n/nb_NO.php)0
-rw-r--r--apps/files/l10n/nl.php (renamed from files/l10n/nl.php)0
-rw-r--r--apps/files/l10n/nn_NO.php (renamed from files/l10n/nn_NO.php)0
-rw-r--r--apps/files/l10n/pl.php (renamed from files/l10n/pl.php)0
-rw-r--r--apps/files/l10n/pt_BR.php (renamed from files/l10n/pt_BR.php)0
-rw-r--r--apps/files/l10n/ro.php (renamed from files/l10n/ro.php)0
-rw-r--r--apps/files/l10n/ru.php (renamed from files/l10n/ru.php)0
-rw-r--r--apps/files/l10n/sk_SK.php (renamed from files/l10n/sk_SK.php)0
-rw-r--r--apps/files/l10n/sl.php (renamed from files/l10n/sl.php)0
-rw-r--r--apps/files/l10n/sr.php (renamed from files/l10n/sr.php)0
-rw-r--r--apps/files/l10n/sr@latin.php (renamed from files/l10n/sr@latin.php)0
-rw-r--r--apps/files/l10n/sv.php (renamed from files/l10n/sv.php)0
-rw-r--r--apps/files/l10n/th_TH.php (renamed from files/l10n/th_TH.php)0
-rw-r--r--apps/files/l10n/tr.php (renamed from files/l10n/tr.php)0
-rw-r--r--apps/files/l10n/xgettextfiles (renamed from files/l10n/xgettextfiles)0
-rw-r--r--apps/files/l10n/zh_CN.php (renamed from files/l10n/zh_CN.php)0
-rw-r--r--apps/files/settings.php (renamed from files/settings.php)2
-rw-r--r--apps/files/templates/admin.php (renamed from files/templates/admin.php)0
-rw-r--r--apps/files/templates/index.php (renamed from files/templates/index.php)0
-rw-r--r--apps/files/templates/part.breadcrumb.php (renamed from files/templates/part.breadcrumb.php)0
-rw-r--r--apps/files/templates/part.list.php (renamed from files/templates/part.list.php)0
-rw-r--r--apps/files/webdav.php (renamed from files/webdav.php)2
-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/files_versioning/ajax/gethead.php2
-rw-r--r--apps/files_versioning/ajax/sethead.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/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/media/ajax/api.php2
-rw-r--r--apps/media/ajax/autoupdate.php2
-rw-r--r--apps/media/index.php2
-rw-r--r--apps/media/server/xml.server.php2
-rw-r--r--apps/media/tomahawk.php2
-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
-rw-r--r--core/js/js.js25
-rw-r--r--index.php8
-rw-r--r--lib/base.php62
-rwxr-xr-xlib/helper.php17
-rw-r--r--lib/util.php2
184 files changed, 215 insertions, 157 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..4daed58af3b 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.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/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/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 ae48b229b16..707c8c59ebf 100644
--- a/apps/calendar/ajax/changeview.php
+++ b/apps/calendar/ajax/changeview.php
@@ -6,7 +6,7 @@
* 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 5fc12900ef3..49b740656de 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 98c22eb0206..1634e7ea416 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 64daffddef0..53912cb4c93 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 8150fdbaa32..bfebefb8fe0 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 838002a3a09..2e03c02af27 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 aa2d420e77d..9a9d37ff3d4 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 d053df2e4c1..0cfee0dbdc1 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');
$l = OC_L10N::get('calendar');
$unnamed = $l->t('unnamed');
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 d0bdab4f0d5..95294948f75 100644
--- a/apps/calendar/ajax/import/import.php
+++ b/apps/calendar/ajax/import/import.php
@@ -7,7 +7,7 @@
*/
//check for calendar rights or create new one
ob_start();
-require_once('../../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$nl = "\n\r";
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 d91f87b613f..5538637eab4 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 d892727701a..88885cd7c10 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 ec3150a89aa..97ef7ab2cb0 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..a319fd05223 100644
--- a/apps/calendar/caldav.php
+++ b/apps/calendar/caldav.php
@@ -9,7 +9,7 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
-require_once('../../lib/base.php');
+
OC_Util::checkAppEnabled('calendar');
// Backends
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index db3a83c92e9..bf0503defbc 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/import.php b/apps/calendar/import.php
index e5a5f0837f4..9494ed89fca 100644
--- a/apps/calendar/import.php
+++ b/apps/calendar/import.php
@@ -7,7 +7,7 @@
*/
//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";
diff --git a/apps/calendar/index.php b/apps/calendar/index.php
index f964a13ef79..4aa1f695e31 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');
diff --git a/apps/calendar/resettimezone.php b/apps/calendar/resettimezone.php
index 1ef9591ae39..0996924b5ad 100644
--- a/apps/calendar/resettimezone.php
+++ b/apps/calendar/resettimezone.php
@@ -1,4 +1,4 @@
<?php
-require_once ("../../lib/base.php");
+
OC_Preferences::deleteKey(OC_USER::getUser(), 'calendar', 'timezone');
?> \ No newline at end of file
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 2c8bb7bf1ed..669f9e2844d 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 0df4e1998cb..36ba6a046dc 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 9780df46476..96231596222 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..794fb890898 100644
--- a/apps/contacts/carddav.php
+++ b/apps/contacts/carddav.php
@@ -23,7 +23,7 @@
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;
-require_once('../../lib/base.php');
+
OC_Util::checkAppEnabled('contacts');
// Backends
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 04cfc397d56..8cf0a173db1 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('calendar');
$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/photo.php b/apps/contacts/photo.php
index 298f1215e3c..cd0ae350102 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/thumbnail.php b/apps/contacts/thumbnail.php
index 5082626499b..c7d37b755fe 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/files/admin.php b/apps/files/admin.php
index 4ae3ee51236..bdea70506fb 100644
--- a/files/admin.php
+++ b/apps/files/admin.php
@@ -23,7 +23,7 @@
// Init owncloud
-require_once('../lib/base.php');
+
OC_Util::checkAdminUser();
diff --git a/files/ajax/autocomplete.php b/apps/files/ajax/autocomplete.php
index 8d7a5b482bd..8cdb6188a02 100644
--- a/files/ajax/autocomplete.php
+++ b/apps/files/ajax/autocomplete.php
@@ -3,7 +3,7 @@
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/delete.php b/apps/files/ajax/delete.php
index 1725201fdd9..d8a01d7acf1 100644
--- a/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/download.php b/apps/files/ajax/download.php
index 39852613ab9..65c04c36faf 100644
--- a/files/ajax/download.php
+++ b/apps/files/ajax/download.php
@@ -25,7 +25,7 @@
$RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/files/ajax/list.php b/apps/files/ajax/list.php
index ec9ab7342dd..83914332a7d 100644
--- a/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -4,7 +4,7 @@
$RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php
index ff72ba0f5b7..57898cd82d9 100644
--- a/files/ajax/mimeicon.php
+++ b/apps/files/ajax/mimeicon.php
@@ -4,7 +4,7 @@
$RUNTIME_NOAPPS=false;
// Init owncloud
-require_once('../../lib/base.php');
+
print OC_Helper::mimetypeIcon($_GET['mime']);
diff --git a/files/ajax/move.php b/apps/files/ajax/move.php
index 9af3f80208f..0ad314f873c 100644
--- a/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index 2d1372f06ee..472b577a32a 100644
--- a/files/ajax/newfile.php
+++ b/apps/files/ajax/newfile.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php
index 228e369fbef..2aff95e5b35 100644
--- a/files/ajax/newfolder.php
+++ b/apps/files/ajax/newfolder.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index e02c5b62733..8f1990d1b8f 100644
--- a/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -4,7 +4,7 @@
$RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
-require_once('../../lib/base.php');
+
require_once('../../lib/template.php');
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/rename.php b/apps/files/ajax/rename.php
index a51b36635b3..dc5d3962abd 100644
--- a/files/ajax/rename.php
+++ b/apps/files/ajax/rename.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
OC_JSON::checkLoggedIn();
diff --git a/files/ajax/scan.php b/apps/files/ajax/scan.php
index db09b7d5c64..488f68e6b3c 100644
--- a/files/ajax/scan.php
+++ b/apps/files/ajax/scan.php
@@ -1,7 +1,5 @@
<?php
-require_once '../../lib/base.php';
-
set_time_limit(0);//scanning can take ages
$force=isset($_GET['force']) and $_GET['force']=='true';
diff --git a/files/ajax/timezone.php b/apps/files/ajax/timezone.php
index 8e1d2aa1ec1..8e1d2aa1ec1 100644
--- a/files/ajax/timezone.php
+++ b/apps/files/ajax/timezone.php
diff --git a/files/ajax/upload.php b/apps/files/ajax/upload.php
index b04796e3248..c60e1a3752a 100644
--- a/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -1,7 +1,7 @@
<?php
// Init owncloud
-require_once('../../lib/base.php');
+
// Firefox and Konqueror tries to download application/json for me. --Arthur
OC_JSON::setContentTypeHeader('text/plain');
diff --git a/files/appinfo/app.php b/apps/files/appinfo/app.php
index c4a2ee7407a..c4a2ee7407a 100644
--- a/files/appinfo/app.php
+++ b/apps/files/appinfo/app.php
diff --git a/files/css/files.css b/apps/files/css/files.css
index fd551b27625..fd551b27625 100644
--- a/files/css/files.css
+++ b/apps/files/css/files.css
diff --git a/files/download.php b/apps/files/download.php
index d1f5ba486d7..ec4a6e1fc9c 100644
--- a/files/download.php
+++ b/apps/files/download.php
@@ -22,7 +22,7 @@
*/
// Init owncloud
-require_once('../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/files/index.php b/apps/files/index.php
index aea91542db6..46b511d66eb 100644
--- a/files/index.php
+++ b/apps/files/index.php
@@ -21,10 +21,6 @@
*
*/
-
-// Init owncloud
-require_once('../lib/base.php');
-
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/files/js/admin.js b/apps/files/js/admin.js
index bfa96670635..bfa96670635 100644
--- a/files/js/admin.js
+++ b/apps/files/js/admin.js
diff --git a/files/js/fileactions.js b/apps/files/js/fileactions.js
index 80e918a455c..80e918a455c 100644
--- a/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
diff --git a/files/js/filelist.js b/apps/files/js/filelist.js
index 5bd85fc29ef..5bd85fc29ef 100644
--- a/files/js/filelist.js
+++ b/apps/files/js/filelist.js
diff --git a/files/js/files.js b/apps/files/js/files.js
index 3ce95f992d0..3ce95f992d0 100644
--- a/files/js/files.js
+++ b/apps/files/js/files.js
diff --git a/files/js/timezone.js b/apps/files/js/timezone.js
index d569683f210..d569683f210 100644
--- a/files/js/timezone.js
+++ b/apps/files/js/timezone.js
diff --git a/files/l10n/ar.php b/apps/files/l10n/ar.php
index 50edc0d6979..50edc0d6979 100644
--- a/files/l10n/ar.php
+++ b/apps/files/l10n/ar.php
diff --git a/files/l10n/bg_BG.php b/apps/files/l10n/bg_BG.php
index 027a7698203..027a7698203 100644
--- a/files/l10n/bg_BG.php
+++ b/apps/files/l10n/bg_BG.php
diff --git a/files/l10n/ca.php b/apps/files/l10n/ca.php
index b85b36f5c02..b85b36f5c02 100644
--- a/files/l10n/ca.php
+++ b/apps/files/l10n/ca.php
diff --git a/files/l10n/cs_CZ.php b/apps/files/l10n/cs_CZ.php
index 5d26b26604a..5d26b26604a 100644
--- a/files/l10n/cs_CZ.php
+++ b/apps/files/l10n/cs_CZ.php
diff --git a/files/l10n/da.php b/apps/files/l10n/da.php
index f86a98d44c1..f86a98d44c1 100644
--- a/files/l10n/da.php
+++ b/apps/files/l10n/da.php
diff --git a/files/l10n/de.php b/apps/files/l10n/de.php
index 94d312c3e9e..94d312c3e9e 100644
--- a/files/l10n/de.php
+++ b/apps/files/l10n/de.php
diff --git a/files/l10n/el.php b/apps/files/l10n/el.php
index 27a80fcc98c..27a80fcc98c 100644
--- a/files/l10n/el.php
+++ b/apps/files/l10n/el.php
diff --git a/files/l10n/eo.php b/apps/files/l10n/eo.php
index 42dc4f1280e..42dc4f1280e 100644
--- a/files/l10n/eo.php
+++ b/apps/files/l10n/eo.php
diff --git a/files/l10n/es.php b/apps/files/l10n/es.php
index 11665ac3c32..11665ac3c32 100644
--- a/files/l10n/es.php
+++ b/apps/files/l10n/es.php
diff --git a/files/l10n/et_EE.php b/apps/files/l10n/et_EE.php
index 415eb632312..415eb632312 100644
--- a/files/l10n/et_EE.php
+++ b/apps/files/l10n/et_EE.php
diff --git a/files/l10n/eu.php b/apps/files/l10n/eu.php
index b9873e6c3fa..b9873e6c3fa 100644
--- a/files/l10n/eu.php
+++ b/apps/files/l10n/eu.php
diff --git a/files/l10n/fr.php b/apps/files/l10n/fr.php
index cf90223a06a..cf90223a06a 100644
--- a/files/l10n/fr.php
+++ b/apps/files/l10n/fr.php
diff --git a/files/l10n/gl.php b/apps/files/l10n/gl.php
index 83cf93be795..83cf93be795 100644
--- a/files/l10n/gl.php
+++ b/apps/files/l10n/gl.php
diff --git a/files/l10n/he.php b/apps/files/l10n/he.php
index 79ae1edb7a5..79ae1edb7a5 100644
--- a/files/l10n/he.php
+++ b/apps/files/l10n/he.php
diff --git a/files/l10n/hr.php b/apps/files/l10n/hr.php
index 670e87f6557..670e87f6557 100644
--- a/files/l10n/hr.php
+++ b/apps/files/l10n/hr.php
diff --git a/files/l10n/hu_HU.php b/apps/files/l10n/hu_HU.php
index a176ffce647..a176ffce647 100644
--- a/files/l10n/hu_HU.php
+++ b/apps/files/l10n/hu_HU.php
diff --git a/files/l10n/ia.php b/apps/files/l10n/ia.php
index 8753b871c9e..8753b871c9e 100644
--- a/files/l10n/ia.php
+++ b/apps/files/l10n/ia.php
diff --git a/files/l10n/id.php b/apps/files/l10n/id.php
index 902eeeb4ec2..902eeeb4ec2 100644
--- a/files/l10n/id.php
+++ b/apps/files/l10n/id.php
diff --git a/files/l10n/it.php b/apps/files/l10n/it.php
index 919ff0b5aae..919ff0b5aae 100644
--- a/files/l10n/it.php
+++ b/apps/files/l10n/it.php
diff --git a/files/l10n/ja_JP.php b/apps/files/l10n/ja_JP.php
index 24c4e36ee6e..24c4e36ee6e 100644
--- a/files/l10n/ja_JP.php
+++ b/apps/files/l10n/ja_JP.php
diff --git a/files/l10n/lb.php b/apps/files/l10n/lb.php
index 43956fcd63e..43956fcd63e 100644
--- a/files/l10n/lb.php
+++ b/apps/files/l10n/lb.php
diff --git a/files/l10n/lt_LT.php b/apps/files/l10n/lt_LT.php
index 1bec35e0f8c..1bec35e0f8c 100644
--- a/files/l10n/lt_LT.php
+++ b/apps/files/l10n/lt_LT.php
diff --git a/files/l10n/ms_MY.php b/apps/files/l10n/ms_MY.php
index 038ffd521a0..038ffd521a0 100644
--- a/files/l10n/ms_MY.php
+++ b/apps/files/l10n/ms_MY.php
diff --git a/files/l10n/nb_NO.php b/apps/files/l10n/nb_NO.php
index c4ef4989a58..c4ef4989a58 100644
--- a/files/l10n/nb_NO.php
+++ b/apps/files/l10n/nb_NO.php
diff --git a/files/l10n/nl.php b/apps/files/l10n/nl.php
index 36b4695a476..36b4695a476 100644
--- a/files/l10n/nl.php
+++ b/apps/files/l10n/nl.php
diff --git a/files/l10n/nn_NO.php b/apps/files/l10n/nn_NO.php
index 34f2f6be960..34f2f6be960 100644
--- a/files/l10n/nn_NO.php
+++ b/apps/files/l10n/nn_NO.php
diff --git a/files/l10n/pl.php b/apps/files/l10n/pl.php
index d110f52ab1d..d110f52ab1d 100644
--- a/files/l10n/pl.php
+++ b/apps/files/l10n/pl.php
diff --git a/files/l10n/pt_BR.php b/apps/files/l10n/pt_BR.php
index 57b1af2ae6d..57b1af2ae6d 100644
--- a/files/l10n/pt_BR.php
+++ b/apps/files/l10n/pt_BR.php
diff --git a/files/l10n/ro.php b/apps/files/l10n/ro.php
index 9d8d6e2d5df..9d8d6e2d5df 100644
--- a/files/l10n/ro.php
+++ b/apps/files/l10n/ro.php
diff --git a/files/l10n/ru.php b/apps/files/l10n/ru.php
index 88a6d8ee19c..88a6d8ee19c 100644
--- a/files/l10n/ru.php
+++ b/apps/files/l10n/ru.php
diff --git a/files/l10n/sk_SK.php b/apps/files/l10n/sk_SK.php
index 0d91ae35a51..0d91ae35a51 100644
--- a/files/l10n/sk_SK.php
+++ b/apps/files/l10n/sk_SK.php
diff --git a/files/l10n/sl.php b/apps/files/l10n/sl.php
index 5a09e0fe20b..5a09e0fe20b 100644
--- a/files/l10n/sl.php
+++ b/apps/files/l10n/sl.php
diff --git a/files/l10n/sr.php b/apps/files/l10n/sr.php
index 7e2ac3b1366..7e2ac3b1366 100644
--- a/files/l10n/sr.php
+++ b/apps/files/l10n/sr.php
diff --git a/files/l10n/sr@latin.php b/apps/files/l10n/sr@latin.php
index 1b5addbc571..1b5addbc571 100644
--- a/files/l10n/sr@latin.php
+++ b/apps/files/l10n/sr@latin.php
diff --git a/files/l10n/sv.php b/apps/files/l10n/sv.php
index dfd32f3f5c2..dfd32f3f5c2 100644
--- a/files/l10n/sv.php
+++ b/apps/files/l10n/sv.php
diff --git a/files/l10n/th_TH.php b/apps/files/l10n/th_TH.php
index e7e2fb94b1e..e7e2fb94b1e 100644
--- a/files/l10n/th_TH.php
+++ b/apps/files/l10n/th_TH.php
diff --git a/files/l10n/tr.php b/apps/files/l10n/tr.php
index 5fc46056175..5fc46056175 100644
--- a/files/l10n/tr.php
+++ b/apps/files/l10n/tr.php
diff --git a/files/l10n/xgettextfiles b/apps/files/l10n/xgettextfiles
index 9e22680e455..9e22680e455 100644
--- a/files/l10n/xgettextfiles
+++ b/apps/files/l10n/xgettextfiles
diff --git a/files/l10n/zh_CN.php b/apps/files/l10n/zh_CN.php
index ab23a55d29e..ab23a55d29e 100644
--- a/files/l10n/zh_CN.php
+++ b/apps/files/l10n/zh_CN.php
diff --git a/files/settings.php b/apps/files/settings.php
index c47eb130095..41017c064ef 100644
--- a/files/settings.php
+++ b/apps/files/settings.php
@@ -23,7 +23,7 @@
// Init owncloud
-require_once('../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/files/templates/admin.php b/apps/files/templates/admin.php
index 9bcc40e9361..9bcc40e9361 100644
--- a/files/templates/admin.php
+++ b/apps/files/templates/admin.php
diff --git a/files/templates/index.php b/apps/files/templates/index.php
index b21cf0aeb02..b21cf0aeb02 100644
--- a/files/templates/index.php
+++ b/apps/files/templates/index.php
diff --git a/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php
index 16da6bb97b4..16da6bb97b4 100644
--- a/files/templates/part.breadcrumb.php
+++ b/apps/files/templates/part.breadcrumb.php
diff --git a/files/templates/part.list.php b/apps/files/templates/part.list.php
index 5a5941fc7ae..5a5941fc7ae 100644
--- a/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
diff --git a/files/webdav.php b/apps/files/webdav.php
index 25e33024470..3418eba5a6c 100644
--- a/files/webdav.php
+++ b/apps/files/webdav.php
@@ -29,7 +29,7 @@ $RUNTIME_NOSETUPFS = true;
// only need filesystem apps
$RUNTIME_APPTYPES=array('filesystem','authentication');
-require_once('../lib/base.php');
+
// Backends
$authBackend = new OC_Connector_Sabre_Auth();
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/files_versioning/ajax/gethead.php b/apps/files_versioning/ajax/gethead.php
index cc93b7a1d17..a0bfe77db51 100644
--- a/apps/files_versioning/ajax/gethead.php
+++ b/apps/files_versioning/ajax/gethead.php
@@ -4,7 +4,7 @@
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
// Fetch current commit (or HEAD if not yet set)
diff --git a/apps/files_versioning/ajax/sethead.php b/apps/files_versioning/ajax/sethead.php
index d1b2df9b00f..dd8b924b118 100644
--- a/apps/files_versioning/ajax/sethead.php
+++ b/apps/files_versioning/ajax/sethead.php
@@ -4,7 +4,7 @@
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
-require_once('../../../lib/base.php');
+
OC_JSON::checkLoggedIn();
if(isset($_POST["file_versioning_head"])){
OC_Preferences::setValue(OC_User::getUser(), 'files_versioning', 'head', $_POST["file_versioning_head"]);
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/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/media/ajax/api.php b/apps/media/ajax/api.php
index 9d9c14deb17..72235bf5db8 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -23,7 +23,7 @@
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');
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..f51d62b77cd 100644
--- a/apps/media/index.php
+++ b/apps/media/index.php
@@ -22,7 +22,7 @@
*/
-require_once('../../lib/base.php');
+
// Check if we are a user
OC_Util::checkLoggedIn();
diff --git a/apps/media/server/xml.server.php b/apps/media/server/xml.server.php
index cb9b68fc422..83339c91af1 100644
--- a/apps/media/server/xml.server.php
+++ b/apps/media/server/xml.server.php
@@ -22,7 +22,7 @@
*/
-require_once('../../../lib/base.php');
+
OC_Util::checkAppEnabled('media');
require_once('../lib_collection.php');
require_once('../lib_ampache.php');
diff --git a/apps/media/tomahawk.php b/apps/media/tomahawk.php
index 6dd41233f12..1ff2599e103 100644
--- a/apps/media/tomahawk.php
+++ b/apps/media/tomahawk.php
@@ -23,7 +23,7 @@
$_POST=$_GET; //debug
-require_once('../../lib/base.php');
+
OC_JSON::checkAppEnabled('media');
require_once('lib_collection.php');
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);
diff --git a/core/js/js.js b/core/js/js.js
index 019c40a0e1b..9b0a159b5c2 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -32,7 +32,7 @@ t.cache={};
OC={
webroot:oc_webroot,
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
- coreApps:['files','admin','log','search','settings','core','3rdparty'],
+ coreApps:['admin','log','search','settings','core','3rdparty'],
/**
* get an absolute url to a file in an appen
* @param app the id of the app the file belongs to
@@ -51,16 +51,21 @@ OC={
*/
filePath:function(app,type,file){
var isCore=OC.coreApps.indexOf(app)!=-1;
- app+='/';
- var link=OC.webroot+'/';
- if(!isCore){
- link+='apps/';
- }
- link+=app;
- if(type){
- link+=type+'/';
+ var link=OC.webroot;
+ if(file.substring(file.length-3) == 'php' && !isCore){
+ link+='/?app=' + app + '&file=' + type + '/' + file;
+ }else{
+ link+='/';
+ app+='/';
+ if(!isCore){
+ link+='apps/';
+ }
+ link+=app;
+ if(type){
+ link+=type+'/';
+ }
+ link+=file;
}
- link+=file;
return link;
},
/**
diff --git a/index.php b/index.php
index b4cac1879c6..a3835c6d2f3 100644
--- a/index.php
+++ b/index.php
@@ -57,7 +57,13 @@ elseif(OC_User::isLoggedIn()) {
exit();
}
else {
- OC_Util::redirectToDefaultPage();
+ OC_App::loadApps();
+ if(is_null(OC::$REQUESTEDFILE)){
+ OC::loadapp();
+ }else{
+ OC::loadfile();
+ }
+
}
}
diff --git a/lib/base.php b/lib/base.php
index f3dacdc0f76..df240dca6df 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -62,15 +62,22 @@ class OC{
* the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty)
*/
public static $THIRDPARTYWEBROOT = '';
- /**
- * The installation path of the apps folder on the server (e.g. /srv/http/owncloud)
- */
- public static $APPSROOT = '';
- /**
- * the root path of the apps folder for http requests (e.g. owncloud)
- */
- public static $APPSWEBROOT = '';
-
+ /**
+ * The installation path of the apps folder on the server (e.g. /srv/http/owncloud)
+ */
+ public static $APPSROOT = '';
+ /**
+ * the root path of the apps folder for http requests (e.g. owncloud)
+ */
+ public static $APPSWEBROOT = '';
+ /*
+ * requested app
+ */
+ public static $REQUESTEDAPP = '';
+ /*
+ * requested file of app
+ */
+ public static $REQUESTEDFILE = '';
/**
* SPL autoload
*/
@@ -161,12 +168,15 @@ class OC{
}
// search the apps folder
- if(file_exists(OC::$SERVERROOT.'/apps')){
+ if(OC_Config::getValue('appsroot', '')<>''){
+ OC::$APPSROOT=OC_Config::getValue('appsroot', '');
+ OC::$APPSWEBROOT=OC_Config::getValue('appsurl', '');
+ }elseif(file_exists(OC::$SERVERROOT.'/apps')){
OC::$APPSROOT=OC::$SERVERROOT;
OC::$APPSWEBROOT=OC::$WEBROOT;
}elseif(file_exists(OC::$SERVERROOT.'/../apps')){
- OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/');
OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/');
+ OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/');
}else{
echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
exit;
@@ -261,6 +271,22 @@ class OC{
ini_set('session.cookie_httponly','1;');
session_start();
}
+
+ public static function loadapp(){
+ if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP)){
+ require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php');
+ }else{
+ trigger_error('The requested App was not found.', E_USER_ERROR);
+ }
+ }
+
+ public static function loadfile(){
+ if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)){
+ require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE);
+ }else{
+ header('404 Not found');
+ }
+ }
public static function init(){
// register autoloader
@@ -371,6 +397,18 @@ class OC{
//make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper','cleanTmp'));
+
+ self::$REQUESTEDAPP = (isset($_GET['app'])?strip_tags($_GET['app']):'files');
+ self::$REQUESTEDFILE = $_GET['file'];
+ if(substr_count(self::$REQUESTEDFILE, '?') != 0){
+ $pos_questionmark = strpos(self::$REQUESTEDFILE, '?');
+ $pos_equal = strpos(self::$REQUESTEDFILE, '=');
+ $pos_and = strpos(self::$REQUESTEDFILE, '?');
+ $_GET[substr(self::$REQUESTEDFILE, $pos_questionmark + 1, $pos_equal - $pos_questionmark - 1)] = substr(self::$REQUESTEDFILE, $pos_equal + 1, $pos_and);
+ self::$REQUESTEDFILE = substr(self::$REQUESTEDFILE, 0, $pos_questionmark);
+ $_GET['file'] = OC::$REQUESTEDFILE;
+ }
+ self::$REQUESTEDFILE = (isset($_GET['file'])?(OC_Helper::issubdirectory(OC::$APPSROOT . '/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE, OC::$APPSROOT . '/' . self::$REQUESTEDAPP)?self::$REQUESTEDFILE:null):null);
}
}
@@ -399,4 +437,4 @@ if(!function_exists('get_temp_dir')) {
}
}
-OC::init();
+OC::init(); \ No newline at end of file
diff --git a/lib/helper.php b/lib/helper.php
index beb10280d93..34f8faad4a5 100755
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -41,7 +41,11 @@ class OC_Helper {
$app .= '/';
// Check if the app is in the app folder
if( file_exists( OC::$APPSROOT . '/apps/'. $app.$file )){
- $urlLinkTo = OC::$APPSWEBROOT . '/apps/' . $app . $file;
+ if(substr($app, -1, 1) == '/'){
+ $app = substr($app, 0, strlen($app) - 1);
+ }
+ $urlLinkTo = OC::$WEBROOT . '?app=' . $app;
+ $urlLinkTo .= ($file!='index.php')?'&file=' . $file:'';
}
else{
$urlLinkTo = OC::$WEBROOT . '/' . $app . $file;
@@ -543,4 +547,15 @@ class OC_Helper {
return $newpath;
}
+
+ /*
+ * checks if $sub is a subdirectory of $parent
+ *
+ * @param $sub
+ * @param $parent
+ * @return bool
+ */
+ public static function issubdirectory($sub, $parent){
+ return (substr(realpath($sub), 0, strlen(realpath($parent))) == realpath($parent))?true:false;
+ }
}
diff --git a/lib/util.php b/lib/util.php
index ec70fd91cb5..0b8ea1ec907 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -298,7 +298,7 @@ class OC_Util {
if(isset($_REQUEST['redirect_url'])) {
header( 'Location: '.$_REQUEST['redirect_url']);
} else {
- header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', 'files/index.php'));
+ header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'));
}
exit();
}