当前位置: 首页>>代码示例>>PHP>>正文


PHP CWebUser::getType方法代码示例

本文整理汇总了PHP中CWebUser::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP CWebUser::getType方法的具体用法?PHP CWebUser::getType怎么用?PHP CWebUser::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWebUser的用法示例。


在下文中一共展示了CWebUser::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkSelementPermissions

 /**
  * Checks that the user has write permissions to objects used in the map elements.
  *
  * @throws APIException if the user has no permissions to at least one of the objects
  *
  * @param array $selements
  */
 protected function checkSelementPermissions(array $selements)
 {
     if (CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
         return;
     }
     $hostIds = $groupIds = $triggerIds = $mapIds = array();
     foreach ($selements as $selement) {
         switch ($selement['elementtype']) {
             case SYSMAP_ELEMENT_TYPE_HOST:
                 $hostIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
                 $groupIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_TRIGGER:
                 $triggerIds[$selement['elementid']] = $selement['elementid'];
                 break;
             case SYSMAP_ELEMENT_TYPE_MAP:
                 $mapIds[$selement['elementid']] = $selement['elementid'];
                 break;
         }
     }
     if ($hostIds && !API::Host()->isWritable($hostIds) || $groupIds && !API::HostGroup()->isWritable($groupIds) || $triggerIds && !API::Trigger()->isWritable($triggerIds) || $mapIds && !API::Map()->isWritable($mapIds)) {
         self::exception(ZBX_API_ERROR_PERMISSIONS, _('No permissions to referred object or it does not exist!'));
     }
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:33,代码来源:CMapElement.php

示例2: bodyToString

 function bodyToString($destroy = true)
 {
     $setup_left = (new CDiv([(new CDiv())->addClass(ZBX_STYLE_SIGNIN_LOGO), $this->getList()]))->addClass(ZBX_STYLE_SETUP_LEFT);
     $setup_right = (new CDiv($this->getStage()))->addClass(ZBX_STYLE_SETUP_RIGHT);
     if (CWebUser::$data && CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
         $cancel_button = (new CSubmit('cancel', _('Cancel')))->addClass(ZBX_STYLE_BTN_ALT)->addClass(ZBX_STYLE_FLOAT_LEFT);
         if ($this->DISABLE_CANCEL_BUTTON) {
             $cancel_button->setEnabled(false);
         }
     } else {
         $cancel_button = null;
     }
     if (array_key_exists($this->getStep() + 1, $this->stage)) {
         $next_button = new CSubmit('next[' . $this->getStep() . ']', _('Next step'));
     } else {
         $next_button = new CSubmit($this->SHOW_RETRY_BUTTON ? 'retry' : 'finish', _('Finish'));
     }
     $back_button = (new CSubmit('back[' . $this->getStep() . ']', _('Back')))->addClass(ZBX_STYLE_BTN_ALT)->addClass(ZBX_STYLE_FLOAT_LEFT);
     if ($this->getStep() == 0 || $this->DISABLE_BACK_BUTTON) {
         $back_button->setEnabled(false);
     }
     $setup_footer = (new CDiv([new CDiv([$next_button, $back_button]), $cancel_button]))->addClass(ZBX_STYLE_SETUP_FOOTER);
     $setup_container = (new CDiv([$setup_left, $setup_right, $setup_footer]))->addClass(ZBX_STYLE_SETUP_CONTAINER);
     return parent::bodyToString($destroy) . $setup_container->ToString();
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:25,代码来源:CSetupWizard.php

示例3: getHostInventories

    $data['hostScripts'] = API::Script()->getScriptsByHosts([$hostId]);
    // inventory info
    $data['tableTitles'] = getHostInventories();
    $data['tableTitles'] = zbx_toHash($data['tableTitles'], 'db_field');
    $inventoryFields = array_keys($data['tableTitles']);
    // overview tab
    $data['host'] = API::Host()->get(['output' => ['hostid', 'host', 'name', 'status', 'maintenance_status', 'maintenanceid', 'maintenance_type', 'description'], 'selectInterfaces' => API_OUTPUT_EXTEND, 'selectItems' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectScreens' => API_OUTPUT_COUNT, 'selectInventory' => $inventoryFields, 'selectGraphs' => API_OUTPUT_COUNT, 'selectApplications' => API_OUTPUT_COUNT, 'selectDiscoveries' => API_OUTPUT_COUNT, 'selectHttpTests' => API_OUTPUT_COUNT, 'hostids' => $hostId, 'preservekeys' => true]);
    $data['host'] = reset($data['host']);
    unset($data['host']['inventory']['hostid']);
    // resolve macros
    $data['host']['interfaces'] = CMacrosResolverHelper::resolveHostInterfaces($data['host']['interfaces']);
    if ($data['host']['maintenance_status'] == HOST_MAINTENANCE_STATUS_ON) {
        $data['maintenances'] = API::Maintenance()->get(['maintenanceids' => [$data['host']['maintenanceid']], 'output' => ['name', 'description'], 'preservekeys' => true]);
    }
    // get permissions
    $userType = CWebUser::getType();
    if ($userType == USER_TYPE_SUPER_ADMIN) {
        $data['rwHost'] = true;
    } elseif ($userType == USER_TYPE_ZABBIX_ADMIN) {
        $rwHost = API::Host()->get(['output' => ['hostid'], 'hostids' => $hostId, 'editable' => true]);
        $data['rwHost'] = (bool) $rwHost;
    } else {
        $data['rwHost'] = false;
    }
    // view generation
    $hostinventoriesView = new CView('inventory.host.view', $data);
    $hostinventoriesView->render();
    $hostinventoriesView->show();
} else {
    $data = ['config' => select_config(), 'hosts' => [], 'sort' => $sortField, 'sortorder' => $sortOrder];
    // filter
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:hostinventories.php

示例4: check_right_on_discovery

/**
 * Returns true if the user has the permissions to network discovery.
 *
 * @return bool
 */
function check_right_on_discovery()
{
    return CWebUser::getType() >= USER_TYPE_ZABBIX_ADMIN;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:9,代码来源:discovery.inc.php

示例5: checkInput

 public function checkInput(array &$dRules)
 {
     $dRules = zbx_toArray($dRules);
     if (empty($dRules)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty input.'));
     }
     if (CWebUser::getType() < USER_TYPE_ZABBIX_ADMIN) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('No permissions to referred object or it does not exist!'));
     }
     $proxies = array();
     $ipRangeValidator = new CIPRangeValidator(array('ipRangeLimit' => ZBX_DISCOVERER_IPRANGE_LIMIT));
     foreach ($dRules as $dRule) {
         if (!isset($dRule['iprange'])) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _('IP range cannot be empty.'));
         }
         if (!$ipRangeValidator->validate($dRule['iprange'])) {
             self::exception(ZBX_API_ERROR_PARAMETERS, $ipRangeValidator->getError());
         }
         if (isset($dRule['delay']) && $dRule['delay'] < 0) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect delay.'));
         }
         if (isset($dRule['status']) && ($dRule['status'] != DRULE_STATUS_DISABLED && $dRule['status'] != DRULE_STATUS_ACTIVE)) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect status.'));
         }
         if (empty($dRule['dchecks'])) {
             self::exception(ZBX_API_ERROR_PARAMETERS, _('Cannot save discovery rule without checks.'));
         }
         $this->validateDChecks($dRule['dchecks']);
         if (isset($dRule['proxy_hostid']) && $dRule['proxy_hostid']) {
             $proxies[] = $dRule['proxy_hostid'];
         }
     }
     if (!empty($proxies)) {
         $proxiesDB = API::proxy()->get(array('proxyids' => $proxies, 'output' => array('proxyid'), 'preservekeys' => true));
         foreach ($proxies as $proxy) {
             if (!isset($proxiesDB[$proxy])) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect proxyid.'));
             }
         }
     }
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:41,代码来源:CDRule.php

示例6: applyQueryFilterOptions

 protected function applyQueryFilterOptions($tableName, $tableAlias, array $options, array $sqlParts)
 {
     $sqlParts = parent::applyQueryFilterOptions($tableName, $tableAlias, $options, $sqlParts);
     // do not return host prototypes from discovered hosts
     $sqlParts['from'][] = 'host_discovery hd';
     $sqlParts['from'][] = 'items i';
     $sqlParts['from'][] = 'hosts ph';
     $sqlParts['where'][] = $this->fieldId('hostid') . '=hd.hostid';
     $sqlParts['where'][] = 'hd.parent_itemid=i.itemid';
     $sqlParts['where'][] = 'i.hostid=ph.hostid';
     $sqlParts['where'][] = 'ph.flags=' . ZBX_FLAG_DISCOVERY_NORMAL;
     if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) {
         $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ;
         $sqlParts['where'][] = 'EXISTS (' . 'SELECT NULL' . ' FROM ' . 'host_discovery hd,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', getUserGroupsByUserId(self::$userData['userid'])) . ' WHERE h.hostid=hd.hostid' . ' AND hd.parent_itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY hgg.hostid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ' AND MAX(r.permission)>=' . zbx_dbstr($permission) . ')';
     }
     // discoveryids
     if ($options['discoveryids'] !== null) {
         $sqlParts['where'][] = dbConditionInt('hd.parent_itemid', (array) $options['discoveryids']);
         if ($options['groupCount'] !== null) {
             $sqlParts['group']['hd'] = 'hd.parent_itemid';
         }
     }
     // inherited
     if ($options['inherited'] !== null) {
         $sqlParts['where'][] = $options['inherited'] ? 'h.templateid IS NOT NULL' : 'h.templateid IS NULL';
     }
     return $sqlParts;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:28,代码来源:CHostPrototype.php

示例7: getRequest

    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    if (hasRequest('filter_set')) {
        CProfile::update('web.sysmapconf.filter_name', getRequest('filter_name', ''), PROFILE_TYPE_STR);
    } elseif (hasRequest('filter_rst')) {
        DBStart();
        CProfile::delete('web.sysmapconf.filter_name');
        DBend();
    }
    $config = select_config();
    $data = ['filter' => ['name' => CProfile::get('web.sysmapconf.filter_name', '')], 'sort' => $sortField, 'sortorder' => $sortOrder];
    // get maps
    $data['maps'] = API::Map()->get(['output' => ['sysmapid', 'name', 'width', 'height'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1, 'search' => ['name' => $data['filter']['name'] === '' ? null : $data['filter']['name']], 'preservekeys' => true]);
    $user_type = CWebUser::getType();
    if ($user_type != USER_TYPE_SUPER_ADMIN && $user_type != USER_TYPE_ZABBIX_ADMIN) {
        $editable_maps = API::Map()->get(['output' => [], 'sysmapids' => array_keys($data['maps']), 'editable' => true, 'preservekeys' => true]);
        foreach ($data['maps'] as &$map) {
            $map['editable'] = array_key_exists($map['sysmapid'], $editable_maps);
        }
        unset($map);
    }
    order_result($data['maps'], $sortField, $sortOrder);
    // paging
    $data['paging'] = getPagingLine($data['maps'], $sortOrder, new CUrl('sysmaps.php'));
    // render view
    $mapView = new CView('monitoring.sysmap.list', $data);
    $mapView->render();
    $mapView->show();
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:sysmaps.php

示例8: applyQueryFilterOptions

 protected function applyQueryFilterOptions($tableName, $tableAlias, array $options, array $sqlParts)
 {
     if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
         // if services with specific trigger IDs were requested, return only the ones accessible to the current user.
         if ($options['filter']['triggerid']) {
             $accessibleTriggers = API::Trigger()->get(array('triggerids' => $options['filter']['triggerid']));
             $options['filter']['triggerid'] = zbx_objectValues($accessibleTriggers, 'triggerid');
         } else {
             $sqlParts = $this->addPermissionFilter($sqlParts);
         }
     }
     $sqlParts = parent::applyQueryFilterOptions($tableName, $tableAlias, $options, $sqlParts);
     // parentids
     if ($options['parentids'] !== null) {
         $sqlParts['from'][] = 'services_links slp';
         $sqlParts['where'][] = $this->fieldId('serviceid') . '=slp.servicedownid AND slp.soft=0';
         $sqlParts['where'][] = dbConditionInt('slp.serviceupid', (array) $options['parentids']);
     }
     // childids
     if ($options['childids'] !== null) {
         $sqlParts['from'][] = 'services_links slc';
         $sqlParts['where'][] = $this->fieldId('serviceid') . '=slc.serviceupid AND slc.soft=0';
         $sqlParts['where'][] = dbConditionInt('slc.servicedownid', (array) $options['childids']);
     }
     return $sqlParts;
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:26,代码来源:CService.php

示例9: dirname

** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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';
require_once dirname(__FILE__) . '/include/triggers.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/js.inc.php';
$page['title'] = _('Media');
$page['file'] = 'popup_media.php';
if (CWebUser::getType() < USER_TYPE_ZABBIX_ADMIN || CWebUser::isGuest() && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
    access_deny(ACCESS_DENY_PAGE);
}
define('ZBX_PAGE_NO_MENU', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = ['dstfrm' => [T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null], 'media' => [T_ZBX_INT, O_OPT, P_SYS, null, null], 'mediatypeid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({add})'], 'sendto' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add})'], 'period' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add})'], 'active' => [T_ZBX_INT, O_OPT, null, IN([MEDIA_STATUS_ACTIVE, MEDIA_STATUS_DISABLED]), null], 'severity' => [T_ZBX_INT, O_OPT, null, NOT_EMPTY, null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null]];
check_fields($fields);
insert_js_function('add_media');
if (isset($_REQUEST['add'])) {
    $validator = new CTimePeriodValidator();
    if ($validator->validate($_REQUEST['period'])) {
        $severity = 0;
        $_REQUEST['severity'] = getRequest('severity', []);
        foreach ($_REQUEST['severity'] as $id) {
            $severity |= 1 << $id;
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:popup_media.php

示例10: get

 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $sortfield = 'clock';
     $sortorder = ZBX_SORT_DOWN;
     $sorttitle = _('Time');
     switch ($this->screenitem['sort_triggers']) {
         case SCREEN_SORT_TRIGGERS_TIME_ASC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Time');
             break;
         case SCREEN_SORT_TRIGGERS_TIME_DESC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Time');
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_ASC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Type');
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_DESC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Type');
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_ASC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Status');
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_DESC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Status');
             break;
         case SCREEN_SORT_TRIGGERS_RETRIES_LEFT_ASC:
             $sortfield = 'retries';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Retries left');
             break;
         case SCREEN_SORT_TRIGGERS_RETRIES_LEFT_DESC:
             $sortfield = 'retries';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Retries left');
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_ASC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Recipient(s)');
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_DESC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Recipient(s)');
             break;
     }
     $sql = 'SELECT a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error' . ' FROM events e,alerts a' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid ' . ' WHERE e.eventid=a.eventid' . ' AND alerttype IN (' . ALERT_TYPE_MESSAGE . ')';
     // editable + PERMISSION CHECK
     if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
         $userid = CWebUser::$data['userid'];
         $userGroups = getUserGroupsByUserId($userid);
         $sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE e.objectid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>=' . PERM_READ_ONLY . ')';
     }
     $sql .= ' AND ' . DBin_node('a.alertid') . ' ' . ' ORDER BY ' . $sortfield . ' ' . $sortorder;
     $alerts = DBfetchArray(DBselect($sql, $this->screenitem['elements']));
     order_result($alerts, $sortfield, $sortorder);
     // indicator of sort field
     $sortfieldSpan = new CSpan(array($sorttitle, SPACE));
     $sortorderSpan = new CSpan(SPACE, $sortorder == ZBX_SORT_DOWN ? 'icon_sortdown default_cursor' : 'icon_sortup default_cursor');
     // create alert table
     $actionTable = new CTableInfo(_('No actions found.'));
     $actionTable->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, $sortfield == 'clock' ? array($sortfieldSpan, $sortorderSpan) : _('Time'), $sortfield == 'description' ? array($sortfieldSpan, $sortorderSpan) : _('Type'), $sortfield == 'status' ? array($sortfieldSpan, $sortorderSpan) : _('Status'), $sortfield == 'retries' ? array($sortfieldSpan, $sortorderSpan) : _('Retries left'), $sortfield == 'sendto' ? array($sortfieldSpan, $sortorderSpan) : _('Recipient(s)'), _('Message'), _('Error')));
     foreach ($alerts as $alert) {
         if ($alert['status'] == ALERT_STATUS_SENT) {
             $status = new CSpan(_('sent'), 'green');
             $retries = new CSpan(SPACE, 'green');
         } elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
             $status = new CSpan(_('In progress'), 'orange');
             $retries = new CSpan(ALERT_MAX_RETRIES - $alert['retries'], 'orange');
         } else {
             $status = new CSpan(_('not sent'), 'red');
             $retries = new CSpan(0, 'red');
         }
         $message = array(bold(_('Subject') . ': '), br(), $alert['subject'], br(), br(), bold(_('Message') . ': '), br(), $alert['message']);
         $error = empty($alert['error']) ? new CSpan(SPACE, 'off') : new CSpan($alert['error'], 'on');
         $actionTable->addRow(array(get_node_name_by_elid($alert['alertid']), new CCol(zbx_date2str(HISTORY_OF_ACTIONS_DATE_FORMAT, $alert['clock']), 'top'), new CCol(!empty($alert['description']) ? $alert['description'] : '-', 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($alert['sendto'], 'top'), new CCol($message, 'top pre'), new CCol($error, 'wraptext top')));
     }
     return $this->getOutput($actionTable);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:95,代码来源:CScreenActions.php

