[geeklog-cvs] geeklog: Fixed uploading topic images when $_CONF['path_images']...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Aug 28 11:08:55 EDT 2011
changeset 8368:810e27b9c460
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/810e27b9c460
user: Dirk Haun <dirk at haun-online.de>
date: Thu Jun 23 13:04:50 2011 +0200
description:
Fixed uploading topic images when $_CONF['path_images'] was changed (bug #0001268)
diffstat:
public_html/admin/topic.php | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diffs (47 lines):
diff -r 30d0fa4b5d29 -r 810e27b9c460 public_html/admin/topic.php
--- a/public_html/admin/topic.php Thu Jun 23 10:41:48 2011 +0200
+++ b/public_html/admin/topic.php Thu Jun 23 13:04:50 2011 +0200
@@ -2,13 +2,13 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.7 |
+// | Geeklog 1.8 |
// +---------------------------------------------------------------------------+
// | topic.php |
// | |
// | Geeklog topic administration page. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2010 by the following authors: |
+// | Copyright (C) 2000-2011 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -664,7 +664,26 @@
COM_output($display);
exit; // don't return
}
- $filename = '/images/topics/' . $filename;
+ if (strpos($_CONF['path_images'], $_CONF['path_html']) === 0) {
+ $filename = substr($_CONF['path_images'],
+ strlen($_CONF['path_html']) - 1)
+ . 'topics/' . $filename;
+ } else {
+ /**
+ * Not really used when the 'path_images' is outside of the webroot.
+ * Let's at least extract the name of the images directory then.
+ */
+ $images = 'images';
+ $parts = explode('/', $_CONF['path_images']);
+ if (count($parts) > 1) {
+ $cnt = count($parts);
+ // e.g. from /path/to/myimages/ would extract "myimages"
+ if (empty($parts[$cnt - 1]) && !empty($parts[$cnt - 2])) {
+ $images = $parts[$cnt - 2];
+ }
+ $filename = '/' . $images . '/topics/' . $filename;
+ }
+ }
}
return $filename;
More information about the geeklog-cvs
mailing list