aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Randprof.php2
-rw-r--r--Zotlabs/Module/Wiki.php18
-rw-r--r--Zotlabs/Widget/Wiki_pages.php57
3 files changed, 40 insertions, 37 deletions
diff --git a/Zotlabs/Module/Randprof.php b/Zotlabs/Module/Randprof.php
index dc2e925fe..94ec095cb 100644
--- a/Zotlabs/Module/Randprof.php
+++ b/Zotlabs/Module/Randprof.php
@@ -8,7 +8,7 @@ class Randprof extends \Zotlabs\Web\Controller {
function init() {
$x = random_profile();
if($x)
- goaway(chanlink_url($x));
+ goaway(chanlink_hash($x));
/** FIXME this doesn't work at the moment as a fallback */
goaway(z_root() . '/profile');
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 5a93046e3..85481754f 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -207,9 +207,10 @@ class Wiki extends \Zotlabs\Web\Controller {
$ignore_language = true;
continue;
}
- if($page_name)
+ if($page_name) {
$page_name .= '/';
- $page_name .= argv($x);
+ }
+ $page_name .= argv($x);
}
$pageUrlName = urldecode($page_name);
@@ -296,7 +297,8 @@ class Wiki extends \Zotlabs\Web\Controller {
'$showPageControls' => $showPageControls,
'$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')),
'$tools_label' => 'Page Tools',
- '$channel' => $owner['channel_address'],
+ '$channel_address' => $owner['channel_address'],
+ '$channel_id' => $owner['channel_id'],
'$resource_id' => $resource_id,
'$page' => $pageUrlName,
'$mimeType' => $mimeType,
@@ -496,10 +498,12 @@ class Wiki extends \Zotlabs\Web\Controller {
$x = new \Zotlabs\Widget\Wiki_pages();
- $page_list_html = $x->widget(array(
- 'resource_id' => $resource_id,
- 'refresh' => true,
- 'channel' => argv(1)));
+ $page_list_html = $x->widget([
+ 'resource_id' => $resource_id,
+ 'channel_id' => $owner['channel_id'],
+ 'channel_address' => $owner['channel_address'],
+ 'refresh' => true
+ ]);
json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
}
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
index f992b3f93..53966b06f 100644
--- a/Zotlabs/Widget/Wiki_pages.php
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -7,58 +7,57 @@ class Wiki_pages {
function widget($arr) {
- $channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
- $c = channelx_by_nick($channelname);
+ if(argc() < 3)
+ return;
+
+ if(! $arr['resource_id']) {
- if(! $c)
$c = \App::get_channel();
- if(! $c)
- return '';
+ if(! $c)
+ $c = channelx_by_nick(argv(1));
- $wikiname = '';
- if(array_key_exists('refresh', $arr)) {
- $not_refresh = (($arr['refresh']=== true) ? false : true);
- }
- else {
- $not_refresh = true;
+ $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],argv(2));
+
+ $arr = array(
+ 'resource_id' => $w['resource_id'],
+ 'channel_id' => $c['channel_id'],
+ 'channel_address' => $c['channel_address'],
+ 'refresh' => false
+ );
}
+ $wikiname = '';
+
$pages = array();
- if(! array_key_exists('resource_id', $arr)) {
- $hide = true;
- }
- else {
- $p = \Zotlabs\Lib\NativeWikiPage::page_list($c['channel_id'],get_observer_hash(),$arr['resource_id']);
-
- if($p['pages']) {
- $pages = $p['pages'];
- $w = $p['wiki'];
- // Wiki item record is $w['wiki']
- $wikiname = $w['urlName'];
- if (!$wikiname) {
- $wikiname = '';
- }
+
+ $p = \Zotlabs\Lib\NativeWikiPage::page_list($arr['channel_id'],get_observer_hash(),$arr['resource_id']);
+
+ if($p['pages']) {
+ $pages = $p['pages'];
+ $w = $p['wiki'];
+ // Wiki item record is $w['wiki']
+ $wikiname = $w['urlName'];
+ if (!$wikiname) {
+ $wikiname = '';
}
}
-
$can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
$can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
- '$hide' => $hide,
'$resource_id' => $arr['resource_id'],
- '$not_refresh' => $not_refresh,
'$header' => t('Wiki Pages'),
- '$channel' => $channelname,
+ '$channel_address' => $arr['channel_address'],
'$wikiname' => $wikiname,
'$pages' => $pages,
'$canadd' => $can_create,
'$candel' => $can_delete,
'$addnew' => t('Add new page'),
'$pageName' => array('pageName', t('Page name')),
+ '$refresh' => $arr['refresh']
));
}
}