Exemplo n.º 1
0
 public function onAddProfileContentMenu(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['userId'])) {
         return;
     }
     $userId = (int) $params['userId'];
     $lang = OW::getLanguage();
     $linkId = uniqid('photo');
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $exclude = array();
     $newsfeedAlbum = $albumService->getNewsfeedAlbum($userId);
     if ($newsfeedAlbum !== null) {
         $exclude[] = $newsfeedAlbum->id;
     }
     if (!$albumService->countUserAlbums($userId, $exclude)) {
         return;
     }
     $albumList = $albumService->findUserAlbumList($userId, 1, 1, $exclude);
     $cover = !empty($albumList[0]['cover']) ? $albumList[0]['cover'] : null;
     $username = BOL_UserService::getInstance()->getUserName($userId);
     $url = OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $username));
     $resultArray = array(BASE_MCMP_ProfileContentMenu::DATA_KEY_LABEL => $lang->text('photo', 'user_photo_albums_widget'), BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_HREF => $url, BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_ID => $linkId, BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_CLASS => 'owm_profile_nav_photo', BASE_MCMP_ProfileContentMenu::DATA_KEY_THUMB => $cover);
     $event->add($resultArray);
 }
Exemplo n.º 2
0
 public function getNewItems(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params['page'] == self::CONSOLE_PAGE_KEY) {
         $event->add(array(self::CONSOLE_SECTION_KEY => new FRIENDS_MCMP_ConsoleNewItems($params['timestamp'])));
     }
 }
Exemplo n.º 3
0
 public function getNewInvitations(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params['page'] == self::CONSOLE_NOTIFICATIONS_PAGE_KEY) {
         $event->add(array(self::CONSOLE_INVITATIONS_SECTION_KEY => new BASE_MCMP_ConsoleNewInvitations($params['timestamp'])));
     }
 }
Exemplo n.º 4
0
function socialsharing_get_sharing_buttons(BASE_CLASS_EventCollector $event)
{
    $params = $event->getParams();
    $entityId = !empty($params['entityId']) ? $params['entityId'] : null;
    $entityType = !empty($params['entityType']) ? $params['entityType'] : null;
    if (!empty($entityId) && !empty($entityType)) {
        $sharingInfoEvent = new OW_Event('socialsharing.get_entity_info', $params, $params);
        OW::getEventManager()->trigger($sharingInfoEvent);
        $data = $sharingInfoEvent->getData();
        $params = array_merge($params, $data);
    }
    $display = isset($params['display']) ? $params['display'] : true;
    if (!$display) {
        return;
    }
    $url = !empty($params['url']) ? $params['url'] : null;
    $description = !empty($params['description']) ? $params['description'] : OW::getDocument()->getDescription();
    $title = !empty($params['title']) ? $params['title'] : OW::getDocument()->getTitle();
    $image = !empty($params['image']) ? $params['image'] : null;
    $class = !empty($params['class']) ? $params['class'] : null;
    $displayBlock = false;
    //isset($params['displayBlock']) ? $params['displayBlock'] : true;
    $cmp = new SOCIALSHARING_CMP_ShareButtons();
    $cmp->setCustomUrl($url);
    $cmp->setDescription($description);
    $cmp->setTitle($title);
    $cmp->setImageUrl($image);
    $cmp->setDisplayBlock($displayBlock);
    if (!empty($class)) {
        $cmp->setBoxClass($class);
    }
    $event->add($cmp->render());
}
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $snippet = new SNIPPETS_CMP_Snippet(self::WIDGET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_virtual_gifts_preview"));
         $snippet->setIconClass("ow_ic_birthday");
         $event->add($snippet);
         return;
     }
     $service = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance();
     $total = $service->countUserReceivedGifts($userId);
     $list = $service->findUserReceivedGifts($userId, 1, 4);
     if (empty($list)) {
         return;
     }
     $images = array();
     foreach ($list as $gift) {
         $images[] = $gift["imageUrl"];
     }
     $dispslayType = count($images) > 1 ? SNIPPETS_CMP_Snippet::DISPLAY_TYPE_4 : SNIPPETS_CMP_Snippet::DISPLAY_TYPE_1;
     $url = OW::getRouter()->urlForRoute('virtual_gifts_user_list', array("userName" => BOL_UserService::getInstance()->getUserName($userId)));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_virtual_gifts", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $snippet->setDisplayType($dispslayType);
     $event->add($snippet);
 }
