예제 #1
0
 public function __construct()
 {
     parent::__construct();
     $this->questionService = BOL_QuestionService::getInstance();
     $this->emailVerifyService = BOL_EmailVerifyService::getInstance();
     $this->userService = BOL_UserService::getInstance();
 }
예제 #2
0
 /**
  * @see Validator::isValid()
  *
  * @param mixed $value
  */
 public function isValid($value)
 {
     $emailVerifyData = BOL_EmailVerifyService::getInstance()->findByHash($value);
     if ($emailVerifyData == null) {
         return false;
     }
     if ($emailVerifyData->type === BOL_EmailVerifyService::TYPE_USER_EMAIL) {
         $user = BOL_UserService::getInstance()->findUserById($emailVerifyData->userId);
         if ($user == null) {
             return false;
         }
     }
     return true;
 }
예제 #3
0
 * This example instantiates a Slim application using
 * its default settings. However, you will usually configure
 * 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();
예제 #4
0
파일: cron.php 프로젝트: ZyXelP/oxwall
 public function run()
 {
     //clean email varify code table
     BOL_EmailVerifyService::getInstance()->deleteByCreatedStamp(time() - self::EMAIL_VARIFY_CODE_REMOVE_TIMEOUT);
     BOL_UserService::getInstance()->cronSendWellcomeLetter();
 }
예제 #5
0
 public function onDeleteUserContent(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = (int) $params['userId'];
     if ($userId > 0) {
         $moderatorId = BOL_AuthorizationService::getInstance()->getModeratorIdByUserId($userId);
         if ($moderatorId !== null) {
             BOL_AuthorizationService::getInstance()->deleteModerator($moderatorId);
         }
         BOL_AuthorizationService::getInstance()->deleteUserRolesByUserId($userId);
         if (isset($params['deleteContent']) && (bool) $params['deleteContent']) {
             BOL_CommentService::getInstance()->deleteUserComments($userId);
             BOL_RateService::getInstance()->deleteUserRates($userId);
             BOL_VoteService::getInstance()->deleteUserVotes($userId);
         }
         //delete widgets
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_DASHBOARD, $userId);
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_PROFILE, $userId);
         // delete email verify
         BOL_EmailVerifyService::getInstance()->deleteByUserId($userId);
         // delete remote auth info
         BOL_RemoteAuthService::getInstance()->deleteByUserId($userId);
         // delete user auth token
         BOL_AuthTokenDao::getInstance()->deleteByUserId($userId);
     }
 }
