merged heads
authorRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 02:36:31 +0000 (03:36 +0100)
committerRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 02:36:31 +0000 (03:36 +0100)
23 files changed:
.hgignore
Makefile
config/82error-reporter [new file with mode: 0644]
debian/changelog
debian/postinst [deleted file]
debian/postrm
debian/prerm [deleted file]
debian/rules
inc/class_erConfig.inc
inc/class_erErrorReport.inc
inc/class_erErrorReportManager.inc
inc/class_erErrorReportView.inc
inc/init.inc
iservchk/99errorreporter [new file with mode: 0644]
maint/update-config-from-iserv1.sh [new file with mode: 0755]
maint/update-config.sh
maint/update-database.php [new file with mode: 0755]
maint/update.php [deleted file]
nav/79mod_error-reporter.mod
nav/admin/99mod_error-reporter-cfg.mod [deleted file]
src/config.php [deleted file]
src/detail.php
src/index.php

index 55b7288..1a9df72 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -6,3 +6,10 @@ debian/files
 debian/iserv-mod-error-reporter
 .buildpath
 Doxyfile
+\.swp
+\.gz
+\.dsc
+\.deb
+\.upload
+\.build
+\.changes
index acf4270..43ad927 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #
 # @file Makefile
-# Makefile for installing, creating documentation etc.
+# Makefile for creating documentation and hardlinks for better development
 # @author Roland Hieber (roland.hieber@wilhelm-gym.net)
 # @date 06.10.2007
 # @package iserv_errorreporter
@@ -40,51 +40,50 @@ MKDIR=mkdir -p
 links: sourcedoc
        # documentation
        $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
-       if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi
-       $(LN) doc/{TODO,changelog.old.html} debian/copyright $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
+       $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/
+       $(LN) doc/TODO $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/
+       $(LN) doc/changelog.old.html $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/
        $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
-       $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter # remove old link 
-       $(LN) -s ../../iserv-mod-error-reporter $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
+       $(LN) -s ../../iserv-mod-error-reporter $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter/
        
        # images
-       if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16; fi
-       if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32; fi
-       $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16
-       $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/
+       $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/
+       $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/
        
        # localization
-       if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de; fi
-       $(LN) lang/mod_error-reporter.po $(DESTDIR)/usr/share/iserv/locale/de
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/
+       $(LN) lang/mod_error-reporter.po $(DESTDIR)/usr/share/iserv/locale/de/
        
        # SQL data
-       if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module/
        $(LN) sql/mod_error-reporter.sql $(DESTDIR)/usr/share/iserv/db/
-       $(LN) sql/log_module/mod_error-reporter $(DESTDIR)/usr/share/iserv/db/log_module
+       $(LN) sql/log_module/mod_error-reporter $(DESTDIR)/usr/share/iserv/db/log_module/
        
        # privileges
