겸손한 자바스크립트 적용중

This commit is contained in:
gnuboard
2013-01-15 19:02:38 +09:00
parent 5d8d481731
commit 7a574f5077
5 changed files with 32 additions and 48 deletions

View File

@ -78,7 +78,7 @@ include_once ('./admin.head.php');
<li><a href="#frm_extra">여분필드</a></li>
</ul>
<form id="fboardform" name="fboardform" method="post" onsubmit="return fboardform_submit(this)" enctype="multipart/form-data">
<form id="fboardform" name="fboardform" action="./board_form_update.php" method="post" onsubmit="return fboardform_submit(this)" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?=$w?>">
<input type="hidden" name="sfl" value="<?=$sfl?>">
<input type="hidden" name="stx" value="<?=$stx?>">
@ -92,7 +92,7 @@ include_once ('./admin.head.php');
<tr>
<th scope="row"><label for="bo_table">TABLE</label></th>
<td colspan="2">
<input type="text" id="bo_table" name="bo_table" maxlength="20" <?=$bo_table_attr?> value="<?=$board['bo_table'] ?>">
<input type="text" id="bo_table" name="bo_table" maxlength="20" <?=$bo_table_attr?> value="<?=$board['bo_table'] ?>" required="required">
<?
if ($w == '')
echo '영문자, 숫자, _ 만 가능 (공백없이 20자 이내)';
@ -104,14 +104,13 @@ include_once ('./admin.head.php');
<tr>
<th scope="row"><label for="gr_id">그룹</label></th>
<td colspan="2">
<?=get_group_select('gr_id', $board['gr_id'], "required");?>
<? if ($w=='u') { ?><a href="javascript:location.href='./board_list.php?sfl=a.gr_id&amp;stx='+document.fboardform.gr_id.value;">동일그룹게시판목록</a><?}?>
<?=get_group_select('gr_id', $board['gr_id'], 'required="required"');?>
</td>
</tr>
<tr>
<th scope="row"><label for="bo_subject">게시판 제목</label></th>
<td colspan="2">
<input type="text" id="bo_subject" name="bo_subject" maxlength="120" class="required" value="<?=get_text($board['bo_subject'])?>" size="80">
<input type="text" id="bo_subject" name="bo_subject" maxlength="120" class="required" value="<?=get_text($board['bo_subject'])?>" size="80" required="required">
</td>
</tr>
<tr>
@ -295,11 +294,10 @@ include_once ('./admin.head.php');
<td>
<?=help('"체크박스"는 글작성시 비밀글 체크가 가능합니다. "무조건"은 작성되는 모든글을 비밀글로 작성합니다. (관리자는 체크박스로 출력합니다.) 스킨에 따라 적용되지 않을 수 있습니다.')?>
<select id="bo_use_secret" name="bo_use_secret">
<option value='0'>사용하지 않음
<option value="1">체크박스
<option value='2'>무조건
<?=option_selected(0, $board['bo_use_secret'], "사용하지 않음");?>
<?=option_selected(1, $board['bo_use_secret'], "체크박스");?>
<?=option_selected(2, $board['bo_use_secret'], "무조건");?>
</select>
<script>document.getElementById('bo_use_secret').value="<?=$board['bo_use_secret']?>";</script>
</td>
<td class="group_setting">
<input type="checkbox" id="chk_use_secret" name="chk_use_secret" value="1">
@ -521,14 +519,7 @@ if (!preg_match("/([m|M])$/", $upload_max_filesize)) {
<tr>
<th scope="row"><label for="bo_skin">스킨 디렉토리</label></th>
<td>
<select id="bo_skin" name="bo_skin" class="required">
<?
$arr = get_skin_dir('board');
for ($i=0; $i<count($arr); $i++) {
echo '<option value="'.$arr[$i].'">'.$arr[$i].'</option>'.PHP_EOL;
}
?></select>
<script>document.fboardform.bo_skin.value="<?=$board['bo_skin']?>";</script>
<?=get_skin_select("board", "bo_skin", "bo_skin", $board['bo_skin'], 'required="required"');?>
</td>
<td class="group_setting">
<input type="checkbox" id="chk_skin" name="chk_skin" value="1">
@ -787,18 +778,25 @@ if (!preg_match("/([m|M])$/", $upload_max_filesize)) {
<legend>XSS 혹은 CSRF 방지</legend>
<p>관리자 권한을 탈취당하는 경우를 대비하여 패스워드를 다시 한번 확인합니다.</p>
<label for="admin_password">관리자 패스워드</label>
<input type="password" id="admin_password" name="admin_password" class="required" title="관리자 패스워드">
<input type="password" id="admin_password" name="admin_password" class="required" title="관리자 패스워드" required="required">
</fieldset>
<div class="btn_confirm">
<input type="submit" class="btn_submit" accesskey="s" value="확인">
<button onclick="document.location.href='./board_list.php?<?=$qstr?>';">목록</button>
<? if ($w == 'u') { ?><button onclick="board_copy('<?=$bo_table?>');">게시판복사</button><?}?>
<a href="./board_list.php?<?=$qstr?>">목록</a>
<? if ($w == 'u') { ?><a href="./board_copy.php?bo_table=<?=$bo_table?>" id="board_copy" target="win_board_copy">게시판복사</a><?}?>
</div>
</form>
<script>
$(function(){
$("#board_copy").click(function(){
window.open(this.href, "win_board_copy", "left=10,top=10,width=500,height=400");
return false;
});
});
function board_copy(bo_table) {
window.open("./board_copy.php?bo_table="+bo_table, "BoardCopy", "left=10,top=10,width=500,height=200");
}
@ -834,7 +832,6 @@ function fboardform_submit(f)
return false;
}
f.action = './board_form_update.php';
return true;
}
</script>

