Exemple #1
0
 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();
 }
Exemple #2
0
 public function ajaxUpdateWall($wallId, $message, $editableFunc, $photoId = 0)
 {
     $filter = JFilterInput::getInstance();
     $wallId = $filter->clean($wallId, 'int');
     $editableFunc = $filter->clean($editableFunc, 'string');
     $wall = JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     $json = array();
     if (empty($message)) {
         $json['error'] = JText::_('COM_COMMUNITY_EMPTY_MESSAGE');
         die(json_encode($json));
     }
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT');
         die(json_encode($json));
     }
     // 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, $photoId);
     $wall->originalComment = $wall->comment;
     $CComment = new CComment();
     $wall->comment = $CComment->stripCommentData($wall->comment);
     $wall->comment = CStringHelper::autoLink($wall->comment);
     $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
     $json['success'] = true;
     $json['comment'] = $wall->comment;
     $json['originalComment'] = $wall->originalComment;
     die(json_encode($json));
 }
Exemple #3
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();
 }