diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-04-16 10:12:53 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-04-16 10:12:53 +0200 |
commit | 232654cb606af856d24c4b01353f18ac4a48e9bc (patch) | |
tree | 6b75128d02cc082e8a8bbcc26cfd921391562e17 /lib | |
parent | 3d89b2caa41bc99f48b8377c87e9c653f467631d (diff) | |
download | nextcloud-server-232654cb606af856d24c4b01353f18ac4a48e9bc.tar.gz nextcloud-server-232654cb606af856d24c4b01353f18ac4a48e9bc.zip |
get rid of the oc_require and friends
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Group/database.php | 9 | ||||
-rw-r--r-- | lib/HTTP/WebDAV/Server/Filesystem.php | 4 | ||||
-rw-r--r-- | lib/User/database.php | 2 | ||||
-rw-r--r-- | lib/app.php | 2 | ||||
-rw-r--r-- | lib/base.php | 154 | ||||
-rw-r--r-- | lib/files.php | 2 | ||||
-rw-r--r-- | lib/group.php | 2 | ||||
-rw-r--r-- | lib/user.php | 2 |
8 files changed, 32 insertions, 145 deletions
diff --git a/lib/Group/database.php b/lib/Group/database.php index c10f6db80e0..bdf5bbc5c55 100644 --- a/lib/Group/database.php +++ b/lib/Group/database.php @@ -37,7 +37,7 @@ * */ -oc_require_once( 'Group/backend.php' ); +require_once( 'Group/backend.php' ); /** * Class for group management in a SQL Database (e.g. MySQL, SQLite) @@ -75,7 +75,12 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { public static function inGroup( $username, $groupName ){ $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` = ?" ); $result = $query->execute( array( $groupName, $username )); - + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"<br />'; + $entry .= 'Offending command was: '.$result->getDebugInfo().'<br />'; + error_log( $entry ); + die( $entry ); + } return $result->numRows() > 0 ? true : false; } diff --git a/lib/HTTP/WebDAV/Server/Filesystem.php b/lib/HTTP/WebDAV/Server/Filesystem.php index 0615c600e07..c0be27d7c05 100644 --- a/lib/HTTP/WebDAV/Server/Filesystem.php +++ b/lib/HTTP/WebDAV/Server/Filesystem.php @@ -34,8 +34,8 @@ --- modified for ownCloud --- */ require_once("lib/base.php"); - oc_require_once("HTTP/WebDAV/Server.php"); - oc_require_once("System.php"); + require_once("HTTP/WebDAV/Server.php"); + require_once("System.php"); /** * Filesystem access using WebDAV diff --git a/lib/User/database.php b/lib/User/database.php index 45aab061e39..d521cc23c42 100644 --- a/lib/User/database.php +++ b/lib/User/database.php @@ -33,7 +33,7 @@ * */ -oc_require_once('User/backend.php'); +require_once('User/backend.php'); /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) diff --git a/lib/app.php b/lib/app.php index ecab723a6ad..ddbad4ee2ec 100644 --- a/lib/app.php +++ b/lib/app.php @@ -54,7 +54,7 @@ class OC_APP{ while( false !== ( $filename = readdir( $dir ))){ if( substr( $filename, 0, 1 ) != '.' ){ if( file_exists( "$SERVERROOT/$filename/appinfo/app.php" )){ - oc_require( "$filename/appinfo/app.php" ); + require( "$filename/appinfo/app.php" ); } } } diff --git a/lib/base.php b/lib/base.php index 054ba2415e0..033052a3c3b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -45,7 +45,7 @@ if($WEBROOT!='' and $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($SERVERROOT.'/lib'.PATH_SEPARATOR.$SERVERROOT.'/config'.PATH_SEPARATOR.$SERVERROOT.'/3dparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.$SERVERROOT); // define runtime variables - unless this already has been done if( !isset( $RUNTIME_NOSETUPFS )){ @@ -66,7 +66,6 @@ $CONFIG_FILESYSTEM=array(); // include the generated configfile @include_once($SERVERROOT.'/config/config.php'); - $CONFIG_DATADIRECTORY_ROOT=$CONFIG_DATADIRECTORY;// store this in a seperate variable so we can change the data directory to jail users. // redirect to https site if configured if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){ @@ -78,20 +77,20 @@ if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){ } // load core libs -oc_require_once('helper.php'); -oc_require_once('app.php'); -oc_require_once('files.php'); -oc_require_once('filesystem.php'); -oc_require_once('filestorage.php'); -oc_require_once('fileobserver.php'); -oc_require_once('log.php'); -oc_require_once('config.php'); -oc_require_once('user.php'); -oc_require_once('group.php'); -oc_require_once('ocs.php'); -oc_require_once('connect.php'); -oc_require_once('remotestorage.php'); -oc_require_once('plugin.php'); +require_once('helper.php'); +require_once('app.php'); +require_once('files.php'); +require_once('filesystem.php'); +require_once('filestorage.php'); +require_once('fileobserver.php'); +require_once('log.php'); +require_once('config.php'); +require_once('user.php'); +require_once('group.php'); +require_once('ocs.php'); +require_once('connect.php'); +require_once('remotestorage.php'); +require_once('plugin.php'); OC_PLUGIN::loadPlugins( "" ); @@ -113,13 +112,11 @@ OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" ); OC_UTIL::addScript( "js" ); OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" ); OC_UTIL::addStyle( "styles" ); - // Load Apps OC_APP::loadApps(); // check if the server is correctly configured for ownCloud OC_UTIL::checkserver(); - /** * Class for utility functions * @@ -380,8 +377,8 @@ class OC_DB { // do nothing if the connection already has been established if(!self::$DBConnection){ - // Require MDB2.php (TODO: why here not in head of file?) - @oc_require_once('MDB2.php'); + // Require MDB2.php (not required in the head of the file so we only load it when needed) + require_once('MDB2.php'); // Prepare options array $options = array( @@ -610,7 +607,7 @@ class OC_DB { // Connect if this did not happen before if(!self::$schema){ - @oc_require_once('MDB2/Schema.php'); + require_once('MDB2/Schema.php'); self::$schema=&MDB2_Schema::factory(self::$DBConnection); } @@ -646,120 +643,6 @@ 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)){ - return require($file); - } - elseif(is_file($SERVERROOT.'/'.$file)){ - return require($SERVERROOT.'/'.$file); - } - elseif(is_file($SERVERROOT.'/lib/'.$file)){ - return require($SERVERROOT.'/lib/'.$file); - } - elseif(is_file($SERVERROOT.'/3dparty/'.$file)){ - return require($SERVERROOT.'/3dparty/'.$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)){ - return require_once($file); - } - elseif(is_file($SERVERROOT.'/'.$file)){ - return require_once($SERVERROOT.'/'.$file); - } - elseif(is_file($SERVERROOT.'/lib/'.$file)){ - return require_once($SERVERROOT.'/lib/'.$file); - } - elseif(is_file($SERVERROOT.'/3dparty/'.$file)){ - return require_once($SERVERROOT.'/3dparty/'.$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)){ - return include($file); - } - elseif(is_file($SERVERROOT.'/'.$file)){ - return include($SERVERROOT.'/'.$file); - } - elseif(is_file($SERVERROOT.'/lib/'.$file)){ - return include($SERVERROOT.'/lib/'.$file); - } - elseif(is_file($SERVERROOT.'/3dparty/'.$file)){ - return include($SERVERROOT.'/3dparty/'.$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)){ - return include_once($file); - } - elseif(is_file($SERVERROOT.'/'.$file)){ - return include_once($SERVERROOT.'/'.$file); - } - elseif(is_file($SERVERROOT.'/lib/'.$file)){ - return include_once($SERVERROOT.'/lib/'.$file); - } - elseif(is_file($SERVERROOT.'/3dparty/'.$file)){ - return include_once($SERVERROOT.'/3dparty/'.$file); - } -} - function chmodr($path, $filemode) { // echo "$path<br/>"; if (!is_dir($path)) @@ -782,5 +665,4 @@ function chmodr($path, $filemode) { else return FALSE; } - ?> diff --git a/lib/files.php b/lib/files.php index bf629a59d44..a1f983b6b2f 100644 --- a/lib/files.php +++ b/lib/files.php @@ -21,7 +21,7 @@ * */ -oc_require_once("log.php"); +require_once("log.php"); /** diff --git a/lib/group.php b/lib/group.php index 06c91bc2436..18e34c72773 100644 --- a/lib/group.php +++ b/lib/group.php @@ -68,7 +68,7 @@ class OC_GROUP { case 'database': case 'mysql': case 'sqlite': - oc_require_once('Group/database.php'); + require_once('Group/database.php'); self::$_backend = new OC_GROUP_DATABASE(); break; default: diff --git a/lib/user.php b/lib/user.php index 645bda4ed5d..9841b8ef276 100644 --- a/lib/user.php +++ b/lib/user.php @@ -74,7 +74,7 @@ class OC_USER { case 'database': case 'mysql': case 'sqlite': - oc_require_once('User/database.php'); + require_once('User/database.php'); self::$_backend = new OC_USER_DATABASE(); break; default: |