summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/application/controllers/file.php32
-rw-r--r--system/application/models/file_mod.php1
-rw-r--r--system/application/views/file/delete_form.php9
-rw-r--r--system/application/views/file/deleted.php3
-rw-r--r--system/application/views/file/html_header.php2
-rw-r--r--system/application/views/file/upload_form.php4
6 files changed, 45 insertions, 6 deletions
diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php
index 40a5c9016..e42d1d3db 100644
--- a/system/application/controllers/file.php
+++ b/system/application/controllers/file.php
@@ -86,14 +86,38 @@ class File extends Controller {
// Allow users to delete IDs if their password matches the one used when uploading
function delete()
{
+ $data = array();
$id = $this->uri->segment(3);
$password = $this->input->post('password');
- if ($this->file_mod->delete_id($id, $password)) {
- echo $id." deleted\n";
+ $data["title"] = "Delete";
+ $data["id"] = $id;
+ if ($password) {
+ if ($this->file_mod->delete_id($id, $password)) {
+ if ($this->var->cli_client) {
+ echo $id." deleted\n";
+ die();
+ } else {
+ $this->load->view('file/header', $data);
+ $this->load->view('file/deleted', $data);
+ $this->load->view('file/footer', $data);
+ return;
+ }
+ } else {
+ if ($this->var->cli_client) {
+ echo 'Couldn\'t delete '.$id."\n";
+ die();
+ } else {
+ $data["msg"] = "Deletion failed. Is the password correct?";
+ }
+ }
+ }
+ if ($this->var->cli_client) {
+ die();
} else {
- echo 'Couldn\'t delete '.$id."\n";
+ $this->load->view('file/header', $data);
+ $this->load->view('file/delete_form', $data);
+ $this->load->view('file/footer', $data);
}
- die();
}
// Take the content from post instead of a file
diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php
index 83834f7f1..5a06a9801 100644
--- a/system/application/models/file_mod.php
+++ b/system/application/models/file_mod.php
@@ -215,6 +215,7 @@ class File_mod extends Model {
$data['plain_link'] = site_url($id.'/plain');
$data['auto_link'] = site_url($id).'/';
$data['rmd_link'] = site_url($id.'/rmd');
+ $data['delete_link'] = site_url("file/delete/".$id);
header("Content-Type: text/html\n");
if ($mode) {
diff --git a/system/application/views/file/delete_form.php b/system/application/views/file/delete_form.php
new file mode 100644
index 000000000..7d4f2329f
--- /dev/null
+++ b/system/application/views/file/delete_form.php
@@ -0,0 +1,9 @@
+<div style="text-align:center">
+ <?php echo form_open('file/delete/'.$id); ?>
+ <p>
+ <?php if($msg) echo $msg."<br />"; ?>
+ Password:<input type="password" name="password" size="10" />
+ <input type="submit" value="Delete" name="process" />
+ </p>
+ </form>
+</div>
diff --git a/system/application/views/file/deleted.php b/system/application/views/file/deleted.php
new file mode 100644
index 000000000..865b5304a
--- /dev/null
+++ b/system/application/views/file/deleted.php
@@ -0,0 +1,3 @@
+<div style="text-align:center">
+ <p><?php echo $id; ?> has been deleted.</p>
+</div>
diff --git a/system/application/views/file/html_header.php b/system/application/views/file/html_header.php
index b7e27315d..52ffab007 100644
--- a/system/application/views/file/html_header.php
+++ b/system/application/views/file/html_header.php
@@ -11,7 +11,7 @@
<a class="raw_link no" href="<?php echo $raw_link; ?>">Raw</a> |
<a class="raw_link no" href="<?php echo $plain_link; ?>">Plain</a> |
Currently: <?php echo $current_highlight; ?> |
- Timeout: <?php echo $timeout; ?>
+ Timeout: <a class="raw_link no" href="<?php echo $delete_link; ?>" title="delete"><?php echo $timeout; ?></a>
<div style="float:right;">
<a class="raw_link no" href="<?php echo $auto_link; ?>">Code</a> |
<a class="raw_link no" href="<?php echo $rmd_link; ?>">Render Markdown</a>
diff --git a/system/application/views/file/upload_form.php b/system/application/views/file/upload_form.php
index ec7ab53de..fe3f5db5a 100644
--- a/system/application/views/file/upload_form.php
+++ b/system/application/views/file/upload_form.php
@@ -2,13 +2,15 @@
<?php echo form_open_multipart('file/do_upload'); ?>
<p>
File: <input type="file" name="file" size="30" />
- <input type="submit" value="Upload" name="process" />
+ <input type="submit" value="Upload" name="process" /><br />
+ Optional password (for deletion): <input type="password" name="password" size="10" />
</p>
</form>
<p><b>OR</b></p>
<?php echo form_open_multipart('file/do_paste'); ?>
<p>
<textarea name="content" cols="80" rows="20"></textarea><br />
+ Optional password (for deletion): <input type="password" name="password" size="10" /><br />
<input type="submit" value="Paste" name="process" />
</p>
</form>