Process config options. If value is not set, save as "-1" to database

@param array $aParams params

@return array
353181
protected function _processOptions($aParams)
    {
        if (!is_array($aParams)) {
            $aParams = [];
        }

        if (!isset($aParams["oxfiles__oxdownloadexptime"]) || $aParams["oxfiles__oxdownloadexptime"] == "") {
            $aParams["oxfiles__oxdownloadexptime"] = -1;
        }
        if (!isset($aParams["oxfiles__oxlinkexptime"]) || $aParams["oxfiles__oxlinkexptime"] == "") {
            $aParams["oxfiles__oxlinkexptime"] = -1;
        }
        if (!isset($aParams["oxfiles__oxmaxunregdownloads"]) || $aParams["oxfiles__oxmaxunregdownloads"] == "") {
            $aParams["oxfiles__oxmaxunregdownloads"] = -1;
        }
        if (!isset($aParams["oxfiles__oxmaxdownloads"]) || $aParams["oxfiles__oxmaxdownloads"] == "") {
            $aParams["oxfiles__oxmaxdownloads"] = -1;
        }

        return $aParams;
    }
254847
public function actionDelete($aParams = array())
    {
        $aConfig = $this->config('Delete');

        $mResult = false;

        if ($aConfig) {
            if (!isset($aConfig['View']) || (isset($aConfig['View']) && $aConfig['View'] != false)) {
                $mResult = $this->view(array(), $aConfig['View']);
            } else if (isset($aConfig['Component'])) {
                $sComponentModule = $aConfig['Component']['Component'][0];
                $sComponentAlias  = $aConfig['Component']['Component'][1];
                $aComponentParams = isset($aConfig['Component']['Params']) ? $aConfig['Component']['Params'] : array();
                
                $object = $this->getUpdateObject($aParams);
                
                // Проверка доступа
                $this->checkActionAccess('Delete', $object);
                
                $this->deleteObject($aParams);
                
                $aComponentParams['ObjectParams'] = $aParams;
                $aComponentParams['ObjectData'] = $object->export();
                
                $mResult = $this->component($sComponentModule, $sComponentAlias, $aComponentParams);

            } else {
                $mResult = false;
            }
        } else {
            $mResult = $this->view('Delete');
        }

        return $mResult;
    }
457361
private function formatParams(array $params) {
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                $params[$key] = implode(',', $value);
            } else if (is_bool($value)) {
                $params[$key] = $value ? 1 : 0;
            }
        }
        return $params;
    }
153760
public function setupParams($params = [])
    {
        if (is_array($params)) {
            $this->params = array_merge($this->params, $params);
        }
        return $this;
    }
1226161
public function actionList($aParams = array())
    {
        $aConfig = $this->config('List');
        $limit = 10;
        
        $aFindParams = array();
        
        if (count($aParams) && $this->sMapperAlias) 
        {
            foreach ($aParams as $key=> $param)
            {
                if ($this->mapper()->isRealFieldExists($key))
                {
                    $aFindParams['Criteria'][$key] = $param;
                }
            }
        }
        
        $page = isset($_GET['page']) ? intval($_GET['page']) - 1 : 0;
        
        $aFindParams['Limit'] = $limit;
        $aFindParams['Offset'] = $page * $limit;
        
        $sort_field = isset($_GET['sort_field']) ? $_GET['sort_field'] : 'Id';
        $sort_direction = isset($_GET['sort_direction']) ? $_GET['sort_direction'] : 'ASC';
        
        $aFindParams['Order'] = array();
        //echo '<pre>', print_r($aFindParams, true), '</pre>'; die();
        
        if (isset($aConfig['Component']['FindParams'])) {
            $aFindParams = ArrayHelper::merge($aFindParams, $aConfig['Component']['FindParams']);
        }
        
        if (!count($aFindParams['Order']))
        {
            $aFindParams['Order'] = array($sort_field => $sort_direction);
        }
        
        $mResult = false;

        if ($aConfig) {
            if (!isset($aConfig['View']) || (isset($aConfig['View']) && $aConfig['View'] != false)) {
                $mResult = $this->view(array(), $aConfig['View']);
            } else if (isset($aConfig['Component'])) {
                $sComponentModule = $aConfig['Component']['Component'][0];
                $sComponentAlias  = $aConfig['Component']['Component'][1];
                $aComponentParams = isset($aConfig['Component']['Params']) ? $aConfig['Component']['Params'] : array();
                
                // Проверка доступа
                $this->checkActionAccess('List');
                
                $aComponentParams['Data'] = $this->getListData($aFindParams);
                $count = $this->getListDataCount($aFindParams);
                
                $oPagination = new Pagination($count);
                $oPagination->setPageSize($aFindParams['Limit']);
                $oPagination->applyLimit(@$aFindParams['Criteria']);
                $aComponentParams['Pagination'] = $oPagination;
                        
                $mResult = $this->component($sComponentModule, $sComponentAlias, $aComponentParams);

            } else {
                $mResult = false;
            }
        } else {
            $mResult = $this->view('List');
        }

        return $mResult;
    }
358974
protected function processArguments(array $args) {
		$definition = [];
		
		foreach ($args as $arg) {
			if ($arg->getName() !== 'argument') {
				throw new InvalidConfig('Unknown element "' . $arg->getName() . '" in arguments definition', null, null, $arg);
			}

			$definition[] = $this->processArgument($arg);
		}
		
		return $definition;
	}
1165568
public function normalizeParams(array $params): array
    {
        foreach ($params as $key => $value) {
            if (false === \is_string($value) && false === \is_resource($value)) {
                $params[$key] = json_encode($value);
            }
        }

        return $params;
    }
