"hex2bin function"
This commit is contained in:
Mendel Mobach 2014-04-18 08:10:17 +00:00
parent 772c4b577b
commit 365a7272cf
4 changed files with 12 additions and 12 deletions

View file

@ -506,7 +506,7 @@
return(0); return(0);
} }
function hex2bin($data) function gpg_hex2bin($data)
{ {
while(strstr($data, "\\x")) while(strstr($data, "\\x"))
{ {

View file

@ -144,7 +144,7 @@ GETTEXT_FILE_PATTERN := \
../pages/*/*.php \ ../pages/*/*.php \
../scripts/*.php \ ../scripts/*.php \
../www/*.php \ ../www/*.php \
../www/*/*.php \ ../www/[a-z]*/*.php \
# ../tverify/*.php \ # ../tverify/*.php \
# ../tverify/*/*.php \ # ../tverify/*/*.php \

View file

@ -18,7 +18,7 @@
require_once("../includes/mysql.php"); //general.php"); require_once("../includes/mysql.php"); //general.php");
//include "../includes/general.php"; //include "../includes/general.php";
function hex2bin($data) function gpg_hex2bin($data)
{ {
while(strstr($data, "\\x")) while(strstr($data, "\\x"))
{ {
@ -69,7 +69,7 @@ echo "Found:\n";
if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match)) if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match))
{ {
//echo "Found: ".$match[1]; //echo "Found: ".$match[1];
$mail = trim(hex2bin($match[1])); $mail = trim(gpg_hex2bin($match[1]));
echo "EMail: *$mail**\n"; echo "EMail: *$mail**\n";

View file

@ -187,18 +187,18 @@ function verifyEmail($email)
// Name (Comment) <Email> // Name (Comment) <Email>
if(preg_match("/^([^\(\)\[@<>]+) \(([^\(\)@<>]*)\) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches)) if(preg_match("/^([^\(\)\[@<>]+) \(([^\(\)@<>]*)\) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches))
{ {
$name=trim(hex2bin($matches[1])); $name=trim(gpg_hex2bin($matches[1]));
$nocomment=0; $nocomment=0;
$comm=trim(hex2bin($matches[2])); $comm=trim(gpg_hex2bin($matches[2]));
$mail=trim(hex2bin($matches[3])); $mail=trim(gpg_hex2bin($matches[3]));
} }
// Name <EMail> // Name <EMail>
elseif(preg_match("/^([^\(\)\[@<>]+) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches)) elseif(preg_match("/^([^\(\)\[@<>]+) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches))
{ {
$name=trim(hex2bin($matches[1])); $name=trim(gpg_hex2bin($matches[1]));
$nocomment=1; $nocomment=1;
$comm=""; $comm="";
$mail=trim(hex2bin($matches[2])); $mail=trim(gpg_hex2bin($matches[2]));
} }
// Unrecognized format // Unrecognized format
else else
@ -357,13 +357,13 @@ function verifyEmail($email)
$pos = strlen($bits[9]); $pos = strlen($bits[9]);
} }
$name = trim(hex2bin(trim(substr($bits[9], 0, $pos)))); $name = trim(gpg_hex2bin(trim(substr($bits[9], 0, $pos))));
$nameok=verifyName($name); $nameok=verifyName($name);
if($nocomment == 0) if($nocomment == 0)
{ {
$pos += 2; $pos += 2;
$pos2 = strpos($bits[9], ")"); $pos2 = strpos($bits[9], ")");
$comm = trim(hex2bin(trim(substr($bits[9], $pos, $pos2 - $pos)))); $comm = trim(gpg_hex2bin(trim(substr($bits[9], $pos, $pos2 - $pos))));
if($comm != "") if($comm != "")
$comment[] = $comm; $comment[] = $comm;
$pos = $pos2 + 3; $pos = $pos2 + 3;
@ -374,7 +374,7 @@ function verifyEmail($email)
$mail=""; $mail="";
if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match)) { if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match)) {
//echo "Found: ".$match[1]; //echo "Found: ".$match[1];
$mail = trim(hex2bin($match[1])); $mail = trim(gpg_hex2bin($match[1]));
} }
else else
{ {