summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-04-16 10:26:40 +0200
committerJakob Sack <kde@jakobsack.de>2011-04-16 10:26:40 +0200
commite8f68480959031b9e97bc23efca9ac5cf566a009 (patch)
treeedefc5671a114df8240486a6dae2d43535856b11
parent683677b4f9c5fcf3f7fed6db1881544898f816cc (diff)
parent69289bf9438f11df8d75fd034776983b997aa7b0 (diff)
downloadnextcloud-server-e8f68480959031b9e97bc23efca9ac5cf566a009.tar.gz
nextcloud-server-e8f68480959031b9e97bc23efca9ac5cf566a009.zip
Merge branch 'refactoring' of git://anongit.kde.org/owncloud into refactoring
-rw-r--r--3dparty/Console/Getopt.php2
-rw-r--r--3dparty/HTTP/WebDAV/Server.php6
-rw-r--r--3dparty/MDB2.php6
-rw-r--r--3dparty/MDB2/Driver/Datatype/Common.php2
-rw-r--r--3dparty/MDB2/Driver/Datatype/mysql.php2
-rw-r--r--3dparty/MDB2/Driver/Datatype/pgsql.php2
-rw-r--r--3dparty/MDB2/Driver/Datatype/sqlite.php2
-rw-r--r--3dparty/MDB2/Driver/Function/mysql.php2
-rw-r--r--3dparty/MDB2/Driver/Function/pgsql.php2
-rw-r--r--3dparty/MDB2/Driver/Function/sqlite.php2
-rw-r--r--3dparty/MDB2/Driver/Manager/mysql.php2
-rw-r--r--3dparty/MDB2/Driver/Manager/pgsql.php2
-rw-r--r--3dparty/MDB2/Driver/Manager/sqlite.php2
-rw-r--r--3dparty/MDB2/Driver/Reverse/mysql.php2
-rw-r--r--3dparty/MDB2/Driver/Reverse/pgsql.php2
-rw-r--r--3dparty/MDB2/Driver/Reverse/sqlite.php2
-rw-r--r--3dparty/MDB2/LOB.php2
-rw-r--r--3dparty/MDB2/Schema/Parser.php4
-rw-r--r--3dparty/System.php4
-rw-r--r--3dparty/XML/Parser.php2
-rw-r--r--admin/index.php2
-rw-r--r--admin/plugins.php2
-rw-r--r--admin/system.php2
-rw-r--r--admin/users.php2
-rw-r--r--docs/skeleton/admin.php2
-rw-r--r--docs/skeleton/index.php2
-rw-r--r--files/admin.php2
-rw-r--r--files/download.php2
-rw-r--r--files/index.php2
-rw-r--r--files/settings.php2
-rw-r--r--files/webdav.php2
-rw-r--r--index.php4
-rw-r--r--lib/Group/database.php9
-rw-r--r--lib/HTTP/WebDAV/Server/Filesystem.php4
-rw-r--r--lib/User/database.php2
-rw-r--r--lib/app.php4
-rw-r--r--lib/base.php470
-rw-r--r--lib/database.php316
-rw-r--r--lib/files.php2
-rw-r--r--lib/group.php2
-rw-r--r--lib/helper.php29
-rw-r--r--lib/user.php2
-rw-r--r--log/index.php2
-rw-r--r--plugins/ldap/lib_ldap.php2
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss4
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss11
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss41
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss12
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss13
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss27
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss3
-rw-r--r--plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss3
-rw-r--r--settings/index.php2
53 files changed, 495 insertions, 543 deletions
diff --git a/3dparty/Console/Getopt.php b/3dparty/Console/Getopt.php
index 6f2f9c73079..aec980b34d5 100644
--- a/3dparty/Console/Getopt.php
+++ b/3dparty/Console/Getopt.php
@@ -18,7 +18,7 @@
//
// $Id: Getopt.php,v 1.21.4.7 2003/12/05 21:57:01 andrei Exp $
-oc_require_once( 'PEAR.php');
+require_once( 'PEAR.php');
/**
* Command-line options parsing class.
diff --git a/3dparty/HTTP/WebDAV/Server.php b/3dparty/HTTP/WebDAV/Server.php
index c407d74c89f..ceed7214e93 100644
--- a/3dparty/HTTP/WebDAV/Server.php
+++ b/3dparty/HTTP/WebDAV/Server.php
@@ -33,9 +33,9 @@
+----------------------------------------------------------------------+
*/
-oc_require_once("HTTP/WebDAV/Tools/_parse_propfind.php");
-oc_require_once("HTTP/WebDAV/Tools/_parse_proppatch.php");
-oc_require_once("HTTP/WebDAV/Tools/_parse_lockinfo.php");
+require_once("HTTP/WebDAV/Tools/_parse_propfind.php");
+require_once("HTTP/WebDAV/Tools/_parse_proppatch.php");
+require_once("HTTP/WebDAV/Tools/_parse_lockinfo.php");
/**
diff --git a/3dparty/MDB2.php b/3dparty/MDB2.php
index faf405b4112..c07545588dc 100644
--- a/3dparty/MDB2.php
+++ b/3dparty/MDB2.php
@@ -52,7 +52,7 @@
* @author Lukas Smith <smith@pooteeweet.org>
*/
-oc_require_once('PEAR.php');
+require_once('PEAR.php');
// {{{ Error constants
@@ -330,9 +330,9 @@ class MDB2
if (!MDB2::classExists($class_name)) {
$file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
if ($debug) {
- $include = oc_include_once($file_name);
+ $include = include_once($file_name);
} else {
- $include = oc_include_once($file_name);
+ $include = include_once($file_name);
}
if (!$include) {
if (!MDB2::fileExists($file_name)) {
diff --git a/3dparty/MDB2/Driver/Datatype/Common.php b/3dparty/MDB2/Driver/Datatype/Common.php
index 750dbb24772..6ef557ad371 100644
--- a/3dparty/MDB2/Driver/Datatype/Common.php
+++ b/3dparty/MDB2/Driver/Datatype/Common.php
@@ -44,7 +44,7 @@
//
// $Id: Common.php,v 1.139 2008/12/04 11:50:42 afz Exp $
-oc_require_once('MDB2/LOB.php');
+require_once('MDB2/LOB.php');
/**
* @package MDB2
diff --git a/3dparty/MDB2/Driver/Datatype/mysql.php b/3dparty/MDB2/Driver/Datatype/mysql.php
index 944248f57c3..490dacdcc7d 100644
--- a/3dparty/MDB2/Driver/Datatype/mysql.php
+++ b/3dparty/MDB2/Driver/Datatype/mysql.php
@@ -46,7 +46,7 @@
// $Id: mysql.php,v 1.65 2008/02/22 19:23:49 quipo Exp $
//
-oc_require_once('MDB2/Driver/Datatype/Common.php');
+require_once('MDB2/Driver/Datatype/Common.php');
/**
* MDB2 MySQL driver
diff --git a/3dparty/MDB2/Driver/Datatype/pgsql.php b/3dparty/MDB2/Driver/Datatype/pgsql.php
index fe18729c84f..e0bb31bccf1 100644
--- a/3dparty/MDB2/Driver/Datatype/pgsql.php
+++ b/3dparty/MDB2/Driver/Datatype/pgsql.php
@@ -44,7 +44,7 @@
//
// $Id: pgsql.php,v 1.93 2008/08/28 20:32:57 afz Exp $
-oc_require_once('MDB2/Driver/Datatype/Common.php');
+require_once('MDB2/Driver/Datatype/Common.php');
/**
* MDB2 PostGreSQL driver
diff --git a/3dparty/MDB2/Driver/Datatype/sqlite.php b/3dparty/MDB2/Driver/Datatype/sqlite.php
index 533d0e9510b..572ccc38e71 100644
--- a/3dparty/MDB2/Driver/Datatype/sqlite.php
+++ b/3dparty/MDB2/Driver/Datatype/sqlite.php
@@ -46,7 +46,7 @@
// $Id: sqlite.php,v 1.67 2008/02/22 19:58:06 quipo Exp $
//
-oc_require_once('MDB2/Driver/Datatype/Common.php');
+require_once('MDB2/Driver/Datatype/Common.php');
/**
* MDB2 SQLite driver
diff --git a/3dparty/MDB2/Driver/Function/mysql.php b/3dparty/MDB2/Driver/Function/mysql.php
index aff531c9f3a..44183c3aa06 100644
--- a/3dparty/MDB2/Driver/Function/mysql.php
+++ b/3dparty/MDB2/Driver/Function/mysql.php
@@ -45,7 +45,7 @@
// $Id: mysql.php,v 1.12 2008/02/17 18:54:08 quipo Exp $
//
-oc_require_once('MDB2/Driver/Function/Common.php');
+require_once('MDB2/Driver/Function/Common.php');
/**
* MDB2 MySQL driver for the function modules
diff --git a/3dparty/MDB2/Driver/Function/pgsql.php b/3dparty/MDB2/Driver/Function/pgsql.php
index cb47ea57d9f..173bfc91494 100644
--- a/3dparty/MDB2/Driver/Function/pgsql.php
+++ b/3dparty/MDB2/Driver/Function/pgsql.php
@@ -44,7 +44,7 @@
//
// $Id: pgsql.php,v 1.11 2008/11/09 19:46:50 quipo Exp $
-oc_require_once('MDB2/Driver/Function/Common.php');
+require_once('MDB2/Driver/Function/Common.php');
/**
* MDB2 MySQL driver for the function modules
diff --git a/3dparty/MDB2/Driver/Function/sqlite.php b/3dparty/MDB2/Driver/Function/sqlite.php
index f5499599dd5..8a5b7ec8fad 100644
--- a/3dparty/MDB2/Driver/Function/sqlite.php
+++ b/3dparty/MDB2/Driver/Function/sqlite.php
@@ -45,7 +45,7 @@
// $Id: sqlite.php,v 1.10 2008/02/17 18:54:08 quipo Exp $
//
-oc_require_once('MDB2/Driver/Function/Common.php');
+require_once('MDB2/Driver/Function/Common.php');
/**
* MDB2 SQLite driver for the function modules
diff --git a/3dparty/MDB2/Driver/Manager/mysql.php b/3dparty/MDB2/Driver/Manager/mysql.php
index 7bd6a3623a3..29d644a957a 100644
--- a/3dparty/MDB2/Driver/Manager/mysql.php
+++ b/3dparty/MDB2/Driver/Manager/mysql.php
@@ -45,7 +45,7 @@
// $Id: mysql.php,v 1.113 2008/11/23 20:30:29 quipo Exp $
//
-oc_require_once('MDB2/Driver/Manager/Common.php');
+require_once('MDB2/Driver/Manager/Common.php');
/**
* MDB2 MySQL driver for the management modules
diff --git a/3dparty/MDB2/Driver/Manager/pgsql.php b/3dparty/MDB2/Driver/Manager/pgsql.php
index 1a7e851897c..490f697aa5b 100644
--- a/3dparty/MDB2/Driver/Manager/pgsql.php
+++ b/3dparty/MDB2/Driver/Manager/pgsql.php
@@ -44,7 +44,7 @@
//
// $Id: pgsql.php,v 1.87 2008/11/29 14:09:59 afz Exp $
-oc_require_once('MDB2/Driver/Manager/Common.php');
+require_once('MDB2/Driver/Manager/Common.php');
/**
* MDB2 MySQL driver for the management modules
diff --git a/3dparty/MDB2/Driver/Manager/sqlite.php b/3dparty/MDB2/Driver/Manager/sqlite.php
index 85751d39a3f..e985298c2c3 100644
--- a/3dparty/MDB2/Driver/Manager/sqlite.php
+++ b/3dparty/MDB2/Driver/Manager/sqlite.php
@@ -46,7 +46,7 @@
// $Id: sqlite.php,v 1.76 2008/05/31 11:48:48 quipo Exp $
//
-oc_require_once('MDB2/Driver/Manager/Common.php');
+require_once('MDB2/Driver/Manager/Common.php');
/**
* MDB2 SQLite driver for the management modules
diff --git a/3dparty/MDB2/Driver/Reverse/mysql.php b/3dparty/MDB2/Driver/Reverse/mysql.php
index 40c62da3baa..856d2427ab4 100644
--- a/3dparty/MDB2/Driver/Reverse/mysql.php
+++ b/3dparty/MDB2/Driver/Reverse/mysql.php
@@ -45,7 +45,7 @@
// $Id: mysql.php,v 1.80 2008/03/26 21:15:37 quipo Exp $
//
-oc_require_once('MDB2/Driver/Reverse/Common.php');
+require_once('MDB2/Driver/Reverse/Common.php');
/**
* MDB2 MySQL driver for the schema reverse engineering module
diff --git a/3dparty/MDB2/Driver/Reverse/pgsql.php b/3dparty/MDB2/Driver/Reverse/pgsql.php
index d010292cd8c..649c1cad9ee 100644
--- a/3dparty/MDB2/Driver/Reverse/pgsql.php
+++ b/3dparty/MDB2/Driver/Reverse/pgsql.php
@@ -45,7 +45,7 @@
//
// $Id: pgsql.php,v 1.75 2008/08/22 16:36:20 quipo Exp $
-oc_require_once('MDB2/Driver/Reverse/Common.php');
+require_once('MDB2/Driver/Reverse/Common.php');
/**
* MDB2 PostGreSQL driver for the schema reverse engineering module
diff --git a/3dparty/MDB2/Driver/Reverse/sqlite.php b/3dparty/MDB2/Driver/Reverse/sqlite.php
index 1b85aa71f9a..b83544835fe 100644
--- a/3dparty/MDB2/Driver/Reverse/sqlite.php
+++ b/3dparty/MDB2/Driver/Reverse/sqlite.php
@@ -46,7 +46,7 @@
// $Id: sqlite.php,v 1.80 2008/05/03 10:30:14 quipo Exp $
//
-oc_require_once('MDB2/Driver/Reverse/Common.php');
+require_once('MDB2/Driver/Reverse/Common.php');
/**
* MDB2 SQlite driver for the schema reverse engineering module
diff --git a/3dparty/MDB2/LOB.php b/3dparty/MDB2/LOB.php
index 2cdf67afa92..ae67224020e 100644
--- a/3dparty/MDB2/LOB.php
+++ b/3dparty/MDB2/LOB.php
@@ -50,7 +50,7 @@
* @author Lukas Smith <smith@pooteeweet.org>
*/
-oc_require_once('MDB2.php');
+require_once('MDB2.php');
/**
* MDB2_LOB: user land stream wrapper implementation for LOB support
diff --git a/3dparty/MDB2/Schema/Parser.php b/3dparty/MDB2/Schema/Parser.php
index ed31ba03bdf..7c22012c416 100644
--- a/3dparty/MDB2/Schema/Parser.php
+++ b/3dparty/MDB2/Schema/Parser.php
@@ -54,8 +54,8 @@
*/
-oc_require_once('XML/Parser.php');
-oc_require_once('MDB2/Schema/Validate.php');
+require_once('XML/Parser.php');
+require_once('MDB2/Schema/Validate.php');
/**
* Parses an XML schema file
diff --git a/3dparty/System.php b/3dparty/System.php
index a9279ff687d..97de96b14ca 100644
--- a/3dparty/System.php
+++ b/3dparty/System.php
@@ -19,8 +19,8 @@
// $Id: System.php,v 1.36 2004/06/15 16:33:46 pajoye Exp $
//
-oc_require_once( 'PEAR.php');
-oc_require_once( 'Console/Getopt.php');
+require_once( 'PEAR.php');
+require_once( 'Console/Getopt.php');
$GLOBALS['_System_temp_files'] = array();
diff --git a/3dparty/XML/Parser.php b/3dparty/XML/Parser.php
index 6f77b5c66da..6b65066d028 100644
--- a/3dparty/XML/Parser.php
+++ b/3dparty/XML/Parser.php
@@ -36,7 +36,7 @@
/**
* uses PEAR's error handling
*/
-oc_require_once('PEAR.php');
+require_once('PEAR.php');
/**
* resource could not be created
diff --git a/admin/index.php b/admin/index.php
index 36c9229d2f5..8abef287098 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -22,7 +22,7 @@
*/
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
diff --git a/admin/plugins.php b/admin/plugins.php
index ae6d35c3227..60d23585a4f 100644
--- a/admin/plugins.php
+++ b/admin/plugins.php
@@ -22,7 +22,7 @@
*/
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
diff --git a/admin/system.php b/admin/system.php
index 36c9229d2f5..8abef287098 100644
--- a/admin/system.php
+++ b/admin/system.php
@@ -22,7 +22,7 @@
*/
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
diff --git a/admin/users.php b/admin/users.php
index cfcb7a253fb..4d14c791c3c 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -22,7 +22,7 @@
*/
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
diff --git a/docs/skeleton/admin.php b/docs/skeleton/admin.php
index f237e84d852..aaf6136692d 100644
--- a/docs/skeleton/admin.php
+++ b/docs/skeleton/admin.php
@@ -32,7 +32,7 @@ require_once('../lib/base.php');
OC_UTIL::setupFS();
// We load OC_TEMPLATE, too. This one is not loaded by base
-oc_require( 'template.php' );
+require( 'template.php' );
// The user should have admin rights. This is an admin page!
if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
diff --git a/docs/skeleton/index.php b/docs/skeleton/index.php
index 25a9f0297dc..6d237ed6152 100644
--- a/docs/skeleton/index.php
+++ b/docs/skeleton/index.php
@@ -24,7 +24,7 @@
// Init owncloud
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
diff --git a/files/admin.php b/files/admin.php
index 9470bcf90bd..3cc8a57d4cb 100644
--- a/files/admin.php
+++ b/files/admin.php
@@ -24,7 +24,7 @@
// Init owncloud
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
diff --git a/files/download.php b/files/download.php
index d6d39c82126..f890036a32e 100644
--- a/files/download.php
+++ b/files/download.php
@@ -23,7 +23,7 @@
// Init owncloud
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
diff --git a/files/index.php b/files/index.php
index 25a9f0297dc..6d237ed6152 100644
--- a/files/index.php
+++ b/files/index.php
@@ -24,7 +24,7 @@
// Init owncloud
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
diff --git a/files/settings.php b/files/settings.php
index 25a9f0297dc..6d237ed6152 100644
--- a/files/settings.php
+++ b/files/settings.php
@@ -24,7 +24,7 @@
// Init owncloud
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
diff --git a/files/webdav.php b/files/webdav.php
index 7863818cc20..4b1393c110b 100644
--- a/files/webdav.php
+++ b/files/webdav.php
@@ -23,7 +23,7 @@
require_once('../lib/base.php');
-oc_require_once('HTTP/WebDAV/Server/Filesystem.php');
+require_once('HTTP/WebDAV/Server/Filesystem.php');
ini_set('default_charset', 'UTF-8');
diff --git a/index.php b/index.php
index 23aa30dcb4e..62a515fa20f 100644
--- a/index.php
+++ b/index.php
@@ -22,8 +22,8 @@
*/
require_once( 'lib/base.php' );
-oc_require_once( 'appconfig.php' );
-oc_require_once( 'template.php' );
+require_once( 'appconfig.php' );
+require_once( 'template.php' );
if( OC_USER::isLoggedIn()){
if( $_GET["logout"] ){
OC_USER::logout();
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 1ced0469f98..9f1ce6f1047 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -54,7 +54,7 @@ class OC_APP{
// Our very own core apps are hardcoded
foreach( array( "admin", "files", "log", "settings" ) as $app ){
- oc_require( "$app/appinfo/app.php" );
+ require( "$app/appinfo/app.php" );
}
// The rest comes here
@@ -62,7 +62,7 @@ class OC_APP{
while( false !== ( $filename = readdir( $dir ))){
if( substr( $filename, 0, 1 ) != '.' ){
if( file_exists( "$SERVERROOT/apps/$filename/appinfo/app.php" )){
- oc_require( "apps/$filename/appinfo/app.php" );
+ require( "apps/$filename/appinfo/app.php" );
}
}
}
diff --git a/lib/base.php b/lib/base.php
index 58589db7c8c..c84d61b3214 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,21 @@ 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('database.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 +113,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
*
@@ -258,7 +256,7 @@ class OC_UTIL {
}
$prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,-1)!='0'){
- chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
+ OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
clearstatcache();
$prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,2,1)!='0'){
@@ -268,7 +266,7 @@ class OC_UTIL {
if($CONFIG_ENABLEBACKUP){
$prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3);
if(substr($prems,-1)!='0'){
- chmodr($CONFIG_BACKUPDIRECTORY,0770);
+ OC_HELPER::chmodr($CONFIG_BACKUPDIRECTORY,0770);
clearstatcache();
$prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3);
if(substr($prems,2,1)!='0'){
@@ -351,436 +349,4 @@ class OC_HOOK{
return true;
}
}
-
-/**
- * This class manages the access to the database. It basically is a wrapper for
- * MDB2 with some adaptions.
- */
-class OC_DB {
- static private $DBConnection=false;
- static private $schema=false;
- static private $affected=0;
- static private $result=false;
-
- /**
- * @brief connects to the database
- * @returns true if connection can be established or nothing (die())
- *
- * Connects to the database as specified in config.php
- */
- static public function connect(){
- // The global data we need
- global $CONFIG_DBNAME;
- global $CONFIG_DBHOST;
- global $CONFIG_DBUSER;
- global $CONFIG_DBPASSWORD;
- global $CONFIG_DBTYPE;
- global $DOCUMENTROOT;
- global $SERVERROOT;
-
- // 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');
-
- // Prepare options array
- $options = array(
- 'portability' => MDB2_PORTABILITY_ALL,
- 'log_line_break' => '<br>',
- 'idxname_format' => '%s',
- 'debug' => true,
- 'quote_identifier' => true );
-
- // Add the dsn according to the database type
- if( $CONFIG_DBTYPE == 'sqlite' ){
- // sqlite
- $dsn = array(
- 'phptype' => 'sqlite',
- 'database' => "$SERVERROOT/$CONFIG_DBNAME",
- 'mode' => '0644' );
- }
- elseif( $CONFIG_DBTYPE == 'mysql' ){
- // MySQL
- $dsn = array(
- 'phptype' => 'mysql',
- 'username' => $CONFIG_DBUSER,
- 'password' => $CONFIG_DBPASSWORD,
- 'hostspec' => $CONFIG_DBHOST,
- 'database' => $CONFIG_DBNAME );
- }
- elseif( $CONFIG_DBTYPE == 'pgsql' ){
- // PostgreSQL
- $dsn = array(
- 'phptype' => 'pgsql',
- 'username' => $CONFIG_DBUSER,
- 'password' => $CONFIG_DBPASSWORD,
- 'hostspec' => $CONFIG_DBHOST,
- 'database' => $CONFIG_DBNAME );
- }
-
- // Try to establish connection
- self::$DBConnection = MDB2::factory( $dsn, $options );
-
- // Die if we could not connect
- if( PEAR::isError( self::$DBConnection )){
- echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>');
- $error = self::$DBConnection->getMessage();
- error_log( $error);
- error_log( self::$DBConnection->getUserInfo());
- die( $error );
- }
-
- // We always, really always want associative arrays
- self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC);
- }
-
- // we are done. great!
- return true;
- }
-
- /**
- * @brief SQL query
- * @param $query Query string
- * @returns result as MDB2_Result
- *
- * SQL query via MDB2 query()
- */
- static public function query( $query ){
- // Optimize the query
- $query = self::processQuery( $query );
-
- self::connect();
- //fix differences between sql versions
-
- // return the result
- $result = self::$DBConnection->exec( $query );
-
- // Die if we have an error (error means: bad query, not 0 results!)
- if( PEAR::isError($result)) {
- $entry = 'DB Error: "'.$result->getMessage().'"<br />';
- $entry .= 'Offending command was: '.$cmd.'<br />';
- error_log( $entry );
- die( $entry );
- }
-
- return $result;
- }
-
- /**
- * @brief Prepare a SQL query
- * @param $query Query string
- * @returns prepared SQL query
- *
- * SQL query via MDB2 prepare(), needs to be execute()'d!
- */
- static public function prepare( $query ){
- // Optimize the query
- $query = self::processQuery( $query );
-
- self::connect();
- // return the result
- $result = self::$DBConnection->prepare( $query );
-
- // Die if we have an error (error means: bad query, not 0 results!)
- if( PEAR::isError($result)) {
- $entry = 'DB Error: "'.$result->getMessage().'"<br />';
- $entry .= 'Offending command was: '.$cmd.'<br />';
- error_log( $entry );
- die( $entry );
- }
-
- return $result;
- }
-
- /**
- * @brief gets last value of autoincrement
- * @returns id
- *
- * MDB2 lastInsertID()
- *
- * Call this method right after the insert command or other functions may
- * cause trouble!
- */
- public static function insertid(){
- self::connect();
- return self::$DBConnection->lastInsertID();
- }
-
- /**
- * @brief Disconnect
- * @returns true/false
- *
- * This is good bye, good bye, yeah!
- */
- public static function disconnect(){
- // Cut connection if required
- if(self::$DBConnection){
- self::$DBConnection->disconnect();
- self::$DBConnection=false;
- }
-
- return true;
- }
-
- /**
- * @brief Escapes bad characters
- * @param $string string with dangerous characters
- * @returns escaped string
- *
- * MDB2 escape()
- */
- public static function escape( $string ){
- self::connect();
- return self::$DBConnection->escape( $string );
- }
-
- /**
- * @brief saves database scheme to xml file
- * @param $file name of file
- * @returns true/false
- *
- * TODO: write more documentation
- */
- public static function getDbStructure( $file ){
- self::connectScheme();
-
- // write the scheme
- $definition = self::$schema->getDefinitionFromDatabase();
- $dump_options = array(
- 'output_mode' => 'file',
- 'output' => $file,
- 'end_of_line' => "\n"
- );
- self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE );
-
- return true;
- }
-
- /**
- * @brief Creates tables from XML file
- * @param $file file to read structure from
- * @returns true/false
- *
- * TODO: write more documentation
- */
- public static function createDbFromStructure( $file ){
- global $CONFIG_DBNAME;
- global $CONFIG_DBTABLEPREFIX;
-
- self::connectScheme();
-
- // read file
- $content = file_get_contents( $file );
-
- // Make changes and save them to a temporary file
- $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' );
- $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
- $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
- file_put_contents( $file2, $content );
-
- // Try to create tables
- $definition = @self::$schema->parseDatabaseDefinitionFile( $file2 );
-
- // Delete our temporary file
- unlink( $file2 );
-
- // Die in case something went wrong
- if( $definition instanceof MDB2_Schema_Error ){
- die( $definition->getMessage().': '.$definition->getUserInfo());
- }
- $ret=@self::$schema->createDatabase( $definition );
-
- // Die in case something went wrong
- if( $ret instanceof MDB2_Error ){
- die ($ret->getMessage() . ': ' . $ret->getUserInfo());
- }
-
- return true;
- }
-
- /**
- * @brief connects to a MDB2 database scheme
- * @returns true/false
- *
- * Connects to a MDB2 database scheme
- */
- private static function connectScheme(){
- // We need a database connection
- self::connect();
-
- // Connect if this did not happen before
- if(!self::$schema){
- @oc_require_once('MDB2/Schema.php');
- self::$schema=&MDB2_Schema::factory(self::$DBConnection);
- }
-
- return true;
- }
-
- /**
- * @brief does minor chages to query
- * @param $query Query string
- * @returns corrected query string
- *
- * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX
- * and replaces the ` woth ' or " according to the database driver.
- */
- private static function processQuery( $query ){
- // We need Database type and table prefix
- global $CONFIG_DBTYPE;
- global $CONFIG_DBTABLEPREFIX;
-
- // differences in escaping of table names (` for mysql)
- // Problem: what if there is a ` in the value we want to insert?
- if( $CONFIG_DBTYPE == 'sqlite' ){
- $query = str_replace( '`', '\'', $query );
- }
- elseif( $CONFIG_DBTYPE == 'pgsql' ){
- $query = str_replace( '`', '"', $query );
- }
-
- // replace table names
- $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query );
-
- return $query;
- }
-}
-
-
-//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))
- return chmod($path, $filemode);
- $dh = opendir($path);
- while (($file = readdir($dh)) !== false) {
- if($file != '.' && $file != '..') {
- $fullpath = $path.'/'.$file;
- if(is_link($fullpath))
- return FALSE;
- elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
- return FALSE;
- elseif(!chmodr($fullpath, $filemode))
- return FALSE;
- }
- }
- closedir($dh);
- if(chmod($path, $filemode))
- return TRUE;
- else
- return FALSE;
-}
-
?>
diff --git a/lib/database.php b/lib/database.php
new file mode 100644
index 00000000000..6d65665df43
--- /dev/null
+++ b/lib/database.php
@@ -0,0 +1,316 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @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
+ * 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
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * This class manages the access to the database. It basically is a wrapper for
+ * MDB2 with some adaptions.
+ */
+class OC_DB {
+ static private $DBConnection=false;
+ static private $schema=false;
+ static private $affected=0;
+ static private $result=false;
+
+ /**
+ * @brief connects to the database
+ * @returns true if connection can be established or nothing (die())
+ *
+ * Connects to the database as specified in config.php
+ */
+ static public function connect(){
+ // The global data we need
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBHOST;
+ global $CONFIG_DBUSER;
+ global $CONFIG_DBPASSWORD;
+ global $CONFIG_DBTYPE;
+ global $DOCUMENTROOT;
+ global $SERVERROOT;
+
+ // do nothing if the connection already has been established
+ if(!self::$DBConnection){
+ // 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(
+ 'portability' => MDB2_PORTABILITY_ALL,
+ 'log_line_break' => '<br>',
+ 'idxname_format' => '%s',
+ 'debug' => true,
+ 'quote_identifier' => true );
+
+ // Add the dsn according to the database type
+ if( $CONFIG_DBTYPE == 'sqlite' ){
+ // sqlite
+ $dsn = array(
+ 'phptype' => 'sqlite',
+ 'database' => "$SERVERROOT/$CONFIG_DBNAME",
+ 'mode' => '0644' );
+ }
+ elseif( $CONFIG_DBTYPE == 'mysql' ){
+ // MySQL
+ $dsn = array(
+ 'phptype' => 'mysql',
+ 'username' => $CONFIG_DBUSER,
+ 'password' => $CONFIG_DBPASSWORD,
+ 'hostspec' => $CONFIG_DBHOST,
+ 'database' => $CONFIG_DBNAME );
+ }
+ elseif( $CONFIG_DBTYPE == 'pgsql' ){
+ // PostgreSQL
+ $dsn = array(
+ 'phptype' => 'pgsql',
+ 'username' => $CONFIG_DBUSER,
+ 'password' => $CONFIG_DBPASSWORD,
+ 'hostspec' => $CONFIG_DBHOST,
+ 'database' => $CONFIG_DBNAME );
+ }
+
+ // Try to establish connection
+ self::$DBConnection = MDB2::factory( $dsn, $options );
+
+ // Die if we could not connect
+ if( PEAR::isError( self::$DBConnection )){
+ echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>');
+ $error = self::$DBConnection->getMessage();
+ error_log( $error);
+ error_log( self::$DBConnection->getUserInfo());
+ die( $error );
+ }
+
+ // We always, really always want associative arrays
+ self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC);
+ }
+
+ // we are done. great!
+ return true;
+ }
+
+ /**
+ * @brief SQL query
+ * @param $query Query string
+ * @returns result as MDB2_Result
+ *
+ * SQL query via MDB2 query()
+ */
+ static public function query( $query ){
+ // Optimize the query
+ $query = self::processQuery( $query );
+
+ self::connect();
+ //fix differences between sql versions
+
+ // return the result
+ $result = self::$DBConnection->exec( $query );
+
+ // Die if we have an error (error means: bad query, not 0 results!)
+ if( PEAR::isError($result)) {
+ $entry = 'DB Error: "'.$result->getMessage().'"<br />';
+ $entry .= 'Offending command was: '.$cmd.'<br />';
+ error_log( $entry );
+ die( $entry );
+ }
+
+ return $result;
+ }
+
+ /**
+ * @brief Prepare a SQL query
+ * @param $query Query string
+ * @returns prepared SQL query
+ *
+ * SQL query via MDB2 prepare(), needs to be execute()'d!
+ */
+ static public function prepare( $query ){
+ // Optimize the query
+ $query = self::processQuery( $query );
+
+ self::connect();
+ // return the result
+ $result = self::$DBConnection->prepare( $query );
+
+ // Die if we have an error (error means: bad query, not 0 results!)
+ if( PEAR::isError($result)) {
+ $entry = 'DB Error: "'.$result->getMessage().'"<br />';
+ $entry .= 'Offending command was: '.$cmd.'<br />';
+ error_log( $entry );
+ die( $entry );
+ }
+
+ return $result;
+ }
+
+ /**
+ * @brief gets last value of autoincrement
+ * @returns id
+ *
+ * MDB2 lastInsertID()
+ *
+ * Call this method right after the insert command or other functions may
+ * cause trouble!
+ */
+ public static function insertid(){
+ self::connect();
+ return self::$DBConnection->lastInsertID();
+ }
+
+ /**
+ * @brief Disconnect
+ * @returns true/false
+ *
+ * This is good bye, good bye, yeah!
+ */
+ public static function disconnect(){
+ // Cut connection if required
+ if(self::$DBConnection){
+ self::$DBConnection->disconnect();
+ self::$DBConnection=false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @brief Escapes bad characters
+ * @param $string string with dangerous characters
+ * @returns escaped string
+ *
+ * MDB2 escape()
+ */
+ public static function escape( $string ){
+ self::connect();
+ return self::$DBConnection->escape( $string );
+ }
+
+ /**
+ * @brief saves database scheme to xml file
+ * @param $file name of file
+ * @returns true/false
+ *
+ * TODO: write more documentation
+ */
+ public static function getDbStructure( $file ){
+ self::connectScheme();
+
+ // write the scheme
+ $definition = self::$schema->getDefinitionFromDatabase();
+ $dump_options = array(
+ 'output_mode' => 'file',
+ 'output' => $file,
+ 'end_of_line' => "\n"
+ );
+ self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE );
+
+ return true;
+ }
+
+ /**
+ * @brief Creates tables from XML file
+ * @param $file file to read structure from
+ * @returns true/false
+ *
+ * TODO: write more documentation
+ */
+ public static function createDbFromStructure( $file ){
+ global $CONFIG_DBNAME;
+ global $CONFIG_DBTABLEPREFIX;
+
+ self::connectScheme();
+
+ // read file
+ $content = file_get_contents( $file );
+
+ // Make changes and save them to a temporary file
+ $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' );
+ $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
+ $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
+ file_put_contents( $file2, $content );
+
+ // Try to create tables
+ $definition = @self::$schema->parseDatabaseDefinitionFile( $file2 );
+
+ // Delete our temporary file
+ unlink( $file2 );
+
+ // Die in case something went wrong
+ if( $definition instanceof MDB2_Schema_Error ){
+ die( $definition->getMessage().': '.$definition->getUserInfo());
+ }
+ $ret=@self::$schema->createDatabase( $definition );
+
+ // Die in case something went wrong
+ if( $ret instanceof MDB2_Error ){
+ die ($ret->getMessage() . ': ' . $ret->getUserInfo());
+ }
+
+ return true;
+ }
+
+ /**
+ * @brief connects to a MDB2 database scheme
+ * @returns true/false
+ *
+ * Connects to a MDB2 database scheme
+ */
+ private static function connectScheme(){
+ // We need a database connection
+ self::connect();
+
+ // Connect if this did not happen before
+ if(!self::$schema){
+ require_once('MDB2/Schema.php');
+ self::$schema=&MDB2_Schema::factory(self::$DBConnection);
+ }
+
+ return true;
+ }
+
+ /**
+ * @brief does minor chages to query
+ * @param $query Query string
+ * @returns corrected query string
+ *
+ * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX
+ * and replaces the ` woth ' or " according to the database driver.
+ */
+ private static function processQuery( $query ){
+ // We need Database type and table prefix
+ global $CONFIG_DBTYPE;
+ global $CONFIG_DBTABLEPREFIX;
+
+ // differences in escaping of table names (` for mysql)
+ // Problem: what if there is a ` in the value we want to insert?
+ if( $CONFIG_DBTYPE == 'sqlite' ){
+ $query = str_replace( '`', '\'', $query );
+ }
+ elseif( $CONFIG_DBTYPE == 'pgsql' ){
+ $query = str_replace( '`', '"', $query );
+ }
+
+ // replace table names
+ $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query );
+
+ return $query;
+ }
+}
+?> \ No newline at end of file
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/helper.php b/lib/helper.php
index 982da7b6cc3..c51629f21cb 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -113,6 +113,35 @@ class OC_HELPER {
$bytes = round( $bytes / 1024, 1 );
return "$bytes GB";
}
+
+ /**
+ * @brief Recusive editing of file permissions
+ * @param $path path to file or folder
+ * @param $filemode unix style file permissions as integer
+ *
+ * Makes 2048 to 2 kB.
+ */
+ function chmodr($path, $filemode) {
+ if (!is_dir($path))
+ return chmod($path, $filemode);
+ $dh = opendir($path);
+ while (($file = readdir($dh)) !== false) {
+ if($file != '.' && $file != '..') {
+ $fullpath = $path.'/'.$file;
+ if(is_link($fullpath))
+ return FALSE;
+ elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
+ return FALSE;
+ elseif(!chmodr($fullpath, $filemode))
+ return FALSE;
+ }
+ }
+ closedir($dh);
+ if(chmod($path, $filemode))
+ return TRUE;
+ else
+ return FALSE;
+ }
}
?>
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:
diff --git a/log/index.php b/log/index.php
index e0f48d168cd..a401a38fa1a 100644
--- a/log/index.php
+++ b/log/index.php
@@ -24,7 +24,7 @@
//require_once('../../config/config.php');
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn()){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
diff --git a/plugins/ldap/lib_ldap.php b/plugins/ldap/lib_ldap.php
index 383e7f7ab0a..d2095a022ff 100644
--- a/plugins/ldap/lib_ldap.php
+++ b/plugins/ldap/lib_ldap.php
@@ -21,7 +21,7 @@
*
*/
-oc_require_once('inc/User/backend.php');
+require_once('inc/User/backend.php');
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss
index 1574dae8053..6ff829ef321 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss
@@ -3,5 +3,7 @@
@import "_theme_template.scss";
.syntaxhighlighter {
- .keyword { font-weight: bold !important; }
+.keyword { font-weight:
+ bold !important;
+ }
}
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss
index 8e95c567aeb..45e3f0917c3 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss
@@ -3,7 +3,8 @@
$background: #0a2b1d !default;
$line_highlighted_background: #233729 !default;
-$line_highlighted_number: white !default;
+$line_highlighted_number:
+white !default;
$gutter_text: #497958 !default;
$gutter_border_color: #41a83e !default;
@@ -31,6 +32,10 @@ $code_color3: #edef7d !default;
@import "_theme_template.scss";
.syntaxhighlighter {
- .comments { font-style: italic !important; }
- .keyword { font-weight: bold !important; }
+.comments { font-style:
+ italic !important;
+ }
+.keyword { font-weight:
+ bold !important;
+ }
}
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss
index 193fb1d877a..33cf5a3cac1 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss
@@ -15,9 +15,11 @@ $toolbar_collapsed_a_hover: #aa7700 !default;
$toolbar_collapsed_background: #fff !default;
$toolbar_a: #a0a0a0 !default;
-$toolbar_a_hover: red !default;
+$toolbar_a_hover:
+red !default;
-$code_plain: black !default;
+$code_plain:
+black !default;
$code_comments: #3f5fbf !default;
$code_string: #2a00ff !default;
$code_keyword: #7f0055 !default;
@@ -26,23 +28,30 @@ $code_variable: #aa7700 !default;
$code_value: #009900 !default;
$code_functions: #ff1493 !default;
$code_constants: #0066cc !default;
-$code_color1: gray !default;
+$code_color1:
+gray !default;
$code_color2: #ff1493 !default;
-$code_color3: red !default;
+$code_color3:
+red !default;
@import "_theme_template.scss";
.syntaxhighlighter {
- .keyword { font-weight: bold !important; }
-
- .xml {
- .keyword {
- color: #3f7f7f !important;
- font-weight: normal !important; }
- .color1, .color1 a { color: #7f007f !important; }
- .string {
- font-style: italic !important;
- color: #2a00ff !important;
- }
- }
+.keyword { font-weight:
+ bold !important;
+ }
+
+ .xml {
+ .keyword {
+color: #3f7f7f !important;
+font-weight:
+ normal !important;
+ }
+.color1, .color1 a { color: #7f007f !important; }
+ .string {
+font-style:
+ italic !important;
+color: #2a00ff !important;
+ }
+ }
}
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss
index 11c9deb4d08..2589374f5be 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss
@@ -1,17 +1,20 @@
// Emacs SyntaxHighlighter theme based on theme by Joshua Emmons
// http://www.skia.net/
-$background: black !default;
+$background:
+black !default;
$line_highlighted_background: #2A3133 !default;
-$line_highlighted_number: white !default;
+$line_highlighted_number:
+white !default;
$gutter_text: #d3d3d3 !default;
$gutter_border_color: #990000 !default;
$toolbar_collapsed_a: #ebdb8d !default;
$toolbar_collapsed_a_hover: #ff7d27 !default;
-$toolbar_collapsed_background: black !default;
+$toolbar_collapsed_background:
+black !default;
$toolbar_a: #fff !default;
$toolbar_a_hover: #9ccff4 !default;
@@ -19,7 +22,8 @@ $toolbar_a_hover: #9ccff4 !default;
$code_plain: #d3d3d3 !default;
$code_comments: #ff7d27 !default;
$code_string: #ff9e7b !default;
-$code_keyword: aqua !default;
+$code_keyword:
+aqua !default;
$code_preprocessor: #aec4de !default;
$code_variable: #ffaa3e !default;
$code_value: #009900 !default;
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss
index 7963814952f..3ec13b18277 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss
@@ -4,19 +4,22 @@
$background: #121212 !default;
$line_highlighted_background: #2C2C29 !default;
-$line_highlighted_number: white !default;
+$line_highlighted_number:
+white !default;
$gutter_text: #afafaf !default;
$gutter_border_color: #3185b9 !default;
$toolbar_collapsed_a: #3185b9 !default;
$toolbar_collapsed_a_hover: #d01d33 !default;
-$toolbar_collapsed_background: black !default;
+$toolbar_collapsed_background:
+black !default;
$toolbar_a: #fff !default;
$toolbar_a_hover: #96daff !default;
-$code_plain: white !default;
+$code_plain:
+white !default;
$code_comments: #696854 !default;
$code_string: #e3e658 !default;
$code_keyword: #d01d33 !default;
@@ -32,5 +35,7 @@ $code_color3: #96daff !default;
@import "_theme_template.scss";
.syntaxhighlighter {
- .functions { font-weight: bold !important; }
+.functions { font-weight:
+ bold !important;
+ }
}
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss
index 0356fa6c934..c09517bdc86 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss
@@ -4,29 +4,38 @@
$background: #222222 !default;
$line_highlighted_background: #253e5a !default;
-$line_highlighted_number: white !default;
+$line_highlighted_number:
+white !default;
$gutter_text: #38566f !default;
$gutter_border_color: #435a5f !default;
$toolbar_collapsed_a: #428bdd !default;
-$toolbar_collapsed_a_hover: lime !default;
-$toolbar_collapsed_background: black !default;
+$toolbar_collapsed_a_hover:
+lime !default;
+$toolbar_collapsed_background:
+black !default;
$toolbar_a: #aaaaff !default;
$toolbar_a_hover: #9ccff4 !default;
-$code_plain: lime !default;
+$code_plain:
+lime !default;
$code_comments: #428bdd !default;
-$code_string: lime !default;
+$code_string:
+lime !default;
$code_keyword: #aaaaff !default;
$code_preprocessor: #8aa6c1 !default;
-$code_variable: aqua !default;
+$code_variable:
+aqua !default;
$code_value: #f7e741 !default;
$code_functions: #ff8000 !default;
-$code_constants: yellow !default;
-$code_color1: red !default;
-$code_color2: yellow !default;
+$code_constants:
+yellow !default;
+$code_color1:
+red !default;
+$code_color2:
+yellow !default;
$code_color3: #ffaa3e !default;
@import "_theme_template.scss";
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss
index a4dae02305f..55a630bb331 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss
@@ -26,7 +26,8 @@ $code_value: #f7e741 !default;
$code_functions: #ffaa3e !default;
$code_constants: #e0e8ff !default;
$code_color1: #f8bb00 !default;
-$code_color2: white !default;
+$code_color2:
+white !default;
$code_color3: #ffaa3e !default;
@import "_theme_template.scss";
diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss
index 3b67b153721..f37acb25c42 100644
--- a/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss
+++ b/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss
@@ -26,7 +26,8 @@ $code_value: #009900 !default;
$code_functions: #ffaa3e !default;
$code_constants: #e0e8ff !default;
$code_color1: #e0e8ff !default;
-$code_color2: white !default;
+$code_color2:
+white !default;
$code_color3: #ffaa3e !default;
@import "_theme_template.scss";
diff --git a/settings/index.php b/settings/index.php
index 9791e287306..85e4281c919 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -1,7 +1,7 @@
<?php
require_once('../lib/base.php');
-oc_require( 'template.php' );
+require( 'template.php' );
if( !OC_USER::isLoggedIn()){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();