From 4985e457eb004a4455148802a52ad14d81e7276f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 23 Jan 2014 18:03:44 +0100 Subject: N'affiche que lorsque nécessaire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige https://github.com/marienfressinaud/FreshRSS/issues/372 --- p/i/install.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'p/i/install.php') diff --git a/p/i/install.php b/p/i/install.php index 7ce4a5ccc..a8ea75c9c 100644 --- a/p/i/install.php +++ b/p/i/install.php @@ -805,7 +805,9 @@ function printStep2 () {
-

- +
+ + + +

+ +
+
-
+ Date: Sun, 26 Jan 2014 21:09:47 +0100 Subject: Compatibilité PHP 5.4- MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/327#issuecomment-33328377 --- p/i/install.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'p/i/install.php') diff --git a/p/i/install.php b/p/i/install.php index 331eda4ff..5addfb527 100644 --- a/p/i/install.php +++ b/p/i/install.php @@ -4,7 +4,7 @@ if (function_exists('opcache_reset')) { } require('../../constants.php'); -const BCRYPT_COST = 9; +define('BCRYPT_COST', 9); include(LIB_PATH . '/lib_rss.php'); @@ -170,6 +170,9 @@ function saveStep2 () { $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16); $_SESSION['auth_type'] = $_POST['auth_type']; if (!empty($_POST['passwordPlain'])) { + if (!function_exists('password_hash')) { + include_once(LIB_PATH . '/password_compat.php'); + } $passwordHash = password_hash($_POST['passwordPlain'], PASSWORD_BCRYPT, array('cost' => BCRYPT_COST)); $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js $_SESSION['passwordHash'] = $passwordHash; -- cgit v1.2.3 From 311ea6f52f1bdff15b92078d94ddca2921ff808e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 26 Jan 2014 22:32:30 +0100 Subject: Meilleure mise à jour avec les favicons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/327#issuecomment-33329115 --- p/i/install.php | 74 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 24 deletions(-) (limited to 'p/i/install.php') diff --git a/p/i/install.php b/p/i/install.php index 5addfb527..8002a45da 100644 --- a/p/i/install.php +++ b/p/i/install.php @@ -87,6 +87,8 @@ SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads '); define('SQL_UPDATE_HISTORYv007b', 'UPDATE `%1$sfeed` SET keep_history = CASE WHEN keep_history = 0 THEN -2 WHEN keep_history = 1 THEN -1 ELSE keep_history END;'); + +define('SQL_GET_FEEDS', 'SELECT id, url, website FROM `%1$sfeed`;'); // // gestion internationalisation @@ -310,14 +312,6 @@ function updateDatabase($perform = false) { $stm->execute(); } - $sql = sprintf(SQL_UPDATE_HISTORYv007b, $_SESSION['bd_prefix_user']); - $stm = $c->prepare($sql); - $stm->execute(); - - $sql = sprintf(SQL_UPDATE_CACHED_VALUES, $_SESSION['bd_prefix_user']); - $stm = $c->prepare($sql); - $stm->execute(); - $sql = sprintf(SQL_CONVERT_SELECTv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']); if (!$perform) { $sql .= ' LIMIT 1'; @@ -339,6 +333,7 @@ function updateDatabase($perform = false) { $content = unserialize(gzinflate(base64_decode($row['content']))); $stm2->execute(array($content, $id)); } + return true; } catch (PDOException $e) { return false; @@ -346,6 +341,51 @@ function updateDatabase($perform = false) { return false; } +function newPdo() { + switch ($_SESSION['bd_type']) { + case 'mysql': + $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; + $driver_options = array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', + ); + break; + case 'sqlite': + $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; + $driver_options = null; + break; + default: + return false; + } + return new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); +} + +function postUpdate() { + $c = newPdo(); + + $sql = sprintf(SQL_UPDATE_HISTORYv007b, $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql); + $stm->execute(); + + $sql = sprintf(SQL_UPDATE_CACHED_VALUES, $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql); + $stm->execute(); + + // + $sql = sprintf(SQL_GET_FEEDS, $_SESSION['bd_prefix_user']); + $stm = $c->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + foreach ($res as $feed) { + if (empty($feed['url'])) { + continue; + } + $hash = hash('crc32b', $_SESSION['salt'] . $feed['url']); + @file_put_contents(DATA_PATH . '/favicons/' . $hash . '.txt', + empty($feed['website']) ? $feed['url'] : $feed['website']); + } + // +} + function deleteInstall () { $res = unlink (INDEX_PATH . '/install.php'); if ($res) { @@ -360,22 +400,7 @@ function deleteInstall () { } try { - switch ($_SESSION['bd_type']) { - case 'mysql': - $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; - $driver_options = array( - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', - ); - break; - case 'sqlite': - $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite'; - $driver_options = null; - break; - default: - return false; - } - - $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options); + $c = newPdo(); $sql = sprintf(SQL_DROP_BACKUPv006, $_SESSION['bd_prefix']); $stm = $c->prepare($sql); $stm->execute(); @@ -987,6 +1012,7 @@ case 4: } break; case 5: + postUpdate(); break; case 6: deleteInstall (); -- cgit v1.2.3