(.*)<\/is_(.*)>/Uis", $skin->skin, $matches); for ($i=0; $i< count($matches[0]); $i++) { $np_tag=strtolower($matches[1][$i]); if ($np_tag == "prologue") { $p_flag=1; } else array_push($new_page,$np_tag); } if ($p_flag==1) { if ($suri['directive'] != "/" || $suri['value']) { $skin->skin = preg_replace("/(.*?)<\/is_prologue>/Uis","",$skin->skin); } else { $skin->skin = str_replace("[##_paging_##]","",$skin->skin); $skin->skin = str_replace("[##_article_rep_##]","",$skin->skin); dress('body_id',"tt-body-prologue",$skin->outter); } } foreach($new_page as $npn) { $ptn = "/(.*?)<\/is_".$npn.">/Uis"; if ($suri['directive'] != "/ispage" ) { $skin->skin = preg_replace($ptn,"",$skin->skin); } else if ($npn != trim($_GET['np'])) { $skin->skin = preg_replace($ptn,"",$skin->skin); } else dress('body_id',"tt-body-".$npn,$skin->outter); dress($npn.'_link',$blogURL."/ispage?np=".$npn,$skin->skin); } $skin->skin = str_replace("[##_body_id_##]","",$skin->skin); dress('isblog_link',$blogURL."/isblog.php",$skin->skin); return true; } function base_style_str_pc() {// 기본 스타일 (특별히 지정하지 않으시면 본 스타일로 설정됩니다.) $s_str=CRLF; $s_str.="#IS_PC_rA_div { }".CRLF; $s_str.="#IS_PC_rA_div ul { list-style:none; padding-top:5px;}".CRLF; $s_str.="#IS_PC_rA_div li { list-style:none; padding-top:5px; }".CRLF; $s_str.="#IS_PC_rA_div ul li .is_title { margin-top:10px; font-weight:bold;}".CRLF; $s_str.="#IS_PC_rA_div ul li .is_cnt { font:9px Tahoma;color:#f60;}".CRLF; $s_str.="#IS_PC_rA_div ul li .is_content { }".CRLF; return $s_str; } function get_IS_PC_rA_side() { // 사이드바로 출력 return get_IS_PC_rA(); } function get_IS_PC_rA() { // 일반 치환자로 출력 global $blogURL, $configVal, $database, $owner; requireComponent('Tattertools.Function.misc'); $data = misc::fetchConfigVal($configVal); // 보여지는 글 수 if(is_null($data)){ $display_count = 5;} else $display_count = ($data['display_count'])?trim($data['display_count']):5; // 출력 아이템 if(is_null($data)){ $display_type = "tc";} else $display_type = ($data['display_type'])?trim($data['display_type']):"tc"; // 카테고리 관련 if(is_null($data)){ $display_category = "";} else $display_category = ($data['display_category'])?trim($data['display_category']):""; // 제목 관련 if(is_null($data)){ $title_length = 25;} else $title_length = ($data['title_length'])?trim($data['title_length']):25; // 내용 관련 if(is_null($data)){ $content_length = 250;} else $content_length = ($data['content_length'])?trim($data['content_length']):60; // 출력 영역 스타일 $display_css = $data['display_css']; $plugin_str= CRLF; if (is_null($data) ) { $plugin_str.=CRLF."".CRLF; } else { $plugin_str.=""; } $plugin_str.="
".CRLF."
    "; foreach(getRecentEntries_pc($display_count,$display_category) as $list_item){ $id_link = "$blogURL/{$list_item['id']}"; $title = htmlspecialchars(UTF8::lessenAsEm($list_item['title'],$title_length)); $comments = $list_item['comments']>0? "(".$list_item['comments'].")":""; $plugin_str.= "
  • $title $comments
  • ".CRLF; if ($display_type == "tc") { $content = stripHTMLandTag_pc($list_item['content']); $content = UTF8::lessenAsEm($content, $content_length); $plugin_str.=$content?"
  • $content
  • ".CRLF:""; } } $plugin_str.="
".CRLF."
"; return $plugin_str; } function getRecentEntries_pc($display_count,$display_category){ // 최근글 뽑아오기 global $database,$owner; if ($display_category != "") { $c_array = explode(",",$display_category); $c_str = " AND ( "; for ($c=0;$c 0'; $result_is=mysql_query("SELECT e.id, e.title, e.content, e.comments, e.published FROM {$database['prefix']}Categories c, {$database['prefix']}Entries e WHERE c.id = e.category AND e.owner = $owner AND e.draft = 0 $visibility_is $c_str ORDER BY e.published DESC LIMIT $display_count"); while($entry_is=mysql_fetch_array($result_is)){ array_push($entries_is,$entry_is); } return $entries_is; } function stripHTMLandTag_pc($text){ // 태그 정리 $text=preg_replace('/<(script|style)[^>]*>.*?<\/\1>/si','',$text); $text=preg_replace('/<[\w\/!]+[^>]*>/','',$text); $text=preg_replace('/ ?/',' ',$text); $text=trim(preg_replace('/\s+/',' ',$text)); $text=preg_replace('/\[#M_[^|]*\|[^|]*\|/Us','',str_replace('_M#]','',preg_replace('/\[##_.+_##\]/Us','',$text))); $text=preg_replace('@(@','',$text); $text=str_replace(array(''',''','"'),array('\'','\'','"'),$text); return $text; } function get_IS_PC_rA_Dataset($DATA){ // 테이터 Validation requireComponent('Tattertools.Function.misc'); $cfg = misc::fetchConfigVal( $DATA ); if(!$cfg['title_length']) return "제목의 최대 길이를 지정하여 주십시오."; if(!is_numeric($cfg['title_length'])) return "제목의 최대 길이는 숫자로만 입력하여 주십시오."; if(!$cfg['content_length']) return "내용 미리 보기의 최대 길이를 지정하여 주십시오."; if(!is_numeric($cfg['content_length'])) return "내용 미리 보기의 최대 길이는 숫자로만 입력하여 주십시오."; return true; } ?>꽟꽕씪 뿏吏 삤瑜

GD씪씠釉뚮윭由ш 뾾뒿땲떎.
꽌踰꾧由ъ옄뿉寃 臾몄쓽븯떗떆삤."); */ function getThumbDirectoryCheck() { $blogid = getBlogId(); if(!@is_dir(ROOT."/cache/thumbnail")) {mkdir(ROOT."/cache/thumbnail",0777); chmod(ROOT."/cache/thumbnail",0777);} if(!@is_dir(ROOT."/cache/thumbnail/{$blogid}")) {mkdir(ROOT."/cache/thumbnail/{$blogid}",0777); chmod(ROOT."/cache/thumbnail/{$blogid}",0777);} if(!@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb")) {mkdir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb",0777); chmod(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb",0777);} if(!@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list")) {mkdir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list",0777); chmod(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list",0777);} if(!@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar")) {mkdir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar",0777); chmod(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar",0777);} if(!@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto")) {mkdir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto",0777); chmod(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto",0777);} } // 꽟꽕씪 깭洹 留뚮뱾湲 function get_thumbTag($entryId, $filename, $link_filepath, $src_file, $x, $y, $target_file="", $mode, $thumb_resize, $thumb_quality, $urlimg) { global $dqEngine, $pluginURL, $hostURL; $blogid = getBlogId(); if (!@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb") || !@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list") || !@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar") || !@is_dir(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto")) { getThumbDirectoryCheck(); } // 씠誘몄 뾾쓣븣 $no_image = !$filename ? $pluginURL."/images/no_screenshot.gif" : ""; if($mode == "list"){ if(!$target_file) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list/thumb_{$filename}"; $dqEngine['thumb_resize'] = $thumb_resize; }elseif($mode == "side"){ if(!$target_file) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar/thumb_{$filename}"; $dqEngine['thumb_resize'] = $thumb_resize; }elseif($mode == "cover"){ if(!$target_file) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto/thumb_{$filename}"; $dqEngine['thumb_resize'] = $thumb_resize; } // 엫떆 뙆씪씠 엳뒗吏 寃궗 if(file_exists($target_file.".work")) $ret=$no_image; else { $_GD_VERSION = $dqEngine['gd_version'] ? $dqEngine['gd_version'] : get_gdVersion(); if($filename) { $ret = make_thumb($x, $y, $src_file, $target_file, $mode, $thumb_quality); } elseif($urlimg=1) { $prtstr = get_urlPath($link_filepath); $tmpfilename = basename($prtstr); $tmpfilename = md5($tmpfilename).".".misc::getFileExtension($tmpfilename); if($mode == "list"){ if(!$filename) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list/thumb_link_{$entryId}_{$tmpfilename}"; }elseif($mode == "side"){ if(!$filename) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar/thumb_link_{$entryId}_{$tmpfilename}"; }elseif($mode == "cover"){ if(!$filename) $target_file = ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto/thumb_link_{$entryId}_{$tmpfilename}"; } if(!eregi('://', $prtstr)){ $prtstr = getFilePath($prtstr); $ret = make_thumb($x, $y, $prtstr, $target_file, $mode, $thumb_quality); }else{ if($prtstr && $_GD_VERSION) $ret = get_ThumbnailFromHTMLTag($x, $y, $prtstr, $target_file, $mode, $thumb_quality); } } if($ret && !eregi("thumb_",basename($ret))) {$org = true;}else{$org = false;} if(!$ret) $ret=$no_image; } if(eregi('://',$ret)) $img_size = @getimagesize($ret); elseif(!$org) $img_size = @getimagesize($ret); else $img_size = cal_thumb_size($ret,$x,$y,$mode); $str_docroot = $dqEngine['document_root']; if(substr($ret,0,strlen($str_docroot)) == $str_docroot) $ret=str_replace($str_docroot,'',$ret); if (function_exists('gd_info')) { if(getGDSupport(getFileExt($src_file))){ $ret_tag[0] = ($img_size[0])?$img_size[0]:$x; $ret_tag[1] = ($img_size[1])?$img_size[1]:$y; }else{ $ret_tag[0] = $x; $ret_tag[1] = $y; } }else{ $ret_tag[0] = $x; $ret_tag[1] = $y; } $ret_tag[2] = $ret; return $ret_tag; } function getGDSupport($file_type){ $gd_info = get_GDInfo(); switch($file_type) { case "jpg": if($gd_info['JPG Support']) return true; else return false; break; case "gif": if($gd_info['GIF Read Support']) return true; else return false; break; case "png": if($gd_info['PNG Support']) return true; else return false; break; case "bmp": if($gd_info['WBMP Support']) return true; else return false; break; } } function getFileExt($path) { for ($i = strlen($path) - 1; $i >= 0; $i--) { if ($path{$i} == '.') return strtolower(substr($path, $i + 1)); if (($path{$i} == '/') || ($path{$i} == '\\')) break; } return ''; } //뙆씪 젅寃쎈줈 李얘린 function getFilePath($getFile) { if(file_exists(ROOT."{$getFile}")) return $getFile; else { if(@is_file(".{$getFile}")) $_f_path = "."; elseif(@is_file("..{$getFile}")) $_f_path = ".."; elseif(@is_file("../..{$getFile}")) $_f_path = "../.."; elseif(@is_file("../../..{$getFile}")) $_f_path = "../../.."; elseif(@is_file("../../../..{$getFile}")) $_f_path = "../../../.."; } if($_f_path) return $_f_path.$getFile; } //꽟꽕씪 깮꽦 function make_thumb($max_x,$max_y,$src_file,$target_file="", $mode, $thumb_quality) { global $dqEngine, $configVal; requireComponent('Textcube.Function.misc'); $data = misc::fetchConfigVal($configVal); if(isset($data['cutpixel'])){ $dqEngine['thumb_cutpixel'] = $data['cutpixel']; }else{ $dqEngine['thumb_cutpixel'] = 5; } // 寃잜뙆씪 寃궗/吏젙 $_fThumbnail = $target_file; // if(!$_fThumbnail) { // $tmp = pathinfo($src_file); // $_fThumbnail = $tmp['extension'].".thumb"; // } if(file_exists($_fThumbnail)) $comp_file=$_fThumbnail; else $comp_file=$src_file; if(!chk_imgfile($comp_file,$max_x,$max_y,$mode) || !($max_x||$max_y)) return $comp_file; // $tmp1 = pathinfo($target_file); // $tmp2 = pathinfo($comp_file); // if((!chk_imgfile($comp_file,$max_x,$max_y,$mode) || !($max_x||$max_y)) && ($tmp1['basename'] == $tmp2['basename'])) return $comp_file; if (file_exists($src_file) && filesize($src_file)) { $_GD_VERSION = $dqEngine[gd_version]; //if(!$_GD_VERSION) $_GD_VERSION = get_GDVersion(); unset($_gd_support); $gd_info = get_gdinfo(); $_GIF_Engine = dirname(realpath(__FILE__))."/phpthumb.gif.php"; if($gd_info['JPG Support'] && @file_exists($_GIF_Engine)) $gd_info['GIF Read Support2'] = true; if($_GD_VERSION) { if($gd_info['GIF Read Support']) $_gd_support .=".gif"; if($gd_info['GIF Read Support2']) $_gd_support .=".gif"; if($gd_info['JPG Support']) $_gd_support .=".jpg"; if($gd_info['PNG Support']) $_gd_support .=".png"; if($_GD_VERSION >= 2) $_gd_support .=".GD2"; else $_gd_support .=".GD1"; } $srcimg_info = @getimagesize($src_file); switch($srcimg_info[2]) { case 1: $file_type = "gif"; break; case 2: $file_type = "jpg"; break; case 3: $file_type = "png"; break; case 6: $file_type = "bmp"; break; default: $file_type = "not support"; } if (($gd_info['JPG Support']||$gd_info['PNG Support']||$gd_info['GIF Create Support']) && ereg($file_type,$_gd_support)) { $_fThumbWorkFile = $_fThumbnail.".work"; if(!file_exists($_fThumbWorkFile)) { $fp = fopen($_fThumbWorkFile, "w"); fwrite($fp, "Thumbnail image create works file"); fclose($fp); } $cal_size = cal_thumb_size($src_file,$max_x,$max_y, $mode); switch($file_type) { case "jpg": $src_img=ImageCreateFromjpeg($src_file); break; case "gif": if($gd_info['GIF Read Support']) $src_img=ImageCreateFromgif($src_file); elseif($gd_info['GIF Read Support2']) { include_once $_GIF_Engine; $src_img=gif_loadFileToGDimageResource($src_file); } break; case "png": $src_img=ImageCreateFrompng($src_file); break; case "bmp": $src_img=ImageCreateFromwbmp($src_file); break; } if(ereg(".GD2",$_gd_support)) $dst_img=ImageCreateTrueColor($cal_size[0], $cal_size[1]); if(!$dst_img) $dst_img=ImageCreate($cal_size[0], $cal_size[1]); $color = imagecolorallocate($dst_img,255,255,255); imagefill($dst_img,1,1,$color); $x1 = $cal_size[4] ? 0 - ($cal_size[4] - $cal_size[0])/2 : 0; $y1 = $cal_size[5] ? 0 - ($cal_size[5] - $cal_size[1])/2 : 0; $x2 = $cal_size[4] ? $cal_size[4] : $cal_size[0]; $y2 = $cal_size[5] ? $cal_size[5] : $cal_size[1]; if($cal_size[4] || $cal_size[5]) { $cut_pixel = 0; $pixel_count = $srcimg_info[0] * $srcimg_info[1]; if($pixel_count >= 1600) $cut_pixel = $dqEngine['thumb_cutpixel']; $sx1=$cut_pixel; $sy1=$cut_pixel; $sx2 = $cut_pixel ? ImageSX($src_img)-($cut_pixel*2) : ImageSX($src_img); $sy2 = $cut_pixel ? ImageSY($src_img)-($cut_pixel*2) : ImageSY($src_img); } else { $sx1=0; $sy1=0; $sx2 = ImageSX($src_img); $sy2 = ImageSY($src_img); } if(ereg(".GD2",$_gd_support)) $thumb_img=imageCopyResampled( $dst_img,$src_img,$x1,$y1,$sx1,$sy1,$x2,$y2,$sx2,$sy2); if(!$thumb_img) $thumb_img = imageCopyResized( $dst_img,$src_img,$x1,$y1,$sx1,$sy1,$x2,$y2,$sx2,$sy2); if ($target_dir && !file_exists($target_dir)) { $_mkdir=substr($target_dir,0,strlen($target_dir)-1); if(!@mkdir ($_mkdir,0707)) error("뵒젆넗由 留뚮뱾湲 떎뙣
".$_mkdir); if(!@chmod ($_mkdir,0707)) error("띁誘몄뀡 뿉윭
".$_mkdir); } if($_GD_VERSION >= 2 && $dqEngine[using_usm] && function_exists('UnsharpMask')) { //set_time_limit(20); $dst_img = UnsharpMask($dst_img,$dqEngine['usm_option1'],$dqEngine['usm_option2'],$dqEngine['usm_option3']); } // 씠誘몄 뭹吏 $_thumbnail_quality = $thumb_quality; if($gd_info['JPG Support']) ImageJpeg($dst_img,$_fThumbnail,$_thumbnail_quality); elseif($gd_info['PNG Support']) ImagePng($dst_img,$_fThumbnail,$_thumbnail_quality); elseif($gd_info['GIF Create Support']) ImageGif($dst_img,$_fThumbnail,$_thumbnail_quality); chmod($_fThumbnail,0706); ImageDestroy($dst_img); ImageDestroy($src_img); unlink($_fThumbWorkFile); if(file_exists($_fThumbnail)) return $_fThumbnail; else return $src_file; } return $src_file; } } // HTML 깭洹몃 遺꾩꽍븯뿬 꽟꽕씪 깮꽦 function get_ThumbnailFromHTMLTag($x, $y, $tag_str, $target_file, $mode, $thumb_quality) { global $_SERVER, $dqEngine, $blogid; if(!$dqEngine['using_urlImg']) return ''; if(chk_imgfile($target_file, $x, $y, $mode)) { // 留곹겕 씠誘몄媛 濡쒖뺄꽌踰 궡뿉 議댁옱븷븣 if(substr($_SERVER[HTTP_HOST],0,4)=="www." && substr($_SERVER[REQUEST_URI],0,2)!="/~") $HH = substr($_SERVER[HTTP_HOST],4,strlen($_SERVER[HTTP_HOST])); else $HH = $_SERVER[HTTP_HOST]; if ($tag_str && @eregi($HH, $tag_str)){ // 寃쎈줈굹 샇뒪듃뿉 www.媛 룷븿릺뿀쓣븣쓽 泥섎━ if(!@eregi("www.",$_SERVER[HTTP_HOST]) && eregi("www.",$tag_str)) { $tag_str=str_replace("www.","",$tag_str); $tag_str=get_indexDir()."/".eregi_replace($HH."/","",eregi_replace("http://","",$tag_str)); } elseif(eregi("www.",$_SERVER[HTTP_HOST]) && !eregi("www.",$tag_str)) { $tag_str=get_indexDir()."/".eregi_replace($HH."/","",eregi_replace("http://","",$tag_str)); } else $tag_str=get_indexDir()."/".eregi_replace($_SERVER[HTTP_HOST]."/","",eregi_replace("http://","",$tag_str)); if(file_exists($tag_str)) $filename = make_thumb($x,$y,$tag_str,$target_file, $mode, $thumb_quality); else $filename = ""; if(file_exists($filename)) return($filename); else return(""); } $_fThumbWorkFile = $target_file.".work"; $fpw = fopen($_fThumbWorkFile, "w"); fwrite($fpw, "Get remote image works file"); if($dqEngine['using_socket']) { // 냼耳 諛⑹떇쑝濡 떆룄 $str_info = parse_url($tag_str); set_time_limit(30); if($str_info['query']) $str_info['path'] = $str_info['path']."?".$str_info['query']; $str_info['port'] = $str_info['port'] ? $str_info['port'] : 80; $fp = @fsockopen($str_info['host'], ($str_info['port'] == 80 ? 80 : $str_info['port']), $errno, $errstr, 10); if($fp) { fputs($fp,"GET $str_info[path] HTTP/1.1\r\n"); fputs($fp,"Host: $str_info[host]\r\n"); fputs($fp,"User-Agent: Mozilla/4.0\r\n\r\n"); while(trim($buffer = fgets($fp,128)) != "") { if(eregi('Content-Type: ',$buffer)) $header = $buffer; } //set_time_limit(30); //socket_set_blocking($fp,false); $urlfile_is_image = '1'; if(phpversion() >= '4.3.0') stream_set_timeout($fp,10); while(!feof($fp) && connection_status()==0) $urlFile .= fread($fp,1024); } } else { // url_fopen 쑝濡 떆룄 $fp=@fopen($tag_str, "r"); $urlfile_is_image = '1'; if($fp) { while(!feof($fp) && connection_status()==0) { $urlFile = $urlFile.fread($fp,1024); } } } if($fp) fclose($fp); fclose($fpw); set_time_limit(30); unlink($_fThumbWorkFile); // 엫떆뙆씪 옣 if($fp && $urlfile_is_image) { if($mode == "list"){ $_thumb_temp = tempnam(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/list", "thumb_temp_"); }elseif($mode == "side"){ $_thumb_temp = tempnam(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/sidebar", "thumb_temp_"); }elseif($mode == "cover"){ $_thumb_temp = tempnam(ROOT."/cache/thumbnail/{$blogid}/JP_Thumb/coverphoto", "thumb_temp_"); } $fp = fopen($_thumb_temp, "w"); fwrite($fp, $urlFile); fclose($fp); $filename = make_thumb($x,$y,$_thumb_temp,$target_file, $mode, $thumb_quality); if (!file_exists($filename)) $filename=""; $rt_str = $filename; } if(file_exists($_thumb_temp)) @unlink($_thumb_temp); return $rt_str; } else { if(file_exists($target_file)) return $target_file; else return; } } // 臾몄꽌뿉꽌 씠誘몄깭洹 異붿텧 function get_imgTag($tmp) { preg_match_all('@@iU', $tmp, $prtstr); $prtstr = str_replace(array('"',"'"), array("",""), $prtstr[2][0]); return $prtstr; } // 臾몄옄뿴뿉꽌 url寃쎈줈 異붿텧 function get_urlPath($str) { if(eregi("\.jpg",$str)) $_file_type = ".jpg"; if(eregi("\.jpeg",$str)) $_file_type = ".jpeg"; if(eregi("\.gif",$str)) $_file_type = ".gif"; if(eregi("\.png",$str)) $_file_type = ".png"; if(eregi("\.bmp",$str)) $_file_type = ".bmp"; if(eregi("\.wmf",$str)) $_file_type = ".wmf"; $old_autoResize_text = " name=zb_target_resize style=\"cursor:hand\" onclick=window.open(this.src)"; $str=str_replace($old_autoResize_text,'',$str); if(!eregi('\?',$str)) $str=str_replace(" ","_DQ_TEMP_STRING_",substr($str,0,strpos($str,$_file_type)+(strlen($_file_type)+1))); $link_pattern = ";((http|https|ftp)://)?[/.?\xA1-\xFEa-zA-Z0-9:_\-]+[.][/?\xA1-\xFEa-zA-Z0-9,:\;&#=_~%()\[\]?\/.,+\*\-]+;i"; preg_match($link_pattern,$str,$ret); //由щ늼뒪 떆뒪뀥씠씪硫 %20 臾몄옄瑜 怨듬갚쑝濡 諛붽씔떎. $server_os = get_serverOS(); if(eregi("linux", $server_os)) $ret[0] = str_replace("_DQ_TEMP_STRING_"," ",$ret[0]); else $ret[0] = str_replace("_DQ_TEMP_STRING_","%20",$ret[0]); return $ret[0]; } // 깮꽦맆 꽟꽕씪 씠誘몄쓽 겕湲곌퀎궛 function cal_thumb_size($src_file, $max_x,$max_y, $mode) { global $dqEngine; static $oldInfo = array("","","",""); if($src_file == $oldInfo[3] && $max_x == $oldInfo[0] && $max_y == $oldInfo[1]) { $cal_size = $oldInfo; return $cal_size; } $img_info = @getimagesize ($src_file); $sx = $img_info[0]; $sy = $img_info[1]; // 썝蹂 씠誘몄뿉 臾몄젣媛 엳떎硫 以묐떒 if(!$src_file || !$sx || !$sy) return false; if(!$dqEngine['gd_version'] && $dqEngine['thumb_resize'] > 0) $dqEngine['thumb_resize'] = 0; switch($dqEngine['thumb_resize']) { case 1: // 썝蹂몄쓽 鍮꾩쑉濡 移 由ъ궗씠利 if($max_x != 0 && $max_y != 0) { if($sx>$sy) { $cal_size[1]=ceil(($sy*$max_x)/$sx); $cal_size[0]=$max_x; if($cal_size[1] > $max_y) { $cal_size[0]=ceil($sx*$max_y/$sy); $cal_size[1]=$max_y; } if($mode == "side"){ $cal_size[0]=$max_x; $cal_size[1]=ceil(($sy*$max_x)/$sx); } }else { $cal_size[0]=ceil($sx*$max_y/$sy); $cal_size[1]=$max_y; if($cal_size[0] > $max_x) { $cal_size[1]=ceil($sy*$max_x/$sx); $cal_size[0]=$max_x; } if($mode == "side"){ $cal_size[0]=$max_x; $cal_size[1]=ceil(($sy*$max_x)/$sx); } } } if($max_x==0 || $max_y==0) { $tmp_y=ceil(($sy*$max_x)/$sx); $tmp_x=ceil(($sx*$max_y)/$sy); if($max_x>$max_y) { if($sy>$tmp_y) $cal_size[1]=$tmp_y; else $cal_size[1]=$sy; if($sx>$max_x) $cal_size[0]=$max_x; else $cal_size[0]=$sx; }else { if($sx>$tmp_x) $cal_size[0]=$tmp_x; else $cal_size[0]=$sx; if($sy>$max_y) $cal_size[1]=$max_y; else $cal_size[1]=$sy; } } break; case 2: // 吏젙맂 겕湲곕줈 由ъ궗씠利 븳떎. $cal_size[0] = $max_x; $cal_size[1] = $max_y; break; case 3: // 썝蹂몃━궗씠利덈 븯硫댁꽌 吏젙븳 궗씠利덉뿉 苑 李⑤뒗 씠誘몄瑜 留뚮뱾怨 굹癒몄뒗 옒씪궦떎. $cal_size[0] = $max_x; $cal_size[1] = $max_y; if($sx == $sy) { if($max_x>$max_y) $cal_size[5] = $max_x; else $cal_size[4] = $max_y; } else { // if($sx>$sy && $max_x>$max_y) {$org_y = $max_y; $max_y = 0; $org_x = 0;} // elseif($sx<$sy && $max_x<$max_y) {$org_x = $max_x; $max_x = 0; $org_y = 0;} if($sx>$sy && $max_x>$max_y) {$org_y = $max_y; $max_y = 0;} elseif($sx<$sy && $max_x<$max_y) {$org_x = $max_x; $max_x = 0;} else { if($sx>$sy) {$org_x=$max_x; $max_x = 0;} if($sx<$sy) {$org_y=$max_y; $max_y = 0;} } if($max_x==0 || $max_y==0) { $tmp_y=ceil(($sy*$max_x)/$sx); $tmp_x=ceil(($sx*$max_y)/$sy); if($tmp_y < $org_y) { $tmp_y = $org_y; $org_x=$max_x; $max_x = 0; $tmp_x=ceil(($sx*$org_y)/$sy); } elseif($tmp_x < $org_x) { $tmp_x = $org_x; $org_y=$max_y; $max_y = 0; $tmp_y=ceil(($sy*$org_x)/$sx); } if($max_x>$max_y) { if($sy>$tmp_y || $max_y<$tmp_y) $cal_size[5]=$tmp_y; else $cal_size[5]=$sy; if($sy<$tmp_y) $cal_size[5]=$tmp_y; if($sx<$max_x) $cal_size[4]=$tmp_x; }else { if($sx>$tmp_x || $max_x<$tmp_x) $cal_size[4]=$tmp_x; else $cal_size[4]=$sx; if($sx<$tmp_x) $cal_size[4]=$tmp_x; if($sy<$tmp_y) $cal_size[5]=$tmp_y; } } break; } } $cal_size[3]=$src_file; $oldInfo = $cal_size; return $cal_size; } // 꽟꽕씪쓣 깮꽦빐빞 븷 뙆씪씤吏 寃궗 function chk_imgfile($src_file,$thumb_x,$thumb_y,$mode) { $new_file=true; $tmp=0; if (file_exists($src_file)) { $old_img = @getimagesize($src_file); $cal_size = cal_thumb_size($src_file, $thumb_x, $thumb_y, $mode); if ($old_img[0]!=$cal_size[0]) $tmp++; if ($old_img[1]!=$cal_size[1]) $tmp++; if ($tmp>0) $new_file=true; else $new_file=false; if(!$old_img[0] || !$old_img[1]) $new_file=true; } $workFile = $src_file.".work"; if(file_exists($workFile)) $new_file = false; return $new_file; } // allow_url_open 耳 function set_URLOpen($value) { if($value==1) @ini_set("allow_url_fopen","1"); if($value==0) @ini_set("allow_url_fopen","0"); } // 꽌踰 OS 븣븘궡湲 function get_serverOS () { if(function_exists("posix_uname")) { $server = posix_uname(); return $server[sysname]." ".$server[release]; } ob_start(); phpinfo(1); $server_os=ob_get_contents(); ob_end_clean(); $server_os=strip_tags(stristr($server_os, 'System')); $server_os=explode("\n",$server_os); return substr($server_os[0],6,strlen($server_os[0])); } // PHPThumb뿉꽌 媛졇삩 냼뒪뱾 (빟媛 닔젙) function phpinfo_array() { static $phpinfo_array = array(); if (empty($phpinfo_array)) { ob_start(); phpinfo(); $phpinfo = ob_get_contents(); ob_end_clean(); $phpinfo_array = explode("\n", $phpinfo); } return $phpinfo_array; } function get_GDVersion($fullstring=0) { static $cache_gd_version = array(); if (empty($cache_gd_version)) { $gd_info = get_GDInfo(); if (substr($gd_info['GD Version'], 0, strlen('bundled (')) == 'bundled (') { $cache_gd_version[1] = $gd_info['GD Version']; $cache_gd_version[0] = (float) substr($gd_info['GD Version'], strlen('bundled ('), 3); } else { $cache_gd_version[1] = $gd_info['GD Version']; $cache_gd_version[0] = (float) substr($gd_info['GD Version'], 0, 3); } } return $cache_gd_version[intval($fullstring)]; } function get_GDInfo() { if (function_exists('gd_info')) { return gd_info(); } static $gd_info = array(); if (empty($gd_info)) { $gd_info = array( 'GD Version' => '', 'FreeType Support' => false, 'FreeType Linkage' => '', 'T1Lib Support' => false, 'GIF Read Support' => false, 'GIF Create Support' => false, 'JPG Support' => false, 'PNG Support' => false, 'WBMP Support' => false, 'XBM Support' => false ); $phpinfo_array = phpinfo_array(); foreach ($phpinfo_array as $line) { $line = trim(strip_tags($line)); foreach ($gd_info as $key => $value) { if (strpos($line, $key) === 0) { $newvalue = trim(str_replace($key, '', $line)); $gd_info[$key] = $newvalue; } } } if (empty($gd_info['GD Version'])) { if (function_exists('ImageTypes')) { $imagetypes = ImageTypes(); if ($imagetypes & IMG_PNG) { $gd_info['PNG Support'] = true; } if ($imagetypes & IMG_GIF) { $gd_info['GIF Create Support'] = true; } if ($imagetypes & IMG_JPG) { $gd_info['JPG Support'] = true; } if ($imagetypes & IMG_WBMP) { $gd_info['WBMP Support'] = true; } } if (function_exists('ImageCreateFromGIF')) { if ($tempfilename = tempnam(null, '_thumb_')) { if ($fp_tempfile = @fopen($tempfilename, 'wb')) { fwrite($fp_tempfile, base64_decode('R0lGODlhAQABAIAAAH//AP///ywAAAAAAQABAAACAUQAOw==')); fclose($fp_tempfile); $gd_info['GIF Read Support'] = (bool) @ImageCreateFromGIF($tempfilename); } unlink($tempfilename); } } if (function_exists('ImageCreateTrueColor') && @ImageCreateTrueColor(1, 1)) { $gd_info['GD Version'] = '2.0.1 or higher (assumed)'; } elseif (function_exists('ImageCreate') && @ImageCreate(1, 1)) { $gd_info['GD Version'] = '1.6.0 or higher (assumed)'; } } } return $gd_info; } // USM 븘꽣(PHP 4.3.2 뿉꽌뒗 룞옉븯吏 븡뒗떎.) function UnsharpMask($img, $amount='60', $radius='0.5', $threshold='1') { //////////////////////////////////////////////////////////////////////////////////////////////// //// //// p h p U n s h a r p M a s k //// //// Unsharp mask algorithm by Torstein H?si 2003. //// thoensi_at_netcom_dot_no. //// Please leave this notice. //// /////////////////////////////////////////////////////////////////////////////////////////////// // $img is an image that is already created within php using // imgcreatetruecolor. No url! $img must be a truecolor image. // Attempt to calibrate the parameters to Photoshop: if(eregi('4.3.2',phpversion())) return $img; $amount = min($amount, 500); $amount = $amount * 0.016; $radius = min($radius, 50); $radius = $radius * 2; $threshold = min($threshold, 255); $radius = abs(round($radius)); // Only integers make sense. if ($radius == 0) { return $img; //ImageDestroy($img); //break; } $w = ImageSX($img); $h = ImageSY($img); $imgCanvas = ImageCreateTrueColor($w, $h); $imgCanvas2 = ImageCreateTrueColor($w, $h); $imgBlur = ImageCreateTrueColor($w, $h); $imgBlur2 = ImageCreateTrueColor($w, $h); ImageCopy($imgCanvas, $img, 0, 0, 0, 0, $w, $h); ImageCopy($imgCanvas2, $img, 0, 0, 0, 0, $w, $h); // Gaussian blur matrix: // // 1 2 1 // 2 4 2 // 1 2 1 // ////////////////////////////////////////////////// // Move copies of the image around one pixel at the time and merge them with weight // according to the matrix. The same matrix is simply repeated for higher radii. for ($i = 0; $i < $radius; $i++) { ImageCopy ($imgBlur, $imgCanvas, 0, 0, 1, 1, $w - 1, $h - 1); // up left ImageCopyMerge($imgBlur, $imgCanvas, 1, 1, 0, 0, $w, $h, 50); // down right ImageCopyMerge($imgBlur, $imgCanvas, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left ImageCopyMerge($imgBlur, $imgCanvas, 1, 0, 0, 1, $w, $h - 1, 25); // up right ImageCopyMerge($imgBlur, $imgCanvas, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left ImageCopyMerge($imgBlur, $imgCanvas, 1, 0, 0, 0, $w, $h, 25); // right ImageCopyMerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 20 ); // up ImageCopyMerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 16.666667); // down ImageCopyMerge($imgBlur, $imgCanvas, 0, 0, 0, 0, $w, $h, 50); // center ImageCopy ($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); // During the loop above the blurred copy darkens, possibly due to a roundoff // error. Therefore the sharp picture has to go through the same loop to // produce a similar image for comparison. This is not a good thing, as processing // time increases heavily. ImageCopy ($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 50); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 33.33333); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 25); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 33.33333); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 25); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 20 ); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 16.666667); ImageCopyMerge($imgBlur2, $imgCanvas2, 0, 0, 0, 0, $w, $h, 50); ImageCopy ($imgCanvas2, $imgBlur2, 0, 0, 0, 0, $w, $h); } // Calculate the difference between the blurred pixels and the original // and set the pixels for ($x = 0; $x < $w; $x++) { // each row for ($y = 0; $y < $h; $y++) { // each pixel $rgbOrig = ImageColorAt($imgCanvas2, $x, $y); $rOrig = (($rgbOrig >> 16) & 0xFF); $gOrig = (($rgbOrig >> 8) & 0xFF); $bOrig = ($rgbOrig & 0xFF); $rgbBlur = ImageColorAt($imgCanvas, $x, $y); $rBlur = (($rgbBlur >> 16) & 0xFF); $gBlur = (($rgbBlur >> 8) & 0xFF); $bBlur = ($rgbBlur & 0xFF); // When the masked pixels differ less from the original // than the threshold specifies, they are set to their original value. $rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig; $gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig; $bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig; $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); ImageSetPixel($img, $x, $y, $pixCol); } } ImageDestroy($imgCanvas); ImageDestroy($imgCanvas2); ImageDestroy($imgBlur); ImageDestroy($imgBlur2); return $img; //ImageDestroy($img); } // 젙솗븳 document_root 媛 李얠븘궡湲(꽌踰꾩뿉 뵲씪 뿁슧븯寃 由ы꽩븯뒗 寃쎌슦媛 엳뼱꽌 젙諛븳 寃궗媛 븘슂븯떎) function get_indexDir() { global $_SERVER; $docroot = $_SERVER["DOCUMENT_ROOT"] ? $_SERVER["DOCUMENT_ROOT"] : '\$empty\$'; $scriptfile = $_SERVER["SCRIPT_FILENAME"] ? $_SERVER["SCRIPT_FILENAME"] : $_SERVER["PATH_TRANSLATED"]; $phpself = $_SERVER["PHP_SELF"]; if(!$scriptfile) die("
뒪겕由쏀듃 뙆씪뿉 븳 젙蹂닿 뾾뒿땲떎. ::씠 꽌踰꾩뿉꽌뒗 떎뻾븷닔 뾾뒿땲떎. ::
"); if(!eregi($docroot,$scriptfile)) { $os = get_serveros(); if(eregi("windows",$os)) $scriptfile = str_replace("\\","/",$scriptfile); if (substr($phpself,0,2)=='/~') { $pattern = ":/~+(/+):i"; $scriptfile = str_replace($pattern,"\\1",$scriptfile); } $tmp = str_replace($phpself,'',$scriptfile).'/'; } else $tmp = $docroot; return $tmp; } ?>