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

This commit is contained in:
whitedot
2013-04-22 16:17:46 +09:00
23 changed files with 255 additions and 168 deletions

View File

@ -7,6 +7,7 @@ $menu['menu100'] = array (
//array('100400', '버전정보', G4_ADMIN_URL.'/version.php', 'cf_version'),
array('100800', '세션파일 일괄삭제',G4_ADMIN_URL.'/session_file_delete.php', 'cf_session', 1),
array('100900', '캐쉬파일 일괄삭제',G4_ADMIN_URL.'/cache_file_delete.php', 'cf_cache', 1),
array('100920', '썸네일파일 일괄삭제',G4_ADMIN_URL.'/thumbnail_file_delete.php', 'cf_cache', 1),
array('100500', 'phpinfo()', G4_ADMIN_URL.'/phpinfo.php', 'cf_phpinfo'),
//array('100600', '업그레이드', G4_ADMIN_URL.'/upgrade.php', 'cf_upgrade'),
//array('100700', '복구/최적화', G4_ADMIN_URL.'/repair.php', 'cf_repair'),

View File

@ -0,0 +1,67 @@
<?
$sub_menu = '100920';
include_once('./_common.php');
if ($is_admin != 'super')
alert('최고관리자만 접근 가능합니다.', G4_URL);
$g4['title'] = '썸네일 일괄삭제';
include_once('./admin.head.php');
?>
<div id="thumbnail_del">
<p>
완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오.
</p>
<?php
$directory = array();
$dl = array('file', 'editor');
foreach($dl as $val) {
if($handle = opendir(G4_DATA_PATH.'/'.$val)) {
while(false !== ($entry = readdir($handle))) {
if($entry == '.' || $entry == '..')
continue;
$path = G4_DATA_PATH.'/'.$val.'/'.$entry;
if(is_dir($path))
$directory[] = $path;
}
}
}
flush();
if (empty($directory)) {
echo '<p>썸네일디렉토리를 열지못했습니다.</p>';
}
$cnt=0;
echo '<ul>'.PHP_EOL;
foreach($directory as $dir) {
$files = glob($dir.'/thumb-*');
if (is_array($files)) {
foreach($files as $thumbnail) {
$cnt++;
@unlink($thumbnail);
echo '<li>'.$thumbnail.'</li>'.PHP_EOL;
flush();
if ($cnt%10==0)
echo PHP_EOL;
}
}
}
echo '<li>완료됨</li></ul>'.PHP_EOL;
echo '<p><span>썸네일 '.$cnt.'건의 삭제가 완료됐습니다.</span><br>프로그램의 실행을 끝마치셔도 좋습니다.</p>'.PHP_EOL;
?>
</div>
<?php
include_once('./admin.tail.php');
?>

View File

@ -436,9 +436,7 @@ if (G4_IS_MOBILE) {
$new_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/new/'.$config['cf_mobile_new_skin'];
$search_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/search/'.$config['cf_mobile_search_skin'];
$connect_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
$poll_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/poll/basic';
if (isset($_GET['skin_dir']))
$poll_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/poll/'.$_GET['skin_dir'];
$connect_skin_url = G4_MOBILE_URL.'/'.G4_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
} else {
$board_skin_path = G4_SKIN_PATH.'/board/'.$board['bo_skin'];
$board_skin_url = G4_SKIN_URL .'/board/'.$board['bo_skin'];
@ -447,9 +445,7 @@ if (G4_IS_MOBILE) {
$new_skin_path = G4_SKIN_PATH.'/new/'.$config['cf_new_skin'];
$search_skin_path = G4_SKIN_PATH.'/search/'.$config['cf_search_skin'];
$connect_skin_path = G4_SKIN_PATH.'/connect/'.$config['cf_connect_skin'];
$poll_skin_path = G4_SKIN_PATH.'/poll/basic';
if (isset($_GET['skin_dir']))
$poll_skin_path = G4_SKIN_PATH.'/poll/'.$_GET['skin_dir'];
$connect_skin_url = G4_SKIN_URL.'/connect/'.$config['cf_connect_skin'];
}
//==============================================================================
@ -466,6 +462,8 @@ while ($entry = $tmp->read()) {
include_once(G4_EXTEND_PATH.'/'.$entry);
}
ob_start();
// 자바스크립트에서 go(-1) 함수를 쓰면 폼값이 사라질때 해당 폼의 상단에 사용하면
// 캐쉬의 내용을 가져옴. 완전한지는 검증되지 않음
header('Content-Type: text/html; charset=utf-8');

View File

@ -32,35 +32,19 @@ header("Pragma: no-cache"); // HTTP/1.0
<html lang="ko">
<head>
<meta charset="utf-8">
<title><?=$g4_head_title?></title>
<? if (G4_IS_MOBILE) {?>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">
<meta name="HandheldFriendly" content="true">
<meta name="format-detection" content="telephone=no">
<? } ?>
<? if (defined('G4_IS_ADMIN')) { ?>
<link rel="stylesheet" href="<?=G4_CSS_URL?>/admin.css">
<? } else { ?>
<link rel="stylesheet" href="<?=G4_CSS_URL?>/<?=(G4_IS_MOBILE?'mobile':'default')?>.css">
<?}?>
<title><?=$g4_head_title?></title>
<!-- <meta http-equiv="imagetoolbar" content="no"> -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> -->
<? if (defined('G4_IS_ADMIN')) { ?>
<link rel="stylesheet" href="<?=G4_CSS_URL?>/admin.css?=<?=date("md")?>">
<? } else { ?>
<link rel="stylesheet" href="<?=G4_CSS_URL?>/<?=(G4_IS_MOBILE?'mobile':'default')?>.css?=<?=date("md")?>">
<?}?>
<? // 스킨의 style sheet 불러옴
if (!defined('G4_IS_ADMIN')) {
if(isset($board_skin_path))
echo get_skin_stylesheet($board_skin_path);
if(isset($member_skin_path))
echo get_skin_stylesheet($member_skin_path);
if(isset($new_skin_path))
echo get_skin_stylesheet($new_skin_path);
if(isset($search_skin_path))
echo get_skin_stylesheet($search_skin_path);
if(isset($connect_skin_path))
echo get_skin_stylesheet($connect_skin_path);
if(isset($poll_skin_path))
echo get_skin_stylesheet($poll_skin_path);
}
?>
<!--[if lte IE 8]>
<script src="<?=G4_JS_URL?>/html5.js"></script>
<![endif]-->
@ -78,24 +62,9 @@ var g4_cookie_domain = "<?=G4_COOKIE_DOMAIN?>";
?>
</script>
<script src="<?=G4_JS_URL?>/jquery-1.8.3.min.js"></script>
<script src="<?=G4_JS_URL?>/jquery.menu.js"></script>
<script src="<?=G4_JS_URL?>/common.js"></script>
<script src="<?=G4_JS_URL?>/wrest.js"></script>
<? // 스킨의 javascript 불러옴
if (!defined('G4_IS_ADMIN')) {
if(isset($board_skin_path))
echo get_skin_javascript($board_skin_path, 'js');
if(isset($member_skin_path))
echo get_skin_javascript($member_skin_path, 'js');
if(isset($new_skin_path))
echo get_skin_javascript($new_skin_path, 'js');
if(isset($search_skin_path))
echo get_skin_javascript($search_skin_path, 'js');
if(isset($connect_skin_path))
echo get_skin_javascript($connect_skin_path, 'js');
if(isset($poll_skin_path))
echo get_skin_javascript($poll_skin_path, 'js');
}
?>
<? if(G4_IS_MOBILE) { ?>
<script>
set_cookie("device_width", screen.width, 6, g4_cookie_domain);

106
js/jquery.menu.js Normal file
View File

@ -0,0 +1,106 @@
$(function(){
var hide_menu = false;
var mouse_event = false;
var oldX = oldY = 0;
$(document).mousemove(function(e) {
if(oldX == 0) {
oldX = e.pageX;
oldY = e.pageY;
}
if(oldX != e.pageX || oldY != e.pageY) {
mouse_event = true;
}
});
// 주메뉴
var $gnb = $(".gnb_1depth > a");
$gnb.mouseover(function() {
if(mouse_event) {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
}
});
$gnb.mouseout(function() {
hide_menu = true;
});
$(".gnb_1depth li").mouseover(function() {
hide_menu = false;
});
$(".gnb_1depth li").mouseout(function() {
hide_menu = true;
});
$gnb.focusin(function() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
});
$gnb.focusout(function() {
hide_menu = true;
});
$(".gnb_1depth ul a").focusin(function() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
var $gnb_li = $(this).closest(".gnb_1depth").addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).closest(".gnb_1depth"));
hide_menu = false;
});
$(".gnb_1depth ul a").focusout(function() {
hide_menu = true;
});
$('#gnb_ul>li').bind('mouseleave',function(){
submenu_hide();
});
$(document).bind('click focusin',function(){
if(hide_menu) {
submenu_hide();
}
});
function submenu_hide() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
}
// 텍스트 리사이즈 카운트 쿠키있으면 실행
var resize_act;
var text_resize_count = parseInt(get_cookie("ck_font_resize_count"));
if(!isNaN(text_resize_count)) {
if(text_resize_count > 0)
resize_act = "increase";
else if(text_resize_count < 0)
resize_act = "decrease";
if(Math.abs(text_resize_count) > 0)
font_resize2("container", resize_act, Math.abs(text_resize_count));
}
});
function menu_rearrange(el)
{
var width = $("#gnb_ul").width();
var left = w1 = w2 = 0;
var idx = $(".gnb_1depth").index(el);
for(i=0; i<=idx; i++) {
w1 = $(".gnb_1depth:eq("+i+")").outerWidth();
w2 = $(".gnb_2depth > a:eq("+i+")").outerWidth(true);
if((left + w2) > width) {
el.removeClass("gnb_1depth_over").addClass("gnb_1depth_over2");
}
left += w1;
}
}

View File

@ -1928,4 +1928,45 @@ if (!function_exists('file_put_contents')) {
}
}
}
// HTML 마지막 처리
function html_end()
{
global $g4;
// 현재접속자 처리
$tmp_sql = " select count(*) as cnt from {$g4['login_table']} where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$tmp_row = sql_fetch($tmp_sql);
//sql_query(" lock table $g4['login_table'] write ", false);
if ($tmp_row['cnt']) {
$tmp_sql = " update {$g4['login_table']} set mb_id = '{$member['mb_id']}', lo_datetime = '".G4_TIME_YMDHIS."', lo_location = '$lo_location', lo_url = '$lo_url' where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($tmp_sql, FALSE);
} else {
$tmp_sql = " insert into {$g4['login_table']} ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '{$_SERVER['REMOTE_ADDR']}', '{$member['mb_id']}', '".G4_TIME_YMDHIS."', '$lo_location', '$lo_url' ) ";
sql_query($tmp_sql, FALSE);
// 시간이 지난 접속은 삭제한다
sql_query(" delete from {$g4['login_table']} where lo_datetime < '".date("Y-m-d H:i:s", G4_SERVER_TIME - (60 * $config['cf_login_minutes']))."' ");
// 부담(overhead)이 있다면 테이블 최적화
//$row = sql_fetch(" SHOW TABLE STATUS FROM `$mysql_db` LIKE '$g4['login_table']' ");
//if ($row['Data_free'] > 0) sql_query(" OPTIMIZE TABLE $g4['login_table'] ");
}
// 버퍼의 내용에서 body 태그 중간의 외부 css 파일을 CAPTURE 하여 head 태그로 이동시켜준다.
$buffer = ob_get_contents();
ob_end_clean();
preg_match('#<body>(.*)</body>#is', $buffer, $bodys);
preg_match_all('/<link[^>]+>/i', $bodys[0], $links);
$stylesheet = '';
$links[0] = array_unique($links[0]);
foreach ($links[0] as $key=>$link) {
//$link = PHP_EOL.$links[0][$i];
$stylesheet .= PHP_EOL.$link;
$buffer = preg_replace('#'.$link.'#', '', $buffer);
}
return preg_replace('#(</title>)#', "$1$stylesheet", $buffer);
}
?>

