native wiki stuff
This commit is contained in:
parent
335d9af8dc
commit
b6595a44d1
@ -430,6 +430,8 @@ class Item extends \Zotlabs\Web\Controller {
|
||||
$body .= trim($_REQUEST['attachment']);
|
||||
$postopts = '';
|
||||
|
||||
$allow_empty = ((array_key_exists('allow_empty',$_REQUEST)) ? intval($_REQUEST['allow_empty']) : 0);
|
||||
|
||||
$private = intval($acl->is_private() || ($public_policy));
|
||||
|
||||
// If this is a comment, set the permissions from the parent.
|
||||
@ -442,7 +444,7 @@ class Item extends \Zotlabs\Web\Controller {
|
||||
$owner_hash = $parent_item['owner_xchan'];
|
||||
}
|
||||
|
||||
if(! strlen($body)) {
|
||||
if((! $allow_empty) && (! strlen($body))) {
|
||||
if($preview)
|
||||
killme();
|
||||
info( t('Empty post discarded.') . EOL );
|
||||
|
@ -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
|
||||
|
@ -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']
|
||||
|
@ -38,8 +38,10 @@
|
||||
echo "Directory: Zotlabs\n";
|
||||
$files = glob('Zotlabs/*/*.php');
|
||||
foreach($files as $file) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
if(strpos($file,'SiteModule') === false) {
|
||||
echo $file . "\n";
|
||||
include_once($file);
|
||||
}
|
||||
}
|
||||
|
||||
echo "Directory: Zotlabs/Module (sub-modules)\n";
|
||||
|
Reference in New Issue
Block a user