1017936
protected function processArgs(array $args) {
		foreach ($args as &$arg) {
			if (is_array($arg)) {
				$arg = $this->processArgs($arg);
				continue;
			}
			
			if ($arg instanceof Argument\ArgumentInterface) {
				$arg = $arg->getValue();
			}
		}
		unset($arg);
		
		return $args;
	}
257187
public function replaceBy($aParams = array()) 
	{
		$sFile = '';

		if (isset($aParams['file'])) { $sFile = $aParams['file']; }
		else { new \Exception('ConfigLoad: file obligatory');}

		$sViewDirectory = str_replace('lib'.DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.'Function',
			'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR, __DIR__);

		$aConfVars = parse_ini_file($sViewDirectory.$sFile);

		$sContent = '';
		$sContent = $this->_constructVar($sContent, $aConfVars, '$_aProtectedVar[\'app\'][\'config\']');

		return '<?php '.$sContent.'; ?>';
	}
865969
protected function setParams()
    {
        $this->params();
        //
        foreach ($this->params as $key => $value) {
            $cont = $this->strip($value);
            //
            if (Strings::length($cont) > 2) {
                if ($cont[0] == '-' && $cont[1] == '-') {
                    $this->setOption($cont);
                } elseif ($cont[0] != '-' && $cont[1] != '-') {
                    $this->setArgument($cont);
                }
            } else {
                $this->setArgument($cont);
            }
        }
    }
492734
protected function GetAllInputFieldParameter($aParameter = array())
    {
        if (!is_array($aParameter)) {
            $aParameter = array();
        }
        $aParameter = $this->GetStandardInputFieldParameter($aParameter);
        $aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ');
        $aParameter['use_datastorage'] = $this->GetConfigParameter('use_datastorage');
        $aParameter['datastorage_reuse_method'] = $this->GetConfigParameter('datastorage_reuse_method');
        $sDataExpireDateSec = time() + ((int) $this->GetConfigParameter('expiretime_min')) * 60;
        $aParameter['datastorage_expirydate'] = date('Y/m/d H:i:s', $sDataExpireDateSec);
        $oGlobal = TGlobal::instance();
        $aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;

        return $aParameter;
    }
819615
public static function getOption(...$params)
    {
        $trace = debug_backtrace(2, 1);

        $id = (isset($trace[0]['file'])) ? self::setHash($trace[0]['file']) : 0;

        $key = array_shift($params);

        $col[] = isset(self::$data[$id][$key]) ? self::$data[$id][$key] : 0;

        if (! count($params)) {
            return ($col[0]) ? $col[0] : self::$data[$id];
        }

        foreach ($params as $param) {
            $col = array_column($col, $param);
        }

        return (isset($col[0])) ? $col[0] : '';
    }
460119
protected function _getParams()
    {
        $aResult = array();
        $aParams = (array)$this->_getContainer()->getConfig()->getRequestParameter('aParams');

        foreach ($aParams as $sKey => $sValue) {
            $aResult[html_entity_decode($sKey)] = html_entity_decode($sValue);
        }

        return $aResult;
    }
658504
protected function prepareParams(array $params)
    {
        foreach ($params as $key => $param) {
            if (gettype($param) === 'boolean') {
                $params[$key] = (string)(($param) ? 'true' : 'false');
            }
        }
        return $params;
    }
467209
public function actionUpdate($aParams = array())
    {
        $aConfig = $this->config('Update');
        
        $mResult = false;

        if ($aConfig) {
            if (!isset($aConfig['View']) || (isset($aConfig['View']) && $aConfig['View'] != false)) {
                $mResult = $this->view(array(), $aConfig['View']);
            } else if (isset($aConfig['Component'])) {
                $sComponentModule = $aConfig['Component']['Component'][0];
                $sComponentAlias  = $aConfig['Component']['Component'][1];
                $aComponentParams = isset($aConfig['Component']['Params']) ? $aConfig['Component']['Params'] : array();
                
                $model = $this->getUpdateObject($aParams);
                
                // Проверка доступа
                $this->checkActionAccess('Update', $model);
                
                $aComponentParams['Data'] = $model;
                
                if(!empty($_POST))
                {
                    
                    $aResult = array();
                    $aUploadNames = array();
          
                    $model = $this->saveUpdateObject($aParams);
                    //Core::p($model); die();
                    if(!$model->isDirty() || !($model instanceof Object)) 
                    {
                        /*if (!empty($_FILES))
                        {
                            // upload files
                            $model->uploadFiles();
                        }
                        
                        if ($main_image) {
                            $model->main_image = Yii::app()->fileStorage->bucket('images')->saveUploadedFile($model, false);
                        }*/

                        $aResult['success'] = true;
                    } else {
                        $aResult['success'] = false;
                        $aResult['errors'] = $model->getErrors();
                    }
                    
                    
                    header("Content-type: application/json");
                    echo json_encode($aResult);
                    Core::app()->hardEnd();
                    
                    
                } else {
                    $mResult = $this->component($sComponentModule, $sComponentAlias, $aComponentParams);
                }

            } else {
                $mResult = false;
            }
        } else {
            $mResult = $this->view('Update');
        }

        return $mResult;
    }
1299090
protected function buildParams(array $params)
    {
        $normalizedParameters = array();

        foreach ($params as $parameter) {
            if ($parameter instanceof GeneratorInstance) {
                /* @var $parameter GeneratorInstance */
                $normalizedParameters[] = sprintf('$di->get(%s)', '\'' . $parameter->getName() . '\'');
            } else {
                $normalizedParameters[] = var_export($parameter, true);
            }
        }

        return $normalizedParameters;
    }
1267215
protected function prepareParams(array $params)
    {
        $result = $params;

        foreach ($result as $key => $val) {
            if (is_bool($val)) {
                $result[$key] = $val ? 1 : 0;
            }
        }

        return $result;
    }