X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/blobdiff_plain/3e05075cf3aeff4d23dc9eba7af236ea47cb919d..f6faefbedad2de5c5d4aa915f5a5f180039c055b:/src/index.php diff --git a/src/index.php b/src/index.php index bf275d5..a2a5ece 100644 --- a/src/index.php +++ b/src/index.php @@ -58,9 +58,10 @@ if(!$cfgErrors->userHasAccess()) { // 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 { @@ -73,13 +74,15 @@ if($getAction == "delete" and isset($getUid)) { Option(_("Back"), null, "href='".$_SERVER["PHP_SELF"]."'", "back"); } else { if($cfgErrors->userIsAdmin() or $doc->userIsOwner($getUid)) { - echo sprintf("
\n", $view->getDeleteURL($getUid)); - echo sprintf("

%s

", - _c("error-reporter:You are about to delete the following error report:")); + echo sprintf("\n", + $view->getDeleteURL($getUid)); + echo sprintf("

%s

", _c("error-reporter:You are about to delete ". + "the following error report:")); $view->printErrorReport($doc->getErrorReportByID($getUid), true, false); - echo sprintf("

\n". - " \n". - "

", _("Delete"), _("Cancel")); + echo sprintf("

\n \n

", + _("Delete"), _("Cancel")); } else { echo sprintf("

%s

", _c("error-reporter:You are not allowed to delete this report.")); @@ -98,63 +101,71 @@ echo sprintf("
\n", $_SERVER["PHP_SELF"]); if(($getAction == "submit" and $postSubmit == _("Insert"))) { // 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("

%s

", $e->getMessage()); - } - - if($nNewUid !== null) { - echo sprintf("

%s

", - _c("error-reporter:The report was submitted. Thank you for your help.")); - } - - $postText = ""; - $postMachine = ""; - $postHidden = "false"; - } + } + + if($nNewUid !== null) { + echo sprintf("

%s

", _c("error-reporter:The report was ". + "submitted. Thank you for your help.")); + } + + $postText = ""; + $postMachine = ""; + $postHidden = "false"; + } } // Show already existent (and visible) error reports if($doc->getNumErrorReports() > 0) { Title(_c("error-reporter:Reports that have already been submitted:")); - echo sprintf("

%s

", _c("error-reporter:These errors should not be resubmitted.")); - $view->printErrorReports($doc->getErrorReports(array(ER_ERM_SORT_DATE => ER_ERM_SORT_DESC))); + echo sprintf("

%s

", _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 "

\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 "

$strError

\n"; + echo "

$strError

\n"; -echo sprintf("

%s

\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 "
\n<{$GLOBALS["invtbl"]}>\n"; +echo sprintf("

%s

\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 "\n". + "<{$GLOBALS["invtbl"]}>\n"; echo sprintf("%s". "\n", _c("error-reporter:Affected machine:"), q($postMachine)); echo sprintf("%s". "\n", _c("error-reporter:Description of the error:"), q($postText)); -echo sprintf("". - "\n", ($postHidden == "true") ? " checked='checked'" : "", - _c("error-reporter:Visible only for administrators (use this if your report is about security issues)")); -echo sprintf("\n", - _("Insert")); +echo sprintf("\n", + ($postHidden == "true") ? " checked='checked'" : "", _c("error-reporter:". + "Visible only for administrators (use this if your report is about security ". + "issues)")); +echo sprintf("". + "d>\n", _("Insert")); echo "

\n"; _PageBlue();