/var/www/natumbe.kz/bff/base/Application.php
$extension = $opts['extension'] ?? null;
# [Name|NameContext][_]
require_once $pathContext;
# finalize class name
# [Namespace?Class|Name][?_]
$class = $opts['class'] ?? $name;
$this->classAlias($class);
# [ClassContext][_?]
$this->classAlias($class . $context);
if (class_exists($class . $context, false)) {
$class .= $context;
}
# facade
$facade = modification($path . 'facade.php', $customize);
if (is_file($facade)) {
require_once $facade;
}
$module = $this->modules[$name][$context] = $this->make($class);
$module->setSettings('module_dir', $path);
$module->attachExtension($extension);
$module->initModule($name, $opts['class'] ?? $name);
$module->init();
$this->locale()->translationGroup($name, $module->module_title);
$this->hook($name . '.init', $module);
# cross context modules
if (in_array($name, $this->crossContextModules, true)) {
foreach ([self::CONTEXT_FRONTEND, self::CONTEXT_ADMIN] as $otherContext) {
if ($otherContext !== $context) {
$this->modules[$name][$otherContext] = $module;
}
}
}
return $module;
}
/**
* Check if module is already inited
/var/www/natumbe.kz/bff/base/Application.php
}
return $cache;
}
/**
* Get module instance
* @param string $name
* @param array $opts
* @return \Module|mixed
*/
public function module(string $name, array $opts = [])
{
$name = $this->unifyModuleName($name);
if (! empty($this->modulesRegistered[$name]['path'])) {
$opts = array_merge($opts, $this->modulesRegistered[$name]);
}
return $this->moduleInit($name, $opts);
}
/**
* Check if application module exists
* @param string $name
* @return bool
*/
public function moduleExists(string $name): bool
{
return array_key_exists(
$this->unifyModuleName($name),
$this->getModulesList()
);
}
/**
* Get module's model instance
* @param string|object $moduleName
* @param string|null $modelName
* @param bool $modelClassOnly
/var/www/natumbe.kz/bff/base/Application.php
$this->classAlias($class, $aliasOf);
$log = join('', [
'2) autoload map in "' . $group . '"',
($aliasOf ? ' (alias of ' . $aliasOf . ')' : ''),
]);
break;
}
}
}
break;
}
# alias: class_ => class
if (class_exists($class . '_', false)) {
$this->classAlias($class);
$log = '3) alias of "' . $class . '_" => "' . $class . '"';
break;
}
# try to load application module
if (mb_strpos($class, static::NS) === false) {
$this->module($class, ['throw' => false]);
$log = '4) load module';
break;
}
# class with "theme" support
$themed = (
# \views\
mb_stripos($class, static::NS . 'views' . static::NS) !== false
);
# namespace prefixed class => file path
if ($this->autoloadByNamespace($class, $themed)) {
$log = '5) class => namespace prefix';
break;
}
# namespaced class => file path
$path = str_replace(static::NS, static::DS, $class) . '.php';
if ($themed) { # themed version
if ($themePath = $this->view()->resolveFileInTheme(static::DS . $path)) {
include modification($themePath);
$this->classAlias($class);
$log = '6) class => themed path';
/var/www/natumbe.kz/bff.php
$setting = config::sysAdmin('services.enabled', true, TYPE_BOOL);
if (! $setting) {
return false;
}
$module = $this->moduleExists('svc');
if ($this->adminPanel()) {
if ($module) {
if ($moduleName) {
# Any module active service registered
return $this->filter('svc.service.active', false, $moduleName);
}
}
return $module;
} else {
# Any module active service registered
$active = $this->filter('svc.service.active', false, $moduleName);
if ($module && $active) {
# Any payway registered
$list = Bills::getPayWaysList(false);
return ! empty($list);
}
return false;
}
}
public function balanceEnabled()
{
if ($this->servicesEnabled()) {
return true;
}
$list = Bills::getPayWaysList(false);
if (empty($list)) {
return false;
}
if (
$this->pluginExists('orders\transactions') &&
$this->plugin('orders\transactions')->isEnabled()
/var/www/natumbe.kz/bff/vendor/illuminate/support/Facades/Facade.php
}
/**
* Handle dynamic, static calls to the object.
*
* @param string $method
* @param array $args
* @return mixed
*
* @throws \RuntimeException
*/
public static function __callStatic($method, $args)
{
$instance = static::getFacadeRoot();
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}
/var/www/natumbe.kz/modules/listings/views/PremiumItemsBlock.php
}
$this->loadItems($this->prepareItemsFilter($itemsId), [
'orderBy' => 'FIELD(id,' . join(',', $itemsId) . ')',
]);
if (empty($this->items)) {
return false;
}
$data['id'] = $this->id();
return $data;
}
/**
* @return Premium|mixed
*/
protected function getItemService()
{
if (bff::servicesEnabled('listings')) {
return Listings::itemServices($this->serviceKey);
}
return null;
}
public function preparePremiumItemsId()
{
$service = $this->getItemService();
if (! $service) {
return [];
}
$itemsId = $service->itemsIDs($this->order);
if (empty($itemsId)) {
return [];
}
return $itemsId;
}
public function prepareItemsFilter(array $itemsId)
{
/var/www/natumbe.kz/modules/listings/views/PremiumItemsBlock.php
$data['id'] = $this->id();
return $data;
}
/**
* @return Premium|mixed
*/
protected function getItemService()
{
if (bff::servicesEnabled('listings')) {
return Listings::itemServices($this->serviceKey);
}
return null;
}
public function preparePremiumItemsId()
{
$service = $this->getItemService();
if (! $service) {
return [];
}
$itemsId = $service->itemsIDs($this->order);
if (empty($itemsId)) {
return [];
}
return $itemsId;
}
public function prepareItemsFilter(array $itemsId)
{
$filter = array_merge($this->itemsFilter, [
'id' => $itemsId,
'is_publicated' => 1,
'status' => Listings::STATUS_PUBLICATED,
]);
if ($this->region_filter) {
$filter[':region-filter'] = Geo::filter('id');
/var/www/natumbe.kz/modules/listings/views/PremiumItemsBlock.php
protected function itemBlock(array $item)
{
# Replace gallery item template
$block = parent::itemBlock($item);
if ($block) {
$block->setTemplate('lists/premium.item', 'listings');
}
return $block;
}
public function data()
{
if (! $this->limit) {
return false;
}
$data = parent::data();
$itemsId = $this->preparePremiumItemsId();
if (empty($itemsId)) {
return false;
}
$this->loadItems($this->prepareItemsFilter($itemsId), [
'orderBy' => 'FIELD(id,' . join(',', $itemsId) . ')',
]);
if (empty($this->items)) {
return false;
}
$data['id'] = $this->id();
return $data;
}
/**
* @return Premium|mixed
*/
protected function getItemService()
/var/www/natumbe.kz/modules/listings/views/search/PremiumItemsBlock.php
/** @var string Item images view: cover, contain */
public $imagesView = 'cover';
public function init()
{
parent::init();
$this->setTemplate('search/premium.block', 'listings');
$this->limit = 3;
$this->imagesView = $this->config('listings.items.images.lists.view', 'cover');
}
public function data()
{
if (! $this->category_filter) {
$this->categoryId = 0;
}
$data = parent::data();
if ($data === false) {
return false;
}
return $data;
}
public function settingsForm($form)
{
parent::settingsForm($form);
# remove unused settings:
$form
->remove('perline')
->remove('oneline')
;
$form->checkbox('category_filter', _t('@listings', 'Take search category in account'), true)
->tip(_t('@listings', 'display listings based on current search category'))
->after('region_filter');
/var/www/natumbe.kz/bff/view/Block.php
foreach ($this->fillable as $key) {
# Do not override data keys
if (array_key_exists($key, $this->data)) {
continue;
}
$this->data[$key] = &$this->$key;
}
}
/**
* Gather data before render
* @return void
*/
protected function gatherData()
{
$this->fillSettings();
$this->fillableToData();
$this->data = $this->data();
$this->app->hook('view.block.data', $this, ['data' => & $this->data]);
if (is_array($this->data)) {
$this->blocksIterator(function ($block, $key) {
$this->data[$key] = $block;
});
}
}
/**
* Get block (and sub blocks) data without rendering
* @return array|mixed
*/
public function getData()
{
$this->gatherData();
if (is_array($this->data)) {
foreach ($this->data as $key => $value) {
/var/www/natumbe.kz/bff/view/Block.php
$wrapper['renderOptions'] ?? $this->renderOptions
);
continue;
}
if (is_callable($wrapper['template'])) {
$content = call_user_func($wrapper['template'], $content, $this->data);
}
}
}
return $content;
}
/**
* Render block content
* @return string|mixed
*/
protected function renderContent()
{
$this->gatherData();
# Try to return data
if (! is_array($this->data)) {
if ($this->data instanceof self) {
return $this->data->render();
}
# cancel render
if ($this->beforeRender() === false) {
return '';
}
# string is a render goal
if (is_string($this->data)) {
return $this->data;
}
# throw response
if ($this->data instanceof Response) {
$this->data->throw();
}
if ($this->data instanceof Closure) {
$callback = $this->data;
/var/www/natumbe.kz/bff/view/Block.php
{
$this->beforeRenderRotation();
}
/**
* After render
* @return string|mixed
*/
protected function afterRender($content)
{
return $content;
}
/**
* Render block
* @return string|mixed
*/
public function render()
{
$content = $this->renderContent();
if (! is_string($content)) {
return $content;
}
$content = $this->applyWrappers($content);
$content = $this->afterRender($content);
return $this->app->filter('view.block.render', $content, $this);
}
/**
* Apply content wrappers
* @param string $content
* @return false|mixed|\Psr\Http\Message\ResponseInterface|string
*/
protected function applyWrappers($content)
{
if (! empty($this->wrappers)) {
foreach (array_reverse($this->wrappers) as $wrapper) {
/var/www/natumbe.kz/bff/view/Block.php
}
return $data;
}
return ''; # no data no render
}
if ($this->beforeRender() === false) {
return ''; # cancel render
}
# No template - no render
$template = $this->getTemplate();
if ($template === '') {
return '';
}
# Prerender sub blocks
foreach ($this->data as $key => $value) {
if ($value instanceof self && $value->prerenderable()) {
$this->data[$key] = $value->render();
}
}
# Bind scope
$this->renderOptions['this'] = $this->renderOptions['this'] ?? $this;
# Template as callback
if ($template instanceof Closure) {
return $template($this->data, $this, $this->renderOptions);
}
# Groups
if ($group = $this->getGroupKeyword()) {
$this->renderOptions['group'] = $group;
}
return $this->view->template(
$template,
$this->data,
$this->getController(),
/var/www/natumbe.kz/bff/view/Block.php
{
$this->beforeRenderRotation();
}
/**
* After render
* @return string|mixed
*/
protected function afterRender($content)
{
return $content;
}
/**
* Render block
* @return string|mixed
*/
public function render()
{
$content = $this->renderContent();
if (! is_string($content)) {
return $content;
}
$content = $this->applyWrappers($content);
$content = $this->afterRender($content);
return $this->app->filter('view.block.render', $content, $this);
}
/**
* Apply content wrappers
* @param string $content
* @return false|mixed|\Psr\Http\Message\ResponseInterface|string
*/
protected function applyWrappers($content)
{
if (! empty($this->wrappers)) {
foreach (array_reverse($this->wrappers) as $wrapper) {
/var/www/natumbe.kz/bff/view/Block.php
if ($overwrite === false) {
continue;
}
if (is_callable($overwrite) && ! $overwrite($key)) {
continue;
}
}
$to[$key] = &$value;
} unset($value);
return true;
}
/**
* Render block content
* @return string|mixed
*/
public function __toString()
{
return $this->render();
}
/**
* Json encode to string
* @return string|mixed
*/
public function jsonSerialize()
{
return $this->render();
}
/**
* Set settings or data
* @param string $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
if (
/var/www/natumbe.kz/themes/platform/modules/listings/tpl/search.php
* @var $categoriesBlock modules\listings\views\search\CategoriesBlock|null subcateries block
* @var $relinkBlock modules\listings\views\search\RelinkBlock|null
* @var $category array category data
* @var $page int active page number
* @var $seoTagsTopBlock plugins\seotags\views\TagsSearchBlock|null
* @var $seoTagsBottomBlock plugins\seotags\views\TagsSearchBlock|null
* @var $blocks bff\view\Block[]
*/
View::section('filter', fn() => $filterBlock);
?>
<div id="j-listings-search-list">
<?= $breadcrumbs ?>
<div class="l-page-head it-page-head">
<div class="container">
<h1 class="l-page-title c-title"><?= $titleh1 ?></h1>
</div>
</div>
<?php foreach ($blocks as $block) { ?>
<?= $block ?>
<?php } ?>
<?php if (!empty($category['seotext']) && $page <= 1) { ?>
<?= $category['seotext'] ?>
<?php } ?>
</div>
/var/www/natumbe.kz/bff/base/View.php
$hookPrefix = 'view.tpl';
}
$hook = $hookPrefix . '.' . $view;
$replaceTemplate = '';
$hookData = [
'data' => &$data,
'filePath' => $filePath,
'fileName' => $this->files->name($filePath),
'replaceTemplate' => &$replaceTemplate,
];
$this->app->hook($hook . '.data', $hookData);
if ($replaceTemplate) {
$filePath = $replaceTemplate;
}
# render
$render = function ($__filePath, $__sharedData, &$aData) {
extract($__sharedData, EXTR_SKIP);
extract($aData, EXTR_REFS | EXTR_OVERWRITE);
return require $__filePath;
};
if (array_key_exists('this', $opts)) { # bind context
$render = $render->bindTo($opts['this'], $opts['this']);
}
$obLevel = ob_get_level();
try {
$this->start();
$response = $render($filePath, $this->sharedData, $data);
$content = $this->stop();
} catch (Throwable $e) {
while (ob_get_level() > $obLevel) {
ob_end_clean();
}
throw $e;
}
if ($response instanceof ResponseInterface) {
return $response;
}
# hook: after render
/var/www/natumbe.kz/bff/base/View.php
'replaceTemplate' => &$replaceTemplate,
];
$this->app->hook($hook . '.data', $hookData);
if ($replaceTemplate) {
$filePath = $replaceTemplate;
}
# render
$render = function ($__filePath, $__sharedData, &$aData) {
extract($__sharedData, EXTR_SKIP);
extract($aData, EXTR_REFS | EXTR_OVERWRITE);
return require $__filePath;
};
if (array_key_exists('this', $opts)) { # bind context
$render = $render->bindTo($opts['this'], $opts['this']);
}
$obLevel = ob_get_level();
try {
$this->start();
$response = $render($filePath, $this->sharedData, $data);
$content = $this->stop();
} catch (Throwable $e) {
while (ob_get_level() > $obLevel) {
ob_end_clean();
}
throw $e;
}
if ($response instanceof ResponseInterface) {
return $response;
}
# hook: after render
if ($this->app->hooksAdded($hook)) {
unset($hookData['data']);
$content = $this->app->filter($hook, $content, $data, $hookData);
}
# tags: process
if ($opts['tags'] ?? false) {
$content = $this->app->tags()->process($content);
}
/var/www/natumbe.kz/bff/base/Module.php
}
/**
* Forming template
* @param string $view
* @param array $data
* @param array $opts
* @return string|mixed
*/
public function template(string $view, array $data = [], array $opts = [])
{
# context
$opts['this'] = $opts['this'] ?? $this;
# hook prefix
$moduleName = ($this->module_component !== false ? $this->module_component : $this->module_name);
$opts['hookPrefix'] = 'view.module.' . $moduleName; # view.module.{module}
return $this->view->render(
$data,
$view,
(!empty($opts['path']) ? $opts['path'] : $this->module_dir_tpl),
$opts
);
}
/**
* Display a notification (frontend)
* @param string $title message title
* @param string|array $message message text(s)
* @param bool $success
* @param array $opts
* @return string HTML
*/
public function showMessage($title = '', $message = '', $success = true, array $opts = [])
{
if ($success) {
return $this->showSuccess($title, $message, $opts);
}
return $this->showForbidden($title, $message, $opts);
/var/www/natumbe.kz/bff/base/View.php
/**
* Rendering the template
* @param string $view name of the template (without extension)
* @param array $data data to be passed to the template
* @param string|null $from name/object of the module/plugin, path to the file, null - path to the default template
* @param array $opts
* @return string|mixed HTML
*/
public function template(string $view, array $data = [], $from = null, array $opts = [])
{
if (empty($from) && strpos(trim($view), static::HINT_DELIMITER) > 0) {
$segments = explode(static::HINT_DELIMITER, $view);
if (count($segments) === 2) {
[$from, $view] = $segments;
}
}
if (is_string($from) && !empty($from)) {
if ($this->app->moduleExists($from)) {
return $this->app->module($from)->template($view, $data, $opts);
} elseif ($this->app->pluginExists($from)) {
return $this->app->plugin($from)->template($view, $data, $opts);
}
} elseif ($from instanceof Module) {
return $from->template($view, $data, $opts);
}
return $this->render($data, $view, $from, $opts);
}
/**
* Forming the path to the template file
* @param string $view name of the template file without extension
* @param string|null $path path to the file
* @param array $opts [custom, extension]
* @return string|bool
*/
public function resolveViewPath(string $view, ?string $path = null, array $opts = [])
{
# group
if (! empty($opts['group'])) {
/var/www/natumbe.kz/bff/view/Block.php
}
# Bind scope
$this->renderOptions['this'] = $this->renderOptions['this'] ?? $this;
# Template as callback
if ($template instanceof Closure) {
return $template($this->data, $this, $this->renderOptions);
}
# Groups
if ($group = $this->getGroupKeyword()) {
$this->renderOptions['group'] = $group;
}
return $this->view->template(
$template,
$this->data,
$this->getController(),
$this->renderOptions
);
}
/**
* Set/get prerenderable status
* @param bool|callable|null $prerenderable
* @return static|bool|mixed
*/
public function prerenderable($prerenderable = null)
{
if (is_null($prerenderable)) {
if (is_callable($this->prerenderable)) {
return ($this->prerenderable)();
}
return $this->prerenderable;
}
$this->prerenderable = $prerenderable;
return $this;
/var/www/natumbe.kz/bff/view/Page.php
$this->fillSettings();
}
if ($this->isSubmitAction()) {
if ($response = $this->handleActionRequest('submit')) {
if (is_array($response)) {
return $this->getActionResponse($response);
}
return $response;
}
} else {
if ($response = $this->handleActionRequest()) {
if (is_array($response)) {
return $this->getActionResponse($response);
}
return $response;
}
}
return parent::renderContent();
}
/**
* Init before render to fill seo data used in template (titleh1, breadcrumbs ...)
* @return bool|void
*/
protected function beforeRender()
{
if (parent::beforeRender() === false) {
return false;
}
if ($this->skipSeo) {
return;
}
if (is_array($this->data)) {
$this->seoSettings();
$this->seo();
$this->seoStructured();
/var/www/natumbe.kz/bff/view/Block.php
{
$this->beforeRenderRotation();
}
/**
* After render
* @return string|mixed
*/
protected function afterRender($content)
{
return $content;
}
/**
* Render block
* @return string|mixed
*/
public function render()
{
$content = $this->renderContent();
if (! is_string($content)) {
return $content;
}
$content = $this->applyWrappers($content);
$content = $this->afterRender($content);
return $this->app->filter('view.block.render', $content, $this);
}
/**
* Apply content wrappers
* @param string $content
* @return false|mixed|\Psr\Http\Message\ResponseInterface|string
*/
protected function applyWrappers($content)
{
if (! empty($this->wrappers)) {
foreach (array_reverse($this->wrappers) as $wrapper) {
/var/www/natumbe.kz/bff/base/Router.php
if ($controller && $action) {
return $this->get(static::DIRECT_ROUTE, '', $controller . '/' . $action . '/');
}
return null;
}
/**
* Gather route middleware
* @param \bff\http\Request $request
* @param \bff\base\Route $route
* @return \bff\http\Response|mixed
*/
public function runRoute(Request $request, Route $route)
{
try {
# Run
$response = $route->run($request);
if ($response instanceof Block) {
$response = $response->render();
}
} catch (ResponseException $e) {
# Special type of exception in cases where unable to implement proper "return Response"
return $e->getResponse();
} catch (ModelRecordNotFoundException $e) {
if (Errors::no()) {
Errors::unknownRecord();
}
if ($request->isAJAX()) {
return Response::json(['data' => [], 'errors' => Errors::get()]);
}
} catch (NotFoundException $e) {
return Response::notFound($e->getResponse());
} catch (Throwable $e) {
if (! bff()->isDebug()) {
Errors::logException($e);
return Errors::error404();
}
return Errors::handleException($e);
}
/var/www/natumbe.kz/bff/base/Application.php
if (is_string($middleware) && array_key_exists($middleware, $this->middlewareGroups)) {
foreach ($this->middlewareGroups[$middleware] as $key => $value) {
if (is_string($key)) {
$stack[$key] = $value;
} else {
$stack[] = $value;
}
}
} else {
$stack[] = $middleware;
}
}
if ($this->adminPanel()) {
# Admin
$stack[] = ['callback' => \bff\middleware\AdminPanel::class, 'priority' => 100];
} else {
# Frontend ...
$stack[] = ['callback' => function (Request $request, $next) use ($route) {
# Run
$response = $this->router()->runRoute($request, $route);
# Html + Layout
if (is_string($response)) {
return $this->view()->layoutResponse([
'centerblock' => $this->view()->vueRender(
$this->tags()->process($response)
),
]);
}
# Other response types
return Response::responsify($response);
}, 'priority' => 100];
}
} else {
if ($this->adminPanel()) {
# Admin
$stack[] = ['callback' => \bff\middleware\StartSession::class, 'priority' => 50];
$stack[] = ['callback' => \bff\middleware\AdminPanel::class, 'priority' => 100];
} else {
# Not found: Frontend ...
$stack[] = function () {
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $this->handleException($passable, $e);
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
if (is_callable($pipe)) {
// If the pipe is a callable, then we will call it directly, but otherwise we
// will resolve the pipes out of the dependency container and call it with
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
/var/www/natumbe.kz/bff/middleware/StartSession.php
/**
* Handle the given request within session state.
*
* @param \bff\http\Request $request
* @param \Illuminate\Contracts\Session\Session $session
* @param \Closure $next
* @return mixed
*/
protected function handleStatefulRequest(Request $request, $session, Closure $next)
{
// If a session driver has been configured, we will need to start the session here
// so that the data is ready for an application. Note that the Laravel sessions
// do not make use of PHP "native" sessions in any way since they are crappy.
$request->setSession(
$this->startSession($request, $session)
);
$this->collectGarbage($session);
$response = $next($request);
$this->storeCurrentUrl($request, $session);
if ($this->isSecureRequest($request, $session)) {
$response = $this->addCookieToResponse($response, $session);
// Again, if the session has been configured we will need to close out the session
// so that the attributes may be persisted to some storage medium. We will also
// add the session identifier cookie to the application response headers now.
$this->saveSession($request);
}
return $response;
}
/**
* Start the session for the given request.
*
* @param \bff\http\Request $request
* @param \Illuminate\Contracts\Session\Session $session
/var/www/natumbe.kz/bff/middleware/StartSession.php
*/
public function handle($request, Closure $next)
{
if (! $this->sessionConfigured()) {
return $next($request);
}
# No session for robots
if ($request->isRobot()) {
config::temp('session.driver', 'array');
}
$session = $this->getSession($request);
if (
$this->manager->shouldBlock() ||
($request->route() instanceof Route && $request->route()->locksFor())
) {
return $this->handleRequestWhileBlocking($request, $session, $next);
} else {
return $this->handleStatefulRequest($request, $session, $next);
}
}
/**
* Handle the given request within session state.
*
* @param \bff\http\Request $request
* @param \Illuminate\Contracts\Session\Session $session
* @param \Closure $next
* @return mixed
*/
protected function handleRequestWhileBlocking(Request $request, $session, Closure $next)
{
if (! $request->route() instanceof Route) {
return;
}
$lockFor = $request->route() && $request->route()->locksFor()
? $request->route()->locksFor()
: 10;
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
/var/www/natumbe.kz/bff/middleware/UserLastActivity.php
use User;
use Users;
use bff\http\Request;
/**
* Marking the user's last activity
* @copyright Tamaranga
*/
class UserLastActivity
{
public function __invoke(Request $request, $next)
{
if (User::logined()) {
$userID = User::id();
# Update last activity
Users::updateUserLastActivity($userID);
}
return $next($request);
}
}
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/bff/middleware/LoginAuto.php
$userData = Users::model()->userData($userID, ['user_id', 'user_id_ex', 'last_login']);
if (empty($userData)) {
break;
}
if (Users::model()->userIsAdministrator($userID)) {
break;
}
if ($hashFull !== Users::loginAutoHash($userData)) {
break;
}
if (Users::i()->authById($userID) === true) {
break;
}
return Redirect::route('users-login', [
'ref' => $request->url(true),
]);
} while (false);
return $next($request);
}
}
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/bff/middleware/Offline.php
<?php //ICB0 71:0 81:1479 ?><?php //00091
// Copyright Tamaranga. 2014-2022
// All Rights Reserved
echo('No IonCube Loader is installed. Please contact support.');exit(199);
?>
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
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/app/middleware/SubdomainsValidation.php
break;
}
if (preg_match('/(.*)\.' . preg_quote(SITEHOST) . '/', $host, $matches) <= 0) {
break;
}
if (empty($matches[1])) {
break;
}
if (Geo::urlType() !== Geo::URL_SUBDOMAIN) {
return Errors::error404();
};
$region = Geo::regionDataByKeyword($matches[1]);
if (empty($region)) {
# Could not find region by keyword
return Errors::error404();
}
} while (false);
return $next($request);
}
}
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/bff/middleware/Cors.php
* @param mixed $next
* @return ResponseInterface
*/
public function __invoke(RequestInterface $request, $next)
{
return $this->handle($request, $next);
}
/**
* Handle request
* @param RequestInterface $request
* @param mixed $next
* @return ResponseInterface
*/
public function handle(RequestInterface $request, $next)
{
# Skip requests without Origin header
if (! $request->hasHeader('Origin')) {
# Not an access control request
return $next($request);
}
# Preflight Request
if ($this->isPreflightRequest($request)) {
return $this->setCorsHeaders($request, ResponseFactory::empty(), true);
}
# Strict request validation
if ($this->strict() && ! $this->isAllowedRequest($request)) {
return ResponseFactory::createResponse(403, $this->options['forbidden_message'] ?? '');
}
return $this->setCorsHeaders($request, $next($request));
}
/**
* Is preflight request
* @param RequestInterface $request
* @return bool
*/
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
/var/www/natumbe.kz/bff/middleware/FrameGuard.php
<?php
namespace bff\middleware;
use Security;
use bff\http\Request;
/**
* X-Frame-Options
* @copyright Tamaranga
*/
class FrameGuard
{
public function __invoke(Request $request, $next)
{
if (! $request->isPOST()) {
Security::setIframeOptions();
}
return $next($request);
}
}
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/bff/middleware/TrustedProxies.php
namespace bff\middleware;
use Cache;
use config;
use bff\http\Request;
/**
* Allowed proxies
* @copyright Tamaranga
*/
class TrustedProxies
{
public function __invoke(Request $request, $next)
{
$request->setTrustedProxies([]); // reset state between requests
$trusted = config::get('request.trusted.proxies');
if (is_null($trusted) || $trusted === '') {
return $next($request);
}
if (is_string($trusted)) {
if ($trusted === '*') {
$trusted = [
$request->remoteAddress(false, false) // current IP
];
} else {
$trusted = array_map('trim', explode(',', $trusted));
}
}
if (is_array($trusted)) {
$request->setTrustedProxies(
$this->mixinCloudFlareIps($trusted)
);
}
return $next($request);
}
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
/var/www/natumbe.kz/bff/vendor/illuminate/pipeline/Pipeline.php
public function via($method)
{
$this->method = $method;
return $this;
}
/**
* Run the pipeline with a final destination callback.
*
* @param \Closure $destination
* @return mixed
*/
public function then(Closure $destination)
{
$pipeline = array_reduce(
array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
* @return mixed
*/
public function thenReturn()
{
return $this->then(function ($passable) {
return $passable;
});
}
/**
* Get the final piece of the Closure onion.
*
* @param \Closure $destination
* @return \Closure
*/
/var/www/natumbe.kz/bff/base/Application.php
}
return $result;
}
/**
* Run middleware stack
* @param array $pipes
* @param mixed $passable
* @param Closure|null $destination
* @return mixed|\bff\http\Response
*/
public function middlewareRun(array $pipes, $passable, ?Closure $destination = null)
{
return (new Pipeline($this))
->send($passable)
->through($pipes)
->then($destination ?? function ($passable) {
return $passable;
});
}
/**
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
# Call macro method
if (static::hasMacro($method)) {
return $this->callMacro($method, $parameters);
}
return null;
}
/**
* Handle dynamic static method calls into the method.
* @param string $method
/var/www/natumbe.kz/bff/base/Application.php
'dynamic' => true,
]);
}
} catch (Throwable $e) {
$route = null;
}
# Handle route
if ($route) {
# Controller/action fallback
bff::$class = $route->getControllerName();
bff::$event = $route->getControllerMethod();
# Set request route
$request->setRouteResolver(function () use ($route) {
return $route;
});
}
# Call middleware stack
$response = $this->middlewareRun($this->finalizeMiddleware(
$this->filter('app.middleware', $this->middlewares),
$route
), $request);
# Fix http protocol mismatch
if ($response->getProtocolVersion() !== ($requestProtocol = $request->getProtocolVersion())) {
if ($requestProtocol === '2.0') {
$requestProtocol = '2';
}
$response = $response->withProtocolVersion($requestProtocol);
}
# Respond
if ($respond) {
$this->respond($response);
}
return $response;
}
/var/www/natumbe.kz/public_html/index.php
<?php
$_SERVER["DOCUMENT_ROOT"] = __DIR__;
require_once($_SERVER['DOCUMENT_ROOT'].'/protect192/code/include.php');
require __DIR__ . '/../bff/bootstrap.php';
bff()->run();