Sfoglia il codice sorgente

模块打包安装管理功能调整

tags/6.0.0
tianya 3 anni fa
parent
commit
44d039dc90
8 ha cambiato i file con 413 aggiunte e 349 eliminazioni
  1. +5
    -0
      src/dede/css/base.css
  2. +93
    -20
      src/dede/module_make.php
  3. +5
    -5
      src/dede/module_upload.php
  4. +43
    -60
      src/dede/templets/module_edit.htm
  5. +9
    -11
      src/dede/templets/module_main.htm
  6. +241
    -250
      src/dede/templets/module_make.htm
  7. +1
    -1
      src/include/common.inc.php
  8. +16
    -2
      src/include/dedemodule.class.php

+ 5
- 0
src/dede/css/base.css Vedi File

@@ -82,6 +82,11 @@ box-shadow: 0 0 3px #A5C760;
outline: none;
}
input:disabled, input[readonly] {
background-color: #e9ecef;
opacity: 1;
}
label {
display: inline-block;
margin: .5rem 0;


+ 93
- 20
src/dede/module_make.php Vedi File

@@ -20,21 +20,25 @@ if($action=='')
require_once(dirname(__FILE__)."/templets/module_make.htm");
exit();
}
/*---------
//获得Hash码
function GetHash()
----------*/
else if($action=='gethash')
{
echo md5($modulname.$email);
exit();
}
/*-------------
//生成项目
function Makemodule()
--------------*/
else if($action=='make')
{
require_once(DEDEINC.'/dedehttpdown.class.php');
// 校验私钥,确定开发者身份
$devURL = DEDECDNURL."/developers/$dev_id.json";
$dhd = new DedeHttpDown();
$dhd->OpenUrl($devURL);
$devContent = $dhd->GetHtml();
$devInfo = (array)json_decode($devContent);
if (($devInfo['auth_at']+60*60*24*365) < time()) {
ShowMsg("您的开发者账号已经过期,请登录www.dedebiz.com重新申请!","-1");
exit();
}
$filelist = str_replace("\r", "\n", trim($filelist));
$filelist = trim(preg_replace("#[\n]{1,}#", "\n", $filelist));
if($filelist=='')
@@ -42,6 +46,37 @@ else if($action=='make')
ShowMsg("对不起,你没有指定模块的文件列表,因此不能创建项目!","-1");
exit();
}
if (empty($dev_id)) {
ShowMsg("开发者ID不能为空!","-1");
exit();
}
if (empty($priv)) {
ShowMsg("请填写开发者私钥信息","-1");
exit();
}
if (strlen($modulname) > 150) {
ShowMsg("模块名称过长","-1");
exit();
}
// 校验私钥合法性
$enstr = json_encode(array(
"module_name" => $modulname,
"dev_id" => $devInfo['dev_id'],
));
// 私钥加密模块信息
openssl_private_encrypt($enstr,$encotent,$priv);
$moduleInfo = base64url_encode($encotent);
openssl_public_decrypt($encotent,$decontent,$devInfo['pub_key']);
$minfo = (array)json_decode($decontent);
if ($minfo['module_name'] != $modulname || $minfo['dev_id'] != $devInfo['dev_id']) {
ShowMsg("开发者私钥校验失败,请确保填写正确的开发者私钥","-1");
exit();
}
//去除转义
foreach($_POST as $k=>$v) $$k = stripslashes($v);
@@ -49,7 +84,7 @@ else if($action=='make')
if(!isset($autosetup)) $autosetup = 0;
if(!isset($autodel)) $autodel = 0;
$mdir = DEDEDATA.'/module';
$hashcode = md5($modulname.$email);
$hashcode = md5($modulname.$devInfo['dev_id']);
$moduleFilename = $mdir.'/'.$hashcode.'.xml';
$menustring = base64_encode($menustring);
$indexurl = str_replace('=', '**', $indexurl);
@@ -101,17 +136,16 @@ else if($action=='make')
$modulinfo = "<module>
<baseinfo>
name={$modulname}
team={$team}
dev_id={$devInfo['dev_id']}
info={$moduleInfo}
time={$mtime}
email={$email}
url={$url}
hash={$hashcode}
indexname={$indexname}
indexurl={$indexurl}
ismember={$ismember}
autosetup={$autosetup}
autodel={$autodel}
lang={$lang}
lang=utf-8
moduletype={$moduletype}
</baseinfo>
<systemfile>
@@ -173,6 +207,48 @@ else if($action=='edit')
ShowMsg("对不起,你没有指定模块的文件列表,因此不能创建项目!","-1");
exit();
}
if (empty($dev_id)) {
ShowMsg("开发者ID不能为空!","-1");
exit();
}
if (empty($priv)) {
ShowMsg("请填写开发者私钥信息","-1");
exit();
}
// 校验私钥,确定开发者身份
$devURL = DEDECDNURL."/developers/$dev_id.json";
$dhd = new DedeHttpDown();
$dhd->OpenUrl($devURL);
$devContent = $dhd->GetHtml();
$devInfo = (array)json_decode($devContent);
if (($devInfo['auth_at']+60*60*24*365) < time()) {
ShowMsg("您的开发者账号已经过期,请登录www.dedebiz.com重新申请!","-1");
exit();
}
if (strlen($modulname) > 150) {
ShowMsg("模块名称过长","-1");
exit();
}
// 校验私钥合法性
$enstr = json_encode(array(
"module_name" => $modulname,
"dev_id" => $devInfo['dev_id'],
));
// 私钥加密模块信息
openssl_private_encrypt($enstr,$encotent,$priv);
$moduleInfo = base64url_encode($encotent);
openssl_public_decrypt($encotent,$decontent,$devInfo['pub_key']);
$minfo = (array)json_decode($decontent);
if ($minfo['module_name'] != $modulname || $minfo['dev_id'] != $devInfo['dev_id']) {
ShowMsg("开发者私钥校验失败,请确保填写正确的开发者私钥","-1");
exit();
}
//已经去除转义
foreach($_POST as $k=>$v) $$k = stripslashes($v);
@@ -182,8 +258,6 @@ else if($action=='edit')
$hashcode = $hash;
$moduleFilename = $mdir.'/'.$hashcode.'.xml';
$modulname = str_replace('=', '', $modulname);
$email = str_replace('=', '', $email);
$team = str_replace('=', '', $team);
$indexurl = str_replace('=', '**', $indexurl);
$menustring = base64_encode($menustring);
$dm = new DedeModule($mdir);
@@ -219,17 +293,16 @@ else if($action=='edit')
$modulinfo = "<module>
<baseinfo>
name={$modulname}
team={$team}
dev_id={$devInfo['dev_id']}
info={$moduleInfo}
time={$mtime}
email={$email}
url={$url}
hash={$hashcode}
indexname={$indexname}
indexurl={$indexurl}
ismember={$ismember}
autosetup={$autosetup}
autodel={$autodel}
lang={$lang}
lang=utf-8
moduletype={$moduletype}
</baseinfo>
<systemfile>


