From 3c23ce30e0291cb855bc1303755617b69005f615 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 16 Nov 2009 09:01:01 +0000 Subject: [PATCH] fixing PHP5.3 deprecated warnings --- addressbook/csv_import.php | 8 +- .../inc/class.addressbook_groupdav.inc.php | 4 +- .../inc/class.addressbook_ldap.inc.php | 2 +- .../inc/class.addressbook_merge.inc.php | 4 +- addressbook/inc/class.addressbook_so.inc.php | 4 +- addressbook/inc/class.addressbook_sql.inc.php | 4 +- .../inc/class.addressbook_tracking.inc.php | 2 +- addressbook/inc/hook_home.inc.php | 2 +- admin/inc/class.admin_cmd.inc.php | 2 +- admin/inc/class.admin_cmd_change_pw.inc.php | 2 +- admin/inc/class.boaccess_history.inc.php | 2 +- admin/inc/class.bocurrentsessions.inc.php | 2 +- admin/inc/class.customfields.inc.php | 2 +- admin/inc/class.uiaccounts.inc.php | 2 +- admin/inc/class.uiconfig.inc.php | 4 +- calendar/csv_import.php | 10 +- doc/fix_depricated.php | 216 +++++++++++++++++ doc/modernize.php | 219 ------------------ egw-pear/Log.php | 2 +- egw-pear/Log/observer.php | 6 +- egw-pear/Net/Sieve.php | 2 +- emailadmin/inc/class.ajaxemailadmin.inc.php | 4 +- emailadmin/inc/class.pleskimap.inc.php | 2 +- emailadmin/inc/class.smtpplesk.inc.php | 2 +- .../inc/class.advancedsearch_widget.inc.php | 4 +- .../inc/class.ajax_select_widget.inc.php | 2 +- etemplate/inc/class.date_widget.inc.php | 10 +- etemplate/inc/class.db_tools.inc.php | 4 +- etemplate/inc/class.editor.inc.php | 12 +- etemplate/inc/class.etemplate.inc.php | 8 +- etemplate/inc/class.historylog_widget.inc.php | 4 +- etemplate/inc/class.link_widget.inc.php | 6 +- etemplate/inc/class.nextmatch_widget.inc.php | 8 +- etemplate/inc/class.select_widget.inc.php | 2 +- etemplate/inc/class.so_sql.inc.php | 4 +- etemplate/inc/class.soetemplate.inc.php | 8 +- etemplate/inc/class.solangfile.inc.php | 4 +- etemplate/inc/class.tab_widget.inc.php | 6 +- etemplate/inc/class.tree_widget.inc.php | 2 +- etemplate/inc/class.uietemplate_gtk.inc.php | 46 ++-- etemplate/inc/class.xmltool.inc.php | 16 +- etemplate/inc/class.xslt_widget.inc.php | 2 +- etemplate/inc/class.xul_io.inc.php | 42 ++-- felamimail/inc/class.Script.inc.php | 2 +- felamimail/inc/class.ajax_contacts.inc.php | 2 +- felamimail/inc/class.ajaxfelamimail.inc.php | 58 ++--- felamimail/inc/class.bosieve.inc.php | 2 +- felamimail/inc/class.uisieve.inc.php | 6 +- importexport/inc/class.uidefinitions.inc.php | 12 +- importexport/inc/class.uiexport.inc.php | 2 +- infolog/csv_import.php | 6 +- .../inc/class.infolog_customfields.inc.php | 2 +- infolog/inc/class.infolog_datasource.inc.php | 4 +- infolog/inc/class.infolog_groupdav.inc.php | 4 +- infolog/inc/class.infolog_widget.inc.php | 2 +- login.php | 2 +- .../inc/class.ajaxnotifications.inc.php | 2 +- phpgwapi/inc/adodb/adodb-datadict.inc.php | 2 +- phpgwapi/inc/adodb/adodb-pear.inc.php | 4 +- phpgwapi/inc/adodb/adodb-perf.inc.php | 4 +- phpgwapi/inc/adodb/adodb-xmlschema.inc.php | 4 +- phpgwapi/inc/adodb/adodb.inc.php | 4 +- .../adodb/drivers/adodb-informix72.inc.php | 2 +- phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php | 2 +- .../adodb/drivers/adodb-postgres64.inc.php | 2 +- .../adodb/drivers/adodb-sybase_ase.inc.php | 2 +- .../inc/adodb/session/adodb-encrypt-md5.php | 4 +- phpgwapi/inc/class.accounts_sql.inc.php | 2 +- phpgwapi/inc/class.acl.inc.php | 2 +- phpgwapi/inc/class.asyncservice.inc.php | 2 +- phpgwapi/inc/class.auth_ads.inc.php | 2 +- phpgwapi/inc/class.auth_sql.inc.php | 2 +- phpgwapi/inc/class.browser.inc.php | 16 +- phpgwapi/inc/class.categories.inc.php | 6 +- phpgwapi/inc/class.common.inc.php | 4 +- phpgwapi/inc/class.contenthistory.inc.php | 4 +- phpgwapi/inc/class.egw.inc.php | 6 +- phpgwapi/inc/class.egw_db.inc.php | 2 +- phpgwapi/inc/class.egw_framework.inc.php | 2 +- phpgwapi/inc/class.egw_session.inc.php | 4 +- phpgwapi/inc/class.error.inc.php | 2 +- phpgwapi/inc/class.http.inc.php | 2 +- phpgwapi/inc/class.interserver.inc.php | 2 +- phpgwapi/inc/class.javascript.inc.php | 2 +- phpgwapi/inc/class.jscalendar.inc.php | 4 +- phpgwapi/inc/class.phpmailer.inc.php | 4 +- phpgwapi/inc/class.soap_client.inc.php | 4 +- phpgwapi/inc/class.soap_parser.inc.php | 16 +- phpgwapi/inc/class.soap_server.inc.php | 10 +- phpgwapi/inc/class.soapmsg.inc.php | 8 +- phpgwapi/inc/class.soapval.inc.php | 4 +- .../inc/class.sqlfs_stream_wrapper.inc.php | 2 +- phpgwapi/inc/class.translation.inc.php | 14 +- phpgwapi/inc/class.validator.inc.php | 4 +- phpgwapi/inc/class.vcard.inc.php | 20 +- phpgwapi/inc/class.wsdl.inc.php | 2 +- phpgwapi/inc/class.xml.inc.php | 48 ++-- phpgwapi/inc/class.xmlrpc_client.inc.php | 14 +- phpgwapi/inc/class.xmlrpc_server.inc.php | 4 +- phpgwapi/inc/class.xmlrpc_server_epi.inc.php | 6 +- phpgwapi/inc/class.xmlrpc_server_php.inc.php | 10 +- phpgwapi/inc/class.xmlrpcmsg.inc.php | 10 +- phpgwapi/inc/class.xmlrpcresp.inc.php | 2 +- phpgwapi/inc/class.xmlrpcval.inc.php | 2 +- phpgwapi/inc/common_functions.inc.php | 18 +- phpgwapi/inc/fpdf/tutorial/tuto6.php | 2 +- phpgwapi/inc/savant2/Savant2.php | 8 +- .../Savant2/Savant2_Compiler_basic.php | 2 +- .../inc/savant2/Savant2/tests/1_assign.php | 2 +- .../inc/savant2/Savant2/tests/2_display.php | 2 +- .../inc/savant2/Savant2/tests/3_fetch.php | 2 +- .../inc/savant2/Savant2/tests/4_plugins.php | 2 +- .../inc/savant2/Savant2/tests/5_filters.php | 2 +- .../inc/savant2/Savant2/tests/6_paths.php | 2 +- .../inc/savant2/Savant2/tests/7_include.php | 2 +- .../inc/savant2/Savant2/tests/8_extend.php | 2 +- .../inc/savant2/Savant2/tests/9_errors.php | 2 +- .../inc/savant2/Savant2/tests/compile.php | 4 +- phpgwapi/inc/savant2/Savant2/tests/form.php | 2 +- phpgwapi/inc/savant2/Savant2/tests/form2.php | 2 +- .../tests/templates/compile_bad.tpl.php | 2 +- phpgwapi/inc/xml_functions.inc.php | 12 +- phpgwapi/setup/tables_update.inc.php | 4 +- .../idots/class.idots_framework.inc.php | 8 +- preferences/inc/class.ajaxpreferences.inc.php | 2 +- .../inc/class.resources_select_widget.inc.php | 2 +- setup/inc/class.setup_cmd_header.inc.php | 2 +- setup/inc/class.setup_cmd_install.inc.php | 2 +- setup/inc/class.setup_html.inc.php | 2 +- setup/inc/class.setup_translation.inc.php | 2 +- setup/inc/functions.inc.php | 2 +- setup/lang.php | 2 +- setup/manageheader.php | 2 +- setup/setup-cli.php | 2 +- soap.php | 4 +- timesheet/fix_lost_links.php | 4 +- .../inc/class.timesheet_datasource.inc.php | 2 +- timesheet/inc/class.timesheet_ui.inc.php | 4 +- xajax.php | 4 +- xmlrpc.php | 4 +- 140 files changed, 603 insertions(+), 606 deletions(-) create mode 100755 doc/fix_depricated.php delete mode 100755 doc/modernize.php diff --git a/addressbook/csv_import.php b/addressbook/csv_import.php index 6990cd5e7d..6dbdcfa177 100644 --- a/addressbook/csv_import.php +++ b/addressbook/csv_import.php @@ -92,7 +92,7 @@ function cat_id($cats) return ''; } $ids = array(); - foreach(split(' *[,;] *',$cats) as $cat) + foreach(preg_split('/ *[,;] */',$cats) as $cat) { if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--') { @@ -332,8 +332,8 @@ switch($_POST['action']) { if(ereg((string) $pattern,$val)) { - // echo "

csv_idx='$csv_idx',info='$addr',trans_csv=".print_r($trans_csv).",ereg_replace('$pattern','$replace','$val') = "; - $val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val); + // echo "

csv_idx='$csv_idx',info='$addr',trans_csv=".print_r($trans_csv).",preg_replace('/$pattern/','$replace','$val') = "; + $val = preg_replace('/'.(string) $pattern.'/',str_replace($VPre,'\\',$replace),(string) $val); // echo "'$val'

"; $reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg; @@ -379,7 +379,7 @@ switch($_POST['action']) if (isset($values[$date]) && !is_numeric($date)) { // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format - $values[$date] = ereg_replace('([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})','\3-\2-\1',$values[$date]); + $values[$date] = preg_replace('/([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})/','\3-\2-\1',$values[$date]); // remove fractures of seconds if present at the end of the string if (ereg('(.*)\.[0-9]+',$values[$date],$parts)) $values[$date] = $parts[1]; $values[$date] = strtotime($values[$date]); diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index 0aa9280845..50cc399132 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -53,7 +53,7 @@ class addressbook_groupdav extends groupdav_handler { parent::__construct($app,$debug,$base_uri); - $this->bo =& new addressbook_bo(); + $this->bo = new addressbook_bo(); } /** @@ -290,7 +290,7 @@ class addressbook_groupdav extends groupdav_handler */ private function _get_handler() { - $handler =& new addressbook_vcal(); + $handler = new addressbook_vcal(); $handler->setSupportedFields('GroupDAV',$this->agent); return $handler; diff --git a/addressbook/inc/class.addressbook_ldap.inc.php b/addressbook/inc/class.addressbook_ldap.inc.php index bd2c33bb98..a13e7a5496 100644 --- a/addressbook/inc/class.addressbook_ldap.inc.php +++ b/addressbook/inc/class.addressbook_ldap.inc.php @@ -937,7 +937,7 @@ class addressbook_ldap return $this->_error(__LINE__); // baseDN does NOT exist and we cant/wont create it } // create a admin connection to add the needed DN - $adminLDAP =& new ldap; + $adminLDAP = new ldap; $adminDS = $adminLDAP->ldapConnect(); list(,$ou) = explode(',',$baseDN); diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index 8564689dec..e02d8cd206 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -35,7 +35,7 @@ class addressbook_merge // extends bo_merge */ function __construct() { - $this->contacts =& new addressbook_bo(); + $this->contacts = new addressbook_bo(); } /** @@ -159,7 +159,7 @@ class addressbook_merge // extends bo_merge function calendar_replacements($id,$last_event_too=false) { require_once(EGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_boupdate.inc.php'); - $calendar =& new calendar_boupdate(); + $calendar = new calendar_boupdate(); // next events $events = $calendar->search(array( diff --git a/addressbook/inc/class.addressbook_so.inc.php b/addressbook/inc/class.addressbook_so.inc.php index 70e34abbbc..7be61bd8c2 100755 --- a/addressbook/inc/class.addressbook_so.inc.php +++ b/addressbook/inc/class.addressbook_so.inc.php @@ -217,7 +217,7 @@ class addressbook_so if($GLOBALS['egw_info']['server']['contact_repository'] == 'ldap' && $this->account_repository == 'ldap') { $this->contact_repository = 'ldap'; - $this->somain =& new addressbook_ldap(); + $this->somain = new addressbook_ldap(); if ($this->user) // not set eg. in setup { @@ -236,7 +236,7 @@ class addressbook_so { $this->contact_repository = 'sql-ldap'; } - $this->somain =& new addressbook_sql(); + $this->somain = new addressbook_sql(); if ($this->user) // not set eg. in setup { diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 72e5de7626..f38c5ad421 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -516,7 +516,7 @@ class addressbook_sql extends so_sql if ($this->db->select($this->lists_table,'list_id',array( 'list_name' => $name, 'list_owner' => $owner, - ),__LINE__,__FILE__)->fetchSingle()) + ),__LINE__,__FILE__)->fetchColumn()) { return true; // return existing list-id } @@ -551,7 +551,7 @@ class addressbook_sql extends so_sql if ($this->db->select($this->ab2list_table,'list_id',array( 'contact_id' => $contact, 'list_id' => $list, - ),__LINE__,__FILE__)->fetchSingle()) + ),__LINE__,__FILE__)->fetchColumn()) { return true; // no need to insert it, would give sql error } diff --git a/addressbook/inc/class.addressbook_tracking.inc.php b/addressbook/inc/class.addressbook_tracking.inc.php index d5cba6b78c..916448c01e 100644 --- a/addressbook/inc/class.addressbook_tracking.inc.php +++ b/addressbook/inc/class.addressbook_tracking.inc.php @@ -92,7 +92,7 @@ class addressbook_tracking extends bo_tracking case 'copy': if ($data['is_contactform']) { - return split(', ?',$data['email_contactform']); + return preg_split('/, ?/',$data['email_contactform']); } break; diff --git a/addressbook/inc/hook_home.inc.php b/addressbook/inc/hook_home.inc.php index 3c44cd6236..f03d15d0ce 100644 --- a/addressbook/inc/hook_home.inc.php +++ b/addressbook/inc/hook_home.inc.php @@ -16,7 +16,7 @@ if ($GLOBALS['egw_info']['user']['apps']['addressbook'] && if (!(int) $days) $days = 1; // old pref - $contacts =& new addressbook_bo(); + $contacts = new addressbook_bo(); $month_start = date('*-m-*',$contacts->now_su); $bdays =& $contacts->search(array('bday' => $month_start),array('id','n_family','n_given','bday'),'n_given,n_family'); diff --git a/admin/inc/class.admin_cmd.inc.php b/admin/inc/class.admin_cmd.inc.php index 7747fd51f6..4120af47d2 100644 --- a/admin/inc/class.admin_cmd.inc.php +++ b/admin/inc/class.admin_cmd.inc.php @@ -795,7 +795,7 @@ abstract class admin_cmd return admin_cmd::run_queued_jobs(); } include_once(EGW_API_INC.'/class.asyncservice.inc.php'); - $async =& new asyncservice(); + $async = new asyncservice(); // we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class! list($app) = explode('_',$class=$next['type']); diff --git a/admin/inc/class.admin_cmd_change_pw.inc.php b/admin/inc/class.admin_cmd_change_pw.inc.php index 939c9c1b29..211ea10777 100644 --- a/admin/inc/class.admin_cmd_change_pw.inc.php +++ b/admin/inc/class.admin_cmd_change_pw.inc.php @@ -50,7 +50,7 @@ class admin_cmd_change_pw extends admin_cmd if ($check_only) return true; - $auth =& new auth; + $auth = new auth; if (!$auth->change_password(null, $this->password, $account_id)) { diff --git a/admin/inc/class.boaccess_history.inc.php b/admin/inc/class.boaccess_history.inc.php index 52179070a4..4dd93b3a78 100644 --- a/admin/inc/class.boaccess_history.inc.php +++ b/admin/inc/class.boaccess_history.inc.php @@ -56,7 +56,7 @@ if (ereg('@',$record['loginid'])) { - $t = split('@',$record['loginid']); + $t = explode('@',$record['loginid']); $record['loginid'] = $t[0]; } diff --git a/admin/inc/class.bocurrentsessions.inc.php b/admin/inc/class.bocurrentsessions.inc.php index 06a6fd8034..814b7d4b34 100644 --- a/admin/inc/class.bocurrentsessions.inc.php +++ b/admin/inc/class.bocurrentsessions.inc.php @@ -33,7 +33,7 @@ { if (ereg('@',$value['session_lid'])) { - $t = split('@',$value['session_lid']); + $t = explode('@',$value['session_lid']); $session_lid = $t[0]; } else diff --git a/admin/inc/class.customfields.inc.php b/admin/inc/class.customfields.inc.php index 4eb1594743..0276abd154 100644 --- a/admin/inc/class.customfields.inc.php +++ b/admin/inc/class.customfields.inc.php @@ -230,7 +230,7 @@ class customfields { foreach(explode("\n",$field['values']) as $line) { - list($var,$value) = split('=',trim($line),2); + list($var,$value) = explode('=',trim($line),2); $var = trim($var); $values[$var] = empty($value) ? $var : $value; } diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index 19b3194dd3..2cea1bd3ac 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -1577,7 +1577,7 @@ function ajax_check_account_email($first,$last,$account_lid,$account_id,$email,$id) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if (!$email) { $response->addAssign('email','value',$GLOBALS['egw']->common->email_address($first,$last,$account_lid)); diff --git a/admin/inc/class.uiconfig.inc.php b/admin/inc/class.uiconfig.inc.php index 5aec610fd6..9c0f8b8c7f 100644 --- a/admin/inc/class.uiconfig.inc.php +++ b/admin/inc/class.uiconfig.inc.php @@ -108,7 +108,7 @@ } } /* don't erase passwords, since we also don't print them */ - elseif(!ereg('passwd',$key) && !ereg('password',$key) && !ereg('root_pw',$key)) + elseif(strpos($key,'passwd') === false && strpos($key,'password') === false && strpos($key,'root_pw') === false) { unset($c->config_data[$key]); } @@ -181,7 +181,7 @@ case 'value': $newval = str_replace(' ','_',$newval); /* Don't show passwords in the form */ - if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value)) + if(strpos($value,'passwd') !== false || strpos($value,'password') !== false || strpos($value,'root_pw') !== false) { $t->set_var($value,''); } diff --git a/calendar/csv_import.php b/calendar/csv_import.php index f79a560323..8645c4ba08 100644 --- a/calendar/csv_import.php +++ b/calendar/csv_import.php @@ -102,7 +102,7 @@ function cat_id($cats) return ''; } - foreach(split('[,;]',$cats) as $cat) + foreach(preg_split('/[,;]/',$cats) as $cat) { if (isset($cat2id[$cat])) { @@ -374,8 +374,8 @@ case 'import': { if (ereg((string) $pattern,$val)) { - //echo "

csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",ereg_replace('$pattern','$replace','$val') = "; - $val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val); + //echo "

csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",preg_replace('/$pattern/','$replace','$val') = "; + $val = preg_replace('/'.(string) $pattern.'/',str_replace($VPre,'\\',$replace),(string) $val); //echo "'$val'"; $reg = $CPreReg.'([a-zA-Z_0-9 ]+)'.$CPosReg; @@ -440,14 +440,14 @@ case 'import': if (isset($values[$date]) && !is_numeric($date)) { // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format - $values[$date] = ereg_replace('([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})','\3-\2-\1',$values[$date]); + $values[$date] = preg_replace('/([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})/','\3-\2-\1',$values[$date]); // remove fractures of seconds if present at the end of the string if (ereg('(.*)\.[0-9]+',$values[$date],$parts)) $values[$date] = $parts[1]; $values[$date] = strtotime($values[$date]); } } // convert participants-names to user-id's - $parts = $values['participants'] ? split('[,;]',$values['participants']) : array(); + $parts = $values['participants'] ? preg_split('/[,;]/',$values['participants']) : array(); $values['participants'] = array(); foreach($parts as $part_status) { diff --git a/doc/fix_depricated.php b/doc/fix_depricated.php new file mode 100755 index 0000000000..e40d6e3f25 --- /dev/null +++ b/doc/fix_depricated.php @@ -0,0 +1,216 @@ +#!/usr/bin/php -qC +fix_depricated.php must NOT be called as web-page --> exiting !!!'); +} + +/** + * Fix depricated stuff in a given file + * + * @param string $file filename + * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created + * @return boolean false on error + */ +function fix_depricated($file,$replace_file=false) +{ + $orig = $lines = file_get_contents($file); + if ($lines === false) return false; + global $prog; + if (basename($file) == $prog) return true; // dont fix ourself ;-) + + // PHP Deprecated: Assigning the return value of new by reference is deprecated + if (preg_match('/= *& *new /m',$lines)) + { + $lines = preg_replace('/= *& *new /','= new ',$lines); + } + // PHP Deprecated: Function split() is deprecated + if (preg_match_all('/[= \t(]+spliti? *\\(("[^"]*"|\'[^\']*\'),/m',$lines,$matches)) + { + $replace = array(); + //print_r($matches); + foreach($matches[1] as $key => $pattern) + { + $full_pattern = $matches[0][$key]; + // single char --> just explode + if (strlen($pattern) == 3 || strlen($pattern) == 4 && substr($pattern,0,2) == '"\\') + { + $replace[$full_pattern] = str_replace('split','explode',$full_pattern); + } + else + { + $preg_pattern = $pattern[0].'/'.str_replace('/','\\\\/',substr($pattern,1,-1)).'/'.$pattern[0]; + if (strpos($full_pattern,'spliti')) $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0]; + $replace[$full_pattern] = str_replace(array('spliti','split',$pattern),array('preg_split','preg_split',$preg_pattern),$full_pattern); + } + } + //print_r($replace); + $lines = strtr($lines,$replace); + } + // PHP Deprecated: Function ereg() is deprecated + if (preg_match_all('/!?eregi? *\\(("[^"]+"[^,]*|\'[^\']+\'[^,]*), *(\$[A-Za-z0-9_]+)(, *\$[A-Za-z0-9_]+)?\)([ )&|]+)/m',$lines,$matches)) + { + $replace = array(); + //print_r($matches); + foreach($matches[1] as $key => $pattern) + { + $full_pattern = $matches[0][$key]; + $what = $matches[2][$key]; + + // simple existence check --> use strpos() + if (preg_quote($pattern) == $pattern) + { + + $replace[$full_pattern] = (strpos($full_pattern,'eregi')!==false?'strposi':'strpos').'('.$what.','.$pattern. + ') '.($full_pattern[0]=='!'?'===':'!==').' false'.$matches[4][$key]; + } + else + { + // full ereg regular expression --> preg_match + $preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'"); + $replace[$full_pattern] = str_replace(array('eregi','ereg',$pattern),array('preg_match','preg_match',$preg_pattern),$full_pattern); + } + } + //print_r($replace); + $lines = strtr($lines,$replace); + } + // PHP Deprecated: Function ereg_replace() is deprecated + if (preg_match_all('/eregi?_replace *\\((".+"|\'.+\'|[^,]+), *(.+), *[\'s$].+\)[,; =]/m',$lines,$matches)) + { + $replace = array(); + //print_r($matches); + foreach($matches[1] as $key => $pattern) + { + $full_pattern = $matches[0][$key]; + $other = $matches[2][$key]; + + // simple replace --> use str_replace() + if (preg_quote($pattern) == $pattern) + { + $replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace'),array('stri_replace','str_replace'),$full_pattern); + } + else + { + // full ereg regular expression --> preg_replace + $preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'"); + $replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace',$pattern), + array('preg_replace','preg_replace',$preg_pattern),$full_pattern); + } + } + //print_r($replace); + $lines = strtr($lines,$replace); + } + // remove extra '/' from regular expressions + $lines = str_replace(array("'/'.'","'.'/'","'.'/i'"),array("'/","/'","/i'"),$lines); + + // fix call to not longer existing PDO method $result->fetchSingle() + $lines = str_replace('->fetchSingle(','->fetchColumn(',$lines); + + if ($lines != $orig) + { + file_put_contents($file.'53',$lines); + system('/usr/bin/php -l '.$file.'53',$ret); + system('/usr/bin/diff -u '.$file.' '.$file.'53'); + if (!$ret && $replace_file) + { + unlink($file); + rename($file.'53',$file); + } + return !$ret; + } + return true; +} + +/** + * Loop recursive through directory and call fix_depricated for each php file + * + * @param string $dir + * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created + * @return boolean false on error + */ +function fix_depricated_recursive($dir,$replace_file=false) +{ + if (!is_dir($dir)) return false; + + foreach(scandir($dir) as $file) + { + if ($file == '.' || $file == '..') continue; + + if (is_dir($dir.'/'.$file)) + { + fix_depricated_recursive($dir.'/'.$file,$replace_file); + } + elseif(substr($file,-4) == '.php') + { + echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': '; + fix_depricated($dir.'/'.$file,$replace_file); + } + } + echo "\r".str_repeat(' ',100)."\r"; + return true; +} + +/** + * Give usage + * + * @param string $error=null + */ +function usage($error=null) +{ + global $prog; + echo "Usage: $prog [--replace] [-h|--help] file or dir\n\n"; + if ($error) echo $error."\n\n"; + exit($error ? 1 : 0); +} + +$args = $_SERVER['argv']; +$prog = basename(array_shift($args)); + +if (!$args) usage(); + +$replace_file = false; +while(($arg = array_shift($args))) +{ + switch($arg) + { + case '-h': + case '--help': + usage(); + break; + + case '--replace': + $replace_file = true; + break; + + default: + if ($args) // not last argument + { + usage("Unknown argument '$arg'!"); + } + break 2; + } +} + +if (!file_exists($arg)) usage("Error: $arg not found!"); + +if (!is_dir($arg)) +{ + fix_depricated($arg,$replace_file); +} +else +{ + fix_depricated_recursive($arg,$replace_file); +} \ No newline at end of file diff --git a/doc/modernize.php b/doc/modernize.php deleted file mode 100755 index 2660f813b1..0000000000 --- a/doc/modernize.php +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/php -qC - * -* ------------------------------------------------------- * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 2 of the License, or (at your * -* option) any later version. * -\**************************************************************************/ - -/* $Id$ */ - -error_reporting(E_ALL & ~ E_NOTICE); - -// defaults -$no_phpgw = $do_replace = false; -$remove_space_indention = 2; // replace 2 space with a tab - -while ($argc > 2) -{ - switch($argv[1]) - { - case '--no-phpgw': - $no_phpgw = true; - break; - - case '--remove-space-indention': - $remove_space_indention = (int) $argv[2]; - array_shift($argv); - --$argc; - break; - - case '--replace': - $do_replace = true; - break; - - default: - $argc = 0; // invalid parameter ==> break the loop and give usage message - break; - } - array_shift($argv); - --$argc; -} - -if ($argc != 2 || !file_exists($file = $argv[1])) -{ - if ($argc == 2) echo "File '$file' not found !!!\n\n"; - echo "Usage: modernize.php [--no-phpgw] [--remove-space-indention N] [--replace] \n"; - echo "--no-phpgw dont change phpgw to egw, necessary for some API files\n"; - echo "--remove-space-indention N substitute every N space at the beginning of a line with a tab (default 2)\n"; - echo "--replace replaces the given file (plus creating a backup) instead of acting as filter\n\n"; - exit; -} - -if ($do_replace) -{ - if (!is_writable($file) && !is_writable(dirname($file))) - { - echo "'$file' is NOT writeable !!!\n"; - exit; - } - $do_replace = $file; - $file .= '.bak'; - if (is_writable(dirname($file))) - { - rename($do_replace,$file); - } - else // only file is writable not the directory, so we cant create a backup - { - $file = $do_replace; - } - ob_start(); -} - - -// some code modernizations -$modernize = array( - // saves an unnecessary copy - '= CreateObject' => '=& CreateObject', - '= new' => '=& new', - // php5 cloning of the DB object - '= $GLOBALS[\'phpgw\']->db;' => '= clone($GLOBALS[\'egw\']->db);', - '= $this->db;' => '= clone($this->db);', - // remove windows lineends (CR) - "\r" => '', -); - -foreach(array('GET','POST','SERVER','SESSION') as $name) -{ - $modernize['$HTTP_'.$name.'_VARS'] = '$_'.$name; - $modernize['$GLOBALS[\'HTTP_'.$name.'_VARS\']'] = '$_'.$name; - $modernize['$GLOBALS["HTTP_'.$name.'_VARS"]'] = '$_'.$name; -} - -if (!$no_phpgw) -{ - $modernize += array( - // phpGW --> eGW -// done now separate as it is case sensitve 'PHPGW_' => 'EGW_', - 'global $phpgw_info;' => '', - 'global $phpgw;' => '', - '$GLOBALS[\'phpgw_info\']' => '$GLOBALS[\'egw_info\']', - '$GLOBALS["phpgw_info"]' => '$GLOBALS[\'egw_info\']', - '$phpgw_info[' => '$GLOBALS[\'egw_info\'][', - '$GLOBALS[\'phpgw\']' => '$GLOBALS[\'egw\']', - '$GLOBALS["phpgw"]' => '$GLOBALS[\'egw\']', - '$phpgw->' => '$GLOBALS[\'egw\']->', - 'common->phpgw_header' => 'common->egw_header', - 'common->phpgw_footer' => 'common->egw_footer', - 'common->phpgw_exit' => 'common->egw_exit', - 'common->phpgw_final' => 'common->egw_final', - ); -} - - -$modernize_from = array_keys($modernize); -$modernize_to = array_values($modernize); - -$in_doc_block = false; -foreach(file($file) as $n => $line) -{ - $func = function_exists('str_ireplace') ? 'str_ireplace' : 'str_replace'; - $line = str_replace('PHPGW_','EGW_',$func($modernize_from,$modernize_to,$line)); - - if ($remove_space_indention) - { - while (preg_match("/^(\t*)".str_repeat(' ',$remove_space_indention).'/',$line)) - { - $line = preg_replace("/^(\t*)".str_repeat(' ',$remove_space_indention).'/',"\\1\t",$line); - } - } - - if (!$in_doc_block) - { - $parts = explode('/*!',$line); - if (count($parts) <= 1) - { - echo $line; - continue; - } - $in_doc_block = true; - - list($indent,$rest) = $parts; - echo $indent."/**\n"; - if (strlen($rest) <= 2) - { - continue; - } - $line = $indent.$rest; - - if (($one_line_block = strstr($line,'*/') !== false)) $line = str_replace('*/','',$line); - } - // now we are inside a comment-block - - if (preg_match('/[ \t]*\*\//',$line)) // exiting the comment-block - { - $in_doc_block = false; - echo str_replace('*/',' */',$line); - continue; - } - if (preg_match('/^(.*)@([a-zA-Z]+) (.*)$/',$line,$parts)) - { - list(,$indent,$cmd,$value) = $parts; - switch ($cmd) - { - // to ignore - case 'syntax': - case 'function': - case 'class': - break; - - case 'abstract': - echo $indent.' * '.$value."\n".$indent." *\n"; - break; - - case 'discussion': - case 'example': - default: - echo $indent.' * '.$value."\n"; - break; - - case 'result': - $cmd = 'return'; - // fall through - case 'param': - case 'return': - case 'var': - case 'author': - case 'copyright': - case 'licence': - case 'package': - case 'access': - echo $indent.' * @'.$cmd.' '.$value."\n"; - break; - } - } - else - { - echo str_replace($indent,$indent.' * ',$line); - } - if ($one_line_block) - { - echo $indent." */\n"; - $one_line_block = $in_doc_block = false; - } -} - -if ($do_replace && ($f = fopen($do_replace,'wb'))) -{ - fwrite($f,ob_get_contents()); - fclose($f); -} -else -{ - ob_flush(); -} diff --git a/egw-pear/Log.php b/egw-pear/Log.php index 1460376747..7f2494df03 100644 --- a/egw-pear/Log.php +++ b/egw-pear/Log.php @@ -144,7 +144,7 @@ class Log /* If the class exists, return a new instance of it. */ if (class_exists($class)) { - $obj = &new $class($name, $ident, $conf, $level); + $obj = new $class($name, $ident, $conf, $level); return $obj; } diff --git a/egw-pear/Log/observer.php b/egw-pear/Log/observer.php index d167ca93e5..ccb5c2528f 100644 --- a/egw-pear/Log/observer.php +++ b/egw-pear/Log/observer.php @@ -78,7 +78,7 @@ class Log_observer * instance. */ if (class_exists($class)) { - $object = &new $class($priority, $conf); + $object = new $class($priority, $conf); return $object; } @@ -102,9 +102,9 @@ class Log_observer if (class_exists($class)) { /* Support both new-style and old-style construction. */ if ($newstyle) { - $object = &new $class($priority, $conf); + $object = new $class($priority, $conf); } else { - $object = &new $class($priority); + $object = new $class($priority); } return $object; } diff --git a/egw-pear/Net/Sieve.php b/egw-pear/Net/Sieve.php index f88804ba65..c00857cde0 100644 --- a/egw-pear/Net/Sieve.php +++ b/egw-pear/Net/Sieve.php @@ -167,7 +167,7 @@ class Net_Sieve $this->_data['port'] = $port; $this->_data['logintype'] = $logintype; $this->_data['euser'] = $euser; - $this->_sock = &new Net_Socket(); + $this->_sock = new Net_Socket(); $this->_debug = $debug; $this->_bypassAuth = $bypassAuth; $this->_useTLS = $useTLS; diff --git a/emailadmin/inc/class.ajaxemailadmin.inc.php b/emailadmin/inc/class.ajaxemailadmin.inc.php index 815b224d78..59d9f4e386 100644 --- a/emailadmin/inc/class.ajaxemailadmin.inc.php +++ b/emailadmin/inc/class.ajaxemailadmin.inc.php @@ -53,7 +53,7 @@ { $acl = implode('',(array)$_aclData['acl']); $data = $this->bofelamimail->addACL($this->sessionDataAjax['folderName'], $_accountName, $acl); - #$response =& new xajaxResponse(); + #$response = new xajaxResponse(); #$response->addScript("window.close();"); #$response->addAssign("accountName", "value", $this->sessionDataAjax['folderName'].'-'.$_accountName.'-'.$acl); #return $response->getXML(); @@ -65,7 +65,7 @@ { $folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName']); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign("aclTable", "innerHTML", $this->createACLTable($folderACL)); return $response->getXML(); } diff --git a/emailadmin/inc/class.pleskimap.inc.php b/emailadmin/inc/class.pleskimap.inc.php index 822f919f2f..4c7461aad8 100644 --- a/emailadmin/inc/class.pleskimap.inc.php +++ b/emailadmin/inc/class.pleskimap.inc.php @@ -423,7 +423,7 @@ class pleskimap extends defaultimap while(!feof($fp)) { $line = trim(fgets($fp)); - list($name,$value) = split(': *',$line,2); + list($name,$value) = preg_split('/: */',$line,2); if (!is_null($value) && strpos($name,'An error occured') === false && $name) { $values[$name] = $value; diff --git a/emailadmin/inc/class.smtpplesk.inc.php b/emailadmin/inc/class.smtpplesk.inc.php index 55206a55ec..50c07525a5 100644 --- a/emailadmin/inc/class.smtpplesk.inc.php +++ b/emailadmin/inc/class.smtpplesk.inc.php @@ -49,7 +49,7 @@ class smtpplesk extends defaultsmtp static $plesk; if (!is_object($plesk)) { - $plesk =& new pleskimap(null); + $plesk = new pleskimap(null); $this->error =& $plesk->error; } return $plesk->plesk_mail($action,$account,$password,$aliases,$forward,$keepLocalCopy,$quota_kb); diff --git a/etemplate/inc/class.advancedsearch_widget.inc.php b/etemplate/inc/class.advancedsearch_widget.inc.php index 3422242bd6..b270f40faf 100644 --- a/etemplate/inc/class.advancedsearch_widget.inc.php +++ b/etemplate/inc/class.advancedsearch_widget.inc.php @@ -76,7 +76,7 @@ (is_array($GLOBALS['egw']->session->appsession('advanced_search_query',$GLOBALS['egw_info']['flags']['currentapp'])) ? $GLOBALS['egw']->session->appsession('advanced_search_query',$GLOBALS['egw_info']['flags']['currentapp']) : $value); - $tpl =& new etemplate; + $tpl = new etemplate; $tpl->init('*** generated advanced search widget','','',0,'',0,0); // make an empty template if($extension_data['message']) @@ -96,7 +96,7 @@ // 'width' => '800px', ))); - $result_rows_tpl =& new etemplate; + $result_rows_tpl = new etemplate; $result_rows_tpl->init('*** generated rows template for advanced search results','','',0,'',0,0); $grid =& $result_rows_tpl->children[0]; foreach((array)$extension_data['colums_to_present'] as $field => $label) diff --git a/etemplate/inc/class.ajax_select_widget.inc.php b/etemplate/inc/class.ajax_select_widget.inc.php index 9b6e1fb822..3755feecfa 100644 --- a/etemplate/inc/class.ajax_select_widget.inc.php +++ b/etemplate/inc/class.ajax_select_widget.inc.php @@ -146,7 +146,7 @@ $cell['type'] = 'template'; $cell['size'] = $cell['name']; $value = array('value' => $current_value, 'search' => $title); - $widget =& new etemplate('etemplate.ajax_select_widget'); + $widget = new etemplate('etemplate.ajax_select_widget'); $widget->no_onclick = True; // Link if readonly & link is set diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index ceaa33f978..e231dd8ab7 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -113,9 +113,9 @@ class date_widget } elseif ($data_format != '') { - $date = split('[- /.:,]',$value); + $date = preg_split('/[- \\/.:,]/',$value); //echo "date=

