diff options
author | friendica <info@friendica.com> | 2013-05-27 05:27:35 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-05-27 05:27:35 -0700 |
commit | df32c93d562f0dfcc28ebf36723ef07dab630b90 (patch) | |
tree | 9ccbff9a691d896409c23024502b3a11e3e1db9c /include | |
parent | 5c1f959c1828066358ec868ffb953e88f16195c6 (diff) | |
download | volse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.tar.gz volse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.tar.bz2 volse-hubzilla-df32c93d562f0dfcc28ebf36723ef07dab630b90.zip |
zidify img links, delay notifier until actually published for time travelling posts
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 6 | ||||
-rw-r--r-- | include/notifier.php | 4 | ||||
-rw-r--r-- | include/poller.php | 16 | ||||
-rwxr-xr-x | include/text.php | 24 |
4 files changed, 42 insertions, 8 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 = '<img' . $match[1] . ' src="' . zid($match[2]) . '"'; + } + else { + $replace = '<img' . $match[1] . ' src="' . zid($match[3]) . '"'; + } + + $x = str_replace($match[0],$replace,$match[0]); + return $x; +} + + function zidify_links($s) { - if (feature_enabled(local_user(),'sendzid')) { - $s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);} + if(feature_enabled(local_user(),'sendzid')) { + $s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s); + $s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s); + } else { - $s = preg_replace_callback('/\<a(.*?)class\=\"zrl\"(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s);} + $s = preg_replace_callback('/\<a(.*?)class\=\"zrl\"(.*?)href\=\"(.*?)\"/ism','zidify_callback',$s); + // FIXME zidify only img links from known Red servers. + $s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_img_callback',$s); + } return $s; } |