diff options
author | Bart Visscher <bart@thisnet.nl> | 2011-09-18 21:31:56 +0200 |
---|---|---|
committer | Bart Visscher <bart@thisnet.nl> | 2011-09-18 21:31:56 +0200 |
commit | e990ef35426b7dde59ec74eb1568a8cfbd69f316 (patch) | |
tree | 9b4a276885378540812ce93c3cddcc73a00ba3b0 /index.php | |
parent | 8966ed5a004a9b830f093355170d381566d58554 (diff) | |
download | nextcloud-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 'index.php')
-rw-r--r-- | index.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/index.php b/index.php index 46105a106fb..23bc4fb7764 100644 --- a/index.php +++ b/index.php @@ -48,8 +48,7 @@ elseif(OC_User::isLoggedIn()) { exit(); } else { - header("Location: ".OC::$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); - exit(); + OC_Util::redirectToDefaultPage(); } } @@ -61,7 +60,7 @@ elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) { if(OC_User::userExists($_COOKIE['oc_username']) && OC_Preferences::getValue($_COOKIE['oc_username'], "login", "token") == $_COOKIE['oc_token']) { OC_User::setUserId($_COOKIE['oc_username']); - header("Location: ". OC::$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); + OC_Util::redirectToDefaultPage(); } else { OC_Template::printGuestPage("", "login", array("error" => true)); @@ -72,7 +71,6 @@ elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) { elseif(isset($_POST["user"]) && isset($_POST['password'])) { OC_App::loadApps(); if(OC_User::login($_POST["user"], $_POST["password"])) { - header("Location: ".OC::$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); if(!empty($_POST["remember_login"])){ error_log("Setting remember login to cookie"); $token = md5($_POST["user"].time()); @@ -82,7 +80,7 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) { else { OC_User::unsetMagicInCookie(); } - exit(); + OC_Util::redirectToDefaultPage(); } else { if(isset($_COOKIE["oc_username"])){ |