/** * Return formatted comment given the wall item */ public static function formatComment($wall) { $config = CFactory::getConfig(); $my = CFactory::getUser(); $actModel = CFactory::getModel('activities'); $like = new CLike(); $likeCount = $like->getLikeCount('comment', $wall->id); $isLiked = $like->userLiked('comment', $wall->id, $my->id); $user = CFactory::getUser($wall->post_by); // Censor if the user is banned if ($user->block) { $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED'); } else { // strip out the comment data $CComment = new CComment(); $wall->comment = $CComment->stripCommentData($wall->comment); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text $CTemplate = new CTemplate(); $wall->comment = $origComment = $CTemplate->escape($wall->comment); $wall->comment = CStringHelper::autoLink($wall->comment); } $commentsHTML = ''; $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>'; $date = new JDate($wall->date); $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> '; $commentsHTML .= $wall->comment; $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date); $cid = isset($wall->contentid) ? $wall->contentid : null; $activity = $actModel->getActivity($cid); $ownPost = $my->id == $wall->post_by; $allowRemove = $my->authorise('community.delete', 'walls', $wall); $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin(); // only poster can edit if ($allowRemove) { $commentsHTML .= ' <span class="wall-coc-remove-link">• <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>'; } $commentsHTML .= '</span>'; $commentsHTML .= '</div>'; $editHTML = ''; if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) { $editHTML .= '<a href="javascript:" class="joms-button--edit">'; $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>'; $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>'; $editHTML .= '</a>'; } $removeHTML = ''; if ($allowRemove) { $removeHTML .= '<a href="javascript:" class="joms-button--remove">'; $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>'; $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>'; $removeHTML .= '</a>'; } $removeTagHTML = ''; if (CActivitiesHelper::hasTag($my->id, $wall->comment)) { $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>'; } /* user deleted */ if ($user->guest == 1) { $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> '; } else { $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> '; } $params = $wall->params; $paramsHTML = ''; $image = (array) $params->get('image'); $photoThumbnail = false; if ($params->get('attached_photo_id') > 0) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>'; } else { if ($params->get('title')) { $video = self::detectVideo($params->get('url')); if (is_object($video)) { $paramsHTML .= '<div class="joms-media--video joms-js--video"'; $paramsHTML .= ' data-type="' . $video->type . '"'; $paramsHTML .= ' data-id="' . $video->id . '"'; $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"'; $paramsHTML .= ' style="margin-top:10px;">'; $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<img src="' . $video->getThumbnail() . '">'; $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">'; $paramsHTML .= '<div class="mejs-overlay-button"></div>'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>'; $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>'; $paramsHTML .= '</div>'; $paramsHTML .= '</div>'; } else { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">'; if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) { $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>'; } if ($params->get('image')) { $paramsHTML .= $params->get('link'); $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">'; $paramsHTML .= '<img src="' . array_shift($image) . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $url = $params->get('url') ? $params->get('url') : '#'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<a href="' . $url . '">'; $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>'; $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>'; if ($params->get('link')) { $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>'; } $paramsHTML .= '</a></div></div>'; } } } if (!$params->get('title') && $params->get('url')) { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album">'; $paramsHTML .= '<a href="' . $params->get('url') . '">'; $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $wall->comment = nl2br($wall->comment); $wall->comment = CUserHelper::replaceAliasURL($wall->comment); $wall->comment = CStringHelper::getEmoticon($wall->comment); $wall->comment = CStringHelper::converttagtolink($wall->comment); // convert to hashtag $template = new CTemplate(); $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML); $commentsHTML = $template->fetch('stream/single-comment'); return $commentsHTML; }
echo JText::sprintf('COM_COMMUNITY_ACTIVITY_GROUP_PHOTO_UPLOAD_TITLE', CUrlHelper::groupLink($group->id), CStringHelper::escape($group->name)); } else { echo JText::sprintf('COM_COMMUNITY_ACTIVITY_PHOTO_UPLOAD_TITLE', $album->getURI(), CStringHelper::escape($album->name)); } } } ?> <div> <?php if (!$act->groupid) { ?> <?php echo CActivitiesHelper::getStreamPermissionHTML($act->access, $act->actor); ?> <?php } ?> <span class="joms-share-meta date"><?php echo $createdTime; ?> </span> </div> </header> <?php // If custom message is there for single photo upload, display it
<use xlink:href="<?php echo CRoute::getURI(); ?> #joms-icon-remove"></use> </svg> <span><?php echo JText::_('COM_COMMUNITY_WALL_REMOVE'); ?> </span> </a> <?php } ?> <?php if (CActivitiesHelper::hasTag($my->id, $wall->originalComment)) { ?> <a href="javascript:" class="joms-button--remove-tag" onclick="joms.api.commentRemoveTag('<?php echo $id; ?> ');"> <svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg> <span><?php echo JText::_('COM_COMMUNITY_WALL_REMOVE_TAG'); ?> </span> </a> <?php } ?>
if ($config->get('activitydateformat') == "lapse") { $createdTime = CTimeHelper::timeLapse($date); } else { $createdTime = $date->format($config->get('profileDateFormat')); } $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H'); // Setup group table $event = JTable::getInstance('Event', 'CTable'); $event->load($act->eventid); $this->set('event', $event); $membersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND); $user = CFactory::getUser($this->act->actor); $users = array_reverse(explode(',', $this->actors)); $userCount = count($users); if ($userCount != $membersCount) { $userCount = CActivitiesHelper::updateEventAttendMembers($this->act->id, $event); } $actorsHTML = array(); $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); ?> <div class="joms-stream__body no-head"> <p> <svg class="joms-icon" viewBox="0 0 16 16"> <use xlink:href="<?php echo CRoute::getURI(); ?>
if ($appName == 'groups') { $obj = $this->group; } if ($appName == 'events') { $obj = $this->event; } $my = CFactory::getUser(); $allowLike = $my->authorise('community.add', 'activities.like.' . $this->act->actor, $obj); $showLocation = !empty($this->act->location); // @todo: delete permission shoudl be handled within ACL system $allowDelete = ($act->actor == $my->id || $isCommunityAdmin || $act->target == $my->id) && $my->id != 0; // Allow system message deletion only for admin if ($act->app == 'users.featured') { $allowDelete = $isCommunityAdmin; } $allowComment = CActivitiesHelper::isActionAllowed($act->app, 'comment'); $allowComment = $allowComment && $my->authorise('community.add', 'activities.comment.' . $this->act->actor, $obj); if ($act->app == 'groups.discussion.reply' || $act->app == 'groups.discussion' || $act->app == 'groups.bulletin' || $act->app == 'events' || $act->app == 'groups' || strpos($act->app, 'featured') !== false || $act->app == 'albums.comment') { $allowComment = false; } // Allow comment for system post if ($appName == 'system') { $allowComment = !empty($my->id); } // No like/comment support from the activity stream if ($appName == 'photos' || $appName == 'videos') { // $allowLike = false; // $allowComment = false; } if ($appName == 'kunena') { $allowLike = true;
<li> <a href="javascript:" data-propagate="1" onclick="joms.api.streamRemoveMood('<?php echo $act->id; ?> ');"> <?php echo JText::_('COM_COMMUNITY_ACTIVITY_REMOVE_MOOD'); ?> </a> </li> <?php } ?> <?php if (CActivitiesHelper::hasTag($my->id, $act->title)) { ?> <li class="joms-js--contextmenu-removetag"> <a href="javascript:" data-propagate="1" onclick="joms.api.streamRemoveTag('<?php echo $act->id; ?> ');"> <?php echo JText::_('COM_COMMUNITY_ACTIVITY_REMOVE_TAG'); ?> </a> </li> <?php } ?>
<?php } } } ?> <!-- Privacy --> <div> <?php /* Do filter not show privacy option for events' activities & groups' activities */ ?> <?php if (strpos($activity->get('app'), 'events') === false && strpos($activity->get('app'), 'groups') === false) { ?> <?php echo $activity->get('groupid') || $activity->get('app') == 'profile' && $activity->get('target') != $activity->get('actor') ? '' : CActivitiesHelper::getStreamPermissionHTML($activity->access, $user->id); ?> <?php } ?> <span class="joms-share-meta date"><?php echo $activity->getCreateTimeFormatted(); ?> </span> </div> </header> <div data-type="stream-editor" class="cStream-Respond" style="display:none"> <div class="cStream-Form" style="display:block"> <div class="cStream-FormInput"><textarea><?php echo $activity->get('title');
// Setup group table $group = JTable::getInstance('Group', 'CTable'); if (isset($act->groupid) && !empty($act->groupid)) { $group->load($act->groupid); } else { $group->load($act->cid); } $this->set('group', $group); $truncateVal = 60; $user = CFactory::getUser($this->act->actor); $users = explode(',', $this->actors); // We want the last guy joining to be the first mentioned $users = array_reverse($users); $userCount = count($users); if ($userCount != $group->getMembersCount()) { $userCount = CActivitiesHelper::updateGroupJoinMembers($act->id, $group); } $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); $actorsHTML = array(); ?> <div class="joms-stream__body no-head"> <p> <svg class="joms-icon" viewBox="0 0 16 16"> <use xlink:href="<?php echo CRoute::getURI(); ?>
<span class="joms-stream-avatar"> <img class="img-responsive joms-radius-rounded" src="components/com_community/assets/user-Male-thumb.png" /> </span> <?php } ?> <div class="joms-stream-content"> <header> <?php echo $stream->headline; ?> <!-- Privacy --> <div> <?php echo !$stream->groupid ? CActivitiesHelper::getStreamPermissionHTML($stream->access, $stream->actor->id) : ''; ?> <span class="joms-share-meta date"> <?php echo isset($stream->createdtime) ? $stream->createdtime : ''; ?> </span> </div> </header> <?php // Contain message ? if ($stream->message) { ?> <p><span><?php
<small> <?php echo CTimeHelper::timeLapse(CTimeHelper::getDate($msg->posted_on)); ?> </small> </span> <div class="joms-js--inbox-content"> <?php $content = CUserHelper::replaceAliasURL($content); $content = filter_var(htmlspecialchars_decode($content), FILTER_UNSAFE_RAW); echo $content; ?> </div> <div> <?php if (CActivitiesHelper::hasTag($my->id, $originalContent)) { ?> <div class="joms-comment__actions"> <a href="javascript:" class="joms-button--remove-tag" onclick="joms.api.commentRemoveTag('<?php echo $msg->id; ?> ', 'inbox');"> <svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="<?php echo CRoute::getURI(); ?> #joms-icon-tag"></use></svg> <span><?php echo JText::_('COM_COMMUNITY_WALL_REMOVE_TAG'); ?> </span> </a>