GNU/skin/board/A095_jy_note/write.skin.php
<?php 
 if (!defined('_GNUBOARD_')) exit;
 ini_set('display_errors', '1');
 include_once("{$board_skin_path}/db_update.php"); // db 업데이트
 //include_once(G5_PATH.'/_SYSTEM/_M72X2.php'); // 사이트 시스템 파일
 //----------------------------------------------
 ## 죄회수 / 클릭 / 테이블 & 필드
 include_once($jeongyeon_path.'/code.php');
 //----------------------------------------------
 include_once(G5_LIB_PATH.'/thumbnail.lib.php'); // 이미지 섬네일 라이브러리
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ## 이전 데이터 & 첫 데이터 호출
 if ($wr_id) {
    $pre_num = $write['wr_num'] + 1; // 글 수정 시 : 이전 넘버
 } else {
    $new_board = sql_query("select * from $write_table where wr_id is not null order by wr_datetime desc limit 1"); // 새글 시 : 최근 넘버
    $lat_board = sql_fetch_array($new_board);
    $pre_num = $lat_board['wr_num'];
 }
 $board_pre = sql_fetch(" select * from $write_table where wr_num = $pre_num "); // 이전 데이터
 $board_no1 = sql_fetch(" select * from $write_table where wr_num = '-1' "); // 첫 데이터
 //-------------------------------------------------------------------------------------------------
 ## PATCH
 if ($bo_table == "asset_total") include_once("{$board_skin_path}/plugin/asset/asset_write.php"); // 플러그인 : 자산 보드 패치
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
?>
<!----------| STYLE |---------->
 <link rel="stylesheet" href="<?=$board_skin_url;?>/style.css">
<!----------| SCRIPT |---------->
 <script src="<?=G5_JS_URL;?>/viewimageresize.js"></script>
