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(); }
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(); }