Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function lastposts_channel_mod_init(&$a,&$b) {
- logger('lastposts invoked');
- if(! intval(get_pconfig(local_user(),'lastposts','lastposts_enable')))
- return;
- $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/lastposts/lastposts.css' . '" media="all" /
- >' . "\r\n";
- $lastposts = '<div id="lastposts-channel" class="widget">
- <div class="title tool">
- <h4>'.t("Latest Posts").'</h4></div>';
- $lastposts .= '<ul>';
- $channel = $a->profile(); // This is the channel owner, if it has been set
- logger('lastposts chan=$channel');
- $channel_hash = $channel['channel_hash'];
- logger('lastposts chanhash=$channel_hash');
- if($channel && perm_is_allowed($channel['profile_uid'],get_observer_hash(),'view_stream')) {
- $query = q("select title, plink, created from item where author_xchan='%s' where item_restrict = 0 and uid = %d and item_private = 0 order by
- created desc LIMIT 0,5",
- dbesc($channel_hash),
- intval($channel['profile_uid'])
- );
- if($query) {
- foreach($query as $row) {
- $plink = $row['plink'];
- $created = $row['created'];
- if (! $row['title'] ) {
- $title = $created;
- } else {
- $title = $row['title'];
- }
- $lastposts .= '<li><a href="$plink">$title</a></li>';
- }
- $lastposts .= '</ul>';
- $lastposts .= '</div><div class="clear"></div>';
- if (! intval(get_pconfig(local_user(), 'lastposts', 'lastposts_right'))) {
- $a->page['aside'] = $lastposts.$a->page['aside'];
- } else {
- $a->page['right_aside'] = $lastposts.$a->page['right_aside'];
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement