fixed translation: if it is not granted at all, the admin privilege does _not_ apply...
[iserv-mod-error-reporter.git] / src / config.php
1 <?php
2 /**
3 * @file config.php
4 * Configuration page
5 * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
6 * @date 22.10.2007
7 *
8 * Copyright © 2007 Roland Hieber
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 * THE SOFTWARE.
27 */
28
29 /** @todo add configuration for allowed groups */
30
31 require_once("mod_error-reporter/class_erConfig.inc");
32 require_once("mod_error-reporter/functions.inc");
33 require_once("share.inc");
34 require_once("ctrl.inc");
35 require_once("db.inc");
36 require_once("sec/admsecure.inc");
37
38 html_header("<style type='text/css'>
39 td.errors-cfg-field {
40 padding: 1em;
41 width: 50%;
42 vertical-align: top;
43 }
44 td.errors-cfg-field input {
45 margin: 0;
46 }
47 .errors-cfg-field-heading {
48 font-weight: bold;
49 }
50 </style>");
51
52 $cfgErrors = new erConfig();
53 require_once("mod_error-reporter/config.inc");
54
55 PageBlue(_c("error-reporter-cfg:Error Report Wizard – Configuration"), "mod_error-reporter");
56
57 if(@$_POST["submit"] == _("Save")) {
58 $bMailNotify = (@$_POST["mailnotify"] == "true");
59 $strMailNotifyAddr = @$_POST["mailnotifyaddr"];
60 $bLog = (@$_POST["log"] == "true");
61
62 if($bMailNotify != $cfgErrors->isMailNotify()) {
63 $cfgErrors->setMailNotify($bMailNotify);
64 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification."));
65 }
66 if($strMailNotifyAddr != $cfgErrors->getMailNotifyAddr()) {
67 if(!erIsMailAddress($strMailNotifyAddr)) {
68 echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The specified string is not ".
69 "a valid e-mail address!"));
70 } else {
71 $cfgErrors->setMailNotifyAddr($strMailNotifyAddr);
72 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification address."));
73 }
74 }
75 $cfgErrors->writeConfig();
76 }
77
78 // two columns
79 echo "<table border='0' cellspacing='10' cellpadding='0'><tr><td width='50%'>\n";
80
81 // Mail notification
82 GroupBox(_c("error-reporter-cfg:Mail notification"), "mail");
83 echo "<form method='post'>\n";
84 echo "<table class='errors-cfg-table'>\n";
85 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotify' ".
86 "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
87 "<input type='checkbox' name='mailnotify' id='mailnotify' value='true'%s /></td></tr>",
88 _c("error-reporter-cfg:Enable mail notification"), _c("error-reporter-cfg:If this option is ".
89 "enabled, everytime an error report is submitted, an e-mail with information about the ".
90 "report will be sent to the address specified below."), $cfgErrors->isMailNotify() ?
91 " checked='checked'" : "");
92 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotifyaddr'".
93 "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
94 "<input type='text' name='mailnotifyaddr' id='mailnotifyaddr' size='30' value='%s' />".
95 "</td></tr>", _c("error-reporter-cfg:Mail address to send the notification mail to"),
96 _c("error-reporter-cfg:If mail notifications are enabled, any notification mails are sent to ".
97 "the address specified here. You can give more than one address by separating them with a ".
98 "comma."), q($cfgErrors->getMailNotifyAddr()));
99 echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' value='%s' /></td></tr>\n",
100 _("Save"));
101 echo "</table>\n</form>\n";
102 _GroupBox();
103
104 echo "</td><td>\n";
105
106 // Privileges
107 GroupBox(_("Privileges"), "keys");
108 $asAccessGroups = erPrivilegedGroups("mod_errorreporter_access");
109 $asAdminGroups = erPrivilegedGroups("mod_errorreporter_admin");
110 echo sprintf("<p>%s</p>\n<p>%s</p>\n<p>%s</p>", _c("error-reporter:This is ".
111 "a short summary of the privileges related to the error report assistant ".
112 "and the groups which have them assigned."),
113 sprintf(_c("error-reporter:If one of these privileges is not assigned to ".
114 "any group, all users on this server are allowed to perform the specified ".
115 "action. Please use the %sgroup administration%s to assign and revoke ".
116 "privileges."), "<a href='/idesk/admin/act/groups.php'>", "</a>"),
117 _c("error-reporter:Please note that every group with the administration ".
118 "privilege can also implicitly report errors and see the reported messages."));
119 echo "<p><table style='width:100%'><tr>\n";
120 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
121 _("View error reports and report errors").":", $asAccessGroups == array() ?
122 _c("error-reporter:all users") : icon("act-group") . join(", ",
123 array_map("erGetGroupName", $asAccessGroups)));
124 echo "</tr><tr>\n";
125 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
126 _("Administration of the error report wizard"),
127 $asAdminGroups == array() ? _c("error-reporter:no users") :
128 icon("act-group") . join(", ", array_map("erGetGroupName", $asAdminGroups)));
129 echo "</tr></table></p>\n";
130 _GroupBox();
131
132 echo "</td></tr></table>\n";
133
134 _PageBlue();
135 ?>
This page took 0.059212 seconds and 5 git commands to generate.