X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/blobdiff_plain/3f6e109ede4c6190f46569a0c5df7bde2efe0353..65d6cdfbaae66c99062406937c242ef0612d3a3b:/inc/class_erErrorReportManager.inc diff --git a/inc/class_erErrorReportManager.inc b/inc/class_erErrorReportManager.inc index cf15e03..425f26b 100644 --- a/inc/class_erErrorReportManager.inc +++ b/inc/class_erErrorReportManager.inc @@ -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("\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; }