<? include "css.php" ?>
<?
if (!defined("_GNUBOARD_")) exit; //  
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<?
//여분필드추가시 wr_번호 
if ($fadmin =='fok') { 
 if ($is_admin =='super') { 
//시작할번호 wr_추가시작할 번호 
$af = 11; 
//마지막번호 생성할 마지막번호+1 
$bf = 101; 
for ($di=$af; $di<$bf; $di++) { 
$g4memoup ="ALTER TABLE $g4[write_prefix]$bo_table ADD wr_{$di} VARCHAR(255) NOT NULL"; 
$resultup = @mysql_query($g4memoup) or mysql_error(); 
if ($resultup) { 
  echo "$bo_table 게시판에 wr_{$di} 필드생성 성공 하였습니다......ㅊㅋ<br><br>"; 
} else { 
  echo "$bo_table 게시판에 wr_{$di} 필드가 이미 존재 하거나 생성실패......ㅠㅠ<br><br>"; 
 } 
 } 
 } else { 
 alert_close("니 머꼬? 콱"); 
 } 
 //exit; 
} 

//여분필드삭제시 
if ($fadmin =='fdel') { 
 if ($is_admin =='super') { 
//필드삭제를 시작할번호 wr_삭제시작 번호 
$adf = 11; 
//필드삭제할 마지막번호 +1 
$bdf = 101; 
for ($di=$adf; $di<$bdf; $di++) { 
$g4memoups ="ALTER TABLE $g4[write_prefix]$bo_table DROP wr_{$di}"; 
$resultups = @mysql_query($g4memoups) or mysql_error(); 
if ($resultups) { 
  echo "$bo_table 게시판에 wr_{$di} 필드삭제를 성공 하였습니다......ㅊㅋ<br><br>"; 
} else { 
  echo "$bo_table 게시판에 wr_{$di} 필드가 존재 하지않거나 삭제실패......ㅠㅠ<br><br>"; 
 } 
 } 
 } else { 
 alert_close("니 머꼬? 콱"); 
 } 
// exit; 
}
?>

<?
$noIMG = $board_skin_path."/img/noimg.gif"; //[필수](URL)
$max = 120 ; //[필수](픽셀) 썸네일 이미지의 가로세로(긴쪽)의 최대치. 
$resol = 90 ; //[필수](퍼센트%) 생성되는 썸네일의 JPG압축률.
$str = 15 ; //[필수](글자수) 썸네일 밑의 제목의 글자수.

function smaller( $W, $H ) {
	global $max, $thum_W, $thum_H ;

		if ( $W > $H ) { //가로형일 경우.
			$thum_W = $max ;
			$thum_H = ceil( $H * ( $max / $W ) );
		}
		if ( $W < $H ) { //세로형일 경우.
			$thum_H = $max ;
			$thum_W = ceil( $W * ( $max / $H ) );
		}
		if ( $W == $H ) { //정사각형일 경우.
			$thum_W = ceil( $max * 0.8 );
			$thum_H = ceil( $max * 0.8 );
		}
	
	return $thum_W ;
	return $thum_H ;
}


function maker( $thum_W, $thum_H ) {
	global $thum, $resol, $ori, $ori_info ;

		//$newImg = ImageCreate($thum_W,$thum_H); // GD라이브러리 2.0 (이하일 경우)
		$newImg = ImageCreateTrueColor($thum_W,$thum_H); // GD라이브러리 2.0 전용함수
		
		if($ori_info[2]=="2") $origImg=ImageCreateFromjpeg($ori);
		if($ori_info[2]=="3") $origImg=ImageCreateFrompng($ori);
		
		//ImageCopyResized($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg)); 
		imageCopyResampled($newImg,$origImg,0,0,0,0,$thum_W,$thum_H,ImageSX($origImg),ImageSY($origImg)); 
		
		Imagejpeg($newImg, $thum, $resol );
		
		chmod($thum,0707);
		ImageDestroy($newImg); 
		ImageDestroy($origImg); 

	return $thum ;
}
?>
					

<div align="center">
					

<table valign="bottom" width='660' cellpadding="0" cellspacing="0" id="table629">
<tr align="center">
<?php
    $arr = explode("|", $board[bo_category_list]);
    $arr1   = explode("|", $board[bo_10]);
	$str = "";
    for ($i=0; $i<count($arr); $i++)
        if (trim($arr[$i])){
            if($arr[$i]==$sca){ 
			    $key    = array_search($sca, $arr);
			    $cate   = explode("^", $arr1[$key]);
			    $subca1 = $cate[0];
				$str .= "
				<td width='3'><img src='$board_skin_path/img/cat_tap_on_01.gif'></td>
				<td background='$board_skin_path/img/cat_tap_on_02.gif' style='padding:4 2 0 2' nowrap>
				<a href='$category_location$arr[$i]&sfl=wr_10&stx=$subca1&nca=$subca1'><b><font color=#1B57B3>$arr[$i]</font></b></a></td>
				<td width='3'><img src='$board_skin_path/img/cat_tap_on_03.gif'></td>
				";
				}else{ 
			    $key    = array_search($arr[$i], $arr);
			    $cate   = explode("^", $arr1[$key]);
			    $subca1=$cate[0];
				$str .= "
				<td width='3'><img src='$board_skin_path/img/cat_tap_off_01.gif'></td>
				<td background='$board_skin_path/img/cat_tap_off_02.gif' style='padding:4 2 0 2' nowrap>
				<a href='$category_location$arr[$i]&sfl=wr_10&stx=$subca1&nca=$subca1'><b><font color=#B8B8B8>$arr[$i]</font></b></a></td>
				<td width='3'><img src='$board_skin_path/img/cat_tap_off_03.gif'></td>
				";
				}
			}
	echo $str;
	echo "<td width='100%'></td>";
