aboutsummaryrefslogtreecommitdiffstats
path: root/functions/date_functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'functions/date_functions.php')
-rw-r--r--functions/date_functions.php16
1 files changed, 8 insertions, 8 deletions
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 <http> 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';
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy