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

Changeset 9335


Ignore:
Timestamp:
Nov 21, 2008, 11:54:04 PM (12 years ago)
Author:
ebihara
Message:

#1474:revert r9273, r9267, r9247, r9219 (「トピック一覧のカメラアイコンの表示条件が統一されていない」変更についての取り消し)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.10.x/webapp/lib/db/commu.php

    r9303 r9335  
    516516
    517517    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
    518         $sql = 'SELECT cct.c_commu_topic_id , cct.name, MAX(cctc.r_datetime) as r_datetime , cct.c_commu_id'
    519              . ' , max(cctc.image_filename1) as image_filename1, max(cctc.image_filename2) as image_filename2, max(cctc.image_filename3) as image_filename3'
    520              . ' FROM c_commu_topic_comment as cctc , c_commu_topic as cct'
    521              . ' WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id'
    522              . ' AND cct.event_flag = ?'
    523              . ' AND cct.c_commu_id = ?'
    524              . ' group by cct.c_commu_topic_id, cct.name, cct.c_commu_id'
    525              . ' order by r_datetime desc';
     518        $sql = "SELECT cct.c_commu_topic_id , cct.name, MAX(cctc.r_datetime) as r_datetime , cct.c_commu_id" .
     519                " , max(cctc.image_filename1) as image_filename1, max(cctc.image_filename2) as image_filename2, max(cctc.image_filename3) as image_filename3 " .
     520                " FROM c_commu_topic_comment as cctc , c_commu_topic as cct" .
     521                " WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id " .
     522                " AND cct.event_flag = ?".
     523                " AND cct.c_commu_id = ?".
     524                " group by cct.c_commu_topic_id, cct.name, cct.c_commu_id " .
     525                " order by r_datetime desc ";
    526526    } else {
    527         $sql = 'SELECT cct.c_commu_topic_id , cct.name, MAX(cctc.r_datetime) as r_datetime , cct.c_commu_id'
    528              . ' , cctc.image_filename1, cctc.image_filename2, cctc.image_filename3'
    529              . ' FROM c_commu_topic_comment as cctc , c_commu_topic as cct'
    530              . ' WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id'
    531              . ' AND cct.event_flag = ?'
    532              . ' AND cct.c_commu_id = ?'
    533              . ' group by cct.c_commu_topic_id'
    534              . ' order by r_datetime desc';
     527        $sql = "SELECT cct.c_commu_topic_id , cct.name, MAX(cctc.r_datetime) as r_datetime , cct.c_commu_id " .
     528                " , cctc.image_filename1, cctc.image_filename2, cctc.image_filename3 " .
     529                " FROM c_commu_topic_comment as cctc , c_commu_topic as cct" .
     530                " WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id " .
     531                " AND cct.event_flag = ?".
     532                " AND cct.c_commu_id = ?".
     533                " group by cct.c_commu_topic_id " .
     534                " order by r_datetime desc ";
    535535    }
    536536    $params = array((bool)$event_flag, intval($c_commu_id));
     
    11741174    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    11751175    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
    1176         $sql = 'SELECT sub_cct_tbl.c_commu_topic_id, cct.c_commu_id, sub_cct_tbl.r_datetime, cct.c_member_id'
    1177              . ' , max(cctc.image_filename1) as image_filename1, max(cctc.image_filename2) as image_filename2, max(cctc.image_filename3) as image_filename3'
    1178              . ' FROM ('
    1179              .     ' SELECT cct.c_commu_topic_id, MAX(cctc.r_datetime) as r_datetime'
    1180              .     ' FROM'
    1181              .         ' c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint
    1182              .     ' WHERE'
    1183              .         ' cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1184              .     ' GROUP BY cct.c_commu_topic_id'
    1185              .     ') as sub_cct_tbl, c_commu_topic_comment as cctc , c_commu_topic as cct'
    1186              . ' WHERE'
    1187              . ' cct.c_commu_topic_id=sub_cct_tbl.c_commu_topic_id'
    1188              . ' AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1189              . ' AND cctc.r_datetime=sub_cct_tbl.r_datetime'
    1190              . ' ORDER BY r_datetime DESC';
     1176        $sql = 'SELECT sub_cct_tbl.c_commu_topic_id, cct.c_commu_id, sub_cct_tbl.r_datetime, cct.c_member_id'.
     1177            ' FROM (' .
     1178                    ' SELECT cct.c_commu_topic_id, MAX(cctc.r_datetime) as r_datetime' .
     1179                    ' FROM' .
     1180                        ' c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint .
     1181                    ' WHERE ' .
     1182                        ' cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     1183                    ' GROUP BY cct.c_commu_topic_id' .
     1184                    ') as sub_cct_tbl, c_commu_topic_comment as cctc , c_commu_topic as cct' .
     1185            ' WHERE' .
     1186                ' cct.c_commu_topic_id=sub_cct_tbl.c_commu_topic_id' .
     1187                ' AND cctc.c_commu_topic_id = cct.c_commu_topic_id ' .
     1188                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
     1189            ' ORDER BY r_datetime DESC';
    11911190    } else {
    1192         $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'
    1193              . ' , cctc.image_filename1, cctc.image_filename2, cctc.image_filename3'
    1194              . ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint
    1195              . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1196              . ' GROUP BY cctc.c_commu_topic_id'
    1197              . ' ORDER BY r_datetime DESC';
     1191        $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
     1192            ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     1193            ' GROUP BY cctc.c_commu_topic_id'.
     1194            ' ORDER BY r_datetime DESC';
    11981195    }
    11991196    $c_commu_topic_list = db_get_all_limit($sql, 0, $limit);
     
    12031200        $c_commu_topic_list[$key]['nickname'] = $c_member['nickname'];
    12041201
    1205         $sql = 'SELECT number FROM c_commu_topic_comment'
    1206              . ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
     1202        $sql = 'SELECT number, image_filename1, image_filename2, image_filename3' .
     1203               ' FROM c_commu_topic_comment' .
     1204               ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
    12071205        $params = array(intval($value['c_commu_topic_id']), $value['r_datetime']);
    12081206        $temp = db_get_row($sql, $params);
     
    12181216
    12191217        $c_commu_topic_list[$key]['number'] = $number;
     1218        $c_commu_topic_list[$key]['image_filename1'] = $temp['image_filename1'];
     1219        $c_commu_topic_list[$key]['image_filename2'] = $temp['image_filename2'];
     1220        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    12201221        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
    12211222        $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
     
    12361237    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    12371238    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
    1238         $sql = 'SELECT sub_cct_tbl.c_commu_topic_id, cct.c_commu_id, sub_cct_tbl.r_datetime, cct.c_member_id'
    1239              . ' , max(cctc.image_filename1) as image_filename1, max(cctc.image_filename2) as image_filename2, max(cctc.image_filename3) as image_filename3'
    1240              . ' FROM ('
    1241              .     ' SELECT cct.c_commu_topic_id, MAX(cctc.r_datetime) as r_datetime'
    1242              .     ' FROM'
    1243              .         ' c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint
    1244              .     ' WHERE'
    1245              .         ' cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1246              .     ' GROUP BY cct.c_commu_topic_id'
    1247              .     ') as sub_cct_tbl, c_commu_topic_comment as cctc , c_commu_topic as cct'
    1248              . ' WHERE'
    1249              . ' cct.c_commu_topic_id=sub_cct_tbl.c_commu_topic_id'
    1250              . ' AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1251              . ' AND cctc.r_datetime=sub_cct_tbl.r_datetime'
    1252              . ' ORDER BY r_datetime DESC';
     1239        $sql = 'SELECT sub_cct_tbl.c_commu_topic_id, cct.c_commu_id, sub_cct_tbl.r_datetime, cct.c_member_id'.
     1240            ' FROM (' .
     1241                    ' SELECT cct.c_commu_topic_id, MAX(cctc.r_datetime) as r_datetime' .
     1242                    ' FROM' .
     1243                        ' c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint .
     1244                    ' WHERE ' .
     1245                        ' cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     1246                    ' GROUP BY cct.c_commu_topic_id' .
     1247                    ') as sub_cct_tbl, c_commu_topic_comment as cctc , c_commu_topic as cct' .
     1248            ' WHERE' .
     1249                ' cct.c_commu_topic_id=sub_cct_tbl.c_commu_topic_id' .
     1250                ' AND cctc.c_commu_topic_id = cct.c_commu_topic_id ' .
     1251                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
     1252            ' ORDER BY r_datetime DESC';
    12531253    } else {
    1254         $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'
    1255              . ' , cctc.image_filename1, cctc.image_filename2, cctc.image_filename3'
    1256              . ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint
    1257              . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'
    1258              . ' GROUP BY cctc.c_commu_topic_id'
    1259              . ' ORDER BY r_datetime DESC';
     1254        $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
     1255            ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     1256            ' GROUP BY cctc.c_commu_topic_id'.
     1257            ' ORDER BY r_datetime DESC';
    12601258    }
    12611259    $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit);
     1260
    12621261    foreach ($c_commu_topic_list as $key => $value) {
    12631262        $c_member = db_common_c_member4c_member_id_LIGHT($value['c_member_id']);
    12641263        $c_commu_topic_list[$key]['nickname'] = $c_member['nickname'];
    12651264
    1266         $sql = 'SELECT number FROM c_commu_topic_comment'
    1267              . ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
     1265        $sql = 'SELECT number, image_filename1, image_filename2, image_filename3' .
     1266               ' FROM c_commu_topic_comment ' .
     1267               ' WHERE c_commu_topic_id = ? AND r_datetime = ?';
    12681268        $params = array(intval($value['c_commu_topic_id']), $value['r_datetime']);
    12691269        $temp = db_get_row($sql, $params);
     
    12791279
    12801280        $c_commu_topic_list[$key]['number'] = $number;
     1281        $c_commu_topic_list[$key]['image_filename1'] = $temp['image_filename1'];
     1282        $c_commu_topic_list[$key]['image_filename2'] = $temp['image_filename2'];
     1283        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    12811284        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
    12821285        $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
    12831286    }
    12841287
    1285     $sql = 'SELECT count(DISTINCT ct.c_commu_topic_id)'
    1286          . ' FROM c_commu_member AS cm, c_commu_topic_comment AS cc'
    1287          . ', c_commu AS c, c_commu_topic AS ct'
    1288          . ' WHERE cm.c_member_id = ?'
    1289          . ' AND cc.c_commu_id=cm.c_commu_id'
    1290          . ' AND c.c_commu_id=cm.c_commu_id'
    1291          . ' AND ct.c_commu_id=cm.c_commu_id'
    1292          . ' AND ct.c_commu_topic_id=cc.c_commu_topic_id';
     1288    $sql = "SELECT count(DISTINCT ct.c_commu_topic_id)";
     1289    $sql .= " FROM c_commu_member AS cm, c_commu_topic_comment AS cc";
     1290    $sql .= ", c_commu AS c, c_commu_topic AS ct";
     1291    $sql .= " WHERE cm.c_member_id = ?";
     1292    $sql .= " AND cc.c_commu_id=cm.c_commu_id";
     1293    $sql .= " AND c.c_commu_id=cm.c_commu_id";
     1294    $sql .= " AND ct.c_commu_id=cm.c_commu_id";
     1295    $sql .= " AND ct.c_commu_topic_id=cc.c_commu_topic_id";
    12931296    $params = array(intval($c_member_id));
    12941297    $total_num = db_get_one($sql, $params);
Note: See TracChangeset for help on using the changeset viewer.