= 1577833200); // 2020-01-01 - date of birth of this soft } public static function description($comment) { if (preg_match("/^[\p{L}0-9\p{P}\p{Zs}\p{Zl}\p{Sc}\=\+]+$/uim", $comment)) return true; return false; } public static function email($value, $domain=NULL, $checkDns=true) { $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/'; if (!preg_match($regex, $value)) { return false; } $nd = explode('@', $value); $nd=$nd[1]; if ($domain) { if(is_array($domain)) { if (!in_array($nd,$domain)) { return false; } } else { if($nd!=$domain) { return false; } } } if ($checkDns && function_exists('checkdnsrr')) { if (!(checkdnsrr($nd, 'MX') || checkdnsrr($nd, 'A'))) { return false; } } return true; } public static function is_empty($val) { switch(gettype($val)) { case "boolean": case "integer": case "double": case "object": case "resource": return False; case "array": case "string": if ($val == "0") return false; return empty($val); case "NULL": return True; } } } # vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab