Commit 2d39a83a authored by Thomas Citharel's avatar Thomas Citharel
Browse files

rebase and run php-cs-fixer


Signed-off-by: default avatarThomas Citharel <tcit@tcit.fr>
parent 64ff4149
......@@ -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()
];
// ---------------------------------------
......
......@@ -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)');
}
}
......@@ -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) {
......
......@@ -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) {
......
......@@ -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);
......
......@@ -17,7 +17,6 @@
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
// FRAMADATE version
const VERSION = '1.0';
......
......@@ -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'])) {
......
......@@ -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;
}
......
......@@ -30,9 +30,6 @@ use Framadate\Services\SecurityService;
use Framadate\Services\SessionService;
use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php';
/* Constantes */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment