forked from science-ation/science-ation
Replacements of calls to deprecated function "explode", "ereg", and "ereg_replace" with their recommended equivalents.
This commit is contained in:
parent
8165ddd86d
commit
5c5c3e55ec
@ -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 "<tr><td $span>";
|
||||
|
||||
|
@ -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","<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>",$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","<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>",$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 "<script language=javascript>em('$b','$a')</script>";
|
||||
}
|
||||
else
|
||||
|
@ -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 "<table cellpadding=0>";
|
||||
echo "<tr><td>";
|
||||
@ -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 "<table cellpadding=0>";
|
||||
echo "<tr><td>";
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 = "<span style=\"color: red;\">*</span> ".$error_ids[$d['id']]."</font>";
|
||||
}
|
||||
list($_d,$_t)=split(" ",$d['date']);
|
||||
list($_d,$_t)=explode(" ",$d['date']);
|
||||
|
||||
echo "<tr><td>".i18n($d['description'])."</td>";
|
||||
echo "<td><input size=\"10\" class=\"date\" type=\"text\" name=\"savedates[{$d['id']}]\" value=\"{$_d}\" />";
|
||||
|
@ -228,7 +228,7 @@ function config_editor($category, $year, $array_name, $self)
|
||||
print("</select>");
|
||||
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 */
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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."'");
|
||||
|
@ -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']}'
|
||||
|
@ -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 "<table width=\"10\" cellspacing=0 cellpadding=0>";
|
||||
echo "<tr>";
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
|
@ -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'");
|
||||
|
@ -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\'',),
|
||||
|
||||
);
|
||||
|
@ -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 "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
||||
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 "<br />\n";
|
||||
@ -283,7 +283,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
list($d,$t)=split(" ",$config['dates']['postwinners']);
|
||||
list($d,$t)=explode(" ",$config['dates']['postwinners']);
|
||||
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
||||
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)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user