[Fusionforge-commits] r10841 - in trunk/src: common/docman common/include common/include/system cronjobs plugins/fckeditor/www/editor/filemanager/browser/default/connectors/php plugins/scmccase/common www www/account www/include www/news www/scm www/soap www/survey/admin
Franck VILLAUME
nerville at libremir.placard.fr.eu.org
Mon Oct 4 18:29:29 CEST 2010
Author: nerville
Date: 2010-10-04 18:29:29 +0200 (Mon, 04 Oct 2010)
New Revision: 10841
Modified:
trunk/src/common/docman/Parsedata.class.php
trunk/src/common/include/MailParser.class.php
trunk/src/common/include/User.class.php
trunk/src/common/include/account.php
trunk/src/common/include/system/LDAP.class.php
trunk/src/common/include/utils.php
trunk/src/cronjobs/forum_gateway.php
trunk/src/cronjobs/tracker_gateway.php
trunk/src/plugins/fckeditor/www/editor/filemanager/browser/default/connectors/php/connector.php
trunk/src/plugins/scmccase/common/CCasePlugin.class.php
trunk/src/www/account/register.php
trunk/src/www/include/HTML_Graphs.php
trunk/src/www/include/filechecks.php
trunk/src/www/news/submit.php
trunk/src/www/scm/viewvc.php
trunk/src/www/sendmessage.php
trunk/src/www/soap/nusoap.php
trunk/src/www/survey/admin/show_results_csv.php
Log:
ereg -> preg migration : fix from Bond Masuda in https://fusionforge.org/tracker/index.php?func=detail&aid=160&group_id=6&atid=107
Modified: trunk/src/common/docman/Parsedata.class.php
===================================================================
--- trunk/src/common/docman/Parsedata.class.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/docman/Parsedata.class.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -63,8 +63,7 @@
}
// always parse titre and description
$data2 = utf8_decode("$title $description");
- // $data2 = ereg_replace ("\n", " ", $data2);
- // temporary file for traitement
+ // temporary file for treatement
$filename = tempnam("/tmp", "tmp");
$fp = fopen ($filename, "w");
fwrite ($fp, $data2);
@@ -73,7 +72,7 @@
$cmd = "php -f $cmd $filename";
$rep1 = shell_exec ($cmd);
// dont need to unlink the filename because parser_text already remove it
- return ereg_replace ("\n", " ", "$rep $rep1");
+ return preg_replace("/\n/", " ", "$rep $rep1");
}
Modified: trunk/src/common/include/MailParser.class.php
===================================================================
--- trunk/src/common/include/MailParser.class.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/include/MailParser.class.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -64,7 +64,7 @@
//
// See if line starts with tab, if so ignore it for now
//
- if (!ereg('^[A-z]',$lines[$i])) {
+ if (!preg_match('/^[A-z]/',$lines[$i])) {
$header[$lastheader] = $header[$lastheader]."\n".$lines[$i];
} else {
$pos = (strpos($lines[$i],':'));
Modified: trunk/src/common/include/User.class.php
===================================================================
--- trunk/src/common/include/User.class.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/include/User.class.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -1176,9 +1176,9 @@
*/
function setAuthorizedKeys($keys) {
$keys = trim($keys);
- $keys = ereg_replace("\r\n", "\n", $keys); // Convert to Unix EOL
- $keys = ereg_replace("\n+", "\n", $keys); // Remove empty lines
- $keys = ereg_replace("\n", "###", $keys); // Convert EOL to marker
+ $keys = preg_replace("/\r\n/", "\n", $keys); // Convert to Unix EOL
+ $keys = preg_replace("/\n+/", "\n", $keys); // Remove empty lines
+ $keys = preg_replace("/\n/", "###", $keys); // Convert EOL to marker
$res = db_query_params ('UPDATE users SET authorized_keys=$1 WHERE user_id=$2',
array ($keys,
Modified: trunk/src/common/include/account.php
===================================================================
--- trunk/src/common/include/account.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/include/account.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -3,6 +3,7 @@
* FusionForge account functions
*
* Copyright 1999-2001, VA Linux Systems, Inc.
+ * Copyright 2010, Franck Villaume - Capgemini
*
* This file is part of FusionForge.
*
@@ -63,15 +64,16 @@
return 0;
}
- if (!ereg('^[a-z][-a-z0-9_]+$', $name)) {
+ if (!preg_match('/^[a-z][-a-z0-9_]+$/', $name)) {
$GLOBALS['register_error'] = _('Illegal character in name.');
return 0;
}
// illegal names
- if (eregi("^((root)|(bin)|(daemon)|(adm)|(lp)|(sync)|(shutdown)|(halt)|(mail)|(news)"
- . "|(uucp)|(operator)|(games)|(mysql)|(httpd)|(nobody)|(dummy)"
- . "|(www)|(cvs)|(shell)|(ftp)|(irc)|(debian)|(ns)|(download))$",$name)) {
+ $regExpReservedNames = "^(root|bin|daemon|adm|lp|sync|shutdown|halt|mail|news|"
+ . "uucp|operator|games|mysql|httpd|nobody|dummy|www|cvs|shell|ftp|irc|"
+ . "debian|ns|download)$";
+ if( preg_match("/$regExpReservedNames/i", $name) ) {
$GLOBALS['register_error'] = _('Name is reserved.');
return 0;
}
@@ -85,7 +87,7 @@
return 0;
}
}
- if (eregi("^(anoncvs_)",$name)) {
+ if (preg_match("/^(anoncvs_)/i",$name)) {
$GLOBALS['register_error'] = _('Name is reserved for CVS.');
return 0;
}
@@ -104,14 +106,16 @@
if (!account_namevalid($name)) return 0;
// illegal names
- if (eregi("^((www[0-9]?)|(cvs[0-9]?)|(shell[0-9]?)|(ftp[0-9]?)|(irc[0-9]?)|(news[0-9]?)"
- . "|(mail[0-9]?)|(ns[0-9]?)|(download[0-9]?)|(pub)|(users)|(compile)|(lists)"
- . "|(slayer)|(orbital)|(tokyojoe)|(webdev)|(projects)|(cvs)|(slayer)|(monitor)|(mirrors?))$",$name)) {
+ $regExpReservedGroupNames = "^(www[0-9]?|cvs[0-9]?|shell[0-9]?|ftp[0-9]?|"
+ . "irc[0-9]?|news[0-9]?|mail[0-9]?|ns[0-9]?|download[0-9]?|pub|users|"
+ . "compile|lists|slayer|orbital|tokyojoe|webdev|projects|cvs|monitor|"
+ . "mirrors?)$";
+ if(preg_match("/$regExpReservedGroupNames/i",$name)) {
$GLOBALS['register_error'] = _('Name is reserved for DNS purposes.');
return 0;
}
- if (eregi("_",$name)) {
+ if(preg_match("/_/",$name)) {
$GLOBALS['register_error'] = _('Group name cannot contain underscore for DNS reasons.');
return 0;
}
Modified: trunk/src/common/include/system/LDAP.class.php
===================================================================
--- trunk/src/common/include/system/LDAP.class.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/include/system/LDAP.class.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -56,7 +56,7 @@
return '?';
}
- return ereg_replace("[\x80-\xff]","?",$str);
+ return preg_replace("/[\x80-\xff]/","?",$str);
}
/*
Modified: trunk/src/common/include/utils.php
===================================================================
--- trunk/src/common/include/utils.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/common/include/utils.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -526,9 +526,14 @@
// angle brackets in the URL
// (RFC2396; http://www.w3.org/Addressing/URL/5.1_Wrappers.html)
$line = str_replace('>', "\1", $line);
- $line = eregi_replace("([ \t]|^)www\."," http://www.",$line);
- $text = eregi_replace("([[:alnum:]]+)://([^[:space:]<\1]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\" target=\"_new\">\\1://\\2\\3</a>", $line);
- $text = eregi_replace("([[:space:]]|^)(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", "\\1<a href=\"mailto:\\2\" target=\"_new\">\\2</a>", $text);
+ $line = preg_replace( "/([ \t]|^)www\./i", " http://www.", $line);
+ $text = preg_replace( "/([[:alnum:]]+):\/\/([^[:space:]<\1]*)([[:alnum:]#?\/&=])/i",
+ "<a href=\"\\1://\\2\\3\" target=\"_new\">\\1://\\2\\3</a>", $line);
+ $text = preg_replace(
+ "/([[:space:]]|^)(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))/i",
+ "\\1<a href=\"mailto:\\2\" target=\"_new\">\\2</a>",
+ $text
+ );
$text = str_replace("\1", '>', $text);
$newText .= $text;
}
@@ -811,7 +816,9 @@
*
*/
function validate_email ($address) {
- return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address) !== false);
+ return ( preg_match(
+ "/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+$/",
+ $address) );
}
/**
@@ -870,14 +877,14 @@
function valid_hostname ($hostname = "xyz") {
//bad char test
- $invalidchars = eregi_replace("[-A-Z0-9\.]","",$hostname);
+ $invalidchars = preg_replace("/[-A-Z0-9\.]/i","",$hostname);
if (!empty($invalidchars)) {
return false;
}
//double dot, starts with a . or -
- if (ereg("\.\.",$hostname) || ereg("^\.",$hostname) || ereg("^\-",$hostname)) {
+ if ( preg_match("/\.\./",$hostname) || preg_match("/^\./",$hostname) || preg_match("/^\-/",$hostname) ) {
return false;
}
Modified: trunk/src/cronjobs/forum_gateway.php
===================================================================
--- trunk/src/cronjobs/forum_gateway.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/cronjobs/forum_gateway.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -155,7 +155,7 @@
$this->Subject = addslashes(substr($subj,$parent_end+3));
}
*/
- if (ereg('(\[)([0-9]*)(\])',$subj,$arr)) {
+ if (preg_match('/(\[)([0-9]*)(\])/',$subj,$arr)) {
$this->Parent=$arr[2];
$parent_end=(strpos($subj,'['.$arr[2].']')) + strlen('['.$arr[2].']');
$this->Subject = addslashes(substr($subj,$parent_end));
Modified: trunk/src/cronjobs/tracker_gateway.php
===================================================================
--- trunk/src/cronjobs/tracker_gateway.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/cronjobs/tracker_gateway.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -129,7 +129,7 @@
//we parse that ID to get the artifact that this should post to
//
$subj = $mp->getSubject();
- if (ereg('(\[)([0-9]*)(\])',$subj,$arr)) {
+ if (preg_match('/(\[)([0-9]*)(\])/',$subj,$arr)) {
$this->ArtifactId=$arr[2];
$artifactid_end=(strpos($subj,'['.$arr[2].']')) + strlen('['.$arr[2].']');
$this->Subject = addslashes(substr($subj,$artifactid_end));
Modified: trunk/src/plugins/fckeditor/www/editor/filemanager/browser/default/connectors/php/connector.php
===================================================================
--- trunk/src/plugins/fckeditor/www/editor/filemanager/browser/default/connectors/php/connector.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/plugins/fckeditor/www/editor/filemanager/browser/default/connectors/php/connector.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -39,14 +39,14 @@
else
$GLOBALS["UserFilesPath"] = '/UserFiles/' ;
-if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
+if ( ! preg_match( '/\/$/', $GLOBALS["UserFilesPath"] ) )
$GLOBALS["UserFilesPath"] .= '/' ;
if ( strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
{
$GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
- if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
+ if ( ! preg_match( '/\/$/', $GLOBALS["UserFilesDirectory"] ) )
$GLOBALS["UserFilesDirectory"] .= '/' ;
}
else
@@ -72,7 +72,7 @@
return ;
// Check the current folder syntax (must begin and start with a slash).
- if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
+ if ( ! preg_match( '/\/$/', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
// Check for invalid folder paths (..)
@@ -106,4 +106,4 @@
exit ;
}
-?>
\ No newline at end of file
+?>
Modified: trunk/src/plugins/scmccase/common/CCasePlugin.class.php
===================================================================
--- trunk/src/plugins/scmccase/common/CCasePlugin.class.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/plugins/scmccase/common/CCasePlugin.class.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -76,7 +76,7 @@
$project =& group_get_object($group_id);
if ($project->usesPlugin ("scmccase")) {
- $vob_tag = ereg_replace ("GROUPNAME", $project->getUnixName (), forge_get_config('tag_pattern', 'scmccase')) ;
+ $vob_tag = preg_replace("/GROUPNAME/", $project->getUnixName (), forge_get_config('tag_pattern', 'scmccase')) ;
print '<h2>ClearCase</h2>
<p>Documentation for ClearCase is probably available somewhere.
Modified: trunk/src/www/account/register.php
===================================================================
--- trunk/src/www/account/register.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/account/register.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -95,7 +95,7 @@
if (!empty($error_msg))
print "<div class='error'>$error_msg</div>";
-if (!empty($warning))
+if (!empty($warning_msg))
print "<div class='warning_msg'>$warning_msg</div>";
if (!isset($timezone) || empty($timezone) || !preg_match('/^[-a-zA-Z0-9_\/\.+]+$/', $timezone)) {
Modified: trunk/src/www/include/HTML_Graphs.php
===================================================================
--- trunk/src/www/include/HTML_Graphs.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/include/HTML_Graphs.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -474,7 +474,7 @@
echo ">";
// Decide if the value in bar is a color code or image.
- if (ereg("^#", $bars[$i]))
+ if (preg_match("/^#/", $bars[$i]))
{
?>
@@ -611,13 +611,13 @@
<?php
// Set background to a color if it starts with # or
// an image otherwise.
- if (ereg("^#", $dbars[$i])) { print 'style="background-color:' . $dbars[$i] . '">'; }
+ if (preg_match("/^#/", $dbars[$i])) { print 'style="background-color:' . $dbars[$i] . '">'; }
else { print 'background="' . $dbars[$i] . '">'; }
?>
<nowrap>
<?php
// Decide if the value in bar is a color code or image.
- if (ereg("^#", $bars[$i]))
+ if (preg_match("/^#/", $bars[$i]))
{
?>
<table align="left" cellpadding="0" cellspacing="0"
Modified: trunk/src/www/include/filechecks.php
===================================================================
--- trunk/src/www/include/filechecks.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/include/filechecks.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -42,7 +42,7 @@
return 0;
}
- if (ereg('^\.',$filename)) {
+ if (preg_match('/^\./',$filename)) {
return 0;
}
@@ -88,82 +88,82 @@
$filename = chop($filename);
- if (ereg(".diff$",$filename)) {
+ if (preg_match("/\.diff$/",$filename)) {
$filetype = "diff";
}
- elseif (ereg(".diff.gz$",$filename)) {
+ elseif (preg_match("/\.diff.gz$/",$filename)) {
$filetype = "diff/gz";
filechecks_gz($filename);
}
- elseif (ereg(".asc$",$filename)) {
+ elseif (preg_match("/\.asc$/",$filename)) {
$filetype = "asc";
}
- elseif (ereg(".bin$",$filename)) {
+ elseif (preg_match("/\.bin$/",$filename)) {
$filetype = "bin";
}
- elseif (ereg(".exe$",$filename)) {
+ elseif (preg_match("/\.exe$/",$filename)) {
$filetype = "exe";
}
- elseif (ereg(".jar$",$filename)) {
+ elseif (preg_match("/\.jar$/",$filename)) {
$filetype = "jar";
}
- elseif (ereg(".lsm$",$filename)) {
+ elseif (preg_match("/\.lsm$/",$filename)) {
$filetype = "lsm";
}
- elseif (ereg(".pdb$",$filename)) {
+ elseif (preg_match("/\.pdb$/",$filename)) {
$filetype = "pilot";
}
- elseif (ereg(".pl$",$filename)) {
+ elseif (preg_match("/\.pl$/",$filename)) {
$filetype = "perl";
}
- elseif (ereg(".py$",$filename)) {
+ elseif (preg_match("/\.py$/",$filename)) {
$filetype = "python";
}
- elseif (ereg(".prc$",$filename)) {
+ elseif (preg_match("/\.prc$/",$filename)) {
$filetype = "pilot";
}
- elseif (ereg(".sig$",$filename)) {
+ elseif (preg_match("/\.sig$/",$filename)) {
$filetype = "sig";
}
- elseif (ereg(".tar.bz2$",$filename)) {
+ elseif (preg_match("/\.tar.bz2$/",$filename)) {
$filetype = "tar/bz2";
}
- elseif (ereg(".tar.gz$",$filename)) {
+ elseif (preg_match("/\.tar.gz$/",$filename)) {
$filetype = "tar/gz";
filechecks_targz($filename);
}
- elseif (ereg(".tgz$",$filename)) {
+ elseif (preg_match("/\.tgz$/",$filename)) {
$filetype = "tgz";
}
- elseif (ereg(".zip$",$filename)) {
+ elseif (preg_match("/\.zip$/",$filename)) {
$filetype = "zip";
}
- elseif (ereg(".shar.gz$",$filename)) {
+ elseif (preg_match("/\.shar.gz$/",$filename)) {
$filetype = "shar/gz";
}
- elseif (ereg(".bz2$",$filename)) {
+ elseif (preg_match("/\.bz2$/",$filename)) {
$filetype = "bz2";
}
- elseif (ereg(".gz$",$filename)) {
+ elseif (preg_match("/\.gz$/",$filename)) {
$filetype = "gz";
filechecks_gz($filename);
}
- elseif (ereg(".i386.rpm$",$filename)) {
+ elseif (preg_match("/\.i386.rpm$/",$filename)) {
$filetype = "i386 rpm";
}
- elseif (ereg(".alpha.rpm$",$filename)) {
+ elseif (preg_match("/\.alpha.rpm$/",$filename)) {
$filetype = "alpha rpm";
}
- elseif (ereg(".src.rpm$",$filename)) {
+ elseif (preg_match("/\.src.rpm$/",$filename)) {
$filetype = "src rpm";
}
- elseif (ereg(".rpm$",$filename)) {
+ elseif (preg_match("/\.rpm$/",$filename)) {
$filetype = "rpm";
}
- elseif (ereg(".deb$",$filename)) {
+ elseif (preg_match("/\.deb$/",$filename)) {
$filetype = "deb";
}
- elseif (ereg("\.([a-zA-Z]+)$",$filename,$regs)) {
+ elseif (preg_match("/\.([a-zA-Z]+)$/",$filename,$regs)) {
$filetype = $regs[1];
}
Modified: trunk/src/www/news/submit.php
===================================================================
--- trunk/src/www/news/submit.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/news/submit.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -92,7 +92,7 @@
db_begin();
$f=new Forum(group_get_object(forge_get_config('news_group')));
- if (!$f->create(ereg_replace('[^_\.0-9a-z-]','-', strtolower($summary)),$details,1,'',0,0)) {
+ if (!$f->create(preg_replace('/[^_\.0-9a-z-]/','-', strtolower($summary)),$details,1,'',0,0)) {
db_rollback();
exit_error($f->getErrorMessage(),'news');
}
Modified: trunk/src/www/scm/viewvc.php
===================================================================
--- trunk/src/www/scm/viewvc.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/scm/viewvc.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -56,7 +56,7 @@
}
}
// Remove eventual leading /root/ or root/
-$projectName = ereg_replace('^..[^/]*/','', $projectName);
+$projectName = preg_replace('%^..[^/]*/%','', $projectName);
if (!$projectName) {
exit_no_group();
}
Modified: trunk/src/www/sendmessage.php
===================================================================
--- trunk/src/www/sendmessage.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/sendmessage.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -47,7 +47,7 @@
}
}
-if ($toaddress && !eregi(forge_get_config('web_host'),$toaddress)) {
+if ($toaddress && !preg_match('/'.forge_get_config('web_host').'/i',$toaddress)) {
exit_error(sprintf(_('You can only send to addresses @<em>%1$s</em>.'),forge_get_config('web_host')),'home');
}
@@ -80,7 +80,7 @@
/*
send it to the toaddress
*/
- $to=eregi_replace('_maillink_','@',$toaddress);
+ $to=preg_replace('/_maillink_/i','@',$toaddress);
$to = util_remove_CRLF($to);
util_send_message($to,$subject,$body,$email,'',$name);
$HTML->header(array('title'=>forge_get_config ('forge_name').' ' ._('Contact') ));
Modified: trunk/src/www/soap/nusoap.php
===================================================================
--- trunk/src/www/soap/nusoap.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/soap/nusoap.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -562,7 +562,7 @@
case (is_array($val) || $type):
// detect if struct or array
$valueType = $this->isArraySimpleOrStruct($val);
- if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
+ if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
$this->debug("serialize_val: serialize array");
$i = 0;
if(is_array($val) && count($val)> 0){
@@ -765,7 +765,7 @@
*/
function expandQname($qname){
// get element prefix
- if(strpos($qname,':') && !ereg('^http://',$qname)){
+ if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
// get unqualified name
$name = substr(strstr($qname,':'),1);
// get ns prefix
@@ -904,7 +904,7 @@
function timestamp_to_iso8601($timestamp,$utc=true){
$datestr = date('Y-m-d\TH:i:sO',$timestamp);
if($utc){
- $eregStr =
+ $pregStr =
'([0-9]{4})-'. // centuries & years CCYY-
'([0-9]{2})-'. // months MM-
'([0-9]{2})'. // days DD
@@ -914,7 +914,7 @@
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
- if(ereg($eregStr,$datestr,$regs)){
+ if(preg_match("/$pregStr/",$datestr,$regs)){
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
}
return false;
@@ -930,7 +930,7 @@
* @access public
*/
function iso8601_to_timestamp($datestr){
- $eregStr =
+ $pregStr =
'([0-9]{4})-'. // centuries & years CCYY-
'([0-9]{2})-'. // months MM-
'([0-9]{2})'. // days DD
@@ -939,7 +939,7 @@
'([0-9]{2}):'. // minutes mm:
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
- if(ereg($eregStr,$datestr,$regs)){
+ if(preg_match("/$pregStr/",$datestr,$regs)){
// not utc
if($regs[8] != 'Z'){
$op = substr($regs[8],0,1);
@@ -1267,7 +1267,7 @@
if(count($attrs) > 0){
foreach($attrs as $k => $v){
// if ns declarations, add to class level array of valid namespaces
- if(ereg("^xmlns",$k)){
+ if(preg_match("/^xmlns/",$k)){
//$this->xdebug("$k: $v");
//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
if($ns_prefix = substr(strrchr($k,':'),1)){
@@ -1379,7 +1379,7 @@
// minOccurs="0" maxOccurs="unbounded" />
// </sequence>
// </complexType>
- if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+ if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
$this->xdebug('complexType is unusual array');
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
} else {
@@ -1399,7 +1399,7 @@
// minOccurs="0" maxOccurs="unbounded" />
// </sequence>
// </complexType>
- if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+ if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
$this->xdebug('complexType is unusual array');
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
} else {
@@ -1809,7 +1809,7 @@
} elseif(isset($this->attributes[$type])){
$this->xdebug("in getTypeDef, found attribute $type");
return $this->attributes[$type];
- } elseif (ereg('_ContainedType$', $type)) {
+ } elseif (preg_match('/_ContainedType$/', $type)) {
$this->xdebug("in getTypeDef, have an untyped element $type");
$typeDef['typeClass'] = 'simpleType';
$typeDef['phpType'] = 'scalar';
@@ -2173,7 +2173,7 @@
$this->ch_options = $curl_options;
}
$this->use_curl = $use_curl;
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+ preg_match('/\$Revisio/' . 'n: ([^ ]+)', $this->revision, $rev);
$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
}
@@ -2936,7 +2936,7 @@
}
}
// remove 100 headers
- if (isset($lb) && ereg('^HTTP/1.1 100',$data)) {
+ if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
unset($lb);
$data = '';
}//
@@ -3102,7 +3102,7 @@
if ($data == '') {
// have nothing left; just remove 100 header(s)
$data = $savedata;
- while (ereg('^HTTP/1.1 100',$data)) {
+ while (preg_match('/^HTTP\/1.1 100/',$data)) {
if ($pos = strpos($data,"\r\n\r\n")) {
$data = ltrim(substr($data,$pos));
} elseif($pos = strpos($data,"\n\n") ) {
@@ -3654,7 +3654,7 @@
}
$this->debug("In service, query string=$qs");
- if (ereg('wsdl', $qs) ){
+ if (preg_match('/wsdl/', $qs) ){
$this->debug("In service, this is a request for WSDL");
if($this->externalWSDLURL){
if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
@@ -3725,7 +3725,7 @@
// get the character encoding of the incoming request
if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+ if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -3754,7 +3754,7 @@
$enc = substr(strstr($v, '='), 1);
$enc = str_replace('"', '', $enc);
$enc = str_replace('\\', '', $enc);
- if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+ if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -3788,7 +3788,7 @@
$enc = substr(strstr($v, '='), 1);
$enc = str_replace('"', '', $enc);
$enc = str_replace('\\', '', $enc);
- if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -4126,7 +4126,7 @@
$payload .= $this->getDebugAsXMLComment();
}
$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+ preg_match('/\$Revision$this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
// Let the Web server decide about this
//$this->outgoing_headers[] = "Connection: Close\r\n";
@@ -4214,7 +4214,7 @@
if (strpos($headers['content-type'], '=')) {
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
$this->debug('Got response encoding: ' . $enc);
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -4781,7 +4781,7 @@
$this->currentSchema->schemaStartElement($parser, $name, $attrs);
$this->appendDebug($this->currentSchema->getDebug());
$this->currentSchema->clearDebug();
- } elseif (ereg('schema$', $name)) {
+ } elseif (preg_match('/schema$/', $name)) {
$this->debug('Parsing WSDL schema');
// $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
$this->status = 'schema';
@@ -4800,7 +4800,7 @@
if (count($attrs) > 0) {
// register namespace declarations
foreach($attrs as $k => $v) {
- if (ereg("^xmlns", $k)) {
+ if (preg_match("/^xmlns/", $k)) {
if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
$this->namespaces[$ns_prefix] = $v;
} else {
@@ -4825,7 +4825,7 @@
$attrs = array();
}
// get element prefix, namespace and name
- if (ereg(':', $name)) {
+ if (preg_match('/:/', $name)) {
// get ns prefix
$prefix = substr($name, 0, strpos($name, ':'));
// get ns
@@ -4990,7 +4990,7 @@
*/
function end_element($parser, $name){
// unset schema status
- if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
+ if (/*ereg('types$', $name) ||*/ preg_match('/schema$/', $name)) {
$this->status = "";
$this->appendDebug($this->currentSchema->getDebug());
$this->currentSchema->clearDebug();
@@ -6587,7 +6587,7 @@
$key_localpart = $this->getLocalPart($key);
// if ns declarations, add to class level array of valid namespaces
if($key_prefix == 'xmlns'){
- if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
+ if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
$this->XMLSchemaVersion = $value;
$this->namespaces['xsd'] = $this->XMLSchemaVersion;
$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
@@ -6615,7 +6615,7 @@
}
} elseif($key_localpart == 'arrayType'){
$this->message[$pos]['type'] = 'array';
- /* do arrayType ereg here
+ /* do arrayType preg here
[1] arrayTypeValue ::= atype asize
[2] atype ::= QName rank*
[3] rank ::= '[' (',')* ']'
@@ -6624,7 +6624,7 @@
[6] nextDimension ::= Digit+ ','
*/
$expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
- if(ereg($expr,$value,$regs)){
+ if(preg_match("/$expr/",$value,$regs)){
$this->message[$pos]['typePrefix'] = $regs[1];
$this->message[$pos]['arrayTypePrefix'] = $regs[1];
if (isset($this->namespaces[$regs[1]])) {
@@ -7422,7 +7422,7 @@
// detect transport
switch(true){
// http(s)
- case ereg('^http',$this->endpoint):
+ case preg_match('/^http/',$this->endpoint):
$this->debug('transporting via HTTP');
if($this->persistentConnection == true && is_object($this->persistentConnection)){
$http =& $this->persistentConnection;
@@ -7444,10 +7444,10 @@
$http->setEncoding($this->http_encoding);
}
$this->debug('sending message, length='.strlen($msg));
- if(ereg('^http:',$this->endpoint)){
+ if(preg_match('/^http:/',$this->endpoint)){
//if(strpos($this->endpoint,'http:')){
$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
- } elseif(ereg('^https',$this->endpoint)){
+ } elseif(preg_match('/^https/',$this->endpoint)){
//} elseif(strpos($this->endpoint,'https:')){
//if(phpversion() == '4.3.0-dev'){
//$response = $http->send($msg,$timeout,$response_timeout);
@@ -7506,7 +7506,7 @@
if (strpos($headers['content-type'], '=')) {
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
$this->debug('Got response encoding: ' . $enc);
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
Modified: trunk/src/www/survey/admin/show_results_csv.php
===================================================================
--- trunk/src/www/survey/admin/show_results_csv.php 2010-10-04 14:30:26 UTC (rev 10840)
+++ trunk/src/www/survey/admin/show_results_csv.php 2010-10-04 16:29:29 UTC (rev 10841)
@@ -37,7 +37,7 @@
}
function strip_commas($string) {
- return ereg_replace(",","",$string);
+ return preg_replace("/,/","",$string);
}
/*
More information about the Fusionforge-commits
mailing list