"; print_r($date); echo "
"; - $mdy = split('[- /.:,]',$data_format); + $mdy = preg_split('/[- \\/.:,]/',$data_format); if (count($mdy) == 1) // no seperators, eg. YmdHi { @@ -166,7 +166,7 @@ class date_widget $value['H'] = $value['H'] % 12 ? $value['H'] % 12 : 12; // no leading 0 and 0h => 12am $timeformat += array(5 => 'a'); } - $format = split('[/.-]',$this->dateformat); + $format = preg_split('/[\\/.-]/',$this->dateformat); // no time also if $options&8 and readonly and time=0h0 if ($type != 'date' && !($readonly && ($options & 8) && $time_0h0)) @@ -236,7 +236,7 @@ class date_widget 'needed' => $cell['needed'], ); } - $tpl =& new etemplate; + $tpl = new etemplate; $tpl->init('*** generated fields for date','','',0,'',0,0); // make an empty template // keep the editor away from the generated tmpls $tpl->no_onclick = true; @@ -411,7 +411,7 @@ class date_widget 'value' => $value, 'unit' => $unit, ); - $tpl =& new etemplate; + $tpl = new etemplate; $tpl->init('*** generated fields for duration','','',0,'',0,0); // make an empty template // keep the editor away from the generated tmpls $tpl->no_onclick = true; diff --git a/etemplate/inc/class.db_tools.inc.php b/etemplate/inc/class.db_tools.inc.php index 24bef28140..100ec69c7f 100644 --- a/etemplate/inc/class.db_tools.inc.php +++ b/etemplate/inc/class.db_tools.inc.php @@ -300,7 +300,7 @@ class db_tools $new_version[$minor] = sprintf('%03d',1+$new_version[$minor]); $content['new_version'] = implode('.',$new_version); - $tmpl =& new etemplate('etemplate.db-tools.ask_save'); + $tmpl = new etemplate('etemplate.db-tools.ask_save'); if (!file_exists(EGW_SERVER_ROOT."/$posted_app/setup/tables_current.inc.php")) { @@ -485,7 +485,7 @@ class db_tools $opts = array(); foreach(explode(',',$col['options']) as $opt) { - list($db,$opt) = split('[(:)]',$opt); + list($db,$opt) = preg_split('/[(:)]/',$opt); $opts[$db] = is_numeric($opt) ? intval($opt) : $opt; } $table[$prop][] = array( diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 89d6e90f62..41a89a1645 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -271,7 +271,7 @@ class editor { $content[$row] = $param; } - $list_result =& new etemplate('etemplate.editor.list_result'); + $list_result = new etemplate('etemplate.editor.list_result'); $GLOBALS['egw_info']['flags']['app_header'] = lang('Editable Templates - Search'); $list_result->exec('etemplate.editor.list_result',$content,'','',array( 'result' => $result, @@ -460,7 +460,7 @@ class editor 'xml' => $xml ? '
'.html::htmlspecialchars($xml)."
\n" : '', ); - $editor =& new etemplate('etemplate.editor.new'); + $editor = new etemplate('etemplate.editor.new'); if (!$msg && isset($content['values']) && !isset($content['vals'])) { $r = 1; @@ -1319,8 +1319,8 @@ class editor $content['cell']['options'] = explode(',',$content['cell']['size']); - $editor =& new etemplate('etemplate.editor.widget'); - $type_tmpl =& new etemplate; + $editor = new etemplate('etemplate.editor.widget'); + $type_tmpl = new etemplate; list($ext_type) = explode('-',$widget['type']); if ($type_tmpl->read('etemplate.editor.widget.'.$widget['type']) || @@ -1435,7 +1435,7 @@ class editor 'java_script' => $js ? '' : '', 'msg' => $msg ); - $tmpl =& new etemplate('etemplate.editor.styles'); + $tmpl = new etemplate('etemplate.editor.styles'); if ($content['from']) { @@ -1489,7 +1489,7 @@ class editor $dir = @opendir(EGW_SERVER_ROOT.'/'.$app.'/inc'); while ($dir && ($file = readdir($dir))) { - if (ereg('class\\.([a-zA-Z0-9_]*)_widget.inc.php',$file,$regs) && + if (preg_match('/class\\.([a-zA-Z0-9_]*)_widget.inc.php/',$file,$regs) && ($regs[1] != 'xslt' || $this->etemplate->xslt) && ($ext = $this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate))) { diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index bd00594514..6b4cbf3de8 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -281,7 +281,7 @@ class etemplate extends boetemplate echo '
'."\n"; if ($GLOBALS['egw_info']['user']['apps']['manual']) // adding a manual icon to every popup { - $manual =& new etemplate('etemplate.popup.manual'); + $manual = new etemplate('etemplate.popup.manual'); echo $manual->show(array()); unset($manual); echo ''."\n"; @@ -1360,7 +1360,7 @@ class etemplate extends boetemplate $obj_read = 'already loaded'; if (is_array($cell['obj'])) { - $obj =& new etemplate(); + $obj = new etemplate(); $obj->init($cell['obj']); $cell['obj'] =& $obj; unset($obj); @@ -1373,12 +1373,12 @@ class etemplate extends boetemplate $obj_read = is_object($cell['obj']) ? 'obj from content' : 'obj read, obj-name from content'; if (!is_object($cell['obj'])) { - $cell['obj'] =& new etemplate($cell['obj'],$this->as_array()); + $cell['obj'] = new etemplate($cell['obj'],$this->as_array()); } } else { $obj_read = 'obj read'; - $cell['obj'] =& new etemplate($name,$this->as_array()); + $cell['obj'] = new etemplate($name,$this->as_array()); } } if (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type']) diff --git a/etemplate/inc/class.historylog_widget.inc.php b/etemplate/inc/class.historylog_widget.inc.php index ed62c7351b..c2cf819b59 100644 --- a/etemplate/inc/class.historylog_widget.inc.php +++ b/etemplate/inc/class.historylog_widget.inc.php @@ -61,14 +61,14 @@ class historylog_widget $status_widgets = is_array($value) && isset($value['status-widgets']) ? $value['status-widgets'] : null; $id = is_array($value) ? $value['id'] : $value; - $historylog =& new historylog($app); + $historylog = new historylog($app); if (!$id || method_exists($historylog,'search')) { $value = $id ? $historylog->search($id) : false; } unset($historylog); - $tpl =& new etemplate; + $tpl = new etemplate; $tpl->init('*** generated fields for historylog','','',0,'',0,0); // make an empty template // keep the editor away from the generated tmpls $tpl->no_onclick = true; diff --git a/etemplate/inc/class.link_widget.inc.php b/etemplate/inc/class.link_widget.inc.php index af7dc1c798..d602a7f2a1 100644 --- a/etemplate/inc/class.link_widget.inc.php +++ b/etemplate/inc/class.link_widget.inc.php @@ -249,7 +249,7 @@ class link_widget // modify add_app default to the action used as value if (isset($value['add_app']) && $app == $value['add_app']) $value['add_app'] = $action; } - $tpl =& new etemplate('etemplate.link_widget.add'); + $tpl = new etemplate('etemplate.link_widget.add'); break; case 'link-to': @@ -283,7 +283,7 @@ class link_widget return True; } $value['link_list_format'] = $GLOBALS['egw_info']['user']['preferences']['common']['link_list_format']; - $tpl =& new etemplate('etemplate.link_widget.list'); + $tpl = new etemplate('etemplate.link_widget.list'); for($row=$tpl->rows-1; list(,$link) = each($links); ++$row) { $value[$row] = $link; @@ -319,7 +319,7 @@ class link_widget case 'link-entry': $GLOBALS['egw_info']['flags']['include_xajax'] = true; - $tpl =& new etemplate('etemplate.link_widget.entry'); + $tpl = new etemplate('etemplate.link_widget.entry'); $options = $cell['size'] ? explode(',',$cell['size']) : array(); $app = $extension_data['app'] = $options[0]; // handle extra args for onclick like: values2url(this.form,'start,end,duration,participants,recur_type,whole_day')+'&exec[event_id]= diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 82f7b26bf1..9e027e1f96 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -344,7 +344,7 @@ class nextmatch_widget } if (!is_object($value['template'])) { - $value['template'] =& new etemplate($value['template'],$tmpl->as_array()); + $value['template'] = new etemplate($value['template'],$tmpl->as_array()); } $extension_data['template'] = $value['template']->name; // used for the column-selection, and might be set in get_rows() $extension_data['columnselection_pref'] = $value['columnselection_pref']; @@ -360,7 +360,7 @@ class nextmatch_widget { // disable whole nextmatch line if no scrolling necessary if ($value['header_left'] || $value['header_right']) { - $nextmatch =& new etemplate('etemplate.nextmatch_widget.header_only'); + $nextmatch = new etemplate('etemplate.nextmatch_widget.header_only'); $cell['size'] = $cell['name']; $cell['obj'] = &$nextmatch; $cell['name'] = $nextmatch->name; @@ -374,7 +374,7 @@ class nextmatch_widget } else { - $nextmatch =& new etemplate('etemplate.nextmatch_widget'); + $nextmatch = new etemplate('etemplate.nextmatch_widget'); $nextmatch->read('etemplate.nextmatch_widget'); // keep the editor away from the generated tmpls $nextmatch->no_onclick = true; @@ -1075,7 +1075,7 @@ class nextmatch_widget if ($app) { include_once(EGW_API_INC.'/class.config.inc.php'); - $config =& new config($app); + $config = new config($app); $config->read_repository(); $customfields = isset($config->config_data['customfields']) ? $config->config_data['customfields'] : $config->config_data['custom_fields']; diff --git a/etemplate/inc/class.select_widget.inc.php b/etemplate/inc/class.select_widget.inc.php index 2fd4c84a6f..b537b01ec6 100644 --- a/etemplate/inc/class.select_widget.inc.php +++ b/etemplate/inc/class.select_widget.inc.php @@ -182,7 +182,7 @@ } else // we need to instanciate a new cat object for the correct application { - $categories =& new categories('',$type3); + $categories = new categories('',$type3); } $accountId = $GLOBALS['egw_info']['user']['account_id']; foreach((array)$categories->return_sorted_array(0,False,'','','',!$type) as $cat) diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index ef4274218b..67bfcfca78 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -838,7 +838,7 @@ class so_sql } elseif (!$need_full_no_count && (!$join || stripos($join,'LEFT JOIN')!==false)) { - $this->total = $this->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__,false,'',$this->app,0,$join)->fetchSingle(); + $this->total = $this->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__,false,'',$this->app,0,$join)->fetchColumn(); } else // cant do a count, have to run the query without limit { @@ -854,7 +854,7 @@ class so_sql if ($mysql_calc_rows) { - $this->total = $this->db->query('SELECT FOUND_ROWS()')->fetchSingle(); + $this->total = $this->db->query('SELECT FOUND_ROWS()')->fetchColumn(); } $arr = array(); if ($rs) foreach($rs as $row) diff --git a/etemplate/inc/class.soetemplate.inc.php b/etemplate/inc/class.soetemplate.inc.php index d215158350..c2faf340e9 100644 --- a/etemplate/inc/class.soetemplate.inc.php +++ b/etemplate/inc/class.soetemplate.inc.php @@ -949,7 +949,7 @@ class soetemplate $tpls = $this->search($app); - $tpl =& new soetemplate; // to not alter our own data + $tpl = new soetemplate; // to not alter our own data while (list(,$keys) = each($tpls)) { @@ -1058,7 +1058,7 @@ class soetemplate $templ_version=0; include($path = EGW_SERVER_ROOT."/$app/setup/etemplates.inc.php"); - $templ =& new etemplate($app); + $templ = new etemplate($app); foreach($templ_data as $data) { @@ -1100,7 +1100,7 @@ class soetemplate if ($time = @filemtime($path)) { - $templ =& new soetemplate(".$app",'','##'); + $templ = new soetemplate(".$app",'','##'); if ($templ->lang != '##' || $templ->modified < $time) // need to import { $ret = self::import_dump($app); @@ -1282,7 +1282,7 @@ class soetemplate case 'template': if (!isset($widget['obj']) && $widget['name'][0] != '@') { - $widget['obj'] =& new etemplate; + $widget['obj'] = new etemplate; if (!$widget['obj']->read($widget['name'])) $widget['obj'] = false; } if (!is_object($widget['obj'])) break; // cant descent into template diff --git a/etemplate/inc/class.solangfile.inc.php b/etemplate/inc/class.solangfile.inc.php index c7c4545505..b9a036038d 100644 --- a/etemplate/inc/class.solangfile.inc.php +++ b/etemplate/inc/class.solangfile.inc.php @@ -74,7 +74,7 @@ class solangfile } foreach($lines as $n => $line) { - while (ereg('\{lang_([^}]+)\}(.*)',$line,$found)) + while (preg_match('/\{lang_([^}]+)\}(.*)/',$line,$found)) { $lang = str_replace('_',' ',$found[1]); $this->plist[$lang] = $app; @@ -256,7 +256,7 @@ class solangfile } $rest = substr($rest,$next+1); } - if(!ereg("[ \t\n]*,[ \t\n]*(.*)$",$rest,$parts)) + if(!preg_match('/'."[ \t\n]*,[ \t\n]*(.*)$".'/',$rest,$parts)) { break; // nothing found } diff --git a/etemplate/inc/class.tab_widget.inc.php b/etemplate/inc/class.tab_widget.inc.php index 6f29c1acef..0abbfdd834 100644 --- a/etemplate/inc/class.tab_widget.inc.php +++ b/etemplate/inc/class.tab_widget.inc.php @@ -86,7 +86,7 @@ } $all_names = implode('|',$names); - $tab_widget =& new etemplate('etemplate.tab_widget'); + $tab_widget = new etemplate('etemplate.tab_widget'); $tab_widget->no_onclick = true; if ($value && strpos($value,'.') === false) @@ -150,7 +150,7 @@ foreach($names as $n => $name) { $bcell = $tab_widget->empty_cell('template',$name); - $bcell['obj'] =& new etemplate($name,$tmpl->as_array()); + $bcell['obj'] = new etemplate($name,$tmpl->as_array()); $tab_widget->set_cell_attribute('body',$n+1,$bcell); } $tab_widget->set_cell_attribute('body','type','deck'); @@ -160,7 +160,7 @@ } else { - $stab =& new etemplate($selected_tab,$tmpl->as_array()); + $stab = new etemplate($selected_tab,$tmpl->as_array()); $tab_widget->set_cell_attribute('body','type','template'); $tab_widget->set_cell_attribute('body','size',''); // the deck has a '1' there $tab_widget->set_cell_attribute('body','obj',$stab); diff --git a/etemplate/inc/class.tree_widget.inc.php b/etemplate/inc/class.tree_widget.inc.php index c1e2a93e03..9bbea7e2e4 100644 --- a/etemplate/inc/class.tree_widget.inc.php +++ b/etemplate/inc/class.tree_widget.inc.php @@ -81,7 +81,7 @@ class tree_widget } else // we need to instanciate a new cat object for the correct application { - $categories =& new categories('',$type3); + $categories = new categories('',$type3); } $accountId = $GLOBALS['egw_info']['user']['account_id']; $cat2path=array(); diff --git a/etemplate/inc/class.uietemplate_gtk.inc.php b/etemplate/inc/class.uietemplate_gtk.inc.php index 5555b2dc3b..ba226f0f23 100644 --- a/etemplate/inc/class.uietemplate_gtk.inc.php +++ b/etemplate/inc/class.uietemplate_gtk.inc.php @@ -108,7 +108,7 @@ */ if (!$GLOBALS['egw_info']['etemplate']['window']) { - $window = &new GtkWindow(); + $window = new GtkWindow(); $window->connect('destroy',array('etemplate','destroy')); $window->connect('delete-event',array('etemplate','delete_event')); $window->set_title('eGroupWareGTK: '.$GLOBALS['egw_info']['server']['site_title']); @@ -125,7 +125,7 @@ $table->set_border_width(10); $table->show(); - $swindow = &new GtkScrolledWindow(null,null); + $swindow = new GtkScrolledWindow(null,null); $swindow->set_policy(GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); $swindow->add_with_viewport($table); $swindow->show(); @@ -287,7 +287,7 @@ '.row' => $show_row ); - $table = &new GtkTable($this->rows,$this->cols,False); + $table = new GtkTable($this->rows,$this->cols,False); $table->set_row_spacings(2); $table->set_col_spacings(5); $table->show(); @@ -369,7 +369,7 @@ default: $align = 0.0; } - $align = &new GtkAlignment($align,$valign,$cell['type'] == 'hrule' ? 1.0 : 0.0,0.0); + $align = new GtkAlignment($align,$valign,$cell['type'] == 'hrule' ? 1.0 : 0.0,0.0); $align->add($widget); } $table->attach($align ? $align : $widget, $c, $c+$colspan, $r, $r+1,GTK_FILL,GTK_FILL,0,0); @@ -444,7 +444,7 @@ $name = $this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content); // building the form-field-name depending on prefix $cname and possibl. Array-subscript in name - if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs)) // name contains array-index + if (preg_match('/^([^[]*)(\\[.*\\])$/',$name,$regs)) // name contains array-index { $form_name = $cname == '' ? $name : $cname.'['.$regs[1].']'.$regs[2]; eval(str_replace(']',"']",str_replace('[',"['",'$value = $content['.$regs[1].']'.$regs[2].';'))); @@ -492,7 +492,7 @@ if ($value) { - $widget = &new GtkLabel($value); + $widget = new GtkLabel($value); if ($cell['align'] != 'center') { $widget->set_justify($cell['align'] == 'right' ? GTK_JUSTIFY_RIGHT : GTK_JUSTIFY_LEFT); @@ -520,7 +520,7 @@ //$html .= $this->html->input($form_name,$value,'',$options.$this->html->formatOptions($cell['size'],'SIZE,MAXLENGTH')); } list($len,$max) = explode(',',$cell['size']); - $widget = &new GtkEntry(); + $widget = new GtkEntry(); $widget->set_text($value); if ($max) { @@ -534,15 +534,15 @@ break; case 'textarea': // Multiline Text Input, size: [rows][,cols] //$html .= $this->html->textarea($form_name,$value,$options.$this->html->formatOptions($cell['size'],'ROWS,COLS')); - $widget = &new GtkText(null,null); + $widget = new GtkText(null,null); $widget->insert_text($value,strlen($value)); $widget->set_editable(!$readonly); break; /* case 'date': if ($cell['size'] != '') { - $date = split('[/.-]',$value); - $mdy = split('[/.-]',$cell['size']); + $date = preg_split('/[\\/.-]/',$value); + $mdy = preg_split('/[\\/.-]/',$cell['size']); for ($value=array(),$n = 0; $n < 3; ++$n) { switch($mdy[$n]) @@ -572,7 +572,7 @@ $options .= ' CHECKED'; } //$html .= $this->html->input($form_name,'1','CHECKBOX',$options); - $widget = &new GtkCheckButton($right_label); + $widget = new GtkCheckButton($right_label); $right_label = ''; $widget->set_active($value); break; @@ -584,23 +584,23 @@ //$html .= $this->html->input($form_name,$cell['size'],'RADIO',$options); if (isset($this->buttongroup[$form_name])) { - $widget = &new GtkRadioButton($this->buttongroup[$form_name],$right_label); + $widget = new GtkRadioButton($this->buttongroup[$form_name],$right_label); } else { - $this->buttongroup[$form_name] = $widget = &new GtkRadioButton(null,$right_label); + $this->buttongroup[$form_name] = $widget = new GtkRadioButton(null,$right_label); } $right_label = ''; $widget->set_active($value == $cell['size']); break; case 'button': //$html .= $this->html->submit_button($form_name,$cell['label'],'',strlen($cell['label']) <= 1 || $cell['no_lang'],$options); - $widget = &new GtkButton(strlen($cell['label']) > 1 ? lang($cell['label']) : $cell['label']); + $widget = new GtkButton(strlen($cell['label']) > 1 ? lang($cell['label']) : $cell['label']); $widget->connect_object('clicked', array('etemplate', 'button_clicked'),&$var,$form_name); break; case 'hrule': //$html .= $this->html->hr($cell['size']); - $widget = &new GtkHSeparator(); + $widget = new GtkHSeparator(); break; case 'template': // size: index in content-array (if not full content is past further on) if ($this->autorepeat_idx($cell,$show_c,$show_row,$idx,$idx_cname) || $cell['size'] != '') @@ -661,7 +661,7 @@ $maxlen = $len; } } - $widget = &new GtkCombo(); + $widget = new GtkCombo(); $widget->set_popdown_strings($sel_options); $entry = $widget->entry; $entry->set_text($sel_options[$value]); @@ -709,7 +709,7 @@ $pixbuf = &$GLOBALS['egw_info']['etemplate']['pixbufs'][$path]; if ($pixbuf) { - $widget = &new GtkDrawingArea(); + $widget = new GtkDrawingArea(); $widget->size($pixbuf->get_width(),$pixbuf->get_height()); $widget->connect('expose_event',array('etemplate','draw_image'),$pixbuf); } @@ -720,7 +720,7 @@ break; default: //$html .= 'unknown type'; - $widget = &new GtkLabel('unknown type: '.$cell['type']); + $widget = new GtkLabel('unknown type: '.$cell['type']); $widget->set_justify(GTK_JUSTIFY_LEFT); break; } @@ -738,14 +738,14 @@ { if (!$widget && !$right_label) { - $widget = &new GtkLabel($left_label); + $widget = new GtkLabel($left_label); } else { - $hbox = &new GtkHBox(False,5); + $hbox = new GtkHBox(False,5); if ($left_label) { - $left = &new GtkLabel($left_label); + $left = new GtkLabel($left_label); $left->show(); $hbox->add($left); } @@ -756,7 +756,7 @@ } if ($right_label) { - $right = &new GtkLabel($right_label); + $right = new GtkLabel($right_label); $right->show(); $hbox->add($right); } @@ -766,7 +766,7 @@ { if (!$this->tooltips) { - $this->tooltips = &new GtkTooltips(); + $this->tooltips = new GtkTooltips(); } $this->tooltips->set_tip($widget,lang($cell['help']),$this->name.'/'.$form_name); } diff --git a/etemplate/inc/class.xmltool.inc.php b/etemplate/inc/class.xmltool.inc.php index c90ee21a39..27404d3da0 100644 --- a/etemplate/inc/class.xmltool.inc.php +++ b/etemplate/inc/class.xmltool.inc.php @@ -12,7 +12,7 @@ function var2xml($name, $data) { - $doc =& new xmltool('root','',''); + $doc = new xmltool('root','',''); return $doc->import_var($name,$data,True,True); } @@ -167,7 +167,7 @@ function import_var($name, $value,$is_root=False,$export_xml=False) { //echo "

import_var: this->indentstring='$this->indentstring'

