Changeset 2326

Show
Ignore:
Timestamp:
05/14/08 09:22:20 (6 months ago)
Author:
takayama
Message:

Fixed BugId:78122
* Not join to mt_permission
* Added function that fetches mt_permission

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-38/php/lib/block.mtcomments.php

    r2294 r2326  
    3737        if ($comment['comment_commenter_id']) { 
    3838            $commenter = $ctx->mt->db->fetch_author($comment['comment_commenter_id']); 
     39            $permission = $ctx->mt->db->fetch_permission(array('blog_id' => $comment['comment_blog_id'], 'id' => $comment['comment_commenter_id'])); 
     40            $commenter = array_merge($commenter, $permission[0]); 
    3941            $ctx->stash('commenter', $commenter); 
    4042        } else { 
  • branches/release-38/php/lib/mtdb_base.php

    r2285 r2326  
    14281428        if ($sql = $this->include_exclude_blogs($args)) { 
    14291429            $blog_join = 'join mt_permission on permission_author_id = author_id and permission_blog_id ' . $sql; 
    1430             $extend_column = ', mt_permission.*'; 
     1430            $unique_filter = 'distinct'; 
    14311431        } elseif (isset($args['blog_id'])) { 
    14321432            $blog_id = intval($args['blog_id']); 
    14331433            $blog_join = "join mt_permission on permission_author_id = author_id and permission_blog_id = $blog_id"; 
    1434             $extend_column = ', mt_permission.*'; 
    14351434        } 
    14361435 
     
    16661665 
    16671666        return $authors; 
     1667    } 
     1668 
     1669    function &fetch_permission($args) { 
     1670        if ($sql = $this->include_exclude_blogs($args)) { 
     1671            $blog_filter = 'permission_blog_id ' . $sql; 
     1672        } elseif (isset($args['blog_id'])) { 
     1673            $blog_id = intval($args['blog_id']); 
     1674            $blog_filter = "and permission_blog_id = $blog_id"; 
     1675        } 
     1676        if (isset($args['id'])) { 
     1677          $id_filter = 'and permission_author_id in ('.$args['id'].')'; 
     1678        } 
     1679 
     1680        $sql = "select 
     1681                    * 
     1682                from 
     1683                    mt_permission 
     1684                where 
     1685                    1 = 1 
     1686                    $blog_filter 
     1687                    $id_filter"; 
     1688 
     1689        $result = $this->get_results($sql, ARRAY_A); 
     1690        return $result; 
    16681691    } 
    16691692