summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3f2ce44)
raw | patch | inline | side by side (parent: 3f2ce44)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Jan 2008 12:54:47 +0000 (12:54 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Jan 2008 12:54:47 +0000 (12:54 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8287 594d385d-05f5-0310-b6e9-bd551577e9d8
43 files changed:
index dec871a7542525cfa16a527283522047e88768a0..ff2ced9685b14b18c648e76e4c93a77867ff5ff5 100644 (file)
"LayersMenu" => "include/utils/layer-menu/lib/layersmenu.inc.php",
"LayersMenuCommon" => "include/utils/layer-menu/lib/layersmenu-common.inc.php",
"PlainMenu" => "include/utils/layer-menu/lib/plainmenu.inc.php",
+ "tests" => "include/utils/class_tests.inc",
"divlist" => "include/class_divlist.inc",
"passwordMethodClear" => "include/password-methods/class_password-methods-clear.inc",
"passwordMethodMd5" => "include/password-methods/class_password-methods-md5.inc",
index 87c667de61bfaab2ec2819d0d3f53ff136f86111..07ce7ded7eb41ea0baad61a2101382f4bb3df1e5 100644 (file)
if (isset($_POST['set_size_action'])){
/* User wants new size limit? */
- if (is_id($_POST['new_limit']) &&
+ if (tests::is_id($_POST['new_limit']) &&
isset($_POST['action']) && $_POST['action']=="newlimit"){
session::set('size_limit', validate($_POST['new_limit']));
}
-function is_phone_nr($nr)
-{
- if ($nr == ""){
- return (TRUE);
- }
-
- return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
-}
-
-
-function is_dns_name($str)
-{
- return(preg_match("/^[a-z0-9\.\-]*$/i",$str));
-}
-
-
-function is_url($url)
-{
- if ($url == ""){
- return (TRUE);
- }
-
- return preg_match ("/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/", $url);
-}
-
-
-function is_dn($dn)
-{
- if ($dn == ""){
- return (TRUE);
- }
-
- return preg_match ("/^[a-z0-9 _-]+$/i", $dn);
-}
-
-
function strict_uid_mode()
{
return !(isset($config->current['STRICT']) && preg_match('/^(no|false)$/i', $config->current['STRICT']));
}
-function is_uid($uid)
-{
- global $config;
-
- if ($uid == ""){
- return (TRUE);
- }
-
- /* STRICT adds spaces and case insenstivity to the uid check.
- This is dangerous and should not be used. */
- if (strict_uid_mode()){
- return preg_match ("/^[a-z0-9_-]+$/", $uid);
- } else {
- return preg_match ("/^[a-z0-9 _.-]+$/i", $uid);
- }
-}
-
-
-function is_ip($ip)
-{
- return preg_match("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $ip);
-}
-
-
-function is_mac($mac)
-{
- return preg_match("/^[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$/i", $mac);
-}
-
-
-/* Checks if the given ip address dosen't match
- "is_ip" because there is also a sub net mask given */
-function is_ip_with_subnetmask($ip)
-{
- /* Generate list of valid submasks */
- $res = array();
- for($e = 0 ; $e <= 32; $e++){
- $res[$e] = $e;
- }
- $i[0] =255;
- $i[1] =255;
- $i[2] =255;
- $i[3] =255;
- for($a= 3 ; $a >= 0 ; $a --){
- $c = 1;
- while($i[$a] > 0 ){
- $str = $i[0].".".$i[1].".".$i[2].".".$i[3];
- $res[$str] = $str;
- $i[$a] -=$c;
- $c = 2*$c;
- }
- }
- $res["0.0.0.0"] = "0.0.0.0";
- if(preg_match("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/", $ip)){
- $mask = preg_replace("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
- "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/","",$ip);
-
- $mask = preg_replace("/^\//","",$mask);
- if((in_array("$mask",$res)) && preg_match("/^[0-9\.]/",$mask)){
- return(TRUE);
- }
- }
- return(FALSE);
-}
-
-
-/* Simple is domain check, it checks if the given string looks like "string(...).string" */
-function is_domain($str)
-{
- return(preg_match("/^([a-z0-9i\-]*)\.[a-z0-9]*$/i",$str));
-}
-
-
-function is_id($id)
-{
- if ($id == ""){
- return (FALSE);
- }
-
- return preg_match ("/^[0-9]+$/", $id);
-}
-
-
-function is_path($path)
-{
- if ($path == ""){
- return (TRUE);
- }
- if (!preg_match('/^[a-z0-9%\/_.+-]+$/i', $path)){
- return (FALSE);
- }
-
- return preg_match ("/\/.+$/", $path);
-}
-
-
-function is_email($address, $template= FALSE)
-{
- if ($address == ""){
- return (TRUE);
- }
- if ($template){
- return preg_match ("/^[._a-z0-9%-]+@[_a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z0-9-]+)*$/i",
- $address);
- } else {
- return preg_match ("/^[._a-z0-9-]+@[_a-z0-9-]+(\.[a-z0-9i-]+)(\.[a-z0-9-]+)*$/i",
- $address);
- }
-}
-
-
function print_red()
{
trigger_error("Use of obsolete print_red");
}
-/* Check if the given department name is valid */
-function is_department_name_reserved($name,$base)
-{
- $reservedName = array("systems","apps","incomming","internal","accounts","fax","addressbook",
- preg_replace("/ou=(.*),/","\\1",get_people_ou()),
- preg_replace("/ou=(.*),/","\\1",get_groups_ou()));
- $follwedNames['/ou=fai,ou=configs,ou=systems,/'] = array("fai","hooks","templates","scripts","disk","packages","variables","profiles");
-
- /* Check if name is one of the reserved names */
- if(in_array_ics($name,$reservedName)) {
- return(true);
- }
-
- /* Check all follow combinations if name is in array && parent base == array_key, return false*/
- foreach($follwedNames as $key => $names){
- if((in_array_ics($name,$names)) && (preg_match($key,$base))){
- return(true);
- }
- }
- return(false);
-}
-
-
function get_base_dir()
{
global $BASE_DIR;
}
-/* Check if $ip1 and $ip2 represents a valid IP range
- * returns TRUE in case of a valid range, FALSE in case of an error.
- */
-function is_ip_range($ip1,$ip2)
-{
- if(!is_ip($ip1) || !is_ip($ip2)){
- return(FALSE);
- }else{
- $ar1 = split("\.",$ip1);
- $var1 = $ar1[0] * (16777216) + $ar1[1] * (65536) + $ar1[2] * (256) + $ar1[3];
-
- $ar2 = split("\.",$ip2);
- $var2 = $ar2[0] * (16777216) + $ar2[1] * (65536) + $ar2[2] * (256) + $ar2[3];
- return($var1 < $var2);
- }
-}
-
-
-/* Check if the specified IP address $address is inside the given network */
-function is_in_network($network, $netmask, $address)
-{
- $nw= split('\.', $network);
- $nm= split('\.', $netmask);
- $ad= split('\.', $address);
-
- /* Generate inverted netmask */
- for ($i= 0; $i<4; $i++){
- $ni[$i]= 255-$nm[$i];
- $la[$i]= $nw[$i] | $ni[$i];
- }
-
- /* Transform to integer */
- $first= $nw[0] * (16777216) + $nw[1] * (65536) + $nw[2] * (256) + $nw[3];
- $curr= $ad[0] * (16777216) + $ad[1] * (65536) + $ad[2] * (256) + $ad[3];
- $last= $la[0] * (16777216) + $la[1] * (65536) + $la[2] * (256) + $la[3];
-
- return ($first < $curr&& $last > $curr);
-}
-
-
/* Return class name in correct case */
function get_correct_class_name($cls)
{
diff --git a/gosa-core/include/sieve/class_sieveElement_Redirect.inc b/gosa-core/include/sieve/class_sieveElement_Redirect.inc
index 64e71b6f8bba0c88a5255be7681add920154da20..bbb2d4bf1c80d881d48aef352e8fd3aabd3313cc 100644 (file)
{
$msgs = array();
- if(!is_email($this->data)){
+ if(!tests::is_email($this->data)){
$msgs[] =_("Please specify a valid email address.");
}
diff --git a/gosa-core/include/sieve/class_sieveElement_Vacation.inc b/gosa-core/include/sieve/class_sieveElement_Vacation.inc
index 43c7546377215877efee4065959c00d61d3a8980..1af166e9d9ed73b34fbac46bb496fbdeab0a003e 100644 (file)
$msgs = array();
$err = FALSE;
foreach($this->addresses as $addr){
- if(!is_email($addr)){
+ if(!tests::is_email($addr)){
$err = true;
}
}
diff --git a/gosa-core/include/utils/class_tests.inc b/gosa-core/include/utils/class_tests.inc
--- /dev/null
@@ -0,0 +1,238 @@
+<?php
+/*
+ * This code is part of GOsa (https://gosa.gonicus.de)
+ * Copyright (C) 2008 Cajus Pollmeier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class tests {
+ function is_phone_nr($nr)
+ {
+ if ($nr == ""){
+ return (TRUE);
+ }
+
+ return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
+ }
+
+
+ function is_dns_name($str)
+ {
+ return(preg_match("/^[a-z0-9\.\-]*$/i",$str));
+ }
+
+
+ function is_url($url)
+ {
+ if ($url == ""){
+ return (TRUE);
+ }
+
+ return preg_match ("/^(http|https):\/\/((?:[a-zA-Z0-9_-]+\.?)+):?(\d*)/", $url);
+ }
+
+
+ function is_dn($dn)
+ {
+ if ($dn == ""){
+ return (TRUE);
+ }
+
+ return preg_match ("/^[a-z0-9 _-]+$/i", $dn);
+ }
+
+
+ function is_uid($uid)
+ {
+ global $config;
+
+ if ($uid == ""){
+ return (TRUE);
+ }
+
+ /* STRICT adds spaces and case insenstivity to the uid check.
+ This is dangerous and should not be used. */
+ if (strict_uid_mode()){
+ return preg_match ("/^[a-z0-9_-]+$/", $uid);
+ } else {
+ return preg_match ("/^[a-z0-9 _.-]+$/i", $uid);
+ }
+ }
+
+
+ function is_ip($ip)
+ {
+ return preg_match("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $ip);
+ }
+
+
+ function is_mac($mac)
+ {
+ return preg_match("/^[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$/i", $mac);
+ }
+
+
+ /* Checks if the given ip address dosen't match
+ "is_ip" because there is also a sub net mask given */
+ function is_ip_with_subnetmask($ip)
+ {
+ /* Generate list of valid submasks */
+ $res = array();
+ for($e = 0 ; $e <= 32; $e++){
+ $res[$e] = $e;
+ }
+ $i[0] =255;
+ $i[1] =255;
+ $i[2] =255;
+ $i[3] =255;
+ for($a= 3 ; $a >= 0 ; $a --){
+ $c = 1;
+ while($i[$a] > 0 ){
+ $str = $i[0].".".$i[1].".".$i[2].".".$i[3];
+ $res[$str] = $str;
+ $i[$a] -=$c;
+ $c = 2*$c;
+ }
+ }
+ $res["0.0.0.0"] = "0.0.0.0";
+ if(preg_match("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/", $ip)){
+ $mask = preg_replace("/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.".
+ "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/","",$ip);
+
+ $mask = preg_replace("/^\//","",$mask);
+ if((in_array("$mask",$res)) && preg_match("/^[0-9\.]/",$mask)){
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+ }
+
+
+ /* Simple is domain check, it checks if the given string looks like "string(...).string" */
+ function is_domain($str)
+ {
+ return(preg_match("/^([a-z0-9i\-]*)\.[a-z0-9]*$/i",$str));
+ }
+
+
+ function is_id($id)
+ {
+ if ($id == ""){
+ return (FALSE);
+ }
+
+ return preg_match ("/^[0-9]+$/", $id);
+ }
+
+
+ function is_path($path)
+ {
+ if ($path == ""){
+ return (TRUE);
+ }
+ if (!preg_match('/^[a-z0-9%\/_.+-]+$/i', $path)){
+ return (FALSE);
+ }
+
+ return preg_match ("/\/.+$/", $path);
+ }
+
+
+ function is_email($address, $template= FALSE)
+ {
+ if ($address == ""){
+ return (TRUE);
+ }
+ if ($template){
+ return preg_match ("/^[._a-z0-9%-]+@[_a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z0-9-]+)*$/i",
+ $address);
+ } else {
+ return preg_match ("/^[._a-z0-9-]+@[_a-z0-9-]+(\.[a-z0-9i-]+)(\.[a-z0-9-]+)*$/i",
+ $address);
+ }
+ }
+
+
+ /* Check if the given department name is valid */
+ function is_department_name_reserved($name,$base)
+ {
+ $reservedName = array("systems","apps","incomming","internal","accounts","fax","addressbook",
+ preg_replace("/ou=(.*),/","\\1",get_people_ou()),
+ preg_replace("/ou=(.*),/","\\1",get_groups_ou()));
+ $follwedNames['/ou=fai,ou=configs,ou=systems,/'] = array("fai","hooks","templates","scripts","disk","packages","variables","profiles");
+
+ /* Check if name is one of the reserved names */
+ if(in_array_ics($name,$reservedName)) {
+ return(true);
+ }
+
+ /* Check all follow combinations if name is in array && parent base == array_key, return false*/
+ foreach($follwedNames as $key => $names){
+ if((in_array_ics($name,$names)) && (preg_match($key,$base))){
+ return(true);
+ }
+ }
+ return(false);
+ }
+
+
+ /* Check if $ip1 and $ip2 represents a valid IP range
+ * returns TRUE in case of a valid range, FALSE in case of an error.
+ */
+ function is_ip_range($ip1,$ip2)
+ {
+ if(!is_ip($ip1) || !is_ip($ip2)){
+ return(FALSE);
+ }else{
+ $ar1 = split("\.",$ip1);
+ $var1 = $ar1[0] * (16777216) + $ar1[1] * (65536) + $ar1[2] * (256) + $ar1[3];
+
+ $ar2 = split("\.",$ip2);
+ $var2 = $ar2[0] * (16777216) + $ar2[1] * (65536) + $ar2[2] * (256) + $ar2[3];
+ return($var1 < $var2);
+ }
+ }
+
+
+ /* Check if the specified IP address $address is inside the given network */
+ function is_in_network($network, $netmask, $address)
+ {
+ $nw= split('\.', $network);
+ $nm= split('\.', $netmask);
+ $ad= split('\.', $address);
+
+ /* Generate inverted netmask */
+ for ($i= 0; $i<4; $i++){
+ $ni[$i]= 255-$nm[$i];
+ $la[$i]= $nw[$i] | $ni[$i];
+ }
+
+ /* Transform to integer */
+ $first= $nw[0] * (16777216) + $nw[1] * (65536) + $nw[2] * (256) + $nw[3];
+ $curr= $ad[0] * (16777216) + $ad[1] * (65536) + $ad[2] * (256) + $ad[3];
+ $last= $la[0] * (16777216) + $la[1] * (65536) + $la[2] * (256) + $la[3];
+
+ return ($first < $curr&& $last > $curr);
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/addressbook/class_addressbook.inc b/gosa-core/plugins/addons/addressbook/class_addressbook.inc
index 1933228b9fb648ec47c6b4abb27413faa5456178..b1821bcd08f480413ca9f0315f59d2cb9d15baee 100644 (file)
}
/* Check phone numbers */
- if (!is_phone_nr($this->homePhone)){
+ if (!tests::is_phone_nr($this->homePhone)){
$message[]= _("The field 'Phone' contains an invalid phone number.");
}
- if (!is_phone_nr($this->telephoneNumber)){
+ if (!tests::is_phone_nr($this->telephoneNumber)){
$message[]= _("The field 'Phone' contains an invalid phone number.");
}
- if (!is_phone_nr($this->facsimileTelephoneNumber)){
+ if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
$message[]= _("The field 'Fax' contains an invalid phone number.");
}
- if (!is_phone_nr($this->mobile)){
+ if (!tests::is_phone_nr($this->mobile)){
$message[]= _("The field 'Mobile' contains an invalid phone number.");
}
- if (!is_phone_nr($this->pager)){
+ if (!tests::is_phone_nr($this->pager)){
$message[]= _("The field 'Pager' contains an invalid phone number.");
}
}
/* Check mail */
- if (!is_email($this->mail)){
+ if (!tests::is_email($this->mail)){
$message[]= _("Please enter a valid email address in 'Primary address' field.");
}
diff --git a/gosa-core/plugins/addons/gotomasses/class_goto_task.inc b/gosa-core/plugins/addons/gotomasses/class_goto_task.inc
index 8964def485ece43d7807c7844d105488408ac53b..1fa84d1cb1c88b2cb8e26a8fb28a381debb6901b 100644 (file)
if(isset($_POST['task_Name'])){
$NAME = $_POST['task_Name'];
}
- if(isset($_POST['task_IP']) && is_ip($_POST['task_IP'])){
+ if(isset($_POST['task_IP']) && tests::is_ip($_POST['task_IP'])){
$IP = $_POST['task_IP'];
}
if(isset($_POST['configure_dns']) && isset($_POST['Zone']) && isset($this->Zones[$_POST['Zone']])){
if(isset($_POST['configure_dhcp']) && isset($_POST['Section']) && isset($this->Sections[$_POST['Section']])){
$DHCP = $_POST['Section'];
}
- if(is_mac($MAC)){
+ if(tests::is_mac($MAC)){
$this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
}
}
if(isset($tmp[2])){
$NAME = trim($tmp[2]);
}
- if(is_mac($MAC)){
+ if(tests::is_mac($MAC)){
$this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
}
}
*/
function is_valid_target($str)
{
- if(is_mac($str)){
+ if(tests::is_mac($str)){
return(TRUE);
}else{
$ldap = $this->config->get_ldap_link();
diff --git a/gosa-core/plugins/addons/gotomasses/class_target_list.inc b/gosa-core/plugins/addons/gotomasses/class_target_list.inc
index 088c208c7b249855e0efdcca8458f907d614d845..15d3fb1aed4554956a82cc09da552a0aa439a063 100644 (file)
$IP_end = $this->IP_end;
if($this->IPMatch){
- if(!is_ip($IP_start)){
+ if(!tests::is_ip($IP_start)){
print_red(_("Please specify a valid IP range."));
return;
}
- if(!is_ip($IP_end)){
+ if(!tests::is_ip($IP_end)){
print_red(_("Please specify a valid IP range."));
return;
}
if($this->IPMatch){
if(isset($val['ipHostNumber'][0])){
- if(is_ip_range($IP_start,$val['ipHostNumber'][0]) && is_ip_range($val['ipHostNumber'][0],$IP_end)){
+ if(tests::is_ip_range($IP_start,$val['ipHostNumber'][0]) && tests::is_ip_range($val['ipHostNumber'][0],$IP_end)){
$tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
}
}
diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc
index 429b454f23f2751892d9633f1387ca5ba988f664..e1d637d15b48c5c38f7e6e63a7a6d88a63351f80 100644 (file)
$message[]= _("Required field 'Description' is not set.");
}
- if(is_department_name_reserved($this->ou,$this->base)){
+ if(tests::is_department_name_reserved($this->ou,$this->base)){
$message[]= sprintf(_("The field 'Name' contains the reserved word '%s'. Please choose another name."),$this->ou);
}
if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
$message[]= _("The field 'Name' contains invalid characters.");
}
- if (!is_phone_nr($this->telephoneNumber)){
+ if (!tests::is_phone_nr($this->telephoneNumber)){
$message[]= _("The field 'Phone' contains an invalid phone number.");
}
- if (!is_phone_nr($this->facsimileTelephoneNumber)){
+ if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
$message[]= _("The field 'Fax' contains an invalid phone number.");
}
diff --git a/gosa-core/plugins/admin/fai/class_faiManagement.inc b/gosa-core/plugins/admin/fai/class_faiManagement.inc
index 16ae87f73f1bf39cb4424b83803e5c2ac06afb1f..1c9b4347e7a4e334e52109084e929dc888ce33fc 100644 (file)
return(false);
}elseif(in_array($name,$this->getBranches($f))) {
return(false);
- }elseif(is_department_name_reserved($name,$base)){
+ }elseif(tests::is_department_name_reserved($name,$base)){
return(false);
}
return(true);
diff --git a/gosa-core/plugins/admin/fai/class_faiPartitionTableEntry.inc b/gosa-core/plugins/admin/fai/class_faiPartitionTableEntry.inc
index 431157c261e20ad4bf6242304daf5fb73ddc3388..bb2278ed031ba220563c21113257aa6478026ff4 100644 (file)
$message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
break;
case 1:
- if (!is_id(is_id($tmp[0])) &&(!empty($tmp[1]))){
+ if (!tests::is_id(is_id($tmp[0])) &&(!empty($tmp[1]))){
$message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
}
break;
case 2:
- if((!is_id($tmp[0]))&&(!is_id($tmp[1])) &&(!empty($tmp[1]))){
+ if((!tests::is_id($tmp[0]))&&(!tests::is_id($tmp[1])) &&(!empty($tmp[1]))){
$message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
}elseif($tmp[0]>=$tmp[1]){
$message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc
index ce23be1882cfd5cd1fd766713cef92524136f797..2de3144046e58de37e3e1374624300987e83fdba 100644 (file)
}
/* Check for valid input */
- if (!is_uid($this->cn)){
+ if (!tests::is_uid($this->cn)){
$message[]= _("The field 'Name' contains invalid characters. Lowercase, numbers and dashes are allowed.");
}
/* Check ID */
if ($this->force_gid == "1"){
- if (!is_id($this->gidNumber)){
+ if (!tests::is_id($this->gidNumber)){
$message[]= _("Value specified as 'GID' is not valid.");
} else {
if ($this->gidNumber < $this->config->current['MINID']){
diff --git a/gosa-core/plugins/admin/groups/class_groupMail.inc b/gosa-core/plugins/admin/groups/class_groupMail.inc
index b7a2946a4199fbccc210f5f82d53f99a0d492f96..6f07583554e969c4eaf86f5e6ee0c1a0709703a4 100644 (file)
/* Valid email address specified? */
$address= $_POST['forward_address'];
- if (!is_email($address)){
+ if (!tests::is_email($address)){
print_red (_("You're trying to add an invalid email address ".
"to the list of forwarders."));
if (isset($_POST['add_alternate'])){
if ($_POST['alternate_address'] != "" && $this->acl_is_writeable("gosaMailAlternateAddress")){
- if (!is_email($_POST['alternate_address'])){
+ if (!tests::is_email($_POST['alternate_address'])){
print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
} elseif (($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
if ($this->mail == ""){
$message[]= _("The required field 'Primary address' is not set.");
}
- if (!is_email($this->mail)){
+ if (!tests::is_email($this->mail)){
$message[]= _("Please enter a valid email addres in 'Primary address' field.");
}
$ldap->cd($this->config->current['BASE']);
diff --git a/gosa-core/plugins/admin/ogroups/class_mailogroup.inc b/gosa-core/plugins/admin/ogroups/class_mailogroup.inc
index ebf569729927c3df9acd88916b14c7946afe5913..7ab344bbfe49941c7488f3e52b08c3ad7c2437b8 100644 (file)
$ldap= $this->config->get_ldap_link();
/* Check if mail address is valid */
- if (!is_email($this->mail) || $this->mail == ""){
+ if (!tests::is_email($this->mail) || $this->mail == ""){
$message[]= _("Please enter a valid email address in 'Primary address' field.");
}
diff --git a/gosa-core/plugins/admin/systems/class_componentGeneric.inc b/gosa-core/plugins/admin/systems/class_componentGeneric.inc
index 4f2657a69aefe9e410c4fd19aa35194622ee5d65..2772f3501cdd81e2d487476417b394e57c845b85 100644 (file)
}
/* Check if given name is a valid host/dns name */
- if(!is_dns_name($this->cn)){
+ if(!tests::is_dns_name($this->cn)){
$message[] = _("Please specify a valid name for this object.");
}
if($this->netConfigDNS->ipHostNumber == ""){
$message[]= _("The required field IP address is empty.");
} else {
- if (!is_ip($this->netConfigDNS->ipHostNumber)){
+ if (!tests::is_ip($this->netConfigDNS->ipHostNumber)){
$message[]= _("The field IP address contains an invalid address.");
}
}
diff --git a/gosa-core/plugins/admin/systems/class_phoneGeneric.inc b/gosa-core/plugins/admin/systems/class_phoneGeneric.inc
index e3e279c368129ebdd202076f5ae8e60605c4aaa9..3357e5c0bad1fd74da0ae1daea3d31e65335c92e 100644 (file)
if($this->netConfigDNS->ipHostNumber == ""){
$message[]= _("The required field IP address is empty.");
} else {
- if (!is_ip($this->netConfigDNS->ipHostNumber)){
+ if (!tests::is_ip($this->netConfigDNS->ipHostNumber)){
$message[]= _("The field IP address contains an invalid address.");
}
}
/* Check if given name is a valid host/dns name */
- if(!is_dns_name($this->cn) ){
+ if(!tests::is_dns_name($this->cn) ){
$message[] = _("Please specify a valid name for this object.");
}
diff --git a/gosa-core/plugins/admin/systems/class_printGeneric.inc b/gosa-core/plugins/admin/systems/class_printGeneric.inc
index 3020e0d5a245d73ec33b98c63d7d638ecd781395..b2954dc04644e80be21f9e982c6c8fc96bf9c63c 100644 (file)
}
/* must: cn */
- if(($this->BelongsTo == "Printer") && !is_dns_name($this->cn)){
+ if(($this->BelongsTo == "Printer") && !tests::is_dns_name($this->cn)){
$message[]= _("Invalid character in printer name.");
}
diff --git a/gosa-core/plugins/admin/systems/class_servGeneric.inc b/gosa-core/plugins/admin/systems/class_servGeneric.inc
index 4bc47245cc6260131a6afdd0b6bfd82436d97764..c0f1d595cb04bfe6a87209ee0c2f957c56b5911d 100644 (file)
}
/* Check if given name is a valid host/dns name */
- if(!is_dns_name($this->cn)){
+ if(!tests::is_dns_name($this->cn)){
$message[] = _("Please specify a valid name for this object.");
}
diff --git a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc b/gosa-core/plugins/admin/systems/class_terminalGeneric.inc
index 3f3f258fe2d26deef236eeef607e8b22d3e98a59..6782d8fab197a69e0be69c1f4594c01fc089f3ea 100644 (file)
}
/* Check if given name is a valid host/dns name */
- if(!is_dns_name($this->cn) ){
+ if(!tests::is_dns_name($this->cn) ){
$message[] = _("Please specify a valid name for this object.");
}
diff --git a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc b/gosa-core/plugins/admin/systems/class_workstationGeneric.inc
index 1c56e88418ee900b0a5ed514f260be5cb7127896..82658218925f1b38932d74d35cfcc3fe484cb148 100644 (file)
}
/* Check if given name is a valid host/dns name */
- if(!is_dns_name($this->cn)){
+ if(!tests::is_dns_name($this->cn)){
$message[] = _("Please specify a valid name for this object.");
}
diff --git a/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc b/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc
index 1c3ced0659a0a533cf6a1f35d92b19e046b6fe14..146b0e21b26cb15d0727bfc4a1106ecc8dd70176 100644 (file)
}
$tmp= preg_replace('/^[^\s]+\s/', '', $this->options["$key"]);
- if (!is_ip($tmp)){
+ if (!tests::is_ip($tmp)){
$message[]= sprintf(_("Error in definition of '%s'!"), $typ);
}
}
diff --git a/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpPool.inc b/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpPool.inc
index 9e9821e8a6483da3afd8239c28cceacf86ee483a..eae26ddeb5015ec4e3b1eb766d1808d73a80e375 100644 (file)
$message[]= _("Required field 'Range' is not filled.");
}
- if (!is_ip($this->range_start) || !is_ip($this->range_stop)){
+ if (!tests::is_ip($this->range_start) || !tests::is_ip($this->range_stop)){
$message[]= _("Field 'Range' contains invalid IP addresses.");
}
- if(!is_ip_range($this->range_start,$this->range_stop)){
+ if(!tests::is_ip_range($this->range_start,$this->range_stop)){
$message[] = _("Field 'Range' contains invalid IP range.");
}
if ($type == 'dhcpSubnet'){
$network= $cache[$dn]['cn'][0];
$netmask= normalize_netmask($cache[$dn]['dhcpNetMask'][0]);
- if (!is_in_network($network, $netmask, $this->range_start) ||
- !is_in_network($network, $netmask, $this->range_stop)){
+ if (!tests::is_in_network($network, $netmask, $this->range_start) ||
+ !tests::is_in_network($network, $netmask, $this->range_stop)){
$message[] = _("'Range' is not inside the configured network.");
}
}
diff --git a/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpService.inc b/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpService.inc
index 57f76cc9e19f43440605f282931cfdac49ec679c..4989c43fcb8c9737710c6514c12ebae0ab4f602e 100644 (file)
{
$message= array();
- if (!is_id($this->statements['default-lease-time'])){
+ if (!tests::is_id($this->statements['default-lease-time'])){
$message[]= _('Default lease time needs to be numeric.');
}
- if (!is_id($this->statements['max-lease-time'])){
+ if (!tests::is_id($this->statements['max-lease-time'])){
$message[]= _('Maximum lease time needs to be numeric.');
}
if ($this->statements['default-lease-time'] > $this->statements['max-lease-time']){
diff --git a/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc b/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc
index 6e55b75d6b7ad9cb7bd11554db66803eb9f7d02f..5dfd47703c737bc58984ef467c6546f78bd461fb 100644 (file)
"max-lease-time" => _("Max. lease time"),
"min-lease-time" => _("Min. lease time")) as $key => $val){
if (isset($this->statements[$key]) && $this->statements[$key] != "" &&
- !is_id($this->statements[$key])){
+ !tests::is_id($this->statements[$key])){
$message[]= sprintf(_("The value specified as '%s' is not numeric!"), $val);
}
}
diff --git a/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc b/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc
index 8c2da41dea46fbbef28c1e17dcc55ca3c53c0443..7fa9e9823af0f8032a8218b53ea95c43cf5ce7cc 100644 (file)
/* IP's? */
foreach(array('dhcpNetMask' => _("Netmask"), 'cn' => _("Network address"), 'range_start' => _("Range"), 'range_stop' => _("Range")) as $attr => $str){
- if ($this->$attr != "" && !is_ip($this->$attr)){
+ if ($this->$attr != "" && !tests::is_ip($this->$attr)){
$message[]= sprintf(_("The field '%s' contains an invalid IP address"), $str);
}
}
/* Check ip range */
if ($this->use_range){
- if(!is_ip_range($this->range_start,$this->range_stop)){
+ if(!tests::is_ip_range($this->range_start,$this->range_stop)){
$message[] = _("Field 'Range' contains invalid IP range.");
}
/* Check if range is in the network */
- if (!is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
- !is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
+ if (!tests::is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
+ !tests::is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
$message[] = _("'Range' is not inside the configured network.");
}
}
diff --git a/gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZone.inc b/gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZone.inc
index d5df0871d9bbbb912ec1699716255342ccb2b451..c9ecd96df076a911c26664bf1f230bf139427224 100644 (file)
$addr = preg_replace("/^[^\/]*+\//","",$this->ReverseZone);
/* Check for valid&complete IP address */
- if(!is_ip($addr)){
+ if(!tests::is_ip($addr)){
$message[] = _("The given network address is not a valid, please specify a valid IP address.");
}
foreach(array("sOAprimary","zoneName","sOAmail") as $attr){
if(!preg_match("/\.$/",$ret[$attr])){
- if(!is_ip($ret[$attr])){
+ if(!tests::is_ip($ret[$attr])){
$ret[$attr] = $ret[$attr].".";
}
}
diff --git a/gosa-core/plugins/admin/systems/services/dns/class_termDNS.inc b/gosa-core/plugins/admin/systems/services/dns/class_termDNS.inc
index f64650f26ffe0085e17a383db591e3b6bf14b203..48c1918526218569235baaf5954472bb1a472a3e 100644 (file)
$message[]= _("The required field 'IP-address' is not set.");
}
- if (!is_ip($this->ipHostNumber)){
+ if (!tests::is_ip($this->ipHostNumber)){
$message[]= _("Wrong IP format in field IP-address.");
}
}
if ($this->macAddress == "" ){
$message[]= _("The required field 'MAC-address' is not set.");
}
- if(!is_mac($this->macAddress)){
+ if(!tests::is_mac($this->macAddress)){
$message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
}
diff --git a/gosa-core/plugins/admin/systems/services/kolab/class_servKolab.inc b/gosa-core/plugins/admin/systems/services/kolab/class_servKolab.inc
index 7d31ff58d59401b212e4a50ef541403176f1f753..08b75ea862c581759ff2a5f0444b6e52073fb055 100644 (file)
if(($this->kolabFreeBusyFuture=="")) {
$message[] = _("Future days in Free/Busy settings must be set.");
- }elseif(!is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){
+ }elseif(!tests::is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){
$message[] = _("Future days in Free/Busy settings must be a positive value.");
}
diff --git a/gosa-core/plugins/admin/systems/services/mail/class_goMailServer.inc b/gosa-core/plugins/admin/systems/services/mail/class_goMailServer.inc
index 742249ef717c404495f051d6d5ae136840e6f031..9180cfa542173d3ce6b1e84758c0b788a7660294 100644 (file)
$port = trim($tmp[1]);
$ip = trim($tmp[0]);
- if((is_ip($ip)) && (is_numeric($port))){
+ if((tests::is_ip($ip)) && (is_numeric($port))){
$dst = "[".$ip."]:".$port;
}
}
- if(is_ip($dst)){
+ if(tests::is_ip($dst)){
$dst = "[".$dst."]";
}
$tmp2 ['src'] = $src;
diff --git a/gosa-core/plugins/admin/systems/services/spam/class_goSpamServer.inc b/gosa-core/plugins/admin/systems/services/spam/class_goSpamServer.inc
index 82ff0fbaf84809b7c95f5887010139e86307f258..68c04e043a08dc79b5747af1954a72aa87f415ec 100644 (file)
function AddTrust($post)
{
if(!empty($post)){
- if(is_ip($post) || is_domain($post) || (is_ip_with_subnetmask($post))){
+ if(tests::is_ip($post) || tests::is_domain($post) || (tests::is_ip_with_subnetmask($post))){
$this->TrustedNetworks[$post] = $post;
}else{
print_red(_("Specified value is not a valid 'trusted network' value."));
diff --git a/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc b/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc
index 15c4c00caf1dc9856c56497e5f9d869554775a96..a6dab5936b691482150028ed75936fceb4c387e9 100644 (file)
/* Handle interactions: add */
if (isset($_POST['add_number']) && $_POST['number'] != ""){
- if (is_phone_nr($_POST['number']) || preg_match ("/^[\/0-9 ()\^\.\$+*-]+$/",$_POST['number'])){
+ if (tests::is_phone_nr($_POST['number']) || preg_match ("/^[\/0-9 ()\^\.\$+*-]+$/",$_POST['number'])){
$this->addNumber ($_POST['number']);
} else {
print_red (_("Please specify a valid phone number."));
if ($this->cn == ""){
$message[]= _("Required field 'Name' is not set.");
} else {
- if (!is_uid($this->cn)){
+ if (!tests::is_uid($this->cn)){
$message[]= _("Required field 'Name' contains invalid characters");
}
if ($this->dn == 'new'){
diff --git a/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc b/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc
index f1b18145ad90dcef625b47744632128b4254b267..63f22cee6057f5290813c78acabf700fe59a1154 100644 (file)
}
/* Add alternatives */
- if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && is_phone_nr($_POST['forward_address'])){
+ if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && tests::is_phone_nr($_POST['forward_address'])){
if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
$this->addAlternate($_POST['forward_address']);
}
/* Add number to blocklist (dialog) */
if (isset($_POST['add_blocklist_number']) && $_POST['block_number'] != ""){
- if (!is_phone_nr($_POST['block_number'])){
+ if (!tests::is_phone_nr($_POST['block_number'])){
print_red (_("You're trying to add an invalid phone number."));
} else {
array_push($this->current_blocklist, $_POST['block_number']);
$this->goFaxRBlockgroups = array();
foreach ($this->current_blocklist as $val){
- if (is_phone_nr($val)){
+ if (tests::is_phone_nr($val)){
$this->goFaxRBlocklist[]=$val;
} else {
$this->goFaxRBlockgroups[]= $val;
/* Transfer values to ourself */
foreach ($this->current_blocklist as $val){
- if (is_phone_nr($val)){
+ if (tests::is_phone_nr($val)){
$this->goFaxSBlocklist[]=$val;
} else {
$this->goFaxSBlockgroups[]= $val;
$message[]= _("The required field 'Fax' is not set.");
}
- if (!is_phone_nr($this->facsimileTelephoneNumber)){
+ if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
$message[]= _("Please enter a valid telephone number in the 'Fax' field.");
}
$this->goFaxDeliveryMode & 32){
if ($this->mail == ""){
$message[]= _("Mail delivery is checked, but no address has been specified.");
- } elseif (!is_email($this->mail)){
+ } elseif (!tests::is_email($this->mail)){
$message[]= _("The mail address you've entered is invalid.");
}
}
diff --git a/gosa-core/plugins/gofon/phoneaccount/class_phoneAccount.inc b/gosa-core/plugins/gofon/phoneaccount/class_phoneAccount.inc
index 84c0e037eecb9f88846523d589ae121c921cc916..a247dec96420cf9c8b7cfa53f170ed8e8919665d 100644 (file)
/* Add phone number */
if (isset($_POST["add_phonenumber"]) && $_POST['phonenumber']){
- if (is_phone_nr($_POST['phonenumber'])){
+ if (tests::is_phone_nr($_POST['phonenumber'])){
$number= $_POST["phonenumber"];
$this->phoneNumbers[$number]= $number;
$this->is_modified= TRUE;
diff --git a/gosa-core/plugins/personal/connectivity/class_kolabAccount.inc b/gosa-core/plugins/personal/connectivity/class_kolabAccount.inc
index ddf92a8895e1feb4d268ddd8fc36532cfb104c33..1ff95fe53e019759375601fa3b15b360aa9c0d00 100644 (file)
/* Valid email address specified? */
$address= $_POST['delegate_address'];
$valid= FALSE;
- if (!is_email($address)){
- if (!is_email($address, TRUE)){
+ if (!tests::is_email($address)){
+ if (!tests::is_email($address, TRUE)){
print_red (_("You're trying to add an invalid email address to the list of delegations."));
}
} else {
}
$address= preg_replace('/^([^:]+).*$/', '\1', $policy);
- if (!is_email($address)){
- if (!is_email($address, TRUE)){
+ if (!tests::is_email($address)){
+ if (!tests::is_email($address, TRUE)){
$message[]= sprintf(_("The invitation policy entry for address '%s' is not valid."), $address);
}
} else {
diff --git a/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc b/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc
index dbcf2eba24da61a133f432f098598ae81b81e998..ad2cba40b74a5cc7ab296a78115c09bfbc936e25 100644 (file)
/* Check for positive integer values */
if ($this->is_account){
- if($this->acl_is_writeable("FTPUploadBandwidth") && !is_id($this->FTPUploadBandwidth)){
+ if($this->acl_is_writeable("FTPUploadBandwidth") && !tests::is_id($this->FTPUploadBandwidth)){
$message[]= _("Value specified as 'Upload bandwidth' is not valid.");
}
- if($this->acl_is_writeable("FTPDownloadBandwidth") && !is_id($this->FTPDownloadBandwidth)){
+ if($this->acl_is_writeable("FTPDownloadBandwidth") && !tests::is_id($this->FTPDownloadBandwidth)){
$message[]= _("Value specified as 'Download bandwidth' is not valid.");
}
- if($this->acl_is_writeable("FTPQuotaFiles") && !is_id($this->FTPQuotaFiles)){
+ if($this->acl_is_writeable("FTPQuotaFiles") && !tests::is_id($this->FTPQuotaFiles)){
$message[]= _("Value specified as 'Quota files' is not valid.");
}
- if($this->acl_is_writeable("FTPQuotaMBytes") && !is_id($this->FTPQuotaMBytes)){
+ if($this->acl_is_writeable("FTPQuotaMBytes") && !tests::is_id($this->FTPQuotaMBytes)){
$message[]= _("Value specified as 'Quota size' is not valid.");
}
- if($this->acl_is_writeable("FTPUploadRatio") && !is_id($this->FTPUploadRatio)){
+ if($this->acl_is_writeable("FTPUploadRatio") && !tests::is_id($this->FTPUploadRatio)){
$message[]= _("Value specified as 'Upload ratio' is not valid.");
}
- if($this->acl_is_writeable("FTPDownloadRatio") && !is_id($this->FTPDownloadRatio)){
+ if($this->acl_is_writeable("FTPDownloadRatio") && !tests::is_id($this->FTPDownloadRatio)){
$message[]= _("Value specified as 'Download ratio' is not valid.");
}
}
diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc
index 15f8921c74e6eac32f6e7c318efbe03a4b92e5f7..e1904c07a5661858e9d752fe17f07c295874f572 100644 (file)
if (isset($_POST["certificateSerialNumber"]) &&
$_POST["certificateSerialNumber"] != ""){
- if (!is_id($_POST["certificateSerialNumber"])){
+ if (!tests::is_id($_POST["certificateSerialNumber"])){
print_red (_("Please enter a valid serial number"));
foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
}
/* Check for valid input */
- if ($this->is_modified && !is_uid($this->uid)){
+ if ($this->is_modified && !tests::is_uid($this->uid)){
$message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
}
- if (!is_url($this->labeledURI)){
+ if (!tests::is_url($this->labeledURI)){
$message[]= _("The field 'Homepage' contains an invalid URL definition.");
}
if (preg_match ("/[\\\\]/", $this->sn)){
}
/* Check phone numbers */
- if (!is_phone_nr($this->telephoneNumber)){
+ if (!tests::is_phone_nr($this->telephoneNumber)){
$message[]= _("The field 'Phone' contains an invalid phone number.");
}
- if (!is_phone_nr($this->facsimileTelephoneNumber)){
+ if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
$message[]= _("The field 'Fax' contains an invalid phone number.");
}
- if (!is_phone_nr($this->mobile)){
+ if (!tests::is_phone_nr($this->mobile)){
$message[]= _("The field 'Mobile' contains an invalid phone number.");
}
- if (!is_phone_nr($this->pager)){
+ if (!tests::is_phone_nr($this->pager)){
$message[]= _("The field 'Pager' contains an invalid phone number.");
}
if($this->dn == "new") {
$this->set_acl_base($this->base);
}
- if (!is_url($this->labeledURI) && in_array("labeledURI",$this->multi_boxes)){
+ if (!tests::is_url($this->labeledURI) && in_array("labeledURI",$this->multi_boxes)){
$message[]= _("The field 'Homepage' contains an invalid URL definition.");
}
if (preg_match ("/[\\\\]/", $this->sn) && in_array("sn",$this->multi_boxes)){
if (preg_match ("/[\\\\]/", $this->givenName) && in_array("givenName",$this->multi_boxes)){
$message[]= _("The field 'Given name' contains invalid characters.");
}
- if (!is_phone_nr($this->telephoneNumber) && in_array("telephoneNumber",$this->multi_boxes)){
+ if (!tests::is_phone_nr($this->telephoneNumber) && in_array("telephoneNumber",$this->multi_boxes)){
$message[]= _("The field 'Phone' contains an invalid phone number.");
}
- if (!is_phone_nr($this->facsimileTelephoneNumber) && in_array("facsimileTelephoneNumber",$this->multi_boxes)){
+ if (!tests::is_phone_nr($this->facsimileTelephoneNumber) && in_array("facsimileTelephoneNumber",$this->multi_boxes)){
$message[]= _("The field 'Fax' contains an invalid phone number.");
}
- if (!is_phone_nr($this->mobile) && in_array("mobile",$this->multi_boxes)){
+ if (!tests::is_phone_nr($this->mobile) && in_array("mobile",$this->multi_boxes)){
$message[]= _("The field 'Mobile' contains an invalid phone number.");
}
- if (!is_phone_nr($this->pager) && in_array("pager",$this->multi_boxes)){
+ if (!tests::is_phone_nr($this->pager) && in_array("pager",$this->multi_boxes)){
$message[]= _("The field 'Pager' contains an invalid phone number.");
}
if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName) && in_array("givenName",$this->multi_boxes)){
diff --git a/gosa-core/plugins/personal/mail/class_mailAccount.inc b/gosa-core/plugins/personal/mail/class_mailAccount.inc
index 6df2ca7112e4f45f9726a7659783ef167b4a1683..1bdd4cefb878cd7b702092ff1ec9544e31b28cd6 100644 (file)
/* Valid email address specified? */
$address= $_POST['forward_address'];
$valid= FALSE;
- if (!is_email($address)){
- if (!is_email($address, TRUE)){
+ if (!tests::is_email($address)){
+ if (!tests::is_email($address, TRUE)){
if ($this->is_template){
$valid= TRUE;
} else {
if (isset($_POST['add_alternate'])){
$valid= FALSE;
- if (!is_email($_POST['alternate_address'])){
+ if (!tests::is_email($_POST['alternate_address'])){
if ($this->is_template){
- if (!(is_email($_POST['alternate_address'], TRUE))){
+ if (!(tests::is_email($_POST['alternate_address'], TRUE))){
print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
} else {
$valid= TRUE;
$message[]= _("The required field 'Primary address' is not set.");
}
if ($this->is_template){
- if (!is_email($this->mail, TRUE)){
+ if (!tests::is_email($this->mail, TRUE)){
$message[]= _("Please enter a valid email address in 'Primary address' field.");
}
} else {
- if (!is_email($this->mail)){
+ if (!tests::is_email($this->mail)){
$message[]= _("Please enter a valid email address in 'Primary address' field.");
}
}
diff --git a/gosa-core/plugins/personal/nagios/class_nagiosAccount.inc b/gosa-core/plugins/personal/nagios/class_nagiosAccount.inc
index 66625e213e24793d91e537d8c9bda2c340249bcf..153f73cd373e69d38aca8c3e7b8bda9b907c7095 100644 (file)
$message[]= _("The required field 'NagiosMail' is not set.");
}
if ($this->is_template){
- if (!is_email($this->NagiosMail, TRUE)){
+ if (!tests::is_email($this->NagiosMail, TRUE)){
$message[]= _("Please enter a valid email address in 'NagiosMail' field.");
}
} else {
- if (!is_email($this->NagiosMail)){
+ if (!tests::is_email($this->NagiosMail)){
$message[]= _("Please enter a valid email address in 'NagiosMail' field.");
}
}
diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc
index 63fabf0019ad5e7c08ccc9a66fc376568e54e8ad..9b0aeccc68fdcfa69735034f252eacbc847d73fc 100644 (file)
if ($this->homeDirectory == ""){
$message[]= _("The required field 'Home directory' is not set.");
}
- if (!is_path($this->homeDirectory)){
+ if (!tests::is_path($this->homeDirectory)){
$message[]= _("Please enter a valid path in 'Home directory' field.");
}
if ($this->force_ids == "1"){
/* Valid uid/gid? */
- if (!is_id($this->uidNumber)){
+ if (!tests::is_id($this->uidNumber)){
$message[]= _("Value specified as 'UID' is not valid.");
} else {
if ($this->uidNumber < $this->config->current['MINID']){
$message[]= _("Value specified as 'UID' is too small.");
}
}
- if (!is_id($this->gidNumber)){
+ if (!tests::is_id($this->gidNumber)){
$message[]= _("Value specified as 'GID' is not valid.");
} else {
if ($this->gidNumber < $this->config->current['MINID']){
/* Check shadow settings, well I like spaghetties... */
if ($this->activate_shadowMin){
- if (!is_id($this->shadowMin)){
+ if (!tests::is_id($this->shadowMin)){
$message[]= _("Value specified as 'shadowMin' is not valid.");
}
}
if ($this->activate_shadowMax){
- if (!is_id($this->shadowMax)){
+ if (!tests::is_id($this->shadowMax)){
$message[]= _("Value specified as 'shadowMax' is not valid.");
}
}
if ($this->activate_shadowWarning){
- if (!is_id($this->shadowWarning)){
+ if (!tests::is_id($this->shadowWarning)){
$message[]= _("Value specified as 'shadowWarning' is not valid.");
}
if (!$this->activate_shadowMax){
}
}
if ($this->activate_shadowInactive){
- if (!is_id($this->shadowInactive)){
+ if (!tests::is_id($this->shadowInactive)){
$message[]= _("Value specified as 'shadowInactive' is not valid.");
}
if (!$this->activate_shadowMax){
if ($this->homeDirectory == "" && in_array("homeDirectory",$this->multi_boxes)){
$message[]= _("The required field 'Home directory' is not set.");
}
- if (!is_path($this->homeDirectory) && in_array("homeDirectory",$this->multi_boxes)){
+ if (!tests::is_path($this->homeDirectory) && in_array("homeDirectory",$this->multi_boxes)){
$message[]= _("Please enter a valid path in 'Home directory' field.");
}
/* Check shadow settings, well I like spaghetties... */
if ($this->activate_shadowMin && in_array("activate_shadowMin",$this->multi_boxes)){
- if (!is_id($this->shadowMin)){
+ if (!tests::is_id($this->shadowMin)){
$message[]= _("Value specified as 'shadowMin' is not valid.");
}
}
if ($this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
- if (!is_id($this->shadowMax)){
+ if (!tests::is_id($this->shadowMax)){
$message[]= _("Value specified as 'shadowMax' is not valid.");
}
}
if ($this->activate_shadowWarning && in_array("activate_shadowWarning",$this->multi_boxes)){
- if (!is_id($this->shadowWarning)){
+ if (!tests::is_id($this->shadowWarning)){
$message[]= _("Value specified as 'shadowWarning' is not valid.");
}
if (!$this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
}
}
if ($this->activate_shadowInactive && in_array("activate_shadowInactive",$this->multi_boxes)){
- if (!is_id($this->shadowInactive)){
+ if (!tests::is_id($this->shadowInactive)){
$message[]= _("Value specified as 'shadowInactive' is not valid.");
}
if (!$this->activate_shadowMax && in_array("activate_shadowMax",$this->multi_boxes)){
diff --git a/gosa-core/plugins/personal/samba/class_sambaAccount.inc b/gosa-core/plugins/personal/samba/class_sambaAccount.inc
index 1ca0fc5c184fc050444a8cf0cfa6f7dde4c647be..fc93c9c76f645d3c65c500b9cb55ddd0808675f8 100644 (file)
"CtxMaxDisconnectionTime" => _("Disconnection"),
"CtxMaxIdleTime" => _("IDLE")) as $key => $val){
- if (isset($this->mungedObject->ctx[$key]) && !is_id($this->mungedObject->ctx[$key]) && $val != 0){
+ if (isset($this->mungedObject->ctx[$key]) && !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
$message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
}
}
"CtxMaxIdleTime" => _("IDLE")) as $key => $val){
if (in_array($key,$this->multi_boxes) &&
isset($this->mungedObject->ctx[$key]) &&
- !is_id($this->mungedObject->ctx[$key]) && $val != 0){
+ !tests::is_id($this->mungedObject->ctx[$key]) && $val != 0){
$message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
}
}
diff --git a/gosa-core/plugins/personal/scalix/class_scalixAccount.inc b/gosa-core/plugins/personal/scalix/class_scalixAccount.inc
index 2d85f0d889116ea31f3f3ece160904cdf6668d91..39b99f59ad61d8fa8c4c36ce6732c8b0e99d3bee 100644 (file)
$valid= FALSE;
/* Valid mail address */
- if( ($this->is_template && !is_email($_POST['email_address'], TRUE)) ||
- (!$this->is_template && !is_email($_POST['email_address'])) ){
+ if( ($this->is_template && !tests::is_email($_POST['email_address'], TRUE)) ||
+ (!$this->is_template && !tests::is_email($_POST['email_address'])) ){
print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
}else{
$valid = TRUE;
diff --git a/gosa-core/setup/class_setupStep_Feedback.inc b/gosa-core/setup/class_setupStep_Feedback.inc
index 514b6e79fdfab635d812c57d0ad69ad40f69b154..3243a770dfd88b5e93dd03d92eb53f521a8edcd0 100644 (file)
function check_feedback()
{
$msgs = array();
- if(!is_email($this->eMail) || empty($this->eMail)){
+ if(!tests::is_email($this->eMail) || empty($this->eMail)){
$msgs[] = _("Please specify a valid email address.");
}
diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc
index a979ba25603bd43c61fc5818198d7c5d4210a4df..16dbf8a276157e022832ad8d7632131a2d506e95 100644 (file)
return false;
}
- if(!is_uid($uid) || empty($uid)){
+ if(!tests::is_uid($uid) || empty($uid)){
msg_dialog::display(_("Input error"), _("Specify a valid user ID!"), ERROR_DIALOG);
return false;
}