Exemplo n.º 6
0
 public function onCollectProfileActions(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $userId = $params['userId'];
     if (!OW::getUser()->isAuthenticated() || OW::getUser()->getId() == $userId) {
         return;
     }
     $activeModes = MAILBOX_BOL_ConversationService::getInstance()->getActiveModeList();
     if (!in_array('mail', $activeModes)) {
         return;
     }
     $linkId = uniqid('send_message');
     $script = UTIL_JsGenerator::composeJsString('
         $("#' . $linkId . '").click(function()
         {
             if ( {$isBlocked} )
             {
                 OWM.error({$blockError});
                 return false;
             }
         });
     ', array('isBlocked' => BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId), 'blockError' => OW::getLanguage()->text('base', 'user_block_message')));
     OW::getDocument()->addOnloadScript($script);
     $event->add(array("label" => OW::getLanguage()->text('mailbox', 'send_message'), "href" => OW::getRouter()->urlForRoute('mailbox_compose_mail_conversation', array('opponentId' => $userId)), "id" => $linkId));
 }
Exemplo n.º 7
0
 public function trackVisit(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['userId'])) {
         return;
     }
     $userId = (int) $params['userId'];
     $viewerId = OW::getUser()->getId();
     SKAPI_BOL_Service::getInstance()->trackVisit($userId, $viewerId);
 }
Exemplo n.º 8
0
 public function onCollectButtonsConfig(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $label = OW::getLanguage()->text("newsfeed", "follow_button");
     $active = HINT_BOL_Service::getInstance()->isActionActive(HINT_BOL_Service::ENTITY_TYPE_USER, "follow");
     $button = array("key" => "follow", "active" => $active === null ? true : $active, "label" => $label);
     $event->add($button);
 }
Exemplo n.º 9
0
 public function onSend(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $recipients = $params["recipients"];
     foreach ($recipients as $r) {
         list($prefix, $id) = explode("_", $r);
         if ($prefix == self::ID_PREFIX) {
             $event->add($id);
         }
     }
 }
Exemplo n.º 10
0
 public function onCollectButtonsConfig(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $label = OW::getLanguage()->text("virtualgifts", "profile_toolbar_item_send_gift");
     $active = HINT_BOL_Service::getInstance()->isActionActive(HINT_BOL_Service::ENTITY_TYPE_USER, "virtualgift");
     $button = array("key" => "virtualgift", "active" => $active === null ? true : $active, "label" => $label);
     $event->add($button);
 }
Exemplo n.º 11
0
 public function sendList(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $userIdList = $params['userIdList'];
     $notifications = $this->service->findNotificationListForSend($userIdList);
     $notificationIds = array();
     foreach ($notifications as $notification) {
         $event->add(array('pluginKey' => $notification->pluginKey, 'entityType' => $notification->entityType, 'entityId' => $notification->entityId, 'userId' => $notification->userId, 'action' => $notification->action, 'time' => $notification->timeStamp, 'viewed' => (bool) $notification->viewed, 'data' => $notification->getData()));
         $notificationIds[] = $notification->id;
     }
     $this->service->markNotificationsSentByIds($notificationIds);
 }
Exemplo n.º 12
0
/**
 * Copyright (c) 2014, Skalfa LLC
 * All rights reserved.
 * 
 * ATTENTION: This commercial software is intended for exclusive use with SkaDate Dating Software (http://www.skadate.com) and is licensed under SkaDate Exclusive License by Skalfa LLC.
 * 
 * Full text of this license can be found at http://www.skadate.com/sel.pdf
 */
function pcgallery_get_content(BASE_CLASS_EventCollector $event)
{
    $params = $event->getParams();
    if ($params['placeName'] != "profile") {
        return;
    }
    if (!PCGALLERY_CLASS_PhotoBridge::getInstance()->isActive()) {
        return;
    }
    $cmp = new PCGALLERY_CMP_Gallery($params['entityId']);
    $event->add($cmp->render());
}
Exemplo n.º 13
0
 public function trackVisit(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['entityId']) || empty($params['placeName']) || $params['placeName'] != 'profile') {
         return;
     }
     $userId = (int) $params['entityId'];
     $viewerId = OW::getUser()->getId();
     if ($userId && $viewerId && $viewerId != $userId) {
         OCSGUESTS_BOL_Service::getInstance()->trackVisit($userId, $viewerId);
     }
 }
Exemplo n.º 14
0
 public function onCollectProfileActions(BASE_CLASS_EventCollector $event)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $params = $event->getParams();
     $targetUserID = $params['userId'];
     if (empty($targetUserID) || $targetUserID == OW::getUser()->getId() || !OW::getAuthorization()->isUserAuthorized($targetUserID, 'credits', 'receive')) {
         return;
     }
     $linkId = 'credits' . rand(10, 1000000);
     $event->add(array("label" => OW::getLanguage()->text('credits', 'profile_label_send'), "href" => OW::getRouter()->urlFor('CREDITS_MCTRL_Action', 'send', array('id' => $targetUserID)), "id" => $linkId));
 }
Exemplo n.º 15
0
 public function onProfilePageRender(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['entityId']) || empty($params['placeName']) || $params['placeName'] != 'profile') {
         return;
     }
     $userId = (int) $params['entityId'];
     $viewerId = OW::getUser()->getId();
     $authService = BOL_AuthorizationService::getInstance();
     $isAdmin = $authService->isActionAuthorizedForUser($viewerId, 'admin') || $authService->isActionAuthorizedForUser($viewerId, 'base');
     if ($userId && $viewerId && $viewerId != $userId && !$isAdmin) {
         OCSGUESTS_BOL_Service::getInstance()->trackVisit($userId, $viewerId);
     }
 }
Exemplo n.º 16
0
function credits_members_action_tool(BASE_CLASS_EventCollector $event)
{
    if (!OW::getUser()->isAuthenticated()) {
        return;
    }
    $params = $event->getParams();
    $targetUserID = $params['userId'];
    if (empty($targetUserID) || $targetUserID == OW::getUser()->getId() || !OW::getAuthorization()->isUserAuthorized($targetUserID, 'credits', 'receive')) {
        return;
    }
    $user = BOL_UserService::getInstance()->getUserName((int) $targetUserID);
    $linkId = 'credits' . rand(10, 1000000);
    $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => OW::getLanguage()->text('credits', 'profile_label_send'), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => OW::getRouter()->urlFor('CREDITS_CTRL_Action', 'send', array('id' => $targetUserID)), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId);
    $event->add($resultArray);
}
Exemplo n.º 17
0
 public function onSearch(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $kw = $params["kw"];
     $userId = $params["userId"];
     if ($kw === null) {
         $userIds = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => $userId, 'first' => 0, 'count' => 200));
         $userIds = empty($userIds) ? array() : $userIds;
     } else {
         $userIds = $this->findUsers($kw, $userId);
     }
     $data = $this->buildData($userIds, OW::getLanguage()->text('utags', 'selector_group_friends'), array($userId));
     foreach ($data as $item) {
         $event->add($item);
     }
 }
Exemplo n.º 18
0
 public function onCollectButtonsConfig(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $label = OW::getLanguage()->text('mailbox', 'create_conversation_button');
     $active = HINT_BOL_Service::getInstance()->isActionActive(HINT_BOL_Service::ENTITY_TYPE_USER, "mcompose");
     $mcomposeInstalled = $this->isActive();
     $button = array("key" => "mcompose", "active" => $active === null ? $mcomposeInstalled : $active, "label" => $label);
     if (!$mcomposeInstalled) {
         $button["requirements"]["short"] = OW::getLanguage()->text("hint", "mcompose_required_short", array("plugin" => '<a href="' . self::PLUGIN_URL . '" target="_blank">' . self::PLUGIN_TITLE . '</a>'));
         $button["requirements"]["long"] = OW::getLanguage()->text("hint", "mcompose_required_long", array("plugin" => '<a href="' . self::PLUGIN_URL . '" target="_blank">' . self::PLUGIN_TITLE . '</a>', "feature" => $label));
     }
     $event->add($button);
 }
