-
Notifications
You must be signed in to change notification settings - Fork 9
/
delete-blog-category.php
48 lines (28 loc) · 1.31 KB
/
delete-blog-category.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require 'class.base.php';
require 'class.html.php';
$base_instance=new base();
$html_instance=new html();
$userid=$base_instance->get_userid();
$category_id=isset($_REQUEST['category_id']) ? (int)$_REQUEST['category_id'] : exit;
if (isset($_POST['save'])) {
if (!$category_id) { exit; }
$base_instance->query("DELETE FROM {$base_instance->entity['BLOG']['MAIN']} WHERE user='$userid' AND category='$category_id'");
$base_instance->query("DELETE FROM {$base_instance->entity['BLOG']['CATEGORY']} WHERE user='$userid' AND ID='$category_id'");
header('Location: close-me.php'); exit;
}
else {
$data=$base_instance->get_data("SELECT * FROM {$base_instance->entity['BLOG']['CATEGORY']} WHERE user='$userid' AND ID='$category_id'");
if (!$data) { $base_instance->show_message('Blog Category not found'); exit; }
$title=$data[1]->title;
}
$html_instance->add_parameter(
array('ACTION'=>'show_form',
'HEADER'=>'<font color="#ff0000">Delete this category?</font>',
'FORM_ACTION'=>$_SERVER['PHP_SELF'],
'BUTTON_TEXT'=>'Delete'
));
$html_instance->add_form_field(array('TYPE'=>'hidden','NAME'=>'category_id','VALUE'=>"$category_id"));
$html_instance->add_form_field(array('TYPE'=>'label','TEXT'=>"Are you sure you want to delete the <b>'$title'</b> category AND the items of this category?"));
$html_instance->process();
?>