diff -r -u dialup_admin/Changelog restena_eduroam//Changelog
--- dialup_admin/Changelog	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//Changelog	2011-01-07 10:04:58.890767588 +0100
@@ -1,3 +1,8 @@
+Ver X.XX:
+* add comparison operators "!=" and "not like" to Accounting
+* replace ereg -> preg_match, ereg_replace -> preg_replace, split -> preg_split for PHP5.3 compatibility
+* fix LIMIT not working when using MySQL
+* add configuration item "timezone" to make PHP 5.1+ happy
 Ver 1.80:
 * Remove snmp_clearsession. It is replaced by clearsession which supports both snmp and telnet
   methods of removing a user from an access server. Add corresponding configuration directives
diff -r -u dialup_admin/conf/admin.conf restena_eduroam//conf/admin.conf
--- dialup_admin/conf/admin.conf	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//conf/admin.conf	2011-01-07 10:24:03.438539560 +0100
@@ -344,3 +303,8 @@
 # it configurable
 # This is not needed if the monthly limit is not none
 #counter_monthly_calculate_usage: true
+
+# some of the date/time related functions need to know what timezone we are in
+
+timezone: Europe/Luxembourg
+
diff -r -u dialup_admin/conf/config.php3 restena_eduroam//conf/config.php3
--- dialup_admin/conf/config.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//conf/config.php3	2011-01-07 10:03:04.878995345 +0100
@@ -2,6 +2,7 @@
 #
 # Things should work even if register_globals is set to off
 #
+
 $testVer=intval(str_replace(".", "",'4.1.0'));
 $curVer=intval(str_replace(".", "",phpversion()));
 if( $curVer >= $testVer )
