시소당
function set_file(
$type,
$cval1,
$cval2,
$spath,
$rpath,
$apath) {
global
$db,
$dbid;
switch(
$type) {
case "1":
list(
$width,
$height) = @getimagesize(
$rpath.
$apath.
$cval1);
$set_width =
$width;
$set_height =
$height;
$scroll = 0;
if (
$width > 800) {
$set_width=820;
$scroll = 1; }
if (
$height > 600) {
$set_height=600;
$set_width += 16;
$scroll = 1; }
if (strpos(str_replace(""", "",
$cval2), "width=
$width") !== false && strpos(str_replace(""", "",
$cval2), "height=
$height") !== false) return "<img src=\"
$spath$apath$cval1\"
$cval2 alt=\"\">";
else return "<img src=
$spath$apath$cval1 $cval2 style=cursor:pointer onclick=\"window.open('
$spath"."image_pop.php? imagefile=
$apath$cval1&width=
$width&height=
$height','','width=
$set_width,height=
$set_height,scrollbars=
$scroll')\">";
break;
case "2":
return "<EMBED loop=true menu=false quality=high
$cval2 TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash src=
$spath$apath$cval1></embed>";
break;
case "3":
return "<EMBED autostart=0
$cval2 src=
$spath$apath$cval1></embed>";
break;
case "4":
return "<EMBED autostart=0
$cval2 height=45 src=
$spath$apath$cval1></embed>";
break;
case "0":
$sql = "select filename, filesize from t3_".
$dbid."_files where attachname = '
$cval1'";
list (
$filename,
$filesize) = mysql_fetch_array(mysql_query(
$sql));
if (!
$filename){
$sql = "select filename, filesize from t3_".
$dbid."_keyword_files where attachname = '
$cval1'";
list (
$filename,
$filesize) = mysql_fetch_array(mysql_query(
$sql));
}
$icon = set_icon_extension(
$filename);
if (!
$icon)
$icon = "file";
return "<table class=ib onclick=\"location.href='
$spath"."down.php?attachname=
$cval1'\"><tr><td><img src=
$spath"."images/icon/
$icon.gif></td><td class=cap1>
$filename (".get_filesize(
$filesize).")</td></tr></table>";
break;
}
}
확장자에 맞게 출력문을 제어하고 있다.