diff options
author | Jakob Sack <mail@jakobsack.de> | 2011-03-01 23:20:16 +0100 |
---|---|---|
committer | Jakob Sack <mail@jakobsack.de> | 2011-03-01 23:20:16 +0100 |
commit | 132695ceb1d7ab0e4bfbb141e9e9639111dd25b5 (patch) | |
tree | f53fabcefd89a1e5bbeda9a2c2d2fff6683139d4 /index.php | |
parent | 1fd39a52fa750878e7d70fba63c099f252095762 (diff) | |
download | nextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.tar.gz nextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.zip |
Start of the refactoring. Commit is quite big because I forgot to use git right from the beginning. Sorry.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/index.php b/index.php index 67e0b549302..23aa30dcb4e 100644 --- a/index.php +++ b/index.php @@ -3,40 +3,50 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -require_once('inc/lib_base.php'); - -if(isset($_GET['dir'])) $dir=$_GET['dir']; else $dir=''; - -if(isset($_GET['file'])) { - - OC_FILES::get($dir,$_GET['file']); -}else{ - - OC_UTIL::addscript('js/ajax.js'); - OC_UTIL::showheader(); - - OC_FILES::showbrowser($CONFIG_DATADIRECTORY,$dir); - - OC_UTIL::showfooter(); - +require_once( 'lib/base.php' ); +oc_require_once( 'appconfig.php' ); +oc_require_once( 'template.php' ); +if( OC_USER::isLoggedIn()){ + if( $_GET["logout"] ){ + OC_USER::logout(); + OC_TEMPLATE::printGuestPage( "", "logout" ); + } + else{ + header( "Location: ".OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" )); + exit(); + } +} +else{ + if( OC_USER::login( $_POST["user"], $_POST["password"] )){ + header( "Location: ".OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" )); + exit(); + } + else{ + $error = false; + // Say "bad login" in case the user wanted to login + if( $_POST["user"] && $_POST["password"] ){ + $error = true; + } + OC_TEMPLATE::printGuestPage( "", "login", array( "error" => $error )); + } } ?> |