示例11: DBfetchArray

     }
     $db_slideshow['userGroups'] = DBfetchArray(DBselect('SELECT s.usrgrpid,s.permission' . ' FROM slideshow_usrgrp s' . ' WHERE s.slideshowid=' . zbx_dbstr(getRequest('slideshowid'))));
     foreach ($db_slideshow['userGroups'] as $user_group) {
         $user_groupids[$user_group['usrgrpid']] = true;
     }
 }
 $data['users'] = API::User()->get(['output' => ['userid', 'alias', 'name', 'surname'], 'userids' => array_keys($userids), 'preservekeys' => true]);
 $data['user_groups'] = API::UserGroup()->get(['output' => ['usrgrpid', 'name'], 'usrgrpids' => array_keys($user_groupids), 'preservekeys' => true]);
 if (array_key_exists('slideshowid', $db_slideshow) && !isset($_REQUEST['form_refresh'])) {
     $data['slideshow'] = ['slideshowid' => $db_slideshow['slideshowid'], 'name' => $db_slideshow['name'], 'delay' => $db_slideshow['delay'], 'userid' => $db_slideshow['userid'], 'private' => $db_slideshow['private'], 'users' => $db_slideshow['users'], 'userGroups' => $db_slideshow['userGroups']];
     // Get slides.
     $data['slideshow']['slides'] = DBfetchArray(DBselect('SELECT s.slideid, s.screenid, s.delay' . ' FROM slides s' . ' WHERE s.slideshowid=' . zbx_dbstr($db_slideshow['slideshowid']) . ' ORDER BY s.step'));
 } else {
     $data['slideshow'] = ['slideshowid' => getRequest('slideshowid'), 'name' => getRequest('name', ''), 'delay' => getRequest('delay', ZBX_ITEM_DELAY_DEFAULT), 'slides' => getRequest('slides', []), 'private' => getRequest('private', PRIVATE_SHARING), 'users' => getRequest('users', []), 'userGroups' => getRequest('userGroups', [])];
     if (hasRequest('form_refresh')) {
         if (CWebUser::getType() == USER_TYPE_SUPER_ADMIN || CWebUser::getType() == USER_TYPE_ZABBIX_ADMIN) {
             $data['slideshow']['userid'] = getRequest('userid', '');
         } else {
             $data['slideshow']['userid'] = getRequest('userid');
         }
     } else {
         if ($db_slideshow) {
             $data['slideshow']['userid'] = $db_slideshow['userid'];
         } else {
             $data['slideshow']['userid'] = $current_userid;
         }
     }
 }
 $screenids = [];
 foreach ($data['slideshow']['slides'] as $slides) {
     $screenids[] = $slides['screenid'];
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:slideconf.php

示例12: CView

    $warningView = new CView('general.warning', array('message' => 'Configuration file error: ' . $e->getMessage()));
    $warningView->render();
    exit;
}
require_once dirname(__FILE__) . '/include/setup.inc.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('type' => array(T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null), 'server' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database host')), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Database port')), 'database' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')), 'user' => array(T_ZBX_STR, O_OPT, null, null, null), 'password' => array(T_ZBX_STR, O_OPT, null, null, null), 'schema' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_name' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'message' => array(T_ZBX_STR, O_OPT, null, null, null), 'save_config' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'finish' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'next' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'back' => 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_INT, O_OPT, null, null, null));
// config
$ZBX_CONFIG = get_cookie('ZBX_CONFIG', null);
$ZBX_CONFIG = isset($ZBX_CONFIG) ? unserialize($ZBX_CONFIG) : array();
$ZBX_CONFIG['check_fields_result'] = check_fields($fields, false);
if (!isset($ZBX_CONFIG['step'])) {
    $ZBX_CONFIG['step'] = 0;
}
// if a guest or a non-super admin user is logged in
if (CWebUser::$data && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
    // on the last step of the setup we always have a guest user logged in;
    // when he presses the "Finish" button he must be redirected to the login screen
    if (CWebUser::isGuest() && $ZBX_CONFIG['step'] == 5 && hasRequest('finish')) {
        zbx_unsetcookie('ZBX_CONFIG');
        redirect('index.php');
    } elseif (!(CWebUser::isGuest() && $ZBX_CONFIG['step'] == 5)) {
        access_deny(ACCESS_DENY_PAGE);
    }
} elseif (hasRequest('cancel') || hasRequest('finish')) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
}
/*
 * Setup wizard
 */
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:setup.php