View File

@ -7,10 +7,15 @@ if ($w == 'u')
auth_check($auth[$sub_menu], 'w');
if ($member['mb_password'] != sql_password($_POST['admin_password'])) {
alert('패스워드가 다릅니다.');
if ($_POST['admin_password']) {
if ($member['mb_password'] != sql_password($_POST['admin_password'])) {
alert('관리자 패스워드가 틀립니다.');
}
} else {
alert('관리자 패스워드를 입력하세요.');
}
if (!$_POST['gr_id']) { alert('그룹 ID는 반드시 선택하세요.'); }
if (!$bo_table) { alert('게시판 TABLE명은 반드시 입력하세요.'); }
if (!preg_match("/^([A-Za-z0-9_]{1,20})$/", $bo_table)) { alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); }

View File

@ -70,9 +70,9 @@ var list_delete_php = 'board_list_delete.php';
</span>
<label for="sfl">검색대상</label>
<select id="sfl" name="sfl">
<option value="bo_table">TABLE</option>
<option value="bo_subject">제목</option>
<option value="a.gr_id">그룹ID</option>
<option value="bo_table" <?=option_selected($_GET['sfl'], "bo_table");?>>TABLE</option>
<option value="bo_subject" <?=option_selected($_GET['sfl'], "bo_subject");?>>제목</option>
<option value="a.gr_id" <?=option_selected($_GET['sfl'], "a.gr_id");?>>그룹ID</option>
</select>
<input type="text" name="stx" required value="<?=$stx?>" title="검색어">
<input type="submit" class="fieldset_submit" value="검색">
@ -113,17 +113,6 @@ var list_delete_php = 'board_list_delete.php';
</thead>
<tbody>
<?
// 스킨디렉토리
$skin_options = '';
$arr = get_skin_dir('board');
for ($k=0; $k<count($arr); $k++) {
$option = $arr[$k];
if (strlen($option) > 10)
$option = substr($arr[$k], 0, 18) . '…';
$skin_options .= '<option value="'.$arr[$k].'">'.$option.'</option>';
}
for ($i=0; $row=sql_fetch_array($result); $i++) {
$s_upd = '<a href="./board_form.php?w=u&amp;bo_table='.$row['bo_table'].'&amp;'.$qstr.'">수정</a>';
$s_del = "";
@ -150,12 +139,9 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
<a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$row['bo_table']?>"><?=$row['bo_table']?></a>
</td>
<td>
<select id="bo_skin_<?=$i?>" name="bo_skin[<?=$i?>]">
<?=$skin_options?>
</select>
<script>document.getElementById("bo_skin_<?=$i?>").value="<?=$row['bo_skin']?>";</script>
<?=get_skin_select("board", "bo_skin_$i", "bo_skin[$i]", $row['bo_skin']);?>
</td>
<td><input type="text" id="bo_subject[<?=$i?>]" name="bo_subject[<?=$i?>]" value="<?=get_text($row['bo_subject'])?>" title="게시판제목" size="20"></td>
<td><input type="text" id="bo_subject[<?=$i?>]" name="bo_subject[<?=$i?>]" class="required" value="<?=get_text($row['bo_subject'])?>" title="게시판제목" size="20" required="required"></td>
<td>
<label for="bo_read_point_<?=$i?>">읽기</label>
<input type="text" id="bo_read_point_<?=$i?>" name="bo_read_point[<?=$i?>]" value="<?=$row['bo_read_point']?>" size="2">
@ -190,10 +176,6 @@ if ($i == 0)
<?}?>
</div>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택수정 및 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?
$pagelist = get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr.'&amp;page=');
?>

View File

@ -5,7 +5,7 @@ include_once('./_common.php');
check_demo();
if (!count($_POST['chk'])) {
alert($_POST['btn_submit']." 하실 항목을 하나 이상 선택하세요.");
alert($_POST['btn_submit']." 하실 항목을 하나 이상 체크하세요.");
}
if ($_POST['btn_submit'] == "선택수정") {

View File

@ -9,7 +9,7 @@ auth_check($auth[$sub_menu], 'w');
if ($is_admin != 'super' && $w == '') alert('최고관리자만 접근 가능합니다.');
if (!preg_match("/^([A-Za-z0-9_]{1,10})$/", $gr_id))
if (!preg_match("/^([A-Za-z0-9_]{1,10})$/", $_POST['gr_id']))
alert('그룹 ID는 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (10자 이내)');
if (!$gr_subject) alert('그룹 제목을 입력하세요.');