\n"; - $node =& new xmltool('node',$name,$this->indentstring); + $node = new xmltool('node',$name,$this->indentstring); switch (gettype($value)) { case 'string': @@ -220,12 +220,12 @@ case 'integer': case 'double': case 'NULL': - $subnode =& new xmltool('node', $nextkey,$this->indentstring); + $subnode = new xmltool('node', $nextkey,$this->indentstring); $subnode->set_value($val); $node->add_node($subnode); break; case 'boolean': - $subnode =& new xmltool('node', $nextkey,$this->indentstring); + $subnode = new xmltool('node', $nextkey,$this->indentstring); if($val == True) { $subnode->set_value('1'); @@ -251,7 +251,7 @@ } break; case 'object': - $subnode =& new xmltool('node', $nextkey,$this->indentstring); + $subnode = new xmltool('node', $nextkey,$this->indentstring); $subnode->set_value('PHP_SERIALIZED_OBJECT&:'.serialize($val)); $node->add_node($subnode); break; @@ -390,7 +390,7 @@ { case 'cdata': case 'complete': - $node =& new xmltool('node',$data[$i]['tag'],$this->indentstring); + $node = new xmltool('node',$data[$i]['tag'],$this->indentstring); if(is_array($data[$i]['attributes']) && count($data[$i]['attributes']) > 0) { while(list($k,$v)=each($data[$i]['attributes'])) @@ -402,7 +402,7 @@ $parent_node->add_node($node); break; case 'open': - $node =& new xmltool('node',$data[$i]['tag'],$this->indentstring); + $node = new xmltool('node',$data[$i]['tag'],$this->indentstring); if(is_array($data[$i]['attributes']) && count($data[$i]['attributes']) > 0) { while(list($k,$v)=each($data[$i]['attributes'])) @@ -428,7 +428,7 @@ xml_parse_into_struct($parser, $xmldata, $vals, $index); xml_parser_free($parser); unset($index); - $node =& new xmltool('node',$vals[0]['tag'],$this->indentstring); + $node = new xmltool('node',$vals[0]['tag'],$this->indentstring); if(isset($vals[0]['attributes'])) { while(list($key,$value) = each($vals[0]['attributes'])) diff --git a/etemplate/inc/class.xslt_widget.inc.php b/etemplate/inc/class.xslt_widget.inc.php index 3006ab5f23..319b90b301 100644 --- a/etemplate/inc/class.xslt_widget.inc.php +++ b/etemplate/inc/class.xslt_widget.inc.php @@ -61,7 +61,7 @@ function render_html($cell,$form_name,$value,$readonly,&$tmpl) { - list($app,$file) = split('\\.',$cell['size'],2); + list($app,$file) = preg_split('/\\./',$cell['size'],2); $pref_templ = $GLOBALS['egw_info']['server']['template_set']; $path = "$app/templates/$pref_templ/$file"; if (!file_exists(EGW_SERVER_ROOT.'/'.$path.'.xsl')) diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index 6ed9acf49a..88a44213f4 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -165,16 +165,16 @@ $widgetattr2xul = isset($this->widget2xul[$type]) ? $this->widget2xul[$type] : array(); $type = isset($widgetattr2xul['.name']) ? $widgetattr2xul['.name'] : $type; list($type,$child,$child2) = explode(',',$type); - $widget =& new xmlnode($type); + $widget = new xmlnode($type); $attr_widget = &$widget; if ($child) { - $child =& new xmlnode($child); + $child = new xmlnode($child); if ($type != 'tabbox') $attr_widget = &$child; } if ($child2) { - $child2 =& new xmlnode($child2); + $child2 = new xmlnode($child2); } if (isset($widgetattr2xul['.set'])) // set default-attr for type { @@ -189,7 +189,7 @@ { case 'nextmatch': list($tpl) = explode(',',$cell['size']); - $embeded =& new etemplate($tpl,$this->load_via); + $embeded = new etemplate($tpl,$this->load_via); if ($embeded_too) { $this->add_etempl($embeded,$embeded_too); @@ -203,17 +203,17 @@ $names = explode('|',$cell['name']); unset($cell['name']); for ($n = 0; $n < count($labels); ++$n) { - $tab =& new xmlnode('tab'); + $tab = new xmlnode('tab'); $tab->set_attribute('label',$labels[$n]); $tab->set_attribute('statustext',$helps[$n]); $child->add_node($tab); - $embeded =& new etemplate($names[$n],$this->load_via); + $embeded = new etemplate($names[$n],$this->load_via); if ($embeded_too) { $this->add_etempl($embeded,$embeded_too); } - $template =& new xmlnode('template'); + $template = new xmlnode('template'); $template->set_attribute('id',$embeded->name); $child2->add_node($template); unset($embeded); @@ -236,7 +236,7 @@ case 'groupbox': if ($cell['label']) { - $caption =& new xmlnode('caption'); + $caption = new xmlnode('caption'); $caption->set_attribute('label',$cell['label']); $widget->add_node($caption); unset($cell['label']); @@ -246,7 +246,7 @@ case 'hbox': case 'box': case 'deck': - list($anz,$orient,$options) = split(',',$cell['size'],3); + list($anz,$orient,$options) = explode(',',$cell['size'],3); for ($n = 1; $n <= $anz; ++$n) { $this->add_widget($widget,$cell[$n],$embeded_too); @@ -261,7 +261,7 @@ case 'template': if ($cell['name'][0] != '@' && $embeded_too) { - $templ =& new etemplate(); + $templ = new etemplate(); if ($templ->read(boetemplate::expand_name($cell['name'],0,0),'default','default',0,'',$this->load_via)) { $this->add_etempl($templ,$embeded_too); @@ -310,18 +310,18 @@ */ function add_grid(&$parent,$grid,&$embeded_too) { - $xul_grid =& new xmlnode('grid'); + $xul_grid = new xmlnode('grid'); $this->set_attributes($xul_grid,'width,height,border,class,spacing,padding,overflow',$grid['size']); $this->set_attributes($xul_grid,'id',$grid['name']); - $xul_columns =& new xmlnode('columns'); - $xul_rows =& new xmlnode('rows'); + $xul_columns = new xmlnode('columns'); + $xul_rows = new xmlnode('rows'); reset($grid['data']); list(,$opts) = each ($grid['data']); // read over options-row while (list($r,$row) = each ($grid['data'])) { - $xul_row =& new xmlnode('row'); + $xul_row = new xmlnode('row'); $this->set_attributes($xul_row,'class,valign',$opts["c$r"]); $this->set_attributes($xul_row,'height,disabled',$opts["h$r"]); @@ -330,7 +330,7 @@ { if ($r == '1') // write columns only once in the first row { - $xul_column =& new xmlnode('column'); + $xul_column = new xmlnode('column'); $this->set_attributes($xul_column,'width,disabled',$opts[$c]); $xul_columns->add_node($xul_column); } @@ -371,7 +371,7 @@ } $embeded_too[$etempl->name] = True; - $template =& new xmlnode('template'); + $template = new xmlnode('template'); $template->set_attribute('id',$etempl->name); $template->set_attribute('template',$etempl->template); $template->set_attribute('lang',$etempl->lang); @@ -384,7 +384,7 @@ } if ($etempl->style != '') { - $styles =& new xmlnode('styles'); + $styles = new xmlnode('styles'); $styles->set_value(str_replace("\r",'',$etempl->style)); $template->add_node($styles); } @@ -403,10 +403,10 @@ { echo "

