aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Item.php8
-rw-r--r--include/wiki.php56
2 files changed, 36 insertions, 28 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index d6df20130..085c02742 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -1108,6 +1108,14 @@ class Item extends \Zotlabs\Web\Controller {
else {
// complex deletion that needs to propagate and be performed in phases
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
+ $r = q("select * from item where id = %d",
+ intval($i[0]['id'])
+ );
+ if($r) {
+ xchan_query($r);
+ $sync_item = fetch_post_tags($r);
+ build_sync_packet($i[0]['uid'],array('item' => array(encode_item($sync_item[0],true))));
+ }
tag_deliver($i[0]['uid'],$i[0]['id']);
}
}
diff --git a/include/wiki.php b/include/wiki.php
index 542d617b9..30685a0bf 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -46,7 +46,7 @@ function wiki_page_list($resource_id) {
$i = 1;
foreach($files as $file) {
// strip the file extension and unwrap URL encoding to leave HTML encoded name
- $title = substr($file, 0, -3);
+ $title = substr($file, 0, strrpos($file,'.'));
if(urldecode($title) !== 'Home') {
$pages[] = [
'resource_id' => $resource_id,
@@ -147,7 +147,7 @@ function wiki_create_wiki($channel, $observer_hash, $wiki, $acl) {
$item_id = $post['item_id'];
if ($item_id) {
- \Zotlabs\Daemon\Master::Summon(array('Notifier', 'activity', $item_id));
+ \Zotlabs\Daemon\Master::Summon(array('Notifier', 'activity', $item_id));
return array('item' => $post['item'], 'success' => true);
} else {
return array('item' => null, 'success' => false);
@@ -226,8 +226,8 @@ function wiki_get_permissions($resource_id, $owner_id, $observer_hash) {
$r = q("SELECT * FROM item WHERE uid = %d and resource_type = '%s' AND resource_id = '%s' $sql_extra LIMIT 1",
intval($owner_id),
dbesc(WIKI_ITEM_RESOURCE_TYPE),
- dbesc($resource_id)
- );
+ dbesc($resource_id)
+ );
if (!$r) {
return array('read' => false, 'write' => false, 'success' => true);
@@ -579,36 +579,36 @@ function wiki_toc($content) {
// look for markdown TOC items
preg_match_all(
- '/^(?:=|-|#).*$/m',
- $source,
- $matches,
- PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE
+ '/^(?:=|-|#).*$/m',
+ $source,
+ $matches,
+ PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE
);
// preprocess: iterate matched lines to create an array of items
// where each item is an array(level, text)
$file_size = strlen($source);
foreach ($matches[0] as $item) {
- $found_mark = substr($item[0], 0, 1);
- if ($found_mark == '#') {
- // text is the found item
- $item_text = $item[0];
- $item_level = strrpos($item_text, '#') + 1;
- $item_text = substr($item_text, $item_level);
- } else {
- // text is the previous line (empty if <hr>)
- $item_offset = $item[1];
- $prev_line_offset = strrpos($source, "\n", -($file_size - $item_offset + 2));
- $item_text =
- substr($source, $prev_line_offset, $item_offset - $prev_line_offset - 1);
- $item_text = trim($item_text);
- $item_level = $found_mark == '=' ? 1 : 2;
- }
- if (!trim($item_text) OR strpos($item_text, '|') !== FALSE) {
- // item is an horizontal separator or a table header, don't mind
- continue;
- }
- $raw_toc[] = ['level' => $item_level, 'text' => trim($item_text)];
+ $found_mark = substr($item[0], 0, 1);
+ if ($found_mark == '#') {
+ // text is the found item
+ $item_text = $item[0];
+ $item_level = strrpos($item_text, '#') + 1;
+ $item_text = substr($item_text, $item_level);
+ } else {
+ // text is the previous line (empty if <hr>)
+ $item_offset = $item[1];
+ $prev_line_offset = strrpos($source, "\n", -($file_size - $item_offset + 2));
+ $item_text =
+ substr($source, $prev_line_offset, $item_offset - $prev_line_offset - 1);
+ $item_text = trim($item_text);
+ $item_level = $found_mark == '=' ? 1 : 2;
+ }
+ if (!trim($item_text) OR strpos($item_text, '|') !== FALSE) {
+ // item is an horizontal separator or a table header, don't mind
+ continue;
+ }
+ $raw_toc[] = ['level' => $item_level, 'text' => trim($item_text)];
}
$o = '';
foreach($raw_toc as $t) {