Пример #1
0
//Contact Data
$contactData = $user->getContactData();
//is it a personal profile edition ?
$personalProfile = $user->getUserId() == $cms_user->getUserId();
//MAIN TAB
//load languages
$languages = CMS_languagesCatalog::getAllLanguages();
$languagesDatas = array();
foreach ($languages as $language) {
    $languagesDatas[] = array('id' => $language->getCode(), 'label' => $language->getLabel());
}
$languagesDatas = sensitiveIO::jsonEncode($languagesDatas);
//Need to sanitize all datas which can contain single quotes
$fullname = sensitiveIO::sanitizeJSString($user->getFullName());
$firstname = sensitiveIO::sanitizeJSString($user->getFirstName());
$lastname = sensitiveIO::sanitizeJSString($user->getLastName());
$lastnameValue = $lastname ? "value:'{$lastname}'," : '';
$login = sensitiveIO::sanitizeJSString($user->getLogin());
$loginValue = $login ? "value:'{$login}'," : '';
$email = sensitiveIO::sanitizeJSString($user->getEmail());
$emailValue = $email ? "value:'{$email}'," : '';
//Contact datas
$service = sensitiveIO::sanitizeJSString($contactData->getService());
$jobtitle = sensitiveIO::sanitizeJSString($contactData->getJobTitle());
$address1 = sensitiveIO::sanitizeJSString($contactData->getAddressField1());
$address2 = sensitiveIO::sanitizeJSString($contactData->getAddressField2());
$address3 = sensitiveIO::sanitizeJSString($contactData->getAddressField3());
$zipcode = sensitiveIO::sanitizeJSString($contactData->getZip());
$city = sensitiveIO::sanitizeJSString($contactData->getCity());
$state = sensitiveIO::sanitizeJSString($contactData->getState());
$country = sensitiveIO::sanitizeJSString($contactData->getCountry());
Пример #2
0
     $user = new CMS_profile_user();
 }
 //is it a new user creation ?
 $userCreation = $user->getUserId() ? false : true;
 //email
 if ($email) {
     $contactData = $user->getContactData();
     $contactData->setEmail($email);
     $user->setContactData($contactData);
 } elseif (!$user->getEmail()) {
     $cms_message = $cms_language->getMessage(MESSAGE_INCORRECT_FIELD_VALUE, array($cms_language->getMessage(MESSAGE_FIELD_EMAIL))) . "\n";
 }
 //lastname
 if ($lastname) {
     $user->setLastName(ucfirst($lastname));
 } elseif (!$user->getLastName()) {
     $cms_message = $cms_language->getMessage(MESSAGE_INCORRECT_FIELD_VALUE, array($cms_language->getMessage(MESSAGE_FIELD_LASTNAME))) . "\n";
 }
 //firstname
 $user->setFirstName(ucfirst($firstname));
 //login
 if ($login && CMS_profile_usersCatalog::loginExists($login, $user)) {
     $cms_message .= $cms_language->getMessage(MESSAGE_LOGIN_EXISTS, array($login)) . "\n";
 } elseif ($login && !$user->setLogin($login)) {
     $cms_message .= $cms_language->getMessage(MESSAGE_INCORRECT_FIELD_VALUE, array($cms_language->getMessage(MESSAGE_FIELD_LOGIN))) . "\n";
 }
 //Check password fields
 if ($pass1 && $pass2 && $pass1 == $pass2 && $user->getLogin() != $pass1) {
     $user->setPassword($pass1);
 } elseif ($pass1 || $pass2) {
     $cms_message .= $cms_language->getMessage(MESSAGE_INCORRECT_PASSWORD_VALUES) . "\n";