示例13: get

 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $sortfield = 'clock';
     $sortorder = ZBX_SORT_DOWN;
     switch ($this->screenitem['sort_triggers']) {
         case SCREEN_SORT_TRIGGERS_TIME_ASC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_UP;
             break;
         case SCREEN_SORT_TRIGGERS_TIME_DESC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_DOWN;
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_ASC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_UP;
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_DESC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_DOWN;
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_ASC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_UP;
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_DESC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_DOWN;
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_ASC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_UP;
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_DESC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_DOWN;
             break;
     }
     $sql = 'SELECT a.alertid,a.clock,a.sendto,a.subject,a.message,a.status,a.retries,a.error,' . 'a.userid,a.actionid,a.mediatypeid,mt.description' . ' FROM events e,alerts a' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE e.eventid=a.eventid' . ' AND alerttype=' . ALERT_TYPE_MESSAGE;
     if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
         $userid = CWebUser::$data['userid'];
         $userGroups = getUserGroupsByUserId($userid);
         $sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE e.objectid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ')';
     }
     $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
     $alerts = DBfetchArray(DBselect($sql, $this->screenitem['elements']));
     order_result($alerts, $sortfield, $sortorder);
     $userids = [];
     foreach ($alerts as $alert) {
         if ($alert['userid'] != 0) {
             $userids[$alert['userid']] = true;
         }
     }
     if ($userids) {
         $dbUsers = API::User()->get(['output' => ['userid', 'alias', 'name', 'surname'], 'userids' => array_keys($userids), 'preservekeys' => true]);
     }
     // indicator of sort field
     $sort_div = (new CSpan())->addClass($sortorder === ZBX_SORT_DOWN ? ZBX_STYLE_ARROW_DOWN : ZBX_STYLE_ARROW_UP);
     // create alert table
     $table = (new CTableInfo())->setHeader([$sortfield === 'clock' ? ['Time', $sort_div] : _('Time'), _('Action'), $sortfield === 'description' ? [_('Type'), $sort_div] : _('Type'), $sortfield === 'sendto' ? [_('Recipient(s)'), $sort_div] : _('Recipient(s)'), _('Message'), $sortfield === 'status' ? [_('Status'), $sort_div] : _('Status'), _('Info')]);
     $actions = API::Action()->get(['output' => ['actionid', 'name'], 'actionids' => array_unique(zbx_objectValues($alerts, 'actionid')), 'preservekeys' => true]);
     foreach ($alerts as $alert) {
         if ($alert['status'] == ALERT_STATUS_SENT) {
             $status = (new CSpan(_('Sent')))->addClass(ZBX_STYLE_GREEN);
         } elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
             $status = (new CSpan([_('In progress') . ':', BR(), _n('%1$s retry left', '%1$s retries left', ALERT_MAX_RETRIES - $alert['retries'])]))->addClass(ZBX_STYLE_YELLOW);
         } else {
             $status = (new CSpan(_('Not sent')))->addClass(ZBX_STYLE_RED);
         }
         $recipient = $alert['userid'] != 0 ? [bold(getUserFullname($dbUsers[$alert['userid']])), BR(), $alert['sendto']] : $alert['sendto'];
         $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']), $actions[$alert['actionid']]['name'], $alert['mediatypeid'] == 0 ? '' : $alert['description'], $recipient, [bold($alert['subject']), BR(), BR(), zbx_nl2br($alert['message'])], $status, $alert['error'] === '' ? '' : makeErrorIcon($alert['error'])]);
     }
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader(_('Action log')));
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:80,代码来源:CScreenActions.php

