/**
* Sobrecarga da função __autoload do php
* Faz o include automaticamente do arquivo da classe
* Utiliza o arquivo XML de definições de diretórios e arquivos como base
* @param string Nome da classe
*/
function __autoload($stClasse)
{
    try {
        switch (true) {
            case is_file($ar['stArquivo'] = definicaoPasta::tema() . $stClasse . '.php'):
                include_once $ar['stArquivo'];
                break;
            case defined('diretorioPrioritario') && is_file($ar['stArquivo'] = diretorioPrioritario . $stClasse . '.php'):
                include_once $ar['stArquivo'];
                break;
            case defined('diretorioPrioritario') && is_file($ar['stArquivo'] = diretorioPrioritario . $stClasse . '.php'):
                include_once $ar['stArquivo'];
                break;
            default:
                $ar = definirDiretorio($stClasse);
                switch (true) {
                    case !is_dir($ar['stDiretorio']):
                        throw new erroInclusao("Diretório [{$ar['stDiretorio']}] inexistente!");
                        break;
                    case !is_file($ar['stArquivo']):
                        throw new erroInclusao("Arquivo [{$ar['stArquivo']}] inexistente!");
                        break;
                    case !is_readable($ar['stArquivo']):
                        throw new erroInclusao("Arquivo [{$ar['stArquivo']}] sem permissão de leitura!");
                        break;
                    default:
                        include_once $ar['stArquivo'];
                        break;
                }
        }
    } catch (erroInclusao $e) {
        echo $e->__toHtml();
    } catch (Exception $e) {
        if (strtolower(ini_get('display_errors')) == 'on') {
            $debug = debug_backtrace();
            echo "\n\t\t\t\t<link rel='stylesheet' href='.sistema/debug.css' />\n\t\t\t\t<div class='erroNegro'>\n\t\t\t\t\t<table summary='text' class='erroNegro'>\n\t\t\t\t\t\t<tr><th colspan=2 >Tentativa de instanciar uma classe inexistente!</th></tr>\n\t\t\t\t\t\t<tr><td>Classe:</td><td><font size='6px'>{$stClasse} ???</font></td></tr>\n\t\t\t\t\t\t<tr><td>Arquivo:</td><td>{$debug[0]['file']}</td></tr>\n\t\t\t\t\t\t<tr><td>Linha:</td><td>{$debug[0]['line']}</td></tr>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t";
            die;
        }
    }
}
示例#2
0
            $tipoErro = 'Notice';
            $imagemErro = 'notice.png';
            break;
        case E_WARNING:
            $tipoErro = 'Warning';
            break;
        case E_PARSE:
            $tipoErro = 'Parser';
            break;
        case E_COMPILE_ERROR:
            $tipoErro = 'Fatal';
            break;
    }
    if (preg_match('/(.*)\\.html\\.php(.*)/', $arquivo, $resultado)) {
        $mensagem = str_replace('Undefined index:', 'Variável não registrada no controle para apresentação no template: ', $mensagem);
        $back = null;
    } else {
        ob_start();
        debug_print_backtrace();
        $back = ob_get_clean();
    }
    echo "\n\t\t<link type='text/css' rel='stylesheet' href='.sistema/debug.css' />\n\t\t<fieldset class='erroNegro'>\n\t\t\t<legend>{$tipoErro}</legend>\n\t\t\t<img src='.sistema/imagens/{$imagemErro}' alt='[imagem]'>\n\t\t\t<table summary='text' class='erroNegro'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Mensagem:</td>\n\t\t\t\t\t<td><b>{$mensagem}</b></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>Arquivo:</td>\n\t\t\t\t\t<td>## {$arquivo}({$linha})</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t<pre>{$back}\n\t\t</pre>\n\t\t</fieldset>";
}
include_once '.sistema/debug.php';
include_once '.sistema/definicoes.php';
$dir = definirDiretorio('Sistema');
define('diretorioPrioritario', $dir['stDiretorio']);
if (isset($_GET['c'])) {
    $_GET['c'] = is_numeric($_GET['c']) ? 'CSsd_Retorno' : $_GET['c'];
}
new gerenteControles(isset($_REQUEST['c']) ? $_REQUEST['c'] : definicaoSistema::pegarControleInicial());