From 51ebe79aa0fc50df691f442a73e3ac34a08179a0 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 9 Jun 2013 00:01:13 +0200 Subject: implement repasting (fills textarea with ID's content) Signed-off-by: Florian Pritz --- application/controllers/file.php | 10 ++++++++++ application/views/file/html_header.php | 2 ++ application/views/file/upload_form.php | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index cb95edf0c..1c216aa15 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -353,6 +353,16 @@ class File extends CI_Controller { $this->data['username'] = $this->muser->get_username(); + $repaste_id = $this->input->get("repaste"); + + if ($repaste_id) { + $filedata = $this->mfile->get_filedata($repaste_id); + + if ($filedata !== false && $this->mfile->can_highlight($filedata["mimetype"])) { + $this->data["textarea_content"] = file_get_contents($this->mfile->file($filedata["hash"])); + } + } + $this->load->view('header', $this->data); $this->load->view($this->var->view_dir.'/upload_form', $this->data); if (is_cli_client()) { diff --git a/application/views/file/html_header.php b/application/views/file/html_header.php index b861e0a39..7964488d6 100644 --- a/application/views/file/html_header.php +++ b/application/views/file/html_header.php @@ -72,6 +72,8 @@ include(FCPATH."application/views/header.php"); ?> +
  • +
  • Repaste
  • Linewrap diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php index be449ee6e..a83ca3c87 100644 --- a/application/views/file/upload_form.php +++ b/application/views/file/upload_form.php @@ -4,7 +4,11 @@

    Text paste

    -
    +
    -- cgit v1.2.3-24-g4f1b