本文整理汇总了PHP中BOL_AuthorizationService类的典型用法代码示例。如果您正苦于以下问题:PHP BOL_AuthorizationService类的具体用法?PHP BOL_AuthorizationService怎么用?PHP BOL_AuthorizationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BOL_AuthorizationService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addToList
public function addToList(OW_Event $event)
{
$params = $event->getParams();
$userId = $params["userId"];
$data = array("result" => true, "message" => null, "buyCredits" => false);
$available = true;
if (!isset($params["checkCredits"]) || $params["checkCredits"]) {
if (!OW::getUser()->isAuthorized("hotlist", "add_to_list")) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus("hotlist", "add_to_list");
$available = false;
$data["result"] = false;
if ($status["status"] == BOL_AuthorizationService::STATUS_PROMOTED) {
$data["message"] = $status["msg"];
$data["buyCredits"] = true;
}
}
}
if ($available) {
$this->service->addUser($userId);
BOL_AuthorizationService::getInstance()->trackAction('hotlist', 'add_to_list');
$data["result"] = true;
$data['message'] = OW::getLanguage()->text('hotlist', 'user_added');
}
$event->setData($data);
return $data;
}
开发者ID:hardikamutech,项目名称:loov,代码行数:26,代码来源:event_handler.php
示例2: index
/**
* Default action
*/
public function index()
{
$language = OW::getLanguage();
$clipService = VIDEO_BOL_ClipService::getInstance();
$userId = OW::getUser()->getId();
if (!OW::getUser()->isAuthorized('video', 'add')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add');
throw new AuthorizationException($status['msg']);
}
if (!($clipService->findUserClipsCount($userId) <= $clipService->getUserQuotaConfig())) {
$this->assign('auth_msg', $language->text('video', 'quota_exceeded', array('limit' => $clipService->getUserQuotaConfig())));
} else {
$this->assign('auth_msg', null);
$videoAddForm = new videoAddForm();
$this->addForm($videoAddForm);
if (OW::getRequest()->isPost() && $videoAddForm->isValid($_POST)) {
$values = $videoAddForm->getValues();
$code = $clipService->validateClipCode($values['code']);
if (!mb_strlen($code)) {
OW::getFeedback()->warning($language->text('video', 'resource_not_allowed'));
$this->redirect();
}
$res = $videoAddForm->process();
OW::getFeedback()->info($language->text('video', 'clip_added'));
$this->redirect(OW::getRouter()->urlForRoute('view_clip', array('id' => $res['id'])));
}
}
if (!OW::getRequest()->isAjax()) {
OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'video', 'video');
}
OW::getDocument()->setHeading($language->text('video', 'page_title_add_video'));
OW::getDocument()->setHeadingIconClass('ow_ic_video');
OW::getDocument()->setTitle($language->text('video', 'meta_title_video_add'));
OW::getDocument()->setDescription($language->text('video', 'meta_description_video_add'));
}
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:38,代码来源:add.php
示例3: __construct
/**
* @return Constructor.
*/
public function __construct(BASE_CLASS_WidgetParameter $paramObj)
{
parent::__construct();
$avatarService = BOL_AvatarService::getInstance();
$viewerId = OW::getUser()->getId();
$userId = $paramObj->additionalParamList['entityId'];
if ($viewerId == $userId) {
$this->assign('owner', true);
$this->assign('changeAvatarUrl', OW::getRouter()->urlForRoute('base_avatar_crop'));
} else {
$this->assign('owner', false);
}
$avatar = $avatarService->getAvatarUrl($userId, 2);
$this->assign('avatar', $avatar ? $avatar : $avatarService->getDefaultAvatarUrl(2));
$roles = BOL_AuthorizationService::getInstance()->getRoleListOfUsers(array($userId));
$this->assign('role', !empty($roles[$userId]) ? $roles[$userId] : null);
$userService = BOL_UserService::getInstance();
$showPresence = true;
// Check privacy permissions
$eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$showPresence = false;
}
$this->assign('isUserOnline', $userService->findOnlineUserById($userId) && $showPresence);
$this->assign('userId', $userId);
$this->assign('avatarSize', OW::getConfig()->getValue('base', 'avatar_big_size'));
}
开发者ID:vazahat,项目名称:dudex,代码行数:32,代码来源:user_avatar_widget.php
示例4: getList
public function getList($params)
{
$service = SKADATEIOS_ABOL_Service::getInstance();
$auth = array('photo.view' => $service->getAuthorizationActionStatus('photo', 'view'), 'base.search_users' => $service->getAuthorizationActionStatus('base', 'search_users'));
$this->assign('auth', $auth);
if ($auth["base.search_users"]["status"] != BOL_AuthorizationService::STATUS_AVAILABLE) {
$this->assign("list", array());
$this->assign("total", 0);
return;
}
$_criteriaList = array_filter($params["criteriaList"]);
$userId = OW::getUser()->getId();
$userInfo = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array("sex"));
$_criteriaList["sex"] = !empty($userInfo[$userId]["sex"]) ? $userInfo[$userId]["sex"] : null;
$questionList = BOL_QuestionService::getInstance()->findQuestionByNameList(array_keys($_criteriaList));
$criteriaList = array();
foreach ($_criteriaList as $questionName => $questionValue) {
if (empty($questionList[$questionName])) {
continue;
}
$criteriaList[$questionName] = $this->convertQuestionValue($questionList[$questionName]->presentation, $questionValue);
}
$idList = OW::getEventManager()->call("usearch.get_user_id_list", array("criterias" => $criteriaList, "limit" => array($params["first"], $params["count"])));
$idList = empty($idList) ? array() : $idList;
//$idList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($criteriaList, $params["first"], $params["count"]);
$total = BOL_UserService::getInstance()->countUsersByQuestionValues($params["criteriaList"]);
$userData = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, false, false, true, true);
$questionsData = BOL_QuestionService::getInstance()->getQuestionData($idList, array("googlemap_location", "birthdate"));
foreach ($questionsData as $userId => $data) {
$date = UTIL_DateTime::parseDate($data['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$userData[$userId]["ages"] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
$userData[$userId]["location"] = empty($data["googlemap_location"]["address"]) ? null : $data["googlemap_location"]["address"];
}
$photoList = array();
$avatarList = array();
foreach ($idList as $userId) {
$bigAvatar = SKADATE_BOL_Service::getInstance()->findAvatarByUserId($userId);
$avatarList[$userId] = $bigAvatar ? SKADATE_BOL_Service::getInstance()->getAvatarUrl($userId, $bigAvatar->hash) : BOL_AvatarService::getInstance()->getAvatarUrl($userId, 2);
$event = new OW_Event('photo.getMainAlbum', array('userId' => $userId));
OW::getEventManager()->trigger($event);
$album = $event->getData();
$photos = !empty($album['photoList']) ? $album['photoList'] : array();
foreach ($photos as $photo) {
$photoList[$userId][] = array("src" => $photo["url"]["main"]);
}
}
$bookmarksList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
$bookmarksList = empty($bookmarksList) ? array() : $bookmarksList;
$list = array();
foreach ($idList as $userId) {
$list[] = array("userId" => $userId, "photos" => empty($photoList[$userId]) ? array() : $photoList[$userId], "avatar" => $avatarList[$userId], "name" => empty($userData[$userId]["title"]) ? "" : $userData[$userId]["title"], "label" => $userData[$userId]["label"], "labelColor" => $userData[$userId]["labelColor"], "location" => empty($userData[$userId]["location"]) ? "" : $userData[$userId]["location"], "ages" => $userData[$userId]["ages"], "bookmarked" => !empty($bookmarksList[$userId]));
}
$this->assign("list", $list);
$this->assign("total", $total);
$allowSendMessage = OW::getPluginManager()->isPluginActive('mailbox');
$this->assign("actions", array("bookmark" => OW::getPluginManager()->isPluginActive('bookmarks'), "message" => $allowSendMessage, "wink" => OW::getPluginManager()->isPluginActive('winks')));
BOL_AuthorizationService::getInstance()->trackAction("base", "search_users");
$mailboxModes = OW::getEventManager()->call('mailbox.get_active_mode_list');
$this->assign("mailboxModes", empty($mailboxModes) ? array() : $mailboxModes);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:60,代码来源:search.php
示例5: __construct
public function __construct($data)
{
$script = UTIL_JsGenerator::composeJsString('
OWM.bind("mailbox.ready", function(readyStatus){
if (readyStatus == 2){
OWM.conversation = new MAILBOX_Conversation({$params});
OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation});
}
});
', array('params' => $data));
OW::getDocument()->addOnloadScript($script);
OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation');
$form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']);
$this->addForm($form);
$this->assign('data', $data);
$this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
$firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']);
if (empty($firstMessage)) {
$actionName = 'send_message';
} else {
$actionName = 'reply_to_message';
}
$isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName);
if (!$isAuthorized) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$this->assign('sendAuthMessage', $status['msg']);
} elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
$this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied'));
}
}
}
开发者ID:tammyrocks,项目名称:mailbox,代码行数:33,代码来源:mail_conversation.php
示例6: profile
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);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:34,代码来源:widget_panel.php
示例7: __construct
/**
* Constructor.
*
* @param BASE_CommentsParams $params
*/
public function __construct(BASE_CommentsParams $params)
{
parent::__construct();
$this->params = $params;
$this->batchData = $params->getBatchData();
$this->staticData = empty($this->batchData['_static']) ? array() : $this->batchData['_static'];
$this->batchData = isset($this->batchData[$params->getEntityType()][$params->getEntityId()]) ? $this->batchData[$params->getEntityType()][$params->getEntityId()] : array();
srand(time());
$this->id = $params->getEntityType() . $params->getEntityId() . rand(1, 10000);
$this->cmpContextId = "comments-{$this->id}";
$this->assign('cmpContext', $this->cmpContextId);
$this->assign('wrapInBox', $params->getWrapInBox());
$this->assign('topList', in_array($params->getDisplayType(), array(BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST, BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI)));
$this->assign('bottomList', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_PAGING);
$this->assign('mini', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI);
$this->isAuthorized = OW::getUser()->isAuthorized($params->getPluginKey(), 'add_comment') && $params->getAddComment();
if (!$this->isAuthorized) {
$errorMessage = $params->getErrorMessage();
if (empty($errorMessage)) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus($params->getPluginKey(), 'add_comment');
$errorMessage = OW::getUser()->isAuthenticated() ? $status['msg'] : OW::getLanguage()->text('base', 'comments_add_login_message');
}
$this->assign('authErrorMessage', $errorMessage);
}
$this->initForm();
}
开发者ID:hardikamutech,项目名称:loov,代码行数:31,代码来源:comments.php
示例8: getInstance
/**
* Returns an instance of class (singleton pattern implementation).
*
* @return BOL_AuthorizationService
*/
public static function getInstance()
{
if (self::$classInstance === null) {
self::$classInstance = new self();
}
return self::$classInstance;
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:12,代码来源:authorization_service.php
示例9: __construct
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);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:29,代码来源:moderation_tools_widget.php
示例10: __construct
public function __construct($layout)
{
parent::__construct();
$status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) {
$this->assign('authError', $status['msg']);
return;
}
$class = "";
switch ($layout) {
case 'page':
$class = ' ow_photoview_info_onpage';
break;
default:
if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) {
$class = ' ow_photoview_pint_mode';
} else {
$class = '';
}
break;
}
$this->assign('class ', $class);
$this->assign('layout ', $layout);
$document = OW::getDocument();
$js = "\$('#btn-save-as-avatar').off().on('click', function() {\n console.log('photo floatbox call js');\n var photoId = \$('#btn-photo-edit') . attr('rel');\n\n document.avatarFloatBox = OW.ajaxFloatBox(\n 'BASE_CMP_AvatarChange', {\n params: {\n step: 2, entityType: 'photo_album', entityId: '', id: photoId\n }}, {\n width: 749, title: OW.getLanguageText('base', 'avatar_change')}\n );\n })";
$document->addOnloadScript($js);
}
开发者ID:hardikamutech,项目名称:hammu,代码行数:27,代码来源:photo_floatbox.php
示例11: render
public function render()
{
$defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
$this->assign('defaultAvatarUrl', $defaultAvatarUrl);
$js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
OW::getDocument()->addOnloadScript($js, 3006);
//TODO check this config
$enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
$this->assign('enableAttachments', $enableAttachments);
$replyToMessageActionPromotedText = '';
$isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
$isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
if (!$isAuthorizedReplyToMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
$isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
if (!$isAuthorizedReplyToChatMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
$this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
if ($isAuthorizedReplyToMessage) {
$text = new WysiwygTextarea('mailbox_message');
$text->setId('conversationTextarea');
$this->assign('mailbox_message', $text->renderInput());
}
return parent::render();
}
开发者ID:tammyrocks,项目名称:mailbox,代码行数:35,代码来源:conversation.php
示例12: __construct
/**
* @param BASE_CLASS_WidgetParameter $params
* @return \BASE_CMP_UserViewWidget
*/
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$userId = $params->additionalParamList['entityId'];
$viewerId = OW::getUser()->getId();
$ownerMode = $userId == $viewerId;
$adminMode = OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base');
$isSuperAdmin = BOL_AuthorizationService::getInstance()->isSuperModerator($userId);
$user = BOL_UserService::getInstance()->findUserById($userId);
$accountType = $user->accountType;
$questionService = BOL_QuestionService::getInstance();
$questions = self::getUserViewQuestions($userId, $adminMode);
$questionArray = $questions['questions'];
$questionData = $questions['data'];
$questionLabelList = $questions['labels'];
$sections = array_keys($questionArray);
$template = OW::getPluginManager()->getPlugin('base')->getViewDir() . 'components' . DS . 'user_view_widget_table.html';
$userViewPresntation = OW::getConfig()->getValue('base', 'user_view_presentation');
if ($userViewPresntation === self::USER_VIEW_PRESENTATION_TABS) {
$template = OW::getPluginManager()->getPlugin('base')->getViewDir() . 'components' . DS . 'user_view_widget_tabs.html';
OW::getDocument()->addOnloadScript(" view = new UserViewWidget(); ");
$jsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
OW::getDocument()->addScript($jsDir . "user_view_widget.js");
$this->addMenu($sections);
}
$script = ' $(".profile_hidden_field").bind( "mouseover.hiddenfield",
function() {
OW.showTip($(this), {side: "top", hideEvent: "mouseout", timeout:0, show: "' . OW::getLanguage()->text('base', 'base_invisible_profile_field_tooltip') . '"});
} );';
OW::getDocument()->addOnloadScript($script);
$this->setTemplate($template);
$accountTypes = $questionService->findAllAccountTypes();
if (!isset($sections[0])) {
$sections[0] = 0;
}
if (count($accountTypes) > 1) {
if (!isset($questionArray[$sections[0]])) {
$questionArray[$sections[0]] = array();
}
array_unshift($questionArray[$sections[0]], array('name' => 'accountType', 'presentation' => 'select'));
$questionData[$userId]['accountType'] = $questionService->getAccountTypeLang($accountType);
}
if (!isset($questionData[$userId])) {
$questionData[$userId] = array();
}
$this->assign('firstSection', $sections[0]);
$this->assign('questionArray', $questionArray);
$this->assign('questionData', $questionData[$userId]);
$this->assign('ownerMode', $ownerMode);
$this->assign('adminMode', $adminMode);
$this->assign('superAdminProfile', $isSuperAdmin);
$this->assign('profileEditUrl', OW::getRouter()->urlForRoute('base_edit'));
if ($adminMode && !$ownerMode) {
$this->assign('profileEditUrl', OW::getRouter()->urlForRoute('base_edit_user_datails', array('userId' => $userId)));
}
$this->assign('avatarUrl', BOL_AvatarService::getInstance()->getAvatarUrl($userId));
$this->assign('displayName', BOL_UserService::getInstance()->getDisplayName($userId));
$this->assign('questionLabelList', $questionLabelList);
$this->assign('userId', $userId);
}
开发者ID:vazahat,项目名称:dudex,代码行数:64,代码来源:user_view_widget.php
示例13: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$viewAllUrl = OW::getRouter()->urlForRoute('mailbox_messages_default');
$this->assign('viewAllUrl', $viewAllUrl);
$conversationService = MAILBOX_BOL_ConversationService::getInstance();
$activeModeList = $conversationService->getActiveModeList();
$mailModeEnabled = in_array('mail', $activeModeList) ? true : false;
$this->assign('mailModeEnabled', $mailModeEnabled);
$actionName = 'send_message';
$event = new OW_Event('mailbox.show_send_message_button', array(), false);
OW::getEventManager()->trigger($event);
$showSendMessage = $event->getData();
$isAuthorizedSendMessage = $showSendMessage && OW::getUser()->isAuthorized('mailbox', $actionName);
if (!$isAuthorizedSendMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$script = '$("#mailboxConsoleListSendMessageBtn").click(function(){
OW.authorizationLimitedFloatbox(' . json_encode($status['msg']) . ');
});';
OW::getDocument()->addOnloadScript($script);
$isAuthorizedSendMessage = true;
//this service is promoted
}
}
$this->assign('isAuthorizedSendMessage', $isAuthorizedSendMessage);
}
开发者ID:tammyrocks,项目名称:mailbox,代码行数:27,代码来源:console_list.php
示例14: request
/**
* Request new friendship controller
*
* @param array $params
* @throws Redirect404Exception
* @throws AuthenticateException
*/
public function request($params)
{
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$requesterId = OW::getUser()->getId();
$userId = (int) $params['id'];
if (BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId)) {
throw new Redirect404Exception();
}
if (!OW::getUser()->isAuthorized('friends', 'add_friend')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('friends', 'add_friend');
OW::getFeedback()->error($status['msg']);
}
$service = FRIENDS_BOL_Service::getInstance();
if ($service->findFriendship($requesterId, $userId) === null) {
$service->request($requesterId, $userId);
$service->onRequest($requesterId, $userId);
OW::getFeedback()->info(OW::getLanguage()->text('friends', 'feedback_request_was_sent'));
} else {
OW::getFeedback()->error(OW::getLanguage()->text('friends', 'feedback_request_already_sent_error_message'));
}
if (isset($params['backUri'])) {
$this->redirect($params['backUri']);
}
$this->redirect($_SERVER['HTTP_REFERER']);
}
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:34,代码来源:action.php
示例15: isAuthorized
/**
*
* @param string $groupName
* @param string $actionName
* @param array $extra
* @return boolean
*/
public function isAuthorized($groupName, $actionName = null, $extra = null)
{
if ($extra !== null && !is_array($extra)) {
trigger_error("`ownerId` parameter has been deprecated, pass `extra` parameter instead\n" . OW_ErrorManager::getInstance()->debugBacktrace(), E_USER_WARNING);
}
return BOL_AuthorizationService::getInstance()->isActionAuthorized($groupName, $actionName, $extra);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:14,代码来源:user.php
示例16: __construct
public function __construct(array $params = array())
{
parent::__construct();
$service = HOTLIST_BOL_Service::getInstance();
$authMsg = '';
$authorized = OW::getUser()->isAuthorized('hotlist', 'add_to_list');
$status = BOL_AuthorizationService::getInstance()->getActionStatus('hotlist', 'add_to_list');
if (!$authorized) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('hotlist', 'add_to_list');
$authMsg = json_encode($status['msg']);
}
$this->assign('authorized', $authorized);
$this->assign('authMsg', $authMsg);
if (empty($params)) {
$this->settingList = array('number_of_users' => 8);
} else {
$this->settingList = $params;
}
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('hotlist')->getStaticJsUrl() . 'jquery.cycle.js');
$userList = HOTLIST_BOL_Service::getInstance()->getHotList();
$info = array();
foreach ($userList as $id => $user) {
$userDto = BOL_UserService::getInstance()->findUserById($user->userId);
if (empty($userDto)) {
continue;
}
$info[$id]['userId'] = $user->userId;
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($user->userId));
$event = new OW_Event('bookmarks.is_mark', array(), $avatars);
OW::getEventManager()->trigger($event);
if ($event->getData()) {
$avatars = $event->getData();
}
$info[$id]['avatarUrl'] = $avatars[$user->userId]['src'];
$info[$id]['url'] = $avatars[$user->userId]['url'];
$info[$id]['username'] = BOL_UserService::getInstance()->getUserName($user->userId);
$info[$id]['displayName'] = empty($avatars[$user->userId]['title']) ? BOL_UserService::getInstance()->getUserName($user->userId) : $avatars[$user->userId]['title'];
$fields = $this->getFields($user->userId);
$info[$id]['sex'] = empty($fields['sex']) ? '' : $fields['sex'];
$info[$id]['age'] = empty($fields['age']) ? '' : $fields['age'];
$info[$id]['googlemap_location'] = empty($fields['googlemap_location']) ? '' : $fields['googlemap_location'];
$info[$id]['avatar'] = $avatars[$user->userId];
$info[$id]['isMarked'] = !empty($avatars[$user->userId]['isMarked']);
}
if (!empty($info)) {
$this->assign('userList', $info);
} else {
$this->assign('userList', null);
}
$user = $service->findUserById(OW::getUser()->getId());
$this->assign('userInList', !empty($user));
$this->assign('number_of_users', $this->settingList['number_of_users']);
$this->assign('number_of_rows', 1);
$this->assign('count', count($info));
$js = "\n\$(document).ready(function() {\n \$('.users_slideshow').cycle({\n\t\tfx: 'scrollUp',\n\t\tspeed: 300,\n\t\ttimeout: 4500\n\t});\n});";
if (count($info) > $this->settingList['number_of_users']) {
OW::getDocument()->addOnloadScript($js);
}
}
开发者ID:hardikamutech,项目名称:loov,代码行数:59,代码来源:index.php
示例17: index
public function index()
{
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$form = new SubscribeForm();
$this->addForm($form);
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
$form->process();
}
$membershipService = MEMBERSHIP_BOL_MembershipService::getInstance();
$authService = BOL_AuthorizationService::getInstance();
$actions = $membershipService->getSubscribePageGroupActionList();
$this->assign('groupActionList', $actions);
$mTypes = $membershipService->getTypeList();
/* @var $defaultRole BOL_AuthorizationRole */
$defaultRole = $authService->getDefaultRole();
/* @var $default MEMBERSHIP_BOL_MembershipType */
$default = new MEMBERSHIP_BOL_MembershipType();
$default->roleId = $defaultRole->id;
$mTypes = array_merge(array($default), $mTypes);
$userId = OW::getUser()->getId();
$userMembership = $membershipService->getUserMembership($userId);
$userRoleIds = array($defaultRole->id);
if ($userMembership) {
$type = $membershipService->findTypeById($userMembership->typeId);
if ($type) {
$userRoleIds[] = $type->roleId;
}
$this->assign('current', $userMembership);
$this->assign('currentTitle', $membershipService->getMembershipTitle($type->roleId));
}
$permissions = $authService->getPermissionList();
$perms = array();
foreach ($permissions as $permission) {
/* @var $permission BOL_AuthorizationPermission */
$perms[$permission->roleId][$permission->actionId] = true;
}
$mPlans = $membershipService->getTypePlanList();
$mTypesPermissions = array();
foreach ($mTypes as $membership) {
$mId = $membership->id;
$data = array('id' => $mId, 'title' => $membershipService->getMembershipTitle($membership->roleId), 'roleId' => $membership->roleId, 'permissions' => isset($perms[$membership->roleId]) ? $perms[$membership->roleId] : null, 'current' => in_array($membership->roleId, $userRoleIds), 'plans' => isset($mPlans[$mId]) ? $mPlans[$mId] : null);
$mTypesPermissions[$mId] = $data;
}
$this->assign('mTypePermissions', $mTypesPermissions);
$this->assign('typesNumber', count($mTypes));
// collecting labels
$event = new BASE_CLASS_EventCollector('admin.add_auth_labels');
OW::getEventManager()->trigger($event);
$data = $event->getData();
$dataLabels = empty($data) ? array() : call_user_func_array('array_merge', $data);
$this->assign('labels', $dataLabels);
$gateways = BOL_BillingService::getInstance()->getActiveGatewaysList();
$this->assign('gatewaysActive', (bool) $gateways);
$lang = OW::getLanguage();
$this->setPageHeading($lang->text('membership', 'subscribe_page_heading'));
$this->setPageHeadingIconClass('ow_ic_user');
}
开发者ID:vazahat,项目名称:dudex,代码行数:59,代码来源:subscribe.php
示例18: collectItems
public function collectItems(BASE_CLASS_ConsoleItemCollector $event)
{
$language = OW::getLanguage();
$router = OW::getRouter();
//Hardik Changes for menu
if (OW::getUser()->isAuthenticated()) {
//$item = new BASE_CMP_ConsoleDropdownMenu(BOL_UserService::getInstance()->getDisplayName(OW::getUser()->getId()));
$item = new BASE_CMP_ConsoleDropdownMenu(OW::getUser()->getUserObject()->getUsername());
$item->setUrl($router->urlForRoute('base_user_profile', array('username' => OW::getUser()->getUserObject()->getUsername())));
$item->addItem('main', array('label' => $language->text('base', 'console_item_label_profile'), 'url' => $router->urlForRoute('base_user_profile', array('username' => OW::getUser()->getUserObject()->getUsername()))));
$item->addItem('main', array('label' => $language->text('base', 'edit_index'), 'url' => $router->urlForRoute('base_edit')));
// $item->addItem('main', array('label' => $language->text('base', 'preference_index'), 'url' => $router->urlForRoute('base_preference_index')));
if (OW::getUser()->isAdmin() || BOL_AuthorizationService::getInstance()->isModerator()) {
$item->addItem('main', array('label' => $language->text('base', 'moderation_tools'), 'url' => $router->urlForRoute('base.moderation_tools')));
}
$item->addItem('foot', array('label' => $language->text('base', 'console_item_label_sign_out'), 'url' => $router->urlForRoute('base_sign_out')));
$addItemsEvent = new BASE_CLASS_EventCollector('base.add_main_console_item');
OW::getEventManager()->trigger($addItemsEvent);
$addItems = $addItemsEvent->getData();
// echo '<pre>';
// print_r($addItems);
// echo '</pre>';
foreach ($addItems as $addItem) {
if (!empty($addItem['label']) && !empty($addItem['url'])) {
// $item->addItem('main', array('label' => $addItem['label'], 'url' => $addItem['url']));
}
}
$event->addItem($item, 2);
if (OW::getUser()->isAdmin()) {
$item = new BASE_CMP_ConsoleDropdownMenu($language->text('admin', 'main_menu_admin'));
$item->setUrl($router->urlForRoute('admin_default'));
$item->addItem('head', array('label' => $language->text('admin', 'console_item_admin_dashboard'), 'url' => $router->urlForRoute('admin_default')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_theme'), 'url' => $router->urlForRoute('admin_themes_edit')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_users'), 'url' => $router->urlForRoute('admin_users_browse')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_pages'), 'url' => $router->urlForRoute('admin_pages_main')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_plugins'), 'url' => $router->urlForRoute('admin_plugins_installed')));
$event->addItem($item, 1);
}
} else {
$buttonListEvent = new BASE_CLASS_EventCollector(BASE_CMP_ConnectButtonList::HOOK_REMOTE_AUTH_BUTTON_LIST);
OW::getEventManager()->trigger($buttonListEvent);
$buttonList = $buttonListEvent->getData();
$iconListMarkup = '';
foreach ($buttonList as $button) {
$iconListMarkup .= '<span class="ow_ico_signin ' . $button['iconClass'] . '"></span>';
}
$cmp = new BASE_CMP_SignIn(true);
$signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>';
$item = new BASE_CMP_ConsoleItem();
$item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup);
$event->addItem($item, 2);
OW::getDocument()->addOnloadScript("\n \$('#" . $item->getUniqId() . "').click(function(){new OW_FloatBox({ \$contents: \$('#base_cmp_floatbox_ajax_signin')});});\n ");
$item = new BASE_CMP_ConsoleButton($language->text('base', 'console_item_sign_up_label'), OW::getRouter()->urlForRoute('base_join'));
$event->addItem($item, 1);
}
$item = new BASE_CMP_ConsoleSwitchLanguage();
$event->addItem($item, 0);
}
开发者ID:hardikamutech,项目名称:hammu,代码行数:58,代码来源:console_event_handler.php
|
请发表评论