diff options
-rw-r--r-- | include/bb2diaspora.php | 17 | ||||
-rw-r--r-- | include/poller.php | 20 |
2 files changed, 34 insertions, 3 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 41001d216..f15a34e99 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -67,6 +67,17 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) { return $string; } +function share_shield($m) { + return str_replace($m[1],'!=+=+=!' . base64url_encode($m[1]) . '=+!=+!=',$m[0]); +} + +function share_unshield($m) { + $x = str_replace(array('!=+=+=!','=+!=+!='),array('',''),$m[1]); + return str_replace($m[1], base64url_decode($x), $m[0]); +} + + + // we don't want to support a bbcode specific markdown interpreter // and the markdown library we have is pretty good, but provides HTML output. // So we'll use that to convert to HTML, then convert the HTML back to bbcode, @@ -93,6 +104,8 @@ function diaspora2bb($s,$use_zrl = false) { // This seems to work $s = preg_replace('/\#([^\s\#])/','#$1',$s); + $s = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$s); + $s = Markdown($s); $s = str_replace('#','#',$s); @@ -123,6 +136,10 @@ function diaspora2bb($s,$use_zrl = false) { // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); + + $s = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$s); + + // Don't show link to full picture (until it is fixed) $s = scale_external_images($s, false); diff --git a/include/poller.php b/include/poller.php index ec013c9c7..546a2d6d1 100644 --- a/include/poller.php +++ b/include/poller.php @@ -91,9 +91,15 @@ function poller_run($argv, $argc){ // FIXME: add birthday updates, both locally and for xprof for use // by directory servers - $d1 = get_config('system','last_expire_day'); + $d1 = intval(get_config('system','last_expire_day')); $d2 = intval(datetime_convert('UTC','UTC','now','d')); + // Allow somebody to staggger daily activities if they have more than one site on their server, + // or if it happens at an inconvenient (busy) hour. + + $h1 = intval(get_config('system','cron_hour')); + $h2 = intval(datetime_convert('UTC','UTC','now','G')); + $dirmode = get_config('system','directory_mode'); /** @@ -103,7 +109,7 @@ function poller_run($argv, $argc){ * */ - if($d2 != intval($d1)) { + if(($d2 != $d1) && ($h1 == $h2)) { call_hooks('cron_daily',datetime_convert()); @@ -129,6 +135,10 @@ function poller_run($argv, $argc){ require_once('include/Contact.php'); mark_orphan_hubsxchans(); + + /** + * End Cron Weekly + */ } update_birthdays(); @@ -156,6 +166,9 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); + /** + * End Cron Daily + */ } // update any photos which didn't get imported properly @@ -180,7 +193,8 @@ function poller_run($argv, $argc){ // pull in some public posts - if(! get_config('system','disable_discover_tab')) + + if(! get_config('system','disable_discover_tab')) proc_run('php','include/externals.php'); |