示例#1
0
 $user['user_medias'] = getRequest('user_medias', array());
 if (hasRequest('lang')) {
     $user['lang'] = getRequest('lang');
 }
 $messages = getRequest('messages', array());
 if (!isset($messages['enabled'])) {
     $messages['enabled'] = 0;
 }
 if (!isset($messages['triggers.recovery'])) {
     $messages['triggers.recovery'] = 0;
 }
 if (!isset($messages['triggers.severities'])) {
     $messages['triggers.severities'] = array();
 }
 DBstart();
 updateMessageSettings($messages);
 $result = API::User()->updateProfile($user);
 if ($result && CwebUser::$data['type'] > USER_TYPE_ZABBIX_USER) {
     $result = API::User()->updateMedia(array('users' => $user, 'medias' => $user['user_medias']));
 }
 $result = DBend($result);
 if (!$result) {
     error(API::User()->resetErrors());
 }
 if ($result) {
     DBstart();
     add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_USER, 'User alias [' . CWebUser::$data['alias'] . '] Name [' . CWebUser::$data['name'] . ']' . ' Surname [' . CWebUser::$data['surname'] . '] profile id [' . CWebUser::$data['userid'] . ']');
     DBend(true);
     ob_end_clean();
     redirect(CWebUser::$data['last_page']['url']);
 } else {
示例#2
0
                $priority = $trigger['priority'];
                $title = S_PROBLEM_ON;
                $sound = $msgsettings['sounds.' . $trigger['priority']];
            }
            $url_tr_status = 'tr_status.php?hostid=' . $host['hostid'];
            $url_events = 'events.php?triggerid=' . $event['objectid'];
            $url_tr_events = 'tr_events.php?eventid=' . $event['eventid'] . '&triggerid=' . $event['objectid'];
            $result[$enum] = array('type' => 3, 'caption' => 'events', 'sourceid' => $event['eventid'], 'time' => $event['clock'], 'priority' => $priority, 'sound' => $sound, 'color' => getEventColor($trigger['priority'], $event['value']), 'title' => $title . ' ' . get_node_name_by_elid($host['hostid'], null, ':') . '[url=' . $url_tr_status . ']' . $host['host'] . '[/url]', 'body' => array(S_DETAILS . ': ' . ' [url=' . $url_events . ']' . $trigger['description'] . '[/url]', S_DATE . ': [b][url=' . $url_tr_events . ']' . zbx_date2str(S_DATE_FORMAT_YMDHMS, $event['clock']) . '[/url][/b]'), 'timeout' => $msgsettings['timeout']);
            $sortClock[$enum] = $event['clock'];
            $sortEvent[$enum] = $event['eventid'];
        }
        array_multisort($sortClock, SORT_ASC, $sortEvent, SORT_ASC, $result);
        break;
    case 'message.closeAll':
        $params = $data['params'];
        $msgsettings = getMessageSettings();
        switch (strtolower($params['caption'])) {
            case 'events':
                $msgsettings['last.clock'] = (int) $params['time'] + 1;
                updateMessageSettings($msgsettings);
                break;
        }
        break;
    default:
        fatal_error('Wrong RPC call to JS RPC');
}
if (isset($data['id'])) {
    $rpcResp = array('jsonrpc' => '2.0', 'result' => $result, 'id' => $data['id']);
    print $json->encode($rpcResp);
}
include_once 'include/page_footer.php';