public function sendAppeal() { \Helpers\GUMP::set_field_name('appealtext', 'Дополнительная информация'); $validated = \Helpers\GUMP::is_valid($_POST, array('appeal-type' => 'required', 'appealtext' => 'max_len,512', 'fileid' => 'required')); if (is_array($validated)) { echo $validated[0]; die; } $mail = new \Helpers\PhpMailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom('*****@*****.**'); $mail->addAddress('*****@*****.**'); $mail->subject('Новая жалоба'); $mail->body('<p>Жалоба на файл: ' . 'http://rocketfiles.com/files/' . \Helpers\Data::html($_POST['fileid']) . '</p>' . '<p>Причина: ' . \Helpers\Data::html($_POST['appeal-type']) . '</p>' . '<p>Дополнительный текст: ' . \Helpers\Data::html($_POST['appealtext']) . '</p>'); $mail->send(); echo 'Жалоба отправлена!'; die; }
public function create() { if (Request::isPost()) { //Checkbox validation if ($_POST['participeAvant'] == "Yes") { $participe_avant = 'true'; } else { $participe_avant = 'false'; } //date validation $_POST['dateD'] = $this->validate_date($_POST['dateD']); $_POST['dateF'] = $this->validate_date($_POST['dateF']); if ($_POST['dateD'] != null && $_POST['dateF'] != null) { if (!$this->is_date_higher($_POST['dateD'], $_POST['dateF'])) { $_POST['dateD'] = null; $_POST['dateF'] = null; } } GUMP::set_field_name("titre", "\"Titre\""); GUMP::set_field_name("dateD", "\"Date de début\""); GUMP::set_field_name("dateF", "\"Date de fin\""); GUMP::set_field_name("participeAvant", "\"Participe avant\""); GUMP::set_field_name("nbParticipantsMax", "\"Nombre de participant max\""); GUMP::set_field_name("image_concours", "\"Image\""); $is_valid = GUMP::is_valid(array_merge($_POST, $_FILES), array('titre' => 'required', 'dateD' => 'required', 'dateF' => 'required', 'participeAvant' => 'boolean', 'nbParticipantsMax' => 'required|integer', 'image_concours' => 'required', 'nb_votes_max' => 'required|integer')); //A modifier $id_client = 1; $image_concours = "image_concours"; //save de contest if ($is_valid === true) { /* $concour = array( 'titre' => $_POST['titre'], 'theme' => $_POST['theme'], 'reglement' => $_POST['reglement'], 'description' => $_POST['description'], 'lots' => $_POST['lots'], 'dateD' => $_POST['dateD'], 'dateF' => $_POST['dateF'], 'nbParticipantsMax' => intval($_POST['nbPaticipantsMax']), 'participeAvant' => $_POST['participeAvant'], 'image_concours' => $image_concours, 'fk_id_client' => $id_client, 'nb_votes_max' => intval($_POST['nb_votes_max']) ); */ $query = "INSERT INTO concours(titre, theme, reglement, description, lots, \"dateD\",\n \"dateF\", \"nbParticipantsMax\", image_concours,\n \"participeAvant\", fk_id_client, nb_votes_max)\n\n VALUES ('" . $_POST['titre'] . "',' " . $_POST['theme'] . "', '" . $_POST['reglement'] . "', '" . $_POST['description'] . "', '" . $_POST['lots'] . "', '" . $_POST['dateD'] . "', '" . $_POST['dateF'] . "', " . intval($_POST['nbPaticipantsMax']) . ", '" . $image_concours . "', '" . $participe_avant . "', " . $id_client . ", '" . $_POST['nb_votes_max'] . "')"; $bdd = pg_connect(DB_CONFIG); //$res = pg_insert($bdd, "concours", $concour); $res = pg_query($bdd, $query); pg_close($bdd); if ($res) { $data['saved_correctly'] = true; } else { $data['is_error'] = true; $data['is_valid'] = array('Une erreur s\'est produite au moment de la sauvegarde'); } } else { $data['post'] = $_POST; $data['is_error'] = true; $data['is_valid'] = $is_valid; } } $this->validate_date("4/13/2017"); $data['title'] = $this->language->get('createContest'); //Adding specific JS files $data['js-datePlaceholder'] = true; View::renderTemplate('backoffice/header', $data); View::renderTemplate('backoffice/main_header', $data); View::render('backoffice/contest/create', $data); View::renderTemplate('backoffice/footer', $data); }
public function refresh() { \Helpers\GUMP::set_field_name('new-email', 'email'); \Helpers\GUMP::set_field_name('new-password', 'Пароль'); \Helpers\GUMP::set_field_name('confirm-new-password', 'Подтверждение пароля'); $validated = \Helpers\GUMP::is_valid($_POST, array('user-id' => 'required|integer', 'old-email' => 'required|valid_email', 'new-email' => 'required|valid_email', 'new-password' => 'required|max_len,32|min_len,4', 'confirm-new-password' => 'required|max_len,32|min_len,4')); if (is_array($validated)) { echo $validated[0]; die; } if ($_POST['new-password'] != $_POST['confirm-new-password']) { echo 'Пароли не совпадают.'; die; } if (mb_strtolower($_POST['old-email']) != mb_strtolower($_POST['new-email'])) { $checkEmail = $this->_user->checkEmail(mb_strtolower($_POST['new-email'])); if (!empty($checkEmail)) { echo 'Этот email уже есть в базе.'; die; } } $newPass = \Helpers\Password::make($_POST['new-password']); $this->_user->updateUser($_POST['new-email'], $newPass, $_POST['user-id']); }