예제 #6
0
파일: join.php 프로젝트: ZyXelP/oxwall
 protected function joinUser($joinData, $accountType, $params)
 {
     $event = new OW_Event(OW_EventManager::ON_BEFORE_USER_REGISTER, $joinData);
     OW::getEventManager()->trigger($event);
     $language = OW::getLanguage();
     // create new user
     $user = $this->userService->createUser($joinData['username'], $joinData['password'], $joinData['email'], $accountType);
     unset($joinData['username']);
     unset($joinData['password']);
     unset($joinData['email']);
     unset($joinData['accountType']);
     // save user data
     if (!empty($user->id)) {
         if (BOL_QuestionService::getInstance()->saveQuestionsData($joinData, $user->id)) {
             OW::getSession()->delete(JoinForm::SESSION_JOIN_DATA);
             OW::getSession()->delete(JoinForm::SESSION_JOIN_STEP);
             // authenticate user
             OW::getUser()->login($user->id);
             // create Avatar
             $this->createAvatar($user->id);
             $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('userId' => $user->id, 'method' => 'native', 'params' => $params));
             OW::getEventManager()->trigger($event);
             OW::getFeedback()->info(OW::getLanguage()->text('base', 'join_successful_join'));
             if (OW::getConfig()->getValue('base', 'confirm_email')) {
                 BOL_EmailVerifyService::getInstance()->sendUserVerificationMail($user);
             }
         } else {
             OW::getFeedback()->error($language->text('base', 'join_join_error'));
         }
     } else {
         OW::getFeedback()->error($language->text('base', 'join_join_error'));
     }
 }
 /**
  * Save questions data.
  *
  * @param array $data
  * @param int $userId
  */
 public function saveQuestionsData(array $data, $userId)
 {
     if ($data === null || !is_array($data)) {
         return false;
     }
     $user = null;
     if ((int) $userId > 0) {
         $user = $this->userService->findUserById($userId);
         if ($user === null) {
             return false;
         }
     } else {
         return false;
     }
     $oldUserEmail = $user->email;
     $event = new OW_Event('base.questions_save_data', array('userId' => $userId), $data);
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     $dataFields = array_keys($data);
     $questions = $this->questionDao->findQuestionsByQuestionNameList($dataFields);
     $questionsData = $this->dataDao->findByQuestionsNameList($dataFields, $userId);
     $questionsUserData = array();
     foreach ($questionsData as $questionData) {
         $questionsUserData[$questionData->questionName] = $questionData;
     }
     $questionDataArray = array();
     foreach ($questions as $key => $question) {
         $value = null;
         if (isset($data[$question->name])) {
             switch ($question->type) {
                 case self::QUESTION_VALUE_TYPE_TEXT:
                     $value = $question->presentation !== self::QUESTION_PRESENTATION_PASSWORD ? $this->questionTextFormatter(trim($data[$question->name])) : BOL_UserService::getInstance()->hashPassword($data[$question->name]);
                     if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
                         $property = new ReflectionProperty('BOL_User', $question->name);
                         $property->setValue($user, $value);
                     } else {
                         if (isset($questionsUserData[$question->name])) {
                             $questionData = $questionsUserData[$question->name];
                         } else {
                             $questionData = new BOL_QuestionData();
                             $questionData->userId = $userId;
                             $questionData->questionName = $question->name;
                         }
                         $questionData->textValue = $value;
                         if ($question->presentation === self::QUESTION_PRESENTATION_URL && !empty($value)) {
                             $questionData->textValue = $this->urlFilter($value);
                         }
                         $questionDataArray[] = $questionData;
                         //$this->dataDao->save($questionData);
                     }
                     break;
                 case self::QUESTION_VALUE_TYPE_DATETIME:
                     $date = UTIL_DateTime::parseDate($data[$question->name], UTIL_DateTime::DEFAULT_DATE_FORMAT);
                     if (!isset($date)) {
                         $date = UTIL_DateTime::parseDate($data[$question->name], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
                     }
                     if (isset($date)) {
                         if (UTIL_Validator::isDateValid($date[UTIL_DateTime::PARSE_DATE_MONTH], $date[UTIL_DateTime::PARSE_DATE_DAY], $date[UTIL_DateTime::PARSE_DATE_YEAR])) {
                             $value = $date[UTIL_DateTime::PARSE_DATE_YEAR] . '-' . $date[UTIL_DateTime::PARSE_DATE_MONTH] . '-' . $date[UTIL_DateTime::PARSE_DATE_DAY];
                             if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
                                 $property = new ReflectionProperty('BOL_User', $question->name);
                                 $property->setValue($user, $value);
                             } else {
                                 if (isset($questionsUserData[$question->name])) {
                                     $questionData = $questionsUserData[$question->name];
                                 } else {
                                     $questionData = new BOL_QuestionData();
                                     $questionData->userId = $userId;
                                     $questionData->questionName = $question->name;
                                 }
                                 $questionData->dateValue = $value;
                                 $questionDataArray[] = $questionData;
                             }
                         }
                     }
                     break;
                 case self::QUESTION_VALUE_TYPE_MULTISELECT:
                     if (!empty($data[$question->name]) && is_array($data[$question->name])) {
                         $value = array_sum($data[$question->name]);
                     }
                 case self::QUESTION_VALUE_TYPE_SELECT:
                     if (!isset($value)) {
                         $value = (int) $data[$question->name];
                     }
                     if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
                         $property = new ReflectionProperty('BOL_User', $question->name);
                         $property->setValue($user, $value);
                     } else {
                         if (isset($questionsUserData[$question->name])) {
                             $questionData = $questionsUserData[$question->name];
                         } else {
                             $questionData = new BOL_QuestionData();
                             $questionData->userId = $userId;
                             $questionData->questionName = $question->name;
                         }
                         $questionData->intValue = $value;
                         $questionDataArray[] = $questionData;
                         //$this->dataDao->save($questionData);
                     }
                     break;
                 case self::QUESTION_VALUE_TYPE_BOOLEAN:
                     $value = false;
                     $issetValues = array('1', 'true', 'on');
                     if (in_array(mb_strtolower((string) $data[$question->name]), $issetValues)) {
                         $value = true;
                     }
                     if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
                         $property = new ReflectionProperty('BOL_User', $question->name);
                         $property->setValue($user, $value);
                     } else {
                         if (isset($questionsUserData[$question->name])) {
                             $questionData = $questionsUserData[$question->name];
                         } else {
                             $questionData = new BOL_QuestionData();
                             $questionData->userId = $userId;
                             $questionData->questionName = $question->name;
                         }
                         $questionData->intValue = $value;
                         $questionDataArray[] = $questionData;
                         //$this->dataDao->save($questionData);
                     }
                     break;
             }
         }
     }
     $sendVerifyMail = false;
     if ($user->id !== null) {
         if (strtolower($user->email) !== strtolower($oldUserEmail)) {
             $user->emailVerify = false;
             $sendVerifyMail = true;
         }
         if (!empty($data['accountType'])) {
             $accountType = $this->findAccountTypeByName($data['accountType']);
             $accountTypeOld = $this->findAccountTypeByName($user->accountType);
             if (!empty($accountType)) {
                 $user->accountType = $accountType->name;
                 $this->updateQuestionsEditStamp();
             }
         }
     }
     //printVar($user);
     $this->userService->saveOrUpdate($user);
     if (count($questionDataArray) > 0) {
         $this->dataDao->batchReplace($questionDataArray);
     }
     if ($sendVerifyMail && OW::getConfig()->getValue('base', 'confirm_email')) {
         BOL_EmailVerifyService::getInstance()->sendUserVerificationMail($user);
     }
     return true;
 }
