]> git.mxchange.org Git - friendica.git/blob - include/notifier.php
b87aa95b1559c2f1e20d9ad31ea78e2efd95b50c
[friendica.git] / include / notifier.php
1 <?php
2
3 require_once("boot.php");
4
5 function notifier_run($argv, $argc){
6         global $a, $db;
7
8         if(is_null($a)){
9                 $a = new App;
10         }
11   
12         if(is_null($db)) {
13                 @include(".htconfig.php");
14                 require_once("dba.php");
15                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
16                         unset($db_host, $db_user, $db_pass, $db_data);
17         }
18
19         require_once("session.php");
20         require_once("datetime.php");
21         require_once('include/items.php');
22         require_once('include/bbcode.php');
23
24         load_config('config');
25         load_config('system');
26
27         load_hooks();
28
29         if($argc < 3)
30                 return;
31
32         $a->set_baseurl(get_config('system','url'));
33
34         logger('notifier: invoked: ' . print_r($argv,true));
35
36         $cmd = $argv[1];
37
38         switch($cmd) {
39                 case 'mail':
40                 default:
41                         $item_id = intval($argv[2]);
42                         if(! $item_id){
43                                 return;
44                         }
45                         break;
46         }
47
48         $expire = false;
49         $mail = false;
50         $fsuggest = false;
51         $top_level = false;
52         $recipients = array();
53         $url_recipients = array();
54
55         $normal_mode = true;
56
57         if($cmd === 'mail') {
58                 $normal_mode = false;
59                 $mail = true;
60                 $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
61                                 intval($item_id)
62                 );
63                 if(! count($message)){
64                         return;
65                 }
66                 $uid = $message[0]['uid'];
67                 $recipients[] = $message[0]['contact-id'];
68                 $item = $message[0];
69
70         }
71         elseif($cmd === 'expire') {
72                 $normal_mode = false;
73                 $expire = true;
74                 $items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1 
75                         AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP - INTERVAL 10 MINUTE",
76                         intval($item_id)
77                 );
78                 $uid = $item_id;
79                 $item_id = 0;
80                 if(! count($items))
81                         return;
82         }
83         elseif($cmd === 'suggest') {
84                 $normal_mode = false;
85                 $fsuggest = true;
86
87                 $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
88                         intval($item_id)
89                 );
90                 if(! count($suggest))
91                         return;
92                 $uid = $suggest[0]['uid'];
93                 $recipients[] = $suggest[0]['cid'];
94                 $item = $suggest[0];
95         }
96         else {
97
98                 // find ancestors
99                 $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
100                         intval($item_id)
101                 );
102
103                 if((! count($r)) || (! intval($r[0]['parent']))) {
104                         return;
105                 }
106
107                 $target_item = $r[0];
108                 $parent_id = intval($r[0]['parent']);
109                 $uid = $r[0]['uid'];
110                 $updated = $r[0]['edited'];
111
112                 $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer` 
113                         FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d ORDER BY `id` ASC",
114                         intval($parent_id)
115                 );
116
117                 if(! count($items)) {
118                         return;
119                 }
120
121                 // avoid race condition with deleting entries
122
123                 if($items[0]['deleted']) {
124                         foreach($items as $item)
125                                 $item['deleted'] = 1;
126                 }
127
128                 if(count($items) == 1 && $items[0]['uri'] === $items[0]['parent-uri'])
129                         $top_level = true;
130         }
131
132         $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, 
133                 `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, 
134                 `user`.`page-flags`, `user`.`prvnets`
135                 FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` 
136                 WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
137                 intval($uid)
138         );
139
140         if(! count($r))
141                 return;
142
143         $owner = $r[0];
144
145         $hub = get_config('system','huburl');
146
147         // If this is a public conversation, notify the feed hub
148         $public_message = true;
149
150         // fill this in with a single salmon slap if applicable
151         $slap = '';
152
153         if(! ($mail || $fsuggest)) {
154
155                 require_once('include/group.php');
156
157                 $parent = $items[0];
158
159                 // This is IMPORTANT!!!!
160
161                 // We will only send a "notify owner to relay" or followup message if the referenced post
162                 // originated on our system by virtue of having our hostname somewhere
163                 // in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
164                 // if $parent['wall'] == 1 we will already have the parent message in our array
165                 // and we will relay the whole lot.
166  
167                 // expire sends an entire group of expire messages and cannot be forwarded.
168                 // However the conversation owner will be a part of the conversation and will 
169                 // be notified during this run.
170                 // Other DFRN conversation members will be alerted during polled updates.
171
172                 // Diaspora members currently are not notified of expirations, and other networks have
173                 // either limited or no ability to process deletions. We should at least fix Diaspora 
174                 // by stringing togther an array of retractions and sending them onward.
175                  
176         
177                 $localhost = $a->get_hostname();
178                 if(strpos($localhost,':'))
179                         $localhost = substr($localhost,0,strpos($localhost,':'));
180
181                 /**
182                  *
183                  * Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes 
184                  * have been known to cause runaway conditions which affected several servers, along with 
185                  * permissions issues. 
186                  *
187                  */
188  
189                 if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
190                         // local followup to remote post
191                         $followup = true;
192                         $public_message = false; // not public
193                         $conversant_str = dbesc($parent['contact-id']);
194                 }
195                 else {
196                         $followup = false;
197
198                         if((strlen($parent['allow_cid'])) 
199                                 || (strlen($parent['allow_gid'])) 
200                                 || (strlen($parent['deny_cid'])) 
201                                 || (strlen($parent['deny_gid']))) {
202                                 $public_message = false; // private recipients, not public
203                         }
204
205                         $allow_people = expand_acl($parent['allow_cid']);
206                         $allow_groups = expand_groups(expand_acl($parent['allow_gid']));
207                         $deny_people  = expand_acl($parent['deny_cid']);
208                         $deny_groups  = expand_groups(expand_acl($parent['deny_gid']));
209
210                         $conversants = array();
211
212                         foreach($items as $item) {
213                                 $recipients[] = $item['contact-id'];
214                                 $conversants[] = $item['contact-id'];
215                                 // pull out additional tagged people to notify (if public message)
216                                 if($public_message && strlen($item['inform'])) {
217                                         $people = explode(',',$item['inform']);
218                                         foreach($people as $person) {
219                                                 if(substr($person,0,4) === 'cid:') {
220                                                         $recipients[] = intval(substr($person,4));
221                                                         $conversants[] = intval(substr($person,4));
222                                                 }
223                                                 else {
224                                                         $url_recipients[] = substr($person,4);
225                                                 }
226                                         }
227                                 }
228                         }
229
230                         logger('notifier: url_recipients' . print_r($url_recipients,true));
231
232                         $conversants = array_unique($conversants);
233
234
235                         $recipients = array_unique(array_merge($recipients,$allow_people,$allow_groups));
236                         $deny = array_unique(array_merge($deny_people,$deny_groups));
237                         $recipients = array_diff($recipients,$deny);
238
239                         $conversant_str = dbesc(implode(', ',$conversants));
240                 }
241
242                 $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0");
243
244                 if(count($r))
245                         $contacts = $r;
246         }
247
248         $feed_template = get_markup_template('atom_feed.tpl');
249         $mail_template = get_markup_template('atom_mail.tpl');
250
251         $atom = '';
252         $slaps = array();
253
254         $hubxml = feed_hublinks();
255
256         $birthday = feed_birthday($owner['uid'],$owner['timezone']);
257
258         if(strlen($birthday))
259                 $birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
260
261         $atom .= replace_macros($feed_template, array(
262                         '$version'      => xmlify(FRIENDIKA_VERSION),
263                         '$feed_id'      => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ),
264                         '$feed_title'   => xmlify($owner['name']),
265                         '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
266                         '$hub'          => $hubxml,
267                         '$salmon'       => '',  // private feed, we don't use salmon here
268                         '$name'         => xmlify($owner['name']),
269                         '$profile_page' => xmlify($owner['url']),
270                         '$photo'        => xmlify($owner['photo']),
271                         '$thumb'        => xmlify($owner['thumb']),
272                         '$picdate'      => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
273                         '$uridate'      => xmlify(datetime_convert('UTC','UTC',$owner['uri-date']    . '+00:00' , ATOM_TIME)) ,
274                         '$namdate'      => xmlify(datetime_convert('UTC','UTC',$owner['name-date']   . '+00:00' , ATOM_TIME)) ,
275                         '$birthday'     => $birthday
276         ));
277
278         if($mail) {
279                 $public_message = false;  // mail is  not public
280
281                 $body = fix_private_photos($item['body'],$owner['uid']);
282
283                 $atom .= replace_macros($mail_template, array(
284                         '$name'         => xmlify($owner['name']),
285                         '$profile_page' => xmlify($owner['url']),
286                         '$thumb'        => xmlify($owner['thumb']),
287                         '$item_id'      => xmlify($item['uri']),
288                         '$subject'      => xmlify($item['title']),
289                         '$created'      => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
290                         '$content'      => xmlify($body),
291                         '$parent_id'    => xmlify($item['parent-uri'])
292                 ));
293         }
294         elseif($fsuggest) {
295                 $public_message = false;  // suggestions are not public
296
297                 $sugg_template = get_markup_template('atom_suggest.tpl');
298
299                 $atom .= replace_macros($sugg_template, array(
300                         '$name'         => xmlify($item['name']),
301                         '$url'          => xmlify($item['url']),
302                         '$photo'        => xmlify($item['photo']),
303                         '$request'      => xmlify($item['request']),
304                         '$note'         => xmlify($item['note'])
305                 ));
306
307                 // We don't need this any more
308
309                 q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
310                         intval($item['id'])
311                 );
312
313         }
314         else {
315                 if($followup) {
316                         foreach($items as $item) {  // there is only one item
317                                 if(! $item['parent'])
318                                         continue;
319                                 if($item['id'] == $item_id) {
320                                         logger('notifier: followup: item: ' . print_r($item,true), LOGGER_DATA);
321                                         $slap  = atom_entry($item,'html',$owner,$owner,false);
322                                         $atom .= atom_entry($item,'text',$owner,$owner,false);
323                                 }
324                         }
325                 }
326                 else {
327                         foreach($items as $item) {
328
329                                 if(! $item['parent'])
330                                         continue;
331
332                                 // private emails may be in included in public conversations. Filter them.
333
334                                 if(($public_message) && $item['private'])
335                                         continue;
336
337                                 $contact = get_item_contact($item,$contacts);
338                                 if(! $contact)
339                                         continue;
340
341                                 $atom .= atom_entry($item,'text',$contact,$owner,true);
342
343                                 if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire)) 
344                                         $slaps[] = atom_entry($item,'html',$contact,$owner,true);
345                         }
346                 }
347         }
348         $atom .= '</feed>' . "\r\n";
349
350         logger('notifier: ' . $atom, LOGGER_DATA);
351
352         logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
353
354         // If this is a public message and pubmail is set on the parent, include all your email contacts
355
356         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
357
358         if(! $mail_disabled) {
359                 if((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid'])) 
360                         && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid'])) 
361                         && (intval($target_item['pubmail']))) {
362                         $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
363                                 intval($uid),
364                                 dbesc(NETWORK_MAIL)
365                         );
366                         if(count($r)) {
367                                 foreach($r as $rr)
368                                         $recipients[] = $rr['id'];
369                         }
370                 }
371         }
372
373         if($followup)
374                 $recip_str = $parent['contact-id'];
375         else
376                 $recip_str = implode(', ', $recipients);
377
378         $r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 AND `pending` = 0 ",
379                 dbesc($recip_str)
380         );
381
382         // delivery loop
383
384         require_once('include/salmon.php');
385
386         if(count($r)) {
387                 foreach($r as $contact) {
388                         if($contact['self'])
389                                 continue;
390
391                         // potentially more than one recipient. Start a new process and space them out a bit.
392                         // we will deliver single recipient types of message and email receipients here. 
393
394                         if((! $mail) && (! $fsuggest) && (! $followup)) {
395                                 $interval = intval(get_config('system','delivery_interval'));
396                                 if(! $interval)
397                                         $interval = 2;
398
399                                 proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
400                                 sleep($interval);
401                                 continue;
402                         }
403
404                         $deliver_status = 0;
405
406                         logger("main delivery by notifier: followup=$followup mail=$mail fsuggest=$fsuggest");
407
408                         switch($contact['network']) {
409                                 case NETWORK_DFRN:
410                                         logger('notifier: dfrndelivery: ' . $contact['name']);
411                                         $deliver_status = dfrn_deliver($owner,$contact,$atom);
412
413                                         logger('notifier: dfrn_delivery returns ' . $deliver_status);
414         
415                                         if($deliver_status == (-1)) {
416                                                 logger('notifier: delivery failed: queuing message');
417                                                 // queue message for redelivery
418                                                 q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
419                                                         VALUES ( %d, '%s', '%s', '%s') ",
420                                                         intval($contact['id']),
421                                                         dbesc(datetime_convert()),
422                                                         dbesc(datetime_convert()),
423                                                         dbesc($atom)
424                                                 );
425                                         }
426                                         break;
427                                 case NETWORK_OSTATUS:
428
429                                         // Do not send to otatus if we are not configured to send to public networks
430                                         if($owner['prvnets'])
431                                                 break;
432                                         if(get_config('system','ostatus_disabled') || get_config('system','dfrn_only'))
433                                                 break;
434
435                                         if($followup && $contact['notify']) {
436                                                 logger('notifier: slapdelivery: ' . $contact['name']);
437                                                 $deliver_status = slapper($owner,$contact['notify'],$slap);
438
439                                                 if($deliver_status == (-1)) {
440                                                         // queue message for redelivery
441                                                         q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
442                                                                 VALUES ( %d, '%s', '%s', '%s') ",
443                                                                 intval($contact['id']),
444                                                                 dbesc(datetime_convert()),
445                                                                 dbesc(datetime_convert()),
446                                                                 dbesc($slap)
447                                                         );
448
449                                                 }
450                                         }
451                                         else {
452
453                                                 // only send salmon if public - e.g. if it's ok to notify
454                                                 // a public hub, it's ok to send a salmon
455
456                                                 if((count($slaps)) && ($public_message) && (! $expire)) {
457                                                         logger('notifier: slapdelivery: ' . $contact['name']);
458                                                         foreach($slaps as $slappy) {
459                                                                 if($contact['notify']) {
460                                                                         $deliver_status = slapper($owner,$contact['notify'],$slappy);
461                                                                         if($deliver_status == (-1)) {
462                                                                                 // queue message for redelivery
463                                                                                 q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
464                                                                                         VALUES ( %d, '%s', '%s', '%s') ",
465                                                                                         intval($contact['id']),
466                                                                                         dbesc(datetime_convert()),
467                                                                                         dbesc(datetime_convert()),
468                                                                                         dbesc($slappy)
469                                                                                 );                                                              
470                                                                         }
471                                                                 }
472                                                         }
473                                                 }
474                                         }
475                                         break;
476
477                                 case NETWORK_MAIL:
478                                                 
479                                         if(get_config('system','dfrn_only'))
480                                                 break;
481
482                                         // WARNING: does not currently convert to RFC2047 header encodings, etc.
483
484                                         $addr = $contact['addr'];
485                                         if(! strlen($addr))
486                                                 break;
487
488                                         if($cmd === 'wall-new' || $cmd === 'comment-new') {
489
490                                                 $it = null;
491                                                 if($cmd === 'wall-new') 
492                                                         $it = $items[0];
493                                                 else {
494                                                         $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", 
495                                                                 intval($argv[2]),
496                                                                 intval($uid)
497                                                         );
498                                                         if(count($r))
499                                                                 $it = $r[0];
500                                                 }
501                                                 if(! $it)
502                                                         break;
503                                                 
504
505
506                                                 $local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
507                                                         intval($uid)
508                                                 );
509                                                 if(! count($local_user))
510                                                         break;
511                                                 
512                                                 $reply_to = '';
513                                                 $r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
514                                                         intval($uid)
515                                                 );
516                                                 if($r1 && $r1[0]['reply_to'])
517                                                         $reply_to = $r1[0]['reply_to'];
518         
519                                                 $subject  = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
520                                                 $headers  = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
521
522                                                 if($reply_to)
523                                                         $headers .= 'Reply-to: ' . $reply_to . "\n";
524
525                                                 $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n";
526
527                                                 if($it['uri'] !== $it['parent-uri']) {
528                                                         $header .= 'References: <' . $it['parent-uri'] . '>' . "\n";
529                                                         if(! strlen($it['title'])) {
530                                                                 $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
531                                                                         dbesc($it['parent-uri'])
532                                                                 );
533                                                                 if(count($r)) {
534                                                                         $subtitle = $r[0]['title'];
535                                                                         if($subtitle) {
536                                                                                 if(strncasecmp($subtitle,'RE:',3))
537                                                                                         $subject = $subtitle;
538                                                                                 else
539                                                                                         $subject = 'Re: ' . $subtitle;
540                                                                         }
541                                                                 }
542                                                         }
543                                                 }
544
545                                                 $headers .= 'MIME-Version: 1.0' . "\n";
546                                                 $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
547                                                 $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
548                                                 $html    = prepare_body($it);
549                                                 $message = '<html><body>' . $html . '</body></html>';
550                                                 logger('notifier: email delivery to ' . $addr);
551                                                 mail($addr, $subject, $message, $headers);
552                                         }
553                                         break;
554                                 case NETWORK_DIASPORA:
555                                         require_once('include/diaspora.php');
556                                         if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')) || (! $normal_mode))
557                                                 break;
558
559                                         if(! $contact['pubkey'])
560                                                 break;
561                                         
562                                         if($target_item['verb'] === ACTIVITY_DISLIKE) {
563                                                 // unsupported
564                                                 break;
565                                         }
566                                         elseif(($target_item['deleted']) && ($target_item['verb'] !== ACTIVITY_LIKE)) {
567                                                 // diaspora delete, 
568                                                 diaspora_send_retraction($target_item,$owner,$contact);
569                                                 break;
570                                         }
571                                         elseif($followup) {
572                                                 // send comments, likes and retractions of likes to owner to relay
573                                                 diaspora_send_followup($target_item,$owner,$contact);
574                                                 break;
575                                         }
576                                         elseif($target_item['parent'] != $target_item['id']) {
577                                                 // we are the relay - send comments, likes and unlikes to our conversants
578                                                 diaspora_send_relay($target_item,$owner,$contact);
579                                                 break;
580                                         }               
581                                         elseif($top_level) {
582                                                 diaspora_send_status($target_item,$owner,$contact);
583                                                 break;
584                                         }
585
586                                         break;
587
588                                 case NETWORK_FEED:
589                                 case NETWORK_FACEBOOK:
590                                         if(get_config('system','dfrn_only'))
591                                                 break;
592                                 default:
593                                         break;
594                         }
595                 }
596         }
597                 
598         // send additional slaps to mentioned remote tags (@foo@example.com)
599
600         if($slap && count($url_recipients) && ($followup || $top_level) && $public_message && (! $expire)) {
601                 if(! get_config('system','dfrn_only')) {
602                         foreach($url_recipients as $url) {
603                                 if($url) {
604                                         logger('notifier: urldelivery: ' . $url);
605                                         $deliver_status = slapper($owner,$url,$slap);
606                                         // TODO: redeliver/queue these items on failure, though there is no contact record
607                                 }
608                         }
609                 }
610         }
611
612
613         if($public_message) {
614
615                 $r = q("SELECT `id`, `name` FROM `contact` 
616                         WHERE `network` in ('%s','%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0
617                         AND `rel` != %d order by rand() ",
618                         dbesc(NETWORK_DFRN),
619                         dbesc(NETWORK_DIASPORA),
620                         intval($owner['uid']),
621                         intval(CONTACT_IS_SHARING)
622                 );
623
624                 if(count($r)) {
625                         logger('pubdeliver: ' . print_r($r,true));
626
627                         foreach($r as $rr) {
628
629                                 /* Don't deliver to folks who have already been delivered to */
630
631                                 if(in_array($rr['id'],$conversants)) {
632                                         logger('notifier: already delivered id=' . $rr['id']);
633                                         continue;
634                                 }
635
636                                 if((! $mail) && (! $fsuggest) && (! $followup)) {
637                                         $interval = intval(get_config('system','delivery_interval'));
638                                         if(! $interval)
639                                                 $interval = 2;
640
641                                         proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
642                                         sleep($interval);
643                                         continue;
644                                 }
645                         }
646                 }
647
648
649                 if(strlen($hub)) {
650                         $hubs = explode(',', $hub);
651                         if(count($hubs)) {
652                                 foreach($hubs as $h) {
653                                         $h = trim($h);
654                                         if(! strlen($h))
655                                                 continue;
656                                         $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
657                                         post_url($h,$params);
658                                         logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
659                                         if(count($hubs) > 1)
660                                                 sleep(7);                               // try and avoid multiple hubs responding at precisely the same time
661                                 }
662                         }
663                 }
664
665         }
666
667         return;
668 }
669
670 if (array_search(__file__,get_included_files())===0){
671   notifier_run($argv,$argc);
672   killme();
673 }