plugins/gallery/browser.php
changeset 9 ebd7003e73c6
parent 4 ad3b061a1c76
child 10 b38afb86dcad
--- a/plugins/gallery/browser.php	Thu Jul 26 14:43:45 2007 -0400
+++ b/plugins/gallery/browser.php	Thu Aug 09 12:31:24 2007 -0400
@@ -352,7 +352,8 @@
   {
     if ( !isset($first_row['folder_id']) )
     {
-      $first_row['folder_id'] =& $first_row['img_id'];
+      // $first_row['folder_id'] =& $first_row['img_id'];
+      $first_row['folder_id'] = 'NULL';
     }
     if ( !isset($first_row['folder_id']) )
     {
@@ -488,8 +489,21 @@
   
   $per_page = $rows_in_browser * 5;
   
-  $html = paginate($img_query, '{img_id}', $db->numrows($img_query), makeUrl($paths->fullpage, 'sort=' . $sort_column . '&order=' . $sort_order . '&start=%s', true), $start, $per_page, $callers, '<table border="0" cellspacing="8"><tr>', '</tr></table>');
-  echo $html;
+  if ( $db->numrows($img_query) < 1 )
+  {
+    $html = '';
+    if ( $session->user_level >= USER_LEVEL_ADMIN )
+    {
+      $html .= '<p><a href="' . makeUrlNS('Special', 'GalleryUpload', 'folder=' . $first_row['img_id'], true) . '">Upload an image</a></p>';
+    }
+    
+    echo '<p>There are no items in this folder.</p>' . $html;
+  }
+  else
+  {
+    $html = paginate($img_query, '{img_id}', $db->numrows($img_query), makeUrl($paths->fullpage, 'sort=' . $sort_column . '&order=' . $sort_order . '&start=%s', true), $start, $per_page, $callers, '<table border="0" cellspacing="8"><tr>', '</tr></table>');
+    echo $html;
+  }
   
   if ( $session->user_level >= USER_LEVEL_ADMIN )
   {