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