# HG changeset patch # User Matti Hamalainen # Date 1416494130 -7200 # Node ID 6e9e420057016098a8562b8d0e10ae867181343c # Parent f8d09e0de027b1251eb617a8a57e91b0854a6741 Cleanups, fixes. diff -r f8d09e0de027 -r 6e9e42005701 msite.inc.php --- a/msite.inc.php Thu Nov 20 16:35:15 2014 +0200 +++ b/msite.inc.php Thu Nov 20 16:35:30 2014 +0200 @@ -695,9 +695,11 @@ $previewURL = stGetSetting("previewURL"); $thumbDir = stGetSetting("thumbnailSubDir"); + $filename = $entry["filename"]; + // Data for the actual entry file $res["previewType"] = ($entry["preview_type"] != EPREV_NONE) ? $entry["preview_type"] : $compo["preview_type"]; - $res["entryFile"] = stMakePath(FALSE, FALSE, array($entryPath, $compo["cpath"], $entry["filename"])); + $res["entryFile"] = stMakePath(FALSE, FALSE, array($entryPath, $compo["cpath"], $filename)); if ($fullData) { $res["entrySize"] = @filesize($res["entryFile"]); @@ -707,7 +709,7 @@ switch ($res["previewType"]) { case EPREV_IMAGE: - $res["fileBase"] = stMakePath(FALSE, "_sshot", array($entry["filename"])); + $res["fileBase"] = stMakePath(FALSE, "_sshot", array($filename)); $res["preferType"] = "PNG"; $fileTypeList = array( "PNG" => array(".png", ".PNG"), @@ -717,7 +719,7 @@ break; case EPREV_AUDIO: - $res["fileBase"] = stMakePath(FALSE, "_sample", array($entry["filename"])); + $res["fileBase"] = stMakePath(FALSE, "_sample", array($filename)); $res["preferType"] = "PNG"; $fileTypeList = array( "MP3" => array(".mp3", ".MP3"), @@ -730,20 +732,20 @@ } // Find the preview file(s) - foreach ($fileTypeList as $ftype => $fexts) + foreach ($fileTypeList as $fileType => $fileExts) { - foreach ($fexts as $fext) + foreach ($fileExts as $fext) { $filename = stMakePath(FALSE, $fext, array($previewPath, $compo["cpath"], $res["fileBase"])); if ($probePreview == FALSE || file_exists($filename)) { - $res["previewFileType"] = $ftype; + $res["previewFileType"] = $fileType; $res["previewPath"] = $filename; $res["previewURL"] = stMakePath(TRUE, $fext, array($previewURL, $compo["cpath"], $res["fileBase"])); if ($res["previewType"] == EPREV_IMAGE) { - $res["thumbPath"] = stMakePath(TRUE, $fext, array($previewPath, $compo["cpath"], $thumbDir, $res["fileBase"])); + $res["thumbPath"] = stMakePath(FALSE, $fext, array($previewPath, $compo["cpath"], $thumbDir, $res["fileBase"])); $res["thumbURL"] = stMakePath(TRUE, $fext, array($previewURL, $compo["cpath"], $thumbDir, $res["fileBase"])); }