+ 5
- 5
src/dede/module_upload.php Vedi File

@@ -97,15 +97,15 @@ else
<tr>
<td height='30'>文件格式:</td>
<td>
<input name='filetype' type='radio' value='0' checked='checked' />
正常的模块包
<input type='radio' name='filetype' value='1' />
经过 zip 压缩的模块包 </td>
<label><input name='filetype' type='radio' value='0' checked='checked' />
正常的模块包</label>
<label><input type='radio' name='filetype' value='1' />
经过 zip 压缩的模块包</label> </td>
</tr>
<tr>
<td height='30'>已有模块:</td>
<td>
<input name='delhas' type='checkbox' id='delhas' value='1' /> 强制删除同名模块(这可能导致已经安装的模块无法卸载)
<label><input name='delhas' type='checkbox' id='delhas' value='1' /> 强制删除同名模块(这可能导致已经安装的模块无法卸载)</label>
</td>
</tr>
<tr>


+ 43
- 60
src/dede/templets/module_edit.htm Vedi File

@@ -2,31 +2,10 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<script language="javascript" src="../static/js/dedeajax2.js"></script>
<script language="javascript">
function LoadHashCode()
{
var tgobj = document.getElementById('modulcode');
var email = document.form1.email.value;
var modulname = document.form1.modulname.value;
var myajax = new DedeAjax(tgobj,false,true,'-','-','...');
<?php
if(strtolower(substr($cfg_soft_lang, 0, 3)) == 'utf') {
?>
myajax.AddKeyUtf8('action','gethash');
myajax.AddKeyUtf8('email',email);
myajax.AddKeyUtf8('modulname',modulname);
myajax.SendPost2('module_make.php');
<?php
}
elseif (strtolower(substr($cfg_soft_lang, 0, 2)) == 'gb') {
echo 'myajax.SendGet2("module_make.php?action=gethash&email="+email+"&modulname="+modulname);';
}
?>
//myajax.SendGet2('module_make.php?action=gethash&email='+email+'&modulname='+modulname);
DedeXHTTP = null;
}
function ShowHideField(cbox,vid,nid)
{
var cboxobj = document.getElementById(cbox);
@@ -61,13 +40,14 @@ td{padding-left:8px}
</style>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;">模块管理</div>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#CFCFCF;">
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable mb-3" style="background:#CFCFCF;">
<form action="module_make.php" method="post" enctype="multipart/form-data" name="form1">
<input type='hidden' name='action' value='edit'>
<input type='hidden' name='dev_id' value='<?php echo $dev_id; ?>'>
<tr>
<td height="20" colspan="2" bgcolor="#EDF9D5" background='images/wbg.gif' style="padding-left:10px;"><b>
<a href="module_main.php"><u>模块管理</u></a>
@@ -81,55 +61,47 @@ td{padding-left:8px}
<input name="modulname" type="text" id="modulname" style="width:180px" value="<?php echo $name; ?>" class='alltxt'/>
</td>
</tr>
<tr>
<td width="19%" align="center" bgcolor="#FFFFFF"><b>开发者ID:</b></td>
<td width="81%" bgcolor="#FFFFFF">
<input name="dev_id2" type="text" id="dev_id2" style="width:180px" value="<?php echo $dev_id; ?>" class='alltxt' disabled/> <a
href="<?php echo $cfg_biz_dedebizUrl;?>/developer" target="_blank" class="text-success">如何获取开发者ID?</a>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>语言编码:</b></td>
<td bgcolor="#FFFFFF">
<input name="lang" type="radio" id="lang1" class='np' value='gb2312'<?php if($lang=='gb2312') echo " checked='1' "; ?>/> GBK
<input name="lang" type="radio" id="lang2" class='np' value='utf-8'<?php if($lang=='utf-8') echo " checked='1' "; ?>/> UTF8
<input name="lang" type="radio" id="lang3" class='np' value='big5'<?php if($lang=='big5') echo " checked='1' "; ?>/> BIG5
<?php echo $lang;?>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>封装类型:</b></td>
<td bgcolor="#FFFFFF">
<input name="moduletype" type="radio" id="moduletype1" class='np' value='soft'<?php if($moduletype=='soft') echo " checked='1' "; ?>/> 模块
<input name="moduletype" type="radio" id="moduletype2" class='np' value='templets'<?php if($moduletype=='templets') echo " checked='1' "; ?>/> 模板
<input name="moduletype" type="radio" id="moduletype3" class='np' value='plus'<?php if($moduletype=='plus') echo " checked='1' "; ?>/> 小插件
<input name="moduletype" type="radio" id="moduletype3" class='np' value='patch'<?php if($moduletype=='patch') echo " checked='1' "; ?>/> 补丁
<label><input name="moduletype" type="radio" id="moduletype1" class='np' value='soft'<?php if($moduletype=='soft') echo " checked='1' "; ?>/> 模块</label>
<label><input name="moduletype" type="radio" id="moduletype2" class='np' value='templets'<?php if($moduletype=='templets') echo " checked='1' "; ?>/> 模板</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='plus'<?php if($moduletype=='plus') echo " checked='1' "; ?>/> 小插件</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='patch'<?php if($moduletype=='patch') echo " checked='1' "; ?>/> 补丁</label>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>联系Email:</b></td>
<td bgcolor="#FFFFFF"><input name="email" type="text" id="email" style="width:180px" value="<?php echo $email; ?>" class='alltxt'/> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>模块识别码:</b></td>
<td bgcolor="#FFFFFF">
<input type='hidden' name='hash' value='<?php echo $hash; ?>' />
<input type='text' name='hashv' value='<?php echo $hash; ?>' style="width:280px" class='alltxt' />(不可改)
<input type='text' disabled name='hashv' value='<?php echo $hash; ?>' style="width:280px" class='alltxt' />(不可改)
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发团队:</b></td>
<td bgcolor="#FFFFFF"><input name="team" type="text" id="team" style="width:180px" value="<?php echo $team; ?>" class='alltxt' /> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>发布时间:</b></td>
<td bgcolor="#FFFFFF">
<input name="mtime" type="text" id="mtime" style="width:180px" value="<?php echo $time; ?>" class='alltxt'/>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>官方网址:</b></td>
<td bgcolor="#FFFFFF"><input name="url" type="text" id="url" style="width:250px" value="<?php echo $url; ?>" class='alltxt' /> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>是否涉及会员系统:</b></td>
<td bgcolor="#FFFFFF">
<input name="ismember" type="radio" class='np' id="ismember0" value="0" onclick="ShowHideMb('ismember0','rboxct')" <?php if($ismember=='0') echo " checked='1' ";?> />
不涉及
<input name="ismember" type="radio" id="ismember1" value="1" onclick="ShowHideMb('ismember0','rboxct')" class='np' <?php if($ismember=='1') echo " checked='1' ";?> /> 涉及
<label><input name="ismember" type="radio" class='np' id="ismember0" value="0" onclick="ShowHideMb('ismember0','rboxct')" <?php if($ismember=='0') echo " checked='1' ";?> />
不涉及</label>
<label><input name="ismember" type="radio" id="ismember1" value="1" onclick="ShowHideMb('ismember0','rboxct')" class='np' <?php if($ismember=='1') echo " checked='1' ";?> /> 涉及</label>
<div id='rboxct' style='display:<?php echo ($ismember=='0' ? 'none' : 'block'); ?>'>
导航使用名称:
<input name="indexname" type="text" id="indexname" style="width:180px" value="<?php echo $indexname; ?>" class='alltxt'/>
@@ -138,7 +110,6 @@ td{padding-left:8px}
<input name="indexurl" type="text" id="indexurl" style="width:180px" value="<?php echo $indexurl; ?>" class='alltxt' />
(用相对于会员中心的网址,如:../ask)
</div>
</td>
</tr>
<tr>
@@ -170,9 +141,8 @@ td{padding-left:8px}
<tr>
<td align="center" bgcolor="#FFFFFF"><b>安装程序:</b></td>
<td bgcolor="#FFFFFF">
<input type="checkbox" name="autosetup" id="autosetup" value='1' class="np" onclick="ShowHideField('autosetup','autosetupinput','autosetupct')"<?php if(isset($autosetup) && $autosetup==1) echo " checked='1'"; ?> />
自动生成(由系统自动处理安装)
<label><input type="checkbox" name="autosetup" id="autosetup" value='1' class="np" onclick="ShowHideField('autosetup','autosetupinput','autosetupct')"<?php if(isset($autosetup) && $autosetup==1) echo " checked='1'"; ?> />
自动生成(由系统自动处理安装)</label>
<br />
<div style='display:<?php if(!isset($autosetup) || $autosetup==0) echo "block"; else echo 'none'; ?>' id='autosetupinput'>
<input name="setup" type="file" id="setup" style="width:350px" />
@@ -201,9 +171,8 @@ td{padding-left:8px}
<tr>
<td align="center" bgcolor="#FFFFFF"><b>删除程序:</b></td>
<td bgcolor="#FFFFFF">
<input type="checkbox" name="autodel" id="autodel" value='1' class="np" onclick="ShowHideField('autodel','autodelinput','autodelct')" <?php if(isset($autodel) && $autodel==1) echo " checked='1' "; ?> />
自动生成(由系统自动处理卸载)
<label><input type="checkbox" name="autodel" id="autodel" value='1' class="np" onclick="ShowHideField('autodel','autodelinput','autodelct')" <?php if(isset($autodel) && $autodel==1) echo " checked='1' "; ?> />
自动生成(由系统自动处理卸载)</label>
<br />
<div style='display:<?php if(!isset($autodel) || $autodel==0) echo 'block'; else echo 'none'; ?>' id='autodelinput'>
<input name="uninstall" type="file" id="uninstall" style="width:350px" />
@@ -231,8 +200,8 @@ td{padding-left:8px}
<tr>
<td align="center" bgcolor="#FFFFFF"><b>模块文件选项:</b></td>
<td bgcolor="#FFFFFF">
<input name="rebuild" type="radio" id="rebuild1" class='np' value='yes' checked='1'/> 重新编译所有文件
<input name="rebuild" type="radio" id="rebuild2" class='np' value='no'/> 不对[<b>文件列表</b>]内文件重编译
<label><input name="rebuild" type="radio" id="rebuild1" class='np' value='yes' checked='1'/> 重新编译所有文件</label>
<label><input name="rebuild" type="radio" id="rebuild2" class='np' value='no'/> 不对[<b>文件列表</b>]内文件重编译</label>
</td>
</tr>
@@ -246,12 +215,26 @@ td{padding-left:8px}
</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发者私钥:</b></td>
<td bgcolor="#FFFFFF">
<p>
开发者认证后获取的私钥
<br />
<textarea name="priv" rows="8" id="priv" style="width:80%"></textarea>
</p>
</td>
</tr>
<tr bgcolor="#F9FDF0">
<td height="28" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="26%">&nbsp;</td>
<td width="15%"><input name="imageField" type="submit" class="np coolbg" value="提交" /></td>
<td width="59%"><input type="button" name="button" id="button" value="返回" onClick="location='plus_main.php';" class="np coolbg" /></td>
<td width="15%">
<button name="imageField" type="submit" class="btn btn-secondary">提交</button>
</td>
<td width="59%"><button name="button" id="button" onClick="location='plus_main.php';" class="btn btn-secondary">返回</button></td>
</tr>
</table></td>
</tr>


+ 9
- 11
src/dede/templets/module_main.htm Vedi File

@@ -3,6 +3,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>模块打包</title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet" type="text/css" />
<script src="../static/js/dedeajax2.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
@@ -17,11 +19,11 @@ function getmodule(action,hash)
</script>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;">模块管理</div>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#CFCFCF;">
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable" style="background:#CFCFCF;">
<form name="form1" action="plus_add.php" method="post">
<input type='hidden' name='dopost' value='save'>
<tr>
@@ -39,7 +41,6 @@ function getmodule(action,hash)
<tr bgcolor="#FBFCE2" >
<td align="center" width="16%">模块名称</td>
<td align="center" width="12%">发布时间</td>
<td align="center" width="14%">开发团队</td>
<td align="center" width="10%">编码</td>
<td align="center" width="10%">类型</td>
<td align="center" width="12%">模块状态</td>
@@ -53,7 +54,6 @@ foreach($modules as $k=>$v)
<tr bgcolor="#FFFFFF" height="26" align="center" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
<td><?php echo $v['name']; ?></td>
<td><?php echo $v['time']; ?></td>
<td><?php echo $v['team']; ?></td>
<td>
<?php
if($cfg_soft_lang != $v['lang']) echo "<font color='red'>".$v['lang']."</font>";
@@ -80,13 +80,11 @@ foreach($modules as $k=>$v)
<td>
<div id = 'manager_<?php echo $v['hash']; ?>' <?php if(!file_exists(DEDEDATA."/module/{$v['hash']}.xml")) echo 'style="display:none;"'?>>
<a href='module_main.php?action=showreadme&hash=<?php echo $v['hash']; ?>'>使用说明</a>
|
<a href='module_main.php?action=view&hash=<?php echo $v['hash']; ?>'>详细</a>
|
<a href='module_main.php?action=edit&hash=<?php echo $v['hash']; ?>'>修改</a>
|
<a href='module_main.php?action=del&hash=<?php echo $v['hash']; ?>'>删除</a>
<a class="btn btn-secondary btn-sm" href='module_main.php?action=showreadme&hash=<?php echo $v['hash']; ?>'>开发者</a>
<a class="btn btn-secondary btn-sm" href='module_main.php?action=showreadme&hash=<?php echo $v['hash']; ?>'>说明</a>
<a class="btn btn-secondary btn-sm" href='module_main.php?action=view&hash=<?php echo $v['hash']; ?>'>详细</a>
<a class="btn btn-secondary btn-sm" href='module_main.php?action=edit&hash=<?php echo $v['hash']; ?>'>修改</a>
<a class="btn btn-secondary btn-sm" href='module_main.php?action=del&hash=<?php echo $v['hash']; ?>'>删除</a>
</div>
</td>
</tr>


+ 241
- 250
src/dede/templets/module_make.htm Vedi File

@@ -1,262 +1,253 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<script language="javascript" src="../static/js/dedeajax2.js"></script>
<script language="javascript">
function LoadHashCode()
{
var tgobj = document.getElementById('modulcode');
var email = document.form1.email.value;
var modulname = document.form1.modulname.value;
var myajax = new DedeAjax(tgobj,false,true,'-','-','...');
<?php
if(strtolower(substr($cfg_soft_lang, 0, 3)) == 'utf') {
?>
myajax.AddKeyUtf8('action','gethash');
myajax.AddKeyUtf8('email',email);
myajax.AddKeyUtf8('modulname',modulname);
myajax.SendPost2('module_make.php');
<?php
}
elseif (strtolower(substr($cfg_soft_lang, 0, 2)) == 'gb') {
echo 'myajax.SendGet2("module_make.php?action=gethash&email="+email+"&modulname="+modulname);';
}
?>
//myajax.SendGet2('module_make.php?action=gethash&email='+email+'&modulname='+modulname);
DedeXHTTP = null;
}
function ShowHideField(cbox,vid,nid)
{
var cboxobj = document.getElementById(cbox);
if(cboxobj.checked)
{
document.getElementById(nid).style.display = 'block';
document.getElementById(vid).style.display = 'none';
}
else
{
document.getElementById(nid).style.display = 'none';
document.getElementById(vid).style.display = 'block';
}
}
function ShowHideMb(rbox1,nid)
{
var rboxobj = document.getElementById(rbox1);
if(rboxobj.checked)
{
document.getElementById(nid).style.display = 'none';
}
else
{
document.getElementById(nid).style.display = 'block';
}
}
</script>
<title>模块打包</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<style>
td{padding-left:8px}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<script language="javascript" src="../static/js/dedeajax2.js"></script>
<script language="javascript">
function ShowHideField(cbox, vid, nid) {
var cboxobj = document.getElementById(cbox);
if (cboxobj.checked) {
document.getElementById(nid).style.display = 'block';
document.getElementById(vid).style.display = 'none';
}
else {
document.getElementById(nid).style.display = 'none';
document.getElementById(vid).style.display = 'block';
}
}
function ShowHideMb(rbox1, nid) {
var rboxobj = document.getElementById(rbox1);
if (rboxobj.checked) {
document.getElementById(nid).style.display = 'none';
}
else {
document.getElementById(nid).style.display = 'block';
}
}
</script>
<title>模块打包</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<style>
td {
padding-left: 8px
}
</style>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;"><b>模块管理</b></div>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable" style="background:#CFCFCF;">
<form action="module_make.php" method="post" enctype="multipart/form-data" name="form1">
<input type='hidden' name='action' value='make'>
<tr>
<td height="20" colspan="2" bgcolor="#EDF9D5" background="images/tbg.gif" style="padding-left:10px;"><a href="module_main.php"><u><b>模块管理</b></u></a>
&gt; <b> 模块打包:</b> </td>
</tr>
<tr>
<td width="19%" align="center" bgcolor="#FFFFFF"><b>模块名称:</b></td>
<td width="81%" bgcolor="#FFFFFF">
<input name="modulname" type="text" id="modulname" style="width:180px" class='alltxt'/> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>语言编码:</b></td>
<td bgcolor="#FFFFFF">
<b><?php echo $cfg_soft_lang; ?></b>
(不同编码模块可以使用,但不能在此打包)
<input name="lang" type="hidden" value='<?php echo $cfg_soft_lang; ?>' />
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>封装类型:</b></td>
<td bgcolor="#FFFFFF">
<label><input name="moduletype" type="radio" id="moduletype1" class='np' value='soft' checked='1' /> 模块</label>
<label><input name="moduletype" type="radio" id="moduletype2" class='np' value='templets' /> 模板</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='plus' /> 小插件</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='patch' /> 补丁</label>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发者ID:</b></td>
<td bgcolor="#FFFFFF">
<input name="dev_id" type="text" id="dev_id" style="width:180px" class='alltxt'/> <a href="<?php echo $cfg_biz_dedebizUrl;?>/developer" target="_blank" class="text-success">如何获取开发者ID?</a>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>发布时间:</b></td>
<td bgcolor="#FFFFFF">
<input name="mtime" type="text" id="mtime" style="width:180px" value="<?php echo GetDateMk(time()); ?>" class='alltxt'/> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>是否涉及会员系统:</b></td>
<td bgcolor="#FFFFFF">
<label><input name="ismember" type="radio" class='np' id="ismember0" value="0" onclick="ShowHideMb('ismember0','rboxct')" checked="checked" />
不涉及</label>
<label><input name="ismember" type="radio" id="ismember1" value="1" onclick="ShowHideMb('ismember0','rboxct')" class='np' /> 涉及</label>
<div id='rboxct' style='display:none'>
导航使用名称:
<input name="indexname" type="text" id="indexname" style="width:180px" value=""/>
<br />
导航使用网址:
<input name="indexurl" type="text" id="indexurl" style="width:180px" value="" />
(用相对于会员中心的网址,如:../ask)
</div>
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;"><b>模块管理</b></div>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable"
style="background:#CFCFCF;">
<form action="module_make.php" method="post" enctype="multipart/form-data" name="form1">
<input type='hidden' name='action' value='make'>
<tr>
<td height="20" colspan="2" bgcolor="#EDF9D5" background="images/tbg.gif" style="padding-left:10px;"><a
href="module_main.php"><u><b>模块管理</b></u></a>
&gt; <b> 模块打包:</b> </td>
</tr>
<tr>
<td width="19%" align="center" bgcolor="#FFFFFF"><b>模块名称:</b></td>
<td width="81%" bgcolor="#FFFFFF">
<input name="modulname" type="text" id="modulname" style="width:180px" class='alltxt' /> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>语言编码:</b></td>
<td bgcolor="#FFFFFF">
<b><?php echo $cfg_soft_lang; ?></b>
(不同编码模块可以使用,但不能在此打包)
<input name="lang" type="hidden" value='<?php echo $cfg_soft_lang; ?>' />
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>封装类型:</b></td>
<td bgcolor="#FFFFFF">
<label><input name="moduletype" type="radio" id="moduletype1" class='np' value='soft' checked='1' />
模块</label>
<label><input name="moduletype" type="radio" id="moduletype2" class='np' value='templets' /> 模板</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='plus' /> 小插件</label>
<label><input name="moduletype" type="radio" id="moduletype3" class='np' value='patch' /> 补丁</label>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发者ID:</b></td>
<td bgcolor="#FFFFFF">
<input name="dev_id" type="text" id="dev_id" style="width:180px" class='alltxt' /> <a
href="<?php echo $cfg_biz_dedebizUrl;?>/developer" target="_blank" class="text-success">如何获取开发者ID?</a>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>发布时间:</b></td>
<td bgcolor="#FFFFFF">
<input name="mtime" type="text" id="mtime" style="width:180px" value="<?php echo GetDateMk(time()); ?>"
class='alltxt' /> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>是否涉及会员系统:</b></td>
<td bgcolor="#FFFFFF">
<label><input name="ismember" type="radio" class='np' id="ismember0" value="0"
onclick="ShowHideMb('ismember0','rboxct')" checked="checked" />
不涉及</label>
<label><input name="ismember" type="radio" id="ismember1" value="1" onclick="ShowHideMb('ismember0','rboxct')"
class='np' /> 涉及</label>
<div id='rboxct' style='display:none'>
导航使用名称:
<input name="indexname" type="text" id="indexname" style="width:180px" value="" />
<br />
导航使用网址:
<input name="indexurl" type="text" id="indexurl" style="width:180px" value="" />
(用相对于会员中心的网址,如:../ask)
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>后台管理菜单:</b></td>
<td bgcolor="#FFFFFF">
<textarea name="menustring" rows="8" id="menustring" style="width:80%"></textarea>
<br />
(普通插件或模板、补丁类不要填写,模块菜单格式请参考inc/inc_menu_module.php)
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>使用说明文件:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autoreadme" value='1' id="autoreadme" class="np" onclick="ShowHideField('autoreadme','autoreadmeinput','autoreadmect')" />
直接填写</label>
<br />
<div style='display:block' id='autoreadmeinput'>
<input name="readme" type="file" id="readme" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autoreadmect'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>填写使用协议或说明:</b>
<br /> 如果需要带HTML格式,请编译后点击修改时使用HTML
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="readmetxt" rows="10" id="readmetxt" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>安装程序:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autosetup" value='1' id="autosetup" class="np" onclick="ShowHideField('autosetup','autosetupinput','autosetupct')" />
自动生成(由系统自动处理安装)</label>
<br />
<div style='display:block' id='autosetupinput'>
<input name="setup" type="file" id="setup" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autosetupct'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>请使用MySQL4.0版本格式的SQL语句:</b>
<br />
MySQL4.1/5.x版本请把创建表语句 ENGINE=MyISAM DEFAULT CHARSET=* ,改为 TYPE=MyISAM ,SQL语句允许换行,但必须用 ";换行" 表示一条SQL语句结束
<br />
如果SQL中包含有模块网址的,用 _ROOTURL_ 表示,如:_ROOTURL_/ask/index.php
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="setupsql40" rows="10" id="setupsql40" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>后台管理菜单:</b></td>
<td bgcolor="#FFFFFF">
<textarea name="menustring" rows="8" id="menustring" style="width:80%"></textarea>
<br />
(普通插件或模板、补丁类不要填写,模块菜单格式请参考inc/inc_menu_module.php)
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>使用说明文件:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autoreadme" value='1' id="autoreadme" class="np"
onclick="ShowHideField('autoreadme','autoreadmeinput','autoreadmect')" />
直接填写</label>
<br />
<div style='display:block' id='autoreadmeinput'>
<input name="readme" type="file" id="readme" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autoreadmect'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>填写使用协议或说明:</b>
<br /> 如果需要带HTML格式,请编译后点击修改时使用HTML
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="readmetxt" rows="10" id="readmetxt" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>安装程序:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autosetup" value='1' id="autosetup" class="np"
onclick="ShowHideField('autosetup','autosetupinput','autosetupct')" />
自动生成(由系统自动处理安装)</label>
<br />
<div style='display:block' id='autosetupinput'>
<input name="setup" type="file" id="setup" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autosetupct'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>请使用MySQL4.0版本格式的SQL语句:</b>
<br />
MySQL4.1/5.x版本请把创建表语句 ENGINE=MyISAM DEFAULT CHARSET=* ,改为 TYPE=MyISAM ,SQL语句允许换行,但必须用 ";换行"
表示一条SQL语句结束
<br />
如果SQL中包含有模块网址的,用 _ROOTURL_ 表示,如:_ROOTURL_/ask/index.php
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="setupsql40" rows="10" id="setupsql40" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>删除程序:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autodel" value='1' id="autodel" class="np" onclick="ShowHideField('autodel','autodelinput','autodelct')" />
自动生成(由系统自动处理卸载)</label>
<br />
<div style='display:block' id='autodelinput'>
<input name="uninstall" type="file" id="uninstall" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autodelct'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>卸载时执行的SQL语句:</b>
<br />
(SQL允许换行,但必须用 ";换行" 表示一条SQL语句结束)
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="delsql" rows="10" id="delsql" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>删除程序:</b></td>
<td bgcolor="#FFFFFF">
<label><input type="checkbox" name="autodel" value='1' id="autodel" class="np"
onclick="ShowHideField('autodel','autodelinput','autodelct')" />
自动生成(由系统自动处理卸载)</label>
<br />
<div style='display:block' id='autodelinput'>
<input name="uninstall" type="file" id="uninstall" style="width:350px" />
</div>
<div style='margin:5px 0px 5px 5px;display:none' id='autodelct'>
<table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#83B771">
<tr>
<td width="75%" bgcolor="#F3FDE1">
<b>卸载时执行的SQL语句:</b>
<br />
(SQL允许换行,但必须用 ";换行" 表示一条SQL语句结束)
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<textarea name="delsql" rows="10" id="delsql" style="width:99%"></textarea>
</td>
</tr>
</table>
</div>
</td>
</tr>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>文件列表:</b></td>
<td bgcolor="#FFFFFF">
<p>
每行指定一个文件或目录,路径为相对于本目录,本目录的文件则直接用文件名即可,对于整个打包的目录,不需要指定子目录里的文件。<br />
如:如果已经指定了: ../book 则不需要再指定目录里的 ../book/index.php 等文件或目录,系统会自动索引整个目录,<br />
对于不需要索引整个目录的,请不要指定这个目录,否则可能会把不必要的文件也放进模块中。 <br />
<textarea name="filelist" rows="8" id="filelist" style="width:80%"></textarea>
</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>文件列表:</b></td>
<td bgcolor="#FFFFFF">
<p>
每行指定一个文件或目录,路径为相对于本目录,本目录的文件则直接用文件名即可,对于整个打包的目录,不需要指定子目录里的文件。<br />
如:如果已经指定了: ../book 则不需要再指定目录里的 ../book/index.php 等文件或目录,系统会自动索引整个目录,<br />
对于不需要索引整个目录的,请不要指定这个目录,否则可能会把不必要的文件也放进模块中。 <br />
<textarea name="filelist" rows="8" id="filelist" style="width:80%"></textarea>
</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发者私钥:</b></td>
<td bgcolor="#FFFFFF">
<p>
开发者认证后获取的私钥
<br />
<textarea name="filelist" rows="8" id="filelist" style="width:80%"></textarea>
</p>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><b>开发者私钥:</b></td>
<td bgcolor="#FFFFFF">
<p>
开发者认证后获取的私钥
<br />
<textarea name="priv" rows="8" id="priv" style="width:80%"></textarea>
</p>
</td>
</tr>
<tr bgcolor="#F9FDF0">
<td height="28" colspan="2" bgcolor="#F9FCEF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="26%">&nbsp;</td>
<td width="15%">
<button name="imageField" type="submit" class="btn btn-secondary">提交</button>
</td>
<td width="59%">
<button type="button" name="button" id="button" onClick="location='plus_main.php';" class="btn btn-secondary">返回</button>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<tr bgcolor="#F9FDF0">
<td height="28" colspan="2" bgcolor="#F9FCEF">
<div class="alert alert-info" role="alert">
制作模块即表示你同意<a href="<?php echo $cfg_biz_dedebizUrl;?>/license_developer" target="_blank">《DedeBIZ开发者协议》</a>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="26%">&nbsp;</td>
<td width="15%">
<button name="imageField" type="submit" class="btn btn-secondary">提交</button>
</td>
<td width="59%">
<button type="button" name="button" id="button" onClick="location='module_main.php';"
class="btn btn-secondary">返回</button>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</body>
</html>

+ 1
- 1
src/include/common.inc.php Vedi File

@@ -44,7 +44,7 @@ NQabUzX9JoYtXqPcpZRT7ymHrppU0KFdUSEJiW0utTWJo0HrDOBIT5qWlM0MP9p/
PwIDAQAB
-----END PUBLIC KEY-----
EOT); // DedeBIZ系统公钥
define('DEDECDNURL', 'https://cdn.dedebiz.com'); // 默认静态资源地址

