Example #1
0
 public function genericInit()
 {
     $em = OW::getEventManager();
     $em->bind(OW_EventManager::ON_USER_REGISTER, array($this, 'onUserRegister'));
     $em->bind(OW_EventManager::ON_USER_UNREGISTER, array($this, 'onUserUnregister'));
     $em->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, 'affiliateSystemEntry'));
 }
Example #2
0
 public function grantCredits()
 {
     if (!OW::getRequest()->isAjax()) {
         throw new Redirect404Exception();
     }
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $form = new USERCREDITS_CLASS_GrantCreditsForm();
     if ($form->isValid($_POST)) {
         $lang = OW::getLanguage();
         $creditService = USERCREDITS_BOL_CreditsService::getInstance();
         $grantorId = OW::getUser()->getId();
         $values = $form->getValues();
         $userId = (int) $values['userId'];
         $amount = abs((int) $values['amount']);
         $granted = $creditService->grantCredits($grantorId, $userId, $amount);
         $credits = $creditService->getCreditsBalance($grantorId);
         if ($granted) {
             $data = array('amount' => $amount, 'grantorId' => $grantorId, 'userId' => $userId);
             $event = new OW_Event('usercredits.grant', $data);
             OW::getEventManager()->trigger($event);
             $data = array('message' => $lang->text('usercredits', 'credits_granted', array('amount' => $amount)), 'credits' => $credits);
         } else {
             $data = array('error' => $lang->text('usercredits', 'credits_grant_error'));
         }
         exit(json_encode($data));
     }
 }
 public static function process($prefix, $key)
 {
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     $currentLangValue = "";
     foreach ($list as $item) {
         $keyDto = $languageService->findKey($prefix, $key);
         if (empty($keyDto)) {
             $prefixDto = $languageService->findPrefix($prefix);
             $keyDto = $languageService->addKey($prefixDto->getId(), $key);
         }
         $value = trim($_POST['lang'][$item->getId()][$prefix][$key]);
         if (mb_strlen(trim($value)) == 0 || $value == json_decode('"\\u00a0"')) {
             $value = ' ';
         }
         $dto = $languageService->findValue($item->getId(), $keyDto->getId());
         if ($dto !== null) {
             $event = new OW_Event('admin.before_save_lang_value', array('dto' => $dto));
             OW::getEventManager()->trigger($event);
             if ($dto->getValue() !== $value) {
                 $languageService->saveValue($dto->setValue($value));
             }
         } else {
             $dto = $languageService->addValue($item->getId(), $prefix, $key, $value);
         }
         if ((int) $currentLanguageId === (int) $item->getId()) {
             $currentLangValue = $value;
         }
     }
     exit(json_encode(array('result' => 'success', 'prefix' => $prefix, 'key' => $key, 'value' => $currentLangValue)));
 }
