first commit

This commit is contained in:
chicpro
2013-03-14 09:21:54 +09:00
commit cc5063d012
1817 changed files with 131384 additions and 0 deletions

33
lib/cheditor.lib.php Normal file
View File

@ -0,0 +1,33 @@
<?
if (!defined('_GNUBOARD_')) exit;
function cheditor1($id, $content)
{
return "<textarea id='ps_{$id}' style='display:none;'>{$content}</textarea>";
}
function cheditor2($form, $id, $width='100%', $height='250')
{
global $g4;
return "
<input type='hidden' name='{$id}' id='{$id}'>
<script>
var ed_{$id} = new cheditor('ed_{$id}');
ed_{$id}.editorPath = '{$g4[editor_path]}';
ed_{$id}.width = '{$width}';
ed_{$id}.height = '{$height}';
ed_{$id}.pasteContent = true;
ed_{$id}.pasteContentForm = 'ps_{$id}';
ed_{$id}.formName = '{$form}';
ed_{$id}.run();
</script>";
}
function cheditor3($id)
{
//return "document.getElementById('{$id}').value = ed_{$id}.outputHTML();";
// body 태그 안의 내용만 반환 (백경동 님)
return "document.getElementById('{$id}').value = ed_{$id}.outputBodyHTML();";
}
?>

56
lib/cheditor4.lib.php Normal file
View File

@ -0,0 +1,56 @@
<?
if (!defined('_GNUBOARD_')) exit;
if ($g4['is_cheditor5'])
{
$g4['cheditor4'] = "cheditor5";
$g4['cheditor4_path'] = $g4['path'] . "/" . $g4['cheditor4'];
function cheditor1($id, $width='100%', $height='250')
{
global $g4;
return "
<script type='text/javascript'>
var ed_{$id} = new cheditor('ed_{$id}');
ed_{$id}.config.editorHeight = '{$height}';
ed_{$id}.config.editorWidth = '{$width}';
ed_{$id}.inputForm = 'tx_{$id}';
</script>";
}
}
else
{
function cheditor1($id, $width='100%', $height='250')
{
global $g4;
return "
<script type='text/javascript'>
var ed_{$id} = new cheditor('ed_{$id}');
ed_{$id}.config.editorHeight = '{$height}';
ed_{$id}.config.editorWidth = '{$width}';
ed_{$id}.config.imgReSize = false;
ed_{$id}.config.fullHTMLSource = false;
ed_{$id}.config.editorPath = '{$g4[cheditor4_path]}';
ed_{$id}.inputForm = 'tx_{$id}';
</script>";
}
}
function cheditor2($id, $content='')
{
global $g4;
return "
<textarea name='{$id}' id='tx_{$id}' style='display:none;'>{$content}</textarea>
<script type='text/javascript'>
ed_{$id}.run();
</script>";
}
function cheditor3($id)
{
return "document.getElementById('tx_{$id}').value = ed_{$id}.outputBodyHTML();";
}
?>

1538
lib/common.lib.php Normal file

File diff suppressed because it is too large Load Diff

25
lib/connect.lib.php Normal file
View File