Exemplo n.º 19
0
 public function sendGiftActionTool(BASE_CLASS_EventCollector $event)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $params = $event->getParams();
     if (empty($params['userId']) || $params['userId'] == OW::getUser()->getId()) {
         return;
     }
     $linkId = uniqid('toolbar-send-gift-');
     $lang = OW::getLanguage();
     $user = BOL_UserService::getInstance()->getUserName((int) $params['userId']);
     if (BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), (int) $params['userId'])) {
         $script = '$("#' . $linkId . '").click(function(){
             window.OW.error(' . json_encode($lang->text('base', 'user_block_message')) . ');
         });
         ';
     } else {
         if (!OW::getUser()->isAuthorized('virtualgifts', 'send_gift')) {
             $status = BOL_AuthorizationService::getInstance()->getActionStatus('virtualgifts', 'send_gift');
             if ($status['status'] != BOL_AuthorizationService::STATUS_PROMOTED) {
                 return;
             }
             $script = '$("#' . $linkId . '").click(function(){
                 OW.authorizationLimitedFloatbox(' . json_encode($status['msg']) . ');
             });
             ';
         } else {
             $title = $lang->text('virtualgifts', 'send_gift_to', array('user' => $user));
             $script = '$("#' . $linkId . '").click(function(){
                 sendGiftFloatBox = OW.ajaxFloatBox(
                     "VIRTUALGIFTS_CMP_SendGift",
                     { recipientId: ' . $params['userId'] . ' },
                     { width : 580, title: ' . json_encode($title) . '}
                 );
             });
             ';
         }
     }
     if (!empty($script)) {
         OW::getDocument()->addOnloadScript($script);
     }
     $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => $lang->text('virtualgifts', 'profile_toolbar_item_send_gift'), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => 'javascript://', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId, BASE_CMP_ProfileActionToolbar::DATA_KEY_ITEM_KEY => "virtualgifts.send_gift", BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ORDER => 4);
     $event->add($resultArray);
 }
Exemplo n.º 20
0
 public function onCollectProfileActionToolbarItem(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['userId'])) {
         return;
     }
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $userId = (int) $params['userId'];
     $linkId = 'gi' . rand(10, 1000000);
     $creditsService = USERCREDITS_BOL_CreditsService::getInstance();
     $balance = $creditsService->getCreditsBalance($userId);
     if (OW::getUser()->isAuthorized('usercredits')) {
         $label = OW::getLanguage()->text('usercredits', 'profile_toolbar_item_credits', array('credits' => $balance));
         $script = '$("#' . $linkId . '").click(function(){
         document.setCreditsFloatBox = OW.ajaxFloatBox(
             "USERCREDITS_CMP_SetCredits",
             { userId: ' . $userId . ' },
             { width: 300, title: "' . $label . '" }
         );
         });';
     } else {
         if ($params['userId'] == OW::getUser()->getId()) {
             return;
         }
         $grantorBalance = $creditsService->getCreditsBalance(OW::getUser()->getId());
         $label = OW::getLanguage()->text('usercredits', 'profile_toolbar_grant');
         if ($grantorBalance) {
             $script = '$("#' . $linkId . '").click(function(){
             document.grantCreditsFloatBox = OW.ajaxFloatBox(
                 "USERCREDITS_CMP_GrantCredits",
                 { userId: ' . $userId . ' },
                 { width: 400, title: "' . $label . '" }
             );
             });';
         }
     }
     if (!empty($script)) {
         OW::getDocument()->addOnloadScript($script);
         $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => $label, BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => 'javascript://', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId);
         $event->add($resultArray);
     }
 }
Exemplo n.º 21
0
 public function onSearch(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     $kw = $params["kw"];
     $userId = $params["userId"];
     $userIds = array();
     if ($kw === null) {
         $users = BOL_UserService::getInstance()->findList(0, 200);
         foreach ($users as $u) {
             $userIds[] = $u->id;
         }
     } else {
         $userIds = $this->findUsers($kw);
     }
     $data = $this->buildData($userIds, OW::getLanguage()->text('utags', 'selector_group_other'));
     foreach ($data as $item) {
         $event->add($item);
     }
 }
