本文整理汇总了PHP中access_deny函数的典型用法代码示例。如果您正苦于以下问题:PHP access_deny函数的具体用法?PHP access_deny怎么用?PHP access_deny使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了access_deny函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_user_history
$table->setClass('history');
$table->setCellSpacing(0);
$table->setCellPadding(0);
$history = get_user_history();
$tr = new CRow(new CCol('History:', 'caption'));
$tr->addItem($history);
$table->addRow($tr);
$table->Show();
} else {
if ($page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
echo SBR;
}
}
//------------------------------------ </HISTORY> ---------------------------------------
unset($ZBX_MENU);
unset($table, $top_page_row, $menu_table, $node_form);
unset($main_menu_row);
unset($db_nodes, $node_data);
unset($sub_menu_table, $sub_menu_rows);
if ($denyed_page_requested) {
access_deny();
}
if (version_compare(phpversion(), '5.1.0RC1', '>=') && $page['type'] == PAGE_TYPE_HTML) {
$tmezone = ini_get('date.timezone');
if (empty($tmezone)) {
info('Timezone for PHP is not set. Please set "date.timezone" option in php.ini.');
date_default_timezone_set('UTC');
}
unset($tmezone);
}
show_messages();
示例2: __construct
/**
* Init screen data.
*
* @param array $options
* @param boolean $options['isFlickerfree']
* @param string $options['pageFile']
* @param int $options['mode']
* @param int $options['timestamp']
* @param int $options['hostid']
* @param int $options['period']
* @param int $options['stime']
* @param string $options['profileIdx']
* @param int $options['profileIdx2']
* @param boolean $options['updateProfile']
* @param array $options['screen']
*/
public function __construct(array $options = array())
{
$this->isFlickerfree = isset($options['isFlickerfree']) ? $options['isFlickerfree'] : true;
$this->mode = isset($options['mode']) ? $options['mode'] : SCREEN_MODE_SLIDESHOW;
$this->timestamp = !empty($options['timestamp']) ? $options['timestamp'] : time();
$this->hostid = !empty($options['hostid']) ? $options['hostid'] : null;
// get page file
if (!empty($options['pageFile'])) {
$this->pageFile = $options['pageFile'];
} else {
global $page;
$this->pageFile = $page['file'];
}
// get screen
if (!empty($options['screen'])) {
$this->screen = $options['screen'];
} elseif (!empty($options['screenid'])) {
$this->screen = API::Screen()->get(array('screenids' => $options['screenid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND, 'editable' => $this->mode == SCREEN_MODE_EDIT));
if (!empty($this->screen)) {
$this->screen = reset($this->screen);
} else {
access_deny();
}
}
// calculate time
$this->profileIdx = !empty($options['profileIdx']) ? $options['profileIdx'] : '';
$this->profileIdx2 = !empty($options['profileIdx2']) ? $options['profileIdx2'] : null;
$this->updateProfile = isset($options['updateProfile']) ? $options['updateProfile'] : true;
$this->timeline = CScreenBase::calculateTime(array('profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'period' => !empty($options['period']) ? $options['period'] : null, 'stime' => !empty($options['stime']) ? $options['stime'] : null));
}
示例3: update_user_profile
function update_user_profile($userid, $passwd, $url, $autologin, $autologout, $lang, $theme, $refresh, $user_medias)
{
global $USER_DETAILS;
if (bccomp($userid, $USER_DETAILS["userid"]) != 0) {
access_deny();
}
DBbegin();
$result = DBexecute('update users set ' . ' url=' . zbx_dbstr($url) . ' ,autologin=' . $autologin . ' ,autologout=' . $autologout . ' ,lang=' . zbx_dbstr($lang) . ' ,theme=' . zbx_dbstr($theme) . (isset($passwd) ? ' ,passwd=' . zbx_dbstr(md5($passwd)) : '') . ' ,refresh=' . $refresh . ' where userid=' . $userid);
$result = DBexecute('delete from media where userid=' . $userid);
foreach ($user_medias as $mediaid => $media_data) {
$mediaid = get_dbid("media", "mediaid");
$result = DBexecute('insert into media (mediaid,userid,mediatypeid,sendto,active,severity,period)' . ' values (' . $mediaid . ',' . $userid . ',' . $media_data['mediatypeid'] . ',' . zbx_dbstr($media_data['sendto']) . ',' . $media_data['active'] . ',' . $media_data['severity'] . ',' . zbx_dbstr($media_data['period']) . ')');
if (!$result) {
break;
}
}
}
示例4: elseif
} elseif (!empty($ZBX_NODES)) {
$pageTitle .= ' (' . $ZBX_NODES[$ZBX_CURRENT_NODEID]['name'] . ')';
}
}
if ((defined('ZBX_PAGE_DO_REFRESH') || defined('ZBX_PAGE_DO_JS_REFRESH')) && CWebUser::$data['refresh']) {
$pageTitle .= ' [' . _s('refreshed every %1$s sec.', CWebUser::$data['refresh']) . ']';
}
break;
}
// construct menu
$main_menu = array();
$sub_menus = array();
$denied_page_requested = zbx_construct_menu($main_menu, $sub_menus, $page);
// render the "Deny access" page
if ($denied_page_requested) {
access_deny(ACCESS_DENY_PAGE);
}
if ($page['type'] == PAGE_TYPE_HTML) {
$pageHeader = new CPageHeader($pageTitle);
$pageHeader->addCssInit();
$css = ZBX_DEFAULT_THEME;
if (!ZBX_PAGE_NO_THEME) {
if (!empty($DB['DB'])) {
$config = select_config();
$css = getUserTheme(CWebUser::$data);
$severityCss = <<<CSS
.disaster { background: #{$config['severity_color_5']} !important; }
.high { background: #{$config['severity_color_4']} !important; }
.average { background: #{$config['severity_color_3']} !important; }
.warning { background: #{$config['severity_color_2']} !important; }
.information { background: #{$config['severity_color_1']} !important; }
示例5: update_user_profile
function update_user_profile($userid, $passwd, $url, $autologin, $autologout, $lang, $theme, $refresh)
{
global $USER_DETAILS;
if (bccomp($userid, $USER_DETAILS["userid"]) != 0) {
access_deny();
}
return DBexecute('update users set ' . ' url=' . zbx_dbstr($url) . ' ,autologin=' . $autologin . ' ,autologout=' . $autologout . ' ,lang=' . zbx_dbstr($lang) . ' ,theme=' . zbx_dbstr($theme) . (isset($passwd) ? ' ,passwd=' . zbx_dbstr(md5($passwd)) : '') . ' ,refresh=' . $refresh . ' where userid=' . $userid);
}
示例6: get_screen
function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
global $USER_DETAILS;
if ($screenid == 0) {
return new CTableInfo(S_NO_SCREENS_DEFINED);
}
$r = CScreen::get(array('screenids' => $screenid, 'editable' => $editmode == 1 ? 1 : null, 'output' => API_OUTPUT_SHORTEN));
if (empty($r)) {
access_deny();
}
if (is_null($effectiveperiod)) {
$effectiveperiod = ZBX_MIN_PERIOD;
}
$result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
$row = DBfetch($result);
if (!$row) {
return new CTableInfo(S_NO_SCREENS_DEFINED);
}
$sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid;
$iresult = DBSelect($sql);
$skip_field = array();
$irows = array();
while ($irow = DBfetch($iresult)) {
$irows[] = $irow;
for ($i = 0; $i < $irow['rowspan'] || $i == 0; $i++) {
for ($j = 0; $j < $irow['colspan'] || $j == 0; $j++) {
if ($i != 0 || $j != 0) {
if (!isset($skip_field[$irow['y'] + $i])) {
$skip_field[$irow['y'] + $i] = array();
}
$skip_field[$irow['y'] + $i][$irow['x'] + $j] = 1;
}
}
}
}
$table = new CTable(new CLink(S_NO_ROWS_IN_SCREEN . SPACE . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
$table->setAttribute('id', 'iframe');
if ($editmode == 1) {
$new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
for ($c = 0; $c < $row['hsize'] + 1; $c++) {
$add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
$add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_col={$c}';");
array_push($new_cols, new Ccol($add_icon));
}
$table->addRow($new_cols);
}
$empty_screen_col = array();
for ($r = 0; $r < $row['vsize']; $r++) {
$new_cols = array();
$empty_screen_row = true;
if ($editmode == 1) {
$add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
$add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_row={$r}';");
array_push($new_cols, new Ccol($add_icon));
}
for ($c = 0; $c < $row['hsize']; $c++) {
$item = array();
if (isset($skip_field[$r][$c])) {
continue;
}
$item_form = false;
$irow = false;
foreach ($irows as $tmprow) {
if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
$irow = $tmprow;
break;
}
}
if ($irow) {
$screenitemid = $irow['screenitemid'];
$resourcetype = $irow['resourcetype'];
$resourceid = $irow['resourceid'];
$width = $irow['width'];
$height = $irow['height'];
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
$elements = $irow['elements'];
$valign = $irow['valign'];
$halign = $irow['halign'];
$style = $irow['style'];
$url = $irow['url'];
$dynamic = $irow['dynamic'];
} else {
$screenitemid = 0;
$resourcetype = 0;
$resourceid = 0;
$width = 0;
$height = 0;
$colspan = 0;
$rowspan = 0;
$elements = 0;
$valign = VALIGN_DEFAULT;
$halign = HALIGN_DEFAULT;
$style = 0;
$url = '';
$dynamic = 0;
}
if ($screenitemid > 0) {
$empty_screen_row = false;
$empty_screen_col[$c] = 1;
//.........这里部分代码省略.........
示例7: createGraph
function createGraph($itemids, $name, $width, $height, $graphtype, $func, $drawtype, $yaxisside)
{
if (!$name) {
error(_s('Warning. Incorrect value for field "%1$s"', '[name]'));
return false;
}
if (!$graphtype) {
$graphtype = 0;
}
if (!$width) {
$width = 900;
}
if (!$height) {
$height = 200;
}
// Check permissions
if (!empty($itemids)) {
$options = array('nodeids' => get_current_nodeid(true), 'itemids' => $itemids, 'filter' => array('flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)), 'webitems' => 1, 'editable' => 1, 'output' => API_OUTPUT_EXTEND);
$items = API::Item()->get($options);
$items = zbx_toHash($items, 'itemid');
foreach ($itemids as $inum => $itemid) {
if (!isset($items[$itemid])) {
access_deny();
}
}
}
if (empty($items)) {
info(_('Items required for graph'));
return false;
} else {
$gitems = array();
$num = 0;
foreach ($items as $inum => $item) {
if ($item['value_type'] != ITEM_VALUE_TYPE_UINT64 && $item['value_type'] != ITEM_VALUE_TYPE_FLOAT) {
info(_s('Cannot create graph for non-numeric item, skipping "%1$s"', $item['name']));
continue;
}
$gitem['itemid'] = $item['itemid'];
$gitem['drawtype'] = $drawtype;
$gitem['sortorder'] = $num;
$gitem['color'] = getColor($num);
$gitem['yaxisside'] = $yaxisside;
$gitem['calc_fnc'] = $func;
$gitem['type'] = 0;
$gitems[] = $gitem;
$num++;
}
$graph = array('name' => $name, 'width' => $width, 'height' => $height, 'ymin_type' => 0, 'ymax_type' => 0, 'yaxismin' => 0, 'yaxismax' => 0, 'ymin_itemid' => 0, 'ymax_itemid' => 0, 'show_work_period' => 1, 'show_triggers' => 1, 'graphtype' => $graphtype, 'show_legend' => 1, 'show_3d' => 0, 'percent_left' => 0, 'percent_right' => 0, 'gitems' => $gitems);
$result = API::Graph()->create($graph);
if ($result) {
info(_('Graph added'));
add_audit(AUDIT_ACTION_ADD, AUDIT_RESOURCE_GRAPH, 'Graph [' . $name . ']');
} else {
info(_('Cannot add graph'));
}
}
return $result;
}
示例8: get_screen
function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
global $USER_DETAILS;
if ($screenid == 0) {
return new CTableInfo(S_NO_SCREENS_DEFINED);
}
if (!screen_accessible($screenid, $editmode == 1 ? PERM_READ_WRITE : PERM_READ_ONLY)) {
access_deny();
}
if (is_null($effectiveperiod)) {
$effectiveperiod = ZBX_MIN_PERIOD;
}
$result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
$row = DBfetch($result);
if (!$row) {
return new CTableInfo(S_NO_SCREENS_DEFINED);
}
for ($r = 0; $r < $row['vsize']; $r++) {
for ($c = 0; $c < $row['hsize']; $c++) {
if (isset($skip_field[$r][$c])) {
continue;
}
$sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r;
$iresult = DBSelect($sql);
$irow = DBfetch($iresult);
if ($irow) {
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
} else {
$colspan = 0;
$rowspan = 0;
}
for ($i = 0; $i < $rowspan || $i == 0; $i++) {
for ($j = 0; $j < $colspan || $j == 0; $j++) {
if ($i != 0 || $j != 0) {
$skip_field[$r + $i][$c + $j] = 1;
}
}
}
}
}
$table = new CTable(new CLink('No rows in screen ' . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
$table->setAttribute('id', 'iframe');
if ($editmode == 1) {
$add_col_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_col=';
$new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
for ($c = 0; $c < $row['hsize'] + 1; $c++) {
array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_col_link . $c)));
}
$table->addRow($new_cols);
}
$empty_screen_col = array();
for ($r = 0; $r < $row['vsize']; $r++) {
$new_cols = array();
$empty_screen_row = true;
if ($editmode == 1) {
$add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row=';
array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $r)));
}
for ($c = 0; $c < $row['hsize']; $c++) {
$item = array();
if (isset($skip_field[$r][$c])) {
continue;
}
$item_form = false;
$iresult = DBSelect('SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r);
$irow = DBfetch($iresult);
if ($irow) {
$screenitemid = $irow['screenitemid'];
$resourcetype = $irow['resourcetype'];
$resourceid = $irow['resourceid'];
$width = $irow['width'];
$height = $irow['height'];
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
$elements = $irow['elements'];
$valign = $irow['valign'];
$halign = $irow['halign'];
$style = $irow['style'];
$url = $irow['url'];
$dynamic = $irow['dynamic'];
} else {
$screenitemid = 0;
$resourcetype = 0;
$resourceid = 0;
$width = 0;
$height = 0;
$colspan = 0;
$rowspan = 0;
$elements = 0;
$valign = VALIGN_DEFAULT;
$halign = HALIGN_DEFAULT;
$style = 0;
$url = '';
$dynamic = 0;
}
if ($screenitemid > 0) {
$empty_screen_row = false;
$empty_screen_col[$c] = 1;
}
//.........这里部分代码省略.........
示例9: checkAccessHost
function checkAccessHost($p_hostid)
{
if (get_request($p_hostid) && !API::Host()->isReadable(array($_REQUEST[$p_hostid]))) {
access_deny();
} else {
$hostids = array($_REQUEST[$p_hostid]);
if ($hostids[0] == 0) {
$hostids = array();
}
}
return $hostids;
}
示例10: run
/**
* Main controller processing routine. Returns response object: data, redirect or fatal redirect.
*
* @return var
*/
public final function run()
{
if ($this->validateSID && !$this->checkSID()) {
access_deny(ACCESS_DENY_PAGE);
}
if ($this->checkInput()) {
if ($this->checkPermissions() !== true) {
access_deny(ACCESS_DENY_PAGE);
}
$this->doAction();
}
if (CProfile::isModified()) {
DBstart();
$result = CProfile::flush();
DBend($result);
}
return $this->getResponse();
}