Merging in changes (again?) from Scribus.
authorDan
Sat, 16 Feb 2008 23:10:17 -0500
changeset 20 d8a281557365
parent 17 ecb96b051d08 (diff)
parent 18 c1c398349651 (current diff)
child 21 0475c9ed1386
Merging in changes (again?) from Scribus.
--- a/plugins/gallery/browser.php	Sat Feb 16 23:07:31 2008 -0500
+++ b/plugins/gallery/browser.php	Sat Feb 16 23:10:17 2008 -0500
@@ -118,26 +118,10 @@
   // Determine number of pictures per page
   $template->load_theme();
   
-  global $theme;
-  $fn = ENANO_ROOT . '/themes/' . $template->theme . '/theme.cfg';
-  require( $fn );
-  if ( isset($theme['snapr_gallery_rows']) )
-  {
-    $rows_in_browser = intval($theme['snapr_gallery_rows']);
-    if ( empty($rows_in_browser) )
-    {
-      $rows_in_browser = 5;
-    }
-  }
-  else
-  {
-    $rows_in_browser = 5;
-  }
-  
   $where = 'WHERE folder_parent IS NULL ' . "\n  ORDER BY is_folder DESC, $sort_column $sort_order, img_title ASC";
   $parms = $paths->getAllParams();
   
-  $sql = "SELECT img_id, img_title, is_folder FROM ".table_prefix."gallery $where;";
+  $sql = "SELECT img_id, img_title, is_folder, 'NULL' AS folder_id FROM ".table_prefix."gallery $where;";
   
   // Breadcrumb browser
   $breadcrumbs = array();
@@ -330,6 +314,7 @@
   {
     if ( !isset($first_row['folder_id']) )
     {
+      //die('FALLING<pre>' . print_r($first_row, true) . '</pre>');
       $first_row['folder_id'] =& $first_row['img_id'];
     }
     if ( !isset($first_row['folder_id']) )
--- a/plugins/gallery/search.php	Sat Feb 16 23:07:31 2008 -0500
+++ b/plugins/gallery/search.php	Sat Feb 16 23:10:17 2008 -0500
@@ -156,7 +156,7 @@
               ' . $text . '
             </td>
             <td valign="top" style="text-align: right; width: 80px; padding-left: 10px;">
-              <a href="' . makeUrlNS('Image', $row['img_id']) . '"><img alt="[thumbnail]" src="' . makeUrlNS('Special', "GalleryFetcher/thumb/{$row['img_id']}") . '" /></a>
+              <a href="' . makeUrlNS('Gallery', $row['img_id']) . '"><img alt="[thumbnail]" src="' . makeUrlNS('Special', "GalleryFetcher/thumb/{$row['img_id']}") . '" /></a>
             </td>
           </tr>
         </table>
--- a/plugins/gallery/upload.php	Sat Feb 16 23:07:31 2008 -0500
+++ b/plugins/gallery/upload.php	Sat Feb 16 23:10:17 2008 -0500
@@ -833,10 +833,13 @@
             
             // Create thumbnail image
             $thumb_filename = ENANO_ROOT . '/cache/' . $stored_name . '-thumb.jpg';
-            if ( !unlink($thumb_filename) )
+            if ( file_exists($thumb_filename) )
             {
-              $errors[] = "Could not delete $thumb_filename";
-              break 2;
+              if ( !unlink($thumb_filename) )
+              {
+                $errors[] = "Could not delete $thumb_filename";
+                break 2;
+              }
             }
             
             if ( !scale_image($store, $thumb_filename, 80, 80) )
@@ -847,10 +850,13 @@
             
             // Create preview image
             $preview_filename = ENANO_ROOT . '/cache/' . $stored_name . '-preview.jpg';
-            if ( !unlink($preview_filename) )
+            if ( file_exists($preview_filename) )
             {
-              $errors[] = "Could not delete $preview_filename";
-              break 2;
+              if ( !unlink($preview_filename) )
+              {
+                $errors[] = "Could not delete $preview_filename";
+                break 2;
+              }
             }
             
             if ( !scale_image($store, $preview_filename, 640, 640) )