Example #4
0
 public function __construct($params)
 {
     parent::__construct();
     $this->visiblePhotoCount = !empty($params['photoCount']) ? (int) $params['photoCount'] : 8;
     $checkAuth = isset($params['checkAuth']) ? (bool) $params['checkAuth'] : true;
     $wrap = isset($params['wrapBox']) ? (bool) $params['wrapBox'] : true;
     $boxType = isset($params['boxType']) ? $params['boxType'] : '';
     $showTitle = isset($params['showTitle']) ? (bool) $params['showTitle'] : true;
     $uniqId = isset($params['uniqId']) ? $params['uniqId'] : uniqid();
     if ($checkAuth && !OW::getUser()->isAuthorized('photo', 'view')) {
         $this->setVisible(false);
         return;
     }
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $latest = $photoService->findPhotoList('latest', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('latest', $latest);
     $featured = $photoService->findPhotoList('featured', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('featured', $featured);
     $toprated = $photoService->findPhotoList('toprated', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('toprated', $toprated);
     $items = array('latest', 'toprated');
     if ($featured) {
         $items[] = 'featured';
     }
     $menuItems = $this->getMenuItems($items, $uniqId);
     $this->assign('items', $menuItems);
     $this->assign('wrapBox', $wrap);
     $this->assign('boxType', $boxType);
     $this->assign('showTitle', $showTitle);
     $this->assign('url', OW::getEventManager()->call('photo.getAddPhotoURL', array('')));
     $this->assign('uniqId', $uniqId);
     $this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getMobileCmpViewDir() . 'index_photo_list.html');
 }
Example #5
0
 public function index($params)
 {
     if (empty($params['documentKey'])) {
         throw new Redirect404Exception();
     }
     $language = OW::getLanguage();
     $documentKey = $params['documentKey'];
     $document = $this->navService->findDocumentByKey($documentKey);
     if ($document === null) {
         throw new Redirect404Exception();
     }
     $menuItem = $this->navService->findMenuItemByDocumentKey($document->getKey());
     if ($menuItem !== null) {
         if (!$menuItem->getVisibleFor() || $menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_GUEST && OW::getUser()->isAuthenticated()) {
             throw new Redirect403Exception();
         }
         if ($menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_MEMBER && !OW::getUser()->isAuthenticated()) {
             throw new AuthenticateException();
         }
     }
     $this->assign('content', $language->text('base', "local_page_content_{$document->getKey()}"));
     $this->setPageHeading($language->text('base', "local_page_title_{$document->getKey()}"));
     $this->setPageTitle($language->text('base', "local_page_title_{$document->getKey()}"));
     $this->documentKey = $document->getKey();
     $this->setDocumentKey($document->getKey());
     OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($this, 'setCustomMetaInfo'));
 }
Example #6
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     if (!OW::getUser()->isAdmin()) {
         throw new AuthenticateException();
     }
     if (!OW::getRequest()->isAjax()) {
         $document = OW::getDocument();
         $document->setMasterPage(new ADMIN_CLASS_MasterPage());
         $this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title'));
     }
     BOL_PluginService::getInstance()->checkManualUpdates();
     $plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin();
     $handlerParams = OW::getRequestHandler()->getHandlerAttributes();
     // TODO refactor shortcut below
     if (!defined('OW_PLUGIN_XP') && $plugin !== null) {
         if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') {
             //action
         } else {
             throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey())));
         }
     }
     // TODO temp admin pge inform event
     function admin_check_if_admin_page()
     {
         return true;
     }
     OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page');
 }
Example #7
0
 /**
  * @return Constructor.
  */
 public function __construct($groupId)
 {
     parent::__construct();
     $service = GROUPS_BOL_Service::getInstance();
     $groupDto = $service->findGroupById($groupId);
     $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id);
     $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto);
     OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop');
     OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property');
     $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp);
     $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId);
     $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId);
     $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId)));
     OW::getDocument()->addOnloadScript($js, 1001);
     $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl))));
     if ($service->isCurrentUserCanEdit($groupDto)) {
         $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId)));
     }
     if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) {
         $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag');
     }
     $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId));
     OW::getEventManager()->trigger($event);
     foreach ($event->getData() as $item) {
         $toolbar[] = $item;
     }
     $this->assign('toolbar', $toolbar);
     $this->assign('group', $group);
 }
Example #8
0
 public function init()
 {
     parent::init();
     $this->genericInit();
     OW::getEventManager()->bind(UTAGS_BOL_Service::EVENT_ON_SEARCH, array($this, "onSearch"));
     OW::getEventManager()->bind(UTAGS_BOL_Service::EVENT_ON_INPUT_INIT, array($this, "onInputInit"));
 }
