<?php
-/**\r
+/**
* @file detail.php
- * Page to edit an error report\r
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)\r
- * @date 22.10.2007\r
- * \r
- * Copyright © 2007 Roland Hieber\r
- * \r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included in\r
- * all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
- * THE SOFTWARE.\r
+ * Page to edit an error report
+ * @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/init.inc");
require_once("sec/secure.inc");
require_once("js.inc");
+db_user("errorreporter");
+
PageBlue(_c("error-reporter:Change an error report"), "mod_error-reporter");
-if(!$cfgErrors->userHasAccess()) {
+if(!erConfig::userHasAccess()) {
printf("<p class='err'>%s</p>\n", ER_ERROR_ACCESS_DENIED);
_PageBlue();
die();
$getUid = @intval($_GET["uid"]);
$postSubmit = @$_POST["submit"];
-isset($getUid) or die();
+isset($getUid) or die();
// Check if the specified report exists
if(!is_object($doc->getErrorReportByID($getUid))) {
}
// Only admins or owners can view this page
-if(!($cfgErrors->userIsAdmin() or $doc->userIsOwner($getUid))) {
- echo sprintf("<p class='err'>%s</div>", _c("error-reporter:You are not allowed to edit this report."));
+if(!(erConfig::userIsAdmin() or $doc->userIsOwner($getUid))) {
+ echo sprintf("<p class='err'>%s</div>", _c("error-reporter:You are not ".
+ "allowed to edit this report."));
_PageBlue();
die();
}
$strOldComment = $er->getComment();
// Probably we have to update an error report
-if($getAction == "update" and $postSubmit == _c("Change"))
+if($getAction == "update" and $postSubmit == _("Change"))
{
- if($cfgErrors->userIsAdmin()) {
+ if(erConfig::userIsAdmin()) {
$postComment = stripslashes(@$_POST["comment"]);
$postCommentOld = stripslashes(@$_POST["comment_old"]);
}
- // change the fields of the old dataset
- $er->setMachine(stripslashes(@$_POST["machine"]));
- $er->setText(stripslashes(@$_POST["text"]));
- $er->setVisibility(isset($_POST["hidden"]) ? true : false);
+ // change the fields of the old dataset
+ $er->setMachine(stripslashes(@$_POST["machine"]));
+ $er->setText(stripslashes(@$_POST["text"]));
+ $er->setVisibility(isset($_POST["hidden"]) ? true : false);
- // Do we have to change the comment and his owner?
- if($cfgErrors->userIsAdmin()) {
+ // Do we have to change the comment and his owner?
+ if(erConfig::userIsAdmin()) {
if(@$_POST["comment_old"] != @$_POST["comment"]) {
$er->setComment(stripslashes(@$_POST["comment"]), $_SESSION["act"]);
}
}
// write into database, reload parent and close window
- if($doc->writeErrorReport($er) != -1) {
+ if($doc->writeErrorReport($er) != -1) {
js_try("opener.location.href = 'index.php';");
js_close(500);
- } else {
- printLastError();
- _PageBlue();
- die();
- }
+ } else {
+ printLastError();
+ _PageBlue();
+ die();
+ }
}
// output form
$hidctrl = "input type='hidden'";
Title(_c("error-reporter:Change an error report"));
-echo sprintf("<form action='?action=update&uid=%d' method='post'>\n", $getUid);
+echo sprintf("<form action='?action=update&uid=%d' method='post'>\n",
+ $getUid);
echo "<table>\n";
-echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n", _c("error-reporter:Reported by:"),
- q(erGetRealUserName($er->getOwner())));
-echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n", _c("error-reporter:Date:"), SmartDate($er->getDate()));
-echo sprintf("<tr><td>%s</td><td><{$GLOBALS["stdedt"]} name='machine' value='%s' /></td></tr>\n",
- _c("error-reporter:Affected machine:"), q($er->getMachine()));
+echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n",
+ _c("error-reporter:Reported by:"), q(erGetRealUserName($er->getOwner())));
+echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n", _c("error-reporter:Date:"),
+ SmartDate($er->getDate()));
+echo sprintf("<tr><td>%s</td><td><{$GLOBALS["stdedt"]} name='machine' ".
+ "value='%s' /></td></tr>\n", _c("error-reporter:Affected machine:"),
+ q($er->getMachine()));
echo sprintf("<tr><td>%s</td><td><textarea name='text' cols='40' rows='7'>%s".
"</textarea></td></tr>\n", _c("error-reporter:Text:"), $er->getText());
-echo sprintf("<tr><td><label for='hidden'>%s</label></td><td><input type='checkbox' id='hidden' ".
- "name='hidden' value='true'%s /></td></tr>\n", _c("error-reporter:Hidden:"),
- $er->isHidden() ? " checked='checked'" : "");
-if($cfgErrors->userIsAdmin()) {
- echo sprintf("<tr><td>%s</td><td><textarea name='comment' cols='40' rows='3'>%s</textarea>",
- _c("error-reporter:Comment:"), $er->getComment());
+echo sprintf("<tr><td><label for='hidden'>%s</label></td><td>".
+ "<input type='checkbox' id='hidden' name='hidden' value='true'%s /></td>".
+ "</tr>\n", _c("error-reporter:Hidden:"), $er->isHidden() ?
+ " checked='checked'" : "");
+if(erConfig::userIsAdmin()) {
+ echo sprintf("<tr><td>%s</td><td><textarea name='comment' cols='40' ".
+ "rows='3'>%s</textarea>", _c("error-reporter:Comment:"), $er->getComment());
if($er->getComment() != "") {
- echo sprintf("<input type='hidden' name='comment_old' value='%s' /></td></tr>\n", $strOldComment);
- echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n", _c("error-reporter:Comment written by:"),
- erGetRealUserName($er->getCommentOwner()));
+ echo sprintf("<input type='hidden' name='comment_old' value='%s' /></td>".
+ "</tr>\n", $strOldComment);
+ echo sprintf("<tr><td>%s</td><td>%s</td></tr>\n", _c("error-reporter:".
+ "Comment written by:"), erGetRealUserName($er->getCommentOwner()));
}
}
-echo sprintf("<tr><td /><td><{$GLOBALS["smlbtn"]} value='%s' /></td></tr>\n", _("Change"));
+echo sprintf("<tr><td /><td><{$GLOBALS["smlbtn"]} name='submit' value='%s' ".
+ "/></td></tr>\n", _("Change"));
echo "</table></form><p />\n";
_PageBlue();
?>