]> git.mxchange.org Git - friendica.git/commitdiff
Added proc_run() and modified all occurrence of proc_close(proc_open()) to use proc_run()
authorfabrixxm <fabrix.xm@gmail.com>
Mon, 24 Jan 2011 21:00:02 +0000 (22:00 +0100)
committerfabrixxm <fabrix.xm@gmail.com>
Mon, 24 Jan 2011 21:00:02 +0000 (22:00 +0100)
boot.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/follow.php
mod/item.php
mod/like.php
mod/message.php
mod/photos.php
mod/profile_photo.php
mod/profiles.php
mod/settings.php

index 86ad29296cb24091594cfc50c832d1de78264da9..207faaf480e3392f2b597e978ec00b4fe7c5fcb1 100644 (file)
--- 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));
+}}
+
+?>
+
index 41e0771afa6f5b2fe3269517775cdb4004604011..24e8bf106a9a938dcf6e0ddf3352b2839fcbf38f 100644 (file)
@@ -438,8 +438,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
 
                                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
 
-                           proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &",
-                       array(),$foo));
+                           //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", array(),$foo));
+                           proc_run($php_path,"include/notifier.php","activity","$i");
 
                        }
 
index 49356d358c4cd2d217006bca20dad413571d44c6..39d882411076c703661ab1e56a9de5913ac0ede6 100644 (file)
@@ -283,9 +283,9 @@ function dfrn_notify_post(&$a) {
 
                                        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
 
-                                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &", 
-                                               array(),$foo));
-
+                                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &", array(),$foo));
+                                       proc_run($php_path,"include/notifier.php","comment-import","$posted_id");
+                                       
                                        if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
                                                require_once('bbcode.php');
                                                $from = stripslashes($datarray['author-name']);
index e5eb7763bf620eea6a6248384de66e7e2422ebc5..102f46aec6427bee6c02b23127d2257f7912303e 100644 (file)
@@ -206,8 +206,8 @@ function follow_post(&$a) {
        // pull feed and consume it, which should subscribe to the hub.
 
        $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-       proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
-
+       //proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
+       proc_run($php_path,"include/poller.php","$contact_id");
 
        // create a follow slap
 
index feef7c95f8f5f3cea88e23579110e81b292bd130..11e79a7ab291fcf3655aa07290c6e2a91c85967f 100644 (file)
@@ -421,8 +421,7 @@ function item_post(&$a) {
 
        logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
 
-       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
-               array(),$foo));
+  proc_run($php_path, "include/notifier.php", $notify_type, "$post_id");
 
        $datarray['id'] = $post_id;
 
@@ -520,8 +519,8 @@ function item_content(&$a) {
                        
                        // send the notification upstream/downstream as the case may be
 
-                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &",
-                               array(), $foo));
+                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo));
+                       proc_run($php_path,"include/notifier.php","drop","$drop_id");
 
                        goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
                        return; //NOTREACHED
index 7b20975781452166f942c333b65abf9b28f520ea..c78c1f030ca71d364d9e732f9ad0f28e1983d64d 100644 (file)
@@ -102,8 +102,8 @@ function like_content(&$a) {
                );
 
                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-               proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &",
-                       array(),$foo));
+               //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
+               proc_run($php_path,"include/notifier.php","like","$post_id");
                return;
        }
 
@@ -176,8 +176,8 @@ EOT;
 
        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
 
-       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &",
-               array(),$foo));
+       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
+       proc_run($php_path,"include/notifier.php","like","$post_id");
 
        return; // NOTREACHED
 }
\ No newline at end of file
index 9cc2e2826cf0e5d6eae7d45a6609d2e52cefda77..7615f22bec727ff4ec22b63ba3e8d83296f56221 100644 (file)
@@ -72,8 +72,8 @@ function message_post(&$a) {
        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
        
        if($post_id) {
-               proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &",
-                       array(),$foo));
+               //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", array(),$foo));
+               proc_run($php_path,"include/notifier.php","mail","$post_id");
                notice( t('Message sent.') . EOL );
        }
        else {
index e811ca395714ae0ee4915ed07b404b6b489c08b1..11d234bf73bf1a3b44f9cd5a2dcab80d09fc44b6 100644 (file)
@@ -179,9 +179,8 @@ function photos_post(&$a) {
                                        // send the notification upstream/downstream as the case may be
 
                                        if($rr['visible'])
-                                               proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
-                                                       array(),$foo));
-
+                                               //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",array(),$foo));
+                                               proc_run($php_path,"include/notifier.php","drop","$drop_id");
                                }
                        }
                }
@@ -228,8 +227,8 @@ function photos_post(&$a) {
                                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
 
                                if($i[0]['visible'])
-                                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
-                                               array(),$foo));
+                                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",       array(),$foo));
+                                       proc_run($php_path,"include/notifier.php","drop","$drop_id");
                        }
                }
 
@@ -454,8 +453,8 @@ function photos_post(&$a) {
 
                                        $item_id = item_store($arr);
                                        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-                                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",
-                                               array(),$foo));
+                                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",array(),$foo));
+                                       proc_run($php_path,"include/notifier.php","tag","$item_id");
                                }
 
                        }
index 64093b2de0fb4c062dbd3250f003963440e97761..8b72bfca06ee27104e4f450718dc2dd7dceaea44 100644 (file)
@@ -90,8 +90,8 @@ function profile_photo_post(&$a) {
                                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                                $url = $_SESSION['my_url'];
                                if($url && strlen(get_config('system','directory_submit_url')))
-                                       proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
-                                               array(),$foo));
+                                       //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
+                                       proc_run($php_path,"include/directory.php","$url");
                        }
                        else
                                notice( t('Unable to process image') . EOL);
index 0bb476549eb89d93b624c404740b72aba13cd7b3..d74219501a0ce3501888994bf715e908320188af 100644 (file)
@@ -203,8 +203,8 @@ function profiles_post(&$a) {
                        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                        $url = $_SESSION['my_url'];
                        if($url && strlen(get_config('system','directory_submit_url')))
-                               proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
-                                       array(),$foo));
+                               //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", array(),$foo));
+                               proc_run($php_path,"include/directory.php","$url");
                }
        }
 }
index 1923c58da1148d4f69742dd6df209fce410559b3..fd75657c7166fd7eb26f4efd56187fa36425ccf2 100644 (file)
@@ -170,8 +170,8 @@ function settings_post(&$a) {
                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                $url = $_SESSION['my_url'];
                if($url && strlen(get_config('system','directory_submit_url')))
-                       proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
-                               array(),$foo));
+                       //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
+                       proc_run($php_path,"include/directory.php","$url");
        }
 
        $_SESSION['theme'] = $theme;