diff options
| author | 2013-11-17 18:12:15 +0100 | |
|---|---|---|
| committer | 2013-11-17 18:12:15 +0100 | |
| commit | 86bede27704e55ab21dc019dadf0b34c2a66c098 (patch) | |
| tree | adbc3f6571a0ec11ded906dee959152cf3e5f337 | |
| parent | 642d1d378149db97e8e510b15ff6d9ec5f54b4d2 (diff) | |
Corrections install.php
Première version fonctionnelle
https://github.com/marienfressinaud/FreshRSS/issues/273
| -rwxr-xr-x | app/models/Entry.php | 8 | ||||
| -rw-r--r-- | public/install.php | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/app/models/Entry.php b/app/models/Entry.php index c4856af8b..052e5abff 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -578,7 +578,9 @@ class EntryDAO extends Model_pdo { $stm = $this->bd->prepare ($sql); $stm->execute (); $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); - return array('total' => $res[0], 'unread' => $res[1], 'read' => $res[0] - $res[1]); + $all = empty($res[0]) ? 0 : $res[0]; + $unread = empty($res[1]) ? 0 : $res[1]; + return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread); } public function count ($minPriority = null) { $sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id'; @@ -607,7 +609,9 @@ class EntryDAO extends Model_pdo { $stm = $this->bd->prepare ($sql); $stm->execute (); $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); - return array('all' => $res[0], 'unread' => $res[1], 'read' => $res[0] - $res[1]); + $all = empty($res[0]) ? 0 : $res[0]; + $unread = empty($res[1]) ? 0 : $res[1]; + return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread); } public function optimizeTable() { diff --git a/public/install.php b/public/install.php index ba8fe3675..c35d52f29 100644 --- a/public/install.php +++ b/public/install.php @@ -159,7 +159,7 @@ function saveStep2 () { $_SESSION['old_entries'] = 3; } $_SESSION['mail_login'] = addslashes ($_POST['mail_login']); - $_SESSION['default_user'] = substr(0, 16, preg_replace ('/[^a-zA-Z0-9]/', '', $_POST['default_user'])); + $_SESSION['default_user'] = substr(preg_replace ('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16); $token = ''; if ($_SESSION['mail_login']) { @@ -293,7 +293,8 @@ function checkStep2 () { isset ($_SESSION['old_entries']) && isset ($_SESSION['mail_login']) && isset ($_SESSION['default_user']); - $data = file_exists (DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'); + $defaultUser = empty($_POST['default_user']) ? $_SESSION['default_user'] : $_POST['default_user']; + $data = file_exists (DATA_PATH . '/' . $defaultUser . '_user.php'); return array ( 'conf' => $conf ? 'ok' : 'ko', @@ -561,11 +562,11 @@ function printStep3 () { <div class="group-controls"> <select name="type" id="type"> <option value="mysql" - <?php echo $_SESSION['bd_type'] && $_SESSION['bd_type'] == 'mysql' ? 'selected="selected"' : ''; ?>> + <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>> MySQL </option> <option value="sqlite" - <?php echo $_SESSION['bd_type'] && $_SESSION['bd_type'] == 'sqlite' ? 'selected="selected"' : ''; ?>> + <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>> SQLite </option> </select> |
