<?php
/**
 * @package linea21.core
 * @subpackage user
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

//////////// Check Inclusion de pages ////////////
if (!class_exists('auth')) {
  include_once("../lib/lib_common.php");
  ReloadIndex('admin');
}
////////////



/** Préparation du mail
 * $email_html_body
 * $email_text_body
 * $email_subject
 * $email_recipient
 **/
switch($todo_mail) {
  case 'add_user':
    $email_html_body = _t('user','mail_add_body1') . "<br />\n";
    $email_html_body .= _t('user','mail_add_body2') . "<br />\n";
    $email_html_body .= _t('user','login') . " : " . $u_login . "<br />\n";
    $email_html_body .= _t('user','password') . " : " . $u_password . "<br /><br />\n";
    $email_html_body .= _t('user','mail_head') . " : <a href=\"" . SITE_ROOT_URL. 'public/' . "\">" . SITE_NAME . "</a><br />\n";
    $email_html_body .= _t('user','mail_bottom') . " : <a href=\"mailto:" . SITE_MAIL . "\">" . SITE_MAIL . "</a><br />\n";

    $email_text_body = _t('user','mail_add_body1') . "\n";
    $email_text_body .= _t('user','mail_add_body2') . "\n";
    $email_text_body .= _t('user','login') . " : " . $u_login . "\n";
    $email_text_body .= _t('user','password') . " : " . $u_password . "\n\n";
    $email_text_body .= _t('user','mail_head') . " " . SITE_ROOT_URL. 'public/' . "\n";
    $email_text_body .= _t('user','mail_bottom') . " " . SITE_MAIL . "\n";

    $email_subject = _t('user','mail_add_subject').' '.SITE_NAME;
    $email_recipient = $u_mail;
    break;
  case 'change_pass':
    $email_html_body = _t('user','mail_changepass_body1') . "<br />\n";
    $email_html_body .= _t('user','mail_changepass_body2') . "<br />\n";
    $email_html_body .= _t('user','login') . " : " . $user_login . "<br />\n";
    $email_html_body .= _t('user','password') . " : " . $new_pass . "<br /><br />\n";
    $email_html_body .= _t('user','mail_head') . " : <a href=\"" . SITE_ROOT_URL. 'public/' . "\">" . SITE_NAME . "</a><br />\n";
    $email_html_body .= _t('user','mail_bottom') . " : <a href=\"mailto:" . SITE_MAIL . "\">" . SITE_MAIL . "</a><br />\n";
    	
    $email_text_body = _t('user','mail_changepass_body1') . "\n";
    $email_text_body .= _t('user','mail_changepass_body2') . "\n";
    $email_text_body .= _t('user','login') . " : " . $user_login . "\n";
    $email_text_body .= _t('user','password') . " : " . $new_pass . "\n";
    $email_text_body .= _t('user','mail_head') . " " . SITE_ROOT_URL. 'public/' . "\n";
    $email_text_body .= _t('user','mail_bottom') . " " . SITE_MAIL . "\n";

    $email_subject = _t('user','mail_changemail_subject').' - '.SITE_NAME;
    $email_recipient = $user_email;
    break;
  case 'forgot_pass':
    $email_html_body  = _t('user','mail_forgotpass_body1') . "<br />\n";
    $email_html_body .= '<em>'._t('user','mail_forgotpass_body2') . "</em><br />\n";
    $email_html_body .= "<a href='".SITE_ROOT_URL. 'public/'.get_permalink($link_pass)."'>".SITE_ROOT_URL. 'public/'.get_permalink($link_pass)."</a><br /><br />\n";
    $email_html_body .= _t('user','mail_head') . " : <a href=\"" . SITE_ROOT_URL. 'public/' . "\">" . SITE_NAME . "</a><br />\n";
    $email_html_body .= _t('user','mail_bottom') . " : <a href=\"mailto:" . SITE_MAIL . "\">" . SITE_MAIL . "</a><br />\n";
    	
    $email_text_body  = _t('user','mail_forgotpass_body1') . "\n";
    $email_text_body .= _t('user','mail_forgotpass_body2') . "\n";
    $email_text_body .= SITE_ROOT_URL. 'public/'.get_permalink($link_pass). "\n\n";
    $email_text_body .= _t('user','mail_head') . " " . SITE_ROOT_URL. 'public/' . "\n";
    $email_text_body .= _t('user','mail_bottom') . " " . SITE_MAIL . "\n";

    $email_subject = _t('user','mail_forgotpass_subject').' - '.SITE_NAME;
    $email_recipient = $user_email;
    break;
  case 'change_mail':
    $email_html_body = _t('user','mail_changemail_body1') . "<br />\n";
    $email_html_body .= _t('user','mail_changemail_body2') . "<br />\n";
    $email_html_body .= _t('user','login') . " : " . $user_login . "<br />\n";
    $email_html_body .= _t('user','password') . " : " . $new_pass . "<br /><br />\n";
    $email_html_body .= _t('user','mail_head') . " : <a href=\"" . SITE_ROOT_URL. 'public/' . "\">" . SITE_NAME . "</a><br />\n";
    $email_html_body .= _t('user','mail_bottom') . " : <a href=\"mailto:" . SITE_MAIL . "\">" . SITE_MAIL . "</a><br />\n";
    	
    $email_text_body = _t('user','mail_changemail_body1') . "\n";
    $email_text_body .= _t('user','mail_changemail_body2') . "\n";
    $email_text_body .= _t('user','login') . " : " . $user_login . "\n";
    $email_text_body .= _t('user','password') . " : " . $new_pass . "\n";
    $email_text_body .= _t('user','mail_head') . " " . SITE_ROOT_URL. 'public/' . "\n";
    $email_text_body .= _t('user','mail_bottom') . " " . SITE_MAIL . "\n";

    $email_subject = _t('user','mail_changemail_subject').' - '.SITE_NAME;

    $email_recipient = $new_email;
    break;
  default:
    exit();
}

?>
