PHP User::getData Examples

PHP User::getData - 25 examples found. These are the top rated real world PHP examples of User::getData extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 protected function _checkUser()
 {
     if (fnGet($this->input, 'access_token') == '') {
         $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '参数[access_token]不能为空'), 400);
     }
     // 设置当前用户和客户端
     $this->session->setUser($user = new User())->setClient($client = new Client());
     $passportConfig = $this->config->get("api.passport");
     // 尝试从缓存获取 userInfo
     if ($this->_userInfo = S($cacheKey = 'access_token_info.' . fnGet($this->input, 'access_token'))) {
         $user->find(fnGet($this->_userInfo, 'user_id'));
         $client->find(fnGet($this->_userInfo, 'client_id'));
         return;
     }
     // 向 passport 请求 userInfo
     $time = time();
     $url = str_replace('internal-resource/user-info?', '', $passportConfig->passportUrl) . 'internal-resource/user-info';
     $params = array('access_token' => fnGet($this->input, 'access_token'), 'app' => $passportConfig->passportApp, 'time' => $time);
     $sign = md5(implode('', $params) . $passportConfig->passportSecret);
     $params['sign'] = $sign;
     $http = new HttpClient();
     $response = $http->request($url, $params);
     $data = json_decode($response, true);
     if (fnGet($data, 'id')) {
         //检测用户是否已经保存
         $user->getByUsername($username = fnGet($data, 'username'));
         if (!($userId = $user->getId()) || !$user->getData('passport_id') || $user->getData('mobile') != fnGet($data, 'mobile')) {
             $user->addData(array('username' => $username, 'email' => fnGet($data, 'email'), 'mobile' => fnGet($data, 'mobile'), 'passport_id' => fnGet($data, 'passport_id'), 'avatar' => fnGet($data, 'avatar'), 'nickname' => fnGet($data, 'nickname')));
             $user->save();
             $userId = $user->getId();
         }
         //检测客户端是否已经保存
         $client->getByAppId($appId = fnGet($data, 'client_info/id'));
         if (!($clientId = $client->getId()) || $client->getScopes() != fnGet($data, 'client_info/scopes')) {
             $client->addData(array('client' => $appId, 'name' => fnGet($data, 'client_info/name'), 'app_secret' => fnGet($data, 'client_info/secret'), 'developerurl' => fnGet($data, 'client_info/endpoint'), 'scopes' => fnGet($data, 'client_info/scopes')));
             $client->save();
             $clientId = $client->getId();
         }
         $this->_userInfo = array('user_id' => $userId, 'client_id' => $clientId, 'username' => $username, 'session_data' => fnGet($data, 'session_data'));
         S($cacheKey, $this->_userInfo, 3600);
         return;
     }
     $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '用户无效'), 400);
 }
Example #2
0
 /**
  * Метод добавления нового пользователя в базу данных
  * @param User $user - пользователь
  * @return bool - добавлен/не добавлен
  */
 public function create($user)
 {
     $db = DataBase::getInstance();
     $connection = $db->connect();
     $data = $user->getData();
     $sql = "INSERT INTO " . self::TABLE_NAME . " (`name`, lastname, birthday, email, password, is_active, reg_date, last_update) VALUES (:name, :lastname, :birthday, :email, :password, :is_active, :reg_date, :last_update)";
     $stmt = $connection->prepare($sql);
     $status = $stmt->execute($data);
     $db->close();
     return $status;
 }
 public function formObject()
 {
     $model = new User($this->data->id);
     $this->data->forUpdate = $this->data->id != '';
     $this->data->object = $model->getData();
     $this->data->object->userLevel = $model->getUserLevel();
     $this->data->title = $this->data->forUpdate ? $model->getDescription() : _M("New User");
     $this->data->userLevel = Base::userLevel();
     $this->data->save = "@fnbr20/auth/user/save/" . $model->getId() . '|formObject';
     $this->data->delete = "@fnbr20/auth/user/delete/" . $model->getId() . '|formObject';
     $this->render();
 }
