do not asume owncloud is installed in the root of the webserver

remotes/origin/stable
Robin 2010-03-15 15:41:53 +07:00
parent 6bb0022345
commit 35b9aabd01
3 changed files with 16 additions and 15 deletions

@ -57,7 +57,7 @@ class OC_USER {
* check if the login button is pressed and logg the user in * check if the login button is pressed and logg the user in
* *
*/ */
public static function loginlistener(){ public static function loginlisener(){
global $CONFIG_ADMINLOGIN; global $CONFIG_ADMINLOGIN;
global $CONFIG_ADMINPASSWORD; global $CONFIG_ADMINPASSWORD;
if(isset($_POST['loginbutton']) and isset($_POST['password']) and isset($_POST['login'])){ if(isset($_POST['loginbutton']) and isset($_POST['password']) and isset($_POST['login'])){
@ -74,7 +74,7 @@ class OC_USER {
* check if the logout button is pressed and logout the user * check if the logout button is pressed and logout the user
* *
*/ */
public static function logoutlistener(){ public static function logoutlisener(){
if(isset($_GET['logoutbutton'])){ if(isset($_GET['logoutbutton'])){
OC_LOG::event($_SESSION['username'],2,''); OC_LOG::event($_SESSION['username'],2,'');
if(isset($_SESSION['username'])) unset($_SESSION['username']); if(isset($_SESSION['username'])) unset($_SESSION['username']);
@ -132,17 +132,18 @@ class OC_UTIL {
* *
*/ */
public static function shownavigation(){ public static function shownavigation(){
global $CONFIG_WEBROOT;
echo('<table cellpadding="5" cellspacing="0" border="0"><tr>'); echo('<table cellpadding="5" cellspacing="0" border="0"><tr>');
echo('<td class="navigationitem1"><a href="/">'.$_SESSION['username'].'</a></td>'); echo('<td class="navigationitem1"><a href="'.$CONFIG_WEBROOT.'/">'.$_SESSION['username'].'</a> <img src="/img/dots.png" border="0"></td>');
if($_SERVER['SCRIPT_NAME']=='/index.php') echo('<td class="navigationitemselected"><a href="/">Files</a></td>'); else echo('<td class="navigationitem"><a href="/">Files</a></td>'); if($_SERVER['SCRIPT_NAME']=='/index.php') echo('<td class="navigationitemselected"><a href="'.$CONFIG_WEBROOT.'/">Files</a></td>'); else echo('<td class="navigationitem"><a href="'.$CONFIG_WEBROOT.'/">Files</a></td>');
foreach(OC_UTIL::$NAVIGATION as $NAVI) { foreach(OC_UTIL::$NAVIGATION as $NAVI) {
if($_SERVER['SCRIPT_NAME']==$NAVI['url']) echo('<td class="navigationitemselected"><a href="'.$NAVI['url'].'">'.$NAVI['name'].'</a></td>'); else echo('<td class="navigationitem"><a href="'.$NAVI['url'].'">'.$NAVI['name'].'</a></td>'); if($_SERVER['SCRIPT_NAME']==$NAVI['url']) echo('<td class="navigationitemselected"><a href="'.$NAVI['url'].'">'.$NAVI['name'].'</a></td>'); else echo('<td class="navigationitem"><a href="'.$NAVI['url'].'">'.$NAVI['name'].'</a></td>');
} }
if($_SERVER['SCRIPT_NAME']=='/log/index.php') echo('<td class="navigationitemselected"><a href="/log">Log</a></td>'); else echo('<td class="navigationitem"><a href="/log">Log</a></td>'); if($_SERVER['SCRIPT_NAME']=='/log/index.php') echo('<td class="navigationitemselected"><a href="'.$CONFIG_WEBROOT.'/log">Log</a></td>'); else echo('<td class="navigationitem"><a href="'.$CONFIG_WEBROOT.'/log">Log</a></td>');
if($_SERVER['SCRIPT_NAME']=='/settings/index.php') echo('<td class="navigationitemselected"><a href="/settings">Settings</a></td>'); else echo('<td class="navigationitem"><a href="/settings">Settings</a></td>'); if($_SERVER['SCRIPT_NAME']=='/settings/index.php') echo('<td class="navigationitemselected"><a href="'.$CONFIG_WEBROOT.'/settings">Settings</a></td>'); else echo('<td class="navigationitem"><a href="'.$CONFIG_WEBROOT.'/settings">Settings</a></td>');
echo('<td class="navigationitem"><a href="/?logoutbutton=1">Logout</a></td>'); echo('<td class="navigationitem"><a href="'.$CONFIG_WEBROOT.'?logoutbutton=1">Logout</a></td>');
echo('</tr></table>'); echo('</tr></table>');
} }
@ -152,7 +153,7 @@ class OC_UTIL {
* *
*/ */
public static function showloginform(){ public static function showloginform(){
require('templates/loginform.php');; require('templates/loginform.php');
} }
/** /**
@ -190,14 +191,14 @@ class OC_DB {
$DBConnection = @new mysqli($CONFIG_DBHOST, $CONFIG_DBUSER, $CONFIG_DBPWD,$CONFIG_DBNAME); $DBConnection = @new mysqli($CONFIG_DBHOST, $CONFIG_DBUSER, $CONFIG_DBPWD,$CONFIG_DBNAME);
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
@ob_end_clean(); @ob_end_clean();
echo('<html><head></head><body class="error"><div class="center"><b>can not connect to database.</div></body></html>'); echo('<html><head></head><body bgcolor="#F0F0F0"><br /><br /><center><b>can not connect to database.</center></body></html>');
exit(); exit();
} }
} }
$result = @$DBConnection->query($cmd); $result = @$DBConnection->query($cmd);
if (!$result) { if (!$result) {
$entry='<p>DB Error: "'.$DBConnection->error.'"</p>'; $entry='DB Error: "'.$DBConnection->error.'"<br />';
$entry.='<p>Offending command was: '.$cmd.'</p>'; $entry.='Offending command was: '.$cmd.'<br />';
echo($entry); echo($entry);
} }
return $result; return $result;

@ -1,4 +1,4 @@
<form method="post" enctype="multipart/form-data" action="/" > <form method="post" enctype="multipart/form-data" action="<?php echo $GLOBALS['CONFIG_WEBROOT'] ?>/" >
<table cellpadding="5" cellspacing="5" border="0" class="loginform"> <table cellpadding="5" cellspacing="5" border="0" class="loginform">
<tr><td>login:</td><td><input type="text" name="login" size="30" class="formstyle"></input></td></tr> <tr><td>login:</td><td><input type="text" name="login" size="30" class="formstyle"></input></td></tr>
<tr><td>password:</td><td><input type="password" name="password" size="30" class="formstyle"></input></td></tr> <tr><td>password:</td><td><input type="password" name="password" size="30" class="formstyle"></input></td></tr>

@ -32,14 +32,14 @@ if(isset($_GET['file'])) {
}else{ }else{
OC_USER::loginlistener(); OC_USER::loginlisener();
OC_USER::logoutlistener(); OC_USER::logoutlisener();
OC_UTIL::showheader(); OC_UTIL::showheader();
OC_FILES::showbrowser($CONFIG_DATADIRECTORY,$dir); OC_FILES::showbrowser($CONFIG_DATADIRECTORY,$dir);
echo('<p class="hint">Hint: Mount it via webdav like this: <a href="webdav://'.$_SERVER["HTTP_HOST"].'/webdav/owncloud.php">webdav://'.$_SERVER["HTTP_HOST"].'/webdav/owncloud.php</a></p>'); echo('<br /><br /><p class="hint">Hint: Mount it via webdav like this: <a href="webdav://'.$CONFIG_SITEROOT.'/webdav/owncloud.php">webdav://'.$CONFIG_SITEROOT.'/webdav/owncloud.php</a></p>');
OC_UTIL::showfooter(); OC_UTIL::showfooter();