@ -0,0 +1,25 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 현재 접속자수 출력
function connect($skin_dir="")
{
global $config, $g4;
// 회원, 방문객 카운트
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from $g4[login_table] where mb_id <> '$config[cf_admin]' ";
$row = sql_fetch($sql);
if ($skin_dir)
$connect_skin_path = "$g4[path]/skin/connect/$skin_dir";
else
$connect_skin_path = "$g4[path]/skin/connect/$config[cf_connect_skin]";
ob_start();
include_once ("$connect_skin_path/connect.skin.php");
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>

12
lib/constant.php Normal file
View File

@ -0,0 +1,12 @@
<?
// 상수 정의
// 입력값 검사 상수
define('_G4_ALPHAUPPER_', 1); // 영대문자
define('_G4_ALPHALOWER_', 2); // 영소문자
define('_G4_ALPHABETIC_', 4); // 영대,소문자
define('_G4_NUMERIC_', 8); // 숫자
define('_G4_HANGUL_', 16); // 한글
define('_G4_SPACE_', 32); // 공백
define('_G4_SPECIAL_', 64); // 특수문자
?>

12
lib/etc.lib.php Normal file
View File

@ -0,0 +1,12 @@
<?
// 로그를 파일에 쓴다
function write_log($file, $log) {
$fp = fopen($file, "a+");
ob_start();
print_r($log);
$msg = ob_get_contents();
ob_end_clean();
fwrite($fp, $msg);
fclose($fp);
}
?>

153
lib/icode.sms.lib.php Normal file
View File

@ -0,0 +1,153 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 아이코드에서 제공하는 함수
///////////////////////////////////////////////////////////////////////////////////////////
// 이 부분은 건드릴 필요가 없습니다.
function spacing($text,$size) {
for ($i=0; $i<$size; $i++) $text.=" ";
$text = substr($text,0,$size);
return $text;
}
function cut_char($word, $cut) {
// $word=trim(stripslashes($word));
$word=substr($word,0,$cut); // 필요한 길이만큼 취함.
for ($k=$cut-1; $k>1; $k--) {
if (ord(substr($word,$k,1))<128) break; // 한글값은 160 이상.
}
$word=substr($word,0,$cut-($cut-$k+1)%2);
return $word;
}
function CheckCommonType($dest, $rsvTime) {
//$dest=eregi_replace("[^0-9]","",$dest);
$dest=preg_replace("/[^0-9]/i","",$dest);
if (strlen($dest)<10 || strlen($dest)>11) return "휴대폰 번호가 틀렸습니다";
$CID=substr($dest,0,3);
//if ( eregi("[^0-9]",$CID) || ($CID!='010' && $CID!='011' && $CID!='016' && $CID!='017' && $CID!='018' && $CID!='019') ) return "휴대폰 앞자리 번호가 잘못되었습니다";
if ( preg_match("/[^0-9]/i",$CID) || ($CID!='010' && $CID!='011' && $CID!='016' && $CID!='017' && $CID!='018' && $CID!='019') ) return "휴대폰 앞자리 번호가 잘못되었습니다";
//$rsvTime=eregi_replace("[^0-9]","",$rsvTime);
$rsvTime=preg_replace("/[^0-9]/i","",$rsvTime);
if ($rsvTime) {
if (!checkdate(substr($rsvTime,4,2),substr($rsvTime,6,2),substr($rsvTime,0,4))) return "예약날짜가 잘못되었습니다";
if (substr($rsvTime,8,2)>23 || substr($rsvTime,10,2)>59) return "예약시간이 잘못되었습니다";
}
}
class SMS {
var $ID;
var $PWD;
var $SMS_Server;
var $port;
var $SMS_Port;
var $Data = array();
var $Result = array();
function SMS_con($sms_server,$sms_id,$sms_pw,$port) {
$this->ID=$sms_id; // 계약 후 지정
$this->PWD=$sms_pw; // 계약 후 지정
$this->SMS_Server=$sms_server;
$this->SMS_Port=$port;
$this->ID = spacing($this->ID,10);
$this->PWD = spacing($this->PWD,10);
}
function Init() {
$this->Data = "";
$this->Result = "";
}
function Add($dest, $callBack, $Caller, $msg, $rsvTime="") {
global $g4;
// 내용 검사 1
$Error = CheckCommonType($dest, $rsvTime);
if ($Error) return $Error;
// 내용 검사 2
//if ( eregi("[^0-9]",$callBack) ) return "회신 전화번호가 잘못되었습니다";
if ( preg_match("/[^0-9]/i",$callBack) ) return "회신 전화번호가 잘못되었습니다";
// 아이코드에서는 문자에 utf-8 인코딩 형식을 아직 지원하지 않는다.
if (strtolower($g4['charset'])=='utf-8') {
if (function_exists("iconv")) {
$msg = iconv("utf-8", "euc-kr", $msg);
}
}
$msg=cut_char($msg,80); // 80자 제한
// 보낼 내용을 배열에 집어넣기
$dest = spacing($dest,11);
$callBack = spacing($callBack,11);
$Caller = spacing($Caller,10);
$rsvTime = spacing($rsvTime,12);
$msg = spacing($msg,80);
$this->Data[] = '01144 '.$this->ID.$this->PWD.$dest.$callBack.$Caller.$rsvTime.$msg;
return "";
}
function AddURL($dest, $callBack, $URL, $msg, $rsvTime="") {
// 내용 검사 1
$Error = CheckCommonType($dest, $rsvTime);
if ($Error) return $Error;
// 내용 검사 2
//$URL=str_replace("http://","",$URL);
if (strlen($URL)>50) return "URL이 50자가 넘었습니다";
switch (substr($dest,0,3)) {
case '010': //20바이트
$msg=cut_char($msg,20);
break;
case '011': //80바이트
$msg=cut_char($msg,80);
break;
case '016': // 80바이트
$msg=cut_char($msg,80);
break;
case '017': // URL 포함 80바이트
$msg=cut_char($msg,80-strlen($URL));
break;
case '018': // 20바이트
$msg=cut_char($msg,20);
break;
case '019': // 20바이트
$msg=cut_char($msg,20);
break;
default:
return "아직 URL CallBack이 지원되지 않는 번호입니다";
break;
}
// 보낼 내용을 배열에 집어넣기
$dest = spacing($dest,11);
$URL = spacing($URL,50);
$callBack = spacing($callBack,11);
$rsvTime = spacing($rsvTime,12);
$msg = spacing($msg,80);
$this->Data[] = '05173 '.$this->ID.$this->PWD.$dest.$callBack.$URL.$rsvTime.$msg;
return "";
}
function Send () {
$fp=@fsockopen(trim($this->SMS_Server),trim($this->SMS_Port));
if (!$fp) return false;
set_time_limit(300);
## php4.3.10일경우
## zend 최신버전으로 업해주세요..
## 또는 122번째 줄을 $this->Data as $tmp => $puts 로 변경해 주세요.
foreach($this->Data as $puts) {
$dest = substr($puts,26,11);
fputs($fp,$puts);
while(!$gets) { $gets=fgets($fp,30); }
if (substr($gets,0,19)=="0223 00".$dest) $this->Result[]=$dest.":".substr($gets,19,10);
else $this->Result[$dest]=$dest.":Error";
$gets="";
}
fclose($fp);
$this->Data="";
return true;
}
}
?>

585
lib/iteminfo.lib.php Normal file
View File

@ -0,0 +1,585 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 품목별 재화등에 관한 상품요약 정보
$item_info = array(
"wear"=>array(
"title"=>"의류",
"article"=>array(
"material"=>array("제품소재", "섬유의 조성 또는 혼용률을 백분율로 표시, 기능성인 경우 성적서 또는 허가서"),
"color"=>array("색상", ""),
"size"=>array("치수", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"caution"=>array("세탁방법 및 취급시 주의사항", ""),
"manufacturing_ym"=>array("제조연월", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"shoes"=>array(
"title"=>"구두/신발",
"article"=>array(
"material"=>array("제품소재", "운동화인 경우에는 겉감, 안감을 구분하여 표시"),
"color"=>array("색상", ""),
"size"=>array("치수-발길이", "해외사이즈 표기 시 국내사이즈 병행 표기 (mm)"),
"height"=>array("치수-굽높이", "굽 재료를 사용하는 여성화에 한함 (cm)"),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"caution"=>array("취급시 주의사항", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"bag"=>array(
"title"=>"가방",
"article"=>array(
"kind"=>array("종류", ""),
"material"=>array("소재", ""),
"color"=>array("색상", ""),
"size"=>array("크기", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"caution"=>array("취급시 주의사항", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"fashion"=>array(
"title"=>"패션잡화(모자/벨트/액세서리)",
"article"=>array(
"kind"=>array("종류", ""),
"material"=>array("소재", ""),
"size"=>array("치수", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"caution"=>array("취급시 주의사항", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"bedding"=>array(
"title"=>"침구류/커튼",
"article"=>array(
"material"=>array("제품소재", "(섬유의 조성 또는 혼용률을 백분율로 표시) 충전재를 사용한 제품은 충전재를 함께 표기"),
"color"=>array("색상", ""),
"size"=>array("치수", ""),
"component" =>array("제품구성", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"caution"=>array("세탁방법 및 취급시 주의사항", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"furniture"=>array(
"title"=>"가구(침대/소파/싱크대/DIY제품)",
"article"=>array(
"product_name"=>array("품명", ""),
"certification"=>array("KC 인증 필 유무", "(품질경영 및 공산품안전관리법 상 안전&middot;품질표시대상공산품에 한함)"),
"color"=>array("색상", ""),
"component" =>array("구성품", ""),
"material"=>array("주요소재", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)<br />구성품 별 제조자가 다른 경우 각 구성품의 제조자, 수입자"),
"madein"=>array("제조국", "구성품 별 제조국이 다른 경우 각 구성품의 제조국"),
"size"=>array("크기", ""),
"delivery"=>array("배송&middot;설치비용", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"image_appliances"=>array(
"title"=>"영상가전 (TV류)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("전기용품 안전인증 필 유무", "전기용품안전관리법 상 안전인증대상전기용품, 자율안전확인대상전기용품, 공급자적합성확인대상전기용품에 한함"),
"rated_voltage"=>array("정격전압", "에너지이용합리화법 상 의무대상상품에 한함"),
"power_consumption"=>array("소비전력", "에너지이용합리화법 상 의무대상상품에 한함"),
"energy_efficiency"=>array("에너지효율등급", "에너지이용합리화법 상 의무대상상품에 한함"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", "구성품 별 제조국이 다른 경우 각 구성품의 제조국"),
"size"=>array("크기", "형태포함"),
"display_specification"=>array("화면사양", "크기, 해상도, 화면비율 등"),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"home_appliances"=>array(
"title"=>"가정용전기제품(냉장고/세탁기/식기세척기/전자레인지)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("전기용품 안전인증 필 유무", "전기용품안전관리법 상 안전인증대상전기용품, 자율안전확인대상전기용품, 공급자적합성확인대상전기용품에 한함"),
"rated_voltage"=>array("정격전압", "에너지이용합리화법 상 의무대상상품에 한함"),
"power_consumption"=>array("소비전력", "에너지이용합리화법 상 의무대상상품에 한함"),
"energy_efficiency"=>array("에너지효율등급", "에너지이용합리화법 상 의무대상상품에 한함"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", "형태포함"),
"display_specification"=>array("화면사양", "크기, 해상도, 화면비율 등"),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"season_appliances"=>array(
"title"=>"계절가전(에어컨/온풍기)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("전기용품 안전인증 필 유무", "전기용품안전관리법 상 안전인증대상전기용품, 자율안전확인대상전기용품, 공급자적합성확인대상전기용품에 한함"),
"rated_voltage"=>array("정격전압", "에너지이용합리화법 상 의무대상상품에 한함"),
"power_consumption"=>array("소비전력", "에너지이용합리화법 상 의무대상상품에 한함"),
"energy_efficiency"=>array("에너지효율등급", "에너지이용합리화법 상 의무대상상품에 한함"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", "형태 및 실외기 포함"),
"area"=>array("냉난방면적", ""),
"installation_costs"=>array("추가설치비용", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"office_appliances"=>array(
"title"=>"사무용기기(컴퓨터/노트북/프린터)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KCC 인증 필 유무", "전파법 상 인증대상상품에 한함, MIC 인증 필 혼용 가능"),
"rated_voltage"=>array("정격전압", "에너지이용합리화법 상 의무대상상품에 한함"),
"power_consumption"=>array("소비전력", "에너지이용합리화법 상 의무대상상품에 한함"),
"energy_efficiency"=>array("에너지효율등급", "에너지이용합리화법 상 의무대상상품에 한함"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", "구성품 별 제조국이 다른 경우 각 구성품의 제조국"),
"size"=>array("크기", ""),
"weight"=>array("무게", "무게는 노트북에 한함"),
"specification"=>array("주요사양", "컴퓨터와 노트북의 경우 성능, 용량, 운영체제 포함여부 등 / 프린터의 경우 인쇄 속도 등"),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"optics_appliances"=>array(
"title"=>"광학기기(디지털카메라/캠코더)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KCC 인증 필 유무", "전파법 상 인증대상상품에 한함, MIC 인증 필 혼용 가능"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", ""),
"weight"=>array("무게", ""),
"specification"=>array("주요사양", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"microelectronics"=>array(
"title"=>"소형전자(MP3/전자사전등)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KCC 인증 필 유무", "전파법 상 인증대상상품에 한함, MIC 인증 필 혼용 가능"),
"rated_voltage"=>array("정격전압", ""),
"power_consumption"=>array("소비전력", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", ""),
"weight"=>array("무게", ""),
"specification"=>array("주요사양", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"mobile"=>array(
"title"=>"휴대폰",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KCC 인증 필 유무", "전파법 상 인증대상상품에 한함, MIC 인증 필 혼용 가능"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", ""),
"weight"=>array("무게", ""),
"telecom"=>array("이동통신사", ""),
"join_process"=>array("가입절차", ""),
"extra_burden"=>array("소비자의 추가적인 부담사항 ", "가입비, 유심카드 구입비 등 추가로 부담하여야 할 금액, 부가서비스, 의무사용기간, 위약금 등"),
"specification"=>array("주요사양", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"navigation"=>array(
"title"=>"네비게이션",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KCC 인증 필 유무", "전파법 상 인증대상상품에 한함, MIC 인증 필 혼용 가능"),
"rated_voltage"=>array("정격전압", ""),
"power_consumption"=>array("소비전력", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"size"=>array("크기", ""),
"weight"=>array("무게", ""),
"specification"=>array("주요사양", ""),
"update_cost"=>array("맵 업데이트 비용", ""),
"freecost_period"=>array("무상기간", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"car"=>array(
"title"=>"자동차용품(자동차부품/기타자동차용품)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"certification"=>array("자동차부품 자기인증 유무 ", "자동차 관리법 상 인증 대상 자동차 부품에 한함"),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", "구성품 별 제조국이 다른 경우 각 구성품의 제조국"),
"size"=>array("크기", ""),
"apply_model"=>array("적용차종", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"medical"=>array(
"title"=>"의료기기",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"license_number"=>array("의료기기법상 허가&middot;신고 번호", "허가&middot;신고 대상 의료기기에 한함"),
"advertising"=>array("광고사전심의필 유무", ""),
"certification"=>array("전기용품안전관리법상 KC 인증 필 유무 ", "안전인증 또는 자율안전확인 대상 전기용품에 한함"),
"rated_voltage"=>array("정격전압", "전기용품에 한함"),
"power_consumption"=>array("소비전력", "전기용품에 한함"),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"appliances_purpose"=>array("제품의 사용목적", ""),
"appliances_usage"=>array("제품의 사용목적", ""),
"display_specification"=>array("화면사양", "(크기, 해상도, 화면비율 등)"),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"kitchenware"=>array(
"title"=>"주방용품",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"material"=>array("재질", ""),
"component"=>array("구성품", ""),
"size"=>array("크기", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"import_declaration"=>array("식품위생법에 따른 수입 신고", "식품위생법에 따른 수입 기구&middot;용기의 경우 \"식품위생법에 따른 수입신고를 필함\"의 문구"),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"cosmetics"=>array(
"title"=>"화장품",
"article"=>array(
"capacity"=>array("용량 또는 중량", ""),
"specification"=>array("제품 주요사양", "피부타입, 색상(호, 번) 등"),
"expiration_date"=>array("사용기한 또는 개봉 후 사용기간", "개봉 후 사용기간을 기재할 경우에는 제조연월일을 병행표기"),
"usage"=>array("사용방법", ""),
"maker"=>array("제조자", ""),
"distributor"=>array("제조판매업자", ""),
"madein"=>array("제조국", ""),
"mainingredient"=>array("주요성분", "유기농 화장품의 경우 유기농 원료 함량 포함"),
"certification"=>array("식품의약품안전청 심사 필 유무", "기능성 화장품의 경우 화장품법에 따른 식품의약품안전청 심사 필 유무 (미백, 주름개선, 자외선차단 등)"),
"caution"=>array("사용할 때 주의사항", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"jewelry"=>array(
"title"=>"귀금속/보석/시계류",
"article"=>array(
"material"=>array("소재", ""),
"purity"=>array("순도", ""),
"band"=>array("밴드재질", "시계의 경우"),
"weight"=>array("중량", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", "원산지와 가공지 등이 다를 경우 함께 표기"),
"size"=>array("치수", ""),
"caution"=>array("착용 시 주의사항", ""),
"specification"=>array("주요사양", "귀금속, 보석류는 등급, 시계는 기능, 방수 등"),
"provide_warranty"=>array("보증서 제공여부", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("A/S 책임자와 전화번호", ""),
)
),
"food"=>array(
"title"=>"식품(농수산물)",
"article"=>array(
"weight"=>array("포장단위별 용량(중량)", ""),
"quantity"=>array("포장단위별 수량", ""),
"size"=>array("포장단위별 크기", ""),
"producer"=>array("생산자", "수입품의 경우 수입자를 함께 표기"),
"origin"=>array("원산지", "농수산물의 원산지 표시에 관한 법률에 따른 원산지"),
"manufacturing_ymd"=>array("제조연월일", "포장일 또는 생산연도"),
"expiration_date"=>array("유통기한 또는 품질유지기한", ""),
"law_content"=>array("관련법상 표시사항", "농산물 - 농산물품질관리법상 유전자변형농산물 표시, 지리적표시<br />축산물 - 축산법에 따른 등급 표시, 쇠고기의 경우 이력관리에 따른 표시 유무<br />수산물 - 수산물품질관리법상 유전자변형수산물 표시, 지리적표시<br />수입식품에 해당하는 경우 \"식품위생법에 따른 수입신고를 필함\"의 문구"),
"product_composition"=>array("상품구성", ""),
"keep"=>array("보관방법 또는 취급방법", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"general_food"=>array(
"title"=>"가공식품",
"article"=>array(
"food_type"=>array("식품의 유형", ""),
"producer"=>array("생산자", ""),
"location"=>array("소재지", "수입품의 경우 수입자를 함께 표기"),
"manufacturing_ymd"=>array("제조연월일", ""),
"expiration_date"=>array("유통기한 또는 품질유지기한", ""),
"weight"=>array("포장단위별 용량(중량)", ""),
"quantity"=>array("포장단위별 수량", ""),
"ingredients"=>array("원재료명 및 함량", "농수산물의 원산지 표시에 관한 법률에 따른 원산지 표시 포함"),
"nutrition_component"=>array("영양성분", "식품위생법에 따른 영양성분 표시대상 식품에 한함"),
"genetically_modified"=>array("유전자재조합식품에 해당하는 경우의 표시", ""),
"baby_food"=>array("영유아식 또는 체중조절식품 등에 해당하는 경우 표시광고 사전심의필", ""),
"imported_food"=>array("수입식품에 해당하는 경우 “식품위생법에 따른 수입신고를 필함”의 문구", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"diet_food"=>array(
"title"=>"건강기능식품",
"article"=>array(
"food_type"=>array("식품의 유형", ""),
"producer"=>array("생산자", ""),
"location"=>array("소재지", "수입품의 경우 수입자를 함께 표기"),
"manufacturing_ymd"=>array("제조연월일", ""),
"expiration_date"=>array("유통기한 또는 품질유지기한", ""),
"waight"=>array("포장단위별 용량(중량)", ""),
"quantity"=>array("포장단위별 수량", ""),
"ingredients"=>array("원재료명 및 함량", "농수산물의 원산지 표시에 관한 법률에 따른 원산지 표시 포함"),
"nutrition"=>array("영양정보", ""),
"specification"=>array("기능정보", ""),
"intake"=>array("섭취량, 섭취방법 및 섭취 시 주의사항", ""),
"disease"=>array("질병의 예방 및 치료를 위한 의약품이 아니라는 내용의 표현", ""),
"genetically_modified"=>array("유전자재조합식품에 해당하는 경우의 표시", ""),
"display_ad"=>array("표시광고 사전심의필", ""),
"imported_food"=>array("수입식품에 해당하는 경우 \"건강기능식품에 관한 법률에 따른 수입신고를 필함\"의 문구", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"kids"=>array(
"title"=>"영유아용품",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certification"=>array("KC 인증 필", "품질경영 및 공산품안전관리법 상 안전인증대상 또는 자율안전확인대상 공산품에 한함"),
"size"=>array("크기", ""),
"weight"=>array("중량", ""),
"color"=>array("색상", ""),
"material"=>array("재질", "섬유의 경우 혼용률"),
"age"=>array("사용연령", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"caution"=>array("취급방법 및 취급시 주의사항, 안전표시 (주의, 경고 등)", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"instrument"=>array(
"title"=>"악기",
"article"=>array(
"size"=>array("크기", ""),
"color"=>array("색상", ""),
"material"=>array("재질", ""),
"components"=>array("제품구성", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"detailed_specifications"=>array("상품별 세부 사양", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"sports"=>array(
"title"=>"스포츠용품",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"size"=>array("크기", ""),
"weight"=>array("중량", ""),
"color"=>array("색상", ""),
"material"=>array("재질", ""),
"components"=>array("제품구성", ""),
"released_date"=>array("동일모델의 출시년월", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"madein"=>array("제조국", ""),
"detailed_specifications"=>array("상품별 세부 사양", ""),
"warranty"=>array("품질보증기준", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"books"=>array(
"title"=>"서적",
"article"=>array(
"product_name"=>array("도서명", ""),
"author"=>array("저자", ""),
"publisher"=>array("출판사", ""),
"size"=>array("크기", "전자책의 경우 파일의 용량"),
"pages"=>array("쪽수", "전자책의 경우 제외"),
"components"=>array("제품구성", "전집 또는 세트일 경우 낱권 구성, CD 등"),
"publish_date"=>array("출간일", ""),
"description"=>array("목차 또는 책소개", ""),
)
),
"reserve"=>array(
"title"=>"호텔/펜션예약",
"article"=>array(
"location"=>array("국가 또는 지역명", ""),
"lodgment_type"=>array("숙소형태", ""),
"grade"=>array("등급", ""),
"room_type"=>array("객실타입", ""),
"room_capacity"=>array("사용가능인원", ""),
"extra_person_charge"=>array("인원 추가시 비용", ""),
"facilities"=>array("부대시설", ""),
"provided_service"=>array("제공서비스", "조식 등"),
"cancellation_policy"=>array("취소규정", "환불 위약금 등"),
"booking_contacts"=>array("예약담당 연락처", ""),
)
),
"travel"=>array(
"title"=>"여행패키지",
"article"=>array(
"travel_agency"=>array("여행사", ""),
"flight"=>array("이용항공편", ""),
"travel_period"=>array("여행기간", ""),
"schedule"=>array("일정", ""),
"maximum_people"=>array("총예정인원", ""),
"minimum_people"=>array("출발가능인원", ""),
"accomodation_info"=>array("숙박정보", ""),
"details"=>array("포함내역", "식사, 인솔자, 공연관람 등"),
"additional_charge"=>array("추가 경비 항목과 금액", "유류할증료, 공항이용료, 관광지 입장료, 안내원수수료, 식사비용, 선택사항 등"),
"cancellation_policy"=>array("취소규정", "환불, 위약금 등"),
"travel_warnings"=>array("해외여행의 경우 외교통상부가 지정하는 여행경보단계", ""),
"booking_contacts"=>array("예약담당 연락처", ""),
)
),
"airline_ticket"=>array(
"title"=>"항공권",
"article"=>array(
"charge_condition"=>array("요금조건", ""),
"round_trip"=>array("왕복&middot;편도 여부", ""),
"expiration_date"=>array("유효기간", ""),
"restriction"=>array("제한사항", "출발일, 귀국일 변경가능 여부 등"),
"ticket_delivery_mean"=>array("티켓수령방법", ""),
"seat_type"=>array("좌석종류", ""),
"additional_charge"=>array("추가 경비 항목과 금액", "유류할증료, 공항이용료 등"),
"cancellation_policy"=>array("취소 규정", "환불, 위약금 등"),
"booking_contacts"=>array("예약담당 연락처", ""),
)
),
"rent_car"=>array(
"title"=>"자동차대여서비스(렌터카)",
"article"=>array(
"model"=>array("차종", ""),
"ownership_transfer"=>array("소유권 이전 조건", "소유권이 이전되는 경우에 한함"),
"additional_charge"=>array("추가 선택 시 비용", "자차면책제도, 내비게이션 등"),
"fuel_cost"=>array("차량 반환 시 연료대금 정산 방법", ""),
"vehicle_breakdown"=>array("차량의 고장&middot훼손 시 소비자 책임", ""),
"cancellation_policy"=>array("예약취소 또는 중도 해약 시 환불 기준", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"rental_water"=>array(
"title"=>"물품대여서비스(정수기,비데,공기청정기 등)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"transfer_of_ownership"=>array("소유권 이전 조건", "소유권이 이전되는 경우에 한함"),
"maintenance"=>array("유지보수 조건", "점검&middot;필터교환 주기, 추가 비용 등"),
"consumer_responsibility"=>array("상품의 고장&middot;분실&middot;훼손 시 소비자 책임", ""),
"refund"=>array("중도 해약 시 환불 기준", ""),
"specification"=>array("제품 사양", "용량, 소비전력 등"),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"rental_etc"=>array(
"title"=>"물품대여서비스(서적,유아용품,행사용품 등)",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"transfer_of_ownership"=>array("소유권 이전 조건", "소유권이 이전되는 경우에 한함"),
"consumer_responsibility"=>array("상품의 고장&middot;분실&middot;훼손 시 소비자 책임", ""),
"refund"=>array("중도 해약 시 환불 기준", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"digital_contents"=>array(
"title"=>"디지털콘텐츠(음원,게임,인터넷강의 등)",
"article"=>array(
"producer"=>array("제작자 또는 공급자", ""),
"terms_of_use"=>array("이용조건", ""),
"use_period"=>array("이용기간", ""),
"product_offers"=>array("상품 제공 방식", "CD, 다운로드, 실시간 스트리밍 등"),
"minimum_system"=>array("최소 시스템 사양, 필수 소프트웨어", ""),
"transfer_of_ownership"=>array("소유권 이전 조건", "소유권이 이전되는 경우에 한함"),
"maintenance"=>array("청약철회 또는 계약의 해제&middot;해지에 따른 효과", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"gift_card"=>array(
"title"=>"상품권/쿠폰",
"article"=>array(
"isseur"=>array("발행자", ""),
"expiration_date"=>array("유효기간", ""),
"terms_of_use"=>array("이용조건", "유효기간 경과 시 보상 기준, 사용제한품목 및 기간 등"),
"use_store"=>array("이용 가능 매장", ""),
"refund_policy"=>array("잔액 환급 조건", ""),
"as"=>array("소비자상담 관련 전화번호", ""),
)
),
"etc"=>array(
"title"=>"기타",
"article"=>array(
"product_name"=>array("품명", ""),
"model_name"=>array("모델명", ""),
"certified_by_law"=>array("법에 의한 인증&middot허가 등을 받았음을 확인할 수 있는 경우 그에 대한 사항", ""),
"origin"=>array("제조국 또는 원산지", ""),
"maker"=>array("제조자", "수입품의 경우 수입자를 함께 표기 (병행수입의 경우 병행수입 여부로 대체 가능)"),
"as"=>array("A/S 책임자와 전화번호 또는 소비자상담 관련 전화번호", ""),
)
),
);
// 상품상세정보 테이블 생성
function create_table_item_info()
{
global $g4;
return sql_query("
CREATE TABLE IF NOT EXISTS `{$g4['yc4_item_info_table']}` (
`ii_id` int(11) NOT NULL AUTO_INCREMENT,
`it_id` varchar(10) NOT NULL,
`ii_gubun` varchar(50) NOT NULL,
`ii_article` varchar(50) NOT NULL,
`ii_title` varchar(255) NOT NULL,
`ii_value` varchar(255) NOT NULL,
PRIMARY KEY (`ii_id`),
UNIQUE KEY `it_id` (`it_id`,`ii_gubun`,`ii_article`)
)
", false);
}
function item_info_gubun($gubun)
{
global $item_info;
return $item_info[$gubun]['title'];
}
?>

35
lib/latest.lib.php Normal file
View File

@ -0,0 +1,35 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>

173
lib/mailer.lib.php Normal file
View File

@ -0,0 +1,173 @@
<?
if (!defined("_GNUBOARD_")) exit;
// 메일 보내기 (파일 여러개 첨부 가능)
// type : text=0, html=1, text+html=2
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
{
global $config;
global $g4;
// 메일발송 사용을 하지 않는다면
if (!$config[cf_email_use]) return;
$fname = "=?$g4[charset]?B?" . base64_encode($fname) . "?=";
$subject = "=?$g4[charset]?B?" . base64_encode($subject) . "?=";
//$g4[charset] = ($g4[charset] != "") ? "charset=$g4[charset]" : "";
$header = "Return-Path: <$fmail>\n";
$header .= "From: $fname <$fmail>\n";
$header .= "Reply-To: <$fmail>\n";
if ($cc) $header .= "Cc: $cc\n";
if ($bcc) $header .= "Bcc: $bcc\n";
$header .= "MIME-Version: 1.0\n";
//$header .= "X-Mailer: SIR Mailer 0.91 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
// UTF-8 관련 수정
$header .= "X-Mailer: SIR Mailer 0.92 (sir.co.kr) : $_SERVER[SERVER_ADDR] : $_SERVER[REMOTE_ADDR] : $g4[url] : $_SERVER[PHP_SELF] : $_SERVER[HTTP_REFERER] \n";
if ($file != "") {
$boundary = uniqid("http://sir.co.kr/");
$header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n";
$header .= "--$boundary\n";
}
if ($type) {
$header .= "Content-Type: TEXT/HTML; charset=$g4[charset]\n";
if ($type == 2)
$content = nl2br($content);
} else {
$header .= "Content-Type: TEXT/PLAIN; charset=$g4[charset]\n";
$content = stripslashes($content);
}
$header .= "Content-Transfer-Encoding: BASE64\n\n";
$header .= chunk_split(base64_encode($content)) . "\n";
if ($file != "") {
foreach ($file as $f) {
$header .= "\n--$boundary\n";
$header .= "Content-Type: APPLICATION/OCTET-STREAM; name=\"$f[name]\"\n";
$header .= "Content-Transfer-Encoding: BASE64\n";
$header .= "Content-Disposition: inline; filename=\"$f[name]\"\n";
$header .= "\n";
$header .= chunk_split(base64_encode($f[data]));
$header .= "\n";
}
$header .= "--$boundary--\n";
}
@mail($to, $subject, "", $header);
}
// 파일 첨부시
/*
$fp = fopen(__FILE__, "r");
$file[] = array(
"name"=>basename(__FILE__),
"data"=>fread($fp, filesize(__FILE__)));
fclose($fp);
*/
// 파일을 첨부함
function attach_file($filename, $file)
{
$fp = fopen($file, "r");
$tmpfile = array(
"name" => $filename,
"data" => fread($fp, filesize($file)));
fclose($fp);
return $tmpfile;
}
// 메일 유효성 검사
// core PHP Programming 책 참고
// hanmail.net , hotmail.com , kebi.com 등이 정상적이지 않음으로 사용 불가
function verify_email($address, &$error)
{
global $g4;
$WAIT_SECOND = 3; // ?초 기다림
list($user, $domain) = explode("@", $address);
// 도메인에 메일 교환기가 존재하는지 검사
if (checkdnsrr($domain, "MX")) {
// 메일 교환기 레코드들을 얻는다
if (!getmxrr($domain, $mxhost, $mxweight)) {
$error = "메일 교환기를 회수할 수 없음";
return false;
}
} else {
// 메일 교환기가 없으면, 도메인 자체가 편지를 받는 것으로 간주
$mxhost[] = $domain;
$mxweight[] = 1;
}
// 메일 교환기 호스트의 배열을 만든다.
for ($i=0; $i<count($mxhost); $i++)
$weighted_host[($mxweight[$i])] = $mxhost[$i];
ksort($weighted_host);
// 각 호스트를 검사
foreach($weighted_host as $host) {
// 호스트의 SMTP 포트에 연결
if (!($fp = @fsockopen($host, 25))) continue;
// 220 메세지들은 건너뜀
// 3초가 지나도 응답이 없으면 포기
socket_set_blocking($fp, false);
$stoptime = $g4[server_time] + $WAIT_SECOND;
$gotresponse = false;
while (true) {
// 메일서버로부터 한줄 얻음
$line = fgets($fp, 1024);
if (substr($line, 0, 3) == "220") {
// 타이머를 초기화
$stoptime = $g4[server_time] + $WAIT_SECOND;
$gotresponse = true;
} else if ($line == "" && $gotresponse)
break;
else if ($g4[server_time] > $stoptime)
break;
}
// 이 호스트는 응답이 없음. 다음 호스트로 넘어간다
if (!$gotresponse) continue;
socket_set_blocking($fp, true);
// SMTP 서버와의 대화를 시작
fputs($fp, "HELO $_SERVER[SERVER_NAME]\r\n");
echo "HELO $_SERVER[SERVER_NAME]\r\n";
fgets($fp, 1024);
// From을 설정
fputs($fp, "MAIL FROM: <info@$domain>\r\n");
echo "MAIL FROM: <info@$domain>\r\n";
fgets($fp, 1024);
// 주소를 시도
fputs($fp, "RCPT TO: <$address>\r\n");
echo "RCPT TO: <$address>\r\n";
$line = fgets($fp, 1024);
// 연결을 닫음
fputs($fp, "QUIT\r\n");
fclose($fp);
if (substr($line, 0, 3) != "250") {
// SMTP 서버가 이 주소를 인식하지 못하므로 잘못된 주소임
$error = $line;
return false;
} else
// 주소를 인식했음
return true;
}
$error = "메일 교환기에 도달하지 못하였습니다.";
return false;
}
?>

37
lib/outlogin.lib.php Normal file
View File

@ -0,0 +1,37 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 외부로그인
function outlogin($skin_dir="basic")
{
global $config, $member, $g4, $urlencode, $is_admin;
$nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
$point = number_format($member['mb_point']);
$outlogin_skin_path = "$g4[path]/skin/outlogin/$skin_dir";
// 읽지 않은 쪽지가 있다면
if ($member['mb_id']) {
$sql = " select count(*) as cnt from {$g4['memo_table']} where me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' ";
$row = sql_fetch($sql);
$memo_not_read = $row['cnt'];
$is_auth = false;
$sql = " select count(*) as cnt from $g4[auth_table] where mb_id = '$member[mb_id]' ";
$row = sql_fetch($sql);
if ($row['cnt'])
$is_auth = true;
}
ob_start();
if ($member['mb_id'])
include_once ("$outlogin_skin_path/outlogin.skin.2.php");
else // 로그인 전이라면
include_once ("$outlogin_skin_path/outlogin.skin.1.php");
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>

25
lib/poll.lib.php Normal file
View File

@ -0,0 +1,25 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 설문조사
function poll($skin_dir="basic", $po_id=false)
{
global $config, $member, $g4;
// 투표번호가 넘어오지 않았다면 가장 큰(최근에 등록한) 투표번호를 얻는다
if (empty($po_id))
{
$po_id = $config['cf_max_po_id'];
if (empty($po_id))
return "<!-- po_id를 찾을 수 없습니다. -->";
}
ob_start();
$poll_skin_path = "$g4[path]/skin/poll/$skin_dir";
include_once ("$poll_skin_path/poll.skin.php");
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>

36
lib/popular.lib.php Normal file
View File

@ -0,0 +1,36 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 인기검색어 출력
// $skin_dir : 스킨 디렉토리
// $pop_cnt : 검색어 몇개
// $date_cnt : 몇일 동안
function popular($skin_dir='basic', $pop_cnt=7, $date_cnt=3)
{
global $config, $g4;
if (!$skin_dir) $skin_dir = 'basic';
$date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
where pp_date between '$date_gap' and '$g4[time_ymd]'
group by pp_word
order by cnt desc, pp_word
limit 0, $pop_cnt ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
// 스크립트등의 실행금지
$list[$i][pp_word] = get_text($list[$i][pp_word]);
}
ob_start();
$popular_skin_path = "$g4[path]/skin/popular/$skin_dir";
include_once ("$popular_skin_path/popular.skin.php");
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>

696
lib/shop.lib.php Normal file
View File

@ -0,0 +1,696 @@
<?
//==============================================================================
// 쇼핑몰 함수 모음 시작
//==============================================================================
// 장바구니 건수 검사
function get_cart_count($on_uid)
{
global $g4;
$sql = " select count(ct_id) as cnt from $g4[yc4_cart_table] where on_uid = '$on_uid' ";
$row = sql_fetch($sql);
$cnt = (int)$row[cnt];
return $cnt;
}
// 이미지를 얻는다
function get_image($img, $width=0, $height=0)
{
global $g4, $default;
$full_img = "$g4[path]/data/item/$img";
if (file_exists($full_img) && $img)
{
if (!$width)
{
$size = getimagesize($full_img);
$width = $size[0];
$height = $size[1];
}
$str = "<img id='$img' src='$g4[url]/data/item/$img' width='$width' height='$height' border='0'>";
}
else
{
$str = "<img id='$img' src='$g4[shop_img_url]/no_image.gif' border='0' ";
if ($width)
$str .= "width='$width' height='$height'";
else
$str .= "width='$default[de_mimg_width]' height='$default[de_mimg_height]'";
$str .= ">";
}
return $str;
}
// 상품 이미지를 얻는다
function get_it_image($img, $width=0, $height=0, $id="")
{
global $g4;
$str = get_image($img, $width, $height);
if ($id) {
$str = "<a href='$g4[shop_url]/item.php?it_id=$id'>$str</a>";
}
return $str;
}
// 상품의 재고 (창고재고수량 - 주문대기수량)
function get_it_stock_qty($it_id)
{
global $g4;
$sql = " select it_stock_qty from $g4[yc4_item_table] where it_id = '$it_id' ";
$row = sql_fetch($sql);
$jaego = (int)$row['it_stock_qty'];
// 재고에서 빼지 않았고 주문인것만
$sql = " select SUM(ct_qty) as sum_qty
from $g4[yc4_cart_table]
where it_id = '$it_id'
and ct_stock_use = 0
and ct_status in ('주문', '준비') ";
$row = sql_fetch($sql);
$daegi = (int)$row['sum_qty'];
return $jaego - $daegi;
}
// 큰 이미지
function get_large_image($img, $it_id, $btn_image=true)
{
global $g4;
if (file_exists("$g4[path]/data/item/$img") && $img != "")
{
$size = getimagesize("$g4[path]/data/item/$img");
$width = $size[0];
$height = $size[1];
$str = "<a href=\"javascript:popup_large_image('$it_id', '$img', $width, $height, '$g4[shop_path]')\">";
if ($btn_image)
$str .= "<img src='$g4[shop_img_path]/btn_zoom.gif' border='0'></a>";
}
else
$str = "";
return $str;
}
// 금액 표시
function display_amount($amount, $tel_inq=false)
{
if ($tel_inq)
$amount = "전화문의";
else
$amount = number_format($amount, 0) . "";
return $amount;
}
// 금액표시
// $it : 상품 배열
function get_amount($it)
{
global $member;
if ($it['it_tel_inq']) return '전화문의';
if ($member[mb_level] > 2) // 특별회원
$amount = $it[it_amount3];
if ($member[mb_level] == 2 || $amount == 0) // 회원가격
$amount = $it[it_amount2];
if ($member[mb_level] == 1 || $amount == 0) // 비회원가격
$amount = $it[it_amount];
return (int)$amount;
}
// 포인트 표시
function display_point($point)
{
return number_format($point, 0) . "";
}
// 포인트를 구한다
function get_point($amount, $point)
{
return (int)($amount * $point / 100);
}
// HTML 특수문자 변환 htmlspecialchars
function htmlspecialchars2($str)
{
$trans = array("\"" => "&#034;", "'" => "&#039;", "<"=>"&#060;", ">"=>"&#062;");
$str = strtr($str, $trans);
return $str;
}
// 파일을 업로드 함
function upload_file($srcfile, $destfile, $dir)
{
if ($destfile == "") return false;
// 업로드 한후 , 퍼미션을 변경함
@move_uploaded_file($srcfile, "$dir/$destfile");
@chmod("$dir/$destfile", 0606);
return true;
}
// 유일키를 생성
function get_unique_id($len=32)
{
global $g4;
$result = @mysql_query(" LOCK TABLES $g4[yc4_on_uid_table] WRITE, $g4[yc4_cart_table] READ, $g4[yc4_order_table] READ ");
if (!$result) {
$sql = " CREATE TABLE `$g4[yc4_on_uid_table]` (
`on_id` int(11) NOT NULL auto_increment,
`on_uid` varchar(32) NOT NULL default '',
`on_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`session_id` varchar(32) NOT NULL default '',
PRIMARY KEY (`on_id`),
UNIQUE KEY `on_uid` (`on_uid`) ) ";
sql_query($sql, false);
}
// 이틀전 자료는 모두 삭제함
$ytime = date("Y-m-d", $g4['server_time'] - 86400 * 1);
$sql = " delete from $g4[yc4_on_uid_table] where on_datetime < '$ytime' ";
sql_query($sql);
$unique = false;
do {
sql_query(" INSERT INTO $g4[yc4_on_uid_table] set on_uid = NOW(), on_datetime = NOW(), session_id = '".session_id()."' ", false);
$id = @mysql_insert_id();
$uid = md5($id);
sql_query(" UPDATE $g4[yc4_on_uid_table] set on_uid = '$uid' where on_id = '$id' ");
// 장바구니에도 겹치는게 있을 수 있으므로 ...
$sql = "select COUNT(*) as cnt from $g4[yc4_cart_table] where on_uid = '$uid' ";
$row = sql_fetch($sql);
if (!$row[cnt]) {
// 주문서에도 겹치는게 있을 수 있으므로 ...
$sql = "select COUNT(*) as cnt from $g4[yc4_order_table] where on_uid = '$uid' ";
$row = sql_fetch($sql);
if (!$row[cnt])
$unique = true;
}
} while (!$unique); // $unique 가 거짓인동안 실행
@mysql_query(" UNLOCK TABLES ");
return $uid;
}
// 주문서 번호를 얻는다.
function get_new_od_id()
{
global $g4;
// 주문서 테이블 Lock 걸고
sql_query(" LOCK TABLES $g4[yc4_order_table] READ, $g4[yc4_order_table] WRITE ", FALSE);
// 주문서 번호를 만든다.
$date = date("ymd", time()); // 2002년 3월 7일 일경우 020307
$sql = " select max(od_id) as max_od_id from $g4[yc4_order_table] where SUBSTRING(od_id, 1, 6) = '$date' ";
$row = sql_fetch($sql);
$od_id = $row[max_od_id];
if ($od_id == 0)
$od_id = 1;
else
{
$od_id = (int)substr($od_id, -4);
$od_id++;
}
$od_id = $date . substr("0000" . $od_id, -4);
// 주문서 테이블 Lock 풀고
sql_query(" UNLOCK TABLES ", FALSE);
return $od_id;
}
function message($subject, $content, $align="left", $width="450")
{
$str = "
<table width=$width cellpadding=4 align=center>
<tr><td class=line height=1></td></tr>
<tr>
<td align=center>$subject</td>
</tr>
<tr><td class=line height=1></td></tr>
<tr>
<td>
<table width=100% cellpadding=8 cellspacing=0>
<tr>
<td class=leading align=$align>$content</td>
</tr>
</table>
</td>
</tr>
<tr><td class=line height=1></td></tr>
</table>
<br>
";
return $str;
}
// 시간이 비어 있는지 검사
function is_null_time($datetime)
{
// 공란 0 : - 제거
//$datetime = ereg_replace("[ 0:-]", "", $datetime); // 이 함수는 PHP 5.3.0 에서 배제되고 PHP 6.0 부터 사라집니다.
$datetime = preg_replace("/[ 0:-]/", "", $datetime);
if ($datetime == "")
return true;
else
return false;
}
// 출력유형, 스킨파일, 1라인이미지수, 총라인수, 이미지폭, 이미지높이
// 1.02.01 $ca_id 추가
function display_type($type, $skin_file, $list_mod, $list_row, $img_width, $img_height, $ca_id="")
{
global $member, $g4;
// 상품의 갯수
$items = $list_mod * $list_row;
// 1.02.00
// it_order 추가
$sql = " select *
from $g4[yc4_item_table]
where it_use = '1'
and it_type{$type} = '1' ";
if ($ca_id) $sql .= " and ca_id like '$ca_id%' ";
$sql .= " order by it_order, it_id desc
limit $items ";
$result = sql_query($sql);
if (!mysql_num_rows($result)) {
return false;
}
$file = "$g4[shop_path]/$skin_file";
if (!file_exists($file)) {
echo "<span class=point>{$file} 파일을 찾을 수 없습니다.</span>";
} else {
$td_width = (int)(100 / $list_mod);
include $file;
}
}
// 분류별 출력
// 스킨파일번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이 , 분류번호
function display_category($no, $list_mod, $list_row, $img_width, $img_height, $ca_id="")
{
global $member, $g4;
// 상품의 갯수
$items = $list_mod * $list_row;
$sql = " select * from $g4[yc4_item_table] where it_use = '1'";
if ($ca_id)
$sql .= " and ca_id LIKE '{$ca_id}%' ";
$sql .= " order by it_order, it_id desc limit $items ";
$result = sql_query($sql);
if (!mysql_num_rows($result)) {
return false;
}
$file = "$g4[shop_path]/maintype{$no}.inc.php";
if (!file_exists($file)) {
echo "<span class=point>{$file} 파일을 찾을 수 없습니다.</span>";
} else {
$td_width = (int)(100 / $list_mod);
include $file;
}
}
// 별
function get_star($score)
{
if ($score > 8) $star = "5";
else if ($score > 6) $star = "4";
else if ($score > 4) $star = "3";
else if ($score > 2) $star = "2";
else if ($score > 0) $star = "1";
else $star = "5";
return $star;
}
// 별 이미지
function get_star_image($it_id)
{
global $g4;
$sql = "select (SUM(is_score) / COUNT(*)) as score from $g4[yc4_item_ps_table] where it_id = '$it_id' ";
$row = sql_fetch($sql);
return (int)get_star($row[score]);
}
// 메일 보내는 내용을 HTML 형식으로 만든다.
function email_content($str)
{
global $g4;
$s = "";
$s .= "<html><head><meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'><title>메일</title>\n";
$s .= "<body>\n";
$s .= $str;
$s .= "</body>\n";
$s .= "</html>";
return $s;
}
// 타임스탬프 형식으로 넘어와야 한다.
// 시작시간, 종료시간
function gap_time($begin_time, $end_time)
{
$gap = $end_time - $begin_time;
$time[days] = (int)($gap / 86400);
$time[hours] = (int)(($gap - ($time[days] * 86400)) / 3600);
$time[minutes] = (int)(($gap - ($time[days] * 86400 + $time[hours] * 3600)) / 60);
$time[seconds] = (int)($gap - ($time[days] * 86400 + $time[hours] * 3600 + $time[minutes] * 60));
return $time;
}
// 공란없이 이어지는 문자 자르기 (wayboard 참고 (way.co.kr))
function continue_cut_str($str, $len=80)
{
/*
$pattern = "[^ \n<>]{".$len."}";
return eregi_replace($pattern, "\\0\n", $str);
*/
$pattern = "/[^ \n<>]{".$len."}/";
return preg_replace($pattern, "\\0\n", $str);
}
// 제목별로 컬럼 정렬하는 QUERY STRING
// $type 이 1이면 반대
function title_sort($col, $type=0)
{
global $sort1, $sort2;
global $_SERVER;
global $page;
global $doc;
$q1 = "sort1=$col";
if ($type) {
$q2 = "sort2=desc";
if ($sort1 == $col) {
if ($sort2 == "desc") {
$q2 = "sort2=asc";
}
}
} else {
$q2 = "sort2=asc";
if ($sort1 == $col) {
if ($sort2 == "asc") {
$q2 = "sort2=desc";
}
}
}
#return "$_SERVER[PHP_SELF]?$q1&$q2&page=$page";
return "$_SERVER[PHP_SELF]?$q1&$q2&page=$page";
}
// 세션값을 체크하여 이쪽에서 온것이 아니면 메인으로
function session_check()
{
global $g4;
if (!trim(get_session('ss_on_uid')))
gotourl("$g4[path]/");
}
// 상품 옵션
function get_item_options($subject, $option, $index)
{
$subject = trim($subject);
$option = trim($option);
if (!$subject || !$option) return "";
$str = "";
$arr = explode("\n", $option);
// 옵션이 하나일 경우
if (count($arr) == 1)
{
$str = $option;
}
else
{
$str = "<select name=it_opt{$index} onchange='amount_change()'>\n";
for ($k=0; $k<count($arr); $k++)
{
$arr[$k] = str_replace("\r", "", $arr[$k]);
$opt = explode(";", trim($arr[$k]));
$str .= "<option value='$arr[$k]'>{$opt[0]}";
// 옵션에 금액이 있다면
if ($opt[1] != 0)
{
$str .= " (";
// - 금액이 아니라면 모두 + 금액으로
//if (!ereg("[-]", $opt[1]))
if (!preg_match("/[-]/", $opt[1]))
$str .= "+";
$str .= display_amount($opt[1]) . ")";
}
$str .= "</option>\n";
}
$str .= "</select>\n<input type=hidden name=it_opt{$index}_subject value='$subject'>\n";
}
return $str;
}
// 인수는 $it_id, $it_opt1, ..., $it_opt6 까지 넘어옴
function print_item_options()
{
global $g4;
$it_id = func_get_arg(0);
$sql = " select it_opt1_subject,
it_opt2_subject,
it_opt3_subject,
it_opt4_subject,
it_opt5_subject,
it_opt6_subject
from $g4[yc4_item_table]
where it_id = '$it_id' ";
$it = sql_fetch($sql);
$it_name = $str_split = "";
for ($i=1; $i<=6; $i++)
{
$it_opt = trim(func_get_arg($i));
// 상품옵션에서 0은 제외되는 현상을 수정
if ($it_opt==null) continue;
$it_name .= $str_split;
$it_opt_subject = $it["it_opt{$i}_subject"];
$opt = explode( ";", $it_opt );
$it_name .= "&nbsp; $it_opt_subject = $opt[0]";
if ($opt[1] != 0)
{
$it_name .= " (";
//if (ereg("[+]", $opt[1]) == true)
if (preg_match("/[+]/", $opt[1]) == true)
$it_name .= "+";
$it_name .= display_amount($opt[1]) . ")";
}
$str_split = "<br>";
}
return $it_name;
}
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
// 일자형식변환
function date_conv($date, $case=1)
{
if ($case == 1) { // 년-월-일 로 만들어줌
$date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $date);
} else if ($case == 2) { // 년월일 로 만들어줌
$date = preg_replace("/-/", "", $date);
}
return $date;
}
// 배너출력
function display_banner($position, $num="")
{
global $g4;
if (!$position) $position = "왼쪽";
include "$g4[shop_path]/boxbanner{$num}.inc.php";
}
// 1.00.02
// 파일번호, 이벤트번호, 1라인이미지수, 총라인수, 이미지폭, 이미지높이
// 1.02.01 $ca_id 추가
function display_event($no, $event, $list_mod, $list_row, $img_width, $img_height, $ca_id="")
{
global $member, $g4;
// 상품의 갯수
$items = $list_mod * $list_row;
// 1.02.00
// b.it_order 추가
$sql = " select b.*
from $g4[yc4_event_item_table] a,
$g4[yc4_item_table] b
where a.it_id = b.it_id
and b.it_use = '1'
and a.ev_id = '$event' ";
if ($ca_id) $sql .= " and ca_id = '$ca_id' ";
$sql .= " order by b.it_order, a.it_id desc
limit $items ";
$result = sql_query($sql);
if (!mysql_num_rows($result)) {
return false;
}
$file = "$g4[shop_path]/maintype{$no}.inc.php";
if (!file_exists($file)) {
echo "<span class=point>{$file} 파일을 찾을 수 없습니다.</span>";
} else {
$td_width = (int)(100 / $list_mod);
include $file;
}
}
function get_yn($val, $case='')
{
switch ($case) {
case '1' : $result = ($val > 0) ? 'Y' : 'N'; break;
default : $result = ($val > 0) ? '예' : '아니오';
}
return $result;
}
// 상품명과 건수를 반환
function get_goods($on_uid)
{
global $g4;
// 상품명만들기
$row = sql_fetch(" select a.it_id, b.it_name from $g4[yc4_cart_table] a, $g4[yc4_item_table] b where a.it_id = b.it_id and a.on_uid = '$on_uid' order by ct_id limit 1 ");
// 상품명에 "(쌍따옴표)가 들어가면 오류 발생함
$goods[it_id] = $row[it_id];
$goods[full_name]= $goods[name] = addslashes($row[it_name]);
// 특수문자제거
$goods[full_name] = preg_replace ("/[ #\&\+\-%@=\/\\\:;,\.'\"\^`~\_|\!\?\*$#<>()\[\]\{\}]/i", "", $goods[full_name]);
// 상품건수
$row = sql_fetch(" select count(*) as cnt from $g4[yc4_cart_table] where on_uid = '$on_uid' ");
$cnt = $row[cnt] - 1;
if ($cnt)
$goods[full_name] .= "{$cnt}";
$goods[count] = $row[cnt];
return $goods;
}
// 패턴의 내용대로 해당 디렉토리에서 정렬하여 <select> 태그에 적용할 수 있게 반환
function get_list_skin_options($pattern, $dirname="./")
{
$str = "";
unset($arr);
$handle = opendir($dirname);
while ($file = readdir($handle)) {
if (preg_match("/$pattern/", $file, $matches)) {
$arr[] = $matches[0];
}
}
closedir($handle);
sort($arr);
foreach($arr as $key=>$value) {
$str .= "<option value='$arr[$key]'>$arr[$key]</option>\n";
}
return $str;
}
// 일자 시간을 검사한다.
function check_datetime($datetime)
{
if ($datetime == "0000-00-00 00:00:00")
return true;
$year = substr($datetime, 0, 4);
$month = substr($datetime, 5, 2);
$day = substr($datetime, 8, 2);
$hour = substr($datetime, 11, 2);
$minute = substr($datetime, 14, 2);
$second = substr($datetime, 17, 2);
$timestamp = mktime($hour, $minute, $second, $month, $day, $year);
$tmp_datetime = date("Y-m-d H:i:s", $timestamp);
if ($datetime == $tmp_datetime)
return true;
else
return false;
}
// 경고메세지를 경고창으로
function alert_opener($msg='', $url='')
{
global $g4;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<script type='text/javascript'>";
echo "alert('$msg');";
echo "opener.location.href='$url';";
echo "self.close();";
echo "</script>";
exit;
}
//==============================================================================
// 쇼핑몰 함수 모음 끝
//==============================================================================
?>

128
lib/thumb.lib.php Normal file
View File

@ -0,0 +1,128 @@
<?
if (!defined('_GNUBOARD_')) exit;
/*******************************************************************************
썸네일 Class
사용법 :
$thumb = new g4_thumbnail(경로, 썸네일이미지폭);
$thumb->run(이미지 경로가 포함된 컨텐츠);
*******************************************************************************/
class g4_thumb {
var $path;
var $width;
var $red = 0xff;
var $green = 0xff;
var $blue = 0xff;
var $quality = 100;
var $permission = 0606;
function g4_thumb($path, $width) {
$this->set_path($path);
$this->set_width($width);
}
// 경로
function set_path($path) {
$this->path = $path;
@mkdir($path, 0707);
@chmod($path, 0707);
}
function set_width($width) {
$this->width = $width;
}
function get_width() {
return $this->width;
}
function set_bgcolor($red, $green, $blue) {
$this->red = $red;
$this->green = $green;
$this->blue = $blue;
}
function set_quality($quality) {
$this->quality = $quality;
}
function set_permission($permission) {
$this->permission = $permission;
}
function create($srcimg, $thumbfile) {
$width = $this->get_width();
$source = null;
$size = @getimagesize($srcimg);
if ($size[2] == 1)
$source = @imagecreatefromgif($srcimg);
else if ($size[2] == 2)
$source = @imagecreatefromjpeg($srcimg);
else if ($size[2] == 3)
$source = @imagecreatefrompng($srcimg);
if ($source == null)
return '';
// 이미지의 폭이 설정폭 보다 작다면
if ($size[0] < $width) {
$width = $size[0];
$height = $size[1];
} else {
$rate = $width / $size[0];
$height = (int)($size[1] * $rate);
}
$target = @imagecreatetruecolor($width, $height);
$bgcolor = @imagecolorallocate($target, $this->red, $this->green, $this->blue); // 썸네일 배경
imagefilledrectangle($target, 0, 0, $width, $height, $bgcolor);
imagecopyresampled($source, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagecopy($target, $source, 0, 0, 0, 0, $size[0], $size[1]);
imagejpeg($target, $thumbfile, $this->quality);
chmod($thumbfile, $this->permission); // 추후 삭제를 위하여 파일모드 변경
return $thumbfile;
}
function thumbnail($matches)
{
foreach ($matches as $img) {
preg_match("/src=[\"\']?([^\"\'\s>]+)/i", $img, $m);
$src = trim($m[1]);
$result = true;
if (preg_match("/\.(jpe?g|png|gif)$/i", $src)) {
// 유일한 파일명을 만든다.
$filename = md5($src).'_'.$this->width;
$thumb = $this->path.'/'.$filename;
if (!file_exists($thumb)) {
$result = $this->create($src, $thumb);
}
}
else {
$thumb = $src;
}
if ($result) {
$size = @getimagesize($src);
if ($size[0] < $this->width) {
return "<img src='$thumb' width='$size[0]' />";
} else {
return "<a href='$src' target='_blank' title='클릭하시면 이미지가 크게 보입니다.'><img src='$thumb' width='{$this->width}' border='0' /></a>";
}
}
}
}
function run($content)
{
//return preg_replace_callback('#<img[^>]+>#iS', create_function('$matches', 'return g4_thumb::thumbnail($matches);'), $content);
//return preg_replace_callback('#<img[^>]+>#iS', array('g4_thumb', 'thumbnail'), $content);
//return preg_replace_callback('#<img[^>]+>#iS', 'g4_thumb::thumbnail', $content);
return preg_replace_callback('#<img[^>]+>#iS', array($this, 'thumbnail'), $content);
}
}
?>

77
lib/trackback.lib.php Normal file
View File

@ -0,0 +1,77 @@
<?
if (!defined('_GNUBOARD_')) exit;
/////////////////////////////////////////
// //
// mics'php - Trackback Sender //
// //
// COPYLEFT (c) by micsland.com //
// //
// MODIFIED (c) by sir.co.kr //
// //
/////////////////////////////////////////
// return 값이 있으면 오류, 없으면 정상
function send_trackback($tb_url, $url, $title, $blog_name, $excerpt)
{
/*
// allow_url_fopen = Off 일 경우 트랙백 사용할 수 없었던 오류를 수정
// allow_url_fopen = On 일 경우에만 사용 가능
//주소가 유효한지 검사
$p_fp = fopen($tb_url,"r");
if($p_fp)
@fclose($p_fp);
else
return "트랙백 URL이 존재하지 않습니다.";
*/
//내용 정리
$title = strip_tags($title);
$excerpt = strip_tags($excerpt);
$tmp_data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt);
//주소 처리
$uinfo = parse_url($tb_url);
if($uinfo[query]) $tmp_data .= "&".$uinfo[query];
if(!$uinfo[port]) $uinfo[port] = "80";
//최종 전송 자료
$send_str = "POST ".$uinfo[path]." HTTP/1.1\r\n".
"Host: ".$uinfo[host]."\r\n".
"User-Agent: GNUBOARD\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-length: ".strlen($tmp_data)."\r\n".
"Connection: close\r\n\r\n".
$tmp_data;
$fp = @fsockopen($uinfo[host],$uinfo[port]);
if(!$fp)
return "트랙백 URL이 존재하지 않습니다.";
//전송
//$fp = fsockopen($uinfo[host],$uinfo[port]);
fputs($fp,$send_str);
//응답 받음
while(!feof($fp)) $response .= fgets($fp,128);
fclose($fp);
//트랙백 URL인지 확인
if(!strstr($response,"<response>"))
return "올바른 트랙백 URL이 아닙니다.";
//XML 부분만 뽑음
$response = strchr($response,"<?");
$response = substr($response,0,strpos($response,"</response>"));
//에러 검사
if(strstr($response,"<error>0</error>"))
return "";
else {
$tb_error_str = strchr($response,"<message>");
$tb_error_str = substr($tb_error_str,0,strpos($tb_error_str,"</message>"));
$tb_error_str = str_replace("<message>","",$tb_error_str);
return "트랙백 전송중 오류가 발생했습니다: $tb_error_str";
}
}
?>

84
lib/visit.lib.php Normal file
View File

@ -0,0 +1,84 @@
<?
if (!defined('_GNUBOARD_')) exit;
// 방문자수 출력
function visit($skin_dir="basic")
{
global $config, $g4;
// visit 배열변수에
// $visit[1] = 오늘
// $visit[2] = 어제
// $visit[3] = 최대
// $visit[4] = 전체
// 숫자가 들어감
preg_match("/오늘:(.*),어제:(.*),최대:(.*),전체:(.*)/", $config['cf_visit'], $visit);
settype($visit[0], "integer");
settype($visit[1], "integer");
settype($visit[2], "integer");
settype($visit[3], "integer");
ob_start();
$visit_skin_path = "$g4[path]/skin/visit/$skin_dir";
include_once ("$visit_skin_path/visit.skin.php");
$content = ob_get_contents();
ob_end_clean();
return $content;
}
// get_browser() 함수는 이미 있음
function get_brow($agent)
{
$agent = strtolower($agent);
//echo $agent; echo "<br/>";
if (preg_match("/msie 5.0[0-9]*/", $agent)) { $s = "MSIE 5.0"; }
else if(preg_match("/msie 5.5[0-9]*/", $agent)) { $s = "MSIE 5.5"; }
else if(preg_match("/msie 6.0[0-9]*/", $agent)) { $s = "MSIE 6.0"; }
else if(preg_match("/msie 7.0[0-9]*/", $agent)) { $s = "MSIE 7.0"; }
else if(preg_match("/msie 8.0[0-9]*/", $agent)) { $s = "MSIE 8.0"; }
else if(preg_match("/msie 4.[0-9]*/", $agent)) { $s = "MSIE 4.x"; }
else if(preg_match("/firefox/", $agent)) { $s = "FireFox"; }
else if(preg_match("/chrome/", $agent)) { $s = "Chrome"; }
else if(preg_match("/x11/", $agent)) { $s = "Netscape"; }
else if(preg_match("/opera/", $agent)) { $s = "Opera"; }
else if(preg_match("/gec/", $agent)) { $s = "Gecko"; }
else if(preg_match("/bot|slurp/", $agent)) { $s = "Robot"; }
else if(preg_match("/internet explorer/", $agent)) { $s = "IE"; }
else if(preg_match("/mozilla/", $agent)) { $s = "Mozilla"; }
else { $s = "기타"; }
return $s;
}
function get_os($agent)
{
$agent = strtolower($agent);
//echo $agent; echo "<br/>";
if (preg_match("/windows 98/", $agent)) { $s = "98"; }
else if(preg_match("/windows 95/", $agent)) { $s = "95"; }
else if(preg_match("/windows nt 4\.[0-9]*/", $agent)) { $s = "NT"; }
else if(preg_match("/windows nt 5\.0/", $agent)) { $s = "2000"; }
else if(preg_match("/windows nt 5\.1/", $agent)) { $s = "XP"; }
else if(preg_match("/windows nt 5\.2/", $agent)) { $s = "2003"; }
else if(preg_match("/windows nt 6\.0/", $agent)) { $s = "Vista"; }
else if(preg_match("/windows nt 6\.1/", $agent)) { $s = "Windows7"; }
else if(preg_match("/windows 9x/", $agent)) { $s = "ME"; }
else if(preg_match("/windows ce/", $agent)) { $s = "CE"; }
else if(preg_match("/mac/", $agent)) { $s = "MAC"; }
else if(preg_match("/linux/", $agent)) { $s = "Linux"; }
else if(preg_match("/sunos/", $agent)) { $s = "sunOS"; }
else if(preg_match("/irix/", $agent)) { $s = "IRIX"; }
else if(preg_match("/phone/", $agent)) { $s = "Phone"; }
else if(preg_match("/bot|slurp/", $agent)) { $s = "Robot"; }
else if(preg_match("/internet explorer/", $agent)) { $s = "IE"; }
else if(preg_match("/mozilla/", $agent)) { $s = "Mozilla"; }
else { $s = "기타"; }
return $s;
}
?>