aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/include/widgets.php b/include/widgets.php
index c4b80afd0..b19c36bc6 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -854,6 +854,66 @@ function widget_chatroom_members() {
return $o;
}
+function widget_wiki_list($arr) {
+
+ require_once("include/wiki.php");
+ if (argc() > 1) {
+ $nick = argv(1);
+ $channel = get_channel_by_nick($nick);
+ } else {
+ $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;
+ }
+ if ($wikis) {
+ return replace_macros(get_markup_template('wikilist.tpl'), array(
+ '$header' => t('Wiki List'),
+ '$channel' => $nick,
+ '$wikis' => $wikis['wikis'],
+ '$showControls' => $showControls
+ ));
+ }
+}
+
+function widget_wiki_pages($arr) {
+
+ require_once("include/wiki.php");
+ $channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
+ $wikiname = '';
+ if (array_key_exists('refresh', $arr)) {
+ $not_refresh = (($arr['refresh']=== true) ? false : true);
+ } else {
+ $not_refresh = true;
+ }
+ $pages = array();
+ if (!array_key_exists('resource_id', $arr)) {
+ $hide = true;
+ } else {
+ $p = wiki_page_list($arr['resource_id']);
+ if ($p['pages']) {
+ $pages = $p['pages'];
+ $w = wiki_get_wiki($arr['resource_id']);
+ $wikiname = $w['wiki']['title'];
+ if (!$wikiname) {
+ $wikiname = '';
+ }
+ }
+ }
+ return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
+ '$hide' => $hide,
+ '$not_refresh' => $not_refresh,
+ '$header' => t('Wiki Pages'),
+ '$channel' => $channelname,
+ '$wikiname' => $wikiname,
+ '$pages' => $pages
+ ));
+}
+
function widget_bookmarkedchats($arr) {
if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))