Добавление параметра. Если такой параметр уже задан, значение будет добавлено в массив
351198
public function addParameter($name, $parameter)
  {
    if ($this->hasParameter($name)) {
      $this->parameters[$name]   = (array)$this->parameters[$name];
      $this->parameters[$name][] = $parameter;
    } else {
      $this->parameters[$name] = $parameter;
    }

    return $this->sortParameters();
  }
448172
public function boot()
    {
        /**
         * Подключаем базовые маршруты
         * пока оставляем это для ручной работы
         */
        // if (Config::get('qwertcms.include_routes')) {
        //     include __DIR__ . '/routes.php';
        // }

        /**
         * Языки (резерв)
         */
        // $this->loadTranslationsFrom(__DIR__ . '/lang', 'qwertcms');
        
        /**
         * Настройки
         */
        $this->publishes([
            __DIR__ . '/config/qwertcms.php' => base_path('config/qwertcms.php'),
        ], 'qwertcms_config');

        /**
         * Роуты
         */
        $this->publishes([
            __DIR__ . '/routes' => base_path('routes/'),
        ], 'qwertcms_routes');

        /**
         * Шаблоны для админки
         */
        $this->loadViewsFrom(__DIR__.'/views', 'qwertcms');

        $this->publishes([
            __DIR__ . '/public' => public_path('vendor/qwertcms'),
        ], 'qwertcms_public');

        $this->publishes([
            __DIR__.'/views'  => base_path('resources/views/'),
        ], 'qwertcms_view');

        /**
         * Шаблоны авторизации
         */
        // $this->publishes([
        //     __DIR__.'/views/auth'  => base_path('resources/views/auth'),
        // ], 'qwertcms_view');

        /**
         * Миграции и seeds
         */
        $this->publishes([
            __DIR__ . '/database/migrations/' => database_path('migrations')
        ], 'qwertcms_migrations');

        $this->publishes([
            __DIR__ . '/database/seeds/' => database_path('seeds')
        ], 'qwertcms_seeds');

        /**
         * Базовые контроллеры
         */
        $this->publishes([
            __DIR__ . '/controllers/' => app_path('Http/controllers')
        ], 'qwertcms_controllers');

        /**
         * Модели
         */
        $this->publishes([
            __DIR__ . '/Models/' => app_path()
        ], 'qwertcms_models');

        /**
         * Шаблоны писем
         */
        $this->publishes([
            __DIR__ . '/Mail/' => app_path('Mail')
        ], 'qwertcms_mail');

        /**
         * Функции хелперы
         */
        $this->publishes([
            __DIR__ . '/Helpers/' => app_path('Helpers')
        ], 'qwertcms_helpers');

        /**
         * Языковые файлы
         */        
        $this->publishes([
            __DIR__ . '/lang/adminlte/ru' => base_path('resources/lang/vendor/adminlte/ru/')
        ], 'qwertcms_adminlang');
        $this->publishes([
            __DIR__ . '/lang/laravel/ru' => base_path('resources/lang/ru/')
        ], 'qwertcms_lang');

        /**
         * Middleware для мультиязычности
         */
        $this->publishes([
            __DIR__ . '/Middleware' => app_path('Http/Middleware/')
        ], 'qwertcms_lang');
        
    }
49911
public function save()
    {
        $this->_slug = trim(trim($this->_slug), '/');
        if (is_null($this->_slugModel) || $this->_slugModel->slug !== $this->_slug) {
            //Если уже есть запись с таким slug то обновим её присвоев её максимальный id + 1
            $model = SeoSlug::find()
                ->where([
                    'AND',
                    ['=', 'model', $this->owner->className()],
                    ['=', 'model_id', $this->owner->getPrimaryKey()],
                    ['=', 'slug', $this->_slug],
                ])
                ->one();
            if ($model) {
                $maxId = SeoSlug::find()
                    ->max('id');
                $oldId = $model->id;
                $model->id = ++$maxId;
                $model->save();
                SeoSlug::updateAllCounters(['id' => -1], [
                    'AND',
                    ['>', SeoSlug::tableName() . '.id', $oldId],
                ]);
            } else {
                $model = new SeoSlug();
                $model->model = $this->owner->className();
                $model->model_id = $this->owner->getPrimaryKey();
            }
            $model->slug = $this->_slug;
            $model->save();
            if (is_callable($this->afterSave)) {
                call_user_func($this->afterSave, $this);
            }
        }
    }
27250
public function run()
    {
        // Insert
        \DB::table('modules')->insert([
            ['name' => 'articles', 'title' => null, 'icon' => 'fa fa-newspaper-o', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'categories', 'title' => null, 'icon' => 'fa fa-folder-open-o', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'tags', 'title' => null, 'icon' => 'fa fa-tags', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'users', 'title' => null, 'icon' => 'fa fa-users', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'comments', 'title' => null, 'icon' => 'fa fa-comments-o', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'polls', 'title' => null, 'icon' => 'fa fa-list-ol', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'files', 'title' => 'filemanager', 'icon' => 'fa fa-files-o', 'info' => 'Файловый менеджер', 'on_mainpage' => 1, ],
            ['name' => 'system', 'title' => null, 'icon' => 'fa fa-list-alt', 'info' => 'No description available', 'on_mainpage' => 1, ],
            ['name' => 'themes', 'title' => 'design', 'icon' => 'fa fa-paint-brush', 'info' => 'No description available', 'on_mainpage' => null, ],
            ['name' => 'x_fields', 'title' => 'x_fields', 'icon' => 'fa fa-columns', 'info' => 'Extra fields', 'on_mainpage' => 1, ],
        ]);
    }
1069410
function load($object)
	{
		$set    = popval($where, '*set');
		$must_be_configured = $object->get('must_be_configured');
		$select = array();
		$post_functions = array();

		$table_prefix = '`'.$object->table_name().'`.';

//		if(Cfg::get('is_developer')) { bors_use('debug/print_dd'); echo "<b>Load: {$object->class_name()}</b><br/>"; print_dd($where); print_dd(bors_lib_orm::main_fields($object)); }
		foreach(bors_lib_orm::main_fields($object) as $f)
		{
			if(preg_match('/^\w+$/', $sql_name = $f['sql_name']))
				$x = $table_prefix.'`'.$sql_name.'`'; // убирать апострофы нельзя, иначе тупо не работабт поля с некорректными именами
			elseif(preg_match('/^(\w+)\+(\w+)$/', $f['sql_name'], $m)) // id => forum_id+group_id
				// http://forums.airbase.ru/2008/06/t62054,12--poslednij-pokhod-unikalnogo-korablya.html
				$x = "CONCAT({$m[1]},':',{$m[2]})";
			elseif(preg_match('/^`\w+`$/', $sql_name))
				$x = $table_prefix.$sql_name;
			else
				$x = $sql_name;

			if($f['sql_name'] != ($property = $f['property']))
				$x .= " AS `{$property}`";

			$select[] = $x;

			if(!empty($f['post_function']))
				$post_functions[$f['property']] = $f['post_function'];
		}

		$where = array('`'.$object->table_name().'`.`'.$object->id_field().'`=' => $object->id());

		$dummy = array();
		self::__join('inner', $object, $select, $where, $post_functions, $dummy);
		self::__join('left',  $object, $select, $where, $post_functions, $dummy);

		// формат: array(..., '*set' => 'MAX(create_time) AS max_create_time, ...')
		if($set)
			foreach(preg_split('/,\s*/', $set) as $s)
				$select[] = $s;

		$dbh = new driver_mysql($object->db_name());

		$data = $dbh->select($object->table_name(), join(',', $select), $where);

		if(!$data)
			return $object->set_is_loaded(false);

		$object->data = $data;

		if($must_be_configured)
			$object->b2_configure();

		if(!empty($post_functions))
			self::post_functions_do($object, $post_functions);

		$object->set_is_loaded(true);
		save_cached_object($object);

		return true;
	}
186654
private function actionCreate()
    {
        $forms = $this->plugin->getForms();
        $name = arg('name');
        if ($forms->get($name) === false)
        {
            $forms->add($name, arg('code'), arg('title'));
            HTTP::redirect(arg('submitURL'));
        }
        ErrorMessage('Форма с таким именем уже есть! Укажите другое имя.');
        return $this->actionAddDialog();
    }
1307769
public function parse()
    {
        if (!$this->validate()) {
            return null;
        }
        
        $parse = new Pkk5Component(['cache'=>true]);
        $data = $parse->getInfo($this->kadastr);
        if(!empty($data)){
            $show = [];
            foreach ($data as $key => $value){
                if($value==null OR empty($value)) continue ; //пропустим если пустое данны

                $kadastr = Pkk5kadastr::find()->where(['kadastrnumber'=>$value['kadastrnumber']])->one();

                if($kadastr==null) $kadastr = new Pkk5kadastr();

                $kadastr->kadastrnumber = $value['kadastrnumber'];
                $kadastr->address = $value['address'];
                $kadastr->cost = $value['cost'];
                $kadastr->area = $value['area'];
                $kadastr->save(false);
                $show[]=$kadastr;
            }
            return $show;
        }
        return false;
    }
408368
public function show($provider_id, $bill_id, $refund_id)
	{
		if (!$bill = Bill::getBill($bill_id, $provider_id)) {
			$data['error'] = Catalog::C_BILL_NOT_FOUND;

			return $this->responseFromGate($data);
		}

		$refund = Refund::whereBillId($bill_id)
			->whereRefundId($refund_id)
			->first();

		if ($refund == null) {
			$data['error'] = Catalog::C_BILL_NOT_FOUND;

			return $this->responseFromGate($data);
		}

		//Проводим возврат по прошествии минуты
		if ($refund->isProcessing()) {
			$refund = $refund->doSuccess();
		}

		$data = $this->dataFromObj($refund);
		$data['user'] = $bill->user;
		$data['error'] = 0;

		return $this->responseFromGate($data);

	}
1089302
function() {
        var builder = this.builder;

        builder.register( 'View', new ViewBuilder() );
        builder.register( 'InlineView', new InlineViewBuilder() );
        builder.register( 'AutoView', new MetadataViewBuilder() );

        builder.register( 'StackPanel', new StackPanelBuilder() );
        builder.register( 'GridPanel', new GridPanelBuilder() );
        builder.register( 'ScrollPanel', new ScrollPanelBuilder() );
        builder.register( 'Panel', new PanelBuilder() );
        builder.register( 'ScrollPanel', new ScrollPanelBuilder() );
        builder.register( 'ViewPanel', new ViewPanelBuilder() );
        builder.register( 'TabPanel', new TabPanelBuilder() );
        builder.register( 'TabPage', new TabPageBuilder() );

        builder.register( 'TablePanel', new TablePanelBuilder() );
        builder.register( 'Cell', new CellBuilder() );
        builder.register( 'Row', new RowBuilder() );

        builder.register( 'MenuBar', new MenuBarBuilder() );

        builder.register( 'DataGrid', new DataGridBuilder() );
        // служебный элемент, в документировании не нуждается
        builder.register( 'DataGridRow', new DataGridRowBuilder() );

        builder.register( 'DataGridColumn', new DataGridColumnBuilder() );
        builder.register( 'ListBox', new ListBoxBuilder() );

        builder.register( 'TextBox', new TextBoxBuilder() );
        builder.register( 'PasswordBox', new PasswordBoxBuilder() );
        builder.register( 'CheckBox', new CheckBoxBuilder() );
        builder.register( 'IndeterminateCheckBox', new IndeterminateCheckBoxBuilder() );
        builder.register( 'ImageBox', new ImageBoxBuilder() );
        builder.register( 'FileBox', new FileBoxBuilder() );
        builder.register( 'Label', new LabelBuilder() );
        builder.register( 'Link', new LinkBuilder() );
        builder.register( 'Form', new FormBuilder() );
        builder.register( 'Icon', new IconBuilder() );
        builder.register( 'DateTimePicker', new DateTimePickerBuilder() );
        builder.register( 'DatePicker', new DatePickerBuilder() );
        builder.register( 'TimePicker', new TimePickerBuilder() );
        builder.register( 'ToggleButton', new ToggleButtonBuilder() );
        builder.register( 'NumericBox', new NumericBoxBuilder() );
        builder.register( 'Button', new ButtonBuilder() );
        builder.register( 'ToolBar', new ToolBarBuilder() );
        builder.register( 'ToolBarButton', new ButtonBuilder() );
        builder.register( 'ComboBox', new ComboBoxBuilder() );
        builder.register( 'RadioGroup', new RadioGroupBuilder() );
        builder.register( 'ExtensionPanel', new ExtensionPanelBuilder() );
        builder.register( 'PopupButton', new PopupButtonBuilder() );
        builder.register( 'DataNavigation', new DataNavigationBuilder() );
        builder.register( 'TreeView', new TreeViewBuilder() );
        builder.register( 'Frame', new FrameBuilder() );
        builder.register( 'ButtonEdit', new ButtonEditBuilder() );

        builder.register( 'RestDataSource', new RestDataSourceBuilder() );
        builder.register( 'DocumentDataSource', new DocumentDataSourceBuilder() );
        builder.register( 'PropertyBinding', new DataBindingBuilder() );
        builder.register( 'ObjectDataSource', new ObjectDataSourceBuilder() );
        builder.register( 'Parameter', new ParameterBuilder() );

        builder.register( 'AcceptAction', new AcceptActionBuilder() );
        builder.register( 'AddAction', new AddActionBuilder() );
        builder.register( 'CreateItemAction', new CreateItemActionBuilder() );
        builder.register( 'CancelAction', new CancelActionBuilder() );
        builder.register( 'DeleteAction', new DeleteActionBuilder() );
        builder.register( 'EditAction', new EditActionBuilder() );
        builder.register( 'OpenAction', new OpenActionBuilder() );
        builder.register( 'SaveAction', new SaveActionBuilder() );
        builder.register( 'SelectAction', new SelectActionBuilder() );
        builder.register( 'UpdateAction', new UpdateActionBuilder() );
        builder.register( 'ServerAction', new ServerActionBuilder() );

        builder.register( 'RouteToAction', new RouteToActionBuilder() );

        builder.register( 'BooleanFormat', new BooleanFormatBuilder() );
        builder.register( 'DateTimeFormat', new DateTimeFormatBuilder() );
        builder.register( 'NumberFormat', new NumberFormatBuilder() );
        builder.register( 'ObjectFormat', new ObjectFormatBuilder() );

        builder.register( 'Script', new ScriptBuilder() );

        builder.register( 'Divider', new DividerBuilder() );
        builder.register( 'ContextMenu', new ContextMenuBuilder() );

        // служебный элемент, в документировании не нуждается
        builder.register( 'ToolTip', new InfinniUI.TooltipBuilder() );

        var registerQueue = ApplicationBuilder.registerQueue;

        for( var i = 0, ii = registerQueue.length; i < ii; i++ ) {
            builder.register( registerQueue[ i ].name, registerQueue[ i ].builder );
        }
    }
917885
public function delete()
    {
        // удаление ссылок с удаляемого материала
        $r = $this->getDbConnection()->query("select B.name, B.len, B.type, B.pseudo_type from types A, types_fields B where A.alias='".$this->table."' and B.id=A.id and (B.type=".FIELD_LINKSET." or B.type=".FIELD_MATSET.")");
        while ($f = $r->fetch(\PDO::FETCH_NUM)) {
            $tbl = ObjectDefinition::get_table($f[2], $f[1], $this->objectDefinition->id, $f[3]);
            if ($f[2] != FIELD_LINKSET && $f[3] != PSEUDO_FIELD_TAGS) {
            	$r1 = $this->getDbConnection()->query("select dest from ".$this->table."_".$tbl."_".$f[0]." where id=".$this->id);
            	while ($f1 = $r1->fetch(\PDO::FETCH_NUM)) {
            	   $m = Material::getById($f1[0], $f[1], $tbl);
            	   $m->delete();
            	}
            }
            $this->getDbConnection()->executeQuery("delete from ".$this->table."_".$tbl."_"."$f[0] where id=".$this->id);
        }
        
        // удаление ссылок на этот материал
        if (property_exists($this, 'idcat') && $this->idcat >= 0) {
        	$r = $this->getDbConnection()->query("select A.alias, B.name, B.type from types A, types_fields B where B.id=A.id and B.len=".$this->idcat." and (B.type=".FIELD_LINK." or B.type=".FIELD_LINKSET.")");
        	while ($f = $r->fetch(\PDO::FETCH_NUM)) {
              if ($f[2] == FIELD_LINK) {
        	    $this->getDbConnection()->executeQuery("update $f[0] set $f[1]=0 where $f[1]=".$this->id);
        	  } else {
        	    $this->getDbConnection()->executeQuery("delete from $f[0]"."_".$this->table."_"."$f[1] where dest=".$this->id);
        	  }
        	}
        } else {
        	$r = $this->getDbConnection()->query("select A.alias, B.name from types A, types_fields B where B.id=A.id and B.len = ".$this->objectDefinition->id." and B.type=".FIELD_MATSET);
            while ($f = $r->fetch(\PDO::FETCH_NUM)) {
        	  $this->getDbConnection()->executeQuery("delete from $f[0]"."_".$this->table."_"."$f[1] where dest=".$this->id);
        	}
        }
                
        // удаление самого материала
        $this->getDbConnection()->executeQuery("delete from ".$this->table." where id=".$this->id);
        
    }
1223377
function(model, force) {
        var request = this._keys[model.key];
        // хотя такого не может быть, но вдруг его нет
        if (request) {
            if (model.isValid() || force) {
                request.status = this.STATUS.DONE;

            } else {
                request.status = this.STATUS.FAILED;
            }
        }
    }
876645
private function actionAddDialog()
    {
        $form = array(
            'name' => 'add',
            'caption' => 'Добавление формы',
            'width' => '100%',
            'fields' => array(
                array('type' => 'hidden', 'name' => 'action', 'value' => 'create'),
                array('type' => 'edit', 'name' => 'title', 'label' => 'Описание',
                    'width' => '99%', 'value' => arg('title')),
                array('type' => 'edit', 'name' => 'name', 'label' => 'Имя',
                    'width' => '16em', 'value' => arg('name'), 'comment' =>
                'только латинские буквы, цифры, символы минус и подчёркивание',
                    'pattern' => '/^[\w\-]+$/i',
                    'errormsg' =>
                    'Имя формы может содержать только латинские буквы, цифры, символы минус и подчёркивание'),
                array('type' => 'text',
                    'value' =>
                    '&raquo; <b><a href="https://github.com/Eresus/EForms/wiki/%D0%AF%D0%B7%D1%8B%D0%BA-%D1%84%D0%BE%D1%80%D0%BC">' .
                    'Синтаксис форм</a></b>'),
                array('type' => 'memo', 'name' => 'code', 'height' => '30', 'syntax' => 'html',
                    'value' => arg('code') ? arg('code') :
                        '<form xmlns:ef="http://procreat.ru/eresus2/ext/eforms" method="post">' . "\n</form>"),
            ),
            'buttons' => array('ok', 'cancel'),
        );
        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        return $page->renderForm($form);
    }
245553
function errors()
    {
        if (!$this->_errors){
            $this->_errors = new Error('Ошибки', $this->name(), null, true);
            // Связывание с ошибками родительского объекта. Образуется целостная иерархия ошибок
            if ($this->_parent){
                $this->_parent->errors()->_children->add($this->_errors, '', true);
            }
        }
        return $this->_errors;
    }
38061
protected function RenderImpl()
    {

        //   $this->beforeRender();
        //$keys =   array_keys($this->components);
        foreach ($this->components as $component) {


            if ($component->isVisible()) {
                $component->Render();
            } else {
                $component->getTag()->remove();
                $label = $component->getLabelTag();
                if ($label->size() == 1) {  //прячем  связаный  тег label
                    $label->remove();
                }
                if ($label->size() > 1) {  //прячем  связаный  тег label
                    foreach ($label as $l) {
                        pq($l)->remove();
                    }
                }
            }
        }
        //   $this->afterRender();
    }
113338
public function postCancelBill()
	{
		$bill_id = Input::get('transaction');
		$provider_id = Input::get('shop');
		$bill = Bill::getBill($bill_id, $provider_id);

		//предполагаем ошибку
		$error = 'Счёт не найден';

		if ($bill) {
			//Если счёт отмеён, то кидаем callback и отдаём успех
			if ($bill->doCancel($bill_id)) {
				$this->sendCallback($bill_id);

				return array(
					'message' => 'Счёт отменён',
				);
			}
			$error = 'Счёт не отменён. Проверьте статус.';
		}

		//Отдаём ошибку
		return array(
			'error'   => true,
			'message' => $error,
		);
	}
132916
function on() {
        if($this->is_used) {
            return true;
        }
        $route   = \Route::currentRouteName();
        $exclude = self::maxIs($this->exclude, $route);
        $include = self::maxIs($this->include, $route);
        if($exclude > $include || true === $exclude) {
            // исключаем
        } else {
            // подключаем
            //сперва подключим на страницу зависимости
            foreach((array) $this->require as $require => $scopes) {
                Manager::package($require)
                    ->on();
            }
            
            foreach($this->deferred_scopes as $scope) {
                $this->scope($scope);
            }
            
            //затем подключим CSS
            foreach($this->css as $url => $item) {
                $condition = Arr::get($item, 'condition', null);
                $media     = Arr::get($item, 'media', null);
                $no_build  = (bool) Arr::get($item, 'no_build', false);
                Css::instance()
                    ->add($url, $media, $condition, $no_build);
            }
            //затем подключим JS
            foreach($this->js as $url => $item) {
                $condition = Arr::get($item, 'condition', null);
                $no_build  = (int) Arr::get($item, 'no_build', false);
                Js::instance()
                    ->add($url, $condition, $no_build);
            }
        }
        $this->is_used = true;
        
        return true;
    }
1055287
function get_external() {
        if (!count($this->js_external))
            return '';
        //если не надо собирать все в один билд-файл
        if (!$this->get_need_build_external()) {
            $js_code = '';
            foreach ($this->js_external as $js => $_js) {
                $condition = \Arr::get($_js, 'condition');
                //если надо подключать все по отдельности
                $js_code .= $this->get_link($js, $condition) . "\n";
            }
            return $js_code;
        } else {
            $build = array();
            $no_build = array();
            $js_code = '';
            foreach ($this->js_external as $js => $_js) {
                $condition = \Arr::get($_js, 'condition');
                if (\Arr::get($_js, 'no_build')) {
                    $no_build[$condition][] = $js;
                } else {
                    $build[$condition][] = $js;
                }
            }
            foreach ($no_build as $condition => $js) {
                $condition = \Arr::get($_js, 'condition');
                foreach ($js as $url) {
                    $js_code .= $this->get_link($url, $condition) . "<!-- no build -->" . PHP_EOL;
                }
            }
            foreach ($build as $condition => $js) {
                $build_name = $this->make_file_name($this->js_external, 'js/external' . ($condition ? '/' . $condition : ''), 'js');
                $build_file = Helper::build_file($build_name);
                if (!file_exists($build_file)) {
                    //соберем билд в первый раз
                    $build = array();
                    foreach ($js as $url) {
                        $_js = $this->get_source($url);
                        $_js = $this->prepare($_js, $this->get_need_min_external());
                        $build[] = $_js;
                    }
                    //если требуется собирать инлайн скрипты в один внешний файл
                    $this->require_build($build_name, implode("\n", $build));
                }
                $js_code .= $this->get_link(Helper::build_url($build_name), $condition) . PHP_EOL;
            }
            //$build_name = $this->make_file_name($this->js_inline, 'js/onload', 'js');
            return $js_code;
        }
    }