From f4782a76907cf010faf9f4cd7deb3a67a2d02de9 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 30 Sep 2011 23:05:10 +0200 Subject: [PATCH] Check if the application is actually enabled --- apps/admin_export/settings.php | 3 ++- apps/bookmarks/addBm.php | 1 + apps/bookmarks/ajax/addBookmark.php | 1 + apps/bookmarks/ajax/delBookmark.php | 1 + apps/bookmarks/ajax/editBookmark.php | 1 + apps/bookmarks/ajax/getMeta.php | 1 + apps/bookmarks/ajax/recordClick.php | 1 + apps/bookmarks/ajax/updateList.php | 1 + apps/bookmarks/index.php | 1 + apps/calendar/ajax/activation.php | 1 + apps/calendar/ajax/changeview.php | 1 + apps/calendar/ajax/choosecalendar.php | 1 + apps/calendar/ajax/createcalendar.php | 1 + apps/calendar/ajax/deletecalendar.php | 1 + apps/calendar/ajax/deleteevent.php | 1 + apps/calendar/ajax/editcalendar.php | 1 + apps/calendar/ajax/editevent.php | 1 + apps/calendar/ajax/editeventform.php | 1 + apps/calendar/ajax/getcal.php | 1 + apps/calendar/ajax/newcalendar.php | 1 + apps/calendar/ajax/newevent.php | 1 + apps/calendar/ajax/neweventform.php | 1 + apps/calendar/ajax/settimezone.php | 1 + apps/calendar/ajax/updatecalendar.php | 1 + apps/calendar/caldav.php | 1 + apps/calendar/export.php | 1 + apps/calendar/index.php | 1 + apps/contacts/ajax/addcard.php | 1 + apps/contacts/ajax/addproperty.php | 1 + apps/contacts/ajax/deletebook.php | 1 + apps/contacts/ajax/deletecard.php | 1 + apps/contacts/ajax/deleteproperty.php | 1 + apps/contacts/ajax/getdetails.php | 1 + apps/contacts/ajax/setproperty.php | 1 + apps/contacts/ajax/showaddcard.php | 1 + apps/contacts/ajax/showaddproperty.php | 1 + apps/contacts/ajax/showsetproperty.php | 1 + apps/contacts/carddav.php | 1 + apps/contacts/index.php | 1 + apps/contacts/photo.php | 1 + apps/files_sharing/ajax/getitem.php | 1 + apps/files_sharing/ajax/setpermissions.php | 3 ++- apps/files_sharing/ajax/share.php | 3 ++- apps/files_sharing/ajax/unshare.php | 3 ++- apps/files_sharing/ajax/userautocomplete.php | 1 + apps/files_sharing/get.php | 1 + apps/files_sharing/list.php | 1 + apps/media/ajax/api.php | 1 + apps/media/ajax/autoupdate.php | 1 + apps/media/index.php | 1 + apps/media/server/xml.server.php | 1 + apps/media/tomahawk.php | 1 + apps/unhosted/compat.php | 1 + apps/user_openid/user.php | 1 + lib/json.php | 11 +++++++++++ lib/util.php | 10 ++++++++++ settings/ajax/openid.php | 1 + 57 files changed, 80 insertions(+), 4 deletions(-) diff --git a/apps/admin_export/settings.php b/apps/admin_export/settings.php index 2d1bc66a29..565c4b3db9 100644 --- a/apps/admin_export/settings.php +++ b/apps/admin_export/settings.php @@ -20,6 +20,7 @@ * License along with this library. If not, see . * */ +OC_Util::checkAppEnabled('admin_export'); if (isset($_POST['admin_export'])) { $root = OC::$SERVERROOT . "/"; $zip = new ZipArchive(); @@ -91,4 +92,4 @@ function zipAddDir($dir, $zip, $recursive=true, $internalDir='') { } else { error_log("Was not able to open directory: " . $dir); } -} \ No newline at end of file +} diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php index b62fcdfbeb..a2a39134ea 100644 --- a/apps/bookmarks/addBm.php +++ b/apps/bookmarks/addBm.php @@ -25,6 +25,7 @@ require_once('../../lib/base.php'); // Check if we are a user OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('bookmarks'); require_once('bookmarksHelper.php'); diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 9b0beb388a..0dc83d9014 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php index afe60f7d1b..4aef86e771 100644 --- a/apps/bookmarks/ajax/delBookmark.php +++ b/apps/bookmarks/ajax/delBookmark.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); $params=array( htmlspecialchars_decode($_GET["url"]), diff --git a/apps/bookmarks/ajax/editBookmark.php b/apps/bookmarks/ajax/editBookmark.php index 5125f9ce89..b427a175e5 100644 --- a/apps/bookmarks/ajax/editBookmark.php +++ b/apps/bookmarks/ajax/editBookmark.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ diff --git a/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php index 4583ef204b..ca797315ef 100644 --- a/apps/bookmarks/ajax/getMeta.php +++ b/apps/bookmarks/ajax/getMeta.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); // $metadata = array(); diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php index f5f7c20c6a..e6fdfe043e 100644 --- a/apps/bookmarks/ajax/recordClick.php +++ b/apps/bookmarks/ajax/recordClick.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); $query = OC_DB::prepare(" UPDATE *PREFIX*bookmarks diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php index de3480d6c3..8e9bda0bc2 100644 --- a/apps/bookmarks/ajax/updateList.php +++ b/apps/bookmarks/ajax/updateList.php @@ -28,6 +28,7 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('bookmarks'); $params=array(OC_User::getUser()); $CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' ); diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php index 45c9a52f55..50fea3fddb 100644 --- a/apps/bookmarks/index.php +++ b/apps/bookmarks/index.php @@ -25,6 +25,7 @@ require_once('../../lib/base.php'); // Check if we are a user OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('bookmarks'); OC_App::setActiveNavigationEntry( 'bookmarks_index' ); diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php index 38f727e948..89239f2175 100644 --- a/apps/calendar/ajax/activation.php +++ b/apps/calendar/ajax/activation.php @@ -10,6 +10,7 @@ require_once ("../../../lib/base.php"); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['calendarid']; OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); $cal = OC_Calendar_Calendar::findCalendar($calendarid); diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php index d19a11585a..b396ff4945 100644 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -10,6 +10,7 @@ require_once ("../../../lib/base.php"); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $currentview = $_GET["v"]; OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview); ?> diff --git a/apps/calendar/ajax/choosecalendar.php b/apps/calendar/ajax/choosecalendar.php index 44ff22906f..0935a4c42a 100644 --- a/apps/calendar/ajax/choosecalendar.php +++ b/apps/calendar/ajax/choosecalendar.php @@ -11,6 +11,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $output = new OC_TEMPLATE("calendar", "part.choosecalendar"); $output -> printpage(); ?> diff --git a/apps/calendar/ajax/createcalendar.php b/apps/calendar/ajax/createcalendar.php index 7d80333b25..82176d4368 100644 --- a/apps/calendar/ajax/createcalendar.php +++ b/apps/calendar/ajax/createcalendar.php @@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); $userid = OC_User::getUser(); $calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], $_POST['description'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']); diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php index 30607b92e6..e8ffe0d059 100644 --- a/apps/calendar/ajax/deletecalendar.php +++ b/apps/calendar/ajax/deletecalendar.php @@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(''); } +OC_JSON::checkAppEnabled('calendar'); $cal = $_POST["calendarid"]; $calendar = OC_Calendar_Calendar::findCalendar($cal); diff --git a/apps/calendar/ajax/deleteevent.php b/apps/calendar/ajax/deleteevent.php index a6750267bd..9e3c7dd87d 100644 --- a/apps/calendar/ajax/deleteevent.php +++ b/apps/calendar/ajax/deleteevent.php @@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(''); } +OC_JSON::checkAppEnabled('calendar'); $id = $_POST['id']; $data = OC_Calendar_Object::find($id); diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/editcalendar.php index 8f798d1bbf..7ff869f888 100644 --- a/apps/calendar/ajax/editcalendar.php +++ b/apps/calendar/ajax/editcalendar.php @@ -11,6 +11,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']); $tmpl = new OC_Template("calendar", "part.editcalendar"); $tmpl->assign('new', false); diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php index 7187e05d56..3abf4de98b 100644 --- a/apps/calendar/ajax/editevent.php +++ b/apps/calendar/ajax/editevent.php @@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(''); } +OC_JSON::checkAppEnabled('calendar'); $errarr = OC_Calendar_Object::validateRequest($_POST); if($errarr){ diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index e2d32d03d3..34d6c657ce 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(''); } +OC_JSON::checkAppEnabled('calendar'); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_Object::getCategoryOptions($l10n); diff --git a/apps/calendar/ajax/getcal.php b/apps/calendar/ajax/getcal.php index 7fa4f87cd3..c59cb873fd 100644 --- a/apps/calendar/ajax/getcal.php +++ b/apps/calendar/ajax/getcal.php @@ -10,6 +10,7 @@ require_once ("../../../lib/base.php"); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); $events = array(); diff --git a/apps/calendar/ajax/newcalendar.php b/apps/calendar/ajax/newcalendar.php index ffcffb8afd..199f95fb46 100644 --- a/apps/calendar/ajax/newcalendar.php +++ b/apps/calendar/ajax/newcalendar.php @@ -11,6 +11,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $calendar = array( 'id' => 'new', 'displayname' => 'Test', diff --git a/apps/calendar/ajax/newevent.php b/apps/calendar/ajax/newevent.php index 9ac3b0aaff..1a696cf778 100644 --- a/apps/calendar/ajax/newevent.php +++ b/apps/calendar/ajax/newevent.php @@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(""); } +OC_JSON::checkAppEnabled('calendar'); $errarr = OC_Calendar_Object::validateRequest($_POST); if($errarr){ diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index 7099ea718e..9bab2cd484 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -13,6 +13,7 @@ $l10n = new OC_L10N('calendar'); if(!OC_USER::isLoggedIn()) { die(''); } +OC_JSON::checkAppEnabled('calendar'); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_Object::getCategoryOptions($l10n); diff --git a/apps/calendar/ajax/settimezone.php b/apps/calendar/ajax/settimezone.php index 2b82bc8e4b..c726a11471 100644 --- a/apps/calendar/ajax/settimezone.php +++ b/apps/calendar/ajax/settimezone.php @@ -13,6 +13,7 @@ $l=new OC_L10N('calendar'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); // Get data if( isset( $_POST['timezone'] ) ){ diff --git a/apps/calendar/ajax/updatecalendar.php b/apps/calendar/ajax/updatecalendar.php index d53515d0de..5cf48d50ea 100644 --- a/apps/calendar/ajax/updatecalendar.php +++ b/apps/calendar/ajax/updatecalendar.php @@ -12,6 +12,7 @@ $l10n = new OC_L10N('calendar'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['id']; OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], $_POST['description'], null, null, null, $_POST['color']); diff --git a/apps/calendar/caldav.php b/apps/calendar/caldav.php index 83f6a5ab51..b581274398 100644 --- a/apps/calendar/caldav.php +++ b/apps/calendar/caldav.php @@ -10,6 +10,7 @@ $RUNTIME_NOSETUPFS = true; require_once('../../lib/base.php'); +OC_Util::checkAppEnabled('calendar'); // Backends $authBackend = new OC_Connector_Sabre_Auth(); diff --git a/apps/calendar/export.php b/apps/calendar/export.php index a6fdaba1d2..feb4755a3a 100644 --- a/apps/calendar/export.php +++ b/apps/calendar/export.php @@ -8,6 +8,7 @@ require_once ("../../lib/base.php"); OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('calendar'); $cal = $_GET["calid"]; $calendar = OC_Calendar_Calendar::findCalendar($cal); if($calendar["userid"] != OC_User::getUser()){ diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 39f961d1bb..1e4d724b30 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -8,6 +8,7 @@ require_once ('../../lib/base.php'); OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('calendar'); // Create default calendar ... $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); if( count($calendars) == 0){ diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index cfae3327f5..ee95513732 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $addressbook = OC_Contacts_Addressbook::find( $aid ); if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 5a37f77f85..0b218c6298 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php index 13be33eb5a..c13217ef2e 100644 --- a/apps/contacts/ajax/deletebook.php +++ b/apps/contacts/ajax/deletebook.php @@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $addressbook = OC_Contacts_Addressbook::find( $id ); if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php index c69638320e..a0a6b8c3ea 100644 --- a/apps/contacts/ajax/deletecard.php +++ b/apps/contacts/ajax/deletecard.php @@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php index 40b765cf84..0a3a3c293a 100644 --- a/apps/contacts/ajax/deleteproperty.php +++ b/apps/contacts/ajax/deleteproperty.php @@ -31,6 +31,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php index 47d88a771e..0e76de61af 100644 --- a/apps/contacts/ajax/getdetails.php +++ b/apps/contacts/ajax/getdetails.php @@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index b4fc2162d9..18e0087247 100644 --- a/apps/contacts/ajax/setproperty.php +++ b/apps/contacts/ajax/setproperty.php @@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php index 58567392d7..2f534f0fe2 100644 --- a/apps/contacts/ajax/showaddcard.php +++ b/apps/contacts/ajax/showaddcard.php @@ -27,6 +27,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser()); $tmpl = new OC_Template('contacts','part.addcardform'); diff --git a/apps/contacts/ajax/showaddproperty.php b/apps/contacts/ajax/showaddproperty.php index 0d01b37d8e..f87cd05359 100644 --- a/apps/contacts/ajax/showaddproperty.php +++ b/apps/contacts/ajax/showaddproperty.php @@ -28,6 +28,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 0b30a8e68e..6188f4773c 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -29,6 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php index b17a939535..df7c858b1a 100644 --- a/apps/contacts/carddav.php +++ b/apps/contacts/carddav.php @@ -24,6 +24,7 @@ $RUNTIME_NOSETUPFS = true; require_once('../../lib/base.php'); +OC_Util::checkAppEnabled('contacts'); // Backends $authBackend = new OC_Connector_Sabre_Auth(); diff --git a/apps/contacts/index.php b/apps/contacts/index.php index c9cf348dfd..7e8eb8e695 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -29,6 +29,7 @@ require_once('../../lib/base.php'); // Check if we are a user OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('contacts'); // Check if the user has an addressbook $addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser()); diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php index 7ba2002b13..1bdfbe3a27 100644 --- a/apps/contacts/photo.php +++ b/apps/contacts/photo.php @@ -22,6 +22,7 @@ // Init owncloud require_once('../../lib/base.php'); +OC_Util::checkAppEnabled('contacts'); $id = $_GET['id']; diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index e7bda0f614..8d51c14652 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -2,6 +2,7 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); +OC_JSON::checkAppEnabled('files_sharing'); require_once('../lib_share.php'); $userDirectory = "/".OC_User::getUser()."/files"; diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php index 8e0bac0b06..7ee8f0e57b 100644 --- a/apps/files_sharing/ajax/setpermissions.php +++ b/apps/files_sharing/ajax/setpermissions.php @@ -2,6 +2,7 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); +OC_JSON::checkAppEnabled('files_sharing'); require_once('../lib_share.php'); $source = "/".OC_User::getUser()."/files".$_GET['source']; @@ -9,4 +10,4 @@ $uid_shared_with = $_GET['uid_shared_with']; $permissions = $_GET['permissions']; OC_Share::setPermissions($source, $uid_shared_with, $permissions); -?> \ No newline at end of file +?> diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index e672cf0240..6a2b45b3a7 100644 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -2,6 +2,7 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); +OC_JSON::checkAppEnabled('files_sharing'); require_once('../lib_share.php'); $userDirectory = "/".OC_User::getUser()."/files"; @@ -26,4 +27,4 @@ foreach ($sources as $source) { } } -?> \ No newline at end of file +?> diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php index b9230d257b..a19a85cfda 100644 --- a/apps/files_sharing/ajax/unshare.php +++ b/apps/files_sharing/ajax/unshare.php @@ -2,10 +2,11 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); +OC_JSON::checkAppEnabled('files_sharing'); require_once('../lib_share.php'); $source = "/".OC_User::getUser()."/files".$_GET['source']; $uid_shared_with = $_GET['uid_shared_with']; OC_Share::unshare($source, $uid_shared_with); -?> \ No newline at end of file +?> diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php index a3158cf72d..21516c3d09 100644 --- a/apps/files_sharing/ajax/userautocomplete.php +++ b/apps/files_sharing/ajax/userautocomplete.php @@ -4,6 +4,7 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('files_sharing'); $users = array(); $ocusers = OC_User::getUsers(); diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index 33918bf9e7..083f48e112 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -3,6 +3,7 @@ $RUNTIME_NOAPPS=true; //no need to load the apps $RUNTIME_NOSETUPFS=true; //don't setup the fs yet require_once '../../lib/base.php'; +OC_JSON::checkAppEnabled('files_sharing'); require_once 'lib_share.php'; //get the path of the shared file diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index a5f99f3804..721620dc92 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -24,6 +24,7 @@ require_once('../../lib/base.php'); require_once('lib_share.php'); OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('files_sharing'); OC_App::setActiveNavigationEntry("files_sharing_list"); diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index 84ee633446..29f61a2207 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -27,6 +27,7 @@ header('Content-type: text/html; charset=UTF-8') ; $RUNTIME_NOAPPS=true; 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 ad103d1c39..ff0923ca03 100644 --- a/apps/media/ajax/autoupdate.php +++ b/apps/media/ajax/autoupdate.php @@ -28,6 +28,7 @@ $RUNTIME_NOAPPS=true; $RUNTIME_NOSETUPFS=true; require_once('../../../lib/base.php'); +OC_JSON::checkAppEnabled('media'); if(defined("DEBUG") && DEBUG) {error_log($_GET['autoupdate']);} $autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true'); diff --git a/apps/media/index.php b/apps/media/index.php index d5273ae45c..419d4ae0bd 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -26,6 +26,7 @@ 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'); diff --git a/apps/media/server/xml.server.php b/apps/media/server/xml.server.php index 387c348004..44a16793bf 100644 --- a/apps/media/server/xml.server.php +++ b/apps/media/server/xml.server.php @@ -23,6 +23,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 1db982a350..68401db67a 100644 --- a/apps/media/tomahawk.php +++ b/apps/media/tomahawk.php @@ -24,6 +24,7 @@ $_POST=$_GET; //debug require_once('../../lib/base.php'); +OC_JSON::checkAppEnabled('media'); require_once('lib_collection.php'); $user=isset($_POST['user'])?$_POST['user']:''; diff --git a/apps/unhosted/compat.php b/apps/unhosted/compat.php index 00d6a7c2ee..a514018f71 100644 --- a/apps/unhosted/compat.php +++ b/apps/unhosted/compat.php @@ -30,6 +30,7 @@ $RUNTIME_NOSETUPFS = true; require_once('../../lib/base.php'); +OC_Util::checkAppEnabled('unhosted'); require_once('Sabre/autoload.php'); require_once('lib_unhosted.php'); require_once('oauth_ro_auth.php'); diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php index d90e0b7190..3cbc38491c 100644 --- a/apps/user_openid/user.php +++ b/apps/user_openid/user.php @@ -37,6 +37,7 @@ if($USERNAME=='' and isset($_SERVER['PHP_AUTH_USER'])){ $RUNTIME_NOAPPS=true; $RUNTIME_NOAPPS=false; require_once '../../lib/base.php'; +OC_Util::checkAppEnabled('user_openid'); if(!OC_User::userExists($USERNAME)){ if(defined("DEBUG") && DEBUG) {error_log($USERNAME.' doesn\'t exist');} diff --git a/lib/json.php b/lib/json.php index 6ab0404c08..cedf79fd7c 100644 --- a/lib/json.php +++ b/lib/json.php @@ -19,6 +19,17 @@ class OC_JSON{ } } + /** + * Check if the app is enabled, send json error msg if not + */ + public static function checkAppEnabled($app){ + if( !OC_App::isEnabled($app)){ + $l = new OC_L10N('core'); + self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled') ))); + exit(); + } + } + /** * Check if the user is logged in, send json error msg if not */ diff --git a/lib/util.php b/lib/util.php index c17f346c2b..26d718da94 100644 --- a/lib/util.php +++ b/lib/util.php @@ -276,6 +276,16 @@ class OC_Util { } + /** + * Check if the app is enabled, send json error msg if not + */ + public static function checkAppEnabled($app){ + if( !OC_App::isEnabled($app)){ + header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true)); + exit(); + } + } + /** * Check if the user is logged in, redirects to home if not */ diff --git a/settings/ajax/openid.php b/settings/ajax/openid.php index 4226ae740f..c4b119b448 100644 --- a/settings/ajax/openid.php +++ b/settings/ajax/openid.php @@ -6,6 +6,7 @@ require_once('../../lib/base.php'); $l=new OC_L10N('settings'); OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('user_openid'); // Get data if( isset( $_POST['identity'] ) ){