...Человеческий поиск в разработке...
- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/publicaction.php
- Класс: BitrixLandingPublicAction
- Вызов: PublicAction::actionProcessing
static function actionProcessing($action, $data, $isRest = false) { if (!is_array($data)) { $data = array(); } if (isset($data['scope'])) { Type::setScope($data['scope']); } if (!$isRest && (!defined('BX_UTF') || BX_UTF !== true)) { $data = Manager::getApplication()->convertCharsetArray( $data, 'UTF-8', SITE_CHARSET ); } $error = new Error; // not for guest if (!Manager::getUserId() || !self::checkForExtranet()) { $error->addError( 'ACCESS_DENIED', Loc::getMessage('LANDING_ACCESS_DENIED2') ); } // tmp flag for compatibility else if ( ModuleManager::isModuleInstalled('bitrix24') && Manager::getOption('temp_permission_admin_only') && !CBitrix24::isPortalAdmin(Manager::getUserId()) ) { $error->addError( 'ACCESS_DENIED', Loc::getMessage('LANDING_ACCESS_DENIED2') ); } // check common permission else if ( !Rights::hasAdditionalRight( Rights::ADDITIONAL_RIGHTS['menu24'], null, true ) ) { $error->addError( 'ACCESS_DENIED', Loc::getMessage('LANDING_ACCESS_DENIED2') ); } else if (!Manager::isB24() && Manager::getApplication()->getGroupRight('landing') < 'W') { $error->addError( 'ACCESS_DENIED', Loc::getMessage('LANDING_ACCESS_DENIED2') ); } // if method::action exist in PublicAction, call it elseif (($action = self::getMethodInfo($action, $data))) { if (!$isRest && !check_bitrix_sessid()) { $error->addError( 'SESSION_EXPIRED', Loc::getMessage('LANDING_SESSION_EXPIRED') ); } if (!empty($action['params_missing'])) { $error->addError( 'MISSING_PARAMS', Loc::getMessage('LANDING_MISSING_PARAMS', array( '#MISSING#' => implode(', ', $action['params_missing']) )) ); } if (method_exists($action['class'], 'init')) { $result = call_user_func_array( array($action['class'], 'init'), [] ); if (!$result->isSuccess()) { $error->copyError($result->getError()); } } // all right - execute if ($error->isEmpty()) { try { $result = call_user_func_array( array($action['class'], $action['method']), $action['params_init'] ); // answer if ($result === null)// void is accepted as success { return array( 'type' => 'success', 'result' => true ); } else if ($result->isSuccess()) { $restResult = $result->getResult(); $event = new BitrixMainEvent('landing', 'onSuccessRest', [ 'result' => $restResult, 'action' => $action ]); $event->send(); foreach ($event->getResults() as $eventResult) { if (($modified = $eventResult->getModified())) { if (isset($modified['result'])) { $restResult = $modified['result']; } } } return array( 'type' => 'success', 'result' => $restResult ); } else { $error->copyError($result->getError()); } } catch (TypeError $e) { $error->addError( 'TYPE_ERROR', $e->getMessage() ); } catch (Exception $e) { $error->addError( 'SYSTEM_ERROR', $e->getMessage() ); } } } // error $errors = array(); foreach ($error->getErrors() as $error) { $errors[] = array( 'error' => $error->getCode(), 'error_description' => $error->getMessage() ); } if (!$isRest) { return [ 'sessid' => bitrix_sessid(), 'type' => 'error', 'result' => $errors ]; } else { return [ 'type' => 'error', 'result' => $errors ]; } }