コード例 #1
0
ファイル: photo_bridge.php プロジェクト: vazahat/dudex
 /**
  * Returns class instance
  *
  * @return UTAGS_CLASS_PhotoBridge
  */
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
コード例 #2
0
ファイル: newsfeed_bridge.php プロジェクト: vazahat/dudex
 public function onTagAdd(OW_Event $event)
 {
     $params = $event->getParams();
     /*@var $tag UTAGS_BOL_Tag */
     $tag = $params['tag'];
     $tagData = $tag->getData();
     $language = OW::getLanguage();
     $userId = $tag->userId;
     $photoOwnerId = UTAGS_CLASS_PhotoBridge::getInstance()->getPhotoOwnerId($tag->photoId);
     $photoOwnerMode = $userId == $photoOwnerId;
     $userTag = $tag->entityType == UTAGS_BOL_Service::ENTITY_TYPE_USER;
     $userIds = array($userId, $photoOwnerId);
     if ($userTag) {
         $userIds[] = $tag->entityId;
     }
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds, true, true, true, false);
     $assignVars = array('user' => '<a href="' . $avatars[$userId]['url'] . '">' . $avatars[$userId]['title'] . '</a>');
     $assignVars["photoOwner"] = '<a href="' . $avatars[$photoOwnerId]['url'] . '">' . $avatars[$photoOwnerId]['title'] . '</a>';
     if ($userTag) {
         $assignVars["taggedUser"] = '******' . $avatars[$tag->entityId]['url'] . '">' . $avatars[$tag->entityId]['title'] . '</a>';
         $feed = array("feedType" => "user", "feedId" => $tag->entityId);
         if ($photoOwnerId == $tag->userId) {
             $langKey = 'utags+newsfeed_owner_user_tag';
             if ($tag->entityId == $tag->userId) {
                 $langKey = 'utags+newsfeed_owner_themselves_tag';
                 $feed = null;
             }
         } else {
             if ($photoOwnerId == $tag->entityId) {
                 $langKey = 'utags+newsfeed_user_photo_user_tagged';
             } else {
                 $langKey = 'utags+newsfeed_user_tagged';
             }
         }
         $this->addActivity(self::TYPE_USER_TAG, NEWSFEED_BOL_Service::VISIBILITY_FULL, $tag, $tag->userId, array("key" => $langKey, "vars" => $assignVars), $feed);
     } else {
         $tagUrl = OW::getRouter()->urlForRoute("view_tagged_photo_list", array("tag" => $tagData["data"]["text"]));
         $assignVars["tag"] = '<a href="' . $tagUrl . '">' . $tagData["data"]["text"] . '</a>';
         $feed = null;
         if ($photoOwnerId == $tag->userId) {
             $langKey = 'utags+newsfeed_owner_text_tag';
         } else {
             $langKey = 'utags+newsfeed_text_tagged';
             $feed = array("feedType" => "user", "feedId" => $photoOwnerId);
         }
         $this->addActivity(self::TYPE_TEXT_TAG, NEWSFEED_BOL_Service::VISIBILITY_FULL, $tag, $tag->userId, array("key" => $langKey, "vars" => $assignVars), $feed);
     }
 }
コード例 #3
0
 public function onTagAdd(OW_Event $event)
 {
     $params = $event->getParams();
     /*@var $tag UTAGS_BOL_Tag */
     $tag = $params['tag'];
     $tagData = $tag->getData();
     $userId = $tag->userId;
     $photoOwnerId = UTAGS_CLASS_PhotoBridge::getInstance()->getPhotoOwnerId($tag->photoId);
     $photoOwnerMode = $userId == $photoOwnerId;
     $userTag = $tag->entityType == UTAGS_BOL_Service::ENTITY_TYPE_USER;
     if ($photoOwnerMode && ($userTag && $userId == $tag->entityId || !$userTag)) {
         return;
     }
     $userIds = array($userId, $photoOwnerId);
     if ($userTag) {
         $userIds[] = $tag->entityId;
     }
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds, true, true, true, false);
     $assignVars = array('user' => '<a href="' . $avatars[$userId]['url'] . '">' . $avatars[$userId]['title'] . '</a>');
     if ($userTag) {
         $assignVars["taggedUser"] = '******' . $avatars[$tag->entityId]['url'] . '">' . $avatars[$tag->entityId]['title'] . '</a>';
         $assignVars["photoOwner"] = '<a href="' . $avatars[$photoOwnerId]['url'] . '">' . $avatars[$photoOwnerId]['title'] . '</a>';
         if ($photoOwnerMode) {
             $this->addNotification(self::TYPE_TAG_ME, self::ACTION_TAG_ME, $tag, $tag->entityId, $avatars[$userId], array('key' => 'utags+notifications_owner_tagged_you', 'vars' => $assignVars));
         } else {
             if ($photoOwnerId == $tag->entityId) {
                 $langKey = 'utags+notifications_tagged_you_on_your_photo';
             } else {
                 if ($tag->entityId == $tag->userId) {
                     $langKey = 'utags+notifications_tagged_himself_on_your_photo';
                 } else {
                     $langKey = 'utags+notifications_tagged_user_on_your_photo';
                 }
             }
             $this->addNotification(self::TYPE_TAG_MY_PHOTO, self::ACTION_TAG_MY_PHOTO, $tag, $photoOwnerId, $avatars[$userId], array('key' => $langKey, 'vars' => $assignVars));
             if ($photoOwnerId != $tag->entityId && $tag->userId != $tag->entityId) {
                 $this->addNotification(self::TYPE_TAG_ME, self::ACTION_TAG_ME, $tag, $tag->entityId, $avatars[$userId], array('key' => 'utags+notifications_user_tagged_you', 'vars' => $assignVars));
             }
         }
     } else {
         if (!$photoOwnerMode) {
             $tagUrl = OW::getRouter()->urlForRoute("view_tagged_photo_list", array("tag" => $tagData["data"]["text"]));
             $assignVars["tag"] = '<a href="' . $tagUrl . '">' . $tagData["data"]["text"] . '</a>';
             $this->addNotification(self::TYPE_TAG_MY_PHOTO, self::ACTION_TAG_MY_PHOTO, $tag, $photoOwnerId, $avatars[$userId], array('key' => 'utags+notifications_tagged_your_photo', 'vars' => $assignVars), $tagData["data"]["text"]);
         }
     }
 }
コード例 #4
0
ファイル: service.php プロジェクト: vazahat/dudex
 public function getTagsByPhotoId($photoId, $type = null)
 {
     $tagList = $this->tagDao->findByPhotoIdOrCopyPhotoId($photoId, $type);
     $photoOwnerId = UTAGS_CLASS_PhotoBridge::getInstance()->getPhotoOwnerId($photoId);
     $userId = OW::getUser()->getId();
     $userTags = array();
     foreach ($tagList as $tag) {
         $userTags[$tag->userId] = isset($userTags[$tag->userId]) ? $userTags[$tag->userId] : array();
         $userTags[$tag->userId][] = $tag;
     }
     $actions = @OW::getEventManager()->call("privacy_check_permission_for_user_list", array("action" => UTAGS_CLASS_PrivacyBridge::ACTION_VIEW_TAGS, "ownerIdList" => array_keys($userTags), "viewerId" => OW::getUser()->getId()));
     $out = array();
     $globalPermited = OW::getUser()->isAuthorized("utags", "view_tags");
     $moderatorPermited = OW::getUser()->isAuthorized("utags");
     foreach ($tagList as $tag) {
         $permited = false;
         /*@var $tag UTAGS_BOL_Tag */
         if ($moderatorPermited) {
             $permited = true;
         } else {
             if ($tag->userId == $userId || $photoOwnerId == $userId || $tag->entityType == self::ENTITY_TYPE_USER && $tag->entityId == $userId) {
                 $permited = true;
             } else {
                 if (!$actions[$tag->userId]["blocked"]) {
                     $permited = true;
                 } else {
                     $permited = $globalPermited;
                 }
             }
         }
         if ($permited) {
             $out[] = $tag;
         }
     }
     return $out;
 }
コード例 #5
0
ファイル: ajax.php プロジェクト: vazahat/dudex
 private function deleteTags($params)
 {
     $photoId = $params["photoId"];
     $tagIds = $params["tagIds"];
     $clonnedPhoto = false;
     foreach ($tagIds as $tagId) {
         $tag = $this->service->findTagById($tagId);
         if ($tag->copyPhotoId == $photoId) {
             $clonnedPhoto = true;
         }
         $this->service->deleteTagById($tagId);
     }
     return array("list" => $this->renderTagList($photoId), "customList" => UTAGS_CLASS_PhotoBridge::getInstance()->getTagCloudHtml($photoId), "clearCache" => true, "close" => $clonnedPhoto, "refresh" => $clonnedPhoto);
 }
コード例 #6
0
ファイル: plugin.php プロジェクト: vazahat/dudex
 public function init()
 {
     OW::getRouter()->addRoute(new OW_Route('utags-settings-page', 'admin/plugins/photo-tags', 'UTAGS_CTRL_Admin', 'index'));
     OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'addAuthLabels'));
     if (!UTAGS_CLASS_PhotoBridge::getInstance()->isActive()) {
         OW::getEventManager()->bind('admin.add_admin_notification', array($this, 'collectAdminNotifications'));
         return;
     }
     UTAGS_CLASS_BaseBridge::getInstance()->init();
     UTAGS_CLASS_FriendsBridge::getInstance()->init();
     UTAGS_CLASS_PhotoBridge::getInstance()->init();
     UTAGS_CLASS_NotificationsBridge::getInstance()->init();
     UTAGS_CLASS_NewsfeedBridge::getInstance()->init();
     UTAGS_CLASS_PrivacyBridge::getInstance()->init();
     UTAGS_CLASS_CreditsBridge::getInstance()->init();
     UTAGS_CLASS_TagsBridge::getInstance()->init();
     OW::getEventManager()->bind(OW_EventManager::ON_FINALIZE, array($this, "onFinalize"));
 }