Example #1
0
 public function __destruct()
 {
     if (empty($this->storage)) {
         OW::getSession()->delete('OW-INSTALL-DATA');
     } else {
         OW::getSession()->set('OW-INSTALL-DATA', $this->storage);
     }
 }
Example #2
0
 public function render()
 {
     //	init
     $iLimit = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     $iLimitSelected = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     //	process
     //$aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance() -> getEnabledProviders($iLimit, (int)$iLimitSelected);
     $aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance()->getProvidersByStatus($bDisplay = true);
     $listProvider = array();
     $step = 0;
     foreach ($aOpenProviders as $item) {
         if (in_array($item->name, array('facebook', 'twitter', 'linkedin'))) {
             if (!YNSOCIALCONNECT_CLASS_SocialConnect::getInstance()->checkSocialBridgePlugin($item->name)) {
                 continue;
             }
         }
         $listProvider[] = $item;
         $step++;
         if ($step >= $iLimit) {
             break;
         }
     }
     $iIconSize = intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) >= 0 ? intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) : 24;
     $iWidth = (count($listProvider) + 1) * ($iIconSize + 6);
     $this->assign('iLimitView', $iLimit);
     $this->assign('iLimitSelected', $iLimitSelected);
     $this->assign('aOpenProviders', $listProvider);
     $this->assign('iIconSize', $iIconSize);
     $this->assign('iWidth', $iWidth);
     $this->assign('sCoreUrl', OW_DIR_ROOT);
     $this->assign('sImgSrc', OW::getPluginManager()->getPlugin('ynsocialconnect')->getStaticUrl() . 'img/');
     //	set url redirect to session
     $uri = OW::getRequest()->getRequestUri();
     // @formatter:off
     if (isset($uri) && strpos($uri, 'socialbridge') === false && strpos($uri, 'ynsocialbridge') === false && strpos($uri, 'ynsocialconnect') === false && strpos($uri, 'socialconnect') === false) {
         $uri = OW_URL_HOME . $uri;
         $_SESSION['ynsc_session']['urlRedirect'] = $uri;
     }
     // @formatter:on
     if (OW::getSession()->isKeySet(YNSOCIALCONNECT_CTRL_Sync::SESSION_SIGNUP_DATA)) {
         $signupData = OW::getSession()->get(YNSOCIALCONNECT_CTRL_Sync::SESSION_SIGNUP_DATA);
         $profilePicture = YNSOCIALCONNECT_CLASS_SocialConnect::getInstance()->getPhotoUrlFromTokenData($signupData['user'], $signupData['service']);
         if ($profilePicture == null) {
             //OW::getSession() -> set(self::SESSION_USE_PROFILE_PHOTO, 'not_use');
             $profilePicture = "";
         } else {
             //OW::getSession() -> set(self::SESSION_USE_PROFILE_PHOTO, 'use');
             $url = OW::getRouter()->urlFor('YNSOCIALCONNECT_CTRL_Sync', 'removeAvatar');
             $removeEl = "<div class=\"ow_avatar_change\"><a href=\"javascript:void(0);\" onclick=\"YNSocialConnect.removeAvatar(\\'{$url}\\');\" class=\"ow_lbutton\">X</a></div>";
             //$removeEl = "<div class=\"ow_avatar_change\"><a href=\"javascript:void(0);\" onclick=\"YNSocialConnect.removeAvatar();\" class=\"ow_lbutton\">X</a></div>";
             $profilePicture = "<div id=\"ynsc_profile_picture\" class=\"ynsc_profile_photo_center\"><img class=\"ynsc_profile_phpto\" src=\"" . $profilePicture . "\">" . $removeEl . "</div><br />";
         }
         $this->assign('profilePicture', $profilePicture);
     }
     //	end
     return parent::render();
 }
Example #3
0
 public function confirmPage()
 {
     if (empty($_GET['back_uri'])) {
         throw new Redirect404Exception();
     }
     OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_BLANK));
     $this->assign('text', OW::getSession()->get('baseConfirmPageMessage'));
     OW::getSession()->delete('baseConfirmPageMessage');
     $this->assign('okBackUrl', OW::getRequest()->buildUrlQueryString(OW_URL_HOME . urldecode($_GET['back_uri']), array('confirm-result' => 1)));
     $this->assign('clBackUrl', OW::getRequest()->buildUrlQueryString(OW_URL_HOME . urldecode($_GET['back_uri']), array('confirm-result' => 0)));
 }
Example #4
0
 public function quickSearch()
 {
     if (!OW::getRequest()->isAjax()) {
         exit(json_encode(array('result' => false)));
     }
     $lang = OW::getLanguage();
     $form = OW::getClassInstance('USEARCH_CLASS_QuickSearchForm', $this);
     $isValid = $form->isValid($_POST);
     $data = $form->getValues();
     if (!empty($data['match_sex'])) {
         $data['match_sex'] = $data['match_sex'];
         OW::getSession()->set(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR, $data);
     }
     if ($isValid) {
         if (!OW::getUser()->isAuthorized('base', 'search_users')) {
             $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
             OW::getFeedback()->warning($status['msg']);
             exit(json_encode(array('result' => false, 'error' => $status['msg'])));
         }
         //            if ( $credits === false )
         //            {
         //                exit(json_encode(
         //                    array('result' => false, 'error' => OW::getEventManager()->call('usercredits.error_message', $eventParams))
         //                ));
         //            }
         $addParams = array('join' => '', 'where' => '');
         if ($data['online']) {
             $addParams['join'] .= " INNER JOIN `" . BOL_UserOnlineDao::getInstance()->getTableName() . "` `online` ON (`online`.`userId` = `user`.`id`) ";
         }
         if ($data['with_photo']) {
             $addParams['join'] .= " INNER JOIN `" . OW_DB_PREFIX . "base_avatar` avatar ON (`avatar`.`userId` = `user`.`id`) ";
             //$addParams['join'] .= " INNER JOIN `".OW_DB_PREFIX . "photo_album` album ON (`album`.`userId` = `user`.`id`)
             //        INNER JOIN `". OW_DB_PREFIX . "photo` `photo` ON (`album`.`id` = `photo`.`albumId`) ";
         }
         $data = USEARCH_BOL_Service::getInstance()->updateSearchData($data);
         $data = USEARCH_BOL_Service::getInstance()->updateQuickSearchData($data);
         $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE, false, $addParams);
         $listId = 0;
         if (count($userIdList) > 0) {
             $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
         }
         OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
         OW::getSession()->set('usearch_search_data', $data);
         BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
         exit(json_encode(array('result' => true, 'url' => OW::getRouter()->urlForRoute("users-search-result", array()))));
     }
     exit(json_encode(array('result' => true, 'url' => OW::getRouter()->urlForRoute("users-search"))));
 }
 public function __construct($items, $page, $orderType = null, $actions = false)
 {
     parent::__construct();
     $this->items = $items;
     $this->actions = $actions;
     $this->page = $page;
     $this->orderType = $orderType;
     $data = OW::getSession()->get('usearch_search_data');
     if ($this->orderType == USEARCH_BOL_Service::LIST_ORDER_DISTANCE) {
         //$location = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('googlemap_location'));
         if (!empty($data['googlemap_location']['json'])) {
             $this->location = $data['googlemap_location'];
         }
     }
     $url = OW::getPluginManager()->getPlugin('usearch')->getStaticCssUrl() . 'search.css';
     OW::getDocument()->addStyleSheet($url);
     $this->assign('searchUrl', OW::getRouter()->urlForRoute('users-search'));
 }
Example #6
0
 public function ajaxResponder()
 {
     if (empty($_POST["command"]) || !OW::getRequest()->isAjax()) {
         throw new Redirect404Exception();
     }
     $command = (string) $_POST["command"];
     switch ($command) {
         case 'checkCaptcha':
             $value = $_POST["value"];
             $result = UTIL_Validator::isCaptchaValid($value);
             if ($result) {
                 OW::getSession()->set('securimage_code_value', $value);
             }
             echo json_encode(array('result' => $result));
             break;
     }
     exit;
 }
 public function process($data)
 {
     if (OW::getRequest()->isPost() && isset($data[self::SUBMIT_NAME]) && $this->isValid($data) && !$this->isAjax()) {
         if (!OW::getUser()->isAuthorized('base', 'search_users')) {
             $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
             OW::getFeedback()->warning($status['msg']);
             $this->controller->redirect();
         }
         $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE);
         $listId = 0;
         if (count($userIdList) > 0) {
             $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
         }
         OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
         BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
         $this->controller->redirect(OW::getRouter()->urlForRoute("users-search-result", array()));
     }
 }
Example #8
0
 public function ajaxResponder()
 {
     if (empty($_POST["command"]) || !OW::getRequest()->isAjax()) {
         throw new Redirect404Exception();
     }
     $command = (string) $_POST["command"];
     switch ($command) {
         case 'checkCaptcha':
             $value = $_POST["value"];
             $result = UTIL_Validator::isCaptchaValid($value);
             if ($result) {
                 OW::getSession()->set('securimage_code_value', $value);
             }
             $result === FALSE ? OW::getEventManager()->trigger(new OW_Event(ANTIBRUTEFORCE_BOL_Service::EVENT_AUTHENTICATE_FAIL)) : NULL;
             echo json_encode(array('result' => $result));
             break;
     }
     exit;
 }
Example #9
0
function usearch_set_presentation(OW_Event $event)
{
    $params = $event->getParams();
    if ($params['type'] != 'search' || !in_array($params['fieldName'], array('sex', 'birthdate'))) {
        return;
    }
    $lang = OW::getLanguage();
    $sessionData = OW::getSession()->get(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR);
    switch ($params['fieldName']) {
        case 'sex':
            $field = new Selectbox('sex');
            $field->setLabel($lang->text('usearch', 'search_label_sex'));
            $field->setHasInvitation(false);
            if (!empty($sessionData['sex'])) {
                $field->setValue($sessionData['sex']);
            }
            break;
        case 'birthdate':
            $field = new USEARCH_CLASS_AgeRangeField('birthdate');
            $field->setLabel($lang->text('usearch', 'age'));
            if (!empty($sessionData['birthdate']['from']) && !empty($sessionData['birthdate']['to'])) {
                $field->setValue($sessionData['birthdate']);
            }
            $configs = !empty($params['configs']) ? BOL_QuestionService::getInstance()->getQuestionConfig($params['configs'], 'year_range') : null;
            $max = !empty($configs['from']) ? date("Y") - (int) $configs['from'] : null;
            $min = !empty($configs['to']) ? date("Y") - (int) $configs['to'] : null;
            $field->setMaxAge($max);
            $field->setMinAge($min);
            $validator = new USEARCH_CLASS_AgeRangeValidator($min, $max);
            $errorMsg = $lang->text('usearch', 'age_range_incorrect_values', array('min' => $min, 'max' => $max));
            $validator->setErrorMessage($errorMsg);
            $field->addValidator($validator);
            break;
    }
    if (!empty($field)) {
        $event->setData($field);
    }
}
Example #10
0
 public function redirect()
 {
     if (OW::getRequest()->isAjax()) {
         $handler = OW::getRequestHandler()->getHandlerAttributes();
         if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_User' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxSignIn') {
             OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
             exit(json_encode(array('result' => TRUE, 'message' => '')));
         } else {
             if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Captcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                 OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
                 exit(json_encode(array('result' => FALSE, 'reload' => OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'))));
             } else {
                 if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'SMARTCAPTCHA_CTRL_SmartCaptcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                     OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
                     exit(json_encode(array('result' => FALSE, 'reload' => OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'))));
                 }
             }
         }
     } else {
         OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
         UTIL_Url::redirect(OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'));
     }
 }
Example #11
0
 public function noPermission($params)
 {
     $username = $params['username'];
     $user = BOL_UserService::getInstance()->findByUsername($username);
     if ($user === null) {
         throw new Redirect404Exception();
     }
     $this->setPageHeading(OW::getLanguage()->text('privacy', 'privacy_no_permission_heading'));
     $this->setPageHeadingIconClass('ow_ic_lock');
     if (OW::getSession()->isKeySet('privacyRedirectExceptionMessage')) {
         $this->assign('message', OW::getSession()->get('privacyRedirectExceptionMessage'));
     }
     $avatarService = BOL_AvatarService::getInstance();
     $viewerId = OW::getUser()->getId();
     $userId = $user->id;
     $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();
     $this->assign('username', $username);
     $this->assign('avatarSize', OW::getConfig()->getValue('base', 'avatar_big_size'));
 }
Example #12
0
 /**
  * Returns inited and checked ftp connection.
  *
  * @throws LogicException
  * @return UTIL_Ftp
  */
 public function getFtpConnection()
 {
     $language = OW::getLanguage();
     $errorMessageKey = null;
     $ftp = null;
     if (!OW::getSession()->isKeySet('ftpAttrs') || !is_array(OW::getSession()->get('ftpAttrs'))) {
         $errorMessageKey = 'plugins_manage_need_ftp_attrs_message';
     } else {
         $ftp = null;
         try {
             $ftp = UTIL_Ftp::getConnection(OW::getSession()->get('ftpAttrs'));
         } catch (Exception $ex) {
             $errorMessageKey = $ex->getMessage();
         }
         if ($ftp !== null) {
             $testDir = OW_DIR_CORE . 'test';
             $ftp->mkDir($testDir);
             if (file_exists($testDir)) {
                 $ftp->rmDir($testDir);
             } else {
                 $errorMessageKey = 'plugins_manage_ftp_attrs_invalid_user';
             }
         }
     }
     if ($errorMessageKey !== null) {
         throw new LogicException($language->text('admin', $errorMessageKey));
     }
     return $ftp;
 }
 protected function getQuestionData()
 {
     $questionData = OW::getSession()->get(self::FORM_SESSEION_VAR);
     if ($questionData === null) {
         $questionData = array();
         if (OW::getUser()->isAuthenticated()) {
             $data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('match_sex'));
             $questionData['match_sex'] = $data[OW::getUser()->getId()]['match_sex'];
             $questionData['googlemap_location']['distance'] = 50;
             OW::getSession()->set(self::FORM_SESSEION_VAR, $questionData);
         }
     } else {
         if (!empty($questionData['match_sex'])) {
             if (is_array($questionData['match_sex'])) {
                 $questionData['match_sex'] = array_shift($questionData['match_sex']);
             } else {
                 for ($i = 0; $i < 31; $i++) {
                     if (pow(2, $i) & $questionData['match_sex']) {
                         $questionData['match_sex'] = pow(2, $i);
                         break;
                     }
                 }
             }
         }
     }
     return $questionData;
 }
Example #14
0
 public function onEmergencyExit(OW_Event $e)
 {
     if (!empty($_COOKIE['adminToken']) && trim($_COOKIE['adminToken']) == OW::getConfig()->getValue('base', 'admin_cookie')) {
         OW::getSession()->set('errorData', serialize($e->getParams()));
     }
 }
Example #15
0
 public function unsetSessionBackUrl()
 {
     $key = 'base.billing.back_url';
     $session = OW::getSession();
     if ($session->isKeySet($key)) {
         $session->delete($key);
     }
     return true;
 }
Example #16
0
 public function ftpAttrs()
 {
     $this->checkXP();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('admin', 'page_title_manage_plugins_ftp_info'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $form = new Form('ftp');
     $login = new TextField('host');
     $login->setValue('localhost');
     $login->setRequired(true);
     $login->setLabel($language->text('admin', 'plugins_manage_ftp_form_host_label'));
     $form->addElement($login);
     $login = new TextField('login');
     $login->setHasInvitation(true);
     $login->setInvitation('login');
     $login->setRequired(true);
     $login->setLabel($language->text('admin', 'plugins_manage_ftp_form_login_label'));
     $form->addElement($login);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $password->setLabel($language->text('admin', 'plugins_manage_ftp_form_password_label'));
     $form->addElement($password);
     $port = new TextField('port');
     $port->setValue(21);
     $port->addValidator(new IntValidator());
     $port->setLabel($language->text('admin', 'plugins_manage_ftp_form_port_label'));
     $form->addElement($port);
     $submit = new Submit('submit');
     $submit->setValue($language->text('admin', 'plugins_manage_ftp_form_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             OW::getSession()->set('ftpAttrs', array('host' => trim($data['host']), 'login' => trim($data['login']), 'password' => trim($data['password']), 'port' => (int) $data['port']));
             if (!empty($_GET['back_uri'])) {
                 $this->redirect(OW_URL_HOME . urldecode($_GET['back_uri']));
             } else {
                 $this->redirectToAction('index');
             }
         }
     }
 }
Example #17
0
 public function process($data)
 {
     if (OW::getRequest()->isPost() && !$this->isAjax() && isset($data['form_name']) && $data['form_name'] === $this->getName()) {
         OW::getSession()->set(self::FORM_SESSEION_VAR, $data);
         OW::getSession()->set('usearch_search_data', $data);
         if (isset($data[self::SUBMIT_NAME]) && $this->isValid($data) && !$this->isAjax()) {
             if (!OW::getUser()->isAuthorized('base', 'search_users')) {
                 $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
                 OW::getFeedback()->warning($status['msg']);
                 $this->controller->redirect();
             }
             //                echo "<pre>";
             //                print_r($data);
             //                exit;
             $data = USEARCH_BOL_Service::getInstance()->updateSearchData($data);
             $addParams = array('join' => '', 'where' => '');
             if ($data['online']) {
                 $addParams['join'] .= " INNER JOIN `" . BOL_UserOnlineDao::getInstance()->getTableName() . "` `online` ON (`online`.`userId` = `user`.`id`) ";
             }
             if ($data['with_photo']) {
                 $addParams['join'] .= " INNER JOIN `" . OW_DB_PREFIX . "base_avatar` avatar ON (`avatar`.`userId` = `user`.`id`) ";
                 //                    $addParams['join'] .= " INNER JOIN `".OW_DB_PREFIX . "photo_album` album ON (`album`.`userId` = `user`.`id`)
                 //                            INNER JOIN `". OW_DB_PREFIX . "photo` `photo` ON (`album`.`id` = `photo`.`albumId`) ";
             }
             $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE, false, $addParams);
             $listId = 0;
             if (OW::getUser()->isAuthenticated()) {
                 foreach ($userIdList as $key => $id) {
                     if (OW::getUser()->getId() == $id) {
                         unset($userIdList[$key]);
                     }
                 }
             }
             if (count($userIdList) > 0) {
                 $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
             }
             OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
             BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
             $this->controller->redirect(OW::getRouter()->urlForRoute("users-search-result", array()));
         }
         $this->controller->redirect(OW::getRouter()->urlForRoute("users-search"));
     }
 }
Example #18
0
 public function resetCurrentLanguage()
 {
     unset($_COOKIE['base_language_id']);
     OW::getSession()->delete('base.language_id');
     self::$currentLanguage = null;
     $this->getCurrent();
 }
Example #19
0
function getCurrentLanguages($lang_id)
{
    global $LanguageService;
    OW::getSession()->set('base.language_id', $lang_id);
    $Langobj = $LanguageService->getCurrent()->setId($lang_id);
    $currentLanguageId = $LanguageService->getCurrent()->getId();
    return $currentLanguageId;
}
Example #20
0
        $installPos = strpos($selfUrl, '/install');
        if (!$installPos) {
            $installPos = strpos($selfUrl, '/ow_install');
        }
        if ($installPos) {
            $selfUrl = substr($selfUrl, 0, $installPos) . '/';
        }
        define('OW_URL_HOME', $selfUrl);
    }
    define('INSTALL_DIR_ROOT', dirname(__FILE__) . DS);
    define('INSTALL_URL_ROOT', OW_URL_HOME . 'ow_install/');
    define('INSTALL_URL_VIEW', INSTALL_URL_ROOT . 'view/');
    define('INSTALL_DIR_CLASSES', INSTALL_DIR_ROOT . 'classes' . DS);
    define('INSTALL_DIR_BOL', INSTALL_DIR_ROOT . 'bol' . DS);
    define('INSTALL_DIR_CTRL', INSTALL_DIR_ROOT . 'controllers' . DS);
    define('INSTALL_DIR_CMP', INSTALL_DIR_ROOT . 'components' . DS);
    define('INSTALL_DIR_VIEW', INSTALL_DIR_ROOT . 'view' . DS);
    define('INSTALL_DIR_VIEW_CTRL', INSTALL_DIR_VIEW . 'controllers' . DS);
    define('INSTALL_DIR_VIEW_CMP', INSTALL_DIR_VIEW . 'components' . DS);
    define('INSTALL_DIR_FILES', INSTALL_DIR_ROOT . 'files' . DS);
    OW::getAutoloader()->addPackagePointer('INSTALL', INSTALL_DIR_CLASSES);
    OW::getAutoloader()->addPackagePointer('INSTALL_BOL', INSTALL_DIR_BOL);
    OW::getAutoloader()->addPackagePointer('INSTALL_CTRL', INSTALL_DIR_CTRL);
    OW::getAutoloader()->addPackagePointer('INSTALL_CMP', INSTALL_DIR_CMP);
    OW::getAutoloader()->addClass('INSTALL', INSTALL_DIR_CLASSES . 'install.php');
    OW::getSession()->start();
    $application = INSTALL_Application::getInstance();
    $application->init($dbReady);
    $application->display($dbReady);
    exit;
}
Example #21
0
 public function __destruct()
 {
     OW::getSession()->set('OW-INSTALL-FEEDBACK', $this->session);
 }
Example #22
0
 public function signOut()
 {
     OW::getUser()->logout();
     if (isset($_COOKIE['ow_login'])) {
         setcookie('ow_login', '', time() - 3600, '/');
     }
     OW::getSession()->set('no_autologin', true);
     $this->redirect(OW::getRouter()->getBaseUrl());
 }
Example #23
0
 /**
  * Constructor.
  */
 public function __construct($message)
 {
     parent::__construct(OW::getRouter()->urlForRoute('base_page_alert'));
     OW::getSession()->set('baseAlertPageMessage', $message);
 }
Example #24
0
 public function clearSession()
 {
     OW::getSession()->delete(self::SESSION_REAL_QUESTION_LIST);
     OW::getSession()->delete(self::SESSION_ALL_QUESTION_LIST);
 }
Example #25
0
 public function removeAvatar()
 {
     OW::getSession()->set(YNSOCIALCONNECT_CMP_ViewInJoinPage::SESSION_USE_PROFILE_PHOTO, 'not_use');
     exit;
 }
Example #26
0
 public function map()
 {
     $listId = OW::getSession()->get(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE);
     $list = BOL_UserService::getInstance()->findSearchResultList($listId, 0, BOL_SearchService::USER_LIST_SIZE);
     $userIdList = array();
     if ($list) {
         foreach ($list as $dto) {
             $userIdList[] = $dto->getId();
         }
         $event = new OW_Event('googlelocation.get_map_component', array('userIdList' => $userIdList));
         OW::getEventManager()->trigger($event);
         $cmp = $event->getData();
         if ($cmp) {
             $this->assign('mapCmp', $cmp);
         }
     } else {
         $this->assign('mapCmp', null);
         $this->assign('searchUrl', OW::getRouter()->urlForRoute('users-search'));
     }
     $this->addComponent('menu', $this->getMenu());
     OW::getDocument()->setHeading(OW::getLanguage()->text('usearch', 'search_result'));
     OW::getDocument()->setDescription(OW::getLanguage()->text('base', 'users_list_user_search_meta_description'));
 }
Example #27
0
function searchResult($params, $listId)
{
    global $SEARCH_RESULT_ID_VARIABLE;
    global $LIST_ORDER_MATCH_COMPATIBILITY;
    global $LIST_ORDER_DISTANCE;
    global $BOL_SearchService;
    global $USEARCH_BOL_Service;
    global $ow_user;
    global $QuestionService;
    global $PHOTO_BOL_PhotoService_inst;
    global $BOL_AvatarService_inst;
    global $Userservice;
    $listId = OW::getSession()->get($SEARCH_RESULT_ID_VARIABLE);
    $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
    $orderType = getOrderType($params);
    //bhushan changes
    if (!$ow_user->isAuthenticated()) {
        if (in_array($orderType, array($LIST_ORDER_MATCH_COMPATIBILITY, $LIST_ORDER_DISTANCE))) {
            throw new Redirect404Exception();
        }
        //    }
        //end bhushan changes
        $limit = 16;
        $itemCount = $BOL_SearchService->countSearchResultItem($listId);
        $list = $USEARCH_BOL_Service->getSearchResultList($listId, $orderType, ($page - 1) * $limit, $limit);
        foreach ($list as $key => $list_id) {
            $ids[] = $list_id->id;
        }
        $user_ids = array_values($ids);
        $single_id = $user_ids[0];
        $userinfoData = array();
        $userinfoData = $QuestionService->getQuestionData($user_ids, array('id', 'username', 'realname', 'birthdate', 'googlemap_location', 'field_f92bbdb57510b86ba6c506c487be3aa1', 'field_d3d1470339c8d689ab705fd19a509655'));
        $avatar = $BOL_AvatarService_inst->getDataForUserAvatars($user_ids);
        $onlineStatus = $Userservice->findOnlineStatusForUserList($user_ids);
        $user_info = array();
        foreach ($userinfoData as $key => $user) {
            $dob = date("Y/m/d", strtotime($user["birthdate"]));
            $age = ageCalculate($dob);
            $userKeyId = $key;
            $photoService = $PHOTO_BOL_PhotoService_inst;
            $photos = $photoService->findPhotoListByUserId($userKeyId, 1, 500);
            $service = null;
            $service_name = null;
            $price = null;
            if (array_key_exists("field_f92bbdb57510b86ba6c506c487be3aa1", $user)) {
                $service = renderQuestion($key, "field_f92bbdb57510b86ba6c506c487be3aa1");
                $service_name = renderQuestion($key, "field_f92bbdb57510b86ba6c506c487be3aa1", true);
            }
            if (array_key_exists("field_d3d1470339c8d689ab705fd19a509655", $user)) {
                $price = $user["field_d3d1470339c8d689ab705fd19a509655"];
            }
            $user_data[] = array("user_id" => $key, "user_name" => $user["username"], "profile_picture" => $avatar[$key]["src"], "available" => !empty($onlineStatus[$key]) ? "Online" : "Offline", "age" => "{$age}", "prices" => $price, "services" => $service, "services_name" => $service_name, "location" => array("latitude" => $user["googlemap_location"]["latitude"], "longitude" => $user["googlemap_location"]["longitude"]), "image" => $photos);
        }
        //    $return_data = array($user_data, $all_services);
        return $user_data;
    }
}
Example #28
0
 public function setAvatarChangeSessionKey()
 {
     $key = OW::getSession()->get(self::AVATAR_CHANGE_SESSION_KEY);
     if (!strlen($key)) {
         $key = uniqid();
         OW::getSession()->set(self::AVATAR_CHANGE_SESSION_KEY, $key);
     }
 }
 public function __construct($controller)
 {
     parent::__construct('QuickSearchForm');
     $this->questionService = BOL_QuestionService::getInstance();
     $this->searchService = USEARCH_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlForRoute('usearch.quick_search_action'));
     $this->setAjaxResetOnSuccess(false);
     $questionNameList = $this->searchService->getQuickSerchQuestionNames();
     $questionValueList = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $sessionData = OW::getSession()->get(self::FORM_SESSEION_VAR);
     if ($sessionData === null) {
         $sessionData = array();
         if (OW::getUser()->isAuthenticated()) {
             $data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('sex', 'match_sex'));
             if (!empty($data[OW::getUser()->getId()]['sex'])) {
                 $sessionData['sex'] = $data[OW::getUser()->getId()]['sex'];
             }
             if (!empty($data[OW::getUser()->getId()]['match_sex'])) {
                 for ($i = 0; $i < 31; $i++) {
                     if (pow(2, $i) & $data[OW::getUser()->getId()]['match_sex']) {
                         $sessionData['match_sex'] = pow(2, $i);
                         break;
                     }
                 }
             }
             $sessionData['googlemap_location']['distance'] = 50;
             OW::getSession()->set(self::FORM_SESSEION_VAR, $sessionData);
         }
     }
     if (!empty($sessionData['match_sex'])) {
         if (is_array($sessionData['match_sex'])) {
             $sessionData['match_sex'] = array_shift($sessionData['match_sex']);
         } else {
             for ($i = 0; $i < 31; $i++) {
                 if (pow(2, $i) & $sessionData['match_sex']) {
                     $sessionData['match_sex'] = pow(2, $i);
                     break;
                 }
             }
         }
     }
     /* ------------------------- */
     $questionDtoList = BOL_QuestionService::getInstance()->findQuestionByNameList($questionNameList);
     $questions = array();
     $questionList = array();
     $orderedQuestionList = array();
     /* @var $question BOL_Question */
     foreach ($questionDtoList as $key => $question) {
         $dataList = (array) $question;
         $questions[$question->name] = $dataList;
         $isRequired = in_array($question->name, array('googlemap_location', 'match_sex')) ? 1 : 0;
         $questions[$question->name]['required'] = $isRequired;
         if ($question->name == 'sex' || $question->name == 'match_sex') {
             unset($questions[$question->name]);
         } else {
             $questionList[$question->name] = $dataList;
         }
     }
     foreach ($questionNameList as $questionName) {
         if (!empty($questionDtoList[$questionName])) {
             $orderedQuestionList[] = $questionDtoList[$questionName];
         }
     }
     $controller->assign('displayGender', false);
     $accounts = $this->getAccountTypes();
     $this->addQuestions($questions, $questionValueList, array());
     $locationField = $this->getElement('googlemap_location');
     if ($locationField) {
         $value = $locationField->getValue();
         if (empty($value['distance'])) {
             $locationField->setDistance(50);
         }
     }
     if (count($accounts) > 1) {
         $this->displayAccountType = true;
         $controller->assign('displayGender', true);
         $sex = new Selectbox('sex');
         $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex'));
         $sex->setHasInvitation(false);
         $sex->setRequired();
         //$accountType->setHasInvitation(false);
         $this->setFieldOptions($sex, 'sex', $questionValueList['sex']);
         if (!empty($sessionData['sex'])) {
             $sex->setValue($sessionData['sex']);
         }
         $this->addElement($sex);
         $matchSex = new Selectbox('match_sex');
         $matchSex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('match_sex'));
         $matchSex->setRequired();
         $matchSex->setHasInvitation(false);
         //$accountType->setHasInvitation(false);
         $this->setFieldOptions($matchSex, 'match_sex', $questionValueList['sex']);
         if (!empty($sessionData['match_sex']) && !is_array($sessionData['match_sex'])) {
             $matchSex->setValue($sessionData['match_sex']);
         }
         $this->addElement($matchSex);
     }
     $controller->assign('questionList', $orderedQuestionList);
     $controller->assign('displayAccountType', $this->displayAccountType);
     // 'online' field
     $onlineField = new CheckboxField('online');
     if (is_array($sessionData) && array_key_exists('online', $sessionData)) {
         $onlineField->setValue((int) $sessionData['online']);
     }
     $onlineField->setLabel($lang->text('usearch', 'online_only'));
     $this->addElement($onlineField);
     //        if ( OW::getPluginManager()->isPluginActive('photo') )
     //        {
     // with photo
     $withPhoto = new CheckboxField('with_photo');
     if (is_array($sessionData) && array_key_exists('with_photo', $sessionData)) {
         $withPhoto->setValue((int) $sessionData['with_photo']);
     }
     $withPhoto->setLabel($lang->text('usearch', 'with_photo'));
     $this->addElement($withPhoto);
     //        }
     // submit
     $submit = new Submit('search');
     $submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( data.result ) {\n                document.location.href = data.url;\n            }\n            else {\n                OW.warning(data.error);\n            }\n        }");
 }
Example #30
0
 protected function userAutoLogin()
 {
     if (OW::getSession()->isKeySet('no_autologin')) {
         OW::getSession()->delete('no_autologin');
         return;
     }
     if (!empty($_COOKIE['ow_login']) && !OW::getUser()->isAuthenticated()) {
         $id = BOL_UserService::getInstance()->findUserIdByCookie(trim($_COOKIE['ow_login']));
         if (!empty($id)) {
             OW_User::getInstance()->login($id);
             $loginCookie = BOL_UserService::getInstance()->findLoginCookieByUserId($id);
             setcookie('ow_login', $loginCookie->getCookie(), time() + 86400 * 7, '/', null, null, true);
         }
     }
 }