<commit_before><?php

/**
 * Ecommerce admin controller
 *
 * @author <NAME> <<EMAIL>>
 * @link http://inji.ru/
 * @copyright 2015 <NAME>
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
 */
class EcommerceController extends adminController
{
    function dashboardAction()
    {
        $this->view->setTitle('Онлайн магазин');
        $this->view->page();
    }

    function configureAction()
    {
        if (!empty($_POST['config'])) {
            $config = App::$cur->ecommerce->config;
            $config['view_empty_warehouse'] = empty($_POST['config']['view_empty_warehouse']) ? false : true;
            $config['view_empty_image'] = empty($_POST['config']['view_empty_image']) ? false : true;
            $config['sell_empty_warehouse'] = empty($_POST['config']['sell_empty_warehouse']) ? false : true;
            $config['sell_over_warehouse'] = empty($_POST['config']['sell_over_warehouse']) ? false : true;
            $config['notify_mail'] = $_POST['config']['notify_mail'];
            Config::save('module', $config, 'Ecommerce');
            Tools::redirect('/admin/ecommerce/configure', 'Настройки были изменены', 'success');
        }
        $managers = [
            'Ecommerce\Delivery',
            'Ecommerce\PayType',
            'Ecommerce\Warehouse',
            'Ecommerce\Unit',
            'Ecommerce\Card',
            'Ecommerce\Discount',
            'Ecommerce\Item\Type',
            'Ecommerce\Item\Option',
            'Ecommerce\Item\Offer\Price\Type',
            'Ecommerce\UserAdds\Field',
        ];
        $this->view->setTitle('Настройки магазина');
        $this->view->page(['data' => compact('managers')]);
    }

    function reBlockIndexAction()
    {
        set_time_limit(0);
        $carts = Cart::get_list();
        Inji::app()->Log->stop();
        foreach ($carts as $cart) {
            $cart->save();
        }
        $this->url->redirect($this->url->module() . '/configure', 'Данные о блокировках обновлены');
    }

    function reSearchIndexAction()
    {
        set_time_limit(0);
        $count = 100;
        $items = Ecommerce\Item::getList(['start' => $i * $count, 'limit' => $count]);
        if (!$items) {
            Tools::redirect('/admin/ecommerce/configure', 'Поисковый индекс обновлен');
        } else {<commit_msg>redirect fix<commit_after><?php

/**
 * Ecommerce admin controller
 *
 * @author <NAME> <<EMAIL>>
 * @link http://inji.ru/
 * @copyright 2015 <NAME>
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
 */
class EcommerceController extends adminController
{
    function dashboardAction()
    {
        $this->view->setTitle('Онлайн магазин');
        $this->view->page();
    }

    function configureAction()
    {
        if (!empty($_POST['config'])) {
            $config = App::$cur->ecommerce->config;
            $config['view_empty_warehouse'] = empty($_POST['config']['view_empty_warehouse']) ? false : true;
            $config['view_empty_image'] = empty($_POST['config']['view_empty_image']) ? false : true;
            $config['sell_empty_warehouse'] = empty($_POST['config']['sell_empty_warehouse']) ? false : true;
            $config['sell_over_warehouse'] = empty($_POST['config']['sell_over_warehouse']) ? false : true;
            $config['notify_mail'] = $_POST['config']['notify_mail'];
            Config::save('module', $config, 'Ecommerce');
            Tools::redirect('/admin/ecommerce/configure', 'Настройки были изменены', 'success');
        }
        $managers = [
            'Ecommerce\Delivery',
            'Ecommerce\PayType',
            'Ecommerce\Warehouse',
            'Ecommerce\Unit',
            'Ecommerce\Card',
            'Ecommerce\Discount',
            'Ecommerce\Item\Type',
            'Ecommerce\Item\Option',
            'Ecommerce\Item\Offer\Price\Type',
            'Ecommerce\UserAdds\Field',
        ];
        $this->view->setTitle('Настройки магазина');
        $this->view->page(['data' => compact('managers')]);
    }

    function reBlockIndexAction()
    {
        set_time_limit(0);
        $carts = Cart::get_list();
        Inji::app()->Log->stop();
        foreach ($carts as $cart) {
            $cart->save();
        }
        $this->url->redirect($this->url->module() . '/configure', 'Данные о блокировках обновлены');
    }

    function reSearchIndexAction($i = 0)
    {
        set_time_limit(0);
        $count = 100;
        $items = Ecommerce\Item::getList(['start' => $i * $count, 'limit' => $count]);
        if (!$items) {
            Tools::redirect('/admin/ecommerce/configure', 'Поисковый индекс обновлен');
        } else {
{'fraction_non_alphanumeric': 0.17516677426296534, 'fraction_numerical': 0.004088659350118356, 'mean_word_length': 2.5319148936170213, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 51, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4333640', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1415, 'n_words': 212}