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

AbstractException: dump arrays too.

DbException: minor renaming.
HelpFormElement: New buildFormElementId.
Support: New log().
parent e931fc01
......@@ -46,6 +46,9 @@ class AbstractException extends \Exception {
// Layout
$html = '<tr bgcolor="#dddddd"><td colspan="2">Exception</td></tr>';
foreach ($this->messageArray as $key => $value) {
if(is_array($value)) {
$value = var_export($value, true);
}
$html .= "<tr>" . "<td>$key</td>" . "<td>$value</td>" . "</tr>";
}
......
......@@ -30,7 +30,7 @@ class DbException extends AbstractException {
$this->messageArray['Form Element'] = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
$this->messageArray['Form Element Column'] = Store::getVar(SYSTEM_FORM_ELEMENT_COLUMN, STORE_SYSTEM);
$this->messageArray['SQL before evaluation'] = Store::getVar(SYSTEM_SQL_RAW, STORE_SYSTEM);
$this->messageArray['SQL after evaluation'] = Store::getVar(SYSTEM_SQL_FINAL, STORE_SYSTEM);
$this->messageArray['SQL final'] = Store::getVar(SYSTEM_SQL_FINAL, STORE_SYSTEM);
$this->messageArray['SQL Params'] = Store::getVar(SYSTEM_SQL_PARAM_ARRAY, STORE_SYSTEM);
return parent::formatException();
......
......@@ -50,4 +50,8 @@ class HelperFormElement {
}
}
public static function buildFormElementId($field, $id) {
return($field . ':' . $id);
}
}
\ No newline at end of file
......@@ -60,4 +60,23 @@ class Support {
return implode('&', $items);
}
/**
* @throws CodeException
*/
public static function log($text) {
if (!is_writable(QFQ_LOG)) {
throw new CodeException ("The file (" . dirname($_SERVER['SCRIPT_FILENAME']) . '/) ' . QFQ_LOG . " is not writable ()", ERROR_LOG_NOT_WRITABLE);
}
if (!$handle = fopen(QFQ_LOG, 'a')) {
throw new CodeException ("Cannot open file to apped: " . QFQ_LOG, ERROR_LOG_NOT_WRITABLE);
}
if (fwrite($handle, $text . chr(10)) === FALSE) {
throw new CodeException ("Cannot write to file: " . QFQ_LOG, ERROR_LOG_NOT_WRITABLE);
}
fclose($handle);
}
}
\ No newline at end of file
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