-<?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();
-?>