From 2020ea23b106c159a705c26e6c79156aafde75ba Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 24 Jan 2011 22:01:56 +0100 Subject: Mods to script runned via CLI to permits to run also included --- include/directory.php | 4 ++-- include/notifier.php | 39 ++++++++++++++++++++++----------------- include/poller.php | 10 ++++++---- include/queue.php | 6 +++--- 4 files changed, 33 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/directory.php b/include/directory.php index 5f835dc4b..4fdcf4928 100644 --- a/include/directory.php +++ b/include/directory.php @@ -11,7 +11,7 @@ if($argc != 2) - exit; + return; load_config('system'); @@ -24,5 +24,5 @@ fetch_url($dir . '?url=' . bin2hex($argv[1])); - exit; + return; diff --git a/include/notifier.php b/include/notifier.php index 4efdad4ce..bb38ecf51 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -16,7 +16,7 @@ require_once('include/bbcode.php'); if($argc < 3) - exit; + return; $a->set_baseurl(get_config('system','url')); @@ -29,8 +29,9 @@ case 'mail': default: $item_id = intval($argv[2]); - if(! $item_id) - killme(); + if(! $item_id){ + killme(); return; + } break; } @@ -42,8 +43,9 @@ $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", intval($item_id) ); - if(! count($message)) - killme(); + if(! count($message)){ + killme(); return; + } $uid = $message[0]['uid']; $recipients[] = $message[0]['contact-id']; $item = $message[0]; @@ -55,8 +57,9 @@ $r = q("SELECT `parent`, `uid`, `edited` FROM `item` WHERE `id` = %d LIMIT 1", intval($item_id) ); - if(! count($r)) - killme(); + if(! count($r)){ + killme(); return; + } $parent_id = $r[0]['parent']; $uid = $r[0]['uid']; @@ -66,8 +69,9 @@ intval($parent_id) ); - if(! count($items)) - killme(); + if(! count($items)){ + killme(); return; + } } $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags` @@ -78,9 +82,9 @@ if(count($r)) $owner = $r[0]; - else - killme(); - + else { + killme(); return; + } $hub = get_config('system','huburl'); // If this is a public conversation, notify the feed hub @@ -150,8 +154,9 @@ $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0"); - if( ! count($r)) - killme(); + if( ! count($r)){ + killme(); return; + } $contacts = $r; } @@ -248,9 +253,9 @@ $r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 ", dbesc($recip_str) ); - if(! count($r)) - killme(); - + if(! count($r)){ + killme(); return; + } // delivery loop require_once('include/salmon.php'); diff --git a/include/poller.php b/include/poller.php index 024b9fbcd..a4bc60767 100644 --- a/include/poller.php +++ b/include/poller.php @@ -19,11 +19,12 @@ $a->set_baseurl(get_config('system','url')); logger('poller: start'); - + // run queue delivery process in the background $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); - proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo)); + //proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo)); + proc_run($php_path,"include/queue.php"); $hub_update = false; @@ -46,8 +47,9 @@ $sql_extra AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()"); - if(! count($contacts)) - killme(); + if(! count($contacts)){ + killme(); return; + } foreach($contacts as $contact) { diff --git a/include/queue.php b/include/queue.php index 96ddfa81b..fae93e328 100644 --- a/include/queue.php +++ b/include/queue.php @@ -50,9 +50,9 @@ function remove_queue_item($id) { $r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); - if(! count($r)) - killme(); - + if(! count($r)){ + killme(); return; + } // delivery loop require_once('include/salmon.php'); -- cgit v1.2.3 From ef33ca67501559fba72281f0d1f32fc6ef43704d Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 28 Jan 2011 14:04:18 +0100 Subject: modded scripts to be runned in cli so they can be included and executed in main program --- include/directory.php | 32 +++++++++++++++++++++----------- include/notifier.php | 51 +++++++++++++++++++++++++++++++-------------------- include/poller.php | 36 ++++++++++++++++++++++-------------- include/queue.php | 31 ++++++++++++++++++++----------- 4 files changed, 94 insertions(+), 56 deletions(-) (limited to 'include') diff --git a/include/directory.php b/include/directory.php index 4fdcf4928..2c9daa5ea 100644 --- a/include/directory.php +++ b/include/directory.php @@ -1,14 +1,19 @@ Date: Sun, 30 Jan 2011 18:25:41 -0800 Subject: wrong ref in ssl policy --- include/notifier.php | 2 +- include/poller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/notifier.php b/include/notifier.php index dd5d55ed0..59e29d7d1 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -363,7 +363,7 @@ function notifier_run($argv, $argc){ continue; $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] ); post_url($h,$params); - logger('pubsub: publish: ' . $h . ' returned ' . $a->get_curl_code()); + logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code()); if(count($hubs) > 1) sleep(7); // try and avoid multiple hubs responding at precisely the same time } diff --git a/include/poller.php b/include/poller.php index 1003b2f08..0dbc6f583 100644 --- a/include/poller.php +++ b/include/poller.php @@ -76,7 +76,7 @@ function poller_run($argv, $argc){ $contact['priority'] = (($interval !== false) ? intval($interval) : 3); $hub_update = false; - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) + if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force) $hub_update = true; } -- cgit v1.2.3 From 3eefe8b50003c858d4930c03cc06d2679a14347c Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 30 Jan 2011 19:38:03 -0800 Subject: more ssl_policy cleanup, allow manual feed update per contact when hub is whacked, log feed parse errors --- include/items.php | 4 ++++ include/poller.php | 3 +++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index e238280fc..a5991d663 100644 --- a/include/items.php +++ b/include/items.php @@ -903,6 +903,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) { $feed->enable_order_by_date(false); $feed->init(); + if($feed->error()) + logger('consume_feed: Error parsing XML: ' . $feed->error()); + + // Check at the feed level for updated contact name and/or photo $name_updated = ''; diff --git a/include/poller.php b/include/poller.php index 0dbc6f583..4567a5cfc 100644 --- a/include/poller.php +++ b/include/poller.php @@ -58,6 +58,9 @@ function poller_run($argv, $argc){ foreach($contacts as $contact) { + if($manual_id) + $contact['last-update'] = '0000-00-00 00:00:00'; + if($contact['priority'] || $contact['subhub']) { $hub_update = true; -- cgit v1.2.3 From 6935d34e7683fa2cf43092b39346c3c43cb8d38d Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 30 Jan 2011 19:49:26 -0800 Subject: disable "take me home" hotkey, different on FF (shift-home), IE ($). --- include/main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/main.js b/include/main.js index fcd1d6fee..a24f0ae08 100644 --- a/include/main.js +++ b/include/main.js @@ -44,12 +44,13 @@ $('#pause').html(''); } } - if(event.keyCode == '36' && event.shiftKey == true) { - if(homebase !== undefined) { - event.preventDefault(); - document.location = homebase; - } - } +// this is shift-home on FF, but $ on IE, disabling until I figure out why the diff. +// if(event.keyCode == '36' && event.shiftKey == true) { +// if(homebase !== undefined) { +// event.preventDefault(); +// document.location = homebase; +// } +// } }); }); -- cgit v1.2.3 From d8877b88d6c26e29019312f02297411817692361 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 30 Jan 2011 22:45:02 -0800 Subject: limit privacy ACL's to networks which can handle privacy --- include/acl_selectors.php | 17 +++++++++-------- include/main.js | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/acl_selectors.php b/include/acl_selectors.php index d0952421e..554782a82 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -30,7 +30,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { -function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false) { +function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false) { $o = ''; @@ -43,6 +43,10 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p $sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD)); } + if($privmail || $privatenet) { + $sql_extra .= " AND `network` IN ( 'dfrn' ) "; + } + if($privmail) $o .= "