From e2988a025388c5ea023a9e3d42b7cc40fa93f780 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 27 Oct 2013 16:30:55 -0700 Subject: put comanche widgets in their own file. Added a category tagcloud widget - but the entries aren't going to link to anything until we have a webpage search ability. But this will be a way to exercise and test widget arguments. --- include/widgets.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/widgets.php (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php new file mode 100644 index 000000000..87941f40f --- /dev/null +++ b/include/widgets.php @@ -0,0 +1,34 @@ +profile, $block, true); +} + +// 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. + +function widget_tagcloud($args) { + + $o = ''; + $tab = 0; + $a = get_app(); + $uid = $a->profile_uid; + $count = ((x($args,'count')) ? intval($args['count']) : 24); + $flags = 0; + $type = TERM_CATEGORY; + + $r = tagadelic($uid,$count,$authors,$flags,ITEM_WEBPAGE,$type); + + if($r) { + $o = '

' . t('Categories') . '

'; + foreach($r as $rr) { + $o .= ''.$rr[0].' ' . "\r\n"; + } + $o .= '
'; + } + return $o; +} + -- cgit v1.2.3 From d32e05fb5e30dc634754e9d2e55cc7702a883ede Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 8 Dec 2013 16:04:28 -0800 Subject: starting on the journey to comanche everywhere - beginning with widget conversions. There are approximately 20 which need to be wrapped for accessibility to comanche. --- 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 87941f40f..5be77498c 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -32,3 +32,11 @@ function widget_tagcloud($args) { return $o; } +function widget_collections($args) { + require_once('include/group.php'); + $page = argv(0); + $gid = $_REQUEST['gid']; + + return group_side($page,$page,true,$_REQUEST['gid'],'',0); + +} \ No newline at end of file -- cgit v1.2.3 From 082ac6777829c98ded48c271f4210ac5d6e1a68f Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 8 Dec 2013 20:08:50 -0800 Subject: suggestion widget tweaked to make it comanche capable. Remove old versions of specs that are so obsolete it isn't funny. Zot protocol reference is in red's github wiki, and in the code. We should move the github copy to /doc once it is updated to match the code. There's no point in documenting dfrn in the red code base. --- include/widgets.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 5be77498c..f152e8ee1 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -39,4 +39,57 @@ function widget_collections($args) { return group_side($page,$page,true,$_REQUEST['gid'],'',0); +} + + +function widget_suggestions($arr) { + + require_once('include/socgraph.php'); + + $r = suggestion_query(local_user(),get_observer_hash(),0,20); + + if(! $r) { + return; + } + + $arr = array(); + + // Get two random entries from the top 20 returned. + // We'll grab the first one and the one immediately following. + // This will throw some entropy intot he situation so you won't + // be looking at the same two mug shots every time the widget runs + + + $index = ((count($r) > 2) ? mt_rand(0,count($r) - 2) : 0); + + + for($x = $index; $x <= ($index+1); $x ++) { + + $rr = $r[$x]; + if(! $rr['xchan_url']) + break; + + $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr']; + + $arr[] = array( + 'url' => chanlink_url($rr['xchan_url']), + 'profile' => $rr['xchan_url'], + 'name' => $rr['xchan_name'], + 'photo' => $rr['xchan_photo_m'], + 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'], + 'conntxt' => t('Connect'), + 'connlnk' => $connlnk, + 'ignore' => t('Ignore/Hide') + ); + } + + + $o = replace_macros(get_markup_template('suggest_widget.tpl'),array( + '$title' => t('Suggestions'), + '$more' => t('See more...'), + '$entries' => $arr + )); + + return $o; + } \ No newline at end of file -- cgit v1.2.3 From 00f4ee271789b61393edd384f12cda1c14af4b94 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Dec 2013 00:12:44 -0800 Subject: migrate follow widget to comanche and remove obsolete mod/intro.php --- include/widgets.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index f152e8ee1..6e3452ac6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -92,4 +92,33 @@ function widget_suggestions($arr) { return $o; -} \ No newline at end of file +} + + +function widget_follow($args) { + if(! local_user()) + return ''; + $a = get_app(); + $uid =$a->channel['channel_id']; + $r = q("select count(*) as total from abook where abook_channel = %d and not (abook_flags & %d) ", + intval($uid), + intval(ABOOK_FLAG_SELF) + ); + if($r) + $total_channels = $r[0]['total']; + $limit = service_class_fetch($uid,'total_channels'); + if($limit !== false) { + $abook_usage_message = sprintf( t("You have %1$.0f of %2$.0f allowed connections."), $total_channels, $limit); + } + else { + $abook_usage_message = ''; + } + 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'), + '$follow' => t('Connect'), + '$abook_usage_message' => $abook_usage_message + )); + +} -- cgit v1.2.3 From d8c632ada202f4552e85796008837c293a323a31 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Dec 2013 00:41:49 -0800 Subject: more comanchisation (I declare this to be a word) --- include/widgets.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 6e3452ac6..632f85436 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,5 +1,18 @@ t('Displays a full channel profile'), + 'tagcloud' => t('Tag cloud of webpage categories'), + 'collections' => t('List and filter by collection'), + 'suggestions' => t('Show a couple of channel suggestion'), + 'follow' => t('Provide a channel follow form') + ); + $arr = array('widgets' => $widgets); + call_hooks('list_widgets',$arr); + return $arr['widgets']; +} + function widget_profile($args) { $a = get_app(); -- cgit v1.2.3 From f85cba10eb3d976d715c7a80fe69fe15d9dc468c Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Dec 2013 15:27:46 -0800 Subject: notes widget --- include/widgets.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 632f85436..2e8169bd7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -135,3 +135,17 @@ function widget_follow($args) { )); } + + +function widget_notes($arr) { + if(! local_user()) + return ''; + $text = htmlspecialchars(get_pconfig(local_user(),'notes','text')); + + $o = replace_macros(get_markup_template('notes.tpl'), array( + '$banner' => t('Notes'), + '$text' => $text, + '$save' => t('Save'), + )); + return $o; +} -- cgit v1.2.3 From 251720bfd32541901b9e845651dbc037b34065e2 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Dec 2013 18:54:50 -0800 Subject: turn private notes into a feature --- 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 2e8169bd7..3534c3978 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -140,6 +140,9 @@ function widget_follow($args) { function widget_notes($arr) { if(! local_user()) return ''; + if(! feature_enabled(local_user(),'private_notes')) + return ''; + $text = htmlspecialchars(get_pconfig(local_user(),'notes','text')); $o = replace_macros(get_markup_template('notes.tpl'), array( -- cgit v1.2.3 From ed9f10872240231125007cf32b95007281558cac Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 9 Dec 2013 21:20:55 -0800 Subject: comanchify the savedsearch widget --- include/widgets.php | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 3534c3978..e64920cdc 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -152,3 +152,86 @@ function widget_notes($arr) { )); return $o; } + + +function widget_savedsearch($arr) { + if((! local_user()) || (! feature_enabled(local_user(),'savedsearch'))) + return ''; + + $a = get_app(); + + $search = ((x($_GET,'search')) ? $_GET['search'] : ''); + + if(x($_GET,'searchsave') && $search) { + $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", + intval(local_user()), + intval(TERM_SAVEDSEARCH), + dbesc($search) + ); + if(! $r) { + q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ", + intval(local_user()), + intval(TERM_SAVEDSEARCH), + dbesc($search) + ); + } + } + + if(x($_GET,'searchremove') && $search) { + q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", + intval(local_user()), + intval(TERM_SAVEDSEARCH), + dbesc($search) + ); + $search = ''; + } + + + + $srchurl = $a->query_string; + + $srchurl = rtrim(preg_replace('/searchsave\=[^\&].*?(\&|$)/is','',$srchurl),'&'); + $hasq = ((strpos($srchurl,'?') !== false) ? true : false); + $srchurl = rtrim(preg_replace('/searchremove\=[^\&].*?(\&|$)/is','',$srchurl),'&'); + $hasq = ((strpos($srchurl,'?') !== false) ? true : false); + + $srchurl = rtrim(preg_replace('/search\=[^\&].*?(\&|$)/is','',$srchurl),'&'); + $hasq = ((strpos($srchurl,'?') !== false) ? true : false); + + $o = ''; + + $r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ", + intval(local_user()), + intval(TERM_SAVEDSEARCH) + ); + + $saved = array(); + + if(count($r)) { + foreach($r as $rr) { + + $saved[] = array( + 'id' => $rr['tid'], + 'term' => $rr['term'], + 'dellink' => z_root() . '/' . $srchurl . (($hasq) ? '' : '?f=') . '&searchremove=1&search=' . urlencode($rr['term']), + 'srchlink' => z_root() . '/' . $srchurl . (($hasq) ? '' : '?f=') . '&search=' . urlencode($rr['term']), + 'displayterm' => htmlspecialchars($rr['term']), + 'encodedterm' => urlencode($rr['term']), + 'delete' => t('Remove term'), + 'selected' => ($search==$rr['term']), + ); + } + } + + + $tpl = get_markup_template("saved_searches.tpl"); + $o = replace_macros($tpl, array( + '$title' => t('Saved Searches'), + '$add' => t('add'), + '$searchbox' => searchbox('','netsearch-box',$srchurl . (($hasq) ? '' : '?f='),true), + '$saved' => $saved, + )); + + return $o; + +} -- cgit v1.2.3 From e873f6e95ed167e48a557365089ec97abee473cc Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Dec 2013 00:05:31 -0800 Subject: we're almost ready to turn on comanche for mod_network. All the widgets are done. --- include/widgets.php | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index e64920cdc..e0fc94e18 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -231,7 +231,72 @@ function widget_savedsearch($arr) { '$searchbox' => searchbox('','netsearch-box',$srchurl . (($hasq) ? '' : '?f='),true), '$saved' => $saved, )); - + return $o; } + + +function widget_filer($arr) { + if(! local_user()) + return ''; + + $a = get_app(); + + $selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : ''); + + $terms = array(); + $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc", + intval(local_user()), + intval(TERM_FILE) + ); + if(! $r) + return; + + foreach($r as $rr) + $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); + + return replace_macros(get_markup_template('fileas_widget.tpl'),array( + '$title' => t('Saved Folders'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => z_root() . '/' . $a->cmd + + )); +} + +function widget_archive($arr) { + + $o = ''; + $a = get_app(); + + if(! $a->profile_uid) { + return ''; + } + + $uid = $a->profile_uid; + + if(! feature_enabled($uid,'archives')) + return ''; + + + $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); + $url = z_root() . '/' . $a->cmd; + + $ret = posted_dates($uid,$wall); + + if(! count($ret)) + return ''; + + $o = replace_macros(get_markup_template('posted_date_widget.tpl'),array( + '$title' => t('Archives'), + '$size' => ((count($ret) > 6) ? 6 : count($ret)), + '$url' => $url, + '$dates' => $ret + )); + return $o; +} + + -- cgit v1.2.3 From e5ea4a009b81c7f3fa987ba34d20a996055775d6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Dec 2013 20:36:11 -0800 Subject: mod channel is now Comanchified --- include/widgets.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index e0fc94e18..cea5a6ce2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -196,6 +196,7 @@ function widget_savedsearch($arr) { $hasq = ((strpos($srchurl,'?') !== false) ? true : false); $srchurl = rtrim(preg_replace('/search\=[^\&].*?(\&|$)/is','',$srchurl),'&'); + $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); $hasq = ((strpos($srchurl,'?') !== false) ? true : false); $o = ''; @@ -285,6 +286,7 @@ function widget_archive($arr) { $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); $url = z_root() . '/' . $a->cmd; + $ret = posted_dates($uid,$wall); if(! count($ret)) @@ -300,3 +302,32 @@ function widget_archive($arr) { } +function widget_fullprofile($arr) { + $a = get_app(); + if(! $a->profile['profile_uid']) + return; + + $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); + + return profile_sidebar($a->profile, $block); +} + +function widget_categories($arr) { + $a = get_app(); + $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat']) : ''); + $srchurl = $a->query_string; + $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); + $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); + return categories_widget($srchurl,$cat); + +} + +function widget_tagcloud_wall($arr) { + $a = get_app(); + if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash'])) + return ''; + $limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50); + if(feature_enabled($a->profile['profile_uid'],'tagadelic')) + return tagblock('search',$a->profile['profile_uid'],$limit,$a->profile['channel_hash'],ITEM_WALL); + return ''; +} \ No newline at end of file -- cgit v1.2.3 From 1d8c15f2df45387993624a8217b648ac10491344 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 11 Dec 2013 12:01:28 +0100 Subject: make suggest channels a feature --- include/widgets.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index cea5a6ce2..6d258d101 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -57,6 +57,9 @@ function widget_collections($args) { function widget_suggestions($arr) { + if((! local_user()) || (! feature_enabled(local_user(),'suggest'))) + return ''; + require_once('include/socgraph.php'); $r = suggestion_query(local_user(),get_observer_hash(),0,20); @@ -330,4 +333,4 @@ function widget_tagcloud_wall($arr) { if(feature_enabled($a->profile['profile_uid'],'tagadelic')) return tagblock('search',$a->profile['profile_uid'],$limit,$a->profile['channel_hash'],ITEM_WALL); return ''; -} \ No newline at end of file +} -- cgit v1.2.3 From aea1e1af82ab2f76f0d8a421ff101316421cbd84 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 11 Dec 2013 18:57:42 +0100 Subject: this makes quotes appear as quotes in notes once page is reloaded. i guess thats fine since we use escape_tags() in notes.php --- 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 6d258d101..abbe1e2e0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -146,7 +146,7 @@ function widget_notes($arr) { if(! feature_enabled(local_user(),'private_notes')) return ''; - $text = htmlspecialchars(get_pconfig(local_user(),'notes','text')); + $text = get_pconfig(local_user(),'notes','text'); $o = replace_macros(get_markup_template('notes.tpl'), array( '$banner' => t('Notes'), -- cgit v1.2.3 From b4e1e8a4a43721d0134e41944afaa9f45bcd8aa8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Dec 2013 19:43:41 -0800 Subject: The affinity tool is not a "traditional" widget. But it is nevertheless a widget. It just makes fewer page layout decisions which are hard-coded. If you want to shrink it down and put it on the sidebar in your theme, go for it. --- include/widgets.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index abbe1e2e0..680c00df2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -334,3 +334,29 @@ function widget_tagcloud_wall($arr) { return tagblock('search',$a->profile['profile_uid'],$limit,$a->profile['channel_hash'],ITEM_WALL); return ''; } + + +function widget_affinity($arr) { + + if(! local_user()) + return ''; + + if(feature_enabled(local_user(),'affinity')) { + $tpl = get_markup_template('main_slider.tpl'); + $x = replace_macros($tpl,array( + '$val' => intval($_REQUEST['cmin']) . ';' . intval($_REQUEST['cmax']), + '$refresh' => t('Refresh'), + '$me' => t('Me'), + '$intimate' => t('Best Friends'), + '$friends' => t('Friends'), + '$coworkers' => t('Co-workers'), + '$oldfriends' => t('Former Friends'), + '$acquaintances' => t('Acquaintances'), + '$world' => t('Everybody') + )); + $arr = array('html' => $x); + call_hooks('main_slider',$arr); + return $arr['html']; + } + return ''; +} \ No newline at end of file -- cgit v1.2.3 From 18f0ab2605790f616ffd9b7a988e8dbdb10a0157 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Dec 2013 19:56:57 -0800 Subject: cmax wasn't defaulting correctly --- include/widgets.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 680c00df2..495ce74aa 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -341,10 +341,13 @@ function widget_affinity($arr) { if(! local_user()) return ''; + $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : 0); + $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : 99); + if(feature_enabled(local_user(),'affinity')) { $tpl = get_markup_template('main_slider.tpl'); $x = replace_macros($tpl,array( - '$val' => intval($_REQUEST['cmin']) . ';' . intval($_REQUEST['cmax']), + '$val' => $cmin . ';' . $cmax, '$refresh' => t('Refresh'), '$me' => t('Me'), '$intimate' => t('Best Friends'), -- cgit v1.2.3 From 303324cdff3f7c8bc83fae89256a2133939944b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Dec 2013 02:15:02 -0800 Subject: more htmlspecialchars sanitisation --- 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 495ce74aa..f53998b23 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -219,7 +219,7 @@ function widget_savedsearch($arr) { 'term' => $rr['term'], 'dellink' => z_root() . '/' . $srchurl . (($hasq) ? '' : '?f=') . '&searchremove=1&search=' . urlencode($rr['term']), 'srchlink' => z_root() . '/' . $srchurl . (($hasq) ? '' : '?f=') . '&search=' . urlencode($rr['term']), - 'displayterm' => htmlspecialchars($rr['term']), + 'displayterm' => htmlspecialchars($rr['term'], ENT_COMPAT,'UTF-8'), 'encodedterm' => urlencode($rr['term']), 'delete' => t('Remove term'), 'selected' => ($search==$rr['term']), @@ -317,7 +317,7 @@ function widget_fullprofile($arr) { function widget_categories($arr) { $a = get_app(); - $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat']) : ''); + $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); $srchurl = $a->query_string; $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); -- cgit v1.2.3 From c00f0d4b282f2242b9c2e154a5381029cf0dc812 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 14 Dec 2013 13:26:40 -0800 Subject: a couple more comanche conversions --- include/widgets.php | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index f53998b23..888da37a2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -362,4 +362,136 @@ function widget_affinity($arr) { return $arr['html']; } return ''; +} + + +function widget_settings_menu($arr) { + + if(! local_user()) + return; + + $a = get_app(); + $channel = $a->get_channel(); + + $abook_self_id = 0; + + // Retrieve the 'self' address book entry for use in the auto-permissions link + + $abk = q("select abook_id from abook where abook_channel = %d and ( abook_flags & %d ) limit 1", + intval(local_user()), + intval(ABOOK_FLAG_SELF) + ); + if($abk) + $abook_self_id = $abk[0]['abook_id']; + + + $tabs = array( + array( + 'label' => t('Account settings'), + 'url' => $a->get_baseurl(true).'/settings/account', + 'selected' => ((argv(1) === 'account') ? 'active' : ''), + ), + + array( + 'label' => t('Channel settings'), + 'url' => $a->get_baseurl(true).'/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 settings'), + 'url' => $a->get_baseurl(true).'/settings/featured', + 'selected' => ((argv(1) === 'featured') ? 'active' : ''), + ), + + array( + 'label' => t('Display settings'), + 'url' => $a->get_baseurl(true).'/settings/display', + 'selected' => ((argv(1) === 'display') ? 'active' : ''), + ), + + array( + 'label' => t('Connected apps'), + 'url' => $a->get_baseurl(true) . '/settings/oauth', + 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), + ), + + array( + 'label' => t('Export channel'), + 'url' => $a->get_baseurl(true) . '/uexport/basic', + 'selected' => '' + ), + +// array( +// 'label' => t('Export account'), +// 'url' => $a->get_baseurl(true) . '/uexport/complete', +// 'selected' => '' +// ), + + array( + 'label' => t('Automatic Permissions (Advanced)'), + 'url' => $a->get_baseurl(true) . '/connections/' . $abook_self_id, + 'selected' => '' + ), + + + ); + + if(feature_enabled(local_user(),'premium_channel')) { + $tabs[] = array( + 'label' => t('Premium Channel Settings'), + 'url' => $a->get_baseurl(true) . '/connect/' . $channel['channel_address'], + 'selected' => '' + ); + + } + + if(feature_enabled(local_user(),'channel_sources')) { + $tabs[] = array( + 'label' => t('Channel Sources'), + 'url' => $a->get_baseurl(true) . '/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_user()) + return; + + $a = get_app(); + return replace_macros(get_markup_template('message_side.tpl'), array( + '$tabs'=> array(), + + '$check'=>array( + 'label' => t('Check Mail'), + 'url' => $a->get_baseurl(true) . '/message', + 'sel' => (argv(1) == ''), + ), + '$new'=>array( + 'label' => t('New Message'), + 'url' => $a->get_baseurl(true) . '/message/new', + 'sel'=> (argv(1) == 'new'), + ) + + )); + } \ No newline at end of file -- cgit v1.2.3 From 38fd8410eb5c66928cb24bb87ad38657f53aec3a Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 18 Dec 2013 01:00:08 -0800 Subject: split off mod_connections into mod_connections & mod_connedit - lots of links to fix --- 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 888da37a2..9d6617aa2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -436,7 +436,7 @@ function widget_settings_menu($arr) { array( 'label' => t('Automatic Permissions (Advanced)'), - 'url' => $a->get_baseurl(true) . '/connections/' . $abook_self_id, + 'url' => $a->get_baseurl(true) . '/connedit/' . $abook_self_id, 'selected' => '' ), -- cgit v1.2.3 From 125543adedfe00b3d5cea8548d1a66096a173a6b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 02:16:14 -0800 Subject: more comanche migration --- include/widgets.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 9d6617aa2..ed155be9b 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -494,4 +494,20 @@ function widget_mailmenu($arr) { )); +} + +function widget_design_tools($arr) { + $a = get_app(); + + // mod menu doesn't load a profile. For any modules which load a profile, check it. + // otherwise local_user() is sufficient for permissions. + + if($a->profile['profile_uid']) + if($a->profile['profile_uid'] != local_user()) + return ''; + + if(! local_user()) + return ''; + + return design_tools(); } \ No newline at end of file -- cgit v1.2.3 From b28a37c38e3fc68b1d0a59e4f5e6054ce13cb680 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 02:25:44 -0800 Subject: more comanche --- include/widgets.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index ed155be9b..5418d6d8e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -510,4 +510,8 @@ function widget_design_tools($arr) { return ''; return design_tools(); +} + +function widget_findpeople($arr) { + return findpeople_widget(); } \ No newline at end of file -- cgit v1.2.3 From 564f431551672d706136559a4fed3a3c4f98c0ec Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 17:36:31 -0800 Subject: comanchificate mod_photos --- include/widgets.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 5418d6d8e..5bb937c2e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,18 +1,5 @@ t('Displays a full channel profile'), - 'tagcloud' => t('Tag cloud of webpage categories'), - 'collections' => t('List and filter by collection'), - 'suggestions' => t('Show a couple of channel suggestion'), - 'follow' => t('Provide a channel follow form') - ); - $arr = array('widgets' => $widgets); - call_hooks('list_widgets',$arr); - return $arr['widgets']; -} - function widget_profile($args) { $a = get_app(); @@ -514,4 +501,22 @@ function widget_design_tools($arr) { function widget_findpeople($arr) { return findpeople_widget(); -} \ No newline at end of file +} + + +function widget_photo_albums($arr) { + $a = get_app(); + if(! $a->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_photos'))) + return ''; + return photos_album_widget($channelx[0],$a->get_observer()); + +} + + +function widget_vcard($arr) { + return vcard_from_xchan('',get_app()->get_observer()); +} + -- cgit v1.2.3 From 2c0fbc508e44ebc96b00e4e8a5e166324fbcf9b3 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 19 Dec 2013 23:56:37 -0800 Subject: comanchify connedit, group --- include/widgets.php | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 5bb937c2e..2591a9d09 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -34,10 +34,39 @@ function widget_tagcloud($args) { function widget_collections($args) { require_once('include/group.php'); - $page = argv(0); - $gid = $_REQUEST['gid']; - return group_side($page,$page,true,$_REQUEST['gid'],'',0); + $mode = ((array_key_exists('mode',$args)) ? $args['mode'] : 'conversation'); + switch($mode) { + case 'conversation': + $every = argv(0); + $each = argv(0); + $edit = true; + $current = $_REQUEST['gid']; + $abook_id = 0; + $wmode = 0; + break; + case 'groups': + $every = 'connections'; + $each = argv(0); + $edit = false; + $current = intval(argv(1)); + $abook_id = 0; + $wmode = 1; + break; + case 'abook': + $every = 'connections'; + $each = 'group'; + $edit = false; + $current = 0; + $abook_id = get_app()->poi['abook_xchan']; + $wmode = 1; + break; + default: + return ''; + break; + } + + return group_side($every, $each, $edit, $current, $abook_id, $wmode); } -- cgit v1.2.3 From aa312f72bf48f3ffeb62606541b39e5243ce819e Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 20 Dec 2013 12:43:04 -0800 Subject: comanchify mod_directory. Two modules remaining. Actually three because message needs to be split. --- include/widgets.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 2591a9d09..5e2285de7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1,5 +1,8 @@ get_observer()); } + +/** + * The following directory widgets are only useful on the directory page + */ + +function widget_dirsafemode($arr) { + return dir_safe_mode(); +} + +function widget_dirsort($arr) { + return dir_sort_links(); +} + +function widget_dirtags($arr) { + return dir_tagblock(z_root() . '/directory',null); +} \ No newline at end of file -- cgit v1.2.3 From d32bbaf599c77aa415ee403a896b77f091f0e9fc Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 21 Dec 2013 23:47:44 -0800 Subject: split private messages into two modules - "message" is just for message lists, "mail" is for reading and writing conversations. This is so we can Comanchify it cleanly. --- 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 5e2285de7..d6ef9ec07 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -507,7 +507,7 @@ function widget_mailmenu($arr) { ), '$new'=>array( 'label' => t('New Message'), - 'url' => $a->get_baseurl(true) . '/message/new', + 'url' => $a->get_baseurl(true) . '/mail/new', 'sel'=> (argv(1) == 'new'), ) -- cgit v1.2.3 From 0366991b45a9b54da66850bce44b4b9dc1d939a7 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Dec 2013 02:04:55 -0800 Subject: appears that I missed a few files for Comanchification. so here's mitem. --- include/widgets.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index d6ef9ec07..a1ff756ff 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -567,4 +567,11 @@ function widget_dirsort($arr) { function widget_dirtags($arr) { return dir_tagblock(z_root() . '/directory',null); -} \ No newline at end of file +} + +function widget_menu_preview($arr) { + if(! get_app()->data['menu_item']) + return; + require_once('include/menu.php'); + return menu_render(get_app()->data['menu_item']); +} -- cgit v1.2.3 From 331609cb871517bd35416669492488a3bc14702d Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 18 Jan 2014 18:38:53 +0000 Subject: vcard widget needs to include Contact if it's not included from the module that calls it. --- 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 a1ff756ff..efa350785 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -549,6 +549,7 @@ function widget_photo_albums($arr) { function widget_vcard($arr) { + require_once ('include/Contact.php'); return vcard_from_xchan('',get_app()->get_observer()); } -- cgit v1.2.3 From 9f546757021305b6cfe924f38ca1af5fd5d3e69b Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 01:52:23 -0800 Subject: chatroom list widget backend --- include/widgets.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index efa350785..8b22515b1 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -576,3 +576,12 @@ function widget_menu_preview($arr) { require_once('include/menu.php'); return menu_render(get_app()->data['menu_item']); } + +function widget_chatroom_list($arr) { + require_once("include/chat.php"); + $r = chatroom_list(local_user()); + return replace_macros(get_markup_template('chatroomlist.tpl'),array( + '$header' => t('Chat Rooms'), + '$items' => $r, + )); +} \ No newline at end of file -- cgit v1.2.3 From 677f5f641e6c37244ee67459b6fa2c7e5aea119b Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 16:02:02 -0800 Subject: more testing of chatroom interfaces, also corrected a function call that should have been a class instantiation in reddav --- 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 8b22515b1..400660d11 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -580,8 +580,11 @@ function widget_menu_preview($arr) { function widget_chatroom_list($arr) { require_once("include/chat.php"); $r = chatroom_list(local_user()); + $channel = get_app()->get_channel(); return replace_macros(get_markup_template('chatroomlist.tpl'),array( '$header' => t('Chat Rooms'), + '$baseurl' => z_root(), + '$nickname' => $channel['channel_address'], '$items' => $r, )); } \ No newline at end of file -- cgit v1.2.3 From 080928f214c9f83879f1578e05baa6032fa2b7b8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 21:29:48 -0800 Subject: chatroom management front-end stuff --- include/widgets.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 400660d11..0151f7c27 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -587,4 +587,5 @@ function widget_chatroom_list($arr) { '$nickname' => $channel['channel_address'], '$items' => $r, )); -} \ No newline at end of file +} + -- cgit v1.2.3 From e06d9e97c56d119c35c59ba65c7437a28115e4a0 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 12 Feb 2014 21:31:11 +0100 Subject: make chatrooms in /chat/channel visible to observers aswell --- include/widgets.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0151f7c27..7c316410e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -578,13 +578,16 @@ function widget_menu_preview($arr) { } function widget_chatroom_list($arr) { + + $a = get_app(); + require_once("include/chat.php"); - $r = chatroom_list(local_user()); - $channel = get_app()->get_channel(); + $r = chatroom_list($a->profile['profile_uid']); + return replace_macros(get_markup_template('chatroomlist.tpl'),array( '$header' => t('Chat Rooms'), '$baseurl' => z_root(), - '$nickname' => $channel['channel_address'], + '$nickname' => $a->profile['channel_address'], '$items' => $r, )); } -- cgit v1.2.3 From 18b2ff9c24d2384f57009d86cab9a3a82d3dc7b8 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 12 Feb 2014 21:36:20 +0100 Subject: whitespace --- include/widgets.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 7c316410e..3c2333323 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -578,12 +578,9 @@ function widget_menu_preview($arr) { } 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(), -- cgit v1.2.3 From e12f6f1bd93bb42bf0fe9fc9d9a1ff08cd162a0d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 20 Feb 2014 17:20:24 -0800 Subject: small changes to a couple of lookup functions which we need to use a bit more --- 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 3c2333323..4a5ae9de7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -543,7 +543,7 @@ function widget_photo_albums($arr) { $channelx = channelx_by_n($a->profile['profile_uid']); if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_photos'))) return ''; - return photos_album_widget($channelx[0],$a->get_observer()); + return photos_album_widget($channelx,$a->get_observer()); } -- cgit v1.2.3 From 642da17b86cce8f6455a68d2d863a288d3c125c8 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Feb 2014 17:07:11 -0800 Subject: chatroom suggestions --- include/widgets.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 4a5ae9de7..eb4565641 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -589,3 +589,39 @@ function widget_chatroom_list($arr) { )); } +function widget_bookmarkedchats($arr) { + $h = get_observer_hash(); + if(! $h) + return; + $r = q("select * from xchat where xchat_xchan = '%s' group by xchat_url order by xchat_desc", + dbesc($h) + ); + + for($x = 0; $x < count($r); $x ++) + $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); + return replace_macros(get_markup_template('bookmarkedchats.tpl'),array( + '$header' => t('Bookmarked Chatrooms'), + '$rooms' => $r + )); +} + +function widget_suggestedchats($arr) { + + // probably should restrict this to your friends, but then the widget will only work + // if you are logged in locally. + + $h = get_observer_hash(); + if(! $h) + return; + $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc", + dbesc($h) + ); + + for($x = 0; $x < count($r); $x ++) + $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); + return replace_macros(get_markup_template('bookmarkedchats.tpl'),array( + '$header' => t('Suggested Chatrooms'), + '$rooms' => $r + )); +} + -- cgit v1.2.3 From d2bc7c606a6585dc82127717acf2cfe60b45f987 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Feb 2014 17:10:26 -0800 Subject: minor fixes to suggested chatrooms --- include/widgets.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index eb4565641..aaf5a72a0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -613,9 +613,7 @@ function widget_suggestedchats($arr) { $h = get_observer_hash(); if(! $h) return; - $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc", - dbesc($h) - ); + $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc"); for($x = 0; $x < count($r); $x ++) $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); -- cgit v1.2.3 From 102521844b3d6f31d0d801b0d0c89241c2c621af Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Feb 2014 20:48:10 -0800 Subject: put schemas in Comanche (this requires theme support (!)) --- 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 aaf5a72a0..8d5ab77e3 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -613,7 +613,7 @@ function widget_suggestedchats($arr) { $h = get_observer_hash(); if(! $h) return; - $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc"); + $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc limit 24"); for($x = 0; $x < count($r); $x ++) $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); -- cgit v1.2.3 From 12480a13cd46b5aa747dc72b42b0d78b8852d2bb Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Mar 2014 18:20:52 -0800 Subject: item widget - displays one (webpage) item by mid. This is how you could put multiple content blobs on a page without turning them all into blocks. --- include/widgets.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 8d5ab77e3..8d8eef160 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -623,3 +623,30 @@ function widget_suggestedchats($arr) { )); } +function widget_item($arr) { + $uid = $a->profile['profile_uid']; + if((! $uid) || (! $arr['mid'])) + return ''; + + if(! perm_is_allowed($uid,get_observer_hash(),'view_pages')) + return ''; + + require_once('include/security.php'); + $sql_extra = item_permissions_sql($uid); + + + $r = q("select * from item where mid = '%s' and uid = %d and item_restrict = " . intval(ITEM_WEBPAGE) . " $sql_extra limit 1", + dbesc($arr['mid']), + intval($uid) + ); + + if(! $r) + return ''; + + xchan_query($r); + $r = fetch_post_tags($r,true); + + $o .= prepare_page($r[0]); + return $o; + +} \ No newline at end of file -- cgit v1.2.3 From d58abc0230e07663ce543088c186639d36f82f02 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 5 Mar 2014 04:28:48 -0800 Subject: add clock widget and correct some doco --- include/widgets.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 8d8eef160..90586397f 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -649,4 +649,60 @@ function widget_item($arr) { $o .= prepare_page($r[0]); return $o; +} + +function widget_clock($arr) { + + $miltime = 0; + if(isset($arr['military']) && $arr['military']) + $miltime = 1; + +$o = <<< EOT +
+

+ +
+EOT; +return $o; + } \ No newline at end of file -- cgit v1.2.3 From 34eb79e6ba2255113eca6d30ae6c65b28d63abfa Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 16:20:44 -0700 Subject: provide 'style' option to archive widget to choose between 'select' and 'list' format --- include/widgets.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 90586397f..82769d925 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -306,6 +306,7 @@ function widget_archive($arr) { $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); + $style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select'); $url = z_root() . '/' . $a->cmd; @@ -318,6 +319,7 @@ function widget_archive($arr) { '$title' => t('Archives'), '$size' => ((count($ret) > 6) ? 6 : count($ret)), '$url' => $url, + '$style' => $style, '$dates' => $ret )); return $o; -- cgit v1.2.3 From 506ae56385f5f731b7f3a8f5ee7feda2a66ae985 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 14 Apr 2014 16:45:16 -0700 Subject: Better handling of restricted /channel and /profile permissions. We will show the name, profile photo and a 'connect' button if appropriate on these pages regardless of permissions. A blank page makes it difficult for folks to figure out how to connect and if it is their real life friend 'x' or not. It also matches our overall policy (adopted from Facebook's lessons learned) that the channel name and default profile photo are always visible and can't really be blocked without messing up the usability of the entire network. This also makes sure that a connect button can be found somewhere besides the directory - where the entry could be blocked; and avoid somebody having to figure out the webbie and find the link to "follow" (another related issue). --- include/widgets.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 82769d925..678fed833 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -304,6 +304,9 @@ function widget_archive($arr) { if(! feature_enabled($uid,'archives')) return ''; + if(! perm_is_allowed($uid,get_observer_hash(),'view_stream')) + return ''; + $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); $style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select'); @@ -338,6 +341,12 @@ function widget_fullprofile($arr) { function widget_categories($arr) { $a = get_app(); + + + if($a->profile['profile_uid'] && (! perm_is_allowed($a->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 = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); @@ -350,6 +359,9 @@ function widget_tagcloud_wall($arr) { $a = get_app(); if((! $a->profile['profile_uid']) || (! $a->profile['channel_hash'])) return ''; + if(! perm_is_allowed($a->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 tagblock('search',$a->profile['profile_uid'],$limit,$a->profile['channel_hash'],ITEM_WALL); -- cgit v1.2.3 From b666aca5c39216270d3ba81b73cdb15d142cf20f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 1 May 2014 17:54:12 -0700 Subject: bring the posted-date selector widget up to date. There are no longer two different styles. --- 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 678fed833..1b0e140c0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -313,7 +313,7 @@ function widget_archive($arr) { $url = z_root() . '/' . $a->cmd; - $ret = posted_dates($uid,$wall); + $ret = list_post_dates($uid,$wall); if(! count($ret)) return ''; -- cgit v1.2.3 From b0dc3d3b4cc6c4c4151b2d7882062b6658637955 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 13 May 2014 21:33:39 -0700 Subject: add photo widget --- include/widgets.php | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 1b0e140c0..0f6d70ff7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -719,4 +719,46 @@ $(document).ready(function() { EOT; return $o; -} \ No newline at end of file +} + + +/** + * @function widget_photo($arr) + * widget to display a single photo. + * @param array $arr; + * 'src' => URL of photo + * 'zrl' => true or false, use zid in url + * 'style' => CSS string + * URL must be an http or https URL + */ + + +function widget_photo($arr) { + + $style = $zrl = false; + $params = ''; + if(array_key_exists('src',$arr) && isset($arr['src'])) + $url = $arr['src']; + + if(strpos($url,'http') !== 0) + return ''; + + if(array_key_exists('style',$arr) && isset($arr['style'])) + $style = $arr['style']; + + if(array_key_exists('zrl',$arr) && isset($arr['zrl'])) + $zrl = (($arr['zrl']) ? true : false); + + if($zrl) + $url = zid($url); + + $o = '
'; + + $o .= ''; + + $o .= '
'; + + return $o; +} -- cgit v1.2.3 From 2f1e4a6370da6892433b6d8d57362a5a6565e07c Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 May 2014 00:55:32 -0700 Subject: xss prevention --- include/widgets.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0f6d70ff7..0ed79f1eb 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -746,6 +746,11 @@ function widget_photo($arr) { if(array_key_exists('style',$arr) && isset($arr['style'])) $style = $arr['style']; + // ensure they can't sneak in an eval(js) function + + if(strpos($style,'(') !== false) + return ''; + if(array_key_exists('zrl',$arr) && isset($arr['zrl'])) $zrl = (($arr['zrl']) ? true : false); -- cgit v1.2.3 From 2fdc13e91d3b0ccd514a13fd7f475f045656b23f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 May 2014 20:20:20 -0700 Subject: some sidebar content (doesn't yet do anything) --- include/widgets.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 0ed79f1eb..37a079bc7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -74,6 +74,18 @@ function widget_collections($args) { } +function widget_appselect($arr) { + return replace_macros(get_markup_template('app_select.tpl'),array( + '$title' => t('App Category'), + '$system' => t('System'), + '$personal' => t('Personal'), + '$featured' => t('Featured'), + '$new' => t('New') + )); +} + + + function widget_suggestions($arr) { if((! local_user()) || (! feature_enabled(local_user(),'suggest'))) -- cgit v1.2.3 From fc0967b84b5e1301c0ce3a9a41c00985ce16bc82 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 May 2014 18:08:49 -0700 Subject: most of the remaining apps basic infrastructure except a form to create the things. Don't let this fool you - there is still a lot of work, but there isn't a whole lot of work to create a demo; in fact you can demo it now. --- include/widgets.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/widgets.php') diff --git a/include/widgets.php b/include/widgets.php index 37a079bc7..8cd2287a7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -78,9 +78,9 @@ function widget_appselect($arr) { return replace_macros(get_markup_template('app_select.tpl'),array( '$title' => t('App Category'), '$system' => t('System'), - '$personal' => t('Personal'), - '$featured' => t('Featured'), - '$new' => t('New') + '$personal' => t('Personal') +// '$featured' => t('Featured'), +// '$new' => t('New') )); } -- cgit v1.2.3 From 751fda97045ad4e399e9a01cc14d8eb058b361a8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 21 May 2014 20:54:09 -0700 Subject: more app work --- 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 8cd2287a7..1043acce0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -76,11 +76,11 @@ function widget_collections($args) { function widget_appselect($arr) { return replace_macros(get_markup_template('app_select.tpl'),array( - '$title' => t('App Category'), + '$title' => t('Apps'), '$system' => t('System'), - '$personal' => t('Personal') -// '$featured' => t('Featured'), -// '$new' => t('New') + '$personal' => t('Personal'), + '$new' => t('Create Personal App'), + '$edit' => t('Edit Personal App') )); } -- cgit v1.2.3 From 17e575e1ebcc7ea232530bd0c1dddef334122f96 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 1 Jun 2014 22:15:21 -0700 Subject: don't show app editing options to non-authenticated folks --- 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 1043acce0..c7a4da6a0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -78,6 +78,7 @@ function widget_appselect($arr) { return replace_macros(get_markup_template('app_select.tpl'),array( '$title' => t('Apps'), '$system' => t('System'), + '$authed' => ((local_user()) ? true : false), '$personal' => t('Personal'), '$new' => t('Create Personal App'), '$edit' => t('Edit Personal App') -- cgit v1.2.3 From 97a4479513130658fffdcc1f8ef0d349f08520bc Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jun 2014 18:19:27 -0700 Subject: don't provide a second (actually third counting the navbar) search box on the search page if you've got saved searches turned on. This should solve some problems with duplicate html id's (and save wasn't working anyway). If you don't have saved search ability (which will provide a saved search widget in the sidebar), provide a simple search box in the main content region but without save ability. --- 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 c7a4da6a0..d197eb240 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -264,7 +264,7 @@ function widget_savedsearch($arr) { $o = replace_macros($tpl, array( '$title' => t('Saved Searches'), '$add' => t('add'), - '$searchbox' => searchbox('','netsearch-box',$srchurl . (($hasq) ? '' : '?f='),true), + '$searchbox' => searchbox($search,'netsearch-box',$srchurl . (($hasq) ? '' : '?f='),true), '$saved' => $saved, )); -- cgit v1.2.3 From 737d3f583665f24881e484b40acf0bbc5f498e48 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jun 2014 19:25:59 -0700 Subject: don't add a birthday event if the birthday channel doesn't have permission to send you posts. --- 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 d197eb240..96bced87f 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -196,7 +196,7 @@ function widget_savedsearch($arr) { $a = get_app(); $search = ((x($_GET,'search')) ? $_GET['search'] : ''); - + if(x($_GET,'searchsave') && $search) { $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", intval(local_user()), -- cgit v1.2.3