removed stuff from makefile that is unneccessary for development and packaging (no...
[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 db_user("errorreporter");
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"),
56 "mod_error-reporter");
57
58 if(@$_POST["submit"] == _("Save")) {
59 $bMailNotify = (@$_POST["mailnotify"] == "true");
60 $strMailNotifyAddr = @$_POST["mailnotifyaddr"];
61 $bLog = (@$_POST["log"] == "true");
62
63 if($bMailNotify != $cfgErrors->isMailNotify()) {
64 $cfgErrors->setMailNotify($bMailNotify);
65 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
66 "notification."));
67 }
68 if($strMailNotifyAddr != $cfgErrors->getMailNotifyAddr()) {
69 if(!erIsMailAddress($strMailNotifyAddr)) {
70 echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The ".
71 "specified string is not a valid e-mail address!"));
72 } else {
73 $cfgErrors->setMailNotifyAddr($strMailNotifyAddr);
74 echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
75 "notification address."));
76 }
77 }
78 $cfgErrors->writeConfig();
79 }
80
81 // two columns
82 echo "<table border='0' cellspacing='10' cellpadding='0'><tr>".
83 "<td width='50%'>\n";
84
85 // Mail notification
86 GroupBox(_c("error-reporter-cfg:Mail notification"), "mail");
87 echo "<form method='post'>\n";
88 echo "<table class='errors-cfg-table'>\n";
89 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotify' ".
90 "class='errors-cfg-field-heading'>%s</label><br />%s</td><td ".
91 "class='errors-cfg-field'><input type='checkbox' name='mailnotify' ".
92 "id='mailnotify' value='true'%s /></td></tr>",
93 _c("error-reporter-cfg:Enable mail notification"),
94 _c("error-reporter-cfg:If this option is enabled, everytime an error report ".
95 "is submitted, an e-mail with information about the report will be sent to ".
96 "the address specified below."), $cfgErrors->isMailNotify() ?
97 " checked='checked'" : "");
98 echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotifyaddr'".
99 "class='errors-cfg-field-heading'>%s</label><br />%s</td>".
100 "<td class='errors-cfg-field'><input type='text' name='mailnotifyaddr' ".
101 "id='mailnotifyaddr' size='30' value='%s' /></td></tr>",
102 _c("error-reporter-cfg:Mail address to send the notification mail to"),
103 _c("error-reporter-cfg:If mail notifications are enabled, any notification ".
104 "mails are sent to the address specified here. You can give more than one ".
105 "address by separating them with a comma."),
106 q($cfgErrors->getMailNotifyAddr()));
107 echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' ".
108 "value='%s' /></td></tr>\n", _("Save"));
109 echo "</table>\n</form>\n";
110 _GroupBox();
111
112 echo "</td><td>\n";
113
114 // Privileges
115 GroupBox(_("Privileges"), "keys");
116 $asAccessGroups = erPrivilegedGroups("mod_errorreporter_access");
117 $asAdminGroups = erPrivilegedGroups("mod_errorreporter_admin");
118 echo sprintf("<p>%s</p>\n<p>%s</p>\n<p>%s</p>", _c("error-reporter:This is ".
119 "a short summary of the privileges related to the error report assistant ".
120 "and the groups which have them assigned."),
121 sprintf(_c("error-reporter:If one of these privileges is not assigned to ".
122 "any group, all users on this server are allowed to perform the specified ".
123 "action. Please use the %sgroup administration%s to assign and revoke ".
124 "privileges."), "<a href='/idesk/admin/act/groups.php'>", "</a>"),
125 _c("error-reporter:Please note that every group with the administration ".
126 "privilege can also implicitly report errors and see the reported ".
127 "messages."));
128 echo "<p><table style='width:100%'><tr>\n";
129 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
130 _("View error reports and report errors").":", $asAccessGroups == array() ?
131 _c("error-reporter:all users") : icon("act-group") . join(", ",
132 array_map("erGetGroupName", $asAccessGroups)));
133 echo "</tr><tr>\n";
134 echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
135 _("Administration of the error report wizard"),
136 $asAdminGroups == array() ? _c("error-reporter:no users") :
137 icon("act-group") . join(", ", array_map("erGetGroupName", $asAdminGroups)));
138 echo "</tr></table></p>\n";
139 _GroupBox();
140
141 echo "</td></tr></table>\n";
142
143 _PageBlue();
144 ?>
This page took 0.057966 seconds and 5 git commands to generate.