깜빡하고 카테고리 설정을 안하고 써서 여기저기 있는 경우가 있어서
조금 더 쉽게 카테고리에 맞는 글을 쓸 수 있는 방법이 없을까 해서 삽질을 하다가 만들어 봤습니다.

좀.. 지저분한 소스지만
필요하신 분들이 많이 사용해서 편안한 블로깅 생활을 즐기셨으면 좋겠습니다 ^^
[ ## 과 ## ] 는 공백을 없애고 붙여야 합니다.
[ ## → [##
## ] → ##]



수정하는 파일
index.php - a_write_ct1, ct2 추가
index.php - s_ad_write 추가
admin/article_edit.php
skin/../skin.html


index.php - 본래 소스

 if (strpos($d1, "[ ##_s_rctrp_rep_## ]")) $d1 = str_replace("[ ##_s_rctrp_rep_## ]", get_rctrp_rep(), $d1);
 if (strpos($d1, "[ ##_s_rcttb_rep_## ]")) $d1 = str_replace("[ ##_s_rcttb_rep_## ]", get_rcttb_rep(), $d1);

index.php - 추가

 if (strpos($d1, "[ ##_s_rctrp_rep_## ]")) $d1 = str_replace("[ ##_s_rctrp_rep_## ]", get_rctrp_rep(), $d1);
 if (strpos($d1, "[ ##_s_rcttb_rep_## ]")) $d1 = str_replace("[ ##_s_rcttb_rep_## ]", get_rcttb_rep(), $d1);

 // modified by Mooki - 2004.12.2 [ Write Category Post ]
 if (strpos($d1, "[ ##_a_write_ct1_## ]")) $d1 = str_replace("[ ##_a_write_ct1_## ]", $ct1, $d1);
 if (strpos($d1, "[ ##_a_write_ct2_## ]")) $d1 = str_replace("[ ##_a_write_ct2_## ]", $ct2, $d1);

index.php - 수정

 if (strpos($d1, "[ ##_s_rctrp_rep_## ]")) $d1 = str_replace("[ ##_s_rctrp_rep_## ]", get_rctrp_rep(), $d1);
 if (strpos($d1, "[ ##_s_rcttb_rep_## ]")) $d1 = str_replace("[ ##_s_rcttb_rep_## ]", get_rcttb_rep(), $d1);

 // modified by Mooki - 2004.12.8 [ Write Category Post ]
    if (strpos($d1, "[ ##_s_ad_write_## ]") && return_authority()) {
     $d1 = str_replace("[ ##_s_ad_write_## ]", "<a href="#" onclick="if (confirm('새로운 글을 생성합니다.\n계속하시겠습니까?\t')) location.href='admin/article_edit.php?mode=issue&ct1=".$ct1."&ct2=".$ct2."'">[글쓰기]</a>", $d1);
    } else { $d1 = str_replace("[ ##_s_ad_write_## ]", "",$d1); }



 
admin/article_edit.php - 본래 소스

 if ($mode == "issue") {
  $image_file_path1 = date("md",mktime())."/";
  $image_file_path2 = get_timestamp2()."/";

   put_query("
       insert into t3_".$dbid." (
           title, body, user_id, image_file_path1, image_file_path2, regdate,
       ) values (
           '제목을 입력해 주세요', '내용을 입력해 주세요', '$p_user_id', '$image_file_path1', '$image_file_path2', '".mktime()."'
       )
   ");

admin/article_edit.php - 변경

 if ($mode == "issue") {
  $image_file_path1 = date("md",mktime())."/";
  $image_file_path2 = get_timestamp2()."/";

// modified by Mooki - 2004.12.2 [ Write Category Post ]
        if ($ct1 && $ct2) {
         put_query("
             insert into t3_".$dbid." (
                 title, body, user_id, image_file_path1, image_file_path2, regdate
                 , category1, category2
             ) values (
                 '제목을 입력해 주세요', '내용을 입력해 주세요', '$p_user_id', '$image_file_path1', '$image_file_path2', '".mktime()."', $ct1, $ct2
             )
         ");
        } else if ($ct1) {
         put_query("
             insert into t3_".$dbid." (
                 title, body, user_id, image_file_path1, image_file_path2, regdate
                 , category1
             ) values (
                 '제목을 입력해 주세요', '내용을 입력해 주세요', '$p_user_id', '$image_file_path1', '$image_file_path2', '".mktime()."', $ct1
             )
         ");
        } else {
         put_query("
             insert into t3_".$dbid." (
                 title, body, user_id, image_file_path1, image_file_path2, regdate,
             ) values (
                 '제목을 입력해 주세요', '내용을 입력해 주세요', '$p_user_id', '$image_file_path1', '$image_file_path2', '".mktime()."'
             )
         ");
        }


 
skin/../skin.html - 원하는 스킨 본래 소스

[ ##_list_conform_## ] 옆부분이나 원하는 부분에
skin/../skin.html - 추가

[ ##_list_conform_## ]
                      <!-- modified by Mooki - 2004.12.2 [ Write Category Post ]-->
                       <a href="#" onclick="if (confirm('새로운 글을 생성합니다.
계속하시겠습니까? ')) location.href='admin/article_edit.php?mode=issue&ct1=[ ##_a_write_ct1_## ]&ct2=[ ##_a_write_ct2_## ]'">[글쓰기]</a>
skin/../skin.html - 수정

[ ##_list_conform_## ]<!-- modified by Mooki - 2004.12.8 [ Write Category Post ]--> [ ##_s_ad_write_## ]

<s_ad_div> 사이에 넣으면 관리자 로그인이 되어있을 경우에만 보입니다 ^^

[ ##_s_ad_write_## ] 부분을 사용하고 싶은 위치에 배치합니다.

이제 관리자 로그인이 되어있을 경우에만 '[글쓰기]' 버튼이 나오겠죠?
[글쓰기] 디자인을 바꾸고 싶다면 index.php에서 굵은 글씨 부분을 수정하시면 됩니다.
이미지 링크도 가능하고 무엇이든 좋죠 ^^


좋은 블로그 꾸미시기 바랍니다 ^^

※ 퍼가실 때는 꼭 트랙백으로..
※ 문제가 있으면 덧글로 알려주세요 ^^
Posted by Mooki
,