Changeset 2468:d7fda5a0bd39 for inc/core
- Timestamp:
- 10/21/13 09:08:36 (12 years ago)
- 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. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.blog.php
r2313 r2468 771 771 if ($count_only) 772 772 { 773 $strReq = 'SELECT count( P.post_id) ';773 $strReq = 'SELECT count(DISTINCT P.post_id) '; 774 774 } 775 775 elseif (!empty($params['sql_only'])) … … 791 791 } 792 792 793 793 794 $strReq = 794 795 'SELECT P.post_id, P.blog_id, P.user_id, P.cat_id, post_dt, '. … … 807 808 'LEFT OUTER JOIN '.$this->prefix.'category C ON P.cat_id = C.cat_id '; 808 809 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 820 810 if (!empty($params['from'])) { 821 811 $strReq .= $params['from'].' '; … … 950 940 if (isset($params['media'])) { 951 941 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 .= ")"; 954 952 } 955 953 956 954 if (!empty($params['sql'])) { 957 955 $strReq .= $params['sql'].' '; 958 }959 960 if (!$count_only && isset($params['media'])) {961 $strReq .= ' GROUP BY P.post_id ';962 956 } 963 957 -
inc/core/class.dc.blog.php
r2318 r2468 4 4 # This file is part of Dotclear 2. 5 5 # 6 # Copyright (c) 2003-201 3Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 81 81 $this->desc = $b->blog_desc; 82 82 $this->url = $b->blog_url; 83 $this->host = http::getHostFromURL($this->url);83 $this->host = preg_replace('|^([a-z]{3,}://)(.*?)/.*$|','$1$2',$this->url); 84 84 $this->creadt = strtotime($b->blog_creadt); 85 85 $this->upddt = strtotime($b->blog_upddt); … … 865 865 866 866 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'])." "; 868 868 } 869 869 … … 963 963 $strReq .= 'ORDER BY post_dt DESC '; 964 964 } 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 } 969 968 } 970 969
Note: See TracChangeset
for help on using the changeset viewer.