Commit c4c11d9c authored by Medicean's avatar Medicean

(New:Core) 新增 PHP4 类型

parent 6cdd78eb
......@@ -14,7 +14,7 @@ class Core {
constructor() {
// 加载子模块列表
let cores = {};
['php', 'asp', 'aspx', 'custom'].map((_) => {
['php', 'asp', 'aspx', 'custom', 'php4'].map((_) => {
cores[_] = require(`./${_}/index`);
});
// 返回子模块对象
......
/**
* PHP4 服务端脚本模板
*/
'use strict';
//const Base = require('../base');
const PHP = require('../php/index');
class PHP4 extends PHP {
/**
* HTTP请求数据组合函数
* @param {Object} data 通过模板解析后的代码对象
* @return {Promise} 返回一个Promise操作对象
*/
complete(data) {
// 分隔符号
let tag_s = Math.random().toString(16).substr(2, 5); // "->|";
let tag_e = Math.random().toString(16).substr(2, 5); // "|<-";
// 组合完整的代码
let tmpCode = data['_'];
data['_'] = `@ini_set("display_errors", "0");@set_time_limit(0);echo "${tag_s}";${tmpCode};echo "${tag_e}";die();`;
// 使用编码器进行处理并返回
return this.encodeComplete(tag_s, tag_e, data);
}
}
module.exports = PHP4;
......@@ -287,7 +287,15 @@ class Form {
let ret = [];
for (let c in antSword['core']) {
// 加载默认编码器和用户自定义编码器
let encoders = antSword['core'][c].prototype.encoders.concat(antSword['encoders'][c]);
let encoders;
switch(c){
case 'php4':
encoders = antSword['core']['php4'].prototype.encoders.concat(antSword['encoders']['php']);
break;
default:
encoders = antSword['core'][c].prototype.encoders.concat(antSword['encoders'][c]);
break;
}
ret.push({
text: c.toUpperCase(), value: c,
selected: c === _default,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment