From 2d39a83a7fd0ecabaaf63c48c59dd504e4f0a29b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 20 Feb 2018 13:12:46 +0100 Subject: [PATCH] rebase and run php-cs-fixer Signed-off-by: Thomas Citharel --- admin/migration.php | 13 ++++++------- .../AddColumn_ValueMax_In_poll_For_1_1.php | 2 -- .../Framadate/Repositories/PollRepository.php | 2 +- app/classes/Framadate/Services/InputService.php | 3 +-- app/classes/Framadate/Services/PollService.php | 4 +--- app/inc/constants.php | 1 - create_date_poll.php | 1 - create_poll.php | 4 +--- studs.php | 3 --- 9 files changed, 10 insertions(+), 23 deletions(-) diff --git a/admin/migration.php b/admin/migration.php index b2de049..166f790 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -17,15 +17,15 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -use Framadate\Migration\AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9; -use Framadate\Migration\From_0_0_to_0_8_Migration; -use Framadate\Migration\From_0_8_to_0_9_Migration; +use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; use Framadate\Migration\AddColumn_receiveNewComments_For_0_9; use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9; -use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; -use Framadate\Migration\Alter_Comment_table_for_name_length; -use Framadate\Migration\Alter_Comment_table_adding_date; use Framadate\Migration\AddColumn_ValueMax_In_poll_For_1_1; +use Framadate\Migration\AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9; +use Framadate\Migration\Alter_Comment_table_adding_date; +use Framadate\Migration\Alter_Comment_table_for_name_length; +use Framadate\Migration\From_0_0_to_0_8_Migration; +use Framadate\Migration\From_0_8_to_0_9_Migration; use Framadate\Migration\Generate_uniqId_for_old_votes; use Framadate\Migration\Increase_pollId_size; use Framadate\Migration\Migration; @@ -50,7 +50,6 @@ $migrations = [ new Alter_Comment_table_adding_date(), new AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9(), new Increase_pollId_size() - ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php b/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php index dbf129c..6715f9b 100644 --- a/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php +++ b/app/classes/Framadate/Migration/AddColumn_ValueMax_In_poll_For_1_1.php @@ -27,7 +27,6 @@ use Framadate\Utils; * @version 0.9 */ class AddColumn_ValueMax_In_poll_For_1_1 implements Migration { - function __construct() { } @@ -69,5 +68,4 @@ class AddColumn_ValueMax_In_poll_For_1_1 implements Migration { ADD `ValueMax` TINYINT, ADD CHECK (ValueMax > 0)'); } - } diff --git a/app/classes/Framadate/Repositories/PollRepository.php b/app/classes/Framadate/Repositories/PollRepository.php index 9427813..0b8167b 100644 --- a/app/classes/Framadate/Repositories/PollRepository.php +++ b/app/classes/Framadate/Repositories/PollRepository.php @@ -15,7 +15,7 @@ class PollRepository extends AbstractRepository { (id, admin_id, title, description, admin_name, admin_mail, end_date, format, editable, receiveNewVotes, receiveNewComments, hidden, password_hash, results_publicly_visible,ValueMax) VALUES (?,?,?,?,?,?,FROM_UNIXTIME(?),?,?,?,?,?,?,?,?)'; $prepared = $this->prepare($sql); - $prepared->execute(array($poll_id, $admin_poll_id, $form->title, $form->description, $form->admin_name, $form->admin_mail, $form->end_date, $form->format, ($form->editable>=0 && $form->editable<=2) ? $form->editable : 0, $form->receiveNewVotes ? 1 : 0, $form->receiveNewComments ? 1 : 0, $form->hidden ? 1 : 0, $form->password_hash, $form->results_publicly_visible ? 1 : 0,$form->ValueMax)); + $prepared->execute([$poll_id, $admin_poll_id, $form->title, $form->description, $form->admin_name, $form->admin_mail, $form->end_date, $form->format, ($form->editable>=0 && $form->editable<=2) ? $form->editable : 0, $form->receiveNewVotes ? 1 : 0, $form->receiveNewComments ? 1 : 0, $form->hidden ? 1 : 0, $form->password_hash, $form->results_publicly_visible ? 1 : 0,$form->ValueMax]); } function findById($poll_id) { diff --git a/app/classes/Framadate/Services/InputService.php b/app/classes/Framadate/Services/InputService.php index ffb2266..0a06a68 100644 --- a/app/classes/Framadate/Services/InputService.php +++ b/app/classes/Framadate/Services/InputService.php @@ -80,9 +80,8 @@ class InputService { public function filterInteger($int) { if (filter_var($int, FILTER_VALIDATE_INT)) { return $int; - } else { + } return null; - } } public function filterBoolean($boolean) { diff --git a/app/classes/Framadate/Services/PollService.php b/app/classes/Framadate/Services/PollService.php index f2466d0..43efd42 100644 --- a/app/classes/Framadate/Services/PollService.php +++ b/app/classes/Framadate/Services/PollService.php @@ -26,8 +26,6 @@ use Framadate\Repositories\RepositoryFactory; use Framadate\Security\Token; use Framadate\Utils; - - class PollService { private $connect; private $logService; @@ -153,7 +151,7 @@ class PollService { return $this->pollRepository->findAllByAdminMail($mail); } - function computeBestChoices($votes) { + function computeBestChoices($votes) { $result = ['y' => [0], 'inb' => [0]]; foreach ($votes as $vote) { $choices = str_split($vote->choices); diff --git a/app/inc/constants.php b/app/inc/constants.php index b631b9e..d36106a 100644 --- a/app/inc/constants.php +++ b/app/inc/constants.php @@ -17,7 +17,6 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ - // FRAMADATE version const VERSION = '1.0'; diff --git a/create_date_poll.php b/create_date_poll.php index 89f805b..05261b0 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -48,7 +48,6 @@ if ($_SESSION['form']->format !== 'D') { $_SESSION['form']->clearChoices(); } - if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || ($config['use_smtp'] && !isset($_SESSION['form']->admin_mail))) { $step = 1; } else if (!empty($_POST['confirmation'])) { diff --git a/create_poll.php b/create_poll.php index 015b63e..75f4240 100644 --- a/create_poll.php +++ b/create_poll.php @@ -57,7 +57,7 @@ if ($goToStep2) { $title = $inputService->filterTitle($_POST['title']); $use_ValueMax = isset($_POST['use_ValueMax']) ? $inputService->filterBoolean($_POST['use_ValueMax']) : false; - $ValueMax = $use_ValueMax == true ? $inputService->filterInteger($_POST['ValueMax']) : null; + $ValueMax = $use_ValueMax === true ? $inputService->filterInteger($_POST['ValueMax']) : null; $use_customized_url = isset($_POST['use_customized_url']) ? $inputService->filterBoolean($_POST['use_customized_url']) : false; $customized_url = $use_customized_url === true ? $inputService->filterId($_POST['customized_url']) : null; @@ -83,7 +83,6 @@ if ($goToStep2) { $error_on_customized_url = false; $error_on_ValueMax = false; - $_SESSION['form']->title = $title; $_SESSION['form']->id = $customized_url; $_SESSION['form']->use_customized_url = $use_customized_url; @@ -125,7 +124,6 @@ if ($goToStep2) { } } - if ($name !== $_POST['name']) { $error_on_name = true; } diff --git a/studs.php b/studs.php index 1b71197..64d1a89 100644 --- a/studs.php +++ b/studs.php @@ -30,9 +30,6 @@ use Framadate\Services\SecurityService; use Framadate\Services\SessionService; use Framadate\Utils; - - - include_once __DIR__ . '/app/inc/init.php'; /* Constantes */