aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 536af8818..d9dac1afa 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -857,27 +857,27 @@ function widget_chatroom_members() {
function widget_wiki_list($arr) {
require_once("include/wiki.php");
- if (argc() > 1) {
- $nick = argv(1);
- $channel = get_channel_by_nick($nick);
- } else {
+ $channel = null;
+ if (argc() < 2 && local_channel()) {
+ // This should not occur because /wiki should redirect to /wiki/channel ...
$channel = \App::get_channel();
- $nick = $channel['channel_address'];
- }
- $wikis = wiki_list($channel, get_observer_hash());
- if (local_channel() === intval($channel['channel_id'])) {
- $showControls = true;
} else {
- $showControls = false;
+ $channel = get_channel_by_nick(argv(1)); // Channel being viewed by observer
}
+ if (!$channel) {
+ return '';
+ }
+ $wikis = wiki_list($channel, get_observer_hash());
if ($wikis) {
return replace_macros(get_markup_template('wikilist.tpl'), array(
'$header' => t('Wiki List'),
- '$channel' => $nick,
+ '$channel' => $channel['channel_address'],
'$wikis' => $wikis['wikis'],
- '$showControls' => $showControls
+ // If the observer is the local channel owner, show the wiki controls
+ '$showControls' => ((local_channel() === intval($channel['channel_id'])) ? true : false)
));
}
+ return '';
}
function widget_wiki_pages($arr) {