module_main.php
来自「这是matlab的一个小程序」· PHP 代码 · 共 624 行 · 第 1/2 页
PHP
624 行
<td class='dtb'>{$infos['lang']} {$alertMsg}</td>
</tr>
<tr>
<td width='200' height='28' class='dtb'>文件大小:</td>
<td width='550' class='dtb'>{$infos['filesize']}</td>
</tr>
<tr>
<td height='28' class='dtb'>团队名称:</td>
<td class='dtb'>{$infos['team']}</td>
</tr>
<tr>
<td height='28' class='dtb'>发布时间:</td>
<td class='dtb'>{$infos['time']}</td>
</tr>
<tr>
<td height='28' class='dtb'>电子邮箱:</td>
<td class='dtb'>{$infos['email']}</td>
</tr>
<tr>
<td height='28' class='dtb'>官方网址:</td>
<td class='dtb'>{$infos['url']}</td>
</tr>
<tr>
<td height='28' class='dtb'>使用协议:</td>
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td>
</tr>
<tr>
<td height='28' colspan='2'>
删除模块仅删除这个模块的安装包文件,如果你已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'><u>卸载程序</u></a>来删除!
</td>
</tr>
</table>
";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok","");
$win->Display();
$dm->Clear();
exit();
}
else if($action=='delok')
{
$dm = new DedeModule($mdir);
$modfile = $mdir."/".$dm->GetHashFile($hash);
unlink($modfile) or die("删除文件 {$modfile} 失败!");
ShowMsg("成功删除一个模块文件!","module_main.php");
exit();
}
/*--------------
function UnInstall();
--------------*/
else if($action=='uninstall')
{
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if($infos['url']=='') $infos['url'] = ' ';
$alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '<br /><font color="red">(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)</font>');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
foreach($filelists as $v)
{
if(empty($v['name'])) continue;
if($v['type']=='dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
$win = new OxWindow();
$win->Init("module_main.php","js/blank.js","post");
$win->mainTitle = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> >> 卸载模块: {$infos['name']}");
$win->AddHidden("hash",$hash);
$win->AddHidden("action",'uninstallok');
$msg = "<style>.dtb{border-bottom:1px dotted #cccccc}</style>
<table width='750' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='200' height='28' class='dtb'>模块名称:</td>
<td width='550' class='dtb'>{$infos['name']}</td>
</tr>
<tr>
<td height='28' class='dtb'>语言:</td>
<td class='dtb'>{$infos['lang']} {$alertMsg}</td>
</tr>
<tr>
<td width='200' height='28' class='dtb'>文件大小:</td>
<td width='550' class='dtb'>{$infos['filesize']}</td>
</tr>
<tr>
<td height='28' class='dtb'>团队名称:</td>
<td class='dtb'>{$infos['team']}</td>
</tr>
<tr>
<td height='28' class='dtb'>发布时间:</td>
<td class='dtb'>{$infos['time']}</td>
</tr>
<tr>
<td height='28' class='dtb'>电子邮箱:</td>
<td class='dtb'>{$infos['email']}</td>
</tr>
<tr>
<td height='28' class='dtb'>官方网址:</td>
<td class='dtb'>{$infos['url']}</td>
</tr>
<tr>
<td height='28' class='dtb'>使用协议:</td>
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td>
</tr>
<tr>
<td height='28'>模块包含的文件:<br />(文件路径相对于当前目录)</td><td> </td>
</tr>
<tr>
<td height='164' colspan='2'>
<textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>
</td>
</tr>
<tr>
<td height='28'>对于模块的文件处理方法:</td>
<td>
<input type='radio' name='isreplace' value='0' checked='checked' />
手工删除文件,仅运行卸载程序
<input name='isreplace' type='radio' value='2' />
删除模块的所有文件
</td>
</tr>
</table>
";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok","");
$win->Display();
$dm->Clear();
exit();
}
/*--------------
function UnInstallRun();
--------------*/
else if($action=='uninstallok')
{
$dsql->ExecuteNoneQuery("Delete From `#@__sys_module` where hashcode like '$hash' ");
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if(!isset($moduletype) || $moduletype != 'patch' )
{
$dm->DeleteFiles($hash,$isreplace);
}
@$dm->DelSystemFile($hash,'readme');
@$dm->DelSystemFile($hash,'setup');
$dm->Clear();
if(!isset($autodel) || $autodel==0)
{
include(DEDEROOT."/data/module/{$hash}-uninstall.php");
@unlink(DEDEROOT."/data/module/{$hash}-uninstall.php");
exit();
}
else
{
@$dm->DelSystemFile($hash,'uninstall');
$delsql = $dm->GetSystemFile($hash,'delsql');
if(trim($delsql)!='')
{
$sqls = explode(';', $delsql);
foreach($sqls as $sql)
{
if(trim($sql)!='') $dsql->executenonequery($sql);
}
}
ReWriteConfigAuto();
$rflwft = "<script language='javascript' type='text/javascript'>\r\n";
$rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
$rflwft .= "else top.document.getElementById('menu').src = 'index_menu_module.php';\r\n";
$rflwft .= "</script>";
echo $rflwft;
ShowMsg('模块卸载完成...','module_main.php');
exit();
}
}
/*--------------
function ShowReadme();
--------------*/
else if($action=='showreadme')
{
$dm = new DedeModule($mdir);
$msg = $dm->GetSystemFile($hash,'readme');
$msg = preg_replace("/(.*)<body/isU","",$msg);
$msg = preg_replace("/<\/body>(.*)/isU","",$msg);
$dm->Clear();
$win = new OxWindow();
$win->Init("module_main.php","js/blank.js","post");
$win->mainTitle = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> >> 使用说明:");
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("hand");
$win->Display();
exit();
}
/*--------------
function ViewOne();
--------------*/
else if($action=='view')
{
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if($infos['url']=='') $infos['url'] = ' ';
$alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '<br /><font color="red">(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)</font>');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
$setupinfo = '';
foreach($filelists as $v)
{
if(empty($v['name'])) continue;
if($v['type']=='dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
if(file_exists(DEDEROOT."/data/module/{$hash}-readme.php")) {
$setupinfo = "已安装 <a href='module_main.php?action=uninstall&hash={$hash}'>卸载</a>";
} else {
$setupinfo = "未安装 <a href='module_main.php?action=setup&hash={$hash}'>安装</a>";
}
$win = new OxWindow();
$win->Init("","js/blank.js","");
$win->mainTitle = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> >> 模块详情: {$infos['name']}");
$msg = "<style>.dtb{border-bottom:1px dotted #cccccc}</style>
<table width='98%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='20%' height='28' class='dtb'>模块名称:</td>
<td width='80%' class='dtb'>{$infos['name']}</td>
</tr>
<tr>
<td height='28' class='dtb'>语言:</td>
<td class='dtb'>{$infos['lang']} {$alertMsg}</td>
</tr>
<tr>
<td height='28' class='dtb'>文件大小:</td>
<td class='dtb'>{$infos['filesize']}</td>
</tr>
<tr>
<td height='28' class='dtb'>是否已安装:</td>
<td class='dtb'>{$setupinfo}</td>
</tr>
<tr>
<td height='28' class='dtb'>团队名称:</td>
<td class='dtb'>{$infos['team']}</td>
</tr>
<tr>
<td height='28' class='dtb'>发布时间:</td>
<td class='dtb'>{$infos['time']}</td>
</tr>
<tr>
<td height='28' class='dtb'>电子邮箱:</td>
<td class='dtb'>{$infos['email']}</td>
</tr>
<tr>
<td height='28' class='dtb'>官方网址:</td>
<td class='dtb'>{$infos['url']}</td>
</tr>
<tr>
<td height='28' class='dtb'>使用协议:</td>
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td>
</tr>
<tr>
<td height='28'>模块包含的文件:<br />(文件路径相对于当前目录)</td><td> </td>
</tr>
<tr>
<td height='164' colspan='2'>
<textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>
</td>
</tr>
</table>
";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow('hand','');
$win->Display();
$dm->Clear();
exit();
}
/*--------------
function Edit();
--------------*/
else if($action=='edit')
{
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if(!isset($lang)) $lang = 'gb2312';
if(!isset($moduletype)) $moduletype = 'soft';
$menustring = $dm->GetSystemFile($hash,'menustring');
$setupsql40 = $dm->GetSystemFile($hash,'setupsql40');
$readmetxt = $dm->GetSystemFile($hash,'readme');
$delsql = $dm->GetSystemFile($hash,'delsql');
$filelist = $dm->GetSystemFile($hash,'oldfilelist',false);
$dm->Clear();
require_once(dirname(__FILE__).'/templets/module_edit.htm');
exit();
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?