コード例 #1
0
ファイル: function.inc.php プロジェクト: Blu2z/implsk
/**
 * функция удаляет макет
 *
 */
function DeleteTemplates()
{
    global $nc_core, $db, $UI_CONFIG;
    while (list($key, $val) = each($_POST)) {
        if (substr($key, 0, 6) != "Delete") {
            continue;
        }
        $val = intval($val);
        if (!$val) {
            continue;
        }
        $val = (int) $val;
        $File_Mode = nc_get_file_mode('Template', $val);
        if ($File_Mode) {
            $template_editor = new nc_template_editor($nc_core->TEMPLATE_FOLDER, $nc_core->db);
            $template_editor->load_template($val);
            $template_editor->delete_template();
        }
        $UI_CONFIG = new ui_config_template('delete', $val);
        $arr_templates = nc_get_template_children($val);
        if (count($arr_templates) > 1) {
            foreach ($arr_templates as $int_template_id) {
                // execute core action
                $nc_core->event->execute("dropTemplatePrep", $int_template_id);
                if (!$db->query("DELETE FROM `Template` WHERE `Template_ID` = '" . $int_template_id . "'")) {
                    $SelectArray = $db->get_var("select Description from Template where Template_ID='" . $int_template_id . "'");
                    nc_print_status(CONTROL_TEMPLATE_ERR_CANTDEL . " " . $SelectArray . ". " . TOOLS_PATCH_ERROR, 'error');
                } else {
                    // execute core action
                    $nc_core->event->execute("dropTemplate", $int_template_id);
                }
                DeleteSystemTableFiles('Template', $int_template_id);
                $UI_CONFIG->treeChanges['deleteNode'][] = "template-{$int_template_id}";
            }
        } else {
            // execute core action
            $nc_core->event->execute("dropTemplatePrep", $val);
            if (!$db->query("delete from Template where Template_ID='" . $val . "'")) {
                $SelectArray = $db->get_var("select Description from Template where Template_ID='" . $val . "'");
                nc_print_status(CONTROL_TEMPLATE_ERR_CANTDEL . " " . $SelectArray . ". " . TOOLS_PATCH_ERROR, 'error');
            } else {
                // execute core action
                $nc_core->event->execute("dropTemplate", $val);
            }
            DeleteSystemTableFiles('Template', $val);
            $UI_CONFIG->treeChanges['deleteNode'][] = "template-{$val}";
        }
    }
}
コード例 #2
0
ファイル: function.inc.php プロジェクト: Blu2z/implsk
function DeleteCatalogue()
{
    global $db, $UI_CONFIG, $nc_core;
    $deleted_ids = array();
    if (!empty($_POST)) {
        foreach ($_POST as $key => $val) {
            if (nc_substr($key, 0, 6) == "Delete" && $val) {
                $val += 0;
                CascadeDeleteCatalogue($val);
                DeleteSystemTableFiles("Catalogue", $val);
                $UI_CONFIG->treeChanges['deleteNode'][] = "site-" . $val;
                $deleted_ids[] = $val;
            }
        }
    }
    $UI_CONFIG->deleteNavBarCatalogue = $deleted_ids;
    $nc_core->catalogue->load_all();
    nc_print_status(CONTROL_CONTENT_CATALOUGE_SUCCESS_DELETE, "ok");
}
コード例 #3
0
ファイル: nc_user.class.php プロジェクト: Blu2z/implsk
 public function delete_by_id($id)
 {
     if (!is_array($id)) {
         $id = array($id);
     }
     $id = array_map('intval', $id);
     // генерируем событие
     $this->core->event->execute("dropUserPrep", $id);
     require_once $this->core->INCLUDE_FOLDER . "s_files.inc.php";
     foreach ($id as $v) {
         DeleteSystemTableFiles('User', $id);
     }
     $ids_str = join(',', $id);
     $this->db->query("DELETE FROM `User` WHERE `User_ID` IN (" . $ids_str . ") ");
     $this->db->query("DELETE FROM `User_Group`  WHERE `User_ID` IN (" . $ids_str . ") ");
     if ($this->core->modules->get_by_keyword('auth')) {
         $this->db->query("DELETE FROM `Auth_ExternalAuth` WHERE `User_ID` IN (" . $ids_str . ") ");
     }
     // генерируем событие
     $this->core->event->execute("dropUser", $id);
 }
