aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-01-25 19:41:47 +0100
committerMario Vavti <mario@mariovavti.com>2017-01-25 19:41:47 +0100
commit1db57c498d0edceac705ba027790cfa9d4e04c6d (patch)
tree315989dd17ba37604069033e703bd09e89d0c71c /Zotlabs
parent54f7cd53022284570ca38daba97386f929fd6f4a (diff)
downloadvolse-hubzilla-1db57c498d0edceac705ba027790cfa9d4e04c6d.tar.gz
volse-hubzilla-1db57c498d0edceac705ba027790cfa9d4e04c6d.tar.bz2
volse-hubzilla-1db57c498d0edceac705ba027790cfa9d4e04c6d.zip
fixes for wiki create/delete page
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php16
-rw-r--r--Zotlabs/Module/Wiki.php18
2 files changed, 10 insertions, 24 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index f0b8b76a1..79b7548ce 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -20,7 +20,7 @@ class NativeWikiPage {
$sql_extra = item_permissions_sql($channel_id,$observer_hash);
- $r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d
+ $r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d and item_hidden = 0
$sql_extra group by mid",
dbesc($resource_id),
intval($channel_id)
@@ -63,7 +63,7 @@ class NativeWikiPage {
$p = post_activity_item($arr, false, false);
- if($p['success']) {
+ if($p['item_id']) {
$page = [
'rawName' => $name,
'htmlName' => escape_tags($name),
@@ -71,7 +71,7 @@ class NativeWikiPage {
'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w)
];
- return array('page' => $page, 'item_id' => $p['post_id'], 'wiki' => $w, 'message' => '', 'success' => true);
+ return array('page' => $page, 'item_id' => $p['item_id'], 'wiki' => $w, 'message' => '', 'success' => true);
}
return [ 'success' => false, 'message' => t('Wiki page create failed.') ];
}
@@ -202,6 +202,7 @@ class NativeWikiPage {
$revision = ((array_key_exists('revision',$arr)) ? $arr['revision'] : (-1));
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
+
if (! $w['wiki']) {
return array('content' => null, 'message' => 'Error reading wiki', 'success' => false);
}
@@ -385,7 +386,7 @@ class NativeWikiPage {
intval($channel_id),
dbesc($pageUrlName)
);
-
+
if($ic) {
foreach($ic as $c) {
$ids[] = intval($c['iid']);
@@ -393,9 +394,7 @@ class NativeWikiPage {
}
if($ids) {
- foreach($ids as $id) {
- drop_item($id,false);
- }
+ drop_items($ids);
return [ 'success' => true ];
}
@@ -484,7 +483,6 @@ class NativeWikiPage {
}
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
-
if (! $w['wiki']) {
return array('message' => t('Error reading wiki'), 'success' => false);
}
@@ -646,4 +644,4 @@ class NativeWikiPage {
return $o;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 222c10155..d694a28ae 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -416,7 +416,7 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id);
- if($page['success']) {
+ if($page['item_id']) {
$ob = \App::get_observer();
$commit = Zlib\NativeWikiPage::commit(array(
'commit_msg' => t('New page created'),
@@ -547,20 +547,8 @@ class Wiki extends \Zotlabs\Web\Controller {
$deleted = Zlib\NativeWikiPage::delete_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
if($deleted['success']) {
- $ob = \App::get_observer();
- $commit = Zlib\NativeWikiPage::git_commit(array(
- 'commit_msg' => 'Deleted ' . $pageUrlName,
- 'resource_id' => $resource_id,
- 'observer' => $ob,
- 'files' => null
- ));
- if($commit['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
- json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
- }
- else {
- json_return_and_die(array('message' => 'Error making git commit','success' => false));
- }
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
+ json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
}
else {
json_return_and_die(array('message' => 'Error deleting page', 'success' => false));