# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
-PROJECT_NAME = iserv-mod-error-reporter
-PROJECT_NUMBER = 8.09.13
+PROJECT_NAME = {{{MODULE}}}
+PROJECT_NUMBER = 9.02.22
OUTPUT_DIRECTORY = doc/source
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
/**
* Write the current state of this instance to the config file.
- * @return (bool) If the function fails, it returns <tt>false</tt>. Call getLastError() to get
- * more information about the error.
+ * @return (bool) If the function fails, it returns <tt>false</tt>. Call
+ * getLastError() to get more information about the error.
*/
public function writeConfig() {
// Open config file
// Mail notification
$strFile .= sprintf("\$cfgErrors->setMailNotify(%s);\n",
$this->isMailNotify() ? "true" : "false");
- $strFile .= sprintf("\$cfgErrors->setMailNotifyAddr('%s');\n", $this->getMailNotifyAddr());
+ $strFile .= sprintf("\$cfgErrors->setMailNotifyAddr('%s');\n",
+ $this->getMailNotifyAddr());
$strFile .= "?>";
/**
* Enable or disable mail notification
- * @param $b (bool) <tt>true</tt> to enable mail notification, <tt>false</tt> to disable it.
+ * @param $b (bool) <tt>true</tt> to enable mail notification, <tt>false</tt>
+ * to disable it.
*/
public function setMailNotify($b) { $this->bMailNotify = ($b == true); }
/**
* Set the mail address(es) for mail notification
- * @param $str (string) The adresses to send the notofication mails to, comma-separated
+ * @param $str (string) The adresses to send the notofication mails to,
+ * comma-separated
*/
public function setMailNotifyAddr($str) { $this->strMailNotifyAddr = $str; }
/**
* Determine if mail notification is enabled
- * @return (bool) <tt>true</tt> if mail notification is enabled, otherwise <tt>false</tt>
+ * @return (bool) <tt>true</tt> if mail notification is enabled, otherwise
+ * <tt>false</tt>
*/
public function isMailNotify() { return $this->bMailNotify; }
/** @} */
}
-?>
\ No newline at end of file
+?>
* @param $strOwner (string) Account name of the creator
* @param $strMachine (string) Machine to which the report refers
* @param $strText (string) Text of the report
- * @param $bHidden (bool) Indicate if the report can be seen by non-administrators
+ * @param $bHidden (bool) Indicate if the report can be seen by
+ * non-administrators
* @return erError
*/
function erErrorReport($tsDate = null, $strOwner = null, $strMachine = null, $strText = null,
$this->bHidden = ($bHidden == true);
}
- /////////////////////////////////////////// SETTER FUNCTIONS ///////////////////////////////////////////
+ ////////////////////////////// SETTER FUNCTIONS //////////////////////////////
/**
* @}
}
/**
* Set the visibility of the report
- * @param $value (bool) <tt>true</tt>: the report is only visible for administrators
+ * @param $value (bool) <tt>true</tt>: the report is only visible for
+ * administrators
*/
function setVisibility($value) { $this->bHidden = $value; }
- /////////////////////////////////////////// GETTER FUNCTIONS ///////////////////////////////////////////
+ ////////////////////////////// GETTER FUNCTIONS //////////////////////////////
/**
* @}
* @{
*/
- /**
+ /**
* Get the unique ID in the database
* @return (int)
*/
/**@}*/
}
-?>
\ No newline at end of file
+?>
*
* 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
* - @b ER_ERM_SORT_UID: Array is sorted by unique ID
* - @b ER_ERM_SORT_DATE: Array is sorted by the creation date
* - @b ER_ERM_SORT_OWNER: Array is sorted by owner of the error report
- * - @b ER_ERM_SORT_MACHINE: Array is sorted by the machine to which the report refers
+ * - @b ER_ERM_SORT_MACHINE: Array is sorted by the machine to which the
+ * report refers
* - @b ER_ERM_SORT_TEXT: Array is sorted by text / notes
* - @b ER_ERM_SORT_COMMENT: Array is sorted by comment
- * - @b ER_ERM_SORT_COMMENTOWNER: Array is sorted by the account name of the person who wrote the comment
+ * - @b ER_ERM_SORT_COMMENTOWNER: Array is sorted by the account name of the
+ * person who wrote the comment
* - @b ER_ERM_SORT_VISIBILITY: Array is sorted by hide status
* @section errorreportmanager_sorting_dir Sorting direction constants
* - @b ER_ERM_SORT_ASC: Array is sorted in ascending order
define("ER_ERM_SORT_UID", 0); /*< sort by unique ID */
define("ER_ERM_SORT_DATE", 1); /*< sort by date */
define("ER_ERM_SORT_OWNER", 2); /*< sort by owner */
-define("ER_ERM_SORT_MACHINE", 3); /*< sort by machine to which the report refers */
+define("ER_ERM_SORT_MACHINE", 3); /*< sort by machine to which the */
+ /*< report refers */
define("ER_ERM_SORT_TEXT", 4); /*< sort by text*/
define("ER_ERM_SORT_COMMENT", 5); /*< sort by comment */
-define("ER_ERM_SORT_COMMENTOWNER", 6); /*< sort by account name of the person who wrote the comment */
+define("ER_ERM_SORT_COMMENTOWNER", 6); /*< sort by account name of the */
+ /*< person who wrote the comment */
define("ER_ERM_SORT_VISIBILITY", 6); /*< sort by visibility */
define("ER_ERM_SORT_ASC", 0); /*< sort ascending */
* This class allows a comprehensive management of error reports.
*
* @par Error reports management
- * To add an error reports, simply create an instance of this class and call writeErrorReport()
- * with a erErrorReport object as the only parameter. If the $nUid member of the erErrorReport
- * object is <tt>null</tt>, writeErrorReport() will use the next ID which is not used in the
- * table.
+ * To add an error reports, simply create an instance of this class and call
+ * writeErrorReport() with an erErrorReport object as the only parameter. If
+ * the $nUid member of the erErrorReport object is <tt>null</tt>,
+ * writeErrorReport() will use the next ID which is not used in the table.
*
* @par
* An error report that has been written to the database can be changed using
- * writeErrorReport(), setting the $nUid member of the erErrorReport parameter to the UID of the
- * error report to be changed.
+ * writeErrorReport(), setting the $nUid member of the erErrorReport parameter
+ * to the UID of the error report to be changed.
*
* @par
- * To change the visibility of an error report to @e hidden, call setErrorReportDoneFlag() with
- * the UID of the error report and set the second parameter to <tt>false</tt>.
+ * To change the visibility of an error report to @e hidden, call
+ * setErrorReportDoneFlag() with the UID of the error report and set the second
+ * parameter to <tt>false</tt>.
*
* @par
- * To delete an error report from the database, call deleteErrorReport() with the UID of the
- * error report you want to delete.
+ * To delete an error report from the database, call deleteErrorReport() with
+ * the UID of the error report you want to delete.
*
* @par
- * Error reports can be retrieved by their UID (getErrorReportByID()), by creation date
- * (getErrorReportsByDate()), by owner (getErrorReportsByOwner()), by machine to which the
- * report refers (getErrorReportsByMachine()) and by the person who wrote the comment
- * (getErrorReportsByCommentOwner()). All error reports in the database can be retrieved using
- * getErrorReports(). All of these functions return a object of type erErrorReport or an array
- * of erErrorReport objects.
+ * Error reports can be retrieved by their UID (getErrorReportByID()), by
+ * creation date (getErrorReportsByDate()), by owner (getErrorReportsByOwner()),
+ * by machine to which the report refers (getErrorReportsByMachine()) and by
+ * the person who wrote the comment (getErrorReportsByCommentOwner()). All
+ * error reports in the database can be retrieved using getErrorReports(). All
+ * of these functions return a object of type erErrorReport or an array of
+ * erErrorReport objects.
*
* @par Example
- * The following example creates a new error report “This doesn’t work”, written by the user
- * “testuser” on February 5, 2007, which refers to the machine “Client-26” and is not visible for
- * non-admin users. Then it adds a nice comment, makes the error report visible and writes it to
- * the database.
+ * The following example creates a new error report “This doesn’t work”, written
+ * by the user “testuser” on February 5, 2007, which refers to the machine
+ * “Client-26” and is not visible for non-admin users. Then it adds a nice
+ * comment, makes the error report visible and writes it to the database.
* @code
* <?php
* require_once("class_erErrorReportManager.inc");
* $em = new erErrorReport(strtotime("2007-02-05"), "testuser", "Client-26",
* "This doesn’t work", false);
* $em->setComment("We know that already", "admin");
- *
- * $nNewID = $obj->writeErrorReport($em); // $em->nUid is null, so writeErrorReport()
- * // calculates the UID by itself
- * ?>
+ * // $em->nUid is null, so writeErrorReport() calculates the UID by itself
+ * $nNewID = $obj->writeErrorReport($em);
* @endcode
*/
/**
* Constructor
- * @param $objcfg (object of type erConfig) Pointer to the configuration class for retrieving the
+ * @param $objcfg (object of type erConfig) Pointer to the configuration
+ * class for retrieving the
* configuration data
* @return erErrorReportManager
*/
$this->objcfg = &$objcfg;
}
- //////////////////////////////////////////// QUERYING ///////////////////////////////////////////
+ /////////////////////////////////// QUERYING /////////////////////////////////
/**
* @name Quering
* @return int
*/
public function getNumErrorReports() {
- $ar = pg_fetch_array(db_query("SELECT COUNT(*) AS count FROM mod_errorreporter;"), 0);
+ $ar = pg_fetch_array(db_query("SELECT COUNT(*) AS count FROM ".
+ "mod_errorreporter;"), 0);
return intval($ar["count"]);
}
/**
* Get all error reports in the database.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * If this function fails, it returns <tt>null</tt>. Call getLastError() to
+ * get more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
- public function getErrorReports($arcSort = array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
+ public function getErrorReports($arcSort = array(ER_ERM_SORT_UID =>
+ ER_ERM_SORT_ASC)) {
return $this->readFromSQL("", $arcSort);
}
/**
* Get all error reports which have been created on the specified date.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
+ * If this function fails, it returns <tt>null</tt>. Call getLastError() to
+ * get more information.
* @param $tsDate (timestamp) Date
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
- public function getErrorReportsByDate($tsDate, $arcSort = array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
+ public function getErrorReportsByDate($tsDate, $arcSort =
+ array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
return $this->readFromSQL("er_date = ".qdb(date("Y\-m\-d", $tsDate)), $arcSort);
}
/**
* Get all error reports which have been created by the specified user.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
+ * If this function fails, it returns <tt>null</tt>. Call getLastError() to
+ * get more information.
* @param $strAct (string) Account name
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
- public function getErrorReportsByOwner($strAct, $arcSort = array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
+ public function getErrorReportsByOwner($strAct, $arcSort =
+ array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
return $this->readFromSQL("er_act = ".qdb($strAct), $arcSort);
}
/**
* Get all error reports which are related to a specified machine.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
+ * If this function fails, it returns <tt>null</tt>. Call getLastError() to
+ * get more information.
* @param $strMachine (string) Machine name
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
public function getErrorReportsByMachine($strMachine,
/**
* Get all error reports which have been commented by the specified user.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
+ * If this function fails, it returns <tt>null</tt>. Call getLastError() to
+ * get more information.
* @param $strAct (string) Account name
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
public function getErrorReportsByCommentOwner($strAct,
/**
* Get datasets from the SQL tables.
- * This function should not be called directly. Use the getBy* functions instead.
- * If this function fails, it returns <tt>null</tt>. Call getLastError() to get more information.
+ * This function should not be called directly. Use the getBy* functions
+ * instead. If this function fails, it returns <tt>null</tt>. Call
+ * getLastError() to get more information.
* @internal
* @param $strWhere (string) Parameters for the SQL WHERE clause
- * @param $arcSort (array of constants) Defines the sorting of the returned array.
- * See the documentation of the $arcSort parameter of buildOrderByClause() for more information.
+ * @param $arcSort (array of constants) Defines the sorting of the returned
+ * array. See the documentation of the $arcSort parameter of
+ * buildOrderByClause() for more information.
* @return array of objects of type erErrorReport
*/
- protected function readFromSQL($strWhere = "", $arcSort = array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
+ protected function readFromSQL($strWhere = "", $arcSort =
+ array(ER_ERM_SORT_UID => ER_ERM_SORT_ASC)) {
$arReturn = array();
- // only allow visible reports for non-admins, but all reports for admins and owners
+ // only allow visible reports for non-admins, but all reports for
+ // admins and owners
if($this->objcfg->userIsAdmin()) {
$strWhereClause = (trim($strWhere) == "") ? "" : "WHERE $strWhere";
} else {
- $strWhereClause = "WHERE ".((trim($strWhere) == "") ? "" : "$strWhere AND ").
- sprintf("((er_act = '%s') or (er_hidden IS NULL OR NOT er_hidden))", $_SESSION["act"]);
+ $strWhereClause = "WHERE ".((trim($strWhere) == "") ? "" :
+ "$strWhere AND ").sprintf("((er_act = '%s') or (er_hidden IS NULL OR ".
+ " er_hidden))", $_SESSION["act"]);
}
$strSortClause = $this->buildOrderByClause($arcSort);
// fetch the error reports
- $hQuery = db_query("SELECT * FROM mod_errorreporter $strWhereClause $strSortClause;");
+ $hQuery = db_query("SELECT * FROM mod_errorreporter $strWhereClause ".
+ "$strSortClause;");
if(!is_resource($hQuery)) {
setLastError(ER_ERROR_SQL);
return null;
}
while($arResult = pg_fetch_array($hQuery)) {
- $er = new erErrorReport(strtotime($arResult["er_date"]), $arResult["er_act"],
- $arResult["er_machine"], $arResult["er_text"], $arResult["er_hidden"] == "t");
+ $er = new erErrorReport(strtotime($arResult["er_date"]),
+ $arResult["er_act"], $arResult["er_machine"], $arResult["er_text"],
+ $arResult["er_hidden"] == "t");
$er->setUid($arResult["er_uid"]);
$er->setComment($arResult["er_comment"], $arResult["er_commentact"]);
$arReturn[] = $er;
/**
* Build a ORDER BY clause from an array.
- * This helper function takes an array of sorting constants as input and returns an ORDER BY
- * clause. The values in the clause are in the same order as the constants in the array.
- * The function in the following example returns an ORDER BY clause where the datasets are first
- * sorted ascending by visibility, then descending by the machine name to which they refer and
+ * This helper function takes an array of sorting constants as input and
+ * returns an ORDER BY clause. The values in the clause are in the same order
+ * as the constants in the array. The function in the following example
+ * returns an ORDER BY clause where the datasets are first sorted ascending
+ * by visibility, then descending by the machine name to which they refer and
* finally ascending by their UID:
* @code
* $strOrder = buildOrderClause(array(
* @endcode
* The output is: <tt>ORDER BY er_hidden ASC, er_machine DESC, er_uid ASC</tt>
* @internal
- * @param $arcSort (array of constants) The array which declares the order of the SQL rows. Use
- * @ref errorreportmanager_sorting as keys and @ref errorreportmanager_sorting_dir as values.
+ * @param $arcSort (array of constants) The array which declares the order of
+ * the SQL rows. Use @ref errorreportmanager_sorting as keys and
+ * @ref errorreportmanager_sorting_dir as values.
* @return string
*/
protected function buildOrderByClause($arcSort) {
foreach($arcSort as $cSort => $cDir) {
switch($cSort) {
case ER_ERM_SORT_UID:
- $arstrSort[] = "er_uid ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_uid ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC");
+ break;
case ER_ERM_SORT_DATE:
- $arstrSort[] = "er_date ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_date ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
case ER_ERM_SORT_OWNER:
- $arstrSort[] = "er_act ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_act ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC");
+ break;
case ER_ERM_SORT_MACHINE:
- $arstrSort[] = "er_machine ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_machine ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
case ER_ERM_SORT_TEXT:
- $arstrSort[] = "er_text ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_text ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
case ER_ERM_SORT_COMMENT:
- $arstrSort[] = "er_comment ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_comment ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
case ER_ERM_SORT_COMMENTOWNER:
- $arstrSort[] = "er_commentact ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_commentact ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
case ER_ERM_SORT_VISIBILITY:
- $arstrSort[] = "er_hidden ".($cDir == ER_ERM_SORT_DESC ? "DESC" : "ASC"); break;
+ $arstrSort[] = "er_hidden ".($cDir == ER_ERM_SORT_DESC ? "DESC" :
+ "ASC");
+ break;
}
}
return ("ORDER BY ".join(", ", $arstrSort));
}
- //////////////////////////////////// ERROR MESSAGE MANAGEMENT ///////////////////////////////////
+ ////////////////////////// ERROR MESSAGE MANAGEMENT //////////////////////////
/**
* @name Error report management
/**
* Insert or update an error report in the database.
- * When the $nUid member of the $erErrorReport object is <tt>null</tt>, a new unique ID is
- * assigned and the error report is written to the database. Otherwise, the corresponding
- * record in the table is updated.
+ * When the $nUid member of the $erErrorReport object is <tt>null</tt>, a new
+ * unique ID is assigned and the error report is written to the database.
+ * Otherwise, the record having the respective UID in the table is updated.
* @param $er (erErrorReport)
* @return (int) The unique ID of the inserted or updated record.
* @throws Exception
$arPut = array();
if($er->getUid() == null) {
// er_uid is now serial
- /*$hQuery = db_query("SELECT MAX(er_uid) AS id FROM mod_errorreporter;");
+ /*$hQuery = db_query("SELECT MAX(er_uid) AS id FROM mod_errorreporter;");
if(!is_resource($hQuery)) {
setLastError(ER_ERROR_SQL);
return -1;
} else {
$strWhere = "er_uid = ".qdb(intval($er->getUid()));
$oOldReport = $this->getErrorReportByID($er->getUid());
- $strLog = sprintf("Fehlermeldung geändert, Rechner war „%s“, Text war „%s“. ".
- "Neuer Rechner: „%s“, neuer Text: „%s“, Kommentar: %s",
- $oOldReport->getMachine(), $oOldReport->getText(), $er->getMachine(),
- $er->getText(), (strlen($er->getComment()) > 0) ? "„".$er->getComment()."“" : "(leer)");
+ $strLog = sprintf("Fehlermeldung geändert, Rechner war „%s“, Text war ".
+ "„%s“. Neuer Rechner: „%s“, neuer Text: „%s“, Kommentar: %s",
+ $oOldReport->getMachine(), $oOldReport->getText(), $er->getMachine(),
+ $er->getText(), (strlen($er->getComment()) > 0) ?
+ $"„" . er->getComment() . "“" : "(leer)");
}
$arPut["er_date"] = date("Y\-m\-d\ G\:i\:s", $er->getDate());
$arPut["er_act"] = $er->getOwner();
// send notification mail, but only if the message is new
if($this->objcfg->isMailNotify() and $er->getUid() == null) {
- $strMailText = sprintf("<html><body>\nEin Benutzer hat eine Fehlermeldung mit dem ".
- "Fehlermeldungs-Assistenten abgeschickt. Nachfolgend finden sich Angaben über den ".
- "Fehler.\n<table>\n<tr><td>Fehler gemeldet von:</td><td>%s</td></tr>\n".
- "<tr><td>Datum:</td><td>%s</td></tr>\n<tr><td>Betroffener Rechner:</td><td>%s</td></tr>\n".
- "<tr><td colspan='2'>%s</td></tr>\n</table>\n<hr />\nDiese Mail wurde automatisch ".
- "generiert.\n</body></html>", q(erGetRealUserName($er->getOwner())),
- q(date("d\.m\.Y\ G\:i\:s", $er->getDate())), q($er->getMachine()), q($er->getText()));
+ $strMailText = sprintf("<html><body>\nEin Benutzer hat eine ".
+ "Fehlermeldung mit dem Fehlermeldungs-Assistenten abgeschickt. ".
+ "Nachfolgend finden sich Angaben über den Fehler.\n".
+ "<table>\n<tr><td>Fehler gemeldet von:</td><td>%s</td></tr>\n".
+ "<tr><td>Datum:</td><td>%s</td></tr>\n".
+ "<tr><td>Betroffener Rechner:</td><td>%s</td></tr>\n".
+ "<tr><td colspan='2'>%s</td></tr>\n</table>\n<hr />\n".
+ "Diese Mail wurde automatisch generiert.\n".
+ "</body></html>", q(erGetRealUserName($er->getOwner())),
+ q(date("d\.m\.Y\ G\:i\:s", $er->getDate())), q($er->getMachine()),
+ q($er->getText()));
$strMailSubject = sprintf("%s hat einen Fehler im System gemeldet",
q(erGetRealUserName($er->getOwner())));
- $strMailHeader = sprintf("From: %s <%s>\nContent-Type: text/html; charset=utf-8",
+ $strMailHeader = sprintf("From: %s <%s>\n".
+ "Content-Type: text/html; charset=utf-8",
q(erGetRealUserName($er->getOwner())), user_mail_addr($er->getOwner()));
- mail($this->objcfg->getMailNotifyAddr(), $strMailSubject, $strMailText, $strMailHeader);
+ mail($this->objcfg->getMailNotifyAddr(), $strMailSubject, $strMailText,
+ $strMailHeader);
}
return $er->getUid();
/**
* Delete an error report from the database.
- * @param $nErrorReportID (int) Unique ID of the error report to delete or -1 if an error
- * occured. In this case, call getLastError() to get more information.
+ * @param $nErrorReportID (int) Unique ID of the error report to delete or -1
+ * if an error occured. In this case, call getLastError() to get more
+ * information.
*/
public function deleteErrorReport($nErrorReportID) {
if(!($this->objcfg->userIsAdmin() or $this->userIsOwner($nErrorReportID))) {
}
$oOldReport = $this->getErrorReportByID($nErrorReportID);
- db_query(sprintf("DELETE FROM mod_errorreporter WHERE er_uid = '%d';", intval($nErrorReportID)));
- erInsertLog(sprintf("Fehlermeldung gelöscht, Rechner war „%s“, Text war „%s“",
- $oOldReport->getMachine(), $oOldReport->getText()));
+ db_query(sprintf("DELETE FROM mod_errorreporter WHERE er_uid = '%d';",
+ intval($nErrorReportID)));
+ erInsertLog(sprintf("Fehlermeldung gelöscht, Rechner war „%s“, Text war ".
+ "„%s“", $oOldReport->getMachine(), $oOldReport->getText()));
}
/**
if(!$_SESSION["act"]) {
return false; // user is not logged in
} else {
- $hQuery = db_query(sprintf("SELECT er_act FROM mod_errorreporter WHERE er_uid = %d;", intval($nID)));
+ $hQuery = db_query(sprintf("SELECT er_act FROM mod_errorreporter WHERE ".
+ "er_uid = %d;", intval($nID)));
if(!is_resource($hQuery)) {
setLastError(ER_ERROR_SQL);
return false;
}
}
}
-?>
\ No newline at end of file
+?>
/** @todo document */
class erErrorReportView {
- /**
- * (object of class erConfig) pointer to the configuration class
- */
+ /** (erConfig) pointer to the configuration class */
protected $objcfg;
- /** (object of type erErrorReportManager) pointer to a erErrorReportManager instance */
+ /** (erErrorReportManager) pointer to a erErrorReportManager instance */
protected $objManager;
/**
* (string) URL to the page which allows editing of an error report.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be edited.
*/
protected $strEditURL;
/**
* (string) URL to the page which allows deletion of an error report.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be deleted.
*/
protected $strDeleteURL;
/**
* Constructor
- * @param $objcfg (object of type erConfig) Pointer to an instance of the erConfig class for
+ * @param $objcfg (erConfig) Pointer to an instance of the erConfig class for
* retrieving the configuration data
- * @param $objemm (object of type erErrorReportManager) Pointer to a instance of the
+ * @param $objemm (erErrorReportManager) Pointer to a instance of the
* erErrorReportManager class for retrieving the document data
* @return erErrorReportView
*/
$this->objcfg = $objcfg;
$this->objManager = $objemm;
html_header("<style type='text/css'>
- table.errors-view-table { width:100%; border:2px solid #5276AB; }
- td.errors-view-description { width:12em; }
- td.errors-view-comment-row { font-style:italic; }
- td.errors-view-action-edit, td.errors-view-action-delete {
- width: 16px;
- padding:0 1em;
- vertical-align:middle;
- }
+ table.errors-view-table { width:100%; border:2px solid #5276AB; }
+ td.errors-view-description { width:12em; }
+ td.errors-view-comment-row { font-style:italic; }
+ td.errors-view-action-edit, td.errors-view-action-delete {
+ width: 16px;
+ padding:0 1em;
+ vertical-align:middle;
+ }
</style>");
}
/**
* Print a single error report.
- * Call this function to print a table or a compound of table rows with the information of the
- * specified error report. The function determines if the current user is the owner of the
- * specified report or if he has admin rights and in this case displays buttons for deletion and
- * editing the error report.
+ * Call this function to print a table or a compound of table rows with the
+ * information of the specified error report. The function determines if the
+ * current user is the owner of the specified report or if he has admin
+ * rights and in this case displays buttons for deletion and editing the
+ * error report.
* @param $objem (erErrorReport) Error report to print
- * @param $bSingle (bool) Determines if you call this function once (<tt>true</tt>) or several
- * times to get a compound table of reports (<tt>false</tt>).
- * @param $bAdminButtons (bool) Explcitly determines whether to show the edit and delete buttons.
- * This parameter overrides the userIsAdmin() and userIsOwner() functions.
+ * @param $bSingle (bool) Determines if you call this function once
+ * (<tt>true</tt>) or several times to get a compound table of reports
+ * (<tt>false</tt>).
+ * @param $bAdminButtons (bool) Explicitly determines whether to show the
+ * edit and delete buttons. This parameter overrides the check for owner and
+ * admin rights.
*/
public function printErrorReport(erErrorReport $objem, $bSingle = false, $bAdminButtons = true) {
global $colbox_state, $invtbl;
echo "<{$GLOBALS["invtbl"]} class='errors-view-table'>";
}
$nColor = bgcol_rgb();
- $sColor = sprintf("rgb(%d,%d,%d)", ($nColor >> 16) % 256, ($nColor >> 8) % 256, $nColor % 256);
+ $sColor = sprintf("rgb(%d,%d,%d)", ($nColor >> 16) % 256,
+ ($nColor >> 8) % 256, $nColor % 256);
echo "<tr style='background-color:$sColor'>";
- if($this->objcfg->userIsAdmin() or $this->objManager->userIsOwner($objem->getUid())) {
+ if($this->objcfg->userIsAdmin() or
+ $this->objManager->userIsOwner($objem->getUid())) {
// user is admin or owner
echo "<td style='padding:3px'><{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>",
- _c("error-reporter:Reported by:"), erMailToUserLink($objem->getOwner()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Date:"), SmartDate($objem->getDate()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Affected machine:"), q($objem->getMachine()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Text:"), q($objem->getText()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Hidden:"), $objem->isHidden() ? _c("error-reporter:yes") : _c("error-reporter:no"));
+ $sRow = "<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>";
+ echo sprintf("$sRow\n", _c("error-reporter:Reported by:"),
+ erMailToUserLink($objem->getOwner()));
+ echo sprintf("$sRow\n", _c("error-reporter:Date:"),
+ SmartDate($objem->getDate()));
+ echo sprintf("$sRow\n", _c("error-reporter:Affected machine:"),
+ q($objem->getMachine()));
+ echo sprintf("$sRow\n", _c("error-reporter:Text:"), q($objem->getText()));
+ echo sprintf("$sRow\n", _c("error-reporter:Hidden:"), $objem->isHidden() ?
+ _c("error-reporter:yes") : _c("error-reporter:no"));
if(trim($objem->getComment()) != "") {
- echo sprintf("<tr><td class='errors-view-description errors-view-comment-row'>%s".
- "</td><td class='errors-view-comment-row'>%s</td></tr>\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("<tr><td class='errors-view-description ".
+ "errors-view-comment-row'>%s</td><td ".
+ "class='errors-view-comment-row'>%s</td></tr>\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo "</table></td>\n";
if($bAdminButtons) {
echo sprintf("<td class='errors-view-action-edit'>%s</td>".
"<td class='errors-view-action-delete'>%s</td>",
- $this->getEditLink($objem->getUid()), $this->getDeleteLink($objem->getUid()));
+ $this->getEditLink($objem->getUid()),
+ $this->getDeleteLink($objem->getUid()));
}
echo "</tr>\n";
} else {
// user can only read the report
echo "<td><{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Affected machine:"), $objem->getMachine());
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Text:"), $objem->getText());
+ $sRow = "<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>";
+ echo sprintf("$sRow\n", _c("error-reporter:Affected machine:"),
+ $objem->getMachine());
+ echo sprintf("$sRow\n", _c("error-reporter:Text:"), $objem->getText());
if(trim($objem->getComment()) != "") {
- echo sprintf("<tr><td class='errors-view-description errors-view-comment-row'>%s".
- "</td><td class='errors-view-comment-row'>%s</td></tr>\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("<tr><td class='errors-view-description ".
+ "errors-view-comment-row'>%s</td><td ".
+ "class='errors-view-comment-row'>%s</td></tr>\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo "</td></table><td /><td /></tr>\n";
/**
* Print a table of error reports.
- * Prints a table with several error reports by calling printErrorReport() for each report.
+ * Prints a table with several error reports by calling printErrorReport()
+ * for each report.
* @param $arobjem (array of errorReport objects) The reports to print
*/
public public function printErrorReports($arobjem) {
/**
* Set the link to the edit page.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be edited.
* @see getEditURL()
* @see getEditLink()
* @param $strUrl (string)
* @return string
*/
public function getEditLink($nUid) {
- return sprintf("<a %s title='%s'>%s</a>", pop($this->getEditURL($nUid), 500, 500),
- _c("error-reporter:Edit this error report"), icon("write"));
+ return sprintf("<a %s title='%s'>%s</a>", pop($this->getEditURL($nUid),
+ 500, 500), _c("error-reporter:Edit this error report"), icon("write"));
}
/**
* Set the link to the delete page.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be deleted.
* @see getDeleteURL()
* @see getDeleteLink()
* @param $strUrl (string)
_c("error-reporter:Delete this error report"), icon("trash"));
}
}
-?>
\ No newline at end of file
+?>
*/
/** Access denied. This can be due to missing access rights. */
define("ER_ERROR_ACCESS_DENIED", _c("error-reporter:Access denied"));
-/** Error while querying the database, maybe due to a lost connection to the server */
-define("ER_ERROR_SQL", _c("error-reporter:Error while trying to query the database"));
+/**
+ * Error while querying the database, maybe due to a lost connection to the
+ * server
+ */
+define("ER_ERROR_SQL", _c("error-reporter:Error while trying to query the ".
+ "database"));
/** Error while trying to open a file */
define("ER_ERROR_OPEN_FILE", _c("error-reporter:Could not open file"));
/** Error while trying to write a file */
function setLastError($cError) { $GLOBALS["ercLastError"] = $cError; }
/**
* Get the error that occured last.
- * @return (constant) Error code, see @ref error-reporter_errorcodes for a list of constants.
+ * @return (constant) Error code, see @ref error-reporter_errorcodes for a list
+ * of constants.
*/
function getLastError() { return $GLOBALS["ercLastError"]; }
* @return void
*/
function printLastError() {
- echo sprintf("<p class='err'>%s %s</p>", _c("error-reporter:An error occured:"), getLastError());
+ echo sprintf("<p class='err'>%s %s</p>", _c("error-reporter:An error ".
+ "occured:"), getLastError());
}
/**
/**
* Get the real user name for an account name
* @param $strAct (string) Account name of the user to look up
- * @return (string) The real name of the user. If the function fails, it returns <tt>null</tt>.
+ * @return (string) The real name of the user. If the function fails, it
+ * returns <tt>null</tt>.
* @throws Exception
*/
function erGetRealUserName($strAct) {
- $hQuery = db_query("SELECT firstname, lastname FROM users WHERE act = $1;", $strAct);
+ $hQuery = db_query("SELECT firstname, lastname FROM users WHERE act = $1;",
+ $strAct);
if(!is_resource($hQuery)) {
- throw new Exception(ER_ERROR_SQL);
- return null;
+ throw new Exception(ER_ERROR_SQL);
+ return null;
}
if(pg_num_rows($hQuery) == 0) {
return $strAct; // User not found in database, return account name
* @throws Exception
*/
function erIsGroup($strAct) {
- $hQuery = db_query(sprintf("SELECT * FROM groups WHERE act=%s;", qdb($strAct)));
+ $hQuery = db_query(sprintf("SELECT * FROM groups WHERE act=%s;",
+ qdb($strAct)));
if(!is_resource($hQuery)) {
throw new Exception(ER_ERROR_SQL);
return null;
/**
* Look up the name of a group
* @param $strAct (string) Account name of the group
- * @return (string) The name of the group. If the function fails, it returns <tt>null</tt>.
+ * @return (string) The name of the group. If the function fails, it returns
+ * <tt>null</tt>.
* @throws Exception
*/
function erGetGroupName($strAct) {
- $hQuery = db_query(sprintf("SELECT * FROM groups WHERE act=%s;", qdb($strAct)));
+ $hQuery = db_query(sprintf("SELECT * FROM groups WHERE act=%s;",
+ qdb($strAct)));
if(!is_resource($hQuery)) {
- throw new Exception(ER_ERROR_SQL);
- return null;
+ throw new Exception(ER_ERROR_SQL);
+ return null;
}
if(pg_num_rows($hQuery) == 0) {
return $strAct; // Group not found in database, return account name
/**
* Create a link to write a mail to the specified account name.
- * This function returns a link if the specified account exists, otherwise it returns the
- * account name.
+ * This function returns a link if the specified account exists, otherwise it
+ * returns the account name.
* @param $strAct (string) Account name
* @return string
*/
* @return string
*/
function erIsMailAddress($strAddr) {
- return ((preg_match("/([a-zA-Z0-9_\-\.]*(@[a-zA-Z0-9\-\.]*)?(\s*,\s*)?)+/", $strAddr) > 0)
- and (preg_match("/(\s*,\s*)$/", $strAddr) == 0));
+ return ((preg_match("/([a-zA-Z0-9_\-\.]*(@[a-zA-Z0-9\-\.]*)?(\s*,\s*)?)+/",
+ $strAddr) > 0) and (preg_match("/(\s*,\s*)$/", $strAddr) == 0));
}
function erInsertLog($sMsg) {
log_insert($sMsg, null, "Error Report Wizard");
}
-?>
\ No newline at end of file
+?>
* THE SOFTWARE.
*/
-require_once("mod_error-reporter/class_erErrorReportView.inc"); // this includes all the other things
+// this includes all the other things
+require_once("mod_error-reporter/class_erErrorReportView.inc");
$cfgErrors = new erConfig();
require_once("mod_error-reporter/config.inc");
$view = new erErrorReportView($cfgErrors, $doc);
$view->setDeleteURL("index.php?action=delete");
$view->setEditURL("detail.php");
-
-?>
\ No newline at end of file
+?>
*/
require_once("mod_error-reporter/init.inc");
if($cfgErrors->userHasAccess()) {
- TreeNode(_c("error-reporter:Report an error"), "mod_error-reporter/index.php", "mod_error-reporter");
+ TreeNode(_c("error-reporter:Report an error"), "mod_error-reporter/index.php",
+ "mod_error-reporter");
}
?>
* THE SOFTWARE.
*/
-TreeNode(_c("error-reporter:Error Report Wizard"), "mod_error-reporter/config.php", "mod_error-reporter");
-?>
\ No newline at end of file
+TreeNode(_c("error-reporter:Error Report Wizard"),
+ "mod_error-reporter/config.php", "mod_error-reporter");
+?>
---\r
--- @file mod_ error-reporter.sql -- Table definitions for iserv-mod-error-reporter\r
--- @author Roland Hieber (roland.hieber@wilhelm-gym.net)\r
--- @date 27.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
+--
+-- @file mod_ error-reporter.sql
+-- Table definitions for iserv-mod-error-reporter
+-- @author Roland Hieber (roland.hieber@wilhelm-gym.net)
+-- @date 27.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.
--
CREATE TABLE mod_errorreporter (
- er_uid SERIAL NOT NULL PRIMARY KEY,
- er_date TIMESTAMP WITHOUT TIME ZONE NOT NULL,
- er_act TEXT NOT NULL\r
- REFERENCES users(act)\r
- ON DELETE CASCADE\r
- ON UPDATE CASCADE,
- er_machine TEXT NOT NULL,
- er_text TEXT NOT NULL,
- er_comment TEXT,
- er_commentact TEXT,
- er_hidden BOOL
+ er_uid SERIAL NOT NULL PRIMARY KEY,
+ er_date TIMESTAMP WITHOUT TIME ZONE NOT NULL,
+ er_act TEXT NOT NULL
+ REFERENCES users(act)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ er_machine TEXT NOT NULL,
+ er_text TEXT NOT NULL,
+ er_status SMALLINT NOT NULL DEFAULT 0,
+ er_comment TEXT,
+ er_commentact TEXT,
+ er_hidden BOOL
);
GRANT SELECT, INSERT, UPDATE, DELETE ON mod_errorreporter, mod_errorreporter_er_uid_seq TO webadm;
$cfgErrors = new erConfig();
require_once("mod_error-reporter/config.inc");
-PageBlue(_c("error-reporter-cfg:Error Report Wizard – Configuration"), "mod_error-reporter");
+PageBlue(_c("error-reporter-cfg:Error Report Wizard – Configuration"),
+ "mod_error-reporter");
if(@$_POST["submit"] == _("Save")) {
$bMailNotify = (@$_POST["mailnotify"] == "true");
if($bMailNotify != $cfgErrors->isMailNotify()) {
$cfgErrors->setMailNotify($bMailNotify);
- echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification."));
+ echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
+ "notification."));
}
if($strMailNotifyAddr != $cfgErrors->getMailNotifyAddr()) {
if(!erIsMailAddress($strMailNotifyAddr)) {
- echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The specified string is not ".
- "a valid e-mail address!"));
+ echo sprintf("<p class='err'>%s</p>", _c("error-reporter-cfg:The ".
+ "specified string is not a valid e-mail address!"));
} else {
$cfgErrors->setMailNotifyAddr($strMailNotifyAddr);
- echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail notification address."));
+ echo sprintf("<p>%s</p>\n", _c("error-reporter-cfg:Set mail ".
+ "notification address."));
}
}
$cfgErrors->writeConfig();
}
// two columns
-echo "<table border='0' cellspacing='10' cellpadding='0'><tr><td width='50%'>\n";
+echo "<table border='0' cellspacing='10' cellpadding='0'><tr>".
+ "<td width='50%'>\n";
// Mail notification
GroupBox(_c("error-reporter-cfg:Mail notification"), "mail");
echo "<form method='post'>\n";
echo "<table class='errors-cfg-table'>\n";
echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotify' ".
- "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
- "<input type='checkbox' name='mailnotify' id='mailnotify' value='true'%s /></td></tr>",
- _c("error-reporter-cfg:Enable mail notification"), _c("error-reporter-cfg:If this option is ".
- "enabled, everytime an error report is submitted, an e-mail with information about the ".
- "report will be sent to the address specified below."), $cfgErrors->isMailNotify() ?
+ "class='errors-cfg-field-heading'>%s</label><br />%s</td><td ".
+ "class='errors-cfg-field'><input type='checkbox' name='mailnotify' ".
+ "id='mailnotify' value='true'%s /></td></tr>",
+ _c("error-reporter-cfg:Enable mail notification"),
+ _c("error-reporter-cfg:If this option is enabled, everytime an error report ".
+ "is submitted, an e-mail with information about the report will be sent to ".
+ "the address specified below."), $cfgErrors->isMailNotify() ?
" checked='checked'" : "");
echo sprintf("<tr><td class='errors-cfg-field'><label for='mailnotifyaddr'".
- "class='errors-cfg-field-heading'>%s</label><br />%s</td><td class='errors-cfg-field'>".
- "<input type='text' name='mailnotifyaddr' id='mailnotifyaddr' size='30' value='%s' />".
- "</td></tr>", _c("error-reporter-cfg:Mail address to send the notification mail to"),
- _c("error-reporter-cfg:If mail notifications are enabled, any notification mails are sent to ".
- "the address specified here. You can give more than one address by separating them with a ".
- "comma."), q($cfgErrors->getMailNotifyAddr()));
-echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' value='%s' /></td></tr>\n",
- _("Save"));
+ "class='errors-cfg-field-heading'>%s</label><br />%s</td>".
+ "<td class='errors-cfg-field'><input type='text' name='mailnotifyaddr' ".
+ "id='mailnotifyaddr' size='30' value='%s' /></td></tr>",
+ _c("error-reporter-cfg:Mail address to send the notification mail to"),
+ _c("error-reporter-cfg:If mail notifications are enabled, any notification ".
+ "mails are sent to the address specified here. You can give more than one ".
+ "address by separating them with a comma."),
+ q($cfgErrors->getMailNotifyAddr()));
+echo sprintf("<tr><td class='errors-cfg-field'><$stdbtn name='submit' ".
+ "value='%s' /></td></tr>\n", _("Save"));
echo "</table>\n</form>\n";
_GroupBox();
"action. Please use the %sgroup administration%s to assign and revoke ".
"privileges."), "<a href='/idesk/admin/act/groups.php'>", "</a>"),
_c("error-reporter:Please note that every group with the administration ".
- "privilege can also implicitly report errors and see the reported messages."));
+ "privilege can also implicitly report errors and see the reported ".
+ "messages."));
echo "<p><table style='width:100%'><tr>\n";
echo sprintf("<td>%s%s</td><td>%s</td>\n", icon("keys"),
_("View error reports and report errors").":", $asAccessGroups == array() ?
echo "</td></tr></table>\n";
_PageBlue();
-?>
\ No newline at end of file
+?>
$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."));
+ echo sprintf("<p class='err'>%s</div>", _c("error-reporter:You are not ".
+ "allowed to edit this report."));
_PageBlue();
die();
}
$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?
+ // Do we have to change the comment and his owner?
if($cfgErrors->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'" : "");
+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>%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"]} value='%s' /></td></tr>\n",
+ _("Change"));
echo "</table></form><p />\n";
_PageBlue();
?>
// 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."));
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("<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
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)));
+ 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' />".
+ "d></tr>\n", _("Insert"));
echo "</table></form><p />\n";
_PageBlue();