plugins/gallery/browser.php
changeset 39 e9a7e37bdadd
parent 38 512951548faa
child 42 7c6e2e97aa08
--- a/plugins/gallery/browser.php	Wed Aug 26 23:37:37 2009 -0400
+++ b/plugins/gallery/browser.php	Sun Aug 01 12:42:21 2010 -0400
@@ -16,15 +16,7 @@
 ## BROWSER INTERFACE
 ##
 
-$plugins->attachHook('base_classes_initted', '
-  global $paths;
-    $paths->add_page(Array(
-      \'name\'=>\'Image gallery\',
-      \'urlname\'=>\'Gallery\',
-      \'namespace\'=>\'Special\',
-      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
-      ));
-  ');
+$plugins->attachHook('session_started', 'register_special_page("Gallery", "Image gallery");');
 
 /**
  * Class to handle building the HTML for gallery pages. Called by the pagination function.
@@ -281,7 +273,8 @@
     
     $first_row = $row;
     
-    $db->sql_data_seek(0, $img_query);
+    if ( $db->numrows($img_query) > 0 )
+      $db->sql_data_seek(0, $img_query);
     
     /* $folders = $folders_old; */
   }
@@ -430,7 +423,8 @@
         </div>
         <div class="select-pad">&nbsp;</div>';
   
-  $db->sql_data_seek(0, $img_query);
+  if ( $db->numrows($img_query) > 0 )
+	$db->sql_data_seek(0, $img_query);
   
   //
   // Main fetcher
@@ -452,7 +446,14 @@
   $per_page = 25;
   
   $html = paginate($img_query, '{img_id}', $db->numrows($img_query), makeUrl($paths->fullpage, 'sort=' . $sort_column . '&order=' . $sort_order . '&start=%s', false), $start, $per_page, $callers, '<ul class="snapr-gallery">', '</ul><span class="menuclear"></span>');
-  echo $html;
+  if ( empty($html) )
+  {
+  	  echo '<h2 class="emptymessage">No images</h2>';
+  }
+  else
+  {
+	  echo $html;
+  }
   
   if ( $session->user_level >= USER_LEVEL_ADMIN )
   {