示例#1
0
 public function run()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $postId = Yii::app()->request->getParam('postId');
         $content = Yii::app()->request->getParam('content');
         $createTime = date('Y-m-d H-i-s');
         $userId = Yii::app()->user->id;
         $comment = new CComment();
         $result = $comment->sendcomment(array('postId' => $postId, 'content' => $content, 'userId' => $userId, 'createTime' => $createTime));
         echo CJSON::encode($result);
     }
 }
示例#2
0
 /**
  * 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">&#x2022; <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;
 }
示例#3
0
 function ajaxRemoveComment($response, $parentWallId, $commentIndex)
 {
     // Add the comment into the db
     CFactory::load('libraries', 'comment');
     $my = CFactory::getUser();
     $db =& JFactory::getDBO();
     $comment = new CComment();
     // Extract the numeric id from the wall-cmt-xxx
     $wallid = substr($parentWallId, 9);
     $wallModel = CFactory::getModel('wall');
     $wall = $wallModel->get($wallid);
     $content = $wall->comment;
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     // Get the comment data to determine ownership
     $commentData = $comment->getCommentsData($content);
     CFactory::load('helpers', 'owner');
     // Make sure that we have the right permission to delete this comment
     // Make sure the current user actually has the correct permission
     // Only the original writer and the person the wall is meant for (and admin of course)
     // can delete the wall
     if ($my->id == $commentData[$commentIndex]->creator || $my->id == $wall->contentid || COwnerHelper::isCommunityAdmin()) {
         $content = $comment->remove($content, $commentIndex);
         // Update the wall with the comment info
         $sql = 'UPDATE ' . $db->nameQuote('#__community_wall') . ' SET ' . $db->nameQuote('comment') . '=' . $db->Quote($content) . ' WHERE ' . $db->nameQuote('id') . ' =' . $db->Quote($wallid);
         $db->setQuery($sql);
         $db->query();
         if ($db->getErrorNum()) {
             JError::raiseError(500, $db->stderr());
         }
         $response->addScriptCall("joms.jQuery('#wall-cmt-" . $wallid . "').children(':nth-child(" . ($commentIndex + 1) . ")').remove();");
     } else {
         $html = JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING');
         $response->addAlert($html);
     }
     return $response;
 }
示例#4
0
文件: wall.php 项目: bizanto/Hooked
 function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
 {
     CFactory::load('helpers', 'url');
     CFactory::load('helpers', 'user');
     CFactory::load('helpers', 'videos');
     CFactory::load('libraries', 'comment');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $date = CTimeHelper::getDate($wall->date);
     $config = CFactory::getConfig();
     // @rule: for site super administrators we want to allow them to view the remove link
     $isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
     $isEditable = CWall::isEditable($processFunc, $wall->id);
     // Apply any post processing on the content
     $wall->comment = CWallLibrary::_processWallContent($wall->comment);
     $commentsHTML = '';
     $comment = new CComment();
     // If the wall post is a user wall post (in profile pages), we
     // add wall comment feature
     if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
         $commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
     }
     $avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
     //var_dump($avatarHTML);exit;
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
     $editInterval = round($interval / 60);
     // Create new instance of the template
     $tmpl = new CTemplate();
     $tmpl->set('id', $wall->id);
     $tmpl->set('author', $user->getDisplayName());
     $tmpl->set('avatarHTML', $avatarHTML);
     $tmpl->set('authorLink', CUrlHelper::userLink($user->id));
     $tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
     $tmpl->set('content', $wall->comment);
     $tmpl->set('commentsHTML', $commentsHTML);
     $tmpl->set('avatar', $user->getThumbAvatar());
     $tmpl->set('isMine', $isOwner);
     $tmpl->set('isEditable', $isEditable);
     $tmpl->set('editInterval', $editInterval);
     $tmpl->set('processFunc', $processFunc);
     $tmpl->set('config', $config);
     return $tmpl->fetch($templateFile);
 }
示例#5
0
<?php

$fb =& CFotobox::getInstance();
$fbm =& CFotoboxManage::getInstance();
$c =& CComment::getInstance();
$group_id = $_GET['group_id'];
$page = $_GET['page'];
$offset = $_GET['offset'];
$tags = $_GET['tags'];
$settingsHtml = '';
$filterTags = array();
$tagUrl = '';
if (isset($tags)) {
    $filterTags = (array) explode(',', $tags);
}
$foto_id = $_GET['id'];
$f_data = $fb->fotoData($foto_id);
$viewable = permission($f_data['P_PRIVACY'], 1);
if ($viewable === true) {
    if ($_USER_ID != $user_id) {
        $fbm->viewed($f_data['P_KEY'], $user_id);
    }
    if ($offset !== false) {
        if ($offset == 0) {
            $previous = false;
            $next = 1;
            $limit = 2;
        } else {
            $offset--;
            $previous = 0;
            $next = 2;
示例#6
0
 public function ajaxeditComment($id, $value, $photoId = 0)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $objResponse = new JAXResponse();
     $json = array();
     if ($my->id == 0) {
         $this->blockUnregister();
     }
     $wall = JTable::getInstance('wall', 'CTable');
     $wall->load($id);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $targetPost = $activity->target == $my->id;
     $allowEdit = COwnerHelper::isCommunityAdmin() || ($ownPost || $targetPost) && !empty($my->id);
     $value = trim($value);
     if (empty($value)) {
         $json['error'] = JText::_('COM_COMMUNITY_CANNOT_EDIT_COMMENT_ERROR');
     } else {
         if ($config->get('wallediting') && $allowEdit) {
             $params = new CParameter($wall->params);
             //if photo id is not 0, this wall is appended with a picture
             if ($photoId > 0 && $params->get('attached_photo_id') != $photoId) {
                 //lets check if the photo belongs to the uploader
                 $photo = JTable::getInstance('Photo', 'CTable');
                 $photo->load($photoId);
                 if ($photo->creator == $my->id && $photo->albumid == '-1') {
                     $params->set('attached_photo_id', $photoId);
                     //sets the status to ready so that it wont be deleted on cron run
                     $photo->status = 'ready';
                     $photo->store();
                 }
             } else {
                 if ($photoId == -1) {
                     //if there is nothing, remove the param if applicable
                     //delete from db and files
                     $photoModel = CFactory::getModel('photos');
                     $photoTable = $photoModel->getPhoto($params->get('attached_photo_id'));
                     $photoTable->delete();
                     $params->set('attached_photo_id', 0);
                 }
             }
             $wall->params = $params->toString();
             $wall->comment = $value;
             $wall->store();
             $CComment = new CComment();
             $value = $CComment->stripCommentData($value);
             // Need to perform basic formatting here
             // 1. support nl to br,
             // 2. auto-link text
             $CTemplate = new CTemplate();
             $value = $origValue = $CTemplate->escape($value);
             $value = CStringHelper::autoLink($value);
             $value = nl2br($value);
             $value = CUserHelper::replaceAliasURL($value);
             $value = CStringHelper::getEmoticon($value);
             $json['comment'] = $value;
             $json['originalComment'] = $origValue;
             // $objResponse->addScriptCall("joms.jQuery('div[data-commentid=" . $id . "] .cStream-Content span.comment').html", $value);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").val', $origValue);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").removeData', 'initialized');
             // if ($photoId == -1) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "none").attr("data-no_thumb", 1);');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail").html', '<img/>');
             // } else if ($photoId != 0) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-fetch-wrapper").remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-content] .cStream-Meta").before', '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . JUri::root(true) ."/". $photo->thumbnail . '" /></div>');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "block").removeAttr("data-no_thumb");');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail img").attr("src", "' . JUri::root(true) ."/". $photo->thumbnail . '").attr("data-photo_id", "0").data("photo_id", 0);');
             // }
         } else {
             $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT');
         }
     }
     if (!isset($json['error'])) {
         $json['success'] = true;
     }
     die(json_encode($json));
 }
示例#7
0
        //$key indicates the group id
        foreach ($groups as $key => $groupPost) {
            $groupId = $key;
            $groupname = CStringHelper::escape($groupPost[0]->groupname);
            $grouplink = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
            ?>

    	    <h4><?php 
            echo $groupname;
            ?>
</h4>

            	<?php 
            foreach ($groupPost as $post_info) {
                $user = CFactory::getUser($post_info->actor);
                $comment = CComment::stripCommentData($post_info->title);
                $comment = JString::substr($comment, 0, $charactersCount);
                $comment .= $charactersCount > JString::strlen($comment) ? '' : '...';
                $comment = CUserHelper::replaceAliasURL($comment);
                ?>
            	<div class="joms-stream__header wide ">
            		<div class= "joms-avatar--stream">
                        <a title="<?php 
                echo $user->getDisplayName();
                ?>
" href="<?php 
                echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
                ?>
">
            				<img src="<?php 
                echo $user->getThumbAvatar();
示例#8
0
 public static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     $config = CFactory::getConfig();
     $groupModel = CFactory::getModel('groups');
     if ($action == CGroupsAction::DISCUSSION_CREATE) {
         // Old discussion might not have 'action', and we can't display their
         // discussion summary
         $topicId = $param->get('topic_id', false);
         if ($topicId) {
             $group = JTable::getInstance('Group', 'CTable');
             $discussion = JTable::getInstance('Discussion', 'CTable');
             $group->load($act->cid);
             $discussion->load($topicId);
             $discussion->message = strip_tags($discussion->message);
             $topic = CStringHelper::escape($discussion->message);
             $tmpl = new CTemplate();
             $tmpl->set('comment', JString::substr($topic, 0, $config->getInt('streamcontentlength')));
             $html = $tmpl->fetch('activity.groups.discussion.create');
         }
         return $html;
     } else {
         if ($action == CGroupsAction::WALLPOST_CREATE) {
             // a new wall post for group
             // @since 1.8
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($act->cid);
             $wallModel = CFactory::getModel('Wall');
             $wall = JTable::getInstance('Wall', 'CTable');
             $my = CFactory::getUser();
             // make sure the group is a public group or current use is
             // a member of the group
             if ($group->approvals == 0 || $group->isMember($my->id)) {
                 //CFactory::load( 'libraries' , 'comment' );
                 $wall->load($param->get('wallid'));
                 $comment = strip_tags($wall->comment, '<comment>');
                 $comment = CComment::stripCommentData($comment);
                 $tmpl = new CTemplate();
                 $tmpl->set('comment', JString::substr($comment, 0, $config->getInt('streamcontentlength')));
                 $html = $tmpl->fetch('activity.groups.wall.create');
             }
             return $html;
         } else {
             if ($action == CGroupsAction::DISCUSSION_REPLY) {
                 // @since 1.8
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($act->cid);
                 $wallModel = CFactory::getModel('Wall');
                 $wall = JTable::getInstance('Wall', 'CTable');
                 $my = CFactory::getUser();
                 // make sure the group is a public group or current use is
                 // a member of the group
                 if ($group->approvals == 0 || $group->isMember($my->id)) {
                     $wallid = $param->get('wallid');
                     //CFactory::load( 'libraries' , 'wall' );
                     $html = CWallLibrary::getWallContentSummary($wallid);
                 }
                 return $html;
             } else {
                 if ($action == CGroupsAction::CREATE) {
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($act->cid);
                     $tmpl = new CTemplate();
                     $tmpl->set('group', $group);
                     $html = $tmpl->fetch('activity.groups.create');
                 }
             }
         }
     }
     return $html;
 }
示例#9
0
 /**
  * Return formatted comment given the wall item
  */
 public static function formatComment($wall)
 {
     CFactory::load('helpers', 'owner');
     $my = CFactory::getUser();
     // Save processing time
     if (!$wall->comment) {
         return '';
     }
     // strip out the comment data
     CFactory::load('libraries', 'comment');
     $wall->comment = CComment::stripCommentData($wall->comment);
     // Need to perform basic formatting here
     // 1. support nl to br,
     // 2. auto-link text
     CFactory::load('helpers', 'linkgenerator');
     $wall->comment = CTemplate::escape($wall->comment);
     $wall->comment = CLinkGeneratorHelper::replaceURL($wall->comment);
     $wall->comment = nl2br($wall->comment);
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $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);
     // Only site admin, or wall author can remove it
     // @todo: the target stream activity should also be able to delete it
     if (COwnerHelper::isCommunityAdmin() || $my->id == $wall->post_by) {
         $commentsHTML .= ' <span class="wall-coc-remove-link">&#x2022; <a onclick="joms.miniwall.remove(' . $wall->id . ');" href="#removeThisComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>';
     }
     $commentsHTML .= '</span>';
     $commentsHTML .= '</div>';
     return $commentsHTML;
 }
