diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-06-02 22:27:26 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-06-02 22:27:26 -0400 |
commit | b70c6809648bb3c78e5e26f9293727b3a7aa4025 (patch) | |
tree | d62b402f57fd133951820759c4589b6d649e315a /include/widgets.php | |
parent | 8d284bab474c7e669ae9a639bdb22f7b28b95cc3 (diff) | |
download | volse-hubzilla-b70c6809648bb3c78e5e26f9293727b3a7aa4025.tar.gz volse-hubzilla-b70c6809648bb3c78e5e26f9293727b3a7aa4025.tar.bz2 volse-hubzilla-b70c6809648bb3c78e5e26f9293727b3a7aa4025.zip |
Major corrections to access control and page construction.
Diffstat (limited to 'include/widgets.php')
-rw-r--r-- | include/widgets.php | 24 |
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) { |