etempl->data = "; _debug_array($etempl->data); } - $doc =& new xmldoc(); + $doc = new xmldoc(); $doc->add_comment('$'.'Id$'); - $this->xul_overlay =& new xmlnode('overlay'); // global for all add_etempl calls + $this->xul_overlay = new xmlnode('overlay'); // global for all add_etempl calls $this->load_via = $etempl->as_array(); $embeded_too = True; @@ -568,7 +568,7 @@ { break; } - $nul = null; soetemplate::add_child($parent,$nul); // null =& new row + $nul = null; soetemplate::add_child($parent,$nul); // null = new row $parent['data'][0]['c'.$parent['rows']] = $attr['class'] . ($attr['valign'] ? ','.$attr['valign'] : ''); $parent['data'][0]['h'.$parent['rows']] = $attr['height'] . ($attr['disabled'] ? ','.$attr['disabled'] : ''); @@ -691,7 +691,7 @@ unset($attr['src']); break; case 'listbox': - $attr['size'] = ereg_replace(',*$','',$attr['rows'].','.$attr['size']); + $attr['size'] = preg_replace('/,*$','/',$attr['rows'].','.$attr['size']); unset($attr['rows']); break; case 'button': diff --git a/felamimail/inc/class.Script.inc.php b/felamimail/inc/class.Script.inc.php index 42f4fcfda9..aa217f7ee1 100644 --- a/felamimail/inc/class.Script.inc.php +++ b/felamimail/inc/class.Script.inc.php @@ -380,7 +380,7 @@ class Script { $if[] = 'address :contains ["To","TO","Cc","CC"] "'.$addr.'"'; } $newscriptbody .= 'if anyof ('.implode(', ',$if).") {\n"; - foreach(split(', ?',$vacation['forwards']) as $addr) { + foreach(preg_split('/, ?/',$vacation['forwards']) as $addr) { $newscriptbody .= "\tredirect \"".$addr."\";\n"; } $newscriptbody .= "\tkeep;\n}\n"; diff --git a/felamimail/inc/class.ajax_contacts.inc.php b/felamimail/inc/class.ajax_contacts.inc.php index aad4f9782f..37da0b2798 100644 --- a/felamimail/inc/class.ajax_contacts.inc.php +++ b/felamimail/inc/class.ajax_contacts.inc.php @@ -60,7 +60,7 @@ ), $_searchString, 'tid=n', '', 'fn'); } } - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if(is_array($contacts)) { $innerHTML = ''; diff --git a/felamimail/inc/class.ajaxfelamimail.inc.php b/felamimail/inc/class.ajaxfelamimail.inc.php index 1a33813fc9..25f56c45ba 100644 --- a/felamimail/inc/class.ajaxfelamimail.inc.php +++ b/felamimail/inc/class.ajaxfelamimail.inc.php @@ -49,7 +49,7 @@ function addACL($_accountName, $_aclData) { if($this->_debug) error_log("ajaxfelamimail::addACL"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if(!empty($_accountName)) { $acl = implode('',(array)$_aclData['acl']); @@ -75,7 +75,7 @@ if($this->_debug) error_log("ajaxfelamimail::addFolder($parentFolder, $newSubFolder)"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($folderName = $this->bofelamimail->createFolder($parentFolder, $newSubFolder, true)) { $parentFolder = $this->_encodeFolderName($parentFolder); @@ -213,7 +213,7 @@ function deleteACL($_aclData) { if($this->_debug) error_log("ajaxfelamimail::deleteACL"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if(is_array($_aclData)) { foreach($_aclData['accountName'] as $accountName) { $data = $this->bofelamimail->deleteACL($this->sessionDataAjax['folderName'], $accountName); @@ -232,7 +232,7 @@ $bocompose =& CreateObject('felamimail.bocompose', $_composeID); $bocompose->removeAttachment($_attachmentID); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); return $response->getXML(); } @@ -252,7 +252,7 @@ } $htmlObject = html::fckEditorQuick('body', $_mode, $_content); $this->saveSessionData(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addScript('FCKeditorAPI_ConfirmCleanup();'); $response->addScript('FCKeditorAPI_Cleanup();'); $response->addAssign('editorArea', 'innerHTML', $htmlObject); @@ -271,7 +271,7 @@ { $folderName = $this->_decodeEntityFolderName($_folderName); if($this->_debug) error_log("ajaxfelamimail::deleteFolder($_folderName)"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); // don't delete this folders if($folderName == 'INBOX' || $folderName == '--topfolder--') { @@ -312,7 +312,7 @@ unset($signatures); $signatures = $boSignatures->getListOfSignatures(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign('signatureTable', 'innerHTML', $this->uiwidgets->createSignatureTable($signatures)); return $response->getXML(); } @@ -325,7 +325,7 @@ $boPreferences->setProfileActive(false); if ($accountData) $boPreferences->setProfileActive(true,$accountData); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addScript('refreshView();'); return $response->getXML(); } @@ -353,7 +353,7 @@ } $accountArray[]=$tempvar; } - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign('userDefinedAccountTable', 'innerHTML', $this->uiwidgets->createAccountDataTable($accountArray)); return $response->getXML(); } @@ -410,7 +410,7 @@ function sendNotify ($_uid, $_ret) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if ($_ret==='true') { if ( $this->bofelamimail->sendMDN($_uid) ) $this->bofelamimail->flagMessages("mdnsent",array($_uid)); @@ -425,7 +425,7 @@ function generateMessageList($_folderName) { if($this->_debug) error_log("ajaxfelamimail::generateMessageList"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($this->_connectionStatus === false) { return $response->getXML(); @@ -516,7 +516,7 @@ $folderName = html_entity_decode($_folderName, ENT_QUOTES, $this->charset); if($folderName != '--topfolder--' && $folderStatus = $this->bofelamimail->getFolderStatus($folderName)) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($this->sessionDataAjax['oldFolderName'] == '--topfolder--') { $this->sessionDataAjax['oldFolderName'] = ''; @@ -565,7 +565,7 @@ $this->sessionDataAjax['oldFolderName'] = $folderName; $this->saveSessionData(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign("newMailboxName", "value", ''); $response->addAssign("folderName", "innerHTML", ''); $response->addScript("document.getElementById('newMailboxName').disabled = true;"); @@ -638,7 +638,7 @@ return $this->generateMessageList($this->sessionData['mailbox']); } else { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addScript('resetMessageSelect();'); $response->addScript('tellUser("'.lang('No messages selected, or lost selection. Changing to folder ').'","'.$_folderName.'");'); $response->addScript('onNodeSelect("'.$_folderName.'");'); @@ -677,7 +677,7 @@ if ($this->_debug) error_log("ajaxfelamimail::refreshFolder"); $GLOBALS['egw']->session->commit_session(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if ($this->_connectionStatus === true) { $folderName = $this->sessionData['mailbox']; @@ -699,7 +699,7 @@ if($this->_debug) error_log("ajaxfelamimail::refreshFolderList"); $GLOBALS['egw']->session->commit_session(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($this->_connectionStatus === true) { $folders = $this->bofelamimail->getFolderObjects(); @@ -725,7 +725,7 @@ $boSignatures = new felamimail_bosignatures(); $signatures = $boSignatures->getListOfSignatures(); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign('signatureTable', 'innerHTML', $this->uiwidgets->createSignatureTable($signatures)); return $response->getXML(); } @@ -750,7 +750,7 @@ } $accountArray[]=$tempvar; } - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign('userDefinedAccountTable', 'innerHTML', $this->uiwidgets->createAccountDataTable($accountArray)); return $response->getXML(); } @@ -802,7 +802,7 @@ $table = html::table($tableRows, "style='width:100%'"); } - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign('divAttachments', 'innerHTML', $table); return $response->getXML(); } @@ -824,7 +824,7 @@ $parentFolder = ($_parentFolder == '--topfolder--' ? '' : $parentFolder); if($this->_debug) error_log("ajaxfelamimail::renameFolder work with ($oldFolderName, $parentFolder, $folderName)"); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if(strtoupper($_oldFolderName) != 'INBOX' ) { if($newFolderName = $this->bofelamimail->renameFolder($oldFolderName, $parentFolder, $folderName)) { //enforce the subscription to the newly named server, as it seems to fail for names with umlauts @@ -866,7 +866,7 @@ $signatureID = $boSignatures->saveSignature($_id, $_description, $_signature, $isDefaultSignature); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($_mode == 'save') { #$response->addAssign('signatureID', 'value', $signatureID); @@ -887,7 +887,7 @@ $Identities = $preferences->getIdentity($identity); //error_log(print_r($Identities->signature,true)); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addScript('setSignature('.$Identities->signature.');'); return $response->getXML(); } @@ -900,7 +900,7 @@ 'email_home' => $_searchString, ),array('n_fn','email','email_home'),'n_fn','','%',false,'OR',array(0,20)); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if(is_array($contacts)) { $innerHTML = ''; @@ -988,7 +988,7 @@ function updateACL($_user, $_acl) { if ($_acl == 'custom') { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); return $response->getXML(); } @@ -998,7 +998,7 @@ return $this->updateACLView(); } - $response =& new xajaxResponse(); + $response = new xajaxResponse(); // add error message // $response->add??? return $response->getXML(); @@ -1014,7 +1014,7 @@ function updateACLView() { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if($folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName'])) { $response->addAssign("aclTable", "innerHTML", $this->createACLTable($folderACL)); } @@ -1031,7 +1031,7 @@ $this->bofelamimail->subscribe($folderName, $status); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); return $response->getXML(); } @@ -1059,14 +1059,14 @@ function updateSingleACL($_accountName, $_aclType, $_aclStatus) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $data = $this->bofelamimail->updateSingleACL($this->sessionDataAjax['folderName'], $_accountName, $_aclType, $_aclStatus); return $response->getXML(); } function xajaxFolderInfo($_formValues) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAssign("field1", "value", $_formValues['num1']); $response->addAssign("field2", "value", $_formValues['num2']); diff --git a/felamimail/inc/class.bosieve.inc.php b/felamimail/inc/class.bosieve.inc.php index 219c3f4f6d..7fd94a863d 100644 --- a/felamimail/inc/class.bosieve.inc.php +++ b/felamimail/inc/class.bosieve.inc.php @@ -126,7 +126,7 @@ // setting up an async job to enable/disable the vacation message include_once(EGW_API_INC.'/class.asyncservice.inc.php'); - $async =& new asyncservice(); + $async = new asyncservice(); $user = $GLOBALS['egw_info']['user']['account_id']; $async->delete($async_id ="felamimail-vacation-$user"); $end_date = $_vacation['end_date'] + 24*3600; // end-date is inclusive, so we have to add 24h diff --git a/felamimail/inc/class.uisieve.inc.php b/felamimail/inc/class.uisieve.inc.php index 4b4c49f6f1..fdcbdf7c32 100644 --- a/felamimail/inc/class.uisieve.inc.php +++ b/felamimail/inc/class.uisieve.inc.php @@ -257,7 +257,7 @@ if ($_vacation['forwards']) { - foreach(split(', ?',$_vacation['forwards']) as $addr) + foreach(preg_split('/, ?/',$_vacation['forwards']) as $addr) { if (!preg_match($regexp,$addr)) { @@ -522,7 +522,7 @@ // store text as default if (isset($_POST['set_as_default'])) { - $config =& new config('felamimail'); + $config = new config('felamimail'); $config->save_value('default_vacation_text',$_POST['vacation_text'],'felamimail'); } $this->t->set_var('set_as_default',''); @@ -581,7 +581,7 @@ // vacation text if (empty($vacation['text'])) { - $config =& new config('felamimail'); + $config = new config('felamimail'); $config = $config->read_repository(); $vacation['text'] = $config['default_vacation_text']; } diff --git a/importexport/inc/class.uidefinitions.inc.php b/importexport/inc/class.uidefinitions.inc.php index c28b32d4d3..a6c648a875 100644 --- a/importexport/inc/class.uidefinitions.inc.php +++ b/importexport/inc/class.uidefinitions.inc.php @@ -59,7 +59,7 @@ class uidefinitions $GLOBALS['egw_info']['flags']['currentapp'] = self::_appname; $GLOBALS['egw_info']['flags']['include_xajax'] = true; - $this->etpl =& new etemplate(); + $this->etpl = new etemplate(); $this->clock = html::image(self::_appname,'clock'); $this->steps = array( 'wizzard_step10' => lang('Choose an application'), @@ -112,7 +112,7 @@ class uidefinitions } } - $etpl =& new etemplate(self::_appname.'.definition_index'); + $etpl = new etemplate(self::_appname.'.definition_index'); // we need an offset because of autocontinued rows in etemplate ... $definitions = array('row0'); @@ -213,7 +213,7 @@ class uidefinitions if(class_exists('xajaxResponse')) { - $this->response =& new xajaxResponse(); + $this->response = new xajaxResponse(); if ($content['closewindow']) { @@ -245,7 +245,7 @@ class uidefinitions // adding a manual icon to every popup if ($GLOBALS['egw_info']['user']['apps']['manual']) { - $manual =& new etemplate('etemplate.popup.manual'); + $manual = new etemplate('etemplate.popup.manual'); echo $manual->exec(self::_appname.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1); unset($manual); } @@ -271,7 +271,7 @@ class uidefinitions /*if($content['plugin'] && $content['application']&& !is_object($this->plugin)) { $plugin_definition = $this->plugins[$content['application']][$content['plugin']]['definition']; - if($plugin_definition) $this->plugin =& new $plugin_definition; + if($plugin_definition) $this->plugin = new $plugin_definition; }*/ if(is_object($this->plugin)) { @@ -446,7 +446,7 @@ class uidefinitions } else { - $etpl =& new etemplate(self::_appname.'.import_definition'); + $etpl = new etemplate(self::_appname.'.import_definition'); return $etpl->exec(self::_appname.'.uidefinitions.import_definition',$content,array(),$readonlys,$preserv); } } diff --git a/importexport/inc/class.uiexport.inc.php b/importexport/inc/class.uiexport.inc.php index 114e937b29..211e6a46c1 100644 --- a/importexport/inc/class.uiexport.inc.php +++ b/importexport/inc/class.uiexport.inc.php @@ -167,7 +167,7 @@ class uiexport { elseif(class_exists('xajaxResponse')) { //error_log(__LINE__.__FILE__.'$_content: '.print_r($_content,true)); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); if ($_content['defintion'] == 'expert') { $definition = new definition(); diff --git a/infolog/csv_import.php b/infolog/csv_import.php index 30110ac94d..98012b6ea5 100644 --- a/infolog/csv_import.php +++ b/infolog/csv_import.php @@ -429,8 +429,8 @@ case 'import': { if (ereg((string) $pattern,$val)) { - // echo "

csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",ereg_replace('$pattern','$replace','$val') = "; - $val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val); + // echo "

csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",preg_replace('/$pattern/','$replace','$val') = "; + $val = preg_replace('/'.(string) $pattern.'/',str_replace($VPre,'\\',$replace),(string) $val); // echo "'$val'

"; $reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg; @@ -485,7 +485,7 @@ case 'import': { $responsible = $values['responsible']; $values['responsible'] = array(); - foreach(split('[,;]',$responsible) as $user) + foreach(preg_split('/[,;]/',$responsible) as $user) { if (preg_match('/\[([^\]]+)\]/',$user,$matches)) $user = $matches[1]; if ($user && !is_numeric($user)) $user = $GLOBALS['egw']->accounts->name2id($user); diff --git a/infolog/inc/class.infolog_customfields.inc.php b/infolog/inc/class.infolog_customfields.inc.php index ab86b03371..6639f977f4 100644 --- a/infolog/inc/class.infolog_customfields.inc.php +++ b/infolog/inc/class.infolog_customfields.inc.php @@ -209,7 +209,7 @@ class infolog_customfields { foreach(explode("\n",$field['values']) as $line) { - list($var,$value) = split('=',trim($line),2); + list($var,$value) = explode('=',trim($line),2); $var = trim($var); $values[$var] = empty($value) ? $var : $value; } diff --git a/infolog/inc/class.infolog_datasource.inc.php b/infolog/inc/class.infolog_datasource.inc.php index 4937856249..3101233680 100644 --- a/infolog/inc/class.infolog_datasource.inc.php +++ b/infolog/inc/class.infolog_datasource.inc.php @@ -44,7 +44,7 @@ class infolog_datasource extends datasource // we use $GLOBALS['infolog_bo'] as an already running instance might be availible there if (!is_object($GLOBALS['infolog_bo'])) { - $GLOBALS['infolog_bo'] =& new infolog_bo(); + $GLOBALS['infolog_bo'] = new infolog_bo(); } $this->infolog_bo =& $GLOBALS['infolog_bo']; } @@ -150,7 +150,7 @@ class infolog_datasource extends datasource if (!is_object($GLOBALS['infolog_bo'])) { include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.infolog_bo.inc.php'); - $GLOBALS['infolog_bo'] =& new infolog_bo(); + $GLOBALS['infolog_bo'] = new infolog_bo(); } // dont delete infolog, which are linked to other elements, but their project if (count(egw_link::get_links('infolog',$id)) > 1) diff --git a/infolog/inc/class.infolog_groupdav.inc.php b/infolog/inc/class.infolog_groupdav.inc.php index 021276e4a4..80bc82a109 100644 --- a/infolog/inc/class.infolog_groupdav.inc.php +++ b/infolog/inc/class.infolog_groupdav.inc.php @@ -34,7 +34,7 @@ class infolog_groupdav extends groupdav_handler { parent::__construct($app,$debug,$base_uri); - $this->bo =& new infolog_bo(); + $this->bo = new infolog_bo(); } const PATH_ATTRIBUTE = 'info_id'; @@ -219,7 +219,7 @@ class infolog_groupdav extends groupdav_handler */ private function _get_handler() { - $handler =& new infolog_ical(); + $handler = new infolog_ical(); $handler->setSupportedFields('GroupDAV',$this->agent); return $handler; diff --git a/infolog/inc/class.infolog_widget.inc.php b/infolog/inc/class.infolog_widget.inc.php index 6cf3826acb..0ebbf25d86 100644 --- a/infolog/inc/class.infolog_widget.inc.php +++ b/infolog/inc/class.infolog_widget.inc.php @@ -60,7 +60,7 @@ class infolog_widget function infolog_widget($ui) { $this->ui = $ui; - $this->infolog =& new infolog_bo(); + $this->infolog = new infolog_bo(); } /** diff --git a/login.php b/login.php index cf98187dcb..a12893de51 100755 --- a/login.php +++ b/login.php @@ -402,7 +402,7 @@ else foreach($_GET as $name => $value) { - if(ereg('phpgw_',$name)) + if(strpos($name,'phpgw_') !== false) { $extra_vars .= '&' . $name . '=' . urlencode($value); } diff --git a/notifications/inc/class.ajaxnotifications.inc.php b/notifications/inc/class.ajaxnotifications.inc.php index f74912579b..8cbebdbbf6 100644 --- a/notifications/inc/class.ajaxnotifications.inc.php +++ b/notifications/inc/class.ajaxnotifications.inc.php @@ -76,7 +76,7 @@ class ajaxnotifications { * @return xajax response */ public function get_popup_notifications() { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $session_id = $GLOBALS['egw_info']['user']['sessionid']; $message = ''; $rs = $this->db->select(self::_notification_table, diff --git a/phpgwapi/inc/adodb/adodb-datadict.inc.php b/phpgwapi/inc/adodb/adodb-datadict.inc.php index f9a41992a0..898071c397 100644 --- a/phpgwapi/inc/adodb/adodb-datadict.inc.php +++ b/phpgwapi/inc/adodb/adodb-datadict.inc.php @@ -390,7 +390,7 @@ class ADODB_DataDict { if ($flds) { list($lines,$pkey) = $this->_GenFields($flds); list(,$first) = each($lines); - list(,$column_def) = split("[\t ]+",$first,2); + list(,$column_def) = preg_split("/[\t ]+/",$first,2); } return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def)); } diff --git a/phpgwapi/inc/adodb/adodb-pear.inc.php b/phpgwapi/inc/adodb/adodb-pear.inc.php index 9a938b5c29..b99080f670 100644 --- a/phpgwapi/inc/adodb/adodb-pear.inc.php +++ b/phpgwapi/inc/adodb/adodb-pear.inc.php @@ -113,7 +113,7 @@ class DB { include_once(ADODB_DIR."/drivers/adodb-$type.inc.php"); $obj = &NewADOConnection($type); - if (!is_object($obj)) $obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); + if (!is_object($obj)) $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); return $obj; } @@ -159,7 +159,7 @@ class DB @$obj =& NewADOConnection($type); if (!is_object($obj)) { - $obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); + $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1); return $obj; } if (is_array($options)) { diff --git a/phpgwapi/inc/adodb/adodb-perf.inc.php b/phpgwapi/inc/adodb/adodb-perf.inc.php index 4895809c33..2f25283b8f 100644 --- a/phpgwapi/inc/adodb/adodb-perf.inc.php +++ b/phpgwapi/inc/adodb/adodb-perf.inc.php @@ -75,10 +75,10 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) $conn->_logsql = false; // disable logsql error simulation $dbT = $conn->databaseType; - $a0 = split(' ',$t0); + $a0 = explode(' ',$t0); $a0 = (float)$a0[1]+(float)$a0[0]; - $a1 = split(' ',$t1); + $a1 = explode(' ',$t1); $a1 = (float)$a1[1]+(float)$a1[0]; $time = $a1 - $a0; diff --git a/phpgwapi/inc/adodb/adodb-xmlschema.inc.php b/phpgwapi/inc/adodb/adodb-xmlschema.inc.php index 7b92a7b81a..7a6a857bb7 100644 --- a/phpgwapi/inc/adodb/adodb-xmlschema.inc.php +++ b/phpgwapi/inc/adodb/adodb-xmlschema.inc.php @@ -350,7 +350,7 @@ class dbTable extends dbObject { */ function &addIndex( $attributes ) { $name = strtoupper( $attributes['NAME'] ); - $this->indexes[$name] =& new dbIndex( $this, $attributes ); + $this->indexes[$name] = new dbIndex( $this, $attributes ); return $this->indexes[$name]; } @@ -362,7 +362,7 @@ class dbTable extends dbObject { */ function &addData( $attributes ) { if( !isset( $this->data ) ) { - $this->data =& new dbData( $this, $attributes ); + $this->data = new dbData( $this, $attributes ); } return $this->data; } diff --git a/phpgwapi/inc/adodb/adodb.inc.php b/phpgwapi/inc/adodb/adodb.inc.php index 9e6cab9fb4..ebd3d7d309 100644 --- a/phpgwapi/inc/adodb/adodb.inc.php +++ b/phpgwapi/inc/adodb/adodb.inc.php @@ -885,7 +885,7 @@ } if ($this->_queryID === true) { // return simplified recordset for inserts/updates/deletes with lower overhead - $rs =& new ADORecordSet_empty(); + $rs = new ADORecordSet_empty(); return $rs; } @@ -1853,7 +1853,7 @@ if (empty($this->_metars)) { $rsclass = $this->rsPrefix.$this->databaseType; - $this->_metars =& new $rsclass(false,$this->fetchMode); + $this->_metars = new $rsclass(false,$this->fetchMode); } return $this->_metars->MetaType($t,$len,$fieldobj); diff --git a/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php b/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php index ca03cb6ba8..cb0f138c91 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php @@ -369,7 +369,7 @@ class ADORecordset_informix72 extends ADORecordSet { foreach($fp as $k => $v) { $o = new ADOFieldObject; $o->name = $k; - $arr = split(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE" + $arr = explode(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE" $o->type = $arr[0]; $o->max_length = $arr[1]; $this->_fieldprops[] = $o; diff --git a/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php b/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php index fc07584ad8..de70e7de79 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php @@ -422,7 +422,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od } if (empty($qid)) return $false; - $rs =& new ADORecordSet_odbc($qid); + $rs = new ADORecordSet_odbc($qid); $ADODB_FETCH_MODE = $savem; if (!$rs) return $false; diff --git a/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php b/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php index cd3be2848c..eafd5473d2 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php @@ -647,7 +647,7 @@ WHERE c2.relname=\'%s\' or c2.relname=lower(\'%s\')'; if (strlen($db) == 0) $db = 'template1'; $db = adodb_addslashes($db); if ($str) { - $host = split(":", $str); + $host = explode(":", $str); if ($host[0]) $str = "host=".adodb_addslashes($host[0]); else $str = 'host=localhost'; if (isset($host[1])) $str .= " port=$host[1]"; diff --git a/phpgwapi/inc/adodb/drivers/adodb-sybase_ase.inc.php b/phpgwapi/inc/adodb/drivers/adodb-sybase_ase.inc.php index 4f4b0e0a41..e356fcd01f 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-sybase_ase.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-sybase_ase.inc.php @@ -77,7 +77,7 @@ class ADODB_sybase_ase extends ADODB_sybase { $retarr = array(); while (!$rs->EOF) { - $fld =& new ADOFieldObject(); + $fld = new ADOFieldObject(); $fld->name = $rs->Fields('field_name'); $fld->type = $rs->Fields('type'); $fld->max_length = $rs->Fields('width'); diff --git a/phpgwapi/inc/adodb/session/adodb-encrypt-md5.php b/phpgwapi/inc/adodb/session/adodb-encrypt-md5.php index 87269be12a..607e60f398 100644 --- a/phpgwapi/inc/adodb/session/adodb-encrypt-md5.php +++ b/phpgwapi/inc/adodb/session/adodb-encrypt-md5.php @@ -21,14 +21,14 @@ class ADODB_Encrypt_MD5 { /** */ function write($data, $key) { - $md5crypt =& new MD5Crypt(); + $md5crypt = new MD5Crypt(); return $md5crypt->encrypt($data, $key); } /** */ function read($data, $key) { - $md5crypt =& new MD5Crypt(); + $md5crypt = new MD5Crypt(); return $md5crypt->decrypt($data, $key); } diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 55eb20ed74..7cb327bfe3 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -482,7 +482,7 @@ class accounts_sql */ function update_lastlogin($account_id, $ip) { - $previous_login = $this->db->select($this->table,'account_lastlogin',array('account_id'=>abs($account_id)),__LINE__,__FILE__)->fetchSingle(); + $previous_login = $this->db->select($this->table,'account_lastlogin',array('account_id'=>abs($account_id)),__LINE__,__FILE__)->fetchColumn(); $this->db->update($this->table,array( 'account_lastloginfrom' => $ip, diff --git a/phpgwapi/inc/class.acl.inc.php b/phpgwapi/inc/class.acl.inc.php index 8330e3ac83..bfdac2467e 100644 --- a/phpgwapi/inc/class.acl.inc.php +++ b/phpgwapi/inc/class.acl.inc.php @@ -436,7 +436,7 @@ class acl 'acl_location' => $location, 'acl_account' => $account_id, 'acl_appname' => $appname, - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); } /** diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index bb7c3aded2..c51bd754ef 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -604,7 +604,7 @@ class asyncservice while ($line = fgets($crontab,256)) { if ($this->debug) echo 'line '.++$n.": $line
\n"; - $parts = split(' ',$line,6); + $parts = explode(' ',$line,6); if ($line{0} == '#' || count($parts) < 6 || ($parts[5]{0} != '/' && substr($parts[5],0,3) != 'php')) { diff --git a/phpgwapi/inc/class.auth_ads.inc.php b/phpgwapi/inc/class.auth_ads.inc.php index 6b59b91265..bf649ba79d 100644 --- a/phpgwapi/inc/class.auth_ads.inc.php +++ b/phpgwapi/inc/class.auth_ads.inc.php @@ -31,7 +31,7 @@ function authenticate($username, $passwd) { - if (ereg('[()|&=*,<>!~]',$username)) + if (preg_match('/[()|&=*,<>!~]/',$username)) { return False; } diff --git a/phpgwapi/inc/class.auth_sql.inc.php b/phpgwapi/inc/class.auth_sql.inc.php index 2dce59c721..aa0b4f3e2b 100644 --- a/phpgwapi/inc/class.auth_sql.inc.php +++ b/phpgwapi/inc/class.auth_sql.inc.php @@ -130,7 +130,7 @@ class auth_ 'account_id' => $account_id, 'account_type' => 'u', 'account_status' => 'A', - ),__LINE__,__FILE__)->fetchSingle()) === false) + ),__LINE__,__FILE__)->fetchColumn()) === false) { return false; // account not found } diff --git a/phpgwapi/inc/class.browser.inc.php b/phpgwapi/inc/class.browser.inc.php index 68e98328b9..8ab2e85134 100644 --- a/phpgwapi/inc/class.browser.inc.php +++ b/phpgwapi/inc/class.browser.inc.php @@ -39,30 +39,30 @@ /* Determine browser and version */ - if(ereg('MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) + if(preg_match('/MSIE ([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) { $this->BROWSER_VER = $log_version[1]; $this->BROWSER_AGENT = 'IE'; } - elseif(ereg('Opera ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version) || - ereg('Opera/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) + elseif(preg_match('/Opera ([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version) || + preg_match('/Opera\\/([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) { $this->BROWSER_VER = $log_version[1]; $this->BROWSER_AGENT = 'OPERA'; } - elseif(eregi('iCab ([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version) || - eregi('iCab/([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version)) + elseif(preg_match('/iCab ([0-9].[0-9a-zA-Z]{1,4})/i',$HTTP_USER_AGENT,$log_version) || + preg_match('/iCab\\/([0-9].[0-9a-zA-Z]{1,4})/i',$HTTP_USER_AGENT,$log_version)) { $this->BROWSER_VER = $log_version[1]; $this->BROWSER_AGENT = 'iCab'; } - elseif(ereg('Gecko',$HTTP_USER_AGENT,$log_version)) + elseif(strpos($HTTP_USER_AGENT,'Gecko') !== false) { $this->BROWSER_VER = $log_version[1]; $this->BROWSER_AGENT = 'MOZILLA'; } - elseif(ereg('Konqueror/([0-9].[0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version) || - ereg('Konqueror/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) + elseif(preg_match('/Konqueror\\/([0-9].[0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version) || + preg_match('/Konqueror\\/([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) { $this->BROWSER_VER=$log_version[1]; $this->BROWSER_AGENT='Konqueror'; diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index 85cb3af727..333417fd71 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -94,7 +94,7 @@ class categories case 'mains': $where = 'cat_parent = 0'; break; default: return False; } - return $this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__)->fetchSingle(); + return $this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__)->fetchColumn(); } /** @@ -190,7 +190,7 @@ class categories $where = '(cat_appname=' . $this->db->quote($this->app_name) . ' AND ' . $grant_cats . $global_cats . ')' . $parent_filter . $querymethod . $filter; - $this->total_records = $this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__)->fetchSingle(); + $this->total_records = $this->db->select($this->table,'COUNT(*)',$where,__LINE__,__FILE__)->fetchColumn(); if (!$this->total_records) return false; @@ -731,7 +731,7 @@ class categories } } $where[] = $grant_cats . ")"; - return $cache[$type][$cat_name][$cat_id][$private] = $this->db->select($this->table,'cat_id',$where,__LINE__,__FILE__)->fetchSingle(); + return $cache[$type][$cat_name][$cat_id][$private] = $this->db->select($this->table,'cat_id',$where,__LINE__,__FILE__)->fetchColumn(); } /** diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 37e980dda4..19a5f42e2d 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -606,7 +606,7 @@ { while ($file = readdir($dh)) { - if (eregi("\.css$", $file) && $file != 'phpgw.css') + if (preg_match('/'."\.css$".'/i', $file) && $file != 'phpgw.css') { $list[] = substr($file,0,strpos($file,'.')); } @@ -618,7 +618,7 @@ $dh = opendir(EGW_SERVER_ROOT . '/phpgwapi/themes'); while ($file = readdir($dh)) { - if (eregi("\.theme$", $file)) + if (preg_match('/'."\.theme$".'/i', $file)) { $list[] = substr($file,0,strpos($file,'.')); } diff --git a/phpgwapi/inc/class.contenthistory.inc.php b/phpgwapi/inc/class.contenthistory.inc.php index ca3ca16764..1dfc3e1dd0 100644 --- a/phpgwapi/inc/class.contenthistory.inc.php +++ b/phpgwapi/inc/class.contenthistory.inc.php @@ -116,7 +116,7 @@ class contenthistory 'sync_contentid' => $_id, ); - if (($ts = $this->db->select(self::TABLE,$col,$where,__LINE__,__FILE__)->fetchSingle())) + if (($ts = $this->db->select(self::TABLE,$col,$where,__LINE__,__FILE__)->fetchColumn())) { $ts = $this->db->from_timestamp($ts); } @@ -155,7 +155,7 @@ class contenthistory 'sync_contentid' => $_id, ); - if (!$this->db->select(self::TABLE,'sync_contentid',$where,__LINE__,__FILE__)->fetchSingle()) + if (!$this->db->select(self::TABLE,'sync_contentid',$where,__LINE__,__FILE__)->fetchColumn()) { $this->db->insert(self::TABLE,$newData,array(),__LINE__,__FILE__); } diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index d5930dc546..8f7b1156ed 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -84,9 +84,9 @@ class egw extends egw_minimal // check if eGW is already setup, if not redirect to setup/ try { $this->db->connect(); - if (!($num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle())) + if (!($num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchColumn())) { - $phpgw_config = $this->db->select('phpgw_config','COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle(); + $phpgw_config = $this->db->select('phpgw_config','COUNT(config_name)',false,__LINE__,__FILE__)->fetchColumn(); } } catch(Exception $e) { @@ -113,7 +113,7 @@ class egw extends egw_minimal $system_charset = $this->db->select(config::TABLE,'config_value',array( 'config_app' => 'phpgwapi', 'config_name' => 'system_charset', - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); if ($system_charset) { $this->db->Link_ID->SetCharSet($system_charset); diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index a8c2025f46..60220d5e53 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -39,7 +39,7 @@ * egw_db allows to use exceptions to catch sql-erros, not existing tables or failure to connect to the database, eg.: * try { * $this->db->connect(); - * $num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle(); + * $num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchColumn(); * } * catch(Exception $e) { * echo "Connection to DB failed (".$e->getMessage().")!\n"; diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index e15e3eb528..824eda8b79 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -641,7 +641,7 @@ abstract class egw_framework { require_once(EGW_SERVER_ROOT.'/phpgwapi/inc/xajax.inc.php'); - $xajax =& new xajax($GLOBALS['egw']->link('/xajax.php'), 'xajax_', $GLOBALS['egw']->translation->charset()); + $xajax = new xajax($GLOBALS['egw']->link('/xajax.php'), 'xajax_', $GLOBALS['egw']->translation->charset()); $xajax->waitCursorOff(); $xajax->registerFunction("doXMLHTTP"); diff --git a/phpgwapi/inc/class.egw_session.inc.php b/phpgwapi/inc/class.egw_session.inc.php index 3ff31cd3fc..ef26966e2a 100644 --- a/phpgwapi/inc/class.egw_session.inc.php +++ b/phpgwapi/inc/class.egw_session.inc.php @@ -689,7 +689,7 @@ class egw_session 'account_id = 0', 'ip' => $ip, "li > $block_time", - ),__LINE__,__FILE__)->fetchSingle()) > $GLOBALS['egw_info']['server']['num_unsuccessful_ip']) + ),__LINE__,__FILE__)->fetchColumn()) > $GLOBALS['egw_info']['server']['num_unsuccessful_ip']) { //echo "

login_blocked: ip='$ip' ".$this->db->f(0)." trys (".$GLOBALS['egw_info']['server']['num_unsuccessful_ip']." max.) since ".date('Y/m/d H:i',$block_time)."

\n"; $blocked = true; @@ -698,7 +698,7 @@ class egw_session 'account_id = 0', '(loginid = '.$GLOBALS['egw']->db->quote($login).' OR loginid LIKE '.$GLOBALS['egw']->db->quote($login.'@%').')', "li > $block_time", - ),__LINE__,__FILE__)->fetchSingle()) > $GLOBALS['egw_info']['server']['num_unsuccessful_id']) + ),__LINE__,__FILE__)->fetchColumn()) > $GLOBALS['egw_info']['server']['num_unsuccessful_id']) { //echo "

login_blocked: login='$login' ".$this->db->f(0)." trys (".$GLOBALS['egw_info']['server']['num_unsuccessful_id']." max.) since ".date('Y/m/d H:i',$block_time)."

\n"; $blocked = true; diff --git a/phpgwapi/inc/class.error.inc.php b/phpgwapi/inc/class.error.inc.php index c661d206ec..cf2695ec31 100755 --- a/phpgwapi/inc/class.error.inc.php +++ b/phpgwapi/inc/class.error.inc.php @@ -61,7 +61,7 @@ } $fname = $parms['file']; $line = $parms['line']; - if (eregi('([DIWEF])-([[:alnum:]]*)\, (.*)',$etext,$match)) + if (preg_match('/([DIWEF])-([[:alnum:]]*)\, (.*)/i',$etext,$match)) { $this->severity = strtoupper($match[1]); $this->code = $match[2]; diff --git a/phpgwapi/inc/class.http.inc.php b/phpgwapi/inc/class.http.inc.php index 7324072b8e..58b42523b5 100644 --- a/phpgwapi/inc/class.http.inc.php +++ b/phpgwapi/inc/class.http.inc.php @@ -459,7 +459,7 @@ } break; case 'expires': - if(ereg("^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT$",$value,$matches)) + if(preg_match('/'."^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT$".'/',$value,$matches)) { $year = (int)$matches[5]; if($year<1900) diff --git a/phpgwapi/inc/class.interserver.inc.php b/phpgwapi/inc/class.interserver.inc.php index 337fa9147a..11704860c9 100644 --- a/phpgwapi/inc/class.interserver.inc.php +++ b/phpgwapi/inc/class.interserver.inc.php @@ -81,7 +81,7 @@ function interserver($serverid='') { - $url = eregi_replace('https*://[^/]*/','',$GLOBALS['egw_info']['server']['webserver_url']); + $url = preg_replace('/https*:\\/\\/[^\\/]*\\//i','',$GLOBALS['egw_info']['server']['webserver_url']); $this->urlparts = array( 'xmlrpc' => $url.'/xmlrpc.php', 'soap' => $url.'/soap.php' diff --git a/phpgwapi/inc/class.javascript.inc.php b/phpgwapi/inc/class.javascript.inc.php index d303e0ea76..f144de598d 100644 --- a/phpgwapi/inc/class.javascript.inc.php +++ b/phpgwapi/inc/class.javascript.inc.php @@ -309,7 +309,7 @@ $thyapi_comp = 'thyapi_comp_gecko.js'; } - $GLOBALS['egw_info']['flags']['java_script_globals']['jsapi']['imgDir'] = $GLOBALS['egw_info']['server']['webserver_url'].'/'.'phpgwapi/images'; + $GLOBALS['egw_info']['flags']['java_script_globals']['jsapi']['imgDir'] = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images'; if (EGW_UNCOMPRESSED_THYAPI) { $jsCode = "\n" . diff --git a/phpgwapi/inc/class.jscalendar.inc.php b/phpgwapi/inc/class.jscalendar.inc.php index ae37eaee02..e0ade483fc 100644 --- a/phpgwapi/inc/class.jscalendar.inc.php +++ b/phpgwapi/inc/class.jscalendar.inc.php @@ -204,8 +204,8 @@ function monthClicked(calendar,monthstart) { { return False; } - $fields = split('[./-]',$datestr); - foreach(split('[./-]',$this->dateformat) as $n => $field) + $fields = preg_split('/[.\\/-]/',$datestr); + foreach(preg_split('/[.\\/-]/',$this->dateformat) as $n => $field) { if ($field == 'M') { diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index f9f367814a..82abf5bd95 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -496,7 +496,7 @@ class PHPMailer { $to .= $this->AddrFormat($this->to[$i]); } - $toArr = split(',', $to); + $toArr = explode(',', $to); $params = sprintf("-oi -f %s", $this->Sender); if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { @@ -1779,7 +1779,7 @@ class PHPMailer { $directory = dirname($url); ($directory == '.')?$directory='':''; $cid = 'cid:' . md5($filename); - $fileParts = split("\.", $filename); + $fileParts = explode("\.", $filename); $ext = $fileParts[1]; $mimeType = $this->_mime_types($ext); if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } diff --git a/phpgwapi/inc/class.soap_client.inc.php b/phpgwapi/inc/class.soap_client.inc.php index b6c31397c8..ad3c6cfdc1 100644 --- a/phpgwapi/inc/class.soap_client.inc.php +++ b/phpgwapi/inc/class.soap_client.inc.php @@ -53,12 +53,12 @@ $this->action = ''; // endpoint mangling - if(ereg("^http://",$path)) + if(preg_match('/'."^http:\\/\\/".'/',$path)) { $path = str_replace('http://','',$path); $this->path = strstr($path,'/'); $this->debug("path = $this->path"); - if(ereg(':',$path)) + if(preg_match('/:/',$path)) { $this->server = substr($path,0,strpos($path,':')); $this->port = substr(strstr($path,':'),1); diff --git a/phpgwapi/inc/class.soap_parser.inc.php b/phpgwapi/inc/class.soap_parser.inc.php index 0e5228719d..ec7d3d22d6 100644 --- a/phpgwapi/inc/class.soap_parser.inc.php +++ b/phpgwapi/inc/class.soap_parser.inc.php @@ -134,15 +134,15 @@ $this->parent = $pos; // set status - if(ereg(":Envelope$",$name)) + if(preg_match('/'.":Envelope$".'/',$name)) { $this->status = 'envelope'; } - elseif(ereg(":Header$",$name)) + elseif(preg_match('/'.":Header$".'/',$name)) { $this->status = 'header'; } - elseif(ereg(":Body$",$name)) + elseif(preg_match('/'.":Body$".'/',$name)) { $this->status = 'body'; // set method @@ -150,7 +150,7 @@ elseif($this->status == 'body') { $this->status = 'method'; - if(ereg(':',$name)) + if(preg_match('/:/',$name)) { $this->root_struct_name = substr(strrchr($name,':'),1); } @@ -169,7 +169,7 @@ // set attrs $this->message[$pos]['attrs'] = $attrs; // get namespace - if(ereg(":",$name)) + if(preg_match('/'.":".'/',$name)) { $namespace = substr($name,0,strpos($name,':')); $this->message[$pos]['namespace'] = $namespace; @@ -185,7 +185,7 @@ /* foreach($attrs as $key => $value) */ { // if ns declarations, add to class level array of valid namespaces - if(ereg('xmlns:',$key)) + if(preg_match('/xmlns:/',$key)) { $namespaces[substr(strrchr($key,':'),1)] = $value; if($name == $this->root_struct_name) @@ -280,11 +280,11 @@ { $this->status = 'body'; } - elseif(ereg(':Body',$name)) + elseif(preg_match('/:Body/',$name)) { $this->status = 'header'; } - elseif(ereg(':Header',$name)) + elseif(preg_match('/:Header/',$name)) { $this->status = 'envelope'; } diff --git a/phpgwapi/inc/class.soap_server.inc.php b/phpgwapi/inc/class.soap_server.inc.php index badabeff8c..7831061eba 100644 --- a/phpgwapi/inc/class.soap_server.inc.php +++ b/phpgwapi/inc/class.soap_server.inc.php @@ -81,13 +81,13 @@ if($headers_array["SOAPAction"]) { $action = str_replace('"','',$headers_array["SOAPAction"]); - if(ereg("^urn:",$action)) + if(preg_match('/'."^urn:".'/',$action)) { $this->service = substr($action,4); } - elseif(ereg(".php",$action)) + elseif(preg_match('/'.".php".'/',$action)) { - $this->service = ereg_replace('"|/','',substr(strrchr($action,".php"),4,strlen(strrchr($action,"/")))); + $this->service = preg_replace('/"|\\/','/',substr(strrchr($action,".php"),4,strlen(strrchr($action,"/")))); } $this->debug("got service: $this->service"); } @@ -105,7 +105,7 @@ $this->debug("method name: $this->methodname"); // does method exist? - $test = ereg_replace("\.",'_',$this->methodname); + $test = preg_replace('/'."\.".'/','_',$this->methodname); if(function_exists($test)) { $method = $this->methodname = $test; @@ -115,7 +115,7 @@ { /* egroupware customization - createobject based on methodname */ list($app,$class,$method) = explode('.',$this->methodname); - if(ereg("^service",$app)) + if(preg_match('/'."^service".'/',$app)) { $args = $class; $class = 'service'; diff --git a/phpgwapi/inc/class.soapmsg.inc.php b/phpgwapi/inc/class.soapmsg.inc.php index cdd9208c3f..30900c03c9 100644 --- a/phpgwapi/inc/class.soapmsg.inc.php +++ b/phpgwapi/inc/class.soapmsg.inc.php @@ -111,12 +111,12 @@ $this->debug("Entering parseResponse()"); //$this->debug(" w/ data $data"); // strip headers here - //$clean_data = ereg_replace("\r\n","\n", $data); - if(ereg("^.*\r\n\r\n<",$data)) + //$clean_data = preg_replace('/'."\r\n".'/',"\n", $data); + if(preg_match('/'."^.*\r\n\r\n<".'/',$data)) { $this->debug("found proper seperation of headers and document"); $this->debug("getting rid of headers, stringlen: ".strlen($data)); - $clean_data = ereg_replace("^.*\r\n\r\n<","<", $data); + $clean_data = preg_replace('/'."^.*\r\n\r\n<".'/',"<", $data); $this->debug("cleaned data, stringlen: ".strlen($clean_data)); } else @@ -134,7 +134,7 @@ } /* // if response is a proper http response, and is not a 200 - if(ereg("^HTTP",$clean_data) && !ereg("200$", $clean_data)) + if(preg_match('/'."^HTTP".'/',$clean_data) && !preg_match('/'."200$".'/', $clean_data)) { // get error data $errstr = substr($clean_data, 0, strpos($clean_data, "\n")-1); diff --git a/phpgwapi/inc/class.soapval.inc.php b/phpgwapi/inc/class.soapval.inc.php index 9127ce6a1a..01e2a93b97 100644 --- a/phpgwapi/inc/class.soapval.inc.php +++ b/phpgwapi/inc/class.soapval.inc.php @@ -94,7 +94,7 @@ } // get type prefix - if(ereg(":",$type)) + if(preg_match('/'.":".'/',$type)) { $this->type = substr(strrchr($type,':'),1,strlen(strrchr($type,':'))); $this->type_prefix = substr($type,0,strpos($type,':')); @@ -198,7 +198,7 @@ $type = 'array'; } } - elseif(!ereg("^[0-9]*$",$k) && in_array($k,array_keys($this->soapTypes))) + elseif(!preg_match('/'."^[0-9]*$".'/',$k) && in_array($k,array_keys($this->soapTypes))) { $type = $k; } diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index 8f55bb842a..6a136a6f9c 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -1486,7 +1486,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper $GLOBALS['egw_info']['server']['files_dir'] = $GLOBALS['egw_setup']->db->select('egw_config','config_value',array( 'config_name' => 'files_dir', 'config_app' => 'phpgwapi', - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); } } if (!$GLOBALS['egw_info']['server']['files_dir']) diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 0e3b3bdde0..85caa7494f 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -102,7 +102,7 @@ class translation 'lang' => $lang, 'message_id'=> 'charset', 'app_name' => 'common', - ),__LINE__,__FILE__)->fetchSingle())) + ),__LINE__,__FILE__)->fetchColumn())) { $this->charsets[$lang] = 'iso-8859-1'; } @@ -309,7 +309,7 @@ class translation { return $this->langs[$lang]; } - return $this->db->select($this->languages_table,'lang_name',array('lang_id' => $lang),__LINE__,__FILE__)->fetchSingle(); + return $this->db->select($this->languages_table,'lang_name',array('lang_id' => $lang),__LINE__,__FILE__)->fetchColumn(); } /** @@ -511,7 +511,7 @@ class translation if (($ctimes = $this->db->select($this->config_table,'config_value',array( 'config_app' => 'phpgwapi', 'config_name' => 'lang_ctimes', - ),__LINE__,__FILE__)->fetchSingle())) + ),__LINE__,__FILE__)->fetchColumn())) { $GLOBALS['egw_info']['server']['lang_ctimes'] = unserialize(stripslashes($ctimes)); } @@ -539,7 +539,7 @@ class translation //echo "
Test: addonlynew - select count(*) from egw_lang where lang='".$lang."'"; if (!$this->db->select($this->lang_table,'COUNT(*)',array( 'lang' => $lang, - ),__LINE__,__FILE__)->fetchSingle()) + ),__LINE__,__FILE__)->fetchColumn()) { //echo '
Test: addonlynew - True'; $addlang = True; @@ -747,7 +747,7 @@ class translation } if ($this->db->select($this->lang_table,'COUNT(*)',array( 'app_name' => $appname - ),__LINE__,__FILE__)->fetchSingle()) + ),__LINE__,__FILE__)->fetchColumn()) { $this->db->delete($this->lang_table,array( 'app_name' => $appname @@ -820,7 +820,7 @@ class translation 'lang' => $lang, 'app_name' => $app_name, 'message_id' => $message_id, - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); } /** @@ -838,6 +838,6 @@ class translation if ($app) $where['app_name'] = $app; if ($lang) $where['lang'] = $lang; - return $this->db->select($this->lang_table,'message_id',$where,__LINE__,__FILE__)->fetchSingle(); + return $this->db->select($this->lang_table,'message_id',$where,__LINE__,__FILE__)->fetchColumn(); } } diff --git a/phpgwapi/inc/class.validator.inc.php b/phpgwapi/inc/class.validator.inc.php index 9eeafce78b..2e250bf724 100644 --- a/phpgwapi/inc/class.validator.inc.php +++ b/phpgwapi/inc/class.validator.inc.php @@ -50,7 +50,7 @@ /* strips all whitespace from a string */ function strip_space($text) { - return ereg_replace("( |\n|\t|\r)+", '', $text); + return preg_replace('/'."( |\n|\t|\r)+".'/', '', $text); } function is_allnumbers($text) @@ -196,7 +196,7 @@ foreach($segs as $seg) { //echo "Checking $seg
"; - if(eregi("[a-z0-9\-]{0,62}",$seg)) + if(preg_match('/'."[a-z0-9\-]{0,62}".'/i',$seg)) { $return = True; } diff --git a/phpgwapi/inc/class.vcard.inc.php b/phpgwapi/inc/class.vcard.inc.php index 82a71db278..7d38cdfe0b 100644 --- a/phpgwapi/inc/class.vcard.inc.php +++ b/phpgwapi/inc/class.vcard.inc.php @@ -123,7 +123,7 @@ $fp = fopen($filename,'r'); while($data = fgets($fp,8000)) { - list($name,$value,$extra) = split(':', $data); + list($name,$value,$extra) = explode(':', $data); if(substr($value,0,5) == 'http') { $value = $value . ':'.$extra; @@ -216,12 +216,12 @@ settype($buffer,'array'); foreach($buffer as $name => $value) { - $field = split(';',$name); - $field[0] = ereg_replace("A\.",'',$field[0]); - $field[0] = ereg_replace("B\.",'',$field[0]); - $field[0] = ereg_replace("C\.",'',$field[0]); - $field[0] = ereg_replace("D\.",'',$field[0]); - $values = split(';',$value); + $field = explode(';',$name); + $field[0] = preg_replace('/'."A\.".'/','',$field[0]); + $field[0] = preg_replace('/'."B\.".'/','',$field[0]); + $field[0] = preg_replace('/'."C\.".'/','',$field[0]); + $field[0] = preg_replace('/'."D\.".'/','',$field[0]); + $values = explode(';',$value); if($field[1]) { //echo $field[0]; @@ -594,7 +594,7 @@ } else { - $tmp = split('-',$values[0]); + $tmp = explode('-',$values[0]); if($tmp[0]) { $entry['bday'] = $tmp[1] . '/' . $tmp[2] . '/' . $tmp[0]; @@ -612,7 +612,7 @@ $entry['adr_one_type'] = substr($buffer['adr_one_type'],0,-1); $entry['adr_two_type'] = substr($buffer['adr_two_type'],0,-1); - if(count($street = split("\r*\n",$buffer['adr_one_street'],3)) > 1) + if(count($street = preg_split("/\r*\n/",$buffer['adr_one_street'],3)) > 1) { $entry['adr_one_street'] = $street[0]; // RB 2001/05/08 added for Lotus Organizer to split multiline adresses $entry['address2'] = $street[1]; @@ -650,7 +650,7 @@ } elseif($value == 'BDAY') { - $tmp = split('/',$buffer[$value]); # 12/31/1969 -> 1969-12-31 + $tmp = explode('/',$buffer[$value]); # 12/31/1969 -> 1969-12-31 if($tmp[0]) { if(strlen($tmp[0]) == 1) { $tmp[0] = '0'.$tmp[0]; } diff --git a/phpgwapi/inc/class.wsdl.inc.php b/phpgwapi/inc/class.wsdl.inc.php index a633f4967a..b1e2770030 100644 --- a/phpgwapi/inc/class.wsdl.inc.php +++ b/phpgwapi/inc/class.wsdl.inc.php @@ -205,7 +205,7 @@ break; } // get element prefix - if(ereg(":",$name)) + if(preg_match('/'.":".'/',$name)) { $prefix = substr($name,0,strpos($name,':')); } diff --git a/phpgwapi/inc/class.xml.inc.php b/phpgwapi/inc/class.xml.inc.php index efd56fc1e7..7cb5ad1f15 100644 --- a/phpgwapi/inc/class.xml.inc.php +++ b/phpgwapi/inc/class.xml.inc.php @@ -494,7 +494,7 @@ class XML function remove_node ( $node ) { // Check whether the node is an attribute node. - if ( ereg("/attribute::", $node) ) + if ( preg_match('/'."\\/attribute::".'/', $node) ) { // Get the path to the attribute node's parent. $parent = $this->prestr($node, "/attribute::"); @@ -612,7 +612,7 @@ class XML function add_content ( $path, $value ) { // Check whether it's an attribute node. - if ( ereg("/attribute::", $path) ) + if ( preg_match('/'."\\/attribute::".'/', $path) ) { // Get the path to the attribute node's parent. $parent = $this->prestr($path, "/attribute::"); @@ -649,7 +649,7 @@ class XML function set_content ( $path, $value ) { // Check whether it's an attribute node. - if ( ereg("/attribute::", $path) ) + if ( preg_match('/'."\\/attribute::".'/', $path) ) { // Get the path to the attribute node's parent. $parent = $this->prestr($path, "/attribute::"); @@ -688,7 +688,7 @@ class XML function get_content ( $path ) { // Check whether it's an attribute node. - if ( ereg("/attribute::", $path) ) + if ( preg_match('/'."\\/attribute::".'/', $path) ) { // Get the path to the attribute node's parent. $parent = $this->prestr($path, "/attribute::"); @@ -1053,7 +1053,7 @@ class XML ); // Check whether there are predicates. - if ( ereg("\[", $step) ) + if ( preg_match('/'."\[".'/', $step) ) { // Get the predicates. $predicates = substr($step, strpos($step, "[")); @@ -1099,7 +1099,7 @@ class XML $axis["axis"] = "child"; $axis["node-test"] = "*"; } - elseif ( ereg("\(", $step) ) + elseif ( preg_match('/'."\(".'/', $step) ) { // Check whether it's a function. if ( $this->is_function($this->prestr($step, "(")) ) @@ -1130,13 +1130,13 @@ class XML $axis["node-test"] = $step; } } - elseif ( eregi("^@", $step) ) + elseif ( preg_match('/'."^@".'/i', $step) ) { // Use the attribute axis and select the attribute. $axis["axis"] = "attribute"; $axis["node-test"] = substr($step, 1); } - elseif ( eregi("\]$", $step) ) + elseif ( preg_match('/'."\]$".'/i', $step) ) { // Use the child axis and select a position. $axis["axis"] = "child"; @@ -1154,7 +1154,7 @@ class XML $axis["axis"] = "parent"; $axis["node-test"] = "*"; } - elseif ( ereg("^[a-zA-Z0-9\-_]+$", $step) ) + elseif ( preg_match('/'."^[a-zA-Z0-9\-_]+$".'/', $step) ) { // Select the child axis and the child. $axis["axis"] = "child"; @@ -1496,7 +1496,7 @@ class XML foreach ( $this->functions as $function ) { // Check whether there's a - sign in the function name. - if ( ereg("-", $function) ) + if ( strpos($function,"-") !== false ) { // Get the position of the - in the function name. $sign = strpos($function, "-"); @@ -1615,7 +1615,7 @@ class XML } // Check whether the predicate is a function. - if ( ereg("\(", $predicate) ) + if ( preg_match('/'."\(".'/', $predicate) ) { // Get the position of the first bracket. $start = strpos($predicate, "("); @@ -1664,8 +1664,8 @@ class XML } // Check whether the predicate is just a digit. - if ( ereg("^[0-9]+(\.[0-9]+)?$", $predicate) || - ereg("^\.[0-9]+$", $predicate) ) + if ( preg_match('/'."^[0-9]+(\.[0-9]+)?$".'/', $predicate) || + preg_match('/'."^\.[0-9]+$".'/', $predicate) ) { // Return the value of the digit. return doubleval($predicate); @@ -1718,7 +1718,7 @@ class XML foreach ( $predicates as $predicate ) { // Check whether the predicate is just an number. - if ( ereg("^[0-9]+$", $predicate) ) + if ( preg_match('/'."^[0-9]+$".'/', $predicate) ) { // Enhance the predicate. $predicate .= "=position()"; @@ -1786,7 +1786,7 @@ class XML function check_node_test ( $context, $node_test ) { // Check whether it's a function. - if ( ereg("\(", $node_test) ) + if ( preg_match('/'."\(".'/', $node_test) ) { // Get the type of function to use. $function = $this->prestr($node_test, "("); @@ -1862,7 +1862,7 @@ class XML // Add this node to the node-set. return true; } - elseif ( ereg("^[a-zA-Z0-9\-_]+", $node_test) ) + elseif ( preg_match('/'."^[a-zA-Z0-9\-_]+".'/', $node_test) ) { // Check whether the node-test can be fulfilled. if ( $this->nodes[$context]["name"] == $node_test ) @@ -2592,8 +2592,8 @@ class XML function handle_function_string ( $node, $arguments ) { // Check what type of parameter is given - if ( ereg("^[0-9]+(\.[0-9]+)?$", $arguments) || - ereg("^\.[0-9]+$", $arguments) ) + if ( preg_match('/'."^[0-9]+(\.[0-9]+)?$".'/', $arguments) || + preg_match('/'."^\.[0-9]+$".'/', $arguments) ) { // Convert the digits to a number. $number = doubleval($arguments); @@ -2701,7 +2701,7 @@ class XML $second = $this->evaluate_predicate($node, $second); // Check whether the first string starts with the second one. - if ( ereg("^".$second, $first) ) + if ( preg_match('/'."^".$second.'/', $first) ) { // Return true. return true; @@ -2935,8 +2935,8 @@ class XML $arguments = trim($arguments); // Check what type of parameter is given - if ( ereg("^[0-9]+(\.[0-9]+)?$", $arguments) || - ereg("^\.[0-9]+$", $arguments) ) + if ( preg_match('/'."^[0-9]+(\.[0-9]+)?$".'/', $arguments) || + preg_match('/'."^\.[0-9]+$".'/', $arguments) ) { // Convert the digits to a number. $number = doubleval($arguments); @@ -3128,8 +3128,8 @@ class XML function handle_function_number ( $node, $arguments ) { // Check the type of argument. - if ( ereg("^[0-9]+(\.[0-9]+)?$", $arguments) || - ereg("^\.[0-9]+$", $arguments) ) + if ( preg_match('/'."^[0-9]+(\.[0-9]+)?$".'/', $arguments) || + preg_match('/'."^\.[0-9]+$".'/', $arguments) ) { // Return the argument as a number. return doubleval($arguments); @@ -3367,7 +3367,7 @@ class XML } // Replace the last separator. - $command = eregi_replace(", $", ");", $command); + $command = preg_replace('/'.", $".'/i', ");", $command); // Execute the command. eval($command); diff --git a/phpgwapi/inc/class.xmlrpc_client.inc.php b/phpgwapi/inc/class.xmlrpc_client.inc.php index 87f36bf2c0..19e773d779 100644 --- a/phpgwapi/inc/class.xmlrpc_client.inc.php +++ b/phpgwapi/inc/class.xmlrpc_client.inc.php @@ -211,7 +211,7 @@ } elseif(is_string($msg)) { - $n =& new xmlrpcmsg(''); + $n = new xmlrpcmsg(''); $n->payload = $msg; $msg = $n; } @@ -668,17 +668,17 @@ $calls = array(); foreach($msgs as $msg) { - $call['methodName'] =& new xmlrpcval($msg->method(),'string'); + $call['methodName'] = new xmlrpcval($msg->method(),'string'); $numParams = $msg->getNumParams(); $params = array(); for($i = 0; $i < $numParams; $i++) { $params[$i] = $msg->getParam($i); } - $call['params'] =& new xmlrpcval($params, 'array'); - $calls[] =& new xmlrpcval($call, 'struct'); + $call['params'] = new xmlrpcval($params, 'array'); + $calls[] = new xmlrpcval($call, 'struct'); } - $multicall =& new xmlrpcmsg('system.multicall'); + $multicall = new xmlrpcmsg('system.multicall'); $multicall->addParam(new xmlrpcval($calls, 'array')); // Attempt RPC call @@ -717,7 +717,7 @@ return false; // Bad value } // Normal return value - $response[$i] =& new xmlrpcresp($val->arraymem(0)); + $response[$i] = new xmlrpcresp($val->arraymem(0)); break; case 'struct': $code = $val->structmem('faultCode'); @@ -730,7 +730,7 @@ { return false; } - $response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval()); + $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval()); break; default: return false; diff --git a/phpgwapi/inc/class.xmlrpc_server.inc.php b/phpgwapi/inc/class.xmlrpc_server.inc.php index 80540ea0bb..16e842646e 100644 --- a/phpgwapi/inc/class.xmlrpc_server.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server.inc.php @@ -52,12 +52,12 @@ { $arr = array(); - if (ereg('^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$',$isodate,$arr)) + if (preg_match('/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$/',$isodate,$arr)) { // $isodate is simple ISO8601, remove the difference between split and ereg array_shift($arr); } - elseif (($arr = split('[-:T]',$isodate)) && count($arr) == 6) + elseif (($arr = preg_split('/[-:T]/',$isodate)) && count($arr) == 6) { // $isodate is extended ISO8601, do nothing } diff --git a/phpgwapi/inc/class.xmlrpc_server_epi.inc.php b/phpgwapi/inc/class.xmlrpc_server_epi.inc.php index 6cc0c8166d..199dc2015a 100644 --- a/phpgwapi/inc/class.xmlrpc_server_epi.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server_epi.inc.php @@ -161,7 +161,7 @@ $syscall = 0; /* Setup dispatch map based on the function, if this is a system call */ - if(ereg('^system\.', $methName)) + if(preg_match('/^system\./', $methName)) { foreach($GLOBALS['_xmlrpcs_dmap'] as $meth => $dat) { @@ -170,8 +170,8 @@ $sysCall = 1; $dmap = $this->dmap; } - elseif(ereg('^examples\.',$methName) || - ereg('^validator1\.',$methName) || + elseif(preg_match('/^examples\./',$methName) || + preg_match('/^validator1\./',$methName) || ereg('^interopEchoTests\.', $methName) ) { diff --git a/phpgwapi/inc/class.xmlrpc_server_php.inc.php b/phpgwapi/inc/class.xmlrpc_server_php.inc.php index 18575dd742..fb66925eb1 100644 --- a/phpgwapi/inc/class.xmlrpc_server_php.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server_php.inc.php @@ -238,8 +238,8 @@ } $_type = (is_integer($_res) ? 'int' : gettype($_res)); - if ($_type == 'string' && (ereg('^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$',$_res) || - ereg('^[0-9]{4}[0-9]{2}[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$',$_res))) + if ($_type == 'string' && (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/',$_res) || + preg_match('/^[0-9]{4}[0-9]{2}[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/',$_res))) { $_type = 'dateTime.iso8601'; } @@ -312,7 +312,7 @@ $_methName = $GLOBALS['_xh'][$parser]['method']; $this->last_method = $methName; - if(ereg("^system\.", $methName)) + if(preg_match('/'."^system\.".'/', $methName)) { $dmap = $GLOBALS['_xmlrpcs_dmap']; $sysCall=1; @@ -346,7 +346,7 @@ $service = $tmp[1]; $class = $tmp[0]; - if(ereg('^service',$method)) + if(preg_match('/^service/',$method)) { $t = 'phpgwapi.' . $class . '.exec'; $dmap = ExecMethod($t,array($service,'list_methods','xmlrpc')); @@ -420,7 +420,7 @@ // decode from utf-8 to our charset $this->req_array = $GLOBALS['egw']->translation->convert($this->req_array,'utf-8'); //_debug_array($this->req_array); - if (ereg('^service',$method)) + if (preg_match('/^service/',$method)) { $res = ExecMethod('phpgwapi.service.exec',array($service,$methName,$this->req_array)); } diff --git a/phpgwapi/inc/class.xmlrpcmsg.inc.php b/phpgwapi/inc/class.xmlrpcmsg.inc.php index b4e406da6b..38bb94f821 100644 --- a/phpgwapi/inc/class.xmlrpcmsg.inc.php +++ b/phpgwapi/inc/class.xmlrpcmsg.inc.php @@ -130,10 +130,10 @@ } // see if we got an HTTP 200 OK, else bomb // but only do this if we're using the HTTP protocol. - if(ereg("^HTTP",$data)) + if(preg_match('/'."^HTTP".'/',$data)) { // Strip HTTP 1.1 100 Continue header if present - while(ereg('^HTTP/1.1 1[0-9]{2} ', $data)) + while(preg_match('/^HTTP\\/1.1 1[0-9]{2} /', $data)) { $pos = strpos($data, 'HTTP', 12); // server sent a Continue header without any (valid) content following... @@ -144,7 +144,7 @@ } $data = substr($data, $pos); } - if(!ereg("^HTTP/[0-9\\.]+ 200 ", $data)) + if(!preg_match('/'."^HTTP\\/[0-9\\.]+ 200 ".'/', $data)) { $errstr= substr($data, 0, strpos($data, "\n")-1); error_log('HTTP error, got response: ' .$errstr); @@ -159,7 +159,7 @@ $GLOBALS['_xh'][$parser]['valuestack'] = array(); // separate HTTP headers from data - if(ereg("^HTTP", $data)) + if(preg_match('/'."^HTTP".'/', $data)) { // be tolerant to usage of \n instead of \r\n to separate headers and data // (even though it is not valid http) @@ -182,7 +182,7 @@ } } // be tolerant to line endings, and extra empty lines - $ar = split("\r?\n", trim(substr($data, 0, $pos))); + $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); while(list(,$line) = @each($ar)) { // take care of multi-line headers diff --git a/phpgwapi/inc/class.xmlrpcresp.inc.php b/phpgwapi/inc/class.xmlrpcresp.inc.php index 0d1c327287..41b8522d33 100644 --- a/phpgwapi/inc/class.xmlrpcresp.inc.php +++ b/phpgwapi/inc/class.xmlrpcresp.inc.php @@ -40,7 +40,7 @@ // programmer error // TODO error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to xmlrpcresp. Defaulting to empty value."); - $this->val =& new xmlrpcval(); + $this->val = new xmlrpcval(); } else { diff --git a/phpgwapi/inc/class.xmlrpcval.inc.php b/phpgwapi/inc/class.xmlrpcval.inc.php index 812c27227c..520ae28f95 100644 --- a/phpgwapi/inc/class.xmlrpcval.inc.php +++ b/phpgwapi/inc/class.xmlrpcval.inc.php @@ -84,7 +84,7 @@ case 2: // we're adding a scalar value to an array here //$ar=$this->me['array']; - //$ar[]=&new xmlrpcval($val, $type); + //$ar[]= new xmlrpcval($val, $type); //$this->me['array']=$ar; // Faster (?) avoid all the costly array-copy-by-val done here... $this->me['array'][]=& CreateObject('phpgwapi.xmlrpcval',$val, $type); diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index 8a33643c3b..08901e8d10 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -111,7 +111,7 @@ function print_debug($message,$var = 'messageonly',$part = 'app', $level = 3) /* if (!!(DEBUG_OUTPUT & 32)) { - $obj_debug =& new COM('Some_COM_App.Class','localhost'); + $obj_debug = new COM('Some_COM_App.Class','localhost'); if (is_object($obj_debug)) { $DebugMessage_return = $obj_debug->DebugMessage($output); @@ -335,9 +335,9 @@ function sanitize($string,$type) } break; case 'ip': - if (eregi("^[0-9]{1,3}(\.[0-9]{1,3}){3}$",$string)) + if (preg_match('/'."^[0-9]{1,3}(\.[0-9]{1,3}){3}$".'/i',$string)) { - $octets = split('\.',$string); + $octets = preg_split('/\./',$string); for ($i=0; $i != count($octets); $i++) { if ($octets[$i] < 0 || $octets[$i] > 255) @@ -356,7 +356,7 @@ function sanitize($string,$type) } break; case 'email': - if (eregi("^([[:alnum:]_%+=.-]+)@([[:alnum:]_.-]+)\.([a-z]{2,3}|[0-9]{1,3})$",$string)) + if (preg_match('/'."^([[:alnum:]_%+=.-]+)@([[:alnum:]_.-]+)\.([a-z]{2,3}|[0-9]{1,3})$".'/i',$string)) { return True; } @@ -704,19 +704,19 @@ function &CreateObject($class) switch(count($args)) { case 1: - $obj =& new $classname; + $obj = new $classname; break; case 2: - $obj =& new $classname($args[1]); + $obj = new $classname($args[1]); break; case 3: - $obj =& new $classname($args[1],$args[2]); + $obj = new $classname($args[1],$args[2]); break; case 4: - $obj =& new $classname($args[1],$args[2],$args[3]); + $obj = new $classname($args[1],$args[2],$args[3]); break; default: - $code = '$obj =& new ' . $classname . '('; + $code = '$obj = new ' . $classname . '('; foreach($args as $n => $arg) { if ($n) diff --git a/phpgwapi/inc/fpdf/tutorial/tuto6.php b/phpgwapi/inc/fpdf/tutorial/tuto6.php index 0d81a706ea..1893fbe6ff 100755 --- a/phpgwapi/inc/fpdf/tutorial/tuto6.php +++ b/phpgwapi/inc/fpdf/tutorial/tuto6.php @@ -47,7 +47,7 @@ function WriteHTML($html) $tag=strtoupper(array_shift($a2)); $attr=array(); foreach($a2 as $v) - if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3)) + if(preg_match('/^([^=]*)=["\']?([^"\']*)["\']?$/',$v,$a3)) $attr[strtoupper($a3[1])]=$a3[2]; $this->OpenTag($tag,$attr); } diff --git a/phpgwapi/inc/savant2/Savant2.php b/phpgwapi/inc/savant2/Savant2.php index 54c5c9f08c..9fc16c7627 100755 --- a/phpgwapi/inc/savant2/Savant2.php +++ b/phpgwapi/inc/savant2/Savant2.php @@ -657,7 +657,7 @@ class Savant2 { * * * - * $Savant2 =& new Savant2(); + * $Savant2 = new Savant2(); * * // assign directly * $Savant2->var1 = 'something'; @@ -1114,7 +1114,7 @@ class Savant2 { ! is_a($this->_resource['plugin'][$name], $class)) { // instantiate it - $this->_resource['plugin'][$name] =& new $class($conf); + $this->_resource['plugin'][$name] = new $class($conf); // add a Savant reference if requested if ($savantRef) { @@ -1316,7 +1316,7 @@ class Savant2 { ! is_a($this->_resource['filter'][$name], $class)) { // instantiate it - $this->_resource['filter'][$name] =& new $class($conf); + $this->_resource['filter'][$name] = new $class($conf); // add a Savant reference if requested if ($savantRef) { @@ -1455,7 +1455,7 @@ class Savant2 { } // instantiate and return the error class - $err =& new $class($conf); + $err = new $class($conf); return $err; } diff --git a/phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php b/phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php index 440949e89c..e7b6b985ea 100755 --- a/phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php +++ b/phpgwapi/inc/savant2/Savant2/Savant2_Compiler_basic.php @@ -225,7 +225,7 @@ class Savant2_Compiler_basic extends Savant2_Compiler { function Savant2_Compiler_basic($conf = array()) { parent::Savant2_Compiler($conf); - $this->ca =& new PHPCodeAnalyzer(); + $this->ca = new PHPCodeAnalyzer(); $this->allowedFunctions = $this->allowedFunctions(); $this->allowedStatic = $this->allowedStatic(); } diff --git a/phpgwapi/inc/savant2/Savant2/tests/1_assign.php b/phpgwapi/inc/savant2/Savant2/tests/1_assign.php index 1cc7577532..ce10658b3e 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/1_assign.php +++ b/phpgwapi/inc/savant2/Savant2/tests/1_assign.php @@ -12,7 +12,7 @@ error_reporting(E_ALL); require_once 'Savant2.php'; -$savant =& new Savant2(array('template_path' => 'templates')); +$savant = new Savant2(array('template_path' => 'templates')); echo "

assign 0 (string, null)

"; $val = null; diff --git a/phpgwapi/inc/savant2/Savant2/tests/2_display.php b/phpgwapi/inc/savant2/Savant2/tests/2_display.php index 15337ac820..aa5ec1a33b 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/2_display.php +++ b/phpgwapi/inc/savant2/Savant2/tests/2_display.php @@ -17,7 +17,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); $array = array( 'key0' => 'val0', diff --git a/phpgwapi/inc/savant2/Savant2/tests/3_fetch.php b/phpgwapi/inc/savant2/Savant2/tests/3_fetch.php index ff02c6088f..d797dc0b91 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/3_fetch.php +++ b/phpgwapi/inc/savant2/Savant2/tests/3_fetch.php @@ -17,7 +17,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); $array = array( 'key0' => 'val0', diff --git a/phpgwapi/inc/savant2/Savant2/tests/4_plugins.php b/phpgwapi/inc/savant2/Savant2/tests/4_plugins.php index 2f10a157c1..9b20e1aff9 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/4_plugins.php +++ b/phpgwapi/inc/savant2/Savant2/tests/4_plugins.php @@ -17,7 +17,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); $array = array( 'key0' => 'val0', diff --git a/phpgwapi/inc/savant2/Savant2/tests/5_filters.php b/phpgwapi/inc/savant2/Savant2/tests/5_filters.php index 9193088827..0dc1af2202 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/5_filters.php +++ b/phpgwapi/inc/savant2/Savant2/tests/5_filters.php @@ -18,7 +18,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); // set up filters $savant->loadFilter('colorizeCode'); diff --git a/phpgwapi/inc/savant2/Savant2/tests/6_paths.php b/phpgwapi/inc/savant2/Savant2/tests/6_paths.php index 59bec9e74c..22fbfbc5cb 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/6_paths.php +++ b/phpgwapi/inc/savant2/Savant2/tests/6_paths.php @@ -24,7 +24,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); echo "

Paths to begin with

\n"; preprint($savant->getPath('resource')); diff --git a/phpgwapi/inc/savant2/Savant2/tests/7_include.php b/phpgwapi/inc/savant2/Savant2/tests/7_include.php index c85b782d00..296aded7e6 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/7_include.php +++ b/phpgwapi/inc/savant2/Savant2/tests/7_include.php @@ -17,7 +17,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); $array = array( 'key0' => 'val0', diff --git a/phpgwapi/inc/savant2/Savant2/tests/8_extend.php b/phpgwapi/inc/savant2/Savant2/tests/8_extend.php index d8498d781c..9c783136cc 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/8_extend.php +++ b/phpgwapi/inc/savant2/Savant2/tests/8_extend.php @@ -17,7 +17,7 @@ $conf = array( 'resource_path' => 'resources' ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); $savant->display('extend.tpl.php'); diff --git a/phpgwapi/inc/savant2/Savant2/tests/9_errors.php b/phpgwapi/inc/savant2/Savant2/tests/9_errors.php index 58ab1dcff8..32397e3fd0 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/9_errors.php +++ b/phpgwapi/inc/savant2/Savant2/tests/9_errors.php @@ -12,7 +12,7 @@ error_reporting(E_ALL); require_once 'Savant2.php'; -$savant =& new Savant2(); +$savant = new Savant2(); require_once 'PEAR.php'; PEAR::setErrorHandling(PEAR_ERROR_PRINT); diff --git a/phpgwapi/inc/savant2/Savant2/tests/compile.php b/phpgwapi/inc/savant2/Savant2/tests/compile.php index a68ed08de5..3949cccad1 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/compile.php +++ b/phpgwapi/inc/savant2/Savant2/tests/compile.php @@ -26,11 +26,11 @@ $conf = array( 'restrict' => true // adding path restrictions! ); -$savant =& new Savant2($conf); +$savant = new Savant2($conf); // instantiate a compiler... require_once 'Savant2/Savant2_Compiler_basic.php'; -$compiler =& new Savant2_Compiler_basic(); +$compiler = new Savant2_Compiler_basic(); $compiler->compileDir = '/tmp/'; $compiler->forceCompile = true; diff --git a/phpgwapi/inc/savant2/Savant2/tests/form.php b/phpgwapi/inc/savant2/Savant2/tests/form.php index 2412870312..d6d67e5bdc 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/form.php +++ b/phpgwapi/inc/savant2/Savant2/tests/form.php @@ -2,7 +2,7 @@ error_reporting(E_ALL); require_once 'Savant2.php'; -$Savant2 =& new Savant2(); +$Savant2 = new Savant2(); $Savant2->addPath('template', 'templates/'); $Savant2->addPath('resource', 'resources/'); diff --git a/phpgwapi/inc/savant2/Savant2/tests/form2.php b/phpgwapi/inc/savant2/Savant2/tests/form2.php index cad4706396..04c3ce2901 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/form2.php +++ b/phpgwapi/inc/savant2/Savant2/tests/form2.php @@ -2,7 +2,7 @@ error_reporting(E_ALL); require_once 'Savant2.php'; -$Savant2 =& new Savant2(); +$Savant2 = new Savant2(); $Savant2->addPath('template', 'templates/'); $Savant2->addPath('resource', 'resources/'); diff --git a/phpgwapi/inc/savant2/Savant2/tests/templates/compile_bad.tpl.php b/phpgwapi/inc/savant2/Savant2/tests/templates/compile_bad.tpl.php index 29310f6e88..5c0529a20a 100755 --- a/phpgwapi/inc/savant2/Savant2/tests/templates/compile_bad.tpl.php +++ b/phpgwapi/inc/savant2/Savant2/tests/templates/compile_bad.tpl.php @@ -4,7 +4,7 @@

{$varivari; $this->$varivari}

{$this->variable1; global $_SERVER;}

-

{$this->variable2; $obj =& new StdClass;}

+

{$this->variable2; $obj = new StdClass;}

{$this->variable3; eval("echo 'bad guy!';")}

{$this->key0; print_r($this->_compiler);}

{$this->key1; File::read('/etc/passwd');}

diff --git a/phpgwapi/inc/xml_functions.inc.php b/phpgwapi/inc/xml_functions.inc.php index 5749635460..dab7bb2cd6 100644 --- a/phpgwapi/inc/xml_functions.inc.php +++ b/phpgwapi/inc/xml_functions.inc.php @@ -219,7 +219,7 @@ { return $GLOBALS['xmlEntities'][strtolower($ent)]; } - if (ereg("^#([0-9]+)$", $ent, $regs)) + if (preg_match('/'."^#([0-9]+)$".'/', $ent, $regs)) { return chr($regs[1]); } @@ -465,7 +465,7 @@ error_log('XML-RPC: missing VALUE inside PARAM in received xml'); break; case 'METHODNAME': - $GLOBALS['_xh'][$parser]['method']=ereg_replace("^[\n\r\t ]+", '', $GLOBALS['_xh'][$parser]['ac']); + $GLOBALS['_xh'][$parser]['method']=preg_replace('/'."^[\n\r\t ]+".'/', '', $GLOBALS['_xh'][$parser]['ac']); break; case 'PARAMS': case 'FAULT': @@ -482,7 +482,7 @@ function xmlrpc_cd($parser, $data) { - //if(ereg("^[\n\r \t]+$", $data)) return; + //if(preg_match('/'."^[\n\r \t]+$".'/', $data)) return; // print "adding [${data}]\n"; // skip processing if xml fault already detected @@ -560,7 +560,7 @@ { // return a time in the localtime, or UTC $t = 0; - if (ereg("([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})",$idate, $regs)) + if (preg_match('/'."([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})".'/',$idate, $regs)) { if ($utc) { @@ -693,7 +693,7 @@ { $methName = $m->getParam(0); $methName = $methName->scalarval(); - if (ereg("^system\.", $methName)) + if (preg_match('/'."^system\.".'/', $methName)) { $dmap = $GLOBALS['_xmlrpcs_dmap']; $sysCall = 1; @@ -740,7 +740,7 @@ { $methName = $m->getParam(0); $methName = $methName->scalarval(); - if (ereg("^system\.", $methName)) + if (preg_match('/'."^system\.".'/', $methName)) { $dmap = $GLOBALS['_xmlrpcs_dmap']; $sysCall=1; diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 85add230bd..99fde04087 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -258,7 +258,7 @@ function phpgwapi_upgrade1_5_005() $files_dir = $GLOBALS['egw_setup']->db->select('egw_config','config_value',array( 'config_name' => 'files_dir', 'config_app' => 'phpgwapi', - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); if ($files_dir && file_exists($files_dir) && file_exists($files_dir.'/infolog')) { @@ -296,7 +296,7 @@ function phpgwapi_upgrade1_5_006() ); $filescenter_app = $GLOBALS['egw_setup']->db->select('egw_applications','*',array( 'app_name' => 'filescenter', - ),__LINE__,__FILE__)->fetchSingle(); + ),__LINE__,__FILE__)->fetchColumn(); if (!$filescenter_app || !is_dir(EGW_INCLUDE_ROOT.'/filescenter')) { diff --git a/phpgwapi/templates/idots/class.idots_framework.inc.php b/phpgwapi/templates/idots/class.idots_framework.inc.php index 1f20e0368e..f3bdf780b8 100644 --- a/phpgwapi/templates/idots/class.idots_framework.inc.php +++ b/phpgwapi/templates/idots/class.idots_framework.inc.php @@ -71,7 +71,7 @@ class idots_framework extends egw_framework $GLOBALS['egw_info']['flags']['include_xajax'] = True; $this->egw_framework($template); // call the constructor of the extended class - $this->tplsav2 =& new tplsavant2(); + $this->tplsav2 = new tplsavant2(); $this->tplsav2->set_tpl_path(EGW_SERVER_ROOT.SEP.'phpgwapi'.SEP.'templates'.SEP.'idots'); } @@ -95,7 +95,7 @@ class idots_framework extends egw_framework // the instanciation of the template has to be here and not in the constructor, // as the old Template class has problems if restored from the session (php-restore) - $this->tpl =& new Template(EGW_TEMPLATE_DIR); + $this->tpl = new Template(EGW_TEMPLATE_DIR); $this->tpl->set_file(array('_head' => 'head.tpl')); $this->tpl->set_block('_head','head'); @@ -270,7 +270,7 @@ class idots_framework extends egw_framework */ function login_screen($extra_vars) { - $tmpl =& new Template($GLOBALS['egw_info']['server']['template_dir']); + $tmpl = new Template($GLOBALS['egw_info']['server']['template_dir']); $tmpl->set_file(array('login_form' => 'login.tpl')); @@ -421,7 +421,7 @@ class idots_framework extends egw_framework */ function denylogin_screen() { - $tmpl =& new Template($GLOBALS['egw_info']['server']['template_dir']); + $tmpl = new Template($GLOBALS['egw_info']['server']['template_dir']); $tmpl->set_file(array( 'login_form' => 'login_denylogin.tpl' diff --git a/preferences/inc/class.ajaxpreferences.inc.php b/preferences/inc/class.ajaxpreferences.inc.php index 33d5ca8869..56c66c1123 100644 --- a/preferences/inc/class.ajaxpreferences.inc.php +++ b/preferences/inc/class.ajaxpreferences.inc.php @@ -25,7 +25,7 @@ */ function storeEGWPref($repository,$key,$value) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $GLOBALS['egw']->preferences->read_repository(); $GLOBALS['egw']->preferences->change($repository,$key,$value); $GLOBALS['egw']->preferences->save_repository(True); diff --git a/resources/inc/class.resources_select_widget.inc.php b/resources/inc/class.resources_select_widget.inc.php index fcf6865e8d..47a01424f1 100644 --- a/resources/inc/class.resources_select_widget.inc.php +++ b/resources/inc/class.resources_select_widget.inc.php @@ -70,7 +70,7 @@ class resources_select_widget $cell['label'] = 'no resources'; return false; } - $tpl =& new etemplate('resources.resource_selectbox'); + $tpl = new etemplate('resources.resource_selectbox'); // keep the editor away from the generated tmpls $tpl->no_onclick = true; diff --git a/setup/inc/class.setup_cmd_header.inc.php b/setup/inc/class.setup_cmd_header.inc.php index 03de2cf75c..8665fdd97b 100644 --- a/setup/inc/class.setup_cmd_header.inc.php +++ b/setup/inc/class.setup_cmd_header.inc.php @@ -51,7 +51,7 @@ class setup_cmd_header extends setup_cmd // header is 2 levels lower then this command in setup/inc $this->header_path = realpath(dirname(__FILE__).'/../../header.inc.php'); - $this->setup_header =& new setup_header(); + $this->setup_header = new setup_header(); } /** diff --git a/setup/inc/class.setup_cmd_install.inc.php b/setup/inc/class.setup_cmd_install.inc.php index 88c301df54..2860787b90 100644 --- a/setup/inc/class.setup_cmd_install.inc.php +++ b/setup/inc/class.setup_cmd_install.inc.php @@ -75,7 +75,7 @@ class setup_cmd_install extends setup_cmd // use uploaded backup, instead installing from scratch if ($this->backup) { - $db_backup =& new db_backup(); + $db_backup = new db_backup(); if (!is_resource($f = $db_backup->fopen_backup($this->backup,true))) { diff --git a/setup/inc/class.setup_html.inc.php b/setup/inc/class.setup_html.inc.php index 00d50a9c51..4bfa346aa8 100644 --- a/setup/inc/class.setup_html.inc.php +++ b/setup/inc/class.setup_html.inc.php @@ -309,7 +309,7 @@ $dh = dir(EGW_SERVER_ROOT . '/phpgwapi/themes'); while ($file = $dh->read()) { - if (eregi("\.theme$", $file)) + if (preg_match('/'."\.theme$".'/i', $file)) { $list[] = substr($file,0,strpos($file,'.')); } diff --git a/setup/inc/class.setup_translation.inc.php b/setup/inc/class.setup_translation.inc.php index 0a193ee94e..32a078251b 100644 --- a/setup/inc/class.setup_translation.inc.php +++ b/setup/inc/class.setup_translation.inc.php @@ -105,7 +105,7 @@ if (!is_object($this->sql) || is_object($GLOBALS['egw_setup']->db) && !is_object($this->sql->db)) { include_once(EGW_API_INC.'/class.translation.inc.php'); - $this->sql =& new translation; + $this->sql = new translation; } } diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index f044f91c69..a96608f91a 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -83,7 +83,7 @@ function get_langs() $f = fopen('./lang/languages','rb'); while($line = fgets($f,200)) { - list($x,$y) = split("\t",$line); + list($x,$y) = explode("\t",$line); $languages[$x]['lang'] = trim($x); $languages[$x]['descr'] = trim($y); $languages[$x]['available'] = False; diff --git a/setup/lang.php b/setup/lang.php index 64974a1589..d193b76c3b 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -94,7 +94,7 @@ if($_POST['debug'] && count($GLOBALS['egw_setup']->translation->sql->line_reject $str = ''; foreach($GLOBALS['egw_setup']->translation->sql->line_rejected as $badline) { - $_f_buffer = split("[/\\]", $badline['appfile']); + $_f_buffer = preg_split("/[\\/\\]/", $badline['appfile']); $str .= lang('Application: %1, File: %2, Line: "%3"',''.$_f_buffer[count($_f_buffer)-3].'', ''.$_f_buffer[count($_f_buffer)-1].'',$badline['line'])."
\n"; } diff --git a/setup/manageheader.php b/setup/manageheader.php index 19da70b432..561d614840 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -13,7 +13,7 @@ include('./inc/functions.inc.php'); require_once('./inc/class.setup_header.inc.php'); -$GLOBALS['egw_setup']->header =& new setup_header(); +$GLOBALS['egw_setup']->header = new setup_header(); $setup_tpl = CreateObject('phpgwapi.Template','./templates/default'); $setup_tpl->set_file(array( diff --git a/setup/setup-cli.php b/setup/setup-cli.php index 6cb1b1e017..3bcb594810 100755 --- a/setup/setup-cli.php +++ b/setup/setup-cli.php @@ -433,7 +433,7 @@ function do_header($create,&$arguments) */ function get_lang(&$charset) { - @list($lang,$nation,$charset) = split("[_.]",strtolower($_SERVER['LANG'])); + @list($lang,$nation,$charset) = preg_split("/[_.]/",strtolower($_SERVER['LANG'])); foreach(file('lang/languages') as $line) { diff --git a/soap.php b/soap.php index a91e61fca2..6749866fff 100644 --- a/soap.php +++ b/soap.php @@ -44,7 +44,7 @@ settype($headers,'array'); foreach($_SERVER as $h => $v) { - if(ereg('HTTP_(.+)',$h,$hp)) + if(preg_match('/HTTP_(.+)/',$h,$hp)) { $headers[$hp[1]] = $v; } @@ -60,7 +60,7 @@ $tmp = str_replace(' ','',$tmp); $tmp = str_replace('Basic','',$tmp); $auth = base64_decode(trim($tmp)); - list($sessionid,$kp3) = split(':',$auth); + list($sessionid,$kp3) = explode(':',$auth); if($GLOBALS['egw']->session->verify($sessionid,$kp3)) { diff --git a/timesheet/fix_lost_links.php b/timesheet/fix_lost_links.php index f61e8f45e2..97bb17293f 100644 --- a/timesheet/fix_lost_links.php +++ b/timesheet/fix_lost_links.php @@ -18,8 +18,8 @@ include('../header.inc.php'); require_once(EGW_INCLUDE_ROOT.'/timesheet/inc/class.botimesheet.inc.php'); -$bots =& new botimesheet(); -$so_sql =& new so_sql('timesheet',$bots->table_name); +$bots = new botimesheet(); +$so_sql = new so_sql('timesheet',$bots->table_name); // search timesheet which have a project-field identical to an exiting PM project, but no link to it $rows = $so_sql->search(false,'ts_id,ts_project,ts_title','','pm_id,link_id','',false,'AND',false,array('link_id IS NULL'), diff --git a/timesheet/inc/class.timesheet_datasource.inc.php b/timesheet/inc/class.timesheet_datasource.inc.php index 8dd5c77370..211e4c9a6c 100644 --- a/timesheet/inc/class.timesheet_datasource.inc.php +++ b/timesheet/inc/class.timesheet_datasource.inc.php @@ -39,7 +39,7 @@ class timesheet_datasource extends datasource // we use $GLOBALS['timesheet_bo'] as an already running instance is availible there if (!is_object($GLOBALS['timesheet_bo'])) { - $GLOBALS['timesheet_bo'] =& new timesheet_bo(); + $GLOBALS['timesheet_bo'] = new timesheet_bo(); } if (!is_array($data_id)) { diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 551e720812..2b2fa6717b 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -58,7 +58,7 @@ class timesheet_ui extends timesheet_bo function edit($content = null,$view = false) { $tabs = 'general|notes|links|customfields'; - $etpl =& new etemplate('timesheet.edit'); + $etpl = new etemplate('timesheet.edit'); if (!is_array($content)) { @@ -638,7 +638,7 @@ class timesheet_ui extends timesheet_bo */ function index($content = null,$msg='') { - $etpl =& new etemplate('timesheet.index'); + $etpl = new etemplate('timesheet.index'); if ($_GET['msg']) $msg = $_GET['msg']; diff --git a/xajax.php b/xajax.php index 0400dd140f..d588da598d 100644 --- a/xajax.php +++ b/xajax.php @@ -25,7 +25,7 @@ function xajax_redirect(&$anon_account) $GLOBALS['xajax']->setCharEncoding($GLOBALS['egw']->translation->charset()); define('XAJAX_DEFAULT_CHAR_ENCODING',$GLOBALS['egw']->translation->charset()); - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addScript("location.href='".$GLOBALS['egw_info']['server']['webserver_url'].'/login.php?cd=10'."';"); header('Content-type: text/xml; charset='.$GLOBALS['egw']->translation->charset()); @@ -42,7 +42,7 @@ function xajax_redirect(&$anon_account) */ function ajax_exception_handler(Exception $e) { - $response =& new xajaxResponse(); + $response = new xajaxResponse(); $response->addAlert($e->getMessage()."\n\n".$e->getTraceAsString()); header('Content-type: text/xml; charset='.(is_object($GLOBALS['egw'])?$GLOBALS['egw']->translation->charset():'utf-8')); echo $response->getXML(); diff --git a/xmlrpc.php b/xmlrpc.php index 1a99e9271a..15456a3dca 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -49,7 +49,7 @@ settype($headers,'array'); foreach($_SERVER as $h => $v) { - if(ereg('HTTP_(.+)',$h,$hp)) + if(preg_match('/HTTP_(.+)/',$h,$hp)) { $headers[$hp[1]] = $v; } @@ -65,7 +65,7 @@ $server->setSimpleDate($isodate); $auth_header = $headers['Authorization'] ? $headers['Authorization'] : $headers['authorization']; - if(eregi('Basic *([^ ]*)',$auth_header,$auth)) + if(preg_match('/Basic *([^ ]*)/i',$auth_header,$auth)) { list($sessionid,$kp3) = explode(':',base64_decode($auth[1])); //echo "auth='$auth[1]', sessionid='$sessionid', kp3='$kp3'\n";