From df32c93d562f0dfcc28ebf36723ef07dab630b90 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 May 2013 05:27:35 -0700 Subject: zidify img links, delay notifier until actually published for time travelling posts --- include/api.php | 6 +++++- include/notifier.php | 4 ++++ include/poller.php | 16 ++++++++++++---- include/text.php | 24 +++++++++++++++++++++--- mod/home.php | 2 +- version.inc | 2 +- 6 files changed, 44 insertions(+), 10 deletions(-) diff --git a/include/api.php b/include/api.php index e6140b120..9efee4178 100644 --- a/include/api.php +++ b/include/api.php @@ -535,7 +535,11 @@ require_once('include/security.php'); } if($_SERVER['REQUEST_METHOD'] == 'POST') { - json_return_and_die(post_activity_item($_POST)); + json_return_and_die(post_activity_item($_REQUEST)); + } + else { + // fetch stream + } } api_register_func('api/red/channel/stream','api_channel_stream', true); diff --git a/include/notifier.php b/include/notifier.php index c805ef4cd..159931124 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -208,6 +208,10 @@ function notifier_run($argv, $argc){ if($target_item['item_restrict'] & ITEM_DELETED) logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG); + if($target_item['item_restrict'] & ITEM_DELAYED_PUBLISH) { + logger('notifier: target item ITEM_DELAYED_PUBLISH', LOGGER_DEBUG); + return; + } $s = q("select * from channel where channel_id = %d limit 1", intval($target_item['uid']) diff --git a/include/poller.php b/include/poller.php index 43c7b497b..433bc8caf 100644 --- a/include/poller.php +++ b/include/poller.php @@ -41,12 +41,20 @@ function poller_run($argv, $argc){ // publish any applicable items that were set to be published in the future // (time travel posts) - q("update item set item_restrict = ( item_restrict ^ %d ) - where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ", - intval(ITEM_DELAYED_PUBLISH), + $r = q("select id from item where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ", intval(ITEM_DELAYED_PUBLISH) ); - + if($r) { + foreach($r as $rr) { + $x = q("update item set item_restrict = ( item_restrict ^ %d ) where id = %d limit 1", + intval(ITEM_DELAYED_PUBLISH), + intval($rr['id']) + ); + if($x) { + proc_run('php','include/notifer.php','wall-new',$rr['id']); + } + } + } $abandon_days = intval(get_config('system','account_abandon_days')); if($abandon_days < 1) diff --git a/include/text.php b/include/text.php index b1cf900b6..c0ab406e5 100755 --- a/include/text.php +++ b/include/text.php @@ -1138,11 +1138,29 @@ function zidify_callback($match) { return $x; } +function zidify_img_callback($match) { + if (feature_enabled(local_user(),'sendzid')) { + $replace = '