Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-01-14 15:41:54 +09:00
5 changed files with 110 additions and 126 deletions

View File

@ -7,33 +7,28 @@ include_once('./_head.php');
$list = array();
$sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_open, b.mb_point, a.lo_ip, a.lo_location, a.lo_url
from {$g4[login_table]} a left join {$g4[member_table]} b on (a.mb_id = b.mb_id)
where a.mb_id <> '{$config[cf_admin]}'
from {$g4['login_table']} a left join {$g4['member_table']} b on (a.mb_id = b.mb_id)
where a.mb_id <> '{$config['cf_admin']}'
order by a.lo_datetime desc ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$i] = $row;
if ($row[mb_id])
//$list[$i][name] = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
$list[$i][name] = get_sideview($row[mb_id], cut_str($row[mb_nick], $config[cf_cut_name]), $row[mb_email], $row[mb_homepage]);
else
{
if ($row['mb_id']) {
$list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['mb_nick'], $config['cf_cut_name']), $row['mb_email'], $row['mb_homepage']);
} else {
if ($is_admin)
$list[$i][name] = $row[lo_ip];
$list[$i]['name'] = $row[lo_ip];
else
$list[$i][name] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[lo_ip]);
$list[$i]['name'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row['lo_ip']);
}
$list[$i][num] = sprintf('%03d',$i+1);
$list[$i]['num'] = sprintf('%03d',$i+1);
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, '?gr_id=$gr_id&amp;page=');
echo '<script src="'.$g4['path'].'/js/sideview.js"></script>';
$connect_skin_path = $g4['path'].'/skin/connect/'.$config[cf_connect_skin];
$connect_skin_path = $g4['path'].'/skin/connect/'.$config['cf_connect_skin'];
include_once($connect_skin_path.'/current_connect.skin.php');
include_once('./_tail.php');

View File

