summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9632eb)
raw | patch | inline | side by side (parent: b9632eb)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Jun 2005 11:11:13 +0000 (11:11 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Jun 2005 11:11:13 +0000 (11:11 +0000) |
plugins/personal/generic/class_user.inc | patch | blob | history |
index 2639f958572849c2155b9f366b8d808000947fa1..b4ae7f07b0f00dc6f6db8fe6f55249a05d1466ea 100644 (file)
/* for all certificates do */
foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
as $val){
-
+
/* Check for clean upload */
- if ($_FILES[$val."_file"]['name'] != "" &&
+ if (defined($val) && $val != '' &&
+ preg_match('/\s+/', $_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)
{
- $fd = fopen ($filename, "rb");
- $this->$cert= fread ($fd, filesize ($filename));
- fclose ($fd);
- $this->is_modified= TRUE;
+ if($fd = fopen ($filename, "rb")) {
+ $this->$cert= fread ($fd, filesize ($filename));
+ fclose ($fd);
+ $this->is_modified= TRUE;
+ } else {
+ print_red(_("Cannot open the specified file!"));
+ }
}
/* Adapt from given 'dn' */