Changeset 15950


Ignore:
Timestamp:
06/22/12 23:41:07 (7 years ago)
Author:
mistic100
Message:

bug 2659: Possible misconfiguration of ORDER BY + missing language string

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r14649 r15950  
    146146      { 
    147147        if ( !empty($_POST['order_by']) ) 
    148         {          
    149           // limit to the number of available parameters 
    150           $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2)); 
    151            
    152           // there is no rank outside categories 
    153           unset($order_by[ array_search('rank ASC', $order_by) ]); 
    154            
    155           // must define a default order_by if user want to order by rank only 
    156           if ( count($order_by) == 0 ) 
     148        { 
     149          foreach ($_POST['order_by'] as $i => $val) 
    157150          { 
    158             $order_by = array('id ASC'); 
     151            if (empty($val)) unset($_POST['order_by'][$i]); 
    159152          } 
    160            
    161           $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); 
    162           $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); 
     153          if ( !count($_POST['order_by']) ) 
     154          { 
     155            array_push($page['errors'], l10n('No order field selected')); 
     156          } 
     157          else 
     158          { 
     159            // limit to the number of available parameters 
     160            $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2)); 
     161             
     162            // there is no rank outside categories 
     163            if ( ($i = array_search('rank ASC', $order_by)) !== false) 
     164            { 
     165              unset($order_by[$i]); 
     166            } 
     167             
     168            // must define a default order_by if user want to order by rank only 
     169            if ( count($order_by) == 0 ) 
     170            { 
     171              $order_by = array('id ASC'); 
     172            } 
     173             
     174            $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); 
     175            $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); 
     176          } 
    163177        } 
    164178        else 
    165179        { 
    166           array_push($page['errors'], l10n('No field selected')); 
     180          array_push($page['errors'], l10n('No order field selected')); 
    167181        } 
    168182      } 
  • trunk/language/en_UK/admin.lang.php

    r15659 r15950  
    463463$lang['No user to send notifications by mail.'] = "No user to be notified by mail."; 
    464464$lang['no write access'] = "no write access"; 
     465$lang['No order field selected'] = 'No order field selected'; 
    465466$lang['none'] = "none"; 
    466467$lang['None'] = 'None'; 
  • trunk/language/fr_FR/admin.lang.php

    r15659 r15950  
    923923$lang['Edit photo'] = 'Éditer la photo'; 
    924924$lang['create a new site'] = 'créer un nouveau site'; 
     925$lang['No order field selected'] = 'Aucun critère de tri sélectionné'; 
    925926?> 
Note: See TracChangeset for help on using the changeset viewer.