/var/www/natumbe.kz/bff/base/Application.php
}
if (is_object($moduleName) && $moduleName instanceof Plugin) {
$pluginAlias = $moduleName->getAlias();
if (!empty($pluginAlias)) {
if (class_exists(($class = '\plugins\\' . $pluginAlias . '\models\\' . $modelName))) {
return ($modelClassOnly ? $class : new $class()); # plugin
}
}
} else {
if (is_string($moduleName) && $this->pluginExists($moduleName)) {
$pluginAlias = $this->plugin($moduleName)->getAlias();
if (!empty($pluginAlias)) {
if (class_exists(($class = '\plugins\\' . $pluginAlias . '\models\\' . $modelName))) {
return ($modelClassOnly ? $class : new $class()); # plugin
}
}
}
}
}
throw new Exception(sprintf('Unable to find model "%s"', $modelName));
}
return $this->module($moduleName)->model;
}
/**
* Determine if the application is running in the admin panel context.
* @param bool $pathOnly
* @return bool|string
*/
public function adminPanel(bool $pathOnly = false)
{
if ($pathOnly) {
return $this['admin']->path(true);
}
return $this->getContext() === static::CONTEXT_ADMIN;
}
/**
* Determine if the application is running in the admin panel context.
/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/bff/db/Model.php
return $this->db->now($quote);
}
/**
* Get model class name
* @param string $modelName model name
* @param string|null $moduleName module name
* @param bool $asObject
* @return \bff\db\illuminate\Model|string
*/
public function model($modelName, $moduleName = null, $asObject = true)
{
if (is_null($moduleName)) {
if ($this->controller instanceof Module) {
$moduleName = $this->controller->module_name;
} else {
$moduleName = $this->controller;
}
}
return bff::model($moduleName, $modelName, !$asObject);
}
/**
* Check for compliance with the comparison operator
* @param mixed $value
* @return bool
*/
public static function isOperator($value)
{
return (is_string($value) && !empty($value) && in_array(mb_strtoupper($value), [
'=', '<', '>', '<=', '>=', '<>', '!=', '<=>', '&', '|', '^', '<<', '>>', '~',
'IN', 'NOT IN', 'LIKE', 'LIKE BINARY', 'NOT LIKE', 'ILIKE', 'NOT ILIKE', 'RLIKE',
'REGEXP', 'NOT REGEXP',
], true));
}
/**
* Building a comparison condition for the specified column
* @param string $columnName column name
* @param $value: 'int|string', [1,2,3,...], ['>=', 'value'], ['in', [1,2,3]]
/var/www/natumbe.kz/bff/modules/site/Model.php
return [];
}
return func::array_transparent($data, 'code_position', false);
}
# --------------------------------------------------------------------
# Currencies
/**
* Currency model
* @param int|null $id
* @param array $columns
* @param array $with
* @param string|null $lang
* @return \bff\modules\site\models\Currency | \bff\db\illuminate\Model | array
*/
public function currency($id = null, $columns = ['*'], array $with = [], $lang = null)
{
$model = $this->model('Currency');
if (! empty($id)) {
return $model->one($id, $columns, $with, $lang);
}
return $model;
}
/**
* Currency listing
* @return array
*/
public function currencyListing()
{
return $this->currency()
->orderBy('num')
->tag('site.currency.listing')
->get(['id', 'enabled', 'rate', 'title'])
->toArray();
}
/**
/var/www/natumbe.kz/bff/currency/Currency.php
}
public function onNewRequest($request)
{
parent::onNewRequest($request);
$this->data = [];
$this->codeIdMap = [];
}
/**
* Currency model
* @param int|null $id
* @param array $columns
* @param mixed $lang
* @return array|\bff\modules\site\models\Currency
*/
public function model($id = null, array $columns = ['*'], $lang = null)
{
return Site::model()->currency($id, $columns, [], $lang);
}
/**
* Currency data by id
* @param int|null $id
* @param string|null $key
* @param mixed $lang
* @return mixed
*/
public function data($id = null, ?string $key = null, $lang = null)
{
$id = $id ?? $this->defaultId();
$index = ($lang === true ? $id . ':all' : $id);
if (! array_key_exists($index, $this->data)) {
$this->data[$index] = (!empty($id) ? $this->model($id, []/* as array */, $lang) : []);
if (! empty($this->data[$index])) {
# cache: code => id
$this->idByCode($this->data[$index]['code'], $this->data[$index]);
/var/www/natumbe.kz/bff/currency/Currency.php
*/
public function digits($id = null, $default = 2)
{
return (int)$this->data($id, 'digits') ?? $default;
}
/**
* Currencies data list
* @param bool $enabled
* @param mixed $lang
* @return array
*/
public function list($enabled = true, $lang = null)
{
$ke = $enabled ? 1 : 0;
$kl = $lang ?? '';
if (isset($this->list[$ke][$kl])) {
return $this->list[$ke][$kl];
}
$data = $this->model()->select()
->when($enabled, function ($query) {
$query->enabled();
})
->when($lang, function ($query, $lang) {
if (is_string($lang)) {
$query->lang($lang);
}
})
->orderBy('num')
->get()
->keyBy('id')
->toArray();
$def = $this->defaultId();
foreach ($data as & $cur) {
$cur['default'] = $cur['id'] == $def ? '1' : '0';
} unset($cur);
return $this->list[$ke][$kl] = $data;
}
/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/users/base.php
* @return int
*/
public function filterCurrency($default = null, $opts = [])
{
if (! Users::userCurrencyPrices()) {
return $default ?? Currency::id();
}
$curr = null;
if (isset($opts['currency_id'])) {
$curr = $opts['currency_id'];
} else if (User::id()) {
$curr = User::data('currency_id');
}
if (! $curr) {
$country = Geo::regionDataExtra(Geo::filter('id-country'));
$curr = $country['extra']['currency_id'] ?? null;
}
if ($curr) {
$list = Currency::list();
if (! isset($list[$curr])) {
$curr = $default ?? Currency::id();
}
} else {
$curr = $default ?? Currency::id();
}
return $curr;
}
}
/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/search/FilterBlock.php
$this->listView = array_key_first($views);
}
# Mark active view
foreach ($views as $key => $view) {
$views[$key]['active'] = ($key === $this->listView);
$views[$key]['filtered'] = ($this->originalFilter('listView') === $key);
}
return ($this->listViews = $views);
}
/**
* Init currency
*/
public function initCurrency()
{
# Default currency
$currency = $this->currency ?? $this->currencyId;
$defaultCurrency = Users::filterCurrency();
if ($this->useCategoryCurrency && empty($this->categoryData['price']['curr'])) {
if (! $this->categoryData['price']) {
$this->categoryData['price'] = [];
}
$this->categoryData['price']['curr'] = $defaultCurrency;
}
if (! $currency) {
$currency = $this->categoryData['price']['curr'] ?? 0;
}
if (! $currency) {
$currency = $defaultCurrency;
}
$this->currencyId = $currency;
# Currencies list
if (! $this->listCurrencies) {
$this->listCurrencies = Currency::list();
}
}
/var/www/natumbe.kz/modules/listings/views/search/FilterBlock.php
$this->catFields = [
'id', 'pid', 'numlevel', 'numleft', 'numright',
'settings', 'keyword', 'landing_url', 'title', 'title_filter',
'enabled', 'subs', 'subs_filter_title', 'virtual_ptr',
'type_offer_search', 'type_seek_search', 'type_filter_title',
'icon_b', 'icon_s', 'owner_private_search', 'owner_business_search',
];
$this->catFieldsVirtual = [
'id', 'pid', 'subs', 'numleft', 'numright', 'numlevel', 'enabled', 'title', 'title_filter',
'keyword', 'landing_url',
];
}
protected function onSettingsFilled()
{
$this->sortTypes();
$this->listViews();
$this->initCurrency();
}
public function fillFilters($data = [])
{
# Fix the presence of filters in the GET request
if ($this->isGET() && empty($data)) {
$this->request->forget('c');
}
if ($this->isGET() && ! $this->anyGetFilters) {
foreach ($this->requestMap as $to => $from) {
$this->anyGetFilters += ($this->request->has($from['key']) ? 1 : 0);
}
$this->anyGetFilters += ($this->request->has('p') ? 1 : 0);
}
foreach ($this->requestMap as $to => $from) {
if (isset($data[$from['key']])) {
$this->$to = $this->input->clean($data[$from['key']], $from['type']);
} else {
$this->$to = $this->$to ?? $this->input->postget($from['key'], $from['type']);
/var/www/natumbe.kz/bff/view/HasSettings.php
if ($this->settingsFilled && ! $force) {
return;
}
$parent = $this->getParentPage();
if (! $parent) {
return;
}
if (! $parent->settingsFillAllowed()) {
return;
}
$this->settingsFilled = true;
$settings = $parent->getBlockSettings($this->getKey());
if ($settings) {
$this->setSettings($settings);
}
$this->onSettingsFilled();
}
/**
* Handle settings fill event
*/
protected function onSettingsFilled()
{
}
/**
* Hide/show block settings
* @param bool|null $hide
* @return bool
*/
public function noSettings(?bool $hide = true)
{
if (! is_null($hide)) {
$this->noSettings = $hide;
}
/var/www/natumbe.kz/bff/view/Block.php
* Get sub block by key
* @param string $key
* @param array $opts
* @return Block|null
*/
public function getBlock(string $key, array $opts = [])
{
if (! isset($this->blocks[$key])) {
return null;
}
if (is_callable($this->blocks[$key])) {
$this->blocks[$key] = $this->blocks[$key]();
}
if ($this->withoutBlocks && $this->blocks[$key] instanceof self) {
$this->blocks[$key]->withoutBlock($this->withoutBlocks);
}
if ($this->blocks[$key]) {
$this->blocks[$key]->fillSettings();
} else {
$this->log('Can\'t create block ' . $key . ' for block ' . get_class($this));
}
return $this->blocks[$key];
}
/**
* Set sub block settings and return block instance
* @param string $key
* @param array $settings
* @return Block|null
*/
public function setBlockSettings(string $key, array $settings)
{
$block = $this->getBlock($key);
if ($block) {
$block->setSettings($settings);
return $block;
}
/var/www/natumbe.kz/modules/listings/views/SearchPage.php
{
$this->addBlock('filterBlock', $this->filter);
$this->rotateBlock('filterBlock', false);
$this->addBlock('sortBlock', function () {
return $this->filter->getSortBlock();
});
$this->rotateBlock('sortBlock', false);
$this->addBlock('categoriesBlock', CategoriesBlock::class, function (CategoriesBlock $block) {
$block->filter = $this->filter;
$block->categoryId = $this->filter->categoryId;
});
$this->addBlock('listBlock', function () {
$view = $this->app->filter('listings.search.list.view', [
ListFactory::LIST => ListBlock::class,
ListFactory::GALLERY => GalleryListBlock::class,
ListFactory::MAP => MapListBlock::class,
])[$this->getBlock('filterBlock')->listView ?: ListFactory::GALLERY];
return $this->createBlock($view, ['filter' => $this->filter]);
});
$this->addBlock('relinkBlock', RelinkBlock::class, function (RelinkBlock $block) {
$block->filter = $this->filter;
});
}
/**
* List block
* @return ListBlock|mixed
*/
public function getList()
{
return $this->getBlock('listBlock');
}
public function seo()
{
if ($this->isGET()) {
/var/www/natumbe.kz/bff/view/Block.php
* @param string|Block|Closure $block
* @param Closure|null|array $callback
* @param array $opts
* rotatable options - @see HasBlocksRotation::rotatableSettingsDefault
* @return static
*/
public function addBlock(string $key, $block, $callback = null, array $opts = [])
{
if ($block instanceof self) {
$block->setParent($this);
if ($callback instanceof Closure) {
$callback($block, $key);
}
$this->blocks[$key] = $block;
$this->setRotatableBlockOptions($key, $opts);
return $this;
}
$this->blocks[$key] = function () use ($key, $block, $callback, $opts) {
if ($block instanceof Closure) {
$block = $block($this);
}
if (is_string($block) && static::isValidBlockClass($block)) {
$block = $this->createBlock($block, is_array($callback) ? $callback : []);
}
if ($block instanceof self) {
$this->addBlock($key, $block, $callback, $opts);
return $block;
}
return null;
};
return $this;
}
/**
* Add template block
* @param string $key
* @param string $template
* @param Module|string|null $controller
* @param Closure|null $callback
/var/www/natumbe.kz/bff/view/Block.php
} else {
$this->withoutBlocks[] = $key;
}
return $this;
}
/**
* Get sub block by key
* @param string $key
* @param array $opts
* @return Block|null
*/
public function getBlock(string $key, array $opts = [])
{
if (! isset($this->blocks[$key])) {
return null;
}
if (is_callable($this->blocks[$key])) {
$this->blocks[$key] = $this->blocks[$key]();
}
if ($this->withoutBlocks && $this->blocks[$key] instanceof self) {
$this->blocks[$key]->withoutBlock($this->withoutBlocks);
}
if ($this->blocks[$key]) {
$this->blocks[$key]->fillSettings();
} else {
$this->log('Can\'t create block ' . $key . ' for block ' . get_class($this));
}
return $this->blocks[$key];
}
/**
* Set sub block settings and return block instance
* @param string $key
* @param array $settings
* @return Block|null
/var/www/natumbe.kz/modules/listings/views/SearchPage.php
$view = $this->app->filter('listings.search.list.view', [
ListFactory::LIST => ListBlock::class,
ListFactory::GALLERY => GalleryListBlock::class,
ListFactory::MAP => MapListBlock::class,
])[$this->getBlock('filterBlock')->listView ?: ListFactory::GALLERY];
return $this->createBlock($view, ['filter' => $this->filter]);
});
$this->addBlock('relinkBlock', RelinkBlock::class, function (RelinkBlock $block) {
$block->filter = $this->filter;
});
}
/**
* List block
* @return ListBlock|mixed
*/
public function getList()
{
return $this->getBlock('listBlock');
}
public function seo()
{
if ($this->isGET()) {
$this->seoCorrectUrlEndSlash();
}
$catID = $this->filter->categoryId;
$catData = &$this->filter->categoryData;
$region = $this->filter->region;
$total = $this->filter->total;
$this->seo->with([
'page' => $this->filter->page,
'total' => $total,
'total.text' => tpl::declension($total, _t('listings', 'listing;listings;listings')),
'query' => $this->filter->query,
]);
$geoData = $this->seoMacrosRegionsData($region);
/var/www/natumbe.kz/modules/listings/views/SearchPage.php
$filter->categoryId &&
$filter->categoryData['numlevel'] == 1 &&
$filter->categoryData['settings']['subcats_view'] &&
! $filter->anyGetFilters
) {
return bff(contracts\CategoryPage::class, ['settings' => ['filter' => $filter]]);
}
if ($filter->categoryId && $filter->categoryId !== $categoryRootId) {
return bff(contracts\SearchCategoryPage::class, ['settings' => ['filter' => $filter]]);
}
return bff(contracts\SearchPage::class, ['settings' => ['filter' => $filter]]);
}
public function data()
{
$data = parent::data();
$this->getList()->loadList();
# Banners + query
if ($this->filter->hasSearchQuery()) {
Banners::viewQuery($this->filter->query);
}
# Category crumbs
$this->filter->categoryData['crumbs'] = Listings::categoryCrumbs($this->filter->categoryId, 'search');
$data['category'] = &$this->filter->categoryData;
# Page number
$data['page'] = $this->filter->page;
return $this->app->filter('listings.search.page.data', $data, ['searchPage' => $this]);
}
public function blocks()
{
$this->addBlock('filterBlock', $this->filter);
$this->rotateBlock('filterBlock', false);
/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/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();
/var/www/natumbe.kz/bff/view/Block.php
return parent::config($key, $default, $opts);
}
/**
* Before render
* @return bool|void
*/
protected function beforeRender()
{
$this->beforeRenderRotation();
}
/**
* Render block
* @return string|mixed
*/
public function render()
{
$content = $this->renderContent();
if (! is_string($content)) {
return $content;
}
$content = $this->applyWrappers($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) {
if (empty($wrapper['template'])) {
continue;
/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();