示例14: bodyToString

 function bodyToString($destroy = true)
 {
     $left = new CDiv(null, 'left');
     $left->addItem(new CDiv($this->getList(), 'left_menu'));
     $link1 = new CLink('www.zabbix.com', 'http://www.zabbix.com/', null, null, true);
     $link1->setAttribute('target', '_blank');
     $link2 = new CLink('GPL v2', 'http://www.zabbix.com/license.php', null, null, true);
     $link2->setAttribute('target', '_blank');
     $licence = new CDiv(array($link1, BR(), ' Licensed under ', $link2), 'setup_wizard_licence');
     $left->addItem($licence);
     $right = new CDiv(null, 'right');
     if ($this->getStep() == 0) {
         $right->addItem(new CDiv(null, 'blank_title'));
         $right->addItem(new CDiv($this->getState(), 'blank_under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard setup_wizard_welcome');
     } else {
         $right->addItem(new CDiv($this->stage[$this->getStep()]['title'], 'setup_title'));
         $right->addItem(new CDiv($this->getState(), 'under_title'));
         $container = new CDiv(array($left, $right), 'setup_wizard');
     }
     if (isset($this->stage[$this->getStep() + 1])) {
         $next = new CSubmit('next[' . $this->getStep() . ']', _('Next') . SPACE . '&raquo;');
     } else {
         $next = new CSubmit('finish', _('Finish'));
     }
     if (isset($this->HIDE_CANCEL_BUTTON) && $this->HIDE_CANCEL_BUTTON) {
         $cancel = null;
     } else {
         $cancel = new CDiv(new CSubmit('cancel', _('Cancel')), 'footer_left');
     }
     if ($this->DISABLE_NEXT_BUTTON) {
         $next->setEnabled(false);
     }
     // if the user is not logged in (first setup run) hide the "previous" button on the final step
     if ($this->getStep() && (CWebUser::$data && CWebUser::getType() == USER_TYPE_SUPER_ADMIN || $this->getStep() < 5)) {
         $back = new CSubmit('back[' . $this->getStep() . ']', '&laquo;' . SPACE . _('Previous'));
     } else {
         $back = null;
     }
     $footer = new CDiv(array($cancel, new CDiv(array($back, $next), 'footer_right')), 'footer');
     $container->addItem($footer);
     return parent::bodyToString($destroy) . $container->ToString();
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:43,代码来源:setup.inc.php

示例15: get

 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $sortfield = 'clock';
     $sortorder = ZBX_SORT_DOWN;
     $sorttitle = _('Time');
     switch ($this->screenitem['sort_triggers']) {
         case SCREEN_SORT_TRIGGERS_TIME_ASC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Time');
             break;
         case SCREEN_SORT_TRIGGERS_TIME_DESC:
             $sortfield = 'clock';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Time');
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_ASC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Type');
             break;
         case SCREEN_SORT_TRIGGERS_TYPE_DESC:
             $sortfield = 'description';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Type');
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_ASC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Status');
             break;
         case SCREEN_SORT_TRIGGERS_STATUS_DESC:
             $sortfield = 'status';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Status');
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_ASC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_UP;
             $sorttitle = _('Recipient(s)');
             break;
         case SCREEN_SORT_TRIGGERS_RECIPIENT_DESC:
             $sortfield = 'sendto';
             $sortorder = ZBX_SORT_DOWN;
             $sorttitle = _('Recipient(s)');
             break;
     }
     $sql = 'SELECT a.alertid,a.clock,a.sendto,a.subject,a.message,a.status,a.retries,a.error,' . 'a.userid,a.actionid,a.mediatypeid,mt.description' . ' FROM events e,alerts a' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE e.eventid=a.eventid' . ' AND alerttype=' . ALERT_TYPE_MESSAGE;
     if (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) {
         $userid = CWebUser::$data['userid'];
         $userGroups = getUserGroupsByUserId($userid);
         $sql .= ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE e.objectid=f.triggerid' . ' AND f.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY f.triggerid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ')';
     }
     $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
     $alerts = DBfetchArray(DBselect($sql, $this->screenitem['elements']));
     order_result($alerts, $sortfield, $sortorder);
     if ($alerts) {
         $dbUsers = API::User()->get(array('output' => array('userid', 'alias', 'name', 'surname'), 'userids' => zbx_objectValues($alerts, 'userid'), 'preservekeys' => true));
     }
     // indicator of sort field
     $sortfieldSpan = new CSpan(array($sorttitle, SPACE));
     $sortorderSpan = new CSpan(SPACE, $sortorder === ZBX_SORT_DOWN ? 'icon_sortdown default_cursor' : 'icon_sortup default_cursor');
     // create alert table
     $actionTable = new CTableInfo(_('No action log entries found.'));
     $actionTable->setHeader(array($sortfield === 'clock' ? array($sortfieldSpan, $sortorderSpan) : _('Time'), _('Action'), $sortfield === 'description' ? array($sortfieldSpan, $sortorderSpan) : _('Type'), $sortfield === 'sendto' ? array($sortfieldSpan, $sortorderSpan) : _('Recipient(s)'), _('Message'), $sortfield === 'status' ? array($sortfieldSpan, $sortorderSpan) : _('Status'), _('Info')));
     $actions = API::Action()->get(array('output' => array('actionid', 'name'), 'actionids' => array_unique(zbx_objectValues($alerts, 'actionid')), 'preservekeys' => true));
     foreach ($alerts as $alert) {
         if ($alert['status'] == ALERT_STATUS_SENT) {
             $status = new CSpan(_('Sent'), 'green');
         } elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
             $status = new CSpan(array(_('In progress') . ':', BR(), _n('%1$s retry left', '%1$s retries left', ALERT_MAX_RETRIES - $alert['retries'])), 'orange');
         } else {
             $status = new CSpan(_('Not sent'), 'red');
         }
         $recipient = $alert['userid'] ? array(bold(getUserFullname($dbUsers[$alert['userid']])), BR(), $alert['sendto']) : $alert['sendto'];
         $message = array(bold(_('Subject') . ':'), br(), $alert['subject'], br(), br(), bold(_('Message') . ':'), br(), $alert['message']);
         if (zbx_empty($alert['error'])) {
             $info = '';
         } else {
             $info = new CDiv(SPACE, 'status_icon iconerror');
             $info->setHint($alert['error'], 'on');
         }
         $actionTable->addRow(array(new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']), 'top'), new CCol($actions[$alert['actionid']]['name'], 'top'), new CCol($alert['mediatypeid'] == 0 ? '-' : $alert['description'], 'top'), new CCol($recipient, 'top'), new CCol($message, 'top pre'), new CCol($status, 'top'), new CCol($info, 'wraptext top')));
     }
     return $this->getOutput($actionTable);
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:91,代码来源:CScreenActions.php


注:本文中的CWebUser::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。