<?php
-/**\r
+/**
* @file index.php
- * Main page to show the error reports\r
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)\r
- * @date 21.10.2007\r
- * @package iserv_errorreporter\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
+ * Main page to show the error reports
+ * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
+ * @date 21.10.2007
+ * @package iserv_errorreporter
+ *
+ * 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.
*/
/** @todo turn this into a class */
// Probably we have to delete an error report
if($getAction == "delete" and isset($getUid)) {
// Are you really sure?
- if(@$_POST["surely_delete"] == _("Delete")) {
+ if(@$_POST["surely_delete"] == _("Delete")) {
$doc->deleteErrorReport($getUid);
- header("Location: {$_SERVER["PHP_SELF"]}"); // Reload to get rid of POST data
+ // Reload to get rid of POST data
+ header("Location: {$_SERVER["PHP_SELF"]}");
} elseif(@$_POST["surely_cancel"] == _("Cancel")) {
header("Location: {$_SERVER["PHP_SELF"]}");
} else {
Option(_("Back"), null, "href='".$_SERVER["PHP_SELF"]."'", "back");
} else {
if($cfgErrors->userIsAdmin() or $doc->userIsOwner($getUid)) {
- echo sprintf("<form action='%s' method='post'>\n", $view->getDeleteURL($getUid));
- echo sprintf("<p>%s</p>",
- _c("error-reporter:You are about to delete the following error report:"));
+ echo sprintf("<form action='%s' method='post'>\n",
+ $view->getDeleteURL($getUid));
+ echo sprintf("<p>%s</p>", _c("error-reporter:You are about to delete ".
+ "the following error report:"));
$view->printErrorReport($doc->getErrorReportByID($getUid), true, false);
- echo sprintf("<p><input type='submit' class='submit' name='surely_delete' value='%s' />\n".
- " <input type='submit' class='submit' name='surely_cancel' value='%s' />\n".
- "</p></form>", _("Delete"), _("Cancel"));
+ echo sprintf("<p><input type='submit' class='submit' ".
+ "name='surely_delete' value='%s' />\n <input type='submit' ".
+ "class='submit' name='surely_cancel' value='%s' />\n</p></form>",
+ _("Delete"), _("Cancel"));
} else {
echo sprintf("<p class='err'>%s</p>",
_c("error-reporter:You are not allowed to delete this report."));
echo sprintf("<form action='%s' method='get'></form>\n", $_SERVER["PHP_SELF"]);
// probably we have to insert an error report
-if(($getAction == "submit" and $postSubmit == _("Insert")))
+if(($getAction == "submit" and $postSubmit == _c("error-reporter:Submit")))
{
// All fields must be filled out
- if((trim($postMachine) == "") or (trim($postText) == "")) {
- $strError = _c("error-reporter:You have to fill out all the fields in the form.");
- } else {
- // Write to database
- $nNewUid = null;
- $er = new erErrorReport(time(), $_SESSION["act"], $postMachine, $postText, $postHidden == "true");
- try {
- $nNewUid = $doc->writeErrorReport($er);
- } catch(Exception $e) {
+ if((trim($postMachine) == "") or (trim($postText) == "")) {
+ $strError = _c("error-reporter:You have to fill out all the fields in ".
+ "the form.");
+ } else {
+ // Write to database
+ $nNewUid = null;
+ $er = new erErrorReport(time(), $_SESSION["act"], $postMachine, $postText, $postHidden == "true");
+ try {
+ $nNewUid = $doc->writeErrorReport($er);
+ } catch(Exception $e) {
echo sprintf("<p class='err'>%s</p>", $e->getMessage());
- }
-
- if($nNewUid !== null) {
- echo sprintf("<p class='err'>%s</p>",
- _c("error-reporter:The report was submitted. Thank you for your help."));
- }
-
- $postText = "";
- $postMachine = "";
- $postHidden = "false";
- }
+ }
+
+ if($nNewUid !== null) {
+ echo sprintf("<p class='err'>%s</p>", _c("error-reporter:The report was ".
+ "submitted. Thank you for your help."));
+ }
+
+ $postText = "";
+ $postMachine = "";
+ $postHidden = "false";
+ }
}
// Show already existent (and visible) error reports
-Title(_c("error-reporter:Reports that have already been submitted:"));
-echo sprintf("<p>%s</p>", _c("error-reporter:These errors should not be resubmitted."));
-$view->printErrorReports($doc->getErrorReports(array(ER_ERM_SORT_DATE => ER_ERM_SORT_DESC)));
+if($doc->getNumErrorReports() > 0) {
+ Title(_c("error-reporter:Reports that have already been submitted:"));
+ echo sprintf("<p>%s</p>", _c("error-reporter:These errors should not be ".
+ "resubmitted."));
+ $view->printErrorReports($doc->getErrorReports(array(ER_ERM_SORT_DATE =>
+ ER_ERM_SORT_DESC)));
+}
// Form for submitting a new error report
echo "<p />\n";
Title(_c("error-reporter:Report an error"));
-Option(_c("error-reporter:Recommened reading"), _c("error-reporter:“How to Report Bugs ".
- "Effectively”, by Simon G. Tatham"), "target='_blank' href='".
- _c("error-reporter:http://www.chiark.greenend.org.uk/~sgtatham/bugs.html")."'");
+Option(_c("error-reporter:Recommened reading"), _c("error-reporter:“How to ".
+ "Report Bugs Effectively”, by Simon G. Tatham"), "target='_blank' href='".
+ _c("error-reporter:http://www.chiark.greenend.org.uk/~sgtatham/bugs.html").
+ "'");
// Print the error here
if($strError != "")
- echo "<p class='err'>$strError</p>\n";
+ echo "<p class='err'>$strError</p>\n";
-echo sprintf("<p>%s</p>\n", _c("error-reporter:Please write your report as precise as possible to help ".
- "us solve the problem. The more precise the report is, the faster the error can be fixed. ".
- "Please include also any error messages you have recieved."));
-echo "<form name='form' id='form' method='post' action='?action=submit'>\n<{$GLOBALS["invtbl"]}>\n";
+echo sprintf("<p>%s</p>\n", _c("error-reporter:Please write your report as ".
+ "precise as possible to help us solve the problem. The more precise the ".
+ "report is, the faster the error can be fixed. Please include also any ".
+ "error messages you have recieved."));
+echo "<form name='form' id='form' method='post' action='?action=submit'>\n".
+ "<{$GLOBALS["invtbl"]}>\n";
echo sprintf("<tr><td class='errors-form-description'>%s</td>".
"<td><input type='text' name='machine' size='55' value='%s' /></td></tr>\n",
_c("error-reporter:Affected machine:"), q($postMachine));
echo sprintf("<tr><td class='errors-form-description'>%s</td><td>".
"<textarea name='text' cols='40' rows='5'>%s</textarea></td></tr>\n",
_c("error-reporter:Description of the error:"), q($postText));
-echo sprintf("<tr><td /><td><input type='hidden' name='hidden' value='false' />".
- "<input type='checkbox' id='hidden' name='hidden' value='true'%s><label for='hidden'>%s".
- "</label></td></tr>\n", ($postHidden == "true") ? " checked='checked'" : "",
- _c("error-reporter:Visible only for administrators (use this if your report is about security issues)"));
-echo sprintf("<tr><td /><td><input type='submit' name='submit' value='%s' /></td></tr>\n",
- _("Insert"));
+echo sprintf("<tr><td /><td><input type='hidden' name='hidden' ".
+ "value='false' /><input type='checkbox' id='hidden' name='hidden' ".
+ "value='true'%s><label for='hidden'>%s</label></td></tr>\n",
+ ($postHidden == "true") ? " checked='checked'" : "", _c("error-reporter:".
+ "Visible only for administrators (use this if your report is about security ".
+ "issues)"));
+echo sprintf("<tr><td /><td><input type='submit' name='submit' value='%s' />".
+ "</td></tr>\n", _c("error-reporter:Submit"));
echo "</table></form><p />\n";
_PageBlue();