-       if [ ! -d $(DESTDIR)/usr/share/iserv/priv ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv; fi
-       $(LN) priv/mod_error-reporter $(DESTDIR)/usr/share/iserv/priv
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/
+       $(LN) priv/mod_error-reporter $(DESTDIR)/usr/share/iserv/priv/
        
        # includes
-       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-       $(LN) inc/{class*,init,functions}.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-       if [ ! -e $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc ] ; then touch $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc; fi
-ifeq ($(USER),root)
-       chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
-       chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
-endif
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/
+       $(LN) inc/{class*,init,functions}.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/
        
        # navigation
-       if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi
-       $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav
-       $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin/
+       $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/
+       $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/
        
        # web pages
-       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
-       $(LN) src/{config,detail,index}.php $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter/
+       $(LN) src/{config,detail,index}.php $(DESTDIR)/usr/share/iserv/www/mod_error-reporter/
+       
+       # config
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/config.template/
+       $(LN) config/82error-reporter $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/config.template/
        
        # maintenance files
-       $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/error-reporter
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/error-reporter/
        $(LN) maint/* $(DESTDIR)/usr/share/iserv/modules/error-reporter
 
 # build doxygen documentation from source
@@ -94,43 +93,9 @@ sourcedoc:
        doxygen
        mv doc/source/html/* doc/source/ && rm -rf doc/source/html
 
-install: links
-ifeq ($(USER),root)
-       chklocale
-       chkpriv
-       chkdb -r
-endif
-
-# uninstalling
-uninstall:
-       $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
-       $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
-       $(RM) $(DESTDIR)/usr/share/iserv/www/img/{16,32}/mod_error-reporter.png
-       $(RM) $(DESTDIR)/usr/share/iserv/sql/mod_error-reporter.sql
-       $(RM) $(DESTDIR)/usr/share/iserv/sql/log_module/mod_error-reporter
-       $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_error-reporter
-       $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-       $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_error-reporter.mod
-       $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_error-reporter.mod
-       $(RM) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
-       
-ifeq ($(USER),root)
-       chklocale
-       chkpriv
-       psql -c "DELETE FROM log_module WHERE module='Error Report Wizard';"
-endif
-       
-       @echo
-       @echo If you do not need the SQL tables anymore, remove them by running
-       @echo '  psql -c "DROP TABLE mod_errorreports;"'
-       @echo After that, all reported errors are unrecoverably deleted!
-       @echo
-
 # clean up
-clean: distclean
+clean:
        if [ -e Doxyfile ]; then rm Doxyfile; fi;
-
-distclean:
        $(RM) doc/source
 
-.PHONY: clean distclean install
+.PHONY: clean install
diff --git a/config/82error-reporter b/config/82error-reporter
new file mode 100644 (file)
index 0000000..e90eca4
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Fehlermeldungsassistent
+
+# Mail-Benachrichtigung aktivieren
+# Wenn diese Option aktiviert ist, wird jedesmal, wenn ein Fehler gemeldet 
+# wird, eine E-Mail mit Informationen über die Fehlermeldung an die angegebene 
+# Adresse gesendet.
+ErrorReporterMailNotify:Bool = true
+
+# E-Mail-Adresse für die Benachrichtigungs-Mails
+# Wenn die E-Mail-Benachrichtigung aktiviert ist, werden alle E-Mails an die 
+# hier angegebene Adresse gesendet. Mehrere Adressen können mit Kommata 
+# getrennt werden
+ErrorReporterMailAddress:String = "admins, domain.admins"
+
index 5af73f0..f8172e7 100644 (file)
@@ -2,7 +2,7 @@ iserv-mod-error-reporter (10.03.06-1) testing; urgency=low
 
   * fixed the fix...
 
- -- Roland Hieber <rohieb@rohieb.name>  Sat, 06 Mar 2010 06:22:12 +0100
+ -- Roland Hieber (Package Signing Key) <roland.hieber@wilhelm-gym.net>  Sat, 06 Mar 2010 03:59:20 +0100
 
 iserv-mod-error-reporter (10.03.05-1) testing; urgency=low
 
diff --git a/debian/postinst b/debian/postinst
deleted file mode 100644 (file)
index 8c50428..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-touch /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-chmod g+w /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-chgrp www-data /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-# better let update.php do it because chkdb instantly drops old fields
-# chkdb -r
-chkpriv
-chklocale
-# run update script
-export PGDATABASE=iserv
-export PGUSER=postgres
-php /usr/share/iserv/modules/error-reporter/update.php
-#DEBHELPER#
index 4fdf0ba..e9338c4 100755 (executable)
@@ -1,9 +1,5 @@
 #!/bin/sh
-psql -c "DELETE FROM log_module WHERE module='Error Report Assistant';"
-chklocale
-
 #DEBHELPER#
-
 if [ "$1" = "purge" ]; then
   echo
   echo If you do not need the SQL tables anymore, remove them by running
diff --git a/debian/prerm b/debian/prerm
deleted file mode 100755 (executable)
index e912711..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-if [ "$1" = "purge" ]; then
-  rm -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc
-fi;
-
-#DEBHELPER#
index e8b4a1d..55b5eb3 100755 (executable)
@@ -8,13 +8,11 @@ build:
 binary-indep: 
        [ ! -f Makefile ] || $(MAKE) clean
        dh_clean
-
        dh_testdir
        dh_testroot
        dh_clean -k 
        dh_installdirs
        $(MAKE) DESTDIR=$(CURDIR)/debian/iserv-mod-error-reporter install
-
        # we rather install the documentation via dh_installdocs
        rm -rf $(CURDIR)/debian/iserv-mod-error-reporter/usr/share/doc/iserv-mod-error-reporter
        dh_testdir
index ee7c6df..d980b4c 100644 (file)
@@ -1,22 +1,22 @@
 <?php
 /**
- * @file class_erConfig.inc 
+ * @file class_erConfig.inc
  * Class that handles the configuration
  * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
  * @date 21.10.2007
- * 
+ *
  * Copyright © 2007 Roland Hieber
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- *  
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
 require_once("sec/secure.inc");
 require_once("mod_error-reporter/functions.inc");
-
-/**
- * Determines if a privilege has been assigned
- * @param $sPriv (string) Privilege to test
- * @return bool
- */
-function erPrivilegeAssigned($sPriv) {
-  $h = db_query("SELECT act FROM privileges_assign WHERE privilege = $1;",
-    $sPriv);
-  return pg_num_rows($h) > 0;
-}
-
-/**
- * Retrieve all groups that have a privilege assigned
- * @param $strPriv (string) Privilege to test
- * @return array
- */
-function erPrivilegedGroups($strPriv) {
-  $aReturn = array();
-  $h = db_query("SELECT act FROM privileges_assign WHERE privilege = $1 ".
-    "ORDER BY act;", $strPriv);
-  if(pg_num_rows($h) > 0) {
-    while($a = pg_fetch_array($h)) {
-      $aReturn[] = $a["act"];
-    }
-  }
-  return $aReturn;
-}
-
-define("ER_CONFIGFILE_HEADER", "<?php
-/**
- * config.inc -- configuration file for iserv-mod-error-reporter
- * This file is written by the configuration script.
- */\n");
+require_once("db.inc");
 
 /** @todo document */
 class erConfig {
-  /** (bool) Status of mail notification */
-  protected $bMailNotify;
-  /** (string) Address to send the notification mails to */
-  protected $strMailNotifyAddr;
-  
-  /**
-   * @name Constructor
-   * @{
-   */
+
   /**
-   * Constructor. Sets default values.
-   * @return erConfig
+   * Determine if a privilege has been assigned
+   * @param $sPriv (string) Privilege to test
+   * @return bool
    */
-  public function __construct() {
-    $this->setMailNotify(true);
-    $this->setMailNotifyAddr("admins, win-admins");
+  public static function privilegeAssigned($sPriv) {
+    $h = db_query("SELECT act FROM privileges_assign WHERE privilege = $1;",
+    $sPriv);
+    return pg_num_rows($h) > 0;
   }
-  
-  /**
-   * @}
-   * @name Operations
-   * @{
-   */
-  
+
   /**
-   * Write the current state of this instance to the config file.
-   * @return (bool) If the function fails, it returns <tt>false</tt>. Call
-   *  getLastError() to get more information about the error.
+   * Retrieve all groups that have a privilege assigned
+   * @param $strPriv (string) Privilege to test
+   * @return array
    */
-  public function writeConfig() {
-    // Open config file
-    $hFile = fopen("mod_error-reporter/config.inc", "w", true);
-    if(!is_resource($hFile)) {
-      setLastError(ER_ERROR_OPEN_FILE);
-      return false;
-    }
-    // Try to lock file repeatedly
-    for($n = 0; !flock($hFile, LOCK_EX); $n++) {
-      if($n > 10) {
-        setLastError(ER_ERROR_LOCK_FILE);
-        return false; // Give up
-      } else {
-        sleep(0.1);   // Retry after 100 ms
+  public static function privilegedGroups($strPriv) {
+    $aReturn = array();
+    $h = db_query("SELECT act FROM privileges_assign WHERE privilege = $1 ".
+    "ORDER BY act;", $strPriv);
+    if(pg_num_rows($h) > 0) {
+      while($a = pg_fetch_array($h)) {
+        $aReturn[] = $a["act"];
       }
     }
-    
-    // Create text for config file
-    $strFile = ER_CONFIGFILE_HEADER;
-    
-    // Mail notification
-    $strFile .= sprintf("\$cfgErrors->setMailNotify(%s);\n",
-      $this->isMailNotify() ? "true" : "false");
-    $strFile .= sprintf("\$cfgErrors->setMailNotifyAddr('%s');\n",
-      $this->getMailNotifyAddr());
-    
-    $strFile .= "?>";
-    
-    // Write to config file and unlock it
-    if(fwrite($hFile, $strFile) == false) {
-      setLastError(ER_ERROR_WRITE_FILE);
-      return false;
-    }
-    if(!flock($hFile, LOCK_UN)) {
-      setLastError(ER_ERROR_UNLOCK_FILE);
-      return false;
-    }
-    return true;
+    return $aReturn;
   }
-  
-  public function readConfig() {
-    global $cfgErrors;
-    require("error-reporter/config.inc");
-  }
-  
-  /**
-   * @}
-   * @name Setting options
-   * @{
-   */
-  
-  /**
-   * Enable or disable mail notification
-   * @param $b (bool) <tt>true</tt> to enable mail notification, <tt>false</tt>
-   *  to disable it.
-   */
-  public function setMailNotify($b) { $this->bMailNotify = ($b == true); }
-
-  /**
-   * Set the mail address(es) for mail notification
-   * @param $str (string) The adresses to send the notofication mails to,
-   *  comma-separated
-   */
-  public function setMailNotifyAddr($str) { $this->strMailNotifyAddr = $str; }
-
-  /**
-   * @}
-   * @name Retrieving options
-   * @{
-   */
-  
-  /**
-   * Determine if mail notification is enabled
-   * @return (bool) <tt>true</tt> if mail notification is enabled, otherwise
-   *  <tt>false</tt>
-   */
-  public function isMailNotify() { return $this->bMailNotify; }
-
-  /**
-   * Get the mail adress(es) for mail notification
-   * @return string
-   */
-  public function getMailNotifyAddr() { return $this->strMailNotifyAddr; }
 
   /**
    * Determine if the current user is allowed to see and report errors. This
    * function tests if the user is member of a group which has the
    * <tt>mod-errorreporter_access</tt> privilege.
-   * @return bool 
+   * @return bool
    */
-  public function userHasAccess() {
-    if($this->userIsAdmin() || 
-      !erPrivilegeAssigned("mod_errorreporter_access")) {
+  public static function userHasAccess() {
+    if(erConfig::userIsAdmin() ||
+    !erConfig::privilegeAssigned("mod_errorreporter_access")) {
       // user is admin or privilege is not assigned
       return true;
     } else {
       return secure_privilege("mod_errorreporter_access");
     }
   }
-  
-  /* legacy */
-  public function userIsAllowed() { return $this->userHasAccess(); }
-  
+
   /**
-   * Determine if the current user has admin rights. This function tests if 
-   * the user is member of a group which has the 
+   * Determine if the current user has admin rights. This function tests if
+   * the user is member of a group which has the
    * <tt>mod-errorreporter_access</tt> privilege
-   * @return bool 
+   * @return bool
    */
-  public function userIsAdmin() {
+  public static function userIsAdmin() {
     return secure_privilege("mod_errorreporter_admin");
   }
-  
+
   /** @} */
 }
 ?>
index 827dc4d..2b5208f 100644 (file)
@@ -4,19 +4,19 @@
  * A container class for an error report
  * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
  * @date 18.10.2007
- * 
+ *
  * Copyright © 2007 Roland Hieber
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- *  
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -48,7 +48,7 @@ class erErrorReport {
   var $strCommentOwner;
   /** (bool) Indicate if the report can be seen by non-administrators */
   var $bHidden;
-  
+
   /**
    * @publicsection
    * @name Constructor
@@ -64,8 +64,8 @@ class erErrorReport {
    *  non-administrators
    * @return erError
    */
-  function erErrorReport($tsDate = null, $strOwner = null, $strMachine = null, $strText = null,
-    $bHidden = false) {
+  function erErrorReport($tsDate = null, $strOwner = null, $strMachine = null,
+    $strText = null, $bHidden = false) {
     $this->nUid = null;
     $this->tsDate = intval($tsDate);
     $this->strOwner = $strOwner;
@@ -75,15 +75,15 @@ class erErrorReport {
     $this->strCommentOwner = null;
     $this->bHidden = ($bHidden == true);
   }
-  
+
   ////////////////////////////// SETTER FUNCTIONS //////////////////////////////
-  
+
   /**
    * @}
    * @name Setter functions
    * @{
    */
-  
+
   /**
    * Set the unique ID
    * @param $value (int)
@@ -125,15 +125,15 @@ class erErrorReport {
    *  administrators
    */
   function setVisibility($value) { $this->bHidden = $value; }
-  
+
   ////////////////////////////// GETTER FUNCTIONS //////////////////////////////
-  
+
   /**
    * @}
    * @name Getter functions
    * @{
    */
-  
+
   /**
    * Get the unique ID in the database
    * @return (int)
@@ -145,7 +145,7 @@ class erErrorReport {
    */
   function getDate() { return intval($this->tsDate); }
   /**
-   * Get the account name of the creator 
+   * Get the account name of the creator
    * @return (string)
    */
   function getOwner() { return $this->strOwner; }
@@ -174,7 +174,7 @@ class erErrorReport {
    * @return (bool)
    */
   function isHidden() { return ($this->bHidden == true); }
-  
+
   /**@}*/
 }
 ?>
index cf15e03..425f26b 100644 (file)
@@ -28,6 +28,7 @@
 require_once("mod_error-reporter/class_erErrorReport.inc");
 require_once("mod_error-reporter/class_erConfig.inc");
 require_once("mod_error-reporter/functions.inc");
+require_once("cfg.inc");
 require_once("db.inc");
 require_once("user.inc");
 
@@ -116,23 +117,6 @@ define("ER_ERM_SORT_DESC", 1);         /*< sort descending */
  */
 
 class erErrorReportManager {
-
-  
-  /** 
-   * (object of type erConfig) pointer to the configuration class
-   */
-  protected $objcfg;
-  
-  /**
-   * Constructor
-   * @param $objcfg (object of type erConfig) Pointer to the configuration 
-   * class for retrieving the
-   *  configuration data
-   * @return erErrorReportManager
-   */
-  public function __construct(&$objcfg) {
-    $this->objcfg = &$objcfg;
-  }
   
   /////////////////////////////////// QUERYING /////////////////////////////////
 
@@ -259,7 +243,7 @@ class erErrorReportManager {
     
     // only allow visible reports for non-admins, but all reports for 
     // admins and owners
-    if($this->objcfg->userIsAdmin()) {
+    if(erConfig::userIsAdmin()) {
       $strWhereClause = (trim($strWhere) == "") ? "" : "WHERE $strWhere";
     } else {
       $strWhereClause = "WHERE ".((trim($strWhere) == "") ? "" : 
@@ -366,8 +350,8 @@ class erErrorReportManager {
    * @throws Exception
    */
   public function writeErrorReport(erErrorReport $er) {
-    if(!$this->objcfg->userHasAccess() and (!$this->userIsOwner($er->nUid) or
-      ($er->getUid() == null and !($this->objcfg->userIsAdmin())))) {
+    if(!erConfig::userHasAccess() and (!$this->userIsOwner($er->nUid) or
+      ($er->getUid() == null and !(erConfig::userIsAdmin())))) {
       throw new Exception(ER_ERROR_ACCESS_DENIED);
     }
     
@@ -408,7 +392,7 @@ class erErrorReportManager {
     erInsertLog($strLog);
     
     // send notification mail, but only if the message is new
-    if($this->objcfg->isMailNotify() and $er->getUid() == null) {
+    if(cfg("errorreportermailnotify") and $er->getUid() == null) {
       $strMailText = sprintf("<html><body>\nEin Benutzer hat eine ".
         "Fehlermeldung mit dem Fehlermeldungs-Assistenten abgeschickt. ".
         "Nachfolgend finden sich Angaben über den Fehler.\n".
@@ -425,7 +409,7 @@ class erErrorReportManager {
       $strMailHeader = sprintf("From: %s <%s>\n".
         "Content-Type: text/html; charset=utf-8",
         q(erGetRealUserName($er->getOwner())), user_mail_addr($er->getOwner()));
-      mail($this->objcfg->getMailNotifyAddr(), $strMailSubject, $strMailText,
+      mail(cfg("errorreportermailaddress"), $strMailSubject, $strMailText,
         $strMailHeader);
     }
     
@@ -439,7 +423,7 @@ class erErrorReportManager {
    *  information.
    */
   public function deleteErrorReport($nErrorReportID) {
-    if(!($this->objcfg->userIsAdmin() or $this->userIsOwner($nErrorReportID))) {
+    if(!(erConfig::userIsAdmin() or $this->userIsOwner($nErrorReportID))) {
       setLastError(ER_ERROR_ACCESS_DENIED);
       return -1;
     }
index e335881..590205e 100644 (file)
@@ -35,8 +35,6 @@ require_once("format.inc");
 
 /** @todo document */
 class erErrorReportView {
-  /** (erConfig) pointer to the configuration class */
-  protected $objcfg;
   /** (erErrorReportManager) pointer to a erErrorReportManager instance */
   protected $objManager;
   /**
@@ -54,14 +52,11 @@ class erErrorReportView {
   
   /**
    * Constructor
-   * @param $objcfg (erConfig) Pointer to an instance of the erConfig class for
-   *  retrieving the configuration data
    * @param $objemm (erErrorReportManager) Pointer to a instance of the
    *  erErrorReportManager class for retrieving the document data
    * @return erErrorReportView
    */
-  public function __construct(erConfig &$objcfg, erErrorReportManager &$objemm) {
-    $this->objcfg = $objcfg;
+  public function __construct(erErrorReportManager &$objemm) {
     $this->objManager = $objemm;
     html_header("<style type='text/css'>
       table.errors-view-table { width:100%; border:2px solid #5276AB; }
@@ -100,7 +95,7 @@ class erErrorReportView {
     $sColor = sprintf("rgb(%d,%d,%d)", ($nColor >> 16) % 256,
       ($nColor >> 8) % 256, $nColor % 256);
     echo "<tr style='background-color:$sColor'>";
-    if($this->objcfg->userIsAdmin() or 
+    if(erConfig::userIsAdmin() or 
       $this->objManager->userIsOwner($objem->getUid())) {
       // user is admin or owner
       echo "<td style='padding:3px'><{$GLOBALS["invtbl"]} width='100%'>\n";
index 17aa443..2dc480f 100644 (file)
 
 // this includes all the other things
 require_once("mod_error-reporter/class_erErrorReportView.inc"); 
+require_once("share.inc");
 
-$cfgErrors = new erConfig();
-require_once("mod_error-reporter/config.inc");
-
-$doc = new erErrorReportManager($cfgErrors);
-$view = new erErrorReportView($cfgErrors, $doc);
+$doc = new erErrorReportManager();
+$view = new erErrorReportView($doc);
 $view->setDeleteURL("index.php?action=delete");
 $view->setEditURL("detail.php");
 ?>
diff --git a/iservchk/99errorreporter b/iservchk/99errorreporter
new file mode 100644 (file)
index 0000000..cfe9937
--- /dev/null
@@ -0,0 +1,8 @@
+Test 'import configuration from IServ 1' 
+  '[ ! -f /old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave ]'
+  /usr/share/iserv/modules/error-reporter/update-config-from-iserv1.sh
+Test 'update old config'
+  '[ ! -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc ]'
+  /usr/share/iserv/modules/error-reporter/update-config
+Shell 'update database' /usr/share/iserv/modules/error-reporter/update-database
+
diff --git a/maint/update-config-from-iserv1.sh b/maint/update-config-from-iserv1.sh
new file mode 100755 (executable)
index 0000000..7779e76
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# called from iservchk if old config exists
+OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
+NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
+
+touch $NEWCFG || exit 1;
+chmod u+wr $NEWCFG || exit 1;
+chown www-data $NEWCFG || exit 1;
+
+# filter unused options
+cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
+
+# convert admin groups to group privileges
+ADMGROUPS=$(grep setAdminGroups $OLDCFG|sed -e 's/,//g' -e "s/.*array[^(]*(\([^)]*\)).*/\1/" -e "s/[\"\']/ /g")
+for i in $ADMGROUPS; do
+  psql -c "INSERT INTO privileges_assign (act,privilege) VALUES('$i','mod_errorreporter_admin');" > /dev/null || exit 1;
+  echo "added adminship for group '$i'"
+done;
+
+rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
index 6b6f324..3cc0677 100755 (executable)
@@ -1,24 +1,22 @@
 #!/bin/bash
-OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
-NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
+# called by iservchk
+# convert the old, PHP based config file to /etc/iserv/config
 
-if [ ! -e "$OLDCFG" ]; then
-  echo "$OLDCFG does not exist."
-  exit 1;
-fi;
-
-touch $NEWCFG || exit 1;
-chmod u+wr $NEWCFG || exit 1;
-chown www-data $NEWCFG || exit 1;
+OLDCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
+NEWCFG=/etc/iserv/config
+TMPCFG=`mktemp`
+rm -rf $TMPCFG
 
-# filter unused options
-cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
+# mail notify
+if [ -n "`grep 'setMailNotify(' $OLDCFG|grep false`" ]; then
+  sed 's/^ErrorReporterMailNotify.\+/ErrorReporterMailNotify = false/' $NEWCFG > $TMPCFG
+  mv $TMPCFG $NEWCFG
+fi;
 
-# convert admin groups to group privileges
-ADMGROUPS=$(grep setAdminGroups $OLDCFG|sed -e 's/,//g' -e "s/.*array[^(]*(\([^)]*\)).*/\1/" -e "s/[\"\']/ /g")
-for i in $ADMGROUPS; do
-  psql -c "INSERT INTO privileges_assign (act,privilege) VALUES('$i','mod_errorreporter_admin');" > /dev/null || exit 1;
-  echo "added adminship for group '$i'"
-done;
+# mail notify address
+mailNotifyAddress=`grep setMailNotifyAddr $OLDCFG | sed -e 's/\$cfgErrors->setMailNotifyAddr//' | tr -d '();'|tr "'();" '"'`
+if [ -n "$mailNotifyAddress" ]; then
+  sed "s/^ErrorReporterMailAddress.\+/ErrorReporterMailAddress = $mailNotifyAddress/" $NEWCFG > $TMPCFG
+  mv $TMPCFG $NEWCFG
+fi;
 
-rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
diff --git a/maint/update-database.php b/maint/update-database.php
new file mode 100755 (executable)
index 0000000..2669c3f
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/php
+<?php
+/**
+ * @file update.php
+ * Perform the update operations like renaming SQL tables
+ * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
+ * @date 23.10.2007
+ * 
+ * Copyright © 2007 Roland Hieber
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *  
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* this file is run by iservchk */
+require_once("/usr/share/iserv/www/inc/quote.inc");
+require_once("/usr/share/iserv/www/inc/db.inc");
+
+function doSql($cmd, $quiet = false) {
+  $i = 0;
+  $a = array();
+  $cmd = "psql -c ".qs($cmd);
+  $cmd = ($quiet) ? $cmd . ">/dev/null 2>&1" : $cmd;
+  exec($cmd, $a, $i);
+  return ($i == 0);
+}
+function printSql($cmd) { echo $cmd."\n"; return doSql($cmd); }
+function tableExists($table) {
+  return doSql("SELECT * FROM $table", tnue);
+}
+function columnExists($table, $col) {
+  return (doSql("SELECT $col FROM $table", true) and tableExists($table));
+}
+
+if(isset($_SERVER["REMOTE_ADDR"])) {
+  die("Run this script as root from the command line.");
+}
+
+/*** database schema updates **************************************************/
+echo "updating database schema... \n";
+
+/** table from pre-3.0 **/
+if(tableExists("errors") and !columnExists("errors", "pclabel")) {
+  printSql("ALTER TABLE errors RENAME COLUMN pc_number TO pclabel;");
+}
+
+/** table from 3.0 **/
+if(tableExists("errors") and !columnExists("errors", "pclabel")) {
+  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
+    "er_comment,er_commentact,er_hidden) SELECT date,name,pclabel,text,".
+    "comment,commentby,hidden FROM errors;");
+  printSql("DROP TABLE errors;");
+}
+
+/** table from 4.0 **/
+if(tableExists("errorreports")) {
+  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
+    "er_comment,er_commentact,er_hidden) SELECT er_date,er_act,er_machine,".
+    "er_text,er_comment,er_commentact,er_hidden FROM errorreports;"); 
+  printSql("DROP TABLE errorreports;");
+}
+
+echo "done.\n";
+?>
diff --git a/maint/update.php b/maint/update.php
deleted file mode 100644 (file)
index 8e31289..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * @file update.php
- * Perform the update operations like renaming SQL tables
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
- * @date 23.10.2007
- * 
- * Copyright © 2007 Roland Hieber
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-require_once("/usr/share/iserv/www/inc/quote.inc");
-require_once("/usr/share/iserv/www/inc/db.inc");
-
-function doSql($cmd, $quiet = false) {
-  $i = 0;
-  $a = array();
-  $cmd = "psql -c ".qs($cmd);
-  $cmd = ($quiet) ? $cmd . ">/dev/null 2>&1" : $cmd;
-  exec($cmd, $a, $i);
-  return ($i == 0);
-}
-function printSql($cmd) { echo $cmd."\n"; return doSql($cmd); }
-function tableExists($table) {
-  return doSql("SELECT * FROM $table", tnue);
-}
-function columnExists($table, $col) {
-  return (doSql("SELECT $col FROM $table", true) and tableExists($table));
-}
-
-if(isset($_SERVER["REMOTE_ADDR"])) {
-  die("Run this script as root from the command line.");
-}
-
-/*** Generic update tasks *****************************************************/
-
-/** 8.08.07 **/
-$sOldCfg = "/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave";
-$sNewCfg = "/usr/share/iserv/www/inc/mod_error-reporter/config.inc";
-if(is_file($sOldCfg)) {
-  echo "taking over old config file... ";
-  exec("/usr/share/iserv/modules/error-reporter/update-config.sh", $a, $i);
-  if($i != 0) {
-    die();
-  }
-  echo "done.\n";
-}
-
-/*** database schema updates***************************************************/
-echo "updating database schema... \n";
-if(!tableExists("mod_errorreporter")) {
-  passthru("chkdb -r");
-}
-
-/** table from pre-3.0 **/
-if(tableExists("errors") and !columnExists("errors", "pclabel")) {
-  printSql("ALTER TABLE errors RENAME COLUMN pc_number TO pclabel;");
-}
-
-/** table from 3.0 **/
-if(tableExists("errors") and !columnExists("errors", "pclabel")) {
-  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
-    "er_comment,er_commentact,er_hidden) SELECT date,name,pclabel,text,".
-    "comment,commentby,hidden FROM errors;");
-  printSql("DROP TABLE errors;");
-}
-
-/** table from 4.0 **/
-if(tableExists("errorreports")) {
-  printSql("INSERT INTO mod_errorreporter (er_date,er_act,er_machine,er_text,".
-    "er_comment,er_commentact,er_hidden) SELECT er_date,er_act,er_machine,".
-    "er_text,er_comment,er_commentact,er_hidden FROM errorreports;"); 
-  printSql("DROP TABLE errorreports;");
-}
-
-echo "done.\n";
-?>
index 9245ad0..ababc04 100644 (file)
@@ -25,8 +25,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-require_once("mod_error-reporter/init.inc");
-if($cfgErrors->userHasAccess()) {
+require_once("mod_error-reporter/class_erConfig.inc");
+
+if(erConfig::userHasAccess()) {
   TreeNode(_c("error-reporter:Report an error"), "mod_error-reporter/index.php",
     "mod_error-reporter");
 }
diff --git a/nav/admin/99mod_error-reporter-cfg.mod b/nav/admin/99mod_error-reporter-cfg.mod
deleted file mode 100644 (file)
index 13982d2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * @file 99error-reporter-cfg.mod -- menu item for configuration
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
- * @date 27.10.2007
- * 
- * Copyright © 2007 Roland Hieber
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-TreeNode(_c("error-reporter:Error Report Wizard"), 
-  "mod_error-reporter/config.php", "mod_error-reporter");
-?>
diff --git a/src/config.php b/src/config.php
deleted file mode 100644 (file)
index dfc09c1..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/**
- * @file config.php
- * Configuration page
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
- * @date 22.10.2007
- * 
- * Copyright © 2007 Roland Hieber
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-require_once("mod_error-reporter/class_erConfig.inc");
-require_once("mod_error-reporter/functions.inc");
-require_once("share.inc");
-require_once("ctrl.inc");
-require_once("db.inc");
-require_once("sec/admsecure.inc");
-
-db_user("errorreporter");
-
-html_header("<style type='text/css'>
-td.errors-cfg-field {
-  padding: 1em;
-  width: 50%;
-  vertical-align: top;
-}
-td.errors-cfg-field input {
-  margin: 0;
-}
-.errors-cfg-field-heading {
-  font-weight: bold;
-}
-</style>");
-
-$cfgErrors = new erConfig();
-require_once("mod_error-reporter/config.inc");
-
-PageBlue(_c("error-reporter-cfg:Error Report Wizard – Configuration"), 
-  "mod_error-reporter");
-
-if(@$_POST["submit"] == _("Save")) {
-  $bMailNotify = (@$_POST["mailnotify"] == "true");
-  $strMailNotifyAddr = @$_POST["mailnotifyaddr"];
-  $bLog = (@$_POST["log"] == "true");
-  
-  if($bMailNotify != $cfgErrors->isMailNotify()) {
-    $cfgErrors->setMailNotify($bMailNotify);
-    echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
-      "notification."));
-  }
-  if($strMailNotifyAddr != $cfgErrors->getMailNotifyAddr()) {
-    if(!erIsMailAddress($strMailNotifyAddr)) {
-      echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The ".
-        "specified string is not a valid e-mail address!"));
-    } else {
-      $cfgErrors->setMailNotifyAddr($strMailNotifyAddr);
-      echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
-        "notification address."));
-    }
-  }
-  $cfgErrors->writeConfig();
-}
-
-// two columns
-echo "<table border='0' cellspacing='10' cellpadding='0'><tr>".
-  "<td width='50%'>\n";
-
-// Mail notification
-GroupBox(_c("error-reporter-cfg:Mail notification"), "mail");
-echo "<form method='post'>\n";
-echo "<table class='errors-cfg-table'>\n";
-echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotify' ".
-  "class='errors-cfg-field-heading'>%s</label><br />%s</td><td ".
-  "class='errors-cfg-field'><input type='checkbox' name='mailnotify' ".
-  "id='mailnotify' value='true'%s /></td></tr>",
-  _c("error-reporter-cfg:Enable mail notification"), 
-  _c("error-reporter-cfg:If this option is enabled, everytime an error report ".
-  "is submitted, an e-mail with information about the report will be sent to ".
-  "the address specified below."), $cfgErrors->isMailNotify() ? 
-  " checked='checked'" : "");
-echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotifyaddr'".
-  "class='errors-cfg-field-heading'>%s</label><br />%s</td>".
-  "<td class='errors-cfg-field'><input type='text' name='mailnotifyaddr' ".
-  "id='mailnotifyaddr' size='30' value='%s' /></td></tr>",
-  _c("error-reporter-cfg:Mail address to send the notification mail to"),
-  _c("error-reporter-cfg:If mail notifications are enabled, any notification ".
-  "mails are sent to the address specified here. You can give more than one ".
-  "address by separating them with a comma."), 
-  q($cfgErrors->getMailNotifyAddr()));
-echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' ".
-  "value='%s' /></td></tr>\n", _("Save"));
-echo "</table>\n</form>\n";
-_GroupBox();
-
-echo "</td><td>\n";
-
-// Privileges
-GroupBox(_("Privileges"), "keys");
-$asAccessGroups = erPrivilegedGroups("mod_errorreporter_access");
-$asAdminGroups = erPrivilegedGroups("mod_errorreporter_admin");
-echo sprintf("<p>%s</p>\n<p>%s</p>\n<p>%s</p>", _c("error-reporter:This is ".
-  "a short summary of the privileges related to the error report assistant ".
-  "and the groups which have them assigned."),
-  sprintf(_c("error-reporter:If one of these privileges is not assigned to ".
-  "any group, all users on this server are allowed to perform the specified ".
-  "action. Please use the %sgroup administration%s to assign and revoke ".
-  "privileges."), "<a href='/idesk/admin/act/groups.php'>", "</a>"),
-  _c("error-reporter:Please note that every group with the administration ".
-  "privilege can also implicitly report errors and see the reported ".
-  "messages."));
-echo "<p><table style='width:100%'><tr>\n";
-echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
-  _("View error reports and report errors").":", $asAccessGroups == array() ?
-  _c("error-reporter:all users") : icon("act-group") . join(", ", 
-  array_map("erGetGroupName", $asAccessGroups)));
-echo "</tr><tr>\n";
-echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
-  _("Administration of the error report wizard"),
-  $asAdminGroups == array() ? _c("error-reporter:no users") :
-  icon("act-group") . join(", ", array_map("erGetGroupName", $asAdminGroups)));
-echo "</tr></table></p>\n";
-_GroupBox();
-
-echo "</td></tr></table>\n";
-
-_PageBlue();
-?>
index a0af8ac..1dfbcf3 100644 (file)
@@ -34,7 +34,7 @@ db_user("errorreporter");
 
 PageBlue(_c("error-reporter:Change an error report"), "mod_error-reporter");
 
-if(!$cfgErrors->userHasAccess()) {
+if(!erConfig::userHasAccess()) {
   printf("<p class='err'>%s</p>\n", ER_ERROR_ACCESS_DENIED);
   _PageBlue();
   die();
@@ -55,7 +55,7 @@ if(!is_object($doc->getErrorReportByID($getUid))) {
 }
 
 // Only admins or owners can view this page
-if(!($cfgErrors->userIsAdmin() or $doc->userIsOwner($getUid))) {
+if(!(erConfig::userIsAdmin() or $doc->userIsOwner($getUid))) {
   echo sprintf("<p class='err'>%s</div>", _c("error-reporter:You are not ".
     "allowed to edit this report."));
   _PageBlue();
@@ -69,7 +69,7 @@ $strOldComment = $er->getComment();
 // Probably we have to update an error report
 if($getAction == "update" and $postSubmit == _("Change"))
 {
-  if($cfgErrors->userIsAdmin()) {
+  if(erConfig::userIsAdmin()) {
     $postComment = stripslashes(@$_POST["comment"]);
     $postCommentOld = stripslashes(@$_POST["comment_old"]);
   }
@@ -80,7 +80,7 @@ if($getAction == "update" and $postSubmit == _("Change"))
   $er->setVisibility(isset($_POST["hidden"]) ? true : false);
   
   // Do we have to change the comment and his owner?
-  if($cfgErrors->userIsAdmin()) {
+  if(erConfig::userIsAdmin()) {
     if(@$_POST["comment_old"] != @$_POST["comment"]) {
       $er->setComment(stripslashes(@$_POST["comment"]), $_SESSION["act"]);
     }
@@ -116,7 +116,7 @@ echo sprintf("<tr><td><label for='hidden'>%s</label></td><td>".
   "<input type='checkbox' id='hidden' name='hidden' value='true'%s /></td>".
   "</tr>\n", _c("error-reporter:Hidden:"), $er->isHidden() ? 
   " checked='checked'" : "");
-if($cfgErrors->userIsAdmin()) {
+if(erConfig::userIsAdmin()) {
   echo sprintf("<tr><td>%s</td><td><textarea name='comment' cols='40' ".
   "rows='3'>%s</textarea>", _c("error-reporter:Comment:"), $er->getComment());
   if($er->getComment() != "") {
index 9a9f7d7..0bae2b6 100644 (file)
@@ -51,7 +51,7 @@ $strError = "";
 
 PageBlue(_c("error-reporter:Report an error"), "mod_error-reporter");
 
-if(!$cfgErrors->userHasAccess()) {
+if(!erConfig::userHasAccess()) {
   printf("<p class='err'>%s</p>\n", ER_ERROR_ACCESS_DENIED);
   _PageBlue();
   exit();
@@ -75,7 +75,7 @@ if($getAction == "delete" and isset($getUid)) {
         _c("error-reporter:The specified error report does not exist!"));
       Option(_("Back"), null, "href='".$_SERVER["PHP_SELF"]."'", "back");
     } else {
-      if($cfgErrors->userIsAdmin() or $doc->userIsOwner($getUid)) {
+      if(erConfig::userIsAdmin() or $doc->userIsOwner($getUid)) {
         echo sprintf("<form action='%s' method='post'>\n", 
           $view->getDeleteURL($getUid));
         echo sprintf("<p>%s</p>", _c("error-reporter:You are about to delete ".
@@ -109,7 +109,8 @@ if(($getAction == "submit" and $postSubmit == _c("error-reporter:Submit")))
   } else {
     // Write to database
     $nNewUid = null;
-    $er = new erErrorReport(time(), $_SESSION["act"], $postMachine, $postText, $postHidden == "true");
+    $er = new erErrorReport(time(), $_SESSION["act"], $postMachine, $postText,
+      $postHidden == "true");
     try {
       $nNewUid = $doc->writeErrorReport($er); 
     } catch(Exception $e) {
This page took 0.0809 seconds and 4 git commands to generate.