if (version_compare(PHP_VERSION, '5.3.0', '<') && function_exists("get_magic_quotes_gpc"))
{


+ 16
- 2
src/include/dedemodule.class.php Vedi File

@@ -12,6 +12,16 @@ require_once(DEDEINC . '/charset.func.php');
require_once(DEDEINC . '/dedeatt.class.php');
require_once(DEDEINC . '/dedehttpdown.class.php');
function base64url_encode($data)
{
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data)
{
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
class DedeModule
{
var $modulesPath;
@@ -160,7 +170,7 @@ class DedeModule
} else $filename = $this->modulesPath . '/' . $this->GetHashFile($hash);
$start = 0;
$minfos = array();
$minfos['name'] = $minfos['team'] = $minfos['time'] = $minfos['email'] = $minfos['url'] = '';
$minfos['name'] = $minfos['info'] = $minfos['time'] = '';
$minfos['hash'] = $minfos['indexname'] = $minfos['indexurl'] = '';
$minfos['ismember'] = $minfos['autosetup'] = $minfos['autodel'] = 0;
//$minfos['filename'] = $filename;
@@ -173,19 +183,23 @@ class DedeModule
while (!feof($fp)) {
$n++;
if ($n > 30) break;
$line = fgets($fp, 256);
$line = fgets($fp, 1024);
if ($start == 0) {
if (preg_match("/<baseinfo/is", $line)) $start = 1;
} else {
if (preg_match("/<\/baseinfo/is", $line)) break;
$line = trim($line);
list($skey, $svalue) = explode('=', $line);
$skey = trim($skey);
$minfos[$skey] = $svalue;
}
}
fclose($fp);
if (empty($minfos['lang'])) {
$minfos['lang'] = "utf-8";
}
if (isset($minfos['lang'])) $this->moduleLang = trim($minfos['lang']);
else $this->moduleLang = 'gbk';


Loading…
Annulla
Salva