This commit is contained in:
shim
2023-04-17 11:06:08 +09:00
parent d0b393aa97
commit 76264e09ad
4686 changed files with 552713 additions and 0 deletions

4
modules/market/README.md Normal file
View File

@@ -0,0 +1,4 @@
## Copyright and license
Copyright 2020 Redblock, Inc.
Licensed under the [RBL](https://kimsq.com/p/rbl) License

View File

@@ -0,0 +1,43 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$folder = './';
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
if (is_uploaded_file($tmpname))
{
if (substr($realname,0,7) != 'rb_etc_')
{
getLink('','','기타자료 패키지가 아닙니다.','');
}
if ($fileExt != 'zip')
{
getLink('','','패키지는 반드시 zip압축 포맷이어야 합니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
DirCopy($extPath1,$folder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
getLink('reload','parent.','자료가 정상적으로 등록되었습니다.','');
?>

View File

@@ -0,0 +1,5 @@
<script type="text/javascript">
top.getId('marketFrame').style.height = '<?php echo $height?>px';
</script>
<?php exit?>

View File

@@ -0,0 +1,18 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
?>
<script type="text/javascript">
//<![CDATA[
<?php if($innerF):?>
parent.parent.parent.document.getElementById('marketFrame').style.height = '<?php echo ($height+100)?>px';
<?php else:?>
parent.parent.document.getElementById('marketFrame').style.height = '<?php echo ($height+100)?>px';
parent.parent.scrollTo(0,0);
<?php endif?>
//]]>
</script>
<?php exit?>

View File

@@ -0,0 +1,16 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
if ($type == 'pc')
{
getDbUpdate($table['s_site'],"layout='".$layout."/main.php'",'uid='.$s);
getWindow(RW(0),'PC모드 대표 레이아웃으로 적용되었습니다.','','','');
exit;
}
else {
getDbUpdate($table['s_site'],"m_layout='".$layout."/main.php'",'uid='.$s);
getLink('','','모바일웹 대표레이아웃으로 적용되었습니다. \n\n모바일기기나 에뮬레이터로 확인하세요.','');
}
?>

View File

@@ -0,0 +1,130 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$isModule = '';
$isUpload = false;
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
if ($remote == 'Y')
{
$saveFile = $extPath.'/rb_module_app.zip';
if (is_file($saveFile))
{
if (is_file($folder.$insfolder.'/main.php'))
{
unlink($saveFile);
getLink('','','이미 동일한 아이디('.basename($insfolder).')의 모듈이 존재합니다.','');
}
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
$opendir = opendir($extPath1);
while(false !== ($file = readdir($opendir)))
{
if($file != '.' && $file != '..' && is_file($extPath1.$file.'/main.php'))
{
if(is_file($g['path_module'].$file.'/main.php'))
{
$isModule = $file;
break;
}
mkdir($g['path_module'].$file,0707);
@chmod($g['path_module'].$file,0707);
DirCopy($extPath1.$file,$g['path_module'].$file);
$isUpload = true;
break;
}
}
closedir($opendir);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
if ($isModule)
{
getLink('','','이미 동일한 아이디('.$isModule.')의 모듈이 존재합니다.','');
}
if (!$isUpload)
{
getLink('','','패키지규격에 맞지 않는 파일입니다','');
}
getLink($g['s'].'/?r='.$r.'&m=admin&module='.$m.'&front=pack&type=module','parent.','모듈설치 대기리스트에 등록되었습니다.','');
}
getLink('','','','');
}
else {
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$saveFile = $extPath1.$date['totime'].'.zip';
if (is_uploaded_file($tmpname))
{
if (substr($realname,0,10) != 'rb_module_')
{
getLink('','','모듈 패키지가 아닙니다.','');
}
if ($fileExt != 'zip')
{
getLink('','','패키지는 반드시 zip압축 포맷이어야 합니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
$opendir = opendir($extPath1);
while(false !== ($file = readdir($opendir)))
{
if($file != '.' && $file != '..' && is_file($extPath1.$file.'/main.php'))
{
if(is_file($g['path_module'].$file.'/main.php'))
{
$isModule = $file;
break;
}
mkdir($g['path_module'].$file,0707);
@chmod($g['path_module'].$file,0707);
DirCopy($extPath1.$file,$g['path_module'].$file);
$isUpload = true;
break;
}
}
closedir($opendir);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
if ($isModule)
{
getLink('','','이미 동일한 아이디('.$isModule.')의 모듈이 존재합니다.','');
}
if (!$isUpload)
{
getLink('','','패키지규격에 맞지 않는 파일입니다','');
}
}
getLink('reload','parent.','','');
}
?>

View File

@@ -0,0 +1,51 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$isModule = getDbRows($table['s_module'],"id='".$module."'");
if ($isModule)
{
getLink('','','이미 설치된 모듈입니다.','');
}
else {
if (!is_file($g['path_module'].$module.'/main.php'))
{
getLink('','','존재하지 않는 모듈입니다.','');
}
$_tmptable2 = $table;
$table = array();
$table_db = $g['path_module'].$module.'/_setting/db.table.php';
$table_sc = $g['path_module'].$module.'/_setting/db.schema.php';
if(is_file($table_db))
{
$_tmptable1 = array();
$_tmptfile = $g['path_var'].'table.info.php';
include_once $table_db;
include_once $table_sc;
$_tmptable1 = $table;
rename($table_db,$table_db.'.done');
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_tmptable2 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
foreach($_tmptable1 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
}
else {
if(is_file($table_db.'.done')) include_once $table_db.'.done';
}
$maxgid = getDbCnt($_tmptable2['s_module'],'max(gid)','');
$QKEY = "gid,system,hidden,mobile,name,id,tblnum,d_regis";
$QVAL = "'".($maxgid+1)."','0','0','1','".getFolderName($g['path_module'].$module)."','$module','".count($table)."','".$date['totime']."'";
getDbInsert($_tmptable2['s_module'],$QKEY,$QVAL);
getLink('reload','parent.','모듈이 정상적으로 설치되었습니다.','');
}
?>

View File

@@ -0,0 +1,36 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
include_once $g['path_core'].'function/dir.func.php';
if ($type == 'module')
{
DirDelete($g['path_module'].$pack);
}
if ($type == 'layout')
{
DirDelete($g['path_layout'].$pack);
}
if ($type == 'widget')
{
DirDelete($g['path_widget'].str_replace('.','',str_replace('./widgets/','',$pack)));
}
if ($type == 'switch')
{
DirDelete($g['path_switch'].$pack);
}
if ($type == 'bbstheme')
{
DirDelete($g['path_module'].'bbs/theme/'.$pack);
}
if ($type == 'widget')
{
getLink($g['s'].'/?r='.$r.'&m=admin&module='.$m.'&front=pack&type=widget','parent.','','');
}
else {
getLink('reload','parent.','','');
}
?>

View File

@@ -0,0 +1,162 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$isPack = '';
$isUpload = false;
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$typeset = array('layout'=>'레이아웃이','widget'=>'위젯이','switch'=>'스위치가','bbstheme'=>'게시판테마가');
if ($remote == 'Y')
{
$saveFile = $extPath.'/rb_'.$type.'_app.zip';
if (is_file($saveFile))
{
if (!is_dir($folder.$subfolder))
{
unlink($saveFile);
getLink('','','설치경로 정보가 맞지않아 설치가 중단되었습니다. 직접 다운로드 받아 설치하세요.','');
}
if (is_file($folder.$insfolder.'/main.php'))
{
unlink($saveFile);
getLink('','','이미 동일한 폴더명('.basename($insfolder).')의 패키지가 존재합니다.','');
}
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
$opendir = opendir($extPath1);
while(false !== ($file = readdir($opendir)))
{
if($file != '.' && $file != '..' && is_file($extPath1.$file.'/name.txt'))
{
if(is_file($folder.$subfolder.$file.'/name.txt'))
{
$isPack = $file;
break;
}
mkdir($folder.$subfolder.$file,0707);
@chmod($folder.$subfolder.$file,0707);
DirCopy($extPath1.$file,$folder.$subfolder.$file);
$isUpload = true;
break;
}
}
closedir($opendir);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
if ($isPack)
{
getLink('','','이미 동일한 폴더명('.$isPack.')의 '.$typeset[$type].' 존재합니다.','');
}
if (!$isUpload)
{
getLink('','','패키지규격에 맞지 않는 파일입니다','');
}
}
getLink($g['s'].'/?r='.$r.'&m=admin&module='.$m.'&front=pack&type='.($type=='bbstheme'?'theme':$type).'&insfolder='.$insfolder.($mobile?'&mobile='.$mobile:''),'parent.','['.(getFolderName($folder.$insfolder)).'] '.$typeset[$type].' 정상적으로 설치되었습니다.','');
}
else {
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$saveFile = $extPath1.$date['totime'].'.zip';
if (is_uploaded_file($tmpname))
{
if ($type == 'layout')
{
if (substr($realname,0,10) != 'rb_layout_')
{
getLink('','','레이아웃 패키지가 아닙니다.','');
}
}
if ($type == 'widget')
{
if (substr($realname,0,10) != 'rb_widget_')
{
getLink('','','위젯 패키지가 아닙니다.','');
}
}
if ($type == 'switch')
{
if (substr($realname,0,10) != 'rb_switch_')
{
getLink('','','스위치 패키지가 아닙니다.','');
}
}
if ($type == 'bbstheme')
{
if (substr($realname,0,12) != 'rb_bbstheme_')
{
getLink('','','게시판테마 패키지가 아닙니다.','');
}
}
if ($fileExt != 'zip')
{
getLink('','','패키지는 반드시 zip압축 포맷이어야 합니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
$opendir = opendir($extPath1);
while(false !== ($file = readdir($opendir)))
{
if($file != '.' && $file != '..' && is_file($extPath1.$file.'/name.txt'))
{
if(is_file($folder.$subfolder.$file.'/name.txt'))
{
$isPack = $file;
break;
}
mkdir($folder.$subfolder.$file,0707);
@chmod($folder.$subfolder.$file,0707);
DirCopy($extPath1.$file,$folder.$subfolder.$file);
$isUpload = true;
break;
}
}
closedir($opendir);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
if ($isPack)
{
getLink('','','이미 동일한 폴더명('.$isPack.')의 '.$typeset[$type].' 존재합니다.','');
}
if (!$isUpload)
{
getLink('','','패키지규격에 맞지 않는 파일입니다','');
}
}
getLink('reload','parent.','패키지가 정상적으로 등록되었습니다.','');
}
?>

View File

@@ -0,0 +1,116 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
if ($del == 'Y')
{
require $g['path_core'].'function/dir.func.php';
DirDelete('./_package');
getLink('reload','parent.','패키지 파일이 삭제되었습니다.','');
}
else {
require $g['path_core'].'function/dir.func.php';
@mkdir('./_package',0707);
@mkdir('./_package/rb',0707);
@mkdir('./_package/rb/_core',0707);
@mkdir('./_package/rb/_tmp',0707);
@mkdir('./_package/rb/_var',0707);
@mkdir('./_package/rb/files',0707);
@mkdir('./_package/rb/layouts',0707);
@mkdir('./_package/rb/switchs',0707);
@mkdir('./_package/rb/widgets',0707);
@mkdir('./_package/rb/modules',0707);
@mkdir('./_package/rb/modules/bbs',0707);
@mkdir('./_package/rb/modules/bbs/var',0707);
@mkdir('./_package/rb/pages',0707);
@mkdir('./_package/rb/pages/menu',0707);
@mkdir('./_package/rb/pages/image',0707);
$fp = fopen('./_package/dump_site.dat','w');
foreach($_HS as $_key => $_val)
{
if (!strpos(',,layout,m_layout,lang,dtd,nametype,',','.$_key.',')) continue;
fwrite($fp,$_key."\t".$_val."\t\n");
}
fclose($fp);
$fp = fopen('./_package/dump_menu.dat','w');
$_MENUS = getDbSelect($table['s_menu'],'site='.$_HS['uid'].' order by uid asc','*');
while($R=db_fetch_array($_MENUS))
{
//$_SEO = getDbData($table['s_seo'],'rel=1 and parent='.$R['uid'],'*');
fwrite($fp,$R['uid']."\t".$R['gid']."\t".$R['isson']."\t".$R['parent']."\t".$R['depth']."\t".$R['id']."\t".$R['menutype']."\t".$R['mobile']."\t".$R['hidden']."\t".$R['reject']."\t".$R['name']."\t".$R['target']."\t".$R['redirect']."\t".$R['joint']."\t".$R['layout']."\t".$R['imghead']."\t".$R['imgfoot']."\t".$R['puthead']."\t".$R['putfoot']."\t\n");
$_xfile1 = $g['path_page'].'menu/'.sprintf('%05d',$R['uid']);
$_xfile2 = './_package/rb/pages/menu/'.sprintf('%05d',$R['uid']);
@copy($_xfile1.'.php',$_xfile2.'.php');
@copy($_xfile1.'.widget.php',$_xfile2.'.widget.php');
@copy($_xfile1.'.mobile.php',$_xfile2.'.mobile.php');
@copy($_xfile1.'.css',$_xfile2.'.css');
@copy($_xfile1.'.js',$_xfile2.'.js');
@copy($_xfile1.'.header.php',$_xfile2.'.header.php');
@copy($_xfile1.'.footer.php',$_xfile2.'.footer.php');
}
fclose($fp);
$fp = fopen('./_package/dump_page.dat','w');
$_PAGES = getDbSelect($table['s_page'],'','*');
while($R=db_fetch_array($_PAGES))
{
//$_SEO = getDbData($table['s_seo'],'rel=2 and parent='.$R['uid'],'*');
fwrite($fp,$R['pagetype']."\t".$R['ismain']."\t".$R['mobile']."\t".$R['id']."\t".$R['category']."\t".$R['name']."\t".$R['layout']."\t".$R['joint']."\t".$R['sosokmenu']."\t\n");
$_xfile1 = $g['path_page'].$R['id'];
$_xfile2 = './_package/rb/pages/'.$R['id'];
@copy($_xfile1.'.php',$_xfile2.'.php');
@copy($_xfile1.'.widget.php',$_xfile2.'.widget.php');
@copy($_xfile1.'.mobile.php',$_xfile2.'.mobile.php');
@copy($_xfile1.'.css',$_xfile2.'.css');
@copy($_xfile1.'.js',$_xfile2.'.js');
}
fclose($fp);
$fp = fopen('./_package/dump_bbs.dat','w');
$_BBS = getDbSelect($table['bbslist'],'uid order by gid asc','*');
while($R=db_fetch_array($_BBS))
{
fwrite($fp,$R['id']."\t".$R['name']."\t".$R['category']."\t".$R['imghead']."\t".$R['imgfoot']."\t".$R['puthead']."\t".$R['putfoot']."\t\n");
$_xfile1 = $g['path_module'].'bbs/var/var.'.$R['id'];
$_xfile2 = './_package/rb/modules/bbs/var/var.'.$R['id'];
@copy($_xfile1.'.php',$_xfile2.'.php');
}
fclose($fp);
$fp = fopen('./_package/readme.txt','w');
fwrite($fp,"패키지 안내문\n------------------\n");
fwrite($fp,"여기(/_package/readme.txt)에 이 패키지의 설명글을 작성해 주세요.\n");
fwrite($fp,"이 패키지는 샘플이므로 실제 적용가능한 패키지를 구성하려면 매뉴얼을 참조하세요.\n");
fwrite($fp,"이 샘플패키지는 '적용취소' 버튼을 클릭하면 삭제할 수 있습니다.\n");
fclose($fp);
$fp = fopen('./_package/package.rule.php','w');
fwrite($fp, "<?php\n");
fwrite($fp, "// 이 패키지의 명칭을 지정합니다.\n");
fwrite($fp, "\$d['package']['name'] = \"[".$_HS['name']." - 사이트패키지]\";\n\n");
fwrite($fp, "// 이 패키지에 포함된 확장요소들을 배열로 지정합니다.\n");
fwrite($fp, "// 설치가 필요한 신규모듈일 경우 array 안에 모듈폴더명을 지정합니다.\n");
fwrite($fp, "\$d['package']['elements'] = array\n");
fwrite($fp, "(\n");
fwrite($fp, " '샘플 레이아웃' => array(),\n");
fwrite($fp, " '샘플 신규모듈' => array(''),\n");
fwrite($fp, ");\n");
fwrite($fp, "?>");
fclose($fp);
getLink('reload','parent.','패키지용 샘플파일이 만들어졌습니다.','');
}
?>

View File

@@ -0,0 +1,10 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
require $g['path_core'].'function/dir.func.php';
DirCopy('./_package/modules/'.$module,'./modules/'.$module);
getLink($g['s'].'/?r='.$r.'&m='.$m.'&a=module_setting&module='.$module,'','','');
?>

View File

@@ -0,0 +1,177 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$act = $act ? $act : 'package_upload';
if ($act == 'package_upload')
{
if ($remote == 'Y')
{
$saveFile = $g['path_tmp'].'app/rb_package_app.zip';
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,'./');
getLink($g['s'].'/?r='.$r.'&m=admin&module='.$m.'&front=pack','parent.','패키지가 정상적으로 등록되었습니다.','');
}
else {
$folder = './';
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
if (is_uploaded_file($tmpname))
{
if (substr($realname,0,11) != 'rb_package_')
{
getLink('','','킴스큐용 패키지가 아닙니다.','');
}
if ($fileExt != 'zip')
{
getLink('','','패키지는 반드시 zip압축 포맷이어야 합니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($saveFile,$extPath1);
unlink($saveFile);
DirCopy($extPath1,$folder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
getLink('reload','parent.','패키지가 정상적으로 등록되었습니다.','');
}
}
if ($act == 'package_cancel')
{
require $g['path_core'].'function/dir.func.php';
DirDelete('./_package');
getLink('reload','parent.','패키지 적용이 취소되었습니다.','');
}
if ($act == 'package_aply') {
require $g['path_core'].'function/dir.func.php';
if ($aply_site == '1')
{
$_site = file('./_package/dump_site.dat');
foreach($_site as $_val)
{
if (!trim($_val)) continue;
$_r = explode("\t",$_val);
getDbUpdate($table['s_site'],$_r[0]."='".$_r[1]."'",'uid='.$site);
}
}
if ($aply_menu == '1')
{
$_MENUS = getDbSelect($table['s_menu'],'site='.$site.' order by gid asc','*');
while($R=db_fetch_array($_MENUS))
{
getDbDelete($table['s_menu'],'uid='.$R['uid']);
getDbDelete($table['s_seo'],'rel=1 and parent='.$R['uid']);
$_xfile = $g['path_page'].'menu/'.sprintf('%05d',$R['uid']);
unlink($_xfile.'.php');
unlink($_xfile.'.widget.php');
@unlink($_xfile.'.mobile.php');
@unlink($_xfile.'.css');
@unlink($_xfile.'.js');
@unlink($_xfile.'.header.php');
@unlink($_xfile.'.footer.php');
@unlink($_xfile.'.txt');
@unlink($_xfile.'.cache');
@unlink($_xfile.'.widget.cache');
@unlink($_xfile.'.mobile.cache');
@unlink($g['path_var'].'menu/'.$R['imghead']);
@unlink($g['path_var'].'menu/'.$R['imgfoot']);
}
$_menu = file('./_package/dump_menu.dat');
$_xarr = array();
foreach($_menu as $_val)
{
if (!trim($_val)) continue;
$_r = explode("\t",$_val);
getDbInsert($table['s_menu'],'gid,site,isson,parent,depth,id,menutype,mobile,hidden,reject,name,target,redirect,joint,layout,imghead,imgfoot,puthead,putfoot',"'".$_r[1]."','".$site."','".$_r[2]."','0','".$_r[4]."','".$_r[5]."','".$_r[6]."','".$_r[7]."','".$_r[8]."','".$_r[9]."','".$_r[10]."','".$_r[11]."','".$_r[12]."','".$_r[13]."','".$_r[14]."','".$_r[15]."','".$_r[16]."','".$_r[17]."','".$_r[18]."'");
$lastmenu = getDbCnt($table['s_menu'],'max(uid)','');
$_xarr['p'.$_r[0]] = $lastmenu;
if($_r[3])
{
getDbUpdate($table['s_menu'],'parent='.$_xarr['p'.$_r[3]],'uid='.$lastmenu);
}
else {
getDbUpdate($table['s_menu'],'parent=0','uid='.$lastmenu);
}
$_xfile1 = './_package/rb/pages/menu/'.sprintf('%05d',$_r[0]);
$_xfile2 = './_package/rb/pages/menu/'.sprintf('%05d',$lastmenu);
@rename($_xfile1.'.php',$_xfile2.'.php');
@rename($_xfile1.'.widget.php',$_xfile2.'.widget.php');
@rename($_xfile1.'.mobile.php',$_xfile2.'.mobile.php');
@rename($_xfile1.'.css',$_xfile2.'.css');
@rename($_xfile1.'.js',$_xfile2.'.js');
@rename($_xfile1.'.header.php',$_xfile2.'.header.php');
@rename($_xfile1.'.footer.php',$_xfile2.'.footer.php');
}
}
if ($aply_page == '1')
{
$_page = file('./_package/dump_page.dat');
foreach($_page as $_val)
{
if (!trim($_val)) continue;
$_r = explode("\t",$_val);
$_p = getDbData($table['s_page'],"id='".$_r[3]."'",'uid');
if ($_p['uid'])
{
getDbUpdate($table['s_page'],"pagetype='".$_r[0]."',ismain='".$_r[1]."',mobile='".$_r[2]."',id='".$_r[3]."',category='".$_r[4]."',name='".$_r[5]."',layout='".$_r[6]."',joint='".$_r[7]."',sosokmenu='".$_r[8]."'",'uid='.$_p['uid']);
}
else {
getDbInsert($table['s_page'],'pagetype,ismain,mobile,id,category,name,layout,joint,sosokmenu',"'".$_r[0]."','".$_r[1]."','".$_r[2]."','".$_r[3]."','".$_r[4]."','".$_r[5]."','".$_r[6]."','".$_r[7]."','".$_r[8]."'");
}
}
}
if ($aply_bbs == '1')
{
$maxgid = getDbCnt($table['bbslist'],'max(gid)','');
$_bbs = file('./_package/dump_bbs.dat');
foreach($_bbs as $_val)
{
if (!trim($_val)) continue;
$_r = explode("\t",$_val);
$_p = getDbData($table['bbslist'],"id='".$_r[0]."'",'uid');
if ($_p['uid']) continue;
$maxgid++;
getDbInsert($table['bbslist'],'gid,id,name,category,imghead,imgfoot,puthead,putfoot',"'".$maxgid."','".$_r[0]."','".$_r[1]."','".$_r[2]."','".$_r[3]."','".$_r[4]."','".$_r[5]."','".$_r[6]."'");
}
}
DirCopy('./_package/rb','./');
DirDelete('./_package');
getLink('reload','parent.','패키지가 적용되었습니다.','');
}
?>

View File

@@ -0,0 +1,70 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
if (!$uid) getLink('','','정상적인 접근이 아닙니다.','');
$insFile = $g['dir_module'].'var/install/'.$uid.'.txt';
if (is_file($insFile))
{
getLink('','','이미 설치된 자료입니다.','');
}
else {
include $g['dir_module'].'var/var.php';
if(!$d['market']['url']) getLink('','','환경설정 페이지에서 큐마켓URL을 등록해 주세요.','');
if(!$d['market']['id']||!$d['market']['pw']) getLink('','','환경설정 페이지에서 킴스큐 회원정보를 등록해 주세요.','');
include $g['path_core'].'function/rss.func.php';
$appData = getUrlData($d['market']['url'].'&a=client.install&uid='.$uid.'&id='.$d['market']['id'].'&pw='.$d['market']['pw'],10);
$appArray= explode('|',$appData);
if ($appArray[3]) getLink('','',$appArray[3],'');
if (!$appArray[2]) getLink('','','정상적인 자료가 아닙니다.','');
if ($appArray[4] != 6)
{
if (!$appArray[0] || !$appArray[1]) getLink('','','원격설치를 지원하지 않는 자료입니다.','');
}
$marketUrl = explode('/',$d['market']['url']);
$marketData = getUrlData('http://'.$marketUrl[2].'/modules/qmarket/upload/data/'.$appArray[2],10);
$appfiletype = substr($appArray[0],0,6);
if (strstr($appArray[1],'bbs/theme/')) $appfiletype = 'bbstheme';
$folder = './'.$appArray[0].'/';
$subfolder = explode('/',$appArray[1]);
$subfoldern= count($subfolder)-1;
$nSubfolder = '';
if (strpos(',_pc,_mobile,',$subfolder[$subfoldern]))
{
getLink('','','원격설치 형식에 맞지 않는 자료같습니다.\\n다운로드 받아서 설치해 주세요.','');
}
for ($i = 0; $i < $subfoldern; $i++)
{
$nSubfolder .= $subfolder[$i].'/';
}
if ($appArray[4] == 6) $appfiletype = 'package';
$installaction= array
(
'module'=>array('module_pack_upload','rb_module_app.zip'),
'widget'=>array('pack_upload','rb_widget_app.zip'),
'layout'=>array('pack_upload','rb_layout_app.zip'),
'bbstheme'=>array('pack_upload','rb_bbstheme_app.zip'),
'switch'=>array('pack_upload','rb_switch_app.zip'),
'package'=>array('package_upload','rb_package_app.zip'),
);
if ($installaction[$appfiletype][0]=='') getLink('','','원격설치 형식에 맞지 않는 자료입니다.\\n다운로드 받아서 설치해 주세요.','');
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$installaction[$appfiletype][1];
$fp = fopen($saveFile,'w');
fwrite($fp,$marketData);
fclose($fp);
@chmod($saveFile,0707);
getLink($g['s'].'/?r='.$r.'&m='.$m.'&a='.$installaction[$appfiletype][0].'&remote=Y&type='.$appfiletype.'&folder='.$folder.'&subfolder='.$nSubfolder.'&insfolder='.$appArray[1].'&uid='.$uid,'','','');
}
?>

View File

@@ -0,0 +1,59 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_module'].'dashboard/widgets/'.$plFolder;
$tgFolder = $plfldPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,13) != 'rb_dashboard_')
{
getLink('reload','parent.','킴스큐 공식 대시보드 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
@chmod($plfldPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
else {
getLink('','','대시보드 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
exit;
// if ($reload == 'Y') getLink('reload',"parent.parent.",'대시보드 위젯이 추가되었습니다.','');
// else getLink('',"parent.parent.$('#modal_window').modal('hide');",'대시보드 위젯이 추가되었습니다.','');
?>

View File

@@ -0,0 +1,54 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$tgFolder = './';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,7) != 'rb_etc_')
{
getLink('reload','parent.','킴스큐 공식 기타자료 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
else {
getLink('','','기타자료 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
exit;
//if ($reload == 'Y') getLink('reload',"parent.parent.",'기타자료가 추가되었습니다.','');
//else getLink('',"parent.parent.$('#modal_window').modal('hide');",'기타자료가 추가되었습니다.','');
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
for($_i = 3; $_i < count($nameinfo); $_i++)
{
$plFolder .= '_';
$plFolder .= $nameinfo[$_i];
}
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_layout'].$plFolder;
$tgFolder = $plfldPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,10) != 'rb_layout_')
{
getLink('reload','parent.','킴스큐 공식 레이아웃 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
@chmod($plfldPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
else {
getLink('','','레이아웃 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
// exit;
if ($reload == 'Y') getLink('reload',"parent.parent.",'레이아웃이 추가되었습니다.','');
else getLink('',"parent.parent.$('#modal_window').modal('hide');",'레이아웃이 추가되었습니다.','');
?>

View File

@@ -0,0 +1,106 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
for($_i = 3; $_i < count($nameinfo); $_i++)
{
$plFolder .= '_';
$plFolder .= $nameinfo[$_i];
}
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_module'].$plFolder;
$tgFolder = $plfldPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,10) != 'rb_module_')
{
getLink('reload','parent.','킴스큐 공식 모듈 파일이 아닙니다.','');
}
if (is_file($g['path_module'].$plFolder.'/main.php'))
{
getLink('','',sprintf('이미 동일한 코드의 모듈(%s)이 존재합니다.',$plFolder),'');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
@chmod($plfldPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
else {
getLink('','','모듈 파일을 선택해 주세요.','');
}
$module = $plFolder;
$_tmptable2 = $table;
$table = array();
$table_db = $g['path_module'].$module.'/_setting/db.table.php';
$table_sc = $g['path_module'].$module.'/_setting/db.schema.php';
if(is_file($table_db))
{
$_tmptable1 = array();
$_tmptfile = $g['path_var'].'table.info.php';
include $table_db;
include $table_sc;
$_tmptable1 = $table;
rename($table_db,$table_db.'.done');
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_tmptable2 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
foreach($_tmptable1 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
}
else {
if(is_file($table_db.'.done')) include $table_db.'.done';
}
$maxgid = getDbCnt($_tmptable2['s_module'],'max(gid)','');
$QKEY = "gid,sys,hidden,mobile,name,id,tblnum,icon,d_regis";
$QVAL = "'".($maxgid+1)."','0','0','1','".getFolderName($g['path_module'].$module)."','$module','".count($table)."','kf-module','".$date['totime']."'";
getDbInsert($_tmptable2['s_module'],$QKEY,$QVAL);
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
// exit;
if ($reload == 'Y') getLink('reload',"parent.parent.",'모듈이 추가되었습니다.','');
else getLink('',"parent.parent.$('#modal_window').modal('hide');",'모듈이 추가되었습니다.','');
?>

View File

@@ -0,0 +1,323 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
if ($package_step == 'delete')
{
require $g['path_core'].'function/dir.func.php';
$extPath = $g['path_tmp'].'app';
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
getLink('','','','');
}
if ($package_step == 1)
{
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/'.$realname.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$tgFolder = './';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,11) != 'rb_package_')
{
getLink('reload','parent.','킴스큐 공식 패키지 파일이 아닙니다.','');
}
mkdir($extPath1,0707);
@chmod($extPath1,0707);
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
}
else {
getLink('','','패키지 파일을 선택해 주세요.','');
}
getLink($g['s'].'/?r='.$r.'&iframe=Y&m=admin&module='.$m.'&front=modal.package&package_step=2&package_folder='.$realname,'parent.','','');
}
if ($package_step == 2)
{
require $g['path_core'].'function/dir.func.php';
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.php';
if($siteuid)
{
$S = getUidData($table['s_site'],$siteuid);
getDbUpdate($table['s_site'],"layout='".$d['package']['layout']."',m_layout='".$d['package']['layout_mobile']."',rewrite='".$d['package']['rewrite']."'",'uid='.$S['uid']);
//기존메뉴삭제
if ($ACT_DM)
{
$_MENUS = getDbSelect($table['s_menu'],'site='.$S['uid'].' order by gid asc','*');
while($_M = db_fetch_array($_MENUS))
{
@unlink($g['path_var'].'menu/'.$_M['imghead']);
@unlink($g['path_var'].'menu/'.$_M['imgfoot']);
getDbDelete($table['s_seo'],'rel=1 and parent='.$_M['uid']);
}
getDbDelete($table['s_menu'],'site='.$S['uid']);
db_query("OPTIMIZE TABLE ".$table['s_menu'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table['s_seo'],$DB_CONNECT);
DirDelete($g['path_page'].$S['id'].'-menus');
}
//기존페이지삭제
if ($ACT_DP)
{
$_PAGES = getDbSelect($table['s_page'],'site='.$S['uid'].' order by uid asc','*');
while($_P = db_fetch_array($_PAGES))
{
getDbDelete($table['s_seo'],'rel=2 and parent='.$_P['uid']);
}
getDbDelete($table['s_page'],'site='.$S['uid']);
db_query("OPTIMIZE TABLE ".$table['s_page'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table['s_seo'],$DB_CONNECT);
DirDelete($g['path_page'].$S['id'].'-pages');
}
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-menus',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$S['id'].'-menus');
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-pages',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$S['id'].'-pages');
@rename($g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$d['package']['siteid'],$g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$S['id']);
}
else {
$MAXC = getDbCnt($table['s_site'],'max(gid)','');
$gid = $MAXC + 1;
$name = 'SITE '.$gid;
$label = 'SITE '.$gid;
$id = 's'.date('His');
$QKEY = "gid,id,name,label,title,titlefix,icon,layout,startpage,m_layout,m_startpage,lang,open,dtd,nametype,timecal,rewrite,buffer,usescode,headercode,footercode";
$QVAL = "'".$gid."','".$id."','".$name."','".$label."','{subject} | {site}','0','fa fa-home','".$d['package']['layout']."','0','".$d['package']['layout_mobile']."','0','','1','','nic','0','".$d['package']['rewrite']."','0','1','',''";
getDbInsert($table['s_site'],$QKEY,$QVAL);
$LASTUID = getDbCnt($table['s_site'],'max(uid)','');
db_query("OPTIMIZE TABLE ".$table['s_site'],$DB_CONNECT);
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'0','$LASTUID','','','','ALL',''");
$vfile = $g['path_var'].'sitephp/'.$LASTUID.'.php';
$fp = fopen($vfile,'w');
fwrite($fp,'');
fclose($fp);
@chmod($vfile,0707);
mkdir($g['path_var'].'site/'.$id,0707);
@chmod($g['path_var'].'site/'.$id,0707);
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-menus',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$id.'-menus');
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-pages',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$id.'-pages');
@rename($g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$d['package']['siteid'],$g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$id);
$S = getUidData($table['s_site'],$LASTUID);
}
//메뉴생성
if ($ACT_CM)
{
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.menu.php';
$QKEY = "gid,site,is_child,parent,depth,id,menutype,mobile,hidden,reject,name,target,redirect,joint,perm_g,perm_l,layout,m_layout,imghead,imgfoot,addattr,num,d_last,addinfo,upload,featured_img";
foreach($d['package']['menus'] as $R)
{
$_parent = 0;
if ($R['parent'])
{
$_PRTUID = getDbData($table['s_menu'],'site='.$S['uid']." and id='".$R['parent']."'",'uid');
$_parent = $_PRTUID['uid'];
}
$QVAL = "'".$R['gid']."','".$S['uid']."','".$R['is_child']."','".$_parent."','".$R['depth']."','".$R['id']."','".$R['menutype']."','".$R['mobile']."','".$R['hidden']."','0','".$R['name']."','".$R['target']."','".$R['redirect']."','".$R['joint']."','','0','".$R['layout']."','".$R['m_layout']."','".$R['imghead']."','".$R['imgfoot']."','".$R['addattr']."','0','','".$R['addinfo']."','".$R['upload']."','".$R['featured_img']."'";
getDbInsert($table['s_menu'],$QKEY,$QVAL);
$lastmenu = getDbCnt($table['s_menu'],'max(uid)','');
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'1','$lastmenu','','','','ALL',''");
}
}
//페이지생성
if ($ACT_CP)
{
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.page.php';
$QKEY = "site,pagetype,ismain,mobile,id,category,name,perm_g,perm_l,layout,m_layout,joint,hit,linkedmenu,d_regis,d_update,upload,featured_img,member,extra";
foreach($d['package']['pages'] as $R)
{
if (is_file($g['path_page'].$S['id'].'-pages/'.$R['id'].'.php')) continue;
$QVAL = "'".$S['uid']."','".$R['pagetype']."','".$R['ismain']."','".$R['mobile']."','".$R['id']."','".$R['category']."','".$R['name']."','','0','".$R['layout']."','".$R['m_layout']."','".$R['joint']."','0','".$R['linkedmenu']."','".$date['totime']."','".$date['totime']."','".$R['upload']."','".$R['featured_img']."','1',''";
getDbInsert($table['s_page'],$QKEY,$QVAL);
$lastpage = getDbCnt($table['s_page'],'max(uid)','');
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'2','$lastpage','','','','ALL',''");
}
}
//메인페이지 지정
$MP = getDbData($table['s_page'],"ismain=1 and site=".$S['uid'],'uid');
getDbUpdate($table['s_site'],"startpage='".$MP['uid']."',m_startpage=''",'uid='.$S['uid']);
//모듈설치
if (is_dir($g['path_tmp'].'app/'.$package_folder.'/modules'))
{
$dirh = opendir($g['path_tmp'].'app/'.$package_folder.'/modules');
while(false !== ($filename = readdir($dirh)))
{
if($filename == '.' || $filename == '..') continue;
if(is_file($g['path_module'].$filename.'/main.php')) continue;
$module = $filename;
$_tmptable2 = $table;
$table = array();
$table_db = $g['path_tmp'].'app/'.$package_folder.'/modules/'.$module.'/_setting/db.table.php';
$table_sc = $g['path_tmp'].'app/'.$package_folder.'/modules/'.$module.'/_setting/db.schema.php';
if(is_file($table_db))
{
$_tmptable1 = array();
$_tmptfile = $g['path_var'].'table.info.php';
include $table_db;
include $table_sc;
$_tmptable1 = $table;
rename($table_db,$table_db.'.done');
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_tmptable2 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
foreach($_tmptable1 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
}
else {
if(is_file($table_db.'.done')) include $table_db.'.done';
}
$maxgid = getDbCnt($_tmptable2['s_module'],'max(gid)','');
$QKEY = "gid,system,hidden,mobile,name,id,tblnum,icon,d_regis";
$QVAL = "'".($maxgid+1)."','0','0','1','".getFolderName($g['path_tmp'].'app/'.$package_folder.'/modules/'.$module)."','$module','".count($table)."','kf-module','".$date['totime']."'";
getDbInsert($_tmptable2['s_module'],$QKEY,$QVAL);
}
closedir($dirh);
}
//플러그인설치
if (is_dir($g['path_tmp'].'app/'.$package_folder.'/plugins'))
{
$dirh = opendir($g['path_tmp'].'app/'.$package_folder.'/plugins');
while(false !== ($filename = readdir($dirh)))
{
if($filename == '.' || $filename == '..') continue;
if (is_dir($g['path_plugin'].$filename)) continue;
if (!$d['ov'][$filename])
{
$plVersion = '';
$dirh1 = opendir($g['path_tmp'].'app/'.$package_folder.'/plugins/'.$filename);
while(false !== ($filename1 = readdir($dirh1)))
{
if($filename1 == '.' || $filename1 == '..' || is_file($g['path_tmp'].'app/'.$package_folder.'/plugins/'.$filename.'/'.$filename1)) continue;
if(is_dir($g['path_plugin'].$filename.'/'.$filename1)) continue;
$plVersion = $filename1;
}
closedir($dirh1);
$_tmpdfile = $g['path_var'].'plugin.var.php';
$fp = fopen($_tmpdfile,'w');
fwrite($fp, "<?php\n");
foreach ($d['ov'] as $_key_ => $_val_)
{
fwrite($fp, "\$d['ov']['".$_key_."'] = '".trim($_val_)."';\n");
}
fwrite($fp, "\$d['ov']['".$filename."'] = '".$plVersion."';\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmpdfile,0707);
}
}
closedir($dirh);
}
//스위치설치
$_switchset = array('start','top','head','foot','end');
$newSwitches = array();
foreach ($_switchset as $_key)
{
if (is_dir($g['path_tmp'].'app/'.$package_folder.'/switches/'.$_key))
{
$dirh1 = opendir($g['path_tmp'].'app/'.$package_folder.'/switches/'.$_key);
while(false !== ($filename1 = readdir($dirh1)))
{
if($filename1 == '.' || $filename1 == '..') continue;
if(is_dir($g['path_switch'].$_key.'/'.$filename1)) continue;
$newSwitches[] = array($_key,$filename1);
}
closedir($dirh1);
}
}
if (count($newSwitches))
{
$_ufile = $g['path_var'].'switch.var.php';
$fp = fopen($_ufile,'w');
fwrite($fp, "<?php\n");
foreach ($_switchset as $_key)
{
foreach ($d['switch'][$_key] as $name => $sites)
{
fwrite($fp, "\$d['switch']['".$_key."']['".$name."'] = \"".$sites."\";\n");
}
}
foreach($newSwitches as $_val)
{
fwrite($fp, "\$d['switch']['".$_val[0]."']['".$_val[1]."'] = \"\";\n");
}
fwrite($fp, "?>");
fclose($fp);
@chmod($_ufile,0707);
}
//게시판 생성
if ($ACT_CBBS)
{
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.bbs.php';
$QKEY = "gid,site,id,name,category,num_r,d_last,d_regis,imghead,imgfoot,puthead,putfoot,addinfo,writecode";
foreach($d['package']['bbs'] as $R)
{
$maxgid = getDbCnt($table['bbslist'],'max(gid)','');
$QVAL = "'".($maxgid+1)."','".$S['uid']."','".$R['id']."','".$R['name']."','".$R['category']."','".$R['num_r']."','".$date['totime']."','".$date['totime']."','".$R['imghead']."','".$R['imgfoot']."','".$R['puthead']."','".$R['putfoot']."','".$R['addinfo']."','".$R['writecode']."'";
getDbInsert($table['bbslist'],$QKEY,$QVAL);
}
}
//추가 실행
if (is_file($g['path_tmp'].'app/'.$package_folder.'/_settings/run.php'))
{
include $g['path_tmp'].'app/'.$package_folder.'/_settings/run.php';
}
DirDelete($g['path_tmp'].'app/'.$package_folder.'/_settings');
$extPath = $g['path_tmp'].'app';
$extPath1= $extPath.'/'.$package_folder.'/';
$tgFolder= './';
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
getLink($g['s'].'/?r='.$r.'&iframe=Y&m=admin&module='.$m.'&front=modal.package&package_step=3&siteid='.$S['id'].'&site_name='.urlencode($S['name']).'&package_name='.urlencode($d['package']['name']),'parent.','','');
}
exit;
?>

View File

@@ -0,0 +1,93 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
$plVersion = $nameinfo[3];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_plugin'].$plFolder;
$plverPath = $plfldPath.'/'.$plVersion;
$tgFolder = $plverPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,10) != 'rb_plugin_')
{
getLink('reload','parent.','킴스큐 공식 플러그인 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
mkdir($plverPath,0707);
@chmod($plfldPath,0707);
@chmod($plverPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
if (!$plVersion)
{
$dirh = opendir($plfldPath);
while(false !== ($filename = readdir($dirh)))
{
if($filename == '.' || $filename == '..' || is_file($plfldPath.'/'.$filename)) continue;
$plVersion = $filename;
}
closedir($dirh);
}
if (!$d['ov'][$plFolder])
{
$_tmpdfile = $g['path_var'].'plugin.var.php';
$fp = fopen($_tmpdfile,'w');
fwrite($fp, "<?php\n");
foreach ($d['ov'] as $_key_ => $_val_)
{
fwrite($fp, "\$d['ov']['".$_key_."'] = '".trim($_val_)."';\n");
}
fwrite($fp, "\$d['ov']['".$plFolder."'] = '".$plVersion."';\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmpdfile,0707);
}
if (is_file($g['path_plugin'].$plFolder.'/size.txt'))
{
unlink($g['path_plugin'].$plFolder.'/size.txt');
}
}
else {
getLink('','','플러그인 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
// exit;
if ($reload == 'Y') getLink('reload',"parent.parent.",sprintf('플러그인[%s]이 추가되었습니다.',$plFolder.' - v.'.$plVersion),'');
else getLink('',"parent.parent.$('#modal_window').modal('hide');",sprintf('플러그인[%s]이 추가되었습니다.',$plFolder.' - v.'.$plVersion),'');
?>

View File

@@ -0,0 +1,81 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
$plVersion = $nameinfo[3];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_switch'].$plFolder;
$plverPath = $plfldPath.'/'.$plVersion;
$tgFolder = $plverPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,10) != 'rb_switch_')
{
getLink('reload','parent.','킴스큐 공식 스위치 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
mkdir($plverPath,0707);
@chmod($plfldPath,0707);
@chmod($plverPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
$_switchset = array('start','top','head','foot','end');
$_ufile = $g['path_var'].'switch.var.php';
$fp = fopen($_ufile,'w');
fwrite($fp, "<?php\n");
foreach ($_switchset as $_key)
{
foreach ($d['switch'][$_key] as $name => $sites)
{
fwrite($fp, "\$d['switch']['".$_key."']['".$name."'] = \"".$sites."\";\n");
}
}
fwrite($fp, "\$d['switch']['".$plFolder."']['".$plVersion."'] = \"\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_ufile,0707);
}
else {
getLink('','','스위치 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
// exit;
if ($reload == 'Y') getLink('reload',"parent.parent.",sprintf('스위치[%s]가 추가되었습니다.',$plFolder.'/'.$plVersion),'');
else getLink('',"parent.parent.$('#modal_window').modal('hide');",sprintf('스위치[%s]가 추가되었습니다.',$plFolder.'/'.$plVersion),'');
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$tmpname = $_FILES['upfile']['tmp_name'];
$realname = $_FILES['upfile']['name'];
$nameinfo = explode('_',str_replace('.zip','',$realname));
$plFolder = $nameinfo[2];
$plVersion = $nameinfo[3];
$fileExt = strtolower(getExt($realname));
$extPath = $g['path_tmp'].'app';
$extPath1 = $extPath.'/';
$saveFile = $extPath1.$date['totime'].'.zip';
$plfldPath = $g['path_widget'].$plFolder;
$plverPath = $plfldPath.'/'.$plVersion;
$tgFolder = $plverPath.'/';
if (is_uploaded_file($tmpname))
{
if ($fileExt != 'zip' || substr($realname,0,10) != 'rb_widget_')
{
getLink('reload','parent.','킴스큐 공식 위젯 파일이 아닙니다.','');
}
move_uploaded_file($tmpname,$saveFile);
require $g['path_core'].'function/dir.func.php';
$zip = new ZipArchive;
if ($zip->open($saveFile) === TRUE) {
$zip->extractTo($extPath1);
$zip->close();
} else {
echo 'failed';
}
unlink($saveFile);
mkdir($plfldPath,0707);
mkdir($plverPath,0707);
@chmod($plfldPath,0707);
@chmod($plverPath,0707);
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
}
else {
getLink('','','위젯 파일을 선택해 주세요.','');
}
?>
<script>
var pt = parent.parent.parent ? parent.parent.parent : parent.parent;
var ex = pt.location.href.split('&_admpnl_');
var gx = ex[0] + '&_admpnl_=' + escape(pt.frames._ADMPNL_.location.href);
pt.location.href = gx;
</script>
<?php
// exit;
if ($reload == 'Y') getLink('reload',"parent.parent.",'위젯이 추가되었습니다.','');
else getLink('',"parent.parent.$('#modal_window').modal('hide');",'위젯이 추가되었습니다.','');
?>

View File

@@ -0,0 +1,16 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$_tmpdfile = $g['path_var'].'/market.var.php';
$fp = fopen($_tmpdfile,'w');
fwrite($fp, "<?php\n");
fwrite($fp, "\$d['market']['userid'] = \"".$userid."\";\n");
fwrite($fp, "\$d['market']['key'] = \"".$key."\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmpdfile,0707);
setrawcookie('market_action_result', rawurlencode('입력하신 내용이 적용되었습니다.|success'));
getLink('reload','parent.','','');
?>

View File

@@ -0,0 +1,97 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$result=array();
$result['error']=false;
if(!$uid) {
$result['error']='잘못된 접근 입니다.';
echo json_encode($result);
exit;
}
include $g['path_module'].$m.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if ($d['market']['url']) {
include $g['path_core'].'function/rss.func.php';
$returnData = getUrlData($d['market']['url'].'&iframe=Y&page=client.delete_install&uid='.$uid.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$pathData = explode('[PATH:',$returnData);
$pathData = explode(':PATH]',$pathData[1]);
$path = $pathData[0];
$path_arr = explode(',',$path);
$path = $path_arr[0];
$folder = $path_arr[1];
$_path_arr = explode('/',$path);
$ext = $_path_arr[0];
$returnData = explode('[RESULT:',$returnData);
$returnData = explode(':RESULT]',$returnData[1]);
$return = $returnData[0];
} else {
$result['error']='마켓 접속정보를 확인해주세요.';
echo json_encode($result);
exit;
}
if ($return != 'OK') {
$result['error']=' 다시 시도해주세요.'.$return;
} else {
// 모듈일 경우 DB 테이블 삭제
if ($ext=='modules') {
$moduleid = $folder;
$R = getDbData($table['s_module'],"id='".$moduleid."'",'*');
getDbDelete($table['s_module'],"id='".$moduleid."'");
$table_db = $g['path_module'].$moduleid.'/_setting/db.table.php.done';
$_tmptfile = $g['path_var'].'table.info.php';
if(is_file($table_db)) {
$module= $moduleid;
$_table= $table;
$table = array();
include_once $table_db;
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_table as $key => $val)
{
if (!$table[$key])
{
fwrite($fp, "\$table['$key'] = \"$val\";\n");
}
}
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
foreach($table as $key => $val) {
db_query('drop table '.$val,$DB_CONNECT);
}
}
setrawcookie('market_action_result', rawurlencode('모듈이 삭제 되었습니다.'));
}
// 폴더삭제
$command_delete = 'rm -rf '.$path.'/'.$folder;
shell_exec($command_delete);
}
$result['ext']=$ext;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,31 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
require $g['path_core'].'opensrc/unzip/ArchiveExtractor.class.php';
require $g['path_core'].'function/dir.func.php';
include $g['path_core'].'function/rss.func.php';
$rbPackage = getUrlData('http://download.kimsq.co.kr/__update/package/'.$package.'.zip',10);
if (!trim($rbPackage))
{
echo '<script>';
echo "parent.alert('다운로드 실패 ');";
echo '</script>';
exit;
}
$rbPackageFile = $g['path_tmp'].'app/'.$package.'.zip';
$fp = fopen($rbPackageFile,'w');
fwrite($fp,$rbPackage);
fclose($fp);
$extractor = new ArchiveExtractor();
$extractor -> extractArchive($rbPackageFile,$g['path_tmp'].'app/'.$package.'/');
DirChmod($g['path_tmp'].'app/',0707);
unlink($rbPackageFile);
getLink($g['s'].'/?r='.$r.'&iframe=Y&m=admin&module='.$m.'&front=modal.package&package_step=2&package_folder='.$package,'parent.','','');
?>

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$result=array();
$result['error']=false;
include $g['path_module'].$m.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if ($d['market']['url']) {
include $g['path_core'].'function/rss.func.php';
$packageData = getUrlData($d['market']['url'].'&iframe=Y&page=client.get_goodsData&_clientu='.$g['s'].'&_clientr='.$r.'&goods='.$goods.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'].'&ip='.$_SERVER['REMOTE_ADDR'],10);
$_contentData = explode('[CONTENT:',$packageData);
$_contentData = explode(':CONTENT]',$_contentData[1]);
$_contentData = $_contentData[0];
$_galleryData = explode('[GALLERY:',$packageData);
$_galleryData = explode(':GALLERY]', $_galleryData[1]);
$_galleryData = $_galleryData[0];
$_reviewData = explode('[REVIEW:',$packageData);
$_reviewData = explode(':REVIEW]',$_reviewData[1]);
$_reviewData = $_reviewData[0];
$_extData = explode('[LIST:',$packageData);
$_extData = explode(':LIST]',$_extData[1]);
$_extList = $_extData[0];
$_demoData = explode('[DEMO:',$packageData);
$_demoData = explode(':DEMO]',$_demoData[1]);
$_demoData = $_demoData[0];
$_asideData = explode('[ASIDE:',$packageData);
$_asideData = explode(':ASIDE]',$_asideData[1]);
$_asideData = $_asideData[0];
} else {
$result['error']='마켓 접속정보를 확인해주세요.';
echo json_encode($result);
exit;
}
$result['content'] = $_contentData;
$result['gallery'] = $_galleryData;
$result['list'] = $_extList;
$result['review'] = $_reviewData;
$result['demo'] = $_demoData;
$result['aside'] = $_asideData;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,35 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$result=array();
$result['error']=false;
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.php';
$site_list='';
$_SITES_ALL = getDbArray($table['s_site'],'','*','gid','asc',0,1);
while ($_R = db_fetch_array($_SITES_ALL)) {
$site_list.='<option value="'.$_R['uid'].'">'.$_R['name'].'</option>';
}
$option='';
foreach ($d['package']['execute'] as $_key => $_val) {
$option.= '<div class="custom-control custom-checkbox">';
$option.= '<input type="checkbox" class="custom-control-input" id="ACT_'.$_val[0].'" name="ACT_'.$_val[0].'" value="1" '.($_val[2]?' checked':'').'>';
$option.= '<label class="custom-control-label" for="ACT_'.$_val[0].'">'.$_val[1].'</label>';
$option.= '</div>';
}
if (is_file($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt')) {
$readme = json_decode(file_get_contents($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt'), true);
}
$result['name']=$d['package']['name'];
$result['site_list'] = $site_list;
$result['option'] = $option;
$result['readme'] = $readme;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,102 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$result=array();
$result['error']=false;
if(!is_dir($path)) {
$result['error']=$path.' 추가할 경로를 확인해주세요.';
echo json_encode($result);
exit;
}
if(is_dir($path.'/'.$folder)) {
$result['error']='이미 추가되어 있습니다.';
echo json_encode($result);
exit;
}
include $g['path_module'].$m.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if ($d['market']['url']) {
include $g['path_core'].'function/rss.func.php';
$repoData = getUrlData($d['market']['url'].'&iframe=Y&page=client.check_clone&_clientu='.$g['s'].'&_clientr='.$r.'&goods='.$goods.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'].'&ip='.$_SERVER['REMOTE_ADDR'],10);
$ownerData = explode('[OWNER:',$repoData);
$ownerData = explode(':OWNER]',$ownerData[1]);
$owner = $ownerData[0];
$nameData = explode('[NAME:',$repoData);
$nameData = explode(':NAME]',$nameData[1]);
$name = $nameData[0];
$tokenData = explode('[TOKEN:',$repoData);
$tokenData = explode(':TOKEN]',$tokenData[1]);
$token = $tokenData[0];
} else {
$result['error']='마켓 접속정보를 확인해주세요.';
echo json_encode($result);
exit;
}
if ($token) {
$git = 'https://'.$token.'@github.com/'.$owner.'/'.$name.'.git';
} else {
$git = 'https://github.com/'.$owner.'/'.$name.'.git';
}
$command = 'cd '.$path.' && git clone '.$git.' '.$folder;
exec($command,$command_output,$command_return);
if ($command_return != 0) {
$result['error']=$command.' 실패 했습니다.';
}
// 모듈일 경우 DB테이블 생성
if ($path=='modules') {
$module = $folder;
$_tmptable2 = $table;
$table = array();
$table_db = $g['path_module'].$module.'/_setting/db.table.php';
$table_sc = $g['path_module'].$module.'/_setting/db.schema.php';
if(is_file($table_db)) {
$_tmptable1 = array();
$_tmptfile = $g['path_var'].'table.info.php';
include $table_db;
include $table_sc;
$_tmptable1 = $table;
rename($table_db,$table_db.'.done');
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_tmptable2 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
foreach($_tmptable1 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
}
else {
if(is_file($table_db.'.done')) include $table_db.'.done';
}
$maxgid = getDbCnt($_tmptable2['s_module'],'max(gid)','');
$QKEY = "gid,sys,hidden,mobile,name,id,tblnum,icon,d_regis";
$QVAL = "'".($maxgid+1)."','0','0','1','".getFolderName($g['path_module'].$module)."','$module','".count($table)."','kf-module','".$date['totime']."'";
getDbInsert($_tmptable2['s_module'],$QKEY,$QVAL);
setrawcookie('market_action_result', rawurlencode('모듈이 설치 되었습니다.'));
}
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,367 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$result=array();
$result['error']=false;
require $g['path_core'].'function/dir.func.php';
if ($package_step == 1) {
$appPath = $g['path_tmp'].'app';
DirDelete($appPath);
mkdir($appPath,0707);
@chmod($appPath,0707);
include $g['path_module'].$m.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if ($d['market']['url']) {
include $g['path_core'].'function/rss.func.php';
$packageData = getUrlData($d['market']['url'].'&iframe=Y&page=client.check_package&_clientu='.$g['s'].'&_clientr='.$r.'&package='.$package.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'].'&ip='.$_SERVER['REMOTE_ADDR'],10);
$_installData = explode('[PACK:',$packageData);
$_installData = explode(':PACK]',$_installData[1]);
$_installData = $_installData[0];
$_extData = explode('[LIST:',$packageData);
$_extData = explode(':LIST]',$_extData[1]);
$_extData = $_extData[0];
$_extarr = getArrayString($_extData);
//$_extnum = $_extarr[count];
//$_extper = (100/$_extnum)/100;
$list;
// $_i=0;
if ($_extData) {
foreach ($_extarr['data'] as $_val) {
$extData =explode(',' , $_val);
$path = $extData[0];
$folder = $extData[1];
$name = $extData[2];
$owner = $extData[3];
$token = $extData[4];
$_i++;
//$process = $_extper*$_i;
if(is_dir($path.'/'.$folder)) continue;
if ($token) {
$git = 'https://'.$token.'@github.com/'.$owner.'/'.$name.'.git';
} else {
$git = 'https://github.com/'.$owner.'/'.$name.'.git';
}
$command = 'cd '.$path.' && git clone '.$git.' '.$folder;
exec($command,$command_output,$command_return);
if ($command_return != 0) {
$result['error']=$command.'실패 했습니다.';
}
// 모듈일 경우 DB테이블 생성
if ($path=='modules') {
$module = $folder;
$_tmptable2 = $table;
$table = array();
$table_db = $g['path_module'].$module.'/_setting/db.table.php';
$table_sc = $g['path_module'].$module.'/_setting/db.schema.php';
if(is_file($table_db)) {
$_tmptable1 = array();
$_tmptfile = $g['path_var'].'table.info.php';
include $table_db;
include $table_sc;
$_tmptable1 = $table;
rename($table_db,$table_db.'.done');
$fp = fopen($_tmptfile,'w');
fwrite($fp, "<?php\n");
foreach($_tmptable2 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
foreach($_tmptable1 as $key => $val) fwrite($fp, "\$table['$key'] = \"$val\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmptfile,0707);
}
else {
if(is_file($table_db.'.done')) include $table_db.'.done';
}
$maxgid = getDbCnt($_tmptable2['s_module'],'max(gid)','');
$QKEY = "gid,system,hidden,mobile,name,id,tblnum,icon,d_regis";
$QVAL = "'".($maxgid+1)."','0','0','1','".getFolderName($g['path_module'].$module)."','$module','".count($table)."','kf-module','".$date['totime']."'";
getDbInsert($_tmptable2['s_module'],$QKEY,$QVAL);
}
// echo '<script type="text/javascript">';
// echo 'parent.progress.circleProgress("value", '.$process.');';
// echo '</script>';
}
}
if ($_installData) {
$insData =explode(',' , $_installData);
$_name = $insData[0];
$_owner = $insData[1];
$_token = $insData[2];
if ($_token) {
$_git = 'https://'.$_token.'@github.com/'.$_owner.'/'.$_name.'.git';
} else {
$_git = 'https://github.com/'.$_owner.'/'.$_name.'.git';
}
$_path = $g['path_tmp'].'app';
$package_folder = 'package-'.$date['totime'];
$_command = 'cd '.$_path.' && git clone '.$_git.' '.$package_folder;
exec($_command,$_command_output,$_command_return);
if ($_command_return != 0) {
$result['error']=$_command.'실패 했습니다.';
}
}
} else {
$result['error']='마켓 접속정보를 확인해주세요.';
echo json_encode($result);
exit;
}
$result['package_folder']=$package_folder;
}
if ($package_step == 2) {
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.php';
if($siteuid) {
$S = getUidData($table['s_site'],$siteuid);
getDbUpdate($table['s_site'],"layout='".$d['package']['layout']."',m_layout='".$d['package']['layout_mobile']."',rewrite='".$d['package']['rewrite']."'",'uid='.$S['uid']);
//기존메뉴삭제
if ($ACT_DM) {
$_MENUS = getDbSelect($table['s_menu'],'site='.$S['uid'].' order by gid asc','*');
while($_M = db_fetch_array($_MENUS)) {
@unlink($g['path_var'].'menu/'.$_M['imghead']);
@unlink($g['path_var'].'menu/'.$_M['imgfoot']);
getDbDelete($table['s_seo'],'rel=1 and parent='.$_M['uid']);
}
getDbDelete($table['s_menu'],'site='.$S['uid']);
db_query("OPTIMIZE TABLE ".$table['s_menu'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table['s_seo'],$DB_CONNECT);
DirDelete($g['path_page'].$S['id'].'-menus');
}
//기존페이지삭제
if ($ACT_DP) {
$_PAGES = getDbSelect($table['s_page'],'site='.$S['uid'].' order by uid asc','*');
while($_P = db_fetch_array($_PAGES)) {
getDbDelete($table['s_seo'],'rel=2 and parent='.$_P['uid']);
}
getDbDelete($table['s_page'],'site='.$S['uid']);
db_query("OPTIMIZE TABLE ".$table['s_page'],$DB_CONNECT);
db_query("OPTIMIZE TABLE ".$table['s_seo'],$DB_CONNECT);
DirDelete($g['path_page'].$S['id'].'-pages');
}
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-menus',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$S['id'].'-menus');
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-pages',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$S['id'].'-pages');
@rename($g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$d['package']['siteid'],$g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$S['id']);
}
else {
$MAXC = getDbCnt($table['s_site'],'max(gid)','');
$gid = $MAXC + 1;
$id_exist = getDbRows($table['s_site'],'id="'.$d['package']['id'].'"');
if (!$id_exist) {
$id = $d['package']['id'];
$name = $d['package']['name'];
$label = $d['package']['name'];
} else {
$id = $d['package']['id'].$gid;
$name = $d['package']['name'].$gid;
$label = $d['package']['name'].$gid;
}
$QKEY = "gid,id,name,label,title,titlefix,icon,layout,startpage,m_layout,m_startpage,lang,open,dtd,nametype,timecal,rewrite,buffer,usescode,headercode,footercode";
$QVAL = "'".$gid."','".$id."','".$name."','".$label."','{subject} | {site}','0','fa fa-home','".$d['package']['layout']."','".$d['package']['startpage']."','".$d['package']['layout_mobile']."','".$d['package']['startpage']."','','1','','nic','0','".$d['package']['rewrite']."','0','1','',''";
getDbInsert($table['s_site'],$QKEY,$QVAL);
$LASTUID = getDbCnt($table['s_site'],'max(uid)','');
db_query("OPTIMIZE TABLE ".$table['s_site'],$DB_CONNECT);
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'0','$LASTUID','','','','ALL',''");
$vfile = $g['path_var'].'sitephp/'.$LASTUID.'.php';
$fp = fopen($vfile,'w');
fwrite($fp,'');
fclose($fp);
@chmod($vfile,0707);
mkdir($g['path_var'].'site/'.$id,0707);
@chmod($g['path_var'].'site/'.$id,0707);
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-menus',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$id.'-menus');
@rename($g['path_tmp'].'app/'.$package_folder.'/pages/'.$d['package']['siteid'].'-pages',$g['path_tmp'].'app/'.$package_folder.'/pages/'.$id.'-pages');
@rename($g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$d['package']['siteid'],$g['path_tmp'].'app/'.$package_folder.'/_var/site/'.$id);
$S = getUidData($table['s_site'],$LASTUID);
}
//메뉴생성
if ($ACT_CM) {
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.menu.php';
$QKEY = "gid,site,is_child,parent,depth,id,menutype,mobile,hidden,reject,name,target,redirect,joint,perm_g,perm_l,layout,m_layout,imghead,imgfoot,imgicon,addattr,num,d_last,addinfo,upload";
foreach($d['package']['menus'] as $R)
{
$_parent = 0;
if ($R['parent'])
{
$_PRTUID = getDbData($table['s_menu'],'site='.$S['uid']." and id='".$R['parent']."'",'uid');
$_parent = $_PRTUID['uid'];
}
$QVAL = "'".$R['gid']."','".$S['uid']."','".$R['is_child']."','".$_parent."','".$R['depth']."','".$R['id']."','".$R['menutype']."','".$R['mobile']."','".$R['hidden']."','0','".$R['name']."','".$R['target']."','".$R['redirect']."','".$R['joint']."','','0','".$R['layout']."','".$R['m_layout']."','".$R['imghead']."','".$R['imgfoot']."','".$R['imgicon']."','".$R['addattr']."','0','','".$R['addinfo']."','".$R['upload']."'";
getDbInsert($table['s_menu'],$QKEY,$QVAL);
$lastmenu = getDbCnt($table['s_menu'],'max(uid)','');
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'1','$lastmenu','','','','ALL',''");
}
}
//페이지생성
if ($ACT_CP) {
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.page.php';
$QKEY = "site,pagetype,ismain,mobile,id,category,name,perm_g,perm_l,layout,m_layout,joint,hit,linkedmenu,d_regis,d_last,upload,featured_img,member,extra";
foreach($d['package']['pages'] as $R)
{
if (is_file($g['path_page'].$S['id'].'-pages/'.$R['id'].'.php')) continue;
$QVAL = "'".$S['uid']."','".$R['pagetype']."','".$R['ismain']."','".$R['mobile']."','".$R['id']."','".$R['category']."','".$R['name']."','','0','".$R['layout']."','".$R['m_layout']."','".$R['joint']."','0','".$R['linkedmenu']."','".$date['totime']."','".$date['totime']."','".$R['upload']."','".$R['featured_img']."','1',''";
getDbInsert($table['s_page'],$QKEY,$QVAL);
$lastpage = getDbCnt($table['s_page'],'max(uid)','');
getDbInsert($table['s_seo'],'rel,parent,title,keywords,description,classification,image_src',"'2','$lastpage','','','','ALL',''");
}
}
//메인페이지 지정
$MP = getDbData($table['s_page'],"ismain=1 and site=".$S['uid'],'uid');
if ($MP['uid']) {
getDbUpdate($table['s_site'],"startpage='".$MP['uid']."',m_startpage=''",'uid='.$S['uid']);
}
//플러그인설치
if (is_dir($g['path_tmp'].'app/'.$package_folder.'/plugins')) {
$dirh = opendir($g['path_tmp'].'app/'.$package_folder.'/plugins');
while(false !== ($filename = readdir($dirh)))
{
if($filename == '.' || $filename == '..') continue;
if (is_dir($g['path_plugin'].$filename)) continue;
if (!$d['ov'][$filename])
{
$plVersion = '';
$dirh1 = opendir($g['path_tmp'].'app/'.$package_folder.'/plugins/'.$filename);
while(false !== ($filename1 = readdir($dirh1)))
{
if($filename1 == '.' || $filename1 == '..' || is_file($g['path_tmp'].'app/'.$package_folder.'/plugins/'.$filename.'/'.$filename1)) continue;
if(is_dir($g['path_plugin'].$filename.'/'.$filename1)) continue;
$plVersion = $filename1;
}
closedir($dirh1);
$_tmpdfile = $g['path_var'].'plugin.var.php';
$fp = fopen($_tmpdfile,'w');
fwrite($fp, "<?php\n");
foreach ($d['ov'] as $_key_ => $_val_)
{
fwrite($fp, "\$d['ov']['".$_key_."'] = '".trim($_val_)."';\n");
}
fwrite($fp, "\$d['ov']['".$filename."'] = '".$plVersion."';\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmpdfile,0707);
}
}
closedir($dirh);
}
//스위치설치
$_switchset = array('start','top','head','foot','end');
$newSwitches = array();
foreach ($_switchset as $_key) {
if (is_dir($g['path_tmp'].'app/'.$package_folder.'/switches/'.$_key)) {
$dirh1 = opendir($g['path_tmp'].'app/'.$package_folder.'/switches/'.$_key);
while(false !== ($filename1 = readdir($dirh1))) {
if($filename1 == '.' || $filename1 == '..') continue;
if(is_dir($g['path_switch'].$_key.'/'.$filename1)) continue;
$newSwitches[] = array($_key,$filename1);
}
closedir($dirh1);
}
}
if (count($newSwitches)) {
$_ufile = $g['path_var'].'switch.var.php';
$fp = fopen($_ufile,'w');
fwrite($fp, "<?php\n");
foreach ($_switchset as $_key) {
foreach ($d['switch'][$_key] as $name => $sites) {
fwrite($fp, "\$d['switch']['".$_key."']['".$name."'] = \"".$sites."\";\n");
}
}
foreach($newSwitches as $_val) {
fwrite($fp, "\$d['switch']['".$_val[0]."']['".$_val[1]."'] = \"\";\n");
}
fwrite($fp, "?>");
fclose($fp);
@chmod($_ufile,0707);
}
//게시판 생성
if ($ACT_CBBS) {
include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.bbs.php';
$QKEY = "gid,site,id,name,category,num_r,d_last,d_regis,imghead,imgfoot,puthead,putfoot,addinfo,writecode";
foreach($d['package']['bbs'] as $R)
{
$maxgid = getDbCnt($table['bbslist'],'max(gid)','');
$QVAL = "'".($maxgid+1)."','".$S['uid']."','".$R['id']."','".$R['name']."','".$R['category']."','".$R['num_r']."','".$date['totime']."','".$date['totime']."','".$R['imghead']."','".$R['imgfoot']."','".$R['puthead']."','".$R['putfoot']."','".$R['addinfo']."','".$R['writecode']."'";
getDbInsert($table['bbslist'],$QKEY,$QVAL);
}
}
//추가 실행
if (is_file($g['path_tmp'].'app/'.$package_folder.'/_settings/run.php')) {
include $g['path_tmp'].'app/'.$package_folder.'/_settings/run.php';
}
DirDelete($g['path_tmp'].'app/'.$package_folder.'/.git');
DirDelete($g['path_tmp'].'app/'.$package_folder.'/_settings');
$extPath = $g['path_tmp'].'app';
$extPath1= $extPath.'/'.$package_folder.'/';
$tgFolder= './';
DirCopy($extPath1,$tgFolder);
DirDelete($extPath);
mkdir($extPath,0707);
@chmod($extPath,0707);
$result['siteid']=$S['id'];
$result['site_name']=$S['name'];
$result['package_name']=$d['package']['name'];
}
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,123 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
include $g['path_core'].'function/rss.func.php';
include $g['path_module'].$m.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
$result=array();
$result['error']=false;
if(!$uid) {
$result['error']='잘못된 접근 입니다.';
echo json_encode($result);
exit;
}
if ($d['market']['url']) {
$returnData = getUrlData($d['market']['url'].'&iframe=Y&page=_client.gitinfo&uid='.$uid.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$ownerData = explode('[OWNER:',$returnData);
$ownerData = explode(':OWNER]',$ownerData[1]);
$owner = $ownerData[0];
$nameData = explode('[NAME:',$returnData);
$nameData = explode(':NAME]',$nameData[1]);
$name = $nameData[0];
$tokenData = explode('[TOKEN:',$returnData);
$tokenData = explode(':TOKEN]',$tokenData[1]);
$token = $tokenData[0];
if ($owner && $name) {
$dir = $path.'/'.$folder;
if (!is_dir($dir)) {
$result['error']='[에러] 경로를 확인해주세요.';
echo json_encode($result);
exit;
}
$command_reset = 'cd '.$dir.' && git reset --hard';
$command_pull = 'cd '.$dir.' && git pull origin master';
$d_regis = $date['totime'];
$version = $version_install.'->'.$version_goods;
$output_pull;
$return_pull;
if ($token) {
if (!$token) {
$result['error']='[!TOKEN] 저장소연결에 실패했습니다.';
echo json_encode($result);
exit;
}
$remote = 'https://'.$token.'@github.com/'.$owner.'/'.$name.'.git';
$command_remote = 'cd '.$dir.' && git remote set-url origin '.$remote;
} else {
$remote = 'https://github.com/'.$owner.'/'.$name.'.git';
$command_remote = 'cd '.$dir.' && git remote set-url origin '.$remote;
}
// git 명령어 실행
shell_exec($command_remote);
shell_exec($command_reset);
$output_pull = shell_exec($command_pull);
} else {
$result['error']='[!REMOTE] 저장소연결에 실패했습니다.';
echo json_encode($result);
exit;
}
//git 명령어 실행결과 log 저장
$command = $command_remote.' '.$command_reset.' '.$command_pull;
$mbruid = $my['uid'];
if ($g['mobile']&&$_SESSION['pcmode']!='Y') {
$msg_type = 'default';
} else {
$msg_type = 'success';
}
// 임시-필드 없는 경우, 생성
$_tmp1 = db_query("SHOW COLUMNS FROM ".$table['s_gitlog']." WHERE `Field` = 'ext'",$DB_CONNECT);
if(!db_num_rows($_tmp1)) {
$_tmp1 = ("alter table ".$table['s_gitlog']." ADD ext VARCHAR(30) DEFAULT '' NOT NULL");
db_query($_tmp1, $DB_CONNECT);
}
$_tmp2 = db_query("SHOW COLUMNS FROM ".$table['s_gitlog']." WHERE `Field` = 'target'",$DB_CONNECT);
if(!db_num_rows($_tmp2)) {
$_tmp2 = ("alter table ".$table['s_gitlog']." ADD target VARCHAR(100) DEFAULT '' NOT NULL");
db_query($_tmp2, $DB_CONNECT);
}
if(strpos($output_pull, 'Already up-to-date.') !== false) {
$output_pull = '변경사항이 없습니다.';
}
getDbInsert($table['s_gitlog'],'ext,target,mbruid,remote,command,version,output,d_regis',"'$path','$folder','$mbruid','$remote','$command','$version','$output_pull','$d_regis'");
//마켓설치 정보 버전 및 갱신날짜 업데이트
$returnData = getUrlData($d['market']['url'].'&iframe=Y&page=_client.update&uid='.$uid.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$returnData = explode('[RESULT:',$returnData);
$returnData = explode(':RESULT]',$returnData[1]);
$return = $returnData[0];
if ($return != 'OK') {
$result['error']=' 다시 시도해주세요.'.$return;
} else {
$msg = '업데이트 완료|'.$msg_type;
setrawcookie('market_action_result', rawurlencode($msg));
}
} else {
$result['error']='마켓 접속정보를 확인해주세요.';
}
echo json_encode($result);
exit;
?>

4
modules/market/admin.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
if(!defined('__KIMS__')) exit;
include $g['path_module'].$module.'/admin/'.$front.'.php';
?>

View File

@@ -0,0 +1,17 @@
<div class="p-4">
<div class="text-center text-muted d-flex align-items-center justify-content-center" style="height: calc(100vh - 10rem);">
<div><i class="fa fa-exclamation-circle fa-3x mb-3" aria-hidden="true"></i>
<p>마켓설정이 필요합니다.</p>
<small>
프로젝트 키는 프로젝트의 정식판 여부를 확인하여 마켓이용과 지원에 활용됩니다. <br>
key가 맞지 않거나 분실시에는 kimsq.com 로그인 , 나의 프로젝트 페이지에서 확인할 있습니다.
</small>
<div class="mt-4">
<a href="<?php echo $g['s']?>/?r=<?php echo $r?>&amp;m=<?php echo $m?>&amp;module=<?php echo $module?>&amp;front=config" class="btn btn-outline-primary btn-block">
설정하기
</a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<?php
$license_local = $g['path_module'].$module.'/LICENSE';
$license_global = $g['path_root'].'LICENSE';
if (file_exists($license_local)) $license = $license_local;
else $license = $license_global;
?>
<link href="<?php echo $g['s']?>/_core/css/github-markdown.css" rel="stylesheet">
<?php getImport('jquery-markdown','jquery.markdown','0.0.10','js')?>
<?php @include $g['path_module'].$module.'/var/var.moduleinfo.php' ?>
<article class="rb-docs markdown-body px-5 pt-3">
<h1><?php echo sprintf('%s 모듈정보',ucfirst($MD['name']))?></h1>
<div class="pb-5 readme">
<?php readfile($g['path_module'].$module.'/README.md')?>
</div>
<div class="pb-5">
<h2>라이센스</h2>
<textarea class="form-control" rows="10"><?php readfile($license)?></textarea>
</div>
</article>
<script type="text/javascript">
$(".markdown-body .readme").markdown();
</script>

View File

@@ -0,0 +1,16 @@
.svc_free {
background-color: #ffc107;
color: #222
}
.svc_standard {
background-color: #007bff;
color: #fff
}
.svc_economy{
background-color: #28a745;
color: #fff
}
.svc_premium {
background-color: #563d7c;
color: #fff
}

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.brand&_clientu='.$g['s'].'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.buyer&_clientu='.$g['s'].'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,61 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
?>
<div id="configbox" class="p-4">
<form name="procForm" action="<?php echo $g['s']?>/" method="post" target="_action_frame_<?php echo $m ?>" onsubmit="return saveCheck(this);" class="form-horizontal" autocomplete="off">
<input type="hidden" name="r" value="<?php echo $r ?>">
<input type="hidden" name="m" value="<?php echo $module ?>">
<input type="hidden" name="a" value="config">
<h4>큐마켓 연결설정</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label pt-3">킴스큐 회원 아이디 또는 이메일</label>
<div class="col-lg-10 col-xl-8">
<input class="form-control form-control-lg" type="text" name="userid" value="<?php echo $d['market']['userid']?$d['market']['userid']:'' ?>" required>
<small class="form-text text-muted">
<a href="https://kimsq.com" target="_blank">킴스큐 포탈</a> 회원 아이디 또는 이메일
</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label pt-3">프로젝트 키</label>
<div class="col-lg-10 col-xl-8">
<input class="form-control form-control-lg" type="text" name="key" value="<?php echo $d['market']['key']?$d['market']['key']:'' ?>" required>
<small class="form-text text-muted">
<a href="https://kimsq.com/project/my" target="_blank">내 프로젝트</a>에 접속하여 키를 확인할 수 있습니다.
</small>
</div>
</div>
<div class="form-group form-row">
<div class="offset-sm-2 col-sm-10">
<button type="submit" class="btn btn-primary btn-lg<?php if($g['device']):?> btn-block<?php endif?>">저장하기</button>
<div class="mt-4">
<small class="text-muted">
프로젝트 키는 프로젝트의 정식판 여부를 확인하여 마켓이용과 지원에 활용됩니다.
<a href="https://kimsq.com/docs/c/start/market" class="btn btn-light btn-sm" target="_blank">도움말</a>
</small>
</div>
</div>
</div>
</form>
</div>
<script>
putCookieAlert('market_action_result') // 실행결과 알림 메시지 출력
function saveCheck(f) {
getIframeForAction(f);
return true;
}
</script>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.front&package=0&_clientu='.$g['s'].($goods?'&goods='.$goods:'').'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.front&package=1&_clientu='.$g['s'].($goods?'&goods='.$goods:'').'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,128 @@
<?php
$addExtensionSet = array
(
'module' => array('모듈',$g['path_module'],'rb_module_모듈폴더명.zip'),
'layout' => array('레이아웃',$g['path_layout'],'rb_layout_레이아웃폴더명.zip'),
'widget' => array('위젯',$g['path_widget'],'rb_widget_위젯분류폴더명_위젯폴더명.zip'),
'switch' => array('스위치',$g['path_switch'],'rb_switch_스위치종류_스위치폴더명.zip'),
'plugin' => array('플러그인',$g['path_plugin'],'rb_plugin_플러그인폴더명_버전.zip'),
'dashboard' => array('대시보드',$g['path_module'].'dashboard/widgets','rb_dashboard_대시보드폴더명.zip'),
'etc' => array('기타자료','/root/','rb_etc_자료명.zip'),
);
?>
<form name="_upload_form_" action="<?php echo $g['s']?>/" method="post" enctype="multipart/form-data">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="add_<?php echo $addType?>">
<input type="hidden" name="reload" value="<?php echo $reload?>">
<div class="modal-body bg-white">
<div class="py-5">
<div id="uplocation" class="mb-3">
<code>업로드 위치 : <?php echo str_replace('./','/root/',$addExtensionSet[$addType][1])?></code>
</div>
<input type="file" name="upfile" id="packageupfile" class="hidden" onchange="progressbar();">
<button type="button" class="btn btn-secondary btn-block" id="fileselectbtn" onclick="$('#packageupfile').click();">파일선택</button>
</div>
<hr>
<div class="progress progress-striped active hidden" id="progress-bar">
<div class="progress-bar" role="progressbar" aria-valuemax="100"></div>
</div>
<ul class="list-unstyled mt-4 text-secondary">
<li><?php echo sprintf('킴스큐에서 제공하는 공식 %s만 업로드할 수 있습니다.',$addExtensionSet[$addType][0])?></li>
<li><?php echo sprintf('파일형식은 <code>%s</strong></code> 이어야 합니다.',$addExtensionSet[$addType][2])?></li>
<li><?php echo 'FTP로 직접 추가하시려면 매뉴얼에 따라 추가해 주세요.'?></li>
<li><?php echo sprintf('이미 같은명칭의 %s 폴더가 존재할 경우 덧씌워지니 주의하세요.',$addExtensionSet[$addType][0])?></li>
</ul>
</div>
</form>
<!-- @부모레이어를 제어할 수 있도록 모달의 헤더와 풋터를 부모레이어에 출력시킴 -->
<div id="_modal_header" hidden>
<h5 class="modal-title" id="myModalLabel">
<i class="fa fa-upload fa-lg"></i> <?php echo sprintf('%s 추가',$addExtensionSet[$addType][0])?>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="_modal_footer" hidden>
<button class="btn btn-light pull-left" data-dismiss="modal" type="button">취소</button>
<button class="btn btn-primary" type="button" onclick="frames._modal_iframe_modal_window.getFiles();" id="afterChooseFileNext" disabled>추가하기</button>
</div>
<script>
var _per = 0;
function progressbar()
{
if(_per == 0)
{
$('#progress-bar').removeClass('hidden');
$('#uplocation').addClass('hidden');
}
if (_per < 100)
{
_per = _per + 10;
getId('progress-bar').children[0].style.width = (_per>100?100:_per)+ '%';
setTimeout("progressbar();",100);
}
else {
parent.getId('afterChooseFileNext').disabled = false;
_per = 0;
}
}
function getFiles()
{
var f = document._upload_form_;
if (f.upfile.value == '')
{
alert('파일이 선택되지 않았습니다. ');
return false;
}
getIframeForAction(f);
f.submit();
parent.getId('afterChooseFileNext').innerHTML = '<i class="fa fa-spinner fa-lg fa-spin fa-fw"></i> Uploading ...';
parent.getId('afterChooseFileNext').disabled = true;
}
function modalSetting()
{
parent.getId('modal_window_dialog_modal_window').style.width = '100%';
parent.getId('modal_window_dialog_modal_window').style.paddingRight = '20px';
parent.getId('modal_window_dialog_modal_window').style.maxWidth = '800px';
parent.getId('_modal_iframe_modal_window').style.height = '330px'
parent.getId('_modal_body_modal_window').style.height = '330px';
parent.getId('_modal_header_modal_window').innerHTML = getId('_modal_header').innerHTML;
parent.getId('_modal_header_modal_window').className = 'modal-header';
parent.getId('_modal_body_modal_window').style.padding = '0';
parent.getId('_modal_body_modal_window').style.margin = '0';
parent.getId('_modal_footer_modal_window').innerHTML = getId('_modal_footer').innerHTML;
parent.getId('_modal_footer_modal_window').className = 'modal-footer';
}
document.body.onresize = document.body.onload = function()
{
setTimeout("modalSetting();",100);
setTimeout("modalSetting();",200);
}
</script>
<style>
body {
background: #fff;
}
</style>

View File

@@ -0,0 +1,426 @@
<?php $package_step = $package_step ? $package_step : 1?>
<div id="modal-package-install">
<div class="modal-body bg-white">
<div class="p-3">
<ul class="list-inline mb-0">
<li class="list-inline-item<?php if($package_step==1):?> active<?php endif?>"><span class="badge badge-secondary">Step 1</span> <span><?php echo '패키지 업로드'?></span></li>
<li class="list-inline-item<?php if($package_step==2):?> active<?php endif?>"><span class="badge badge-secondary">Step 2</span> <span><?php echo '설치하기'?></span></li>
<li class="list-inline-item<?php if($package_step==3):?> active<?php endif?>"><span class="badge badge-secondary">Step 3</span> <span><?php echo '완료'?></span></li>
</ul>
</div>
<div class="tab-content">
<?php if($package_step==1):?>
<div id="tab1">
<form name="_upload_form_" action="<?php echo $g['s']?>/" method="post" enctype="multipart/form-data">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="add_package">
<input type="hidden" name="package_step" value="<?php echo $package_step?>">
<div class="row">
<div class="col-sm-4 text-center rb-icon">
<i class="fa fa-upload fa-3x"></i>
<h4 class="text-center text-muted">
패키지 파일을<br>업로드 해주세요.
</h4>
</div>
<div class="col-sm-8">
<div class="mt-4">
<input type="file" name="upfile" id="packageupfile" class="hidden" onchange="progressbar();">
<button type="button" class="btn btn-outline-secondary btn-block" id="fileselectbtn" onclick="$('#packageupfile').click();">파일선택</button>
</div>
<div class="mt-4">
<div class="progress progress-striped d-none" id="progress-bar">
<div class="progress-bar" role="progressbar" aria-valuemax="100"></div>
</div>
</div>
<ul class="mt-4">
<li>킴스큐에서 제공하는 공식 패키지만 업로드할 수 있습니다.</li>
<li>파일형식은 <code>rb_package_패키지명.zip</code> 이어야 합니다.</li>
<li>패키지 설치시 이미 같은명칭의 폴더나 파일이 존재할 경우 덧씌워지니 주의하세요.</li>
</ul>
</div>
</div>
</form>
</div>
<?php endif?>
<?php if($package_step==2):?>
<?php include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.php' ?>
<div id="tab2">
<div class="row">
<div class="col-sm-4 text-center rb-icon">
<i class="fa fa-cube fa-3x"></i>
<h4 class="text-center text-muted">
패키지를 적용할 준비가<br>완료 되었습니다.
</h4>
</div>
<div class="col-sm-8">
<form name="_upload_form_" action="<?php echo $g['s']?>/" method="post" role="form">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="add_package">
<input type="hidden" name="package_step" value="<?php echo $package_step?>">
<input type="hidden" name="package_folder" value="<?php echo $package_folder?>">
<div class="well">
<div class="form-group row">
<label for="" class="col-sm-3 col-form-label">패키지명</label>
<div class="col-sm-9">
<?php echo $d['package']['name']?>
</div>
</div>
<div class="form-group row">
<label for="" class="col-sm-3 col-form-label">적용사이트</label>
<div class="col-sm-8">
<select name="siteuid" class="form-control">
<option value="">신규생성 후 적용</option>
<option value="">-------------------------------</option>
<?php $_SITES_ALL = getDbArray($table['s_site'],'','*','gid','asc',0,1)?>
<?php while($_R = db_fetch_array($_SITES_ALL)):?>
<option value="<?php echo $_R['uid']?>"><?php echo $_R['name']?></option>
<?php endwhile?>
</select>
<small class="form-text text-danger mt-3">
운영중인 사이트에는 적용하지 마십시오.
</small>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<a class="collapsed" data-toggle="collapse" href="#package-options" onclick="detailCheck();"><i class="fa fa-cog"></i> 설치옵션 및 세부내용<span class="pull-right"></span></a>
</div>
<div class="card-body collapse" id="package-options">
<div class="form-group row">
<label class="col-sm-3 col-form-label">설치옵션</label>
<div class="col-sm-9">
<?php foreach($d['package']['execute'] as $_key => $_val):?>
<div class="checkbox">
<label>
<input type="checkbox" name="ACT_<?php echo $_val[0]?>" value="1"<?php if($_val[2]):?> checked<?php endif?>>
<?php echo $_val[1]?>
</label>
</div>
<?php endforeach?>
</div>
</div>
<?php if(is_file($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt')):?>
<div class="form-group row">
<label class="col-sm-3 col-form-label">설치내용</label>
<div class="col-sm-9">
<?php readfile($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt')?>
</div>
</div>
<?php endif?>
</div>
</div>
</form>
</div>
</div>
</div>
<?php endif?>
<?php if($package_step==3):?>
<div id="tab3">
<div class="row">
<div class="col-sm-4 text-center rb-icon">
<i class="fa fa-home fa-3x"></i>
<h4 class="text-center text-muted">
설치가 완료 되었습니다.
</h4>
</div>
<div class="col-sm-8">
<div class="text-center">
<br><br>
<a href="<?php echo $g['s']?>/?r=<?php echo $siteid?>&amp;panel=Y" class="btn btn-primary btn-lg" target="_top">
<i class="fa fa-share"></i> 사이트 접속하기
</a>
<br><br>
<hr><?php echo sprintf('%s 패키지가<br><strong>%s</strong>에 설치 완료 되었습니다.',urldecode($package_name),urldecode($site_name))?>
</div>
</div>
</div>
</div>
<?php endif?>
</div>
</div>
</div>
<!-- @부모레이어를 제어할 수 있도록 모달의 헤더와 풋터를 부모레이어에 출력시킴 -->
<div id="_modal_header" hidden>
<h5 class="modal-title"><i class="fa fa-plus-circle fa-lg"></i> Rb 패키지 설치</h5>
<button type="button" class="close" onclick="frames._modal_iframe_modal_window.mClose();">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="_modal_footer" hidden>
<?php if($package_step==3):?>
<button type="button" class="btn btn-light pull-left" disabled>취소</button>
<button type="button" class="btn btn-primary" disabled>완료</button>
<?php else:?>
<button type="button" class="btn btn-light pull-left" onclick="frames._modal_iframe_modal_window.mClose();">취소</button>
<?php if($package_step==2):?>
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window.install();" id="afterChooseFileNext">다음</button>
<?php endif?>
<?php if($package_step==1):?>
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window.getFiles();" id="afterChooseFileNext" disabled>다음</button>
<?php endif?>
<?php endif?>
</div>
<script>
var _per = 0;
function progressbar()
{
if(_per == 0) $('#progress-bar').removeClass('d-none');
if (_per < 100)
{
_per = _per + 10;
getId('progress-bar').children[0].style.width = (_per>100?100:_per)+ '%';
setTimeout("progressbar();",100);
}
else {
parent.getId('afterChooseFileNext').disabled = false;
}
}
function detailCheck()
{
/*
var h = document.body.scrollHeight;
parent.getId('_modal_iframe_modal_window').style.height = (h+400)+'px'
parent.getId('_modal_body_modal_window').style.height = (h+400)+'px';
*/
}
function nextStep()
{
location.href = '<?php echo $g['s']?>/?r=<?php echo $r?>&iframe=Y&m=admin&module=<?php echo $module?>&front=modal.package&package_type=<?php echo $package_type?>&&package_step=2';
}
function install()
{
var f = document._upload_form_;
getIframeForAction(f);
f.submit();
parent.getId('afterChooseFileNext').innerHTML = '<i class="fa fa-spinner fa-lg fa-spin fa-fw"></i> Installing ...';
parent.getId('afterChooseFileNext').disabled = true;
}
function getFiles()
{
var f = document._upload_form_;
if (f.upfile.value == '')
{
alert('파일이 선택되지 않았습니다. ');
return false;
}
getIframeForAction(f);
f.submit();
parent.getId('afterChooseFileNext').innerHTML = '<i class="fa fa-spinner fa-lg fa-spin fa-fw"></i> Uploading ...';
parent.getId('afterChooseFileNext').disabled = true;
}
function mClose()
{
location.href = '<?php echo $g['s']?>/?r=<?php echo $r?>&m=<?php echo $module?>&a=add_package&package_step=delete';
parent.$('#modal_window').modal('hide');
}
function modalSetting()
{
parent.getId('modal_window_dialog_modal_window').style.width = '100%';
parent.getId('modal_window_dialog_modal_window').style.paddingRight = '20px';
parent.getId('modal_window_dialog_modal_window').style.maxWidth = '800px';
parent.getId('_modal_iframe_modal_window').style.height = '400px'
parent.getId('_modal_body_modal_window').style.height = '400px';
parent.getId('_modal_header_modal_window').innerHTML = getId('_modal_header').innerHTML;
parent.getId('_modal_header_modal_window').className = 'modal-header';
parent.getId('_modal_body_modal_window').style.padding = '0';
parent.getId('_modal_body_modal_window').style.margin = '0';
parent.getId('_modal_footer_modal_window').innerHTML = getId('_modal_footer').innerHTML;
parent.getId('_modal_footer_modal_window').className = 'modal-footer';
}
document.body.onresize = document.body.onload = function()
{
setTimeout("modalSetting();",100);
setTimeout("modalSetting();",200);
}
</script>
<style>
#modal-package-install .modal-body {
min-height: 400px;
max-height: calc(100vh - 175px);
overflow-y: auto;
padding: 15px
}
#modal-package-install .tab-content {
padding: 20px 0
}
/* breadcrumb */
#modal-package-install .breadcrumb {
margin: -15px -15px 15px;
border-radius: 0;
padding: 10px 15px;
}
#modal-package-install .breadcrumb a {
color: #999;
}
#modal-package-install .breadcrumb a:hover {
text-decoration: none;
}
#modal-package-install .breadcrumb .active a {
color: #428bca;
font-weight: bold;
}
#modal-package-install .breadcrumb .badge {
background-color: #999;
}
#modal-package-install .breadcrumb .active .badge {
background-color: #428bca;
}
#modal-package-install h4 {
line-height: 1.5
}
#modal-package-install .page-header {
margin-top: 20px;
}
#modal-package-install .list-group {
margin-bottom: 10px;
}
#modal-package-install .rb-icon {
font-size: 70px;
color: #444
}
#modal-package-install .label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
#modal-package-install .pager {
margin: 0;
}
/* tab2 */
#tab2 .panel-heading a {
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
#tab2 .panel-heading a {
color: #666;
display: block;
}
#tab2 .panel-heading a:hover {
text-decoration: none;
}
#tab2 .panel-heading span:before {
content: " \f078";
}
#tab2 .panel-heading .collapsed span:before {
content: " \f054";
}
/* responsive */
@media (min-width: 992px) {
.modal-lg {
width: 780px;
}
}
@media (max-width: 768px) {
#modal-package-install .breadcrumb .badge {
padding: 5px 15px
}
#modal-package-install .breadcrumb .badge {
font-size: 18px
}
#modal-package-install .rb-icon {
font-size: 40px
}
#modal-package-install .tab-content {
padding: 0
}
#tab1 .btn {
display: block;
width: 100%
}
}
/* 김성호 */
#modal-package-install ul {
color: #666;
}
#modal-package-install ul .active {
font-weight: bold;
color: #428BCA;
}
#modal-package-install ul .active .badge {
background: #428BCA;
}
#modal-package-install .modal-body {
padding: 0;
}
#modal-package-install .tab-content {
clear: both;
padding: 40px 20px 0 20px;
}
#rb-body .tab-content {
border: 0;
}
</style>

View File

@@ -0,0 +1,419 @@
<?php $package_step = $package_step ? $package_step : 1?>
<div id="modal-package-install">
<div class="modal-body bg-white">
<div class="p-3">
<ul class="list-inline mb-0">
<li class="list-inline-item<?php if($package_step==1):?> active<?php endif?>"><span class="badge badge-secondary">Step 1</span> <span><?php echo '패키지 안내'?></span></li>
<li class="list-inline-item<?php if($package_step==2):?> active<?php endif?>"><span class="badge badge-secondary">Step 2</span> <span><?php echo '설치하기'?></span></li>
<li class="list-inline-item<?php if($package_step==3):?> active<?php endif?>"><span class="badge badge-secondary">Step 3</span> <span><?php echo '완료'?></span></li>
</ul>
</div>
<div class="tab-content">
<?php if($package_step==1):?>
<div id="tab1">
<form name="_download_form_" action="<?php echo $g['s']?>/" method="post" enctype="multipart/form-data">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="download_package">
<input type="hidden" name="package_step" value="<?php echo $package_step?>">
<?php
include $g['path_module'].$module.'/var/var.php';
include $g['path_core'].'function/rss.func.php';
$packageData = getUrlData($d['market']['url'].'&iframe=Y&page=client.project.package&pid='.$pid,10);
$packageData = explode('[RESULT:',$packageData);
$packageData = explode(':RESULT]',$packageData[1]);
$packageData = $packageData[0];
echo $packageData;
?>
</form>
</div>
<?php endif?>
<?php if($package_step==2):?>
<?php include $g['path_tmp'].'app/'.$package_folder.'/_settings/var.php' ?>
<div id="tab2">
<div class="row">
<div class="col-sm-4 text-center rb-icon">
<i class="fa fa-cube fa-3x"></i>
<h4 class="text-center text-muted">
패키지를 적용할 준비가<br>완료 되었습니다.
</h4>
</div>
<div class="col-sm-8">
<form name="_upload_form_" action="<?php echo $g['s']?>/" method="post" role="form">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="add_package">
<input type="hidden" name="package_step" value="<?php echo $package_step?>">
<input type="hidden" name="package_folder" value="<?php echo $package_folder?>">
<div class="well">
<div class="form-group form-row">
<label for="" class="col-sm-3 control-label">패키지명</label>
<div class="col-sm-9">
<p class="form-control-static">
<?php echo $d['package']['name']?>
</p>
</div>
</div>
<div class="form-group form-row">
<label for="" class="col-sm-3 control-label">적용사이트</label>
<div class="col-sm-8">
<select name="siteuid" class="form-control">
<option value="">신규생성 후 적용</option>
<option value="">-------------------------------</option>
<?php $_SITES_ALL = getDbArray($table['s_site'],'','*','gid','asc',0,1)?>
<?php while($_R = db_fetch_array($_SITES_ALL)):?>
<option value="<?php echo $_R['uid']?>"><?php echo $_R['name']?></option>
<?php endwhile?>
</select>
<span class="help-block">운영중인 사이트에는 적용하지 마십시오.</span>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<a class="collapsed" data-toggle="collapse" href="#package-options" onclick="detailCheck();"><i class="fa fa-cog"></i> 설치옵션 및 세부내용<span class="pull-right"></span></a>
</div>
<div class="card-body collapse" id="package-options">
<div class="form-group form-row">
<label class="col-sm-3 control-label">설치옵션</label>
<div class="col-sm-9">
<?php foreach($d['package']['execute'] as $_key => $_val):?>
<div class="checkbox">
<label>
<input type="checkbox" name="ACT_<?php echo $_val[0]?>" value="1"<?php if($_val[2]):?> checked<?php endif?>>
<?php echo $_val[1]?>
</label>
</div>
<?php endforeach?>
</div>
</div>
<?php if(is_file($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt')):?>
<div class="form-group form-row">
<label class="col-sm-3 control-label">설치내용</label>
<div class="col-sm-9">
<?php readfile($g['path_tmp'].'app/'.$package_folder.'/_settings/readme.txt')?>
</div>
</div>
<?php endif?>
</div>
</div>
</form>
</div>
</div>
</div>
<?php endif?>
<?php if($package_step==3):?>
<div id="tab3">
<div class="row">
<div class="col-sm-4 text-center rb-icon">
<i class="fa fa-home fa-3x"></i>
<h4 class="text-center text-muted">
설치가 완료 되었습니다.
</h4>
</div>
<div class="col-sm-8">
<div class="text-center">
<br><br>
<a href="<?php echo $g['s']?>/?r=<?php echo $siteid?>&amp;panel=Y" class="btn btn-primary btn-lg" target="_top">
<i class="fa fa-share"></i> 사이트 접속하기
</a>
<br><br>
<hr><?php echo sprintf('%s 패키지가<br><strong>%s</strong>에 설치 완료 되었습니다.',urldecode($package_name),urldecode($site_name))?>
</div>
</div>
</div>
</div>
<?php endif?>
</div>
</div>
</div>
<!-- @부모레이어를 제어할 수 있도록 모달의 헤더와 풋터를 부모레이어에 출력시킴 -->
<div id="_modal_header" hidden>
<h5 class="modal-title"><i class="fa fa-plus-circle fa-lg"></i> Rb 패키지 설치 </h5>
<button type="button" class="close" onclick="frames._modal_iframe_modal_window.mClose();">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="_modal_footer" hidden>
<?php if($package_step==3):?>
<button type="button" class="btn btn-light pull-left" disabled>취소</button>
<button type="button" class="btn btn-primary" disabled>완료</button>
<?php else:?>
<button type="button" class="btn btn-light pull-left" onclick="frames._modal_iframe_modal_window.mClose();">취소</button>
<?php if($package_step==2):?>
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window.install();" id="afterChooseFileNext">다음</button>
<?php endif?>
<?php if($package_step==1):?>
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window.getFiles();" id="afterChooseFileNext" data-pid="<?php echo $pid ?>">다음</button>
<?php endif?>
<?php endif?>
</div>
<script>
var _per = 0;
function progressbar()
{
if(_per == 0) $('#progress-bar').removeClass('d-none');
if (_per < 100)
{
_per = _per + 10;
getId('progress-bar').children[0].style.width = (_per>100?100:_per)+ '%';
setTimeout("progressbar();",100);
}
else {
parent.getId('afterChooseFileNext').disabled = false;
}
}
function detailCheck()
{
/*
var h = document.body.scrollHeight;
parent.getId('_modal_iframe_modal_window').style.height = (h+400)+'px'
parent.getId('_modal_body_modal_window').style.height = (h+400)+'px';
*/
}
function nextStep()
{
location.href = '<?php echo $g['s']?>/?r=<?php echo $r?>&iframe=Y&m=admin&module=<?php echo $module?>&front=modal.package&package_type=<?php echo $package_type?>&&package_step=2';
}
function install()
{
var f = document._upload_form_;
getIframeForAction(f);
f.submit();
parent.getId('afterChooseFileNext').innerHTML = '<i class="fa fa-spinner fa-lg fa-spin fa-fw"></i> Installing ...';
parent.getId('afterChooseFileNext').disabled = true;
}
function getFiles()
{
var f = document._download_form_;
if (confirm('정말로 패키지를 다운받으시겠습니까? '))
{
// var version = ver.value;
parent.document.title = '패키지 다운로드 중';
parent.getId('afterChooseFileNext').innerHTML = '<i class="fa fa-spinner fa-lg fa-spin fa-fw"></i> 다운로드중 ...';
parent.getId('afterChooseFileNext').disabled = true;
// console.log(version)
// frames.download_frame.location.href = './index.php?install=download&version=' + version + '&sitelang='+lang;
// frames.download_frame.location.href = './index.php?install=download&version=' + version + '&sitelang='+lang;
// getIframeForAction('');
// parent.frames.__iframe_for_action__.location.href = $g['s'].'/?r='.$r.'&amp;m='.$m.'&amp;a=download_package';
getIframeForAction(f);
f.submit();
}
}
function mClose()
{
location.href = '<?php echo $g['s']?>/?r=<?php echo $r?>&m=<?php echo $module?>&a=add_package&package_step=delete';
parent.$('#modal_window').modal('hide');
}
function modalSetting()
{
parent.getId('modal_window_dialog_modal_window').style.width = '100%';
parent.getId('modal_window_dialog_modal_window').style.paddingRight = '20px';
parent.getId('modal_window_dialog_modal_window').style.maxWidth = '800px';
parent.getId('_modal_iframe_modal_window').style.height = '400px'
parent.getId('_modal_body_modal_window').style.height = '400px';
parent.getId('_modal_header_modal_window').innerHTML = getId('_modal_header').innerHTML;
parent.getId('_modal_header_modal_window').className = 'modal-header';
parent.getId('_modal_body_modal_window').style.padding = '0';
parent.getId('_modal_body_modal_window').style.margin = '0';
parent.getId('_modal_footer_modal_window').innerHTML = getId('_modal_footer').innerHTML;
parent.getId('_modal_footer_modal_window').className = 'modal-footer';
}
document.body.onresize = document.body.onload = function()
{
setTimeout("modalSetting();",100);
setTimeout("modalSetting();",200);
}
</script>
<style>
#modal-package-install .modal-body {
min-height: 400px;
max-height: calc(100vh - 175px);
overflow-y: auto;
padding: 15px
}
#modal-package-install .tab-content {
padding: 20px 0
}
/* breadcrumb */
#modal-package-install .breadcrumb {
margin: -15px -15px 15px;
border-radius: 0;
padding: 10px 15px;
}
#modal-package-install .breadcrumb a {
color: #999;
}
#modal-package-install .breadcrumb a:hover {
text-decoration: none;
}
#modal-package-install .breadcrumb .active a {
color: #428bca;
font-weight: bold;
}
#modal-package-install .breadcrumb .badge {
background-color: #999;
}
#modal-package-install .breadcrumb .active .badge {
background-color: #428bca;
}
#modal-package-install h4 {
line-height: 1.5
}
#modal-package-install .page-header {
margin-top: 20px;
}
#modal-package-install .list-group {
margin-bottom: 10px;
}
#modal-package-install .rb-icon {
font-size: 70px;
color: #444
}
#modal-package-install .label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
#modal-package-install .pager {
margin: 0;
}
/* tab2 */
#tab2 .panel-heading a {
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
#tab2 .panel-heading a {
color: #666;
display: block;
}
#tab2 .panel-heading a:hover {
text-decoration: none;
}
#tab2 .panel-heading span:before {
content: " \f078";
}
#tab2 .panel-heading .collapsed span:before {
content: " \f054";
}
/* responsive */
@media (min-width: 992px) {
.modal-lg {
width: 780px;
}
}
@media (max-width: 768px) {
#modal-package-install .breadcrumb .badge {
padding: 5px 15px
}
#modal-package-install .breadcrumb .badge {
font-size: 18px
}
#modal-package-install .rb-icon {
font-size: 40px
}
#modal-package-install .tab-content {
padding: 0
}
#tab1 .btn {
display: block;
width: 100%
}
}
/* 김성호 */
#modal-package-install ul {
color: #666;
}
#modal-package-install ul .active {
font-weight: bold;
color: #428BCA;
}
#modal-package-install ul .active .badge {
background: #428BCA;
}
#modal-package-install .modal-body {
padding: 0;
}
#modal-package-install .tab-content {
clear: both;
padding: 40px 20px 0 20px;
}
#rb-body .tab-content {
border: 0;
}
</style>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.package&_clientu='.$g['s'].($goods?'&goods='.$goods:'').'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,16 @@
.tt {font-weight:bold;font-family:"malgun gothic",dotum;color:#333333;border-bottom:#dfdfdf dotted 1px;padding:10px 0 10px 10px;margin:0 0 20px 0;}
.tt img {position:relative;top:6px;}
#orderbox {}
#orderbox .box {padding:10px 0 50px 0;}
#orderbox .box table {}
#orderbox .box td {}
#orderbox .box .td1 {width:80px;padding:5px 0 5px 10px;font-family:dotum;font-size:12px;color:#666;}
#orderbox .box .td2 {padding:7px 0 7px 0;}
#orderbox .box .td2 span {font-family:arial;font-size:11px;color:#ff0000;}
#orderbox .box .td2 s {font-family:arial;font-size:11px;color:#999;}
#orderbox .box .noline td {border-top:#ffffff solid 1px;}
#orderbox .box .buybox {padding:20px 0 20px 90px;}
#orderbox .box .buybox div {padding:0 0 20px 0;}
#orderbox .box .price1 {color:#000000;}
#orderbox .box .price2 {color:#ff0000;}
#orderbox .box .halin {color:#FF4040;}

View File

@@ -0,0 +1,45 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.buy&_clientu='.$g['s'].'&_clientr='.$r.'&uid='.$uid.'&iframe=Y&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2',10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
?>
<?php if($marketData == 'NOMEMBER'):?>
<script type="text/javascript">
//<![CDATA[
alert('환경설정 페이지에 등록한 킴스큐 회원정보가 정확하지 않습니다.');
window.close();
//]]>
</script>
<?php exit;endif?>
<?php if($marketData == 'NOPRODUCT'):?>
<script type="text/javascript">
//<![CDATA[
alert('존재하지 않는 상품입니다.');
window.close();
//]]>
</script>
<?php exit;endif?>
<?php echo $marketData?>
<?php else:?>
<script type="text/javascript">
//<![CDATA[
alert('환경설정 페이지에서 마켓 접속주소와\n킴스큐 아이디와 프로젝트 키를 등록해 주세요.');
window.close();
//]]>
</script>
<?php endif?>
<script type="text/javascript">
//<![CDATA[
document.title = '큐마켓-구매하기';
//]]>
</script>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.recomm&_clientu='.$g['s'].'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,14 @@
<?php
include $g['path_module'].$module.'/var/var.php';
$g['marketvar'] = $g['path_var'].'/market.var.php';
if (file_exists($g['marketvar'])) include_once $g['marketvar'];
if($d['market']['url'] && $d['market']['key'] && $d['market']['userid'] ):
include $g['path_core'].'function/rss.func.php';
$marketData = getUrlData($d['market']['url'].'&iframe=Y&page=client.update&_clientu='.$g['s'].'&_clientr='.$r.'&cat='.$cat.'&theme='.$theme.'&sort='.$sort.'&orderby='.$orderby.'&type='.$type.'&ptype='.$ptype.'&p='.$p.'&todayfree='.$todayfree.'&sailing='.$sailing.'&where='.$where.'&keyword='.$keyword.'&brand='.$brand.'&id='.$d['market']['userid'].'&key='.$d['market']['key'].'&version=2&host='.$_SERVER['HTTP_HOST'],10);
$marketData = explode('[RESULT:',$marketData);
$marketData = explode(':RESULT]',$marketData[1]);
$marketData = $marketData[0];
echo $marketData;
else:?>
<?php include $g['path_module'].$module.'/admin/_guide.php'; ?>
<?php endif?>

View File

@@ -0,0 +1,9 @@
<?php
$d['amenu']['main'] = '패키지';
$d['amenu']['extension'] = '익스텐션';
$d['amenu']['recomm']= '추천상품';
$d['amenu']['brand'] = '브랜드';
$d['amenu']['update'] = '설치내역';
$d['amenu']['buyer'] = '구매내역';
$d['amenu']['config'] = '설정';
?>

3
modules/market/main.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
if(!defined('__KIMS__')) exit;
?>

1
modules/market/name.txt Normal file
View File

@@ -0,0 +1 @@
마켓

View File

@@ -0,0 +1,5 @@
<?php
$d['market']['url'] = "https://kimsq.com/?m=qmarket";
$d['github']['remote'] = "https://github.com/kimsQ/rb2.git";
$d['github']['lastest'] = "https://kimsq.github.io/rb2/lastest.txt";
?>