Rev 484 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 212 | tom | 1 | <?php |
| 2 | |||
| 3 | require '../_taios.php'; |
||
| 4 | |||
| 5 | $page = new Taios_Page('Delete Project', '../'); |
||
| 6 | |||
| 7 | $page->checkLoggedIn(); |
||
| 213 | tom | 8 | $id = $page->getGetID(); |
| 212 | tom | 9 | $project = $page->getProject($id); |
| 10 | |||
| 492 | tom | 11 | if (($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID) && $project) { |
| 12 | $page->query("DELETE FROM Projects WHERE ID = ?", array($id)); |
||
| 212 | tom | 13 | $page->redirect('index.php'); |
| 492 | tom | 14 | } else { |
| 15 | if (!$project) { |
||
| 212 | tom | 16 | $page->drawError('No such project, #' . $id); |
| 492 | tom | 17 | } else { |
| 212 | tom | 18 | $page->drawError('You do not have permission to access this page.'); |
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | ?> |