From 5c5c3e55ec62312ebd8c653f0783c9a3a1a13a6b Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 9 Feb 2012 17:52:17 +0000 Subject: [PATCH] Replacements of calls to deprecated function "explode", "ereg", and "ereg_replace" with their recommended equivalents. --- admin/user_list.php | 2 +- committees.php | 6 +++--- common.inc.php | 6 +++--- config/dates.php | 8 ++++---- config_editor.inc.php | 4 ++-- confirmed_participants.php | 2 +- contact.php | 4 ++-- fair_additional_materials.inc.php | 2 +- fair_stats.php | 2 +- register_participants_isefforms.php | 4 ++-- remote.php | 2 +- tableeditor.class.php | 12 ++++++------ user.inc.php | 4 ++-- user_new.php | 2 +- user_personal.php | 10 +++++----- winners.php | 4 ++-- 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/admin/user_list.php b/admin/user_list.php index 7fb2cff..2339e93 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -241,7 +241,7 @@ function neweditor() if(judge_status_update($u)=="complete") $r['judge_complete']='yes'; } - $types = split(',', $r['types']); + $types = explode(',', $r['types']); $span = count($types) > 1 ? "rowspan=\"".count($types)."\"" : ''; echo ""; diff --git a/committees.php b/committees.php index 560a2e8..39994f3 100644 --- a/committees.php +++ b/committees.php @@ -57,13 +57,13 @@ //make sure we do emailprivate before email so we dont match the wrong thing if($u['emailprivate'] && $u['displayemail']=='yes') { - list($b,$a)=split("@",$u['emailprivate']); + list($b,$a)=explode("@",$u['emailprivate']); $output=str_replace("emailprivate","",$output); } else $output=str_replace("emailprivate","",$output); if($u['email'] && $u['displayemail']=='yes') { - list($b,$a)=split("@",$u['email']); + list($b,$a)=explode("@",$u['email']); $output=str_replace("email","",$output); } else $output=str_replace("email","",$output); @@ -86,7 +86,7 @@ if($r2->email) { echo "     "; - list($b,$a)=split("@",$r2->email); + list($b,$a)=explode("@",$r2->email); echo ""; } else diff --git a/common.inc.php b/common.inc.php index 3c2e62e..7d7a533 100644 --- a/common.inc.php +++ b/common.inc.php @@ -799,7 +799,7 @@ function emit_date_selector($name,$selected="") { if($selected) { - list($year,$month,$day)=split("-",$selected); + list($year,$month,$day)=explode("-",$selected); } echo ""; echo "
"; @@ -851,7 +851,7 @@ function emit_time_selector($name,$selected="") if($selected) { - list($hour,$minute,$second)=split(":",$selected); + list($hour,$minute,$second)=explode(":",$selected); } echo ""; echo ""; echo "
"; @@ -1259,7 +1259,7 @@ function format_datetime($dt) { return format_date($dt)." ".i18n("at")." ".format_time($dt); } else { - list($d,$t)=split(" ",$dt); + list($d,$t)=explode(" ",$dt); return format_date($d)." ".i18n("at")." ".format_time($t); } } diff --git a/config/dates.php b/config/dates.php index 78ffd19..6934205 100644 --- a/config/dates.php +++ b/config/dates.php @@ -86,7 +86,7 @@ $dates = array('fairdate' => array() , $v = $r->date; /* See if $v is something resembling a valid date */ - if(!ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $v, $d)) { + if(!preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $v, $d)) { $error_ids[$r->id] = i18n("Invalid date format"); } else if($d[3]==0 || $d[2]==0 || $d[1]==0) { $error_ids[$r->id] = i18n("Invalid date"); @@ -101,8 +101,8 @@ function chkafter($d1, $d2) $id2 = $dates[$d2]['id']; /* Parse both dates 1, 2, 3, 4, 5, 6 */ - ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})",$dates[$d1]['date'], $p1); - ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})",$dates[$d2]['date'], $p2); + preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/",$dates[$d1]['date'], $p1); + preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/",$dates[$d2]['date'], $p2); // int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] ) $u1 = mktime($p1[4], $p1[5], $p1[6], $p1[2], $p1[3], $p1[1]); @@ -138,7 +138,7 @@ foreach($dates as $dn=>$d) { if($error_ids[$d['id']]) { $e = "* ".$error_ids[$d['id']].""; } - list($_d,$_t)=split(" ",$d['date']); + list($_d,$_t)=explode(" ",$d['date']); echo "
".i18n($d['description']).""; diff --git a/config_editor.inc.php b/config_editor.inc.php index b10e7ee..e6a3058 100644 --- a/config_editor.inc.php +++ b/config_editor.inc.php @@ -228,7 +228,7 @@ function config_editor($category, $year, $array_name, $self) print(""); break; case "enum": - $val = split(',', $val); + $val = explode(',', $val); $values = $var[$k]['type_values']; /* Split values */ /* The PERL regex here matches any string of the form @@ -268,7 +268,7 @@ function config_editor($category, $year, $array_name, $self) break; case 'multisel': /* same PERL parse statements as above */ - $val = split(',', $val); + $val = explode(',', $val); $values = $var[$k]['type_values']; preg_match_all("/([^\|=]+)(?:=([^\|]+))?\|?/", $values, $regs); /* Decide which way to show this list */ diff --git a/confirmed_participants.php b/confirmed_participants.php index 80b0c18..5909a26 100644 --- a/confirmed_participants.php +++ b/confirmed_participants.php @@ -31,7 +31,7 @@ $r=mysql_fetch_object($q); if($r->test!=1) { - list($d,$t)=split(" ",$config['dates']['postparticipants']); + list($d,$t)=explode(" ",$config['dates']['postparticipants']); echo i18n("Confirmed participants (that signature forms have been received for) will be posted here on %1 at %2. Please do not contact the fair to inquire about receipt of your signature form until after this date (and only if you are not listed here after this date).",array($d,$t)); } else diff --git a/contact.php b/contact.php index 68663fb..3fbdfef 100644 --- a/contact.php +++ b/contact.php @@ -26,14 +26,14 @@ function cleanify($in) { $in=ereg_replace("\r","\n",$in); - $lines=split("\n",$in); + $lines=explode("\n",$in); return trim($lines[0]); } if($_POST['action']=="send") { if($_POST['to'] && $_POST['subject'] && $_POST['message'] && $_POST['from'] && $_POST['fromemail']) { if(isEmailAddress($_POST['fromemail'])) { - list($id,$md5email)=split(":",$_POST['to']); + list($id,$md5email)=explode(":",$_POST['to']); $q=mysql_query("SELECT * FROM users WHERE uid='$id' ORDER BY year DESC LIMIT 1"); $r=mysql_fetch_object($q); //if a valid selection is made from the list, then this will always match. diff --git a/fair_additional_materials.inc.php b/fair_additional_materials.inc.php index 5b3fa74..5c21631 100644 --- a/fair_additional_materials.inc.php +++ b/fair_additional_materials.inc.php @@ -90,7 +90,7 @@ function fair_additional_materials($fair, $award, $year) $rep->nextLine(); $rep->addTextX("Grade: _____________ Date of birth: _____________", $x); $rep->addTextX("{$s['grade']}", $x+0.75); - list($y,$m,$d) = split('-',$s['dateofbirth']); + list($y,$m,$d) = explode('-',$s['dateofbirth']); $dob = date('M j, Y', mktime(0,0,0,$m,$d,$y)); $rep->addTextX("$dob", $x+3); $rep->nextLine(); diff --git a/fair_stats.php b/fair_stats.php index 3971390..425e2ac 100644 --- a/fair_stats.php +++ b/fair_stats.php @@ -112,7 +112,7 @@ $q = mysql_query("SELECT * FROM fairs WHERE id='{$u['fairs_id']}'"); echo mysql_error(); $fair = mysql_fetch_assoc($q); -$s = split(',', $fair['gather_stats']); +$s = explode(',', $fair['gather_stats']); foreach($s as $k) { if(trim($k) == '') continue; $server_config[$k] = true; diff --git a/register_participants_isefforms.php b/register_participants_isefforms.php index de721ba..1133f81 100644 --- a/register_participants_isefforms.php +++ b/register_participants_isefforms.php @@ -120,7 +120,7 @@ echo mysql_error(); move_uploaded_file($_FILES['form']['tmp_name'][$k],$TCFORMSLOCATION."/".$CURRENT_FAIRYEAR."/$r->id/$k.pdf"); $pdfinfo=exec("pdfinfo ".$TCFORMSLOCATION."/".$CURRENT_FAIRYEAR."/$r->id/$k.pdf |grep \"Pages\""); - list($pgtext,$pgs)=split(":",$pdfinfo); + list($pgtext,$pgs)=explode(":",$pdfinfo); $pgs=trim($pgs); if($pgs) $p="'$pgs'"; else $p="null"; @@ -160,7 +160,7 @@ echo mysql_error(); //now figur out some other info about the PDF $pdfinfo=exec("pdfinfo ".$TCFORMSLOCATION."/".$CURRENT_FAIRYEAR."/$r->id.pdf |grep \"Pages\""); - list($pgtext,$pgs)=split(":",$pdfinfo); + list($pgtext,$pgs)=explode(":",$pdfinfo); $pgs=trim($pgs); if($pgs) $pgquery=", ReportPages='$pgs'"; mysql_query("UPDATE TC_Projects SET ReportFile='".$r->id.".pdf' $pgquery WHERE id='".$r->id."'"); diff --git a/remote.php b/remote.php index 8463183..db64143 100644 --- a/remote.php +++ b/remote.php @@ -34,7 +34,7 @@ function handle_getstats(&$u, $fair,&$data, &$response) $year = $data['getstats']['year']; /* Send back the stats we'd like to collect */ - $response['statconfig'] = split(',', $fair['gather_stats']); + $response['statconfig'] = explode(',', $fair['gather_stats']); /* Send back the stats we currently have */ $q = mysql_query("SELECT * FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}' diff --git a/tableeditor.class.php b/tableeditor.class.php index e7157e3..a872831 100644 --- a/tableeditor.class.php +++ b/tableeditor.class.php @@ -426,7 +426,7 @@ class TableEditor //so rip out the options right now and add them $inputtype="select"; $enums=substr(ereg_replace("'","",$r->Type),5,-1); - $toks=split(",",$enums); + $toks=explode(",",$enums); foreach($toks as $tok) { $this->fieldOptions[$f][]=$tok; @@ -863,7 +863,7 @@ class TableEditor case "date": case "datetime": - $a = split('[- :]',$editdata[$f]); + $a = preg_split('/[- :]/',$editdata[$f]); if($inputtype == 'date') { list($yy,$mm,$dd)=$a; $w = 10; @@ -891,7 +891,7 @@ class TableEditor case "time": if($inputtype == 'time') { - list($hh,$mi,$ss)=split(":",$editdata[$f]); + list($hh,$mi,$ss)=explode(":",$editdata[$f]); echo ""; echo ""; @@ -1382,7 +1382,7 @@ class TableEditor function format_date($d) { if(!$d) return; - list($y,$m,$d)=split("-",$d); + list($y,$m,$d)=explode("-",$d); $t=mktime(0,0,0,$m,$d,$y); return date($this->dateformat,$t); } @@ -1392,7 +1392,7 @@ class TableEditor if(!$t) return; if($this->timeformat=="12hrs") { - list($hh,$mm,$ss)=split(":",$t); + list($hh,$mm,$ss)=explode(":",$t); //hack to get rid of leading "0" and turn it into a number $hh++; $hh--; @@ -1414,7 +1414,7 @@ class TableEditor } function format_datetime($d) { - list($d,$t)=split(' ', $d); + list($d,$t)=explode(' ', $d); $ret = $this->format_date($d).' '.$this->format_time($t); return $ret; } diff --git a/user.inc.php b/user.inc.php index 7ee86eb..bb2ecf3 100644 --- a/user.inc.php +++ b/user.inc.php @@ -907,7 +907,7 @@ function user_personal_fields($type) $ret = array('firstname','lastname','email'); $fields = $config["{$type}_personal_fields"]; if($fields != '') { - $fields = split(',', $fields); + $fields = explode(',', $fields); foreach($fields as $f) { $ret = array_merge($ret, $user_personal_fields_map[$f]); } @@ -921,7 +921,7 @@ function user_personal_required_fields($type) $ret = array('firstname','lastname','email'); $required = $config["{$type}_personal_required"]; if($required != '') { - $fields = split(',', $required); + $fields = explode(',', $required); foreach($fields as $f) { $ret = array_merge($ret, $user_personal_fields_map[$f]); } diff --git a/user_new.php b/user_new.php index c5ccec2..d829e72 100644 --- a/user_new.php +++ b/user_new.php @@ -124,7 +124,7 @@ if(mysql_num_rows($q) > 0) { /* It already exists, make sure they're not already in this role */ $r = mysql_fetch_object($q); - $types = split(',', $r->types); + $types = explode(',', $r->types); if($r->year==$config['FAIRYEAR'] && $r->deleted=='yes') { mysql_query("UPDATE users SET deleted='no' WHERE id='$r->id'"); diff --git a/user_personal.php b/user_personal.php index 8019918..71035fd 100644 --- a/user_personal.php +++ b/user_personal.php @@ -52,19 +52,19 @@ 'cpr' => array ('name' => 'CPR Training', 'type' => 'yesno'), 'phonehome' => array('name' => 'Phone (Home)', - 'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$', + 'regexp' => '/^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$/', 'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',), 'phonecell' => array('name' => 'Phone (Cell)', - 'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$', + 'regexp' => '/^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$/', 'format' => '\'NNN-NNN-NNNN\'',), 'phonework' => array('name' => 'Phone (Work)', - 'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$', + 'regexp' => '/^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$/', 'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',), 'fax' => array('name' => 'Fax', - 'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$', + 'regexp' => '/^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$/', 'format' => '\'NNN-NNN-NNNN\'',), 'postalcode' => array('name' => $config['postalzip'], - 'regexp' => '^(([A-Za-z][0-9][A-Za-z]( )?[0-9][A-Za-z][0-9])|([0-9]{5}))$', + 'regexp' => '/^(([A-Za-z][0-9][A-Za-z]( )?[0-9][A-Za-z][0-9])|([0-9]{5}))$/', 'format' => '\'ANA NAN\' or \'ANANAN\' or \'NNNNN\'',), ); diff --git a/winners.php b/winners.php index 2902650..a5f5750 100644 --- a/winners.php +++ b/winners.php @@ -246,7 +246,7 @@ else { if($first && $r->year != $config['FAIRYEAR']) { - list($d,$t)=split(" ",$config['dates']['postwinners']); + list($d,$t)=explode(" ",$config['dates']['postwinners']); echo "

".i18n("%1 Winners",array($config['FAIRYEAR']))."

"; echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t))); echo "
\n"; @@ -283,7 +283,7 @@ else } else { - list($d,$t)=split(" ",$config['dates']['postwinners']); + list($d,$t)=explode(" ",$config['dates']['postwinners']); echo "

".i18n("%1 Winners",array($config['FAIRYEAR']))."

"; echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t))); }