diff --git a/README b/README
old mode 100644
new mode 100755
diff --git a/config/config.php b/config/config.php
old mode 100755
new mode 100644
index 8470ad3f24b..425278171ef
--- a/config/config.php
+++ b/config/config.php
@@ -1,87 +1,11 @@
-
-
-
+
\ No newline at end of file
diff --git a/css/default.css b/css/default.php
similarity index 81%
rename from css/default.css
rename to css/default.php
index be4ffd0bc1f..7da6bb5c657 100755
--- a/css/default.css
+++ b/css/default.php
@@ -1,3 +1,7 @@
+
body {background-color: #F9F9F9;}
body.error {background-color: #F0F0F0;}
body,th,td,ul,li,a,div,p,pre {color:#333333; font-family:Verdana,"Bitstream Vera Sans",Arial,Helvetica,Sans,"Bitstream Vera Serif"; font-size:9.0pt;}
@@ -29,7 +33,7 @@ a#owncloud-logo {
display:block;
width:200px;
height:99px;
- background: transparent url(/img/owncloud-logo-small.png) no-repeat scroll 0 0;
+ background: transparent url(/img/owncloud-logo-small.png) no-repeat scroll 0 0;
}
a#owncloud-logo span {
@@ -37,10 +41,12 @@ a#owncloud-logo span {
}
.nametext a {color:#333333; font-size:8pt; font-weight:bold; text-decoration:none;}
+.errortext {color:#CC3333; font-size:9pt; font-weight:bold; text-decoration:none;}
.highlighttext {color:#333333; font-size:9pt; font-weight:bold; text-decoration:none;}
.datetext {color:#333333; font-size:7pt;}
.sizetext {color:#333333; font-size:7pt;}
.footer {color:#999999; text-align:center; font-size:9pt; margin-top:4em;}
+.footer a {color:#999999; text-decoration:none;}
.hint {color:#AAAAAA; text-align:center; font-size:8pt; margin-top:4em; margin-bottom:2em;}
.hint a{color:#AAAAAA; text-align:center; font-size:8pt;}
@@ -81,7 +87,7 @@ a#owncloud-logo span {
.navigationitem1 a{
text-decoration:none;
padding-right:15px;
- background: transparent url(/img/dots.png) no-repeat scroll center right;
+ background: transparent url(/img/dots.png) no-repeat scroll center right;
}
.navigationitem1 img {
diff --git a/inc/lib_base.php b/inc/lib_base.php
index 227e616bcd1..41f792d56b5 100755
--- a/inc/lib_base.php
+++ b/inc/lib_base.php
@@ -23,14 +23,39 @@
// set some stuff
+ob_start();
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('Europe/Berlin');
ini_set('arg_separator.output','&');
ini_set('session.cookie_httponly','1;');
session_start();
+// calculate the documentroot
+$DOCUMENTROOT=substr(__FILE__,0,-17);
+$SERVERROOT=$_SERVER['DOCUMENT_ROOT'];
+$count=strlen($SERVERROOT);
+$WEBROOT=substr($DOCUMENTROOT,$count);
+//echo($WEBROOT);
+
+// set the right include path
+set_include_path(get_include_path().PATH_SEPARATOR.$DOCUMENTROOT.PATH_SEPARATOR.$DOCUMENTROOT.'/inc'.PATH_SEPARATOR.$DOCUMENTROOT.'/config');
+
+// define default config values
+$CONFIG_ADMINLOGIN='';
+$CONFIG_ADMINPASSWORD='';
+$CONFIG_DATADIRECTORY='/var/data';
+$CONFIG_HTTPFORCESSL=false;
+$CONFIG_DATEFORMAT='j M Y G:i';
+$CONFIG_DBHOST='localhost';
+$CONFIG_DBNAME='owncloud';
+$CONFIG_DBUSER='';
+$CONFIG_DBPASSWORD='';
+
+// include the generated configfile
+@include_once('config.php');
+
// redirect to https site if configured
-if($CONFIG_HTTPFORCESSL){
+if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') {
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("Location: $url");
@@ -43,10 +68,19 @@ require_once('lib_files.php');
require_once('lib_log.php');
// load plugins
+$CONFIG_LOADPLUGINS='';
$plugins=explode(' ',$CONFIG_LOADPLUGINS);
if(isset($plugins[0]['url'])) foreach($plugins as $plugin) require_once('plugins/'.$plugin.'/lib_'.$plugin.'.php');
+// check if the server is correctly configured for ownCloud
+OC_UTIL::checkserver();
+
+// listen for login or logout actions
+OC_USER::logoutlisener();
+$loginresult=OC_USER::loginlisener();
+
+
/**
* Class for usermanagement
*
@@ -64,10 +98,12 @@ class OC_USER {
if($_POST['login']==$CONFIG_ADMINLOGIN and $_POST['password']==$CONFIG_ADMINPASSWORD){
$_SESSION['username']=$_POST['login'];
OC_LOG::event($_SESSION['username'],1,'');
+ return('');
}else{
- echo('error');
+ return('error');
}
}
+ return('');
}
/**
@@ -96,11 +132,26 @@ class OC_UTIL {
*/
static private $NAVIGATION = array();
+
+ /**
+ * check if the current server configuration is suitable for ownCloud
+ *
+ */
+ public static function checkserver(){
+ global $DOCUMENTROOT;
+ $f=@fopen($DOCUMENTROOT.'/config/config.php','a+');
+ if(!$f) die('Error: Config file (config/config.php) is not writable for the webserver.');
+ @fclose($f);
+
+ }
+
/**
* show the header of the web GUI
*
*/
public static function showheader(){
+ global $CONFIG_ADMINLOGIN;
+ global $WEBROOT;
require('templates/header.php');;
}
@@ -132,18 +183,18 @@ class OC_UTIL {
*
*/
public static function shownavigation(){
- global $CONFIG_WEBROOT;
+ global $WEBROOT;
echo('');
}
@@ -153,22 +204,94 @@ class OC_UTIL {
*
*/
public static function showloginform(){
+ global $loginresult;
require('templates/loginform.php');
}
+
/**
* show an icon for a filetype
*
*/
public static function showicon($filetype){
- if($filetype=='dir'){ echo(' | ');
+ global $WEBROOT;
+ if($filetype=='dir'){ echo(' | ');
}elseif($filetype=='foo'){ echo('foo | ');
- }else{ echo(' | ');
+ }else{ echo(' | ');
}
}
+ /**
+ * show the configform
+ *
+ */
+ public static function showconfigform(){
+ global $CONFIG_ADMINLOGIN;
+ global $CONFIG_ADMINPASSWORD;
+ global $CONFIG_DATADIRECTORY;
+ global $CONFIG_HTTPFORCESSL;
+ global $CONFIG_DATEFORMAT;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ require('templates/configform.php');
+ }
+
+ /**
+ * lisen for configuration changes and write it to the file
+ *
+ */
+ public static function writeconfiglisener(){
+ global $DOCUMENTROOT;
+ global $WEBROOT;
+ if(isset($_POST['set_config'])){
+
+ //checkdata
+ $error='';
+
+ if(!isset($_POST['adminlogin']) or empty($_POST['adminlogin'])) $error.='admin login not set
';
+ if(!isset($_POST['adminpassword']) or empty($_POST['adminpassword'])) $error.='admin password not set
';
+ if(!isset($_POST['adminpassword2']) or empty($_POST['adminpassword2'])) $error.='retype admin password not set
';
+ if(!isset($_POST['datadirectory']) or empty($_POST['datadirectory'])) $error.='data directory not set
';
+ if(!isset($_POST['dateformat']) or empty($_POST['dateformat'])) $error.='dteformat not set
';
+ if(!isset($_POST['dbhost']) or empty($_POST['dbhost'])) $error.='database host not set
';
+ if(!isset($_POST['dbname']) or empty($_POST['dbname'])) $error.='databasename not set
';
+ if(!isset($_POST['dbuser']) or empty($_POST['dbuser'])) $error.='database user not set
';
+ if(!isset($_POST['dbpassword']) or empty($_POST['dbpassword'])) $error.='database password not set
';
+ if(!isset($_POST['dbpassword2']) or empty($_POST['dbpassword2'])) $error.='retype database password not set
';
+ if($_POST['dbpassword']<>$_POST['dbpassword2'] ) $error.='database passwords are not the same
';
+ if($_POST['adminpassword']<>$_POST['adminpassword2'] ) $error.='admin passwords are not the same
';
+
+
+ if(empty($error)) {
+ //storedata
+ $config=' ';
+
+ $filename=$DOCUMENTROOT.'/config/config.php';
+ file_put_contents($filename,$config);
+ header("Location: ".$WEBROOT."/");
+
+ }
+ return($error);
+
+ }
+
+ }
+
}
+
/**
* Class for database access
*
@@ -186,12 +309,12 @@ class OC_DB {
global $CONFIG_DBHOST;
global $CONFIG_DBNAME;
global $CONFIG_DBUSER;
- global $CONFIG_DBPWD;
+ global $CONFIG_DBPASSWORD;
if(!isset($DBConnection)) {
- $DBConnection = @new mysqli($CONFIG_DBHOST, $CONFIG_DBUSER, $CONFIG_DBPWD,$CONFIG_DBNAME);
+ $DBConnection = @new mysqli($CONFIG_DBHOST, $CONFIG_DBUSER, $CONFIG_DBPASSWORD,$CONFIG_DBNAME);
if (mysqli_connect_errno()) {
@ob_end_clean();
- echo('
can not connect to database.');
+ echo('can not connect to database.');
exit();
}
}
diff --git a/inc/lib_files.php b/inc/lib_files.php
index ab0a5252982..8eb1fc9c125 100755
--- a/inc/lib_files.php
+++ b/inc/lib_files.php
@@ -37,6 +37,7 @@ class OC_FILES {
*/
public static function showbrowser($basedir,$dir){
global $CONFIG_DATEFORMAT;
+ global $WEBROOT;
$directory=$basedir.'/'.$dir;
@@ -49,11 +50,11 @@ class OC_FILES {
// breadcrumb
if(count($dirs)>1) {
echo('');
- echo('| home | ');
+ echo('home | ');
$currentdir='';
foreach($dirs as $d) {
$currentdir.='/'.$d.'';
- if($d<>'') echo(' '.$d.' | ');
+ if($d<>'') echo(' '.$d.' | ');
}
echo('
');
}
@@ -71,8 +72,8 @@ class OC_FILES {
echo('');
OC_UTIL::showicon($filetype);
- if($filetype=='dir') echo('| '.$file.' | ');
- if($filetype<>'dir') echo(''.$file.' | ');
+ if($filetype=='dir') echo(''.$file.' | ');
+ if($filetype<>'dir') echo(''.$file.' | ');
if($filetype<>'dir') echo(''.$stat['size'].' byte | '); else echo(' | ');
echo(''.date($CONFIG_DATEFORMAT,$stat['mtime']).' | ');
echo('
');
diff --git a/inc/templates/configform.php b/inc/templates/configform.php
new file mode 100644
index 00000000000..95043f9cfc8
--- /dev/null
+++ b/inc/templates/configform.php
@@ -0,0 +1,15 @@
+
diff --git a/inc/templates/footer.php b/inc/templates/footer.php
index 9771c797787..5ce34a95791 100755
--- a/inc/templates/footer.php
+++ b/inc/templates/footer.php
@@ -1,8 +1,6 @@