示例#10
0
文件: system.php 项目: bizanto/Hooked
 public function ajaxUpdateWall($wallId, $message, $editableFunc)
 {
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     if (empty($message)) {
         $objResponse->addScriptCall('alert', JText::_('CC EMPTY MESSAGE'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'wall');
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO EDIT'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'comment');
     // We don't want to touch the comments data.
     $comments = CComment::getRawCommentsData($wall->comment);
     $wall->comment = $message;
     $wall->comment .= $comments;
     $my = CFactory::getUser();
     $data = CWallLibrary::saveWall($wall->contentid, $wall->comment, $wall->type, $my, false, $editableFunc, 'wall.content', $wall->id);
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('joms.walls.update', $wall->id, $data->content);
     return $objResponse->sendResponse();
 }
示例#11
0
 public function ajaxUpdateWall($wallId, $message, $editableFunc)
 {
     $filter = JFilterInput::getInstance();
     $wallId = $filter->clean($wallId, 'int');
     $editableFunc = $filter->clean($editableFunc, 'string');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     if (empty($message)) {
         $objResponse->addScriptCall('alert', JText::_('COM_COMMUNITY_EMPTY_MESSAGE'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'wall');
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $response->addScriptCall('cWindowAddContent', JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT'));
         return $objResponse->sendResponse();
     }
     CFactory::load('libraries', 'comment');
     // We don't want to touch the comments data.
     $comments = CComment::getRawCommentsData($wall->comment);
     $wall->comment = $message;
     $wall->comment .= $comments;
     $my = CFactory::getUser();
     $data = CWallLibrary::saveWall($wall->contentid, $wall->comment, $wall->type, $my, false, $editableFunc, 'wall.content', $wall->id);
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('joms.walls.update', $wall->id, $data->content);
     return $objResponse->sendResponse();
 }