Ejemplo n.º 1
0
 $dm = new DedeModule($mdir);
 $minfos = $dm->GetModuleInfo($hash);
 extract($minfos, EXTR_SKIP);
 $menustring = addslashes($dm->GetSystemFile($hash, 'menustring'));
 $indexurl = str_replace('**', '=', $indexurl);
 $query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` )\r\n                                    VALUES ('{$hash}' , '{$name}' , '{$indexname}' , '{$indexurl}' , '{$ismember}' , '{$menustring}' ) ";
 $rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '{$hash}' ");
 $rs = $dsql->ExecuteNoneQuery($query);
 if (!$rs) {
     ShowMsg('保存数据库信息失败,无法完成安装!' . $dsql->GetError(), 'javascript:;');
     exit;
 }
 $dm->WriteFiles($hash, $isreplace);
 $filename = '';
 if (!isset($autosetup) || $autosetup == 0) {
     $filename = $dm->WriteSystemFile($hash, 'setup');
 }
 if (!isset($autodel) || $autodel == 0) {
     $dm->WriteSystemFile($hash, 'uninstall');
 }
 $dm->WriteSystemFile($hash, 'readme');
 $dm->Clear();
 //用模块的安装程序安装
 if (!isset($autosetup) || $autosetup == 0) {
     include DEDEDATA . '/module/' . $filename;
     exit;
 } else {
     $mysql_version = $dsql->GetVersion(TRUE);
     //默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~#
     $setupsql = $dm->GetSystemFile($hash, 'setupsql40');
     $setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql);
Ejemplo n.º 2
0
$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'>点击此进行下一步操作 &gt;&gt;</a>";
    exit;
}
//写文件
$dm->WriteFiles($moduleHash, 1);
$dm->WriteSystemFile($moduleHash, 'readme');
$setupsql = $dm->GetSystemFile($moduleHash, 'setupsql40');
//运行SQL
$mysql_version = $dsql->GetVersion(TRUE);
$setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql);
$sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET=' . $cfg_db_language;
if ($mysql_version >= 4.1) {
    $setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql);
}
//_ROOTURL_
if ($cfg_cmspath == '/') {
    $cfg_cmspath = '';
}
$rooturl = $cfg_basehost . $cfg_cmspath;
$setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql);
$setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql);