Code

Backport from trunk
[gosa.git] / gosa-plugins / gofax / gofax / faxreports / class_faxreport.inc
index 081104d9089255628821e3c0de6c72e44dd21154..1990dd30d9a69ab5c45d5c570a2fbc42391aaffa 100644 (file)
@@ -4,7 +4,7 @@ class faxreport extends plugin
 {
     /* Definitions */
     var $plHeadline     = "FAX Reports";
-    var $plDescription  = "View the FAX report or single documents that have been recieved";
+    var $plDescription  = "View the FAX report or single documents that have been received";
     var $plIcon         = "plugins/gofax/images/reports.png";
 
     /* For internal use */
@@ -43,6 +43,8 @@ class faxreport extends plugin
     /* Create class */
     function faxreport (&$config, &$ui)
     {
+        $this->initTime = microtime(TRUE);
+
         /* Include config object */
         $this->config       = $config;
         $this->ui           = &$ui;
@@ -73,6 +75,11 @@ class faxreport extends plugin
         foreach($tmp as $attrs){
             $this->uidToDN[$attrs['uid'][0]] = $attrs['dn'];
         }
+
+        // Create statistic table entry
+        stats::log('plugin', $class = get_class($this), $category = array($this->acl_category),  $action = 'open',
+                $amount = 1, $duration = (microtime(TRUE) - $this->initTime));
+
     }
 
 
@@ -128,7 +135,7 @@ class faxreport extends plugin
             $link      = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
             if ($link === FALSE){
                 msg_dialog::display(_("Error"), sprintf(
-                    _("Cannot connect to %s database!"), "GOfax"), ERROR_DIALOG);
+                    _("Cannot connect to %s database!"), "<b>".$cfg['SERVER'].":"."GOfax"."</b>"), ERROR_DIALOG);
                 return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
             }
             if (! @mysql_select_db("gofax")){
@@ -158,7 +165,7 @@ class faxreport extends plugin
             // Query for the requested fay entry 
             $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') ".
                 "as queuing_time,status,sender_id,sender_msn,receiver_id,".
-                "receiver_msn,pages,status_message,transfer_time FROM faxlog WHERE id=".$detail.";";
+                "receiver_msn,pages,status_message,transfer_time FROM faxlog WHERE id='".$detail."';";
 
             $cfg= $this->config->data['SERVERS']['FAX'];
             $result = @mysql_query($query);
@@ -201,8 +208,10 @@ class faxreport extends plugin
             }
             $format= _("Y-M-D");
             $queuing_time= $line['queuing_time'];
-            $smarty->assign("plug", "?plug=".get_post('plug'));
-            $smarty->assign("detail", set_post(get_post($detail)));
+
+            $plug = (isset($_GET['plug'])) ? '?plug='.$_GET['plug'] : '';
+            $smarty->assign("plug", $plug);
+            $smarty->assign("detail", set_post($detail));
             $date= preg_replace("/Y/", substr($queuing_time,0,4), $format);
             $date= preg_replace("/M/", substr($queuing_time,4,2), $date);
             $date= preg_replace("/D/", substr($queuing_time,6,2), $date);
@@ -448,6 +457,7 @@ class viewFaxEntries extends plugin {
             "plProvidedAcls" => array(
                 "detailedView"   => _("Detailed view and download"),
                 "id"             => _("Fax ID"),
+                "uid"            => _("The username"),
                 "queuingtime"    => _("Date")."&nbsp;/&nbsp;"._("Time"),
                 "status"         => _("Status"),
                 "senderid"       => _("Sender ID"),