예제 #8
0
파일: service.php 프로젝트: vazahat/dudex
 public function register()
 {
     $curent_url = OW_URL_HOME;
     $ret = false;
     $return_text = "";
     //print_r($_POST);
     //echo "afaFSD";exit;
     //OW::getFeedback()->info('REGISTER OK TODO!');
     //OW::getApplication()->redirect($curent_url);
     //                if (isset($_GET['register']) AND $_GET['register']=="true" AND isset($_POST['doregister'])){
     if (isset($_POST['ss']) and $_POST['ss'] == substr(session_id(), 3, 5)) {
         //                    if ($_POST['doregister']==session_id() ){
         if (isset($_POST['ss']) and $_POST['ss'] == substr(session_id(), 3, 5)) {
             //$_SESSION['joinData']['accountType']=$_POST['acctype'];
             //$_SESSION['joinData']['username']=$_POST['uname'];
             //$_SESSION['joinData']['email']=$_POST['email'];
             //$_SESSION['joinData']['password']=$_POST['pass'];
             if (!isset($_POST['acctype'])) {
                 $_POST['acctype'] = "";
             }
             if (!isset($_POST['muname'])) {
                 $_POST['muname'] = "";
             }
             if (!isset($_POST['uname'])) {
                 $_POST['uname'] = "";
             }
             if (!isset($_POST['email'])) {
                 $_POST['email'] = "";
             }
             if (!isset($_POST['pass'])) {
                 $_POST['pass'] = "";
             }
             if (!isset($_POST['pass2'])) {
                 $_POST['pass2'] = "";
             }
             if (!isset($_POST['sex'])) {
                 $_POST['sex'] = "1";
             }
             if (!isset($_POST['eage_d'])) {
                 $_POST['eage_d'] = "";
             }
             if (!isset($_POST['eage_m'])) {
                 $_POST['eage_m'] = "";
             }
             if (!isset($_POST['eage_y'])) {
                 $_POST['eage_y'] = "";
             }
             //                        if (!isset($_POST['f_username'])) $_POST['f_username']="";
             //                        if (!isset($_POST['f_email'])) $_POST['f_email']="";
             //                        if (!isset($_POST['f_password'])) $_POST['f_password']="";
             //                        if (!isset($_POST['f_password_retype'])) $_POST['f_password_retype']="";
             if (!isset($_POST['f_realname'])) {
                 $_POST['f_realname'] = "";
             }
             if (!isset($_POST['f_sex'])) {
                 $_POST['f_sex'] = "";
             }
             //                        if (!isset($_POST['f_date'])) $_POST['f_date']="";
             //                        if (!isset($_POST['f_bmonth'])) $_POST['f_bmonth']="";
             //                        if (!isset($_POST['f_bday'])) $_POST['f_bday']="";
             //                        if (!isset($_POST['f_byear'])) $_POST['f_byear']="";
             $f_accountType = $_POST['acctype'];
             $f_username = $_POST['uname'];
             $f_username = strip_tags($f_username, "");
             //$f_username = ereg_replace("[^A-Za-z0-9]", "",$f_username);
             $f_username = preg_replace("~[^A-Za-z0-9 (),]~", "", $f_username);
             //echo $f_username;exit;
             $f_email = $_POST['email'];
             $f_password = $_POST['pass'];
             $f_password_retype = $_POST['pass2'];
             if (isset($_POST['muname']) and strlen($_POST['muname']) > 3) {
                 $f_realname = $_POST['muname'];
             } else {
                 $f_realname = $f_username;
             }
             $f_realname = strip_tags($f_realname, "");
             //$f_realname = ereg_replace("[^A-Za-z0-9 ]", "",$f_realname);
             $f_realname = preg_replace("~[^A-Za-z0-9 (),]~", "", $f_realname);
             $f_sex = $_POST['sex'];
             //                        $f_date=$_POST['f_date'];
             $f_bmonth = $_POST['eage_m'];
             $f_bday = $_POST['eage_d'];
             $f_byear = $_POST['eage_y'];
             //echo "sss";
             //print_r($_GET);
             //print_r($_POST);
             //exit;
             //echo "afsdfsdF";exit;
             //echo $f_accountType."--".$f_password."--".$f_password_retype."--".$f_username."--".$f_email."--".$f_realname;exit;
             //                        if (strlen($f_password)>3 AND $f_password==$f_password_retype AND strlen($f_username)>3 AND strlen($f_email)>5 AND strlen($f_realname)>3 AND $f_sex>0 AND $f_bmonth>0 AND $f_bday>0 AND $f_byear>0){
             if (strlen($f_accountType) > 3 and strlen($f_password) > 3 and $f_password == $f_password_retype and strlen($f_username) > 3 and strlen($f_email) > 5 and strlen($f_realname) > 3) {
                 //return true;
                 $sql = "SELECT * FROM " . OW_DB_PREFIX . "base_user WHERE email LIKE '" . addslashes($f_email) . "' OR username LIKE '" . addslashes($f_username) . "' LIMIT 1";
                 $arr = OW::getDbo()->queryForList($sql);
                 if (isset($arr[0])) {
                     $value = $arr[0];
                 } else {
                     $value = array();
                     $value['id'] = 0;
                 }
                 if (!isset($value)) {
                     $value = array();
                     $value['id'] = 0;
                 }
                 $language = OW::getLanguage();
                 if ($value['id'] > 0) {
                     if (strtolower($value['email']) == strtolower($f_email)) {
                         $_SESSION['userId'] = -100;
                         OW::getSession()->set('userId', -100);
                         $ret = -100;
                         $return_text = OW::getLanguage()->text('mobille', 'join_email_exist');
                     } else {
                         $_SESSION['userId'] = -200;
                         OW::getSession()->set('userId', -200);
                         $ret = -200;
                         $return_text = OW::getLanguage()->text('mobille', 'join_uername_exist');
                     }
                 } else {
                     $userService = BOL_UserService::getInstance();
                     $username = $f_username;
                     $password = $f_password;
                     $email = $f_email;
                     //                                $accountType="290365aadde35a97f11207ca7e4279cc";
                     $accountType = $f_accountType;
                     $session = OW::getSession();
                     //print_r($_SESSION);
                     //print_r(OW::getSession()->get());exit;
                     //                                $joinData = $session->get(JoinForm::SESSION_JOIN_DATA);
                     $joinData = array();
                     //                                if ( !isset($joinData) || !is_array($joinData) )
                     //                                {
                     //                                    $joinData = array();
                     //                                }
                     //                        if ($f_bmonth<10) $f_bmonth="0".$f_bmonth;
                     //                        if ($f_bday<10) $f_bday="0".$f_bday;
                     if ($f_realname) {
                         $joinData['realname'] = $f_realname;
                     }
                     //                                $joinData['sex']=$f_sex;
                     if ($f_sex) {
                         $joinData['sex'] = $f_sex;
                     }
                     if ($f_byear > 1000 and $f_bmonth and $f_bmonth) {
                         if ($f_bday < 10) {
                             $f_bday = "0" . $f_bday;
                         }
                         if ($f_bmonth < 10) {
                             $f_bmonth = "0" . $f_bmonth;
                         }
                         $joinData['birthdate'] = $f_byear . "/" . $f_bmonth . "/" . $f_bday;
                     }
                     /*
                     Array
                     (
                         [form_name] =&gt; joinForm
                         [accountType] =&gt; 290365aadde35a97f11207ca7e4279cc
                         [username] =&gt; aron12345
                         [email] =&gt; aron@grafnet.pl
                         [password] =&gt; qazxsw123
                         [realname] =&gt; AronMobile
                         [sex] =&gt; 1
                         [birthdate] =&gt; 1983/2/3
                         [match_sex] =&gt; 1
                         [relationship] =&gt; 0
                         [c441a8a9b955647cdf4c81562d39068a] =&gt; 
                         [7fd3b96ec84474824e77b40b4a596b38] =&gt; 
                         [e44413c6a9c86df86b737b8b93dfa764] =&gt; 
                         [f5b4c04c754a7cb1688c4bc4ed04587e] =&gt; 
                         [0263e86fab7db4b4ad2fd146697bd54f] =&gt; 
                         [58a3516a5e1479aad73527387fd75720] =&gt; 
                         [b749bf00d8dca816161feb7699a0a511] =&gt; 
                         [userPhoto] =&gt; Virunga.jpg
                         [termOfUse] =&gt; 1
                         [captchaField] =&gt; rzlzzc
                     )
                     */
                     //print_r($joinData);exit;
                     //                            $data = $joinForm->getValues();
                     //                            $joinData = array_merge($joinData, $data);
                     //$joinData[$question['name']] = array_sum($joinData[$question['name']]);
                     //                                    $joinData[$question['name']] = 0;
                     $user = $userService->createUser($username, $password, $email, $accountType);
                     //                    $_SESSION['userId']=$user->id;
                     //                    OW::getSession()->set('userId', $user->id);
                     //return true;
                     if ($user->id > 0) {
                         $_SESSION['last_msgXXXXXXXXX'] = $user->id;
                     } else {
                         $_SESSION['last_msgXXXXXXXXX'] = "ERROR";
                     }
                     if (!empty($user->id)) {
                         $ret = $user->id;
                         $_SESSION['userId'] = $user->id;
                         OW::getSession()->set('userId', $user->id);
                         if (BOL_QuestionService::getInstance()->saveQuestionsData($joinData, $user->id)) {
                             //                                        OW::getSession()->delete(JoinForm::SESSION_JOIN_DATA);
                             //                                        OW::getSession()->delete(JoinForm::SESSION_JOIN_STEP);
                             // authenticate user
                             OW::getUser()->login($user->id);
                             // create Avatar
                             //                                    $this->createAvatar($user->id);
                             $uploaddir = OW::getPluginManager()->getPlugin('startpage')->getUserFilesDir();
                             $img_temp = session_id() . ".tmpav.jpg";
                             if ($this->file_exist($uploaddir . $img_temp)) {
                                 $avatarService = BOL_AvatarService::getInstance();
                                 $avatarService->setUserAvatar($user->id, $uploaddir . $img_temp);
                                 $this->file_delete($uploaddir . $img_temp);
                             }
                             $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('userId' => $user->id, 'method' => 'native', 'params' => $_GET));
                             OW::getEventManager()->trigger($event);
                             $return_text = OW::getLanguage()->text('base', 'join_successful_join');
                             if (OW::getConfig()->getValue('base', 'confirm_email')) {
                                 BOL_EmailVerifyService::getInstance()->sendUserVerificationMail($user);
                             }
                             $_SESSION['userId'] = $user->id;
                             OW::getSession()->set('userId', $user->id);
                             //                                    $_SESSION['succesregister_done']=true;
                             $ret = $user->id;
                             /*
                             //---ins se s
                             if (!isset($_POST['sex']) AND $_POST['sex']!="" AND $user->id>0){
                                 $sql="INSERT INTO " . OW_DB_PREFIX. "base_question_data (
                                     id,      questionName    ,userId , textValue     ,  intValue      ,  dateValue
                                 )VALUES(
                                     '','sex','".addslashes($user->id)."','','".addslashes()."',NULL
                                 ) ON DUPLICATE KEY UPDATE intValue='".addslashes($_POST['sex'])."' ";
                                 OW::getDbo()->insert($sql);
                             }
                             //---ins se e
                             */
                         } else {
                             $return_text = OW::getLanguage()->text('mobille', 'join_QuestionService_error');
                         }
                     } else {
                         $return_text = OW::getLanguage()->text('mobille', 'join_creating_user_error');
                     }
                 }
                 //else not exust
             } else {
                 if ($f_password != $f_password_retype or strlen($f_password) > 3) {
                     $return_text = OW::getLanguage()->text('mobille', 'join_error_retypepassword_is_diferent');
                 } else {
                     $return_text = OW::getLanguage()->text('mobille', 'join_error_fill_allrequiredfieds');
                 }
                 //                        $return_text=$language->text('mobille', 'join_acces_error');
             }
         } else {
             $return_text = OW::getLanguage()->text('mobille', 'join_acces_error');
         }
     }
     $_SESSION['last_msg'] = $return_text;
     return $ret;
 }
