Esempio n. 1
0
function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    //global $EmailVerifyService;
    global $SKAPI_BOL_Service_inst;
    global $language;
    $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
    //$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);
    //hardik edited
    $HOTEL_SERVICE = $app->request()->params(HAMMU_HOTEL_SERVICE);
    $HOME_VISIT = $app->request()->params(HAMMU_HOME_VISIT);
    $HAMMU_AVAILABLE_AT = urldecode($app->request()->params(HAMMU_AVAILABLE_AT));
    $SECRET_FANTASY = $app->request()->params(HAMMU_SECRET_FANTASY);
    $HAMMU_LANGUAGE = $app->request()->params(HAMMU_LANGUAGE);
    $HAMMU_COUNTRY = $app->request()->params(HAMMU_COUNTRY);
    //
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $preferences = $app->request()->params(HAMMU_DB_SERVICES_KEY);
    $lang = $app->request()->params(HAMMU_LANG);
    $deviceId = $token;
    $deviceType = $type;
    $preferenceArr = explode(",", $preferences);
    $langArr = explode(",", $lang);
    //print_r($preferenceArr);
    $preVal = 0;
    foreach ($preferenceArr as $key => $value) {
        $preVal = $preVal + $value;
    }
    $langVal = 0;
    foreach ($langArr as $key => $value) {
        $langVal = $langVal + $value;
    }
    //
    $HAMMU_AVAILABLE_ATArr = explode(",", $HAMMU_AVAILABLE_AT);
    //print_r($HAMMU_AVAILABLE_ATArr);
    // die;
    //    $preVal1 = 0;
    //    foreach ($HAMMU_AVAILABLE_ATArr as $key => $value) {
    //        $preVal1 = $preVal1 + $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) {
        $message = $language->text("hammu", "signup_error_prorper_date");
        //"Please Provide Proper Date!";
        $return_data = array("response_status" => "0", "response_message" => $message);
        $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);
            $check_exist_value = $SKAPI_BOL_Service_inst->findValueExistOrNot($user->id);
            if ($check_exist_value) {
                $table_id = $check_exist_value[0]->id;
                if ($table_id) {
                    $user_skapi_id = $check_exist_value[0]->id;
                } else {
                    $user_skapi_id = "";
                }
            } else {
                $user_skapi_id = "";
            }
            $user_details = $SKAPI_BOL_Service_inst->createUserDetails($user->id, $deviceId, $deviceType, $user_skapi_id);
            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($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] = $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;
                    //hardik edited
                    $data_location[HAMMU_HOTEL_SERVICE] = $HOTEL_SERVICE;
                    $data_location[HAMMU_HOME_VISIT] = $HOME_VISIT;
                    $data_location[HAMMU_AVAILABLE_AT] = $HAMMU_AVAILABLE_ATArr;
                    $data_location[HAMMU_SECRET_FANTASY] = $SECRET_FANTASY;
                    $data_location[HAMMU_LANGUAGE] = $HAMMU_LANGUAGE;
                    $data_location[HAMMU_COUNTRY] = $HAMMU_COUNTRY;
                    $data_location[HAMMU_LANG] = $langVal;
                    //
                }
            }
            //            print_r($data_location);
            //            die;
            $store_to_question = cleanArray($data_location);
            BOL_QuestionService::getInstance()->saveQuestionsData($store_to_question, $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 = $language->text("hammu", "login_client");
                //"client";
                $type = "preferences";
            } else {
                $sex_type = $language->text("hammu", "login_escort");
                //"escort";
                $type = "services";
            }
            $messages = $language->text("hammu", "email_verification_code");
            //"Your Verification code has been sent to your Email Address";
            $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));
        }
    }
}
Esempio n. 2
0
function signup()
{
    global $Userservice;
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    $email = $app->request()->params('email');
    $username = $app->request()->params('username');
    $password = $app->request()->params('password');
    $birthdate = $app->request()->params('birthdate');
    $address = $app->request()->params('address');
    $mobile = $app->request()->params('mobile');
    $i_am = $app->request()->params('i_am');
    $looking_for = $app->request()->params('looking_for');
    $preferences_or_services = $app->request()->params('preferences_or_services');
    //$photo = $app->request()->params('photo');
    $photo_data = $_FILES["photo"];
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $deviceId = $token;
    $deviceType = $type;
    $data = $_POST;
    checkuserexists($data);
    $email = trim($data['email']);
    $password = $data['password'];
    $username = $data['username'];
    //        $tmpUsername = explode('@', $email);
    //        $username = $tmpUsername[0];
    $username = trim(preg_replace('/[^\\w]/', '', $username));
    $username = $this->makeUsername($username);
    //extra question data
    //        $data['realname'] = $username;
    //
    //        $accountype = (int) $data["sex"]; //(1 = Female, 2 = Male)
    //
    //        $data["sex"] = (int) $data["sex"];
    //
    //        $UserDob = date("Y/m/d", strtotime($data["birthdate"]));
    //
    //        $data["birthdate"] = $UserDob;
    $data['realname'] = $username;
    $newUser = false;
    try {
        $user = BOL_UserService::getInstance()->createUser($username, $password, $email, null, true);
        $newUser = true;
    } catch (LogicException $ex) {
        $userdata = array("status" => "false", "message" => "unsuccess", "error" => $ex->getCode());
        echo json_encode($userdata);
        exit;
    }
    unset($data['email']);
    unset($data['password']);
    unset($data['username']);
    //Geo location settings on address
    if (!empty($data["address"])) {
        $urlencode_address = urlencode($data["address"]);
        $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=' . $urlencode_address . '&sensor=false');
        $output = json_decode($geocode);
        //echo print_r(json_encode($output->results));
        if (!empty($output->results[0]->formatted_address)) {
            $data['googlemap_location']['address'] = $output->results[0]->formatted_address;
            $data['googlemap_location']['latitude'] = $output->results[0]->geometry->location->lat;
            $data['googlemap_location']['longitude'] = $output->results[0]->geometry->location->lng;
            $data['googlemap_location']['northEastLat'] = $output->results[0]->geometry->bounds->northeast->lat;
            $data['googlemap_location']['northEastLng'] = $output->results[0]->geometry->bounds->northeast->lng;
            $data['googlemap_location']['southWestLat'] = $output->results[0]->geometry->bounds->southwest->lat;
            $data['googlemap_location']['southWestLng'] = $output->results[0]->geometry->bounds->southwest->lng;
            $data['googlemap_location']['json'] = json_encode($output->results[0]);
        }
    }
    BOL_QuestionService::getInstance()->saveQuestionsData(array_filter($data), $user->id);
    //$avatarUrl = 'http://graph.facebook.com/' . $facebookId . '/picture?type=large&height=400&width=400';
    //$pluginfilesDir = OW::getPluginManager()->getPlugin('skandroid')->getPluginFilesDir();
    //$ext = 'jpg';
    //$tmpFile = $pluginfilesDir . uniqid('avatar-') . (empty($ext) ? '' : '.' . $ext);
    //copy($avatarUrl, $tmpFile);
    //        if (file_exists($tmpFile)) {
    //            BOL_AvatarService::getInstance()->setUserAvatar($user->id, $tmpFile);
    //            @unlink($tmpFile);
    //        }
    //        if (!$authAdapter->isRegistered()) {
    //            $authAdapter->register($user->id);
    //        }
    if ($newUser) {
        $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('method' => 'native', 'userId' => $user->id, 'params' => array()));
        OW::getEventManager()->trigger($event);
        $userdata = $this->respondUserData($user->id, $data);
    } else {
        $userdata = array("status" => "false", "message" => "unsuccess");
    }
    echo json_encode($userdata);
    exit;
}
Esempio n. 3
0
function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    $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');
    echo $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');
    echo $mobile_number = $app->request()->params(HAMMU_DB_MOBILE_NUMBER_KEY);
    $price = $app->request()->params(HAMMU_DB_PRICE_KEY);
    $meeting_point = $app->request()->params(HAMMU_DB_METTING_POINT_KEY);
    $pay_pal_address = $app->request()->params(HAMMU_DB_PAYPAL_KEY);
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $preferences = $app->request()->params(HAMMU_DB_SERVICES_KEY);
    $deviceId = $token;
    $deviceType = $type;
    exit;
    $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;
    //    $data["match_sex"] = $match_sex;
    //$data["field_391797ad0e06d17d5b5cec0e48def7c2"] = $field_391797ad0e06d17d5b5cec0e48def7c2;
    //    $filed = array('field_f2d8bb949d7d74a70bcb2003abc5b436', 'field_f92bbdb57510b86ba6c506c487be3aa1');
    //    $all_services_preferences = getallquestions(array("user_id" => $user_id, "fields" => $filed));
    //    print_r($all_services_preferences);
    //
    //    die;
    //    echo urldecode($data["email"]);
    ////    print_r($data);
    //    die;
    $crdata = checkuserexists($data);
    if (count($crdata) > 0) {
        $app->response->setBody(json_encode($crdata));
    } else {
        //    $email = trim($data['email']);
        //    $password = $data['password'];
        //    $username = $data['username'];
        //        $tmpUsername = explode('@', $email);
        //        $username = $tmpUsername[0];
        $username = trim(preg_replace('/[^\\w]/', '', $username));
        $username = makeUsername($username);
        //extra question data
        //        $data['realname'] = $username;
        //
        //        $accountype = (int) $data["sex"]; //(1 = Female, 2 = Male)
        //
        //        $data["sex"] = (int) $data["sex"];
        //
        //        $UserDob = date("Y/m/d", strtotime($data["birthdate"]));
        //
        //        $data["birthdate"] = $UserDob;
        $data['realname'] = $username;
        $newUser = false;
        $accountdata = $SKADATE_BOL_AccountTypeToGenderDao->findByGenderValue($sex);
        //print_r($accountdata);
        $accounttype = $accountdata[0]->accountType;
        if ($accounttype == "8cc28eaddb382d7c6a94aeea9ec029fb") {
            //$type = "services";
            $type_value = "field_f92bbdb57510b86ba6c506c487be3aa1";
        } else {
            //$type = "preferences";
            $type_value = "field_f2d8bb949d7d74a70bcb2003abc5b436";
        }
        $user = BOL_UserService::getInstance()->createUser($username, $password, $data["email"], $accounttype, true);
        $newUser = true;
        // } catch (LogicException $ex) {
        //  $userdata = array("status" => "false", "message" => "unsuccess", "error" => $ex->getCode());
        //  echo json_encode($userdata);
        //exit();
        // }
        unset($data['email']);
        unset($data['password']);
        unset($data['username']);
        //Geo location settings on address
        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['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['field_391797ad0e06d17d5b5cec0e48def7c2'] = $data["field_391797ad0e06d17d5b5cec0e48def7c2"];
                $data_location['sex'] = $data["sex"];
                $data_location['match_sex'] = $data["match_sex"];
                $data_location['realname'] = $data["realname"];
                $data_location[$type_value] = $preVal;
            }
        }
        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);
        }
        //$avatarUrl = 'http://graph.facebook.com/' . $facebookId . '/picture?type=large&height=400&width=400';
        //$pluginfilesDir = OW::getPluginManager()->getPlugin('skandroid')->getPluginFilesDir();
        //$ext = 'jpg';
        //$tmpFile = $pluginfilesDir . uniqid('avatar-') . (empty($ext) ? '' : '.' . $ext);
        //copy($avatarUrl, $tmpFile);
        //        if (file_exists($tmpFile)) {
        //            BOL_AvatarService::getInstance()->setUserAvatar($user->id, $tmpFile);
        //            @unlink($tmpFile);
        //        }
        //        if (!$authAdapter->isRegistered()) {
        //            $authAdapter->register($user->id);
        //        }
        //  if ($newUser) {
        $event = new OW_Event(OW_EventManager::ON_USER_REGISTER, array('method' => 'native', 'userId' => $user->id, 'params' => array()));
        OW::getEventManager()->trigger($event);
        //$userdata = $this->respondUserData($user->id, $data);
        $avatars = $BOL_AvatarService_inst->getAvatarsUrlList(array($user->id));
        //$accountype = ($sex == "female") ? "8cc28eaddb382d7c6a94aeea9ec029fb" : "808aa8ca354f51c5a3868dad5298cd72"; //(int) $data["sex"]; //(1 = Female, 2 = Male)
        if ($accounttype == "3f50168064b9153e37ba1de896cd64ca") {
            $sex_type = "client";
        } else {
            //                $type = "preferences";
            //                $sex = 1;
            $sex_type = "escort";
        }
        $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], "user_type" => $sex_type));
        $app->response->setBody(json_encode($return_data));
    }
}
Esempio n. 4
0
function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    $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;
    $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 = BOL_UserService::getInstance()->createUser($username, $password, $data["email"], $accounttype, true);
        $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") {
            $final_array = array_shift($data_location);
        } else {
            $final_array = $data_location;
        }
        print_r($data_location);
        exit;
        BOL_QuestionService::getInstance()->saveQuestionsData(array_filter($final_array), $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));
        if ($i_m_using == "1") {
            $sex_type = "client";
        } else {
            $sex_type = "escort";
        }
        $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));
        $app->response->setBody(json_encode($return_data));
    }
}