]> git.mjollnir.org Git - s9y.git/commitdiff
Changes to serendipity_displayImageList to allow passing of argument to restrict...
authormgroeninger <mgroeninger>
Wed, 25 May 2005 02:22:30 +0000 (02:22 +0000)
committermgroeninger <mgroeninger>
Wed, 25 May 2005 02:22:30 +0000 (02:22 +0000)
Change to serendipity_displayImageList to use absolute path for images so that function can be used in permalink pages below main directory level.

include/functions_images.inc.php

index 2eea3a3b6d07c1464376077ee2cf2425c7084577..b8967e90d6fdda56a41e34051114acb158535e81 100644 (file)
@@ -869,7 +869,7 @@ function serendipity_calculate_aspect_size($width, $height, $newwidth) {
     return array($newwidth, $newheight);
 }
 
-function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false) {
+function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false, $limit_path = NULL) {
     global $serendipity;
     $sort_row_interval = array(8, 16, 50, 100);
     $sortParams        = array('perpage', 'order', 'ordermode');
@@ -897,7 +897,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
         }
     }
 
-    $serendipity['GET']['only_path']     = serendipity_uploadSecure($serendipity['GET']['only_path'], true);
+    $serendipity['GET']['only_path']     = serendipity_uploadSecure($limit_path . $serendipity['GET']['only_path'], true);
     $serendipity['GET']['only_filename'] = str_replace(array('*', '?'), array('%', '_'), $serendipity['GET']['only_filename']);
 
     $perPage = (!empty($serendipity['GET']['sortorder']['perpage']) ? $serendipity['GET']['sortorder']['perpage'] : $sort_row_interval[0]);
@@ -917,7 +917,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
     $linkPrevious  = '?' . $extraParems . 'serendipity[page]=' . ($page-1);
     $linkNext      = '?' . $extraParems . 'serendipity[page]=' . ($page+1);
     $sort_order    = serendipity_getImageFields();
-    $paths         = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath']);
+    $paths         = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath']. $limit_path);
 
     if (is_null($lineBreak)) {
         $lineBreak = floor(750 / ($serendipity['thumbSize'] + 20));
@@ -938,9 +938,9 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
         <tr>
             <td><?php echo FILTER_DIRECTORY ?></td>
             <td><select name="serendipity[only_path]">
-                    <option value=""><?php echo ALL_DIRECTORIES ?></option>
+                    <option value=""> <?php if (!$limit_path) { echo ALL_DIRECTORIES; } else { echo basename($limit_path);}?></option>
                     <?php foreach ( $paths as $folder ) { ?>
-                    <option <?php echo ($serendipity['GET']['only_path'] == $folder['relpath']) ? 'selected="selected"' : '' ?> value="<?php echo $folder['relpath'] ?>"><?php echo str_repeat('&nbsp;', $folder['depth']*2) . ' '. $folder['name'] ?></option>
+                    <option <?php echo ($serendipity['GET']['only_path'] == $limit_path.$folder['relpath']) ? 'selected="selected"' : '' ?> value="<?php echo $folder['relpath'] ?>"><?php echo str_repeat('&nbsp;', $folder['depth']*2) . ' '. $folder['name'] ?></option>
                     <?php } ?>
                 </select>
             </td>
@@ -1020,13 +1020,13 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
 
             /* If it is an image, and the thumbnail exists */
             if ($is_image && file_exists($img)) {
-                $preview .= '<img src="' . $file['imgsrc'] . '" border="0" title="' . $file['path'] . $file['name'] . '" alt="'. $file['name'] . '" />';
+                $preview .= '<img src="' . $serendipity['serendipityHTTPPath'] . $file['imgsrc'] . '" border="0" title="' . $file['path'] . $file['name'] . '" alt="'. $file['name'] . '" />';
                 if ($url) {
                     $preview = '<a href="'. $url .'&amp;serendipity[image]='. $file['id'] .'">'. $preview .'</a>';
                 }
             } elseif ($is_image && $file['hotlink']) {
                 $sizes = serendipity_calculate_aspect_size($file['dimensions_width'], $file['dimensions_height'], $serendipity['thumbSize']);
-                $preview .= '<img src="' . $file['path'] . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" border="0" title="' . $file['path'] . '" alt="'. $file['name'] . '" />';
+                $preview .= '<img src="' . $serendipity['serendipityHTTPPath'] . $file['path'] . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" border="0" title="' . $file['path'] . '" alt="'. $file['name'] . '" />';
                 if ($url) {
                     $preview = '<a href="'. $url .'&amp;serendipity[image]='. $file['id'] .'">'. $preview .'</a>';
                 }