mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 05:11:41 +02:00
fixes for PHP 5.4 warnings and strict warnings, thought disabled E_STRICT for now, because of various strict warnings in working code, which could not be easy fixed in all areas (see comment in phpgwapi/inc/functions.inc.php)
This commit is contained in:
parent
bade774bfa
commit
f676a23821
@ -305,7 +305,7 @@ class addressbook_so
|
|||||||
$this->content_types = config::get_content_types('addressbook');
|
$this->content_types = config::get_content_types('addressbook');
|
||||||
if (!$this->content_types)
|
if (!$this->content_types)
|
||||||
{
|
{
|
||||||
$this->content_types = $custom->content_types = array('n' => array(
|
$this->content_types = array('n' => array(
|
||||||
'name' => 'contact',
|
'name' => 'contact',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'template' => 'addressbook.edit',
|
'template' => 'addressbook.edit',
|
||||||
|
@ -723,7 +723,7 @@ class addressbook_sql extends so_sql_cf
|
|||||||
* @param string|array $extra_where=null extra where clause, eg. to check the etag, returns 'nothing_affected' if not affected rows
|
* @param string|array $extra_where=null extra where clause, eg. to check the etag, returns 'nothing_affected' if not affected rows
|
||||||
* @return int 0 on success and errno != 0 else
|
* @return int 0 on success and errno != 0 else
|
||||||
*/
|
*/
|
||||||
function save($keys=null)
|
function save($keys = NULL, $extra_where = NULL)
|
||||||
{
|
{
|
||||||
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) {
|
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) {
|
||||||
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
|
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
|
||||||
|
@ -174,9 +174,10 @@ class addressbook_tracking extends bo_tracking
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param array $old
|
* @param array $old
|
||||||
|
* @param int|string $receiver nummeric account_id or email address
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_message($data,$old)
|
protected function get_message($data,$old,$receiver=null)
|
||||||
{
|
{
|
||||||
if (!$data['modified'] || !$old)
|
if (!$data['modified'] || !$old)
|
||||||
{
|
{
|
||||||
@ -194,9 +195,11 @@ class addressbook_tracking extends bo_tracking
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param array $old
|
* @param array $old
|
||||||
|
* @param boolean $deleted=null can be set to true to let the tracking know the item got deleted or undelted
|
||||||
|
* @param int|string $receiver nummeric account_id or email address
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function get_subject($data,$old)
|
protected function get_subject($data,$old,$deleted=null,$receiver=null)
|
||||||
{
|
{
|
||||||
if ($data['is_contactform'])
|
if ($data['is_contactform'])
|
||||||
{
|
{
|
||||||
@ -208,11 +211,11 @@ class addressbook_tracking extends bo_tracking
|
|||||||
/**
|
/**
|
||||||
* Get the details of an entry
|
* Get the details of an entry
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array|object $data
|
||||||
*
|
* @param int|string $receiver nummeric account_id or email address
|
||||||
* @return array of details as array with values for keys 'label','value','type'
|
* @return array of details as array with values for keys 'label','value','type'
|
||||||
*/
|
*/
|
||||||
function get_details($data)
|
function get_details($data,$receiver=null)
|
||||||
{
|
{
|
||||||
foreach($this->contacts->contact_fields as $name => $label)
|
foreach($this->contacts->contact_fields as $name => $label)
|
||||||
{
|
{
|
||||||
|
@ -558,9 +558,9 @@ abstract class bo_merge
|
|||||||
);
|
);
|
||||||
$content = preg_replace(array_keys($replace_tags),array_values($replace_tags),$content, -1, $count);
|
$content = preg_replace(array_keys($replace_tags),array_values($replace_tags),$content, -1, $count);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
In the case where you have something like <span><span></w:t><w:br/><w:t></span></span> (invalid - mismatched tags),
|
In the case where you have something like <span><span></w:t><w:br/><w:t></span></span> (invalid - mismatched tags),
|
||||||
it takes multiple runs to get rid of both spans. So, loop.
|
it takes multiple runs to get rid of both spans. So, loop.
|
||||||
OO.o files have not yet been shown to have this problem.
|
OO.o files have not yet been shown to have this problem.
|
||||||
*/
|
*/
|
||||||
$count = $i = 0;
|
$count = $i = 0;
|
||||||
@ -1051,13 +1051,13 @@ abstract class bo_merge
|
|||||||
if($values[$key])
|
if($values[$key])
|
||||||
{
|
{
|
||||||
$date = new egw_time($values[$key]);
|
$date = new egw_time($values[$key]);
|
||||||
|
|
||||||
if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')//Excel WTF
|
if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')//Excel WTF
|
||||||
{
|
{
|
||||||
$interval = $date->diff(new egw_time('1900-01-00 0:00'));
|
$interval = $date->diff(new egw_time('1900-01-00 0:00'));
|
||||||
$values[$key] = $interval->format('%a')+1;// 1900-02-29 did not exist
|
$values[$key] = $interval->format('%a')+1;// 1900-02-29 did not exist
|
||||||
// 1440 minutes in a day - fractional part
|
// 1440 minutes in a day - fractional part
|
||||||
$values[$key] += ($date->format('H') * 60 + $date->format('i'))/1440;
|
$values[$key] += ($date->format('H') * 60 + $date->format('i'))/1440;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1415,7 +1415,8 @@ abstract class bo_merge
|
|||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
{
|
{
|
||||||
// return only the mime-types we support
|
// return only the mime-types we support
|
||||||
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name'])))) continue;
|
$parts = explode('.',$file['name']);
|
||||||
|
if (!self::is_implemented($file['mime'],'.'.array_pop($parts))) continue;
|
||||||
if ($mime_filter && $negativ_filter === in_array($file['mime'], (array)$mime_filter)) continue;
|
if ($mime_filter && $negativ_filter === in_array($file['mime'], (array)$mime_filter)) continue;
|
||||||
$list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
|
$list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
|
||||||
}
|
}
|
||||||
@ -1477,7 +1478,8 @@ abstract class bo_merge
|
|||||||
foreach($files as $key => $file)
|
foreach($files as $key => $file)
|
||||||
{
|
{
|
||||||
// use only the mime-types we support
|
// use only the mime-types we support
|
||||||
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name']))) ||
|
$parts = explode('.',$file['name']);
|
||||||
|
if (!self::is_implemented($file['mime'],'.'.array_pop($parts)) ||
|
||||||
!egw_vfs::check_access($file['path'], egw_vfs::READABLE, $file) || // remove files not readable by user
|
!egw_vfs::check_access($file['path'], egw_vfs::READABLE, $file) || // remove files not readable by user
|
||||||
$file['path'] === $default_doc) // default doc already added
|
$file['path'] === $default_doc) // default doc already added
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,8 @@ class vfs_widget
|
|||||||
}
|
}
|
||||||
if (($cell_name = $cell['name']) == '$row')
|
if (($cell_name = $cell['name']) == '$row')
|
||||||
{
|
{
|
||||||
$cell_name = array_pop($arr=explode('][',substr($form_name,0,-1)));
|
$arr = explode('][',substr($form_name,0,-1));
|
||||||
|
$cell_name = array_pop($arr);
|
||||||
}
|
}
|
||||||
$cell['name'] = '';
|
$cell['name'] = '';
|
||||||
$cell['type'] = 'hbox';
|
$cell['type'] = 'hbox';
|
||||||
|
@ -84,7 +84,7 @@ class filemanager_ui
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_view()
|
public static function get_view()
|
||||||
{
|
{
|
||||||
$view =& egw_cache::getSession('filemanager', 'view');
|
$view =& egw_cache::getSession('filemanager', 'view');
|
||||||
if (isset($_GET['view']))
|
if (isset($_GET['view']))
|
||||||
|
@ -660,9 +660,9 @@ class infolog_ui
|
|||||||
}
|
}
|
||||||
if (!$action)
|
if (!$action)
|
||||||
{
|
{
|
||||||
$action = $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
|
$action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
|
||||||
$action_id = $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
|
$action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
|
||||||
$action_title = $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));
|
$action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));
|
||||||
}
|
}
|
||||||
//echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values);
|
//echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values);
|
||||||
if (!is_array($values))
|
if (!is_array($values))
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.65 22 July 2005 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.65 22 July 2005 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
Set tabs to 8.
|
Set tabs to 8.
|
||||||
|
|
||||||
MySQL code that does not support transactions. Use mysqlt if you need transactions.
|
MySQL code that does not support transactions. Use mysqlt if you need transactions.
|
||||||
Requires mysql client. Works on Windows and Unix.
|
Requires mysql client. Works on Windows and Unix.
|
||||||
|
|
||||||
28 Feb 2001: MetaColumns bug fix - suggested by Freek Dijkstra (phpeverywhere@macfreek.com)
|
28 Feb 2001: MetaColumns bug fix - suggested by Freek Dijkstra (phpeverywhere@macfreek.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// security - hide paths
|
// security - hide paths
|
||||||
if (!defined('ADODB_DIR')) die();
|
if (!defined('ADODB_DIR')) die();
|
||||||
@ -22,8 +22,8 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
var $databaseType = 'mysql';
|
var $databaseType = 'mysql';
|
||||||
var $dataProvider = 'mysql';
|
var $dataProvider = 'mysql';
|
||||||
var $hasInsertID = true;
|
var $hasInsertID = true;
|
||||||
var $hasAffectedRows = true;
|
var $hasAffectedRows = true;
|
||||||
var $metaTablesSQL = "SHOW TABLES";
|
var $metaTablesSQL = "SHOW TABLES";
|
||||||
var $metaColumnsSQL = "SHOW COLUMNS FROM %s";
|
var $metaColumnsSQL = "SHOW COLUMNS FROM %s";
|
||||||
var $fmtTimeStamp = "'Y-m-d H:i:s'";
|
var $fmtTimeStamp = "'Y-m-d H:i:s'";
|
||||||
var $hasLimit = true;
|
var $hasLimit = true;
|
||||||
@ -38,100 +38,100 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
var $clientFlags = 0;
|
var $clientFlags = 0;
|
||||||
var $substr = "substring";
|
var $substr = "substring";
|
||||||
var $nameQuote = '`'; /// string to use to quote identifiers and names
|
var $nameQuote = '`'; /// string to use to quote identifiers and names
|
||||||
|
|
||||||
function ADODB_mysql()
|
function ADODB_mysql()
|
||||||
{
|
{
|
||||||
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
|
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
|
||||||
}
|
}
|
||||||
|
|
||||||
function ServerInfo()
|
function ServerInfo()
|
||||||
{
|
{
|
||||||
$arr['description'] = ADOConnection::GetOne("select version()");
|
$arr['description'] = ADOConnection::GetOne("select version()");
|
||||||
$arr['version'] = ADOConnection::_findvers($arr['description']);
|
$arr['version'] = ADOConnection::_findvers($arr['description']);
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function IfNull( $field, $ifNull )
|
function IfNull( $field, $ifNull )
|
||||||
{
|
{
|
||||||
return " IFNULL($field, $ifNull) "; // if MySQL
|
return " IFNULL($field, $ifNull) "; // if MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
|
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
|
||||||
{
|
{
|
||||||
$save = $this->metaTablesSQL;
|
$save = $this->metaTablesSQL;
|
||||||
if ($showSchema && is_string($showSchema)) {
|
if ($showSchema && is_string($showSchema)) {
|
||||||
$this->metaTablesSQL .= " from $showSchema";
|
$this->metaTablesSQL .= " from $showSchema";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mask) {
|
if ($mask) {
|
||||||
$mask = $this->qstr($mask);
|
$mask = $this->qstr($mask);
|
||||||
$this->metaTablesSQL .= " like $mask";
|
$this->metaTablesSQL .= " like $mask";
|
||||||
}
|
}
|
||||||
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
|
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
|
||||||
|
|
||||||
$this->metaTablesSQL = $save;
|
$this->metaTablesSQL = $save;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
|
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
|
||||||
{
|
{
|
||||||
// save old fetch mode
|
// save old fetch mode
|
||||||
global $ADODB_FETCH_MODE;
|
global $ADODB_FETCH_MODE;
|
||||||
|
|
||||||
$false = false;
|
$false = false;
|
||||||
$save = $ADODB_FETCH_MODE;
|
$save = $ADODB_FETCH_MODE;
|
||||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
if ($this->fetchMode !== FALSE) {
|
if ($this->fetchMode !== FALSE) {
|
||||||
$savem = $this->SetFetchMode(FALSE);
|
$savem = $this->SetFetchMode(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get index details
|
// get index details
|
||||||
$rs = $this->Execute(sprintf('SHOW INDEX FROM %s',$table));
|
$rs = $this->Execute(sprintf('SHOW INDEX FROM %s',$table));
|
||||||
|
|
||||||
// restore fetchmode
|
// restore fetchmode
|
||||||
if (isset($savem)) {
|
if (isset($savem)) {
|
||||||
$this->SetFetchMode($savem);
|
$this->SetFetchMode($savem);
|
||||||
}
|
}
|
||||||
$ADODB_FETCH_MODE = $save;
|
$ADODB_FETCH_MODE = $save;
|
||||||
|
|
||||||
if (!is_object($rs)) {
|
if (!is_object($rs)) {
|
||||||
return $false;
|
return $false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexes = array ();
|
$indexes = array ();
|
||||||
|
|
||||||
// parse index data into array
|
// parse index data into array
|
||||||
while ($row = $rs->FetchRow()) {
|
while ($row = $rs->FetchRow()) {
|
||||||
if ($primary == FALSE AND $row[2] == 'PRIMARY') {
|
if ($primary == FALSE AND $row[2] == 'PRIMARY') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($indexes[$row[2]])) {
|
if (!isset($indexes[$row[2]])) {
|
||||||
$indexes[$row[2]] = array(
|
$indexes[$row[2]] = array(
|
||||||
'unique' => ($row[1] == 0),
|
'unique' => ($row[1] == 0),
|
||||||
'columns' => array()
|
'columns' => array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4];
|
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort columns by order in the index
|
// sort columns by order in the index
|
||||||
foreach ( array_keys ($indexes) as $index )
|
foreach ( array_keys ($indexes) as $index )
|
||||||
{
|
{
|
||||||
ksort ($indexes[$index]['columns']);
|
ksort ($indexes[$index]['columns']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $indexes;
|
return $indexes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if magic quotes disabled, use mysql_real_escape_string()
|
// if magic quotes disabled, use mysql_real_escape_string()
|
||||||
function qstr($s,$magic_quotes=false)
|
function qstr($s,$magic_quotes=false)
|
||||||
{
|
{
|
||||||
if (!$magic_quotes) {
|
if (!$magic_quotes) {
|
||||||
|
|
||||||
if (ADODB_PHPVER >= 0x4300) {
|
if (ADODB_PHPVER >= 0x4300) {
|
||||||
if (is_resource($this->_connectionID))
|
if (is_resource($this->_connectionID))
|
||||||
return "'".mysql_real_escape_string($s,$this->_connectionID)."'";
|
return "'".mysql_real_escape_string($s,$this->_connectionID)."'";
|
||||||
@ -139,20 +139,20 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
if ($this->replaceQuote[0] == '\\'){
|
if ($this->replaceQuote[0] == '\\'){
|
||||||
$s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
|
$s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
|
||||||
}
|
}
|
||||||
return "'".str_replace("'",$this->replaceQuote,$s)."'";
|
return "'".str_replace("'",$this->replaceQuote,$s)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// undo magic quotes for "
|
// undo magic quotes for "
|
||||||
$s = str_replace('\\"','"',$s);
|
$s = str_replace('\\"','"',$s);
|
||||||
return "'$s'";
|
return "'$s'";
|
||||||
}
|
}
|
||||||
|
|
||||||
function _insertid()
|
function _insertid()
|
||||||
{
|
{
|
||||||
return ADOConnection::GetOne('SELECT LAST_INSERT_ID()');
|
return ADOConnection::GetOne('SELECT LAST_INSERT_ID()');
|
||||||
//return mysql_insert_id($this->_connectionID);
|
//return mysql_insert_id($this->_connectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetOne($sql,$inputarr=false)
|
function GetOne($sql,$inputarr=false)
|
||||||
{
|
{
|
||||||
if (strncasecmp($sql,'sele',4) == 0) {
|
if (strncasecmp($sql,'sele',4) == 0) {
|
||||||
@ -167,40 +167,40 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function BeginTrans()
|
function BeginTrans()
|
||||||
{
|
{
|
||||||
if ($this->debug) ADOConnection::outp("Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver");
|
if ($this->debug) ADOConnection::outp("Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver");
|
||||||
}
|
}
|
||||||
|
|
||||||
function _affectedrows()
|
function _affectedrows()
|
||||||
{
|
{
|
||||||
return mysql_affected_rows($this->_connectionID);
|
return mysql_affected_rows($this->_connectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
|
// See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
|
||||||
// Reference on Last_Insert_ID on the recommended way to simulate sequences
|
// Reference on Last_Insert_ID on the recommended way to simulate sequences
|
||||||
var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
|
var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
|
||||||
var $_genSeqSQL = "create table %s (id int not null)";
|
var $_genSeqSQL = "create table %s (id int not null)";
|
||||||
var $_genSeq2SQL = "insert into %s values (%s)";
|
var $_genSeq2SQL = "insert into %s values (%s)";
|
||||||
var $_dropSeqSQL = "drop table %s";
|
var $_dropSeqSQL = "drop table %s";
|
||||||
|
|
||||||
function CreateSequence($seqname='adodbseq',$startID=1)
|
function CreateSequence($seqname='adodbseq',$startID=1)
|
||||||
{
|
{
|
||||||
if (empty($this->_genSeqSQL)) return false;
|
if (empty($this->_genSeqSQL)) return false;
|
||||||
$u = strtoupper($seqname);
|
$u = strtoupper($seqname);
|
||||||
|
|
||||||
$ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname));
|
$ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname));
|
||||||
if (!$ok) return false;
|
if (!$ok) return false;
|
||||||
return $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
|
return $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function GenID($seqname='adodbseq',$startID=1)
|
function GenID($seqname='adodbseq',$startID=1)
|
||||||
{
|
{
|
||||||
// post-nuke sets hasGenID to false
|
// post-nuke sets hasGenID to false
|
||||||
if (!$this->hasGenID) return false;
|
if (!$this->hasGenID) return false;
|
||||||
|
|
||||||
$savelog = $this->_logsql;
|
$savelog = $this->_logsql;
|
||||||
$this->_logsql = false;
|
$this->_logsql = false;
|
||||||
$getnext = sprintf($this->_genIDSQL,$seqname);
|
$getnext = sprintf($this->_genIDSQL,$seqname);
|
||||||
@ -214,13 +214,13 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$rs = $this->Execute($getnext);
|
$rs = $this->Execute($getnext);
|
||||||
}
|
}
|
||||||
$this->genID = mysql_insert_id($this->_connectionID);
|
$this->genID = mysql_insert_id($this->_connectionID);
|
||||||
|
|
||||||
if ($rs) $rs->Close();
|
if ($rs) $rs->Close();
|
||||||
|
|
||||||
$this->_logsql = $savelog;
|
$this->_logsql = $savelog;
|
||||||
return $this->genID;
|
return $this->genID;
|
||||||
}
|
}
|
||||||
|
|
||||||
function &MetaDatabases()
|
function &MetaDatabases()
|
||||||
{
|
{
|
||||||
$qid = mysql_list_dbs($this->_connectionID);
|
$qid = mysql_list_dbs($this->_connectionID);
|
||||||
@ -234,11 +234,11 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Format date column in sql string given an input format that understands Y M D
|
// Format date column in sql string given an input format that understands Y M D
|
||||||
function SQLDate($fmt, $col=false)
|
function SQLDate($fmt, $col=false)
|
||||||
{
|
{
|
||||||
if (!$col) $col = $this->sysTimeStamp;
|
if (!$col) $col = $this->sysTimeStamp;
|
||||||
$s = 'DATE_FORMAT('.$col.",'";
|
$s = 'DATE_FORMAT('.$col.",'";
|
||||||
$concat = false;
|
$concat = false;
|
||||||
@ -246,7 +246,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
for ($i=0; $i < $len; $i++) {
|
for ($i=0; $i < $len; $i++) {
|
||||||
$ch = $fmt[$i];
|
$ch = $fmt[$i];
|
||||||
switch($ch) {
|
switch($ch) {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ($ch == '\\') {
|
if ($ch == '\\') {
|
||||||
$i++;
|
$i++;
|
||||||
@ -257,7 +257,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
case '/':
|
case '/':
|
||||||
$s .= $ch;
|
$s .= $ch;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
case 'y':
|
case 'y':
|
||||||
$s .= '%Y';
|
$s .= '%Y';
|
||||||
@ -265,7 +265,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
case 'M':
|
case 'M':
|
||||||
$s .= '%b';
|
$s .= '%b';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
$s .= '%m';
|
$s .= '%m';
|
||||||
break;
|
break;
|
||||||
@ -273,41 +273,41 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
case 'd':
|
case 'd':
|
||||||
$s .= '%d';
|
$s .= '%d';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'q':
|
case 'q':
|
||||||
$s .= "'),Quarter($col)";
|
$s .= "'),Quarter($col)";
|
||||||
|
|
||||||
if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
|
if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
|
||||||
else $s .= ",('";
|
else $s .= ",('";
|
||||||
$concat = true;
|
$concat = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
$s .= '%H';
|
$s .= '%H';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
$s .= '%I';
|
$s .= '%I';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
$s .= '%i';
|
$s .= '%i';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
$s .= '%s';
|
$s .= '%s';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
$s .= '%p';
|
$s .= '%p';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
$s .= '%w';
|
$s .= '%w';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
$s .= '%W';
|
$s .= '%W';
|
||||||
break;
|
break;
|
||||||
@ -317,7 +317,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
if ($concat) $s = "CONCAT($s)";
|
if ($concat) $s = "CONCAT($s)";
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// returns concatenated string
|
// returns concatenated string
|
||||||
// much easier to run "mysqld --ansi" or "mysqld --sql-mode=PIPES_AS_CONCAT" and use || operator
|
// much easier to run "mysqld --ansi" or "mysqld --sql-mode=PIPES_AS_CONCAT" and use || operator
|
||||||
@ -325,24 +325,24 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
{
|
{
|
||||||
$s = "";
|
$s = "";
|
||||||
$arr = func_get_args();
|
$arr = func_get_args();
|
||||||
|
|
||||||
// suggestion by andrew005@mnogo.ru
|
// suggestion by andrew005@mnogo.ru
|
||||||
$s = implode(',',$arr);
|
$s = implode(',',$arr);
|
||||||
if (strlen($s) > 0) return "CONCAT($s)";
|
if (strlen($s) > 0) return "CONCAT($s)";
|
||||||
else return '';
|
else return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function OffsetDate($dayFraction,$date=false)
|
function OffsetDate($dayFraction,$date=false)
|
||||||
{
|
{
|
||||||
if (!$date) $date = $this->sysDate;
|
if (!$date) $date = $this->sysDate;
|
||||||
return "from_unixtime(unix_timestamp($date)+($dayFraction)*24*3600)";
|
return "from_unixtime(unix_timestamp($date)+($dayFraction)*24*3600)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true or false
|
// returns true or false
|
||||||
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||||
{
|
{
|
||||||
if (!empty($this->port)) $argHostname .= ":".$this->port;
|
if (!empty($this->port)) $argHostname .= ":".$this->port;
|
||||||
|
|
||||||
if (ADODB_PHPVER >= 0x4300)
|
if (ADODB_PHPVER >= 0x4300)
|
||||||
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword,
|
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword,
|
||||||
$this->forceNewConnect,$this->clientFlags);
|
$this->forceNewConnect,$this->clientFlags);
|
||||||
@ -351,17 +351,17 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$this->forceNewConnect);
|
$this->forceNewConnect);
|
||||||
else
|
else
|
||||||
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword);
|
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword);
|
||||||
|
|
||||||
if ($this->_connectionID === false) return false;
|
if ($this->_connectionID === false) return false;
|
||||||
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true or false
|
// returns true or false
|
||||||
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||||
{
|
{
|
||||||
if (!empty($this->port)) $argHostname .= ":".$this->port;
|
if (!empty($this->port)) $argHostname .= ":".$this->port;
|
||||||
|
|
||||||
if (ADODB_PHPVER >= 0x4300)
|
if (ADODB_PHPVER >= 0x4300)
|
||||||
$this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
|
$this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
|
||||||
else
|
else
|
||||||
@ -369,16 +369,16 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
if ($this->_connectionID === false) return false;
|
if ($this->_connectionID === false) return false;
|
||||||
if ($this->autoRollback) $this->RollbackTrans();
|
if ($this->autoRollback) $this->RollbackTrans();
|
||||||
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||||
{
|
{
|
||||||
$this->forceNewConnect = true;
|
$this->forceNewConnect = true;
|
||||||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
|
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
|
||||||
}
|
}
|
||||||
|
|
||||||
function &MetaColumns($table)
|
function &MetaColumns($table,$upper=true)
|
||||||
{
|
{
|
||||||
$this->_findschema($table,$schema);
|
$this->_findschema($table,$schema);
|
||||||
if ($schema) {
|
if ($schema) {
|
||||||
@ -388,27 +388,27 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
global $ADODB_FETCH_MODE;
|
global $ADODB_FETCH_MODE;
|
||||||
$save = $ADODB_FETCH_MODE;
|
$save = $ADODB_FETCH_MODE;
|
||||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
|
|
||||||
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
|
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
|
||||||
$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
|
$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
|
||||||
|
|
||||||
if ($schema) {
|
if ($schema) {
|
||||||
$this->SelectDB($dbName);
|
$this->SelectDB($dbName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($savem)) $this->SetFetchMode($savem);
|
if (isset($savem)) $this->SetFetchMode($savem);
|
||||||
$ADODB_FETCH_MODE = $save;
|
$ADODB_FETCH_MODE = $save;
|
||||||
if (!is_object($rs)) {
|
if (!is_object($rs)) {
|
||||||
$false = false;
|
$false = false;
|
||||||
return $false;
|
return $false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$retarr = array();
|
$retarr = array();
|
||||||
while (!$rs->EOF){
|
while (!$rs->EOF){
|
||||||
$fld = new ADOFieldObject();
|
$fld = new ADOFieldObject();
|
||||||
$fld->name = $rs->fields[0];
|
$fld->name = $rs->fields[0];
|
||||||
$type = $rs->fields[1];
|
$type = $rs->fields[1];
|
||||||
|
|
||||||
// split type into type(length):
|
// split type into type(length):
|
||||||
$fld->scale = null;
|
$fld->scale = null;
|
||||||
if (preg_match("/^(.+)\((\d+),(\d+)/", $type, $query_array)) {
|
if (preg_match("/^(.+)\((\d+),(\d+)/", $type, $query_array)) {
|
||||||
@ -433,7 +433,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false);
|
$fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false);
|
||||||
$fld->binary = (strpos($type,'blob') !== false);
|
$fld->binary = (strpos($type,'blob') !== false);
|
||||||
$fld->unsigned = (strpos($type,'unsigned') !== false);
|
$fld->unsigned = (strpos($type,'unsigned') !== false);
|
||||||
|
|
||||||
if (!$fld->binary) {
|
if (!$fld->binary) {
|
||||||
$d = $rs->fields[4];
|
$d = $rs->fields[4];
|
||||||
if ($d != '' && $d != 'NULL') {
|
if ($d != '' && $d != 'NULL') {
|
||||||
@ -443,7 +443,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$fld->has_default = false;
|
$fld->has_default = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($save == ADODB_FETCH_NUM) {
|
if ($save == ADODB_FETCH_NUM) {
|
||||||
$retarr[] = $fld;
|
$retarr[] = $fld;
|
||||||
} else {
|
} else {
|
||||||
@ -451,26 +451,26 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
$rs->MoveNext();
|
$rs->MoveNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs->Close();
|
$rs->Close();
|
||||||
return $retarr;
|
return $retarr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true or false
|
// returns true or false
|
||||||
function SelectDB($dbName)
|
function SelectDB($dbName)
|
||||||
{
|
{
|
||||||
$this->database = $dbName;
|
$this->database = $dbName;
|
||||||
if ($this->_connectionID) {
|
if ($this->_connectionID) {
|
||||||
return @mysql_select_db($dbName,$this->_connectionID);
|
return @mysql_select_db($dbName,$this->_connectionID);
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parameters use PostgreSQL convention, not MySQL
|
// parameters use PostgreSQL convention, not MySQL
|
||||||
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
|
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
|
||||||
{
|
{
|
||||||
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
|
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
|
||||||
if ($nrows < 0) $nrows = '18446744073709551615';
|
if ($nrows < 0) $nrows = '18446744073709551615';
|
||||||
|
|
||||||
$offsetStr = (($offset>=0) ? (int)$offset.',' : '').(int)$nrows;
|
$offsetStr = (($offset>=0) ? (int)$offset.',' : '').(int)$nrows;
|
||||||
|
|
||||||
@ -491,34 +491,34 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$rs =& $this->Execute($sql.' LIMIT '.$offsetStr.' '.$FORUPDATE,$inputarr);
|
$rs =& $this->Execute($sql.' LIMIT '.$offsetStr.' '.$FORUPDATE,$inputarr);
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns queryID or false
|
// returns queryID or false
|
||||||
function _query($sql,$inputarr)
|
function _query($sql,$inputarr)
|
||||||
{
|
{
|
||||||
//global $ADODB_COUNTRECS;
|
//global $ADODB_COUNTRECS;
|
||||||
//if($ADODB_COUNTRECS)
|
//if($ADODB_COUNTRECS)
|
||||||
return mysql_query($sql,$this->_connectionID);
|
return mysql_query($sql,$this->_connectionID);
|
||||||
//else return @mysql_unbuffered_query($sql,$this->_connectionID); // requires PHP >= 4.0.6
|
//else return @mysql_unbuffered_query($sql,$this->_connectionID); // requires PHP >= 4.0.6
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns: the last error message from previous database operation */
|
/* Returns: the last error message from previous database operation */
|
||||||
function ErrorMsg()
|
function ErrorMsg()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->_logsql) return $this->_errorMsg;
|
if ($this->_logsql) return $this->_errorMsg;
|
||||||
if (empty($this->_connectionID)) $this->_errorMsg = @mysql_error();
|
if (empty($this->_connectionID)) $this->_errorMsg = @mysql_error();
|
||||||
else $this->_errorMsg = @mysql_error($this->_connectionID);
|
else $this->_errorMsg = @mysql_error($this->_connectionID);
|
||||||
return $this->_errorMsg;
|
return $this->_errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns: the last error number from previous database operation */
|
/* Returns: the last error number from previous database operation */
|
||||||
function ErrorNo()
|
function ErrorNo()
|
||||||
{
|
{
|
||||||
if ($this->_logsql) return $this->_errorCode;
|
if ($this->_logsql) return $this->_errorCode;
|
||||||
if (empty($this->_connectionID)) return @mysql_errno();
|
if (empty($this->_connectionID)) return @mysql_errno();
|
||||||
else return @mysql_errno($this->_connectionID);
|
else return @mysql_errno($this->_connectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true or false
|
// returns true or false
|
||||||
function _close()
|
function _close()
|
||||||
{
|
{
|
||||||
@ -526,23 +526,23 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
$this->_connectionID = false;
|
$this->_connectionID = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum size of C field
|
* Maximum size of C field
|
||||||
*/
|
*/
|
||||||
function CharMax()
|
function CharMax()
|
||||||
{
|
{
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum size of X field
|
* Maximum size of X field
|
||||||
*/
|
*/
|
||||||
function TextMax()
|
function TextMax()
|
||||||
{
|
{
|
||||||
return 4294967295;
|
return 4294967295;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
|
// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
|
||||||
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )
|
function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )
|
||||||
{
|
{
|
||||||
@ -578,7 +578,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
return $foreign_keys;
|
return $foreign_keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $charset2mysql translate www charsets to mysql ones
|
* @var array $charset2mysql translate www charsets to mysql ones
|
||||||
*/
|
*/
|
||||||
@ -611,7 +611,7 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
return $this->charSet ? $this->charSet : false;
|
return $this->charSet ? $this->charSet : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the client encoding from the connection
|
* sets the client encoding from the connection
|
||||||
*
|
*
|
||||||
@ -629,20 +629,20 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------------
|
||||||
Class Name: Recordset
|
Class Name: Recordset
|
||||||
--------------------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
class ADORecordSet_mysql extends ADORecordSet{
|
class ADORecordSet_mysql extends ADORecordSet{
|
||||||
|
|
||||||
var $databaseType = "mysql";
|
var $databaseType = "mysql";
|
||||||
var $canSeek = true;
|
var $canSeek = true;
|
||||||
|
|
||||||
function ADORecordSet_mysql($queryID,$mode=false)
|
function ADORecordSet_mysql($queryID,$mode=false)
|
||||||
{
|
{
|
||||||
if ($mode === false) {
|
if ($mode === false) {
|
||||||
global $ADODB_FETCH_MODE;
|
global $ADODB_FETCH_MODE;
|
||||||
$mode = $ADODB_FETCH_MODE;
|
$mode = $ADODB_FETCH_MODE;
|
||||||
}
|
}
|
||||||
@ -656,9 +656,9 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
$this->fetchMode = MYSQL_BOTH; break;
|
$this->fetchMode = MYSQL_BOTH; break;
|
||||||
}
|
}
|
||||||
$this->adodbFetchMode = $mode;
|
$this->adodbFetchMode = $mode;
|
||||||
$this->ADORecordSet($queryID);
|
$this->ADORecordSet($queryID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _initrs()
|
function _initrs()
|
||||||
{
|
{
|
||||||
//GLOBAL $ADODB_COUNTRECS;
|
//GLOBAL $ADODB_COUNTRECS;
|
||||||
@ -666,9 +666,9 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
$this->_numOfRows = @mysql_num_rows($this->_queryID);
|
$this->_numOfRows = @mysql_num_rows($this->_queryID);
|
||||||
$this->_numOfFields = @mysql_num_fields($this->_queryID);
|
$this->_numOfFields = @mysql_num_fields($this->_queryID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function &FetchField($fieldOffset = -1)
|
function &FetchField($fieldOffset = -1)
|
||||||
{
|
{
|
||||||
if ($fieldOffset != -1) {
|
if ($fieldOffset != -1) {
|
||||||
$o = @mysql_fetch_field($this->_queryID, $fieldOffset);
|
$o = @mysql_fetch_field($this->_queryID, $fieldOffset);
|
||||||
$f = @mysql_field_flags($this->_queryID,$fieldOffset);
|
$f = @mysql_field_flags($this->_queryID,$fieldOffset);
|
||||||
@ -681,7 +681,7 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
$o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich@att.com)
|
$o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich@att.com)
|
||||||
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
|
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,13 +691,13 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
$row =& ADORecordSet::GetRowAssoc($upper);
|
$row =& ADORecordSet::GetRowAssoc($upper);
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use associative array to get fields array */
|
/* Use associative array to get fields array */
|
||||||
function Fields($colname)
|
function Fields($colname)
|
||||||
{
|
{
|
||||||
// added @ by "Michael William Miller" <mille562@pilot.msu.edu>
|
// added @ by "Michael William Miller" <mille562@pilot.msu.edu>
|
||||||
if ($this->fetchMode != MYSQL_NUM) return @$this->fields[$colname];
|
if ($this->fetchMode != MYSQL_NUM) return @$this->fields[$colname];
|
||||||
|
|
||||||
if (!$this->bind) {
|
if (!$this->bind) {
|
||||||
$this->bind = array();
|
$this->bind = array();
|
||||||
for ($i=0; $i < $this->_numOfFields; $i++) {
|
for ($i=0; $i < $this->_numOfFields; $i++) {
|
||||||
@ -707,13 +707,13 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
}
|
}
|
||||||
return $this->fields[$this->bind[strtoupper($colname)]];
|
return $this->fields[$this->bind[strtoupper($colname)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
function _seek($row)
|
function _seek($row)
|
||||||
{
|
{
|
||||||
if ($this->_numOfRows == 0) return false;
|
if ($this->_numOfRows == 0) return false;
|
||||||
return @mysql_data_seek($this->_queryID,$row);
|
return @mysql_data_seek($this->_queryID,$row);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MoveNext()
|
function MoveNext()
|
||||||
{
|
{
|
||||||
//return adodb_movenext($this);
|
//return adodb_movenext($this);
|
||||||
@ -728,18 +728,18 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _fetch()
|
function _fetch()
|
||||||
{
|
{
|
||||||
$this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
|
$this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
|
||||||
return is_array($this->fields);
|
return is_array($this->fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _close() {
|
function _close() {
|
||||||
@mysql_free_result($this->_queryID);
|
@mysql_free_result($this->_queryID);
|
||||||
$this->_queryID = false;
|
$this->_queryID = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MetaType($t,$len=-1,$fieldobj=false)
|
function MetaType($t,$len=-1,$fieldobj=false)
|
||||||
{
|
{
|
||||||
if (is_object($t)) {
|
if (is_object($t)) {
|
||||||
@ -747,58 +747,58 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||||||
$t = $fieldobj->type;
|
$t = $fieldobj->type;
|
||||||
$len = $fieldobj->max_length;
|
$len = $fieldobj->max_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
$len = -1; // mysql max_length is not accurate
|
$len = -1; // mysql max_length is not accurate
|
||||||
switch (strtoupper($t)) {
|
switch (strtoupper($t)) {
|
||||||
case 'STRING':
|
case 'STRING':
|
||||||
case 'CHAR':
|
case 'CHAR':
|
||||||
case 'VARCHAR':
|
case 'VARCHAR':
|
||||||
case 'TINYBLOB':
|
case 'TINYBLOB':
|
||||||
case 'TINYTEXT':
|
case 'TINYTEXT':
|
||||||
case 'ENUM':
|
case 'ENUM':
|
||||||
case 'SET':
|
case 'SET':
|
||||||
if ($len <= $this->blobSize) return 'C';
|
if ($len <= $this->blobSize) return 'C';
|
||||||
|
|
||||||
case 'TEXT':
|
case 'TEXT':
|
||||||
case 'LONGTEXT':
|
case 'LONGTEXT':
|
||||||
case 'MEDIUMTEXT':
|
case 'MEDIUMTEXT':
|
||||||
return 'X';
|
return 'X';
|
||||||
|
|
||||||
// php_mysql extension always returns 'blob' even if 'text'
|
// php_mysql extension always returns 'blob' even if 'text'
|
||||||
// so we have to check whether binary...
|
// so we have to check whether binary...
|
||||||
case 'IMAGE':
|
case 'IMAGE':
|
||||||
case 'LONGBLOB':
|
case 'LONGBLOB':
|
||||||
case 'BLOB':
|
case 'BLOB':
|
||||||
case 'MEDIUMBLOB':
|
case 'MEDIUMBLOB':
|
||||||
return !empty($fieldobj->binary) ? 'B' : 'X';
|
return !empty($fieldobj->binary) ? 'B' : 'X';
|
||||||
|
|
||||||
case 'YEAR':
|
case 'YEAR':
|
||||||
case 'DATE': return 'D';
|
case 'DATE': return 'D';
|
||||||
|
|
||||||
case 'TIME':
|
case 'TIME':
|
||||||
case 'DATETIME':
|
case 'DATETIME':
|
||||||
case 'TIMESTAMP': return 'T';
|
case 'TIMESTAMP': return 'T';
|
||||||
|
|
||||||
case 'INT':
|
case 'INT':
|
||||||
case 'INTEGER':
|
case 'INTEGER':
|
||||||
case 'BIGINT':
|
case 'BIGINT':
|
||||||
case 'TINYINT':
|
case 'TINYINT':
|
||||||
case 'MEDIUMINT':
|
case 'MEDIUMINT':
|
||||||
case 'SMALLINT':
|
case 'SMALLINT':
|
||||||
|
|
||||||
if (!empty($fieldobj->primary_key)) return 'R';
|
if (!empty($fieldobj->primary_key)) return 'R';
|
||||||
else return 'I';
|
else return 'I';
|
||||||
|
|
||||||
default: return 'N';
|
default: return 'N';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ADORecordSet_ext_mysql extends ADORecordSet_mysql {
|
class ADORecordSet_ext_mysql extends ADORecordSet_mysql {
|
||||||
function ADORecordSet_ext_mysql($queryID,$mode=false)
|
function ADORecordSet_ext_mysql($queryID,$mode=false)
|
||||||
{
|
{
|
||||||
if ($mode === false) {
|
if ($mode === false) {
|
||||||
global $ADODB_FETCH_MODE;
|
global $ADODB_FETCH_MODE;
|
||||||
$mode = $ADODB_FETCH_MODE;
|
$mode = $ADODB_FETCH_MODE;
|
||||||
}
|
}
|
||||||
@ -814,7 +814,7 @@ class ADORecordSet_ext_mysql extends ADORecordSet_mysql {
|
|||||||
$this->adodbFetchMode = $mode;
|
$this->adodbFetchMode = $mode;
|
||||||
$this->ADORecordSet($queryID);
|
$this->ADORecordSet($queryID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MoveNext()
|
function MoveNext()
|
||||||
{
|
{
|
||||||
return @adodb_movenext($this);
|
return @adodb_movenext($this);
|
||||||
|
@ -133,7 +133,7 @@ class accounts_sql
|
|||||||
$data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User';
|
$data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User';
|
||||||
// if we call lang() before the translation-class is correctly setup,
|
// if we call lang() before the translation-class is correctly setup,
|
||||||
// we can't switch away from english language anymore!
|
// we can't switch away from english language anymore!
|
||||||
if ($GLOBALS['egw']->translation->lang_arr)
|
if (translation::$lang_arr)
|
||||||
{
|
{
|
||||||
$data['account_lastname'] = lang($data['account_lastname']);
|
$data['account_lastname'] = lang($data['account_lastname']);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ abstract class egw_framework
|
|||||||
/**
|
/**
|
||||||
* Constructor for static variables
|
* Constructor for static variables
|
||||||
*/
|
*/
|
||||||
public function init_static()
|
public static function init_static()
|
||||||
{
|
{
|
||||||
self::$js_include_mgr = new egw_include_mgr(array(
|
self::$js_include_mgr = new egw_include_mgr(array(
|
||||||
// allways load jquery (not -ui) and egw_json first
|
// allways load jquery (not -ui) and egw_json first
|
||||||
|
@ -54,9 +54,11 @@ class solink
|
|||||||
* @param string $id2 id in $app2
|
* @param string $id2 id in $app2
|
||||||
* @param string $remark='' Remark to be saved with the link (defaults to '')
|
* @param string $remark='' Remark to be saved with the link (defaults to '')
|
||||||
* @param int $owner=0 Owner of the link (defaults to user)
|
* @param int $owner=0 Owner of the link (defaults to user)
|
||||||
* @return boolean/int False (for db or param-error) or link_id for success
|
* @param int $lastmod=0 timestamp of last modification (defaults to now=time())
|
||||||
|
* @param int $no_notify=0 &1 dont notify $app1, &2 dont notify $app2
|
||||||
|
* @return int/boolean False (for db or param-error) or on success link_id (Please not the return-value of $id1)
|
||||||
*/
|
*/
|
||||||
static function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
|
static function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0,$no_notify=0 )
|
||||||
{
|
{
|
||||||
if (self::DEBUG)
|
if (self::DEBUG)
|
||||||
{
|
{
|
||||||
@ -235,7 +237,7 @@ class solink
|
|||||||
* @param boolean $hold_for_purge Don't really delete the link, just mark it as deleted and wait for final delete of linked entry
|
* @param boolean $hold_for_purge Don't really delete the link, just mark it as deleted and wait for final delete of linked entry
|
||||||
* @return array with deleted links
|
* @return array with deleted links
|
||||||
*/
|
*/
|
||||||
static function &unlink($link_id,$app='',$id='',$owner=0,$app2='',$id2='',$hold_for_purge=false)
|
static function unlink($link_id,$app='',$id='',$owner=0,$app2='',$id2='',$hold_for_purge=false)
|
||||||
{
|
{
|
||||||
if (self::DEBUG)
|
if (self::DEBUG)
|
||||||
{
|
{
|
||||||
|
@ -260,7 +260,7 @@ class translation
|
|||||||
//$start = microtime(true);
|
//$start = microtime(true);
|
||||||
// for loginscreen we have to use a instance specific cache!
|
// for loginscreen we have to use a instance specific cache!
|
||||||
$instance_specific = in_array($app,self::$instance_specific_translations);
|
$instance_specific = in_array($app,self::$instance_specific_translations);
|
||||||
$loaded =& egw_cache::getCache($instance_specific ? egw_cache::INSTANCE : egw_cache::TREE,
|
$loaded = egw_cache::getCache($instance_specific ? egw_cache::INSTANCE : egw_cache::TREE,
|
||||||
__CLASS__,$app.':'.$lang);
|
__CLASS__,$app.':'.$lang);
|
||||||
|
|
||||||
// do NOT use automatic callback to cache result, as installing languages in setup can create
|
// do NOT use automatic callback to cache result, as installing languages in setup can create
|
||||||
|
@ -17,7 +17,11 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL & ~E_NOTICE);
|
// E_STRICT in PHP 5.4 gives various strict warnings in working code, which can NOT be easy fixed in all use-cases :-(
|
||||||
|
// Only variables should be assigned by reference, eg. soetemplate::tree_walk()
|
||||||
|
// Declaration of <extended method> should be compatible with <parent method>, varios places where method parameters change
|
||||||
|
// --> switching it off for now, as it makes error-log unusable
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
|
||||||
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
|
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
|
||||||
{
|
{
|
||||||
set_magic_quotes_runtime(false);
|
set_magic_quotes_runtime(false);
|
||||||
|
@ -629,7 +629,7 @@ egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['acc
|
|||||||
* @param array $apps
|
* @param array $apps
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function topmenu(array &$vars,array &$apps)
|
function topmenu(array $vars,array $apps)
|
||||||
{
|
{
|
||||||
$this->tplsav2->menuitems = array();
|
$this->tplsav2->menuitems = array();
|
||||||
$this->tplsav2->menuinfoitems = array();
|
$this->tplsav2->menuinfoitems = array();
|
||||||
|
@ -31,7 +31,7 @@ class jerryr_framework extends idots_framework
|
|||||||
parent::__construct($template);
|
parent::__construct($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
function topmenu(array &$vars,array &$apps)
|
function topmenu(array $vars,array $apps)
|
||||||
{
|
{
|
||||||
$this->tplsav2->menuitems = array();
|
$this->tplsav2->menuitems = array();
|
||||||
$this->tplsav2->menuinfoitems = array();
|
$this->tplsav2->menuinfoitems = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user