@ -4,102 +4,108 @@ include_once('./_common.php');
$g4['title'] = '최근 게시물';
include_once('./_head.php');
$sql_common = " from {$g4[board_new_table]} a, {$g4[board_table]} b, {$g4[group_table]} c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 ";
if ($gr_id)
$sql_common = " from {$g4['board_new_table']} a, {$g4['board_table']} b, {$g4['group_table']} c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 ";
$gr_id = isset($_GET['gr_id']) ? $_GET['gr_id'] : "";
if ($gr_id) {
$sql_common .= " and b.gr_id = '$gr_id' ";
}
$view = isset($_GET['view']) ? $_GET['view'] : "";
if ($view == "w")
$sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
$sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
$mb_id = isset($_GET['mb_id']) ? $_GET['mb_id'] : "";
if ($mb_id) {
$sql_common .= " and a.mb_id = '{$mb_id}' ";
}
$sql_order = " order by a.bn_id desc ";
$sql = " select count(*) as cnt {$sql_common} ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$total_count = $row['cnt'];
$rows = $config[cf_new_rows];
$rows = $config['cf_new_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$group_select = '<select name="gr_id" id="gr_id" title="검색대상" onchange="select_change();"><option value="">전체그룹';
$sql = " select gr_id, gr_subject from {$g4[group_table]} order by gr_id ";
$sql = " select gr_id, gr_subject from {$g4['group_table']} order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$group_select .= '<option value="'.$row[gr_id].'">'.$row[gr_subject];
for ($i=0; $row=sql_fetch_array($result); $i++) {
$group_select .= '<option value="'.$row['gr_id'].'">'.$row['gr_subject'];
}
$group_select .= '</select>';
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
{$sql_common}
{$sql_order}
limit {$from_record}, {$rows} ";
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id {$sql_common} {$sql_order} limit {$from_record}, {$rows} ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
for ($i=0; $row=sql_fetch_array($result); $i++) {
$tmp_write_table = $g4['write_prefix'].$row['bo_table'];
if ($row[wr_id] == $row[wr_parent]) // 원글
{
if ($row['wr_id'] == $row['wr_parent']) {
// 원글
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
$name = get_sideview($row2['mb_id'], cut_str($row2['wr_name'], $config['cf_cut_name']), $row2['wr_email'], $row2['wr_homepage']);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime = substr($row2['wr_datetime'],0,10);
$datetime2 = $row2['wr_datetime'];
if ($datetime == $g4['time_ymd']) {
$datetime2 = substr($datetime2,11,5);
else
} else {
$datetime2 = substr($datetime2,5,5);
}
}
else // 코멘트
{
} else {
// 코멘트
$comment = '[코] ';
$comment_link = '#c_'.$row[wr_id];
$row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row[wr_parent]}' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row[wr_id]}' ");
$comment_link = '#c_'.$row['wr_id'];
$row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_parent']}' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$list[$i]['mb_id'] = $row3['mb_id'];
$list[$i]['wr_name'] = $row3['wr_name'];
$list[$i]['wr_email'] = $row3['wr_email'];
$list[$i]['wr_homepage'] = $row3['wr_homepage'];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
$name = get_sideview($row3['mb_id'], cut_str($row3['wr_name'], $config['cf_cut_name']), $row3['wr_email'], $row3['wr_homepage']);
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime = substr($row3['wr_datetime'],0,10);
$datetime2 = $row3['wr_datetime'];
if ($datetime == $g4['time_ymd']) {
$datetime2 = substr($datetime2,11,5);
else
} else {
$datetime2 = substr($datetime2,5,5);
}
}
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = './board.php?bo_table='.$row[bo_table].'&amp;wr_id='.$row2[wr_id].$comment_link;
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i]['gr_id'] = $row['gr_id'];
$list[$i]['bo_table'] = $row['bo_table'];
$list[$i]['name'] = $name;
$list[$i]['comment'] = $comment;
$list[$i]['href'] = './board.php?bo_table='.$row['bo_table'].'&amp;wr_id='.$row2['wr_id'].$comment_link;
$list[$i]['datetime'] = $datetime;
$list[$i]['datetime2'] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
$list[$i]['gr_subject'] = $row['gr_subject'];
$list[$i]['bo_subject'] = $row['bo_subject'];
$list[$i]['wr_subject'] = $row2['wr_subject'];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&amp;view=$view&amp;mb_id=$mb_id&amp;page=");
$write_pages = get_paging($config['cf_write_pages'], $page, $total_page, "?gr_id=$gr_id&amp;view=$view&amp;mb_id=$mb_id&amp;page=");
$new_skin_path = $g4['path'].'/skin/new/'.$config[cf_new_skin];
$new_skin_path = $g4['path'].'/skin/new/'.$config['cf_new_skin'];
echo '<script src="'.$g4['path'].'/js/sideview.js"></script>'.PHP_EOL;

View File

@ -1,25 +1,23 @@
<?
include_once('./_common.php');
//if (!$stx) alert("검색어가 없습니다.");
$g4['title'] = "전체검색 결과";
include_once('./_head.php');
if ($stx)
{
//$stx = trim($stx);
if ($stx) {
$stx = preg_replace("/\//", "\/", trim($stx));
$sop = strtolower($sop);
if (!$sop || !($sop == 'and' || $sop == 'or')) $sop = 'and'; // 연산자 and , or
$srows = isset($_GET['srows']) ? $_GET['srows'] : "";
if (!$srows) $srows = 10; // 한페이지에 출력하는 검색 행수
unset($g4_search[tables]);
unset($g4_search[read_level]);
$sql = " select gr_id, bo_table, bo_read_level from {$g4[board_table]} where bo_use_search = 1 and bo_list_level <= '{$member[mb_level]}' ";
// and bo_read_level <= '$member[mb_level]' ";
$g4_search['tables'] = Array();
$g4_search['read_level'] = Array();
$sql = " select gr_id, bo_table, bo_read_level from {$g4['board_table']} where bo_use_search = 1 and bo_list_level <= '{$member['mb_level']}' ";
if ($gr_id)
$sql .= " and gr_id = '{$gr_id}' ";
$onetable = isset($onetable) ? $onetable : "";
if ($onetable) // 하나의 게시판만 검색한다면
$sql .= " and bo_table = '{$onetable}' ";
$sql .= " order by bo_order_search, gr_id, bo_table ";
@ -29,25 +27,23 @@ if ($stx)
if ($is_admin != 'super')
{
// 그룹접근 사용에 대한 검색 차단
$sql2 = " select gr_use_access, gr_admin from {$g4[group_table]} where gr_id = '{$row[gr_id]}' ";
$sql2 = " select gr_use_access, gr_admin from {$g4['group_table']} where gr_id = '{$row['gr_id']}' ";
$row2 = sql_fetch($sql2);
// 그룹접근을 사용한다면
if ($row2[gr_use_access])
{
if ($row2['gr_use_access']) {
// 그룹관리자가 있으며 현재 회원이 그룹관리자라면 통과
if ($row2[gr_admin] && $row2[gr_admin] == $member[mb_id])
if ($row2['gr_admin'] && $row2['gr_admin'] == $member['mb_id']) {
;
else
{
$sql3 = " select count(*) as cnt from {$g4[group_member_table]} where gr_id = '{$row[gr_id]}' and mb_id = '{$member[mb_id]}' and mb_id <> '' ";
} else {
$sql3 = " select count(*) as cnt from {$g4['group_member_table']} where gr_id = '{$row['gr_id']}' and mb_id = '{$member['mb_id']}' and mb_id <> '' ";
$row3 = sql_fetch($sql3);
if (!$row3[cnt])
if (!$row3['cnt'])
continue;
}
}
}
$g4_search[tables][] = $row[bo_table];
$g4_search[read_level][] = $row[bo_read_level];
$g4_search['tables'][] = $row['bo_table'];
$g4_search['read_level'][] = $row['bo_read_level'];
}
$search_query = 'sfl='.urlencode($sfl).'&amp;stx='.urlencode($stx).'&amp;sop='.$sop;
@ -64,20 +60,18 @@ if ($stx)
$field = explode('||', trim($sfl));
$str = '(';
for ($i=0; $i<count($s); $i++)
{
for ($i=0; $i<count($s); $i++) {
if (trim($s[$i]) == '') continue;
//$search_str = strtolower($s[$i]);
$search_str = $s[$i];
$str .= $op1;
$str .= "(";
$op2 = '';
for ($k=0; $k<count($field); $k++) // 필드의 수만큼 다중 필드 검색 가능 (필드1+필드2...)
{
// 필드의 수만큼 다중 필드 검색 가능 (필드1+필드2...)
for ($k=0; $k<count($field); $k++) {
$str .= $op2;
switch ($field[$k])
{
switch ($field[$k]) {
case 'mb_id' :
case 'wr_name' :
$str .= "$field[$k] = '$s[$i]'";
@ -100,42 +94,38 @@ if ($stx)
$op1 = " {$sop} ";
// 인기검색어
$sql = " insert into {$g4[popular_table]} set pp_word = '{$search_str}', pp_date = '{$g4[time_ymd]}', pp_ip = '{$_SERVER[REMOTE_ADDR]}' ";
$sql = " insert into {$g4['popular_table']} set pp_word = '{$search_str}', pp_date = '{$g4['time_ymd']}', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql, FALSE);
}
$str .= ")";
//$sql_search = $str . " and wr_option not like '%secret%' "; // 비밀글은 제외
$sql_search = $str;
$str_board_list = "";
$board_count = 0;
$time1 = get_microtime();
$search_table = Array();
$table_index = 0;
$total_count = 0;
for ($i=0; $i<count($g4_search[tables]); $i++)
{
$tmp_write_table = $g4[write_prefix] . $g4_search[tables][$i];
for ($i=0; $i<count($g4_search['tables']); $i++) {
$tmp_write_table = $g4['write_prefix'] . $g4_search['tables'][$i];
$sql = " select wr_id from {$tmp_write_table} where {$sql_search} ";
$result = sql_query($sql, false);
$row[cnt] = @mysql_num_rows($result);
//$sql = " select count(*) as cnt from $tmp_write_table where $sql_search ";
//$row = sql_fetch($sql);
$total_count += $row[cnt];
if ($row[cnt])
{
$total_count += $row['cnt'];
if ($row['cnt']) {
$board_count++;
$search_table[] = $g4_search[tables][$i];
$read_level[] = $g4_search[read_level][$i];
$search_table[] = $g4_search['tables'][$i];
$read_level[] = $g4_search['read_level'][$i];
$search_table_count[] = $total_count;
$sql2 = " select bo_subject from {$g4[board_table]} where bo_table = '{$g4_search[tables][$i]}' ";
$sql2 = " select bo_subject from {$g4['board_table']} where bo_table = '{$g4_search['tables'][$i]}' ";
$row2 = sql_fetch($sql2);
$str_board_list .= '<li><a href="'.$_SERVER[PHP_SELF].'?'.$search_query.'&amp;gr_id='.$gr_id.'&amp;onetable='.$g4_search[tables][$i].'">'.$row2[bo_subject].'</a> ('.$row[cnt].')';
$str_board_list .= '<li><a href="'.$_SERVER['PHP_SELF'].'?'.$search_query.'&amp;gr_id='.$gr_id.'&amp;onetable='.$g4_search[tables][$i].'">'.$row2[bo_subject].'</a> ('.$row[cnt].')';
}
}
@ -144,10 +134,8 @@ if ($stx)
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
for ($i=0; $i<count($search_table); $i++)
{
if ($from_record < $search_table_count[$i])
{
for ($i=0; $i<count($search_table); $i++) {
if ($from_record < $search_table_count[$i]) {
$table_index = $i;
$from_record = $from_record - $search_table_count[$i-1];
break;
@ -158,18 +146,16 @@ if ($stx)
$list = array();
$k=0;
for ($idx=$table_index; $idx<count($search_table); $idx++)
{
for ($idx=$table_index; $idx<count($search_table); $idx++) {
$sql = " select bo_subject from {$g4[board_table]} where bo_table = '{$search_table[$idx]}' ";
$row = sql_fetch($sql);
$bo_subject[$idx] = $row[bo_subject];
$bo_subject[$idx] = $row['bo_subject'];
$tmp_write_table = $g4[write_prefix] . $search_table[$idx];
$tmp_write_table = $g4['write_prefix'] . $search_table[$idx];
$sql = " select * from {$tmp_write_table} where {$sql_search} order by wr_id desc limit {$from_record}, {$rows} ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 검색어까지 링크되면 게시판 부하가 일어남
$list[$idx][$i] = $row;
$list[$idx][$i][href] = './board.php?bo_table='.$search_table[$idx].'&amp;wr_id='.$row[wr_parent];
@ -216,22 +202,22 @@ if ($stx)
$from_record = 0;
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, $_SERVER[PHP_SELF].'?'.$search_query.'&amp;gr_id='.$gr_id.'&amp;srows='.$srows.'&amp;onetable='.$onetable.'&amp;page=');
$write_pages = get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$search_query.'&amp;gr_id='.$gr_id.'&amp;srows='.$srows.'&amp;onetable='.$onetable.'&amp;page=');
echo '<script src="'.$g4['path'].'/js/sideview.js"></script>';
}
$group_select = '<select id="gr_id" name="gr_id" class="select" title="그룹선택"><option value="">전체 분류';
$sql = " select gr_id, gr_subject from {$g4[group_table]} order by gr_id ";
$sql = " select gr_id, gr_subject from {$g4['group_table']} order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
$group_select .= '<option value="'.$row[gr_id].'">'.$row[gr_subject].'</option>';
$group_select .= '<option value="'.$row['gr_id'].'">'.$row['gr_subject'].'</option>';
$group_select .= '</select>';
if (!$sfl) $sfl = 'wr_subject';
if (!$sop) $sop = 'or';
$search_skin_path = $g4['path'].'/skin/search/'.$config[cf_search_skin];
$search_skin_path = $g4['path'].'/skin/search/'.$config['cf_search_skin'];
include_once($search_skin_path.'/search.skin.php');
include_once('./_tail.php');

View File

@ -479,6 +479,7 @@ if (isset($member['mb_id'])) {
$write = array();
$write_table = "";
$gr_id = "";
if (isset($bo_table)) {
$board = sql_fetch(" select * from {$g4['board_table']} where bo_table = '$bo_table' ");
if ($board['bo_table']) {

View File

@ -32,7 +32,3 @@ if ($i == 0)
?>
</tbody>
</table>
<div id="pg">
<?=$write_pages?>
</div>