summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorBart Visscher <bart@thisnet.nl>2011-09-18 21:31:56 +0200
committerBart Visscher <bart@thisnet.nl>2011-09-18 21:31:56 +0200
commite990ef35426b7dde59ec74eb1568a8cfbd69f316 (patch)
tree9b4a276885378540812ce93c3cddcc73a00ba3b0 /settings
parent8966ed5a004a9b830f093355170d381566d58554 (diff)
downloadnextcloud-server-e990ef35426b7dde59ec74eb1568a8cfbd69f316.tar.gz
nextcloud-server-e990ef35426b7dde59ec74eb1568a8cfbd69f316.zip
Move some common code to OC_Util
Created the following function: - checkLoggedIn - checkAdminUser - redirectToDefaultPage
Diffstat (limited to 'settings')
-rw-r--r--settings/admin.php11
-rw-r--r--settings/apps.php5
-rw-r--r--settings/help.php5
-rw-r--r--settings/personal.php5
-rw-r--r--settings/settings.php7
-rw-r--r--settings/users.php5
6 files changed, 8 insertions, 30 deletions
diff --git a/settings/admin.php b/settings/admin.php
index 15559a150e5..81ed6aa9516 100644
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -6,14 +6,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn()){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
-if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( "Location: ".OC_Helper::linkTo( '', "index.php" ));
- exit();
-}
+OC_Util::checkAdminUser();
OC_Util::addStyle( "settings", "settings" );
OC_App::setActiveNavigationEntry( "admin" );
@@ -24,4 +17,4 @@ $tmpl->assign('forms',array());
foreach($forms as $form){
$tmpl->append('forms',$form);
}
-$tmpl->printPage(); \ No newline at end of file
+$tmpl->printPage();
diff --git a/settings/apps.php b/settings/apps.php
index 337a52fd416..672cb18775e 100644
--- a/settings/apps.php
+++ b/settings/apps.php
@@ -22,10 +22,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
+OC_Util::checkAdminUser();
// Load the files we need
OC_Util::addStyle( "settings", "settings" );
diff --git a/settings/help.php b/settings/help.php
index f8a2f9b8bf9..48fcec32782 100644
--- a/settings/help.php
+++ b/settings/help.php
@@ -6,10 +6,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn()){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
+OC_Util::checkLoggedIn();
// Load the files we need
diff --git a/settings/personal.php b/settings/personal.php
index e6d2d44db76..aea997aff22 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -6,10 +6,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn()){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
+OC_Util::checkLoggedIn();
// Highlight navigation entry
OC_Util::addScript( "settings", "personal" );
diff --git a/settings/settings.php b/settings/settings.php
index 724cf63aaf7..b08cb08db09 100644
--- a/settings/settings.php
+++ b/settings/settings.php
@@ -6,10 +6,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn()){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
+OC_Util::checkLoggedIn();
OC_Util::addStyle( "settings", "settings" );
OC_App::setActiveNavigationEntry( "settings" );
@@ -20,4 +17,4 @@ $tmpl->assign('forms',array());
foreach($forms as $form){
$tmpl->append('forms',$form);
}
-$tmpl->printPage(); \ No newline at end of file
+$tmpl->printPage();
diff --git a/settings/users.php b/settings/users.php
index 5aae4ce43ef..9ca2cb369f7 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -6,10 +6,7 @@
*/
require_once('../lib/base.php');
-if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( "Location: ".OC_Helper::linkTo( "", "index.php" ));
- exit();
-}
+OC_Util::checkAdminUser();
// We have some javascript foo!
OC_Util::addScript( 'settings', 'users' );