예제 #9
0
 /**
  * Updates video plugin configuration
  *
  * @return boolean
  */
 public function process()
 {
     $values = $this->getValues();
     $config = OW::getConfig();
     //begin update lang cache
     $siteName = $config->getValue('base', 'site_name');
     $config->saveConfig('base', 'site_name', $values['siteTitle']);
     if ($siteName != $config->getValue('base', 'site_name')) {
         BOL_LanguageService::getInstance()->generateCacheForAllActiveLanguages();
     }
     if (defined('OW_PLUGIN_XP')) {
         //end update lang cache
         $siteEmail = $config->getValue('base', 'unverify_site_email');
         if ($siteEmail !== trim($values['siteEmail'])) {
             $config->saveConfig('base', 'unverify_site_email', $values['siteEmail']);
             BOL_EmailVerifyService::getInstance()->sendSiteVerificationMail();
         }
     } else {
         $config->saveConfig('base', 'site_email', $values['siteEmail']);
     }
     //        join_display_photo_upload  	true  	Display photo upload on join page
     //        join_photo_upload_set_required 	false 	Set required photo upload field on join page
     //        join_display_terms_of_use
     $config->saveConfig('base', 'site_tagline', $values['tagline']);
     $config->saveConfig('base', 'site_description', $values['description']);
     $config->saveConfig('base', 'site_timezone', $values['timezone']);
     $config->saveConfig('base', 'site_use_relative_time', $values['relativeTime'] ? '1' : '0');
     $config->saveConfig('base', 'military_time', $values['militaryTime'] ? '1' : '0');
     $config->saveConfig('base', 'date_field_format', $values['dateFieldFormat']);
     $config->saveConfig('base', 'billing_currency', $values['currency']);
     //        $config->saveConfig('base', 'tf_allow_pic_upload', $values['tf-allow-pic-upload']);
     //        $config->saveConfig('base', 'tf_max_pic_size', $values['tf-max-image-size']);
     return array('result' => true);
 }
