Ejemplo n.º 1
0
function delete_regexp($regexpids)
{
    zbx_value2array($regexpids);
    // delete expressions first
    delete_expressions_by_regexpid($regexpids);
    $result = DBexecute('DELETE FROM regexps WHERE ' . DBcondition('regexpid', $regexpids));
    return $result;
}
Ejemplo n.º 2
0
 if (inarr_isset(array('clone', 'regexpid'))) {
     unset($_REQUEST['regexpid']);
     $_REQUEST['form'] = 'clone';
 } else {
     if (isset($_REQUEST['cancel_new_expression'])) {
         unset($_REQUEST['new_expression']);
     } else {
         if (isset($_REQUEST['save'])) {
             if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
                 access_deny();
             }
             $regexp = array('name' => $_REQUEST['rename'], 'test_string' => $_REQUEST['test_string']);
             DBstart();
             if (isset($_REQUEST['regexpid'])) {
                 $regexpid = $_REQUEST['regexpid'];
                 delete_expressions_by_regexpid($_REQUEST['regexpid']);
                 $result = update_regexp($regexpid, $regexp);
                 $msg1 = S_REGULAR_EXPRESSION_UPDATED;
                 $msg2 = S_CANNOT_UPDATE_REGULAR_EXPRESSION;
             } else {
                 $result = $regexpid = add_regexp($regexp);
                 $msg1 = S_REGULAR_EXPRESSION_ADDED;
                 $msg2 = S_CANNOT_ADD_REGULAR_EXPRESSION;
             }
             if ($result) {
                 $expressions = get_request('expressions', array());
                 foreach ($expressions as $id => $expression) {
                     $expressionid = add_expression($regexpid, $expression);
                 }
             }
             $result = Dbend($result);