?>
</tr>
</table>
					</div>
<div align="center">
					<table id="table184" border="0" cellSpacing="1" cellPadding="0" jQuery1283634220656="2" jQuery1283634221250="346" style="width: 660px; border-top: 2px solid #888B94; background-color: #e1e1e1">
						<tbody jQuery1283634221250="347">
							<tr jQuery1283634221250="348">
								<td class="mw_board_group_1_info" jQuery1283634221250="350" bgcolor="#FCFCFC" height="25">
								<table border="0" id="table628" cellspacing="1">
									<tr>
										<td width="8">&nbsp;</td>
										<td>
								<font color="#444444"><b><?php echo $lang['120'];?></b></font></td>
										<td>
								<font size="1">
								(<?=number_format($total_count)?>)</font></td>
										<td width="10">&nbsp;
								</td>
										<td>
								<table border="0" id="table11" cellspacing="1">
					<form name=fsearch method=get style="margin:0px;">
				    <input type=hidden name=bo_table value="<?=$bo_table?>">
				    <input type=hidden name=sca      value="<?=$sca?>">
						<tr>
							<td>
				<select name=sfl style="height:21; width:115" size="0">
				<option value='wr_subject||wr_content||wr_1||wr_2||wr_3||wr_4||wr_5||wr_6||wr_7||wr_8||wr_9||wr_10||mb_id,0||wr_name,1||wr_name,0'><?php echo $lang['63'];?></option>
				<option value='wr_subject'><?php echo $lang['132'];?></option>
				<option value='wr_content'><?php echo $lang['133'];?></option>
				<option value='wr_2'><?php echo $lang['135'];?></option>
				<option value='wr_subject||wr_content'><?php echo $lang['132'];?>+<?php echo $lang['133'];?></option>
                </select></td>
							<td>
				<input name=stx maxlength=15 itemname="<?php echo $lang['66'];?>" required value='<?=$stx?>' style="width:204px; height:21px" size="10" class="nhn2"></td>
							<td>
				<input type="submit" value="<?php echo $lang['04'];?>" name="B1" style="font-weight: bold" class="btn4"></td>
							<td>
				<input type=radio name=sop value=and>and 
			</td>
							<td>
				<input type=radio name=sop value=or checked>or 
			</td>
							<td width="10">&nbsp;
				</td>
						</tr>
					</form>
					</table></td>
									</tr>
								</table>
								</td>
							</tr>
							<tr jQuery1283634221250="354">
								<td class="mw_board_group_1_contents" jQuery1283634221250="375" bgcolor="#FFFFFF">