function checkAuthority($level)
{
    require_once 'site.class.php';
    require_once 'user.class.php';
    $uid = Site::getSessionUid();
    if ($uid == 0) {
        return false;
    }
    $currentUser = new User();
    $currentUser->uid = $uid;
    $response = json_decode($currentUser->getData(), true);
    return $response['level'] >= $level;
}
 /**
  * Add new user and return the model
  *
  * Save new user's data to DB and load this user. If there is referral login, add loyality point to user that owns
  * this login
  *
  * @param string $email
  * @param string $login
  * @param string $name
  * @param string $userGroup
  * @param string $referralLogin
  *
  * @return User
  * @throws Exception
  */
 public static function registerUser($email, $login, $name, $userGroup = 'Default', $referralLogin = '')
 {
     if (self::userExists($email)) {
         throw new Exception('User with this email already exists');
     }
     self::saveUser(array('user_email' => $email, 'user_name' => $name, 'login' => $login, 'user_group_id' => self::getUserGroupIdFromName($userGroup), 'referral_login' => $referralLogin));
     if ($referralLogin) {
         try {
             $user = new User($referralLogin, 'login');
             $user->increaseLoyalityPoints();
             self::saveUser($user->getData());
         } catch (Exception $e) {
             // Process the error
         }
     }
     return new User('$email');
 }
 /**
  * Pay for subscription and save it to DB
  *
  * @param User      $user
  * @param int       $units
  * @param IPayment  $paymentService
  * @param array     $paymentDetails
  *
  * @return bool
  * @throws Exception
  */
 public static function buy(User $user, $units, IPayment $paymentService, $paymentDetails)
 {
     $userData = $user->getData();
     if ($user->getUserGroup() == User::ADMIN_USER_GROUP) {
         throw new Exception('Administrators can\'t buy subscription');
     }
     if ($user->isSubscribed()) {
         $units += ($userData['subscribed_to'] - strtotime(date('Y-m-d', time()) . ' 00:00:00')) / 86400;
     }
     //...
     if ($paymentService->processPayment($paymentData)) {
         $userData['subscribed_to'] = strtotime(date('Y-m-d', strtotime("+{$units} days")) . ' 00:00:00');
         $paymentService->savePayment();
         return true;
     }
     throw new Exception('An error occurred while processing the payment');
     //...
 }
Example #7
0
function updateAccount($first_name, $last_name, $birthday, $sex, $email, $password, $newsletter)
{
    global $bdd;
    global $_TABLES;
    global $config;
    if (isset($_SESSION['user_id'])) {
        // Création de l'objet User
        $objUser = new User($bdd, $_TABLES);
        // Sauvegarde temporaire des anciennes données utilisateurs
        $user = $objUser->getData($_SESSION['user_id']);
        // Mise en forme des données
        $birthday_temp = explode("/", $birthday);
        $birthday = $birthday_temp[2] . '-' . $birthday_temp[1] . '-' . $birthday_temp[0];
        // Mise à jour des données du compte
        $objUser->updateAccount($_SESSION['user_id'], $email, $password, $first_name, $last_name, $birthday, $sex);
        // Ajout ou suppression de l'email de la personne dans la liste de la newsletter
        $objUserNewsletter = new UserNewsletter($bdd, $_TABLES, $config);
        if ($newsletter) {
            $objUserNewsletter->createUserNewsletter($email);
        } else {
            $email_delete = $email;
            // Verification que l'email n'a pas été modifier avant
            if ($user && !is_null($user)) {
                if ($email != $user->email) {
                    $email_delete = $user->email;
                }
            }
            $user_newsletter = $objUserNewsletter->getExist($email_delete);
            if ($user_newsletter && !is_null($user_newsletter)) {
                $objUserNewsletter->deleteUserNewsletter($user_newsletter->id, $email_delete);
            }
        }
        // Retour 0
        return 0;
    } else {
        // Session expire
        return 1;
    }
}
Example #8
0
 public function storeData(User $user)
 {
     $this->users[$user->getUsername()] = $user->getData();
     file_put_contents($this->userFile, json_encode($this->users));
 }
Example #9
0
    } else {
        if ("RemoveCustomer" == $do) {
            $error = array();
            $err = @Utils::checkInput($_POST['userid'], "User ID", 0, 0, INPUT_TYPE_NUMERIC);
            if (strlen($err) != 0) {
                $error[] = $err;
            } else {
                if (!UserManager::existsById($_POST['userid'])) {
                    $error[] = "The given User ID doesn't exist.";
                } else {
                    $user = new User($_POST['userid']);
                    if ($user->getData("coins") > 0) {
                        $error[] = "The user still has coins. You cannot delete him.";
                    }
                    // TODO: Gameserver Count ask
                }
            }
            if (count($error) == 0) {
                $username = $user->getData("username");
                $name = $user->getData("prename") . " " . $user->getData("lastname");
                $page->assign("t_Report", Reporting::success("The user \"{$username}\" (\"{$name}\") has been removed successfully."));
                Database::rowDeleteByField("users", "id", $_POST['userid']);
            } else {
                $page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
            }
        }
    }
}
$customers = UserManager::getAllCustomers();
if ($customers != false) {
    $page->assign("AllUsers", UserManager::getAllCustomers());
Example #10
0
 public static function isBannedFromEvents(User $u)
 {
     $bannedReason = $u->getData('bannedReason');
     return !empty($bannedReason);
 }
Example #11
0
		            		<span class="icon-bar"></span>
		          		</button>
					</div>
					<div id="navbar" class="collapse navbar-collapse">
						<ul class="nav navbar-nav">
							<li><a href="home">Начало</a></li>
							<li class="active"><a href="teams">Отбори<span class="sr-only">(current)</span></a></li>
							<li><a href="prizes">Награди</a></li>
							<li><a href="rules">Регламент</a></li>
							<li><a href="faq">FAQ</a></li>
                            <?php 
if ($user->isLoggedIn()) {
    ?>
                                <li><a href="profile">Профил</a></li>
                                <!-- <a href="/<?php 
    echo escape($user->getData()->username);
    ?>
"> -->
                                <li><a href="logout.php">Излез</a></li>
                            <?php 
}
?>
  							
						</ul>
					</div>
				</div>
			</nav>
		</header>
		<hr />
		<div class="jumbotron">
			<table id="teams">
Example #12
0
 /**
  * Send a notification when address has been changed
  *
  * @param Address $objAddress
  * @param array   $arrOldAddress
  * @param \User   $objMember
  * @param Config  $objConfig
  */
 protected function triggerNotificationCenter(Address $objAddress, array $arrOldAddress, \User $objMember, Config $objConfig)
 {
     if (!$this->nc_notification) {
         return;
     }
     /** @type Notification $objNotification */
     $objNotification = Notification::findByPk($this->nc_notification);
     if (null === $objNotification) {
         return;
     }
     $arrTokens = array();
     $arrTokens['admin_email'] = $GLOBALS['TL_ADMIN_EMAIL'];
     $arrTokens['domain'] = \Environment::get('host');
     $arrTokens['link'] = \Environment::get('base') . \Environment::get('request');
     foreach ($objAddress->row() as $k => $v) {
         $arrTokens['address_' . $k] = $v;
     }
     foreach ($arrOldAddress as $k => $v) {
         $arrTokens['address_old_' . $k] = $v;
     }
     foreach ($objMember->getData() as $k => $v) {
         $arrTokens['member_' . $k] = $v;
     }
     foreach ($objConfig->row() as $k => $v) {
         $arrTokens['config_' . $k] = $v;
     }
     $objNotification->send($arrTokens);
 }
 function chgpasswdsave($vars)
 {
     //print_r($vars);return;
     $a = new User($this->db_conns);
     $a->getData($vars['id']);
     if ($vars['init_passwd'] != $a->user_password) {
         $this->gotoURL("user.php?action=chgpasswd&id=" . $a->id . "&error=1");
     } else {
         if ($vars['password'] != $vars['password2']) {
             $this->gotoURL("user.php?action=chgpasswd&id=" . $a->id . "&error=2");
         } else {
             $a->user_password = $vars['password'];
             $a->chgpassword();
             $this->gotoURL("user.php?action=list");
         }
     }
 }
      $level = max(0, min(9, (int) getRequest('level')));
      if (($sqlUser = @mysql_query('UPDATE `user`
	SET `level` = "' . $level . '"
	WHERE `uid` = "' . $uid . '";')) === false) {
          handle(ERROR_SYSTEM . '01');
      }
      handle('0000');
      break;
  case 'resetPassword':
      if (!checkAuthority(9)) {
          handle(ERROR_PERMISSION . '01');
      }
      $_p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
      $currentUser = new User();
      $currentUser->uid = $uid = getRequest('uid');
      $username = json_decode($currentUser->getData(), true)['username'];
      $pwd = '';
      for ($_i = 0; $_i < 10; $_i++) {
          $pwd .= $_p[mt_rand(0, strlen($_p) - 1)];
      }
      $password = password_hash(md5($username . md5($pwd) . '.cc'), PASSWORD_BCRYPT);
      if (($sqlUser = @mysql_query('UPDATE `user`
	SET `password` = "' . $password . '"
	WHERE `uid` = "' . $uid . '";')) === false) {
          handle(ERROR_SYSTEM . '01');
      }
      handle('0000{"password":"' . $pwd . '"}');
      break;
  default:
      ERROR(ERROR_INPUT . '02', 'Request Error.');
      break;
Example #15
0
<!doctype html>

<html>
    <head>
    
    </head>
    
    <body>
        <?php 
if (isset($_SESSION['alert'])) {
    echo $_SESSION['alert'];
    unset($_SESSION['alert']);
}
include_once 'includes/menu.inc.php';
$User = new User();
$data = $User->getData();
echo '<input type="text" name="username" value="' . $data[0]['username'] . '" disabled>Usernames cannot be changed.<br><br>';
if (isset($data[1]['first']) && isset($data[1]['middle']) && isset($data[1]['last'])) {
    echo $data[1]['first'] . ' ' . $data[1]['middle'] . ' ' . $data[1]['last'];
    ?>
        
        <form action="" method="post">
            <input type="text" name="first" placeholder="First Name">
            <input type="text" name="middle" placeholder="Middle Name / MI">
            <input type="text" name="last" placeholder="Last Name">
            <input type="hidden" name="token" value="<?php 
    echo $token;
    ?>
">
            <input type="submit" name="updateName" value="Update">
        </form>
Example #16
0
 /**
  * 加载外部记录的数据
  *
  * @param User $user
  */
 protected function loadRecordData(User $user)
 {
     $this->setData($user->getData());
     // 清空更改状态
     $this->isChanged = false;
     $this->changedData = [];
 }
             $error[] = "The given Template is not a gameserver template.";
         } else {
             $gameName = $template->getData("gameName");
         }
     }
 }
 // Customer ID
 $err = @Utils::checkInput($_POST['customerid'], "Customer ID", 1, 64, INPUT_TYPE_NUMERIC);
 if (strlen($err) != 0) {
     $error[] = $err;
 } else {
     if (!UserManager::existsById($_POST['customerid'])) {
         $error[] = "The given User doesnt exist.";
     } else {
         $user = new User($_POST['customerid']);
         $userName = $user->getData("username") . " (" . $user->getData("prename") . " " . $user->getData("lastname") . ")";
     }
 }
 // Slots
 $err = @Utils::checkInput($_POST['slots'], "Slots", 1, 64, INPUT_TYPE_NUMERIC);
 if (strlen($err) != 0) {
     $error[] = $err;
 }
 if (count($error) == 0) {
     $page->assign("t_Report", Reporting::success("A Gameserver for the User {$userName} will be installed shortly.<br />Server: {$serverName} {$serverIP}:{$serverPort}<br />Game: {$gameName}"));
     GameserverManager::createServer($server, $user, $template, $serverPort, $_POST["slots"]);
     // Log
     $local = UserManager::getLocalUser();
     $localUsername = $local->getData("username");
     $localID = $local->getData("id");
     $gameName = $template->getData("gameName");
Example #18
0
<?php

require '../load.php';
require '../init.php';
$response = User::getData($_SESSION['userID']);
$data = $response->data;
//var_dump($data);die();
$tpl = new Layout();
echo $tpl->mobiLayout($tpl->loadTemplate('user', $data));
Example #19
0
 /**
  * Prepares mail signature
  *
  * @param string $signatureCode
  * @param bool $html
  * @param string $language
  * @param int $sender
  *
  * @return string
  */
 public static function prepareMailSignature($signatureCode = 'team', $html = false, $language = 'en', $sender = 0)
 {
     $output = '';
     $cachedSignatureCode = $signatureCode . ($signatureCode != 'team' && $sender > 0 ? $sender : '') . ($html ? '.html' : '.txt');
     $format = $html ? 'html' : 'text';
     if (isset(self::$cache['signature'][$cachedSignatureCode])) {
         $output = self::$cache['signature'][$cachedSignatureCode];
     } else {
         // try to get template for $signatureCode from the database
         $output = MailMessageSignature::getByCodeFormatLanguage($signatureCode, $format, $language);
         // If not found, try to locate default signature template in the database
         if ($output == '' && $signatureCode != 'team') {
             $output = self::prepareMailSignature('team', $html, $language, $sender);
         } elseif ($output == '' && $signatureCode == 'team') {
             // If signature is still not found, use static templates.
             $templateName = 'mail.' . ($html ? 'html' : 'text') . '.signature';
             $output = TextProcessor::doTemplate('cron', $templateName);
         }
         // if non-empty template is found for user/user-empty signature, process text with sender data
         if ($output != '' && in_array($signatureCode, ['user', 'user-empty']) && $sender > 0) {
             $userModel = new User();
             if ($userModel->load($sender)->isValid()) {
                 $output = TextProcessor::doText($output, $userModel->getData());
             }
         }
         // save rendered signature to inner cache to reuse on the same HTTP request
         self::$cache['signature'][$cachedSignatureCode] = $output;
     }
     return $output;
 }
Example #20
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
$userid = isset($_GET['userid']) ? $_GET['userid'] : null;
if ($userid != null) {
    if (UserManager::existsById($userid)) {
        $user = new User($userid);
        $page = new Page($smarty, "modals/CustomerRemove.tpl");
        if ($user->getData("gameServerCount") == 0) {
            $page->assign("u", $user);
        } else {
            $page->assign("t_Report", Reporting::Error("This customer cannot be deleted because still has gameservers. They have to be deleted manually."));
        }
        $page->display();
    } else {
        $p = new Page($smarty, "modals/DefaultError.tpl");
        $p->display();
    }
} else {
    $p = new Page($smarty, "modals/DefaultError.tpl");
    $p->display();
}
Example #21
0
<?php

$userVars = explode('/', $q);
$userUsername = $userVars[1];
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 1;
}
require_once 'php/User.php';
$user = User::getData($userUsername);
if ($user) {
    $environments = User::getEnvironments($userUsername, $page);
    $totalEnvironments = User::getTotalEnvironments($userUsername);
    $file = 'user-profile';
} else {
    $file = '404';
}
Example #22
0
    echo $do_user->getData("email");
    ?>
</td>
      <td><?php 
    echo $do_user->getData("status");
    ?>
</td>
      <td><?php 
    echo $do_user->getData("plan");
    ?>
</td>
      <td>
        <?php 
    if ($do_user->getData("status") == "suspend") {
        $e_suspend = new Event("UserInternalMarketing->eventUnsuspendUser");
        $e_suspend->addParam("goto", $_SERVER["PHP_SELF"]);
        $e_suspend->addParam("iduser", $do_user->getData("iduser"));
        echo $e_suspend->getLink("un-suspend", ' title="' . _('un-suspend this User') . '" onclick="if (!confirm(\'' . _('Do you really want to un-suspend this User ?') . '\')) return false;"');
        echo " | ";
    } else {
        $e_suspend = new Event("UserInternalMarketing->eventSuspendUser");
        $e_suspend->addParam("goto", $_SERVER["PHP_SELF"]);
        $e_suspend->addParam("iduser", $do_user->getData("iduser"));
        echo $e_suspend->getLink("Suspend", ' title="' . _('Suspend this User') . '" onclick="if (!confirm(\'' . _('Do you really want to suspend this User ?') . '\')) return false;"');
        echo " &nbsp;&nbsp;&nbsp;&nbsp;| ";
    }
    ?>

        <?php 
    $e_delete = new Event("UserInternalMarketing->eventDeleteUser");
    $e_delete->addParam("goto", $_SERVER["PHP_SELF"]);
    $e_delete->addParam("iduser", $do_user->getData("iduser"));
     handle(ERROR_PERMISSION . '00');
     break;
 case 'list':
     handle('0000' . Calculation::listData((int) getRequest('user'), (int) getRequest('public'), (int) getRequest('status')));
     break;
 case 'new':
     $currentCalculation = new Calculation();
     require_once 'site.class.php';
     $uid = Site::getSessionUid();
     if ($uid == 0) {
         handle(ERROR_PERMISSION . '01' . '请先登陆!');
     }
     require_once 'user.class.php';
     $currentUser = new User();
     $currentUser->uid = $uid;
     $response = json_decode($currentUser->getData(), true);
     $priority = $response['level'];
     if ($priority != 9) {
         require_once 'plugin.class.php';
         $currentPlugin = new Plugin();
         $currentPlugin->pid = getRequest('pid');
         $response = json_decode($currentPlugin->getData(), true);
         if ($uid == $response['uid']) {
             $priority = 5;
         }
     }
     $currentCalculation->init(getRequest('pid'), $uid, $priority, 0, '', 0, getRequest('input'));
     if (!$currentCalculation->checkVariables()) {
         handle(ERROR_INPUT . '01');
     }
     $response = $currentCalculation->create();
Example #24
0
		<div class="data">

			<?php 
require_once dirname(dirname(__FILE__)) . "/common/php/class/class.user.php";
require_once dirname(dirname(__FILE__)) . "/common/php/class/class.user_newsletter.php";
global $bdd;
global $_TABLES;
global $config;
$content_html = "<label for='last-name'>Nom : </label>\n\t\t\t\t\t\t\t\t<input class='input-text' type='text' name='last-name' id='account-last-name' placeholder='Nom' value='%%last-name%%' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<label for='first-name'>Prénom : </label>\n\t\t\t\t\t\t\t\t<input class='input-text' type='text' name='first-name' id='account-first-name' placeholder='Prénom' value='%%first-name%%' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<label for='birthday'>Date de naissance : </label>\n\t\t\t\t\t\t\t\t<input class='input-text' type='text' name='birthday' id='account-birthday' placeholder='Date de naissance : JJ / MM / AAAA' value='%%birthday%%' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<label for='sex'>Sexe : </label>\n\t\t\t\t\t\t\t\t\t<input type='radio' name='sex' class='account-sex' value='1' %%sex-1%%>Homme</input>\n\t\t\t\t\t\t\t\t\t<input type='radio' name='sex' class='account-sex' value='0' %%sex-0%%>Femme</input>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<label for='email'>Email : </label>\n\t\t\t\t\t\t\t\t<input class='input-text' name='email' type='text' id='account-email' placeholder='Adresse email' value='%%email%%' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<label for='password'>Mot de passe : </label>\n\t\t\t\t\t\t\t\t<input class='input-text' name='password' type='password' id='account-password' placeholder='Mot de passe' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<label for='newsletter'>Newsletter : </label>\n\t\t\t\t\t\t\t\t<input type='checkbox' name='newsletter' id='account-newsletter' %%newsletter%% />";
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
if (isset($_SESSION['user_id'])) {
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objUser = new User($bdd, $_TABLES);
        $user = $objUser->getData($_SESSION['user_id']);
        if (!is_null($user)) {
            $content_html = str_replace('%%last-name%%', $user->last_name, $content_html);
            $content_html = str_replace('%%first-name%%', $user->first_name, $content_html);
            $temp_birthday = explode("-", $user->birthday);
            $birthday = $temp_birthday[2] . '/' . $temp_birthday[1] . '/' . $temp_birthday[0];
            $content_html = str_replace('%%birthday%%', $birthday, $content_html);
            $content_html = str_replace('%%sex-' . $user->sex . '%%', 'checked', $content_html);
            if ($user->sex) {
                $content_html = str_replace('%%sex-0%%', '', $content_html);
            } else {
                $content_html = str_replace('%%sex-1%%', '', $content_html);
            }
            $content_html = str_replace('%%email%%', $user->email, $content_html);
            $objUserNewsletter = new UserNewsletter($bdd, $_TABLES, $config);
            $user_newsletter = $objUserNewsletter->getExist($user->email);
 private function getUserName($uid)
 {
     require_once 'user.class.php';
     $currentUser = new User();
     $currentUser->uid = $uid;
     return json_decode($currentUser->getData(), true)['username'];
 }