Example #9
0
 public function profile($paramList)
 {
     $userService = BOL_UserService::getInstance();
     /* @var $userDao BOL_User */
     $userDto = $userService->findByUsername($paramList['username']);
     if ($userDto === null) {
         throw new Redirect404Exception();
     }
     if (!OW::getUser()->isAuthorized('base', 'view_profile')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'view_profile');
         $this->assign('permissionMessage', $status['msg']);
         return;
     }
     $eventParams = array('action' => 'base_view_profile', 'ownerId' => $userDto->id, 'viewerId' => OW::getUser()->getId());
     $displayName = BOL_UserService::getInstance()->getDisplayName($userDto->id);
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $ex) {
         throw new RedirectException(OW::getRouter()->urlForRoute('base_user_privacy_no_permission', array('username' => $displayName)));
     }
     $this->setPageTitle(OW::getLanguage()->text('base', 'profile_view_title', array('username' => $displayName)));
     $this->setPageHeading(OW::getLanguage()->text('base', 'profile_view_heading', array('username' => $displayName)));
     $this->setPageHeadingIconClass('ow_ic_user');
     $profileHeader = OW::getClassInstance("BASE_MCMP_ProfileHeader", $userDto->id);
     $this->addComponent("header", $profileHeader);
     //Profile Info
     $displayNameQuestion = OW::getConfig()->getValue('base', 'display_name_question');
     $profileInfo = OW::getClassInstance("BASE_MCMP_ProfileInfo", $userDto->id, false, array($displayNameQuestion, "birthdate"));
     $this->addComponent("info", $profileInfo);
     $this->addComponent('contentMenu', OW::getClassInstance("BASE_MCMP_ProfileContentMenu", $userDto->id));
     $this->addComponent('about', OW::getClassInstance("BASE_MCMP_ProfileAbout", $userDto->id, 80));
     $place = BOL_MobileWidgetService::PLACE_MOBILE_PROFILE;
     $this->initDragAndDrop($place, $userDto->id);
 }
Example #10
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $service = FRIENDS_BOL_Service::getInstance();
     $userId = $params->additionalParamList['entityId'];
     $count = (int) $params->customParamList['count'];
     $idList = $service->findUserFriendsInList($userId, 0, $count);
     $total = $service->countFriends($userId);
     $userService = BOL_UserService::getInstance();
     $eventParams = array('action' => 'friends_view', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $e) {
         $this->setVisible(false);
         return;
     }
     if (empty($idList) && !$params->customizeMode) {
         $this->setVisible(false);
         return;
     }
     if (!empty($idList)) {
         $this->addComponent('userList', new BASE_CMP_AvatarUserList($idList));
     }
     $username = BOL_UserService::getInstance()->getUserName($userId);
     $toolbar = array();
     if ($total > $count) {
         $toolbar = array(array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('friends_user_friends', array('user' => $username))));
     }
     $this->assign('toolbar', $toolbar);
 }
Example #11
0
 public function init()
 {
     OW::getEventManager()->bind(MBOL_ConsoleService::EVENT_COLLECT_CONSOLE_PAGES, array($this, 'onConsolePagesCollect'));
     OW::getEventManager()->bind(BASE_MCMP_ProfileActionToolbar::EVENT_NAME, array($this, "onCollectProfileActions"));
     OW::getEventManager()->bind('mailbox.renderOembed', array($this, 'onRenderOembed'));
     //        OW::getEventManager()->bind(MBOL_ConsoleService::EVENT_COUNT_CONSOLE_PAGE_NEW_ITEMS, array($this, 'countNewItems'));
 }
Example #12
0
 public function __construct($userId)
 {
     parent::__construct();
     $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
     $albums = empty($data["albums"]) ? array() : $data["albums"];
     $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
     $this->assign("source", $source == "album" ? "album" : "all");
     $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
     $form = new Form("pcGallerySettings");
     $form->setEmptyElementsErrorMessage(null);
     $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
     $element = new HiddenField("userId");
     $element->setValue($userId);
     $form->addElement($element);
     $element = new Selectbox("album");
     $element->setHasInvitation(true);
     $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
     $validator = new PCGALLERY_AlbumValidator();
     $element->addValidator($validator);
     $albumsPhotoCount = array();
     foreach ($albums as $album) {
         $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
         $albumsPhotoCount[$album["id"]] = $album["photoCount"];
         if ($album["id"] == $selectedAlbum) {
             $element->setValue($album["id"]);
         }
     }
     OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
     $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
     $form->addElement($element);
     $submit = new Submit("save");
     $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
     $form->addElement($submit);
     $this->addForm($form);
 }
