diff options
author | Bart Visscher <bart@thisnet.nl> | 2011-09-18 23:31:56 +0400 |
---|---|---|
committer | Bart Visscher <bart@thisnet.nl> | 2011-09-18 23:31:56 +0400 |
commit | e990ef35426b7dde59ec74eb1568a8cfbd69f316 (patch) | |
tree | 9b4a276885378540812ce93c3cddcc73a00ba3b0 /apps | |
parent | 8966ed5a004a9b830f093355170d381566d58554 (diff) |
Move some common code to OC_Util
Created the following function:
- checkLoggedIn
- checkAdminUser
- redirectToDefaultPage
Diffstat (limited to 'apps')
-rw-r--r-- | apps/bookmarks/addBm.php | 7 | ||||
-rw-r--r-- | apps/bookmarks/index.php | 7 | ||||
-rw-r--r-- | apps/calendar/export.php | 7 | ||||
-rw-r--r-- | apps/calendar/index.php | 5 | ||||
-rw-r--r-- | apps/contacts/index.php | 5 | ||||
-rw-r--r-- | apps/files_publiclink/admin.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/list.php | 7 | ||||
-rw-r--r-- | apps/media/index.php | 5 |
8 files changed, 12 insertions, 36 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php index 2dab33afb22..b62fcdfbeb0 100644 --- a/apps/bookmarks/addBm.php +++ b/apps/bookmarks/addBm.php @@ -24,10 +24,7 @@ require_once('../../lib/base.php'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( 'Location: '.OC_Helper::linkTo( '', 'index.php' )); - exit(); -} +OC_Util::checkLoggedIn(); require_once('bookmarksHelper.php'); @@ -45,4 +42,4 @@ $tmpl->assign('URL', htmlentities($metadata['url'])); $tmpl->assign('TITLE', htmlentities($metadata['title'])); $tmpl->assign('DESCRIPTION', htmlentities($metadata['description'])); -$tmpl->printPage();
\ No newline at end of file +$tmpl->printPage(); diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php index ba9f7cc0c61..45c9a52f557 100644 --- a/apps/bookmarks/index.php +++ b/apps/bookmarks/index.php @@ -24,10 +24,7 @@ require_once('../../lib/base.php'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( "Location: ".OC_Helper::linkTo( '', 'index.php' )); - exit(); -} +OC_Util::checkLoggedIn(); OC_App::setActiveNavigationEntry( 'bookmarks_index' ); @@ -36,4 +33,4 @@ OC_Util::addStyle('bookmarks', 'bookmarks'); $tmpl = new OC_Template( 'bookmarks', 'list', 'user' ); -$tmpl->printPage();
\ No newline at end of file +$tmpl->printPage(); diff --git a/apps/calendar/export.php b/apps/calendar/export.php index f03a5d23e68..d5ca5eeedad 100644 --- a/apps/calendar/export.php +++ b/apps/calendar/export.php @@ -18,14 +18,11 @@ * MA 02111-1307 USA * *************************************************/ require_once ("../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - header("Location: " . OC_HELPER::linkTo("", "index.php")); - exit; -} +OC_Util::checkLoggedIn(); $cal = $_GET["calid"]; $calendar = OC_Calendar_Calendar::findCalendar($cal); if($calendar["userid"] != OC_User::getUser()){ - header("Location: " . OC_HELPER::linkTo("", "index.php")); + header( 'Location: '.OC_Helper::linkTo('', 'index.php')); exit; } $calobjects = OC_Calendar_Object::all($cal); diff --git a/apps/calendar/index.php b/apps/calendar/index.php index c9fc9889d40..c93ea93bb6c 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -18,10 +18,7 @@ * MA 02111-1307 USA * *************************************************/ require_once ("../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - header("Location: " . OC_HELPER::linkTo("", "index.php")); - exit; -} +OC_Util::checkLoggedIn(); // Create default calendar ... $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); if( count($calendars) == 0){ diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 8013f19d31f..c9cf348dfd7 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -28,10 +28,7 @@ function contacts_namesort($a,$b){ require_once('../../lib/base.php'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( 'Location: '.OC_Helper::linkTo( '', 'index.php' )); - exit(); -} +OC_Util::checkLoggedIn(); // Check if the user has an addressbook $addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser()); diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php index 33d8f04a603..03d7a2ff6c5 100644 --- a/apps/files_publiclink/admin.php +++ b/apps/files_publiclink/admin.php @@ -28,10 +28,7 @@ require_once( 'lib_public.php' ); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( "Location: ".OC_Helper::linkTo( "index.php" )); - exit(); -} +OC_Util::checkLoggedIn(); OC_App::setActiveNavigationEntry( "files_publiclink_administration" ); diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index 0a11f438eb7..a5f99f38041 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -23,10 +23,7 @@ require_once('../../lib/base.php'); require_once('lib_share.php'); -if (!OC_User::isLoggedIn()){ - header( "Location: ".OC_HELPER::linkTo( "index.php" )); - exit(); -} +OC_Util::checkLoggedIn(); OC_App::setActiveNavigationEntry("files_sharing_list"); @@ -36,4 +33,4 @@ $tmpl = new OC_Template("files_sharing", "list", "user"); $tmpl->assign("shared_items", OC_Share::getMySharedItems()); $tmpl->printPage(); -?>
\ No newline at end of file +?> diff --git a/apps/media/index.php b/apps/media/index.php index fe724b45ddf..578ab7e3c34 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -25,10 +25,7 @@ require_once('../../lib/base.php'); // Check if we are a user -if( !OC_User::isLoggedIn()){ - header( "Location: ".OC_Helper::linkTo( '', 'index.php' )); - exit(); -} +OC_Util::checkLoggedIn(); require_once('lib_collection.php'); require_once('lib_scanner.php'); |