Commit 7deb33ed by Frederick d. Maus

local - not interesting

1 parent 45813a0c
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
*/ */
class D { class D {
const ALL = 'ALL';
private static $echo_count = 0; private static $echo_count = 0;
public static $echo_lines = array(); public static $echo_lines = array();
...@@ -54,7 +56,7 @@ class D { ...@@ -54,7 +56,7 @@ class D {
$file_content = ''; $file_content = '';
foreach(self::$echo_lines as $line_nr => $line) { foreach(self::$echo_lines as $line_nr => $line) {
if($__mc_D_LOGFILE_ONLY_USER === $line['print']) { if($__mc_D_LOGFILE_ONLY_USER === $line['print'] || D::ALL ===$line['print']) {
$file_content .= $line_nr.':'.mcCONST::TAB.self::html2text($line['line']).mcCONST::LINEBREAK; $file_content .= $line_nr.':'.mcCONST::TAB.self::html2text($line['line']).mcCONST::LINEBREAK;
} }
} }
......
...@@ -12,18 +12,28 @@ ...@@ -12,18 +12,28 @@
*/ */
class mcPDOLogger { class mcPDOLogger {
private static $Messages = array(); private static $Messages = array();
public static function add($param_order, array $param_bindValueArray=null, $param_optional='') { public static function add($param_order, array $param_bindValueArray=null, $param_count_result=false, $param_optional='') {
mcPDOLogger::$Messages[] = array( mcPDOLogger::$Messages[] = array(
'order' => $param_order, 'order' => $param_order,
'bindValue' => $param_bindValueArray, 'bindValue' => $param_bindValueArray,
'optional' => $param_optional 'optional' => $param_optional,
'count_result' => $param_count_result,
); );
} }
public static function getMessagesAsText() { public static function getMessagesAsText() {
$MessageAsText = ''; $MessageAsText = '';
foreach(mcPDOLogger::$Messages as $message) { foreach(mcPDOLogger::$Messages as $index => $message) {
$MessageAsText .= "\n".$message['order']."\n"; arsort($message['bindValue']);
foreach($message['bindValue'] as $string => $value) {
if(is_string($value)) {
$value = "'".$value."'";
}
$message['order'] = str_replace($string, $value, $message['order']);
}
$MessageAsText .= "\n".$index.":\t".trim($message['order'])."\n\t\tcount:\t".$message['count_result']."\n";
} }
mcPDOLogger::$Messages = array(); mcPDOLogger::$Messages = array();
......
...@@ -78,5 +78,20 @@ class mcCsv { ...@@ -78,5 +78,20 @@ class mcCsv {
} }
} }
public static function exportXmlToCsv($param_xml,$param_name, $param_charset='utf-8', $param_filename='download.csv'){
$csv_value=explode('CUT_VALUE_FOR_NOT_THE_HEADER',$param_xml);
// Header senden
header("Content-type: text/csv; charset='.$param_charset");
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header("Content-Disposition: attachment; filename =".$param_filename);
header('Pragma: no-cache');
// Datei ausgeben
echo strip_tags(htmlspecialchars_decode(trim($csv_value[1])));
}
} }
?> ?>
\ No newline at end of file
...@@ -9,7 +9,7 @@ class mcException extends mcEvent { ...@@ -9,7 +9,7 @@ class mcException extends mcEvent {
// if($e->getPrevious()) { // if($e->getPrevious()) {
// D::e('there is a previous exception'); // D::e('there is a previous exception');
// } // }
D::cf('ERROR', D::ALL);
if(get_class($e) == 'PDOException') { if(get_class($e) == 'PDOException') {
foreach($e->getTrace() as $i => $array) { foreach($e->getTrace() as $i => $array) {
// D::li($i); // D::li($i);
...@@ -37,6 +37,7 @@ class mcException extends mcEvent { ...@@ -37,6 +37,7 @@ class mcException extends mcEvent {
public static $count =0; public static $count =0;
private static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) { private static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcException($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext)); self::add(new mcException($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
self::$count++; self::$count++;
} }
} }
......
...@@ -13,19 +13,23 @@ mcReport::distribute($__mc_Report); ...@@ -13,19 +13,23 @@ mcReport::distribute($__mc_Report);
* developer things * developer things
*/ */
if($_LOSP_DEV) { if($_LOSP_DEV) {
if($__mc_PDO_LOGFILE) {
$PDOLog = mcPDOLogger::getMessagesAsText();
mcFile::write($__mc_PDO_LOGFILE, $PDOLog, 'a');
}
mcPerformance::showStats($__mc_D_LOGFILE_ONLY_USER); mcPerformance::showStats($__mc_D_LOGFILE_ONLY_USER);
D::showStats($__mc_Report, $__BASEPATH_EX, $__mc_D_LOGFILE); D::showStats($__mc_Report, $__BASEPATH_EX, $__mc_D_LOGFILE);
if($__mc_D_SCREENOUTPUT) { if($__mc_D_SCREENOUTPUT) {
D::printToScreen(); D::printToScreen();
} }
if($__mc_D_LOGFILE) { if($__mc_D_LOGFILE) {
// D::li($__mc_D_LOGFILE); // D::li($__mc_D_LOGFILE);
D::printToFile($__mc_D_LOGFILE,'a'); D::printToFile($__mc_D_LOGFILE,'a');
} }
if($__mc_PDO_LOGFILE) {
$PDOLog = mcPDOLogger::getMessagesAsText();
mcFile::write($__mc_PDO_LOGFILE, $PDOLog, 'a');
}
} }
?> ?>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!