<table width="100%" cellpadding=2 id="table185">
	<tr>
		<td valign="top">
		<form name="fboardlist" method="post">
			<input type="hidden" name="bo_table" value="<?=$bo_table?>">
			<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="page" value="<?=$page?>">
			<input type="hidden" name="sw"   value="">
			<table cellpadding="0" cellspacing="0" width="100%" id="table186" >
				<tr>
        <? for ($i=0; $i<count($list); $i++) {
				  // Thumbnail
                  $image = urlencode($list[$i][file][0][file]); 
                  $ori="$g4[path]/data/file/$bo_table/" . $image;
                  $ext = strtolower(substr(strrchr($ori,"."), 1)); //확장자
                  if ( $ext=="gif"||$ext=="jpg"||$ext=="jpeg"||$ext=="png"||$ext=="bmp"||$ext=="tif"||$ext=="tiff") $ori_info=getimagesize($ori); else $ori_info="";
                  if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) { //원파일이 [ 2JPG, 2JPEG, 3PNG ] 경우.
		          $thum = $ori."" ;
		          if ( file_exists($thum) ) { // Thumbnail [O] 경우	
		         $thum_info = getimagesize ($thum);
			     $thum_W = $thum_info[0] ;
			     $thum_H = $thum_info[1] ;	
	            	} else { // Thumbnail [X] 경우
		      	if ( smaller( $ori_info[0], $ori_info[1] ) ) {
				maker( $thum_W, $thum_H );
			    }
	         	}
                } else if ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) { //원파일이 [ 1GIF,6BMP,7TIF ] 경우.
		     	if ( smaller( $ori_info[0], $ori_info[1] ) ) {
				$thum = $ori ;
		    	}
               } else { //원파일이 [ 1,2,3,6,7 ] 아닐 경우.
              	$thum = $noIMG ;
               }
              ?>
         
            			<td height="10" >
															<table border="0" width="100%" id="table620" cellspacing="0" cellpadding="0">
																<tr>
																	<td>
															<table border="0" width="100%" id="table621" cellspacing="0" cellpadding="0">
																<tr>
																	<td width="1">
																	<table border="0" id="table622" cellpadding="2">
																		<tr>
																			<td align="center">
																			<table border="0" width="150" id="table623" cellspacing="1" bgcolor="#E6E6E6" height="150">
																				<tr>
																					<td bgcolor="#FFFFFF" align="center">
												<a href="<?=$list[$i][href]?>">
												<img src='<?=$thum?>' alt='<?php echo $lang['137'];?>' width="140" height="140" border=0 ></a></td>
																				</tr>
																			</table>
																			</td>
																		</tr>
																		<tr>
																			<td align="center">
																			<a href="<?=$list[$i][ca_name_href]?>">
																			<?=$list[$i][ca_name]?></a></td>
																		</tr>
																		<tr>
																			<td align="center">
																			<font color="#FF6600">
																			<b>
																			<?=$list[$i][subject]?></b></font></td>
																		</tr>
																		<tr>
																			<td align="center">
																			<?=$list[$i][wr_8]?><?php echo $lang['607'];?></td>
																		</tr>
																	</table>
																	</td>
																</tr>
															</table>
																	</td>
																</tr>
																<tr>
																	<td>
															<hr size="0" color="#CCCCCC" style="border-style: dotted; border-width: 1px">
																	</td>
																</tr>
															</table>
						</td >

        <?php
        if($i % 4 == 3){
          echo "</tr><tr>";
        }
        ?>
        <? } ?>
          			</tr>
			</table>
        <? if (count($list) == 0) { echo "  <table width=100% border=0 cellpadding=0 cellspacing=0 ><tr><td height=100 align=center>{$lang[595]}</td></tr></table>"; } ?>
      	</form></td>
	</tr>
	<tr>
		<td valign="top">
		<table border="0" width="100%" id="table630" cellpadding="2">
			<tr>
				<td><table border="0" id="table631" cellpadding="2">
		<tr>
			<? if ($is_checkbox) { ?>
			<td align="center"><a class="btn3" href="javascript:select_delete();"><?php echo $lang['72'];?></a></td>
			<td align="center">
				<a class="btn3" href="javascript:select_copy('copy');"><?php echo $lang['73'];?></a></td>
			<td align="center">
				<a class="btn3" href="javascript:select_copy('move');"><?php echo $lang['74'];?></a></td>
			<? } ?>
			<td align="center">
    <? if ($admin_href) { ?><a class="btn6" href="<?=$admin_href?>"><?php echo $lang['62'];?></a><?}?></td>
			<td align="center">
    <? if ($list_href) { ?><a class="btn6" href="<?=$list_href?>"><?php echo $lang['75'];?></a><? } ?></td>
		</tr>
	</table></td>
				<td align="center" width="20"><? if ($write_href) { ?><a class="btn1" href="<?=$write_href?>"><?php echo $lang['596'];?></a><? } ?></td>
			</tr>
</table>
		</td>
	</tr>
	<tr>
		<td valign="top">
 <? if ($prev_part_href) { echo "<a href='$prev_part_href'>이전검색</a>"; } ?>
 <div class="paginate"><?=$write_pages?></div>
 <? if ($next_part_href) { echo "<a href='$next_part_href'>다음검색</a>"; } ?>
          		</td>
	</tr>
	</table>

								</td>
							</tr>
					</table>

</div>

<table border="0" width="100%" id="table632" cellspacing="0" cellpadding="0">
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>

<script language="JavaScript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$stx?>') {
    document.fsearch.sfl.value = '<?=$sfl?>';

    if ('<?=$sop?>' == 'and') 
        document.fsearch.sop[0].checked = true;

    if ('<?=$sop?>' == 'or')
        document.fsearch.sop[1].checked = true;
} else {
    document.fsearch.sop[0].checked = true;
}
</script>

<? if ($is_checkbox) { ?>
<script language="JavaScript">
function all_checked(sw) {
    var f = document.fboardlist;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]")
            f.elements[i].checked = sw;
    }
}

function check_confirm(str) {
    var f = document.fboardlist;
    var chk_count = 0;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }

    if (!chk_count) {
        alert(str + "<?php echo $lang['68'];?>");
        return false;
    }
    return true;
}

// 선택한 게시물 삭제
function select_delete() {
    var f = document.fboardlist;

    str = "<?php echo $lang['67'];?>";
    if (!check_confirm(str))
        return;

    if (!confirm("<?php echo $lang['71'];?>"))
        return;

    f.action = "./delete_all.php";
    f.submit();
}

// 선택한 게시물 복사 및 이동
function select_copy(sw) {
    var f = document.fboardlist;

    if (sw == "copy")
        str = "<?php echo $lang['69'];?>";
    else
        str = "<?php echo $lang['70'];?>";
                       
    if (!check_confirm(str))
        return;

    var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");

    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<? } ?><!-- 게시판 목록 끝 -->