diff options
author | redmatrix <git@macgirvin.com> | 2016-01-14 17:25:27 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-01-14 17:25:27 -0800 |
commit | 64753effd1cd47c43846e5bc8653180acd7c4bc9 (patch) | |
tree | 05d14ed6842e8b657143580b6c19954542eef181 /include/widgets.php | |
parent | be9442e7b30c27d3ab91dc79c8dd1ff721a2d260 (diff) | |
download | volse-hubzilla-64753effd1cd47c43846e5bc8653180acd7c4bc9.tar.gz volse-hubzilla-64753effd1cd47c43846e5bc8653180acd7c4bc9.tar.bz2 volse-hubzilla-64753effd1cd47c43846e5bc8653180acd7c4bc9.zip |
cover photo fetch and widget
Diffstat (limited to 'include/widgets.php')
-rw-r--r-- | include/widgets.php | 32 |
1 files changed, 32 insertions, 0 deletions
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 = '<div class="widget">' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '</div>'; + } + return $o; +} + + function widget_photo_rand($arr) { require_once('include/photos.php'); |