'0', 'error' => Text::_('JINVALID_TOKEN') ); echo json_encode($response); return; } $app = Factory::getApplication(); $params = $app->getParams(); $commentValue = $app->input->get( 'commentValue', '', 'string' ); $commentId = $app->input->get( 'commentId', 0, 'int' );// ID of File $format = $app->input->get( 'format', '', 'string' ); $task = $app->input->get( 'task', '', 'string' ); $view = $app->input->get( 'view', '', 'string' ); $paramsC = ComponentHelper::getParams('com_phocagallery'); $param['display_comment_img'] = $paramsC->get( 'display_comment_img', 0 ); if ($task == 'refreshcomment' && ((int)$param['display_comment_img'] == 2 || (int)$param['display_comment_img'] == 3)) { $user = Factory::getUser(); //$view = J Request::get Var( 'view', '', 'get', '', J REQUEST_NOTRIM ); //$Itemid = J Request::get Var( 'Itemid', 0, '', 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); $post['imgid'] = (int)$commentId; $post['userid'] = $user->id; $post['comment'] = strip_tags($commentValue); if ($format != 'json') { $msg = Text::_('COM_PHOCAGALLERY_ERROR_WRONG_COMMENT') ; $response = array( 'status' => '0', 'error' => $msg); echo json_encode($response); return; } if ((int)$post['imgid'] < 1) { $msg = Text::_('COM_PHOCAGALLERY_ERROR_IMAGE_NOT_EXISTS'); $response = array( 'status' => '0', 'error' => $msg); echo json_encode($response); return; } $model = $this->getModel(); $checkUserComment = PhocaGalleryCommentImage::checkUserComment( $post['imgid'], $post['userid'] ); // User has already commented this category if ($checkUserComment) { $msg = Text::_('COM_PHOCAGALLERY_COMMENT_ALREADY_SUBMITTED'); $response = array( 'status' => '0', 'error' => '', 'message' => $msg); echo json_encode($response); return; } else { if ($access > 0 && $user->id > 0) { if(!$model->comment($post)) { $msg = Text::_('COM_PHOCAGALLERY_ERROR_COMMENTING_IMAGE'); $response = array( 'status' => '0', 'error' => $msg); echo json_encode($response); return; } else { $o = '