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 2d1bc66a296..565c4b3db97 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 b62fcdfbeb0..a2a39134eab 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 9b0beb388a0..0dc83d9014d 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 afe60f7d1bf..4aef86e771b 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 5125f9ce898..b427a175e5f 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 4583ef204b4..ca797315ef4 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 f5f7c20c6a0..e6fdfe043e1 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 de3480d6c3a..8e9bda0bc20 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 45c9a52f557..50fea3fddbd 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 38f727e9488..89239f21759 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 d19a11585a0..b396ff4945b 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 44ff22906f1..0935a4c42ad 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 7d80333b258..82176d4368a 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 30607b92e6f..e8ffe0d0598 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 a6750267bd2..9e3c7dd87dd 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 8f798d1bbf2..7ff869f8885 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 7187e05d56f..3abf4de98b3 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 e2d32d03d3d..34d6c657cec 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 7fa4f87cd31..c59cb873fdc 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 ffcffb8afd7..199f95fb463 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 9ac3b0aaff6..1a696cf7780 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 7099ea718e9..9bab2cd4846 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 2b82bc8e4bc..c726a11471d 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 d53515d0deb..5cf48d50ea1 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 83f6a5ab51d..b581274398d 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 a6fdaba1d2f..feb4755a3aa 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 39f961d1bb9..1e4d724b307 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 cfae3327f56..ee95513732d 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 5a37f77f858..0b218c6298f 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 13be33eb5a9..c13217ef2e2 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 c69638320ed..a0a6b8c3ea8 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 40b765cf845..0a3a3c293a0 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 47d88a771e6..0e76de61afb 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 b4fc2162d90..18e00872473 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 58567392d7c..2f534f0fe2d 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 0d01b37d8ef..f87cd05359b 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 0b30a8e68ec..6188f4773c3 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 b17a9395355..df7c858b1a0 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 c9cf348dfd7..7e8eb8e6951 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 7ba2002b13d..1bdfbe3a27f 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 e7bda0f6144..8d51c146523 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 8e0bac0b06f..7ee8f0e57bd 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 e672cf02403..6a2b45b3a7d 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 b9230d257b7..a19a85cfda3 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 a3158cf72d6..21516c3d091 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 33918bf9e7d..083f48e1127 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 a5f99f38041..721620dc922 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 84ee6334463..29f61a2207f 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 ad103d1c39b..ff0923ca032 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 d5273ae45cb..419d4ae0bde 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 387c3480047..44a16793bf2 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 1db982a3504..68401db67ae 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 00d6a7c2eeb..a514018f71a 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 d90e0b71900..3cbc38491ca 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 6ab0404c081..cedf79fd7c3 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 c17f346c2be..26d718da944 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 4226ae740f0..c4b119b448d 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'] ) ){ -- 2.39.5