summaryrefslogtreecommitdiff
path: root/forum
diff options
context:
space:
mode:
authordeva <deva>2008-10-27 18:08:29 +0000
committerdeva <deva>2008-10-27 18:08:29 +0000
commit9559ea4fc6f7758c5252fb5cee1b5fa5315da94a (patch)
tree016a88aed67da69959b3a85d66e52fabea0c289b /forum
parentbdad9a1ba9e68c016759374fb24059f571d98435 (diff)
Fixed bug, where links were not converted corretly when residing at the end of the message.
Diffstat (limited to 'forum')
-rw-r--r--forum/utils/parser.php2
-rw-r--r--forum/utils/profile.php3
2 files changed, 3 insertions, 2 deletions
diff --git a/forum/utils/parser.php b/forum/utils/parser.php
index 5864753..f79be2a 100644
--- a/forum/utils/parser.php
+++ b/forum/utils/parser.php
@@ -42,7 +42,7 @@ function parse($input, $indent = "")
$output = preg_replace("/http:\/\/(.*?\.jpg|.*?\.gif|.*?\.png|.*?\.jpeg)/", $imgstartmarker."$1".$imgendmarker, $output);
// Replace URLs with <a></a> tags
- $output = preg_replace("/http:\/\/(.*?)([\n ])/s", "<a href=\"http://$1\">$1</a>$2", $output);
+ $output = preg_replace("/http:\/\/(.*?)([\n ]|$)/s", "<a href=\"http://$1\">$1</a>$2", $output);
// 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);
diff --git a/forum/utils/profile.php b/forum/utils/profile.php
index a8676b4..b8b46d2 100644
--- a/forum/utils/profile.php
+++ b/forum/utils/profile.php
@@ -17,7 +17,8 @@ if($action == "update") {
if(is_uploaded_file($_FILES['userfile']['tmp_name'])) {
if(!file_exists("gfx/avatars")) mkdir("gfx/avatars");
- $filename = $_FILES['userfile']['name'];
+ // Prepend username to prevent overwriting of other users avatars.
+ $filename = $current_user->username . "_" . $_FILES['userfile']['name'];
if($current_user->avatar) unlink("gfx/avatars/" . $current_user->avatar);
move_uploaded_file($_FILES['userfile']['tmp_name'], "gfx/avatars/" . $filename);
$current_user->avatar = $filename;