示例#1
0
文件: photos.php 项目: bizanto/Hooked
 public function ajaxRemovePhotoTag($photoId, $userId)
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $my = CFactory::getUser();
     $response = new JAXResponse();
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($photoId);
     if ($my->id != $userId && $my->id != $photo->creator) {
         $response->addScriptCall('alert', JText::_('ACCESS FORBIDDEN'));
         return $response->sendResponse();
     }
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     if (!$tagging->removeTag($photoId, $userId)) {
         $html = $tagging->getError();
         $response->addScriptCall('cWindowShow', '', 'Notice', 450, 200, 'warning');
         $response->addAssign('cWindowContent', 'innerHTML', $html);
     }
     return $response->sendResponse();
 }
示例#2
0
文件: photos.php 项目: Jougito/DynWeb
 public function ajaxRemovePhotoTag($photoId, $userId)
 {
     $filter = JFilterInput::getInstance();
     $photoId = $filter->clean($photoId, 'int');
     $userId = $filter->clean($userId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $my = CFactory::getUser();
     $json = array();
     $taggedUser = CFactory::getUser($userId);
     if (!$my->authorise('community.remove', 'photos.tag.' . $photoId, $taggedUser)) {
         $json['error'] = JText::_('ACCESS FORBIDDEN');
         die(json_encode($json));
     }
     $tagging = new CPhotoTagging();
     if (!$tagging->removeTag($photoId, $userId)) {
         $json['error'] = $tagging->getError();
         die(json_encode($json));
     }
     $json['success'] = true;
     die(json_encode($json));
 }
示例#3
0
 public function ajaxRemovePhotoTag($photoId, $userId)
 {
     $filter = JFilterInput::getInstance();
     $photoId = $filter->clean($photoId, 'int');
     $userId = $filter->clean($userId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $my = CFactory::getUser();
     $response = new JAXResponse();
     if (!$my->authorise('community.remove', 'photos.tag.' . $photoId)) {
         $response->addScriptCall('alert', JText::_('ACCESS FORBIDDEN'));
         return $response->sendResponse();
     }
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     if (!$tagging->removeTag($photoId, $userId)) {
         $html = $tagging->getError();
         $response->addScriptCall('cWindowShow', '', JText::_('COM_COMMUNITY_NOTICE'), 450, 200, 'warning');
         $reponse->addAssign('cWindowAddContent', $html);
     }
     return $response->sendResponse();
 }