paste deletion is possible now
[phorkie.git] / www / delete.php
1 <?php
2 namespace Phorkie;
3 /**
4  * Delete paste or ask for deletion
5  */
6 require_once 'www-header.php';
7
8 $repo = new Repository();
9 $repo->loadFromRequest();
10
11 if (isset($_GET['confirm']) && $_GET['confirm'] == 1) {
12     if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
13         throw new Exception_Input('Deleting only possible via POST');
14     }
15     $repo->delete();
16     redirect('/');
17 }
18
19 render(
20     'delete',
21     array('repo' => $repo)
22 );
23 ?>