コード例 #4
0
ファイル: function.inc.php プロジェクト: Blu2z/implsk
/**
 * Функция удаляет пользователей
 *
 * @param mixed номер пользователя или массив с индетификаторами
 * @global  $nc_core, $perm
 *
 * @return array массив с id удаленных пользователей
 */
function DeleteUsers($ids)
{
    global $nc_core, $perm;
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    if (!is_object($perm)) {
        return false;
    }
    if (empty($ids)) {
        return false;
    }
    $db = $nc_core->db;
    $deleted_users = array();
    // массив со всеми удаленными пользователями
    $DeleteActionTemplate = $db->get_var("SELECT `DeleteActionTemplate` FROM `Class` WHERE `System_Table_ID`='3'");
    foreach ($ids as $id) {
        $id += 0;
        if (!$id) {
            continue;
        }
        // нельзя удалить себя
        if ($id == $perm->GetUserID()) {
            continue;
        }
        // нельзя удалить пользователя с большими правами
        if (!$perm->isAccess(NC_PERM_ITEM_USER, NC_PERM_ACTION_DEL, $id)) {
            continue;
        }
        // удаление
        //$db->query("DELETE FROM `Subscriber` WHERE `User_ID` = '".intval($UserID)."'"); // из подписок
        DeleteSystemTableFiles('User', $id);
        // удалениe файлов
        $message = $id;
        // чтобы было доступно в действии после удаления
        if ($DeleteActionTemplate) {
            eval("echo \"" . $DeleteActionTemplate . "\";");
        }
        // действие после удлаения
        $deleted_users[] = $id;
    }
    // никого не удалили
    if (empty($deleted_users)) {
        return false;
    }
    // генерируем событие
    $nc_core->event->execute("dropUserPrep", $deleted_users);
    $ids_str = join(',', $deleted_users);
    $db->query("DELETE FROM `User` WHERE `User_ID` IN (" . $ids_str . ") ");
    $db->query("DELETE FROM `User_Group`  WHERE `User_ID` IN (" . $ids_str . ") ");
    if ($nc_core->modules->get_by_keyword('auth')) {
        nc_auth_delete_all_relation($deleted_users);
        $db->query("DELETE FROM `Auth_ExternalAuth` WHERE `User_ID` IN (" . $ids_str . ") ");
    }
    // генерируем событие
    $nc_core->event->execute("dropUser", $deleted_users);
    return $deleted_users;
}
コード例 #5
0
ファイル: function.inc.php プロジェクト: Blu2z/implsk
function DeleteSubdivision()
{
    global $db;
    global $UI_CONFIG;
    $nc_core = nc_Core::get_object();
    // помним, что функция вызывается рекурсивно
    if (!is_object($UI_CONFIG)) {
        $UI_CONFIG = new ui_config_subdivision_delete(0);
        $UI_CONFIG->headerText = CONTROL_CONTENT_SUBDIVISION_FUNCS_LINEADD_DELETE;
    }
    $cat_fields = $nc_core->catalogue->get_all();
    foreach ($cat_fields as $kc => $vc) {
        foreach ($vc as $ks => $vs) {
            if ($ks == 'Title_Sub_ID' || $ks == 'E404_Sub_ID') {
                $subs_serv[] = $vs;
            }
        }
    }
    $i = 0;
    foreach ($nc_core->input->fetch_get_post() as $key => $val) {
        if (substr($key, 0, 6) == "Delete") {
            $sub_id = substr($key, 6, strlen($key) - 6) + 0;
            if (!in_array($sub_id, $subs_serv)) {
                DeleteSystemTableFiles('Subdivision', $sub_id);
                CascadeDeleteSubdivision($sub_id);
                $UI_CONFIG->treeChanges['deleteNode'][] = "sub-{$sub_id}";
                $i++;
            }
        }
    }
    nc_print_status(CONTROL_CONTENT_SUBDIVISION_FUNCS_LINEADD_DELETE_SUCCESS, 'ok');
}