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