@@ -24,9 +25,9 @@
 	$EXTRA_ARR = array();
 	foreach($ARR as $val) {
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($key,$v)=split(":[[:space:]]*",$val,2);
+		list($key,$v)=preg_split("/:[[:space:]]*/",$val,2);
 		if (preg_match("/%\{(.+)\}/",$v,$matches)){
 			$val=$config[$matches[1]];
 			$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
@@ -45,9 +46,9 @@
 	foreach($EXTRA_ARR as $val1) {
 		foreach($val1 as $val){
 			$val=chop($val);
-			if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+			if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 				continue;
-			list($key,$v)=split(":[[:space:]]*",$val,2);
+			list($key,$v)=preg_split("/:[[:space:]]*/",$val,2);
 			if (preg_match("/%\{(.+)\}/",$v,$matches)){
 				$val=$config[$matches[1]];
 				$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
@@ -87,14 +88,14 @@
 	$ARR = file($config[general_username_mappings_file]);
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($key,$realm,$v)=split(":[[:space:]]*",$val,3);
+		list($key,$realm,$v)=preg_split("/:[[:space:]]*/",$val,3);
 		if ($realm == 'accounting' || $realm == 'userdb' || $realm == 'nasdb' || $realm == 'nasadmin')
 			$mappings["$key"][$realm] = $v;
 		if ($realm == 'nasdb'){
 			$NAS_ARR = array();
-			$NAS_ARR = split(',',$v);
+			$NAS_ARR = preg_split('/,/',$v);
 			foreach ($nas_list as $key => $nas){
 				foreach ($NAS_ARR as $nas_check){
 					if ($nas_check == $nas[name])
@@ -107,6 +108,8 @@
 		session_register('mappings');
 }
 
+date_default_timezone_set($config[timezone]);
+
 //Include missing.php3 if needed
 if (!function_exists('array_change_key_case'))
 	include_once('../lib/missing.php3');
diff -r -u dialup_admin/htdocs/accounting.php3 restena_eduroam//htdocs/accounting.php3
--- dialup_admin/htdocs/accounting.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//htdocs/accounting.php3	2011-01-07 09:26:11.044570241 +0100
@@ -24,7 +24,7 @@
 	exit();
 }
 
-$operators=array( '=','<', '>', '<=', '>=', 'regexp', 'like' );
+$operators=array( '=','<', '>', '<=', '>=', '!=', 'regexp', 'like', 'not like' );
 if ($config[sql_type] == 'pg'){
 	$operators=array( '=','<', '>', '<=', '>=', '~', 'like', '~*', '~~*', '<<=' );
 }
@@ -233,7 +233,7 @@
 unset($query_view);
 foreach ($accounting_show_attrs as $val)
 	$query_view .= $val . ',';
-$query_view = ereg_replace(',$','',$query_view);
+$query_view = preg_replace('/,$/','',$query_view);
 unset($sql_extra_query);
 if ($config[sql_accounting_extra_query] != '')
 	$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
diff -r -u dialup_admin/htdocs/user_accounting.php3 restena_eduroam//htdocs/user_accounting.php3
--- dialup_admin/htdocs/user_accounting.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//htdocs/user_accounting.php3	2011-01-07 09:32:59.230924492 +0100
@@ -145,8 +145,8 @@
 			$acct_terminate_cause = "$row[acctterminatecause]";
 			if ($acct_terminate_cause == '')
 				$acct_terminate_cause = '-';
-			if (ereg('Login-Incorrect',$acct_terminate_cause) ||
-				ereg('Multiple-Logins', $acct_terminate_cause) || ereg('Invalid-User',$acct_terminate_cause))
+			if (preg_match('/Login-Incorrect/',$acct_terminate_cause) ||
+				preg_match('/Multiple-Logins/', $acct_terminate_cause) || preg_match('/Invalid-User/',$acct_terminate_cause))
 				$tr_color='#ffe8e0';
 			$acct_callerid = "$row[callingstationid]";
 			if ($acct_callerid == '')
diff -r -u dialup_admin/htdocs/user_edit.php3 restena_eduroam//htdocs/user_edit.php3
--- dialup_admin/htdocs/user_edit.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//htdocs/user_edit.php3	2011-01-07 09:30:23.358497864 +0100
@@ -180,7 +180,7 @@
 		$i = 0;
 		foreach($vals as $val){
 			$name1 = $name . $i;
-			$val = ereg_replace('"','&quot;',$val);
+			$val = preg_replace('/"/','&quot;',$val);
 			$oper_name = $name1 . '_op';
 			$oper = $ops[$i];
 			$selected[$oper] = 'selected';
diff -r -u dialup_admin/htdocs/user_test.php3 restena_eduroam//htdocs/user_test.php3
--- dialup_admin/htdocs/user_test.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//htdocs/user_test.php3	2011-01-07 09:31:51.779874387 +0100
@@ -76,7 +76,7 @@
 	if ($fp){
 		foreach ($req as $val){
 			// Ignore comments
-			if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+			if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 				continue;
 			fwrite($fp,$val);
 		}
@@ -100,13 +100,13 @@
 		unlink($tmp_file);
 		$msg = "<b>" . strftime('%A, %e %B %Y, %T %Z') . "</b><br>\n";
 		$msg .= "<b>Server: </b><i>$server:$port</i><br><br>\n";
-		if (ereg('code 2', $reply[0]))
+		if (preg_match('/code 2/', $reply[0]))
 			$msg .= "<b>Authentication was <font color=green>successful</font>";
-		else if (ereg('code 3',$reply[0]))
+		else if (preg_match('/code 3/',$reply[0]))
 			$msg .= "<b>Authentication <font color=red>failed</font>";
-		else if (ereg('no response from server', $reply[0]))
+		else if (preg_match('/no response from server/', $reply[0]))
 			$msg .= "<b><font color=red>No response from server</font>";
-		else if (ereg('Connection refused',$reply[0]))
+		else if (preg_match('/Connection refused/',$reply[0]))
 			$msg .= "<b><font color=red>Connection was refused</font>";
 		if ($test_login)
 			$msg .= "</b><i> (test user $login)</i><br>\n";
diff -r -u dialup_admin/lib/acctshow.php3 restena_eduroam//lib/acctshow.php3
--- dialup_admin/lib/acctshow.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/acctshow.php3	2011-01-07 09:08:08.327690963 +0100
@@ -7,9 +7,9 @@
 	$ARR = file($config[general_sql_attrs_file]);
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($key,$desc,$show,$func)=split("\t+",$val);
+		list($key,$desc,$show,$func)=preg_split("/\t+/",$val);
 		$sql_attrs[strtolower($key)][desc] = "$desc";
 		$sql_attrs[strtolower($key)][show] = "$show";
 		$sql_attrs[strtolower($key)][func] = ($func == "") ? "nothing" : "$func";
diff -r -u dialup_admin/lib/attrshow.php3 restena_eduroam//lib/attrshow.php3
--- dialup_admin/lib/attrshow.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/attrshow.php3	2011-01-07 09:48:59.065853622 +0100
@@ -9,9 +9,9 @@
 	$ARR = file($infile);
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($key,$v)=split("\t+",$val);
+		list($key,$v)=preg_split("/\t+/",$val);
 		$show_attrs["$key"]=($v != '') ? "$v" : "$key";
 	}
 	if ($config[general_use_session] == 'yes')
@@ -25,9 +25,9 @@
 	$ARR = file($infile);
 	foreach ($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($num,$desc,$showua,$showuf,$showfl)=split("\t+",$val);
+		list($num,$desc,$showua,$showuf,$showfl)=preg_split("/\t+/",$val);
 		if ($showua == 'yes'){
 			$acct_attrs["ua"]["num"]++;
 			$acct_attrs["ua"]["$num"]=$desc;
diff -r -u dialup_admin/lib/defaults.php3 restena_eduroam//lib/defaults.php3
--- dialup_admin/lib/defaults.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/defaults.php3	2011-01-07 09:48:14.555162334 +0100
@@ -7,9 +7,9 @@
 	$ARR=file("$config[general_default_file]");
 	foreach($ARR as $val) {
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($key,$v)=split(":[[:space:]]*",$val,2);
+		list($key,$v)=preg_split("/:[[:space:]]*/",$val,2);
 		$text_default_vals["$key"][0]="$v";
 		$text_default_vals["$key"]['count']++;
 	}
diff -r -u dialup_admin/lib/functions.php3 restena_eduroam//lib/functions.php3
--- dialup_admin/lib/functions.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/functions.php3	2011-01-07 10:37:37.951164319 +0100
@@ -24,7 +24,7 @@
 	}
 	if ($time)
 		$str .= "$time seconds, ";
-	$str = ereg_replace(', $','',$str);
+	$str = preg_replace('/, $/','',$str);
 
 	return $str;
 }
@@ -124,7 +124,7 @@
 }
 
 function check_ip($ipaddr) {
-    if(ereg("^([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})$", $ipaddr,$digit)) {
+    if(preg_match("/^([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})\x2E([0-9]{1,3})$/", $ipaddr,$digit)) {
    	  if(($digit[1] <= 255) && ($digit[2] <= 255) && ($digit[3] <= 255) && ($digit[4] <= 255)) {
         return(1);
       }
diff -r -u dialup_admin/lib/lang/el/utf8.php3 restena_eduroam//lib/lang/el/utf8.php3
--- dialup_admin/lib/lang/el/utf8.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/lang/el/utf8.php3	2011-01-07 09:34:27.042291632 +0100
@@ -72,8 +72,8 @@
 
 function decode_string($line,$k)
 {
-	$line = ereg_replace("&","&&",$line);
-	$line = ereg_replace("([,+0-9./() -])", "%\\1", $line);
+	$line = preg_replace("/&/","&&",$line);
+	$line = preg_replace("/([,+0-9.\/() -])/", "%\\1", $line);
 	$mline = chunk_split($line, 2, " ");
 	$chars = explode(" ", $mline);
 	foreach ($chars as $c){
@@ -81,10 +81,10 @@
 		$c = ($val != "") ? "$val" : "$c";
 		$new_line .= $c;
 	}
-	$new_line = ereg_replace("%%", " ", $new_line);
-	$new_line = ereg_replace("%([,+0-9./() -])", "\\1", $new_line);
-	$new_line = ereg_replace("%", " ",$new_line);
-	$new_line = ereg_replace("&&","&",$new_line);
+	$new_line = preg_replace("/%%/", " ", $new_line);
+	$new_line = preg_replace("/%([,+0-9.\/() -])/", "\\1", $new_line);
+	$new_line = preg_replace("/%/", " ",$new_line);
+	$new_line = preg_replace("/&&/","&",$new_line);
 
 	return $new_line;
 }
diff -r -u dialup_admin/lib/ldap/attrmap.php3 restena_eduroam//lib/ldap/attrmap.php3
--- dialup_admin/lib/ldap/attrmap.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/ldap/attrmap.php3	2011-01-07 09:47:36.954578425 +0100
@@ -7,9 +7,9 @@
 	$ARR = file("$config[general_ldap_attrmap]");
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list(,$key,$v,$g)=split('[[:space:]]+',$val);
+		list(,$key,$v,$g)=preg_split('/[[:space:]]+/',$val);
 		$v = strtolower($v);
 		$attrmap["$key"]=$v;
 		$attrmap[generic]["$key"]=$g;
@@ -17,9 +17,9 @@
 	$ARR = file("$config[general_extra_ldap_attrmap]");
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list(,$key,$v,$g)=split('[[:space:]]+',$val);
+		list(,$key,$v,$g)=preg_split('/[[:space:]]+/',$val);
 		$v = strtolower($v);
 		$attrmap["$key"]=$v;
 		$attrmap[generic]["$key"]=$g;
diff -r -u dialup_admin/lib/ldap/change_info.php3 restena_eduroam//lib/ldap/change_info.php3
--- dialup_admin/lib/ldap/change_info.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/ldap/change_info.php3	2011-01-07 09:47:06.134099800 +0100
@@ -16,7 +16,7 @@
 		$r = @da_ldap_bind($ds,$config);
 		if ($r){
 			if ($Fcn != '' && $Fcn != '-' && $Fcn != $cn){
-				list ($givenname,$sn) = split(' ',$Fcn,2);
+				list ($givenname,$sn) = preg_split('/ /',$Fcn,2);
 				$mod['cn'] = $Fcn;
 				$mod['cn'] = ($decode_normal) ? encode_string($mod['cn'],$k) : $mod['cn'];
 				$mod['givenname'] = $givenname;
diff -r -u dialup_admin/lib/ldap/create_user.php3 restena_eduroam//lib/ldap/create_user.php3
--- dialup_admin/lib/ldap/create_user.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/ldap/create_user.php3	2011-01-07 09:46:47.363808319 +0100
@@ -8,7 +8,7 @@
 	if ($ds){
 		$r = @da_ldap_bind($ds,$config);
 		if ($r){
-			list ($givenname,$sn) = split(' ',$Fcn,2);
+			list ($givenname,$sn) = preg_split('/ /',$Fcn,2);
 			$dn = 'uid=' . $login . ',' . $config[ldap_default_new_entry_suffix];
 			$new_user_entry["objectclass"][0]="top";
 			$new_user_entry["objectclass"][1]="person";
diff -r -u dialup_admin/lib/ldap/personattrs.php3 restena_eduroam//lib/ldap/personattrs.php3
--- dialup_admin/lib/ldap/personattrs.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/ldap/personattrs.php3	2011-01-07 09:47:54.834856080 +0100
@@ -3,9 +3,9 @@
 $ARR = file($config[general_ldap_person_attrs_file]);
 foreach($ARR as $val){
 	$val=chop($val);
-	if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+	if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 		continue;
-	list($key,$desc)=split("\t+",$val);
+	list($key,$desc)=preg_split("/\t+/",$val);
 	$person_attrs["$key"] = "$desc";
 }
 ?>
diff -r -u dialup_admin/lib/sql/attrmap.php3 restena_eduroam//lib/sql/attrmap.php3
--- dialup_admin/lib/sql/attrmap.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/sql/attrmap.php3	2011-01-07 09:46:21.623408614 +0100
@@ -13,9 +13,9 @@
 	$ARR = file("$config[general_sql_attrmap]");
 	foreach($ARR as $val){
 		$val=chop($val);
-		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
 			continue;
-		list($type,$key,$v)=split('[[:space:]]+',$val);
+		list($type,$key,$v)=preg_split('/[[:space:]]+/',$val);
 		$attrmap["$key"]=$v;
 		$rev_attrmap["$v"] = $key;
 		$attr_type["$key"]=$type;
diff -r -u dialup_admin/lib/sql/drivers/mysql/functions.php3 restena_eduroam//lib/sql/drivers/mysql/functions.php3
--- dialup_admin/lib/sql/drivers/mysql/functions.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/sql/drivers/mysql/functions.php3	2011-01-07 09:22:41.281300551 +0100
@@ -6,7 +6,7 @@
 			return '';
 		case 1:
 			return '';
-		case 3:
+		case 2:
 			return "LIMIT $limit";
 	}
 }
diff -r -u dialup_admin/lib/sql/nas_list.php3 restena_eduroam//lib/sql/nas_list.php3
--- dialup_admin/lib/sql/nas_list.php3	2010-09-28 13:03:56.000000000 +0200
+++ restena_eduroam//lib/sql/nas_list.php3	2011-01-07 09:46:02.553112498 +0100
@@ -19,7 +19,7 @@
 		$extra = '';
 		if (isset($mappings[$auth_user][nasdb])){
 			$NAS_ARR = array();
-			$NAS_ARR = split(',',$mappings[$auth_user][nasdb]);
+			$NAS_ARR = preg_split('/,/',$mappings[$auth_user][nasdb]);
 			$extra = 'WHERE nasname IN (';
 			foreach ($NAS_ARR as $nas)
 				$extra .= "'$nasname',";
