aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php25
-rw-r--r--include/widgets.php19
2 files changed, 31 insertions, 13 deletions
diff --git a/include/items.php b/include/items.php
index f7d8691cc..7fb5dc5da 100755
--- a/include/items.php
+++ b/include/items.php
@@ -302,7 +302,7 @@ function add_source_route($iid, $hash) {
* * \e boolean \b success true or false
* * \e array \b activity the resulting activity if successful
*/
-function post_activity_item($arr) {
+function post_activity_item($arr,$allow_code = false,$deliver = true) {
$ret = array('success' => false);
@@ -382,11 +382,11 @@ function post_activity_item($arr) {
return $ret;
}
- $post = item_store($arr);
+ $post = item_store($arr,$allow_code,$deliver);
if($post['success'])
$post_id = $post['item_id'];
- if($post_id) {
+ if($post_id && $deliver) {
$arr['id'] = $post_id;
call_hooks('post_local_end', $arr);
Zotlabs\Daemon\Master::Summon(array('Notifier','activity',$post_id));
@@ -1564,8 +1564,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$arr['attach'] = json_encode($arr['attach']);
}
- $arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
- $arr['mid'] = ((x($arr,'mid')) ? notags(trim($arr['mid'])) : random_string());
+ $arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
+ $arr['mid'] = ((x($arr,'mid')) ? notags(trim($arr['mid'])) : random_string());
+ $arr['revision'] = ((x($arr,'revision') && intval($arr['revision']) > 0) ? intval($arr['revision']) : 0);
+logger('revision: ' . $arr['revision']);
+
$arr['author_xchan'] = ((x($arr,'author_xchan')) ? notags(trim($arr['author_xchan'])) : '');
$arr['owner_xchan'] = ((x($arr,'owner_xchan')) ? notags(trim($arr['owner_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
@@ -1726,9 +1729,10 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if($parent_deleted)
$arr['item_deleted'] = 1;
- $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
+ $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d and revision = %d LIMIT 1",
dbesc($arr['mid']),
- intval($arr['uid'])
+ intval($arr['uid']),
+ intval($arr['revision'])
);
if($r) {
logger('item_store: duplicate item ignored. ' . print_r($arr,true));
@@ -1783,9 +1787,10 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
// find the item we just created
- $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC ",
+ $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d and revision = %d ORDER BY id ASC ",
$arr['mid'], // already dbesc'd
- intval($arr['uid'])
+ intval($arr['uid']),
+ intval($arr['revision'])
);
if($r && count($r)) {
@@ -1996,6 +2001,8 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
$arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : $orig[0]['expires']);
+ $arr['revision'] = ((x($arr,'revision') && $arr['revision'] > 0) ? intval($arr['revision']) : 0);
+
if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] > NULL_DATE)
$arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']);
else
diff --git a/include/widgets.php b/include/widgets.php
index d3bdb3313..94d638d77 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -903,7 +903,12 @@ function widget_chatroom_members() {
function widget_wiki_list($arr) {
require_once("include/wiki.php");
$channel = channelx_by_n(App::$profile_uid);
- $wikis = wiki_list($channel, get_observer_hash());
+
+ if(defined('NATIVE_WIKI'))
+ $wikis = Zotlabs\Lib\NativeWiki::listwikis($channel,get_observer_hash());
+ else
+ $wikis = wiki_list($channel, get_observer_hash());
+
if($wikis) {
return replace_macros(get_markup_template('wikilist_widget.tpl'), array(
'$header' => t('Wiki List'),
@@ -918,6 +923,8 @@ function widget_wiki_pages($arr) {
require_once("include/wiki.php");
$channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
+ $c = channelx_by_nick($channelname);
+
$wikiname = '';
if (array_key_exists('refresh', $arr)) {
$not_refresh = (($arr['refresh']=== true) ? false : true);
@@ -925,11 +932,15 @@ function widget_wiki_pages($arr) {
$not_refresh = true;
}
$pages = array();
- if (!array_key_exists('resource_id', $arr)) {
+ if (! array_key_exists('resource_id', $arr)) {
$hide = true;
} else {
- $p = wiki_page_list($arr['resource_id']);
- if ($p['pages']) {
+ if(defined('NATIVE_WIKI'))
+ $p = Zotlabs\Lib\NativeWikiPage::page_list($c['channel_id'],get_observer_hash(),$arr['resource_id']);
+ else
+ $p = wiki_page_list($arr['resource_id']);
+
+ if($p['pages']) {
$pages = $p['pages'];
$w = $p['wiki'];
// Wiki item record is $w['wiki']