diff --git a/trunk/gosa-core/include/utils/class_tests.inc b/trunk/gosa-core/include/utils/class_tests.inc
index 2f1d0b05cada8039c64bc22a1d0ae05e6484c2a1..1be764926c7f4bd9450f9c0b067884e4dfb3d15d 100644 (file)
/* \brief Check if the specified IP address $address is inside the given network */
public static function is_in_ip_range($from, $to, $address)
{
+ if (!preg_match("/[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9]/", $address)) {
+ return FALSE;
+ }
+
+ if (($from == '*' && $to == '*') || ($from == '' && $to == '')) {
+ return TRUE;
+ }
+
$from = split('\.', $from);
$to = split('\.', $to);
$ad = split('\.', $address);
return ($ad >= $from && $ad <= $to);
}
+
+ /* Check if given timestamp is in gosa-si time-format */
+ public static function is_gosa_si_time($time){
+ return preg_match ("/^20\d\d[0-1]\d[0-3]\d[0-2]\d[0-5]\d[0-5]\d$/i", $time);
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: