summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin <robin@Amaya.(none)>2010-04-24 12:40:20 +0200
committerRobin <robin@Amaya.(none)>2010-04-24 12:40:20 +0200
commitd9e0d5decad7c52d2e78606d7be7570e675b0dbb (patch)
tree33c6aedb8545f5638c0c95d9611965d62c82738c
parent9be88c0080263b3ac4106b277520705415d74e3f (diff)
downloadnextcloud-server-d9e0d5decad7c52d2e78606d7be7570e675b0dbb.tar.gz
nextcloud-server-d9e0d5decad7c52d2e78606d7be7570e675b0dbb.zip
remove dependency on set_include_path because not all hosts support it
-rwxr-xr-xinc/lib_base.php117
-rwxr-xr-xinc/lib_config.php4
-rw-r--r--inc/lib_user.php18
-rw-r--r--inc/templates/adminform.php2
-rwxr-xr-xwebdav/owncloud.php2
5 files changed, 125 insertions, 18 deletions
diff --git a/inc/lib_base.php b/inc/lib_base.php
index 5a70db535db..5992004f537 100755
--- a/inc/lib_base.php
+++ b/inc/lib_base.php
@@ -40,7 +40,7 @@ if($WEBROOT{0}!=='/'){
}
// set the right include path
-set_include_path(get_include_path().PATH_SEPARATOR.$SERVERROOT.PATH_SEPARATOR.$SERVERROOT.'/inc'.PATH_SEPARATOR.$SERVERROOT.'/config');
+// set_include_path(get_include_path().PATH_SEPARATOR.$SERVERROOT.PATH_SEPARATOR.$SERVERROOT.'/inc'.PATH_SEPARATOR.$SERVERROOT.'/config');
// define default config values
$CONFIG_INSTALLED=false;
@@ -51,7 +51,7 @@ $CONFIG_DBNAME='owncloud';
$CONFIG_DBTYPE='sqlite';
// include the generated configfile
-@include_once('config.php');
+@oc_include_once('config.php');
// redirect to https site if configured
if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
@@ -63,10 +63,10 @@ if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){
}
// load core libs
-require_once('lib_files.php');
-require_once('lib_log.php');
-require_once('lib_config.php');
-require_once('lib_user.php');
+oc_require_once('lib_files.php');
+oc_require_once('lib_log.php');
+oc_require_once('lib_config.php');
+oc_require_once('lib_user.php');
if(OC_USER::isLoggedIn()){
//jail the user in a seperate data folder
@@ -131,7 +131,7 @@ class OC_UTIL {
public static function showheader(){
global $CONFIG_ADMINLOGIN;
global $WEBROOT;
- require('templates/header.php');;
+ oc_require('templates/header.php');;
}
/**
@@ -141,7 +141,7 @@ class OC_UTIL {
public static function showfooter(){
global $CONFIG_FOOTEROWNERNAME;
global $CONFIG_FOOTEROWNEREMAIL;
- require('templates/footer.php');;
+ oc_require('templates/footer.php');;
}
/**
@@ -188,7 +188,7 @@ class OC_UTIL {
*/
public static function showloginform(){
global $loginresult;
- require('templates/loginform.php');
+ oc_require('templates/loginform.php');
}
@@ -452,4 +452,101 @@ class OC_DB {
}
-?>
+//custom require/include functions because not all hosts allow us to set the include path
+function oc_require($file){
+ global $SERVERROOT;
+ global $DOCUMENTROOT;
+ global $WEBROOT;
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ global $CONFIG_DBTYPE;
+ global $CONFIG_DATADIRECTORY;
+ global $CONFIG_HTTPFORCESSL;
+ global $CONFIG_DATEFORMAT;
+ global $CONFIG_INSTALLED;
+ if(is_file($file)){
+ require($file);
+ }elseif(is_file($SERVERROOT.'/'.$file)){
+ require($SERVERROOT.'/'.$file);
+ }elseif(is_file($SERVERROOT.'/inc/'.$file)){
+ require($SERVERROOT.'/inc/'.$file);
+ }elseif(is_file($SERVERROOT.'/config/'.$file)){
+ require($SERVERROOT.'/config/'.$file);
+ }
+}
+
+function oc_require_once($file){
+ global $SERVERROOT;
+ global $DOCUMENTROOT;
+ global $WEBROOT;
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ global $CONFIG_DBTYPE;
+ global $CONFIG_DATADIRECTORY;
+ global $CONFIG_HTTPFORCESSL;
+ global $CONFIG_DATEFORMAT;
+ global $CONFIG_INSTALLED;
+ if(is_file($file)){
+ require_once($file);
+ }elseif(is_file($SERVERROOT.'/'.$file)){
+ require_once($SERVERROOT.'/'.$file);
+ }elseif(is_file($SERVERROOT.'/inc/'.$file)){
+ require_once($SERVERROOT.'/inc/'.$file);
+ }elseif(is_file($SERVERROOT.'/config/'.$file)){
+ require_once($SERVERROOT.'/config/'.$file);
+ }
+}
+
+function oc_include($file){
+ global $SERVERROOT;
+ global $DOCUMENTROOT;
+ global $WEBROOT;
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ global $CONFIG_DBTYPE;
+ global $CONFIG_DATADIRECTORY;
+ global $CONFIG_HTTPFORCESSL;
+ global $CONFIG_DATEFORMAT;
+ global $CONFIG_INSTALLED;
+ if(is_file($file)){
+ include($file);
+ }elseif(is_file($SERVERROOT.'/'.$file)){
+ include($SERVERROOT.'/'.$file);
+ }elseif(is_file($SERVERROOT.'/inc/'.$file)){
+ include($SERVERROOT.'/inc/'.$file);
+ }elseif(is_file($SERVERROOT.'/config/'.$file)){
+ include($SERVERROOT.'/config/'.$file);
+ }
+}
+
+function oc_include_once($file){
+ global $SERVERROOT;
+ global $DOCUMENTROOT;
+ global $WEBROOT;
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ global $CONFIG_DBTYPE;
+ global $CONFIG_DATADIRECTORY;
+ global $CONFIG_HTTPFORCESSL;
+ global $CONFIG_DATEFORMAT;
+ global $CONFIG_INSTALLED;
+ if(is_file($file)){
+ include_once($file);
+ }elseif(is_file($SERVERROOT.'/'.$file)){
+ include_once($SERVERROOT.'/'.$file);
+ }elseif(is_file($SERVERROOT.'/inc/'.$file)){
+ include_once($SERVERROOT.'/inc/'.$file);
+ }elseif(is_file($SERVERROOT.'/config/'.$file)){
+ include_once($SERVERROOT.'/config/'.$file);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/inc/lib_config.php b/inc/lib_config.php
index 70de1b96d7e..130731b79f9 100755
--- a/inc/lib_config.php
+++ b/inc/lib_config.php
@@ -11,7 +11,7 @@ class OC_CONFIG{
global $CONFIG_HTTPFORCESSL;
global $CONFIG_DATEFORMAT;
global $CONFIG_DBNAME;
- require('templates/configform.php');
+ oc_require('templates/configform.php');
}
/**
@@ -35,7 +35,7 @@ class OC_CONFIG{
}
}
if($allow){
- require('templates/adminform.php');
+ oc_require('templates/adminform.php');
}
}
diff --git a/inc/lib_user.php b/inc/lib_user.php
index 30dbdcd2fec..37e5f0bc217 100644
--- a/inc/lib_user.php
+++ b/inc/lib_user.php
@@ -21,6 +21,12 @@
*
*/
+if(!$CONFIG_INSTALLED){
+ $_SESSION['user_id']=false;
+ $_SESSION['username']='';
+ $_SESSION['username_clean']='';
+}
+
/**
* Class for usermanagement
*
@@ -174,10 +180,14 @@ class OC_USER {
public static function ingroup($username,$groupname){
$userid=OC_USER::getuserid($username);
$groupid=OC_USER::getgroupid($groupname);
- $query="SELECT user_group_id FROM `user_group` WHERE `group_id` = '$groupid ' AND `user_id` = '$userid 'LIMIT 1";
- $result=OC_DB::select($query);
- if(isset($result[0]) && isset($result[0]['user_group_id'])){
- return true;
+ if($groupid>0 and $userid>0){
+ $query="SELECT user_group_id FROM `user_group` WHERE `group_id` = '$groupid ' AND `user_id` = '$userid 'LIMIT 1";
+ $result=OC_DB::select($query);
+ if(isset($result[0]) && isset($result[0]['user_group_id'])){
+ return true;
+ }else{
+ return false;
+ }
}else{
return false;
}
diff --git a/inc/templates/adminform.php b/inc/templates/adminform.php
index 38d2b14a57e..c5e0bca61d3 100644
--- a/inc/templates/adminform.php
+++ b/inc/templates/adminform.php
@@ -49,7 +49,7 @@ function dbtypechange(){
<?php
}
if($FIRSTRUN){?>
-<tr><td>admin login:</td><td><input type="text" name="adminlogin" size="30" class="formstyle" value="<?php echo($CONFIG_ADMINLOGIN);?>"></input></td></tr>
+<tr><td>admin login:</td><td><input type="text" name="adminlogin" size="30" class="formstyle" value=""></input></td></tr>
<tr><td>admin password:</td><td><input type="password" name="adminpassword" size="30" class="formstyle"></input></td><td>(leave empty to keep current password)</td></tr>
<tr><td>retype admin password:</td><td><input type="password" name="adminpassword2" size="30" class="formstyle"></input></td></tr>
<?php
diff --git a/webdav/owncloud.php b/webdav/owncloud.php
index 6699526be28..ac831789a08 100755
--- a/webdav/owncloud.php
+++ b/webdav/owncloud.php
@@ -23,7 +23,7 @@
require_once('../inc/lib_base.php');
-require_once('HTTP/WebDAV/Server/Filesystem.php');
+oc_require_once('HTTP/WebDAV/Server/Filesystem.php');
ini_set('default_charset', 'UTF-8');