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

This commit is contained in:
gnuboard
2013-03-08 13:29:11 +09:00
12 changed files with 296 additions and 119 deletions

2
.gitignore vendored
View File

@ -2,4 +2,4 @@ data
config.php
test*
sirgle
caption_sr_test.php
sr_*

View File

@ -66,7 +66,7 @@ function imageview(id, w, h)
<div id="logo"><a href="<?=G4_ADMIN_URL?>"><img src="<?=G4_ADMIN_URL?>/img/logo.jpg" alt="<?=$config['cf_title']?> 관리자 처음으로"></a></div>
<div id="snb">
<div id="mb_nb">
<ul>
<li>
<a href="<?=G4_ADMIN_URL?>/member_form.php?w=u&amp;mb_id=<?=$member['mb_id']?>">

View File

@ -3,69 +3,152 @@ include_once('./_common.php');
@include_once($board_skin_path.'/good.head.skin.php');
echo '<meta charset="$g4[charset]">';
// 자바스크립트 사용가능할 때
if($_POST['js'] == "on") {
$error = $count = "";
if (!$is_member)
{
$href = './login.php?$qstr&amp;url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id);
echo '<script>alert(\'회원만 가능합니다.\'); top.location.href = \''.$href.'\';</script>';
exit;
}
if (!($bo_table && $wr_id))
alert_close('값이 제대로 넘어오지 않았습니다.');
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
if (!get_session($ss_name))
alert_close('해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.');
$row = sql_fetch(" select count(*) as cnt from {$g4[write_prefix]}{$bo_table} ", FALSE);
if (!$row[cnt])
alert_close('존재하는 게시판이 아닙니다.');
if ($good == 'good' || $good == 'nogood')
{
if($write[mb_id] == $member[mb_id])
alert_close('자신의 글에는 추천 또는 비추천 하실 수 없습니다.');
if (!$board[bo_use_good] && $good == 'good')
alert_close('이 게시판은 추천 기능을 사용하지 않습니다.');
if (!$board[bo_use_nogood] && $good == 'nogood')
alert_close('이 게시판은 비추천 기능을 사용하지 않습니다.');
$sql = " select bg_flag from {$g4[board_good_table]}
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and mb_id = '{$member[mb_id]}'
and bg_flag in ('good', 'nogood') ";
$row = sql_fetch($sql);
if ($row[bg_flag])
function print_result($error, $count)
{
if ($row[bg_flag] == 'good')
$status = '추천';
else
$status = '비추천';
echo '<script>alert(\'이미 \''.$status.'\' 하신 글 입니다.\');</script>';
echo '{ "error": "' . $error . '", "count": "' . $count . '" }';
exit;
}
else
if (!$is_member)
{
// 추천(찬성), 비추천(반대) 카운트 증가
sql_query(" update {$g4[write_prefix]}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' ");
// 내역 생성
sql_query(" insert {$g4[board_good_table]} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member[mb_id]}', bg_flag = '{$good}', bg_datetime = '".G4_TIME_YMDHIS."' ");
$error = '회원만 가능합니다.';
print_result($error, $count);
}
if ($good == 'good')
$status = '추천';
else
$status = '비추천';
if (!($bo_table && $wr_id)) {
$error = '값이 제대로 넘어오지 않았습니다.';
print_result($error, $count);
}
echo '<script> alert(\'이 글을 \'$status\' 하셨습니다.\');</script>';
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
if (!get_session($ss_name)) {
$error = '해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.';
print_result($error, $count);
}
$row = sql_fetch(" select count(*) as cnt from {$g4['write_prefix']}{$bo_table} ", FALSE);
if (!$row['cnt']) {
$error = '존재하는 게시판이 아닙니다.';
print_result($error, $count);
}
if ($good == 'good' || $good == 'nogood')
{
if($write['mb_id'] == $member['mb_id']) {
$error = '자신의 글에는 추천 또는 비추천 하실 수 없습니다.';
print_result($error, $count);
}
if (!$board['bo_use_good'] && $good == 'good') {
$error = '이 게시판은 추천 기능을 사용하지 않습니다.';
print_result($error, $count);
}
if (!$board['bo_use_nogood'] && $good == 'nogood') {
$error = '이 게시판은 비추천 기능을 사용하지 않습니다.';
print_result($error, $count);
}
$sql = " select bg_flag from {$g4['board_good_table']}
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and mb_id = '{$member['mb_id']}'
and bg_flag in ('good', 'nogood') ";
$row = sql_fetch($sql);
if ($row['bg_flag'])
{
if ($row['bg_flag'] == 'good')
$status = '추천';
else
$status = '비추천';
$error = "이미 $status 하신 글 입니다.";
print_result($error, $count);
}
else
{
// 추천(찬성), 비추천(반대) 카운트 증가
sql_query(" update {$g4['write_prefix']}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' ");
// 내역 생성
sql_query(" insert {$g4['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '".G4_TIME_YMDHIS."' ");
$sql = " select wr_{$good} as count from {$g4['write_prefix']}{$bo_table} where wr_id = '$wr_id' ";
$row = sql_fetch($sql);
$count = $row['count'];
print_result($error, $count);
}
}
} else {
include_once(G4_PATH.'/head.sub.php');
if (!$is_member)
{
$href = './login.php?$qstr&amp;url='.urlencode('./board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id);
alert('회원만 가능합니다.', $href);
}
if (!($bo_table && $wr_id))
alert('값이 제대로 넘어오지 않았습니다.');
$ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;
if (!get_session($ss_name))
alert('해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.');
$row = sql_fetch(" select count(*) as cnt from {$g4['write_prefix']}{$bo_table} ", FALSE);
if (!$row['cnt'])
alert('존재하는 게시판이 아닙니다.');
if ($good == 'good' || $good == 'nogood')
{
if($write['mb_id'] == $member['mb_id'])
alert('자신의 글에는 추천 또는 비추천 하실 수 없습니다.');
if (!$board['bo_use_good'] && $good == 'good')
alert('이 게시판은 추천 기능을 사용하지 않습니다.');
if (!$board['bo_use_nogood'] && $good == 'nogood')
alert('이 게시판은 비추천 기능을 사용하지 않습니다.');
$sql = " select bg_flag from {$g4['board_good_table']}
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and mb_id = '{$member['mb_id']}'
and bg_flag in ('good', 'nogood') ";
$row = sql_fetch($sql);
if ($row['bg_flag'])
{
if ($row['bg_flag'] == 'good')
$status = '추천';
else
$status = '비추천';
alert("이미 $status 하신 글 입니다.");
}
else
{
// 추천(찬성), 비추천(반대) 카운트 증가
sql_query(" update {$g4['write_prefix']}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' ");
// 내역 생성
sql_query(" insert {$g4['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '".G4_TIME_YMDHIS."' ");
if ($good == 'good')
$status = '추천';
else
$status = '비추천';
$href = './board.php?bo_table='.$bo_table.'&amp;wr_id='.$wr_id;
alert("이 글을 $status 하셨습니다.", '', false);
}
}
}
@include_once($board_skin_path.'/good.tail.skin.php');
?>
<script> window.close(); </script>
?>

View File

@ -45,12 +45,12 @@ h2 {font-size:1.2em}
#logo {position:relative;height:70px}
#logo img {position:absolute;top:15px;left:0}
#snb {z-index:2;position:absolute;top:16px;right:0;zoom:1}
#snb:after {display:block;visibility:hidden;clear:both;content:""}
#snb ul {float:right;margin:0;padding:0;zoom:1}
#snb ul:after {display:block;visibility:hidden;clear:both;content:""}
#snb li {float:left;margin-left:20px}
#snb a {display:inline-block;padding:5px 0;color:#e0e0e0;font-size:0.9em;text-decoration:none}
#mb_nb {z-index:2;position:absolute;top:16px;right:0;zoom:1}
#mb_nb:after {display:block;visibility:hidden;clear:both;content:""}
#mb_nb ul {float:right;margin:0;padding:0;zoom:1}
#mb_nb ul:after {display:block;visibility:hidden;clear:both;content:""}
#mb_nb li {float:left;margin-left:20px}
#mb_nb a {display:inline-block;padding:5px 0;color:#e0e0e0;font-size:0.9em;text-decoration:none}
/* gnb js off */
#gnb {z-index:10;background:#383a3f}

View File

@ -51,14 +51,14 @@ a:active {color:#000;text-decoration:underline}
#schall_stx {padding-left:5px;width:156px;height:24px;border:1px solid #aaa;border-right:0;background:#f7f7f2;line-height:1.9em !important;line-height:1.6em}
#schall_submit {border:1px solid #aaa;border-left:0}
#snb {position:absolute;top:18px;right:0;zoom:1}
#snb:after {display:block;visibility:hidden;clear:both;content:""}
#snb li {float:left}
#snb a {display:block;padding:5px 10px;color:#333;letter-spacing:-0.1em}
#snb a:focus,
#snb a:hover,
#snb a:active {text-decoration:none}
#snb img {margin-right:3px}
#mb_nb {position:absolute;top:18px;right:0;zoom:1}
#mb_nb:after {display:block;visibility:hidden;clear:both;content:""}
#mb_nb li {float:left}
#mb_nb a {display:block;padding:5px 10px;color:#333;letter-spacing:-0.1em}
#mb_nb a:focus,
#mb_nb a:hover,
#mb_nb a:active {text-decoration:none}
#mb_nb img {margin-right:3px}
/* gnb js off */
#gnb {z-index:10;margin:-1px 0 0;border-bottom:1px solid #c3c7c5;background:#f0f4f8}
@ -95,7 +95,7 @@ a:active {color:#000;text-decoration:underline}
#wrapper:after {display:block;visibility:hidden;clear:both;content:""}
#wrapper_title {margin-bottom:20px;font-size:1.2em}
#lnb {float:right;width:209px;border:1px solid #cfded8;background:#fff}
#side_nb {float:right;width:209px;border:1px solid #cfded8;background:#fff}
#container {z-index:4;position:relative;float:left;padding:25px 15px 15px;width:728px;min-height:500px;height:auto !important;height:500px;border:1px solid #cfded8;background:#fff;zoom:1}
#container:after {display:block;visibility:hidden;clear:both;content:""}

View File

@ -45,19 +45,11 @@ pre {overflow-x:scroll;font-size:1.1em}
#schall_stx {padding-left:0.3em;width:100px;height:1.5em;border:1px solid #aaa;border-right:0;background:#f7f7f7;line-height:1.5em;-webkit-appearance:none}
#schall_submit {border:1px solid #aaa;border-left:0}
#snb {clear:both;border-top:1px solid #e7f1ed;background:#151515;text-align:center}
#snb li {display:inline-block;border-right:1px solid #333}
#snb li:nth-last-of-type(1) {border-right:0 !important}
#snb a {display:inline-block;padding:0.5em;color:#fff;text-decoration:none}
#snb img {display:none}
#gnb {border-bottom:1px solid #c3c7c5;background:#f0f4f8;zoom:1}
#gnb:after {display:block;visibility:hidden;clear:both;content:""}
#gnb h2 {display:none}
#gnb_ul {border-top:1px solid #e7f1ed}
#gnb li {float:left;width:25%;border-bottom:1px solid #e7f1ed}
#gnb li ul {display:none}
.gnb_1depth a {display:block;padding:1em 0;border-right:1px solid #e7f1ed;color:#000;text-align:center;text-decoration:none}
#mb_nb {clear:both;border-top:1px solid #e7f1ed;background:#151515;text-align:center}
#mb_nb li {display:inline-block;border-right:1px solid #333}
#mb_nb li:nth-last-of-type(1) {border-right:0 !important}
#mb_nb a {display:inline-block;padding:0.5em;color:#fff;text-decoration:none}
#mb_nb img {display:none}
/* 배포시에는 필요없는 부분 */
#sirgle_title {padding:0 1em;height:100px;color:#fff;font-size:2em}
@ -75,6 +67,14 @@ pre {overflow-x:scroll;font-size:1.1em}
#text_size {margin:0 0 1em;text-align:center}
/* 하단 레이아웃 */
#gnb {border-top:1px solid #c3c7c5;border-bottom:1px solid #c3c7c5;background:#f0f4f8;zoom:1}
#gnb:after {display:block;visibility:hidden;clear:both;content:""}
#gnb h2 {width:0;height:0;font-size:0;line-height:0;overflow:hidden}
#gnb ul {border-top:1px solid #e7f1ed}
#gnb li {float:left;width:25%;border-bottom:1px solid #e7f1ed}
#gnb li ul {display:none}
#gnb li a {display:block;padding:1em 0;border-right:1px solid #e7f1ed;color:#000;text-align:center;text-decoration:none}
#ft {background:#484848}
#ft h1 {width:0;height:0;font-size:0;line-height:0;overflow:hidden}

View File

@ -71,7 +71,7 @@ if ($config['cf_include_head']) {
</script>
</fieldset>
<ul id="snb">
<ul id="mb_nb">
<li>
<a href="<?=G4_BBS_URL?>/current_connect.php" id="snb_cnt">
<img src="<?=G4_IMG_URL?>/snb_cnt.jpg" alt="">
@ -154,7 +154,7 @@ if ($config['cf_include_head']) {
<hr>
<div id="wrapper">
<div id="lnb">
<div id="side_nb">
<?=(G4_IS_MOBILE?outlogin('basic'):outlogin('basic')); // 외부 로그인 ?>
<?=(G4_IS_MOBILE?poll('basic'):poll('basic')); // 설문조사 ?>
</div>

View File

@ -58,7 +58,7 @@ include_once(G4_LIB_PATH.'/popular.lib.php');
</script>
</fieldset>
<ul id="snb">
<ul id="mb_nb">
<li><a href="<?=G4_BBS_URL?>/current_connect.php" id="snb_cnt">접속자 <?=connect(); // 현재 접속자수 ?></a></li>
<li><a href="<?=G4_BBS_URL?>/new.php" id="snb_new">새글</a></li>
<? if ($is_member) { ?>
@ -78,27 +78,14 @@ include_once(G4_LIB_PATH.'/popular.lib.php');
<hr>
<nav id="gnb">
<script>$('#gnb').addClass('gnb_js');</script>
<h2>홈페이지 메인메뉴</h2>
<nav id="lnb">
<ul>
<?
$sql = " select * from {$g4['group_table']} where gr_show_menu order by gr_order ";
$result = sql_query($sql);
for ($gi=0; $row=sql_fetch_array($result); $gi++) { // gi 는 group index
$sql2 = " select * from {$g4['board_table']} where gr_id = '{$gr_id}' order by bo_order ";
$result2 = sql_query($sql2);
for ($bi=0; $row2=sql_fetch_array($result2); $bi++) { // bi 는 board index
?>
<li class="gnb_1depth">
<a href="<?=G4_BBS_URL?>/group.php?gr_id=<?=$row['gr_id']?>"><?=$row['gr_subject']?></a>
<ul>
<?
$sql2 = " select * from {$g4['board_table']} where gr_id = '{$row['gr_id']}' order by bo_order ";
$result2 = sql_query($sql2);
for ($bi=0; $row2=sql_fetch_array($result2); $bi++) { // bi 는 board index
?>
<li class="gnb_2depth"><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$row2['bo_table']?>"><?=$row2['bo_subject']?></a></li>
<?}?>
</ul>
</li>
<li><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$row2['bo_table']?>"><?=$row2['bo_subject']?></a></li>
<?}?>
</ul>
</nav>
@ -106,7 +93,7 @@ include_once(G4_LIB_PATH.'/popular.lib.php');
<hr>
<div id="wrapper">
<div id="lnb">
<div id="side_nb">
<?=(G4_IS_MOBILE?outlogin('basic'):outlogin('basic')); // 외부 로그인 ?>
<?=(G4_IS_MOBILE?poll('basic'):poll('basic')); // 설문조사 ?>
</div>

View File

@ -6,6 +6,22 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
<hr>
<nav id="gnb">
<script>$('#gnb').addClass('gnb_js');</script>
<h2>홈페이지 메인메뉴</h2>
<ul>
<?
$sql = " select * from {$g4['group_table']} where gr_show_menu order by gr_order ";
$result = sql_query($sql);
for ($gi=0; $row=sql_fetch_array($result); $gi++) { // gi 는 group index
?>
<li><a href="<?=G4_BBS_URL?>/group.php?gr_id=<?=$row['gr_id']?>"><?=$row['gr_subject']?></a></li>
<?}?>
</ul>
</nav>
<hr>
<footer id="ft">
<h1><?=$config['cf_title']?> 정보</h1>
<?=popular('basic'); // 인기검색어 ?>

View File

@ -144,8 +144,16 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<? if ($scrap_href || $good_href || $nogood_href) { ?>
<div id="bo_v_act">
<? if ($scrap_href) { ?><a href="<?=$scrap_href; ?>" target="_blank" class="btn_b01" onclick="win_scrap(this.href); return false;">스크랩</a><? } ?>
<? if ($good_href) {?><a href="<?=$good_href?>" target="hiddenframe" class="btn_b01">추천 <strong><?=number_format($view['wr_good'])?></strong></a><? } ?>
<? if ($nogood_href) {?><a href="<?=$nogood_href?>" target="hiddenframe" class="btn_b01">비추천 <strong><?=number_format($view['wr_nogood'])?></strong></a><? } ?>
<? if ($good_href) {?>
<a href="<?=$good_href.'&amp;'.$qstr?>" id="good_button" class="btn_b01">추천 <strong><?=number_format($view['wr_good'])?></strong></a>
<span id="bo_v_act_good"></span>
<? } ?>
<? if ($nogood_href) {?>
<a href="<?=$nogood_href.'&amp;'.$qstr?>" id="nogood_button" class="btn_b01">비추천 <strong><?=number_format($view['wr_nogood'])?></strong></a>
<span id="bo_v_act_nogood"></span>
<? } ?>
</div>
<? } else {
if($board['bo_use_good'] || $board['bo_use_nogood']) {
@ -201,6 +209,18 @@ $(function() {
window.open(this.href, "large_image", "top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
// 추천, 비추천
$("#good_button, #nogood_button").click(function() {
var $tx;
if(this.id == "good_button")
$tx = $("#bo_v_act_good");
else
$tx = $("#bo_v_act_nogood");
excute_good(this.href, $(this), $tx);
return false;
});
});
function view_image_resize()
@ -218,4 +238,27 @@ function view_image_resize()
}
});
}
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}
if(data.count) {
$el.find("strong").text(number_format(String(data.count)));
if($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.").css("display", "inline");
} else {
$tx.text("이 글을 추천하셨습니다.").css("display", "inline");
}
}
}, "json"
);
}
</script>

View File

@ -144,8 +144,14 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<? if ($scrap_href || $good_href || $nogood_href) { ?>
<div id="bo_v_act">
<? if ($scrap_href) { ?><a href="<?=$scrap_href; ?>" target="_blank" class="btn_b01" onclick="win_scrap(this.href); return false;">스크랩</a><? } ?>
<? if ($good_href) {?><a href="<?=$good_href?>" target="hiddenframe" class="btn_b01">추천 <strong><?=number_format($view['wr_good'])?></strong></a><? } ?>
<? if ($nogood_href) {?><a href="<?=$nogood_href?>" target="hiddenframe" class="btn_b01">추천 <strong><?=number_format($view['wr_nogood'])?></strong></a><? } ?>
<? if ($good_href) {?>
<a href="<?=$good_href.'&amp;'.$qstr?>" id="good_button" class="btn_b01">추천 <strong><?=number_format($view['wr_good'])?></strong></a>
<span id="bo_v_act_good"></span>
<? } ?>
<? if ($nogood_href) {?>
<a href="<?=$nogood_href.'&amp;'.$qstr?>" id="nogood_button" class="btn_b01">비추천 <strong><?=number_format($view['wr_nogood'])?></strong></a>
<span id="bo_v_act_nogood"></span>
<? } ?>
</div>
<? } else {
if($board['bo_use_good'] || $board['bo_use_nogood']) {
@ -201,6 +207,18 @@ $(function() {
window.open(this.href, "large_image", "top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
// 추천, 비추천
$("#good_button, #nogood_button").click(function() {
var $tx;
if(this.id == "good_button")
$tx = $("#bo_v_act_good");
else
$tx = $("#bo_v_act_nogood");
excute_good(this.href, $(this), $tx);
return false;
});
});
function view_image_resize()
@ -218,4 +236,27 @@ function view_image_resize()
}
});
}
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}
if(data.count) {
$el.find("strong").text(number_format(String(data.count)));
if($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.").css("display", "inline");
} else {
$tx.text("이 글을 추천하셨습니다.").css("display", "inline");
}
}
}, "json"
);
}
</script>

View File

@ -1,15 +1,22 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<style>
html {margin:0;padding:0;font-size:300%;font-family:"gulim"}
#x1 {width:100px;padding:1%;background:#ddd}
</style>
<meta charset="utf-8">
<title>AJAX 동적 컨텐츠 테스트</title>
<script src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div id="x1">깊은 옹달샘 누가 와서 먹나요</div>
<a href="">클릭</a>
<div></div>
<script>
$(function(){
$('a').click(function(){
$('div').text('클릭되었습니다.');
});
});
</script>
</body>
</html>