aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-12-11 14:39:06 -0800
committerzotlabs <mike@macgirvin.com>2016-12-11 14:39:06 -0800
commit9e27559bdb2ba2177128deb014ecaef21f1eaaba (patch)
treedb86c859f81baa34ab032c1e959eadc9c03ee72b /include
parent0a21ffbfecf30f619bdfc8de15c88911a6d7d3db (diff)
downloadvolse-hubzilla-9e27559bdb2ba2177128deb014ecaef21f1eaaba.tar.gz
volse-hubzilla-9e27559bdb2ba2177128deb014ecaef21f1eaaba.tar.bz2
volse-hubzilla-9e27559bdb2ba2177128deb014ecaef21f1eaaba.zip
clone sync missing for some item delete operations
Diffstat (limited to 'include')
-rw-r--r--include/wiki.php56
1 files changed, 28 insertions, 28 deletions
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) {