File name: welboard2/view.wel (7,201 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: view.wel
    4 : 
    5 :    게시판 내용 보기 프로그램 (author: 서광현)
    6 : 
    7 :    Copyright (c) 2001/03/25 by Wesoft
    8 :    All Rights Reserved.
    9 : */
   10 : 
   11 : htmlquery("GET");
   12 : break_on= 0;
   13 : if(nt!="y") view_form= "view.fom";
   14 :  else
   15 :   {
   16 :       prg_title= "공지사항";
   17 :       view_form= "noticeview.fom";
   18 :   }
   19 : if(include("include/board.inc")!=OK) return;
   20 : 
   21 : no= val(no);
   22 : if(no<1)
   23 :  {
   24 :     MSG1= "자료번호 오류";
   25 :     MSG2= "자료 번호가 없거나 잘못되었습니다." ~ BACK_BUTTON;
   26 :     formdump(message_form);
   27 :     return disconnect();
   28 :  }
   29 : 
   30 : qstr= "select * from " ~ mytable ~ " where selno=" ~ no;
   31 : if( (rt=mysql_getrecord(qstr,"")) < 1 )
   32 :  {
   33 :     if(rt==0)
   34 :      {
   35 :         MSG1= "자료가 없습니다!";
   36 :         MSG2= no ~ "번의 게시물이 삭제되었거나 없습니다!" ~ BACK_BUTTON;
   37 :         formdump(message_form);
   38 :      }
   39 :     return disconnect();
   40 :  }
   41 : readcnt= val(readcnt);
   42 : if(val(nc)!=1)
   43 :  {
   44 :     ++readcnt;
   45 :     qstr= "update " ~ mytable ~ " set readcnt=readcnt+1 where selno=" ~ no;
   46 :     mysql_query(mysql, qstr); // 조회수 증가
   47 :  }
   48 : focus_line= selno;
   49 : fileseq= val(fileseq);
   50 : wdtime= mid(insert_week(wdtime),3);
   51 : mdtime= mid(insert_week(mdtime),3);
   52 : depth= len(answer);
   53 : if(depth==0) kind= "게시글";
   54 :  else
   55 :   {
   56 :      kind= "답변글";
   57 :      if(depth>1) kind~= "-" ~ depth;
   58 :   }
   59 : if(depth>=20) answer_button= 0; else answer_button= 1;
   60 : answer_len= len(answer);
   61 : cond= "grpno=" ~ grpno ~ " and substring(answer,1," ~ answer_len ~ ")='"
   62 :     ~ answer ~ "' and length(answer)> " ~ answer_len;
   63 : answer_cnt= get_recount(mytable, cond);
   64 : if(answer_cnt>0)
   65 :  {
   66 :     answer_desc= " 답변수( <font color=#f00000>" ~ answer_cnt ~ "</font> )";
   67 :  }
   68 : if(wid==ckid || us_class=="A")
   69 :  {
   70 :     if(read_only==0 || write_answer==1 && depth>0) mflag= 1;
   71 :  }
   72 : if(attfile=="")
   73 :   {
   74 :      icon= "";
   75 :      if(viewboard_flag!="") include("include/extension.var");
   76 :   }
   77 :  else
   78 :   {
   79 :      ext= 0;
   80 :      for(i=len(attfile); i>=1; i--)
   81 :       {
   82 :          if(mid(attfile, i, 1)==".") { ext= i + 1; break; }
   83 :       }
   84 :      IconFile= "unknown.gif", IconRemark= "알수없는 파일";
   85 :      if(ext>0)
   86 :       {
   87 :          include("include/extension.var");
   88 :          extension= tolower(mid(attfile, ext)); // 파일의 확장자 얻기
   89 :          NewIcon= parser("ext_"~extension,-1); // 확장명에 대한 아이콘
   90 :          NewRemark= parser("remark_" ~ extension,-1); // 확장명 설명
   91 :          if(NewIcon!="") IconFile= NewIcon, IconRemark= NewRemark;
   92 :       }
   93 :      downicon= "<img src='icon/" ~ IconFile ~ "' title='" ~ IconRemark ~ "'>";
   94 :   }
   95 : content_fch= "\n", content_rch= "\n<br>";
   96 : if(accept_html!=1)
   97 :  {
   98 :     content_fch~= "|" ~ html_fch, content_rch~= "|" ~ html_rch;
   99 :     if(accept_html==2)
  100 :      {
  101 :         content_fch= "<&|" ~ content_fch;
  102 :         content_rch= "<|" ~ content_rch;
  103 :      }
  104 :  }
  105 : red_keyword= "<font color=red>" ~ k ~ "</font>";
  106 : if(cc==1 && k!="")
  107 :  {
  108 :     content_fch~= "|" ~ k;
  109 :     content_rch~= "|" ~ red_keyword;
  110 :  }
  111 : if(accept_html!=2) content= strchange(content, content_fch, content_rch);
  112 :   else content=strchange(content,content_fch,content_rch,"[HTML]","[/HTML]");
  113 : writer= strchange(wname, html_fch, html_rch);
  114 : if(wemail!="")
  115 :  {
  116 :     writer= "<a href=\"javascript:gomail2('" ~ wname ~ "','" ~ wemail
  117 :           ~ "')\" title=\"" ~ wemail ~ " \">" ~ writer ~ "</a>";
  118 :  }
  119 : writer= "작성: " ~ writer;
  120 : write_info= wdtime ~ " (" ~ wip ~ ") " ~ whost;
  121 : if(mdtime!="")
  122 :  {
  123 :     modifier= strchange(mname, html_fch, html_rch);
  124 :     if(memail!="")
  125 :      {
  126 :        modifier= "<a href=\"javascript:gomail2('" ~ mname ~ "','" ~ memail
  127 :                ~ "')\" title=\"" ~ memail ~ " \">" ~ modifier ~ "</a>";
  128 :      }
  129 :     modifier= "<br>수정: " ~ modifier;
  130 :     modify_info= "<br>" ~ mdtime ~ " (" ~ mip ~ ") " ~ mhost;
  131 :  }
  132 : wemail= strchange(wemail, html_fch, html_rch);
  133 : memail= strchange(memail, html_fch, html_rch);
  134 : edit_subject= strchange(subject, html_fch, html_rch);
  135 : 
  136 : if(attfile!="")
  137 :  {
  138 :     if(fileseq==0) real_attfile= attfile;
  139 :       else real_attfile= fileseq ~ "-" ~ attfile; // 저장된 실제 파일명
  140 :     download_file= "upload/" ~ db ~ "/" ~ real_attfile;
  141 :     if(!fexist(download_file)) fsize= "";
  142 :      else fsize= bytes_str(fsizeof(download_file), 2);
  143 :  }
  144 : if(cn+cs+cc==0) cn= 0, cs= cc= 1; // 이름(x), 제목(o), 내용(o)
  145 : cond= "";
  146 : if(k!="")
  147 :  {
  148 :     kk= strchange(k, fch, rch);
  149 :     if(cn==1) cond= "wname like '%" ~ kk ~ "%'";
  150 :     if(cs==1)
  151 :      {
  152 :         if(cond!="") cond~= " or ";
  153 :         cond~= "subject like '%" ~ kk ~ "%'";
  154 :      }
  155 :     if(cc==1)
  156 :      {
  157 :         if(cond!="") cond~= " or ";
  158 :         cond~= "content like '%" ~ kk ~ "%'";
  159 :      }
  160 :  }
  161 : now_recnt= get_recount(mytable, cond);
  162 : tot_page= now_recnt / pagerec;
  163 : if(now_recnt%pagerec>0) tot_page++;
  164 : vno= vn= val(vn), now_start= now_recnt - vno;
  165 : pg= tot_page - (now_recnt - vno) / pagerec;
  166 : prev_vno= vno + 1, prev_start= now_start - 1;
  167 : next_vno= vno - 1, next_start= now_start + 1;
  168 : if(prev_vno>now_recnt) prev_vno= 0;
  169 : next_qstr= prev_qstr= "select selno,answer,subject from " ~ mytable;
  170 : if(cond!="")
  171 :  {
  172 :     prev_qstr~= " where " ~ cond;
  173 :     next_qstr~= " where " ~ cond;
  174 :  }
  175 : order= " order by grpno desc, answer asc limit ";
  176 : prev_qstr~= order ~ prev_start ~ ",1";
  177 : next_qstr~= order ~ next_start ~ ",1";
  178 : 
  179 : prev_selno= "";
  180 : prev_kind= next_kind= spc= "&nbsp;";
  181 : if(prev_vno>0)
  182 :  {
  183 :     qstr= prev_qstr;
  184 :     if( (rt=mysql_getrecord(qstr,"prev_")) < 0 ) return;
  185 :     if(rt>0)
  186 :      {
  187 :         depth= len(prev_answer);
  188 :         if(depth==0) prev_indent= "", prev_kind= "게시글";
  189 :          else
  190 :           {
  191 :              prev_indent= strep(spc,depth*4-4) ~ "<img src='icon/tag.gif'>";
  192 :              prev_kind= "답변글";
  193 :              if(depth>1) prev_kind~= "-" ~ depth;
  194 :           }
  195 :         prev_subject= strchange(prev_subject, html_fch, html_rch);
  196 :         if(cs==1&&k!="") prev_subject= strchange(prev_subject,k,red_keyword);
  197 :      }
  198 :  }
  199 : 
  200 : next_selno= "";
  201 : if(next_vno>0)
  202 :  {
  203 :     qstr= next_qstr;
  204 :     if( (rt=mysql_getrecord(qstr,"next_")) < 0 ) return;
  205 :     if(rt>0)
  206 :      {
  207 :         depth= len(next_answer);
  208 :         if(depth==0) next_indent= "", next_kind= "게시글";
  209 :          else
  210 :           {
  211 :              next_indent= strep(spc,depth*4-4) ~ "<img src='icon/tag.gif'>";
  212 :              next_kind= "답변글";
  213 :              if(depth>1) next_kind~= "-" ~ depth;
  214 :           }
  215 :         next_subject= strchange(next_subject, html_fch, html_rch);
  216 :         if(cs==1&&k!="") next_subject= strchange(next_subject,k,red_keyword);
  217 :      }
  218 :  }
  219 : if(viewboard_flag!="")
  220 :   {
  221 :      view_cpright= logo_img= "&nbsp;";
  222 :      home_link= back_link= "";
  223 :   }
  224 :  else
  225 :   {
  226 :      view_cpright= cpright;
  227 :      logo_img= "<img src='icon/logo.gif' border=0>";
  228 :      if(back_url!="")
  229 :       {
  230 :          back_link= "<a href='"~back_url~"'";
  231 :          if(back_target!="") back_link~= " target='"~back_target ~ "'";
  232 :          back_link~= " onMouseover=\"onoff('back','icon/back1.gif')\""
  233 :                    ~ " onMouseout=\"onoff('back')\">"
  234 :                    ~ "<img src='icon/back0.gif' border=0 name='back'></a>";
  235 :       }
  236 :      if(home_url!="")
  237 :       {
  238 :          home_link= "<a href='"~home_url~"'";
  239 :          if(home_target!="") home_link~= " target='"~home_target ~ "'";
  240 :          home_link~= " onMouseover=\"onoff('home','icon/home1.gif')\""
  241 :                    ~ " onMouseout=\"onoff('home')\">"
  242 :                    ~ "<img src='icon/home0.gif' border=0 name='home'></a>";
  243 :       }
  244 :  }
  245 : fm= formdump(skin~view_form);
  246 : if(fm==FORM_OPENERR) return err_form(view_form);
  247 : return disconnect();
File name: welboard2/view.wel (7,201 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.