Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorBart Visscher <bart@thisnet.nl>2011-09-18 23:31:56 +0400
committerBart Visscher <bart@thisnet.nl>2011-09-18 23:31:56 +0400
commite990ef35426b7dde59ec74eb1568a8cfbd69f316 (patch)
tree9b4a276885378540812ce93c3cddcc73a00ba3b0 /files
parent8966ed5a004a9b830f093355170d381566d58554 (diff)
Move some common code to OC_Util
Created the following function: - checkLoggedIn - checkAdminUser - redirectToDefaultPage
Diffstat (limited to 'files')
-rw-r--r--files/admin.php7
-rw-r--r--files/ajax/download.php5
-rw-r--r--files/download.php5
-rw-r--r--files/index.php5
-rw-r--r--files/settings.php5
5 files changed, 5 insertions, 22 deletions
diff --git a/files/admin.php b/files/admin.php
index db47bc7c033..09237dfc1d5 100644
--- a/files/admin.php
+++ b/files/admin.php
@@ -25,12 +25,7 @@
// Init owncloud
require_once('../lib/base.php');
-
-// Check if we are a user
-if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( "Location: ".OC_Helper::linkTo( "files", "index.php" ));
- exit();
-}
+OC_User::checkAdminUser();
$htaccessWorking=(getenv('htaccessWorking')=='true');
if(isset($_POST['maxUploadSize'])){
diff --git a/files/ajax/download.php b/files/ajax/download.php
index 4c756f9b190..198069f3fa1 100644
--- a/files/ajax/download.php
+++ b/files/ajax/download.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();
$files = $_GET["files"];
$dir = $_GET["dir"];
diff --git a/files/download.php b/files/download.php
index ccd3eb43d8e..c8a2692d015 100644
--- a/files/download.php
+++ b/files/download.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();
$filename = $_GET["file"];
diff --git a/files/index.php b/files/index.php
index 3d62c3385fa..bba8dc4951e 100644
--- a/files/index.php
+++ b/files/index.php
@@ -26,10 +26,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();
// Load the files we need
OC_Util::addStyle( "files", "files" );
diff --git a/files/settings.php b/files/settings.php
index 2bbcb2acd3a..c47eb130095 100644
--- a/files/settings.php
+++ b/files/settings.php
@@ -26,10 +26,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();
// Load the files we need
OC_Util::addStyle( "files", "files" );