Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-04-13 18:47:21 -07:00
commit 6777f96bb3
28 changed files with 102 additions and 71 deletions

View file

@ -34,9 +34,9 @@ class Cron {
// run queue delivery process in the background // run queue delivery process in the background
Run::Summon(array('Queue')); Run::Summon( [ 'Queue' ] );
Run::Summon(array('Poller')); Run::Summon( [ 'Poller' ] );
// maintenance for mod sharedwithme - check for updated items and remove them // maintenance for mod sharedwithme - check for updated items and remove them
@ -82,7 +82,7 @@ class Cron {
); );
if($r) { if($r) {
foreach($r as $rr) { foreach($r as $rr) {
Run::Summon(array('Directory',$rr['channel_id'],'force')); Run::Summon( [ 'Directory', $rr['channel_id'], 'force' ] );
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);
} }
@ -114,7 +114,7 @@ class Cron {
] ]
); );
} }
Run::Summon(array('Notifier','wall-new',$rr['id'])); Run::Summon( [ 'Notifier','wall-new',$rr['id'] ] );
} }
} }
} }
@ -143,7 +143,7 @@ class Cron {
if(($d2 != $d1) && ($h1 == $h2)) { if(($d2 != $d1) && ($h1 == $h2)) {
Run::Summon(array('Cron_daily')); Run::Summon( [ 'Cron_daily' ] );
} }
// update any photos which didn't get imported properly // update any photos which didn't get imported properly
@ -189,7 +189,7 @@ class Cron {
// TODO check to see if there are any cronhooks before wasting a process // TODO check to see if there are any cronhooks before wasting a process
if(! $restart) if(! $restart)
Run::Summon(array('Cronhooks')); Run::Summon( [ 'Cronhooks' ] );
set_config('system','lastcron',datetime_convert()); set_config('system','lastcron',datetime_convert());

View file

@ -24,7 +24,7 @@ class Cron_daily {
$d3 = intval(datetime_convert('UTC','UTC','now','N')); $d3 = intval(datetime_convert('UTC','UTC','now','N'));
if ($d3 == 7) { if ($d3 == 7) {
Run::Summon(array('Cron_weekly')); Run::Summon( [ 'Cron_weekly' ] );
} }
// once daily run birthday_updates and then expire in background // once daily run birthday_updates and then expire in background
@ -88,7 +88,7 @@ class Cron_daily {
// expire any expired accounts // expire any expired accounts
downgrade_accounts(); downgrade_accounts();
Run::Summon(array('Expire')); Run::Summon( [ 'Expire' ] );
// remove xchan photos that were stored in the DB ine earlier versions // remove xchan photos that were stored in the DB ine earlier versions

View file

@ -44,7 +44,7 @@ class Cron_weekly {
); );
// Check for dead sites // Check for dead sites
Run::Summon(array('Checksites')); Run::Summon( ['Checksites' ] );
// clean up image cache - use site expiration or 60 days if not set or zero // clean up image cache - use site expiration or 60 days if not set or zero
@ -68,7 +68,7 @@ class Cron_weekly {
// update searchable doc indexes // update searchable doc indexes
Run::Summon(array('Importdoc')); Run::Summon( [ 'Importdoc'] );
/** /**
* End Cron Weekly * End Cron Weekly

View file

@ -47,7 +47,7 @@ class Directory {
// Now update all the connections // Now update all the connections
if ($pushall) { if ($pushall) {
Run::Summon(array('Notifier','refresh_all',$channel['channel_id'])); Run::Summon( [ 'Notifier','refresh_all',$channel['channel_id'] ] );
} }
} }
} }

View file

@ -433,7 +433,7 @@ class Notifier {
// don't uplink a relayed post to the relay owner // don't uplink a relayed post to the relay owner
if ($parent_item['source_xchan'] !== $parent_item['owner_xchan']) { if ($parent_item['source_xchan'] !== $parent_item['owner_xchan']) {
logger('notifier: uplinking this item'); logger('notifier: uplinking this item');
Run::Summon(array('Notifier','uplink',$item_id)); Run::Summon( [ 'Notifier','uplink',$item_id ] );
} }
} }

View file

@ -124,7 +124,7 @@ class Onepoll {
// prohibitive as deletion requests would need to be relayed over potentially hostile networks. // prohibitive as deletion requests would need to be relayed over potentially hostile networks.
if($fetch_feed) { if($fetch_feed) {
$max = intval(get_config('system','max_imported_posts',50)); $max = intval(get_config('system','max_imported_posts',100));
if (intval($max)) { if (intval($max)) {
$cl = get_xconfig($xchan,'activitypub','collections'); $cl = get_xconfig($xchan,'activitypub','collections');
if (is_array($cl) && $cl) { if (is_array($cl) && $cl) {
@ -139,10 +139,14 @@ class Onepoll {
if (is_string($message)) { if (is_string($message)) {
$message = Activity::fetch($message,$importer); $message = Activity::fetch($message,$importer);
} }
if (is_array($message)) {
$AS = new ActivityStreams($message,null,true); $AS = new ActivityStreams($message,null,true);
if ($AS->is_valid() && is_array($AS->obj)) { if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS,true); $item = Activity::decode_note($AS,true);
Activity::store($importer,$contact['abook_xchan'],$AS,$item); if ($item) {
Activity::store($importer,$contact['abook_xchan'],$AS, $item, true, true);
}
}
} }
} }
} }

View file

@ -104,7 +104,7 @@ class Poller {
$min = 60; $min = 60;
$x = datetime_convert('UTC','UTC',"now - $min minutes"); $x = datetime_convert('UTC','UTC',"now - $min minutes");
if($c < $x) { if($c < $x) {
Run::Summon(array('Onepoll',$contact['abook_id'])); Run::Summon( [ 'Onepoll', $contact['abook_id'] ] );
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);
} }
@ -169,7 +169,7 @@ class Poller {
if((! $update) && (! $force)) if((! $update) && (! $force))
continue; continue;
Run::Summon(array('Onepoll',$contact['abook_id'])); Run::Summon( [ 'Onepoll',$contact['abook_id'] ] );
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);

View file

@ -1041,7 +1041,7 @@ class Activity {
} }
if (intval($i['item_wall']) && $i['mid'] === $i['parent_mid']) { if (intval($i['item_wall']) && $i['mid'] === $i['parent_mid']) {
$ret['commentPolicy'] = map_scope(PermissionLimits::Get($i['uid'],'post_comments')); $ret['commentPolicy'] = $i['comment_policy'];
} }
if (intval($i['item_private']) === 2) { if (intval($i['item_private']) === 2) {
@ -2594,6 +2594,26 @@ class Activity {
} }
} }
if ($s['mid'] === $s['parent_mid']) {
// it is a parent node - decode the comment policy info if present
if (isset($act->obj['commentPolicy'])) {
$until = strpos($act->obj['commentPolicy'],'until=');
if ($until !== false) {
$item['comments_closed'] = datetime_convert('UTC','UTC',substr($act->obj['commentPolicy'],'until=') + 6);
if ($item['comments_closed'] < datetime_convert()) {
$item['nocomment'] = true;
}
}
$remainder = substr($act->obj['commentPolicy'],0,(($until) ? $until : strlen($act->obj['commentPolicy'])));
if ($remainder) {
$item['comment_policy'] = $remainder;
}
}
else {
$item['comment_policy'] = 'authenticated';
}
}
if (! (array_key_exists('created',$s) && $s['created'])) { if (! (array_key_exists('created',$s) && $s['created'])) {
$s['created'] = datetime_convert(); $s['created'] = datetime_convert();
} }
@ -3299,9 +3319,6 @@ class Activity {
set_iconfig($item,'ostatus','conversation',$act->obj['conversation'],1); set_iconfig($item,'ostatus','conversation',$act->obj['conversation'],1);
} }
// This isn't perfect but the best we can do for now.
$item['comment_policy'] = 'authenticated';
set_iconfig($item,'activitypub','recips',$act->raw_recips); set_iconfig($item,'activitypub','recips',$act->raw_recips);
@ -3350,6 +3367,10 @@ class Activity {
} }
} }
$item['comment_policy'] = $parent[0]['comment_policy'];
$item['item_nocomment'] = $parent[0]['item_nocomment'];
$item['comments_closed'] = $parent[0]['comments_closed'];
if ($parent[0]['parent_mid'] !== $item['parent_mid']) { if ($parent[0]['parent_mid'] !== $item['parent_mid']) {
$item['thr_parent'] = $item['parent_mid']; $item['thr_parent'] = $item['parent_mid'];
} }
@ -3407,7 +3428,7 @@ class Activity {
if ($is_child_node) { if ($is_child_node) {
if ($item['owner_xchan'] === $channel['channel_hash']) { if ($item['owner_xchan'] === $channel['channel_hash']) {
// We are the owner of this conversation, so send all received comments back downstream // We are the owner of this conversation, so send all received comments back downstream
Run::Summon(array('Notifier','comment-import',$x['item_id'])); Run::Summon( [ 'Notifier','comment-import',$x['item_id'] ] );
} }
$r = q("select * from item where id = %d limit 1", $r = q("select * from item where id = %d limit 1",
intval($x['item_id']) intval($x['item_id'])

View file

@ -41,7 +41,7 @@ class Connect extends Controller {
intval(local_channel()) intval(local_channel())
); );
Run::Summon(array('Notifier','refresh_all',App::$data['channel']['channel_id'])); Run::Summon( [ 'Notifier','refresh_all',App::$data['channel']['channel_id'] ] );
} }
set_pconfig(App::$data['channel']['channel_id'],'system','selltext',$text); set_pconfig(App::$data['channel']['channel_id'],'system','selltext',$text);
// reload the page completely to get fresh data // reload the page completely to get fresh data

View file

@ -262,7 +262,7 @@ class Events extends Controller {
} }
if($share) if($share)
Run::Summon(array('Notifier','event',$item_id)); Run::Summon( [ 'Notifier', 'event', $item_id ] );
} }

View file

@ -806,6 +806,9 @@ class Item extends Controller {
$public_policy = $parent_item['public_policy']; $public_policy = $parent_item['public_policy'];
$owner_hash = $parent_item['owner_xchan']; $owner_hash = $parent_item['owner_xchan'];
$webpage = $parent_item['item_type']; $webpage = $parent_item['item_type'];
$comment_policy = $parent_item['comment_policy'];
$item_nocomment = $parent_item['item_nocomment'];
$comments_closed = $parent_item['comments_closed'];
} }
if((! $allow_empty) && (! strlen($body))) { if((! $allow_empty) && (! strlen($body))) {
@ -1158,7 +1161,7 @@ class Item extends Controller {
$item_unseen = ((local_channel() != $profile_uid) ? 1 : 0); $item_unseen = ((local_channel() != $profile_uid) ? 1 : 0);
$item_wall = ((isset($_REQUEST['type']) && ($_REQUEST['type'] === 'wall' || $_REQUEST['type'] === 'wall-comment')) ? 1 : 0); $item_wall = ((isset($_REQUEST['type']) && ($_REQUEST['type'] === 'wall' || $_REQUEST['type'] === 'wall-comment')) ? 1 : 0);
$item_origin = (($origin) ? 1 : 0); $item_origin = (($origin) ? 1 : 0);
$item_nocomment = (($nocomment) ? 1 : 0); $item_nocomment = ((isset($item_nocomment) ? $item_nocomment : $nocomment);
// determine if this is a wall post // determine if this is a wall post
@ -1330,7 +1333,7 @@ class Item extends Controller {
$datarray['item_blocked'] = intval($item_blocked); $datarray['item_blocked'] = intval($item_blocked);
$datarray['layout_mid'] = $layout_mid; $datarray['layout_mid'] = $layout_mid;
$datarray['public_policy'] = $public_policy; $datarray['public_policy'] = $public_policy;
$datarray['comment_policy'] = map_scope($comment_policy); $datarray['comment_policy'] = ((ctype_digit($comment_policy)) ? map_scope($comment_policy) : $comment_policy); // only map scope if it is numeric, otherwise use what we have
$datarray['term'] = $post_tags; $datarray['term'] = $post_tags;
$datarray['plink'] = $plink; $datarray['plink'] = $plink;
$datarray['route'] = $route; $datarray['route'] = $route;
@ -1438,7 +1441,7 @@ class Item extends Controller {
} }
} }
if(! $nopush) if(! $nopush)
Run::Summon(array('Notifier', 'edit_post', $post_id)); Run::Summon( [ 'Notifier', 'edit_post', $post_id ] );
if($api_source) if($api_source)
@ -1563,7 +1566,7 @@ class Item extends Controller {
} }
if(! $nopush) { if(! $nopush) {
Run::Summon(array('Notifier', $notify_type, $post_id)); Run::Summon( [ 'Notifier', $notify_type, $post_id ] );
} }
logger('post_complete'); logger('post_complete');

View file

@ -319,7 +319,7 @@ class Like extends Controller {
// drop_item was not done interactively, so we need to invoke the notifier // drop_item was not done interactively, so we need to invoke the notifier
// in order to push the changes to connections // in order to push the changes to connections
Run::Summon(array('Notifier','drop',$rr['id'])); Run::Summon( [ 'Notifier','drop',$rr['id'] ] );
} }
@ -382,7 +382,7 @@ class Like extends Controller {
Libsync::build_sync_packet($ch[0]['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]); Libsync::build_sync_packet($ch[0]['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]);
} }
Run::Summon(array('Notifier','wall-new',$item['id'])); Run::Summon( [ 'Notifier','wall-new',$item['id'] ] );
} }
} }
@ -515,7 +515,7 @@ class Like extends Controller {
} }
\Zotlabs\Daemon\Run::Summon(array('Notifier','like',$post_id)); Run::Summon( [ 'Notifier', 'like', $post_id ] );
killme(); killme();
} }

View file

@ -2,12 +2,15 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libsync; use Zotlabs\Lib\Libsync;
use Zotlabs\Daemon\Run;
require_once('include/conversation.php'); require_once('include/conversation.php');
class Moderate extends \Zotlabs\Web\Controller { class Moderate extends Controller {
function get() { function get() {
@ -16,8 +19,8 @@ class Moderate extends \Zotlabs\Web\Controller {
return; return;
} }
\App::set_pager_itemspage(60); App::set_pager_itemspage(60);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
//show all items //show all items
if(argc() == 1) { if(argc() == 1) {
@ -88,7 +91,7 @@ class Moderate extends \Zotlabs\Web\Controller {
Libsync::build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true)))); Libsync::build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true))));
} }
if($action === 'approve') { if($action === 'approve') {
\Zotlabs\Daemon\Run::Summon(array('Notifier', 'comment-new', $post_id)); Run::Summon( [ 'Notifier', 'comment-new', $post_id ] );
} }
goaway(z_root() . '/moderate'); goaway(z_root() . '/moderate');
} }

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App; use App;
use Zotlabs\Lib\Apps; use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller; use Zotlabs\Web\Controller;
use Zotlabs\Daemon\Run;
require_once('include/security.php'); require_once('include/security.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
@ -105,7 +106,7 @@ class Mood extends Controller {
$item_id = $post['item_id']; $item_id = $post['item_id'];
if($item_id) { if($item_id) {
\Zotlabs\Daemon\Run::Summon(array('Notifier','activity', $item_id)); Run::Summon( [ 'Notifier','activity', $item_id ] );
} }
call_hooks('post_local_end', $arr); call_hooks('post_local_end', $arr);

View file

@ -433,7 +433,7 @@ class Photos extends Controller {
} }
if($visibility) { if($visibility) {
Run::Summon(array('Notifier','edit_post',$item_id)); Run::Summon( [ 'Notifier', 'edit_post', $item_id ] );
} }
$sync = attach_export_data(App::$data['channel'],$resource_id); $sync = attach_export_data(App::$data['channel'],$resource_id);

View file

@ -615,7 +615,7 @@ class Profiles extends Controller {
} }
if($is_default) { if($is_default) {
Run::Summon(array('Directory',local_channel())); Run::Summon( [ 'Directory', local_channel() ] );
goaway(z_root() . '/profiles/' . $sync[0]['id']); goaway(z_root() . '/profiles/' . $sync[0]['id']);
} }
} }
@ -925,7 +925,7 @@ class Profiles extends Controller {
if($i) { if($i) {
// FIXME - limit delivery in notifier.php to those specificed in the perms argument // FIXME - limit delivery in notifier.php to those specificed in the perms argument
Zotlabs\Daemon\Run::Summon(array('Notifier','activity', $i, 'PERMS_R_PROFILE')); Run::Summon( [ 'Notifier','activity', $i, 'PERMS_R_PROFILE' ] );
} }
} }

View file

@ -140,7 +140,7 @@ class Search extends Controller {
if (! $author) { if (! $author) {
$author = $item['author_xchan']; $author = $item['author_xchan'];
} }
Activity::store(App::get_channel(),get_observer_hash(),$AS,$item); Activity::store(App::get_channel(),get_observer_hash(),$AS,$item, true, true);
} }
} }
if ($hash) { if ($hash) {

View file

@ -2458,7 +2458,7 @@ function check_cron_broken() {
$d = get_config('system','lastcron'); $d = get_config('system','lastcron');
if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) { if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) {
Run::Summon(array('Cron')); Run::Summon( [ 'Cron' ] );
set_config('system','lastcron',datetime_convert()); set_config('system','lastcron',datetime_convert());
} }

View file

@ -505,7 +505,7 @@ function create_identity($arr) {
call_hooks('create_identity', $newuid); call_hooks('create_identity', $newuid);
Run::Summon(array('Directory', $ret['channel']['channel_id'])); Run::Summon( [ 'Directory', $ret['channel']['channel_id'] ] );
} }
$ret['success'] = true; $ret['success'] = true;
@ -721,7 +721,7 @@ function channel_change_address($channel,$new_address) {
} }
} }
Run::Summon(array('Notifier', 'refresh_all', $channel['channel_id'])); Run::Summon( [ 'Notifier', 'refresh_all', $channel['channel_id'] ] );
$ret['success'] = true; $ret['success'] = true;
return $ret; return $ret;
@ -1272,7 +1272,7 @@ function zid_init() {
dbesc($tmp_str) dbesc($tmp_str)
); );
if (! $r) { if (! $r) {
Run::Summon(array('Gprobe',bin2hex($tmp_str))); Run::Summon( [ 'Gprobe', bin2hex($tmp_str) ] );
} }
if ($r && remote_channel() && remote_channel() === $r[0]['hubloc_hash']) { if ($r && remote_channel() && remote_channel() === $r[0]['hubloc_hash']) {
return; return;

View file

@ -4,6 +4,8 @@
* @brief Hubloc related functions. * @brief Hubloc related functions.
*/ */
use Zotlabs\Daemon\Run;
/** /**
* @brief Create an array for hubloc table and insert record. * @brief Create an array for hubloc table and insert record.
* *
@ -163,7 +165,7 @@ function remove_obsolete_hublocs() {
dbesc($rr['hubloc_hash']) dbesc($rr['hubloc_hash'])
); );
if($x) { if($x) {
Zotlabs\Daemon\Run::Summon(array('Notifier', 'refresh_all', $x[0]['channel_id'])); Run::Summon( [ 'Notifier', 'refresh_all', $x[0]['channel_id'] ] );
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);
} }

View file

@ -1372,8 +1372,8 @@ function import_mail($channel, $mails, $sync = false) {
$m['channel_id'] = $channel['channel_id']; $m['channel_id'] = $channel['channel_id'];
$mail_id = mail_store($m); $mail_id = mail_store($m);
if ($sync && $mail_id) { if ($sync && $mail_id) {
// Not applicable to Zap which does not federate with singletons // Not applicable to Zap which does not support mail
// Run::Summon(array('Notifier','single_mail',$mail_id)); // Run::Summon( [ 'Notifier','single_mail',$mail_id ] );
} }
} }
} }

View file

@ -1180,7 +1180,7 @@ function do_delivery($deliveries, $force = false) {
$deliver[] = $d; $deliver[] = $d;
if(count($deliver) >= $deliveries_per_process) { if(count($deliver) >= $deliveries_per_process) {
Run::Summon(array('Deliver',$deliver)); Run::Summon( [ 'Deliver',$deliver ] );
$deliver = []; $deliver = [];
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);
@ -1190,7 +1190,7 @@ function do_delivery($deliveries, $force = false) {
// catch any stragglers // catch any stragglers
if($deliver) { if($deliver) {
Run::Summon(array('Deliver',$deliver)); Run::Summon( [ 'Deliver',$deliver ] );
} }
} }

View file

@ -85,13 +85,6 @@ function get_all_perms($uid, $observer_xchan, $check_siteblock = true, $default_
intval($uid), intval($uid),
dbesc($observer_xchan) dbesc($observer_xchan)
); );
if(! $x) {
// see if they've got a guest access token; these are treated as connections
$y = atoken_abook($uid,$observer_xchan);
if($y)
$x = [ $y ];
}
$abook_checked = true; $abook_checked = true;
} }
@ -313,13 +306,6 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
return false; return false;
} }
if (! $x) {
// see if they've got a guest access token
$y = atoken_abook($uid,$observer_xchan);
if ($y) {
$x = [ $y ];
}
}
$abperms = get_abconfig($uid,$observer_xchan,'system','my_perms',''); $abperms = get_abconfig($uid,$observer_xchan,'system','my_perms','');
} }

View file

@ -7,7 +7,9 @@
use Zotlabs\Lib\Apps; use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Activity; use Zotlabs\Lib\Activity;
use Zotlabs\Access\AccessControl; use Zotlabs\Access\AccessControl;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Web\HTTPHeaders; use Zotlabs\Web\HTTPHeaders;
use Zotlabs\Daemon\Run;
require_once('include/permissions.php'); require_once('include/permissions.php');
require_once('include/photo_factory.php'); require_once('include/photo_factory.php');
@ -520,7 +522,7 @@ function photo_upload($channel, $observer, $args) {
// in the photos pages - using the photos permissions instead. We need the public policy to keep the photo // in the photos pages - using the photos permissions instead. We need the public policy to keep the photo
// linked item from leaking into the feed when somebody has a channel with read_stream restrictions. // linked item from leaking into the feed when somebody has a channel with read_stream restrictions.
$arr['public_policy'] = map_scope(\Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'view_stream'),true); $arr['public_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'],'view_stream'),true);
if($arr['public_policy']) if($arr['public_policy'])
$arr['item_private'] = 1; $arr['item_private'] = 1;
@ -529,7 +531,7 @@ function photo_upload($channel, $observer, $args) {
$item_id = $result['item_id']; $item_id = $result['item_id'];
if($visible && $deliver) if($visible && $deliver)
Zotlabs\Daemon\Run::Summon(array('Notifier', 'wall-new', $item_id)); Run::Summon( [ 'Notifier', 'wall-new', $item_id ] );
} }
$ret['success'] = true; $ret['success'] = true;

View file

@ -3515,6 +3515,12 @@ function cleanup_bbcode($body) {
* First protect any url inside certain bbcode tags so we don't double link it. * First protect any url inside certain bbcode tags so we don't double link it.
*/ */
// markdown code blocks are slightly more complicated
$body = preg_replace_callback('#(^|\n)([`~]{3,})(?: *\.?([a-zA-Z0-9\-.]+))?\n+([\s\S]+?)\n+\2(\n|$)#', function ($match) {
return $match[1] . $match[2] . "\n" . bb_code_protect($match[4]) . "\n" . $match[2] . (($match[5]) ? $match[5] : "\n");
}, $body);
$body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body); $body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body);
@ -3534,6 +3540,8 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[\$b64img(.*?)\[\/(img)\]/ism','\red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64img(.*?)\[\/(img)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64zmg(.*?)\[\/(zmg)\]/ism','\red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64zmg(.*?)\[\/(zmg)\]/ism','\red_unescape_codeblock',$body);
$body = bb_code_unprotect($body);
// fix any img tags that should be zmg // fix any img tags that should be zmg
$body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','\red_zrlify_img_callback',$body); $body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','\red_zrlify_img_callback',$body);

View file

@ -258,6 +258,7 @@ function red_escape_codeblock($m) {
return '[$b64' . $m[2] . base64_encode($m[1]) . '[/' . $m[2] . ']'; return '[$b64' . $m[2] . base64_encode($m[1]) . '[/' . $m[2] . ']';
} }
function red_unescape_codeblock($m) { function red_unescape_codeblock($m) {
return '[' . $m[2] . base64_decode($m[1]) . '[/' . $m[2] . ']'; return '[' . $m[2] . base64_decode($m[1]) . '[/' . $m[2] . ']';
} }

View file

@ -284,7 +284,7 @@ var activeCommentText = '';
$('#jot-commentstate').val(0); $('#jot-commentstate').val(0);
} }
var post_comments = $('#post_comments').val(); var post_comments = $('#id_post_comments').val();
if (post_comments && post_comments.length) { if (post_comments && post_comments.length) {
$('#jot-commfrom').val(post_comments); $('#jot-commfrom').val(post_comments);
} }

View file

@ -306,7 +306,7 @@
{{include file="field_checkbox.tpl" field=$comments_allowed}} {{include file="field_checkbox.tpl" field=$comments_allowed}}
{{include file="field_select.tpl" field=$comment_perms}} {{include file="field_select.tpl" field=$comment_perms}}
<div class="date"> <div class="date">
<label for="id_oembed">{{$commclosedate}}</label> <label for="commclose-date">{{$commclosedate}}</label>
<input type="text" placeholder="yyyy-mm-dd HH:MM" name="start_text" value="{{$comments_closed}}" id="commclose-date" class="form-control" /> <input type="text" placeholder="yyyy-mm-dd HH:MM" name="start_text" value="{{$comments_closed}}" id="commclose-date" class="form-control" />
</div> </div>
<script> <script>