server {
listen 00.00.00.00:443;
server_name site.com www.site.com;
ssl on;
ssl_certificate /home/admin/conf/web/ssl.site.com.crt;
# ssl_certificate /home/admin/conf/web/ssl.site.com.pem;
ssl_certificate_key /home/admin/conf/web/ssl.site.com.key; error_log /var/log/apache2/domains/site.com.error.log error;
location / {
proxy_pass https://00.00.00.00:8443;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|odt|ods|odp|odf|tar|wav|bmp|rtf|js|mp3|avi|mpeg|flv|html|htm)$ {
root /home/admin/web/site.com/public_html;
access_log /var/log/apache2/domains/site.com.log combined;
access_log /var/log/apache2/domains/site.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/site.com/document_errors/;
}
location @fallback {
proxy_pass https://00.00.00.00:8443;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/snginx.site.com.conf*;
}
HttpException in AuthorizesRequests.php line 94: This action is unauthorized.
in AuthorizesRequests.php line 94
at Controller->createGateUnauthorizedException('if-authuser-allows', object(User), 'This action is unauthorized.', object(UnauthorizedException)) in AuthorizesRequests.php line 63
at Controller->authorizeAtGate(object(Gate), 'if-authuser-allows', object(User)) in AuthorizesRequests.php line 24
at Controller->authorize('if-authuser-allows', object(User)) in UsersController.php line 90
at UsersController->deletedposts('tg')
at call_user_func_array(array(object(UsersController), 'deletedposts'), array('userslug' => 'tg')) in Controller.php line 256
at Controller->callAction('deletedposts', array('userslug' => 'tg')) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(UsersController), object(Route), 'deletedposts') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(UsersController), object(Route), object(Request), 'deletedposts') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\UsersController', 'deletedposts') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
1/2 UnauthorizedException in HandlesAuthorization.php line 28: This action is unauthorized.
in HandlesAuthorization.php line 28
at Gate->deny() in Gate.php line 224
at Gate->authorize('if-authuser-allows', object(User)) in AuthorizesRequests.php line 59
at Controller->authorizeAtGate(object(Gate), 'if-authuser-allows', object(User)) in AuthorizesRequests.php line 24
at Controller->authorize('if-authuser-allows', object(User)) in UsersController.php line 90
at UsersController->deletedposts('tg')
at call_user_func_array(array(object(UsersController), 'deletedposts'), array('userslug' => 'tg')) in Controller.php line 256
at Controller->callAction('deletedposts', array('userslug' => 'tg')) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(UsersController), object(Route), 'deletedposts') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(UsersController), object(Route), object(Request), 'deletedposts') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\UsersController', 'deletedposts') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
<?php namespace YAAP\Theme;
use Illuminate\Container\Container;
use Illuminate\View\ViewFinderInterface;
use YAAP\Theme\Exceptions\ThemeException;
/**
* Class Theme
* @package YAAP\Theme
*/
class Theme
{
/**
* The IoC Container
*
* @var Container
*/
protected $app;
/**
* Default view finder
*
*/
protected $finder;
/**
* theme config
*
*/
protected $config;
/**
* parent themes
*
*/
protected $parents;
/**
* cache for paths
*/
protected $cache;
/**
* current theme
*/
protected $theme;
/**
* Build a new Theme manager
*
* @param Container $app
* @param ViewFinderInterface $finder
*/
public function __construct(Container $app, ViewFinderInterface $finder)
{
$this->app = $app;
$this->finder = $finder;
}
/**
*
* Initialize a theme by name
* @param $theme
* @throws ThemeException
*/
public function init($theme)
{
if (empty($theme)) throw new ThemeException('Theme name should not be empty');
$this->theme = $theme;
// read theme path
$path = $this->app['config']->get('theme.path', base_path('resources/themes'));
//init config
$this->config = $this->_readConfig( $path . '/' . $theme . '/config.php');
// theme parents
$this->parents = array();
while (!empty($theme)) {
if (!is_dir($path . '/' . $theme)) throw new ThemeException('Theme '.$theme.' not found.');
// add theme's root folder
$this->finder->addLocation($path . '/' . $theme);
// add folder with views
$this->finder->addLocation($path . '/' . $theme . '/views');
// read theme config
$current_theme_config = $this->_readConfig($path . '/' . $theme . '/config.php');
$theme = array_get($current_theme_config, 'inherit');
if (!empty($theme)) {
$this->parents[] = $theme;
}
}
}
/**
* Returns the list of available themes names in an array.
*
* @return array
*/
public function getList()
{
// read theme path
$path = $this->app['config']->get('theme.path', base_path('resources/themes'));
if (file_exists($path))
{
$dir_list = dir($path);
while (false !== ($entry = $dir_list->read())) {
if (file_exists($path . '/' . $entry . '/' . 'config.php'))
$list[] = $entry;
}
}
return $list;
}
/**
* Generate an asset path for current theme.
*
* @param $path
* @param null $secure
* @param bool $version
* @throws Exceptions\ThemeException
* @return mixed
*/
public function asset($path, $secure = null, $version = false)
{
if (!$this->theme) throw new ThemeException('Theme should be init first');
$full_path = $this->_assetFullpath($path);
$asset = $this->app['url']->asset($full_path, $secure);
if ($version) {
if (is_bool($version)) {
$asset .= '?v=' . $this->_assetVersion($path);
} else {
$asset .= '?v=' . $version;
}
}
return $asset;
}
/**
* Return filemtime of given asset or null if asset doesn't exists
*
* @param $path
* @return int|null
*/
private function _assetVersion($path)
{
$full_path = $this->_assetFullpath($path);
$file_path = public_path($full_path);
if (file_exists($file_path)) {
return filemtime($file_path);
}
return null;
}
/**
*
* Try to find asset file in current theme or in parents
*
* @param $path
* @return string
*/
private function _assetFullpath($path)
{
$path = trim($path, '/');
// alredy processed
if (isset($this->cache[$path])) {
return $this->cache[$path];
}
$assets_path = trim($this->app['config']->get('theme.assets_path', 'assets/themes'), '/');
$full_path = $assets_path . '/' . $this->theme . '/' . $path;
// theme has this asset
if (!file_exists(public_path($full_path))) {
$found = false;
// loop over parents
foreach ($this->parents as $parent) {
$full_path = $assets_path . '/' . $parent . '/' . $path;
if (file_exists(public_path($full_path))) {
$found = true;
break;
}
}
// in case of failure to find asset - return default theme asset
// (404 error will be signal of promlems)
if (!$found) {
$full_path = $assets_path . '/' . $this->theme . '/' . $path;
}
}
$this->cache[$path] = $full_path;
return $full_path;
}
/**
* @param $path
* @return array|mixed
*/
private function _readConfig($path){
if (file_exists($path))
return include($path);
return array();
}
}
if (!is_dir($path . '/' . $theme)) throw new ThemeException('Theme '.$theme.' not found.');