Ignore:
Timestamp:
Feb 6, 2012, 9:22:13 PM (12 years ago)
Author:
mistic100
Message:

merge r12872 from trunk
bug:2540 When default photos order is only by rank, failure outside albums

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/admin/configuration.php

    r11978 r13037  
    135135          $order_by = array();
    136136          $order_by_inside_category = array();
     137         
    137138          for ($i=0; $i<count($_POST['order_by_field']); $i++)
    138139          {
    139             if ($i>5) continue;
    140             if ($_POST['order_by_field'][$i] == '')
     140            if ( $i >= (count($sort_fields)-1) ) break; // limit to the number of available parameters
     141            if ( empty($_POST['order_by_field'][$i]) )
    141142            {
    142143              array_push($page['errors'], l10n('No field selected'));
     144              break;
    143145            }
    144146            else
    145147            {
     148              // there is no rank outside categories
    146149              if ($_POST['order_by_field'][$i] != 'rank')
    147150              {
     
    151154            }
    152155          }
     156          // must define a default order_by if user want to order by rank only
     157          if ( count($order_by) == 0 )
     158          {
     159            $order_by = array('id ASC');
     160          }
     161         
    153162          $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by);
    154163          $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category);
     164          unset($_POST['order_by_field']);
    155165        }
    156166      }
Note: See TracChangeset for help on using the changeset viewer.