Commit ae107439 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Class report/Error.php removed.

parent 1e8e98f5
Pipeline #1166 passed with stage
in 1 minute and 37 seconds
<?php
define("EXTKEY", "qfq");
define("FORMREPORT", "formreport");
define("LENGTH_HASH", 32);
// dbalias of Extension DB
......
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Glowbase GmbH
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace qfq;
//use qfq;
/**
* syntaxException: Webmaster made a mistake in tt_content record or form definition
*
* @param string $message
* @param string $code
* @param string $file
* @param string $line
* @param string|array $customMessage =array() a) string: "key: value", b) array("key1: value1","key2: value2",
* ...) - all items will be displayed on an own line in the error message.
*/
class SyntaxReportException extends \Exception {
private $fr_error;
/**
* @param string $message
* @param int $code
* @param \Exception $previous
* @param $file
* @param $line
* @param array $customMessage
* @param array $fr_error
*/
public function __construct($message, $code, $previous, $file, $line, $customMessage = array(), $fr_error = array()) {
parent::__construct($message);
$this->code = $code;
$this->file = $file;
$this->line = $line;
$this->customMessage = $customMessage;
$this->fr_error = $fr_error;
}
/**
* @return string
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public function errorMessage() {
$store = Store::getInstance();
// If '$this->customMessage' is a string, convert it to an array.
if ($this->customMessage && !is_array($this->customMessage))
$this->customMessage = [$this->customMessage];
//error message
if (Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_YES, $store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM))) {
$errorMsg = nl2br("<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><br />");
$errorMsg .= "Formreport statement: <strong>" . htmlentities($this->fr_error["row"]) . "</strong><br />";
// Print custom messages.
foreach ($this->customMessage as $value) {
$tmparr = explode(":", $value, 2);
$errorMsg .= $tmparr[0] . ":<strong>" . htmlentities($tmparr[1]) . "</strong><br />";
}
$errorMsg .= "T3 Page pid: <strong>" . $this->fr_error["pid"] . "</strong><br />";
$errorMsg .= "ttcontent record uid: <strong>" . $this->fr_error["uid"] . "</strong><br />";
$errorMsg .= "File: <strong>" . $this->file . "</strong><br />Line: <strong>" . $this->line . "</strong><br />MSG: <strong>" . $this->code . "</strong><br />";
$errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
} else {
$errorMsg = "<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><hr />";
}
return $errorMsg;
} // errorMessage()
} // class syntaxException
/**
* sqlException: An SQL-Query returned an unexpected result
*
* @param string $message
* @param string $sql
* @param string $file
* @param string $line
*/
class SqlReportExceptionUnused extends \Exception {
private $fr_error;
/**
* @param string $message
* @param int $sql
* @param \Exception $file
* @param $line
* @param array $fr_error
*/
public function __construct($message, $sql, $file, $line, $fr_error = array()) {
parent::__construct($message);
$this->file = $file;
$this->line = $line;
$this->sql = $sql;
$this->fr_error = $fr_error;
}
/**
* @return string
*/
public function errorMessage() {
// global $BE_USER; TA: Du sollst kein global verwenden!!
$formreport = Session::get(FORMREPORT);
$beUserUid = ($formreport !== false && isset($formreport['be_user_uid'])) ? $formreport['be_user_uid'] : 0;
if ($GLOBALS['BE_USER']->user["uid"] > 0 || $beUserUid > 0) {
$errorMsg = nl2br("<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><br />MySQL: <strong>" . mysql_error() . "</strong><hr />");
$errorMsg .= "SQL: <strong>" . htmlentities($this->sql) . "</strong><hr />";
$errorMsg .= "Formreport: <strong>" . $this->fr_error["row"] . "</strong><hr />";
$errorMsg .= "T3 Page pid: <strong>" . $this->fr_error["pid"] . "</strong><br>";
$errorMsg .= "ttcontent record uid: <strong>" . $this->fr_error["uid"] . "</strong><br />";
$errorMsg .= "Line: <strong>" . $this->line . "</strong><br />File: <strong>" . $this->file . "</strong><hr />";
$errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
} else {
$errorMsg = "<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><hr />";
}
return $errorMsg;
} // errorMessage()
} // class sqlException
/**
* codeException: Error in formreport code
*
* @param string $message
* @param string $file
* @param string $line
*/
class CodeReportException extends \Exception {
protected $file;
protected $line;
/**
* @param string $message
* @param string $file
* @param string $line
*/
public function __construct($message, $file = "undefined", $line = "undefined") {
parent::__construct($message);
$this->file = $file;
$this->line = $line;
}
/**
* @return string
*/
public function errorMessage() {
$formreport = Session::get(FORMREPORT);
$beUserUid = ($formreport !== false && isset($formreport['be_user_uid'])) ? $formreport['be_user_uid'] : 0;
if ($GLOBALS['BE_USER']->user["uid"] > 0 || $beUserUid > 0) {
$errorMsg = nl2br("<hr />Error: <strong>" . $this->getMessage() . "</strong><br />File: <strong>" . $this->file . "</strong><br />Line: <strong>" . $this->line . "</strong><hr />");
$errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
} else {
$errorMsg = "<hr />Error: <strong>" . $this->getMessage() . "</strong><hr />";
}
return $errorMsg;
} // errorMessage()
} // class codeException
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment