From 374aadc97ef8f5700563bf719be09dc4e5e92fd4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 4 Jan 2016 01:02:10 -0800 Subject: Provide a mechanism for a hub admin to lock features in the on or off state. Locked features will not be available in the UI on the Additional Features page to be set by members. If all features are locked, the link to the Additional Features page will not be displayed. --- include/widgets.php | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 4b14d6c94..0f170fd52 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -493,38 +493,41 @@ function widget_settings_menu($arr) { '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' => $a->get_baseurl(true).'/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' => $a->get_baseurl(true).'/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' => $a->get_baseurl(true).'/settings/display', + 'selected' => ((argv(1) === 'display') ? 'active' : ''), + ); - array( - 'label' => t('Export channel'), - 'url' => $a->get_baseurl(true) . '/uexport', - 'selected' => '' - ), + $tabs[] = array( + 'label' => t('Connected apps'), + 'url' => $a->get_baseurl(true) . '/settings/oauth', + 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), + ); + $tabs[] = array( + 'label' => t('Export channel'), + 'url' => $a->get_baseurl(true) . '/uexport', + 'selected' => '' ); + if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), -- cgit v1.2.3 From 93565ea768a726a02052bd1279dcf09738057460 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 Jan 2016 13:01:28 -0800 Subject: features management page for hubmins --- include/widgets.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0f170fd52..a7d06d39e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1217,6 +1217,7 @@ function widget_admin($arr) { 'site' => array(z_root() . '/admin/site/', t('Site'), 'site'), 'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'), 'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'), + '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'), -- cgit v1.2.3 From 69573c6afe8afcbd75304dd0cd2f12d341f4195e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 14 Jan 2016 10:36:45 +0100 Subject: some template work on follow widget --- include/widgets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index a7d06d39e..444ce55d6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -170,8 +170,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/channel/barbara'), '$follow' => t('Connect'), '$abook_usage_message' => $abook_usage_message )); -- cgit v1.2.3 From e2b79c34bc0c1dc5f48295c1cca7261e8cb648fb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 14 Jan 2016 13:50:47 +0100 Subject: some work on connections --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 444ce55d6..033ba44fe 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -171,7 +171,7 @@ function widget_follow($args) { return replace_macros(get_markup_template('follow.tpl'),array( '$connect' => t('Add New Connection'), '$desc' => t('Enter channel address'), - '$hint' => t('Examples: bob@example.com, https://example.com/channel/barbara'), + '$hint' => t('Examples: bob@example.com, https://example.com/barbara'), '$follow' => t('Connect'), '$abook_usage_message' => $abook_usage_message )); -- cgit v1.2.3 From 64753effd1cd47c43846e5bc8653180acd7c4bc9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 17:25:27 -0800 Subject: cover photo fetch and widget --- include/widgets.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 033ba44fe..7021ef49d 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -936,6 +936,38 @@ function widget_photo($arr) { } +function widget_cover_photo($arr) { + + require_once('include/identity.php'); + $o = ''; + + $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 = get_app()->profile_uid; + if(! $channel_id) + return ''; + + if(array_key_exists('style', $arr) && isset($arr['style'])) + $style = $arr['style']; + else + $style = 'width:100%; padding-right: 10px; height: auto;'; + + // ensure they can't sneak in an eval(js) function + + if(strpos($style,'(') !== false) + return ''; + + $c = get_cover_photo($channel_id,'html'); + + if($c) { + $o = '
' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
'; + } + return $o; +} + + function widget_photo_rand($arr) { require_once('include/photos.php'); -- cgit v1.2.3 From 110ef6201e0a3731967a662afed1606b7077d0b0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 16 Jan 2016 14:00:22 -0800 Subject: add $deliver flag to item_store() and item_store_update() [default true]. If false, do not send any notifications or process tag_deliver. This should avoid any network activity from happening as the result of a channel (actually item) import. Other minor fixes in the handling of the $allow_exec flag and further protecting CSS passed to widgets from rogue code and XSS. --- include/widgets.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 7021ef49d..60605cb51 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -915,8 +915,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); @@ -956,8 +956,8 @@ function widget_cover_photo($arr) { // ensure they can't sneak in an eval(js) function - if(strpos($style,'(') !== false) - return ''; + if(strpbrk($style,'(\'"<>') !== false) + $style = ''; $c = get_cover_photo($channel_id,'html'); -- cgit v1.2.3 From 97ebf9021c5297a7ab2e3685bf920458d4bd3181 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Jan 2016 10:42:20 +0100 Subject: bootstrapify rating and connect buttons. position the connect button more prominent right under the profile image --- include/widgets.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 60605cb51..8e8f67ae6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1110,16 +1110,18 @@ function widget_rating($arr) { } + + $o = '
'; + $o .= '

