config migration in source code; config page is not needed anymore
authorRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 02:25:13 +0000 (03:25 +0100)
committerRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 02:25:13 +0000 (03:25 +0100)
inc/class_erConfig.inc
inc/class_erErrorReport.inc
inc/class_erErrorReportManager.inc
inc/class_erErrorReportView.inc
inc/init.inc
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 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");
 ?>
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.056575 seconds and 4 git commands to generate.