Пример #1
0
function resendEmailVerify()
{
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    $user_id = $app->request()->params("user_id");
    $email_id = $app->request()->params("email");
    $lang_id = (int) $app->request()->params("lang_id");
    $currentLanguageId = getCurrentLanguages($lang_id);
    $user = BOL_UserService::getInstance()->findUserById($user_id);
    $email = htmlspecialchars(trim($email_id));
    if ($user->email != $email) {
        BOL_UserService::getInstance()->updateEmail($user->id, $email);
        $user->email = $email;
    }
    sendUserVerificationMail($user);
    if ($currentLanguageId == '32') {
        $messages = "Bestätigungsemail wurde versandt";
    } else {
        if ($currentLanguageId == '33') {
            $messages = "La verificación de email ha sido enviada con éxito";
        } else {
            $messages = "Verification email successfully sent";
        }
    }
    $return_data = array("response_status" => '1', "response_message" => $messages);
    $app->response->setBody(json_encode($return_data));
}
Пример #2
0
function resendEmailVerify()
{
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    //Lang Call Start
    $hammu_lang_id = $app->request()->params("lang_id");
    if (!empty($hammu_lang_id)) {
        getCurrentLanguages($hammu_lang_id);
    }
    //Lang Call end
    $user_id = $app->request()->params("user_id");
    $email_id = $app->request()->params("email");
    $user = BOL_UserService::getInstance()->findUserById($user_id);
    $email = htmlspecialchars(trim($email_id));
    if ($user->email != $email) {
        BOL_UserService::getInstance()->updateEmail($user->id, $email);
        $user->email = $email;
    }
    sendUserVerificationMail($user);
    $messages = $language->text("hammu", "resend_mail_sent_success");
    //"Verification email successfully sent";
    $return_data = array("response_status" => '1', "response_message" => $messages);
    $app->response->setBody(json_encode($return_data));
}
Пример #3
0
function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    global $EmailVerifyService;
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    //$match_sex = $app->request()->params('match_sex');
    //$preferences_or_services = $app->request()->params('preferences_or_services');
    //$photo = $app->request()->params('photo');
    //$photo_data = $_FILES["photo"];
    $username = $app->request()->params('username');
    $email = $app->request()->params('email');
    $password = $app->request()->params('password');
    $realname = $app->request()->params('realname');
    $sex = $app->request()->params('sex');
    $i_m_using = $app->request()->params(HAMMU_DB_IM_USING_HAMMU_AS_KEY);
    $googlemap_location = $app->request()->params('googlemap_location');
    $birthdate = $app->request()->params('birthdate');
    $mobile_number = $app->request()->params(HAMMU_DB_MOBILE_NUMBER_KEY);
    $meeting_point = $app->request()->params(HAMMU_DB_METTING_POINT_KEY);
    $pay_pal_address = $app->request()->params(HAMMU_DB_PAYMENT_TYPE_KEY);
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $preferences = $app->request()->params(HAMMU_DB_SERVICES_KEY);
    $deviceId = $token;
    $deviceType = $type;
    $preferenceArr = explode(",", $preferences);
    $preVal = 0;
    foreach ($preferenceArr as $key => $value) {
        $preVal = $preVal + $value;
    }
    $data["email"] = urldecode($email);
    $data["username"] = $username;
    $data['password'] = $password;
    $data["googlemap_location"] = $googlemap_location;
    $data["birthdate"] = $birthdate;
    $data[HAMMU_DB_MOBILE_NUMBER_KEY] = $mobile_number;
    $data["sex"] = $sex;
    $today_date_timestamp = strtotime(date("d-m-Y"));
    $birth_date_timestamp = strtotime($birthdate);
    if ($birth_date_timestamp > $today_date_timestamp) {
        $return_data = array("response_status" => "0", "response_message" => "Please Provide Proper Date!");
        $app->response->setBody(json_encode($return_data));
    } else {
        $crdata = checkuserexists($data);
        if (count($crdata) > 0) {
            $app->response->setBody(json_encode($crdata));
        } else {
            $username = trim(preg_replace('/[^\\w]/', '', $username));
            $username = makeUsername($username);
            $data['realname'] = $username;
            $newUser = false;
            $accountdata = $SKADATE_BOL_AccountTypeToGenderDao->findByGenderValue($sex);
            $accounttype = $accountdata[0]->accountType;
            $user = $Userservice->createUser($username, $password, $data["email"], $accounttype, false);
            sendUserVerificationMail($user);
            $newUser = true;
            unset($data['email']);
            unset($data['password']);
            unset($data['username']);
            //Geo location settings on address
            $price = $app->request()->params(HAMMU_DB_PRICE_KEY);
            if (!empty($price)) {
                $final_price = $price;
            } else {
                $final_price = "";
            }
            if (!empty($data["googlemap_location"])) {
                $urlencode_address = urlencode($data["googlemap_location"]);
                $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=' . $urlencode_address . '&sensor=false');
                $output = json_decode($geocode);
                if (!empty($output->results[0]->formatted_address)) {
                    $data_location[HAMMU_DB_PRICE_KEY] = $final_price;
                    $data_location['googlemap_location']['address'] = $output->results[0]->formatted_address;
                    $data_location['googlemap_location']['latitude'] = $output->results[0]->geometry->location->lat;
                    $data_location['googlemap_location']['longitude'] = $output->results[0]->geometry->location->lng;
                    $data_location['googlemap_location']['northEastLat'] = $output->results[0]->geometry->bounds->northeast->lat;
                    $data_location['googlemap_location']['northEastLng'] = $output->results[0]->geometry->bounds->northeast->lng;
                    $data_location['googlemap_location']['southWestLat'] = $output->results[0]->geometry->bounds->southwest->lat;
                    $data_location['googlemap_location']['southWestLng'] = $output->results[0]->geometry->bounds->southwest->lng;
                    $data_location['googlemap_location']['json'] = json_encode($output->results[0]);
                    $data_location['birthdate'] = $data["birthdate"];
                    $data_location['sex'] = $sex;
                    $data_location['realname'] = $realname;
                    $data_location[HAMMU_DB_MOBILE_NUMBER_KEY] = $data[HAMMU_DB_MOBILE_NUMBER_KEY];
                    $data_location[HAMMU_DB_SERVICES_KEY] = $preVal;
                    $data_location[HAMMU_DB_PAYMENT_TYPE_KEY] = $pay_pal_address;
                    $data_location[HAMMU_DB_IM_USING_HAMMU_AS_KEY] = $i_m_using;
                    $data_location[HAMMU_DB_METTING_POINT_KEY] = $meeting_point;
                }
            }
            if ($i_m_using == "1") {
                array_shift($data_location);
            }
            //            print_r($data_location);
            //            exit;
            BOL_QuestionService::getInstance()->saveQuestionsData(array_filter($data_location), $user->id);
            if (!empty($_FILES)) {
                $files = $_FILES;
                //PHOTO_BOL_PhotoService::getInstance()->getPhotoPath($data["photoId"], $data["hash"], 'original');
                $path = $_FILES['photo']['tmp_name'];
                $avtar = $BOL_AvatarService_inst->setUserAvatar($user->id, $path);
            }
            $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('method' => 'native', 'userId' => $user->id, 'params' => array()));
            OW::getEventManager()->trigger($event);
            $avatars = $BOL_AvatarService_inst->getAvatarsUrlList(array($user->id));
            $filed_array = array(HAMMU_DB_PREFRENCES_KEY, HAMMU_DB_SERVICES_KEY);
            $all_services_preferences = getallquestions(array("user_id" => $user->id, "fields" => $filed_array));
            if ($i_m_using == "1") {
                $sex_type = "client";
                $type = "preferences";
            } else {
                $sex_type = "escort";
                $type = "services";
            }
            $messages = "SignUp Successfully";
            $return_data = array("response_status" => '1', "response_message" => $messages, "data" => array("user_id" => $user->id, "user_name" => $username, "email" => urldecode($email), "profile_picture" => $avatars[$user->id], "phone_number" => $mobile_number, "birthday" => $birthdate, "user_type" => $sex_type, $type => $all_services_preferences[0]['userSelectedLabel']));
            $app->response->setBody(json_encode($return_data));
        }
    }
}