Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
This commit is contained in:
commit
45a9eca792
@ -20,7 +20,7 @@ class NativeWikiPage {
|
|||||||
|
|
||||||
$sql_extra = item_permissions_sql($channel_id,$observer_hash);
|
$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",
|
$sql_extra group by mid",
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
@ -63,7 +63,7 @@ class NativeWikiPage {
|
|||||||
|
|
||||||
$p = post_activity_item($arr, false, false);
|
$p = post_activity_item($arr, false, false);
|
||||||
|
|
||||||
if($p['success']) {
|
if($p['item_id']) {
|
||||||
$page = [
|
$page = [
|
||||||
'rawName' => $name,
|
'rawName' => $name,
|
||||||
'htmlName' => escape_tags($name),
|
'htmlName' => escape_tags($name),
|
||||||
@ -71,7 +71,7 @@ class NativeWikiPage {
|
|||||||
'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w)
|
'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.') ];
|
return [ 'success' => false, 'message' => t('Wiki page create failed.') ];
|
||||||
}
|
}
|
||||||
@ -202,6 +202,7 @@ class NativeWikiPage {
|
|||||||
$revision = ((array_key_exists('revision',$arr)) ? $arr['revision'] : (-1));
|
$revision = ((array_key_exists('revision',$arr)) ? $arr['revision'] : (-1));
|
||||||
|
|
||||||
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
|
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
|
||||||
|
|
||||||
if (! $w['wiki']) {
|
if (! $w['wiki']) {
|
||||||
return array('content' => null, 'message' => 'Error reading wiki', 'success' => false);
|
return array('content' => null, 'message' => 'Error reading wiki', 'success' => false);
|
||||||
}
|
}
|
||||||
@ -393,9 +394,7 @@ class NativeWikiPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($ids) {
|
if($ids) {
|
||||||
foreach($ids as $id) {
|
drop_items($ids);
|
||||||
drop_item($id,false);
|
|
||||||
}
|
|
||||||
return [ 'success' => true ];
|
return [ 'success' => true ];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +483,6 @@ class NativeWikiPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
|
$w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id);
|
||||||
|
|
||||||
if (! $w['wiki']) {
|
if (! $w['wiki']) {
|
||||||
return array('message' => t('Error reading wiki'), 'success' => false);
|
return array('message' => t('Error reading wiki'), 'success' => false);
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
$page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id);
|
$page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id);
|
||||||
|
|
||||||
if($page['success']) {
|
if($page['item_id']) {
|
||||||
$ob = \App::get_observer();
|
$ob = \App::get_observer();
|
||||||
$commit = Zlib\NativeWikiPage::commit(array(
|
$commit = Zlib\NativeWikiPage::commit(array(
|
||||||
'commit_msg' => t('New page created'),
|
'commit_msg' => t('New page created'),
|
||||||
@ -547,21 +547,9 @@ 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));
|
$deleted = Zlib\NativeWikiPage::delete_page(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
|
||||||
if($deleted['success']) {
|
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);
|
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));
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
json_return_and_die(array('message' => 'Error deleting page', 'success' => false));
|
json_return_and_die(array('message' => 'Error deleting page', 'success' => false));
|
||||||
}
|
}
|
||||||
|
@ -383,15 +383,18 @@ function post_activity_item($arr,$allow_code = false,$deliver = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$post = item_store($arr,$allow_code,$deliver);
|
$post = item_store($arr,$allow_code,$deliver);
|
||||||
if($post['success'])
|
|
||||||
|
if($post['success']) {
|
||||||
$post_id = $post['item_id'];
|
$post_id = $post['item_id'];
|
||||||
|
$ret['item_id'] = $post_id;
|
||||||
|
}
|
||||||
|
|
||||||
if($post_id && $deliver) {
|
if($post_id && $deliver) {
|
||||||
$arr['id'] = $post_id;
|
$arr['id'] = $post_id;
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
Zotlabs\Daemon\Master::Summon(array('Notifier','activity',$post_id));
|
Zotlabs\Daemon\Master::Summon(array('Notifier','activity',$post_id));
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
$ret['item_id'] = $post_id;
|
//$ret['item_id'] = $post_id;
|
||||||
$ret['activity'] = $post['item'];
|
$ret['activity'] = $post['item'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user