ckeditor, captcha 수정중

This commit is contained in:
gnuboard
2013-01-10 10:57:44 +09:00
parent 1ff1d90efd
commit b370acf97a
8 changed files with 34 additions and 77 deletions

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 = get_captcha('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,7 +137,7 @@ $captcha->run();
*/
// 캡챠이미지는 한개만 사용 가능함.
function get_captcha($input_name, $captcha_no)
function get_captcha($input_name, $captcha_no=1)
{
global $g4;
@ -170,4 +170,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

@ -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;
}