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");
*/
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 /////////////////////////////////
// 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) == "") ? "" :
"$strWhere AND ").sprintf("((er_act = '%s') or (er_hidden IS NULL OR ".
- " er_hidden))", $_SESSION["act"]);
+ " NOT er_hidden))", $_SESSION["act"]);
}
$strSortClause = $this->buildOrderByClause($arcSort);
* @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);
}
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".
$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);
}
* 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;
}