Exemplo n.º 22
0
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $snippet = new SNIPPETS_CMP_Snippet(self::SNIPPET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_friends_preview"));
         $snippet->setIconClass("ow_ic_friends");
         $event->add($snippet);
         return;
     }
     $eventParams = array('action' => 'friends_view', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $exception) {
         return;
     }
     $data = OW::getEventManager()->call("plugin.friends.get_friend_list", array("userId" => $userId, "offset" => 0, "count" => 4));
     $total = OW::getEventManager()->call("plugin.friends.count_friends", array("userId" => $userId));
     if (empty($data)) {
         return;
     }
     $users = BOL_AvatarService::getInstance()->getDataForUserAvatars($data, true, false, false, false);
     $images = array();
     foreach ($users as $user) {
         $images[] = $user["src"];
     }
     $dispslayType = count($images) > 1 ? SNIPPETS_CMP_Snippet::DISPLAY_TYPE_4 : SNIPPETS_CMP_Snippet::DISPLAY_TYPE_1;
     $userName = BOL_UserService::getInstance()->getUserName($userId);
     $url = OW::getRouter()->urlForRoute('friends_user_friends', array('user' => $userName));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_friends", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $snippet->setDisplayType($dispslayType);
     $event->add($snippet);
 }
Exemplo n.º 23
0
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $service = EVENT_BOL_EventService::getInstance();
     $snippet = new SNIPPETS_CMP_Snippet(self::SNIPPET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_events_preview"));
         $snippet->setIconClass("ow_ic_calendar");
         $event->add($snippet);
         return;
     }
     // Privacy check
     $eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $exception) {
         return;
     }
     $list = $service->findUserParticipatedPublicEvents($userId, 1, 3);
     $total = $service->findUserParticipatedPublicEventsCount($userId);
     if (empty($list)) {
         return;
     }
     $images = array();
     foreach ($list as $eventItem) {
         $images[] = $eventItem->getImage() ? $service->generateImageUrl($eventItem->getImage(), true) : $service->generateDefaultImageUrl();
     }
     $url = OW::getRouter()->urlForRoute("event.view_event_list", array("list" => "user-participated-events"));
     $url = OW::getRequest()->buildUrlQueryString($url, array("userId" => $userId));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_events", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $event->add($snippet);
 }
Exemplo n.º 24
0
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $snippet = new SNIPPETS_CMP_Snippet(self::WIDGET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_video_preview"));
         $snippet->setIconClass("ow_ic_video");
         $event->add($snippet);
         return;
     }
     // Privacy check
     $eventParams = array('action' => "video_view_video", 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $exception) {
         return;
     }
     $service = VIDEO_BOL_ClipService::getInstance();
     $total = $service->findUserClipsCount($userId);
     $list = $service->findUserClipsList($userId, 1, 3);
     if (empty($list)) {
         return;
     }
     $images = array();
     foreach ($list as $clip) {
         $images[] = $clip["thumb"];
     }
     $url = OW::getRouter()->urlForRoute("video_user_video_list", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_video", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $event->add($snippet);
 }
Exemplo n.º 25
0
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $snippet = new SNIPPETS_CMP_Snippet(self::WIDGET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_photo_preview"));
         $snippet->setIconClass("ow_ic_picture");
         $event->add($snippet);
         return;
     }
     // Privacy check
     $eventParams = array('action' => "photo_view_album", 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $exception) {
         return;
     }
     $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId, "userId" => $userId, "offset" => 0, "limit" => 3));
     $total = OW::getEventManager()->call("photo.entity_photos_count", array("entityType" => "user", "entityId" => $userId, "userId" => $userId));
     if (empty($data) || empty($data["albums"])) {
         return;
     }
     $images = array();
     foreach ($data["albums"] as $album) {
         $images[] = $album["coverImage"];
     }
     $url = OW::getRouter()->urlForRoute("photo_user_albums", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_photos", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $event->add($snippet);
 }
