Skip to content

Commit 335d3c5

Browse files
Daniel LangeDaniel Lange
Daniel Lange
authored and
Daniel Lange
committed
PHP 7 compatibility from Sourceforge #680
1 parent 7a4da3f commit 335d3c5

17 files changed

+59
-59
lines changed

functions/admin_functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function delete_cal ($filename) {
119119
$delete = unlink($filename);
120120
clearstatcache();
121121
if (@file_exists($filename)) {
122-
$filesys = eregi_replace("/","\\", $filename);
122+
$filesys = preg_match("/\//","\\", $filename);
123123
$delete = system("rm -f $filesys");
124124
clearstatcache();
125125
if (@file_exists($filename)) {
@@ -230,7 +230,7 @@ function is_uploaded_file_v4 ($filename) {
230230
$filename = str_replace ("\\", "/", $filename);
231231
$tmp_file = str_replace ("\\", "/", $tmp_file);
232232
// User might have trailing slash in php.ini...
233-
return (ereg_replace('/+', '/', $tmp_file) == $filename);
233+
return (preg_replace('/\/+/', '/', $tmp_file) == $filename);
234234
}
235235

236236
// return the appropriate error message if the file upload had an error

functions/calendar_functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function display_ical_list($cals, $pick=FALSE) {
226226
while (!feof($ifile)) {
227227
$line = fgets($ifile, 1024);
228228
$line = trim($line);
229-
if (ereg ("([^:]+):(.*)", $line, $regs)){
229+
if (preg_match ("/([^:]+):(.*)/", $line, $regs)){
230230
$field = $regs[1];
231231
$data = $regs[2];
232232
$property = $field;

functions/date_functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ function dayCompare($now, $then) {
161161
// function to compare to dates in Ymd and return the number of months
162162
// that differ between them.
163163
function monthCompare($now, $then) {
164-
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
165-
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
164+
preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $now, $date_now);
165+
preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $then, $date_then);
166166
$diff_years = $date_now[1] - $date_then[1];
167167
$diff_months = $date_now[2] - $date_then[2];
168168
if ($date_now[2] < $date_then[2]) {
@@ -175,8 +175,8 @@ function monthCompare($now, $then) {
175175
}
176176

177177
function yearCompare($now, $then) {
178-
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
179-
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
178+
preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $now, $date_now);
179+
preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $then, $date_then);
180180
$diff_years = $date_now[1] - $date_then[1];
181181
return $diff_years;
182182
}
@@ -306,7 +306,7 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin
306306
# build tooltip
307307
$title = makeTitle($arr, $time);
308308
# for iCal pseudo tag <http> comptability
309-
if (ereg('<([[:alpha:]]+://)([^<>[:space:]]+)>',$event_text,$matches)) {
309+
if (preg_match('#([[:alpha:]]+://)([^<>[:space:]]+)>#',$event_text,$matches)) {
310310
$full_event_text = $matches[1] . $matches[2];
311311
$event_text = $matches[2];
312312
} else {
@@ -322,7 +322,7 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin
322322
$event_text = word_wrap($event_text, $length, $lines);
323323
}
324324

325-
if ((!(ereg('([[:alpha:]]+://[^<>[:space:]]+)', $full_event_text, $res))) || ($arr['description'])) {
325+
if ((!(preg_match('#([[:alpha:]]+://[^<>[:space:]]+)#', $full_event_text, $res))) || ($arr['description'])) {
326326
$escaped_date = addslashes($event_date);
327327
$escaped_time = addslashes($time);
328328
$escaped_uid = addslashes($uid);
@@ -370,9 +370,9 @@ function extractDateTime($data, $property, $field) {
370370
}
371371

372372
// Extract date-only values.
373-
if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) {
373+
if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (preg_match ('/^([0-9]{4})([0-9]{2})([0-9]{2})$/', $data))) {
374374
// Pull out the date value. Minimum year is 1970.
375-
ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dt_check);
375+
preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})/', $data, $dt_check);
376376
if ($dt_check[1] < 1970) {
377377
$dt_check[1] = '1970';
378378
}

functions/ical_parser.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@
131131
while (!feof($ifile)) {
132132
$line = $nextline;
133133
$nextline = fgets($ifile, 1024);
134-
$nextline = ereg_replace("[\r\n]", '', $nextline);
134+
$nextline = preg_replace("/[\r\n]/", '', $nextline);
135135
#handle continuation lines that start with either a space or a tab (MS Outlook)
136136
while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) {
137137
$line = $line . substr($nextline, 1);
138138
$nextline = fgets($ifile, 1024);
139-
$nextline = ereg_replace("[\r\n]", '', $nextline);
139+
$nextline = preg_replace("/[\r\n]/", '', $nextline);
140140
}
141141
$line = str_replace('\n', "\n", $line);
142142
$line = str_replace('\t', "\t", $line);
@@ -261,7 +261,7 @@
261261

262262
default:
263263
unset ($field, $data, $prop_pos, $property);
264-
if (ereg ("([^:]+):(.*)", $line, $line)){
264+
if (preg_match ("/([^:]+):(.*)/", $line, $line)){
265265
$field = $line[1];
266266
$data = $line[2];
267267
$property = strtoupper($field);
@@ -327,7 +327,7 @@
327327
break;
328328

329329
case 'EXDATE':
330-
$data = split(',', $data);
330+
$data = explode(',', $data);
331331
foreach ($data as $exdata) {
332332
$exdata = str_replace('T', '', $exdata);
333333
$exdata = str_replace('Z', '', $exdata);
@@ -367,7 +367,7 @@
367367
case 'RECURRENCE-ID':
368368
$parts = explode(';', $field);
369369
foreach($parts as $part) {
370-
$eachval = split('=',$part);
370+
$eachval = explode('=',$part);
371371
if ($eachval[0] == 'RECURRENCE-ID') {
372372
// do nothing
373373
} elseif ($eachval[0] == 'TZID') {
@@ -384,11 +384,11 @@
384384

385385
$data = str_replace('T', '', $data);
386386
$data = str_replace('Z', '', $data);
387-
ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs);
387+
preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs);
388388
$recurrence_id['date'] = $regs[1] . $regs[2] . $regs[3];
389389
$recurrence_id['time'] = $regs[4] . $regs[5];
390390

391-
$recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]);
391+
$recur_unixtime = mktime(intval($regs[4]), intval($regs[5]), 0, intval($regs[2]), intval($regs[3]), intval($regs[1]));
392392

393393
if (isset($recurrence_id['tzid'])) {
394394
$offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']);
@@ -422,7 +422,7 @@
422422
break;
423423
case 'DURATION':
424424
if (($first_duration == TRUE) && (!stristr($field, '=DURATION'))) {
425-
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);
425+
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);
426426
$weeks = str_replace('W', '', $duration[1]);
427427
$days = str_replace('D', '', $duration[2]);
428428
$hours = str_replace('H', '', $duration[4]);
@@ -434,9 +434,9 @@
434434
break;
435435
case 'RRULE':
436436
$data = str_replace ('RRULE:', '', $data);
437-
$rrule = split (';', $data);
437+
$rrule = explode (';', $data);
438438
foreach ($rrule as $recur) {
439-
ereg ('(.*)=(.*)', $recur, $regs);
439+
preg_match ('/(.*)=(.*)/', $recur, $regs);
440440
$rrule_array[$regs[1]] = $regs[2];
441441
}
442442
break;

functions/init.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
$subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename;
150150
$download_filename = $filename;
151151
} elseif ($phpiCal_config->download_uri != '') {
152-
$newurl = eregi_replace("^(http://)", "", $phpiCal_config->download_uri);
152+
$newurl = preg_replace("#^(http://)#i", "", $phpiCal_config->download_uri);
153153
$subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename);
154154
$download_filename = $phpiCal_config->download_uri.'/'.$add_cpath.basename($filename);
155155
} else {

functions/list_functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function list_jumps() {
44
global $phpiCal_config, $lang, $cal;
5-
$calName = join(',', array_map("getCalendarName", split(',', $cal)));
5+
$calName = join(',', array_map("getCalendarName", explode(',', $cal)));
66
$today = date('Ymd', time() + $phpiCal_config->second_offset);
77
$return = '<option value="#">'.$lang['l_jump'].'</option>';
88
$return .= '<option value="day.php?cal='.$calName.'&amp;getdate='.$today.'">'.$lang['l_goday'].'</option>';
@@ -77,7 +77,7 @@ function list_years() {
7777

7878
function list_weeks() {
7979
global $getdate, $this_year, $cal, $dateFormat_week_jump, $phpiCal_config;
80-
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
80+
preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2);
8181
$this_day = $day_array2[3];
8282
$this_month = $day_array2[2];
8383
$this_year = $day_array2[1];

functions/parse/end_vevent.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
case 'UNTIL':
125125
# UNTIL must be in UTC
126126
$until = date("YmdHis",strtotime($val));
127-
ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
127+
preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $until, $regs);
128128
$until_unixtime = mktime($regs[4],@$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]);
129129
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until);
130130
break;
@@ -135,39 +135,39 @@
135135
}
136136
break;
137137
case 'BYSECOND':
138-
$bysecond = split (',', $val);
138+
$bysecond = explode (',', $val);
139139
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond;
140140
break;
141141
case 'BYMINUTE':
142-
$byminute = split (',', $val);
142+
$byminute = explode (',', $val);
143143
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute;
144144
break;
145145
case 'BYHOUR':
146-
$byhour = split (',', $val);
146+
$byhour = explode (',', $val);
147147
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour;
148148
break;
149149
case 'BYDAY':
150-
$byday = split (',', $val);
150+
$byday = explode (',', $val);
151151
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday;
152152
break;
153153
case 'BYMONTHDAY':
154-
$bymonthday = split (',', $val);
154+
$bymonthday = explode (',', $val);
155155
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday;
156156
break;
157157
case 'BYYEARDAY':
158-
$byyearday = split (',', $val);
158+
$byyearday = explode (',', $val);
159159
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday;
160160
break;
161161
case 'BYWEEKNO':
162-
$byweekno = split (',', $val);
162+
$byweekno = explode (',', $val);
163163
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno;
164164
break;
165165
case 'BYMONTH':
166-
$bymonth = split (',', $val);
166+
$bymonth = explode (',', $val);
167167
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth;
168168
break;
169169
case 'BYSETPOS':
170-
$bysetpos = split (',', $val);
170+
$bysetpos = explode (',', $val);
171171
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos;
172172
break;
173173
case 'WKST':

functions/parse/parse_tzs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
while (!feof($ifile)) {
1313
$line = $nextline;
1414
$nextline = fgets($ifile, 1024);
15-
$nextline = ereg_replace("[\r\n]", '', $nextline);
15+
$nextline = preg_replace("/[\r\n]/", '', $nextline);
1616
#handle continuation lines that start with either a space or a tab (MS Outlook)
1717
while (isset($nextline{0}) && ($nextline{0} == ' ' || $nextline{0} == "\t")) {
1818
$line = $line . substr($nextline, 1);
1919
$nextline = fgets($ifile, 1024);
20-
$nextline = ereg_replace("[\r\n]", '', $nextline);
20+
$nextline = preg_replace("/[\r\n]/", '', $nextline);
2121
}
2222
$line = trim($line);
2323
switch ($line) {
@@ -56,7 +56,7 @@
5656
break;
5757
default:
5858
unset ($field, $data, $prop_pos, $property);
59-
if (ereg ('([^:]+):(.*)', $line, $line)){
59+
if (preg_match ('/([^:]+):(.*)/', $line, $line)){
6060
$field = $line[1];
6161
$data = $line[2];
6262
$property = strtoupper($field);

functions/parse/recur_functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function expand_byday($time) {
138138
[2] => 4 number
139139
[3] => TH day abbr
140140
*/
141-
ereg ('([-\+]{0,1})?([0-9]+)?([A-Z]{2})', $day, $byday_arr);
141+
preg_match ('/([-\+]{0,1})?([0-9]+)?([A-Z]{2})/', $day, $byday_arr);
142142
$on_day = two2threeCharDays($byday_arr[3]);
143143
switch ($freq_type) {
144144
case 'week':
@@ -254,7 +254,7 @@ function restrict_byday($times, $freq = '') {
254254
[2] => 4 number
255255
[3] => TH day abbr
256256
*/
257-
ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr);
257+
preg_match ('/([-\+]{0,1})?([0-9]{1})?([A-Z]{2})/', $day, $byday_arr);
258258
$byday3[] = two2threeCharDays($byday_arr[3]);
259259
}
260260
$new_times = array();

functions/template.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ function draw_print($template_p) {
9393
$location = sanitizeForWeb(stripslashes(urldecode($new_val2['location'])));
9494
$description = sanitizeForWeb(stripslashes(urldecode($new_val2['description'])));
9595
if (!empty($description)) {
96-
$description = ereg_replace('(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&amp;)+[[:alnum:]/])', '<a target="_new" href="\2">\2</a>', $description);
97-
$description = ereg_replace('(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})', '<a href="mailto:\3">\3</a>', $description);
96+
$description = preg_replace('(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&amp;)+[[:alnum:]/])', '<a target="_new" href="\2">\2</a>', $description);
97+
$description = preg_replace('(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})', '<a href="mailto:\3">\3</a>', $description);
9898
}
9999

100100
$event_start = $new_val2['event_start'];
@@ -395,7 +395,7 @@ function draw_week($template_p) {
395395
$key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year);
396396
$key = date ($timeFormat, $key);
397397

398-
if (ereg('([0-9]{1,2}):00', $key)) {
398+
if (preg_match('/([0-9]{1,2}):00/', $key)) {
399399
$even_row = '2';
400400
# column of times colspan = 4 to cover navigation links at top
401401
$weekdisplay .= '<tr>';
@@ -408,7 +408,7 @@ function draw_week($template_p) {
408408
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
409409
} else {
410410
$even_row = '';
411-
if (ereg('([0-9]{1,2}):30', $key)) $even_row = '3';
411+
if (preg_match('/([0-9]{1,2}):30/', $key)) $even_row = '3';
412412
# empty row for each gridLength, to the right of times and left of first weekday
413413
$weekdisplay .= '<tr>';
414414
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
@@ -1142,7 +1142,7 @@ function monthbottom() {
11421142

11431143
}
11441144

1145-
function Page($file = 'std.tpl') {
1145+
function __construct($file = 'std.tpl') {
11461146
global $phpiCal_config;
11471147
if (!file_exists($file)){
11481148
#look for it in default if not found

includes/event.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
$event['description'] = sanitizeForWeb(urldecode($event['description']));
3232
$event['location'] = sanitizeForWeb(urldecode($event['location']));
3333
if (isset($event['description'])) {
34-
$event['description'] = ereg_replace("(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&amp;)+[[:alnum:]/])", '<a target="_new" href="\2">\2</a>', $event['description']);
35-
$event['description'] = ereg_replace("(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})", '<a href="mailto:\3">\3</a>', $event['description']);
34+
$event['description'] = preg_replace("#(blocked)?([[:alpha:]]+://([^<>&[:space:]]|&amp;)+[[:alnum:]/])#", '<a target="_new" href="\2">\2</a>', $event['description']);
35+
$event['description'] = preg_replace("#(blocked)?(mailto:)?([[:alnum:]_.%+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4})#", '<a href="mailto:\3">\3</a>', $event['description']);
3636
}
3737

3838
if (isset($organizer) && is_array($organizer)) {

includes/todo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
$priority = (isset($vtodo_array['priority'])) ? $vtodo_array['priority'] : ('');
1919

2020
$cal_title_full = $calendar_name.' '.$lang['l_calendar'];
21-
$description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\0">\0</a>', $description);
22-
$vtodo_text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>',$vtodo_text);
21+
$description = preg_replace("#[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]#", '<a target="_new" href="\0">\0</a>', $description);
22+
$vtodo_text = preg_replace("#[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]#",'<a target="_new" href="\0">\0</a>',$vtodo_text);
2323

2424

2525
if ((!isset($status) || $status == "COMPLETED") && isset($completed_date)) {

lib/HTTP/WebDAV/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ function _get_ranges(&$options)
920920
if (isset($_SERVER['HTTP_RANGE'])) {
921921

922922
// we only support standard 'bytes' range specifications for now
923-
if (ereg('bytes[[:space:]]*=[[:space:]]*(.+)', $_SERVER['HTTP_RANGE'], $matches)) {
923+
if (preg_match('@bytes[[:space:]]*=[[:space:]]*(.+)@', $_SERVER['HTTP_RANGE'], $matches)) {
924924
$options['ranges'] = array();
925925

926926
// ranges are comma separated
@@ -2180,7 +2180,7 @@ function _check_if_header_conditions()
21802180
// but if opaquelocktokens are used (RFC2518 6.4)
21812181
// we have to check the format (litmus tests this)
21822182
if (!strncmp($condition, '<opaquelocktoken:', strlen('<opaquelocktoken'))) {
2183-
if (!ereg('^<opaquelocktoken:[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}>$', $condition)) {
2183+
if (!preg_match('/^<opaquelocktoken:[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}>$/', $condition)) {
21842184
return;
21852185
}
21862186
}

lib/bennu/iCalendar_rfc2445.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ function rfc2445_is_valid_value($value, $type) {
124124
}
125125

126126
if($scheme === 'mailto') {
127-
$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})$';
127+
$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})$#';
128128
}
129129
else {
130-
$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})?(/.*)?$';
130+
$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})?(/.*)?$#';
131131
}
132132

133-
return ereg($regexp, $remain);
133+
return preg_match($regexp, $remain);
134134
break;
135135

136136
case RFC2445_TYPE_BINARY:

0 commit comments

Comments
 (0)