summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af2db7e)
raw | patch | inline | side by side (parent: af2db7e)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Jun 2005 11:45:43 +0000 (11:45 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Jun 2005 11:45:43 +0000 (11:45 +0000) |
plugins/personal/generic/class_user.inc | patch | blob | history |
index b4ae7f07b0f00dc6f6db8fe6f55249a05d1466ea..ab8d5d69d9c57cf60bb9e5ad9053ecf43165f8d1 100644 (file)
/* for all certificates do */
foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
as $val){
-
+
/* Check for clean upload */
- if (defined($val) && $val != '' &&
- preg_match('/\s+/', $_FILES[$val."_file"]['name']) &&
+ if (array_key_exists($val."_file", $_FILES) &&
+ array_key_exists('name', $_FILES[$val."_file"]) &&
+ $_FILES[$val."_file"]['name'] != "" &&
is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
-
$this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
}
}
/* Check for reserved characers */
if (preg_match ('/[,+"<>;]/', $this->givenName)){
$message[]= _("The field 'Given name' contains invalid characters.");
- }
- if (preg_match ('/[,+"<>;]/', $this->sn)){
- $message[]= _("The field 'Name' contains invalid characters.");
- }
+ }
+ if (preg_match ('/[,+"<>;]/', $this->sn)){
+ $message[]= _("The field 'Name' contains invalid characters.");
+ }
- return $message;
+ return $message;
}
/* Load certificate from file to object */
function set_cert($cert, $filename)
{
- if($fd = fopen ($filename, "rb")) {
+ $fd = fopen ($filename, "rb");
+ if (filesize($filename)>0) {
$this->$cert= fread ($fd, filesize ($filename));
fclose ($fd);
$this->is_modified= TRUE;
} else {
- print_red(_("Cannot open the specified file!"));
+ print_red(_("Could not open specified certificate!"));
}
}