예제 #10
0
 public function sendVerificationMail($type, $params)
 {
     $subject = $params['subject'];
     $template_html = $params['body_html'];
     $template_text = $params['body_text'];
     switch ($type) {
         case self::TYPE_USER_EMAIL:
             $user = $params['user'];
             $email = $user->email;
             $userId = $user->id;
             break;
         case self::TYPE_SITE_EMAIL:
             $email = OW::getConfig()->getValue('base', 'unverify_site_email');
             $userId = 0;
             break;
         default:
             OW::getFeedback()->error($language->text('base', 'email_verify_verify_mail_was_not_sent'));
             return;
     }
     $emailVerifiedData = BOL_EmailVerifyService::getInstance()->findByEmailAndUserId($email, $userId, $type);
     if ($emailVerifiedData !== null) {
         $timeLimit = 60 * 60 * 24 * 3;
         // 3 days
         if (time() - (int) $emailVerifiedData->createStamp >= $timeLimit) {
             $emailVerifiedData = null;
         }
     }
     if ($emailVerifiedData === null) {
         $emailVerifiedData = new BOL_EmailVerify();
         $emailVerifiedData->userId = $userId;
         $emailVerifiedData->email = trim($email);
         $emailVerifiedData->hash = BOL_EmailVerifyService::getInstance()->generateHash();
         $emailVerifiedData->createStamp = time();
         $emailVerifiedData->type = $type;
         BOL_EmailVerifyService::getInstance()->batchReplace(array($emailVerifiedData));
     }
     $vars = array('code' => $emailVerifiedData->hash, 'url' => OW::getRouter()->urlForRoute('base_email_verify_code_check', array('code' => $emailVerifiedData->hash)), 'verification_page_url' => OW::getRouter()->urlForRoute('base_email_verify_code_form'));
     $language = OW::getLanguage();
     $subject = UTIL_String::replaceVars($subject, $vars);
     $template_html = UTIL_String::replaceVars($template_html, $vars);
     $template_text = UTIL_String::replaceVars($template_text, $vars);
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($emailVerifiedData->email);
     $mail->setSubject($subject);
     $mail->setHtmlContent($template_html);
     $mail->setTextContent($template_text);
     OW::getMailer()->send($mail);
     if (!isset($params['feedback']) || $params['feedback'] !== false) {
         OW::getFeedback()->info($language->text('base', 'email_verify_verify_mail_was_sent'));
     }
 }
