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

This commit is contained in:
whitedot
2013-01-10 13:16:39 +09:00
11 changed files with 52 additions and 91 deletions

View File

@ -1,4 +1,5 @@
<?
define('_CAPTCHA_', true);
include_once('./_common.php');
if (!$board['bo_table']) {

View File

@ -1,6 +1,11 @@
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$captcha_html = "";
if ($is_guest) {
$captcha_html = captcha_html('wr_key', '_comment');
}
@include_once($board_skin_path.'/view_comment.head.skin.php');
// 코멘트를 새창으로 여는 경우 세션값이 없으므로 생성한다.

View File

@ -1,4 +1,5 @@
<?
define('_CAPTCHA_', true);
include_once('./_common.php');
set_session('ss_bo_table', $bo_table);
@ -204,6 +205,11 @@ if ($board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_leve
$is_dhtml_editor = false;
}
$captcha_html = "";
if ($is_guest) {
$captcha_html = captcha_html('wr_key');
}
$is_mail = false;
if ($config['cf_email_use'] && $board['bo_use_email'])
$is_mail = true;
@ -247,6 +253,8 @@ if ($board['bo_use_file_content']) {
$is_file_content = true;
}
$file_count = (int)$board['bo_upload_count'];
$name = "";
$email = "";
$homepage = "";
@ -350,34 +358,6 @@ if ($is_admin) {
include_once($g4['path'].'/head.sub.php');
include_once('./board_head.php');
//--------------------------------------------------------------------------
// 가변 파일
$file_script = '';
$file_length = -1;
// 수정의 경우 파일업로드 필드가 가변적으로 늘어나야 하고 삭제 표시도 해주어야 합니다.
if ($w == 'u') {
for ($i=0; $i<$file['count']; $i++) {
$row = sql_fetch(" select bf_file, bf_content from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row['bf_file']) {
$file_script .= 'add_file("<input type="checkbox" name="bf_file_del['.$i.']" value="1"><a href="'.$file[$i]['href'].'">'.$file[$i]['source'].'('.$file[$i]['size'].')</a> 파일 삭제';
if ($is_file_content)
//$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.$row['bf_content'].'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
// 첨부파일설명에서 ' 또는 " 입력되면 오류나는 부분 수정
$file_script .= '<br><input type="text" class="ed" size="50" name="bf_content['.$i.']" value="'.addslashes(get_text($row['bf_content'])).'" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요.">';
$file_script .= '\");'.PHP_EOL;
}
else
$file_script .= 'add_file("");'.PHP_EOL;
}
$file_length = $file['count'] - 1;
}
if ($file_length < 0) {
$file_script .= 'add_file("");'.PHP_EOL;
$file_length = 0;
}
//--------------------------------------------------------------------------
if ($g4['https_url'])
$action_url = "{$g4['https_url']}/{$g4['bbs']}/write_update.php";
else

View File

@ -1,4 +1,5 @@
<?
define('_CAPTCHA_', true);
include_once('./_common.php');
$g4['title'] = '게시글 저장';
@ -150,7 +151,7 @@ if ($w == '' || $w == 'u') {
alert('w 값이 제대로 넘어오지 않았습니다.');
}
if (!chk_captcha()) {
if (!chk_captcha('wr_key')) {
alert('자동등록방지의 답변으로 입력한 숫자가 틀렸습니다.');
}

View File

@ -8,5 +8,7 @@ if (defined('_CAPTCHA_')) {
);
include_once($captcha->lib);
} else {
unset($_SESSION['ss_captcha_use']);
}
?>

View File

@ -58,6 +58,7 @@ header("Pragma: no-cache"); // HTTP/1.0
// 자바스크립트에서 사용하는 전역변수 선언
var g4_path = "<?=$g4['path']?>";
var g4_bbs = "<?=$g4['bbs']?>";
var g4_bbs_path = "<?=$g4['bbs_path']?>";
var g4_bbs_img = "<?=$g4['bbs_img']?>";
var g4_url = "<?=$g4['url']?>";
var g4_is_member = "<?=isset($is_member)?$is_member:'';?>";

View File

@ -137,25 +137,24 @@ $captcha->run();
*/
// 캡챠이미지는 한개만 사용 가능함.
function get_captcha($input_name, $captcha_no)
function captcha_html($input_name, $captcha_id_suffix='')
{
global $g4;
// 세션생성을 한후 다음페이지에서 해당 세션이 있을때만 올바른 캡챠코드인지 비교합니다.
set_session('ss_captcha_use', true);
$captcha_class = str_pad($captcha_no,2,'0',STR_PAD_LEFT);// 캡챠 클래스를 선택할 수 있도록 지운아빠 2012-07-24
$code = '<fieldset id="captcha'.$captcha_class.'">';
$code .= '<legend>자동등록방지</legend>';
//$code .= '<img src="" id="captcha" alt="자동등록방지 이미지" title="이미지를 클릭하시면 숫자가 바뀝니다.">';
$code .= '<iframe id="captcha_iframe" name="captcha_iframe" src="'.$g4['path'].'/plugin/captcha/run.php" width="80" height="25" frameborder="0" scrolling="no"></iframe>';
$code .= '<a href="'.$g4['path'].'/plugin/captcha/run.php" target="captcha_iframe">새로고침</a>';
$code .= '<a href="'.$g4['path'].'/plugin/captcha/wav.php" id="captcha_wav">wav</a>';
$code .= '<label>자동등록방지 입력</label>';
$code .= '<input type="text" id="captcha_key" name="'.$input_name.'" class="captcha_box frm_input" size="10" maxlength="5" required title="자동등록방지 입력">';
$code .= '<p>이미지의 숫자를 순서대로 입력하세요. 새로고침을 클릭하시면 새로운 숫자가 나타납니다.</p>';
$code .= '</fieldset>';
return $code;
$html = '<fieldset id="captcha'.$captcha_id_suffix.'">';
$html .= '<legend>자동등록방지</legend>';
//$html .= '<img src="" id="captcha" alt="자동등록방지 이미지" title="이미지를 클릭하시면 숫자가 바뀝니다.">';
$html .= '<iframe id="captcha_iframe" name="captcha_iframe" src="'.$g4['path'].'/plugin/captcha/run.php" width="80" height="25" frameborder="0" scrolling="no"></iframe>';
$html .= '<a href="'.$g4['path'].'/plugin/captcha/run.php" target="captcha_iframe">새로고침</a>';
$html .= '<a href="'.$g4['path'].'/plugin/captcha/wav.php" id="captcha_wav">wav</a>';
$html .= '<label>자동등록방지 입력</label>';
$html .= '<input type="text" id="captcha_key" name="'.$input_name.'" class="captcha_box frm_input" size="10" maxlength="5" required title="자동등록방지 입력">';
$html .= '<p>이미지의 숫자를 순서대로 입력하세요. 새로고침을 클릭하시면 새로운 숫자가 나타납니다.</p>';
$html .= '</fieldset>';
return $html;
}
@ -170,4 +169,10 @@ function chk_captcha($input_name)
}
return true;
}
// captcha javascript code
function captcha_js($element)
{
return "if (!check_captcha({$element})) { return false; }";
}
?>

View File

@ -23,7 +23,7 @@ function editor_getdata($id)
function editor_empty($id, $textarea_name="내용을")
{
if (defined('_EDITOR_'))
return "if (!{$id}_data) { alert(\"$textarea_name 입력해 주십시오.\"); return false; }\n";
return "if (!{$id}_data) { alert(\"$textarea_name 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\n";
else
return "";
}

View File

@ -25,7 +25,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
</dl>
</section>
<? if ($view['file'][$i]) {?>
<? if (!empty($view['file'])) {?>
<section id="bo_v_file">
<h2>첨부파일</h2>
<ul>
@ -51,7 +51,7 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
</section>
<? } ?>
<? if ($view['link'][$i]) {?>
<? if (!empty($view['link'])) {?>
<section id="bo_v_link">
<h2>관련링크</h2>
<ul>

View File

@ -75,8 +75,7 @@ var char_max = parseInt(<?=$comment_max?>); // 최대
<? if ($is_guest) { ?>
<label for="wr_name">이름</label> <input type="text" id="wr_name" name="wr_name" class="fieldset_input" maxLength="20" size="10" required>
<label for="wr_password">패스워드</label> <input type="password" id="wr_password" name="wr_password" class="fieldset_input" maxLength="20" size="10" required>
<img id="kcaptcha_image" alt="" />
<input type="text" name="wr_key" class="fieldset_input" title="왼쪽의 글자를 입력하세요." size="10" required>
<? echo $captcha_html; ?>
<? } ?>
<input type="checkbox" id="wr_secret" name="wr_secret" value="secret">
<label for="wr_secret">비밀글</label>

View File

@ -112,55 +112,27 @@ if ($option) {
<tr>
<th scope="row"><label for="wr_content">내용</label></th>
<td>
<?=editor_textarea("wr_content", $content);?>
<textarea id="wr_content" name="wr_content" class="ckeditor" rows="10" style="width:100%;"><?=$content?></textarea>
<? if ($write_min || $write_max) { ?><span id="char_count"></span>글자<?}?>
<? if ($write_min || $write_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?}?>
</td>
</tr>
<? if ($is_link) { ?>
<? for ($i=1; $i<=$g4['link_count']; $i++) { ?>
<? for ($i=1; $is_link && $i<=$g4['link_count']; $i++) { ?>
<tr>
<th scope="row"><label for="wr_link<?=$i?>">링크 #<?=$i?></label></th>
<td><input type="text" id="wr_link<?=$i?>" name="wr_link<?=$i?>" class="frm_input" size="60" value="<?if($w=="u"){echo$write['wr_link'.$i];}?>"></td>
</tr>
<? } ?>
<? } ?>
<? if ($is_file) { ?>
<? for ($i=1; $is_file && $i<=$file_count; $i++) { ?>
<tr>
<th scope="row">파일 #1</th>
<td>
<input type="file" name="bf_file[]" class="frm_input frm_file" size="50" title="파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능">
<input type="text" name="bf_content[]" class="frm_input" size="50" title="파일 설명을 입력해주세요.">
</td>
</tr>
<tr>
<th scope="row">파일 #2</th>
<td>
<input type="file" name="bf_file[]" class="frm_input frm_file" size="50" title="파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능">
<input type="text" name="bf_content[]" class="frm_input" size="50" title="파일 설명을 입력해주세요.">
</td>
</tr>
<tr>
<th scope="row">파일 #3</th>
<td>
<input type="file" name="bf_file[]" class="frm_input frm_file" size="50" title="파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능">
<input type="text" name="bf_content[]" class="frm_input" size="50" title="파일 설명을 입력해주세요.">
</td>
</tr>
<tr>
<th scope="row">파일 #4</th>
<td>
<input type="file" name="bf_file[]" class="frm_input frm_file" size="50" title="파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능">
<input type="text" name="bf_content[]" class="frm_input" size="50" title="파일 설명을 입력해주세요.">
</td>
</tr>
<tr>
<th scope="row">파일 #5</th>
<th scope="row">파일 #<?=$i?></th>
<td>
<input type="file" name="bf_file[]" class="frm_input frm_file" size="50" title="파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능">
<? if ($is_file_content) { ?>
<input type="text" name="bf_content[]" class="frm_input" size="50" title="파일 설명을 입력해주세요.">
<?}?>
</td>
</tr>
<?}?>
@ -168,9 +140,7 @@ if ($option) {
</tbody>
</table>
<?
echo run_captcha();
?>
<?=$captcha_html?>
<div class="btn_confirm">
<input type="submit" id="btn_submit" value="글쓰기" accesskey="s">
@ -253,14 +223,13 @@ function fwrite_submit(f)
}
*/
<?
echo chk_editor("wr_content");
?>
<? echo editor_getdata("wr_content"); ?>
<? echo editor_empty("wr_content"); ?>
var subject = "";
var content = "";
$.ajax({
url: bbs_path+"/filter.ajax.php",
url: g4_bbs_path+"/filter.ajax.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
@ -290,9 +259,7 @@ function fwrite_submit(f)
return false;
}
<?
echo chk_js_captcha();
?>
<? if (defined('_CAPTCHA_')) echo captcha_js('f.wr_key'); ?>
return true;
}