Example #13
0
 public function __construct(BASE_CLASS_WidgetParameter $paramsObj)
 {
     parent::__construct();
     $params = $paramsObj->customParamList;
     $addParams = $paramsObj->additionalParamList;
     if (empty($addParams['entityId']) || !OW::getUser()->isAuthenticated() || !OW::getUser()->isAuthorized('eventx', 'view_event')) {
         $this->setVisible(false);
         return;
     } else {
         $userId = $addParams['entityId'];
     }
     $eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $e) {
         $this->setVisible(false);
         return;
     }
     $language = OW::getLanguage();
     $eventService = EVENTX_BOL_EventService::getInstance();
     $userEvents = $eventService->findUserParticipatedPublicEvents($userId, null, $params['events_count']);
     if (empty($userEvents)) {
         $this->setVisible(false);
         return;
     }
     $this->assign('my_events', $eventService->getListingDataWithToolbar($userEvents));
     $toolbarArray = array();
     if ($eventService->findUserParticipatedPublicEventsCount($userId) > $params['events_count']) {
         $url = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('eventx.view_event_list', array('list' => 'user-participated-events')), array('userId' => $userId));
         $toolbarArray = array(array('href' => $url, 'label' => $language->text('eventx', 'view_all_label')));
     }
     $this->assign('toolbars', $toolbarArray);
 }
Example #14
0
 public function __construct()
 {
     $event = new BASE_CLASS_EventCollector('base.dashboard_menu_items');
     OW::getEventManager()->trigger($event);
     $menuItems = $event->getData();
     parent::__construct($menuItems);
 }
Example #15
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($this->user->id));
     $avatarDto = BOL_AvatarService::getInstance()->findByUserId($this->user->id);
     $owner = false;
     if (OW::getUser()->getId() == $this->user->getId()) {
         $owner = true;
     }
     $isModerator = OW::getUser()->isAuthorized('base') || OW::getUser()->isAdmin();
     $avatarData[$this->user->id]['src'] = BOL_AvatarService::getInstance()->getAvatarUrl($this->user->getId(), 1, null, true, !($owner || $isModerator));
     $default_avatar['src'] = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(1);
     $user = array();
     $user["avatar"] = !empty($avatarData[$this->user->id]['src']) ? $avatarData[$this->user->id] : $default_avatar;
     $user["displayName"] = $avatarData[$this->user->id]["title"];
     $this->assign("user", $user);
     $this->addComponent('toolbar', OW::getClassInstance("BASE_MCMP_ProfileActionToolbar", $this->user->id));
     $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => array($this->user->id), 'viewerId' => OW::getUser()->getId());
     $permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams);
     $showPresence = !(isset($permissions[$this->user->id]['blocked']) && $permissions[$this->user->id]['blocked'] == true);
     $this->assign("showPresence", $showPresence);
     $isOnline = null;
     $activityStamp = null;
     if ($showPresence) {
         $onlineInfo = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($this->user->id));
         $isOnline = $onlineInfo[$this->user->id];
         $activityStamp = $this->user->activityStamp;
     }
     $this->assign("isOnline", $isOnline);
     $this->assign("avatarDto", $avatarDto);
     $this->assign("activityStamp", $activityStamp);
     $this->assign('owner', $owner);
     $this->assign('isModerator', $isModerator);
 }
Example #16
0
 public function init()
 {
     if (!$this->isActive()) {
         return;
     }
     OW::getEventManager()->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, "afterInits"));
 }
Example #17
0
 public function acceptWink($params)
 {
     $partnerId = OW::getUser()->getId();
     if (!$partnerId) {
         throw new ApiResponseErrorException();
     }
     if (empty($params['userId'])) {
         throw new ApiResponseErrorException();
     }
     $service = WINKS_BOL_Service::getInstance();
     $userId = $params['userId'];
     /**
      * @var WINKS_BOL_Winks $wink
      */
     $wink = $service->findWinkByUserIdAndPartnerId($userId, $partnerId);
     if (empty($wink)) {
         throw new ApiResponseErrorException();
     }
     $wink->setStatus(WINKS_BOL_WinksDao::STATUS_ACCEPT);
     WINKS_BOL_WinksDao::getInstance()->save($wink);
     if (($_wink = $service->findWinkByUserIdAndPartnerId($partnerId, $userId)) !== NULL) {
         $_wink->setStatus(WINKS_BOL_WinksDao::STATUS_IGNORE);
         WINKS_BOL_WinksDao::getInstance()->save($_wink);
     }
     $params = array('userId' => $userId, 'partnerId' => $partnerId, 'content' => array('entityType' => 'wink', 'eventName' => 'renderWink', 'params' => array('winkId' => $wink->id, 'winkBackEnabled' => 1)));
     $event = new OW_Event('winks.onAcceptWink', $params);
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     if (!empty($data['conversationId'])) {
         $wink->setConversationId($data['conversationId']);
         WINKS_BOL_WinksDao::getInstance()->save($wink);
     }
     $this->assign('result', true);
 }
Example #18
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct($paramObj);
     $userId = $paramObj->additionalParamList['entityId'];
     // privacy check
     $viewerId = OW::getUser()->getId();
     $ownerMode = $userId == $viewerId;
     $modPermissions = OW::getUser()->isAuthorized('newsfeed');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => NEWSFEED_BOL_Service::PRIVACY_ACTION_VIEW_MY_FEED, 'ownerId' => $userId, 'viewerId' => $viewerId);
         $event = new OW_Event('privacy_check_permission', $privacyParams);
         try {
             OW::getEventManager()->trigger($event);
         } catch (RedirectException $e) {
             $this->setVisible(false);
             return;
         }
     }
     $feed = $this->createFeed('user', $userId);
     $isBloacked = BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId);
     if (OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('base', 'add_comment')) {
         if ($isBloacked) {
             $feed->addStatusMessage(OW::getLanguage()->text("base", "user_block_message"));
         } else {
             $visibility = NEWSFEED_BOL_Service::VISIBILITY_FULL;
             $feed->addStatusForm('user', $userId, $visibility);
         }
     }
     $feed->setDisplayType(NEWSFEED_CMP_Feed::DISPLAY_TYPE_ACTIVITY);
     $this->setFeed($feed);
 }
Example #19
0
function antibruteforce_core_after_route(OW_Event $event)
{
    if (OW::getUser()->isAuthenticated()) {
        return;
    }
    $classDir = OW::getPluginManager()->getPlugin('antibruteforce')->getClassesDir();
    $handler = OW::getRequestHandler()->getHandlerAttributes();
    if (OW::getConfig()->getValue('antibruteforce', 'authentication')) {
        include_once $classDir . 'sign_in.php';
        include_once $classDir . 'auth_result.php';
    }
    if (OW::getConfig()->getValue('antibruteforce', 'registration')) {
        if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Join' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'index') {
            OW::getEventManager()->bind(OW_EventManager::ON_FINALIZE, 'antibruteforce_core_finalize');
        } else {
            if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Captcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                include_once $classDir . 'captcha.php';
            }
        }
    }
    if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] != 'ANTIBRUTEFORCE_CTRL_Antibruteforce') {
        if (ANTIBRUTEFORCE_BOL_Service::getInstance()->isLocked()) {
            ANTIBRUTEFORCE_BOL_Service::getInstance()->redirect();
        }
    }
}
Example #20
0
 public function init()
 {
     $this->credits->triggerCreditActionsAdd();
     OW::getEventManager()->bind('usercredits.on_action_collect', array($this->credits, 'bindCreditActionsCollect'));
     OW::getEventManager()->bind(GHEADER_BOL_Service::EVENT_ADD, array($this, 'onCoverAdd'));
     OW::getEventManager()->bind(GHEADER_BOL_Service::EVENT_CHANGE, array($this, 'onCoverAdd'));
 }
 public function init()
 {
     $eventManager = OW::getEventManager();
     $eventManager->bind('console.collect_items', array($this, 'collectItems'));
     $eventManager->bind('console.ping', array($this, 'ping'));
     $eventManager->bind('console.load_list', array($this, 'loadList'));
 }
