]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge branch 'fabrixxm-master'
[friendica.git] / boot.php
index 3cc98cc9b6febe84034872b87d26d5da8d20c68a..223c9416d1c62d4e07dd78ee8d245efbd08d2dc7 100644 (file)
--- 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');
@@ -2225,7 +2224,31 @@ function prepare_body($item) {
        $s = smilies(bbcode($item['body']));
 
        return $s;
+}}
 
+/**
+ * 
+ * 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();
+       call_hooks("proc_run", $args);
+       
+       foreach ($args as &$arg){
+               if(is_string($arg)) $arg='"'.$arg.'"';
+       }
+       $cmdline = implode($args," ");
+       proc_close(proc_open($cmdline." &",array(),$foo));
+}}
 
-}}
\ No newline at end of file