From 0b71a1a78732a52f6c074c02cd69d4dd90024ce2 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 12 Oct 2008 11:18:38 +0000 Subject: Removed 'delete file' unless logged in as admin. Added insertcommand, and made parser use it. --- forum/utils/files.php | 7 +++++-- forum/utils/parser.php | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'forum/utils') diff --git a/forum/utils/files.php b/forum/utils/files.php index c698ede..b91957b 100644 --- a/forum/utils/files.php +++ b/forum/utils/files.php @@ -15,11 +15,14 @@ class File { public function show() { - global $PERMSTORE; + global $PERMSTORE, $current_user; echo "
\n"; - echo " fid . "\">Delete\n"; + if($current_user->uid == 0) { + echo " fid . "\">Delete\n"; + } echo "
Filename: link() . "\">" . $this->name . "(" . $this->mimetype. ")
\n"; echo "
Size: " . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb
\n"; + echo "
Use this command to insert the file: {{" . $this->fid . "}}
\n"; echo "
\n"; } diff --git a/forum/utils/parser.php b/forum/utils/parser.php index db8791b..5ba5724 100644 --- a/forum/utils/parser.php +++ b/forum/utils/parser.php @@ -47,6 +47,9 @@ function parse($input, $indent = "") // Convert marked images to img tags and links $output = preg_replace("/".$imgstartmarker."(.*?)".$imgendmarker."/s", "\"$1\"", $output); + // Replace URLs with tags + $output = preg_replace("/\{\{(.*?)\}\}/s", "File: $1", $output); + // Replace [quote title=...]...[/quote] $urls = ""; while(($start = strpos($output, "[quote"))) { -- cgit v1.2.3