Code

We're html5, right?
[gosa.git] / gosa-core / include / class_certificate.inc
index f7e784d5f6c5484640b9aa5f7f663a91c83b252e..807930531a516f8ccac1552f17974d322dabca5f 100644 (file)
@@ -1,4 +1,24 @@
 <?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 /* definitions */
 
@@ -32,7 +52,7 @@ class certificate
 
       if(!$fp){
         $this->certificate();
-        $this->error=_("Can't open specified file, check accessibility and or existence");
+        $this->error= msgPool::cannotReadFile($data);
         return(false);
       }else{
         /* Reading data*/
@@ -50,7 +70,7 @@ class certificate
     /* Data can't be empty */
     if($data = ""){
       $this->certificate();
-      $this->error = _("Can't read specified certificate / or empty string given"); 
+      $this->error = _("Certificate is empty!"); 
       return(false);
     }
 
@@ -77,7 +97,7 @@ class certificate
     /* If cert is loaded correctly and is PEM now, we could read some data out of it */
     if(count($this->info()) <=1)  {
       $this->certificate();
-      $this->error = _("Can't load certificate, possibly unsupported format (use PEM/DER) ");
+      $this->error = _("Cannot load certificate: only PEM and DER are supported!");
       /* Reset*/
       return(false);
     }
@@ -92,7 +112,7 @@ class certificate
   function info($ret = true)
   {
     if($this->type != PEM){
-      $this->error = _("The Format must be PEM, to output certificate informations");
+      $this->error = _("Cannot extract information for non PEM certificates!");
       return(false);
     } else {
       /* return an array with all given information */
@@ -189,14 +209,14 @@ class certificate
       $fp = fopen($filename,"w+");
 
       if(!$fp){
-        $this->error= _("Can't create/open File");
+        $this->error= msgPool::cannotWriteFile($filename);
         return(false);
       }else{
         fwrite($fp,$this->data,strlen($this->data));        
       }
       return(true);
     }else{
-      $this->error= _("No valid certificate loaded");
+      $this->error= _("No valid certificate loaded!");
       return(false);    
     }
     return(false);