changeset 781:6e9e42005701

Cleanups, fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 20 Nov 2014 16:35:30 +0200
parents f8d09e0de027
children c984cff340e3
files msite.inc.php
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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"]));
         }