From 335d3c5c9c0b24ff5e07cd1968236a8dbc4f2c70 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 20 Feb 2017 18:12:46 +0100 Subject: PHP 7 compatibility from Sourceforge #680 --- functions/admin_functions.php | 4 ++-- functions/calendar_functions.php | 2 +- functions/date_functions.php | 16 ++++++++-------- functions/ical_parser.php | 20 ++++++++++---------- functions/init.inc.php | 2 +- functions/list_functions.php | 4 ++-- functions/parse/end_vevent.php | 20 ++++++++++---------- functions/parse/parse_tzs.php | 6 +++--- functions/parse/recur_functions.php | 4 ++-- functions/template.php | 10 +++++----- includes/event.php | 4 ++-- includes/todo.php | 4 ++-- lib/HTTP/WebDAV/Server.php | 4 ++-- lib/bennu/iCalendar_rfc2445.php | 6 +++--- search.php | 6 +++--- week.php | 2 +- year.php | 4 ++-- 17 files changed, 59 insertions(+), 59 deletions(-) diff --git a/functions/admin_functions.php b/functions/admin_functions.php index d62c077..d3ba2d5 100644 --- a/functions/admin_functions.php +++ b/functions/admin_functions.php @@ -119,7 +119,7 @@ function delete_cal ($filename) { $delete = unlink($filename); clearstatcache(); if (@file_exists($filename)) { - $filesys = eregi_replace("/","\\", $filename); + $filesys = preg_match("/\//","\\", $filename); $delete = system("rm -f $filesys"); clearstatcache(); if (@file_exists($filename)) { @@ -230,7 +230,7 @@ function is_uploaded_file_v4 ($filename) { $filename = str_replace ("\\", "/", $filename); $tmp_file = str_replace ("\\", "/", $tmp_file); // User might have trailing slash in php.ini... - return (ereg_replace('/+', '/', $tmp_file) == $filename); + return (preg_replace('/\/+/', '/', $tmp_file) == $filename); } // return the appropriate error message if the file upload had an error diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index d5586f0..4a05759 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -226,7 +226,7 @@ function display_ical_list($cals, $pick=FALSE) { while (!feof($ifile)) { $line = fgets($ifile, 1024); $line = trim($line); - if (ereg ("([^:]+):(.*)", $line, $regs)){ + if (preg_match ("/([^:]+):(.*)/", $line, $regs)){ $field = $regs[1]; $data = $regs[2]; $property = $field; diff --git a/functions/date_functions.php b/functions/date_functions.php index 22a37ca..2efb993 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -161,8 +161,8 @@ function dayCompare($now, $then) { // function to compare to dates in Ymd and return the number of months // that differ between them. function monthCompare($now, $then) { - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now); - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then); + preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $now, $date_now); + preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $then, $date_then); $diff_years = $date_now[1] - $date_then[1]; $diff_months = $date_now[2] - $date_then[2]; if ($date_now[2] < $date_then[2]) { @@ -175,8 +175,8 @@ function monthCompare($now, $then) { } function yearCompare($now, $then) { - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now); - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then); + preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $now, $date_now); + preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $then, $date_then); $diff_years = $date_now[1] - $date_then[1]; return $diff_years; } @@ -306,7 +306,7 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin # build tooltip $title = makeTitle($arr, $time); # for iCal pseudo tag comptability - if (ereg('<([[:alpha:]]+://)([^<>[:space:]]+)>',$event_text,$matches)) { + if (preg_match('#([[:alpha:]]+://)([^<>[:space:]]+)>#',$event_text,$matches)) { $full_event_text = $matches[1] . $matches[2]; $event_text = $matches[2]; } else { @@ -322,7 +322,7 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin $event_text = word_wrap($event_text, $length, $lines); } - if ((!(ereg('([[:alpha:]]+://[^<>[:space:]]+)', $full_event_text, $res))) || ($arr['description'])) { + if ((!(preg_match('#([[:alpha:]]+://[^<>[:space:]]+)#', $full_event_text, $res))) || ($arr['description'])) { $escaped_date = addslashes($event_date); $escaped_time = addslashes($time); $escaped_uid = addslashes($uid); @@ -370,9 +370,9 @@ function extractDateTime($data, $property, $field) { } // Extract date-only values. - if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) { + if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (preg_match ('/^([0-9]{4})([0-9]{2})([0-9]{2})$/', $data))) { // Pull out the date value. Minimum year is 1970. - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dt_check); + preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})/', $data, $dt_check); if ($dt_check[1] < 1970) { $dt_check[1] = '1970'; } diff --git a/functions/ical_parser.php b/functions/ical_parser.php index a2ce1d3..5549a34 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -131,12 +131,12 @@ foreach ($cal_filelist as $cal_key=>$filename) { while (!feof($ifile)) { $line = $nextline; $nextline = fgets($ifile, 1024); - $nextline = ereg_replace("[\r\n]", '', $nextline); + $nextline = preg_replace("/[\r\n]/", '', $nextline); #handle continuation lines that start with either a space or a tab (MS Outlook) while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) { $line = $line . substr($nextline, 1); $nextline = fgets($ifile, 1024); - $nextline = ereg_replace("[\r\n]", '', $nextline); + $nextline = preg_replace("/[\r\n]/", '', $nextline); } $line = str_replace('\n', "\n", $line); $line = str_replace('\t', "\t", $line); @@ -261,7 +261,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { default: unset ($field, $data, $prop_pos, $property); - if (ereg ("([^:]+):(.*)", $line, $line)){ + if (preg_match ("/([^:]+):(.*)/", $line, $line)){ $field = $line[1]; $data = $line[2]; $property = strtoupper($field); @@ -327,7 +327,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { break; case 'EXDATE': - $data = split(',', $data); + $data = explode(',', $data); foreach ($data as $exdata) { $exdata = str_replace('T', '', $exdata); $exdata = str_replace('Z', '', $exdata); @@ -367,7 +367,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { case 'RECURRENCE-ID': $parts = explode(';', $field); foreach($parts as $part) { - $eachval = split('=',$part); + $eachval = explode('=',$part); if ($eachval[0] == 'RECURRENCE-ID') { // do nothing } elseif ($eachval[0] == 'TZID') { @@ -384,11 +384,11 @@ foreach ($cal_filelist as $cal_key=>$filename) { $data = str_replace('T', '', $data); $data = str_replace('Z', '', $data); - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs); + preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs); $recurrence_id['date'] = $regs[1] . $regs[2] . $regs[3]; $recurrence_id['time'] = $regs[4] . $regs[5]; - $recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); + $recur_unixtime = mktime(intval($regs[4]), intval($regs[5]), 0, intval($regs[2]), intval($regs[3]), intval($regs[1])); if (isset($recurrence_id['tzid'])) { $offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']); @@ -422,7 +422,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { break; case 'DURATION': if (($first_duration == TRUE) && (!stristr($field, '=DURATION'))) { - ereg ('^P([0-9]{1,2}[W])?([0-9]{1,3}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration); + preg_match ('/^P([0-9]{1,2}[W])?([0-9]{1,3}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?/', $data, $duration); $weeks = str_replace('W', '', $duration[1]); $days = str_replace('D', '', $duration[2]); $hours = str_replace('H', '', $duration[4]); @@ -434,9 +434,9 @@ foreach ($cal_filelist as $cal_key=>$filename) { break; case 'RRULE': $data = str_replace ('RRULE:', '', $data); - $rrule = split (';', $data); + $rrule = explode (';', $data); foreach ($rrule as $recur) { - ereg ('(.*)=(.*)', $recur, $regs); + preg_match ('/(.*)=(.*)/', $recur, $regs); $rrule_array[$regs[1]] = $regs[2]; } break; diff --git a/functions/init.inc.php b/functions/init.inc.php index 3ac162b..56e13df 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -149,7 +149,7 @@ if (count($local_cals) > 0) { $subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename; $download_filename = $filename; } elseif ($phpiCal_config->download_uri != '') { - $newurl = eregi_replace("^(http://)", "", $phpiCal_config->download_uri); + $newurl = preg_replace("#^(http://)#i", "", $phpiCal_config->download_uri); $subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename); $download_filename = $phpiCal_config->download_uri.'/'.$add_cpath.basename($filename); } else { diff --git a/functions/list_functions.php b/functions/list_functions.php index fb97354..a7a1f59 100644 --- a/functions/list_functions.php +++ b/functions/list_functions.php @@ -2,7 +2,7 @@ function list_jumps() { global $phpiCal_config, $lang, $cal; - $calName = join(',', array_map("getCalendarName", split(',', $cal))); + $calName = join(',', array_map("getCalendarName", explode(',', $cal))); $today = date('Ymd', time() + $phpiCal_config->second_offset); $return = ''; $return .= ''; @@ -77,7 +77,7 @@ function list_years() { function list_weeks() { global $getdate, $this_year, $cal, $dateFormat_week_jump, $phpiCal_config; - ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); + preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 7def602..a44fca0 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -124,7 +124,7 @@ foreach ($rrule_array as $key => $val) { case 'UNTIL': # UNTIL must be in UTC $until = date("YmdHis",strtotime($val)); - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs); + preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $until, $regs); $until_unixtime = mktime($regs[4],@$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until); break; @@ -135,39 +135,39 @@ foreach ($rrule_array as $key => $val) { } break; case 'BYSECOND': - $bysecond = split (',', $val); + $bysecond = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond; break; case 'BYMINUTE': - $byminute = split (',', $val); + $byminute = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute; break; case 'BYHOUR': - $byhour = split (',', $val); + $byhour = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour; break; case 'BYDAY': - $byday = split (',', $val); + $byday = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday; break; case 'BYMONTHDAY': - $bymonthday = split (',', $val); + $bymonthday = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday; break; case 'BYYEARDAY': - $byyearday = split (',', $val); + $byyearday = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday; break; case 'BYWEEKNO': - $byweekno = split (',', $val); + $byweekno = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno; break; case 'BYMONTH': - $bymonth = split (',', $val); + $bymonth = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth; break; case 'BYSETPOS': - $bysetpos = split (',', $val); + $bysetpos = explode (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos; break; case 'WKST': diff --git a/functions/parse/parse_tzs.php b/functions/parse/parse_tzs.php index 2e10834..348fe7e 100644 --- a/functions/parse/parse_tzs.php +++ b/functions/parse/parse_tzs.php @@ -12,12 +12,12 @@ $is_std = false; while (!feof($ifile)) { $line = $nextline; $nextline = fgets($ifile, 1024); - $nextline = ereg_replace("[\r\n]", '', $nextline); + $nextline = preg_replace("/[\r\n]/", '', $nextline); #handle continuation lines that start with either a space or a tab (MS Outlook) while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) { $line = $line . substr($nextline, 1); $nextline = fgets($ifile, 1024); - $nextline = ereg_replace("[\r\n]", '', $nextline); + $nextline = preg_replace("/[\r\n]/", '', $nextline); } $line = trim($line); switch ($line) { @@ -56,7 +56,7 @@ while (!feof($ifile)) { break; default: unset ($field, $data, $prop_pos, $property); - if (ereg ('([^:]+):(.*)', $line, $line)){ + if (preg_match ('/([^:]+):(.*)/', $line, $line)){ $field = $line[1]; $data = $line[2]; $property = strtoupper($field); diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php index 82e9568..8bce9fe 100644 --- a/functions/parse/recur_functions.php +++ b/functions/parse/recur_functions.php @@ -138,7 +138,7 @@ function expand_byday($time) { [2] => 4 number [3] => TH day abbr */ - ereg ('([-\+]{0,1})?([0-9]+)?([A-Z]{2})', $day, $byday_arr); + preg_match ('/([-\+]{0,1})?([0-9]+)?([A-Z]{2})/', $day, $byday_arr); $on_day = two2threeCharDays($byday_arr[3]); switch ($freq_type) { case 'week': @@ -254,7 +254,7 @@ function restrict_byday($times, $freq = '') { [2] => 4 number [3] => TH day abbr */ - ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); + preg_match ('/([-\+]{0,1})?([0-9]{1})?([A-Z]{2})/', $day, $byday_arr); $byday3[] = two2threeCharDays($byday_arr[3]); } $new_times = array(); diff --git a/functions/template.php b/functions/template.php index 17994da..c37ba56 100644 --- a/functions/template.php +++ b/functions/template.php @@ -93,8 +93,8 @@ class Page { $location = sanitizeForWeb(stripslashes(urldecode($new_val2['location']))); $description = sanitizeForWeb(stripslashes(urldecode($new_val2['description']))); if (!empty($description)) { - $description = ereg_replace('(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&)+[[:alnum:]/])', '\2', $description); - $description = ereg_replace('(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})', '\3', $description); + $description = preg_replace('(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&)+[[:alnum:]/])', '\2', $description); + $description = preg_replace('(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})', '\3', $description); } $event_start = $new_val2['event_start']; @@ -395,7 +395,7 @@ class Page { $key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year); $key = date ($timeFormat, $key); - if (ereg('([0-9]{1,2}):00', $key)) { + if (preg_match('/([0-9]{1,2}):00/', $key)) { $even_row = '2'; # column of times colspan = 4 to cover navigation links at top $weekdisplay .= ''; @@ -408,7 +408,7 @@ class Page { $weekdisplay .= ''; } else { $even_row = ''; - if (ereg('([0-9]{1,2}):30', $key)) $even_row = '3'; + if (preg_match('/([0-9]{1,2}):30/', $key)) $even_row = '3'; # empty row for each gridLength, to the right of times and left of first weekday $weekdisplay .= ''; $weekdisplay .= ''; @@ -1142,7 +1142,7 @@ HEREDOC; } - function Page($file = 'std.tpl') { + function __construct($file = 'std.tpl') { global $phpiCal_config; if (!file_exists($file)){ #look for it in default if not found diff --git a/includes/event.php b/includes/event.php index 8b98c26..c5b2924 100644 --- a/includes/event.php +++ b/includes/event.php @@ -31,8 +31,8 @@ $event['event_text'] = sanitizeForWeb(urldecode($event['event_text'])); $event['description'] = sanitizeForWeb(urldecode($event['description'])); $event['location'] = sanitizeForWeb(urldecode($event['location'])); if (isset($event['description'])) { - $event['description'] = ereg_replace("(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&)+[[:alnum:]/])", '\2', $event['description']); - $event['description'] = ereg_replace("(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})", '\3', $event['description']); + $event['description'] = preg_replace("#(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&)+[[:alnum:]/])#", '\2', $event['description']); + $event['description'] = preg_replace("#(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})#", '\3', $event['description']); } if (isset($organizer) && is_array($organizer)) { diff --git a/includes/todo.php b/includes/todo.php index 1cefcdc..90514aa 100644 --- a/includes/todo.php +++ b/includes/todo.php @@ -18,8 +18,8 @@ $due_date = (isset($vtodo_array['due_date'])) ? localizeDate ($dateFormat_day, $priority = (isset($vtodo_array['priority'])) ? $vtodo_array['priority'] : (''); $cal_title_full = $calendar_name.' '.$lang['l_calendar']; -$description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '\0', $description); -$vtodo_text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'\0',$vtodo_text); +$description = preg_replace("#[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]#", '\0', $description); +$vtodo_text = preg_replace("#[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]#",'\0',$vtodo_text); if ((!isset($status) || $status == "COMPLETED") && isset($completed_date)) { diff --git a/lib/HTTP/WebDAV/Server.php b/lib/HTTP/WebDAV/Server.php index 2d5785d..489d313 100644 --- a/lib/HTTP/WebDAV/Server.php +++ b/lib/HTTP/WebDAV/Server.php @@ -920,7 +920,7 @@ class HTTP_WebDAV_Server if (isset($_SERVER['HTTP_RANGE'])) { // we only support standard 'bytes' range specifications for now - if (ereg('bytes[[:space:]]*=[[:space:]]*(.+)', $_SERVER['HTTP_RANGE'], $matches)) { + if (preg_match('@bytes[[:space:]]*=[[:space:]]*(.+)@', $_SERVER['HTTP_RANGE'], $matches)) { $options['ranges'] = array(); // ranges are comma separated @@ -2180,7 +2180,7 @@ class HTTP_WebDAV_Server // but if opaquelocktokens are used (RFC2518 6.4) // we have to check the format (litmus tests this) if (!strncmp($condition, '$', $condition)) { + if (!preg_match('/^$/', $condition)) { return; } } diff --git a/lib/bennu/iCalendar_rfc2445.php b/lib/bennu/iCalendar_rfc2445.php index e73d863..d6d3ace 100644 --- a/lib/bennu/iCalendar_rfc2445.php +++ b/lib/bennu/iCalendar_rfc2445.php @@ -124,13 +124,13 @@ function rfc2445_is_valid_value($value, $type) { } if($scheme === 'mailto') { - $regexp = '^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$'; + $regexp = '#^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$#'; } else { - $regexp = '^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$'; + $regexp = '#^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$#'; } - return ereg($regexp, $remain); + return preg_match($regexp, $remain); break; case RFC2445_TYPE_BINARY: diff --git a/search.php b/search.php index 8e1f66f..6c1846e 100644 --- a/search.php +++ b/search.php @@ -104,7 +104,7 @@ function format_search($search_str) { $search_str = trim($search_str); $search_str = str_replace(' and ', ' ', $search_str); $search_str = str_replace(' - ', ' ', $search_str); - $search_str = ereg_replace('[[:space:]]+',' ', $search_str); + $search_str = preg_replace('[[:space:]]+',' ', $search_str); $search_str = str_replace(' not ', ' -', $search_str); // start out with an AND array of all the items @@ -260,7 +260,7 @@ function format_recur($arr) { if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') unset($arr['BYMONTHDAY'][$last]); $last = count($arr['BYMONTHDAY']) - 1; foreach ($arr['BYMONTHDAY'] as $key => $day) { - ereg('(-{0,1})([0-9]{1,2})',$day,$regs); + preg_match('/(-{0,1})([0-9]{1,2})/',$day,$regs); list($junk,$sign,$day) = $regs; if ($sign != '') $list .= $sign; if ($key == $last) $list .= $day; @@ -274,7 +274,7 @@ function format_recur($arr) { $list = ''; $last = count($arr['BYDAY']) - 1; foreach ($arr['BYDAY'] as $key => $day) { - ereg('([-\+]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs); + preg_match('/([-\+]{0,1})([0-9]{0,1})([A-Z]{2})/',$day,$regs); list($junk,$sign,$day_num,$day_txt) = $regs; $num = two2threeCharDays($day_txt,false); if ($sign != '') $list .= $sign; diff --git a/week.php b/week.php index 3ad2412..40532ef 100644 --- a/week.php +++ b/week.php @@ -31,7 +31,7 @@ $display_date = "$start_week - $end_week"; $sidebar_date = localizeDate($dateFormat_week_list, $unix_time); // For the side months -ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); +preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; diff --git a/year.php b/year.php index fc93feb..bc56b01 100644 --- a/year.php +++ b/year.php @@ -5,7 +5,7 @@ require_once(BASE.'functions/ical_parser.php'); require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); -ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); +preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; @@ -17,7 +17,7 @@ $prev_year = date ("Ymd", $prev_year); $sidebar_date = localizeDate($dateFormat_week_list, strtotime($getdate)); // For the side months -ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); +preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; -- cgit v1.2.3