本文整理匯總了PHP中DBend函數的典型用法代碼示例。如果您正苦於以下問題:PHP DBend函數的具體用法?PHP DBend怎麽用?PHP DBend使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DBend函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doAction
protected function doAction()
{
$script = [];
$this->getInputs($script, ['scriptid', 'name', 'type', 'execute_on', 'command', 'description', 'usrgrpid', 'groupid', 'host_access']);
$script['confirmation'] = $this->getInput('confirmation', '');
if ($this->getInput('type', ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) == ZBX_SCRIPT_TYPE_IPMI && $this->hasInput('commandipmi')) {
$script['command'] = $this->getInput('commandipmi');
}
if ($this->getInput('hgstype', 1) == 0) {
$script['groupid'] = 0;
}
DBstart();
$result = API::Script()->update($script);
if ($result) {
$scriptId = reset($result['scriptids']);
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCRIPT, 'Name [' . $this->getInput('name', '') . '] id [' . $scriptId . ']');
}
$result = DBend($result);
if ($result) {
$response = new CControllerResponseRedirect('zabbix.php?action=script.list&uncheck=1');
$response->setMessageOk(_('Script updated'));
} else {
$response = new CControllerResponseRedirect('zabbix.php?action=script.edit&scriptid=' . $this->getInput('scriptid'));
$response->setFormData($this->getInputAll());
$response->setMessageError(_('Cannot update script'));
}
$this->setResponse($response);
}
示例2: transactionEnd
private static function transactionEnd($result)
{
if (self::$transactionStarted) {
self::$transactionStarted = false;
DBend($result);
}
}
示例3: doAction
protected function doAction()
{
$proxy = [];
$this->getInputs($proxy, ['host', 'status', 'description', 'tls_connect', 'tls_accept', 'tls_issuer', 'tls_subject', 'tls_psk_identity', 'tls_psk']);
if ($this->getInput('status', HOST_STATUS_PROXY_ACTIVE) == HOST_STATUS_PROXY_PASSIVE) {
$proxy['interface'] = [];
$this->getInputs($proxy['interface'], ['dns', 'ip', 'useip', 'port']);
}
DBstart();
if ($this->hasInput('proxy_hostids')) {
// skip discovered hosts
$proxy['hosts'] = API::Host()->get(['output' => ['hostid'], 'hostids' => $this->getInput('proxy_hostids'), 'filter' => ['flags' => ZBX_FLAG_DISCOVERY_NORMAL]]);
}
$result = API::Proxy()->create([$proxy]);
if ($result) {
add_audit(AUDIT_ACTION_ADD, AUDIT_RESOURCE_PROXY, '[' . $this->getInput('host', '') . '] [' . reset($result['proxyids']) . ']');
}
$result = DBend($result);
if ($result) {
$response = new CControllerResponseRedirect('zabbix.php?action=proxy.list&uncheck=1');
$response->setMessageOk(_('Proxy added'));
} else {
$response = new CControllerResponseRedirect('zabbix.php?action=proxy.edit');
$response->setFormData($this->getInputAll());
$response->setMessageError(_('Cannot add proxy'));
}
$this->setResponse($response);
}
示例4: flush
public static function flush()
{
// if not initialised, no changes were made
if (is_null(self::$profiles)) {
return true;
}
if (self::$userDetails['userid'] <= 0) {
return null;
}
if (!empty(self::$insert) || !empty(self::$update)) {
DBstart();
foreach (self::$insert as $idx => $profile) {
foreach ($profile as $idx2 => $data) {
self::insertDB($idx, $data['value'], $data['type'], $idx2);
}
}
ksort(self::$update);
foreach (self::$update as $idx => $profile) {
ksort($profile);
foreach ($profile as $idx2 => $data) {
self::updateDB($idx, $data['value'], $data['type'], $idx2);
}
}
DBend();
}
}
示例5: endAPITransactions
protected static function endAPITransactions($result)
{
if (self::$transaction['counter'] > 0 && self::$transaction['owner'] != 'DB_CLASS') {
unset(self::$transaction['owner']);
self::$transaction['counter'] = 0;
$result = DBend($result);
}
}
示例6: update_node_profile
function update_node_profile($nodeids)
{
DBstart();
DBexecute('DELETE FROM profiles WHERE userid=' . CWebUser::$data['userid'] . ' AND idx=' . zbx_dbstr('web.nodes.selected'));
foreach ($nodeids as $nodeid) {
DBexecute('INSERT INTO profiles (profileid,userid,idx,value_id,type)' . ' VALUES (' . get_dbid('profiles', 'profileid') . ',' . CWebUser::$data['userid'] . ',' . zbx_dbstr('web.nodes.selected') . ',' . $nodeid . ',4)');
}
DBend();
}
示例7: update_node_profile
function update_node_profile($nodeids)
{
global $USER_DETAILS;
DBstart();
$sql = 'DELETE FROM profiles WHERE userid=' . $USER_DETAILS['userid'] . ' AND idx=' . zbx_dbstr('web.nodes.selected');
DBexecute($sql);
foreach ($nodeids as $nodeid) {
$profileid = get_dbid('profiles', 'profileid');
$sql = 'INSERT INTO profiles (profileid, userid, idx, value_id, type)' . ' VALUES (' . $profileid . ',' . $USER_DETAILS['userid'] . ', ' . zbx_dbstr('web.nodes.selected') . ',' . $nodeid . ', 4)';
DBexecute($sql);
}
DBend();
}
示例8: add
/**
* Adds favorite value to DB.
*
* @param string $idx identifier of favorite value group
* @param int $favid value id
* @param string $favobj source object
*
* @return bool did SQL INSERT succeeded
*/
public static function add($idx, $favid, $favobj = null)
{
if (self::exists($idx, $favid, $favobj)) {
return true;
}
// add to cache only if cache is created
if (isset(self::$cache[$idx])) {
self::$cache[$idx][] = array('value' => $favid, 'source' => $favobj);
}
DBstart();
$values = array('profileid' => get_dbid('profiles', 'profileid'), 'userid' => CWebUser::$data['userid'], 'idx' => zbx_dbstr($idx), 'value_id' => zbx_dbstr($favid), 'type' => PROFILE_TYPE_ID);
if (!is_null($favobj)) {
$values['source'] = zbx_dbstr($favobj);
}
return DBend(DBexecute('INSERT INTO profiles (' . implode(', ', array_keys($values)) . ') VALUES (' . implode(', ', $values) . ')'));
}
示例9: doAction
protected function doAction()
{
$profile = ['graphid' => 'web.favorite.graphids', 'itemid' => 'web.favorite.graphids', 'screenid' => 'web.favorite.screenids', 'slideshowid' => 'web.favorite.screenids', 'sysmapid' => 'web.favorite.sysmapids'];
$object = $this->getInput('object');
$objectid = $this->getInput('objectid');
$data = [];
DBstart();
$result = CFavorite::remove($profile[$object], $objectid, $object);
$result = DBend($result);
if ($result) {
$data['main_block'] = '$("addrm_fav").title = "' . _('Add to favourites') . '";' . "\n" . '$("addrm_fav").onclick = function() { add2favorites("' . $object . '", "' . $objectid . '"); }' . "\n" . 'switchElementClass("addrm_fav", "btn-remove-fav", "btn-add-fav");';
} else {
$data['main_block'] = '';
}
$this->setResponse(new CControllerResponseData($data));
}
示例10: flush
public static function flush()
{
if (!empty(self::$insert) || !empty(self::$update)) {
DBstart();
foreach (self::$insert as $idx => $profile) {
foreach ($profile as $idx2 => $data) {
$result = self::insertDB($idx, $data['value'], $data['type'], $idx2);
}
}
ksort(self::$update);
foreach (self::$update as $idx => $profile) {
ksort($profile);
foreach ($profile as $idx2 => $data) {
self::updateDB($idx, $data['value'], $data['type'], $idx2);
}
}
DBend();
}
}
示例11: doAction
protected function doAction()
{
$scriptids = $this->getInput('scriptids');
DBstart();
$result = API::Script()->delete($scriptids);
if ($result) {
foreach ($scriptids as $scriptid) {
add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCRIPT, _('Script') . ' [' . $scriptid . ']');
}
}
$result = DBend($result);
$deleted = count($scriptids);
$response = new CControllerResponseRedirect('zabbix.php?action=script.list&uncheck=1');
if ($result) {
$response->setMessageOk(_n('Script deleted', 'Scripts deleted', $deleted));
} else {
$response->setMessageError(_n('Cannot delete script', 'Cannot delete scripts', $deleted));
}
$this->setResponse($response);
}
示例12: Exception
if (!$newMacrosIds) {
throw new Exception(_('Cannot add macro.'));
}
$newMacrosCreated = API::UserMacro()->get(array('globalmacroids' => $newMacrosIds['globalmacroids'], 'globalmacro' => 1, 'output' => API_OUTPUT_EXTEND));
foreach ($newMacrosCreated as $macro) {
add_audit_ext(AUDIT_ACTION_ADD, AUDIT_RESOURCE_MACRO, $macro['globalmacroid'], $macro['macro'] . SPACE . RARR . SPACE . $macro['value'], null, null, null);
}
}
// reload macros after updating to properly display them in the form
$_REQUEST['macros'] = API::UserMacro()->get(array('globalmacro' => true, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true));
$result = true;
DBend(true);
show_message(_('Macros updated'));
} catch (Exception $e) {
$result = false;
DBend(false);
error($e->getMessage());
show_error_message(_('Cannot update macros'));
}
}
/*
* Display
*/
$form = new CForm();
$form->cleanItems();
$cmbConf = new CComboBox('configDropDown', 'adm.macros.php', 'redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$form->addItem($cmbConf);
$cnf_wdgt = new CWidget();
$cnf_wdgt->addPageHeader(_('CONFIGURATION OF MACROS'), $form);
$data = array();
示例13: delete
/**
* Delete Users
*
* @static
* @param array $userids
* @return boolean
*/
public static function delete($userids)
{
$result = false;
DBstart(false);
foreach ($userids as $userid) {
$result = delete_user($userid);
if (!$resukt) {
break;
}
}
DBend($result);
if ($result) {
return true;
} else {
self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => 'Internal zabbix error');
return false;
}
}
示例14: add_audit
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ITEM, _('Item') . ' [' . $item['key_'] . '] [' . $id . '] ' . _('Host') . ' [' . $host['host'] . '] ' . _('History cleared'));
}
$go_result = DBend($go_result);
show_messages($go_result, _('History cleared'), $go_result);
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['group_itemid'])) {
DBstart();
$group_itemid = $_REQUEST['group_itemid'];
$itemsToDelete = API::Item()->get(array('output' => array('key_', 'itemid'), 'selectHosts' => array('name'), 'itemids' => $group_itemid, 'preservekeys' => true));
$go_result = API::Item()->delete($group_itemid);
if ($go_result) {
foreach ($itemsToDelete as $item) {
$host = reset($item['hosts']);
add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_ITEM, _('Item') . ' [' . $item['key_'] . '] [' . $item['itemid'] . '] ' . _('Host') . ' [' . $host['name'] . ']');
}
}
show_messages(DBend($go_result), _('Items deleted'), _('Cannot delete items'));
}
if ($_REQUEST['go'] != 'none' && !empty($go_result)) {
$url = new CUrl();
$path = $url->getPath();
insert_js('cookie.eraseArray("' . $path . '")');
}
/*
* Display
*/
if (isset($_REQUEST['form']) && str_in_array($_REQUEST['form'], array(_('Create item'), 'update', 'clone'))) {
$data = getItemFormData();
$data['page_header'] = _('CONFIGURATION OF ITEMS');
// render view
$itemView = new CView('configuration.item.edit', $data);
$itemView->render();
示例15: show_messages
show_messages($result, _('Item updated'), _('Cannot update item'));
} else {
$screenItem['x'] = get_request('x');
$screenItem['y'] = get_request('y');
$result = API::ScreenItem()->create($screenItem);
show_messages($result, _('Item added'), _('Cannot add item'));
}
DBend($result);
if ($result) {
add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Cell changed ' . (isset($_REQUEST['screenitemid']) ? 'screen itemid "' . $_REQUEST['screenitemid'] . '"' : '') . (isset($_REQUEST['x']) && isset($_REQUEST['y']) ? ' coordinates "' . $_REQUEST['x'] . ',' . $_REQUEST['y'] . '"' : '') . (isset($_REQUEST['resourcetype']) ? ' resource type "' . $_REQUEST['resourcetype'] . '"' : ''));
unset($_REQUEST['form']);
}
} elseif (isset($_REQUEST['delete'])) {
DBstart();
$screenitemid = API::ScreenItem()->delete($_REQUEST['screenitemid']);
$result = DBend($screenitemid);
show_messages($result, _('Item deleted'), _('Cannot delete item'));
if ($result && !empty($screenitemid)) {
$screenitemid = reset($screenitemid);
$screenitemid = reset($screenitemid);
add_audit_details(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Screen itemid "' . $screenitemid . '"');
}
unset($_REQUEST['x']);
} elseif (isset($_REQUEST['add_row'])) {
DBexecute('UPDATE screens SET vsize=(vsize+1) WHERE screenid=' . zbx_dbstr($screen['screenid']));
$add_row = get_request('add_row', 0);
if ($screen['vsize'] > $add_row) {
DBexecute('UPDATE screens_items SET y=(y+1) WHERE screenid=' . zbx_dbstr($screen['screenid']) . ' AND y>=' . zbx_dbstr($add_row));
}
add_audit_details(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name'], 'Row added');
} elseif (isset($_REQUEST['add_col'])) {