summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Dörre <felix@dogcraft.de>2015-01-20 21:27:55 +0100
committerBenny Baumann <BenBE@geshi.org>2015-01-20 21:43:43 +0100
commit41ace6dc77532a5d982af220e14a29714e0ab34b (patch)
tree11c46e571878c54f5933dd1b4cb8c279b0511b86
parent88de5d85640962e8b0b0df14bcc5801a8858ffd4 (diff)
downloadcacert-devel-41ace6dc77532a5d982af220e14a29714e0ab34b.tar.gz
cacert-devel-41ace6dc77532a5d982af220e14a29714e0ab34b.tar.xz
cacert-devel-41ace6dc77532a5d982af220e14a29714e0ab34b.zip
bug 1354: Fetch UTF8 names from database for gpg name checks.
-rw-r--r--www/gpg.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/www/gpg.php b/www/gpg.php
index 5a73e32..b3a4787 100644
--- a/www/gpg.php
+++ b/www/gpg.php
@@ -455,15 +455,20 @@ function verifyName($name)
{
if($name == "") return 0;
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['lname'])) return 1; // John Doe
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname'])) return 1; // John Joseph Doe
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname'][0]." ".$_SESSION['profile']['lname'])) return 1; // John J Doe
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname'][0].". ".$_SESSION['profile']['lname'])) return 1; // John J. Doe
-
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'])) return 1; // John Doe Jr.
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'])) return 1; //John Joseph Doe Jr.
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname'][0]." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'])) return 1; //John J Doe Jr.
- if(compareName($name, $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname'][0].". ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'])) return 1; //John J. Doe Jr.
+ $q = mysql_query("SELECT CONVERT(fname USING UTF8), CONVERT(mname USING UTF8), CONVERT(lname USING UTF8), CONVERT(suffix USING UTF8) FROM users WHERE id='" . intval($_SESSION["profile"]["id"]) . "'");
+ if( false === ($row = mysql_fetch_assoc($q)) ) {
+ return 0;
+ }
+
+ if(compareName($name, $row['fname']." ".$row['lname'])) return 1; // John Doe
+ if(compareName($name, $row['fname']." ".$row['mname']." ".$row['lname'])) return 1; // John Joseph Doe
+ if(compareName($name, $row['fname']." ".$row['mname'][0]." ".$row['lname'])) return 1; // John J Doe
+ if(compareName($name, $row['fname']." ".$row['mname'][0].". ".$row['lname'])) return 1; // John J. Doe
+
+ if(compareName($name, $row['fname']." ".$row['lname']." ".$row['suffix'])) return 1; // John Doe Jr.
+ if(compareName($name, $row['fname']." ".$row['mname']." ".$row['lname']." ".$row['suffix'])) return 1; //John Joseph Doe Jr.
+ if(compareName($name, $row['fname']." ".$row['mname'][0]." ".$row['lname']." ".$row['suffix'])) return 1; //John J Doe Jr.
+ if(compareName($name, $row['fname']." ".$row['mname'][0].". ".$row['lname']." ".$row['suffix'])) return 1; //John J. Doe Jr.
return 0;
}