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') 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