Example #22
0
 public function __construct(BASE_CLASS_WidgetParameter $paramObject)
 {
     parent::__construct();
     $text = OW::getLanguage()->text('base', 'welcome_widget_content');
     $text = str_replace('</li>', "</li>\n", $text);
     //if the tags are written in a line it is necessary to make a compulsory hyphenation?
     $photoKey = str_replace('{$key}', self::KEY_PHOTO_UPLOAD, self::PATTERN);
     $avatarKey = str_replace('{$key}', self::KEY_CHANGE_AVATAR, self::PATTERN);
     if (OW::getPluginManager()->isPluginActive('photo') && mb_stripos($text, self::KEY_PHOTO_UPLOAD) !== false) {
         $label = OW::getLanguage()->text('photo', 'upload_photos');
         $js = OW::getEventManager()->call('photo.getAddPhotoURL');
         $langLabel = $this->getLangLabel($photoKey, $text, self::KEY_PHOTO_UPLOAD);
         if ($langLabel != NULL) {
             $label = $langLabel;
         }
         $text = preg_replace($photoKey, '<li><a href="javascript://" onclick="' . $js . '();">' . $label . '</a></li>', $text);
     } else {
         $text = preg_replace($photoKey, '', $text);
     }
     if (mb_stripos($text, self::KEY_CHANGE_AVATAR) !== false) {
         $label = OW::getLanguage()->text('base', 'avatar_change');
         $js = ' $("#welcomeWinget_loadAvatarChangeCmp").click(function(){' . 'document.avatarFloatBox = OW.ajaxFloatBox("BASE_CMP_AvatarChange", [], {width: 749, title: ' . json_encode($label) . '});' . '});';
         OW::getDocument()->addOnloadScript($js);
         $langLabel = $this->getLangLabel($avatarKey, $text, self::KEY_CHANGE_AVATAR);
         if ($langLabel != NULL) {
             $label = $langLabel;
         }
         $text = preg_replace($avatarKey, '<li><a id="welcomeWinget_loadAvatarChangeCmp" href="javascript://">' . $label . '</a></li>', $text);
     } else {
         $text = preg_replace($avatarKey, '', $text);
     }
     $this->assign('text', $text);
 }
 public function __construct($params = array())
 {
     parent::__construct();
     $service = BOL_BillingService::getInstance();
     $gateway = $service->findGatewayByKey($params['gateway']);
     if (!$gateway || $gateway->dynamic) {
         $this->setVisible(false);
         return;
     }
     $event = new BASE_CLASS_EventCollector('base.billing_add_gateway_product');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     $eventProducts = array();
     if ($data) {
         foreach ($data as $plugin) {
             foreach ($plugin as $product) {
                 $id = $service->addGatewayProduct($gateway->id, $product['pluginKey'], $product['entityType'], $product['entityId']);
                 $product['id'] = $id;
                 $eventProducts[] = $product;
             }
         }
     }
     $products = $service->findGatewayProductList($gateway->id);
     foreach ($eventProducts as &$prod) {
         $prod['productId'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['dto']->productId : null;
         $prod['plugin'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['plugin'] : null;
     }
     $this->assign('products', $eventProducts);
     $this->assign('actionUrl', OW::getRouter()->urlFor('BASE_CTRL_Billing', 'saveGatewayProduct'));
     $this->assign('backUrl', urlencode(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri()));
 }
Example #24
0
 /**
  * find provider by id
  *
  * @param $userId
  * @return 
  */
 public function onUserRegister($userId = 0)
 {
     if (!$userId) {
         return null;
     }
     if (isset($_COOKIE['yncontactimporter_userId'])) {
         $refId = $_COOKIE['yncontactimporter_userId'];
         unset($_COOKIE['yncontactimporter_userId']);
         // check email and update isued
         $user = BOL_UserService::getInstance()->findUserById($userId);
         $email = $user->getEmail();
         if ($invitation = YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->checkInvitedUser($email)) {
             $invitation->isUsed = 1;
             YNCONTACTIMPORTER_BOL_InvitationService::getInstance()->save($invitation);
         }
         // save joined
         $joined = new YNCONTACTIMPORTER_BOL_Joined();
         $joined->userId = $userId;
         $joined->inviterId = $refId;
         $this->joinedDao->save($joined);
         //invite friend
         $event = new OW_Event('friends.add_friend', array('requesterId' => $refId, 'userId' => $userId));
         OW::getEventManager()->trigger($event);
     }
 }
Example #25
0
 /**
  * Constructor.
  *
  * @param string $type
  * @param OW_LogWriter $logWriter
  */
 private function __construct($type)
 {
     $this->type = $type;
     $this->logWriter = new BASE_CLASS_DbLogWriter();
     OW::getEventManager()->bind('core.exit', array($this, 'writeLog'));
     OW::getEventManager()->bind('core.emergency_exit', array($this, 'writeLog'));
 }
Example #26
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $count = (int) $params->customParamList['count'];
     $service = SKAPI_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $guests = $service->findGuestsForUser($userId, 1, $count);
     if (!$guests) {
         $this->setVisible(false);
         return;
     }
     $userIdList = array();
     foreach ($guests as $guest) {
         array_push($userIdList, $guest->guestId);
     }
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIdList);
     foreach ($avatars as &$item) {
         $item['class'] = 'ow_guest_avatar';
     }
     $event = new OW_Event('bookmarks.is_mark', array(), $avatars);
     OW::getEventManager()->trigger($event);
     if ($event->getData()) {
         $avatars = $event->getData();
     }
     $this->assign('avatars', $avatars);
     $this->assign('guests', $guests);
     $total = $service->countGuestsForUser($userId);
     if ($total > $count) {
         $toolbar = array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('skapi.list'));
         $this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar));
     }
 }
