本文整理汇总了PHP中show_error_message函数的典型用法代码示例。如果您正苦于以下问题:PHP show_error_message函数的具体用法?PHP show_error_message怎么用?PHP show_error_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_error_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: see_also_page_template
function see_also_page_template()
{
$parent_post_id = array_key_exists('parent', $_GET) ? $_GET['parent'] : 0;
if (array_key_exists('meta', $_GET)) {
$meta_id = $_GET['meta'];
} else {
if (is_page('video')) {
$meta_id = get_meta_id_by_key($parent_post_id, 'external_video_url');
}
}
if (empty($meta_id)) {
show_error_message('missing_meta_param', $parent_post_id);
}
$external_url_meta = get_metadata_by_mid('post', $meta_id);
if (!empty($external_url_meta->meta_value)) {
echo do_shortcode('[iframe src="' . $external_url_meta->meta_value . '" width="100% height="100%]');
} else {
show_error_message('missing_url', $parent_post_id);
}
}
示例2: invalid_url
function invalid_url($msg = null)
{
if (empty($msg)) {
$msg = _('Zabbix has received an incorrect request.');
}
// required global parameters for correct including page_header.php
global $DB, $ZBX_MESSAGES;
// backup messages before including page_header.php
$temp = $ZBX_MESSAGES;
$ZBX_MESSAGES = null;
require_once dirname(__FILE__) . '/page_header.php';
// rollback reseted messages
$ZBX_MESSAGES = $temp;
unset_all();
show_error_message($msg);
require_once dirname(__FILE__) . '/page_footer.php';
}
示例3: dirname
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['file'] = 'chart.php';
$page['type'] = PAGE_TYPE_IMAGE;
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('itemid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'screenid' => array(T_ZBX_STR, O_OPT, null, null, null), 'period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'profileIdx' => array(T_ZBX_STR, O_OPT, null, null, null), 'profileIdx2' => array(T_ZBX_STR, O_OPT, null, null, null), 'updateProfile' => array(T_ZBX_STR, O_OPT, null, null, null), 'from' => array(T_ZBX_INT, O_OPT, null, '{}>=0', null), 'width' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'height' => array(T_ZBX_INT, O_OPT, null, '{}>0', null), 'border' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
/*
* Permissions
*/
if (!DBfetch(DBselect('SELECT i.itemid FROM items i WHERE i.itemid=' . $_REQUEST['itemid']))) {
show_error_message(_('No items defined.'));
}
$dbItems = API::Item()->get(array('itemids' => $_REQUEST['itemid'], 'webitems' => true, 'nodeids' => get_current_nodeid(true), 'filter' => array('flags' => null)));
if (empty($dbItems)) {
access_deny();
}
/*
* Display
*/
$timeline = CScreenBase::calculateTime(array('profileIdx' => get_request('profileIdx', 'web.screens'), 'profileIdx2' => get_request('profileIdx2'), 'updateProfile' => get_request('updateProfile', true), 'period' => get_request('period'), 'stime' => get_request('stime')));
$graph = new CChart();
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
if (isset($_REQUEST['from'])) {
$graph->setFrom($_REQUEST['from']);
}
示例4: dirname
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Scripts');
$page['file'] = 'scripts_exec.php';
define('ZBX_PAGE_NO_MENU', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'scriptid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'execute' => array(T_ZBX_INT, O_OPT, P_ACT, IN('0,1'), null));
check_fields($fields);
if (isset($_REQUEST['execute'])) {
$scriptid = get_request('scriptid');
$hostid = get_request('hostid');
$data = array('message' => '', 'info' => DBfetch(DBselect('SELECT s.name FROM scripts s WHERE s.scriptid=' . zbx_dbstr($scriptid))));
$result = API::Script()->execute(array('hostid' => $hostid, 'scriptid' => $scriptid));
$isErrorExist = false;
if (empty($result)) {
$isErrorExist = true;
} elseif ($result['response'] == 'failed') {
error($result['value']);
$isErrorExist = true;
} else {
$data['message'] = $result['value'];
}
if ($isErrorExist) {
show_error_message(_('Cannot connect to the trapper port of zabbix server daemon, but it should be available to run the script.'));
}
// render view
$scriptView = new CView('general.script.execute', $data);
$scriptView->render();
$scriptView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例5: define
define('ZBX_PAGE_DO_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
$queueModes = [QUEUE_OVERVIEW, QUEUE_OVERVIEW_BY_PROXY, QUEUE_DETAILS];
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = ['config' => [T_ZBX_INT, O_OPT, P_SYS, IN($queueModes), null]];
check_fields($fields);
$config = getRequest('config', CProfile::get('web.queue.config', 0));
CProfile::update('web.queue.config', $config, PROFILE_TYPE_INT);
// fetch data
$zabbixServer = new CZabbixServer($ZBX_SERVER, $ZBX_SERVER_PORT, ZBX_SOCKET_TIMEOUT, ZBX_SOCKET_BYTES_LIMIT);
$queueRequests = [QUEUE_OVERVIEW => CZabbixServer::QUEUE_OVERVIEW, QUEUE_OVERVIEW_BY_PROXY => CZabbixServer::QUEUE_OVERVIEW_BY_PROXY, QUEUE_DETAILS => CZabbixServer::QUEUE_DETAILS];
$queueData = $zabbixServer->getQueue($queueRequests[$config], get_cookie('zbx_sessionid'));
// check for errors error
if ($zabbixServer->getError()) {
error($zabbixServer->getError());
show_error_message(_('Cannot display item queue.'));
require_once dirname(__FILE__) . '/include/page_footer.php';
}
$widget = (new CWidget())->setTitle(_('Queue of items to be updated'))->setControls((new CForm('get'))->cleanItems()->addItem((new CList())->addItem((new CComboBox('config', $config, 'submit();'))->addItem(QUEUE_OVERVIEW, _('Overview'))->addItem(QUEUE_OVERVIEW_BY_PROXY, _('Overview by proxy'))->addItem(QUEUE_DETAILS, _('Details')))));
$table = new CTableInfo();
$severityConfig = select_config();
// overview
if ($config == QUEUE_OVERVIEW) {
$itemTypes = [ITEM_TYPE_ZABBIX, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV1, ITEM_TYPE_SNMPV2C, ITEM_TYPE_SNMPV3, ITEM_TYPE_INTERNAL, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED];
$table->setHeader([_('Items'), _('5 seconds'), _('10 seconds'), _('30 seconds'), _('1 minute'), _('5 minutes'), _('More than 10 minutes')]);
$queueData = zbx_toHash($queueData, 'itemtype');
foreach ($itemTypes as $type) {
if (isset($queueData[$type])) {
$itemTypeData = $queueData[$type];
} else {
$itemTypeData = ['delay5' => 0, 'delay10' => 0, 'delay30' => 0, 'delay60' => 0, 'delay300' => 0, 'delay600' => 0];
示例6: ob_end_clean
ob_end_clean();
redirect(CWebUser::$data['last_page']['url']);
} elseif (hasRequest('update')) {
$auth_type = getUserAuthenticationType(CWebUser::$data['userid']);
if ($auth_type != ZBX_AUTH_INTERNAL) {
$_REQUEST['password1'] = $_REQUEST['password2'] = null;
} else {
$_REQUEST['password1'] = getRequest('password1');
$_REQUEST['password2'] = getRequest('password2');
}
if ($_REQUEST['password1'] != $_REQUEST['password2']) {
show_error_message(_('Cannot update user. Both passwords must be equal.'));
} elseif (isset($_REQUEST['password1']) && CWebUser::$data['alias'] == ZBX_GUEST_USER && !zbx_empty($_REQUEST['password1'])) {
show_error_message(_('For guest, password must be empty'));
} elseif (isset($_REQUEST['password1']) && CWebUser::$data['alias'] != ZBX_GUEST_USER && zbx_empty($_REQUEST['password1'])) {
show_error_message(_('Password should not be empty'));
} else {
$user = array();
$user['userid'] = CWebUser::$data['userid'];
$user['alias'] = CWebUser::$data['alias'];
$user['passwd'] = getRequest('password1');
$user['url'] = getRequest('url');
$user['autologin'] = getRequest('autologin', 0);
$user['autologout'] = hasRequest('autologout_visible') ? getRequest('autologout') : 0;
$user['theme'] = getRequest('theme');
$user['refresh'] = getRequest('refresh');
$user['rows_per_page'] = getRequest('rows_per_page');
$user['user_groups'] = null;
$user['user_medias'] = getRequest('user_medias', array());
if (hasRequest('lang')) {
$user['lang'] = getRequest('lang');
示例7: show_error_message
} else {
$_REQUEST['password1'] = $_REQUEST['password2'] = 'zabbix';
}
}
if ($_REQUEST['password1'] != $_REQUEST['password2']) {
if (isset($_REQUEST['userid'])) {
show_error_message(S_CANNOT_UPDATE_USER_BOTH_PASSWORDS);
} else {
show_error_message(S_CANNOT_ADD_USER_BOTH_PASSWORDS_MUST);
}
} else {
if (isset($_REQUEST['password1']) && $_REQUEST['alias'] == ZBX_GUEST_USER && !zbx_empty($_REQUEST['password1'])) {
show_error_message(S_FOR_GUEST_PASSWORD_MUST_BE_EMPTY);
} else {
if (isset($_REQUEST['password1']) && $_REQUEST['alias'] != ZBX_GUEST_USER && zbx_empty($_REQUEST['password1'])) {
show_error_message(S_PASSWORD_SHOULD_NOT_BE_EMPTY);
} else {
if (isset($_REQUEST['userid'])) {
$action = AUDIT_ACTION_UPDATE;
DBstart();
$result = update_user($_REQUEST['userid'], $_REQUEST['name'], $_REQUEST['surname'], $_REQUEST['alias'], $_REQUEST['password1'], $_REQUEST['url'], get_request('autologin', 0), get_request('autologout', 0), $_REQUEST['lang'], $_REQUEST['theme'], $_REQUEST['refresh'], $_REQUEST['user_type'], $user_groups, $user_medias);
$result = DBend($result);
show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
} else {
$action = AUDIT_ACTION_ADD;
DBstart();
$result = add_user($_REQUEST['name'], $_REQUEST['surname'], $_REQUEST['alias'], $_REQUEST['password1'], $_REQUEST['url'], get_request('autologin', 0), get_request('autologout', 0), $_REQUEST['lang'], $_REQUEST['theme'], $_REQUEST['refresh'], $_REQUEST['user_type'], $user_groups, $user_medias);
$result = DBend($result);
show_messages($result, S_USER_ADDED, S_CANNOT_ADD_USER);
}
if ($result) {
示例8: zbx_toHash
$dbItems = zbx_toHash($dbItems, 'itemid');
foreach ($items as $item) {
if (!isset($dbItems[$item['itemid']])) {
access_deny();
}
}
/*
* Validation
*/
$types = array();
foreach ($items as $item) {
if ($item['type'] == GRAPH_ITEM_SUM) {
if (!in_array($item['type'], $types)) {
array_push($types, $item['type']);
} else {
show_error_message(_('Cannot display more than one item with type "Graph sum".'));
break;
}
}
}
/*
* Display
*/
if ($isDataValid) {
navigation_bar_calc();
$graph = new CPieGraphDraw(getRequest('graphtype', GRAPH_TYPE_NORMAL));
$graph->setHeader(getRequest('name', ''));
if (!empty($_REQUEST['graph3d'])) {
$graph->switchPie3D();
}
$graph->showLegend(getRequest('legend', 0));
示例9: invalid_url
function invalid_url($msg = S_INVALID_URL_PARAMS)
{
include_once 'include/page_header.php';
unset_all();
show_error_message($msg);
include_once 'include/page_footer.php';
}
示例10: validateMinMax
/**
* Check if Y axis min value is larger than Y axis max value. Show error instead of graph if true.
*
* @param float $min Y axis min value
* @param float $max Y axis max value
*/
protected function validateMinMax($min, $max)
{
if (bccomp($min, $max) == 0 || bccomp($min, $max) == 1) {
show_error_message(_('Y axis MAX value must be greater than Y axis MIN value.'));
exit;
}
}
示例11: access_deny
access_deny();
}
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('password1' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({form})&&({form}!="update")&&isset({change_password})'), 'password2' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({form})&&({form}!="update")&&isset({change_password})'), 'lang' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), 'theme' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), 'autologin' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'autologout' => array(T_ZBX_INT, O_OPT, null, BETWEEN(90, 10000), null), 'url' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'refresh' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 3600), 'isset({save})'), 'change_password' => array(T_ZBX_STR, O_OPT, null, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
if (isset($_REQUEST['cancel'])) {
$url = get_profile('web.menu.view.last', 'index.php');
redirect($url);
} else {
if (isset($_REQUEST['save'])) {
$_REQUEST['password1'] = get_request('password1', null);
$_REQUEST['password2'] = get_request('password2', null);
if (isset($_REQUEST['password1']) && $_REQUEST['password1'] == '') {
show_error_message(S_ONLY_FOR_GUEST_ALLOWED_EMPTY_PASSWORD);
} else {
if ($_REQUEST['password1'] == $_REQUEST['password2']) {
$result = update_user_profile($USER_DETAILS['userid'], $_REQUEST['password1'], $_REQUEST['url'], get_request('autologin', 0), get_request('autologout', 0), $_REQUEST['lang'], $_REQUEST['theme'], $_REQUEST['refresh']);
show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
if ($result) {
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_USER, 'User alias [' . $USER_DETAILS['alias'] . '] name [' . $USER_DETAILS['name'] . '] surname [' . $USER_DETAILS['surname'] . '] profile id [' . $USER_DETAILS['userid'] . ']');
}
} else {
show_error_message(S_CANNOT_UPDATE_USER_BOTH_PASSWORDS);
}
}
}
}
show_table_header(S_USER_PROFILE_BIG . ' : ' . $USER_DETAILS['name'] . ' ' . $USER_DETAILS['surname']);
echo '<br>';
insert_user_form($USER_DETAILS['userid'], 1);
include_once 'include/page_footer.php';
示例12: validateBarReportPeriods
/**
* Validate periods array for bar reports - time since, time till and color.
* Automatically set caption if none is set.
*
* @param array $periods
*
* @return mixed valid periods array on success or false on failure
*/
function validateBarReportPeriods($periods = array())
{
if (!isset($periods) || !$periods) {
return false;
}
$fields = array('report_timesince', 'report_timetill', 'color');
$colorValidator = new CColorValidator();
foreach ($periods as &$period) {
foreach ($fields as $field) {
if (!isset($period[$field]) || !$period[$field]) {
show_error_message(_s('Missing "%1$s" field for period.', $field));
return false;
}
}
if (!$colorValidator->validate($period['color'])) {
show_error_message($colorValidator->getError());
return false;
}
if (!validateUnixTime($period['report_timesince'])) {
show_error_message(_s('Invalid period for field "%1$s".', 'report_timesince'));
return false;
}
if (!validateUnixTime($period['report_timetill'])) {
show_error_message(_s('Invalid period for field "%1$s".', 'report_timetill'));
return false;
}
if (!isset($period['caption']) || zbx_empty($period['caption'])) {
$period['caption'] = zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']) . ' - ' . zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']);
}
}
unset($period);
return $periods;
}
示例13: fatal_error
function fatal_error($msg)
{
include_once 'include/page_header.php';
show_error_message($msg);
include_once 'include/page_footer.php';
}
示例14: CComboBox
// header form
$configComboBox = new CComboBox('config', 'screens.php', 'javascript: redirect(this.options[this.selectedIndex].value);');
$configComboBox->addItem('screens.php', _('Screens'));
$configComboBox->addItem('slides.php', _('Slide shows'));
$headerForm = new CForm();
$headerForm->addItem($configComboBox);
if (empty($this->data['screens'])) {
$screenWidget->addPageHeader(_('SCREENS'), $headerForm);
$screenWidget->addItem(BR());
$screenWidget->addItem(new CTableInfo(_('No screens defined.')));
$screenBuilder = new CScreenBuilder();
CScreenBuilder::insertScreenStandardJs(array('timeline' => $screenBuilder->timeline));
} elseif (!isset($this->data['screens'][$this->data['elementIdentifier']]) && !$this->data['id_has_been_fetched_from_profile']) {
// if screen we are searching for does not exist and was not fetched from profile
$error_msg = $this->data['use_screen_name'] ? _s('Screen with name "%s" does not exist.', $this->data['elementIdentifier']) : _s('Screen with ID "%s" does not exist.', $this->data['elementIdentifier']);
show_error_message($error_msg);
} else {
if (!isset($this->data['screens'][$this->data['elementIdentifier']])) {
// this means id was fetched from profile and this screen does not exist
// in this case we need to show the first one
$screen = reset($this->data['screens']);
} else {
$screen = $this->data['screens'][$this->data['elementIdentifier']];
}
// if elementid is used to fetch an element, saving it in profile
if (!$this->data['use_screen_name']) {
CProfile::update('web.screens.elementid', $screen['screenid'], PROFILE_TYPE_ID);
}
// page header
$screenWidget->addPageHeader(_('SCREENS'), array($headerForm, SPACE, get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $screen['screenid'])), SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen']))));
$screenWidget->addItem(BR());
示例15: zbx_toArray
$validateConditions = $conditions;
if (isset($newCondition['value'])) {
$newConditionValues = zbx_toArray($newCondition['value']);
foreach ($newConditionValues as $newValue) {
$condition = $newCondition;
$condition['value'] = $newValue;
$validateConditions[] = $condition;
}
}
if ($validateConditions) {
CAction::validateConditions($validateConditions);
}
$_REQUEST['conditions'] = $validateConditions;
}
} catch (APIException $e) {
show_error_message(_('Cannot add action condition'));
error($e->getMessage());
}
} elseif (isset($_REQUEST['add_opcondition']) && isset($_REQUEST['new_opcondition'])) {
$new_opcondition = $_REQUEST['new_opcondition'];
try {
CAction::validateOperationConditions($new_opcondition);
$new_operation = get_request('new_operation', array());
if (!isset($new_operation['opconditions'])) {
$new_operation['opconditions'] = array();
}
if (!str_in_array($new_opcondition, $new_operation['opconditions'])) {
array_push($new_operation['opconditions'], $new_opcondition);
}
$_REQUEST['new_operation'] = $new_operation;
unset($_REQUEST['new_opcondition']);