function disable_httptest($httptestid)
{
    $result = DBexecute('UPDATE httptest SET status=' . HTTPTEST_STATUS_DISABLED . ' WHERE httptestid=' . zbx_dbstr($httptestid));
    $itemids = array();
    $items_db = DBselect('SELECT hti.itemid FROM httptestitem hti WHERE hti.httptestid=' . zbx_dbstr($httptestid));
    while ($itemid = Dbfetch($items_db)) {
        $itemids[] = $itemid['itemid'];
    }
    $items_db = DBselect('SELECT hsi.itemid' . ' FROM httpstep hs,httpstepitem hsi' . ' WHERE hs.httpstepid=hsi.httpstepid' . ' AND hs.httptestid=' . zbx_dbstr($httptestid));
    while ($itemid = Dbfetch($items_db)) {
        $itemids[] = $itemid['itemid'];
    }
    $result &= DBexecute('UPDATE items SET status=' . ITEM_STATUS_DISABLED . ' WHERE ' . dbConditionInt('itemid', $itemids));
    return $result;
}
Exemplo n.º 2
0
     $cmbConfig->addItem(ZBX_AUTH_HTTP, S_HTTP);
     $frmAuth->addRow(S_DEFAULT_AUTHENTICATION, $cmbConfig);
     $frmAuth->addRow(S_LDAP . SPACE . S_HOST, new CTextBox('ldap_host', $config['ldap_host'], 64));
     $frmAuth->addRow(S_PORT, new CNumericBox('ldap_port', $config['ldap_port'], 5));
     $frmAuth->addRow(S_BASE_DN, new CTextBox('ldap_base_dn', $config['ldap_base_dn'], 64));
     $frmAuth->addRow(S_SEARCH_ATTRIBUTE, new CTextBox('ldap_search_attribute', empty($config['ldap_search_attribute']) ? 'uid' : $config['ldap_search_attribute']));
     $frmAuth->addRow(S_BIND_DN . '*', new CTextBox('ldap_bind_dn', $config['ldap_bind_dn'], 64));
     $frmAuth->addRow(S_BIND_PASSWORD . '*', new CPassBox('ldap_bind_password', $config['ldap_bind_password']));
     $action = "javascript: if(confirm('" . S_SWITCHING_LDAP . "')) return true; else return false;";
     $frmAuth->addRow(S_LDAP . SPACE . S_AUTHENTICATION . SPACE . S_ENABLED, new CCheckBox('authentication_type', $config['authentication_type'], $action, ZBX_AUTH_LDAP));
     $frmAuth->addRow(S_TEST . SPACE . S_AUTHENTICATION, ' [' . S_MUST_BE_VALID_SMALL . SPACE . S_LDAP . SPACE . S_USER . ']');
     if (GROUP_GUI_ACCESS_INTERNAL == get_user_auth($USER_DETAILS['userid'])) {
         $usr_test = new CComboBox('user', $USER_DETAILS['alias']);
         $sql = 'SELECT u.alias, u.userid ' . ' FROM users u ' . ' WHERE ' . DBin_node('u.userid') . ' ORDER BY alias ASC';
         $u_res = DBselect($sql);
         while ($db_user = Dbfetch($u_res)) {
             if (check_perm2login($db_user['userid']) && check_perm2system($db_user['userid'])) {
                 $usr_test->addItem($db_user['alias'], $db_user['alias']);
             }
         }
     } else {
         $usr_test = new CTextBox('user', $USER_DETAILS['alias'], null, 'yes');
     }
     $frmAuth->addRow(S_LOGIN, $usr_test);
     $frmAuth->addRow(S_USER . SPACE . S_PASSWORD, new CPassBox('user_password'));
     $frmAuth->addItemToBottomRow(new CButton('save', S_SAVE));
     $frmAuth->addItemToBottomRow(new CButton('test', S_TEST));
     $frmAuth->Show();
 } else {
     if (ZBX_AUTH_HTTP == $_REQUEST['config']) {
         $form_refresh_http = get_request('form_refresh_http', 0);
Exemplo n.º 3
0
function disable_httptest($httptestid)
{
    $r = DBexecute('UPDATE httptest SET status=' . HTTPTEST_STATUS_DISABLED . ' WHERE httptestid=' . $httptestid);
    $itemids = array();
    $sql = 'SELECT hti.itemid FROM httptestitem hti WHERE hti.httptestid=' . $httptestid;
    $items_db = DBselect($sql);
    while ($itemid = Dbfetch($items_db)) {
        $itemids[] = $itemid['itemid'];
    }
    $sql = 'SELECT hsi.itemid FROM httpstep hs, httpstepitem hsi WHERE ' . ' hs.httptestid=' . $httptestid . ' AND hs.httpstepid=hsi.httpstepid';
    $items_db = DBselect($sql);
    while ($itemid = Dbfetch($items_db)) {
        $itemids[] = $itemid['itemid'];
    }
    $sql = 'UPDATE items SET status=' . ITEM_STATUS_DISABLED . ' WHERE ' . DBcondition('itemid', $itemids);
    $r &= DBexecute($sql);
    return $r;
}