コード例 #1
0
 public static function run()
 {
     new session();
     //Suprimir Warnings
     error_reporting(E_WARNING);
     if (!isset($_SESSION['usuario'])) {
         if ($_GET['class']) {
             echo "\n\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\ttop.location='./';\n\t\t\t\t\t\t</script>\n\t\t\t\t\t";
         }
         $pagina = new login();
         $pagina->show();
     } else {
         //$template = file_get_contents('app.view/template.class.php');
         $template = new template();
         ob_start();
         $template->show();
         $template = ob_get_contents();
         ob_get_clean();
         $content = '';
         /*
          *  Se tiver parametros na URL, carrega a classe
          */
         if ($_GET) {
             $class = $_GET['class'];
             if (class_exists($class)) {
                 $pagina = new $class();
                 ob_start();
                 $pagina->show();
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 if (function_exists($method)) {
                     call_user_func($method, $_GET);
                 }
             }
         } else {
             $pagina = new home();
             ob_start();
             $pagina->show();
             $content = ob_get_contents();
             ob_end_clean();
         }
         /*
          *  Susbstitui a string #CONTENT# do template para a pagina principal
          */
         $site = str_replace('#CONTENT#', $content, $template);
         echo $site;
     }
 }
コード例 #2
0
 /**
  * Funcao run
  * Carrega conteudo da pagina
  * 
  * @access  public
  * @return  void
  */
 public static function run()
 {
     //Suprimir Warnings
     //error_reporting(E_WARNING);
     new TSession(1);
     //Não tem Usuario ativo
     if (!isset($_SESSION['usuario'])) {
         $pagina = new login();
         $pagina->show();
     } else {
         //$template = file_get_contents('app.view/template.class.php');
         $template = new template();
         ob_start();
         $template->show();
         $template = ob_get_contents();
         ob_get_clean();
         $content = '';
         /*
          *  Se tiver parametros na URL, carrega a classe
          */
         if ($_GET) {
             $class = urldecode($_GET['class']);
             if (class_exists($class)) {
                 if (isset($_GET['funcao'])) {
                     $funcao = $_GET['funcao'];
                     $class = $class . '_' . $funcao;
                     if (class_exists($class)) {
                         $pagina = new $class();
                     } else {
                         $pagina = new erro();
                         $pagina->codigo = 404;
                         ob_start();
                         $pagina->show();
                         $content = ob_get_contents();
                         ob_end_clean();
                     }
                 } else {
                     $pagina = new $class();
                 }
                 ob_start();
                 $pagina->show();
                 $content = ob_get_contents();
                 ob_end_clean();
             } else {
                 $pagina = new erro();
                 $pagina->codigo = 404;
                 ob_start();
                 $pagina->show();
                 $content = ob_get_contents();
                 ob_end_clean();
             }
         } else {
             $pagina = new home();
             ob_start();
             $pagina->show();
             $content = ob_get_contents();
             ob_end_clean();
         }
         /*
          *  Susbstitui a string #CONTENT# do template para a pagina principal
          */
         $site = str_replace('#CONTENT#', $content, $template);
         echo $site;
     }
 }