first
This commit is contained in:
43
modules/market/action/@a.etc_pack_upload.php
Normal file
43
modules/market/action/@a.etc_pack_upload.php
Normal 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.','자료가 정상적으로 등록되었습니다.','');
|
||||
|
||||
?>
|
||||
5
modules/market/action/@a.frameset.php
Normal file
5
modules/market/action/@a.frameset.php
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
top.getId('marketFrame').style.height = '<?php echo $height?>px';
|
||||
</script>
|
||||
<?php exit?>
|
||||
18
modules/market/action/@a.height.php
Normal file
18
modules/market/action/@a.height.php
Normal 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?>
|
||||
16
modules/market/action/@a.layout_aply.php
Normal file
16
modules/market/action/@a.layout_aply.php
Normal 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모바일기기나 에뮬레이터로 확인하세요.','');
|
||||
}
|
||||
?>
|
||||
130
modules/market/action/@a.module_pack_upload.php
Normal file
130
modules/market/action/@a.module_pack_upload.php
Normal 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.','','');
|
||||
}
|
||||
?>
|
||||
51
modules/market/action/@a.module_setting.php
Normal file
51
modules/market/action/@a.module_setting.php
Normal 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.','모듈이 정상적으로 설치되었습니다.','');
|
||||
}
|
||||
?>
|
||||
36
modules/market/action/@a.pack_delete.php
Normal file
36
modules/market/action/@a.pack_delete.php
Normal 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.','','');
|
||||
}
|
||||
?>
|
||||
162
modules/market/action/@a.pack_upload.php
Normal file
162
modules/market/action/@a.pack_upload.php
Normal 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.','패키지가 정상적으로 등록되었습니다.','');
|
||||
}
|
||||
?>
|
||||
116
modules/market/action/@a.package_dump.php
Normal file
116
modules/market/action/@a.package_dump.php
Normal 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.','패키지용 샘플파일이 만들어졌습니다.','');
|
||||
}
|
||||
?>
|
||||
10
modules/market/action/@a.package_setting.php
Normal file
10
modules/market/action/@a.package_setting.php
Normal 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,'','','');
|
||||
?>
|
||||
177
modules/market/action/@a.package_upload.php
Normal file
177
modules/market/action/@a.package_upload.php
Normal 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.','패키지가 적용되었습니다.','');
|
||||
}
|
||||
?>
|
||||
70
modules/market/action/@a.remote_install.php
Normal file
70
modules/market/action/@a.remote_install.php
Normal 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,'','','');
|
||||
}
|
||||
?>
|
||||
59
modules/market/action/a.add_dashboard.php
Normal file
59
modules/market/action/a.add_dashboard.php
Normal 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');",'대시보드 위젯이 추가되었습니다.','');
|
||||
?>
|
||||
54
modules/market/action/a.add_etc.php
Normal file
54
modules/market/action/a.add_etc.php
Normal 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');",'기타자료가 추가되었습니다.','');
|
||||
?>
|
||||
64
modules/market/action/a.add_layout.php
Normal file
64
modules/market/action/a.add_layout.php
Normal 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');",'레이아웃이 추가되었습니다.','');
|
||||
?>
|
||||
106
modules/market/action/a.add_module.php
Normal file
106
modules/market/action/a.add_module.php
Normal 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');",'모듈이 추가되었습니다.','');
|
||||
?>
|
||||
323
modules/market/action/a.add_package.php
Normal file
323
modules/market/action/a.add_package.php
Normal 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;
|
||||
?>
|
||||
93
modules/market/action/a.add_plugin.php
Normal file
93
modules/market/action/a.add_plugin.php
Normal 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),'');
|
||||
?>
|
||||
81
modules/market/action/a.add_switch.php
Normal file
81
modules/market/action/a.add_switch.php
Normal 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),'');
|
||||
?>
|
||||
64
modules/market/action/a.add_widget.php
Normal file
64
modules/market/action/a.add_widget.php
Normal 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');",'위젯이 추가되었습니다.','');
|
||||
?>
|
||||
16
modules/market/action/a.config.php
Normal file
16
modules/market/action/a.config.php
Normal 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.','','');
|
||||
?>
|
||||
97
modules/market/action/a.delete_install.php
Normal file
97
modules/market/action/a.delete_install.php
Normal 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;
|
||||
|
||||
?>
|
||||
31
modules/market/action/a.download_package.php
Normal file
31
modules/market/action/a.download_package.php
Normal 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.','','');
|
||||
?>
|
||||
55
modules/market/action/a.get_goodsData.php
Normal file
55
modules/market/action/a.get_goodsData.php
Normal 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;
|
||||
?>
|
||||
35
modules/market/action/a.get_packageStep2.php
Normal file
35
modules/market/action/a.get_packageStep2.php
Normal 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;
|
||||
?>
|
||||
102
modules/market/action/a.git_clone.php
Normal file
102
modules/market/action/a.git_clone.php
Normal 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;
|
||||
|
||||
?>
|
||||
367
modules/market/action/a.git_package.php
Normal file
367
modules/market/action/a.git_package.php
Normal 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;
|
||||
?>
|
||||
123
modules/market/action/a.update.php
Normal file
123
modules/market/action/a.update.php
Normal 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;
|
||||
?>
|
||||
Reference in New Issue
Block a user