Dotclear

Changeset 2468:d7fda5a0bd39 for inc/core


Ignore:
Timestamp:
10/21/13 09:08:36 (12 years ago)
Author:
Dsls
Branch:
twig
Children:
2593:6741802596a0, 2609:c26642f775e2
Parents:
2321:3ab5e6c3d301 (diff), 2466:e42d3233f080 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with 2.6

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.blog.php

    r2313 r2468  
    771771          if ($count_only) 
    772772          { 
    773                $strReq = 'SELECT count(P.post_id) '; 
     773               $strReq = 'SELECT count(DISTINCT P.post_id) '; 
    774774          } 
    775775          elseif (!empty($params['sql_only']))  
     
    791791               } 
    792792                
     793 
    793794               $strReq = 
    794795               'SELECT P.post_id, P.blog_id, P.user_id, P.cat_id, post_dt, '. 
     
    807808          'LEFT OUTER JOIN '.$this->prefix.'category C ON P.cat_id = C.cat_id '; 
    808809 
    809           if (isset($params['media'])) { 
    810                if ($params['media'] == '0') { 
    811                     $strReq .= 'LEFT OUTER JOIN '.$this->prefix.'post_media M on P.post_id = M.post_id '; 
    812                } else { 
    813                     $strReq .= 'INNER JOIN '.$this->prefix.'post_media M on P.post_id = M.post_id '; 
    814                } 
    815                if (isset($params['link_type'])) { 
    816                     $strReq .= " and M.link_type ".$this->con->in($params['link_type'])." "; 
    817                } 
    818           } 
    819            
    820810          if (!empty($params['from'])) { 
    821811               $strReq .= $params['from'].' '; 
     
    950940          if (isset($params['media'])) { 
    951941               if ($params['media'] == '0') { 
    952                     $strReq .= ' AND M.post_id IS NULL '; 
    953                } 
     942                    $strReq .= 'AND NOT '; 
     943               } else { 
     944                    $strReq .= 'AND ';                  
     945               } 
     946               $strReq .= 'EXISTS (SELECT M.post_id FROM '.$this->prefix.'post_media M '. 
     947                    'WHERE M.post_id = P.post_id '; 
     948               if (isset($params['link_type'])) { 
     949                    $strReq .= " AND M.link_type ".$this->con->in($params['link_type'])." "; 
     950               } 
     951               $strReq .= ")"; 
    954952          } 
    955953 
    956954          if (!empty($params['sql'])) { 
    957955               $strReq .= $params['sql'].' '; 
    958           } 
    959            
    960           if (!$count_only && isset($params['media'])) { 
    961                $strReq .= ' GROUP BY P.post_id '; 
    962956          } 
    963957 
  • inc/core/class.dc.blog.php

    r2318 r2468  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    8181               $this->desc = $b->blog_desc; 
    8282               $this->url = $b->blog_url; 
    83                $this->host = http::getHostFromURL($this->url); 
     83               $this->host = preg_replace('|^([a-z]{3,}://)(.*?)/.*$|','$1$2',$this->url); 
    8484               $this->creadt = strtotime($b->blog_creadt); 
    8585               $this->upddt = strtotime($b->blog_upddt); 
     
    865865           
    866866          if (!empty($params['user_id'])) { 
    867                $strReq .= "AND U.user_id = '".$this->con->escape($params['user_id'])."' "; 
     867               $strReq .= "AND U.user_id ".$this->con->in($params['user_id'])." "; 
    868868          } 
    869869           
     
    963963                    $strReq .= 'ORDER BY post_dt DESC '; 
    964964               } 
    965           } 
    966            
    967           if (!$count_only && !empty($params['limit'])) { 
    968                $strReq .= $this->con->limit($params['limit']); 
     965               if (!empty($params['limit'])) { 
     966                    $strReq .= $this->con->limit($params['limit']); 
     967               } 
    969968          } 
    970969           
Note: See TracChangeset for help on using the changeset viewer.

Sites map