From cdaa5e28290fe0e9e73ca3a0557ee021a7ab404b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 30 Mar 2012 21:15:31 +0200 Subject: paste deletion is possible now --- www/.htaccess | 2 ++ www/delete.php | 23 +++++++++++++++++++++++ www/index.php | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 www/delete.php (limited to 'www') diff --git a/www/.htaccess b/www/.htaccess index a058392..32701be 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -3,6 +3,8 @@ RewriteBase / #RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^([0-9]+)$ /display.php?id=$1 +RewriteRule ^([0-9]+)/delete$ /delete.php?id=$1 +RewriteRule ^([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1 RewriteRule ^([0-9]+)/edit$ /edit.php?id=$1 RewriteRule ^([0-9]+)/fork$ /fork.php?id=$1 RewriteRule ^([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2 diff --git a/www/delete.php b/www/delete.php new file mode 100644 index 0000000..9feaf4e --- /dev/null +++ b/www/delete.php @@ -0,0 +1,23 @@ +loadFromRequest(); + +if (isset($_GET['confirm']) && $_GET['confirm'] == 1) { + if ($_SERVER['REQUEST_METHOD'] !== 'POST') { + throw new Exception_Input('Deleting only possible via POST'); + } + $repo->delete(); + redirect('/'); +} + +render( + 'delete', + array('repo' => $repo) +); +?> diff --git a/www/index.php b/www/index.php index d33604d..9a03b77 100644 --- a/www/index.php +++ b/www/index.php @@ -21,4 +21,4 @@ $phork = array( '1' => new File(null, null) ); render('index', array('files' => $phork, 'description' => '')); -?> \ No newline at end of file +?> -- cgit v1.2.3