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.pollsfactory.php

    r2139 r2146  
    4747          if($ident > 0) 
    4848          { 
    49                $params['option_type'] = 'pollsresponse'; 
    50                $params['post_id'] = $poll_id; 
    51                $params['option_title'] = $this->con->escape(http::realIP()); 
    52  
    53                $rs = $this->getOptions($params); 
     49               $rs = $this->con->select( 
     50                    'SELECT option_id '. 
     51                    'FROM '.$this->table.' '. 
     52                    'WHERE post_id = '.$poll_id.' '. 
     53                    "AND option_title = '".$this->con->escape(http::realIP())."' ". 
     54                    "AND option_type = 'pollsresponse' ". 
     55                    $this->con->limit(1) 
     56               ); 
    5457 
    5558               if (!$rs->isEmpty()) $chk = true; 
     
    7679               "AND option_type = 'pollsresponse' ". 
    7780               'GROUP BY option_title, post_id '. 
    78                'ORDER BY option_upddt DESC '. 
     81               'ORDER BY option_title DESC '. 
    7982               $q 
    8083          ); 
     
    8487     public function countVotes($poll_id) 
    8588     { 
    86           $params['option_type'] = 'pollsresponse'; 
    87           $params['post_id'] = (integer) $poll_id; 
    88           $params['group'] = 'option_title'; 
     89          $poll_id = (integer) $poll_id; 
    8990 
    90           $rs = $this->getOptions($params); 
    91            
    92           return $rs->count(); 
     91          return $this->con->select( 
     92               'SELECT option_title '. 
     93               'FROM '.$this->table.' '. 
     94               'WHERE post_id = '.$poll_id.' '. 
     95               "AND option_type = 'pollsresponse' ". 
     96               'GROUP BY option_title ' 
     97          )->count(); 
    9398     } 
    9499 
Note: See TracChangeset for help on using the changeset viewer.

Sites map