aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/NativeWiki.php16
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php25
2 files changed, 28 insertions, 13 deletions
diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php
index c3380939a..f4089d8a2 100644
--- a/Zotlabs/Lib/NativeWiki.php
+++ b/Zotlabs/Lib/NativeWiki.php
@@ -93,13 +93,25 @@ class NativeWiki {
if($item_id) {
\Zotlabs\Daemon\Master::Summon(array('Notifier', 'activity', $item_id));
- return array('item' => $post['item'], 'success' => true);
+ return array('item' => $post['item'], 'item_id' => $item_id, 'success' => true);
}
else {
return array('item' => null, 'success' => false);
}
}
+ static public function sync_a_wiki_item($uid,$id) {
+ $r = q("select * from item where id = %d and uid = %d",
+ intval($id),
+ intval($uid)
+ );
+ if($r) {
+ xchan_query($r);
+ $sync_item = fetch_post_tags($r);
+ build_sync_packet($uid,array('wiki' => array(encode_item($sync_item[0],true))));
+ }
+ }
+
function delete_wiki($channel_id,$observer_hash,$resource_id) {
$w = self::get_wiki($channel_id,$observer_hash,$resource_id);
@@ -113,7 +125,7 @@ class NativeWiki {
info( t('Wiki files deleted successfully'));
- return array('item' => $item, 'success' => (($drop === 1) ? true : false));
+ return array('item' => $item, 'item_id' => $item['id'], 'success' => (($drop === 1) ? true : false));
}
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index 0c3698519..f0b8b76a1 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -61,16 +61,19 @@ class NativeWikiPage {
set_iconfig($arr,'nwikipage','pagetitle',urlencode(($name) ? $name : t('(No Title)')),true);
- post_activity_item($arr, false, false);
+ $p = post_activity_item($arr, false, false);
- $page = [
- 'rawName' => $name,
- 'htmlName' => escape_tags($name),
- 'urlName' => urlencode(escape_tags($name)),
- 'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w)
- ];
+ if($p['success']) {
+ $page = [
+ 'rawName' => $name,
+ 'htmlName' => escape_tags($name),
+ 'urlName' => urlencode(escape_tags($name)),
+ 'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w)
+ ];
- return array('page' => $page, 'wiki' => $w, 'message' => '', 'success' => true);
+ return array('page' => $page, 'item_id' => $p['post_id'], 'wiki' => $w, 'message' => '', 'success' => true);
+ }
+ return [ 'success' => false, 'message' => t('Wiki page create failed.') ];
}
static public function rename_page($arr) {
@@ -119,7 +122,7 @@ class NativeWikiPage {
return [ 'success' => true, 'page' => $page ];
}
- return [ 'success' => false, 'message' => t('Page not found') ];
+ return [ 'success' => false, 'item_id' => $c['item_id'], 'message' => t('Page not found') ];
}
@@ -358,7 +361,7 @@ class NativeWikiPage {
$ret = item_store($item, false, false);
if($ret['item_id'])
- return array('message' => '', 'filename' => $filename, 'success' => true);
+ return array('message' => '', 'item_id' => $ret['item_id'], 'filename' => $filename, 'success' => true);
else
return array('message' => t('Page update failed.'), 'success' => false);
}
@@ -490,7 +493,7 @@ class NativeWikiPage {
if($page) {
set_iconfig($page['id'],'nwikipage','commit_msg',escape_tags($commit_msg),true);
- return [ 'success' => true, 'page' => $page ];
+ return [ 'success' => true, 'item_id' => $page['id'], 'page' => $page ];
}
return [ 'success' => false, 'message' => t('Page not found.') ];