Beispiel #1
0
function action_delete()
{
    global $link;
    $id = (int) $_GET['id'];
    articles_delete($link, $id);
    header("Location: index.php");
}
Beispiel #2
0
 public function action_del()
 {
     $id = (int) $_GET['id'];
     if (!$id) {
         die("Не верный id");
     }
     articles_delete($id);
     header('Location: index.php');
 }
Beispiel #3
0
    $action = "";
}
if ($action == "add") {
    if (!empty($_POST)) {
        articles_new($link, $_POST['title'], $_POST['date'], $_POST['content']);
        header("Location: index.php");
    }
    include "../views/article_admin.php";
} else {
    if ($action == "edit") {
        if (!isset($_GET['id'])) {
            header("Location: index.php");
        }
        $id = (int) $_GET['id'];
        if (!empty($_POST) && $id > 0) {
            articles_edit($link, $id, $_POST['title'], $_POST['date'], $_POST['content']);
            header("Location: index.php");
        }
        $article = articles_get($link, $id);
        include "../views/article_admin.php";
    } else {
        if ($action == 'delete') {
            $id = $_GET['id'];
            $article = articles_delete($link, $id);
            header("Location: index.php");
        } else {
            $articles = articles_all($link);
            include "../views/articles_admin.php";
        }
    }
}
Beispiel #4
0
<?php

include_once 'startup.php';
include_once 'model/m_view.php';
include_once 'model/m_base.php';
// Установка параметров, подключение к БД, запуск сессии.
startup();
// Обработка отправки формы.
if (!empty($_GET['id'])) {
    articles_delete($_GET['id']);
    $message['echo'] = 'удалили cтатью id' . $_GET['id'];
} else {
    header('Location: index.php');
}
// Кодировка.
header('Content-type: text/html; charset=utf-8');
//Вывод в шаблон.
// Внутренний шаблон.
$content = view_include('theme/v_delete.php', $message);
// Внешний шаблон.
$page = view_include('theme/v_base.php', array('title1' => 'Успешное удаление статьи', 'content' => $content));
// Вывод.
echo $page;
Beispiel #5
0
<?php

require_once 'startup.php';
require_once 'model.php';
// подключаемся к БД
startup();
//удаляем все помеченные на удаление статьи
$id_delArticle = array();
foreach ($_POST as $key => $value) {
    if ($_POST[$key] == 'on') {
        articles_delete($key);
    }
}
//извлекаем все статьи
$articles = articles_all();
// кодировку
header('Content-type: text/html; charset=utf-8');
// вывод в шаблон
include 'theme/editor.php';
function articles_delete_category($id, $dir = ARTICLES_PATH)
{
    if (!is_dir($dir . $id)) {
        return 12;
    }
    $catprefix = $dir . $id . '/';
    $articles = rcms_scandir($dir);
    foreach ($articles as $article) {
        if (is_dir($catprefix . $article)) {
            articles_delete($id, $article, $dir);
        }
    }
    rcms_delete_files($catprefix, true);
    return 0;
}
/******************************************************************************
* Extracting some data from request                                           *
******************************************************************************/
$work_dir = articles_get_work_dir($null);
$category = empty($_REQUEST['category']) ? '' : $_REQUEST['category'];
$article = empty($_REQUEST['edit']) ? '' : $_REQUEST['edit'];
if (!empty($work_dir) && $work_dir != ARTICLES_PATH) {
    rcms_showAdminMessage($lang['results']['articles'][8] . $work_dir);
}
/******************************************************************************
* Perform deletion of articles                                                *
******************************************************************************/
if (!empty($_POST['delete'])) {
    foreach ($_POST['delete'] as $id => $chk) {
        if ($chk) {
            $res = articles_delete($category, $id, $work_dir);
        }
    }
    rcms_showAdminMessage($lang['results']['articles'][$res]);
}
/******************************************************************************
* Perform changing of article                                                 *
******************************************************************************/
if (!empty($_POST['editflag'])) {
    $res = articles_save($category, $article, @$_POST['a_title'], @$_POST['a_src'], @$_POST['a_description'], @$_POST['a_text'], @$_POST['a_mode'], @$_POST['a_comments'], $work_dir);
    if (!empty($_POST['a_category']) && $category != $_POST['a_category']) {
        $article = articles_move($category, $article, $_POST['a_category'], $work_dir);
        $category = $_POST['a_category'];
    }
    rcms_showAdminMessage($lang['results']['articles'][$res]);
}