AvocadoAmber/AvocadoEdition_Light/lib/popular.lib.php

35 lines
1 KiB
PHP
Raw Normal View History

2022-09-17 20:50:50 +09:00
<?php
2024-09-19 20:57:39 +09:00
if (!defined('_GNUBOARD_'))
exit;
2022-09-17 20:50:50 +09:00
// 인기검색어 출력
// $skin_dir : 스킨 디렉토리
// $pop_cnt : 검색어 몇개
// $date_cnt : 몇일 동안
2024-09-19 20:57:39 +09:00
function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3)
2022-09-17 20:50:50 +09:00
{
2024-09-19 20:57:39 +09:00
global $config, $g5;
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
if (!$skin_dir)
$skin_dir = 'basic';
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
$date_gap = date("Y-m-d", G5_SERVER_TIME - ($date_cnt * 86400));
2024-09-30 01:58:32 +09:00
$sql = "SELECT pp_word, count(*) as cnt FROM {$g5['popular_table']} WHERE pp_date BETWEEN '$date_gap' AND '" . G5_TIME_YMD . "' GROUP BY pp_word ORDER BY cnt DESC, pp_word LIMIT 0, $pop_cnt ";
2024-09-19 20:57:39 +09:00
$result = sql_query($sql);
for ($i = 0; $row = sql_fetch_array($result); $i++) {
$list[$i] = $row;
// 스크립트등의 실행금지
//$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
}
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
$popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir;
$popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir;
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
ob_start();
include_once $popular_skin_path . "/popular.skin.php";
2024-09-19 20:57:39 +09:00
$content = ob_get_contents();
ob_end_clean();
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
return $content;
2022-09-17 20:50:50 +09:00
}