$dedefileindex = $i; break; } } } if ($dedefileindex == -1) { unlink($tmpfilename); ShowMsg("对不起,你上传的压缩包中不存在dede模块文件!<br /><br /><a href='javascript:history.go(-1);'>>>返回重新上传>></a>", "javascript:;"); exit; } $ziptmp = $mdir . '/ziptmp'; $z->Extract($tmpfilename, $ziptmp, $dedefileindex); unlink($tmpfilename); $tmpfilename = $mdir . "/ziptmp/" . $dedefile; } $dm = new DedeModule($mdir); $infos = $dm->GetModuleInfo($tmpfilename, 'file'); if (empty($infos['hash'])) { unlink($tmpfilename); $dm->Clear(); ShowMsg("对不起,你上传的文件可能不是织梦模块的标准格式文件!<br /><br /><a href='javascript:history.go(-1);'>>>返回重新上传>></a>", "javascript:;"); exit; } $okfile = $mdir . '/' . $infos['hash'] . '.xml'; if ($dm->HasModule($infos['hash']) && empty($delhas)) { unlink($tmpfilename); $dm->Clear(); ShowMsg("对不起,你上传的模块已经存在,<br />如果要覆盖请先删除原来版本或选择强制删除的选项!<br /><br /><a href='javascript:history.go(-1);'>>>返回重新上传>></a>", "javascript:;"); exit; } @unlink($okfile);
} else { $setupinfo = "未安装 <a href='module_main.php?action=setup&hash={$hash}'>安装</a>"; } $win = new OxWindow(); $win->Init("", "js/blank.js", ""); $wecome_info = "模块管理"; $win->AddTitle("<a href='module_main.php'>模块管理</a> >> 模块详情: {$infos['name']}"); $msg = "<style>.dtb{border-bottom:1px dotted #cccccc}</style>\r\n <table width='98%' border='0' cellspacing='0' cellpadding='0'>\r\n <tr>\r\n <td width='20%' height='28' class='dtb'>模块名称:</td>\r\n <td width='80%' class='dtb'>{$infos['name']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>语言:</td>\r\n <td class='dtb'>{$infos['lang']} {$alertMsg}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>文件大小:</td>\r\n <td class='dtb'>{$infos['filesize']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>是否已安装:</td>\r\n <td class='dtb'>{$setupinfo}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>团队名称:</td>\r\n <td class='dtb'>{$infos['team']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>发布时间:</td>\r\n <td class='dtb'>{$infos['time']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>电子邮箱:</td>\r\n <td class='dtb'>{$infos['email']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>官方网址:</td>\r\n <td class='dtb'>{$infos['url']}</td>\r\n </tr>\r\n <tr>\r\n <td height='28' class='dtb'>使用协议:</td>\r\n <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td>\r\n </tr>\r\n <tr>\r\n <td height='28'>模块包含的文件:<br />(文件路径相对于当前目录)</td><td> </td>\r\n </tr>\r\n <tr>\r\n <td height='164' colspan='2'>\r\n <textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>\r\n </td>\r\n </tr>\r\n</table>\r\n "; $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>{$msg}</div>"); $winform = $win->GetWindow('hand', ''); $win->Display(); $dm->Clear(); exit; } 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 = htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40')); $readmetxt = $dm->GetSystemFile($hash, 'readme'); $delsql = $dm->GetSystemFile($hash, 'delsql'); $filelist = $dm->GetSystemFile($hash, 'oldfilelist', false); $indexurl = str_replace('**', '=', $indexurl); $dm->Clear();
$msg .= "<a href='module-install.php?step=9999' target='_top'>点击此完成安装 >></a>"; ShowMsg($msg, "javascript:;"); exit; } include $moduleCacheFile; $modules = split(',', $selModule); $totalMod = count($modules); if ($step >= $totalMod) { $msg = "<font color='red'>完成所有模块的安装!</font><br /><br />"; $msg .= "<a href='module-install.php?step=9999' target='_top'>点击此进行下一步操作 >></a>"; ShowMsg($msg, 'javascript:;'); exit; } $moduleHash = $modules[$step]; $moduleFile = $allmodules[$moduleHash]; $dm = new DedeModule($moduleDir); $minfos = $dm->GetModuleInfo($moduleHash); extract($minfos, EXTR_SKIP); $menustring = addslashes($dm->GetSystemFile($moduleHash, 'menustring')); $query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` )\r\n VALUES ('{$moduleHash}' , '{$name}' , '{$indexname}' , '{$indexurl}' , '{$ismember}' , '{$menustring}' ) "; $rs = $dsql->ExecuteNoneQuery("Delete From `#@__sys_module` where hashcode like '{$moduleHash}' "); $rs = $dsql->ExecuteNoneQuery($query); if (!$rs) { $msg = "<font color='red'>保存数据库信息失败,无法完成你选择的模块安装!</font><br /><br />"; $msg .= "<a href='module-install.php?step=9999' target='_top'>点击此进行下一步操作 >></a>"; exit; } //写文件 $dm->WriteFiles($moduleHash, 1); $dm->WriteSystemFile($moduleHash, 'readme'); $setupsql = $dm->GetSystemFile($moduleHash, 'setupsql40');
} if (!isset($autosetup)) { $autosetup = 0; } if (!isset($autodel)) { $autodel = 0; } $mdir = DEDEROOT . '/data/module'; $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); $readmef = base64_encode($readmetxt); $setupf = $uninstallf = ''; //编译setup文件 if (is_uploaded_file($setup)) { move_uploaded_file($setup, $mdir . "/{$hashcode}-s.php") or die("你没上传,或系统无法把setup文件移动到 module 目录!"); $setupf = $dm->GetEncodeFile($mdir . "/{$hashcode}-s.php", true); } else { if ($autosetup == 0) { $setupf = base64_encode($dm->GetSystemFile($hashcode, 'setup')); } } //编译uninstall文件 if (is_uploaded_file($uninstall)) { move_uploaded_file($uninstall, $mdir . "/{$hashcode}-u.php") or die("你没上传,或系统无法把uninstall文件移动到 module 目录!"); $uninstallf = $dm->GetEncodeFile($mdir . "/{$hashcode}-u.php", true);
</td> </tr> </table> "; $win->AddMsgItem("<div style='padding-left:20px;line-height:150%'>$msg</div>"); $winform = $win->GetWindow("hand",""); $win->Display(); $dm->Clear(); exit(); } /*-------------- function EditOne(); --------------*/ else if($action=='edit') { $dm = new DedeModule($mdir); $minfos = $dm->GetModuleInfo($hash); $modulname = $minfos['name']; $team = $minfos['team']; $mtime = $minfos['time']; $email = $minfos['email']; $url = $minfos['url']; /* $filelists = $dm->GetFileLists($hash); $filelist = ''; $setupinfo = ''; $ds = array(); foreach($filelists as $v) { if(empty($v['name'])) continue; $sonfile = false;
{ $filelist = str_replace("\r","\n",trim($filelist)); $filelist = trim(ereg_replace("[\n]{1,}","\n",$filelist)); if($filelist==""){ ShowMsg("对不起,你没有指定模块的文件列表,因此不能创建项目!","-1"); exit(); } foreach($_POST as $k=>$v) $$k = stripslashes($v); $mdir = dirname(__FILE__).'/module'; $hashcode = $hash; $moduleFilename = $mdir.'/'.$hashcode.'.dev'; $modulname = str_replace('=','',$modulname); $email = str_replace('=','',$email); $team = str_replace('=','',$team); $dm = new DedeModule($mdir); if(is_uploaded_file($readme)){ move_uploaded_file($readme,$mdir."/{$hashcode}-r.html") or die("你没上传,或系统无法把readme文件移动到 module 目录!"); $readmef = $dm->GetEncodeFile($mdir."/{$hashcode}-r.html",true); }else{ $readmef = base64_encode($dm->GetSystemFile($hashcode,'readme')); } if(is_uploaded_file($setup)){ move_uploaded_file($setup,$mdir."/{$hashcode}-s.php") or die("你没上传,或系统无法把setup文件移动到 module 目录!"); $setupf = $dm->GetEncodeFile($mdir."/{$hashcode}-s.php",true); }else{ $setupf = base64_encode($dm->GetSystemFile($hashcode,'setup')); } if(is_uploaded_file($uninstall)){ move_uploaded_file($uninstall,$mdir."/{$hashcode}-u.php") or die("你没上传,或系统无法把uninstall文件移动到 module 目录!");
/** * caijixia for dedecms * @version $Id: cjx.class.php 112 2013-05-28 01:22:57Z qinjinpeng $ * @copyright Copyright (c) 2011,caijixia for dedecms,caijixia.com. * @license This is NOT a freeware, use is subject to license terms * * @param NULL * @return NULL */ function ac_updatenow() { require_once DEDEINC . "/dedemodule.class.php"; $mdir = DEDEDATA . '/module'; $ver = $this->gv('ver'); $file = $this->downfile('http://www.dedeapps.com/uploads/onlineupdate/' . $ver . '_' . $this->gv('soft_lang') . '.xml'); file_put_contents($mdir . '/cjxupdate.xml', $file); $dm = new DedeModule($mdir); $infos = $dm->GetModuleInfo($mdir . '/cjxupdate.xml', 'file'); if (empty($infos['hash'])) { ShowMsg('升级失败', 1, 2); exit; } copy($mdir . '/cjxupdate.xml', $mdir . '/' . $infos['hash'] . '.xml'); $dm->WriteFiles($infos['hash'], 1); @unlink($mdir . '/cjxupdate.xml'); @unlink($mdir . '/' . $infos['hash'] . '.xml'); ShowMsg('升级完成', 1, 2); }