示例#1
0
 function index()
 {
     //_cfg::$fileIni = 'magé';
     echo o::pt(_cfg::this());
     //_cfg::saveConfig(RPATH.'teste.ini');
     _view::set('inicial');
 }
示例#2
0
function _cfg($var = null)
{
    return _cfg::get($var);
}
示例#3
0
文件: user.php 项目: elandio/pizza-10
 /**
  * verifica se o charset é compatível com o usuário/browser
  */
 function getCharset($c = '')
 {
     if ($c == '') {
         $c = \_cfg::this()->charset;
     }
     if (isset($_SERVER['HTTP_ACCEPT_CHARSET']) && strrpos(strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']), strtoupper($c)) !== false) {
         return true;
     } else {
         return false;
     }
 }
示例#4
0
    /**
     * Procura por uma ajuda sobre o erro
     *
     * @param $nHelpCod number	Código de erro interno
     * @return html		Retorna uma ajuda sobre o erro atual ou uma string vazia se não existir
     */
    protected function _errorGetHelp()
    {
        if ($this->classPath == null) {
            return '';
        }
        //Definindo os caminhos
        $neos = strpos(PATH_NEOS, 'phar:') === false ? PATH_NEOS : dirname(str_replace('phar://', '', PATH_NEOS));
        $app = strpos(PATH_APP, 'phar:') === false ? PATH_APP : dirname(str_replace('phar://', '', PATH_APP));
        //Procurando os arquivos de help
        if (!\_cfg::this()->error['helpPath'] == '' && file_exists(\_cfg::this()->error['helpPath'])) {
            $dir = 'phar://' . trim(\_cfg::$error['helpPath'], ' /\\') . '/';
        } elseif (file_exists(PATH . '/help.phar')) {
            $dir = 'phar://' . PATH . '/help.phar/';
        } elseif (file_exists($neos . '/help.phar')) {
            $dir = 'phar://' . $neos . '/help.phar/';
        } elseif (file_exists($app . '/help.phar')) {
            $dir = 'phar://' . $app . '/help.phar/';
        } else {
            return '';
        }
        $o = false;
        $x = explode('/', str_replace(array('\\', '/'), '/', strtolower($this->classPath)));
        for ($i = count($x); $i > 0; $i--) {
            $path = $dir . implode('/', $x) . '/error_' . $this->codigo . '.php';
            if (file_exists($path)) {
                ob_start();
                eval('?>' . file_get_contents($path));
                $o = ob_get_clean();
                break;
            }
            array_pop($x);
        }
        //checando se o arquivo foi encontrado - [não -> carrega o default]
        if (isset($o)) {
            return '<h2>Informações</h2>
			<div id="ajuda">
			' . $o . '</div>';
        }
        return '';
    }
示例#5
0
 function index()
 {
     o::go('inicialize');
     _cfg::loadConfig('app');
     exit(o::pt(_cfg::this()));
 }
示例#6
0
文件: user.php 项目: elandio/pizza-10
 /**
  * carrega os parametros de configuração
  */
 private function _config()
 {
     $this->setup['db'] = '';
     if (isset(\_cfg::this()->user)) {
         foreach (\_cfg::this()->user as $k => $v) {
             $this->setup[$k] = $v;
         }
         return true;
     } else {
         return false;
     }
 }
示例#7
0
文件: main.php 项目: elandio/pizza-10
 private function runController($url)
 {
     $url = strtolower($url);
     //definindo os valores default
     $ctrl = \_cfg::this()->ctrl;
     $func = \_cfg::this()->func;
     $args = \_cfg::this()->args;
     //pegando os elementos (controller/function/args)
     if ($url != '') {
         $uri = explode('/', $url);
         if (isset($uri[0])) {
             $ctrl = array_shift($uri);
         }
         //pegando o controller
         if (isset($uri[0])) {
             $func = array_shift($uri);
         }
         //pegando o método
         if (isset($uri[0])) {
             $args = $uri;
         }
         //pegando os dados
     }
     //controller
     $fctrl = CTRL . $ctrl . '.php';
     //pegando os dados 'default' se o controller não existir
     if (!file_exists($fctrl)) {
         $ctrl = \_cfg::this()->ctrl;
         $func = \_cfg::this()->func;
         $args = \_cfg::this()->args;
     }
     //carregando o arquivo do controller
     include CTRL . $ctrl . '.php';
     //instanciando a classe
     $ctrl = 'Controller_' . ucfirst($ctrl);
     $class = new $ctrl();
     //definendo e chamando o método do controller
     if (is_callable(array($class, $func))) {
         call_user_func_array(array($class, $func), $args);
     } elseif (is_callable(array($class, \_cfg::this()->func))) {
         $func = \_cfg::this()->func;
         call_user_func_array(array($class, $func), $args);
     } else {
         exit('FATAL ERROR :: Método "' . \_cfg::this()->func . '" não existe');
     }
     //atualizando os dados no config
     \_cfg::this()->ctrl = $ctrl;
     \_cfg::this()->func = $func;
     \_cfg::this()->args = $args;
     //retornando a instância do controller
     return $class;
 }