예제 #11
0
파일: join.php 프로젝트: hardikamutech/loov
 protected function joinUser($joinData, $accountType, $params)
 {
     $event = new OW_Event(OW_EventManager::ON_BEFORE_USER_REGISTER, $joinData);
     OW::getEventManager()->trigger($event);
     $language = OW::getLanguage();
     // create new user
     $user = $this->userService->createUser($joinData['username'], $joinData['password'], $joinData['email'], $accountType);
     $password = $joinData['password'];
     unset($joinData['username']);
     unset($joinData['password']);
     unset($joinData['email']);
     unset($joinData['accountType']);
     // save user data
     if (!empty($user->id)) {
         if (BOL_QuestionService::getInstance()->saveQuestionsData($joinData, $user->id)) {
             OW::getSession()->delete(JoinForm::SESSION_JOIN_DATA);
             OW::getSession()->delete(JoinForm::SESSION_JOIN_STEP);
             // authenticate user
             OW::getUser()->login($user->id);
             // create Avatar
             BOL_AvatarService::getInstance()->createAvatar($user->id, false, false);
             $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('userId' => $user->id, 'method' => 'native', 'params' => $params));
             OW::getEventManager()->trigger($event);
             OW::getFeedback()->info(OW::getLanguage()->text('base', 'join_successful_join'));
             if (OW::getConfig()->getValue('base', 'confirm_email')) {
                 BOL_EmailVerifyService::getInstance()->sendUserVerificationMail($user);
             }
         } else {
             OW::getFeedback()->error($language->text('base', 'join_join_error'));
         }
         $billingService = BOL_BillingService::getInstance();
         $membershipService = MEMBERSHIP_BOL_MembershipService::getInstance();
         //$url = OW::getRouter()->urlForRoute('membership_subscribe');
         $lang = OW::getLanguage();
         $planId = 16;
         $userId = $user->id;
         if (!($plan = $membershipService->findPlanById($planId))) {
             $message = $lang->text('membership', 'plan_not_found');
             //            OW::getApplication()->redirect($url);
             $this->jsonEncodeResponse(array("status" => "false", "message" => $message));
         }
         if ($plan->price == 0) {
             // trial plan
             // check if trial plan used
             $used = $membershipService->isTrialUsedByUser($userId);
             if ($used) {
                 $message = $lang->text('membership', 'trial_used_error');
             } else {
                 // give trial plan
                 $userMembership = new MEMBERSHIP_BOL_MembershipUser();
                 $userMembership->userId = $userId;
                 $userMembership->typeId = $plan->typeId;
                 $userMembership->expirationStamp = time() + (int) $plan->period * 3600 * 24;
                 $userMembership->recurring = 0;
                 $userMembership->trial = 1;
                 $membershipService->setUserMembership($userMembership);
                 $membershipService->addTrialPlanUsage($userId, $plan->id, $plan->period);
             }
         }
     } else {
         OW::getFeedback()->error($language->text('base', 'join_join_error'));
     }
 }