Exemplo n.º 26
0
 public function sendGiftActionTool(BASE_CLASS_EventCollector $event)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $params = $event->getParams();
     if (empty($params['userId']) || $params['userId'] == OW::getUser()->getId()) {
         return;
     }
     $linkId = 'gi' . rand(10, 1000000);
     $user = BOL_UserService::getInstance()->getUserName((int) $params['userId']);
     if (BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), (int) $params['userId'])) {
         $script = "\$('#" . $linkId . "').click(function(){\n\n            window.OW.error('" . OW::getLanguage()->text('base', 'user_block_message') . "');\n\n        });";
         OW::getDocument()->addOnloadScript($script);
     } else {
         $script = '$("#' . $linkId . '").click(function(){
     sendGiftFloatBox = OW.ajaxFloatBox("VIRTUALGIFTS_CMP_SendGift", {recipientId: ' . $params['userId'] . ' } , {width:580, iconClass: "ow_ic_heart", title: "' . OW::getLanguage()->text('virtualgifts', 'send_gift_to', array('user' => $user)) . '"});
 });';
         OW::getDocument()->addOnloadScript($script);
     }
     $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => OW::getLanguage()->text('virtualgifts', 'profile_toolbar_item_send_gift'), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => 'javascript://', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId, BASE_CMP_ProfileActionToolbar::DATA_KEY_ITEM_KEY => "virtualgifts.send_gift");
     $event->add($resultArray);
 }
Exemplo n.º 27
0
 public function onCollectInfoConfigs(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     $event->add(array("key" => "base-gender-age", "label" => $language->text("hint", "info-gender-age-label")));
     $event->add(array("key" => "base-activity", "label" => $language->text("hint", "info-activity-label")));
     if ($params["line"] != HINT_BOL_Service::INFO_LINE0) {
         $event->add(array("key" => "base-about", "label" => $language->text("hint", "info-about-label")));
     }
     $event->add(array("key" => "base-question", "label" => $language->text("hint", "info-question-label")));
 }
 public function onCollectButtonsConfig(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $label = OW::getLanguage()->text('usercredits', 'profile_toolbar_grant');
     $active = HINT_BOL_Service::getInstance()->isActionActive(HINT_BOL_Service::ENTITY_TYPE_USER, "usercredits");
     $button = array("key" => "usercredits", "active" => $active === null ? false : $active, "label" => $label);
     $event->add($button);
 }
Exemplo n.º 29
0
 public function onCollectInfoConfigs(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if ($params["line"] != HINT_BOL_Service::INFO_LINE0) {
         $event->add(array("key" => "friends-list", "label" => OW::getLanguage()->text("hint", "info_friend_list_label")));
     }
 }
Exemplo n.º 30
0
 public function onActionToolbarAddDeleteActionTool(BASE_CLASS_EventCollector $event)
 {
     if (!OW::getUser()->isAuthorized('base')) {
         return;
     }
     $params = $event->getParams();
     if (empty($params['userId'])) {
         return;
     }
     if (BOL_AuthorizationService::getInstance()->isSuperModerator($params['userId'])) {
         return;
     }
     $userId = (int) $params['userId'];
     $callbackUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'userDeleted');
     $linkId = 'ud' . rand(10, 1000000);
     $script = UTIL_JsGenerator::newInstance()->jQueryEvent('#' . $linkId, 'click', 'OW.Users.deleteUser(e.data.userId, e.data.callbackUrl, false);', array('e'), array('userId' => $userId, 'callbackUrl' => $callbackUrl));
     OW::getDocument()->addOnloadScript($script);
     $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => OW::getLanguage()->text('base', 'profile_toolbar_user_delete_label'), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_CLASS => 'ow_mild_red', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => 'javascript://', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId, BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_GROUP_KEY => 'base.moderation', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_GROUP_LABEL => OW::getLanguage()->text('base', 'profile_toolbar_group_moderation'), BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ORDER => 5, BASE_CMP_ProfileActionToolbar::DATA_KEY_ITEM_KEY => "base.delete_user");
     $event->add($resultArray);
 }