Commit 889045cf authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug #5348 / Exception/Report: level key missing - Remove outdated report...

Bug #5348 / Exception/Report: level key missing - Remove outdated report exception classes from File 'Error.php'
parent f77b284d
......@@ -133,7 +133,7 @@ class OnArray {
public static function explodeWithoutEscaped($delimiter, $str) {
if (strpos($str, SUBSTITUTE) !== false) {
throw new UserReportException ("Can't replace token by SUBSTITUTE, cause SUBSTITUTE already exist", ERROR_SUBSTITUTE_FOUND);
throw new UserReportException ("Can't replace token by SUBSTITUTE, cause SUBSTITUTE already exist", ERROR_SUBSTITUTE_FOUND);
}
$encodedStr = str_replace('\\' . $delimiter, SUBSTITUTE, $str);
......
......@@ -101,7 +101,7 @@ class SyntaxReportException extends \Exception {
* @param string $file
* @param string $line
*/
class SqlReportException extends \Exception {
class SqlReportExceptionUnused extends \Exception {
private $fr_error;
/**
......@@ -172,7 +172,6 @@ class CodeReportException extends \Exception {
* @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;
......@@ -188,44 +187,5 @@ class CodeReportException extends \Exception {
} // class codeException
/**
* userException: Exception on user-level: Session expired, invalid form submission, no authorization, invalid request,
* etc.
*
* @param string $message
* @param string $file
* @param string $line
*/
class UserReportExceptionUnused 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 userException
......@@ -13,7 +13,7 @@ namespace qfq;
require_once(__DIR__ . '/Define.php');
require_once(__DIR__ . '/Variables.php');
require_once(__DIR__ . '/Error.php');
//require_once(__DIR__ . '/Error.php');
require_once(__DIR__ . '/../database/Database.php');
require_once(__DIR__ . '/Link.php');
require_once(__DIR__ . '/SendMail.php');
......@@ -200,8 +200,7 @@ class Report {
*
* @param string $ttLine : line to split in level, command, content
*
* @throws SyntaxReportException
* @return void
* @throws UserReportException
*/
private function parseFRLine($ttLine) {
......@@ -231,7 +230,7 @@ class Report {
$frCmd = $arrKey[count($arrKey) - 1];
if (strpos('|' . strtolower(TOKEN_VALID_LIST) . '|', '|' . $frCmd . '|') === false) {
throw new SyntaxReportException ("Unknown token: $frCmd in Line '$ttLine''", ERROR_UNKNOWN_TOKEN, null, __FILE__, __LINE__, $this->fr_error);
throw new UserReportException ("Unknown token: $frCmd in Line '$ttLine''", ERROR_UNKNOWN_TOKEN);
}
// remove last item (cmd)
......@@ -377,8 +376,6 @@ class Report {
*
* @return string The content that is displayed on the website
* @throws codeException
* @throws SqlReportException
* @throws SyntaxReportException
* @throws UserReportException
*/
......@@ -572,7 +569,6 @@ class Report {
* @param string $rowIndex Index of recent row in resultset.
*
* @return string Collected content of all printable columns
* @throws SyntaxReportException
*/
private function collectRow(array $row, array $keys, $full_level, $rowIndex) {
$content = "";
......@@ -619,9 +615,12 @@ class Report {
* @param string $columnValue
* @param string $full_level
* @param string $rowIndex
* @param $flagOutput
*
* @return string rendered column
* @throws SyntaxReportException
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
private function renderColumn($columnIndex, $columnName, $columnValue, $full_level, $rowIndex, &$flagOutput) {
$content = "";
......@@ -770,7 +769,7 @@ class Report {
$sendMail = new SendMail();
$mailConfig = $sendMail->parseStringToArray($columnValue);
if (count($mailConfig) < 4) {
throw new SyntaxReportException ("Too few parameter for sendmail: $columnValue", ERROR_TOO_FEW_PARAMETER_FOR_SENDMAIL, null, __FILE__, __LINE__, $this->fr_error);
throw new UserReportException ("Too few parameter for sendmail: $columnValue", ERROR_TOO_FEW_PARAMETER_FOR_SENDMAIL);
}
$mailConfig[SENDMAIL_TOKEN_SRC] = "Report: T3 pageId=" . $this->store->getVar('pageId', STORE_TYPO3) .
......@@ -874,7 +873,6 @@ class Report {
*
* @param string $columnName
* @param string $columnValue
*
* @return string rendered link
*
* $columnValue:
......@@ -888,7 +886,7 @@ class Report {
* param[5]: class
* param[6]: target
* param[7]: render mode
* @throws SyntaxReportException
* @throws UserReportException
*/
private function doFixColPosPage($columnName, $columnValue) {
......@@ -901,7 +899,7 @@ class Report {
// Split definition
$allParam = explode('|', $columnValue);
if (count($allParam) > 8) {
throw new SyntaxReportException ("Too many parameter (max=8): $columnValue", ERROR_TOO_MANY_PARAMETER, null, __FILE__, __LINE__, $this->fr_error);
throw new UserReportException ("Too many parameter (max=8): $columnValue", ERROR_TOO_MANY_PARAMETER);
}
// First Parameter: Split PageId|PageAlias and URL Params
......@@ -965,15 +963,15 @@ class Report {
* @param string $columnValue
*
* @return string rendered link
* @throws SyntaxReportException
* @throws UserReportException
*/
private function doFixColPosDownload($columnValue) {
$tokenList = '';
if ($columnValue == '') {
throw new SyntaxReportException ("Missing parameter for " . DOWNLOAD_MODE_PDF . '/' . DOWNLOAD_MODE_FILE .
'/' . DOWNLOAD_MODE_ZIP, ERROR_MISSING_REQUIRED_PARAMETER, null, __FILE__, __LINE__, $this->fr_error);
throw new UserReportException ("Missing parameter for " . DOWNLOAD_MODE_PDF . '/' . DOWNLOAD_MODE_FILE .
'/' . DOWNLOAD_MODE_ZIP, ERROR_MISSING_REQUIRED_PARAMETER);
}
// Split definition
......
......@@ -45,7 +45,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testLinkUrlBasic() {
$link = new Link($this->sip, true);
......@@ -102,7 +101,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testLinkPageBasic() {
$link = new Link($this->sip, true);
......@@ -128,7 +126,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testLinkMailBasic() {
$link = new Link($this->sip, true);
......@@ -161,7 +158,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testMailEncryption() {
$link = new Link($this->sip, true);
......@@ -837,7 +833,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testLinkUrlParam() {
$link = new Link($this->sip, true);
......@@ -880,7 +875,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testTooltip() {
$link = new Link($this->sip, true);
......@@ -919,7 +913,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testAltText() {
$link = new Link($this->sip, true);
......@@ -940,7 +933,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testClass() {
$link = new Link($this->sip, true);
......@@ -967,7 +959,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testTarget() {
$link = new Link($this->sip, true);
......@@ -994,7 +985,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testRight() {
$link = new Link($this->sip, true);
......@@ -1030,7 +1020,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
/**
* @throws SyntaxReportException
*/
public function testSip() {
$link = new Link($this->sip, true);
......@@ -1081,7 +1070,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
}
/**
* @throws SyntaxReportException
*/
public function testQuestion() {
$link = new Link($this->sip, true);
......
......@@ -9,6 +9,7 @@ require_once(__DIR__ . '/../../qfq/report/Report.php');
//require_once(__DIR__ . '/../../qfq/store/Store.php'); // Should be included in the parent class AbstractDatabaseTest
require_once(__DIR__ . '/../../qfq/Evaluate.php');
require_once(__DIR__ . '/../../qfq/store/Session.php');
require_once(__DIR__ . '/../../qfq/exceptions/UserReportExtension.php');
const TOTAL_COUNT_PERSON_GENERIC_SQL = 2;
......@@ -101,7 +102,7 @@ class ReportTest extends AbstractDatabaseTest {
}
/**
* @expectedException \qfq\SyntaxReportException
* @expectedException UserReportException
*/
public function testUnknownTokenException() {
......
Markdown is supported
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