summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0faedc)
raw | patch | inline | side by side (parent: c0faedc)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Jan 2010 09:50:38 +0000 (09:50 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Jan 2010 09:50:38 +0000 (09:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15303 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-core/include/utils/class_tests.inc | patch | blob | history |
diff --git a/trunk/gosa-core/include/utils/class_tests.inc b/trunk/gosa-core/include/utils/class_tests.inc
index 136dca87ab87c2b393447d2f8f6a5801a04f0673..2f1d0b05cada8039c64bc22a1d0ae05e6484c2a1 100644 (file)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+/*! \brief Test functions
+ *
+ * This class provides various test functions. It enables to check
+ * if a given value is:
+ *
+ * - a phone numnber
+ * - a DNS name
+ * - an URL
+ * etc.
+ *
+ * The functions need to be handled with care, because they are not as strict
+ * as one might expect.
+ */
class tests {
+
+ /*! \brief Test if the given string is a phone number */
public static function is_phone_nr($nr)
{
if ($nr == ""){
}
+ /*! \brief Test if the given string contains characters allowed in a DNS name */
public static function is_dns_name($str)
{
return(preg_match("/^[a-z0-9\.\-]*$/i",$str));
}
+ /*! \brief Test if the given string is an URL */
public static function is_url($url)
{
if ($url == ""){
}
+ /*! \brief Test if the given string is a DN */
public static function is_dn($dn)
{
if ($dn == ""){
}
+ /*! \brief Test if the given string is an uid */
public static function is_uid($uid)
{
if ($uid == ""){
}
+ /*! \brief Test if the given string is an IP */
public static 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);
}
+ /*! \brief Test if the given string is a mac address */
public static 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
+ /*! \brief Checks if the given ip address dosen't match
"is_ip" because there is also a sub net mask given */
public static function is_ip_with_subnetmask($ip)
{
}
- /* Simple is domain check, it checks if the given string looks like "string(...).string" */
+ /*! \brief Simple is domain check
+ *
+ * This checks if the given string looks like "string(...).string"
+ */
public static function is_domain($str)
{
return(preg_match("/^([a-z0-9\-]*)\.[a-z0-9\-]*$/i",$str));
}
+ /*! \brief Check if the given argument is an id */
public static function is_id($id)
{
if ($id == ""){
}
+ /*! \brief Check if the given argument is a path */
public static function is_path($path)
{
if ($path == ""){
}
+ /*! \brief Check if the given argument is an email */
public static function is_email($address, $template= FALSE)
{
if ($address == ""){
}
- /* Check if the given department name is valid */
+ /* \brief Check if the given department name is valid */
public static function is_department_name_reserved($name,$base)
{
$reservedName = array("systems","apps","incomming","internal","accounts","fax","addressbook",
}
- /* Check if $ip1 and $ip2 represents a valid IP range
- * returns TRUE in case of a valid range, FALSE in case of an error.
+ /* \brief Check if $ip1 and $ip2 represents a valid IP range
+ * \return TRUE in case of a valid range, FALSE in case of an error.
*/
public static function is_ip_range($ip1,$ip2)
{
}
- /* Check if the specified IP address $address is inside the given network */
+ /* \brief Check if the specified IP address $address is inside the given network */
public static function is_in_network($network, $netmask, $address)
{
$nw= split('\.', $network);
}
- /* Check if the specified IP address $address is inside the given network */
+ /* \brief Check if the specified IP address $address is inside the given network */
public static function is_in_ip_range($from, $to, $address)
{
$from = split('\.', $from);