From 54e5a1084628696d4a694c9325e4d55aaa41d82c Mon Sep 17 00:00:00 2001
From: Bartek Przybylski <bart.p.pl@gmail.com>
Date: Sun, 2 Oct 2011 13:52:04 +0200
Subject: [PATCH] avoid creating empty albums, removing od depreciated code
 openings

---
 apps/gallery/lib_scanner.php          | 2 +-
 apps/gallery/templates/index.php      | 2 +-
 apps/gallery/templates/view_album.php | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib_scanner.php
index e9a022c606..fe14b68add 100644
--- a/apps/gallery/lib_scanner.php
+++ b/apps/gallery/lib_scanner.php
@@ -30,7 +30,7 @@ class OC_GALLERY_SCANNER {
     $albums[] = $current_album;
     $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE "uid_owner" = ? AND "album_name" = ?');
     $result = $stmt->execute(array(OC_User::getUser(), $current_album['name']));
-    if ($result->numRows() == 0) {
+    if ($result->numRows() == 0 && count($current_album['images'])) {
       $stmt = OC_DB::prepare('INSERT OR REPLACE INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES (?, ?)');
       $stmt->execute(array(OC_User::getUser(), $current_album['name']));
     }
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index 9786990755..0e89e44876 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -1,4 +1,4 @@
-<?
+<?php
 OC_Util::addStyle('gallery', 'styles');
 OC_Util::addScript('gallery', 'albums');
 OC_Util::addScript('gallery', 'album_cover');
diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php
index c1298a22c2..ea2969e011 100644
--- a/apps/gallery/templates/view_album.php
+++ b/apps/gallery/templates/view_album.php
@@ -1,4 +1,4 @@
-<?
+<?php
 OC_Util::addStyle('gallery', 'styles');
 OC_Util::addScript('gallery', 'album_cover');
 OC_Util::addScript( 'files_imageviewer', 'lightbox' );
@@ -9,11 +9,11 @@ OC_Util::addStyle( 'files_imageviewer', 'lightbox' );
   <a href="?"><input type="button" value="Back" /></a><br/>
 </div>
 <div id="gallery_list">
-<?
+<?php
 foreach ($_['photos'] as $a) {
 ?>
-<a onclick="javascript:viewImage('/','<? echo $a; ?>');"><img src="ajax/thumbnail.php?img=<? echo $a ?>"></a>
-<?
+<a onclick="javascript:viewImage('/','<?php echo $a; ?>');"><img src="ajax/thumbnail.php?img=<?php echo $a ?>"></a>
+<?php
   }
 ?>
 
-- 
GitLab