[geeklog-hg] geeklog: Fixed a bug where Filemanager created a broken link

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Jan 23 05:44:25 EST 2014


changeset 9444:e98a50934dcd
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e98a50934dcd
user: Kenji ITO <mystralkk at gmail.com>
date: Thu Jan 23 12:22:26 2014 +0900
description:
Fixed a bug where Filemanager created a broken link

diffstat:

 public_html/filemanager/index.php |  29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r f47b52ee9704 -r e98a50934dcd public_html/filemanager/index.php
--- a/public_html/filemanager/index.php	Wed Jan 22 20:23:21 2014 +0900
+++ b/public_html/filemanager/index.php	Thu Jan 23 12:22:26 2014 +0900
@@ -158,13 +158,32 @@
 );
 
 // Values to be overridden by Geeklog (system)
-$fileRoot = $_CONF['path_html'] . 'images/library/';
-$fileRoot = str_replace('\\', '/', $fileRoot);
-$docRoot  = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
+$relPaths = array(
+    'Image' => 'images/library/Image/',
+    'Flash' => 'images/library/Flash/',
+    'Media' => 'images/library/Media/',
+    'File'  => 'images/library/File/',
+    'Root'  => 'images/',
+);
 
+$type = isset($_GET['Type']) ? COM_applyFilter($_GET['Type']) : '';
+
+if (!array_key_exists($type, $relPaths)) {
+    $type = 'Image';
+}
+
+$fileRoot   = $_CONF['path_html'] . $relPaths[$type];
+$fileRoot   = str_replace('\\', '/', $fileRoot);
+$docRoot    = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
 $serverRoot = (stripos($fileRoot, $docRoot) === 0);
-preg_match('@\Ahttps?://[^/]+(/.*/)filemanager/index\.php at i', COM_getCurrentURL(), $match);
-$relPath = $match[1] . 'images/library/';
+
+if (preg_match('@\Ahttps?://[^/]+(/.*/)filemanager/index\.php at i', COM_getCurrentURL(), $match)) {
+    $relPath = $match[1];
+} else {
+    $relPath = '/';
+}
+
+$relPath .= $relPaths[$type];
 
 $_FM_CONF['options']['culture']            = COM_getLangIso639Code();
 $_FM_CONF['options']['defaultViewMode']    = $_CONF['filemanager_default_view_mode'];



More information about the geeklog-cvs mailing list