Esempio n. 1
0
function db_rss_list_c_rss_cache_list($c_member_id, $page_size, $page)
{
    $sql = 'SELECT * FROM c_rss_cache WHERE c_member_id = ? ORDER BY r_datetime DESC';
    $params = array(intval($c_member_id));
    $lst = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($lst as $key => $value) {
        $lst[$key]['c_member'] = db_member_c_member4c_member_id($value['c_member_id']);
    }
    return $lst;
}
Esempio n. 2
0
function db_message_search_c_message($c_member_id, $page, $page_size, $keyword, $box, $target_c_member_id = null)
{
    $params = array();
    $params[] = intval($c_member_id);
    if ($box == 'inbox' || !$box) {
        $where = "c_member_id_to = ?" . " AND is_deleted_to = 0" . " AND is_send = 1";
        if ($target_c_member_id) {
            $where .= " AND c_member_id_from = ?";
            $params[] = intval($target_c_member_id);
        }
    } elseif ($box == 'outbox') {
        $where = "c_member_id_from = ?" . " AND is_deleted_from = 0" . " AND is_send = 1";
        if ($target_c_member_id) {
            $where .= " AND c_member_id_to = ?";
            $params[] = intval($target_c_member_id);
        }
    }
    $where .= " AND ( subject like ? OR body like ?)";
    $params[] = '%' . strval($keyword) . '%';
    $params[] = '%' . strval($keyword) . '%';
    $sql = "SELECT * FROM c_message";
    $sql .= " WHERE {$where}";
    $sql .= " ORDER BY r_datetime DESC";
    $c_message_list = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($c_message_list as $key => $value) {
        if ($box == 'inbox' || !$box) {
            $c_member = db_member_c_member4c_member_id_LIGHT($value['c_member_id_from']);
        } else {
            $c_member = db_member_c_member4c_member_id_LIGHT($value['c_member_id_to']);
        }
        $c_message_list[$key]['nickname'] = $c_member['nickname'];
        $c_message_list[$key]['image_filename'] = $c_member['image_filename'];
    }
    $sql = "SELECT COUNT(*) FROM c_message WHERE {$where}";
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    return array($c_message_list, $prev, $next, $total_num);
}
Esempio n. 3
0
function biz_getGroupList($keyword = '', $page = 0, $page_size = 20)
{
    //keywordあり
    if ($keyword) {
        $where = ' WHERE info LIKE ? OR name LIKE ? ORDER BY biz_group_id';
        $sql = 'SELECT * FROM biz_group' . $where;
        $params = array('%' . $keyword . '%', '%' . $keyword . '%');
        $list = db_get_all_page($sql, $page, $page_size, $params);
        //keywordなし(全件表示)
    } else {
        $where = '';
        $sql = 'SELECT * FROM biz_group ORDER BY biz_group_id';
        $params = array();
        $list = db_get_all_page($sql, $page, $page_size);
    }
    if (!$list) {
        return array();
    }
    foreach ($list as $key => $value) {
        $count = count(biz_getGroupMember($value['biz_group_id']));
        $list[$key]['count'] = $count;
    }
    $sql = 'SELECT COUNT(*) FROM biz_group' . $where;
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    $start_num = ($page - 1) * $page_size + 1;
    $end_num = $start_num + $page_size >= $total_num ? $total_num : $start_num + $page_size - 1;
    return array($list, $prev, $next, $total_num, $start_num, $end_num);
}
Esempio n. 4
0
function db_review_c_member_review_c_member_review4c_commu_id($c_commu_id, $page, $page_size = 20)
{
    $sql = " SELECT cr.*, ccr.*, crc.category_disp " . " FROM c_commu_review as ccr, c_review as cr, c_review_category as crc" . " WHERE ccr.c_review_id = cr.c_review_id" . " AND cr.c_review_category_id = crc.c_review_category_id" . " AND ccr.c_commu_id =  ?" . " ORDER BY ccr.r_datetime";
    $params = array(intval($c_commu_id));
    $list = db_get_all_page($sql, $page, $page_size, $params);
    $sql = "SELECT COUNT(*) FROM c_commu_review WHERE c_commu_id = ?";
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    $start_num = ($page - 1) * $page_size + 1;
    $end_num = ($page - 1) * $page_size + $page_size > $total_num ? $total_num : ($page - 1) * $page_size + $page_size;
    return array($list, $prev, $next, $total_num, $start_num, $end_num);
}
Esempio n. 5
0
/**
 * フレンドの最新日記リスト
 */
function k_p_h_diary_list_friend_h_diary_list_friend4c_member_id($c_member_id, $page_size, $page)
{
    $from = "c_diary, c_friend";
    $where = "c_friend.c_member_id_from = ?" . " AND c_diary.c_member_id = c_friend.c_member_id_to";
    $sql = "SELECT c_diary.* FROM {$from} WHERE {$where}" . " ORDER BY c_diary.r_datetime DESC";
    $params = array(intval($c_member_id));
    $lst = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($lst as $key => $value) {
        $lst[$key]['count_comments'] = db_diary_count_c_diary_comment4c_diary_id($value['c_diary_id']);
        $lst[$key]['c_member'] = db_member_c_member4c_member_id($value['c_member_id']);
    }
    $sql = "SELECT count(*) FROM {$from} WHERE {$where}";
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    return array($lst, $prev, $next, $total_num);
}
Esempio n. 6
0
function db_friend_ktai_anataga_c_friend_confirm_list4c_member_id_with_pager($c_member_id_from, $page_size, $page)
{
    $sql = "SELECT * FROM c_friend_confirm WHERE c_member_id_from = ?";
    $sql .= " ORDER BY r_datetime ASC";
    $params = array(intval($c_member_id_from));
    $c_friend_confirm_list = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($c_friend_confirm_list as $key => $value) {
        $c_member = db_member_c_member4c_member_id_LIGHT($value['c_member_id_to']);
        $c_friend_confirm_list[$key]['nickname'] = $c_member['nickname'];
    }
    $total_num = db_friend_count_c_anataga_friend_confirm($c_member_id_from);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    return array($c_friend_confirm_list, $prev, $next, $total_num);
}
Esempio n. 7
0
/**
 * お気に入りメンバーの日記リスト(ページャ付き)
 */
function db_bookmark_diary_list_with_pager($c_member_id, $page_size, $page)
{
    $bookmarks = db_bookmark_c_member_id_list($c_member_id, true);
    if (!$bookmarks) {
        return array(array(), false, false, 0);
    }
    $ids = implode(',', array_map('intval', $bookmarks));
    $sql = 'SELECT c_diary.* FROM c_diary, c_member WHERE c_diary.c_member_id IN (' . $ids . ') AND c_diary.public_flag = \'public\' AND c_diary.c_member_id=c_member.c_member_id ORDER BY r_datetime DESC';
    $diary_list = db_get_all_page($sql, intval($page), intval($page_size));
    foreach ($diary_list as $key => $value) {
        $diary_list[$key]['c_member'] = db_member_c_member4c_member_id_LIGHT($value['c_member_id']);
        $diary_list[$key]['count_comments'] = db_diary_count_c_diary_comment4c_diary_id($value['c_diary_id']);
    }
    $sql = 'SELECT count(*) FROM c_diary WHERE c_member_id IN (' . $ids . ')';
    $total_num = db_get_one($sql);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    return array($diary_list, $prev, $next, $total_num);
}
Esempio n. 8
0
/**
 * ポータル用画像ファイルリストを取得する
 *
 * @param int $page
 * @param int $page_size
 * @param array $pager
 */
function db_portal_image_list($page, $page_size, &$pager)
{
    $sql = 'SELECT * FROM portal_image ORDER BY portal_image_id DESC';
    $portal_image_list = db_get_all_page($sql, $page, $page_size);
    $sql = 'SELECT COUNT(*) FROM portal_image';
    $total_num = db_get_one($sql);
    $pager = util_make_pager($page, $page_size, $total_num);
    return $portal_image_list;
}
Esempio n. 9
0
function db_admin_commu_c_members4c_commu_id($c_commu_id, $page_size, $page)
{
    $sql = 'SELECT c_member_id, r_datetime FROM c_commu_member WHERE c_commu_id = ? ORDER BY r_datetime';
    $params = array(intval($c_commu_id));
    $id_list = db_get_all_page($sql, $page, $page_size, $params);
    $list = array();
    foreach ($id_list as $key => $value) {
        $c_member = db_member_c_member4c_member_id_LIGHT($value['c_member_id']);
        $c_member['friend_count'] = db_friend_count_friends($value['c_member_id']);
        $c_member['r_datetime'] = $value['r_datetime'];
        $list[] = $c_member;
    }
    $sql = 'SELECT COUNT(*) FROM c_commu_member WHERE c_commu_id = ?';
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    $start_num = ($page - 1) * $page_size + 1;
    $end_num = ($page - 1) * $page_size + $page_size > $total_num ? $total_num : ($page - 1) * $page_size + $page_size;
    return array($list, $prev, $next, $total_num, $start_num, $end_num);
}
Esempio n. 10
0
/**
 * トピック検索簡易版(キーワード無し)
 */
function db_commu_new_topic_list($page_size, $page, $type = 'all', $c_commu_id = 0)
{
    $select = 'SELECT c.name AS commu_name, c.image_filename AS commu_image' . ' ,ct.*, ct.u_datetime AS max_datetime' . ' FROM c_commu AS c' . ' INNER JOIN c_commu_topic AS ct USING(c_commu_id) ';
    $params = array();
    $where = ' WHERE 0 = 0';
    if ($c_commu_id) {
        $where .= ' AND ct.c_commu_id = ?';
        $params[] = $c_commu_id;
    } else {
        $where .= " AND c.is_open = 'public'";
    }
    switch ($type) {
        case 'topic':
            $where .= ' AND event_flag = 0';
            break;
        case 'event':
            $where .= ' AND event_flag = 1';
            break;
        case 'all':
        default:
            break;
    }
    $order = ' ORDER BY max_datetime DESC';
    $sql = $select . $where . $order;
    $list = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($list as $key => $value) {
        $p = array((int) $value['c_commu_topic_id']);
        $sql = 'SELECT body FROM c_commu_topic_comment WHERE number = 0 AND c_commu_topic_id = ?';
        $list[$key]['body'] = db_get_one($sql, $p);
        $number = db_commu_get_max_c_commu_topic_comment_number4c_topic_id($value['c_commu_topic_id']);
        $list[$key]['max_number'] = $number;
        $start_comment = db_commu_get_start_c_topic_comment($value['c_commu_topic_id']);
        $list[$key]['image_filename1'] = $start_comment['image_filename1'];
        $list[$key]['image_filename2'] = $start_comment['image_filename2'];
        $list[$key]['image_filename3'] = $start_comment['image_filename3'];
    }
    $sql = 'SELECT COUNT(ct.c_commu_topic_id) FROM c_commu AS c' . ' INNER JOIN c_commu_topic AS ct USING(c_commu_id)' . $where;
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        $next = $page < $total_page_num;
        $prev = $page > 1;
    }
    $start_num = ($page - 1) * $page_size + 1;
    $end_num = $start_num + $page_size - 1 >= $total_num ? $total_num : $start_num + $page_size - 1;
    return array($list, $prev, $next, $total_num, $start_num, $end_num);
}
Esempio n. 11
0
/**
 * フレンドの最新アルバムリスト
 */
function p_h_album_list_friend_h_album_list_friend4c_member_id($c_member_id, $page_size, $page)
{
    $friends = db_friend_c_member_id_list($c_member_id, true);
    if (!$friends) {
        return array(array(), false, false, 0);
    }
    $pf_cond = db_album_public_flag_condition($c_member_id, $u);
    $from = "c_album, c_friend";
    $where = "c_friend.c_member_id_from = ?" . " AND c_album.c_member_id = c_friend.c_member_id_to" . ' AND public_flag <> \'private\'';
    $sql = "SELECT c_album.* FROM {$from} WHERE {$where}" . " ORDER BY c_album.r_datetime DESC";
    $params = array(intval($c_member_id));
    $lst = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($lst as $key => $value) {
        $lst[$key]['c_member'] = db_member_c_member4c_member_id($value['c_member_id']);
    }
    $sql = "SELECT count(*) FROM {$from} WHERE {$where}";
    $total_num = db_get_one($sql, $params);
    if ($total_num != 0) {
        $total_page_num = ceil($total_num / $page_size);
        if ($page >= $total_page_num) {
            $next = false;
        } else {
            $next = true;
        }
        if ($page <= 1) {
            $prev = false;
        } else {
            $prev = true;
        }
    }
    return array($lst, $prev, $next, $total_num);
}