summaryrefslogtreecommitdiff
path: root/forum
diff options
context:
space:
mode:
Diffstat (limited to 'forum')
-rw-r--r--forum/utils/files.php7
-rw-r--r--forum/utils/parser.php3
2 files changed, 8 insertions, 2 deletions
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 "<div class=\"file\">\n";
- echo " <a class=\"delete\" href=\"?mode=filehandler&amp;task=delete&amp;fid=" . $this->fid . "\">Delete</a>\n";
+ if($current_user->uid == 0) {
+ echo " <a class=\"delete\" href=\"?mode=filehandler&amp;task=delete&amp;fid=" . $this->fid . "\">Delete</a>\n";
+ }
echo " <div class=\"filename\">Filename: <a href=\"" . $this->link() . "\">" . $this->name . "</a>(" . $this->mimetype. ")</div>\n";
echo " <div class=\"filesize\">Size: " . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb</div>\n";
+ echo " <div class=\"insertcommand\">Use this command to insert the file: {{" . $this->fid . "}}</div>\n";
echo "</div>\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", "<a href=\"http://$1\"><img alt=\"$1\" src=\"?mode=imagecache&amp;uri=http://$1\"/></a>", $output);
+ // Replace URLs with <a></a> tags
+ $output = preg_replace("/\{\{(.*?)\}\}/s", "<a href=\"?mode=file&amp;fid=$1\">File: $1</a>", $output);
+
// Replace [quote title=...]...[/quote]
$urls = "";
while(($start = strpos($output, "[quote"))) {