Move some common code to OC_Util

Created the following function:
 - checkLoggedIn
 - checkAdminUser
 - redirectToDefaultPage
master
Bart Visscher 2011-09-18 21:31:56 +02:00
parent 406ca41f33
commit a8574ea7bc
2 changed files with 3 additions and 9 deletions

View File

@ -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);

View File

@ -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){