disableCsrfValidation(); } protected function checkInput() { $fields = [ 'macros' => 'array' ]; $ret = $this->validateInput($fields); if (!$ret) { $this->setResponse(new CControllerResponseFatal()); } return $ret; } protected function checkPermissions() { return $this->checkAccess(CRoleHelper::UI_ADMINISTRATION_MACROS); } protected function doAction() { $data = []; if ($this->hasInput('macros')) { $data['macros'] = $this->getInput('macros'); } else { $data['macros'] = array_values(order_macros(API::UserMacro()->get([ 'output' => ['globalmacroid', 'macro', 'value', 'type', 'description'], 'globalmacro' => true ]), 'macro')); } if (!$data['macros']) { $data['macros'][] = ['macro' => '', 'value' => '', 'description' => '', 'type' => ZBX_MACRO_TYPE_TEXT]; } $response = new CControllerResponseData($data); $response->setTitle(_('Configuration of macros')); $this->setResponse($response); } }