From e9251499dd63523a552bc3bf6274e3b851cba4c8 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 24 Jan 2011 22:00:02 +0100 Subject: Added proc_run() and modified all occurrence of proc_close(proc_open()) to use proc_run() --- boot.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 86ad29296..207faaf48 100644 --- a/boot.php +++ b/boot.php @@ -2215,3 +2215,33 @@ function link_compare($a,$b) { return true; return false; }} + + +/** + * + * Wrap calls to proc_close(proc_open()) and call hook + * so plugins can take part in process :) + * + * args: + * $cmd program to run + * next args are passed as $cmd command line + * + * e.g.: proc_run("ls","-la","/tmp"); + * + * $cmd and string args are surrounded with "" + */ +if(! function_exists('run_proc')) { +function proc_run($cmd){ + $args = func_get_args(); + foreach ($args as &$arg){ + if(is_string($arg)) $arg='"'.$arg.'"'; + } + $cmdline = implode($args," "); + + call_hooks("proc_run", $args); + + proc_close(proc_open($cmdline." &",array(),$foo)); +}} + +?> + -- cgit v1.2.3 From 517d6812dabfbb93b34045048e8894fb54d220a7 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 28 Jan 2011 14:01:50 +0100 Subject: cal proc_run hook before string escape --- boot.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 207faaf48..d3187648c 100644 --- a/boot.php +++ b/boot.php @@ -1655,7 +1655,6 @@ function attribute_contains($attr,$s) { if(! function_exists('logger')) { function logger($msg,$level = 0) { - $debugging = get_config('system','debugging'); $loglevel = intval(get_config('system','loglevel')); $logfile = get_config('system','logfile'); @@ -2233,15 +2232,13 @@ function link_compare($a,$b) { if(! function_exists('run_proc')) { function proc_run($cmd){ $args = func_get_args(); + call_hooks("proc_run", $args); + foreach ($args as &$arg){ if(is_string($arg)) $arg='"'.$arg.'"'; } $cmdline = implode($args," "); - - call_hooks("proc_run", $args); - proc_close(proc_open($cmdline." &",array(),$foo)); }} -?> - +?> \ No newline at end of file -- cgit v1.2.3