/** * Returns a first not empty value from function arguments * * @author Aurimas Niekis <*****@*****.**> */ function first_value_not_empty($valueA, $valueB) { foreach (func_get_args() as $arg) { if (not_empty($arg)) { return $arg; } } }
/** * Render and Show template * * @param string $template * @param array $data * @return string */ public function show($template = '', $data = array()) { if (empty($data)) { $data =& $this->_data; } $template = not_empty($template, $this->layout); get_instance()->load->view($template, $data); }
/** * Конструктор */ public function __construct() { parent::__construct(); $this->env = not_empty($_SERVER['AOMEGA_ENV'], 'production'); // dev if ($this->env == 'development') { // profile and something else $this->output->enable_profiler(TRUE); } //$this->debug = &$this->settings['site']['debug']; //$this->model = strtolower(get_class($this)); //$this->tpl = $this->lib('template')->factory(); // у нас будет свой шаблонизатор }
/** * Вернём всего кол-во записей в базе * * @param array $where еще условие помимо глобального where * @param string $table может таблица не текущая * @return integer кол-во записей */ public function count($where = '', $table = '') { $table = not_empty($table, $this->table); if (!empty($where)) { $this->db->where($where); } $this->operate_where(); // обработаем глобальный where $res = $this->result($this->db->select('COUNT(*) AS count', FALSE)->get($table, 1), 1); return not_empty($res['count'], 0); }
/** * Update user's time shift */ public function save_shift() { $data['id'] = param('id|int'); $data['staff_id'] = param('staff_id|int'); // break if we dont have user's ID! if (empty($data['staff_id'])) { response_to(array('error' => 'Error, Staff ID is empty')); return; } // decode our row params from JSON $data['fromdate'] = mysql_date(not_empty(param('fromdate', FALSE, FALSE), now2mysql())); $data['shift_id'] = param('shift_id|int'); try { $id = $this->staffshift->save($data); $data['id'] = $id; // make row for return if we create him $shiftheads = $this->shiftheads(); //$data['shifts'] = $this->shifts( $id ); $row = shift_row($data, TRUE, $shiftheads); //$id = $data['id']; $response = array('msg' => 'Good, TimeShift saved', 'id' => $id, 'row' => $row); } catch (Exception $e) { $response = array('error' => $e->getMessage()); } response_to($response); return; }
$q->execute(['email' => $email, 'password' => sha1($password)]); $userHasBeenFound = $q->rowCount(); if ($userHasBeenFound) { redirect('profile.php'); } else { set_flash('Combinaison adresse mail, mot de passe incorrecte.', 'danger'); save_input_data(); } } else { clear_input_data(); } } //Si le formulaire d'inscription a été soumis if (isset($_POST['register'])) { //Si tous les champs sont remplis if (not_empty(['firstname', 'lastname', 'class', 'email', 'password', 'password_confirm'])) { $errors = []; //On crée un tableau qui va contenir nos erreurs extract($_POST); if (mb_strlen($firstname) < 2) { $errors[] = "Votre prénom est trop court. (2 caractères minimum)"; } if (mb_strlen($lastname) < 2) { $errors[] = "Votre nom est trop court. (2 caractères minimum)"; } if (mb_strlen($class) != 4) { $errors[] = "Veuillez insérer votre promo. (ex: 2016)"; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors[] = "Votre adresse email n'est pas valide."; }
function column_sort_links($columns, $old_params, $merge = array()) { foreach ($columns as $column) { $links[$column] = http_build_query(not_empty(array_merge($merge, sort_query_vars($column, $old_params)))); } return $links; }
/** * 获取用户剩余票数 * * @param string openid,workid * @return array */ function get_user_vote_count() { $openId = z(t(v('openid'))); //检测请求参数是否为空 if (!not_empty($openId)) { return self::send_error(LR_API_DB_EMPTY_RESULT, '请求的参数不能为空'); } $voteCount = get_user_vote_count($openId); return self::send_result($voteCount); }
/** * Check our request and keep in safe place TEXT information * * @param type $post * @param type $msg * @return PostController */ protected function check_and_save_text($post, $msg = 'Поздравляем, Вы создали топик') { if ($post !== FALSE and $_POST) { $text['post_id'] = not_empty($this->id, $post['id']); $text['original'] = param('original', TRUE, FALSE); $text['full'] = prepare_text($text['original']); $text['short'] = mb_strcut(strip_tags_regular($text['full']), 0, 250); $this->text->save($text); set_flash_ok($msg); redirect(post_link($post)); } return $this; }
/** * Invoke a method if value is not empty * * @param mixed $var * * @return bool * @author Aurimas Niekis <*****@*****.**> */ function invoke_if_not_empty($object, $methodName, $var) { return invoke_if($object, $methodName, [$var], not_empty($var)); }
<?php session_start(); include 'config/functions.php'; if ($est_connecte) { redirect("index.php?page=logged.php"); } if (isset($_POST["btn-login"])) { extract($_POST); if (not_empty([$N_etudiant, $password])) { if ($N_etudiant == USER && $password == PASSWD) { $_SESSION['user'] = $N_etudiant; $est_connecte = true; redirect("index.php?page=logged.php"); } } } include 'views/login.view.php'; ?> ?>
/** * Новая запись вставляется в таблицу */ public function insert($user = '') { if (empty($user)) { return FALSE; } unset($user[$this->pkey]); if (!empty($user['birth_at'])) { $user['birth_at'] = transform_date($user['birth_at']); } if (!empty($user['new_password'])) { srand(time()); $user['salt'] = substr(md5(rand(100, time())), 0, 12); $user['password'] = $this->make_password($user['new_password'], $user['salt']); } unset($user['new_password']); $user['registered_at'] = not_empty(transform_date($user['registered_at']), now2mysql()); $this->db->insert($this->table, $user); return $this->db->insert_id(); }
function form_select_date($id, $date = '', $lang = 'russian', $today = '') { $common = CI()->config->item('common'); Asset::add_js($common['js'] . '/datepicker.js'); add_css($common['css'] . '/datepicker/datepicker.css'); $date = not_empty($date, date('d.m.Y')); $date = human_date($date); if (empty($page['laguage']) or $page['language'] == 'russian') { $locale = ' locale: { days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], daysShort: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], monthsShort: ["Янв", "Фев", "Март", "Апр", "Май", "Июнь", "Июль", "Авг", "Сен", "Окт", "Нояб", "Дек"], weekMin: "№" }, '; } $out = <<<DOT <input name="{$id}" id="{$id}" type="text" class="input size100" value="{$date}" /> <script language="JavaScript" type="text/javascript"> \t\$(function() { \$('#{$id}').DatePicker({ format:'d.m.Y', date: \$('#{$id}').val(), starts: 1, position: 'right', {$locale} onBeforeShow: function(){ \$('#{$id}').DatePickerSetDate(\$('#{$id}').val(), true); }, onChange: function(formated, dates){ \$('#{$id}').val(formated); } }); \t}); </script> DOT; return $out; }
require 'includes/constants.php'; require 'includes/functions.php'; require 'initialization/locale.php'; if (!empty($_GET['id'])) { $data = find_code_by_id($_GET['id']); if (!$data) { $code = ""; } else { $code = $data->code; } } else { $code = ""; } //Si le formulaire de connexion a été soumis if (isset($_POST['save'])) { if (not_empty(['code'])) { extract($_POST); $q = $db->prepare('INSERT INTO codes(code) VALUES(?)'); $success = $q->execute([$code]); if ($success) { //Afficher le code source $id = $db->lastInsertId(); redirect('show_code.php?id=' . $id); } else { set_flash("Erreur lors de l'ajout du code source."); redirect("share_code.php"); } } else { redirect('share_code.php'); } }
<?php $page = (require_once 'modules/Page_Controller.php'); $validation = (require_once 'modules/Validation_Controller.php'); $errors = array(); $message = ''; // LOGIN if (isset($_POST['action'])) { $username = trim($_POST['username']); $password = $_POST['password']; $message = 'The form was submitted'; // Validations foreach ($_POST as $key => $value) { if (!not_empty(trim($_POST[$key]))) { $errors[$key] = 'Please enter your ' . ucfirst($key) . '.'; } } if (empty($errors)) { if ($username == 'bigdrumr' && $password == 'password99') { redirect_to('templates/account.php'); } else { // errors } } } else { $username = '******'; $password = '******'; $message = 'Please Log In.'; } ?>
/** * Format a rule in a human readable string * intl extension is required. * * @param array $opt * * @return string */ public function humanReadable(array $opt = array()) { if (self::$intl_loaded === null) { self::$intl_loaded = extension_loaded('intl'); } // attempt to detect default locale if (self::$intl_loaded) { $locale = \Locale::getDefault(); } else { $locale = setlocale(LC_MESSAGES, 0); if ($locale == 'C') { $locale = 'en'; } } $default_opt = array('locale' => $locale, 'date_formatter' => null, 'fallback' => 'en'); if (self::$intl_loaded) { $default_opt['date_format'] = \IntlDateFormatter::SHORT; if ($this->freq >= self::SECONDLY || not_empty($this->rule['BYSECOND'])) { $default_opt['time_format'] = \IntlDateFormatter::LONG; } elseif ($this->freq >= self::HOURLY || not_empty($this->rule['BYHOUR']) || not_empty($this->rule['BYMINUTE'])) { $default_opt['time_format'] = \IntlDateFormatter::SHORT; } else { $default_opt['time_format'] = \IntlDateFormatter::NONE; } } $opt = array_merge($default_opt, $opt); if ($opt['date_formatter'] && !is_callable($opt['date_formatter'])) { throw new \InvalidArgumentException('The option date_formatter must callable'); } if (!$opt['date_formatter']) { if (self::$intl_loaded) { $formatter = \IntlDateFormatter::create($opt['locale'], $opt['date_format'], $opt['time_format'], $this->dtstart->getTimezone()->getName()); $opt['date_formatter'] = function ($date) use($formatter) { return $formatter->format($date); }; } else { $opt['date_formatter'] = function ($date) { return $date->format('Y-m-d H:i:s'); }; } } $i18n = self::i18nLoad($opt['locale'], $opt['fallback']); $parts = array('freq' => '', 'byweekday' => '', 'bymonth' => '', 'byweekno' => '', 'byyearday' => '', 'bymonthday' => '', 'byhour' => '', 'byminute' => '', 'bysecond' => '', 'bysetpos' => ''); // Every (INTERVAL) FREQ... $freq_str = strtolower(array_search($this->freq, self::$frequencies)); $parts['freq'] = strtr(self::i18nSelect($i18n[$freq_str], $this->interval), array('%{interval}' => $this->interval)); // BYXXX rules if (not_empty($this->rule['BYMONTH'])) { $tmp = $this->bymonth; foreach ($tmp as &$value) { $value = $i18n['months'][$value]; } $parts['bymonth'] = strtr(self::i18nSelect($i18n['bymonth'], count($tmp)), array('%{months}' => self::i18nList($tmp, $i18n['and']))); } if (not_empty($this->rule['BYWEEKNO'])) { // XXX negative week number are not great here $tmp = $this->byweekno; foreach ($tmp as &$value) { $value = strtr($i18n['nth_weekno'], array('%{n}' => $value)); } $parts['byweekno'] = strtr(self::i18nSelect($i18n['byweekno'], count($this->byweekno)), array('%{weeks}' => self::i18nList($tmp, $i18n['and']))); } if (not_empty($this->rule['BYYEARDAY'])) { $tmp = $this->byyearday; foreach ($tmp as &$value) { $value = strtr(self::i18nSelect($i18n[$value > 0 ? 'nth_yearday' : '-nth_yearday'], $value), array('%{n}' => abs($value))); } $tmp = strtr(self::i18nSelect($i18n['byyearday'], count($tmp)), array('%{yeardays}' => self::i18nList($tmp, $i18n['and']))); // ... of the month $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'yearly'), array('%{x}' => $tmp)); $parts['byyearday'] = $tmp; } if (not_empty($this->rule['BYMONTHDAY'])) { $parts['bymonthday'] = array(); if ($this->bymonthday) { $tmp = $this->bymonthday; foreach ($tmp as &$value) { $value = strtr(self::i18nSelect($i18n['nth_monthday'], $value), array('%{n}' => $value)); } $tmp = strtr(self::i18nSelect($i18n['bymonthday'], count($tmp)), array('%{monthdays}' => self::i18nList($tmp, $i18n['and']))); // ... of the month $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'monthly'), array('%{x}' => $tmp)); $parts['bymonthday'][] = $tmp; } if ($this->bymonthday_negative) { $tmp = $this->bymonthday_negative; foreach ($tmp as &$value) { $value = strtr(self::i18nSelect($i18n['-nth_monthday'], $value), array('%{n}' => -$value)); } $tmp = strtr(self::i18nSelect($i18n['bymonthday'], count($tmp)), array('%{monthdays}' => self::i18nList($tmp, $i18n['and']))); // ... of the month $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'monthly'), array('%{x}' => $tmp)); $parts['bymonthday'][] = $tmp; } $parts['bymonthday'] = implode(' ' . $i18n['and'], $parts['bymonthday']); } if (not_empty($this->rule['BYDAY'])) { $parts['byweekday'] = array(); if ($this->byweekday) { $tmp = $this->byweekday; foreach ($tmp as &$value) { $value = $i18n['weekdays'][$value]; } $parts['byweekday'][] = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), array('%{weekdays}' => self::i18nList($tmp, $i18n['and']))); } if ($this->byweekday_nth) { $tmp = $this->byweekday_nth; foreach ($tmp as &$value) { list($day, $n) = $value; $value = strtr(self::i18nSelect($i18n[$n > 0 ? 'nth_weekday' : '-nth_weekday'], $n), array('%{weekday}' => $i18n['weekdays'][$day], '%{n}' => abs($n))); } $tmp = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), array('%{weekdays}' => self::i18nList($tmp, $i18n['and']))); // ... of the year|month $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], $freq_str), array('%{x}' => $tmp)); $parts['byweekday'][] = $tmp; } $parts['byweekday'] = implode(' ' . $i18n['and'], $parts['byweekday']); } if (not_empty($this->rule['BYHOUR'])) { $tmp = $this->byhour; foreach ($tmp as &$value) { $value = strtr($i18n['nth_hour'], array('%{n}' => $value)); } $parts['byhour'] = strtr(self::i18nSelect($i18n['byhour'], count($tmp)), array('%{hours}' => self::i18nList($tmp, $i18n['and']))); } if (not_empty($this->rule['BYMINUTE'])) { $tmp = $this->byminute; foreach ($tmp as &$value) { $value = strtr($i18n['nth_minute'], array('%{n}' => $value)); } $parts['byminute'] = strtr(self::i18nSelect($i18n['byminute'], count($tmp)), array('%{minutes}' => self::i18nList($tmp, $i18n['and']))); } if (not_empty($this->rule['BYSECOND'])) { $tmp = $this->bysecond; foreach ($tmp as &$value) { $value = strtr($i18n['nth_second'], array('%{n}' => $value)); } $parts['bysecond'] = strtr(self::i18nSelect($i18n['bysecond'], count($tmp)), array('%{seconds}' => self::i18nList($tmp, $i18n['and']))); } if ($this->bysetpos) { $tmp = $this->bysetpos; foreach ($tmp as &$value) { $value = strtr(self::i18nSelect($i18n[$value > 0 ? 'nth_setpos' : '-nth_setpos'], $value), array('%{n}' => abs($value))); } $tmp = strtr(self::i18nSelect($i18n['bysetpos'], count($tmp)), array('%{setpos}' => self::i18nList($tmp, $i18n['and']))); $parts['bysetpos'] = $tmp; } // from X $parts['start'] = strtr($i18n['dtstart'], array('%{date}' => $opt['date_formatter']($this->dtstart))); // to X, or N times, or indefinitely if (!$this->until && !$this->count) { $parts['end'] = $i18n['infinite']; } elseif ($this->until) { $parts['end'] = strtr($i18n['until'], array('%{date}' => $opt['date_formatter']($this->until))); } elseif ($this->count) { $parts['end'] = strtr(self::i18nSelect($i18n['count'], $this->count), array('%{count}' => $this->count)); } // $str = strtr('%{frequency}%{byday}%{start}%{end}', array( // '%{frequency}' => $parts['frequency'], // '%{start}' => $parts['start'], // '%{end}' => $parts['end'], // '%{byday}' => $parts['byday'], // )); $parts = array_filter($parts); $str = implode('', $parts); return $str; }
function api_checklist_add() { $content = z(t(v('text'))); if (!not_empty($content)) { return apiController::send_error(LR_API_ARGS_ERROR, 'TEXT CAN\'T EMPTY'); } $tid = intval(v('tid')); if (intval($tid) < 1) { return apiController::send_error(LR_API_ARGS_ERROR, 'TID NOT EXISTS'); } // check user $tinfo = get_todo_info_by_id($tid); if (intval($tinfo['details']['is_public']) == 0 && uid() != $tinfo['owner_uid']) { return apiController::send_error(LR_API_FORBIDDEN, 'ONLY PUBLIC TODO CAN ADD CHECKLIST BY OTHERS'); } $sql = "INSERT INTO `checklist` ( `tid` , `title` , `content` , `timeline` , `uid` ) VALUES ( '" . intval($tid) . "' , '" . s($content) . "' , '" . s($content) . "' , NOW() , '" . intval(uid()) . "' ) "; run_sql($sql); if (db_errno() != 0) { return apiController::send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { return apiController::send_result(get_line("SELECT * FROM `checklist` WHERE `id` = '" . intval(last_id()) . "' LIMIT 1", db())); } }
<?php session_start(); include 'filters/guest_filter.php'; require 'config/dbconnect.php'; require 'includes/constants.php'; require 'includes/functions.php'; require 'initialization/locale.php'; //Si le formulaire de connexion a été soumis if (isset($_POST['login'])) { //Si tous les champs sont remplis if (not_empty(['email', 'password'])) { extract($_POST); $q = $db->prepare("SELECT id, email, firstname, lastname FROM users WHERE email = :email AND password = :password AND active = '1'"); $q->execute(['email' => $email, 'password' => sha1($password)]); $userHasBeenFound = $q->rowCount(); if ($userHasBeenFound) { $user = $q->fetch(PDO::FETCH_OBJ); // On récupère les données utilisateurs $_SESSION['user_id'] = $user->id; $_SESSION['email'] = $user->email; $_SESSION['firstname'] = $user->firstname; $_SESSION['lastname'] = $user->lastname; redirect('profile.php?id=' . $user->id); } else { set_flash('Combinaison adresse mail, mot de passe incorrecte.', 'danger'); save_input_data(); } } else { clear_input_data(); }
/** * 为Feed添加评论 * * * @param string token , 必填 * @param string fid - 必填 * @param string text - 必填 * @return feed array * @author EasyChen */ public function feed_add_comment($text = false, $fid = false) { if (!$text) { $content = $text = z(t(v('text'))); } if (!not_empty($content)) { return self::send_error(LR_API_ARGS_ERROR, __('INPUT_CHECK_BAD_ARGS', 'TEXT')); } if (!$fid) { $fid = intval(v('fid')); } if (intval($fid) < 1) { return self::send_error(LR_API_ARGS_ERROR, __('INPUT_CHECK_BAD_ARGS', 'FID')); } $finfo = get_line("SELECT * FROM `feed` WHERE `id` = '" . intval($fid) . "' LIMIT 1"); if (is_mobile_request()) { $device = 'mobile'; } else { $device = 'web'; } $sql = "INSERT INTO `comment` ( `fid` , `uid` , `content` , `timeline` , `device` ) \n\t\tVALUES ( '" . intval($fid) . "' , '" . intval($_SESSION['uid']) . "' , '" . s($content) . "' , NOW() , '" . s($device) . "' ) "; run_sql($sql); if (db_errno() != 0) { return self::send_error(LR_API_DB_ERROR, __('API_MESSAGE_DATABASE_ERROR') . mysql_error()); } else { $lid = last_id(); // feed表comment_count计数增加 $count = get_var("SELECT COUNT(*) FROM `comment` WHERE `fid` = '" . intval($fid) . "' ", db()); $sql = "UPDATE `feed` SET `comment_count` = '" . intval($count) . "' WHERE `id` = '" . intval($fid) . "' LIMIT 1"; run_sql($sql); // 向Feed作者发通知 if ($finfo['uid'] != uid()) { send_notice($finfo['uid'], __('API_TEXT_COMMENT_FEED_OWNED', array(uname(), $finfo['content'], $content)), 2, array('fid' => intval($fid), 'count' => $count)); } // 向参与了该Feed讨论的同学发送通知 $sql = "SELECT `uid` FROM `comment` WHERE `fid`= '" . intval($fid) . "' "; if ($uitems = get_data($sql)) { foreach ($uitems as $uitem) { if ($uitem['uid'] != uid() && $uitem['uid'] != $finfo['uid']) { $myuids[] = $uitem['uid']; } } } if (isset($myuids)) { $myuids = array_unique($myuids); foreach ($myuids as $muid) { send_notice($muid, __('API_TEXT_COMMENT_FEED_IN', array(uname(), $finfo['content'], $content)), 2, array('fid' => intval($fid), 'count' => $count)); } } // 向被@的同学,发送通知 if ($ats = find_at($content)) { $sql = "SELECT `id` FROM `user` WHERE "; foreach ($ats as $at) { $at = z(t($at)); if ($gname = get_group_names()) { if (in_array(strtoupper($at), $gname)) { if ($ndata = get_group_unames($at)) { foreach ($ndata as $nname) { $names[] = $nname; } } } else { $names[] = $at; } } else { $names[] = $at; } } foreach ($names as $at) { $at = z(t($at)); if (mb_strlen($at, 'UTF-8') < 2) { continue; } $wsql[] = " `name` = '" . s(t($at)) . "' "; if (c('at_short_name')) { if (mb_strlen($at, 'UTF-8') == 2) { $wsql[] = " `name` LIKE '_" . s($at) . "' "; } } } if (isset($wsql) && is_array($wsql)) { $sql = $sql . join(' OR ', $wsql); if ($udata = get_data($sql)) { foreach ($udata as $uitem) { $myuids[] = $uitem['id']; } if (isset($myuids) && is_array($myuids)) { $myuids = array_unique($myuids); foreach ($myuids as $muid) { if ($muid != uid() && $muid != $finfo['uid']) { send_notice($muid, __('API_TEXT_AT_IN_CAST_COMMENT', array(uname(), $finfo['content'], $content)), 2, array('fid' => intval($fid), $count)); } } } } } } if ($comment = get_line("SELECT * FROM `comment` WHERE `id` = '" . intval($lid) . "' LIMIT 1", db())) { $comment['user'] = get_user_info_by_id($_SESSION['uid']); return self::send_result($comment); } else { if (db_errno() != 0) { return self::send_error(LR_API_DB_ERROR, __('API_MESSAGE_DATABASE_ERROR') . mysql_error()); } else { return self::send_error(LR_API_DB_EMPTY_RESULT, __('API_MESSAGE_EMPTY_RESULT_DATA')); } } } }
require 'initialization/locale.php'; if (!empty($_GET['id'])) { //Dans le cas où l'utilisateur existe, on va récupérer les infos sur lui en BDD en utilisant son id $user = find_user_by_id($_GET['id']); if (!$user) { redirect('index.php'); } } else { redirect('modify_profile.php?id=' . get_session('user_id')); //Sinon, on le redirige avec le bon id } //Si le formulaire de connexion a été soumis if (isset($_POST['update'])) { $errors = []; //Si tous les champs sont remplis if (not_empty(['firstname', 'lastname'])) { extract($_POST); $q = $db->prepare('UPDATE users SET firstname = :firstname, lastname = :lastname, sex = :sex, city = :city, country = :country, github = :github, employment_status = :employment_status, description = :description WHERE id = :id'); $q->execute(['firstname' => $firstname, 'lastname' => $lastname, 'sex' => $sex, 'city' => $city, 'country' => $country, 'github' => $github, 'employment_status' => !empty($employment_status) ? '1' : '0', 'description' => $description, 'id' => get_session('user_id')]); set_flash("Votre profil a été mis à jour."); redirect('profile.php?id=' . get_session('user_id')); } else { save_input_data(); $errors[] = "Veuillez remplir tous les champs obligatoires (*)"; } } else { clear_input_data(); } require 'views/modify_profile.view.php';