aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php385
1 files changed, 256 insertions, 129 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 4b14d6c94..0355ebd8c 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -8,14 +8,24 @@
require_once('include/dir_fns.php');
require_once('include/contact_widgets.php');
require_once('include/attach.php');
-
+require_once('include/Contact.php');
function widget_profile($args) {
- $a = get_app();
+
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- return profile_sidebar($a->profile, $block, true);
+ return profile_sidebar(App::$profile, $block, true);
}
+function widget_zcard($args) {
+
+ $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
+ $channel = channelx_by_n(App::$profile_uid);
+ return get_zcard($channel,get_observer_hash(),array('width' => 875));
+}
+
+
+
+
// FIXME The problem with the next widget is that we don't have a search function for webpages that we can send the links to.
// Then we should also provide an option to search webpages and conversations.
@@ -23,8 +33,8 @@ function widget_tagcloud($args) {
$o = '';
//$tab = 0;
- $a = get_app();
- $uid = $a->profile_uid;
+
+ $uid = App::$profile_uid;
$count = ((x($args,'count')) ? intval($args['count']) : 24);
$flags = 0;
$type = TERM_CATEGORY;
@@ -75,7 +85,7 @@ function widget_collections($args) {
$each = 'group';
$edit = false;
$current = 0;
- $abook_id = get_app()->poi['abook_xchan'];
+ $abook_id = App::$poi['abook_xchan'];
$wmode = 1;
break;
default:
@@ -154,8 +164,7 @@ function widget_follow($args) {
if(! local_channel())
return '';
- $a = get_app();
- $uid =$a->channel['channel_id'];
+ $uid = App::$channel['channel_id'];
$r = q("select count(*) as total from abook where abook_channel = %d and abook_self = 0 ",
intval($uid)
);
@@ -170,8 +179,8 @@ function widget_follow($args) {
}
return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Connection'),
- '$desc' => t('Enter the channel address'),
- '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
+ '$desc' => t('Enter channel address'),
+ '$hint' => t('Examples: bob@example.com, https://example.com/barbara'),
'$follow' => t('Connect'),
'$abook_usage_message' => $abook_usage_message
));
@@ -200,8 +209,6 @@ function widget_savedsearch($arr) {
if((! local_channel()) || (! feature_enabled(local_channel(),'savedsearch')))
return '';
- $a = get_app();
-
$search = ((x($_GET,'search')) ? $_GET['search'] : '');
if(x($_GET,'searchsave') && $search) {
@@ -228,7 +235,7 @@ function widget_savedsearch($arr) {
$search = '';
}
- $srchurl = $a->query_string;
+ $srchurl = App::$query_string;
$srchurl = rtrim(preg_replace('/searchsave\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$hasq = ((strpos($srchurl,'?') !== false) ? true : false);
@@ -285,7 +292,6 @@ function widget_filer($arr) {
if(! local_channel())
return '';
- $a = get_app();
$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');
@@ -306,20 +312,19 @@ function widget_filer($arr) {
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
- '$base' => z_root() . '/' . $a->cmd
+ '$base' => z_root() . '/' . App::$cmd
));
}
function widget_archive($arr) {
$o = '';
- $a = get_app();
- if(! $a->profile_uid) {
+ if(! App::$profile_uid) {
return '';
}
- $uid = $a->profile_uid;
+ $uid = App::$profile_uid;
if(! feature_enabled($uid,'archives'))
return '';
@@ -335,7 +340,7 @@ function widget_archive($arr) {
if(! $visible_years)
$visible_years = 5;
- $url = z_root() . '/' . $a->cmd;
+ $url = z_root() . '/' . App::$cmd;
$ret = list_post_dates($uid,$wall,$mindate);
@@ -360,23 +365,34 @@ function widget_archive($arr) {
function widget_fullprofile($arr) {
- $a = get_app();
- if(! $a->profile['profile_uid'])
+
+ if(! App::$profile['profile_uid'])
return;
$block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
- return profile_sidebar($a->profile, $block);
+ return profile_sidebar(App::$profile, $block);
}
+function widget_shortprofile($arr) {
+
+ if(! App::$profile['profile_uid'])
+ return;
+
+ $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false);
+
+ return profile_sidebar(App::$profile, $block, true, true);
+}
+
+
function widget_categories($arr) {
- $a = get_app();
- if($a->profile['profile_uid'] && (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_stream')))
+
+ if(App::$profile['profile_uid'] && (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_stream')))
return '';
$cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
- $srchurl = $a->query_string;
+ $srchurl = App::$query_string;
$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
@@ -385,31 +401,31 @@ function widget_categories($arr) {
}
function widget_tagcloud_wall($arr) {
- $a = get_app();
- if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash']))
+
+ if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return '';
- if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream'))
+ if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return '';
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
- if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
- return wtagblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
+ if(feature_enabled(App::$profile['profile_uid'], 'tagadelic'))
+ return wtagblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
return '';
}
function widget_catcloud_wall($arr) {
- $a = get_app();
- if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash']))
+
+ if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return '';
- if(! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_stream'))
+ if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return '';
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
- return catblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
+ return catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
}
@@ -465,8 +481,8 @@ function widget_settings_menu($arr) {
if(! local_channel())
return;
- $a = get_app();
- $channel = $a->get_channel();
+
+ $channel = App::get_channel();
$abook_self_id = 0;
@@ -480,55 +496,74 @@ function widget_settings_menu($arr) {
if($abk)
$abook_self_id = $abk[0]['abook_id'];
+ $hublocs = q("select count(*) as total from hubloc where hubloc_hash = '%s'",
+ dbesc($channel['channel_hash'])
+ );
+
+ $hublocs = (($hublocs[0]['total'] > 1) ? true : false);
+
$tabs = array(
array(
'label' => t('Account settings'),
- 'url' => $a->get_baseurl(true).'/settings/account',
+ 'url' => z_root().'/settings/account',
'selected' => ((argv(1) === 'account') ? 'active' : ''),
),
array(
'label' => t('Channel settings'),
- 'url' => $a->get_baseurl(true).'/settings/channel',
+ 'url' => z_root().'/settings/channel',
'selected' => ((argv(1) === 'channel') ? 'active' : ''),
),
- array(
- 'label' => t('Additional features'),
- 'url' => $a->get_baseurl(true).'/settings/features',
- 'selected' => ((argv(1) === 'features') ? 'active' : ''),
- ),
+ );
- array(
- 'label' => t('Feature/Addon settings'),
- 'url' => $a->get_baseurl(true).'/settings/featured',
- 'selected' => ((argv(1) === 'featured') ? 'active' : ''),
- ),
+ if(get_features()) {
+ $tabs[] = array(
+ 'label' => t('Additional features'),
+ 'url' => z_root().'/settings/features',
+ 'selected' => ((argv(1) === 'features') ? 'active' : ''),
+ );
+ }
- array(
- 'label' => t('Display settings'),
- 'url' => $a->get_baseurl(true).'/settings/display',
- 'selected' => ((argv(1) === 'display') ? 'active' : ''),
- ),
+ $tabs[] = array(
+ 'label' => t('Feature/Addon settings'),
+ 'url' => z_root().'/settings/featured',
+ 'selected' => ((argv(1) === 'featured') ? 'active' : ''),
+ );
- array(
- 'label' => t('Connected apps'),
- 'url' => $a->get_baseurl(true) . '/settings/oauth',
- 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
- ),
+ $tabs[] = array(
+ 'label' => t('Display settings'),
+ 'url' => z_root().'/settings/display',
+ 'selected' => ((argv(1) === 'display') ? 'active' : ''),
+ );
- array(
+ if($hublocs) {
+ $tabs[] = array(
+ 'label' => t('Manage locations'),
+ 'url' => z_root() . '/locs',
+ 'selected' => ((argv(1) === 'locs') ? 'active' : ''),
+ );
+ }
+
+ // IF can go away when UNO export and import is fully functional
+ if(! UNO) {
+ $tabs[] = array(
'label' => t('Export channel'),
- 'url' => $a->get_baseurl(true) . '/uexport',
+ 'url' => z_root() . '/uexport',
'selected' => ''
- ),
+ );
+ }
+ $tabs[] = array(
+ 'label' => t('Connected apps'),
+ 'url' => z_root() . '/settings/oauth',
+ 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
- 'url' => $a->get_baseurl(true) . '/connedit/' . $abook_self_id,
+ 'url' => z_root() . '/connedit/' . $abook_self_id,
'selected' => ''
);
}
@@ -536,7 +571,7 @@ function widget_settings_menu($arr) {
if(feature_enabled(local_channel(),'premium_channel')) {
$tabs[] = array(
'label' => t('Premium Channel Settings'),
- 'url' => $a->get_baseurl(true) . '/connect/' . $channel['channel_address'],
+ 'url' => z_root() . '/connect/' . $channel['channel_address'],
'selected' => ''
);
}
@@ -544,7 +579,7 @@ function widget_settings_menu($arr) {
if(feature_enabled(local_channel(),'channel_sources')) {
$tabs[] = array(
'label' => t('Channel Sources'),
- 'url' => $a->get_baseurl(true) . '/sources',
+ 'url' => z_root() . '/sources',
'selected' => ''
);
}
@@ -562,28 +597,27 @@ function widget_mailmenu($arr) {
if (! local_channel())
return;
- $a = get_app();
return replace_macros(get_markup_template('message_side.tpl'), array(
'$title' => t('Private Mail Menu'),
'$combined'=>array(
'label' => t('Combined View'),
- 'url' => $a->get_baseurl(true) . '/mail/combined',
+ 'url' => z_root() . '/mail/combined',
'sel' => (argv(1) == 'combined'),
),
'$inbox'=>array(
'label' => t('Inbox'),
- 'url' => $a->get_baseurl(true) . '/mail/inbox',
+ 'url' => z_root() . '/mail/inbox',
'sel' => (argv(1) == 'inbox'),
),
'$outbox'=>array(
'label' => t('Outbox'),
- 'url' => $a->get_baseurl(true) . '/mail/outbox',
+ 'url' => z_root() . '/mail/outbox',
'sel' => (argv(1) == 'outbox'),
),
'$new'=>array(
'label' => t('New Message'),
- 'url' => $a->get_baseurl(true) . '/mail/new',
+ 'url' => z_root() . '/mail/new',
'sel'=> (argv(1) == 'new'),
)
));
@@ -594,8 +628,6 @@ function widget_conversations($arr) {
if (! local_channel())
return;
- $a = get_app();
-
if(argc() > 1) {
switch(argv(1)) {
@@ -620,7 +652,7 @@ function widget_conversations($arr) {
require_once('include/message.php');
// private_messages_list() can do other more complicated stuff, for now keep it simple
- $r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']);
+ $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']);
if(! $r) {
info( t('No messages.') . EOL);
@@ -695,8 +727,8 @@ function widget_design_tools($arr) {
// mod menu doesn't load a profile. For any modules which load a profile, check it.
// otherwise local_channel() is sufficient for permissions.
- if($a->profile['profile_uid'])
- if(($a->profile['profile_uid'] != local_channel()) && (! $a->is_sys))
+ if(App::$profile['profile_uid'])
+ if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys))
return '';
if(! local_channel())
@@ -712,22 +744,21 @@ function widget_findpeople($arr) {
function widget_photo_albums($arr) {
- $a = get_app();
- if(! $a->profile['profile_uid'])
+ if(! App::$profile['profile_uid'])
return '';
- $channelx = channelx_by_n($a->profile['profile_uid']);
- if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_storage')))
+ $channelx = channelx_by_n(App::$profile['profile_uid']);
+ if((! $channelx) || (! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_storage')))
return '';
require_once('include/photos.php');
- return photos_album_widget($channelx, $a->get_observer());
+ return photos_album_widget($channelx, App::get_observer());
}
function widget_vcard($arr) {
require_once ('include/Contact.php');
- return vcard_from_xchan('', get_app()->get_observer());
+ return vcard_from_xchan('', App::get_observer());
}
@@ -745,27 +776,43 @@ function widget_dirtags($arr) {
}
function widget_menu_preview($arr) {
- if(! get_app()->data['menu_item'])
+ if(! App::$data['menu_item'])
return;
require_once('include/menu.php');
- return menu_render(get_app()->data['menu_item']);
+ return menu_render(App::$data['menu_item']);
}
function widget_chatroom_list($arr) {
- $a = get_app();
+
require_once("include/chat.php");
- $r = chatroom_list($a->profile['profile_uid']);
- return replace_macros(get_markup_template('chatroomlist.tpl'), array(
- '$header' => t('Chat Rooms'),
- '$baseurl' => z_root(),
- '$nickname' => $a->profile['channel_address'],
- '$items' => $r,
+ $r = chatroom_list(App::$profile['profile_uid']);
+
+ if($r) {
+ return replace_macros(get_markup_template('chatroomlist.tpl'), array(
+ '$header' => t('Chatrooms'),
+ '$baseurl' => z_root(),
+ '$nickname' => App::$profile['channel_address'],
+ '$items' => $r,
+ '$overview' => t('Overview')
+ ));
+ }
+}
+
+function widget_chatroom_members() {
+ $o = replace_macros(get_markup_template('chatroom_members.tpl'), array(
+ '$header' => t('Chat Members')
));
+
+ return $o;
}
function widget_bookmarkedchats($arr) {
+
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
$h = get_observer_hash();
if(! $h)
return;
@@ -785,6 +832,9 @@ function widget_bookmarkedchats($arr) {
function widget_suggestedchats($arr) {
+ if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
+ return '';
+
// probably should restrict this to your friends, but then the widget will only work
// if you are logged in locally.
@@ -804,21 +854,39 @@ function widget_suggestedchats($arr) {
}
function widget_item($arr) {
- // FIXME there is no $a here
- $uid = $a->profile['profile_uid'];
- if((! $uid) || (! $arr['mid']))
+
+ $channel_id = 0;
+ if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
+ $channel_id = intval($arr['channel_id']);
+ if(! $channel_id)
+ $channel_id = App::$profile_uid;
+ if(! $channel_id)
return '';
- if(! perm_is_allowed($uid, get_observer_hash(), 'view_pages'))
+
+ if((! $arr['mid']) && (! $arr['title']))
return '';
- require_once('include/security.php');
- $sql_extra = item_permissions_sql($uid);
+ if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages'))
+ return '';
- $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
- dbesc($arr['mid']),
- intval($uid)
- );
+ require_once('include/security.php');
+ $sql_extra = item_permissions_sql($channel_id);
+
+ if($arr['title']) {
+ $r = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and item_type = %d $sql_options $revision limit 1",
+ intval($channel_id),
+ dbesc($arr['title']),
+ intval(ITEM_TYPE_WEBPAGE)
+ );
+ }
+ else {
+ $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
+ dbesc($arr['mid']),
+ intval($channel_id)
+ );
+ }
if(! $r)
return '';
@@ -912,8 +980,8 @@ function widget_photo($arr) {
// ensure they can't sneak in an eval(js) function
- if(strpos($style,'(') !== false)
- return '';
+ if(strpbrk($style,'(\'"<>') !== false)
+ $style = '';
if(array_key_exists('zrl', $arr) && isset($arr['zrl']))
$zrl = (($arr['zrl']) ? true : false);
@@ -933,6 +1001,60 @@ function widget_photo($arr) {
}
+function widget_cover_photo($arr) {
+
+ require_once('include/identity.php');
+ $o = '';
+
+ if(App::$module == 'channel' && $_REQUEST['mid'])
+ return '';
+
+ $channel_id = 0;
+ if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
+ $channel_id = intval($arr['channel_id']);
+ if(! $channel_id)
+ $channel_id = App::$profile_uid;
+ if(! $channel_id)
+ return '';
+
+ $channel = channelx_by_n($channel_id);
+
+ if(array_key_exists('style', $arr) && isset($arr['style']))
+ $style = $arr['style'];
+ else
+ $style = 'width:100%; height: auto;';
+
+ // ensure they can't sneak in an eval(js) function
+
+ if(strpbrk($style,'(\'"<>') !== false)
+ $style = '';
+
+ if(array_key_exists('title', $arr) && isset($arr['title']))
+ $title = $arr['title'];
+ else
+ $title = $channel['channel_name'];
+
+ if(array_key_exists('subtitle', $arr) && isset($arr['subtitle']))
+ $subtitle = $arr['subtitle'];
+ else
+ $subtitle = $channel['xchan_addr'];
+
+ $c = get_cover_photo($channel_id,'html');
+
+ if($c) {
+ $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c);
+
+ $o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array(
+ '$photo_html' => $photo_html,
+ '$title' => $title,
+ '$subtitle' => $subtitle,
+ '$hovertitle' => t('Click to show more'),
+ ));
+ }
+ return $o;
+}
+
+
function widget_photo_rand($arr) {
require_once('include/photos.php');
@@ -947,13 +1069,13 @@ function widget_photo_rand($arr) {
if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = get_app()->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
$scale = ((array_key_exists('scale',$arr)) ? intval($arr['scale']) : 0);
- $ret = photos_list_photos(array('channel_id' => $channel_id),get_app()->get_observer(),$album);
+ $ret = photos_list_photos(array('channel_id' => $channel_id),App::get_observer(),$album);
$filtered = array();
if($ret['success'] && $ret['photos'])
@@ -997,7 +1119,7 @@ function widget_random_block($arr) {
if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
$channel_id = intval($arr['channel_id']);
if(! $channel_id)
- $channel_id = get_app()->profile_uid;
+ $channel_id = App::$profile_uid;
if(! $channel_id)
return '';
@@ -1033,7 +1155,7 @@ function widget_random_block($arr) {
function widget_rating($arr) {
- $a = get_app();
+
$poco_rating = get_config('system','poco_rating_enable');
if((! $poco_rating) && ($poco_rating !== false)) {
@@ -1043,7 +1165,7 @@ function widget_rating($arr) {
if($arr['target'])
$hash = $arr['target'];
else
- $hash = $a->poi['xchan_hash'];
+ $hash = App::$poi['xchan_hash'];
if(! $hash)
return;
@@ -1052,7 +1174,7 @@ function widget_rating($arr) {
$remote = false;
if(remote_channel() && ! local_channel()) {
- $ob = $a->get_observer();
+ $ob = App::get_observer();
if($ob && $ob['xchan_url']) {
$p = parse_url($ob['xchan_url']);
if($p) {
@@ -1066,7 +1188,7 @@ function widget_rating($arr) {
$self = false;
if(local_channel()) {
- $channel = $a->get_channel();
+ $channel = App::get_channel();
if($hash == $channel['channel_hash'])
$self = true;
@@ -1075,16 +1197,18 @@ function widget_rating($arr) {
}
+
+ $o = '<div class="widget">';
+ $o .= '<h3>' . t('Rating Tools') . '</h3>';
+
if((($remote) || (local_channel())) && (! $self)) {
- $o = '<div class="widget rateme">';
if($remote)
- $o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
+ $o .= '<a class="btn btn-block btn-primary btn-sm" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
else
- $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
- $o .= '</div>';
+ $o .= '<div class="btn btn-block btn-primary btn-sm" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
}
- $o .= '<div class="widget rateme"><a class="rateme" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
+ $o .= '<a class="btn btn-block btn-default btn-sm" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
$o .= '</div>';
return $o;
@@ -1093,7 +1217,7 @@ function widget_rating($arr) {
// used by site ratings pages to provide a return link
function widget_pubsites($arr) {
- if(get_app()->poi)
+ if(App::$poi)
return;
return '<div class="widget"><ul class="nav nav-pills"><li><a href="pubsites">' . t('Public Hubs') . '</a></li></ul></div>';
}
@@ -1101,8 +1225,6 @@ function widget_pubsites($arr) {
function widget_forums($arr) {
- $a = get_app();
-
if(! local_channel())
return '';
@@ -1119,7 +1241,7 @@ function widget_forums($arr) {
$perms_sql = item_permissions_sql(local_channel()) . item_normal();
- $r1 = q("select * from abook left join xchan on abook_xchan = xchan_hash where ( xchan_pubforum = 1 or ((abook_their_perms & %d ) != 0 and (abook_their_perms & %d ) = 0) ) and abook_channel = %d order by xchan_name $limit ",
+ $r1 = q("select * from abook left join xchan on abook_xchan = xchan_hash where ( xchan_pubforum = 1 or ((abook_their_perms & %d ) != 0 and (abook_their_perms & %d ) = 0) ) and xchan_deleted = 0 and abook_channel = %d order by xchan_name $limit ",
intval(PERMS_W_TAGWALL),
intval(PERMS_W_STREAM),
intval(local_channel())
@@ -1204,20 +1326,20 @@ function widget_admin($arr) {
return login(false);
}
-
- $a = get_app();
$o = '';
// array( url, name, extra css classes )
$aside = array(
'site' => array(z_root() . '/admin/site/', t('Site'), 'site'),
- 'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'),
+ 'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users', 'pending-update', t('Member registrations waiting for confirmation')),
'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'),
+ 'security' => array(z_root() . '/admin/security/', t('Security'), 'security'),
+ 'features' => array(z_root() . '/admin/features/', t('Features'), 'features'),
'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'),
'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'),
'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'),
- 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'),
+ 'profs' => array(z_root() . '/admin/profs', t('Profile Fields'), 'profs'),
'dbsync' => array(z_root() . '/admin/dbsync/', t('DB updates'), 'dbsync')
);
@@ -1226,24 +1348,29 @@ function widget_admin($arr) {
$r = q("SELECT * FROM addon WHERE plugin_admin = 1");
- $aside['plugins_admin'] = array();
+ $plugins = array();
if($r) {
foreach ($r as $h){
$plugin = $h['name'];
- $aside['plugins_admin'][] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
+ $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
// temp plugins with admin
- $a->plugins_admin[] = $plugin;
+ App::$plugins_admin[] = $plugin;
}
}
- $aside['logs'] = array(z_root() . '/admin/logs/', t('Logs'), 'logs');
+ $logs = array(z_root() . '/admin/logs/', t('Logs'), 'logs');
+
+ $arr = array('links' => $aside,'plugins' => $plugins,'logs' => $logs);
+ call_hooks('admin_aside',$arr);
$o .= replace_macros(get_markup_template('admin_aside.tpl'), array(
'$admin' => $aside,
'$admtxt' => t('Admin'),
'$plugadmtxt' => t('Plugin Features'),
+ '$plugins' => $plugins,
'$logtxt' => t('Logs'),
- '$h_pending' => t('User registrations waiting for confirmation'),
+ '$logs' => $logs,
+ '$h_pending' => t('Member registrations waiting for confirmation'),
'$admurl'=> z_root() . '/admin/'
));
@@ -1255,7 +1382,7 @@ function widget_admin($arr) {
function widget_album($args) {
- $owner_uid = get_app()->profile_uid;
+ $owner_uid = App::$profile_uid;
$sql_extra = permissions_sql($owner_uid);
@@ -1314,7 +1441,7 @@ function widget_album($args) {
$imgalt_e = $rr['filename'];
$desc_e = $rr['description'];
- $imagelink = (z_root() . '/photos/' . get_app()->profile['channel_address'] . '/image/' . $rr['resource_id']);
+ $imagelink = (z_root() . '/photos/' . App::$profile['channel_address'] . '/image/' . $rr['resource_id']);
$photos[] = array(
@@ -1340,7 +1467,7 @@ function widget_album($args) {
'$album_id' => rand(),
'$album_edit' => array(t('Edit Album'), $album_edit),
'$can_post' => false,
- '$upload' => array(t('Upload'), z_root() . '/photos/' . get_app()->profile['channel_address'] . '/upload/' . bin2hex($album)),
+ '$upload' => array(t('Upload'), z_root() . '/photos/' . App::$profile['channel_address'] . '/upload/' . bin2hex($album)),
'$order' => false,
'$upload_form' => $upload_form,
'$usage' => $usage_message