' . t('Rating Tools') . '

'; + if((($remote) || (local_channel())) && (! $self)) { - $o = '
'; if($remote) - $o .= ' ' . t('Rate Me') . ''; + $o .= ' ' . t('Rate Me') . ''; else - $o .= ''; - $o .= '
'; + $o .= '
' . t('Rate Me') . '
'; } - $o .= ''; return $o; -- cgit v1.2.3 From 424af13891fb76889c134699d68b8be05f8514d0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 14:14:18 -0800 Subject: fix undefined variable reference in widget_item --- include/widgets.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 8e8f67ae6..891e9c018 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -807,20 +807,28 @@ 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 = get_app()->profile_uid; + if(! $channel_id) return ''; - if(! perm_is_allowed($uid, get_observer_hash(), 'view_pages')) + + if(! $arr['mid']) + return ''; + + if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages')) return ''; require_once('include/security.php'); - $sql_extra = item_permissions_sql($uid); + $sql_extra = item_permissions_sql($channel_id); $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) + intval($channel_id) ); if(! $r) -- cgit v1.2.3 From 35a9a468ceeb7b8e8b5ae2f026d3bdd76dff68be Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Jan 2016 15:23:42 -0800 Subject: widget_item - provide ability to use the page title instead of the message_id to locate the desired item. You can use either, but the page title is often easier to use and discover. --- include/widgets.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 891e9c018..7e502e4c2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -817,7 +817,7 @@ function widget_item($arr) { return ''; - if(! $arr['mid']) + if((! $arr['mid']) && (! $arr['title'])) return ''; if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages')) @@ -826,10 +826,20 @@ function widget_item($arr) { require_once('include/security.php'); $sql_extra = item_permissions_sql($channel_id); - $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($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 ''; -- cgit v1.2.3 From c75f76f740be16f9880650fcff359d7afd85991d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 20:24:46 -0800 Subject: heavy lifting on admin security page --- include/widgets.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 7e502e4c2..011e3a8d7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1269,6 +1269,7 @@ function widget_admin($arr) { 'site' => array(z_root() . '/admin/site/', t('Site'), 'site'), 'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'), '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'), -- cgit v1.2.3 From 7868e476435b7d8d4530dea19686fdae04d5eb68 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 5 Feb 2016 13:32:15 -0800 Subject: more uno groundwork --- include/widgets.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 011e3a8d7..8073058c6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -527,7 +527,6 @@ function widget_settings_menu($arr) { 'selected' => '' ); - if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), -- cgit v1.2.3 From 315ce6d880855444c0cea683810b9b2fbd80c0d3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 18:16:42 -0800 Subject: lots more zcard tweaks --- include/widgets.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 8073058c6..fa2b3de4d 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -8,7 +8,7 @@ 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(); @@ -16,6 +16,16 @@ function widget_profile($args) { return profile_sidebar($a->profile, $block, true); } +function widget_zcard($args) { + $a = get_app(); + $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); + $channel = channelx_by_n($a->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. @@ -369,6 +379,17 @@ function widget_fullprofile($arr) { return profile_sidebar($a->profile, $block); } +function widget_shortprofile($arr) { + $a = get_app(); + if(! $a->profile['profile_uid']) + return; + + $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); + + return profile_sidebar($a->profile, $block, true, true); +} + + function widget_categories($arr) { $a = get_app(); -- cgit v1.2.3 From fe392a3144f2c2e81e0451b1e6629136a60a7acd Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Thu, 18 Feb 2016 16:53:04 +0100 Subject: Removed export temporary from UNO. Removed 'Remove Channel' from UNO, cause a UNO member has only 1 channel, so it's logical to remove the acccount (by experience on UNO hub). Styling oauth settings. --- include/widgets.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index fa2b3de4d..a995fdf1c 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -542,11 +542,14 @@ function widget_settings_menu($arr) { 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), ); - $tabs[] = array( - 'label' => t('Export channel'), - 'url' => $a->get_baseurl(true) . '/uexport', - 'selected' => '' - ); + // 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', + 'selected' => '' + ); + } if($role === false || $role === 'custom') { $tabs[] = array( -- cgit v1.2.3 From 7206e8af3a943b0fb286f253ed3abbda2d2572b6 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Tue, 1 Mar 2016 22:08:50 +0100 Subject: Small fix for deleted forum channels showing in the forum widget (had this after migration from RM on 1 or 2 channels) --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index a995fdf1c..aa0be87d6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1197,7 +1197,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()) -- cgit v1.2.3 From c97cc1487cbcac2c4fbc4d9e931a82df109af2e6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 2 Mar 2016 12:31:25 +0100 Subject: a simple cover-photo implementation for redbasic default template --- include/widgets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index a995fdf1c..05b9eca1a 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -993,7 +993,7 @@ function widget_cover_photo($arr) { if(array_key_exists('style', $arr) && isset($arr['style'])) $style = $arr['style']; else - $style = 'width:100%; padding-right: 10px; height: auto;'; + $style = 'width:100%; height: auto;'; // ensure they can't sneak in an eval(js) function @@ -1003,7 +1003,7 @@ function widget_cover_photo($arr) { $c = get_cover_photo($channel_id,'html'); if($c) { - $o = '
' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
'; + $o = '
' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
'; } return $o; } -- cgit v1.2.3 From 436e91a1e13bc488003262dfffb0a7d273a3106a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 16:39:34 -0800 Subject: rename the menu entry and page to 'Profile Fields' to maintain consistency --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 3b8a5a7a3..0fc10dfc0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1297,7 +1297,7 @@ function widget_admin($arr) { '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') ); -- cgit v1.2.3 From 59e04aed1b7ea68b51b8672768dffd21f5a4bd4d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 3 Mar 2016 12:07:58 +0100 Subject: move cover-photo to template, add the ability to define a title and subtitle (defaults to channel name and addres), move js from redbasic.js to template. --- include/widgets.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 3b8a5a7a3..96d7b5cd0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -982,14 +982,18 @@ function widget_cover_photo($arr) { require_once('include/identity.php'); $o = ''; + $a = get_app(); + $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 = get_app()->profile_uid; + $channel_id = $a->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 @@ -1000,10 +1004,26 @@ function widget_cover_photo($arr) { 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) { - $o = '
' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $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, + )); } return $o; } -- cgit v1.2.3 From 716240329274912a354190998753c08d22a42082 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Sun, 6 Mar 2016 17:02:58 +0100 Subject: Also make it clear with (mouse) hover text that you must click on the cover photo to show the channel/more --- include/widgets.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index ad54cb59e..0d31133e7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1023,6 +1023,7 @@ function widget_cover_photo($arr) { '$photo_html' => $photo_html, '$title' => $title, '$subtitle' => $subtitle, + '$hovertitle' => t('Click to show more'), )); } return $o; -- cgit v1.2.3 From 843cc1481af008f35804628686459437cedf3220 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 8 Mar 2016 16:46:47 -0800 Subject: isue #315 --- include/widgets.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0d31133e7..65c745a05 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -983,6 +983,9 @@ function widget_cover_photo($arr) { $o = ''; $a = get_app(); + + if($a->module == 'channel' && $_REQUEST['mid']) + return ''; $channel_id = 0; if(array_key_exists('channel_id', $arr) && intval($arr['channel_id'])) -- cgit v1.2.3 From 77094f8d2bffa70c9e95518b9883f8752304102c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 19 Mar 2016 16:17:19 -0700 Subject: make the admin side menu extensible and provide a hook for a channel "move" operation that federation plugins might use to re-establish connections after a channel move. --- include/widgets.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 65c745a05..deb514915 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1314,7 +1314,7 @@ function widget_admin($arr) { $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'), @@ -1330,24 +1330,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; } } - $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/' )); -- cgit v1.2.3 From a50706317435d09cacb95cad0a6ccaf8ae5b5f6c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 26 Mar 2016 18:43:38 +0100 Subject: move link to /locs to settings menu if we have more than one location and some template work on locs --- include/widgets.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index deb514915..010fcf0ae 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -501,6 +501,12 @@ 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'), @@ -534,14 +540,16 @@ function widget_settings_menu($arr) { 'label' => t('Display settings'), 'url' => $a->get_baseurl(true).'/settings/display', 'selected' => ((argv(1) === 'display') ? 'active' : ''), - ); - - $tabs[] = array( - 'label' => t('Connected apps'), - 'url' => $a->get_baseurl(true) . '/settings/oauth', - 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), ); + if($hublocs) { + $tabs[] = array( + 'label' => t('Manage locations'), + 'url' => $a->get_baseurl(true) . '/locs', + 'selected' => ((argv(1) === 'locs') ? 'active' : ''), + ); + } + // IF can go away when UNO export and import is fully functional if(! UNO) { $tabs[] = array( -- cgit v1.2.3 From 97eef2b88c5e2e709b8efdb2ea597a5803783e24 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 26 Mar 2016 19:34:38 +0100 Subject: removed link to connected apps by accident --- include/widgets.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 010fcf0ae..ac0b6a84f 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -559,6 +559,12 @@ function widget_settings_menu($arr) { ); } + $tabs[] = array( + 'label' => t('Connected apps'), + 'url' => $a->get_baseurl(true) . '/settings/oauth', + 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), + ); + if($role === false || $role === 'custom') { $tabs[] = array( 'label' => t('Connection Default Permissions'), -- cgit v1.2.3 From 5462453bf2bde50166c68f90b08d24826dd07ba8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:31:55 +0200 Subject: some work on mod chat --- include/widgets.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index ac0b6a84f..2aa3dccf1 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -797,12 +797,15 @@ function widget_chatroom_list($arr) { 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, - )); + + if($r) { + return replace_macros(get_markup_template('chatroomlist.tpl'), array( + '$header' => t('Chat Rooms'), + '$baseurl' => z_root(), + '$nickname' => $a->profile['channel_address'], + '$items' => $r, + )); + } } function widget_bookmarkedchats($arr) { -- cgit v1.2.3 From 08461c7049ee5c9788e815537b540b9987a5eace Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:44:03 +0200 Subject: more on mod chat --- include/widgets.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 2aa3dccf1..3b5e3a17b 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -804,6 +804,7 @@ function widget_chatroom_list($arr) { '$baseurl' => z_root(), '$nickname' => $a->profile['channel_address'], '$items' => $r, + '$overview' => t('Overview') )); } } -- cgit v1.2.3 From 1cd3b4182595b838a535dd6b6990251db05d49e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 22:13:24 -0700 Subject: deprecate $a->get_baseurl() --- include/widgets.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 3b5e3a17b..014160867 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -510,13 +510,13 @@ function widget_settings_menu($arr) { $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' : ''), ), @@ -525,27 +525,27 @@ function widget_settings_menu($arr) { if(get_features()) { $tabs[] = array( 'label' => t('Additional features'), - 'url' => $a->get_baseurl(true).'/settings/features', + 'url' => z_root().'/settings/features', 'selected' => ((argv(1) === 'features') ? 'active' : ''), ); } $tabs[] = array( 'label' => t('Feature/Addon settings'), - 'url' => $a->get_baseurl(true).'/settings/featured', + 'url' => z_root().'/settings/featured', 'selected' => ((argv(1) === 'featured') ? 'active' : ''), ); $tabs[] = array( 'label' => t('Display settings'), - 'url' => $a->get_baseurl(true).'/settings/display', + 'url' => z_root().'/settings/display', 'selected' => ((argv(1) === 'display') ? 'active' : ''), ); if($hublocs) { $tabs[] = array( 'label' => t('Manage locations'), - 'url' => $a->get_baseurl(true) . '/locs', + 'url' => z_root() . '/locs', 'selected' => ((argv(1) === 'locs') ? 'active' : ''), ); } @@ -554,21 +554,21 @@ function widget_settings_menu($arr) { 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' => $a->get_baseurl(true) . '/settings/oauth', + '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' => '' ); } @@ -576,7 +576,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' => '' ); } @@ -584,7 +584,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' => '' ); } @@ -608,22 +608,22 @@ function widget_mailmenu($arr) { '$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'), ) )); -- cgit v1.2.3 From 3fdd110e0775113d2246a9db16c6c920ecddf19d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 13:21:48 +0200 Subject: mod chat rework continued --- include/widgets.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 014160867..50e4cb184 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -809,6 +809,14 @@ function widget_chatroom_list($arr) { } } +function widget_chatroom_members() { + $o = replace_macros(get_markup_template('chatroom_members.tpl'), array( + '$header' => t('Chatroom Members') + )); + + return $o; +} + function widget_bookmarkedchats($arr) { $h = get_observer_hash(); if(! $h) -- cgit v1.2.3 From 6c2673ae2aa311ee92b5b12b969b4483b52eef53 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 22:42:28 +0200 Subject: various fixes regarding mod chat --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 50e4cb184..cb68ed00f 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -811,7 +811,7 @@ function widget_chatroom_list($arr) { function widget_chatroom_members() { $o = replace_macros(get_markup_template('chatroom_members.tpl'), array( - '$header' => t('Chatroom Members') + '$header' => t('Chat Members') )); return $o; -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- include/widgets.php | 100 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 014160867..4aba14f04 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -13,13 +13,13 @@ 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) { $a = get_app(); $block = (((get_config('system', 'block_public')) && (! local_channel()) && (! remote_channel())) ? true : false); - $channel = channelx_by_n($a->profile_uid); + $channel = channelx_by_n(App::$profile_uid); return get_zcard($channel,get_observer_hash(),array('width' => 875)); } @@ -34,7 +34,7 @@ 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; @@ -85,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: @@ -165,7 +165,7 @@ function widget_follow($args) { 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) ); @@ -238,7 +238,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); @@ -316,7 +316,7 @@ function widget_filer($arr) { '$sel_all' => (($selected == '') ? 'selected' : ''), '$all' => t('Everything'), '$terms' => $terms, - '$base' => z_root() . '/' . $a->cmd + '$base' => z_root() . '/' . App::$cmd )); } @@ -325,11 +325,11 @@ 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 ''; @@ -345,7 +345,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); @@ -371,33 +371,33 @@ 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) { $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, true, true); + 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); @@ -408,14 +408,14 @@ 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 ''; } @@ -423,14 +423,14 @@ function widget_tagcloud_wall($arr) { 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'); } @@ -487,7 +487,7 @@ function widget_settings_menu($arr) { return; $a = get_app(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $abook_self_id = 0; @@ -660,7 +660,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); @@ -735,8 +735,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()) @@ -754,20 +754,20 @@ 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()); } @@ -785,24 +785,24 @@ 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']); + $r = chatroom_list(App::$profile['profile_uid']); if($r) { return replace_macros(get_markup_template('chatroomlist.tpl'), array( '$header' => t('Chat Rooms'), '$baseurl' => z_root(), - '$nickname' => $a->profile['channel_address'], + '$nickname' => App::$profile['channel_address'], '$items' => $r, '$overview' => t('Overview') )); @@ -853,7 +853,7 @@ function widget_item($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 ''; @@ -1002,14 +1002,14 @@ function widget_cover_photo($arr) { $a = get_app(); - if($a->module == 'channel' && $_REQUEST['mid']) + 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 = $a->profile_uid; + $channel_id = App::$profile_uid; if(! $channel_id) return ''; @@ -1065,13 +1065,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']) @@ -1115,7 +1115,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 ''; @@ -1161,7 +1161,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; @@ -1170,7 +1170,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) { @@ -1184,7 +1184,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; @@ -1213,7 +1213,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 ''; } @@ -1354,7 +1354,7 @@ function widget_admin($arr) { $plugin = $h['name']; $plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin'); // temp plugins with admin - $a->plugins_admin[] = $plugin; + App::$plugins_admin[] = $plugin; } } @@ -1382,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); @@ -1441,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( @@ -1467,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 -- cgit v1.2.3 From 0cda43145629586e6110e83fa2356e1c4ee4811a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 20:15:47 -0700 Subject: create miniApp to convert existing settings files to the static App class --- include/widgets.php | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 7a35cf37b..24cfff7fa 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -11,13 +11,13 @@ 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(App::$profile, $block, true); } function widget_zcard($args) { - $a = get_app(); + $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)); @@ -33,7 +33,7 @@ function widget_tagcloud($args) { $o = ''; //$tab = 0; - $a = get_app(); + $uid = App::$profile_uid; $count = ((x($args,'count')) ? intval($args['count']) : 24); $flags = 0; @@ -164,8 +164,7 @@ function widget_follow($args) { if(! local_channel()) return ''; - $a = get_app(); - $uid =App::$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) ); @@ -210,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) { @@ -295,7 +292,6 @@ function widget_filer($arr) { if(! local_channel()) return ''; - $a = get_app(); $selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : ''); @@ -323,7 +319,6 @@ function widget_filer($arr) { function widget_archive($arr) { $o = ''; - $a = get_app(); if(! App::$profile_uid) { return ''; @@ -370,7 +365,7 @@ function widget_archive($arr) { function widget_fullprofile($arr) { - $a = get_app(); + if(! App::$profile['profile_uid']) return; @@ -380,7 +375,7 @@ function widget_fullprofile($arr) { } function widget_shortprofile($arr) { - $a = get_app(); + if(! App::$profile['profile_uid']) return; @@ -391,7 +386,7 @@ function widget_shortprofile($arr) { function widget_categories($arr) { - $a = get_app(); + if(App::$profile['profile_uid'] && (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_stream'))) return ''; @@ -406,7 +401,7 @@ function widget_categories($arr) { } function widget_tagcloud_wall($arr) { - $a = get_app(); + if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash'])) return ''; @@ -421,7 +416,7 @@ function widget_tagcloud_wall($arr) { } function widget_catcloud_wall($arr) { - $a = get_app(); + if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash'])) return ''; @@ -486,7 +481,7 @@ function widget_settings_menu($arr) { if(! local_channel()) return; - $a = get_app(); + $channel = App::get_channel(); $abook_self_id = 0; @@ -602,7 +597,6 @@ 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'), @@ -634,8 +628,6 @@ function widget_conversations($arr) { if (! local_channel()) return; - $a = get_app(); - if(argc() > 1) { switch(argv(1)) { @@ -752,7 +744,6 @@ function widget_findpeople($arr) { function widget_photo_albums($arr) { - $a = get_app(); if(! App::$profile['profile_uid']) return ''; @@ -793,7 +784,6 @@ function widget_menu_preview($arr) { } function widget_chatroom_list($arr) { - $a = get_app(); require_once("include/chat.php"); $r = chatroom_list(App::$profile['profile_uid']); @@ -1007,8 +997,6 @@ function widget_cover_photo($arr) { require_once('include/identity.php'); $o = ''; - - $a = get_app(); if(App::$module == 'channel' && $_REQUEST['mid']) return ''; @@ -1159,7 +1147,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)) { @@ -1229,8 +1217,6 @@ function widget_pubsites($arr) { function widget_forums($arr) { - $a = get_app(); - if(! local_channel()) return ''; @@ -1332,8 +1318,6 @@ function widget_admin($arr) { return login(false); } - - $a = get_app(); $o = ''; // array( url, name, extra css classes ) -- cgit v1.2.3 From ebac0bdcca6ce7d3f4eb07d730925c6fae7d1538 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 09:46:41 +0200 Subject: Chat Rooms -> Chatrooms --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 24cfff7fa..0116e5bd1 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -790,7 +790,7 @@ function widget_chatroom_list($arr) { if($r) { return replace_macros(get_markup_template('chatroomlist.tpl'), array( - '$header' => t('Chat Rooms'), + '$header' => t('Chatrooms'), '$baseurl' => z_root(), '$nickname' => App::$profile['channel_address'], '$items' => $r, -- cgit v1.2.3 From bf3f3564e08754c3f91524798523839ae7b9094c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Apr 2016 16:41:40 -0700 Subject: issue #138 ; make ajaxchat optional and configurable. For reasons we've discussed repeatedly the ajax chat will not be removed from core as XMPP chat does not provide decentralised access control compatible with nomadic identity. --- include/widgets.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0116e5bd1..0355ebd8c 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -785,6 +785,7 @@ function widget_menu_preview($arr) { function widget_chatroom_list($arr) { + require_once("include/chat.php"); $r = chatroom_list(App::$profile['profile_uid']); @@ -808,6 +809,10 @@ function widget_chatroom_members() { } function widget_bookmarkedchats($arr) { + + if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat')) + return ''; + $h = get_observer_hash(); if(! $h) return; @@ -827,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. -- cgit v1.2.3