Exemplo n.º 1
0
$user_lastname = $app->getRequest()->get('lastname');
$user_email = $app->getRequest()->get('email');
$user_pass = $app->getRequest()->get('pass');
$user_type = $app->getRequest()->get('userType');
$ru = $app->getRequest()->get('ru');
$rm = $app->getRequest()->get('rm');
if (!empty($ru) && !empty($rm)) {
    $isReferred = true;
} else {
    $isReferred = false;
}
// Create user
$user = $app->getModel('User')->create($user_name, $user_lastname, $user_email, $user_pass, $user_type);
if (isset($user->id)) {
    // Initialize user detail
    UserDetail::init($user->id, $user->user_type);
    $to = $user_email;
    $toName = $user_name . ' ' . $user_lastname;
    $confirmUrl = FConfig::getUrl('confirmacion') . '?c=' . $user->act_code;
    if ($isReferred) {
        $confirmUrl .= '&ru=' . $ru . '&rm=' . $rm;
    }
    $asunto = "Confirmación de registro";
    $params = array('site_url' => FConfig::getUrl(), 'logo_url' => FConfig::getUrl('images/logo_footer.png'), 'nombre' => $toName, 'confirmacion_url' => $confirmUrl);
    $body = FMailer::replaceParameters($params, file_get_contents('../views/emails/registroEmail.html'));
    $mailer = new FMailer();
    $receivers = array(array('email' => $to, 'name' => $toName));
    $mailer->setReceivers($receivers);
    $mailer->sendEmail($asunto, $body);
    // Event: Creación de perfil
    $events = FAnalytics::getInstance();
Exemplo n.º 2
0
     }
     $dataProfile[UserDetail::USER_DETAIL_CAMERA] = json_encode($camara);
     $dataProfile[UserDetail::USER_DETAIL_GLASSES] = json_encode($lentes);
     $dataProfile[UserDetail::USER_DETAIL_EQUIPMENT] = json_encode($equipo);
     $dataProfile[UserDetail::USER_DETAIL_PHOTOGRAPHY_SCHOOL] = $escuelaFotografia;
     $dataProfile[UserDetail::USER_DETAIL_MORE_EDUCATION] = $masEducacion;
     $dataProfile[UserDetail::USER_DETAIL_LABORAL_EXPERIENCE] = json_encode($experienciaLaboral);
     $dataProfile[UserDetail::USER_DETAIL_LANGUAGES] = json_encode($idiomas);
     $dataProfile[UserDetail::USER_DETAIL_HABILITIES] = json_encode($habilidades);
     $dataProfile[UserDetail::USER_DETAIL_RUT] = $rut;
     $dataProfile[UserDetail::USER_DETAIL_PAYMENT_USER] = $user_pago;
     // Update interests
     UserDetail::updateInterests($currentUser->id, $interes);
 }
 // Update detail user info
 UserDetail::update($currentUser->id, $dataProfile);
 if ($validNewEmail) {
     // Send email with link to activate new email
     $confirmUrl = UrlHelper::getUrl('actions/perfilAction.php') . '?act_code=' . $user->act_code . '&new_email_code=' . $user->new_email_code . '&act=new_email_confirmation';
     $asunto = "Confirmación de cambio de correo electrónico";
     $params = array('site_url' => FConfig::getUrl(), 'logo_url' => FConfig::getUrl('images/logo_footer.png'), 'fullname' => $currentUser->full_name, 'confirmation_url' => $confirmUrl);
     $body = FMailer::replaceParameters($params, file_get_contents('../views/emails/newEmailConfirmation.html'));
     $mailer = new FMailer();
     $receivers = array(array('email' => $currentUser->email, 'name' => $currentUser->full_name));
     $mailer->setReceivers($receivers);
     $mailer->sendEmail($asunto, $body);
     $app->addMessage("Un correo electrónico te ha sido enviado a la dirección <b>" . $email . "</b> para confirmarla.");
     $app->redirect($app->getHelper('UrlHelper')->getUrl('editarPerfil'));
 } else {
     $app->redirect($app->getHelper('UrlHelper')->getUrl('perfil'));
 }