View File

@ -13,6 +13,7 @@ function connect($skin_dir='')
if (!$skin_dir)
$skin_dir = $config['cf_connect_skin'];
$connect_skin_path = G4_SKIN_PATH.'/connect/'.$skin_dir;
$connect_skin_url = G4_SKIN_URL.'/connect/'.$skin_dir;
ob_start();
include_once ($connect_skin_path.'/connect.skin.php');

View File

@ -39,11 +39,13 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40)
include_once($cache_file);
/*
// 같은 스킨은 .css 를 한번만 호출한다.
if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {
echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';
$css[] = $skin_dir;
}
*/
ob_start();
include $latest_skin_path.'/latest.skin.php';

View File

@ -20,8 +20,10 @@ function poll($skin_dir='basic', $po_id=false)
ob_start();
if (G4_IS_MOBILE) {
$poll_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/poll/'.$skin_dir;
$poll_skin_url = G4_MOBILE_URL.'/'.G4_SKIN_DIR.'/poll/'.$skin_dir;
} else {
$poll_skin_path = G4_SKIN_PATH.'/poll/'.$skin_dir;
$poll_skin_url = G4_SKIN_URL.'/poll/'.$skin_dir;
}
include_once ($poll_skin_path.'/poll.skin.php');
$content = ob_get_contents();

View File

@ -9,7 +9,7 @@ function it_img_thumb($filename, $filepath, $thumb_width, $thumb_height, $is_cre
}
// 게시글리스트 썸네일 생성
function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create=false, $is_crop=true)
function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
{
global $g4, $config;
$filename = $alt = "";

View File

@ -9,6 +9,8 @@ if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
?>
<link rel="stylesheet" href="<?=$board_skin_url?>/style.css">
<? if (!$wr_id) {?><h1 id="bo_list_title"><?=$board['bo_subject']?></h1><?}?>
<!-- 게시판 목록 시작 -->

View File

@ -3,6 +3,8 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
?>
<link rel="stylesheet" href="<?=$board_skin_url?>/style.css">
<div id="bo_v" style="width:<?=$width;?>">
<p id="bo_v_cate">

View File

@ -2,6 +2,8 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$board_skin_url?>/style.css">
<h1 id="wrapper_title"><?=$g4['title']?></h1>
<form name="fwrite" id="fwrite" action="<?=$action_url?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?=$width;?>">

View File

@ -3,4 +3,6 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 회원수는 $row['mb_cnt'];
?>
<link rel="stylesheet" href="<?=$connect_skin_url?>/style.css">
<?=$row['total_cnt']?>

View File

@ -2,6 +2,8 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$connect_skin_url?>/style.css">
<table id="current_connect_tbl" class="basic_tbl">
<thead>
<tr>

View File

View File

@ -2,6 +2,8 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$latest_skin_url?>/style.css">
<div class="lt">
<strong class="lt_title"><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$bo_table?>"><?=$bo_subject?></a></strong>
<ul>

View File

@ -2,6 +2,7 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$member_skin_url?>/style.css">
<script src="<?=G4_JS_URL?>/jquery.register_form.js"></script>
<form name="fregisterform" id="fregisterform" action="<?=$register_action_url?>" onsubmit="return fregisterform_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">

View File

@ -2,6 +2,8 @@
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$new_skin_url?>/style.css">
<!-- 검색 -->
<fieldset id="new_sch">
<legend>상세검색</legend>

View File

@ -2,6 +2,8 @@
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$poll_skin_url?>/style.css">
<form name="fpoll" action="<?=G4_BBS_URL?>/poll_update.php" onsubmit="return fpoll_submit(this);" method="post">
<input type="hidden" name="po_id" value="<?=$po_id?>">
<input type="hidden" name="skin_dir" value="<?=$skin_dir?>">

View File

@ -2,6 +2,8 @@
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$poll_skin_url?>/style.css">
<div id="poll_result" class="new_win">
<h1><?=$g4['title']?></h1>

View File

@ -2,6 +2,8 @@
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<link rel="stylesheet" href="<?=$search_skin_url?>/style.css">
<form name="fsearch" onsubmit="return fsearch_submit(this);" method="get">
<input type="hidden" name="srows" value="<?=$srows?>">
<fieldset id="sch_result_detail">

View File

@ -21,133 +21,12 @@ $(function() {
<![endif]-->
<script>
$(function(){
var hide_menu = false;
var mouse_event = false;
var oldX = oldY = 0;
$(document).mousemove(function(e) {
if(oldX == 0) {
oldX = e.pageX;
oldY = e.pageY;
}
if(oldX != e.pageX || oldY != e.pageY) {
mouse_event = true;
}
});
// 주메뉴
var $gnb = $(".gnb_1depth > a");
$gnb.mouseover(function() {
if(mouse_event) {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
}
});
$gnb.mouseout(function() {
hide_menu = true;
});
$(".gnb_1depth li").mouseover(function() {
hide_menu = false;
});
$(".gnb_1depth li").mouseout(function() {
hide_menu = true;
});
$gnb.focusin(function() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
});
$gnb.focusout(function() {
hide_menu = true;
});
$(".gnb_1depth ul a").focusin(function() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
var $gnb_li = $(this).closest(".gnb_1depth").addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).closest(".gnb_1depth"));
hide_menu = false;
});
$(".gnb_1depth ul a").focusout(function() {
hide_menu = true;
});
$('#gnb_ul>li').bind('mouseleave',function(){
submenu_hide();
});
$(document).bind('click focusin',function(){
if(hide_menu) {
submenu_hide();
}
});
function submenu_hide() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
}
// 텍스트 리사이즈 카운트 쿠키있으면 실행
var resize_act;
var text_resize_count = parseInt(get_cookie("ck_font_resize_count"));
if(!isNaN(text_resize_count)) {
if(text_resize_count > 0)
resize_act = "increase";
else if(text_resize_count < 0)
resize_act = "decrease";
if(Math.abs(text_resize_count) > 0)
font_resize2("container", resize_act, Math.abs(text_resize_count));
}
});
function menu_rearrange(el)
{
var width = $("#gnb_ul").width();
var left = w1 = w2 = 0;
var idx = $(".gnb_1depth").index(el);
for(i=0; i<=idx; i++) {
w1 = $(".gnb_1depth:eq("+i+")").outerWidth();
w2 = $(".gnb_2depth > a:eq("+i+")").outerWidth(true);
if((left + w2) > width) {
el.removeClass("gnb_1depth_over").addClass("gnb_1depth_over2");
}
left += w1;
}
}
</script>
</body>
</html>
<?
$tmp_sql = " select count(*) as cnt from {$g4['login_table']} where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$tmp_row = sql_fetch($tmp_sql);
//sql_query(" lock table $g4['login_table'] write ", false);
if ($tmp_row['cnt']) {
$tmp_sql = " update {$g4['login_table']} set mb_id = '{$member['mb_id']}', lo_datetime = '".G4_TIME_YMDHIS."', lo_location = '$lo_location', lo_url = '$lo_url' where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($tmp_sql, FALSE);
} else {
$tmp_sql = " insert into {$g4['login_table']} ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '{$_SERVER['REMOTE_ADDR']}', '{$member['mb_id']}', '".G4_TIME_YMDHIS."', '$lo_location', '$lo_url' ) ";
sql_query($tmp_sql, FALSE);
// 시간이 지난 접속은 삭제한다
sql_query(" delete from {$g4['login_table']} where lo_datetime < '".date("Y-m-d H:i:s", G4_SERVER_TIME - (60 * $config['cf_login_minutes']))."' ");
// 부담(overhead)이 있다면 테이블 최적화
//$row = sql_fetch(" SHOW TABLE STATUS FROM `$mysql_db` LIKE '$g4['login_table']' ");
//if ($row['Data_free'] > 0) sql_query(" OPTIMIZE TABLE $g4['login_table'] ");
}
// HTML 마지막 처리 함수 : 반드시 넣어주시기 바랍니다.
echo html_end();
?>