dos2unix on all files; new .project; chklocale from testing (9.02.20) bothers about...
[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 require_once("mod_error-reporter/class_erConfig.inc");
30 require_once("mod_error-reporter/functions.inc");
31 require_once("share.inc");
32 require_once("ctrl.inc");
33 require_once("db.inc");
34 require_once("sec/admsecure.inc");
35
36 html_header("<style type='text/css'>
37 td.errors-cfg-field {
38 padding: 1em;
39 width: 50%;
40 vertical-align: top;
41 }
42 td.errors-cfg-field input {
43 margin: 0;
44 }
45 .errors-cfg-field-heading {
46 font-weight: bold;
47 }
48 </style>");
49
50 $cfgErrors = new erConfig();
51 require_once("mod_error-reporter/config.inc");
52
53 PageBlue(_c("error-reporter-cfg:Error Report Wizard – Configuration"), "mod_error-reporter");
54
55 if(@$_POST["submit"] == _("Save")) {
56 $bMailNotify = (@$_POST["mailnotify"] == "true");
57 $strMailNotifyAddr = @$_POST["mailnotifyaddr"];
58 $bLog = (@$_POST["log"] == "true");
59
60 if($bMailNotify != $cfgErrors->isMailNotify()) {
61 $cfgErrors->setMailNotify($bMailNotify);
62 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification."));
63 }
64 if($strMailNotifyAddr != $cfgErrors->getMailNotifyAddr()) {
65 if(!erIsMailAddress($strMailNotifyAddr)) {
66 echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The specified string is not ".
67 "a valid e-mail address!"));
68 } else {
69 $cfgErrors->setMailNotifyAddr($strMailNotifyAddr);
70 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification address."));
71 }
72 }
73 $cfgErrors->writeConfig();
74 }
75
76 // two columns
77 echo "<table border='0' cellspacing='10' cellpadding='0'><tr><td width='50%'>\n";
78
79 // Mail notification
80 GroupBox(_c("error-reporter-cfg:Mail notification"), "mail");
81 echo "<form method='post'>\n";
82 echo "<table class='errors-cfg-table'>\n";
83 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotify' ".
84 "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
85 "<input type='checkbox' name='mailnotify' id='mailnotify' value='true'%s /></td></tr>",
86 _c("error-reporter-cfg:Enable mail notification"), _c("error-reporter-cfg:If this option is ".
87 "enabled, everytime an error report is submitted, an e-mail with information about the ".
88 "report will be sent to the address specified below."), $cfgErrors->isMailNotify() ?
89 " checked='checked'" : "");
90 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotifyaddr'".
91 "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
92 "<input type='text' name='mailnotifyaddr' id='mailnotifyaddr' size='30' value='%s' />".
93 "</td></tr>", _c("error-reporter-cfg:Mail address to send the notification mail to"),
94 _c("error-reporter-cfg:If mail notifications are enabled, any notification mails are sent to ".
95 "the address specified here. You can give more than one address by separating them with a ".
96 "comma."), q($cfgErrors->getMailNotifyAddr()));
97 echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' value='%s' /></td></tr>\n",
98 _("Save"));
99 echo "</table>\n</form>\n";
100 _GroupBox();
101
102 echo "</td><td>\n";
103
104 // Privileges
105 GroupBox(_("Privileges"), "keys");
106 $asAccessGroups = erPrivilegedGroups("mod_errorreporter_access");
107 $asAdminGroups = erPrivilegedGroups("mod_errorreporter_admin");
108 echo sprintf("<p>%s</p>\n<p>%s</p>\n<p>%s</p>", _c("error-reporter:This is ".
109 "a short summary of the privileges related to the error report assistant ".
110 "and the groups which have them assigned."),
111 sprintf(_c("error-reporter:If one of these privileges is not assigned to ".
112 "any group, all users on this server are allowed to perform the specified ".
113 "action. Please use the %sgroup administration%s to assign and revoke ".
114 "privileges."), "<a href='/idesk/admin/act/groups.php'>", "</a>"),
115 _c("error-reporter:Please note that every group with the administration ".
116 "privilege can also implicitly report errors and see the reported messages."));
117 echo "<p><table style='width:100%'><tr>\n";
118 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
119 _("View error reports and report errors").":", $asAccessGroups == array() ?
120 _c("error-reporter:all users") : icon("act-group") . join(", ",
121 array_map("erGetGroupName", $asAccessGroups)));
122 echo "</tr><tr>\n";
123 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
124 _("Administration of the error report wizard"),
125 $asAdminGroups == array() ? _c("error-reporter:no users") :
126 icon("act-group") . join(", ", array_map("erGetGroupName", $asAdminGroups)));
127 echo "</tr></table></p>\n";
128 _GroupBox();
129
130 echo "</td></tr></table>\n";
131
132 _PageBlue();
133 ?>
This page took 0.052831 seconds and 5 git commands to generate.