예제 #1
0
function group_del($group_id)
{
    // Находим все подгруппы и рекурсивно удаляем
    $sql = "SELECT * FROM `" . DB_PREFIX . DB_TBL_GROUPS . "` WHERE `parent` = " . $group_id;
    $sql = mysql_query($sql);
    if (false == $sql) {
        my_die();
    }
    $aList = array();
    while ($row = mysql_fetch_assoc($sql)) {
        $aList[] = $row;
    }
    foreach ($aList as $v) {
        group_del($v['id']);
    }
    // Удаляем все продукты группы
    $sql = "DELETE FROM `" . DB_PREFIX . DB_TBL_PRODUCTS . "` WHERE `group` = " . $group_id;
    $sql = mysql_query($sql);
    if (false == $sql) {
        my_die();
    }
    // Удаляем запись группы в базе данных
    $sql = "DELETE FROM `" . DB_PREFIX . DB_TBL_GROUPS . "` WHERE `id` = " . $group_id;
    $sql = mysql_query($sql);
    if (false == $sql) {
        my_die();
    }
}
예제 #2
0
    exit;
}
if (isset($_GET["add-group"])) {
    add_group_form();
    exit;
}
if (isset($_GET["ou-search"])) {
    add_group_list();
    exit;
}
if (isset($_GET["groups-list"])) {
    group_list();
    exit;
}
if (isset($_GET["del-group-rule"])) {
    group_del();
    exit;
}
js();
function js()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $ID = $_GET["ID"];
    $title = $tpl->_ENGINE_parse_body('{APP_DANSGUARDIAN}:: {groups}:: {rule}::' . $ID);
    $add_group = $tpl->_ENGINE_parse_body('{add_group}:: {rule}::' . $ID);
    $html = "\n\tvar mem_rule_id='';\n\tvar mem_cat='';\n\tvar rule_main_mem='';\n\tfunction DansGuardianGroups(){\n\t\tYahooWin5(500,'{$page}?popup=yes','{$title}'); \n\t}\t\t\t\n\t\n\tfunction DansGuardianGroupsAddForm(){\n\t\tYahooWin6(400,'{$page}?add-group=yes','{$add_group}'); \n\t}\n\t\n\tfunction DansGuardianGroupsSelectOU(){\n\t\tLoadAjax('group-id','{$page}?ou-search='+ document.getElementById('ou-selected').value);\n\t}\n\t\n\tfunction DansGuardianRefreshGroups(){\n\t\tLoadAjax('group-list','{$page}?groups-list={$ID}');\n\t}\n\t\n\tvar x_DansGuardianGroupsAdd=function(obj){\n\t  var tempvalue=obj.responseText;\n\t  if(tempvalue.length>0){alert(tempvalue);}\n\t  DansGuardianRefreshGroups();\n\t  YahooWin6Hide();\n      \n\t}\t\n\t\n\tfunction DansGuardianGroupsAdd(){\n\t  var XHR = new XHRConnection();\n      XHR.appendData('add-group-rule','{$ID}');\n      XHR.appendData('gpid',document.getElementById('group-selected').value);\n      document.getElementById('group-list').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n      XHR.sendAndLoad('{$page}', 'GET',x_DansGuardianGroupsAdd);    \n\t}\n\t\n\tfunction DansGuardianGroupsDel(ID){\n\t  var XHR = new XHRConnection();\n      XHR.appendData('del-group-rule',ID);\n      document.getElementById('group-list').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n      XHR.sendAndLoad('{$page}', 'GET',x_DansGuardianGroupsAdd);  \n\t}\n\t\n\tDansGuardianGroups();";
    echo $html;
}
function add_group_sql()
{