Example #27
0
 public function onUserRegister(OW_Event $event)
 {
     $params = $event->getParams();
     if (empty($params['params']['code'])) {
         return;
     }
     $userIds = array();
     foreach ($this->providers as $provider) {
         $inviters = $provider->getInviters($params['params']['code']);
         if ($inviters && is_array($inviters)) {
             $userIds = array_merge($userIds, $inviters);
         }
     }
     $newId = $params['userId'];
     foreach ($userIds as $uid) {
         $event = new OW_Event('friends.add_friend', array('requesterId' => $uid, 'userId' => $newId));
         OW::getEventManager()->trigger($event);
         /*$eventParams = array('pluginKey' => 'contactimporter', 'action' => 'import_friend', 'userId' => $userId);
         
         	    if ( OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true )
         	    {
         		OW::getEventManager()->call('usercredits.track_action', $eventParams);
         	    }*/
     }
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     if (!BOL_AuthorizationService::getInstance()->isModerator() && !OW::getUser()->isAdmin()) {
         $this->setVisible(false);
         return;
     }
     $uniqId = uniqid("mp-");
     $this->assign("uniqId", $uniqId);
     $event = new BASE_CLASS_EventCollector(self::EVENT_COLLECT_CONTENTS);
     OW::getEventManager()->trigger($event);
     $tplContents = array();
     $activeTab = null;
     foreach ($event->getData() as $content) {
         $tplContent = array_merge(array("name" => null, "content" => null, "active" => false), $content);
         $activeTab = $tplContent["active"] ? $tplContent["name"] : $activeTab;
         $tplContents[$tplContent["name"]] = $tplContent;
     }
     if (empty($tplContents)) {
         $this->setVisible(false);
         return;
     }
     if ($activeTab === null) {
         $firstTab = reset($tplContents);
         $activeTab = $firstTab["name"];
         $tplContents[$activeTab]["active"] = true;
     }
     $this->assign("items", $tplContents);
 }