<!----------| WRITE |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
<article id='WRITE'>
   <form name='fwrite' id='fwrite' action='<?=$action_url.$jyq;?>' onsubmit='return fwrite_submit(this);' method='post' enctype='multipart/form-data' autocomplete='off' style='width:<?=$width;?>'>
   <!----------| INPUT |---------->
    <input type='hidden' name='uid'             value='<? echo get_uniqid(); ?>'>
    <input type='hidden' name='w'               value='<?=$w;?>'>
    <input type='hidden' name='bo_table'        value='<?=$bo_table;?>'>
    <input type='hidden' name='wr_id'           value='<?=$wr_id;?>'>
    <input type='hidden' name='wr_num'          value='<?=$write['wr_num'];?>'>
    <input type='hidden' name='sca'             value='<?=$sca;?>'>
    <input type='hidden' name='sfl'             value='<?=$sfl;?>'>
    <input type='hidden' name='stx'             value='<?=$stx;?>'>
    <input type='hidden' name='spt'             value='<?=$spt;?>'>
    <input type='hidden' name='sst'             value='<?=$sst;?>'>
    <input type='hidden' name='sod'             value='<?=$sod;?>'>
    <input type='hidden' name='page'            value='<?=$page;?>'>
    <input type='hidden' name='code'            value='<?=$code;?>'>
   <!----------| OPTION |---------->
    <?
    $option = '';
    $option_hidden = '';
    if ($is_notice || $is_html || $is_secret || $is_mail) { 
        $option = '';
        if ($is_notice) {
            $option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="notice" name="notice"  class="selec_chk" value="1" '.$notice_checked.'>'.PHP_EOL.'<label for="notice"><span></span>공지</label></li>';
        }
        if ($is_html) {
            if ($is_dhtml_editor) {
                $option_hidden .= '<input type="hidden" value="html1" name="html">';
            } else {
                $option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" class="selec_chk" value="'.$html_value.'" '.$html_checked.'>'.PHP_EOL.'<label for="html"><span></span>html</label></li>';
            }
        }
        if ($is_secret) {
            if ($is_admin || $is_secret==1) {
                $option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="secret" name="secret"  class="selec_chk" value="secret" '.$secret_checked.'>'.PHP_EOL.'<label for="secret"><span></span>비밀글</label></li>';
            } else {
                $option_hidden .= '<input type="hidden" name="secret" value="secret">';
            }
        }
        if ($is_mail) {
            $option .= PHP_EOL.'<li class="chk_box"><input type="checkbox" id="mail" name="mail"  class="selec_chk" value="mail" '.$recv_email_checked.'>'.PHP_EOL.'<label for="mail"><span></span>답변메일받기</label></li>';
        }
    }
    echo $option_hidden;
    ?>
   <!----------| TITLE |---------->
    <table cellpadding="0" cellspacing="0" class="Title">
        <tr>
            <td class="L">
                
            </td>
            <td class="C">
                <?
                $g5['title'] = str_replace('글쓰기',"</span><b>글쓰기" ,$g5['title']);
                $g5['title'] = str_replace('글수정',"</span><b>글수정" ,$g5['title']);
                ?>
                <span><?=$g5['title'];?></b>
            </td>
            <td class="R">
               <!-- BUTTON : FIXED -->
                <div class='Fixed'>
                    <button type='button' class='Button2-BOB' onclick="location.href='<?=get_pretty_url($bo_table).$jya;?>'">취소</button>
                    <button type='submit' id='btn_submit' accesskey='s' class='Button2-BOBr'>작성완료</button>
                </div>
            </td>
        </tr>
    </table>
   <!----------| TABLE : BOX |---------->
    <table class="Box" cellpadding="0" cellspacing="0">
       <!----------| BAR |---------->
        <tr class="Bar">
            <td class="Left">
                옵션
            </td>
            <td class="Right">
               <!----------| CATEGORY |---------->
                <? if ($is_category) { ?>
                    <div>분류</div>
                    <div>
                        <select name='ca_name' id='ca_name' required>
                            <? if (!$write["ca_name"]) { ?><option value="<?=date('Y-m');?>"><?=date('Y-m');?></option> <? } ?>
                            <?=$category_option;?>
                        </select>
                    </div>
                <?} ?>
               <!----------| FORM |---------->
                <div>
                    형태
                </div>
                <div>
                    <select name="x2_ca2" id="x2_ca2" required>
                        <option value=''>형태선택</option>
                        <?
                        $bo_1 = explode("|", $board['bo_1']);
                        for ($i=0; $i<count($bo_1); $i++) {
                        ?>
                            <option value='<?=$bo_1[$i];?>'<? if ($write['x2_ca2'] == $bo_1[$i]) echo " selected"; ?>><?=$bo_1[$i];?></option>
                        <? } ?>
                    </select>
                </div>
               <!----------| SEASON |---------->
                <div>
                    기간분류
                </div>
                <div>
                    <?
                    $wr_field = "x2_car2";
                    $select_name = "SEASON.01|SEASON.02|SEASON.03|SEASON.04|SEASON.05|SEASON.06|SEASON.07|SEASON.08|SEASON.09|SEASON.10";
                    ?>
                    <select name='<?=$wr_field;?>' id='<?=$wr_field;?>' required>
                        <?
                        $select_name = $select_name."|UNSET";
                        $arr_select = explode("|", $select_name);
                        for ($s=0; $s<count($arr_select); $s++) {
                            if ($write[$wr_field]==$arr_select[$s]) $selected[$s] = "selected"; else $selected[$s] = "";
                            echo "<option value='{$arr_select[$s]}' {$selected[$s]}>{$arr_select[$s]}</option>";
                        } 
                        // 아래와 같은 경우 초기 상태로 출력 한다.
                        if (!$write[$wr_field] && ($board_pre[$wr_field] && $board_pre[$wr_field] != "UNSET")) {
                            echo "<option value='{$board_pre[$wr_field]}' selected>{$board_pre[$wr_field]}</option>";
                        } else if ($write[$wr_field] == "UNSET" || !$write[$wr_field] && (!$board_pre[$wr_field] || $board_pre[$wr_field] == "UNSET")) {
                            echo "<option value='' selected>시즌</option>";
                        }
                        ?>
                    </select>
                </div>
               <!----------| VERSION |---------->
                <div>
                    버전
                </div>
                <div>
                    <? if ($write['x2_ver']) $write['x2_ver'] = $write['x2_ver']; else $write['x2_ver'] = $board_pre['x2_ver'];?>
                    <input type='text' name='x2_ver' value='<?=$write['x2_ver'];?>' id='x2_ver' size='10' placeholder='버젼' required>
                </div>
                <?
                $ydm = explode(" ", $write['wr_datetime']);
                if ($write['wr_datetime']) {
                    $wr_ydm = $ydm[0];
                    $wr_time = $ydm[1];
                } else {
                    $wr_ydm = date('Y-m-d');
                    $wr_time = date('H:i:s');
                }
                ?>
                <div>
                    년월일
                </div>
                <div>
                    <input type='date' name='date' value='<?=$wr_ydm;?>' id='date'>
                </div>
                <div>
                    시분초
                </div>
                <div>
                    <input type='time' name='time' value='<?=$wr_time;?>' id='time'>
                </div>
                <? if ($option) { ?><ul class="Line-HY"><?=$option;?></ul><? } ?>
            </td>
        </tr>
       <!----------| SUBJECT |---------->
        <tr class="Bar">
            <td class="Left">
                제목
            </td>
            <td class="Right">
                <div>
                    제목
                </div>
                <div>
                    <input type='text' name='wr_subject' value='<?=$subject;?>' id='wr_subject' required placeholder='제목'>
                </div>
            </td>
        </tr>
       <!----------| SUBJECT |---------->
        <tr class="Bar">
            <td class="Left">
                관리
            </td>
            <td class="Right">
                <div>책갈피</div>
                <div class="Bookmark"><label><input type="checkbox" name="bookmark" value="1" <?php if ($write['bookmark']) { echo "checked"; } ?>>&nbsp;&nbsp;책갈피</label></div>
                <div>즐거찾기</div>
                <div class="Bookmark"><label><input type="checkbox" name="frequently" value="1" <?php if ($write['frequently']) { echo "checked"; } ?>>&nbsp;&nbsp;즐겨찾기</label></div>
                <div>낡은 페이지</div>
                <div class="Bookmark"><label><input type="checkbox" name="old" value="1" <?php if ($write['old']) { echo "checked"; } ?>>&nbsp;&nbsp;낡은 페이지</label></div>
                <div>낡은 페이지</div>
                <div class="Bookmark"><label><input type="checkbox" name="dark" value="1" <?php if ($write['dark']) { echo "checked"; } ?>>&nbsp;&nbsp;다크 블럭</label></div>
            </td>
        </tr>
       <!----------| TAG |---------->
        <tr class="Bar">
            <td class="Left">
                태그
            </td>
            <td class="Right">
                <input type="text" name="x2_tag" value="<?=$write['x2_tag'];?>" id="x2_tag" placeholder="태그" required>
            </td>
        </tr>
       <!----------| AUTOSAVE : POP |---------->
        <? if ($is_member) { ?>
            <tr id="autosave_pop" class="Subject-Pop" style="display:none">
                <td class="Left">
                    <div>임시 저장 목록</div>
                    <div class="Close"><button type="button" class="autosave_close Button2-BOb">닫기</button></div>
                </td>
                <td>
                    <p></p>
                    <ul></ul>
                </td>
            </tr>
        <? } ?>
            <!---------| CONTENT : ADD : BUTTON |---------->
            <tr class="Content-Button">
                <td colspan ="2">
                    <button type="button" onclick="document.getElementById('Content-Button').style.display=(document.getElementById('Content-Button').style.display=='none')?'block':'none';" tooltip="내용 / 링크 / 파일 입력" flow="right">내용 및 링크 추가 입력</button>
                </td>
            </tr>

    </table>
   <!---------| CONTENT & LINK & FILE  |---------->
    <? if (!$write['wr_link1'] && !$write['wr_link2'] && !$write['wr_content']) { $hedge = "style='display:none;'"; } ?>
    <table id="Content-Button" cellpadding="0" cellspacing="0" class="Box" <?=$hedge;?>>
       <!---------| COUNTENT : ADD : BUTTON |---------->
        <? if (!$board['bo_use_dhtml_editor']) { ?>
            <tr>
                <td colspan ="2" class="Button-Box">
                    <button type="button" onclick="textarea_increase('wr_content', 30);">확대</button>
                    <button type="button" onclick="textarea_original('wr_content', 15);">기본</button>
                    <button type="button" onclick="textarea_decrease('wr_content', 30);">축소</button>
                </td>
            </tr>
        <? } ?>
       <!---------| INPUT SCRIPT : TITLE NAME |---------->
        <tr>
            <td colspan ="2" class="Time">
                <script language='Javascript'>
                    // 태그 텍스트 폼 입력 스크립트
                    function Add(str) {
                        document.fwrite.wr_content.focus();
                        document.fwrite.wr_content.value+=str;
                        return;
                    }
                </script>
                <ul class="InputTime">
                    <label tooltip="메인 타이틀 시간" flow="right">타이틀 타임</label>
                    <label><b id="clock"></b></label>
                    <a href=javascript:Add('%['+Target.innerText+']%')><label onclick="CopyB()">입력</label></a>
                </ul>
                <ul class="InputTime">
                    <label tooltip="내용 실시간 시간" flow="top">스토리 타임</label>
                    <label><b id="clock2"></b></label>
                    <a href=javascript:Add('^['+Target2.innerText+']^')><label onclick="CopyB()">입력</label></a>
                </ul>
            </td>
        </tr>
       <!---------| INPUT SCRIPT |---------->
        <tr>
            <td colspan ="2" class="Time">
                <ul class="TextCode">
                    <a href=javascript:Add('[Table]')><label>&lt;Table>메인 테이블 시작</label></a>
                    <a href=javascript:Add('[Title]타이틀[/Title]')><label>타이틀 : &lt;Title>&lt;/Title></label></a>
                    <a href=javascript:Add('[Sub]서브[/Sub]')><label>서브 타이틀 : &lt;Sub>&lt;/Sub></label></a>
                    <a href=javascript:Add('[/Table]')><label>메인 테이블 끝&lt;/Table></label></a>
                    <a href=javascript:Add('[Box]\n\n[/Box]')><label>박스 : &lt;Box>&lt;/Box></label></a>
                    <a href=javascript:Add('%['+Target.innerText+']%\n[Table]\n[Title]타이틀[/Title]\n[Sub]서브[/Sub]\n^['+Target2.innerText+']^\u00a0\n[/Table]')><label class="Set">세트&lt;Table> . . . &lt;/Table></label></a>
                </ul>
            </td>
        </tr>
       <!---------| COUNTENT |---------->
        <? $editor_line = $is_dhtml_editor ? $config['cf_editor'] : ''; ?>
        <tr>
            <td colspan ="2" class="Write-Content <?=$editor_line;?>">
                <? if($write_min || $write_max) { ?>
                <p id='char_count_desc'>이 게시판은 최소 <strong><?=$write_min;?></strong>글자 이상, 최대 <strong><?=$write_max;?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p><? } // 최소/최대글자 ?>
                <?=$editor_html; // 에디터 or
                if($write_min || $write_max) { // 최소/최대글자 ?>
                    <div id="char_count_wrap"><span id="char_count"></span>글자</div>
                <? } ?>
            </td>
        </tr>
       <!---------| LINK |---------->
        <? for ($i=1; $is_link && $i<=G5_LINK_COUNT; $i++) { ?>
        <tr class="Bar">
            <td class="Left">
                링크 #<?=$i;?>
            </td>
            <td class="Right">
                <? if($w=="u") { $link_val = $write['wr_link'.$i]; } ?>
                <input type="text" name="wr_link<?=$i;?>" value="<?=$link_val;?>" id="wr_link<?=$i;?>" placeholder="링크 #<?=$i;?>">
            </td>
        </tr>
        <? } ?>
       <!---------| FILE |---------->
        <tr>
            <td colspan ="2" style="border:0px;">
                <? include_once("{$board_skin_path}/write/write.file.php"); ?>
            </td>
        </tr>
    </table>
   <!---------| BUTTON |---------->
    <table class="Button-Box">
        <tr>
            <td align="center" class="Button">
                <button type='button' onclick="location.href='<?=get_pretty_url($bo_table).$qstr;?>'">취소</button>
                <button type='submit' id='btn_submit' accesskey='s'>작성완료</button>
            </td>
        </tr>
    </table>
   </form>
   <!-- SCRIPT -->
    <? include_once("{$board_skin_path}/write/write.script.php"); ?>
</article>
<!----------| HIDDEN |---------->
 <? if ($code == "no") { ?><style type="text/css">.HEAD, .TAIL, .LocalPage { display:none; }</style><? } ?>