Dotclear


Ignore:
Timestamp:
03/30/10 02:37:23 (13 years ago)
Author:
JcDenis
Message:

pollsFactory 1.1:

  • Fixed order of queries and selections
  • Fixed admin posts list actions
  • Fixed adding polls from new post
  • Fixed pgSQL bugs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/pollsFactory/inc/class.postoption.php

    r2139 r2146  
    110110     public function getOptions($params=array(),$count_only=false) 
    111111     { 
    112           // This limit field to only one and group results on this field. 
    113           $group = array(); 
    114           if (!empty($params['group'])) { 
    115                if (is_array($params['group'])) { 
    116                     foreach($params['group'] as $k => $v) { 
    117                          $group[] = $this->con->escape($v); 
    118                     } 
    119                } 
    120                else { 
    121                     $group[] = $this->con->escape($params['group']); 
    122                } 
    123           } 
    124  
    125112          if ($count_only) { 
    126                if (!empty($group)) { 
    127                     $q = 'SELECT count('.$group[0].') '; 
    128                } 
    129                else { 
    130                     $q = 'SELECT count(O.option_id) '; 
    131                } 
     113               $q = 'SELECT count(O.option_id) '; 
    132114          } 
    133115          else { 
    134                if (!empty($group)) { 
    135                     $q = 'SELECT '.implode(', ',$group).' '; 
    136                } 
    137                else { 
    138                     $q = 'SELECT O.option_id, O.post_id, O.option_meta, '; 
    139  
    140                     if (!empty($params['columns']) && is_array($params['columns'])) { 
    141                          $q .= implode(', ',$params['columns']).', '; 
    142                     } 
    143                     $q .=  
    144                     'O.option_creadt, O.option_upddt, O.option_type, O.option_format, '. 
    145                     'O.option_title, O.option_content, O.option_content_xhtml, '. 
    146                     'O.option_selected, O.option_position, '. 
    147                     'P.blog_id, P.post_type, P.post_title '; 
    148                } 
     116               $q = 'SELECT O.option_id, O.post_id, O.option_meta, '; 
     117 
     118               if (!empty($params['columns']) && is_array($params['columns'])) { 
     119                    $q .= implode(', ',$params['columns']).', '; 
     120               } 
     121               $q .=  
     122               'O.option_creadt, O.option_upddt, O.option_type, O.option_format, '. 
     123               'O.option_title, O.option_content, O.option_content_xhtml, '. 
     124               'O.option_selected, O.option_position, '. 
     125               'P.blog_id, P.post_type, P.post_title '; 
    149126          } 
    150127 
     
    212189               $q .= $params['sql'].' '; 
    213190          } 
    214           # group 
    215           if (!empty($group)) { 
    216                if (!$count_only) { 
    217                     $q .= 'GROUP BY '.implode(', ',$group).' '; 
    218                } 
    219                else { 
    220                     $q .= 'GROUP BY '.$group[0].' '; 
    221                } 
    222           } 
    223191          # order 
    224192          if (!$count_only) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map