zidify img links, delay notifier until actually published for time travelling posts

This commit is contained in:
friendica 2013-05-27 05:27:35 -07:00
parent 5c1f959c18
commit df32c93d56
6 changed files with 44 additions and 10 deletions

View file

@ -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);

View file

@ -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'])

View file

@ -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)

View file

@ -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;
}

View file

@ -17,7 +17,7 @@ function home_init(&$a) {
}
if(get_account_id()) {
goaway('new_channel');
goaway(z_root() . '/new_channel');
}
}}

View file

@ -1 +1 @@
2013-05-24.323
2013-05-27.326