13Loc::loadMessages(__FILE__);
47 $this->request = Context::getCurrent()->getRequest();
50 protected function end()
52 include(
$_SERVER[
"DOCUMENT_ROOT"].
BX_ROOT.
"/modules/main/include/epilog_after.php");
67 $this->sendJsonErrorResponse();
93 if(!defined(
'PUBLIC_AJAX_MODE'))
95 define(
'PUBLIC_AJAX_MODE',
true);
101 if(!empty(
$params[
'http_status']) &&
$params[
'http_status'] == 403)
103 header(
'HTTP/1.0 403 Forbidden',
true, 403);
105 if(!empty(
$params[
'http_status']) &&
$params[
'http_status'] == 500)
107 header(
'HTTP/1.0 500 Internal Server Error',
true, 500);
110 header(
'Content-Type:application/json; charset=UTF-8');
116 protected function sendJsonErrorResponse()
123 'message' =>
$error->getMessage(),
124 'code' =>
$error->getCode(),
128 $this->sendJsonResponse(
array(
129 'status' => self::STATUS_ERROR,
137 'status' => self::STATUS_DENIED,
145 'status' => self::STATUS_INVALID_SIGN,
152 $response[
'status'] = self::STATUS_SUCCESS;
158 $response[
'status'] = self::STATUS_PROCESSING;
164 $response[
'status'] = self::STATUS_COMPLETED;
183 return $this->errorCollection->toArray();
191 return $this->errorCollection->getErrorsByCode(
$code);
199 return $this->errorCollection->getErrorByCode(
$code);
205 $action = mb_strtolower($this->action);
207 if(!isset($listOfActions[
$action]))
209 $this->errorCollection->add(
array(
new Error(Loc::getMessage(
'LISTS_CONTROLLER_ERROR_UNKNOWN_ACTION',
array(
'#ACTION#' =>
$action)), self::ERROR_UNKNOWN_ACTION)));
213 $this->realActionName =
$action;
224 $normalized =
array();
238 return array_change_key_case($normalized, CASE_LOWER);
246 'method' =>
array(
'GET'),
248 'check_csrf_token' =>
false,
249 'redirect_on_auth' =>
true,
250 'close_session' =>
false,
271 if($this->errorCollection->hasErrors())
273 $this->sendJsonErrorResponse();
290 if((
$description[
'check_csrf_token'] ??
false) ===
true || ($this->request->isPost() && !isset(
$description[
'check_csrf_token'])))
299 if(!in_array($this->request->getRequestMethod(),
$description[
'method']))
323 return $this->actionDescription;
373 session_write_close();
375 $actionMethod =
'processAction' . $this->
getAction();
377 return $this->$actionMethod();
383 $this->errorCollection->add(
array(
new Error($e->getMessage())));
384 $this->sendJsonErrorResponse();
413 foreach ($required as $item)
415 if(!isset($inputParams[$item]) || (!$inputParams[$item] && !(is_string($inputParams[$item]) && mb_strlen($inputParams[$item]))))
417 $this->errorCollection->add(
array(
new Error(Loc::getMessage(
'LISTS_CONTROLLER_ERROR_REQUIRED_PARAMETER',
array(
'#PARAM#' => $item)), self::ERROR_REQUIRED_PARAMETER)));
428 foreach($required as $item)
430 $params[$item] = $this->request->getPost($item);
440 foreach($required as $item)
442 $params[$item] = $this->request->getQuery($item);
452 foreach($required as $item)
454 $params[$item] = $this->request->getFile($item);
467 return isset(
$_SERVER[
'HTTP_X_REQUESTED_WITH']) &&
$_SERVER[
'HTTP_X_REQUESTED_WITH'] ===
'XMLHttpRequest';
sendJsonCompletedResponse(array $response=array())
sendJsonSuccessResponse(array $response=array())
const STATUS_INVALID_SIGN
runProcessingIfUserNotAuthorized()
sendJsonInvalidSignResponse($message='')
const ERROR_REQUIRED_PARAMETER
processBeforeAction($actionName)
checkRequiredFilesParams(array $required)
setAction($action, array $description)
const ERROR_UNKNOWN_ACTION
runProcessingException(\Exception $e)
sendJsonResponse($response, $params=null)
sendJsonProcessingResponse(array $response=array())
normalizeActionDescription($action, $description)
checkRequiredPostParams(array $required)
checkRequiredGetParams(array $required)
runProcessingIfInvalidCsrfToken()
normalizeListOfAction(array $listOfActions)
checkRequiredInputParams(array $inputParams, array $required)
sendJsonAccessDeniedResponse($message='')
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
$_SERVER["DOCUMENT_ROOT"]
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
const SITE_DIR(!defined('LANG'))
check_bitrix_sessid($varname='sessid')
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']