merge refactoring in master

This commit is contained in:
Robin Appelman 2011-06-02 20:32:12 +02:00
commit 016a892a78
466 changed files with 10231 additions and 42023 deletions

2
.gitignore vendored
View File

@ -16,3 +16,5 @@ _darcs/*
CVS/*
.svn/*
RCS/*
.kdev
*.kdev4

View File

@ -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.

View File

@ -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");
/**

View File

@ -52,7 +52,7 @@
* @author Lukas Smith <smith@pooteeweet.org>
*/
oc_require_once('PEAR.php');
require_once('PEAR.php');
// {{{ Error constants
@ -279,7 +279,7 @@ class MDB2
*
* @access public
*/
function setOptions(&$db, $options)
static function setOptions(&$db, $options)
{
if (is_array($options)) {
foreach ($options as $option => $value) {
@ -304,7 +304,7 @@ class MDB2
* @static
* @access public
*/
function classExists($classname)
static function classExists($classname)
{
if (version_compare(phpversion(), "5.0", ">=")) {
return class_exists($classname, false);
@ -325,14 +325,14 @@ class MDB2
*
* @access public
*/
function loadClass($class_name, $debug)
static function loadClass($class_name, $debug)
{
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)) {
@ -340,7 +340,7 @@ class MDB2
} else {
$msg = "unable to load class '$class_name' from file '$file_name'";
}
$err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
$err =MDB2::raiseErrorStatic(MDB2_ERROR_NOT_FOUND, null, null, $msg);
return $err;
}
}
@ -374,11 +374,11 @@ class MDB2
*
* @access public
*/
function &factory($dsn, $options = false)
static function factory($dsn, $options = false)
{
$dsninfo = MDB2::parseDSN($dsn);
if (empty($dsninfo['phptype'])) {
$err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND,
$err =MDB2::raiseErrorStatic(MDB2_ERROR_NOT_FOUND,
null, null, 'no RDBMS driver specified');
return $err;
}
@ -390,7 +390,7 @@ class MDB2
return $err;
}
$db =& new $class_name();
$db =new $class_name();
$db->setDSN($dsninfo);
$err = MDB2::setOptions($db, $options);
if (PEAR::isError($err)) {
@ -433,7 +433,7 @@ class MDB2
*/
function &connect($dsn, $options = false)
{
$db =& MDB2::factory($dsn, $options);
$db =MDB2::factory($dsn, $options);
if (PEAR::isError($db)) {
return $db;
}
@ -497,10 +497,10 @@ class MDB2
}
}
} elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) {
$db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
$db =$GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
return $db;
}
$db =& MDB2::factory($dsn, $options);
$db =MDB2::factory($dsn, $options);
return $db;
}
@ -516,7 +516,7 @@ class MDB2
* @param array $arr2
* @return boolean
*/
function areEquals($arr1, $arr2)
static function areEquals($arr1, $arr2)
{
if (count($arr1) != count($arr2)) {
return false;
@ -545,11 +545,11 @@ class MDB2
{
$file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php';
if (!MDB2::fileExists($file_name)) {
return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'unable to find: '.$file_name);
}
if (!include_once($file_name)) {
return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'unable to load driver class: '.$file_name);
}
return $file_name;
@ -597,7 +597,7 @@ class MDB2
* @access private
* @see PEAR_Error
*/
function &raiseError($code = null,
function raiseError($code = null,
$mode = null,
$options = null,
$userinfo = null,
@ -605,7 +605,19 @@ class MDB2
$dummy2 = null,
$dummy3 = false)
{
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
$err =PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
return $err;
}
static function raiseErrorStatic($code = null,
$mode = null,
$options = null,
$userinfo = null,
$dummy1 = null,
$dummy2 = null,
$dummy3 = false)
{
$pear=new PEAR();
$err =$pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
return $err;
}
@ -625,7 +637,7 @@ class MDB2
*
* @access public
*/
function isError($data, $code = null)
static function isError($data, $code = null)
{
if (is_a($data, 'MDB2_Error')) {
if (is_null($code)) {
@ -652,7 +664,7 @@ class MDB2
*
* @access public
*/
function isConnection($value)
static function isConnection($value)
{
return is_a($value, 'MDB2_Driver_Common');
}
@ -669,7 +681,7 @@ class MDB2
*
* @access public
*/
function isResult($value)
static function isResult($value)
{
return is_a($value, 'MDB2_Result');
}
@ -686,7 +698,7 @@ class MDB2
*
* @access public
*/
function isResultCommon($value)
static function isResultCommon($value)
{
return is_a($value, 'MDB2_Result_Common');
}
@ -703,7 +715,7 @@ class MDB2
*
* @access public
*/
function isStatement($value)
static function isStatement($value)
{
return is_a($value, 'MDB2_Statement_Common');
}
@ -723,7 +735,7 @@ class MDB2
*
* @access public
*/
function errorMessage($value = null)
static function errorMessage($value = null)
{
static $errorMessages;
@ -824,7 +836,7 @@ class MDB2
* @access public
* @author Tomas V.V.Cox <cox@idecnet.com>
*/
function parseDSN($dsn)
static function parseDSN($dsn)
{
$parsed = $GLOBALS['_MDB2_dsninfo_default'];
@ -954,7 +966,7 @@ class MDB2
*
* @access public
*/
function fileExists($file)
static function fileExists($file)
{
// safe_mode does notwork with is_readable()
global $SERVERROOT;
@ -1000,7 +1012,7 @@ class MDB2_Error extends PEAR_Error
*
* @param mixed MDB2 error code, or string with error message.
* @param int what 'error mode' to operate in
* @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param int what error level to use for $mode raPEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
*/
function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
@ -1352,17 +1364,6 @@ class MDB2_Driver_Common extends PEAR
$this->db_index = $db_index;
}
// }}}
// {{{ function MDB2_Driver_Common()
/**
* PHP 4 Constructor
*/
function MDB2_Driver_Common()
{
$this->destructor_registered = false;
$this->__construct();
}
// }}}
// {{{ destructor: function __destruct()
@ -1457,7 +1458,7 @@ class MDB2_Driver_Common extends PEAR
* @access public
* @see PEAR_Error
*/
function &raiseError($code = null,
function raiseError($code = null,
$mode = null,
$options = null,
$userinfo = null,
@ -1493,15 +1494,16 @@ class MDB2_Driver_Common extends PEAR
if (!is_null($native_msg) && $native_msg !== '') {
$userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n";
}
echo $userinfo;
if (!is_null($method)) {
$userinfo = $method.': '.$userinfo;
}
}
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
$err = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
if ($err->getMode() !== PEAR_ERROR_RETURN
&& isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
$this->has_transaction_error =& $err;
$this->has_transaction_error =$err;
}
return $err;
}
@ -1938,12 +1940,12 @@ class MDB2_Driver_Common extends PEAR
}
if (!MDB2::classExists($class_name)) {
$err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
$err =$this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
"unable to load module '$module' into property '$property'", __FUNCTION__);
return $err;
}
$this->{$property} = new $class_name($this->db_index);
$this->modules[$module] =& $this->{$property};
$this->modules[$module] =$this->{$property};
if ($version) {
// this will be used in the connect method to determine if the module
// needs to be loaded with a different version if the server
@ -2097,7 +2099,7 @@ class MDB2_Driver_Common extends PEAR
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation, $options = array())
static function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
@ -2447,7 +2449,7 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, $is_manip, $connection, false);
$result =$this->_doQuery($query, $is_manip, $connection, false);
if (PEAR::isError($result)) {
return $result;
}
@ -2456,7 +2458,7 @@ class MDB2_Driver_Common extends PEAR
$affected_rows = $this->_affectedRows($connection, $result);
return $affected_rows;
}
$result =& $this->_wrapResult($result, $types, true, false, $limit, $offset);
$result =$this->_wrapResult($result, $types, true, false, $limit, $offset);
return $result;
}
@ -2504,7 +2506,7 @@ class MDB2_Driver_Common extends PEAR
}
$query = $result;
}
$err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
$err =$this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $err;
}
@ -2552,7 +2554,7 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, true, $connection, $this->database_name);
$result =$this->_doQuery($query, true, $connection, $this->database_name);
if (PEAR::isError($result)) {
return $result;
}
@ -2589,12 +2591,12 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, false, $connection, $this->database_name);
$result =$this->_doQuery($query, false, $connection, $this->database_name);
if (PEAR::isError($result)) {
return $result;
}
$result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
$result =$this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
return $result;
}
@ -2643,13 +2645,13 @@ class MDB2_Driver_Common extends PEAR
if ($result_class) {
$class_name = sprintf($result_class, $this->phptype);
if (!MDB2::classExists($class_name)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result class does not exist '.$class_name, __FUNCTION__);
return $err;
}
$result =& new $class_name($this, $result, $limit, $offset);
$result =new $class_name($this, $result, $limit, $offset);
if (!MDB2::isResultCommon($result)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result class is not extended from MDB2_Result_Common', __FUNCTION__);
return $err;
}
@ -2666,7 +2668,7 @@ class MDB2_Driver_Common extends PEAR
}
if ($result_wrap_class) {
if (!MDB2::classExists($result_wrap_class)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result wrap class does not exist '.$result_wrap_class, __FUNCTION__);
return $err;
}
@ -2877,7 +2879,7 @@ class MDB2_Driver_Common extends PEAR
$condition = ' WHERE '.implode(' AND ', $condition);
$query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition;
$result =& $this->_doQuery($query, true, $connection);
$result =$this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) {
$affected_rows = $this->_affectedRows($connection, $result);
$insert = '';
@ -2886,7 +2888,7 @@ class MDB2_Driver_Common extends PEAR
}
$values = implode(', ', $values);
$query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result =$this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) {
$affected_rows += $this->_affectedRows($connection, $result);;
}
@ -2996,7 +2998,7 @@ class MDB2_Driver_Common extends PEAR
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$parameter = preg_replace($regexp, '\\1', $query);
if ($parameter === '') {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@ -3054,7 +3056,7 @@ class MDB2_Driver_Common extends PEAR
if ($ignore['end'] === "\n") {
$end_quote = strlen($query) - 1;
} else {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'query with an unterminated text string specified', __FUNCTION__);
return $err;
}
@ -3446,22 +3448,12 @@ class MDB2_Result_Common extends MDB2_Result
*/
function __construct(&$db, &$result, $limit = 0, $offset = 0)
{
$this->db =& $db;
$this->result =& $result;
$this->db =$db;
$this->result =$result;
$this->offset = $offset;
$this->limit = max(0, $limit - 1);
}
// }}}
// {{{ function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
/**
* PHP 4 Constructor
*/
function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
{
$this->__construct($db, $result, $limit, $offset);
}
// }}}
// {{{ function setResultTypes($types)
@ -3541,7 +3533,7 @@ class MDB2_Result_Common extends MDB2_Result
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
$err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
$err =$this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $err;
}
@ -3846,7 +3838,7 @@ class MDB2_Result_Common extends MDB2_Result
}
$column = $column_names[$column];
}
$this->values[$column] =& $value;
$this->values[$column] =$value;
if (!is_null($type)) {
$this->types[$column] = $type;
}
@ -3920,21 +3912,6 @@ class MDB2_Row
$this->$key = &$row[$key];
}
}
// }}}
// {{{ function MDB2_Row(&$row)
/**
* PHP 4 Constructor
*
* @param resource row data as array
*/
function MDB2_Row(&$row)
{
$this->__construct($row);
}
// }}}
}
// }}}
@ -3969,8 +3946,8 @@ class MDB2_Statement_Common
*/
function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
{
$this->db =& $db;
$this->statement =& $statement;
$this->db =$db;
$this->statement =$statement;
$this->positions = $positions;
$this->query = $query;
$this->types = (array)$types;
@ -3980,16 +3957,6 @@ class MDB2_Statement_Common
$this->offset = $offset;
}
// }}}
// {{{ function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
/**
* PHP 4 Constructor
*/
function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
{
$this->__construct($db, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
}
// }}}
// {{{ function bindValue($parameter, &$value, $type = null)
@ -4085,7 +4052,7 @@ class MDB2_Statement_Common
return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
}
$this->values[$parameter] =& $value;
$this->values[$parameter] =$value;
if (!is_null($type)) {
$this->types[$parameter] = $type;
}
@ -4152,7 +4119,7 @@ class MDB2_Statement_Common
'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__);
}
}
$result =& $this->_execute($result_class, $result_wrap_class);
$result =$this->_execute($result_class, $result_wrap_class);
return $result;
}
@ -4200,7 +4167,7 @@ class MDB2_Statement_Common
if ($this->is_manip) {
$result = $this->db->exec($query);
} else {
$result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
$result =$this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
}
return $result;
}
@ -4272,17 +4239,6 @@ class MDB2_Module_Common
$this->db_index = $db_index;
}
// }}}
// {{{ function MDB2_Module_Common($db_index)
/**
* PHP 4 Constructor
*/
function MDB2_Module_Common($db_index)
{
$this->__construct($db_index);
}
// }}}
// {{{ function &getDBInstance()
@ -4293,12 +4249,12 @@ class MDB2_Module_Common
*
* @access public
*/
function &getDBInstance()
function getDBInstance()
{
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
$result =& $GLOBALS['_MDB2_databases'][$this->db_index];
$result =$GLOBALS['_MDB2_databases'][$this->db_index];
} else {
$result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$result =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'could not find MDB2 instance');
}
return $result;
@ -4358,4 +4314,4 @@ function MDB2_defaultDebugOutput(&$db, $scope, $message, $context = array())
}
// }}}
?>
?>

View File

@ -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
@ -100,7 +100,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
function getValidTypes()
{
$types = $this->valid_default_values;
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -145,7 +145,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
$types = is_array($types) ? $types : array($types);
foreach ($types as $key => $type) {
if (!isset($this->valid_default_values[$type])) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -209,7 +209,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
return fopen('MDB2LOB://'.$lob_index.'@'.$this->db_index, 'r+');
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -235,7 +235,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
if (is_null($value)) {
return null;
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -338,7 +338,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function getDeclaration($type, $name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -387,7 +387,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -453,7 +453,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function _getDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -501,7 +501,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
$default = '';
if (array_key_exists('default', $field)) {
if ($field['default'] === '') {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -583,7 +583,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
function _getIntegerDeclaration($name, $field)
{
if (!empty($field['unsigned'])) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -651,7 +651,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function _getCLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -687,7 +687,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function _getBLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -875,7 +875,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
$type = !empty($current['type']) ? $current['type'] : null;
if (!method_exists($this, "_compare{$type}Definition")) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1114,7 +1114,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function quote($value, $type = null, $quote = true, $escape_wildcards = false)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1218,7 +1218,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
return $value;
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1254,7 +1254,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
}
if (is_resource($value)) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1369,7 +1369,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
function _quoteDate($value, $quote, $escape_wildcards)
{
if ($value === 'CURRENT_DATE') {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1398,7 +1398,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
function _quoteTimestamp($value, $quote, $escape_wildcards)
{
if ($value === 'CURRENT_TIMESTAMP') {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1427,7 +1427,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
function _quoteTime($value, $quote, $escape_wildcards)
{
if ($value === 'CURRENT_TIME') {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1517,7 +1517,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function writeLOBToFile($lob, $file)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1681,7 +1681,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1755,7 +1755,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function mapNativeDatatype($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1784,7 +1784,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function _mapNativeDatatype($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1805,7 +1805,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
*/
function mapPrepareDatatype($type)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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
@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -308,7 +308,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function _getDecimalDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -346,7 +346,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -531,7 +531,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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
@ -117,7 +117,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -198,7 +198,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -262,7 +262,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
return $value;
}
if (version_compare(PHP_VERSION, '5.2.0RC6', '>=')) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -317,7 +317,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -366,7 +366,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function patternEscapeString()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -492,7 +492,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -519,7 +519,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function mapPrepareDatatype($type)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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
@ -101,7 +101,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -199,7 +199,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -237,7 +237,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -388,7 +388,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -108,7 +108,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function getFieldDeclarationList($fields)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -140,7 +140,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function _fixSequenceName($sqn, $check = false)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -168,7 +168,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function _fixIndexName($idx)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -195,7 +195,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function createDatabase($database, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -218,7 +218,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function alterDatabase($database, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -239,7 +239,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function dropDatabase($database)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -263,7 +263,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -356,7 +356,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
if (PEAR::isError($query)) {
return $query;
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -379,7 +379,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -401,7 +401,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -429,7 +429,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -533,7 +533,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -553,7 +553,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -573,7 +573,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -596,7 +596,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listViews($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -617,7 +617,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTableViews($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -638,7 +638,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -658,7 +658,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -681,7 +681,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTables($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -702,7 +702,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -748,7 +748,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -777,7 +777,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -798,7 +798,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -867,7 +867,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -912,7 +912,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function dropConstraint($table, $name, $primary = false)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -934,7 +934,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -956,7 +956,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -977,7 +977,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function dropSequence($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1000,7 +1000,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
*/
function listSequences($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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
@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createTable($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTables($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listViews($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropConstraint($table, $name, $primary = false)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function _createFKTriggers($table, $foreign_keys)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1198,7 +1198,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1232,7 +1232,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1307,7 +1307,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1380,7 +1380,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1401,7 +1401,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listSequences($database = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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

View File

@ -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
@ -71,7 +71,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
global $SERVERROOT;
$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -82,7 +84,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
'database already exists', __FUNCTION__);
}
$php_errormsg = '';
$handle = @sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
$database_file="$datadir/$database_file.db";
$handle = sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
if (!$handle) {
return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
(isset($php_errormsg) ? $php_errormsg : 'could not create the database file'), __FUNCTION__);
@ -107,7 +110,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -174,7 +177,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -236,7 +239,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
}
// create triggers to enforce FOREIGN KEY constraints
if (!empty($options['foreign_keys'])) {
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -384,7 +387,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -427,7 +430,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -534,7 +537,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check, $options = array())
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -687,7 +690,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
$query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true);
$query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')';
$query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')';
$stmt =& $db->prepare($query, null, MDB2_PREPARE_MANIP);
$stmt =$db->prepare($query, null, MDB2_PREPARE_MANIP);
if (PEAR::isError($stmt)) {
return $stmt;
}
@ -712,7 +715,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -732,7 +735,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -750,9 +753,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
* @return mixed array of view names on success, a MDB2 error on failure
* @access public
*/
function listViews()
function listViews($dummy=null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -780,7 +783,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableViews($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -814,9 +817,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
* @return mixed array of table names on success, a MDB2 error on failure
* @access public
*/
function listTables()
function listTables($dummy=null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -850,7 +853,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -898,7 +901,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -958,7 +961,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -998,7 +1001,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1019,7 +1022,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1080,7 +1083,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1133,7 +1136,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
return $this->alterTable($table, array(), false, array('primary' => null));
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1170,7 +1173,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1204,7 +1207,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1274,7 +1277,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1315,7 +1318,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1333,9 +1336,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
* @return mixed array of sequence names on success, a MDB2 error on failure
* @access public
*/
function listSequences()
function listSequences($dummy=null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -107,7 +107,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function getTableFieldDefinition($table, $field)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -141,7 +141,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function getTableIndexDefinition($table, $index)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -193,7 +193,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function getTableConstraintDefinition($table, $index)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -220,7 +220,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function getSequenceDefinition($sequence)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -273,7 +273,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -407,7 +407,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
*/
function tableInfo($result, $mode = null)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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
@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -181,7 +181,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -256,7 +256,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -356,7 +356,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -424,7 +424,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -476,7 +476,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -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

View File

@ -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
@ -63,7 +63,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
* @access private
*/
function _removeComments($sql) {
$lines = split("\n", $sql);
$lines = explode("\n", $sql);
foreach ($lines as $k => $line) {
$pieces = explode('--', $line);
if (count($pieces) > 1 && (substr_count($pieces[0], '\'') % 2) == 0) {
@ -78,7 +78,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function _getTableColumns($sql)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -88,7 +88,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
// replace the decimal length-places-separator with a colon
$column_def = preg_replace('/(\d),(\d)/', '\1:\2', $column_def);
$column_def = $this->_removeComments($column_def);
$column_sql = split(',', $column_def);
$column_sql = explode(',', $column_def);
$columns = array();
$count = count($column_sql);
if ($count == 0) {
@ -156,7 +156,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -258,7 +258,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -300,7 +300,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
$start_pos = strpos($sql, '(');
$end_pos = strrpos($sql, ')');
$column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
$column_names = split(',', $column_names);
$column_names = explode(',', $column_names);
if (preg_match("/^create unique/", $sql)) {
return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
@ -341,7 +341,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -408,7 +408,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
if (preg_match("/\bPRIMARY\s+KEY\b\s*\(([^)]+)/i", $sql, $tmp)) {
$definition['primary'] = true;
$definition['fields'] = array();
$column_names = split(',', $tmp[1]);
$column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
@ -420,7 +420,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
if (preg_match("/\"([^\"]+)\"[^\,\"]+\bPRIMARY\s+KEY\b[^\,\)]*/i", $sql, $tmp)) {
$definition['primary'] = true;
$definition['fields'] = array();
$column_names = split(',', $tmp[1]);
$column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
@ -450,14 +450,14 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
$definition['onupdate'] = 'NO ACTION';
$definition['ondelete'] = 'NO ACTION';
$definition['references']['table'] = $tmp[2];
$column_names = split(',', $tmp[1]);
$column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
'position' => $colpos++
);
}
$referenced_cols = split(',', $tmp[3]);
$referenced_cols = explode(',', $tmp[3]);
$colpos = 1;
foreach ($referenced_cols as $column_name) {
$definition['references']['fields'][trim($column_name)] = array(
@ -487,7 +487,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
$start_pos = strpos($sql, '(');
$end_pos = strrpos($sql, ')');
$column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
$column_names = split(',', $column_names);
$column_names = explode(',', $column_names);
if (!preg_match("/^create unique/", $sql)) {
return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
@ -532,7 +532,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -596,7 +596,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

View File

@ -462,7 +462,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
static function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
if (!$this->supports('transactions')) {

View File

@ -343,7 +343,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
static function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {

View File

@ -205,7 +205,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
register_shutdown_function('MDB2_closeOpenTransactions');
}
$query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result =$this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -240,7 +240,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
$query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result =$this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -275,7 +275,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
$query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result =$this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -299,7 +299,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
static function setTransactionIsolation($isolation,$options=array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {
@ -347,6 +347,8 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
**/
function connect()
{
global $SERVERROOT;
$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
$database_file = $this->_getDatabaseFile($this->database_name);
if (is_resource($this->connection)) {
//if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
@ -370,6 +372,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
if ($database_file !== ':memory:') {
if(!strpos($database_file,'.db')){
$database_file="$datadir/$database_file.db";
}
if (!file_exists($database_file)) {
if (!touch($database_file)) {
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
@ -405,7 +410,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$php_errormsg = '';
if (version_compare('5.1.0', PHP_VERSION, '>')) {
@ini_set('track_errors', true);
echo 1;
$connection = @$connect_function($database_file);
echo 2;
@ini_restore('track_errors');
} else {
$connection = @$connect_function($database_file, 0666, $php_errormsg);
@ -538,7 +545,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$this->_lasterror = $php_errormsg;
if (!$result) {
$err =& $this->raiseError(null, null, null,
$err =$this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -753,7 +760,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$table = $this->quoteIdentifier($table, true);
$query = "REPLACE INTO $table ($query) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result =$this->_doQuery($query, true, $connection);
if (PEAR::isError($result)) {
return $result;
}
@ -781,7 +788,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$this->expectError(MDB2_ERROR_NOSUCHTABLE);
$result =& $this->_doQuery($query, true);
$result =$this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -800,7 +807,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$value = $this->lastInsertID();
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result =$this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -896,7 +903,7 @@ class MDB2_Result_sqlite extends MDB2_Result_Common
}
if (!$row) {
if ($this->result === false) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err =$this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}

View File

@ -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

View File

@ -237,7 +237,7 @@ class MDB2_Schema extends PEAR
* @access public
* @see MDB2::parseDSN
*/
function &factory(&$db, $options = array())
static function factory(&$db, $options = array())
{
$obj =new MDB2_Schema();
$result = $obj->connect($db, $options);
@ -282,7 +282,7 @@ class MDB2_Schema extends PEAR
}
$this->disconnect();
if (!MDB2::isConnection($db)) {
$db =& MDB2::factory($db, $db_options);
$db =MDB2::factory($db, $db_options);
}
if (PEAR::isError($db)) {
@ -1338,15 +1338,15 @@ class MDB2_Schema extends PEAR
if ($dbExists) {
$this->db->debug('Database already exists: ' . $db_name, __FUNCTION__);
if (!empty($dbOptions)) {
$errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NO_PERMISSION);
$this->db->expectError($errorcodes);
$result = $this->db->manager->alterDatabase($db_name, $dbOptions);
$this->db->popExpect();
if (PEAR::isError($result) && !MDB2::isError($result, $errorcodes)) {
return $result;
}
}
// if (!empty($dbOptions)) {
// $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NO_PERMISSION);
// $this->db->expectError($errorcodes);
// $result = $this->db->manager->alterDatabase($db_name, $dbOptions);
// $this->db->popExpect();
// if (PEAR::isError($result) && !MDB2::isError($result, $errorcodes)) {
// return $result;
// }
// }
$create = false;
} else {
$this->db->expectError(MDB2_ERROR_UNSUPPORTED);
@ -2692,9 +2692,9 @@ class MDB2_Schema extends PEAR
* @access public
* @see PEAR_Error
*/
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
function raiseError($code = null, $mode = null, $options = null, $userinfo = null,$a=null,$b=null,$c=null)
{
$err =& PEAR::raiseError(null, $code, $mode, $options,
$err =PEAR::raiseError(null, $code, $mode, $options,
$userinfo, 'MDB2_Schema_Error', true);
return $err;
}
@ -2713,7 +2713,7 @@ class MDB2_Schema extends PEAR
* @return bool true if parameter is an error
* @access public
*/
function isError($data, $code = null)
static function isError($data, $code = null)
{
if (is_a($data, 'MDB2_Schema_Error')) {
if (is_null($code)) {

View File

@ -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
@ -120,7 +120,7 @@ class MDB2_Schema_Parser extends XML_Parser
{
// force ISO-8859-1 due to different defaults for PHP4 and PHP5
// todo: this probably needs to be investigated some more andcleaned up
parent::XML_Parser('ISO-8859-1');
parent::__construct('ISO-8859-1');
$this->variables = $variables;
$this->structure = $structure;
@ -503,7 +503,7 @@ class MDB2_Schema_Parser extends XML_Parser
$this->element = implode('-', $this->elements);
}
function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE)
function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE,$a=null,$b=null,$c=null)
{
if (is_null($this->error)) {
$error = '';

View File

@ -247,7 +247,7 @@ class PEAR
* @access public
* @return bool true if parameter is an error
*/
function isError($data, $code = null)
static function isError($data, $code = null)
{
if (is_a($data, 'PEAR_Error')) {
if (is_null($code)) {

View File

@ -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();

View File

@ -36,7 +36,7 @@
/**
* uses PEAR's error handling
*/
oc_require_once('PEAR.php');
require_once('PEAR.php');
/**
* resource could not be created
@ -164,26 +164,6 @@ class XML_Parser extends PEAR
*/
var $_handlerObj;
// }}}
// {{{ constructor
/**
* Creates an XML parser.
*
* This is needed for PHP4 compatibility, it will
* call the constructor, when a new instance is created.
*
* @param string $srcenc source charset encoding, use NULL (default) to use
* whatever the document specifies
* @param string $mode how this parser object should work, "event" for
* startelement/endelement-type events, "func"
* to have it call functions named after elements
* @param string $tgenc a valid target encoding
*/
function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null)
{
XML_Parser::__construct($srcenc, $mode, $tgtenc);
}
// }}}
/**
@ -560,7 +540,11 @@ class XML_Parser extends PEAR
* @param integer $ecode the error message code
* @return XML_Parser_Error
**/
function raiseError($msg = null, $ecode = 0)
function raiseError($msg = null, $ecode = 0,$mode = null,
$options = null,
$userinfo = null,
$error_class = null,
$skipmsg = false)
{
$msg = !is_null($msg) ? $msg : $this->parser;
$err = new XML_Parser_Error($msg, $ecode);
@ -606,7 +590,7 @@ class XML_Parser extends PEAR
*
* @abstract
*/
function startHandler($xp, $elem, &$attribs)
function startHandler($xp, $elem, $attribs)
{
return NULL;
}

View File

@ -0,0 +1,26 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$username = $_POST["username"];
$password = $_POST["password"];
// Return Success story
if( OC_USER::setPassword( $username, $password )){
echo json_encode( array( "status" => "success", "data" => array( "username" => $username )));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to change password" )));
}
?>

View File

@ -0,0 +1,31 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$groupname = $_POST["groupname"];
// Does the group exist?
if( in_array( $groupname, OC_GROUP::getGroups())){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Group already exists" )));
exit();
}
// Return Success story
if( OC_GROUP::createGroup( $groupname )){
echo json_encode( array( "status" => "success", "data" => array( "groupname" => $groupname )));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add group" )));
}
?>

39
admin/ajax/createuser.php Normal file
View File

@ -0,0 +1,39 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$groups = array();
if( isset( $_POST["groups"] )){
$groups = $_POST["groups"];
}
$username = $_POST["username"];
$password = $_POST["password"];
// Does the group exist?
if( in_array( $username, OC_USER::getUsers())){
echo json_encode( array( "status" => "error", "data" => array( "message" => "User already exists" )));
exit();
}
// Return Success story
if( OC_USER::createUser( $username, $password )){
foreach( $groups as $i ){
OC_GROUP::addToGroup( $username, $i );
}
echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_GROUP::getUserGroups( $username )))));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add user" )));
}
?>

View File

@ -0,0 +1,25 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$name = $_POST["groupname"];
// Return Success story
if( OC_GROUP::deleteGroup( $name )){
echo json_encode( array( "status" => "success", "data" => array( "groupname" => $name )));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete group" )));
}
?>

25
admin/ajax/removeuser.php Normal file
View File

@ -0,0 +1,25 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$username = $_POST["username"];
// Return Success story
if( OC_USER::deleteUser( $username )){
echo json_encode( array( "status" => "success", "data" => array( "username" => $username )));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete user" )));
}
?>

View File

@ -0,0 +1,40 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
exit();
}
$success = true;
$error = "add user to";
$action = "add";
$username = $_POST["username"];
$group = $_POST["group"];
// Toggle group
if( OC_GROUP::inGroup( $username, $group )){
$action = "remove";
$error = "remove user from";
$success = OC_GROUP::removeFromGroup( $username, $group );
}
else{
$success = OC_GROUP::addToGroup( $username, $group );
}
// Return Success story
if( $success ){
echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "action" => $action, "groupname" => $group )));
}
else{
echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to $error group $group" )));
}
?>

13
admin/appinfo/app.php Normal file
View File

@ -0,0 +1,13 @@
<?php
OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_HELPER::imagePath( "admin", "administration.png" )));
OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "users.png" )));
OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" )));
OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "plugins.png" )));
// Add subentries for App installer
OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some&parameters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" )));
?>

91
admin/apps.php Normal file
View File

@ -0,0 +1,91 @@
<?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/>.
*
*/
require_once('../lib/base.php');
require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "", "index.php" ));
exit();
}
// Load the files we need
OC_UTIL::addStyle( "admin", "apps" );
if(isset($_GET['id'])) $id=$_GET['id']; else $id=0;
if(isset($_GET['cat'])) $cat=$_GET['cat']; else $cat=0;
$categories=OC_OCSCLIENT::getCategories();
/*
All
Installed Apps
foreach($categories as $key=>$value) {
print_r($value);
}
*/
// OC_APP::setActiveNavigationEntry( "core_apps_installed" );
if($id==0) {
OC_APP::setActiveNavigationEntry( "core_apps" );
if($cat==0){
$numcats=array();
foreach($categories as $key=>$value) $numcats[]=$key;
$apps=OC_OCSCLIENT::getApplications($numcats);
}else{
$apps=OC_OCSCLIENT::getApplications($cat);
}
// return template
$tmpl = new OC_TEMPLATE( "admin", "apps", "admin" );
$tmpl->assign( "categories", $categories );
$tmpl->assign( "apps", $apps );
$tmpl->printPage();
unset($tmpl);
}else{
OC_APP::setActiveNavigationEntry( "core_apps" );
$app=OC_OCSCLIENT::getApplication($id);
$tmpl = new OC_TEMPLATE( "admin", "app", "admin" );
$tmpl->assign( "categories", $categories );
$tmpl->assign( "app", $app );
$tmpl->printPage();
unset($tmpl);
}
?>

49
admin/css/apps.css Normal file
View File

@ -0,0 +1,49 @@
/* APPS TABLE */
table td.date
{
width: 5em;
padding: 0.5em 1em;
text-align: right;
}
.preview
{
padding: 3px;
text-align: left;
}
table td.date
{
width: 11em;
color: #555555;
}
table td.selection, table th.selection, table td.fileaction
{
width: 2em;
text-align: center;
}
table td.name a
{
padding: 6px;
text-decoration: none;
color: #555555;
}
.type
{
text-decoration: none;
color: #888888;
font-size: 0.8em;
}
.description
{
text-decoration: none;
color: #666666;
font-size: 0.9em;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

BIN
admin/img/apps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

BIN
admin/img/plugins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

BIN
admin/img/users.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

340
admin/js/users.js Normal file
View File

@ -0,0 +1,340 @@
$(document).ready(function(){
// Vars we need
var uid = "";
var gid = "";
var togglepassword = "";
var togglegroup = "";
//#########################################################################
// Stuff I don't understand
//#########################################################################
function doToggleGroup( group ){
$("#changegroupgid").val(group);
// Serialize the data
var post = $( "#changegroupsform" ).serialize();
// Ajax foo
$.post( 'ajax/togglegroups.php', post, function(data){
if( data.status == "success" ){
var groups = [];
$("input[x-use='togglegroup']").each( function(index){
if( $(this).attr("checked")){
groups.push($(this).val());
}
});
if( groups.length == 0 ){
$("#changegroups").prev().html( '&nbsp;' );
}
else{
$("#changegroups").prev().html( groups.join(", "));
}
}
else{
printError( data.data.message );
}
});
return false;
}
function printError( message ){
$("#errormessage").text( message );
$("#errordialog").dialog( "open" );
return false;
}
//#########################################################################
// Functions for editing the dom after user manipulation
//#########################################################################
// Manipulating the page after crteating a user
function userCreated( username, groups ){
// We need at least a space for showing the div
if( groups == "" ){
groups = '&nbsp;';
}
// Add user to table
var newrow = '<tr x-uid="'+username+'"><td x-use="username"><div x-use="usernamediv">'+username+'</div></td>';
newrow = newrow+'<td x-use="usergroups"><div x-use="usergroupsdiv">'+groups+'</td>';
newrow = newrow+'<td><a class="removeuserbutton" href="">remove</a></td></tr>';
$("#usertable").append( newrow );
// Clear forms
$("input[x-use='createuserfield']").val( "" );
$("input[x-use='createusercheckbox']").attr( "checked", false );
}
function userRemoved( username ){
$( "tr[x-uid='"+username+"']" ).remove();
}
function groupCreated( groupname ){
var newrow = '<tr x-gid="'+groupname+'"><td>' + groupname + '</td>';
newrow = newrow + '<td><a class="removegroupbutton" href="">remove</a></td></tr>';
$("#grouptable").append( newrow );
// Delete form content
$("input[x-use='creategroupfield']").val( "" );
// Add group option to Create User and Edit User
var createuser = '<input x-use="createusercheckbox" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-gid="'+groupname+'">'+groupname+'<br /></span>';
$("#createusergroups").append( createuser );
var changeuser = '<input x-use="togglegroup" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-use="togglegroup" x-gid="'+groupname+'">'+groupname+'<br /></span>';
$("#changegroupsform").append( changeuser );
}
function groupRemoved( groupname ){
// Delete the options
$( "tr[x-gid='"+groupname+"']" ).remove();
$( "span[x-gid='"+groupname+"']" ).remove();
$( "input[x-gid='"+groupname+"']" ).remove();
// remove it from user list
$( "div[x-use='usergroupsdiv']" ).each(function(index){
var content = $(this).text();
var list = content.split( ", " );
var newlist = [];
for( var i = 0; i < list.length; i++ ){
var temp = list[i];
if( temp != groupname ){
newlist.push( temp );
}
}
var newstring = newlist.join( ", " );
$(this).html( newstring )
});
}
//#########################################################################
// Editing the users properties by clicking the cell
//#########################################################################
// Password (clicking on user name)
$("div[x-use='usernamediv']").live( "click", function(){
if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){
togglepassword = $(this).parent().parent().attr("x-uid");
// Set the username!
$("#changepassworduid").val(togglepassword);
$("#changepasswordpwd").val("");
$(this).parent().append( $('#changepassword') );
$('#changepassword').show();
}
else{
$('#changepassword').hide();
togglepassword = "";
}
});
$("#changepasswordbutton").click( function(){
// Serialize the data
var post = $( "#changepasswordform" ).serialize();
// Ajax foo
$.post( 'ajax/changepassword.php', post, function(data){
if( data.status == "success" ){
togglepassword = "";
$('#changepassword').hide();
}
else{
printError( data.data.message );
}
});
return false;
});
// Groups
$("div[x-use='usergroupsdiv']").live( "click", function(){
if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){
togglegroup = $(this).parent().parent().attr("x-uid");
var groups = $(this).text();
groups = groups.split(", ");
$("input[x-use='togglegroup']").each( function(index){
var check = false;
// Group checked?
for( var i = 0; i < groups.length; i++ ){
if( $(this).val() == groups[i] ){
check = true;
}
}
// Check/uncheck
if( check ){
$(this).attr("checked","checked");
}
else{
$(this).removeAttr("checked");
}
});
$("#changegroupuid").val(togglegroup);
$(this).parent().append( $('#changegroups') );
$('#changegroups').show();
}
else{
var groups = [];
$("input[x-use='togglegroup']").each( function(index){
if( $(this).attr("checked")){
groups.push($(this).val());
}
});
if( groups.length == 0 ){
$("#changegroups").prev().html( '&nbsp;' );
}
else{
$("#changegroups").prev().html( groups.join(", "));
}
$('#changegroups').hide();
togglegroup = "";
}
});
$("span[x-use='togglegroup']").live( "click", function(){
if( $(this).prev().attr("checked")){
$(this).prev().removeAttr("checked")
}
else{
$(this).prev().attr("checked","checked")
}
doToggleGroup( $(this).attr("x-gid"));
});
$("input[x-use='togglegroup']").live( "click", function(){
doToggleGroup( $(this).attr("x-gid"));
});
//#########################################################################
// Clicking on buttons
//#########################################################################
// Show the create user form
$( "#createuseroptionbutton" )
.click(function(){
$("#createuserform").show();
$("#createuseroption").hide();
return false;
});
// Create a new user
$( "#createuserbutton" )
.click(function(){
// Create the post data
var post = $( "#createuserdata" ).serialize();
// Ajax call
$.post( 'ajax/createuser.php', post, function(data){
// If it says "success" then we are happy
if( data.status == "success" ){
userCreated( data.data.username, data.data.groups );
}
else{
printError( data.data.message );
}
});
return false;
});
$( ".removeuserbutton" ).live( 'click', function() {
uid = $( this ).parent().parent().attr( 'x-uid' );
$("#deleteuserusername").html(uid);
$("#deleteusernamefield").val(uid);
$("#removeuserform").dialog( "open" );
return false;
});
$( "#creategroupbutton" )
.click(function(){
// Serialize the data
var post = $( "#creategroupdata" ).serialize();
// Ajax foo
$.post( 'ajax/creategroup.php', post, function(data){
if( data.status == "success" ){
groupCreated( data.data.groupname );
}
else{
printError( data.data.message );
}
});
return false;
});
$( ".removegroupbutton" ).live( 'click', function(){
gid = $( this ).parent().parent().attr( 'x-gid' );
$("#removegroupgroupname").html(gid);
$("#removegroupnamefield").val(gid);
$("#removegroupform").dialog( "open" );
return false;
});
//#########################################################################
// Dialogs
//#########################################################################
// Removing users
$( "#errordialog" ).dialog({
autoOpen: false,
modal: true,
buttons: {
OK: function() {
$( this ).dialog( "close" );
}
}
});
// Removing users
$( "#removeuserform" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Remove user": function() {
var post = $( "#removeuserdata" ).serialize();
$.post( 'ajax/removeuser.php', post, function(data){
if( data.status == "success" ){
userRemoved( uid );
}
else{
printError( data.data.message );
}
});
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
true;
}
});
// Dialog for adding users
$( "#removegroupform" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Remove group": function(){
var post = $( "#removegroupdata" ).serialize();
$.post( 'ajax/removegroup.php', post, function(data){
if( data.status == "success" ){
groupRemoved( gid );
}
else{
printError( data.data.message );
}
});
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function(){
true;
}
});
} );

52
admin/plugins.php Normal file
View File

@ -0,0 +1,52 @@
<?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/>.
*
*/
require_once('../lib/base.php');
require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
}
OC_APP::setActiveNavigationEntry( "core_plugins" );
$plugins=array();
$blacklist=OC_PLUGIN::loadBlackList();
foreach( OC_PLUGIN::listPlugins() as $i ){
// Gather data about plugin
$data = OC_PLUGIN::getPluginData($plugin);
// Is it enabled?
$data["enabled"] = ( array_search( $plugin, $blacklist ) === false );
// Add the data
$plugins[] = $data;
}
$tmpl = new OC_TEMPLATE( "admin", "plugins", "admin" );
$tmpl->assign( "plugins", $plugins );
$tmpl->printPage();
?>

View File

@ -3,39 +3,35 @@
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
*
* @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
* 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
*
* 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/>.
*
*
*/
$CONFIG_ERROR='';
require_once('../lib/base.php');
require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
}
require_once('../inc/lib_base.php');
OC_APP::setActiveNavigationEntry( "administration" );
OC_UTIL::showheader();
$FIRSTRUN=false;
echo('<div class="center">');
OC_CONFIG::showadminform();
echo('</div>');
OC_UTIL::showfooter();
$tmpl = new OC_TEMPLATE( "admin", "system", "admin" );
$tmpl->printPage();
?>

27
admin/templates/app.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/*
* Template for Apps
*/
$app=$_['app'];
?>
<h1><?php echo $app["name"]; ?></h1>
<?php echo('<span class="type">'.$app['typename'].'</span>'); ?><br />
<span class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></span><br />
<table cellspacing="6" border="0" width="100%">
<tr>
<td width="1" valign="top">
<?php if($app["preview1"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview1"].'" /><br />'); } ?>
<?php if($app["preview2"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview2"].'" /><br />'); } ?>
<?php if($app["preview3"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview3"].'" /><br />'); } ?>
</td>
<td class="description" valign="top">
<?php echo $app["description"]; ?>
<br />
<?php echo('<a class="description" target="_blank" href="'.$app["detailpage"].'">read more</a><br />'); ?>
</td>
<td width="1" valign="top"><a class="prettybutton" href="">INSTALL</a></td>
</tr>
</table>

27
admin/templates/apps.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/*
* Template for Apps
*/
?>
<h1>Apps Repository</h1>
<table cellspacing="0">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Modified</th>
</tr>
</thead>
<tbody>
<?php foreach($_["apps"] as $app): ?>
<tr>
<td width="1"><?php if($app["preview"] <> "") { echo('<a href="'.OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id'].'"><img class="preview" border="0" src="'.$app["preview"].'" /></a>'); } ?> </a></td>
<td class="name"><a href="<?php echo(OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id']); ?>" title=""><?php echo $app["name"]; ?></a><br /><?php echo('<span class="type">'.$app['typename'].'</span>'); ?></td>
<td class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -0,0 +1,28 @@
<?php
/*
* Template for admin pages
*/
?>
<h1>Administration</h1>
<h2>Plugins</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Version</th>
<th>Author</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($_["plugins"] as $plugin): ?>
<td><?php echo $plugin["info"]["id"]; ?></td>
<td><?php echo $plugin["info"]["version"]; ?></td>
<td><?php echo $plugin["info"]["name"]; ?></td>
<td><?php echo $plugin["info"]["author"]; ?></td>
<td>enable</td>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -0,0 +1,8 @@
<?php
/*
* Template for admin pages
*/
?>
<h1>Administration</h1>
<h2>System Settings</h2>
#TBD

116
admin/templates/users.php Normal file
View File

@ -0,0 +1,116 @@
<h2>Users</h2>
<table id="usertable">
<thead>
<tr>
<th>Name</th>
<th>Groups</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr id="createuseroption">
<td><button id="createuseroptionbutton">Add user</button></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<form id="createuserdata">
<tr id="createuserform" style="display:none;">
<td>
Name <input x-use="createuserfield" type="text" name="username" /><br>
Password <input x-use="createuserfield" type="password" name="password" />
</td>
<td id="createusergroups">
<?php foreach($_["groups"] as $i): ?>
<input x-use="createusercheckbox" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" />
<span x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span>
<?php endforeach; ?>
</td>
<td>
<button id="createuserbutton">Create user</button>
</td>
</tr>
</form>
</tfoot>
<tbody>
<?php foreach($_["users"] as $user): ?>
<tr x-uid="<?php echo $user["name"] ?>">
<td x-use="username"><div x-use="usernamediv"><?php echo $user["name"]; ?></div></td>
<td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo "&nbsp";} ?></div></td>
<td><a class="removeuserbutton" href="">remove</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<h2>Groups</h2>
<table id="grouptable">
<thead>
<tr>
<th>Name</th>
<th></th>
</tr>
</thead>
<tfoot>
<form id="creategroupdata">
<tr>
<td><input x-use="creategroupfield" type="text" name="groupname" /></td>
<td><button id="creategroupbutton">Create group</button></td>
</tr>
</form>
</tfoot>
<tbody>
<?php foreach($_["groups"] as $group): ?>
<tr x-gid="<?php echo $group["name"]; ?>">
<td><?php echo $group["name"] ?></td>
<td>
<?php if( $group["name"] != "admin" ): ?>
<a class="removegroupbutton" href="">remove</a>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div id="changegroups" style="display:none">
<form id="changegroupsform">
<input id="changegroupuid" type="hidden" name="username" value="" />
<input id="changegroupgid" type="hidden" name="group" value="" />
<?php foreach($_["groups"] as $i): ?>
<input x-use="togglegroup" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" />
<span x-use="togglegroup" x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span>
<?php endforeach; ?>
</form>
</div>
<div id="changepassword" style="display:none">
<form id="changepasswordform">
<input id="changepassworduid" type="hidden" name="username" value="" />
Force new password:
<input id="changepasswordpwd" type="password" name="password" value="" />
<button id="changepasswordbutton">Set</button>
</form>
</div>
<div id="removeuserform" title="Remove user">
<form id="removeuserdata">
Do you really want to delete user <span id="deleteuserusername">$user</span>?
<input id="deleteusernamefield" type="hidden" name="username" value="">
</form>
</div>
<div id="removegroupform" title="Remove Group">
<form id="removegroupdata">
Do you really want to delete group <span id="removegroupgroupname">$group</span>?
<input id="removegroupnamefield" type="hidden" name="groupname" value="">
</form>
</div>
<div id="errordialog" title="Error">
<span id="errormessage"></span>
</div>

58
admin/users.php Normal file
View File

@ -0,0 +1,58 @@
<?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/>.
*
*/
require_once('../lib/base.php');
require( 'template.php' );
if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
}
// We have some javascript foo!
OC_UTIL::addScript( "admin", "users" );
OC_APP::setActiveNavigationEntry( "core_users" );
$users = array();
$groups = array();
foreach( OC_USER::getUsers() as $i ){
// Do some more work here soon
$ingroups = array();
foreach( OC_GROUP::getUserGroups( $i ) as $userGroup ){
$ingroups[] = $userGroup;
}
$users[] = array( "name" => $i, "groups" => join( ", ", $ingroups ));
}
foreach( OC_GROUP::getGroups() as $i ){
// Do some more work here soon
$groups[] = array( "name" => $i );
}
$tmpl = new OC_TEMPLATE( "admin", "users", "admin" );
$tmpl->assign( "users", $users );
$tmpl->assign( "groups", $groups );
$tmpl->printPage();
?>

1
apps/.gitkeep Normal file
View File

@ -0,0 +1 @@

Some files were not shown because too many files have changed in this diff Show More