gimli2 / sigal

It is a free photo gallery written in PHP. This script inspired by simplicity of brilliant MySQL client Adminer from Jakub Vrána. It is completely in only one file. It is very simple to upload it anywhere to hosting and use it in a few seconds. And why don't use this idea for web photo gallery?
Other
2 stars 3 forks source link

restore ability to have no groups ( with no tabs shown). #7

Closed dmahurin closed 9 years ago

dmahurin commented 9 years ago

restore ability to have no groups ( with no tabs shown).

I think my previous change may have been misinterpreted.

Note, these lines are not equivalent. The first is checking for a special case of a single element with an empty string. The replacement required that the first element was never empty. Perhaps ()'s would have made the order of operations clearer. I added ()'s in this pull request to make it clearer.

The purpose of the special case was to allow no grouping (no tabs) at allow with a function like:

function get_groupname($bn) { return ''; }

The above logic change combined with the 'Fix of broken grouping' change broke this functionality.

gimli2 commented 9 years ago

Fine, this was my misunderstanding to the idea of no tabs. I repair it, but it'll be a little bit complicated.

Your change has wrong requirement that if you have only one group it must be with id 0. Eg. if you have only one group "2015" it will not be dispalyed because count of albums is not greater than 1 (it's exactly 1) but index 0 is not set in $albs_by_year array. Only index "2015" is set. So we have to check that only one key irrespectively to its name. I'll commit this update in few minutes.

gimli2 commented 9 years ago

I have recently pushed a fixed version with correct handling of only one group with empty string in name to display gallery with no tabs.