Example #29
0
 public function getList($params)
 {
     $data = OW::getEventManager()->call("guests.get_guests_list", array("userId" => OW::getUser()->getId()));
     if (empty($data)) {
         $this->assign("list", array());
         return;
     }
     $idList = array();
     $viewedMap = array();
     $timeMap = array();
     foreach ($data as $item) {
         $idList[] = $item["userId"];
         $viewedMap[$item["userId"]] = $item["viewed"];
         $timeMap[$item["userId"]] = UTIL_DateTime::formatDate($item["timeStamp"]);
     }
     OW::getEventManager()->call("guests.mark_guests_viewed", array("userId" => OW::getUser()->getId(), "guestIds" => $idList));
     $bookmarkList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
     $bookmarkList = empty($bookmarkList) ? array() : $bookmarkList;
     $avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false);
     $onlineMap = BOL_UserService::getInstance()->findOnlineStatusForUserList($idList);
     foreach ($avatarList as $userId => $user) {
         $color = array('r' => '100', 'g' => '100', 'b' => '100');
         if (!empty($user['labelColor'])) {
             $_color = explode(', ', trim($user['labelColor'], 'rgba()'));
             $color = array('r' => $_color[0], 'g' => $_color[1], 'b' => $_color[2]);
         }
         $list[] = array("userId" => $userId, "displayName" => $user["title"], "avatarUrl" => $user["src"], "label" => $user["label"], "labelColor" => $color, "viewed" => $viewedMap[$userId], "online" => $onlineMap[$userId], "bookmarked" => !empty($bookmarkList[$userId]), "time" => $timeMap[$userId]);
     }
     $this->assign("list", $list);
 }
Example #30
0
 public static function getMenu($activeListType)
 {
     $language = OW::getLanguage();
     $menuArray = array(array('label' => $language->text('base', 'user_list_menu_item_latest'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'latest')), 'iconClass' => 'ow_ic_clock', 'key' => 'latest', 'order' => 1), array('label' => $language->text('base', 'user_list_menu_item_online'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'online')), 'iconClass' => 'ow_ic_push_pin', 'key' => 'online', 'order' => 3), array('label' => $language->text('base', 'user_search_menu_item_label'), 'url' => OW::getRouter()->urlForRoute('users-search'), 'iconClass' => 'ow_ic_lens', 'key' => 'search', 'order' => 4));
     if (BOL_UserService::getInstance()->countFeatured() > 0) {
         $menuArray[] = array('label' => $language->text('base', 'user_list_menu_item_featured'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'featured')), 'iconClass' => 'ow_ic_push_pin', 'key' => 'featured', 'order' => 2);
     }
     $event = new BASE_CLASS_EventCollector('base.add_user_list');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     if (!empty($data)) {
         $menuArray = array_merge($menuArray, $data);
     }
     $menu = new BASE_CMP_ContentMenu();
     foreach ($menuArray as $item) {
         $menuItem = new BASE_MenuItem();
         $menuItem->setLabel($item['label']);
         $menuItem->setIconClass($item['iconClass']);
         $menuItem->setUrl($item['url']);
         $menuItem->setKey($item['key']);
         $menuItem->setOrder(empty($item['order']) ? 999 : $item['order']);
         $menu->addElement($menuItem);
         if ($activeListType == $item['key']) {
             $menuItem->setActive(true);
         }
     }
     return $menu;
 }