ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 8059


Ignore:
Timestamp:
Aug 19, 2008, 11:17:37 PM (12 years ago)
Author:
ebihara
Message:

#2866:マイフレンド最新レビューがアクセスブロックを考慮していなかったのを修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.12.x/webapp/lib/db/review.php

    r7864 r8059  
    2222    $ids = implode(',', array_map('intval', $friends));
    2323
    24     $sql = 'SELECT * FROM c_review INNER JOIN c_review_comment USING (c_review_id)' .
    25             ' WHERE c_review_comment.c_member_id IN ('.$ids.')' .
    26            ' ORDER BY c_review_comment.r_datetime DESC';
     24    $sql = 'SELECT * FROM c_review INNER JOIN c_review_comment USING (c_review_id)'
     25         . ' WHERE c_review_comment.c_member_id IN (' . $ids . ')'
     26         . ' ORDER BY c_review_comment.r_datetime DESC';
    2727    $list = db_get_all_limit($sql, 0, $limit);
    2828    foreach ($list as $key => $value) {
     
    3434function db_review_c_friend_review_list_more4c_member_id($c_member_id, $page, $page_size)
    3535{
    36     $sql =  "SELECT cm.nickname, cr.c_review_id, cr.title, crc.r_datetime" .
    37             " FROM  c_member AS cm, c_friend AS cf, c_review AS cr, c_review_comment AS crc" .
    38             " WHERE cr.c_review_id = crc.c_review_id " .
    39             " AND cf.c_member_id_to = crc.c_member_id " .
    40             " AND cf.c_member_id_to = cm.c_member_id " .
    41             " AND cf.c_member_id_from = ?".
    42             " ORDER BY crc.r_datetime DESC";
    43     $params = array(intval($c_member_id));
     36    $friends = db_friend_c_member_id_list($c_member_id, true);
     37    if (!$friends) {
     38        return array();
     39    }
     40    $ids = implode(',', array_map('intval', $friends));
     41
     42    $sql = 'SELECT * FROM c_review INNER JOIN c_review_comment USING (c_review_id)'
     43         . ' WHERE c_review_comment.c_member_id IN (' . $ids . ')'
     44         . ' ORDER BY c_review_comment.r_datetime DESC';
    4445    $list = db_get_all_page($sql, $page, $page_size, $params);
    45 
    46     $sql =  "SELECT COUNT(*)" .
    47             " FROM  c_friend AS cf, c_review_comment AS crc" .
    48             " WHERE cf.c_member_id_to = crc.c_member_id" .
    49             " AND cf.c_member_id_from = ?";
    50     $total_num = db_get_one($sql, $params);
     46    foreach ($list as $key => $value) {
     47        $list[$key] += db_member_c_member4c_member_id_LIGHT($value['c_member_id']);
     48    }
     49
     50    $sql = 'SELECT COUNT(*) FROM c_review_comment WHERE c_member_id IN (' . $ids . ')';
     51    $total_num = db_get_one($sql);
    5152
    5253    if ($total_num != 0) {
Note: See TracChangeset for help on using the changeset viewer.