986a9dfcfed4675cfd5d5bde8a50be6de298b8c5
[acontent.git] / docs / updater / patch_delete.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 \r
13 define('TR_INCLUDE_PATH', '../include/');\r
14 require(TR_INCLUDE_PATH.'vitals.inc.php');\r
15 require_once(TR_INCLUDE_PATH.'classes/DAO/MyownPatchesDAO.class.php');\r
16 require_once(TR_INCLUDE_PATH.'classes/DAO/MyownPatchesDependentDAO.class.php');\r
17 require_once(TR_INCLUDE_PATH.'classes/DAO/MyownPatchesFilesDAO.class.php');\r
18 \r
19 $myownPatchesDAO = new MyownPatchesDAO();\r
20 \r
21 if (isset($_POST['submit_no'])) {\r
22         $msg->addFeedback('CANCELLED');\r
23         header('Location: myown_patches.php');\r
24         exit;\r
25 } else if (isset($_POST['submit_yes'])) {\r
26         /* delete has been confirmed, delete this category */\r
27         $myown_patch_id = intval($_POST['myown_patch_id']);\r
28 \r
29         $myownPatchesDependentDAO = new MyownPatchesDependentDAO();\r
30         $myownPatchesFilesDAO = new MyownPatchesFilesDAO();\r
31         \r
32         $myownPatchesDAO->Delete($myown_patch_id);\r
33         $myownPatchesDependentDAO->DeleteByPatchID($myown_patch_id);\r
34         $myownPatchesFilesDAO->DeleteByPatchID($myown_patch_id);\r
35 \r
36         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');\r
37         header('Location: myown_patches.php');\r
38         exit;\r
39 }\r
40 \r
41 //require('../../include/header.inc.php');\r
42 require(TR_INCLUDE_PATH.'header.inc.php');\r
43 \r
44 $_GET['myown_patch_id'] = intval($_GET['myown_patch_id']); \r
45 $row = $myownPatchesDAO->getByID($_GET[myown_patch_id]);\r
46 \r
47 if (!$row) {\r
48         $msg->printErrors('ITEM_NOT_FOUND');\r
49 } else {\r
50         $hidden_vars['system_patch_id']= $row['system_patch_id'];\r
51         $hidden_vars['myown_patch_id']  = $row['myown_patch_id'];\r
52 \r
53         $confirm = array('DELETE_MYOWN_UPDATE', $row['system_patch_id']);\r
54         $msg->addConfirm($confirm, $hidden_vars);\r
55         \r
56         $msg->printConfirm();\r
57 }\r
58 \r
59 require(TR_INCLUDE_PATH.'footer.inc.php');\r
60 \r
61 ?>