doOnTheStart.php 3.79 KB
<?php
/** 
 * @copyright (c) 2014, netz.coop eG
 */
require_once $__PATH_to_mcClasses .'include.php';
require_once $__PATH_to_mcClasses .'config.php';
if(is_file('local.conf.php')) {
	include 'local.conf.php';
}
/**
 * dinge die am Ende noch ausgeführt werden sollen
 *
 * (nur für Dinge die unter mcClasses sind)
 * 
 * @author f@mensch.coop @since 2010-12-17
 */
if($__mc_ERRORHANDLER) {
	require_once $__PATH_to_mcClasses.'ReportHandling/fnc_mcErrorHandler.inc.php';
	set_error_handler('mcErrorHandler');
}

if($_LOSP_DEV) {
	error_reporting(E_ALL);

	

	if($__mc_D_LOGFILE) {
		if($__mc_D_LOGFILE_RESET) {
			$var_message = '['.date('d. m. Y  G:i').'] DEVMODE: logfile wurde zurvor geloescht';
			unlink ( $__mc_D_LOGFILE );
			mcFile::write($__mc_D_LOGFILE, $var_message, 'w');			
		} else {
			$var_message =	mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK
							.'################################################'.mcCONST::LINEBREAK
							.'################################################'.mcCONST::LINEBREAK
							.'################################################'.mcCONST::LINEBREAK
							.'# ['.date('d. m. Y  G:i').'] DEVMODE                #'.mcCONST::LINEBREAK
							.'################################################'.mcCONST::LINEBREAK;

			mcFile::write($__mc_D_LOGFILE, $var_message, 'a');			
		}
	}
	
	if($__mc_PDO_LOGFILE) {
		if($__mc_PDO_LOGFILE_RESET) {
			$var_message = '-- ['.date('d. m. Y  G:i').'] DEVMODE: logfile wurde zurvor geloescht';
			unlink ( $__mc_PDO_LOGFILE );
			mcFile::write($__mc_PDO_LOGFILE, $var_message, 'w');			
		} else {
			$var_message =	mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- # ['.date('d. m. Y  G:i').'] DEVMODE                #'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK;

			mcFile::write($__mc_PDO_LOGFILE, $var_message, 'a');			
		}
	}	
	
	if($__mc_INPUT_LOGFILE) {
		
		$INPUTtext = print_r(array( '_GET' => $_GET, '_POST' => $_POST ), true);
		
		if($__mc_INPUT_LOGFILE_RESET) {
			$var_message = '-- ['.date('d. m. Y  G:i').'] DEVMODE: logfile wurde zurvor geloescht';
			unlink ( $__mc_INPUT_LOGFILE );
			mcFile::write($__mc_INPUT_LOGFILE, $var_message.mcCONST::LINEBREAK.$INPUTtext, 'w');			
		} else {
			$var_message =	mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK
							.'-- # ['.date('d. m. Y  G:i').'] DEVMODE                #'.mcCONST::LINEBREAK
							.'-- ################################################'.mcCONST::LINEBREAK;

			mcFile::write($__mc_INPUT_LOGFILE, $var_message.mcCONST::LINEBREAK.$INPUTtext, 'a');			
		}
	}		
	
	
//mcFile::write('log/tmp.bla',  date('d.m.Y  G:i:s').': '.$_SERVER['SCRIPT_NAME'].' -- '.$_SERVER['REQUEST_URI'].mcCONST::TAB.($_SERVER['SCRIPT_NAME']==$_SERVER['REQUEST_URI']).mcCONST::LINEBREAK, 'a');
	if(is_array($__mc_Report)) {
		foreach($__mc_Report as $Report) {
			foreach($Report as $kindofDistribute => $params) {
				if($kindofDistribute == 'toFile') {
					if(array_key_exists('reset', $params) && $params['reset']) {
						if(is_file($params['file'])) {
							unlink($params['file']);
						}
						mcFile::write($params['file'], $var_message, 'w');
					}
				}
			}
		}		
	}


	D::start();
}