Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

604 lines
19 KiB

  1. <?php
  2. require_once("boot.php");
  3. function RemoveReply($subject) {
  4. while (in_array(strtolower(substr($subject, 0, 3)), array("re:", "aw:")))
  5. $subject = trim(substr($subject, 4));
  6. return($subject);
  7. }
  8. function onepoll_run(&$argv, &$argc){
  9. global $a, $db;
  10. if(is_null($a)) {
  11. $a = new App;
  12. }
  13. if(is_null($db)) {
  14. @include(".htconfig.php");
  15. require_once("include/dba.php");
  16. $db = new dba($db_host, $db_user, $db_pass, $db_data);
  17. unset($db_host, $db_user, $db_pass, $db_data);
  18. };
  19. require_once('include/session.php');
  20. require_once('include/datetime.php');
  21. require_once('library/simplepie/simplepie.inc');
  22. require_once('include/items.php');
  23. require_once('include/Contact.php');
  24. require_once('include/email.php');
  25. require_once('include/socgraph.php');
  26. require_once('include/pidfile.php');
  27. require_once('include/queue_fn.php');
  28. load_config('config');
  29. load_config('system');
  30. $a->set_baseurl(get_config('system','url'));
  31. load_hooks();
  32. logger('onepoll: start');
  33. $manual_id = 0;
  34. $generation = 0;
  35. $hub_update = false;
  36. $force = false;
  37. $restart = false;
  38. if(($argc > 1) && (intval($argv[1])))
  39. $contact_id = intval($argv[1]);
  40. if(! $contact_id) {
  41. logger('onepoll: no contact');
  42. return;
  43. }
  44. // Test
  45. $lockpath = get_lockpath();
  46. if ($lockpath != '') {
  47. $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id);
  48. if($pidfile->is_already_running()) {
  49. logger("onepoll: Already running for contact ".$contact_id);
  50. exit;
  51. }
  52. }
  53. $d = datetime_convert();
  54. // Only poll from those with suitable relationships,
  55. // and which have a polling address and ignore Diaspora since
  56. // we are unable to match those posts with a Diaspora GUID and prevent duplicates.
  57. $contacts = q("SELECT `contact`.* FROM `contact`
  58. WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
  59. AND NOT `network` IN ( '%s', '%s', '%s' )
  60. AND `contact`.`id` = %d
  61. AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0
  62. AND `contact`.`archive` = 0 LIMIT 1",
  63. intval(CONTACT_IS_SHARING),
  64. intval(CONTACT_IS_FRIEND),
  65. dbesc(NETWORK_DIASPORA),
  66. dbesc(NETWORK_FACEBOOK),
  67. dbesc(NETWORK_PUMPIO),
  68. intval($contact_id)
  69. );
  70. if(! count($contacts)) {
  71. return;
  72. }
  73. $contact = $contacts[0];
  74. $xml = false;
  75. $t = $contact['last-update'];
  76. if($contact['subhub']) {
  77. $poll_interval = get_config('system','pushpoll_frequency');
  78. $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
  79. $hub_update = false;
  80. if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
  81. $hub_update = true;
  82. }
  83. else
  84. $hub_update = false;
  85. $importer_uid = $contact['uid'];
  86. $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
  87. intval($importer_uid)
  88. );
  89. if(! count($r))
  90. return;
  91. $importer = $r[0];
  92. logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
  93. $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
  94. ? datetime_convert('UTC','UTC','now - 7 days', ATOM_TIME)
  95. : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
  96. );
  97. if($contact['network'] === NETWORK_DFRN) {
  98. $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
  99. if(intval($contact['duplex']) && $contact['dfrn-id'])
  100. $idtosend = '0:' . $orig_id;
  101. if(intval($contact['duplex']) && $contact['issued-id'])
  102. $idtosend = '1:' . $orig_id;
  103. // they have permission to write to us. We already filtered this in the contact query.
  104. $perm = 'rw';
  105. // But this may be our first communication, so set the writable flag if it isn't set already.
  106. if(! intval($contact['writable']))
  107. q("update contact set writable = 1 where id = %d", intval($contact['id']));
  108. $url = $contact['poll'] . '?dfrn_id=' . $idtosend
  109. . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
  110. . '&type=data&last_update=' . $last_update
  111. . '&perm=' . $perm ;
  112. $handshake_xml = fetch_url($url);
  113. $html_code = $a->get_curl_code();
  114. logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
  115. if((! strlen($handshake_xml)) || ($html_code >= 400) || (! $html_code)) {
  116. logger("poller: $url appears to be dead - marking for death ");
  117. // dead connection - might be a transient event, or this might
  118. // mean the software was uninstalled or the domain expired.
  119. // Will keep trying for one month.
  120. mark_for_death($contact);
  121. // set the last-update so we don't keep polling
  122. $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
  123. dbesc(datetime_convert()),
  124. intval($contact['id'])
  125. );
  126. return;
  127. }
  128. if(! strstr($handshake_xml,'<?xml')) {
  129. logger('poller: response from ' . $url . ' did not contain XML.');
  130. mark_for_death($contact);
  131. $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
  132. dbesc(datetime_convert()),
  133. intval($contact['id'])
  134. );
  135. return;
  136. }
  137. $res = parse_xml_string($handshake_xml);
  138. if(intval($res->status) == 1) {
  139. logger("poller: $url replied status 1 - marking for death ");
  140. // we may not be friends anymore. Will keep trying for one month.
  141. // set the last-update so we don't keep polling
  142. $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
  143. dbesc(datetime_convert()),
  144. intval($contact['id'])
  145. );
  146. mark_for_death($contact);
  147. }
  148. else {
  149. if($contact['term-date'] != '0000-00-00 00:00:00') {
  150. logger("poller: $url back from the dead - removing mark for death");
  151. unmark_for_death($contact);
  152. }
  153. }
  154. if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
  155. return;
  156. if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
  157. q("update contact set poco = '%s' where id = %d",
  158. dbesc(str_replace('/profile/','/poco/', $contact['url'])),
  159. intval($contact['id'])
  160. );
  161. }
  162. $postvars = array();
  163. $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
  164. $challenge = hex2bin((string) $res->challenge);
  165. $final_dfrn_id = '';
  166. if(($contact['duplex']) && strlen($contact['prvkey'])) {
  167. openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
  168. openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
  169. }
  170. else {
  171. openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
  172. openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
  173. }
  174. $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
  175. if(strpos($final_dfrn_id,':') == 1)
  176. $final_dfrn_id = substr($final_dfrn_id,2);
  177. if($final_dfrn_id != $orig_id) {
  178. logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
  179. // did not decode properly - cannot trust this site
  180. return;
  181. }
  182. $postvars['dfrn_id'] = $idtosend;
  183. $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
  184. $postvars['perm'] = 'rw';
  185. $xml = post_url($contact['poll'],$postvars);
  186. }
  187. elseif(($contact['network'] === NETWORK_OSTATUS)
  188. || ($contact['network'] === NETWORK_DIASPORA)
  189. || ($contact['network'] === NETWORK_FEED) ) {
  190. // Upgrading DB fields from an older Friendica version
  191. // Will only do this once per notify-enabled OStatus contact
  192. // or if relationship changes
  193. $stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
  194. if($contact['network'] === NETWORK_OSTATUS && get_pconfig($importer_uid,'system','ostatus_autofriend'))
  195. $stat_writeable = 1;
  196. if($stat_writeable != $contact['writable']) {
  197. q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
  198. intval($stat_writeable),
  199. intval($contact['id'])
  200. );
  201. }
  202. // Are we allowed to import from this person?
  203. if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly'])
  204. return;
  205. $xml = fetch_url($contact['poll']);
  206. }
  207. elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {
  208. logger("onepoll: mail: Fetching", LOGGER_DEBUG);
  209. $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
  210. if($mail_disabled)
  211. return;
  212. logger("onepoll: Mail: Enabled", LOGGER_DEBUG);
  213. $mbox = null;
  214. $x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1",
  215. intval($importer_uid)
  216. );
  217. $mailconf = q("SELECT * FROM `mailacct` WHERE `server` != '' AND `uid` = %d LIMIT 1",
  218. intval($importer_uid)
  219. );
  220. if(count($x) && count($mailconf)) {
  221. $mailbox = construct_mailbox_name($mailconf[0]);
  222. $password = '';
  223. openssl_private_decrypt(hex2bin($mailconf[0]['pass']),$password,$x[0]['prvkey']);
  224. $mbox = email_connect($mailbox,$mailconf[0]['user'],$password);
  225. unset($password);
  226. logger("Mail: Connect to " . $mailconf[0]['user']);
  227. if($mbox) {
  228. q("UPDATE `mailacct` SET `last_check` = '%s' WHERE `id` = %d AND `uid` = %d",
  229. dbesc(datetime_convert()),
  230. intval($mailconf[0]['id']),
  231. intval($importer_uid)
  232. );
  233. }
  234. }
  235. if($mbox) {
  236. $msgs = email_poll($mbox,$contact['addr']);
  237. if(count($msgs)) {
  238. logger("Mail: Parsing ".count($msgs)." mails for ".$mailconf[0]['user'], LOGGER_DEBUG);
  239. $metas = email_msg_meta($mbox,implode(',',$msgs));
  240. if(count($metas) != count($msgs)) {
  241. logger("onepoll: for " . $mailconf[0]['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
  242. }
  243. else {
  244. $msgs = array_combine($msgs, $metas);
  245. foreach($msgs as $msg_uid => $meta) {
  246. logger("Mail: Parsing mail ".$msg_uid, LOGGER_DATA);
  247. $datarray = array();
  248. // $meta = email_msg_meta($mbox,$msg_uid);
  249. // $headers = email_msg_headers($mbox,$msg_uid);
  250. $datarray['uri'] = msgid2iri(trim($meta->message_id,'<>'));
  251. // Have we seen it before?
  252. $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
  253. intval($importer_uid),
  254. dbesc($datarray['uri'])
  255. );
  256. if(count($r)) {
  257. logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
  258. // Only delete when mails aren't automatically moved or deleted
  259. if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
  260. if($meta->deleted && ! $r[0]['deleted']) {
  261. q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d",
  262. dbesc(datetime_convert()),
  263. intval($r[0]['id'])
  264. );
  265. }
  266. switch ($mailconf[0]['action']) {
  267. case 0:
  268. logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG);
  269. break;
  270. case 1:
  271. logger("Mail: Deleting ".$msg_uid." for ".$mailconf[0]['user']);
  272. imap_delete($mbox, $msg_uid, FT_UID);
  273. break;
  274. case 2:
  275. logger("Mail: Mark as seen ".$msg_uid." for ".$mailconf[0]['user']);
  276. imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
  277. break;
  278. case 3:
  279. logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']." for ".$mailconf[0]['user']);
  280. imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
  281. if ($mailconf[0]['movetofolder'] != "")
  282. imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);
  283. break;
  284. }
  285. continue;
  286. }
  287. // look for a 'references' or an 'in-reply-to' header and try to match with a parent item we have locally.
  288. // $raw_refs = ((x($headers,'references')) ? str_replace("\t",'',$headers['references']) : '');
  289. $raw_refs = ((property_exists($meta,'references')) ? str_replace("\t",'',$meta->references) : '');
  290. if(! trim($raw_refs))
  291. $raw_refs = ((property_exists($meta,'in_reply_to')) ? str_replace("\t",'',$meta->in_reply_to) : '');
  292. $raw_refs = trim($raw_refs); // Don't allow a blank reference in $refs_arr
  293. if($raw_refs) {
  294. $refs_arr = explode(' ', $raw_refs);
  295. if(count($refs_arr)) {
  296. for($x = 0; $x < count($refs_arr); $x ++)
  297. $refs_arr[$x] = "'" . msgid2iri(str_replace(array('<','>',' '),array('','',''),dbesc($refs_arr[$x]))) . "'";
  298. }
  299. $qstr = implode(',',$refs_arr);
  300. $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `uri` IN ( $qstr ) AND `uid` = %d LIMIT 1",
  301. intval($importer_uid)
  302. );
  303. if(count($r))
  304. $datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
  305. // $datarray['parent-uri'] = $r[0]['uri'];
  306. }
  307. // Decoding the header
  308. $subject = imap_mime_header_decode($meta->subject);
  309. $datarray['title'] = "";
  310. foreach($subject as $subpart)
  311. if ($subpart->charset != "default")
  312. $datarray['title'] .= iconv($subpart->charset, 'UTF-8//IGNORE', $subpart->text);
  313. else
  314. $datarray['title'] .= $subpart->text;
  315. $datarray['title'] = notags(trim($datarray['title']));
  316. //$datarray['title'] = notags(trim($meta->subject));
  317. $datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
  318. // Is it a reply?
  319. $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
  320. (substr(strtolower($datarray['title']), 0, 3) == "re-") or
  321. ($raw_refs != ""));
  322. // Remove Reply-signs in the subject
  323. $datarray['title'] = RemoveReply($datarray['title']);
  324. // If it seems to be a reply but a header couldn't be found take the last message with matching subject
  325. if(!x($datarray,'parent-uri') and $reply) {
  326. $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
  327. dbesc(protect_sprintf($datarray['title'])),
  328. intval($importer_uid));
  329. if(count($r))
  330. $datarray['parent-uri'] = $r[0]['parent-uri'];
  331. }
  332. if(! x($datarray,'parent-uri'))
  333. $datarray['parent-uri'] = $datarray['uri'];
  334. $r = email_get_msg($mbox,$msg_uid, $reply);
  335. if(! $r) {
  336. logger("Mail: can't fetch msg ".$msg_uid." for ".$mailconf[0]['user']);
  337. continue;
  338. }
  339. $datarray['body'] = escape_tags($r['body']);
  340. $datarray['body'] = limit_body_size($datarray['body']);
  341. logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']);
  342. // some mailing lists have the original author as 'from' - add this sender info to msg body.
  343. // todo: adding a gravatar for the original author would be cool
  344. if(! stristr($meta->from,$contact['addr'])) {
  345. $from = imap_mime_header_decode($meta->from);
  346. $fromdecoded = "";
  347. foreach($from as $frompart)
  348. if ($frompart->charset != "default")
  349. $fromdecoded .= iconv($frompart->charset, 'UTF-8//IGNORE', $frompart->text);
  350. else
  351. $fromdecoded .= $frompart->text;
  352. $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname());
  353. $frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host;
  354. if (isset($fromarr[0]->personal))
  355. $fromname = $fromarr[0]->personal;
  356. else
  357. $fromname = $frommail;
  358. //$datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body'];
  359. $datarray['author-name'] = $fromname;
  360. $datarray['author-link'] = "mailto:".$frommail;
  361. $datarray['author-avatar'] = $contact['photo'];
  362. $datarray['owner-name'] = $contact['name'];
  363. $datarray['owner-link'] = "mailto:".$contact['addr'];
  364. $datarray['owner-avatar'] = $contact['photo'];
  365. } else {
  366. $datarray['author-name'] = $contact['name'];
  367. $datarray['author-link'] = 'mailbox';
  368. $datarray['author-avatar'] = $contact['photo'];
  369. }
  370. $datarray['uid'] = $importer_uid;
  371. $datarray['contact-id'] = $contact['id'];
  372. if($datarray['parent-uri'] === $datarray['uri'])
  373. $datarray['private'] = 1;
  374. if(($contact['network'] === NETWORK_MAIL) && (! get_pconfig($importer_uid,'system','allow_public_email_replies'))) {
  375. $datarray['private'] = 1;
  376. $datarray['allow_cid'] = '<' . $contact['id'] . '>';
  377. }
  378. $stored_item = item_store($datarray);
  379. q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d",
  380. dbesc($datarray['parent-uri']),
  381. intval($importer_uid)
  382. );
  383. q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
  384. intval($stored_item)
  385. );
  386. switch ($mailconf[0]['action']) {
  387. case 0:
  388. logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG);
  389. break;
  390. case 1:
  391. logger("Mail: Deleting ".$msg_uid." for ".$mailconf[0]['user']);
  392. imap_delete($mbox, $msg_uid, FT_UID);
  393. break;
  394. case 2:
  395. logger("Mail: Mark as seen ".$msg_uid." for ".$mailconf[0]['user']);
  396. imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
  397. break;
  398. case 3:
  399. logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']." for ".$mailconf[0]['user']);
  400. imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
  401. if ($mailconf[0]['movetofolder'] != "")
  402. imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);
  403. break;
  404. }
  405. }
  406. }
  407. }
  408. imap_close($mbox);
  409. }
  410. }
  411. elseif($contact['network'] === NETWORK_FACEBOOK) {
  412. // This is picked up by the Facebook plugin on a cron hook.
  413. // Ignored here.
  414. } elseif($contact['network'] === NETWORK_PUMPIO) {
  415. // This is picked up by the pump.io plugin on a cron hook.
  416. // Ignored here.
  417. }
  418. if($xml) {
  419. logger('poller: received xml : ' . $xml, LOGGER_DATA);
  420. if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
  421. logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
  422. $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
  423. dbesc(datetime_convert()),
  424. intval($contact['id'])
  425. );
  426. return;
  427. }
  428. consume_feed($xml,$importer,$contact,$hub,1,1);
  429. // do it twice. Ensures that children of parents which may be later in the stream aren't tossed
  430. consume_feed($xml,$importer,$contact,$hub,1,2);
  431. $hubmode = 'subscribe';
  432. if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
  433. $hubmode = 'unsubscribe';
  434. if(($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify']))
  435. $hub_update = true;
  436. if((strlen($hub)) && ($hub_update) && (($contact['rel'] != CONTACT_IS_FOLLOWER) || $contact['network'] == NETWORK_FEED) ) {
  437. logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
  438. $hubs = explode(',', $hub);
  439. if(count($hubs)) {
  440. foreach($hubs as $h) {
  441. $h = trim($h);
  442. if(! strlen($h))
  443. continue;
  444. subscribe_to_hub($h,$importer,$contact,$hubmode);
  445. }
  446. }
  447. }
  448. }
  449. $updated = datetime_convert();
  450. $r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d",
  451. dbesc($updated),
  452. dbesc($updated),
  453. intval($contact['id'])
  454. );
  455. // load current friends if possible.
  456. if($contact['poco']) {
  457. $r = q("SELECT count(*) as total from glink
  458. where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
  459. intval($contact['id'])
  460. );
  461. }
  462. if(count($r)) {
  463. if(! $r[0]['total']) {
  464. poco_load($contact['id'],$importer_uid,0,$contact['poco']);
  465. }
  466. }
  467. return;
  468. }
  469. if (array_search(__file__,get_included_files())===0){
  470. onepoll_run($argv,$argc);
  471. killme();
  472. }