aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-27 05:27:35 -0700
committerfriendica <info@friendica.com>2013-05-27 05:27:35 -0700
commitdf32c93d562f0dfcc28ebf36723ef07dab630b90 (patch)
tree9ccbff9a691d896409c23024502b3a11e3e1db9c
parent5c1f959c1828066358ec868ffb953e88f16195c6 (diff)
downloadvolse-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
-rw-r--r--include/api.php6
-rw-r--r--include/notifier.php4
-rw-r--r--include/poller.php16
-rwxr-xr-xinclude/text.php24
-rw-r--r--mod/home.php2
-rw-r--r--version.inc2
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 = '<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;
}
diff --git a/mod/home.php b/mod/home.php
index 2f63d9299..f05daf3c7 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -17,7 +17,7 @@ function home_init(&$a) {
}
if(get_account_id()) {
- goaway('new_channel');
+ goaway(z_root() . '/new_channel');
}
}}
diff --git a/version.inc b/version.inc
index 169f291c8..d8ad3fbd5 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-05-24.323
+2013-05-27.326