aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-15 20:56:12 -0700
committerzotlabs <mike@macgirvin.com>2017-03-15 20:56:12 -0700
commit16d750d1f6cf0d2866388269e02445630c4e3464 (patch)
treead44965b8dae98d55322919493ac18d733bd5743 /include/widgets.php
parentdfd626548fc903a4ecffe3241570957a2df9a37a (diff)
downloadvolse-hubzilla-16d750d1f6cf0d2866388269e02445630c4e3464.tar.gz
volse-hubzilla-16d750d1f6cf0d2866388269e02445630c4e3464.tar.bz2
volse-hubzilla-16d750d1f6cf0d2866388269e02445630c4e3464.zip
widgets cont.
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php345
1 files changed, 0 insertions, 345 deletions
diff --git a/include/widgets.php b/include/widgets.php
index db3e195d5..6241f3a6b 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -18,347 +18,16 @@ require_once('include/attach.php');
-function widget_tagcloud_wall($arr) {
- if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
- return '';
- 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(App::$profile['profile_uid'], 'tagadelic'))
- return wtagblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
-
- return '';
-}
-
-function widget_catcloud_wall($arr) {
-
-
- if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
- return '';
- 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(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
-}
-
-
-function widget_affinity($arr) {
-
- if(! local_channel())
- return '';
-
- // Get default cmin value from pconfig, but allow GET parameter to override
- $cmin = intval(get_pconfig(local_channel(),'affinity','cmin'));
- $cmin = (($cmin) ? $cmin : 0);
- $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $cmin);
-
- // Get default cmax value from pconfig, but allow GET parameter to override
- $cmax = intval(get_pconfig(local_channel(),'affinity','cmax'));
- $cmax = (($cmax) ? $cmax : 99);
- $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $cmax);
-
-
- if(feature_enabled(local_channel(),'affinity')) {
-
- $labels = array(
- t('Me'),
- t('Family'),
- t('Friends'),
- t('Acquaintances'),
- t('All')
- );
- call_hooks('affinity_labels',$labels);
- $label_str = '';
-
- if($labels) {
- foreach($labels as $l) {
- if($label_str) {
- $label_str .= ", '|'";
- $label_str .= ", '" . $l . "'";
- }
- else
- $label_str .= "'" . $l . "'";
- }
- }
-
- $tpl = get_markup_template('main_slider.tpl');
- $x = replace_macros($tpl,array(
- '$val' => $cmin . ',' . $cmax,
- '$refresh' => t('Refresh'),
- '$labels' => $label_str,
- ));
- $arr = array('html' => $x);
- call_hooks('main_slider',$arr);
- return $arr['html'];
- }
-
- return '';
-}
-
-
-function widget_settings_menu($arr) {
-
- if(! local_channel())
- return;
-
-
- $channel = App::get_channel();
-
- $abook_self_id = 0;
-
- // Retrieve the 'self' address book entry for use in the auto-permissions link
-
- $role = get_pconfig(local_channel(),'system','permissions_role');
-
- $abk = q("select abook_id from abook where abook_channel = %d and abook_self = 1 limit 1",
- intval(local_channel())
- );
- if($abk)
- $abook_self_id = $abk[0]['abook_id'];
-
- $x = q("select count(*) as total from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0 ",
- dbesc($channel['channel_hash'])
- );
-
- $hublocs = (($x && $x[0]['total'] > 1) ? true : false);
-
- $tabs = array(
- array(
- 'label' => t('Account settings'),
- 'url' => z_root().'/settings/account',
- 'selected' => ((argv(1) === 'account') ? 'active' : ''),
- ),
-
- array(
- 'label' => t('Channel settings'),
- 'url' => z_root().'/settings/channel',
- 'selected' => ((argv(1) === 'channel') ? 'active' : ''),
- ),
-
- );
-
- if(get_account_techlevel() > 0 && get_features()) {
- $tabs[] = array(
- 'label' => t('Additional features'),
- 'url' => z_root().'/settings/features',
- 'selected' => ((argv(1) === 'features') ? 'active' : ''),
- );
- }
-
- $tabs[] = array(
- 'label' => t('Feature/Addon settings'),
- 'url' => z_root().'/settings/featured',
- 'selected' => ((argv(1) === 'featured') ? 'active' : ''),
- );
-
- $tabs[] = array(
- 'label' => t('Display settings'),
- 'url' => z_root().'/settings/display',
- 'selected' => ((argv(1) === 'display') ? 'active' : ''),
- );
-
- if($hublocs) {
- $tabs[] = array(
- 'label' => t('Manage locations'),
- 'url' => z_root() . '/locs',
- 'selected' => ((argv(1) === 'locs') ? 'active' : ''),
- );
- }
-
- $tabs[] = array(
- 'label' => t('Export channel'),
- 'url' => z_root() . '/uexport',
- 'selected' => ''
- );
-
- $tabs[] = array(
- 'label' => t('Connected apps'),
- 'url' => z_root() . '/settings/oauth',
- 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
- );
-
- if(get_account_techlevel() > 2) {
- $tabs[] = array(
- 'label' => t('Guest Access Tokens'),
- 'url' => z_root() . '/settings/tokens',
- 'selected' => ((argv(1) === 'tokens') ? 'active' : ''),
- );
- }
-
- if(feature_enabled(local_channel(),'permcats')) {
- $tabs[] = array(
- 'label' => t('Permission Groups'),
- 'url' => z_root() . '/settings/permcats',
- 'selected' => ((argv(1) === 'permcats') ? 'active' : ''),
- );
- }
- if($role === false || $role === 'custom') {
- $tabs[] = array(
- 'label' => t('Connection Default Permissions'),
- 'url' => z_root() . '/connedit/' . $abook_self_id,
- 'selected' => ''
- );
- }
- if(feature_enabled(local_channel(),'premium_channel')) {
- $tabs[] = array(
- 'label' => t('Premium Channel Settings'),
- 'url' => z_root() . '/connect/' . $channel['channel_address'],
- 'selected' => ''
- );
- }
- if(feature_enabled(local_channel(),'channel_sources')) {
- $tabs[] = array(
- 'label' => t('Channel Sources'),
- 'url' => z_root() . '/sources',
- 'selected' => ''
- );
- }
-
- $tabtpl = get_markup_template("generic_links_widget.tpl");
- return replace_macros($tabtpl, array(
- '$title' => t('Settings'),
- '$class' => 'settings-widget',
- '$items' => $tabs,
- ));
-}
-
-
-function widget_mailmenu($arr) {
- if (! local_channel())
- return;
- return replace_macros(get_markup_template('message_side.tpl'), array(
- '$title' => t('Private Mail Menu'),
- '$combined'=>array(
- 'label' => t('Combined View'),
- 'url' => z_root() . '/mail/combined',
- 'sel' => (argv(1) == 'combined'),
- ),
- '$inbox'=>array(
- 'label' => t('Inbox'),
- 'url' => z_root() . '/mail/inbox',
- 'sel' => (argv(1) == 'inbox'),
- ),
- '$outbox'=>array(
- 'label' => t('Outbox'),
- 'url' => z_root() . '/mail/outbox',
- 'sel' => (argv(1) == 'outbox'),
- ),
- '$new'=>array(
- 'label' => t('New Message'),
- 'url' => z_root() . '/mail/new',
- 'sel'=> (argv(1) == 'new'),
- )
- ));
-}
-function widget_conversations($arr) {
- if (! local_channel())
- return;
-
- if(argc() > 1) {
-
- switch(argv(1)) {
- case 'combined':
- $mailbox = 'combined';
- $header = t('Conversations');
- break;
- case 'inbox':
- $mailbox = 'inbox';
- $header = t('Received Messages');
- break;
- case 'outbox':
- $mailbox = 'outbox';
- $header = t('Sent Messages');
- break;
- default:
- $mailbox = 'combined';
- $header = t('Conversations');
- break;
- }
-
- 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, App::$pager['start'], App::$pager['itemspage']);
-
- if(! $r) {
- info( t('No messages.') . EOL);
- return $o;
- }
-
- $messages = array();
-
- foreach($r as $rr) {
-
- $messages[] = array(
- 'mailbox' => $mailbox,
- 'id' => $rr['id'],
- 'from_name' => $rr['from']['xchan_name'],
- 'from_url' => chanlink_hash($rr['from_xchan']),
- 'from_photo' => $rr['from']['xchan_photo_s'],
- 'to_name' => $rr['to']['xchan_name'],
- 'to_url' => chanlink_hash($rr['to_xchan']),
- 'to_photo' => $rr['to']['xchan_photo_s'],
- 'subject' => (($rr['seen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'),
- 'delete' => t('Delete conversation'),
- 'body' => $rr['body'],
- 'date' => datetime_convert('UTC',date_default_timezone_get(),$rr['created'], 'c'),
- 'seen' => $rr['seen'],
- 'selected' => ((argv(2)) ? (argv(2) == $rr['id']) : ($r[0]['id'] == $rr['id']))
- );
- }
-
- $tpl = get_markup_template('mail_head.tpl');
- $o .= replace_macros($tpl, array(
- '$header' => $header,
- '$messages' => $messages
- ));
-
- //$o .= alt_pager($a,count($r));
-
- }
-
- return $o;
-}
-
-function widget_eventstools($arr) {
- if (! local_channel())
- return;
-
- return replace_macros(get_markup_template('events_tools_side.tpl'), array(
- '$title' => t('Events Tools'),
- '$export' => t('Export Calendar'),
- '$import' => t('Import Calendar'),
- '$submit' => t('Submit')
- ));
-}
-
-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(App::$profile['profile_uid'])
- if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys))
- return '';
-
- if(! local_channel())
- return '';
-
- return design_tools();
-}
function widget_website_portation_tools($arr) {
@@ -380,20 +49,6 @@ function widget_findpeople($arr) {
}
-function widget_photo_albums($arr) {
-
- if(! App::$profile['profile_uid'])
- return '';
- $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');
- $sortkey = ((array_key_exists('sortkey',$arr)) ? $arr['sortkey'] : 'album');
- $direction = ((array_key_exists('direction',$arr)) ? $arr['direction'] : 'asc');
-
- return photos_album_widget($channelx, App::get_observer(),$sortkey,$direction);
-}
-
function widget_vcard($arr) {
return vcard_from_xchan('', App::get_observer());