From e990ef35426b7dde59ec74eb1568a8cfbd69f316 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 18 Sep 2011 21:31:56 +0200 Subject: Move some common code to OC_Util Created the following function: - checkLoggedIn - checkAdminUser - redirectToDefaultPage --- apps/calendar/export.php | 7 ++----- apps/calendar/index.php | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'apps/calendar') 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){ -- cgit v1.2.3