summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/albums.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-09-21 11:35:27 -0700
committerBharat Mediratta <bharat@menalto.com>2009-09-21 11:35:27 -0700
commita6581ede0b7a50c6159eb5d36cf6be340a072609 (patch)
tree9be79884a3c40b037da4e76d64d5bfefc7ea9d39 /modules/gallery/controllers/albums.php
parent3ac3d1e520f95cc859d990000561dbb727411e0c (diff)
Fix Item_Model::get_position() so that our sort is stable when the comparison
row has a null value in the sort field. Fix for #627 Note: this changes get_position() to take an Item_Model instead of an id!
Diffstat (limited to 'modules/gallery/controllers/albums.php')
-rw-r--r--modules/gallery/controllers/albums.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 183c26d0..3ea08538 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -39,12 +39,15 @@ class Albums_Controller extends Items_Controller {
$show = $this->input->get("show");
if ($show) {
- $index = $album->get_position($show);
- $page = ceil($index / $page_size);
- if ($page == 1) {
- url::redirect($album->abs_url());
- } else {
- url::redirect($album->abs_url("page=$page"));
+ $child = ORM::factory("item", $show);
+ $index = $album->get_position($child);
+ if ($index) {
+ $page = ceil($index / $page_size);
+ if ($page == 1) {
+ url::redirect($album->abs_url());
+ } else {
+ url::redirect($album->abs_url("page=$page"));
+ }
}
}