rebase and run php-cs-fixer

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-02-20 13:12:46 +01:00
parent 64ff414900
commit 2d39a83a7f
9 changed files with 10 additions and 23 deletions

View File

@ -17,15 +17,15 @@
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) * 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\AddColumn_hidden_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_receiveNewComments_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_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\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\Generate_uniqId_for_old_votes;
use Framadate\Migration\Increase_pollId_size; use Framadate\Migration\Increase_pollId_size;
use Framadate\Migration\Migration; use Framadate\Migration\Migration;
@ -50,7 +50,6 @@ $migrations = [
new Alter_Comment_table_adding_date(), new Alter_Comment_table_adding_date(),
new AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9(), new AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9(),
new Increase_pollId_size() new Increase_pollId_size()
]; ];
// --------------------------------------- // ---------------------------------------

View File

@ -27,7 +27,6 @@ use Framadate\Utils;
* @version 0.9 * @version 0.9
*/ */
class AddColumn_ValueMax_In_poll_For_1_1 implements Migration { class AddColumn_ValueMax_In_poll_For_1_1 implements Migration {
function __construct() { function __construct() {
} }
@ -69,5 +68,4 @@ class AddColumn_ValueMax_In_poll_For_1_1 implements Migration {
ADD `ValueMax` TINYINT, ADD `ValueMax` TINYINT,
ADD CHECK (ValueMax > 0)'); ADD CHECK (ValueMax > 0)');
} }
} }

View File

@ -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) (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(?),?,?,?,?,?,?,?,?)'; VALUES (?,?,?,?,?,?,FROM_UNIXTIME(?),?,?,?,?,?,?,?,?)';
$prepared = $this->prepare($sql); $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) { function findById($poll_id) {

View File

@ -80,9 +80,8 @@ class InputService {
public function filterInteger($int) { public function filterInteger($int) {
if (filter_var($int, FILTER_VALIDATE_INT)) { if (filter_var($int, FILTER_VALIDATE_INT)) {
return $int; return $int;
} else { }
return null; return null;
}
} }
public function filterBoolean($boolean) { public function filterBoolean($boolean) {

View File

@ -26,8 +26,6 @@ use Framadate\Repositories\RepositoryFactory;
use Framadate\Security\Token; use Framadate\Security\Token;
use Framadate\Utils; use Framadate\Utils;
class PollService { class PollService {
private $connect; private $connect;
private $logService; private $logService;
@ -153,7 +151,7 @@ class PollService {
return $this->pollRepository->findAllByAdminMail($mail); return $this->pollRepository->findAllByAdminMail($mail);
} }
function computeBestChoices($votes) { function computeBestChoices($votes) {
$result = ['y' => [0], 'inb' => [0]]; $result = ['y' => [0], 'inb' => [0]];
foreach ($votes as $vote) { foreach ($votes as $vote) {
$choices = str_split($vote->choices); $choices = str_split($vote->choices);

View File

@ -17,7 +17,6 @@
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/ */
// FRAMADATE version // FRAMADATE version
const VERSION = '1.0'; const VERSION = '1.0';

View File

@ -48,7 +48,6 @@ if ($_SESSION['form']->format !== 'D') {
$_SESSION['form']->clearChoices(); $_SESSION['form']->clearChoices();
} }
if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || ($config['use_smtp'] && !isset($_SESSION['form']->admin_mail))) { if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || ($config['use_smtp'] && !isset($_SESSION['form']->admin_mail))) {
$step = 1; $step = 1;
} else if (!empty($_POST['confirmation'])) { } else if (!empty($_POST['confirmation'])) {

View File

@ -57,7 +57,7 @@ if ($goToStep2) {
$title = $inputService->filterTitle($_POST['title']); $title = $inputService->filterTitle($_POST['title']);
$use_ValueMax = isset($_POST['use_ValueMax']) ? $inputService->filterBoolean($_POST['use_ValueMax']) : false; $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; $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; $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_customized_url = false;
$error_on_ValueMax = false; $error_on_ValueMax = false;
$_SESSION['form']->title = $title; $_SESSION['form']->title = $title;
$_SESSION['form']->id = $customized_url; $_SESSION['form']->id = $customized_url;
$_SESSION['form']->use_customized_url = $use_customized_url; $_SESSION['form']->use_customized_url = $use_customized_url;
@ -125,7 +124,6 @@ if ($goToStep2) {
} }
} }
if ($name !== $_POST['name']) { if ($name !== $_POST['name']) {
$error_on_name = true; $error_on_name = true;
} }

View File

@ -30,9 +30,6 @@ use Framadate\Services\SecurityService;
use Framadate\Services\SessionService; use Framadate\Services\SessionService;
use Framadate\Utils; use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php'; include_once __DIR__ . '/app/inc/init.php';
/* Constantes */ /* Constantes */