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)); } }
/** * Returns class instance * * @return OCSGUESTS_BOL_Service */ public static function getInstance() { if (null === self::$classInstance) { self::$classInstance = new self(); } return self::$classInstance; }
* your Slim application now by passing an associative array * of setting names and values into the application constructor. * * * */ //$app = new \Slim\Slim(); $app = new \Slim\Slim(); //$baseJsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl(); $BOL_UserDao = BOL_UserDao::getInstance(); $ow_user = OW::getUser(); $OW_Auth_inst = OW_Auth::getInstance(); $Userservice = BOL_UserService::getInstance(); $EmailVerifyService = BOL_EmailVerifyService::getInstance(); $BOL_AvatarService_inst = BOL_AvatarService::getInstance(); $SKAPI_BOL_Service_inst = SKAPI_BOL_Service::getInstance(); $PHOTO_BOL_PhotoService_inst = PHOTO_BOL_PhotoService::getInstance(); $PHOTO_BOL_PhotoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance(); $PHOTO_BOL_PhotoTemporaryService = PHOTO_BOL_PhotoTemporaryService::getInstance(); $UserResetPassword = BOL_UserResetPasswordDao::getInstance(); $QuestionService = BOL_QuestionService::getInstance(); $AccountTypeToGenderService = SKADATE_BOL_AccountTypeToGenderService::getInstance(); $BOL_AuthorizationService = BOL_AuthorizationService::getInstance(); $BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance(); $USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance(); $BOL_SearchService = BOL_SearchService::getInstance(); $getPluginManager = OW::getPluginManager(); $CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance(); $PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance(); $PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance(); $PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
public function onUserUnregister(OW_Event $event) { $params = $event->getParams(); $userId = $params['userId']; SKAPI_BOL_Service::getInstance()->deleteUserGuests($userId); }
public function markViewed(OW_Event $event) { $params = $event->getParams(); if (empty($params['guestIds'])) { return; } $userId = $params['userId']; $guestIds = $params['guestIds']; SKAPI_BOL_Service::getInstance()->setViewedStatusByGuestIds($userId, $guestIds); }
public function login() { $post = $_POST; $token = null; $required_data = array("username", "password"); foreach ($required_data as $rdata) { if (!array_key_exists($rdata, $post) || empty($post[$rdata])) { $return = array("response_message" => "Please enter " . $rdata, "response_status" => "0"); echo json_encode($return); exit; } } if (empty($post["username"]) || empty($post["password"])) { throw new ErrorException(); } $deviceId = $post["token"]; $deviceType = $post["type"]; $email_check = BOL_UserDao::getInstance()->findUserByUsernameOrEmail($post["username"]); $email_exits = count($email_check); if ($email_exits != '1') { $messages = "Sorry!!!�Your�email is not �registered"; $return_data = array("response_status" => '0', "response_message" => $messages); echo json_encode($return_data); exit; } else { $result = OW::getUser()->authenticate(new BASE_CLASS_StandardAuth($post["username"], $post["password"])); if (!$result->isValid()) { $messages = $result->getMessages(); $messages = "Sorry!!! Your password doesnot match. Please try again"; $return_data = array("response_status" => '0', "response_message" => $messages); echo json_encode($return_data); exit; } else { $token = OW_Auth::getInstance()->getAuthenticator()->getId(); $tokenauth = new OW_TokenAuthenticator($token); $service = PHOTO_BOL_PhotoService::getInstance(); $this->user = BOL_UserService::getInstance()->findUserById($result->getUserId()); $email = $this->user->getEmail(); $account_type = $this->user->getAccountType(); if ($account_type == "8cc28eaddb382d7c6a94aeea9ec029fb") { $sex = "lady"; } else { $sex = "gentleman"; } $username = $this->user->getUsername(); $user_id = $result->getUserId(); $avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($user_id)); $check_exist_value = SKAPI_BOL_Service::getInstance()->findValueExistOrNot($user_id); // echo "<pre>"; // print_r($check_exist_value); // exit; $count_content = count($check_exist_value); if ($count_content == "0") { $user_details = SKAPI_BOL_Service::getInstance()->createUserDetails($user_id, $deviceId, $deviceType); } $messages = "Login Successfully"; $return_data = array("response_status" => '1', "response_message" => $messages, "data" => array("user_id" => $user_id, "user_name" => $username, "email" => $email, "profile_picture" => $avatars[$user_id], "user_type" => $sex)); echo json_encode($return_data); exit; } } }
function login() { global $BOL_UserDao; global $ow_user; global $Userservice; global $BOL_AvatarService_inst; //global $SKAPI_BOL_Service_inst; global $PHOTO_BOL_PhotoService_inst; global $OW_Auth_inst; $app = \Slim\Slim::getInstance(); $app->response->headers->set('Content-Type', 'application/json'); $app->response->setStatus(200); $username = $app->request()->params('username'); $password = $app->request()->params('password'); $token = $app->request()->params('token'); $type = $app->request()->params('type'); $deviceId = $token; $deviceType = $type; $email_check = $BOL_UserDao->findUserByUsernameOrEmail($username); $email_exits = count($email_check); if ($email_exits != '1') { $app = \Slim\Slim::getInstance(); $app->response->headers->set('Content-Type', 'application/json'); $app->response->setStatus(200); $messages = "Sorry!!!Your Username or Email doesnot matched.please try again"; $return_data = array("response_status" => '0', "response_message" => $messages); $app->response->setBody(json_encode($return_data)); } else { $result = $ow_user->authenticate(new BASE_CLASS_StandardAuth($username, $password)); if (!$result->isValid()) { $messages = $result->getMessages(); $messages = "Sorry!!! Your password doesnot match. Please try again"; $return_data = array("response_status" => '0', "response_message" => $messages); $app->response->setBody(json_encode($return_data)); } else { $token = $OW_Auth_inst->getAuthenticator()->getId(); $tokenauth = new OW_TokenAuthenticator($token); $service = $PHOTO_BOL_PhotoService_inst; $user = $Userservice->findUserById($result->getUserId()); $email = $user->getEmail(); $account_type = $user->getAccountType(); if ($account_type == "8cc28eaddb382d7c6a94aeea9ec029fb") { $sex = "lady"; } else { $sex = "gentleman"; } $username = $user->getUsername(); $user_id = $result->getUserId(); $avatars = $BOL_AvatarService_inst->getAvatarsUrlList(array($user_id)); $user_details = SKAPI_BOL_Service::getInstance()->createUserDetails($user_id, $deviceId, $deviceType, ''); $messages = "Login Successfully"; $return_data = array("response_status" => '1', "response_message" => $messages, "data" => array("user_id" => $user_id, "user_name" => $username, "email" => $email, "profile_picture" => $avatars[$user_id], "user_type" => $sex)); $app->response->setBody(json_encode($return_data)); } } }