if (!$mask) {
file_put_contents($pathname, $message . "\n", FILE_APPEND);
/var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php, line 142 Cake\Log\Engine\FileLog->log() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Log/Log.php, line 392 Cake\Log\Log::write() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Log/Log.php, line 509 Cake\Log\Log::debug() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/AppController.php, line 86 App\Controller\AppController->initialize() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/LocationController.php, line 19 App\Controller\LocationController->initialize() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Controller/Controller.php, line 242 Cake\Controller\Controller->__construct() [internal], line ?? ReflectionClass->newInstance() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 88 Cake\Controller\ControllerFactory->create() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/BaseApplication.php, line 320 Cake\Http\BaseApplication->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 86 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php, line 166 Cake\Http\Middleware\CsrfProtectionMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php, line 157 Cake\Http\Middleware\BodyParserMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php, line 189 Cake\Routing\Middleware\RoutingMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php, line 68 Cake\Routing\Middleware\AssetMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 149 Cake\Error\Middleware\ErrorHandlerMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 67 Cake\Http\Runner->run() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Server.php, line 99 Cake\Http\Server->run() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/webroot/index.php, line 37 [main]
$success = $this->_File->ftruncate(0) &&
$this->_File->fwrite($contents) &&
$this->_File->fflush();
SplFileObject->fwrite() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php, line 142 Cake\Cache\Engine\FileEngine->set() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Cache/Cache.php, line 269 Cake\Cache\Cache::write() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Cache/Cache.php, line 592 Cake\Cache\Cache::remember() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/AppController.php, line 237 App\Controller\AppController->getClientIPInfo() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/AppController.php, line 255 App\Controller\AppController->isBlockedClientIP() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/AppController.php, line 98 App\Controller\AppController->initialize() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/src/Controller/LocationController.php, line 19 App\Controller\LocationController->initialize() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Controller/Controller.php, line 242 Cake\Controller\Controller->__construct() [internal], line ?? ReflectionClass->newInstance() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php, line 88 Cake\Controller\ControllerFactory->create() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/BaseApplication.php, line 320 Cake\Http\BaseApplication->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 86 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php, line 166 Cake\Http\Middleware\CsrfProtectionMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php, line 157 Cake\Http\Middleware\BodyParserMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php, line 189 Cake\Routing\Middleware\RoutingMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php, line 68 Cake\Routing\Middleware\AssetMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 149 Cake\Error\Middleware\ErrorHandlerMiddleware->process() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Runner.php, line 67 Cake\Http\Runner->run() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Server.php, line 99 Cake\Http\Server->run() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/webroot/index.php, line 37 [main]
$message = "Unable to emit headers. Headers sent in file=$file line=$line";
trigger_error($message, E_USER_WARNING);
}
/var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 71 Cake\Http\ResponseEmitter->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/webroot/index.php, line 37 [main]
$reasonPhrase = $response->getReasonPhrase();
header(sprintf(
'HTTP/%s %d%s',
/var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 164 Cake\Http\ResponseEmitter->emitStatusLine() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 74 Cake\Http\ResponseEmitter->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/webroot/index.php, line 37 [main]
foreach ($values as $value) {
header(sprintf(
'%s: %s',
/var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 197 Cake\Http\ResponseEmitter->emitHeaders() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 75 Cake\Http\ResponseEmitter->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/vendor/cakephp/cakephp/src/Http/Server.php, line 137 Cake\Http\Server->emit() /var/www/mapa.conflictosmineros.net/ocmal_db-v2/webroot/index.php, line 37 [main]
|
|
$backend = static::pool($config); |
|
$success = $backend->set($key, $value); |
|
if ($success === false && $value !== '') { |
|
throw new CacheWriteException(sprintf( |
|
"%s cache was unable to write '%s' to %s cache", |
|
$config, |
|
$key, |
|
get_class($backend) |
if ($existing !== null) { |
|
return $existing; |
|
} |
|
$results = $callable(); |
|
self::write($key, $results, $config); |
|
|
|
return $results; |
|
} |
|
|
|
|
protected function getClientIPInfo($field=null) |
|
{ |
|
$clientIP=$this->request->clientIp(); |
|
$clientInfo=Cache::remember('client_ip_info'.base64_encode($clientIP) , function() use ($clientIP) |
|
{ |
|
$clientID=unserialize(file_get_contents("http://ip-api.com/php/".$clientIP)); |
|
return $clientID; |
|
}); |
{ |
|
// add IP addresses to be blocked in array |
|
if (in_array($this->request->clientIp(),['88.198.158.233'])) return true; |
|
// add countries to be blocked in array |
|
return in_array($this->getClientIPInfo('countryCode'),['RU']); |
|
} |
|
|
|
|
|
protected function enableCaching($public=true,$expires='+1 days') |
$this->set('OCMAL_DB_ENABLE_CDNJS',Configure::read('OCMAL_DB_ENABLE_CDNJS')); |
|
|
|
|
|
// return invalid request if client IP is blocked |
|
if ($this->isBlockedClientIP()) $this->invalidRequest(); |
|
|
|
|
|
// get full Server name for use in other controllers |
|
$parse_url = parse_url(Router::url('/', true)); |
class LocationController extends AppController |
|
{ |
|
public function initialize(): void |
|
{ |
|
parent::initialize(); |
|
$this->loadComponent('RequestHandler'); |
|
$this->loadComponent('RemoteServices'); |
|
} |
|
|
if ($components !== null) { |
|
$this->components($components); |
|
} |
|
|
|
$this->initialize(); |
|
|
|
if (isset($this->components)) { |
|
triggerWarning( |
|
'Support for loading components using $components property is removed. ' . |
// The request is in the container by default. |
|
if ($this->container->has($className)) { |
|
$controller = $this->container->get($className); |
|
} else { |
|
$controller = $reflection->newInstance($request); |
|
} |
|
|
|
return $controller; |
|
} |
if (Router::getRequest() !== $request) { |
|
Router::setRequest($request); |
|
} |
|
|
|
$controller = $this->controllerFactory->create($request); |
|
|
|
// This is needed for auto-wiring. Should be removed in 5.x |
|
$container->add(ComponentRegistry::class, $controller->components()); |
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
|
} |
|
|
|
return new Response([ |
|
'body' => 'Middleware queue was exhausted without returning a response ' |
if ($method === 'GET' && $cookieData === null) { |
|
$token = $this->createToken(); |
|
$request = $request->withAttribute('csrfToken', $this->saltToken($token)); |
|
/** @var mixed $response */ |
|
$response = $handler->handle($request); |
|
|
|
return $this->_addTokenCookie($token, $request, $response); |
|
} |
|
|
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
if (!in_array($request->getMethod(), $this->methods, true)) { |
|
return $handler->handle($request); |
|
} |
|
[$type] = explode(';', $request->getHeaderLine('Content-Type')); |
|
$type = strtolower($type); |
|
if (!isset($this->parsers[$type])) { |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
); |
|
} |
|
$matching = Router::getRouteCollection()->getMiddleware($middleware); |
|
if (!$matching) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$container = $this->app instanceof ContainerApplicationInterface |
|
? $this->app->getContainer() |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
$url = $request->getUri()->getPath(); |
|
if (strpos($url, '..') !== false || strpos($url, '.') === false) { |
|
return $handler->handle($request); |
|
} |
|
|
|
if (strpos($url, '/.') !== false) { |
|
return $handler->handle($request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
try { |
|
return $handler->handle($request); |
|
} catch (RedirectException $exception) { |
|
return $this->handleRedirect($exception); |
|
} catch (Throwable $exception) { |
|
return $this->handleException($exception, $request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
) { |
|
Router::setRequest($request); |
|
} |
|
|
|
return $this->handle($request); |
|
} |
|
|
|
/** |
|
* Handle incoming server request and return a response. |
} |
|
|
|
$this->dispatchEvent('Server.buildMiddleware', ['middleware' => $middleware]); |
|
|
|
$response = $this->runner->run($middleware, $request, $this->app); |
|
|
|
if ($request instanceof ServerRequest) { |
|
$request->getSession()->close(); |
|
} |
$server = new Server(new Application(dirname(__DIR__) . '/config')); |
|
|
|
// Run the request/response through the application |
|
// and emit the response. |
|
$server->emit($server->run()); |
|
|
If you want to customize this error message, create templates/Error/error500.ctp