Пример #1
0
 public function __construct($door = "")
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     $domain = Navigation::getURIDomain();
     if ($door) {
         //use em $door ":8080" por exemplo
         $domain = str_replace($door, "", $domain);
     }
     include "configs/" . $domain . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
 }
Пример #2
0
 public function __construct()
 {
     //iniciando a config básico, a menos que exita outro config, este vai ser o que vai ficar valendo
     include "configs/" . str_replace(":8888", "", Navigation::getURIDomain()) . "/config.php";
     //se não foi passado algum locale na url apos o nome do site faz um redirect passando o locale padrão
     //echo Debug::li(Config::getAliasFolder());
     $folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     //echo Debug::li(Config::getRootApplication());
     //$folders_array = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
     $locale = Config::getLocale();
     Translation::setLocale($locale);
     //inicia e pega resultado da controller
     $this->HttpResult = $this->getControllerResult();
     //agora verifica que tipo de retorno esperado e chama a view, se for o caso
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     $retornoDaView = self::searchFile($url, Config::getFolderView());
     //Navigation::searchFileOrFolder(Config::getRootApplication()."/".Config::getLocale(), Config::getFolderView(), Navigation::SEARCH_FILE_MODE_FILE);
     //echo Debug::li("retornoDaView");
     //Debug::print_r($retornoDaView);
     if ($retornoDaView->success) {
         //echo Debug::li("retornoDaView:".$retornoDaView->urlToInclude);
         $this->view = $retornoDaView->urlToInclude;
     } else {
         $this->view = Config::getFolderView() . "/index.php";
     }
     //exit();
     //Debug::print_r("[SEARCH_FILE_MODE_CLASS_AND_METHOD]:".Navigation::searchFileOrFolder(Config::FOLDER_ROOT_APPLICATION, "view/democrart/", Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD, "", TRUE));
 }
Пример #3
0
<?php

/**
Event::listen('illuminate.query', function($query)
{
   var_dump($query);
});
* 
*/
Route::group(['prefix' => 'lang', 'middleware' => ['locale']], function () {
    Route::get('{lang}', function ($lang) {
        Translation::setLocale($lang);
        $previous = URL::previous();
        $new = preg_replace('/(\\.[a-z]{2,5})(\\/[a-z]{0,2})?\\//', "\$1/" . $lang . "/", $previous);
        return Redirect::to($new);
    });
});
Route::group(['prefix' => Translation::getRoutePrefix(), 'middleware' => ['locale']], function () {
    Route::group(['middleware' => 'auth'], function () {
        Route::group(['middleware' => 'access.routeNeedsRoleOrPermission', 'role' => ['Administrator'], 'permission' => ['view_backend'], 'redirect' => '/', 'with' => ['flash_danger', 'You do not have access to do that.']], function () {
            Route::get('download/{file}', function ($file) {
                $file_path = storage_path() . '/' . $file;
                //dd($file_path);
                if (file_exists($file_path)) {
                    // Send Download
                    $filename = preg_filter('/[^\\d\\w\\s \\.]/', '_', $file);
                    return Response::download($file_path, $filename, ['Content-Length: ' . filesize($file_path)], 'attachment');
                } else {
                    // Error
                    exit('Requested file does not exist on our server!');
                }