first
This commit is contained in:
104
_core/function/db.mysql.func.php
Normal file
104
_core/function/db.mysql.func.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
function isConnectedToDB($db)
|
||||
{
|
||||
return mysqli_connect($db['host'],$db['user'],$db['pass'],$db['name']);
|
||||
}
|
||||
function db_query($sql,$con)
|
||||
{
|
||||
mysqli_query($con,'set names utf8mb4');
|
||||
mysqli_query($con,'set sql_mode=\'\'');
|
||||
return mysqli_query($con,$sql);
|
||||
}
|
||||
function db_fetch_array($que)
|
||||
{
|
||||
return @mysqli_fetch_array($que);
|
||||
}
|
||||
function db_fetch_assoc($que)
|
||||
{
|
||||
return mysqli_fetch_assoc($que);
|
||||
}
|
||||
function db_num_rows($que)
|
||||
{
|
||||
return mysqli_num_rows($que);
|
||||
}
|
||||
function db_info()
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
return mysqli_get_server_info($DB_CONNECT);
|
||||
}
|
||||
function db_error()
|
||||
{
|
||||
return mysqli_error();
|
||||
}
|
||||
function db_close($conn)
|
||||
{
|
||||
return mysqli_close($conn);
|
||||
}
|
||||
function db_insert_id($conn)
|
||||
{
|
||||
return mysqli_insert_id($conn);
|
||||
}
|
||||
//DB-UID데이터
|
||||
function getUidData($table,$uid)
|
||||
{
|
||||
return getDbData($table,'uid='.(int)$uid,'*');
|
||||
}
|
||||
//DB데이터 1ROW
|
||||
function getDbData($table,$where,$data)
|
||||
{
|
||||
$row = db_fetch_array(getDbSelect($table,getSqlFilter($where),$data));
|
||||
return $row;
|
||||
}
|
||||
//DB데이터 ARRAY
|
||||
function getDbArray($table,$where,$data,$sort,$orderby,$recnum,$p)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
$rcd = db_query('select '.$data.' from '.$table.($where?' where '.getSqlFilter($where):'').' order by '.$sort.' '.$orderby.($recnum?' limit '.(($p-1)*$recnum).', '.$recnum:''),$DB_CONNECT);
|
||||
return $rcd;
|
||||
}
|
||||
//DB데이터 NUM
|
||||
function getDbRows($table,$where)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
$rows = db_fetch_array(db_query('select count(*) from '.$table.($where?' where '.getSqlFilter($where):''),$DB_CONNECT));
|
||||
return $rows[0] ? $rows[0] : 0;
|
||||
}
|
||||
//DB데이터 MAX
|
||||
function getDbCnt($table,$type,$where)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
$cnts = db_fetch_array(db_query('select '.$type.' from '.$table.($where?' where '.getSqlFilter($where):''),$DB_CONNECT));
|
||||
return $cnts[0] ? $cnts[0] : 0;
|
||||
}
|
||||
//DB셀렉트
|
||||
function getDbSelect($table,$where,$data)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
$r = db_query('select '.$data.' from '.$table.($where?' where '.getSqlFilter($where):''),$DB_CONNECT);
|
||||
return $r;
|
||||
}
|
||||
//DB삽입
|
||||
function getDbInsert($table,$key,$val)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
db_query("insert into ".$table." (".$key.")values(".$val.")",$DB_CONNECT);
|
||||
}
|
||||
//DB업데이트
|
||||
function getDbUpdate($table,$set,$where)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
db_query("update ".$table." set ".$set.($where?' where '.getSqlFilter($where):''),$DB_CONNECT);
|
||||
}
|
||||
//DB삭제
|
||||
function getDbDelete($table,$where)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
db_query("delete from ".$table.($where?' where '.getSqlFilter($where):''),$DB_CONNECT);
|
||||
}
|
||||
|
||||
//SQL필터링
|
||||
function getSqlFilter($sql)
|
||||
{
|
||||
return preg_replace("( union| update| insert| delete| drop|\/\*|\*\/|\\\|\;)",'',$sql);
|
||||
}
|
||||
?>
|
||||
114
_core/function/dir.func.php
Normal file
114
_core/function/dir.func.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
//디렉토리복사
|
||||
function DirCopy($dir1 , $dir2)
|
||||
{
|
||||
$dirh = opendir($dir1);
|
||||
while(false !== ($filename = readdir($dirh)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..')
|
||||
{
|
||||
if(!is_file($dir1.'/'.$filename))
|
||||
{
|
||||
@mkdir($dir2.'/'.$filename , 0707);
|
||||
@chmod($dir2.'/'.$filename , 0707);
|
||||
DirCopy($dir1.'/'.$filename , $dir2.'/'.$filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
@copy($dir1.'/'.$filename , $dir2.'/'.$filename);
|
||||
@chmod($dir2.'/'.$filename , 0707);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
}
|
||||
//디렉토리삭제
|
||||
function DirDelete($t_dir)
|
||||
{
|
||||
$dirh = opendir($t_dir);
|
||||
while(false !== ($filename = readdir($dirh)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..')
|
||||
{
|
||||
if(!is_file($t_dir.'/'.$filename))
|
||||
{
|
||||
DirDelete($t_dir.'/'.$filename);
|
||||
}
|
||||
else {
|
||||
@unlink($t_dir.'/'.$filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
@rmdir($t_dir);
|
||||
}
|
||||
//디렉토리사이즈/파일갯수
|
||||
function DirSizeNum($t_dir)
|
||||
{
|
||||
$dirh = opendir($t_dir);
|
||||
while(false !== ($filename = readdir($dirh)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..')
|
||||
{
|
||||
if(!is_file($t_dir.'/'.$filename)) {
|
||||
$s = DirSizeNum($t_dir.'/'.$filename);
|
||||
$d['size'] += $s['size'];
|
||||
$d['num'] += $s['num'];
|
||||
}
|
||||
else {
|
||||
$d['size'] += filesize($t_dir.'/'.$filename);
|
||||
$d['num']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
return $d;
|
||||
}
|
||||
//퍼미션변경
|
||||
function DirChmod($t_dir,$mode)
|
||||
{
|
||||
$dirh = opendir($t_dir);
|
||||
while(false !== ($filename = readdir($dirh)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..')
|
||||
{
|
||||
if(!is_file($t_dir.'/'.$filename))
|
||||
{
|
||||
@chmod($t_dir.'/'.$filename,$mode);
|
||||
DirChmod($t_dir.'/'.$filename,$mode);
|
||||
}
|
||||
else {
|
||||
@chmod($t_dir.'/'.$filename,$mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
@chmod($t_dir,$mode);
|
||||
}
|
||||
//압축
|
||||
function DirZip($t_dir,$n_dir,$zipfile)
|
||||
{
|
||||
$dirh = opendir($t_dir);
|
||||
while(false !== ($filename = readdir($dirh)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..')
|
||||
{
|
||||
if(!is_file($t_dir.'/'.$filename))
|
||||
{
|
||||
$zipfile -> add_file('',$n_dir.'/'.$filename.'/');
|
||||
DirZip($t_dir.'/'.$filename,$n_dir.'/'.$filename,$zipfile);
|
||||
}
|
||||
else {
|
||||
$zipfile -> add_file($t_dir.'/'.$filename,$n_dir.'/'.$filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
}
|
||||
//디렉토리생성
|
||||
function DirMake($dir)
|
||||
{
|
||||
@mkdir($dir,0707);
|
||||
@chmod($dir,0707);
|
||||
}
|
||||
?>
|
||||
68
_core/function/email.func.php
Normal file
68
_core/function/email.func.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
//이메일전송
|
||||
include_once $g['path_core'].'opensrc/aws-sdk-php/v3/aws-autoloader.php';
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Aws\Exception\AwsException;
|
||||
|
||||
function getSendMail($to,$from,$subject,$content,$html) {
|
||||
global $g,$d;
|
||||
|
||||
if ($html == 'TEXT') $content = nl2br(htmlspecialchars($content));
|
||||
$to_exp = explode('|', $to);
|
||||
$from_exp = explode('|', $from);
|
||||
|
||||
if ($d['admin']['mailer']=='ses') {
|
||||
|
||||
define('SES_KEY', $d['admin']['ses_key']); //발급받은 키.
|
||||
define('SES_SEC', $d['admin']['ses_sec']); //발급받은 비밀번호.
|
||||
define('SES_REGION', $d['admin']['ses_region']); //SES 버킷의 리전.
|
||||
|
||||
$SesClient = new SesClient([
|
||||
'credentials' => [
|
||||
'key' => SES_KEY,
|
||||
'secret' => SES_SEC,
|
||||
],
|
||||
'region' => SES_REGION,
|
||||
'version' => 'latest'
|
||||
]);
|
||||
|
||||
$To = $to_exp[1] ? "\"".utf8_encode($to_exp[1])."\" <$to_exp[0]>" : $to_exp[0];
|
||||
$Frm = $from_exp[1] ? "\"".utf8_encode($from_exp[1])."\" <$from_exp[0]>" : $from_exp[0];
|
||||
|
||||
$char_set = 'UTF-8';
|
||||
|
||||
try {
|
||||
$result = $SesClient->sendEmail([
|
||||
'Destination' => [
|
||||
'ToAddresses' => [$To],
|
||||
],
|
||||
'ReplyToAddresses' => [$Frm],
|
||||
'Source' => $Frm,
|
||||
'Message' => [
|
||||
'Body' => [
|
||||
'Html' => [
|
||||
'Charset' => $char_set,
|
||||
'Data' => $content,
|
||||
],
|
||||
],
|
||||
'Subject' => [
|
||||
'Charset' => $char_set,
|
||||
'Data' => $subject,
|
||||
],
|
||||
],
|
||||
]);
|
||||
return true;
|
||||
} catch (AwsException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$To = $to_exp[1] ? "\"".getUTFtoKR($to_exp[1])."\" <$to_exp[0]>" : $to_exp[0];
|
||||
$Frm = $from_exp[1] ? "\"".getUTFtoKR($from_exp[1])."\" <$from_exp[0]>" : $from_exp[0];
|
||||
$Header = "From:$Frm\nReply-To:$frm\nX-Mailer:PHP/".phpversion();
|
||||
$Header.= "\nContent-Type:text/html;charset=EUC-KR\r\n";
|
||||
return @mail($To,getUTFtoKR($subject),getUTFtoKR($content),$Header);
|
||||
}
|
||||
}
|
||||
?>
|
||||
53
_core/function/fcm.func.php
Normal file
53
_core/function/fcm.func.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// FCM 알림전송
|
||||
function getSendFCM($token,$title,$message,$avatar,$referer,$tag) {
|
||||
global $g,$d,$r;
|
||||
$url = 'https://fcm.googleapis.com/fcm/send';
|
||||
|
||||
$g['notiIconForSite'] = $g['path_var'].'site/'.$r.'/homescreen.png';
|
||||
$g['url_notiIcon'] = $g['s'].'/_var/site/'.$r.'/homescreen-192x192.png';
|
||||
$site_icon = file_exists($g['notiIconForSite']) ? $g['url_notiIcon'] : $g['img_core'].'/touch/homescreen-192x192.png';
|
||||
$icon = $avatar?$avatar:$site_icon;
|
||||
|
||||
$headers = array(
|
||||
'Authorization:key ='.$d['admin']['fcm_key'],
|
||||
'Content-Type: application/json'
|
||||
);
|
||||
|
||||
$fields = array (
|
||||
'data' => array ("title" => $title),
|
||||
'notification' => array (
|
||||
"title" => $title,
|
||||
"body" => $message,
|
||||
"icon" => $icon,
|
||||
"click_action" => $referer,
|
||||
"tag" => $tag
|
||||
)
|
||||
);
|
||||
|
||||
if(is_array($token)) {
|
||||
$fields['registration_ids'] = $token;
|
||||
} else {
|
||||
$fields['to'] = $token;
|
||||
}
|
||||
|
||||
$fields['priority'] = "high";
|
||||
|
||||
$fields = json_encode ($fields);
|
||||
|
||||
$ch = curl_init ();
|
||||
curl_setopt ($ch, CURLOPT_URL, $url );
|
||||
curl_setopt ($ch, CURLOPT_POST, true );
|
||||
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers );
|
||||
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true );
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $fields );
|
||||
|
||||
$result = curl_exec ($ch);
|
||||
if ($result === FALSE) {
|
||||
die('FCM Send Error: ' . curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
106
_core/function/lib/getContent.lib.php
Normal file
106
_core/function/lib/getContent.lib.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
// php-htmlpurfier-html5 : https://github.com/kennberg/php-htmlpurfier-html5
|
||||
function load_htmlpurifier($allowed) {
|
||||
global $g;
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
|
||||
$config->set('CSS.AllowTricky', true);
|
||||
$config->set('Cache.SerializerPath', $g['path_tmp'].'cache/HTMLPurifier');
|
||||
// Allow iframes from:
|
||||
// o YouTube.com
|
||||
// o Vimeo.com
|
||||
$config->set('HTML.SafeIframe', true);
|
||||
$config->set('URI.SafeIframeRegexp', '%^(http:|https:)?//(www.youtube(?:-nocookie)?.com/embed/|player.vimeo.com/video/)%');
|
||||
$config->set('HTML.Allowed', implode(',', $allowed));
|
||||
// Set some HTML5 properties
|
||||
$config->set('HTML.DefinitionID', 'html5-definitions'); // unqiue id
|
||||
$config->set('HTML.DefinitionRev', 1);
|
||||
if ($def = $config->maybeGetRawHTMLDefinition()) {
|
||||
// http://developers.whatwg.org/sections.html
|
||||
$def->addElement('section', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('nav', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('article', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('aside', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('header', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('footer', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('blockquote', 'Block', 'Flow', 'Common');
|
||||
|
||||
// Content model actually excludes several tags, not modelled here
|
||||
$def->addElement('address', 'Block', 'Flow', 'Common');
|
||||
$def->addElement('hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common');
|
||||
// http://developers.whatwg.org/grouping-content.html
|
||||
$def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common');
|
||||
$def->addElement('figcaption', 'Inline', 'Flow', 'Common');
|
||||
|
||||
// http://developers.whatwg.org/the-video-element.html#the-video-element
|
||||
$def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array(
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
'width' => 'Length',
|
||||
'height' => 'Length',
|
||||
'poster' => 'URI',
|
||||
'preload' => 'Enum#auto,metadata,none',
|
||||
'controls' => 'Bool',
|
||||
));
|
||||
$def->addElement('oembed', 'Block', 'Flow', 'Common', array(
|
||||
'url' => 'URI'
|
||||
));
|
||||
$def->addElement('source', 'Block', 'Flow', 'Common', array(
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
));
|
||||
// http://developers.whatwg.org/text-level-semantics.html
|
||||
$def->addElement('s', 'Inline', 'Inline', 'Common');
|
||||
$def->addElement('var', 'Inline', 'Inline', 'Common');
|
||||
$def->addElement('sub', 'Inline', 'Inline', 'Common');
|
||||
$def->addElement('sup', 'Inline', 'Inline', 'Common');
|
||||
$def->addElement('mark', 'Inline', 'Inline', 'Common');
|
||||
$def->addElement('wbr', 'Inline', 'Empty', 'Core');
|
||||
// http://developers.whatwg.org/edits.html
|
||||
$def->addElement('ins', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'CDATA'));
|
||||
$def->addElement('del', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'CDATA'));
|
||||
// TinyMCE
|
||||
$def->addAttribute('img', 'data-mce-src', 'Text');
|
||||
$def->addAttribute('img', 'data-mce-json', 'Text');
|
||||
// Others
|
||||
$def->addAttribute('iframe', 'allowfullscreen', 'Bool');
|
||||
$def->addAttribute('table', 'height', 'Text');
|
||||
$def->addAttribute('td', 'border', 'Text');
|
||||
$def->addAttribute('th', 'border', 'Text');
|
||||
$def->addAttribute('tr', 'width', 'Text');
|
||||
$def->addAttribute('tr', 'height', 'Text');
|
||||
$def->addAttribute('tr', 'border', 'Text');
|
||||
}
|
||||
return new HTMLPurifier($config);
|
||||
}
|
||||
|
||||
function LIB_getContents($str,$html) {
|
||||
global $d,$g;
|
||||
if ($html == 'HTML') {
|
||||
|
||||
$_atkParam = $pattern = explode(',',$d['admin']['secu_param']);
|
||||
foreach($_atkParam as $_prm) $str = str_replace($_prm,'',$str);
|
||||
|
||||
// HTMLPurifier
|
||||
require_once $g['path_core'].'opensrc/HTMLPurifier/4.10.0/HTMLPurifier.safe-includes.php';
|
||||
$allowed = explode(',',$d['admin']['secu_tags']);
|
||||
$purifier = load_htmlpurifier($allowed);
|
||||
$str = $purifier->purify($str);
|
||||
|
||||
}
|
||||
else {
|
||||
$str = str_replace('<','<',$str);
|
||||
$str = str_replace('>','>',$str);
|
||||
$str = str_replace(' ','&nbsp;',$str);
|
||||
$str = str_replace("\t",' ',$str);
|
||||
$str = nl2br($str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getIframes($str) {
|
||||
preg_match_all("/<iframe[^>]*?>/si", $str, $mat);
|
||||
return $mat[0];
|
||||
}
|
||||
?>
|
||||
51
_core/function/lib/getLink.lib.php
Normal file
51
_core/function/lib/getLink.lib.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $GLOBALS['lang']['admin']['flag']?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title></title>
|
||||
<script>
|
||||
var cHref = <?php if($target) echo $target?>location.href.split('#');
|
||||
<?php $url = str_replace('&','&',$url)?>
|
||||
<?php if($alert):?>alert('<?php echo $alert?>');<?php endif?>
|
||||
<?php if(!strpos($url,'__target')):?>
|
||||
<?php if($url=='reload'):?>
|
||||
<?php if($_POST):?>
|
||||
<?php if($target) echo $target?>location.replace(cHref[0]);
|
||||
<?php else:?>
|
||||
<?php if($target) echo $target?>location.reload();
|
||||
<?php endif?>
|
||||
<?php endif?>
|
||||
|
||||
<?php if($url&&$url!='reload'):?><?php if($target) echo $target?>location.href="<?php echo $url?>";<?php endif?>
|
||||
<?php endif?>
|
||||
<?php if($history=='close'):?>window.top.close();<?php endif?>
|
||||
<?php if($history<0):?>history.go(<?php echo $history?>);<?php endif?>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
if (strpos($url,'__target')) :
|
||||
$url_exp = explode('?',$url);
|
||||
$par_exp = explode('&',$url_exp[1]);
|
||||
?>
|
||||
<form name="backForm" action="<?php echo $g['s']?>" method="get" target="">
|
||||
<?php foreach($par_exp as $val):if(trim($val)=='')continue?>
|
||||
<?php $_prm = explode('=',$val)?>
|
||||
<?php if($_prm[0]=='__target'){$__target=$_prm[1];continue;}?>
|
||||
<input type="hidden" name="<?php echo $_prm[0]?>" value="<?php echo $_prm[1]?>" />
|
||||
<?php endforeach?>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
document.backForm.target = '<?php echo $__target?>';
|
||||
document.backForm.submit();
|
||||
//]]>
|
||||
</script>
|
||||
<?php endif?>
|
||||
|
||||
<h1><a href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/"><?php echo $_HS['title'] ?></a></h1>
|
||||
</body>
|
||||
</html>
|
||||
<?php exit?>
|
||||
27
_core/function/lib/getUploadImage.lib.php
Normal file
27
_core/function/lib/getUploadImage.lib.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
function LIB_getUploadImage($upfiles,$d,$content,$ext)
|
||||
{
|
||||
$imgs = getImgs($content,$ext);
|
||||
if ($imgs[0])
|
||||
{
|
||||
if (!$upfiles) return $imgs[0];
|
||||
$basename = basename($imgs[0]);
|
||||
$encname = md5($basename);
|
||||
$folder = substr($d,0,4).'/'.substr($d,4,2).'/'.substr($d,6,2);
|
||||
if (is_file($GLOBALS['g']['path_file'].$folder.'/'.$encname)) return str_replace($basename,'',$imgs[0]).$encname;
|
||||
}
|
||||
if ($upfiles)
|
||||
{
|
||||
$upArray = getArrayString($upfiles);
|
||||
foreach($upArray['data'] as $_val)
|
||||
{
|
||||
$U = getUidData($GLOBALS['table']['s_upload'],$_val);
|
||||
if (!$U['uid']) continue;
|
||||
if (strpos('_jpg,gif,png',$U['ext']))
|
||||
{
|
||||
return $U['url'].$U['folder'].'/'.$U['thumbname'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
22
_core/function/lib/getWindow.lib.php
Normal file
22
_core/function/lib/getWindow.lib.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $GLOBALS['lang']['admin']['flag']?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title></title>
|
||||
<script>
|
||||
<?php $url = str_replace('&','&',$url)?>
|
||||
<?php if($alert):?>alert('<?php echo $alert?>');<?php endif?>
|
||||
<?php if($url):?>window.open('<?php echo $url?>','','<?php echo $option?>');<?php endif?>
|
||||
<?php if($backurl=='reload'):?>
|
||||
<?php if($_POST):?>
|
||||
<?php if($target) echo $target?>location.replace(<?php if($target) echo $target?>location.href);
|
||||
<?php else:?>
|
||||
<?php if($target) echo $target?>location.reload();
|
||||
<?php endif?>
|
||||
<?php endif?>
|
||||
<?php if($backurl&&$backurl!='reload'):?><?php if($target) echo $target?>location.href="<?php echo $backurl?>";<?php endif?>
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
18
_core/function/lib/page.lib.php
Normal file
18
_core/function/lib/page.lib.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function LIB_getPageLink($lnum,$p,$tpage,$_N)
|
||||
{
|
||||
if (!$_N) $_N = $GLOBALS['g']['pagelink'].'&';
|
||||
$g_q = $p > 1 ? '<li class="page-item"><a class="page-link" href="'.$_N.'p=1" data-toggle="tooltip" title="첫 페이지"><i class="fa fa-angle-double-left"></i></a></li>' : '<li class="page-item disabled"><a class="page-link" href="#." data-toggle="tooltip" title="First page"><i class="fa fa-angle-double-left"></i></a></li>';
|
||||
if($p < $lnum+1) { $g_q .= '<li class="page-item disabled"><a class="page-link" href="#." data-toggle="tooltip" title="이전 페이지"><i class="fa fa-angle-left"></i></a></li>'; }
|
||||
else{ $pp = (int)(($p-1)/$lnum)*$lnum; $g_q .= '<li class="page-item"><a class="page-link" href="'.$_N.'page='.$pp.'" data-toggle="tooltip" title="Previous page"><i class="fa fa-angle-left"></i></a></li>';}
|
||||
$st1 = (int)(($p-1)/$lnum)*$lnum + 1;
|
||||
$st2 = $st1 + $lnum;
|
||||
for($jn = $st1; $jn < $st2; $jn++)
|
||||
if ( $jn <= $tpage)
|
||||
($jn == $p)? $g_q .= '<li class="page-item active"><span class="page-link">'.$jn.'</span></li>' : $g_q .= '<li class="page-item"><a class="page-link" href="'.$_N.'p='.$jn.'">'.$jn.'</a></li>';
|
||||
if($tpage < $lnum || $tpage < $jn) { $g_q .= '<li class="page-item disabled"><a class="page-link" href="#." data-toggle="tooltip" title="Next page"><i class="fa fa-angle-right"></i></a></li>'; }
|
||||
else{$np = $jn; $g_q .= '<li class="page-item"><a class="page-link" href="'.$_N.'p='.$np.'" data-toggle="tooltip" title="다음 페이지"><i class="fa fa-angle-right"></i></a></li>'; }
|
||||
$g_q .= $tpage > $p ? '<li class="page-item"><a class="page-link" href="'.$_N.'p='.$tpage.'" data-toggle="tooltip" title="마지막 페이지('.$tpage.')"><i class="fa fa-angle-double-right"></i></a></li>' : '<li class="page-item disabled"><a class="page-link" href="#." data-toggle="tooltip" title="Last page('.$tpage.')"><i class="fa fa-angle-double-right"></i></a></li>';
|
||||
return $g_q;
|
||||
}
|
||||
?>
|
||||
55
_core/function/lib/searchsql.lib.php
Normal file
55
_core/function/lib/searchsql.lib.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
//검색sql
|
||||
function LIB_getSearchSql($w,$k,$ik,$h)
|
||||
{
|
||||
if($k==',' || (!$k&&$h=='not')) return '';
|
||||
$k = $k ? urldecode($k) : '';
|
||||
$ik= $ik? urldecode($ik) : '';
|
||||
$h = $h ? $h : 'or';
|
||||
$k = str_replace(' ', ',',$k);
|
||||
$karr = explode(',' , $k);
|
||||
$knm = count($karr);
|
||||
|
||||
$result = ' and (';
|
||||
|
||||
if ($h == 'not')
|
||||
{
|
||||
$h = 'and';
|
||||
if (strstr($w,'|'))
|
||||
{
|
||||
$warr = explode('|' , $w);
|
||||
$wnm = count($warr);
|
||||
|
||||
for ($j = 0; $j < $knm; $j++)
|
||||
{
|
||||
if (!$karr[$j]) continue;
|
||||
|
||||
for ($i = 0; $i < $wnm; $i++) if (strlen($karr[$j])>2) $result .= $warr[$i]."<>'".$karr[$j]."' ".$h.' ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ($i = 0; $i < $knm; $i++) if (strlen($karr[$i])>2) $result .= $w."<>'".$karr[$i]."' ".$h.' ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strstr($w,'|'))
|
||||
{
|
||||
$warr = explode('|' , $w);
|
||||
$wnm = count($warr);
|
||||
|
||||
for ($j = 0; $j < $knm; $j++)
|
||||
{
|
||||
if (!$karr[$j]) continue;
|
||||
|
||||
for ($i = 0; $i < $wnm; $i++) if (strlen($karr[$j])>2) $result .= $warr[$i]." like '%".$karr[$j]."%' ".$h.' ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ($i = 0; $i < $knm; $i++) if (strlen($karr[$i])>2) $result .= $w." like '%".$karr[$i]."%' ".$h.' ';
|
||||
}
|
||||
}
|
||||
$result = substr($result,0,strlen($result)-4).')';
|
||||
if($ik) $result .= getSearchSql($w,$ik,'',$h);
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
74
_core/function/menu.func.php
Normal file
74
_core/function/menu.func.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
//메뉴출력
|
||||
function getMenuShow($site,$table,$j,$parent,$depth,$uid,$CXA,$hidden)
|
||||
{
|
||||
global $cat,$g;
|
||||
global $MenuOpen,$numhidden,$checkbox,$headfoot;
|
||||
static $j;
|
||||
|
||||
$CD=getDbSelect($table,($site?'site='.$site.' and ':'').'depth='.($depth+1).' and parent='.$parent.($hidden ? ' and hidden=0':'').' order by gid asc','*');
|
||||
while($C=db_fetch_array($CD))
|
||||
{
|
||||
$j++;
|
||||
if(@in_array($C['uid'],$CXA)) $MenuOpen .= 'trees[0].tmB('.$j.');';
|
||||
$numprintx = !$numhidden && $C['num'] ? '<span class="num">('.$C['num'].')</span>' : '';
|
||||
$C['name'] = $headfoot && ($C['imghead']||$C['imgfoot']||$C['codhead']||$C['codfoot']) ? '<b>'.$C['name'].'<b>' : $C['name'];
|
||||
$name = $C['uid'] != $cat ? addslashes($C['name']): '<span class="on">'.addslashes($C['name']).'</span>';
|
||||
$name = '<span class="ticon tdepth'.$C['depth'].'"></span><span class="name'.($C['hidden']||$C['reject']?' hidden':'').' ndepth'.$C['depth'].'">'.$name.'</span>';
|
||||
|
||||
if($checkbox) $icon1 = '<input type="checkbox" name="members[]" value="'.$C['uid'].'" />';
|
||||
$icon2 = $C['mobile'] ? ' <img src="'.$g['img_core'].'/_public/ico_mobile.gif" class="mobile" alt="" />' : '';
|
||||
$icon3 = $C['reject'] ? ' <img src="'.$g['img_core'].'/_public/ico_hidden.gif" alt="" />' : '';
|
||||
|
||||
if ($C['is_child'])
|
||||
{
|
||||
echo "['".$icon1.$name.$icon2.$numprintx."','".$C['uid']."',";
|
||||
getMenuShow($site,$table,$j,$C['uid'],$C['depth'],$uid,$CXA,$hidden);
|
||||
echo "],\n";
|
||||
}
|
||||
else {
|
||||
echo "['".$icon1.$name.$icon2.$icon3.$numprintx."','".$C['uid']."',''],\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//메뉴코드->경로
|
||||
function getMenuCodeToPath($table,$cat,$j)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
static $arr;
|
||||
|
||||
$R=getUidData($table,$cat);
|
||||
if($R['parent'])
|
||||
{
|
||||
$arr[$j]['uid'] = $R['uid'];
|
||||
$arr[$j]['id'] = $R['id'];
|
||||
$arr[$j]['name']= $R['name'];
|
||||
getMenuCodeToPath($table,$R['parent'],$j+1);
|
||||
}
|
||||
else {
|
||||
$C=getUidData($table,$cat);
|
||||
$arr[$j]['uid'] = $C['uid'];
|
||||
$arr[$j]['id'] = $C['id'];
|
||||
$arr[$j]['name']= $C['name'];
|
||||
}
|
||||
sort($arr);
|
||||
reset($arr);
|
||||
return $arr;
|
||||
}
|
||||
//메뉴코드->SQL
|
||||
function getMenuCodeToSql($table,$cat,$f)
|
||||
{
|
||||
static $sql;
|
||||
|
||||
$R=getUidData($table,$cat);
|
||||
if ($R['uid']) $sql .= $f.'='.$R['uid'].' or ';
|
||||
if ($R['is_child'])
|
||||
{
|
||||
$RDATA=getDbSelect($table,'parent='.$R['uid'],'uid');
|
||||
while($C=db_fetch_array($RDATA)) getMenuCodeToSql($table,$C['uid'],$f);
|
||||
}
|
||||
return substr($sql,0,strlen($sql)-4);
|
||||
}
|
||||
?>
|
||||
38
_core/function/menu1.func.php
Normal file
38
_core/function/menu1.func.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
//카테고리출력
|
||||
function getMenuShowSelect($site,$table,$j,$parent,$depth,$uid,$hidden,$id)
|
||||
{
|
||||
global $cat,$_isUid;
|
||||
static $j;
|
||||
|
||||
$CD=getDbSelect($table,($site?'site='.$site.' and ':'').'depth='.($depth+1).' and parent='.$parent.($hidden ? ' and hidden=0':'').' order by gid asc','*');
|
||||
while($C=db_fetch_array($CD))
|
||||
{
|
||||
$nId = ($id?$id.'/':'').$C[$_isUid.'id'];
|
||||
$j++;
|
||||
echo '<option class="selectcat'.$C['depth'].'" value="'.$nId.'"'.($nId==$cat?' selected':'').'>';
|
||||
for($i=1;$i<$C['depth'];$i++) echo ' ';
|
||||
if ($C['depth'] > 1) echo 'ㄴ';
|
||||
echo $C['name'].($C['num']?' ('.$C['num'].')':'').'</option>';
|
||||
if ($C['is_child']) getMenuShowSelect($site,$table,$j,$C['uid'],$C['depth'],$uid,$hidden,$nId);
|
||||
}
|
||||
}
|
||||
|
||||
function getMenuShowSelectCode($site,$table,$j,$parent,$depth,$uid,$hidden,$id)
|
||||
{
|
||||
global $cat,$_isUid;
|
||||
static $j;
|
||||
|
||||
$CD=getDbSelect($table,($site?'site='.$site.' and ':'').'depth='.($depth+1).' and parent='.$parent.($hidden ? ' and hidden=0':'').' order by gid asc','*');
|
||||
while($C=db_fetch_array($CD))
|
||||
{
|
||||
$nId = $C[$_isUid.'id'];
|
||||
$j++;
|
||||
echo '<option class="selectcat'.$C['depth'].'" value="'.$nId.'"'.($nId==$cat?' selected':'').'>';
|
||||
for($i=1;$i<$C['depth'];$i++) echo ' ';
|
||||
if ($C['depth'] > 1) echo 'ㄴ';
|
||||
echo $C['name'].($C['num']?' ('.$C['num'].')':'').'</option>';
|
||||
if ($C['is_child']) getMenuShowSelectCode($site,$table,$j,$C['uid'],$C['depth'],$uid,$hidden,$nId);
|
||||
}
|
||||
}
|
||||
?>
|
||||
82
_core/function/rss.func.php
Normal file
82
_core/function/rss.func.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
function getUrlData($url,$sec)
|
||||
{
|
||||
$URL_parsed = parse_url($url);
|
||||
$host = $URL_parsed['host'];
|
||||
$port = $URL_parsed['port'];
|
||||
$path = $URL_parsed['path'];
|
||||
$query= $URL_parsed['query'];
|
||||
$scheme= $URL_parsed['scheme'];
|
||||
|
||||
if (!$host) $host = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$out = "GET ".$path.'?'.$query." HTTP/1.1\r\n";
|
||||
$out .= "Host: ".$host."\r\n";
|
||||
$out .= "Connection: Close\r\n\r\n";
|
||||
|
||||
if ($scheme == 'https') {
|
||||
if (!$port) $port = 443;
|
||||
$fp = fsockopen('ssl://'.$host,$port,$errno,$errstr,$sec);
|
||||
} else {
|
||||
if (!$port) $port = 80;
|
||||
$fp = fsockopen($host,$port,$errno,$errstr,$sec);
|
||||
}
|
||||
|
||||
if (!$fp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs($fp, $out);
|
||||
$body = false;
|
||||
while (!feof($fp)) {
|
||||
$s = fgets($fp, 128);
|
||||
if ( $body )
|
||||
$in .= $s;
|
||||
if ( $s == "\r\n" )
|
||||
$body = true;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
return $in;
|
||||
}
|
||||
}
|
||||
function getRssArray($url,$tag)
|
||||
{
|
||||
return explode('<'.$tag.'>',getUrlData($url,10));
|
||||
}
|
||||
function getRssTagValue($str,$tag)
|
||||
{
|
||||
$str_exp = explode('<'.$tag.'>' , $str);
|
||||
$str_exp = explode('</'.$tag.'>' , $str_exp[1]);
|
||||
$result = getUTFtoUTF($str_exp[0]) == $str_exp[0] ? $str_exp[0] : getKRtoUTF($str_exp[0]);
|
||||
return trim($result);
|
||||
}
|
||||
function getRssPageTitle($str,$tag)
|
||||
{
|
||||
return getRssTagValue($str,$tag);
|
||||
}
|
||||
function getRssContent($str,$tag)
|
||||
{
|
||||
$str = str_replace('>','>',$str);
|
||||
$str = str_replace('<','<',$str);
|
||||
$str = str_replace('"','"',$str);
|
||||
$str = str_replace(''','\'',$str);
|
||||
$str = getRssTagValue($str,$tag);
|
||||
$str = str_replace(']]>','',$str);
|
||||
$str = str_replace('<![CDATA[','',$str);
|
||||
return $str;
|
||||
}
|
||||
function getRssDomain($url)
|
||||
{
|
||||
$e = explode('/',str_replace('www.','',str_replace('http://','',$url)));
|
||||
return $e[0];
|
||||
}
|
||||
function getJSONData($data,$f)
|
||||
{
|
||||
$arr1 = explode('"'.$f.'":"',str_replace(': "',':"',$data));
|
||||
$arr2 = explode('"',$arr1[1]);
|
||||
return $arr2[0];
|
||||
}
|
||||
?>
|
||||
41
_core/function/search.func.php
Normal file
41
_core/function/search.func.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
function getAgoGrade($SR,$keyword,$d1,$d2)
|
||||
{
|
||||
global $date,$table,$DB_CONNECT,$s;
|
||||
$d_regis1 = date('Ymd',mktime(0,0,0,substr($date['today'],4,2),substr($date['today'],6,2)-$d1,substr($date['today'],0,4)));
|
||||
$d_regis2 = date('Ymd',mktime(0,0,0,substr($date['today'],4,2),substr($date['today'],6,2)-$d2,substr($date['today'],0,4)));
|
||||
$WHEREIS = 'where (date between '.$d_regis1.' and '.$d_regis2.") and keyword='".$keyword."' and site=".$s;
|
||||
$SCOUNT = db_fetch_array(db_query('SELECT sum(hit) FROM '.$table['s_inkey'].' '.$WHEREIS,$DB_CONNECT));
|
||||
|
||||
if (!$SCOUNT[0]) return -1;
|
||||
$len = count($SR);
|
||||
for($i = 0; $i < $len; $i++)
|
||||
{
|
||||
if ($SCOUNT[0] > $SR[$i]) break;
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
function getGradeArr($d1,$d2)
|
||||
{
|
||||
global $date,$table,$DB_CONNECT,$s;
|
||||
$d_regis1 = date('Ymd',mktime(0,0,0,substr($date['today'],4,2),substr($date['today'],6,2)-$d1,substr($date['today'],0,4)));
|
||||
$d_regis2 = date('Ymd',mktime(0,0,0,substr($date['today'],4,2),substr($date['today'],6,2)-$d2,substr($date['today'],0,4)));
|
||||
$WHEREIS = 'where (date between '.$d_regis1.' and '.$d_regis2.') and site='.$s;
|
||||
$SCOUNT = db_query('SELECT sum(hit) as cnt FROM '.$table['s_inkey'].' '.$WHEREIS.' group by keyword order by cnt desc',$DB_CONNECT);
|
||||
while($R=db_fetch_array($SCOUNT)) $ARR[] = $R['cnt'];
|
||||
return $ARR;
|
||||
}
|
||||
function getSicon($n1,$n2)
|
||||
{
|
||||
if($n1 < 0) return 'new';
|
||||
if($n1 > $n2) return 'up';
|
||||
if($n1 < $n2) return 'down';
|
||||
if($n1 ==$n2) return 'same';
|
||||
}
|
||||
function getNumChange($n1,$n2)
|
||||
{
|
||||
if($n1 < 0 || $n1 == $n2) return '';
|
||||
if($n1 > $n2) return $n1 - $n2;
|
||||
if($n1 < $n2) return $n2 - $n1;
|
||||
}
|
||||
?>
|
||||
97
_core/function/sms.func.php
Normal file
97
_core/function/sms.func.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
//SMS 전송
|
||||
function getSendSMS($to,$from,$subject,$content,$type)
|
||||
{
|
||||
global $g,$d;
|
||||
|
||||
if ($html == 'TEXT') $content = nl2br(htmlspecialchars($content));
|
||||
|
||||
require $g['path_core'].'opensrc/snoopy/Snoopy.class.php';
|
||||
|
||||
$snoopy = new Snoopy;
|
||||
|
||||
/*======================================================================*\
|
||||
// MMS일 경우 첨부파일 처리
|
||||
// 서버&로컬 에 저장된 이미지 파일 읽어올때.
|
||||
// 웹경로 ,로컬경로 모두 가능 합니다.
|
||||
\*======================================================================*/
|
||||
$img_source = 'http://websvc.nesolution.com/sms/MMSAttachFiles/M050085/20180510145947.jpg';
|
||||
//$img_source = './img/test.jpg';
|
||||
|
||||
// $img = file_get_contents($img_source);
|
||||
// $Base64files = base64_encode($img);
|
||||
|
||||
//"," 콤마로 구분 최대 3개.가능합니다.
|
||||
$files = $Base64files .",".$Base64files .",".$Base64files ;
|
||||
|
||||
/*======================================================================*\
|
||||
// MMS일 경우 첨부파일 처리
|
||||
// 프론트에서 이미지 파일을 base64로 생성후 post로 받아 올때.
|
||||
// POST 방식
|
||||
\*======================================================================*/
|
||||
/*
|
||||
$files = $_POST["Base64files"];//MMS 발송시 첨부파일
|
||||
*/
|
||||
|
||||
/*======================================================================*\
|
||||
// utf-8 인코딩을 사용할 경우
|
||||
// POST 방식
|
||||
\*======================================================================*/
|
||||
|
||||
$cmd = "SendSms";
|
||||
$tran_phone = urlencode(iconv('UTF-8', 'EUC-KR', $to)); //받는사람 핸드폰 번호
|
||||
$tran_callback = urlencode(iconv('UTF-8', 'EUC-KR', $from)); //보내는사람 핸드폰 번호
|
||||
$tran_date = urlencode(iconv('UTF-8', 'EUC-KR', $date)); //예약전송 일시(생략시 즉시전송)
|
||||
$tran_msg = urlencode(iconv('UTF-8', 'EUC-KR',$content)); //전송 메시지
|
||||
$guest_no = urlencode(iconv('UTF-8', 'EUC-KR',$d['admin']['sms_id'])); //SMS 계정 아이디
|
||||
$guest_key = urlencode(iconv('UTF-8', 'EUC-KR',$d['admin']['sms_key'])); //SMS 계정 인증키
|
||||
$type = urlencode(iconv('UTF-8', 'EUC-KR',$type)); //발송구분
|
||||
$subject = urlencode(iconv('UTF-8', 'EUC-KR',$subject)); //LMS / MMS 발송시 제목
|
||||
$files = $_POST["Base64files"];//MMS 발송시 첨부파일
|
||||
|
||||
if($type != "MMS") {
|
||||
/*======================================================================*\
|
||||
// GET 으로 호출
|
||||
이미지 첨부시 에러 발생함니다. post 로 전송하세요.
|
||||
\*======================================================================*/
|
||||
$method = "GET";
|
||||
$url = "http://websvc.nesolution.com/SMS/SMS.aspx?cmd=$cmd&method=$method&";
|
||||
$url = $url . "guest_no=$guest_no&guest_key=$guest_key&tran_phone=$tran_phone&";
|
||||
$url = $url . "tran_callback=$tran_callback&tran_date=$tran_date&tran_msg=$tran_msg&";
|
||||
$url = $url . "type=$type&subject=$subject"; // LMS 또는 MMS 일경우 제목 필수
|
||||
|
||||
$snoopy->fetchtext($url);
|
||||
// 출력 페이지가 euc-kr 일때
|
||||
//$send_result = $snoopy->results;
|
||||
// 출력 페이지가 utf-8 일때
|
||||
$send_result = iconv('EUC-KR', 'UTF-8', $snoopy->results);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*======================================================================*\
|
||||
// $snoopy 사용 POST 발송(MMS 파일첨부시)
|
||||
\*======================================================================*/
|
||||
|
||||
$formvars["cmd"] =$cmd;
|
||||
$formvars["guest_no"] = $guest_no;
|
||||
$formvars["guest_key"] = $guest_key;
|
||||
$formvars["tran_phone"] = $tran_phone;
|
||||
$formvars["tran_callback"] = $tran_callback;
|
||||
$formvars["tran_date"] = $tran_date;
|
||||
$formvars["tran_msg"] = $tran_msg;
|
||||
$formvars["type"] = $type;
|
||||
$formvars["subject"] = $subject;
|
||||
$formvars["files"] = $files;
|
||||
|
||||
$snoopy->httpmethod = "POST";
|
||||
$snoopy->submit("http://websvc.nesolution.com/SMS/SMS.aspx",$formvars );
|
||||
|
||||
//출력 페이지가 euc-kr 일때
|
||||
//$send_result = $snoopy->results;
|
||||
// 출력 페이지가 utf-8 일때
|
||||
$send_result = iconv('EUC-KR', 'UTF-8', $snoopy->results);
|
||||
}
|
||||
|
||||
return $send_result;
|
||||
}
|
||||
?>
|
||||
38
_core/function/string.func.php
Normal file
38
_core/function/string.func.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
//문자열형태소추출
|
||||
function getSiKey($singer)
|
||||
{
|
||||
$singer_set1 = "ㄱ,ㄴ,ㄷ,ㄹ,ㅁ,ㅂ,ㅅ,ㅇ,ㅈ,ㅊ,ㅋ,ㅍ,ㅌ,ㅎ";
|
||||
$singer_set2 = "가,나,다,라,마,바,사,아,자,차,카,타,파,하";
|
||||
$singer_set3 = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
||||
$singer_arr1 = explode(',' , $singer_set1);
|
||||
$singer_arr2 = explode(',' , $singer_set2);
|
||||
$singer_arr3 = explode(',' , $singer_set3);
|
||||
|
||||
$singer_sub = substr(strtoupper($singer) , 0 , 2);
|
||||
$singer_ord = ord($singer_sub);
|
||||
|
||||
if ($singer_ord > 64 && $singer_ord < 91)
|
||||
{ // 영문
|
||||
|
||||
for($i = 0; $i < 26; $i++)
|
||||
{
|
||||
if($singer_sub >= $singer_arr3[$i])
|
||||
{
|
||||
$key = $singer_arr3[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$key = "기타";
|
||||
for($i = 0; $i < 14; $i++)
|
||||
{
|
||||
if ($singer_sub >= $singer_arr2[$i])
|
||||
{
|
||||
$key = $singer_arr1[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
?>
|
||||
36
_core/function/sys.class.php
Normal file
36
_core/function/sys.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
// 템플릿 파싱 및 데이타 치환
|
||||
class skin {
|
||||
var $filename;
|
||||
|
||||
public function __construct($filename) {
|
||||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
public function mk($filename) {
|
||||
$this->filename = $filename;
|
||||
return $this->make();
|
||||
}
|
||||
|
||||
public function make() {
|
||||
global $g,$m,$theme;
|
||||
$file = sprintf('./modules/'.$m.'/themes/'.$theme.'/_html/%s.html', $this->filename);
|
||||
$fh_skin = fopen($file, 'r');
|
||||
$skin = @fread($fh_skin, filesize($file));
|
||||
fclose($fh_skin);
|
||||
//return $skin;
|
||||
return $this->parse($skin);
|
||||
}
|
||||
|
||||
private function parse($skin) {
|
||||
global $TMPL, $LNG;
|
||||
|
||||
$skin = preg_replace_callback('/{\$lng->(.+?)}/i', create_function('$matches', 'global $LNG; return $LNG[$matches[1]];'), $skin);
|
||||
$skin = preg_replace_callback('/{\$([a-zA-Z0-9_]+)}/', create_function('$matches', 'global $TMPL; return (isset($TMPL[$matches[1]])?$TMPL[$matches[1]]:"");'), $skin);
|
||||
|
||||
return $skin;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1195
_core/function/sys.func.php
Normal file
1195
_core/function/sys.func.php
Normal file
File diff suppressed because it is too large
Load Diff
236
_core/function/thumb.func.php
Normal file
236
_core/function/thumb.func.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
@ini_set('memory_limit', '128M');
|
||||
|
||||
function ResizeWidth($picture,$smallfile,$rewidth)
|
||||
{
|
||||
$picsize=getimagesize($picture);
|
||||
|
||||
if ($picsize[0] <= $rewidth)
|
||||
{
|
||||
copy($picture,$smallfile);
|
||||
}
|
||||
else {
|
||||
|
||||
$reheight = intval(($rewidth * $picsize[1]) / $picsize[0]);
|
||||
if($picsize[0]>$rewidth)
|
||||
{
|
||||
$width=$picsize[0]-$rewidth;
|
||||
$aa=$width/$picsize[0];
|
||||
$picsize[0]=intval($picsize[0]-$picsize[0]*$aa);
|
||||
$picsize[1]=intval($picsize[1]-$picsize[1]*$aa);
|
||||
}
|
||||
if($picsize[1]>$reheight)
|
||||
{
|
||||
$height=$picsize[1]-$reheight;
|
||||
$bb=$heigh/$picsize[1];
|
||||
$picsize[0]=intval($picsize[0]-$picsize[0]*$bb);
|
||||
$picsize[1]=intval($picsize[1]-$picsize[1]*$bb);
|
||||
}
|
||||
if($picsize[2]==1)
|
||||
{
|
||||
//@header("Content-Type: imgage/gif");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=@ImageCreateFromGIF($picture);
|
||||
ImageCopyResized($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagegif($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==2)
|
||||
{
|
||||
//@header("Content-Type: images/jpeg");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=ImageCreateFromJPEG($picture);
|
||||
imagecopyresampled($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagejpeg($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==3)
|
||||
{
|
||||
//@header("Content-Type: images/png");
|
||||
$srcimg=ImageCreateFromPNG($picture);
|
||||
$dstimg = imagecreatetruecolor($rewidth, $reheight);
|
||||
imagealphablending($dstimg, false);
|
||||
imagesavealpha($dstimg,true);
|
||||
$transparent = imagecolorallocatealpha($dstimg, 255, 255, 255, 127);
|
||||
imagefilledrectangle($dstimg, 0, 0, $rewidth, $reheight, $transparent);
|
||||
imagecopyresampled($dstimg, $srcimg, 0, 0, 0, 0, $rewidth, $reheight, ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagepng($dstimg,$smallfile,0);
|
||||
|
||||
}
|
||||
@ImageDestroy($dstimg);
|
||||
@ImageDestroy($srcimg);
|
||||
}
|
||||
}
|
||||
|
||||
function ResizeHeight($picture,$smallfile,$reheight)
|
||||
{
|
||||
$picsize=getimagesize($picture);
|
||||
|
||||
if ($picsize[1] <= $reheight)
|
||||
{
|
||||
copy($picture,$smallfile);
|
||||
}
|
||||
else {
|
||||
|
||||
$rewidth = intval(($reheight * $picsize[0]) / $picsize[1]);
|
||||
if($picsize[0]>$rewidth)
|
||||
{
|
||||
$width=$picsize[0]-$rewidth;
|
||||
$aa=$width/$picsize[0];
|
||||
$picsize[0]=intval($picsize[0]-$picsize[0]*$aa);
|
||||
$picsize[1]=intval($picsize[1]-$picsize[1]*$aa);
|
||||
}
|
||||
if($picsize[1]>$reheight)
|
||||
{
|
||||
$height=$picsize[1]-$reheight;
|
||||
$bb=$heigh/$picsize[1];
|
||||
$picsize[0]=intval($picsize[0]-$picsize[0]*$bb);
|
||||
$picsize[1]=intval($picsize[1]-$picsize[1]*$bb);
|
||||
}
|
||||
if($picsize[2]==1)
|
||||
{
|
||||
//@header("Content-Type: imgage/gif");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=@ImageCreateFromGIF($picture);
|
||||
ImageCopyResized($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagegif($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==2)
|
||||
{
|
||||
//@header("Content-Type: images/jpeg");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=ImageCreateFromJPEG($picture);
|
||||
imagecopyresampled($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagejpeg($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==3)
|
||||
{
|
||||
//@header("Content-Type: images/png");
|
||||
$srcimg=ImageCreateFromPNG($picture);
|
||||
$dstimg=imagecreate($rewidth,$reheight);
|
||||
$black = imagecolorallocate($dstimg, 0x00, 0x00, 0x00);
|
||||
$white = imagecolorallocate($dstimg, 0xFF, 0xFF, 0xFF);
|
||||
$magenta = imagecolorallocate($dstimg, 0xFF, 0x00, 0xFF);
|
||||
imagecolortransparent($dstimg,$black);
|
||||
imagecopyresampled($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagepng($dstimg,$smallfile,0);
|
||||
}
|
||||
@ImageDestroy($dstimg);
|
||||
@ImageDestroy($srcimg);
|
||||
}
|
||||
}
|
||||
|
||||
function ResizeWidthHeight($picture,$smallfile,$rewidth,$reheight)
|
||||
{
|
||||
$picsize=getimagesize($picture);
|
||||
|
||||
if($picsize[2]==1)
|
||||
{
|
||||
//@header("Content-Type: imgage/gif");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=@ImageCreateFromGIF($picture);
|
||||
ImageCopyResized($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagegif($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==2)
|
||||
{
|
||||
//@header("Content-Type: images/jpeg");
|
||||
$dstimg=ImageCreatetruecolor($rewidth,$reheight);
|
||||
$srcimg=ImageCreateFromJPEG($picture);
|
||||
imagecopyresampled($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagejpeg($dstimg,$smallfile,100);
|
||||
}
|
||||
elseif($picsize[2]==3)
|
||||
{
|
||||
//@header("Content-Type: images/png");
|
||||
$srcimg=ImageCreateFromPNG($picture);
|
||||
$dstimg=imagecreate($rewidth,$reheight);
|
||||
$black = imagecolorallocate($dstimg, 0x00, 0x00, 0x00);
|
||||
$white = imagecolorallocate($dstimg, 0xFF, 0xFF, 0xFF);
|
||||
$magenta = imagecolorallocate($dstimg, 0xFF, 0x00, 0xFF);
|
||||
imagecolortransparent($dstimg,$black);
|
||||
imagecopyresampled($dstimg, $srcimg,0,0,0,0,$rewidth,$reheight,ImageSX($srcimg),ImageSY($srcimg));
|
||||
Imagepng($dstimg,$smallfile,0);
|
||||
}
|
||||
@ImageDestroy($dstimg);
|
||||
@ImageDestroy($srcimg);
|
||||
}
|
||||
|
||||
function overlay($backpic,$overpic,$x,$y,$w,$h)
|
||||
{
|
||||
$backsize=getimagesize($backpic);
|
||||
$oversize=getimagesize($overpic);
|
||||
|
||||
if ($backsize[2] == 1)
|
||||
{
|
||||
$dstimg=ImageCreateFromGIF($backpic);
|
||||
}
|
||||
elseif ($backsize[2] == 2)
|
||||
{
|
||||
$dstimg=ImageCreateFromJPEG($backpic);
|
||||
}
|
||||
elseif ($backsize[2] == 3)
|
||||
{
|
||||
$dstimg=ImageCreateFromPNG($backpic);
|
||||
}
|
||||
if ($oversize[2] == 1)
|
||||
{
|
||||
$srcimg=ImageCreateFromGIF($overpic);
|
||||
}
|
||||
elseif ($oversize[2] == 2)
|
||||
{
|
||||
$srcimg=ImageCreateFromJPEG($overpic);
|
||||
}
|
||||
elseif ($oversize[2] == 3)
|
||||
{
|
||||
$srcimg=ImageCreateFromPNG($overpic);
|
||||
}
|
||||
Imagecopymerge($dstimg, $srcimg, $x, $y, 0, 0, $w, $h, 100);
|
||||
if ($backsize[2] == 1)
|
||||
{
|
||||
Imagegif($dstimg,$backpic,100);
|
||||
}
|
||||
elseif ($backsize[2] == 2)
|
||||
{
|
||||
Imagejpeg($dstimg,$backpic,100);
|
||||
}
|
||||
elseif ($backsize[2] == 3)
|
||||
{
|
||||
Imagepng($dstimg,$backpic,0);
|
||||
}
|
||||
@ImageDestroy($dstimg);
|
||||
@ImageDestroy($srcimg);
|
||||
}
|
||||
|
||||
// 이미지 가로/세로 교정
|
||||
function exifRotate($picture)
|
||||
{
|
||||
$exifData = @exif_read_data($picture);
|
||||
if($exifData['Orientation'] == 6) {
|
||||
$degree = 270; // 시계방향으로 90도 돌려줘야 정상인데 270도 돌려야 정상적으로 출력됨
|
||||
}
|
||||
else if($exifData['Orientation'] == 8) {
|
||||
$degree = 90; // 반시계방향으로 90도 돌려줘야 정상
|
||||
}
|
||||
else if($exifData['Orientation'] == 3) {
|
||||
$degree = 180;
|
||||
}
|
||||
if($degree) {
|
||||
if($exifData['FileType'] == 1) {
|
||||
$source = imagecreatefromgif($picture);
|
||||
$source = imagerotate ($source , $degree, 0);
|
||||
imagegif($source, $picture);
|
||||
}
|
||||
else if($exifData['FileType'] == 2) {
|
||||
$source = imagecreatefromjpeg($picture);
|
||||
$source = imagerotate ($source , $degree, 0);
|
||||
imagejpeg($source, $picture);
|
||||
}
|
||||
else if($exifData['FileType'] == 3) {
|
||||
$source = imagecreatefrompng($picture);
|
||||
$source = imagerotate ($source , $degree, 0);
|
||||
imagepng($source, $picture);
|
||||
}
|
||||
@ImageDestroy($source);
|
||||
@ImageDestroy($source);
|
||||
}
|
||||
}
|
||||
?>
|
||||
168
_core/function/zip.class.php
Normal file
168
_core/function/zip.class.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
class ZipFile
|
||||
{
|
||||
var $datasec = array();
|
||||
var $ctrl_dir = array();
|
||||
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
|
||||
var $old_offset = 0;
|
||||
var $proc_count=0;
|
||||
var $makeDirCount;
|
||||
|
||||
function add_dir($name)
|
||||
{
|
||||
$name = str_replace("\\", "/", $name);
|
||||
|
||||
$fr = "\x50\x4b\x03\x04";
|
||||
$fr .= "\x0a\x00";
|
||||
$fr .= "\x00\x00";
|
||||
$fr .= "\x00\x00";
|
||||
$fr .= "\x00\x00\x00\x00";
|
||||
|
||||
$fr .= pack("V",0);
|
||||
$fr .= pack("V",0);
|
||||
$fr .= pack("V",0);
|
||||
$fr .= pack("v", strlen($name) );
|
||||
$fr .= pack("v", 0 );
|
||||
$fr .= $name;
|
||||
$fr .= pack("V", 0);
|
||||
$fr .= pack("V", 0);
|
||||
$fr .= pack("V", 0);
|
||||
|
||||
$this -> datasec[] = $fr;
|
||||
$new_offset = strlen(implode("", $this->datasec));
|
||||
|
||||
$cdrec = "\x50\x4b\x01\x02";
|
||||
$cdrec .="\x00\x00";
|
||||
$cdrec .="\x0a\x00";
|
||||
$cdrec .="\x00\x00";
|
||||
$cdrec .="\x00\x00";
|
||||
$cdrec .="\x00\x00\x00\x00";
|
||||
$cdrec .= pack("V",0);
|
||||
$cdrec .= pack("V",0);
|
||||
$cdrec .= pack("V",0);
|
||||
$cdrec .= pack("v", strlen($name) );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$ext = "\x00\x00\x10\x00";
|
||||
$ext = "\xff\xff\xff\xff";
|
||||
$cdrec .= pack("V", 16 );
|
||||
$cdrec .= pack("V", $this -> old_offset );
|
||||
$cdrec .= $name;
|
||||
|
||||
$this -> ctrl_dir[] = $cdrec;
|
||||
$this -> old_offset = $new_offset;
|
||||
return;
|
||||
}
|
||||
|
||||
function add_file($data, $name)
|
||||
{
|
||||
$fp = fopen($data,"r");
|
||||
$data = fread($fp,filesize($data));
|
||||
fclose($fp);
|
||||
$name = str_replace("\\", "/", $name);
|
||||
$unc_len = strlen($data);
|
||||
$crc = crc32($data);
|
||||
$zdata = gzcompress($data);
|
||||
$zdata = substr ($zdata, 2, -4);
|
||||
$c_len = strlen($zdata);
|
||||
$fr = "\x50\x4b\x03\x04";
|
||||
$fr .= "\x14\x00";
|
||||
$fr .= "\x00\x00";
|
||||
$fr .= "\x08\x00";
|
||||
$fr .= "\x00\x00\x00\x00";
|
||||
$fr .= pack("V",$crc);
|
||||
$fr .= pack("V",$c_len);
|
||||
$fr .= pack("V",$unc_len);
|
||||
$fr .= pack("v", strlen($name) );
|
||||
$fr .= pack("v", 0 );
|
||||
$fr .= $name;
|
||||
$fr .= $zdata;
|
||||
$fr .= pack("V",$crc);
|
||||
$fr .= pack("V",$c_len);
|
||||
$fr .= pack("V",$unc_len);
|
||||
|
||||
$this -> datasec[] = $fr;
|
||||
$new_offset = strlen(implode("", $this->datasec));
|
||||
|
||||
$cdrec = "\x50\x4b\x01\x02";
|
||||
$cdrec .="\x00\x00";
|
||||
$cdrec .="\x14\x00";
|
||||
$cdrec .="\x00\x00";
|
||||
$cdrec .="\x08\x00";
|
||||
$cdrec .="\x00\x00\x00\x00";
|
||||
$cdrec .= pack("V",$crc);
|
||||
$cdrec .= pack("V",$c_len);
|
||||
$cdrec .= pack("V",$unc_len);
|
||||
$cdrec .= pack("v", strlen($name) );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("v", 0 );
|
||||
$cdrec .= pack("V", 32 );
|
||||
$cdrec .= pack("V", $this -> old_offset );
|
||||
|
||||
$this -> old_offset = $new_offset;
|
||||
|
||||
$cdrec .= $name;
|
||||
$this -> ctrl_dir[] = $cdrec;
|
||||
}
|
||||
|
||||
function add_files($files)
|
||||
{
|
||||
foreach($files as $file)
|
||||
{
|
||||
$file = str_replace("//", "/", $file);
|
||||
if (is_file($file))
|
||||
{
|
||||
$this->add_file($file,$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function add_dirs($dirs)
|
||||
{
|
||||
$files = $this->read_dir($dirs);
|
||||
$this->add_files($files);
|
||||
}
|
||||
|
||||
function read_dir($dir)
|
||||
{
|
||||
$array = array();
|
||||
$d = dir($dir);
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
if($entry!='.' && $entry!='..')
|
||||
{
|
||||
$entry = $dir.'/'.$entry;
|
||||
if(is_dir($entry))
|
||||
{
|
||||
$array[] = $entry;
|
||||
$array = array_merge($array, $this->read_dir($entry));
|
||||
}
|
||||
else {
|
||||
$array[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
return $array;
|
||||
}
|
||||
|
||||
function file()
|
||||
{
|
||||
$data = implode('', $this -> datasec);
|
||||
$ctrldir = implode('', $this -> ctrl_dir);
|
||||
|
||||
return
|
||||
$data .
|
||||
$ctrldir .
|
||||
$this -> eof_ctrl_dir .
|
||||
pack("v", sizeof($this -> ctrl_dir)) .
|
||||
pack("v", sizeof($this -> ctrl_dir)) .
|
||||
pack("V", strlen($ctrldir)) .
|
||||
pack("V", strlen($data)) . "\x00\x00";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user