From 2788aaeb1a463012cfa90bf31f5efb4bf6ca7344 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 26 Dec 2013 02:50:58 +0100 Subject: Problème ctype_digit qui ne marche pas sur des variables qui sont déjà des entiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Configuration.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'app/Models/Configuration.php') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 47509636f..cb2f90655 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -220,19 +220,13 @@ class FreshRSS_Configuration extends Minz_Model { public function _sortOrder ($value) { $this->sort_order = $value === 'ASC' ? 'ASC' : 'DESC'; } - public function _oldEntries ($value) { - if (ctype_digit ($value) && $value > 0) { - $this->old_entries = intval($value); - } else { - $this->old_entries = 3; - } + public function _oldEntries($value) { + $value = intval($value); + $this->old_entries = $value > 0 ? $value : 3; } public function _keepHistoryDefault($value) { - if (ctype_digit($value) && $value >= -1) { - $this->keep_history_default = intval($value); - } else { - $this->keep_history_default = 0; - } + $value = intval($value); + $this->keep_history_default = $value >= -1 ? $value : 0; } public function _shortcuts ($values) { foreach ($values as $key => $value) { -- cgit v1.2.3