if (!empty($manifest['upgrade'])) { if (strexists($manifest['upgrade'], '.php')) { if (file_exists($modulepath . $manifest['upgrade'])) { include_once $modulepath . $manifest['upgrade']; } } else { pdo_run($manifest['upgrade']); } } message('模块更新成功!', referer(), 'success'); } else { message('模块更新失败, 请联系模块提供商!'); } } elseif ($do == 'convert') { $id = $_GPC['id']; $manifest = setting_module_manifest($id); if (!empty($manifest) && is_array($manifest)) { message('模块安装配置文件与当前版本兼容, 不需要转换!', '', 'error'); } $m = setting_module_manifest_compat($id); if (empty($m) || empty($m['meta']) || empty($m['convert']) || empty($m['manifest'])) { message('您的模块定义文件完全不兼容, 系统不能支持自动转换. 请联系模块开发者解决.'); } if ($_GPC['confirm'] == '1') { ob_clean(); header('content-type: paint/xml'); header('content-disposition: attachment; filename="manifest.xml"'); exit($m['manifest']); } else { message("当前的模块支持自动转换版本. 将会把模块\"{$m['convert']['title']}\"从版本\"{$m['convert']['compact']}\"转换至当前版本\"" . IMS_VERSION . "\", 继续操作会提示下载新的版本配置文件, 请将生成的配置文件置于模块目录下覆盖后重新安装(转换后有Bug请联系模块开发者), 是否要继续?<a href=\"" . create_url('setting/module/convert', array('id' => $_GPC['id'], 'confirm' => 1)) . '">是</a> <a href="javascript:history.go(-1);">否</a>', '', 'tips'); }
"\t<uninstall><![CDATA[]]></uninstall>".PHP_EOL. "\t<upgrade><![CDATA[]]></upgrade>".PHP_EOL. "</manifest>"; header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header('Content-Encoding: none'); header('Content-Length: '.strlen($xml)); header('Content-Disposition: attachment; filename=manifest.xml'); header('Content-Type: text/xml'); print $xml; } elseif ($do == 'upgrade') { $id = $_GPC['id']; $module = pdo_fetch("SELECT * FROM ".tablename('modules')." WHERE name = '{$id}'"); if (empty($module)) { message('模块已经被卸载或是不存在!', '', 'error'); } $modulepath = IA_ROOT . '/source/modules/' . $id . '/'; $manifest = setting_module_manifest($module['name']); if (!empty($manifest['upgrade'])) { if (strexists($manifest['upgrade'], '.php')) { if (file_exists($modulepath . $manifest['upgrade'])) { include_once $modulepath . $manifest['upgrade']; } } else { pdo_run($manifest['upgrade']); } } pdo_update('modules', array('version' => $manifest['application']['version']), array('name' => $id)); message('模块更新成功!', create_url('setting/module'), 'success'); }