php7 fixes (mysqli)

This commit is contained in:
nikolark committed 2016-08-16 23:41:58 +02:00
1 parent 38f7c99aa9
commit 402a7f7477
18 files changed
+169 -181

No files matched your search

+3 -1
View File
@@ -1,12 +1,14 @@
## Konfigurasjon
Du må endre instillinger for database, migrering (key og server), payex betaling og snapporder-integrasjon.
cp inside/credentials-sample.php inside/credentials.php
cp inside/migration/config.example.php inside/migration/config.php
cp includes/payex2/payex_defines.example.php includes/payex2/payex_defines.php
cp snapporder/config-sample.php snapporder/config.php
Du trenger kanskje å endre ting i includes/Ldap_defines.php også.
Du trenger kanskje å endre ting i `includes/Ldap_defines.php` også.
## Installasjon
Legg inn Apache, MySQL og PHP. Du trenger også noen utvidelser til PHP.
sudo apt-get install php5-mysql php5-ldap
+39 -24
View File
@@ -5,7 +5,7 @@
/**
* Database independent query interface
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: DB.php 315557 2011-08-26 14:32:35Z danielc $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -426,12 +426,12 @@ define('DB_PORTABILITY_ALL', 63);
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB
{
// {{{ &factory()
// {{{ factory()
/**
* Create a new DB object for the specified database type but don't
@@ -444,7 +444,7 @@ class DB
*
* @see DB_common::setOption()
*/
function &factory($type, $options = false)
public static function factory($type, $options = false)
{
if (!is_array($options)) {
$options = array('persistent' => $options);
@@ -480,7 +480,7 @@ class DB
}
// }}}
// {{{ &connect()
// {{{ connect()
/**
* Create a new DB object including a connection to the specified database
@@ -495,7 +495,7 @@ class DB
* 'portability' => DB_PORTABILITY_ALL,
* );
*
* $db =& DB::connect($dsn, $options);
* $db = DB::connect($dsn, $options);
* if (PEAR::isError($db)) {
* die($db->getMessage());
* }
@@ -515,7 +515,7 @@ class DB
*
* @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
*/
function &connect($dsn, $options = array())
public static function connect($dsn, $options = array())
{
$dsninfo = DB::parseDSN($dsn);
$type = $dsninfo['phptype'];
@@ -539,7 +539,8 @@ class DB
if (!class_exists($classname)) {
$tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
"Unable to include the DB/{$type}.php"
. " file for '$dsn'",
. " file for '"
. DB::getDSNString($dsn, true) . "'",
'DB_Error', true);
return $tmp;
}
@@ -576,7 +577,7 @@ class DB
*/
function apiVersion()
{
return '1.7.14';
return '1.9.2';
}
// }}}
@@ -589,7 +590,7 @@ class DB
*
* @return bool whether $value is DB_Error object
*/
function isError($value)
public static function isError($value)
{
return is_object($value) && is_a($value, 'DB_Error');
}
@@ -604,7 +605,7 @@ class DB
*
* @return bool whether $value is a DB_<driver> object
*/
function isConnection($value)
public static function isConnection($value)
{
return (is_object($value) &&
is_subclass_of($value, 'db_common') &&
@@ -625,7 +626,7 @@ class DB
*
* @return boolean whether $query is a data manipulation query
*/
function isManip($query)
public static function isManip($query)
{
$manips = 'INSERT|UPDATE|DELETE|REPLACE|'
. 'CREATE|DROP|'
@@ -649,7 +650,7 @@ class DB
* @return string the error message or false if the error code was
* not recognized
*/
function errorMessage($value)
public static function errorMessage($value)
{
static $errorMessages;
if (!isset($errorMessages)) {
@@ -730,7 +731,7 @@ class DB
* + username: User name for login
* + password: Password for login
*/
function parseDSN($dsn)
public static function parseDSN($dsn)
{
$parsed = array(
'phptype' => false,
@@ -859,7 +860,7 @@ class DB
* @param boolean true to hide the password, false to include it
* @return string
*/
function getDSNString($dsn, $hidePassword) {
public static function getDSNString($dsn, $hidePassword) {
/* Calling parseDSN will ensure that we have all the array elements
* defined, and means that we deal with strings and array in the same
* manner. */
@@ -940,7 +941,7 @@ class DB
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_Error extends PEAR_Error
@@ -958,18 +959,32 @@ class DB_Error extends PEAR_Error
*
* @see PEAR_Error
*/
function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
function __construct($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
$this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
parent::__construct('DB Error: ' . DB::errorMessage($code), $code,
$mode, $level, $debuginfo);
} else {
$this->PEAR_Error("DB Error: $code", DB_ERROR,
parent::__construct("DB Error: $code", DB_ERROR,
$mode, $level, $debuginfo);
}
}
/**
* Workaround to both avoid the "Redefining already defined constructor"
* PHP error and provide backward compatibility in case someone is calling
* DB_Error() dynamically
*/
public function __call($method, $arguments)
{
if ($method == 'DB_Error') {
return call_user_func_array(array($this, '__construct'), $arguments);
}
trigger_error(
'Call to undefined method DB_Error::' . $method . '()', E_USER_ERROR
);
}
// }}}
}
@@ -987,7 +1002,7 @@ class DB_Error extends PEAR_Error
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_result
@@ -1094,7 +1109,7 @@ class DB_result
*
* @return void
*/
function DB_result(&$dbh, $result, $options = array())
function __construct(&$dbh, $result, $options = array())
{
$this->autofree = $dbh->options['autofree'];
$this->dbh = &$dbh;
@@ -1452,7 +1467,7 @@ class DB_result
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @see DB_common::setFetchMode()
*/
@@ -1467,7 +1482,7 @@ class DB_row
*
* @return void
*/
function DB_row(&$arr)
function __construct(&$arr)
{
foreach ($arr as $key => $value) {
$this->$key = &$arr[$key];
+6 -7
View File
@@ -5,7 +5,7 @@
/**
* Contains the DB_common base class
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: common.php 315557 2011-08-26 14:32:35Z danielc $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -42,7 +42,7 @@ require_once 'PEAR.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_common extends PEAR
@@ -145,7 +145,7 @@ class DB_common extends PEAR
*
* @return void
*/
function DB_common()
function __construct()
{
$this->PEAR('DB_Error');
}
@@ -261,7 +261,7 @@ class DB_common extends PEAR
*/
function quoteString($string)
{
$string = $this->quote($string);
$string = $this->quoteSmart($string);
if ($string{0} == "'") {
return substr($string, 1, -1);
}
@@ -284,8 +284,7 @@ class DB_common extends PEAR
*/
function quote($string = null)
{
return ($string === null) ? 'NULL'
: "'" . str_replace("'", "''", $string) . "'";
return $this->quoteSmart($string);
}
// }}}
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's dbase extension
* for interacting with dBase databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: dbase.php 242771 2007-09-21 13:40:42Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_dbase extends DB_common
@@ -140,13 +140,13 @@ class DB_dbase extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_dbase()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's fbsql extension
* for interacting with FrontBase databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: fbsql.php 239211 2007-07-06 05:19:21Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @since Class functional since Release 1.7.0
*/
@@ -124,13 +124,13 @@ class DB_fbsql extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_fbsql()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -6
View File
@@ -9,7 +9,7 @@
* While this class works with PHP 4, PHP's InterBase extension is
* unstable in PHP 4. Use PHP 5.
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -23,7 +23,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ibase.php 277804 2009-03-26 07:16:31Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -49,7 +49,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @since Class became stable in Release 1.7.0
*/
@@ -180,13 +180,13 @@ class DB_ibase extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_ibase()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's ifx extension
* for interacting with Informix databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ifx.php 302738 2010-08-24 03:06:52Z clockwerx $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -48,7 +48,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_ifx extends DB_common
@@ -167,13 +167,13 @@ class DB_ifx extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_ifx()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -6
View File
@@ -10,7 +10,7 @@
* 4.3.11 and 5.0.4. Make sure your version of PHP meets or exceeds
* those versions.
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -23,7 +23,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: msql.php 242771 2007-09-21 13:40:42Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @since Class not functional until Release 1.7.0
*/
@@ -126,13 +126,13 @@ class DB_msql extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_msql()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mssql extension
* for interacting with Microsoft SQL Server databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mssql.php 306603 2010-12-24 06:05:07Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -49,7 +49,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_mssql extends DB_common
@@ -179,13 +179,13 @@ class DB_mssql extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_mssql()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -17
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mysql extension
* for interacting with MySQL databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysql.php 242769 2007-09-21 13:32:52Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_mysql extends DB_common
@@ -162,13 +162,13 @@ class DB_mysql extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_mysql()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
@@ -772,17 +772,6 @@ class DB_mysql extends DB_common
return '`' . str_replace('`', '``', $str) . '`';
}
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}}
// {{{ escapeSimple()
+15 -7
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mysqli extension
* for interacting with MySQL databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -19,7 +19,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysqli.php 315557 2011-08-26 14:32:35Z danielc $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -43,7 +43,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @since Class functional since Release 1.6.3
*/
@@ -224,13 +224,13 @@ class DB_mysqli extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_mysqli()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
@@ -497,7 +497,11 @@ class DB_mysqli extends DB_common
*/
function freeResult($result)
{
return is_resource($result) ? mysqli_free_result($result) : false;
if (! $result instanceof mysqli_result) {
return false;
}
mysqli_free_result($result);
return true;
}
// }}}
@@ -1031,6 +1035,10 @@ class DB_mysqli extends DB_common
? $this->mysqli_types[$tmp->type]
: 'unknown',
// http://bugs.php.net/?id=36579
// Doc Bug #36579: mysqli_fetch_field length handling
// https://bugs.php.net/bug.php?id=62426
// Bug #62426: mysqli_fetch_field_direct returns incorrect
// length on UTF8 fields
'len' => $tmp->length,
'flags' => $flags,
);
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's oci8 extension
* for interacting with Oracle databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: oci8.php 293241 2010-01-08 05:00:28Z danielc $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_oci8 extends DB_common
@@ -173,13 +173,13 @@ class DB_oci8 extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_oci8()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+6 -18
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's odbc extension
* for interacting with databases via ODBC connections
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: odbc.php 239211 2007-07-06 05:19:21Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -44,7 +44,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_odbc extends DB_common
@@ -153,13 +153,13 @@ class DB_odbc extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_odbc()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
@@ -480,18 +480,6 @@ class DB_odbc extends DB_common
}
}
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
* @internal
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}}
// {{{ nextId()
+6 -18
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's pgsql extension
* for interacting with PostgreSQL databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: pgsql.php 306604 2010-12-24 06:09:35Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -43,7 +43,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_pgsql extends DB_common
@@ -148,13 +148,13 @@ class DB_pgsql extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_pgsql()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
@@ -465,18 +465,6 @@ class DB_pgsql extends DB_common
return false;
}
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
* @internal
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}}
// {{{ quoteBoolean()
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's sqlite extension
* for interacting with SQLite databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version CVS: $Id: sqlite.php 306605 2010-12-24 06:22:59Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_sqlite extends DB_common
@@ -152,13 +152,13 @@ class DB_sqlite extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_sqlite()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+4 -4
View File
@@ -5,7 +5,7 @@
/**
* Provides an object interface to a table row
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -18,7 +18,7 @@
* @author Stig Bakken <stig@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: storage.php 241120 2007-08-12 05:27:25Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -38,7 +38,7 @@ require_once 'DB.php';
* @author Stig Bakken <stig@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_storage extends PEAR
@@ -94,7 +94,7 @@ class DB_storage extends PEAR
* a reference to this object
*
*/
function DB_storage($table, $keycolumn, &$dbh, $validator = null)
function __construct($table, $keycolumn, &$dbh, $validator = null)
{
$this->PEAR('DB_Error');
$this->_table = $table;
+6 -6
View File
@@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's sybase extension
* for interacting with Sybase databases
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
@@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: sybase.php 242771 2007-09-21 13:40:42Z aharvey $
* @version CVS: $Id$
* @link http://pear.php.net/package/DB
*/
@@ -46,7 +46,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14
* @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_sybase extends DB_common
@@ -141,13 +141,13 @@ class DB_sybase extends DB_common
// {{{ constructor
/**
* This constructor calls <kbd>$this->DB_common()</kbd>
* This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
function DB_sybase()
function __construct()
{
$this->DB_common();
parent::__construct();
}
// }}}
+30 -31
View File
@@ -8,23 +8,23 @@ $extraScriptParams = Array ();
require_once('credentials.php');
function db_connect($host = "default") {
if (!isset ($GLOBALS['db_conn'][$host])) {
$conn = & DB :: connect(getDSN($host), array('debug' => 2));
if (DB :: isError($conn)) {
if ($conn->getCode() == -24) {
error("Databasen er for øyeblikket utilgjengelig, vennligst forsøk igjen siden.");
return false;
}
else {
error("Database error: " . $conn->toString());
return false;
}
}
else {
$GLOBALS['db_conn'][$host] = & $conn;
}
if( isset($GLOBALS['db_conn'][$host]) ) {
return $GLOBALS['db_conn'][$host];
}
$conn = DB::connect(getDSN($host), array('debug' => 2));
if (DB::isError($conn)) {
if ($conn->getCode() == -24) {
error("Databasen er for øyeblikket utilgjengelig, vennligst forsøk igjen siden.");
} else {
error("Database error: " . $conn->toString());
}
return false;
}
//$conn->query('SET NAMES utf8'); // set charset
$GLOBALS['db_conn'][$host] = $conn;
return $GLOBALS['db_conn'][$host];
}
@@ -62,29 +62,28 @@ function remove_backslashes($val) {
}
function scriptParam($name) {
if (isset ($val))
unset ($val);
if (isset($val) ) {
unset($val);
}
if (isset ($GLOBALS['extraScriptParams'][$name])) {
$val = $GLOBALS['extraScriptParams'][$name];
} else if (isset ($_POST[$name])) {
$conn = db_connect();
$val = $conn->escapeSimple($_POST[$name]);
} else if (isset ($_GET[$name])) {
$val = $_GET[$name];
} else if (isset ($_COOKIE[getCurrentUser()][$name])) {
$val = $_COOKIE[getCurrentUser()][$name];
}
else
if (isset ($_POST[$name])) {
$val = mysql_real_escape_string($_POST[$name]);
}
else
if (isset ($_GET[$name])) {
$val = $_GET[$name];
}
else
if (isset ($_COOKIE[getCurrentUser()][$name])) {
$val = $_COOKIE[getCurrentUser()][$name];
}
if (isset ($val) && get_magic_quotes_gpc()) {
$val = remove_backslashes($val);
}
// return @$val rather than $val to prevent "undefined value"
// messages in case $val is unset and warnings are enabled
return (@ $val);
return @$val;
}
function getCurrentUser() {