Merge branch 'FreshRSS/dev' into PostgreSQL

This commit is contained in:
Alexandre Alapetite
2016-08-20 12:22:56 +02:00
17 changed files with 218 additions and 165 deletions

View File

@@ -1,6 +1,6 @@
# Changelog
## 2016-XX-XX FreshRSS 1.5.x-dev
## 2016-08-XX FreshRSS 1.5.0-dev
* Compatibility
* Require at least MySQL 5.5.3+ [#1153](https://github.com/FreshRSS/FreshRSS/issues/1153)
@@ -8,6 +8,7 @@
* Restore compatibility with PHP 5.3.3 [#1208](https://github.com/FreshRSS/FreshRSS/issues/1208)
* Restore compatibility with Microsoft Internet Explorer 11 / Edge [#772](https://github.com/FreshRSS/FreshRSS/issues/772)
* Features
* Mark a search as read [#608](https://github.com/FreshRSS/FreshRSS/issues/608)
* Support for full Unicode such as emoji 💕 in MySQL with utf8mb4 [#1153](https://github.com/FreshRSS/FreshRSS/issues/1153)
* FreshRSS will automatically migrate MySQL tables to utf8mb4 the first time it is needed.
* Security
@@ -20,10 +21,12 @@
* Fixed Apache Etag issue that prevented caching [#1199](https://github.com/FreshRSS/FreshRSS/pull/1199)
* Fixed OPML import of categories [#1202](https://github.com/FreshRSS/FreshRSS/issues/1202)
* UI
* Use sticky category column [#1172](https://github.com/FreshRSS/FreshRSS/pull/1172)
* Updated to jQuery 3.1.0 and several JavaScript fixes (e.g. drag & drop) [#1197](https://github.com/FreshRSS/FreshRSS/pull/1197)
* API
* Add API link in FreshRSS profile settings to ease set-up [#1186](https://github.com/FreshRSS/FreshRSS/pull/1186)
* Mics.
* Misc.
* Work-around for SuperFeeder time-outs during PubSubHubbub registration [#1184](https://github.com/FreshRSS/FreshRSS/pull/1184)
* JSHint of JavaScript code and better initialisation [#1196](https://github.com/FreshRSS/FreshRSS/pull/1196)
* Updated credits, and images in README [#1201](https://github.com/FreshRSS/FreshRSS/issues/1201)

View File

@@ -9,17 +9,25 @@ People are sorted by name so please keep this order.
* [Alexandre Alapetite](https://github.com/Alkarex): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Alkarex), [Web](http://alexandre.alapetite.fr/)
* [Alexis Degrugillier](https://github.com/aledeg): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=aledeg)
* [Alwaysin](https://github.com/Alwaysin): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Alwaysin)
* [Amaury Carrade](https://github.com/AmauryCarrade): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=AmauryCarrade)
* [Amaury Carrade](https://github.com/AmauryCarrade): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=AmauryCarrade), [Web](https://amaury.carrade.eu/)
* [ASMfreaK](https://github.com/ASMfreaK): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ASMfreaK)
* [Damstre](https://github.com/Damstre): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Damstre),
* [danc](https://github.com/danc): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=danc), [Web](http://tintouli.free.fr/)
* [ealdraed](https://github.com/ealdraed): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ealdraed)
* [Luc Didry](https://github.com/ldidry): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ldidry)
* [Marcus Rohrmoser](https://github.com/mro):
[contributions](https://github.com/FreshRSS/FreshRSS/commits?author=mro)
* [Frans de Jonge](https://github.com/Frenzie): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Frenzie), [Web](http://fransdejonge.com/)
* [Guillaume Fillon](https://github.com/kokaz): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:kokaz), [Web](http://www.guillaume-fillon.com/)
* [hckweb](https://github.com/hckweb): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=hckweb)
* [Jaussoin Timothée](https://github.com/edhelas): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=edhelas), [Web](http://edhelas.movim.eu/)
* [Julien Reichardt](https://github.com/j8r): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=j8r), [Web](https://blog.jrei.ch/)
* [Luc Didry](https://github.com/ldidry): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ldidry), [Web](https://www.fiat-tux.fr/)
* [marcomrc](https://github.com/marcomrc): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=marcomrc)
* [Marcus Rohrmoser](https://github.com/mro): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=mro), [Web](http://mro.name/~me)
* [Marien Fressinaud](https://github.com/marienfressinaud): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=marienfressinaud), [Web](http://marienfressinaud.fr/)
* [Melvyn Laïly](https://github.com/yaurthek): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=yaurthek)
* [Melvyn Laïly](https://github.com/yaurthek): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=yaurthek), [Web](http://x2a.yt/)
* [Nicolas Elie](https://github.com/nicolaselie): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=nicolaselie)
* [plopoyop](https://github.com/plopoyop): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=plopoyop)
* [Tets42](https://github.com/Tets42):
[contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Tets42)
* [thomasE1993](https://github.com/thomasE1993):
[contributions](https://github.com/FreshRSS/FreshRSS/commits?author=thomasE1993)
* [purexo](https://github.com/purexo): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:purexo), [Web](https://purexo.mom/)
* [romibi](https://github.com/romibi): [contributions](https://github.com/FreshRSS/FreshRSS/commits/dev?author=romibi)
* [Tets42](https://github.com/Tets42): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Tets42)
* [tomgue](https://github.com/tomgue): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=tomgue)
* [Wanabo](https://github.com/Wanabo): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Wanabo)

View File

@@ -32,14 +32,12 @@ Nous sommes une communauté amicale.
* Serveur modeste, par exemple sous Linux ou Windows
* Fonctionne même sur un Raspberry Pi 1 avec des temps de réponse < 1s (testé sur 150 flux, 22k articles)
* Serveur Web Apache2 (recommandé), ou nginx, lighttpd (non testé sur les autres)
* PHP 5.3.3+ (PHP 5.3.7+ recommandé, et PHP 5.5+ pour les performances, et PHP 7+ pour dencore meilleures performances)
* Requis : [PDO_MySQL](http://php.net/pdo-mysql) ou [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl), [GMP](http://php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](http://php.net/intl.idn) (pour les noms de domaines internationalisés)
* Recommandés : [iconv](http://php.net/iconv), [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [Zip](http://php.net/zip), [zlib](http://php.net/zlib)
* Inclus par défaut : [DOM](http://php.net/dom), [XML](http://php.net/xml)…
* PHP 5.3.3+ (PHP 5.4+ recommandé, et PHP 5.5+ pour les performances, et PHP 7+ pour dencore meilleures performances)
* Requis : [DOM](http://php.net/dom), [XML](http://php.net/xml), [PDO_MySQL](http://php.net/pdo-mysql) ou [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl)
* Recommandés : [JSON](http://php.net/json), [GMP](http://php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](http://php.net/intl.idn) (pour les noms de domaines internationalisés), [mbstring](http://php.net/mbstring) et/ou [iconv](http://php.net/iconv) (pour conversion dencodages), [Zip](http://php.net/zip) (pour import/export), [zlib](http://php.net/zlib) (pour les flux compressés)
* MySQL 5.5.3+ (recommandé) ou SQLite 3.7.4+
* Un navigateur Web récent tel Firefox, Internet Explorer 11 / Edge, Chrome, Opera, Safari.
* Fonctionne aussi sur mobile
* Lentête HTTP `Referer` ne doit pas être désactivé pour pouvoir utiliser le formulaire de connexion
![Capture décran de FreshRSS](./doc/FreshRSS-screenshot.png)
@@ -61,13 +59,16 @@ sudo apt-get install apache2
sudo a2enmod headers expires rewrite ssl
# (optionnel) Si vous voulez un serveur de base de données MySQL
sudo apt-get install mysql-server mysql-client php5-mysql
# Composants principaux (git est optionnel si vous déployez manuellement les fichiers dinstallation)
sudo apt-get install git php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite
# Composants principaux (pour Ubuntu <= 15.10, Debian <= 8 Jessie)
sudo apt-get install php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite
# Composants principaux (pour Ubuntu >= 16.04, Debian >= 9 Stretch)
sudo apt install php libapache2-mod-php php-curl php-gmp php-intl php-mbstring php-sqlite3 php-xml php-zip
# Redémarrage du serveur Web
sudo service apache2 restart
# Pour FreshRSS lui-même
# Pour FreshRSS lui-même (git est optionnel si vous déployez manuellement les fichiers dinstallation)
cd /usr/share/
sudo apt-get install git
sudo git clone https://github.com/FreshRSS/FreshRSS.git
# Mettre les droits daccès pour le serveur Web
cd FreshRSS
@@ -126,6 +127,7 @@ mysqldump -u utilisateur -p --databases freshrss > freshrss.sql
* [jQuery](http://jquery.com/)
* [ArthurHoaro/favicon](https://github.com/ArthurHoaro/favicon)
* [lib_opml](https://github.com/marienfressinaud/lib_opml)
* [jQuery Plugin Sticky-Kit](http://leafo.net/sticky-kit/)
* [keyboard_shortcuts](http://www.openjs.com/scripts/events/keyboard_shortcuts/)
* [flotr2](http://www.humblesoftware.com/flotr2)

View File

@@ -32,14 +32,12 @@ We are a friendly community.
* Light server running Linux or Windows
* It even works on Raspberry Pi 1 with response time under a second (tested with 150 feeds, 22k articles)
* A web server: Apache2 (recommended), nginx, lighttpd (not tested on others)
* PHP 5.3.3+ (PHP 5.3.7+ recommended, and PHP 5.5+ for performance, and PHP 7 for even higher performance)
* Required extensions: [PDO_MySQL](http://php.net/pdo-mysql) or [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl), [GMP](http://php.net/gmp) (for API access on platforms < 64 bits), [IDN](http://php.net/intl.idn) (for Internationalized Domain Names)
* Recommended extensions: [iconv](http://php.net/iconv), [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [Zip](http://php.net/zip), [zlib](http://php.net/zlib)
* Enabled by default: [DOM](http://php.net/dom), [XML](http://php.net/xml)…
* PHP 5.3.3+ (PHP 5.4+ recommended, and PHP 5.5+ for performance, and PHP 7 for even higher performance)
* Required extensions: [DOM](http://php.net/dom), [XML](http://php.net/xml), [PDO_MySQL](http://php.net/pdo-mysql) or [PDO_SQLite](http://php.net/pdo-sqlite), [cURL](http://php.net/curl)
* Recommended extensions: [JSON](http://php.net/json), [GMP](http://php.net/gmp) (for API access on platforms < 64 bits), [IDN](http://php.net/intl.idn) (for Internationalized Domain Names), [mbstring](http://php.net/mbstring) and/or [iconv](http://php.net/iconv) (for charset conversion), [Zip](http://php.net/zip) (for import/export), [zlib](http://php.net/zlib) (for compressed feeds)
* MySQL 5.5.3+ (recommended) or SQLite 3.7.4+
* A recent browser like Firefox, Internet Explorer 11 / Edge, Chrome, Opera, Safari.
* Works on mobile
* The browser HTTP `Referer` header must not be disabled when using the form login method
![FreshRSS screenshot](./doc/FreshRSS-screenshot.png)
@@ -61,13 +59,16 @@ sudo apt-get install apache2
sudo a2enmod headers expires rewrite ssl
# (Optional) If you want a MySQL database server
sudo apt-get install mysql-server mysql-client php5-mysql
# Main components (git is optional if you manually download the installation files)
sudo apt-get install git php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite
# Main components (for Ubuntu <= 15.10, Debian <= 8 Jessie)
sudo apt-get install php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite
# Main components (for Ubuntu >= 16.04, Debian >= 9 Stretch)
sudo apt install php libapache2-mod-php php-curl php-gmp php-intl php-mbstring php-sqlite3 php-xml php-zip
# Restart Web server
sudo service apache2 restart
# For FreshRSS itself
# For FreshRSS itself (git is optional if you manually download the installation files)
cd /usr/share/
sudo apt-get install git
sudo git clone https://github.com/FreshRSS/FreshRSS.git
# Set the rights so that your Web browser can access the files
cd FreshRSS
@@ -126,6 +127,7 @@ mysqldump -u user -p --databases freshrss > freshrss.sql
* [jQuery](http://jquery.com/)
* [ArthurHoaro/favicon](https://github.com/ArthurHoaro/favicon)
* [lib_opml](https://github.com/marienfressinaud/lib_opml)
* [jQuery Plugin Sticky-Kit](http://leafo.net/sticky-kit/)
* [keyboard_shortcuts](http://www.openjs.com/scripts/events/keyboard_shortcuts/)
* [flotr2](http://www.humblesoftware.com/flotr2)

View File

@@ -40,6 +40,17 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
$get = Minz_Request::param('get');
$next_get = Minz_Request::param('nextGet', $get);
$id_max = Minz_Request::param('idMax', 0);
FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', ''));
FreshRSS_Context::$state = Minz_Request::param('state', 0);
if (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_FAVORITE)) {
FreshRSS_Context::$state = FreshRSS_Entry::STATE_FAVORITE;
} elseif (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_FAVORITE)) {
FreshRSS_Context::$state = FreshRSS_Entry::STATE_NOT_FAVORITE;
} else {
FreshRSS_Context::$state = 0;
}
$params = array();
$entryDAO = FreshRSS_Factory::createEntryDao();
@@ -58,16 +69,16 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
$get = substr($get, 2);
switch($type_get) {
case 'c':
$entryDAO->markReadCat($get, $id_max);
$entryDAO->markReadCat($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state);
break;
case 'f':
$entryDAO->markReadFeed($get, $id_max);
$entryDAO->markReadFeed($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state);
break;
case 's':
$entryDAO->markReadEntries($id_max, true);
$entryDAO->markReadEntries($id_max, true, 0, FreshRSS_Context::$search);
break;
case 'a':
$entryDAO->markReadEntries($id_max);
$entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state);
break;
}

View File

@@ -129,12 +129,7 @@ class FreshRSS_ConfigurationSetter {
// Verify URL and add default value when needed
if (isset($value['url'])) {
$is_url = (
filter_var($value['url'], FILTER_VALIDATE_URL) ||
(version_compare(PHP_VERSION, '5.3.3', '<') &&
(strpos($value, '-') > 0) &&
($value === filter_var($value, FILTER_SANITIZE_URL)))
); //PHP bug #51192
$is_url = filter_var($value['url'], FILTER_VALIDATE_URL);
if (!$is_url) {
continue;
}

View File

@@ -344,7 +344,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @param integer $priorityMin
* @return integer affected rows
*/
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) {
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
@@ -359,8 +359,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
$sql .= ' AND f.priority > ' . intval($priorityMin);
}
$values = array($idMax);
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute($values))) {
list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state);
$stm = $this->bd->prepare($sql . $search);
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
Minz_Log::error('SQL error markReadEntries: ' . $info[2]);
return false;
@@ -383,7 +386,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @param integer $idMax fail safe article ID
* @return integer affected rows
*/
public function markReadCat($id, $idMax = 0) {
public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
@@ -393,8 +396,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
. 'SET e.is_read=1 '
. 'WHERE f.category=? AND e.is_read=0 AND e.id <= ?';
$values = array($id, $idMax);
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute($values))) {
list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state);
$stm = $this->bd->prepare($sql . $search);
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
Minz_Log::error('SQL error markReadCat: ' . $info[2]);
return false;
@@ -417,19 +423,22 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
* @param integer $idMax fail safe article ID
* @return integer affected rows
*/
public function markReadFeed($id_feed, $idMax = 0) {
public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadFeed(0) is deprecated!');
}
$this->bd->beginTransaction();
$sql = 'UPDATE `' . $this->prefix . 'entry` '
. 'SET is_read=1 '
. 'WHERE id_feed=? AND is_read=0 AND id <= ?';
$sql = 'UPDATE `' . $this->prefix . 'entry` e '
. 'SET e.is_read=1 '
. 'WHERE e.id_feed=? AND e.is_read=0 AND e.id <= ?';
$values = array($id_feed, $idMax);
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute($values))) {
list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state);
$stm = $this->bd->prepare($sql . $search);
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
Minz_Log::error('SQL error markReadFeed: ' . $info[2]);
$this->bd->rollBack();
@@ -493,52 +502,24 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL
}
private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
if (!$state) {
$state = FreshRSS_Entry::STATE_ALL;
}
$where = '';
$joinFeed = false;
protected function sqlListEntriesWhere($alias = '', $filter = null, $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $firstId = '', $date_min = 0) {
$search = ' ';
$values = array();
switch ($type) {
case 'a':
$where .= 'f.priority > 0 ';
$joinFeed = true;
break;
case 's': //Deprecated: use $state instead
$where .= 'e1.is_favorite=1 ';
break;
case 'c':
$where .= 'f.category=? ';
$values[] = intval($id);
$joinFeed = true;
break;
case 'f':
$where .= 'e1.id_feed=? ';
$values[] = intval($id);
break;
case 'A':
$where .= '1 ';
break;
default:
throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
}
if ($state & FreshRSS_Entry::STATE_NOT_READ) {
if (!($state & FreshRSS_Entry::STATE_READ)) {
$where .= 'AND e1.is_read=0 ';
$search .= 'AND ' . $alias . 'is_read=0 ';
}
}
elseif ($state & FreshRSS_Entry::STATE_READ) {
$where .= 'AND e1.is_read=1 ';
$search .= 'AND ' . $alias . 'is_read=1 ';
}
if ($state & FreshRSS_Entry::STATE_FAVORITE) {
if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) {
$where .= 'AND e1.is_favorite=1 ';
$search .= 'AND ' . $alias . 'is_favorite=1 ';
}
}
elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
$where .= 'AND e1.is_favorite=0 ';
$search .= 'AND ' . $alias . 'is_favorite=0 ';
}
switch ($order) {
@@ -552,76 +533,111 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
$firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; //MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev
}*/
if ($firstId !== '') {
$where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
$search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
}
if ($date_min > 0) {
$where .= 'AND e1.id >= ' . $date_min . '000000 ';
$search .= 'AND ' . $alias . 'id >= ' . $date_min . '000000 ';
}
$search = '';
if ($filter) {
if ($filter->getIntitle()) {
$search .= 'AND e1.title LIKE ? ';
$search .= 'AND ' . $alias . 'title LIKE ? ';
$values[] = "%{$filter->getIntitle()}%";
}
if ($filter->getInurl()) {
$search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? ';
$search .= 'AND CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ? ';
$values[] = "%{$filter->getInurl()}%";
}
if ($filter->getAuthor()) {
$search .= 'AND e1.author LIKE ? ';
$search .= 'AND ' . $alias . 'author LIKE ? ';
$values[] = "%{$filter->getAuthor()}%";
}
if ($filter->getMinDate()) {
$search .= 'AND e1.id >= ? ';
$search .= 'AND ' . $alias . 'id >= ? ';
$values[] = "{$filter->getMinDate()}000000";
}
if ($filter->getMaxDate()) {
$search .= 'AND e1.id <= ? ';
$search .= 'AND ' . $alias . 'id <= ? ';
$values[] = "{$filter->getMaxDate()}000000";
}
if ($filter->getMinPubdate()) {
$search .= 'AND e1.date >= ? ';
$search .= 'AND ' . $alias . 'date >= ? ';
$values[] = $filter->getMinPubdate();
}
if ($filter->getMaxPubdate()) {
$search .= 'AND e1.date <= ? ';
$search .= 'AND ' . $alias . 'date <= ? ';
$values[] = $filter->getMaxPubdate();
}
if ($filter->getTags()) {
$tags = $filter->getTags();
foreach ($tags as $tag) {
$search .= 'AND e1.tags LIKE ? ';
$search .= 'AND ' . $alias . 'tags LIKE ? ';
$values[] = "%{$tag}%";
}
}
if ($filter->getSearch()) {
$search_values = $filter->getSearch();
foreach ($search_values as $search_value) {
$search .= 'AND ' . $this->sqlconcat('e1.title', $this->isCompressed() ? 'UNCOMPRESS(content_bin)' : 'content') . ' LIKE ? ';
$search .= 'AND ' . $this->sqlconcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? ';
$values[] = "%{$search_value}%";
}
}
}
return array($values,
'SELECT e1.id FROM `' . $this->prefix . 'entry` e1 '
. ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed=f.id ' : '')
return array($values, $search);
}
private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
if (!$state) {
$state = FreshRSS_Entry::STATE_ALL;
}
$where = '';
$joinFeed = false;
$values = array();
switch ($type) {
case 'a':
$where .= 'f.priority > 0 ';
$joinFeed = true;
break;
case 's': //Deprecated: use $state instead
$where .= 'e.is_favorite=1 ';
break;
case 'c':
$where .= 'f.category=? ';
$values[] = intval($id);
$joinFeed = true;
break;
case 'f':
$where .= 'e.id_feed=? ';
$values[] = intval($id);
break;
case 'A':
$where .= '1 ';
break;
default:
throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
}
list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state, $order, $firstId, $date_min);
return array(array_merge($values, $searchValues),
'SELECT e.id FROM `' . $this->prefix . 'entry` e '
. ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' : '')
. 'WHERE ' . $where
. $search
. 'ORDER BY e1.id ' . $order
. 'ORDER BY e.id ' . $order
. ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
}
public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);
$sql = 'SELECT e.id, e.guid, e.title, e.author, '
$sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, '
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
. ', e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags '
. 'FROM `' . $this->prefix . 'entry` e '
. ', e0.link, e0.date, e0.is_read, e0.is_favorite, e0.id_feed, e0.tags '
. 'FROM `' . $this->prefix . 'entry` e0 '
. 'INNER JOIN ('
. $sql
. ') e2 ON e2.id=e.id '
. 'ORDER BY e.id ' . $order;
. ') e2 ON e2.id=e0.id '
. 'ORDER BY e0.id ' . $order;
$stm = $this->bd->prepare($sql);
$stm->execute($values);

View File

@@ -119,7 +119,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
* @param integer $priorityMin
* @return integer affected rows
*/
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) {
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
@@ -132,8 +132,11 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
$sql .= ' AND id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.priority > ' . intval($priorityMin) . ')';
}
$values = array($idMax);
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute($values))) {
list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state);
$stm = $this->bd->prepare($sql . $search);
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
Minz_Log::error('SQL error markReadEntries: ' . $info[2]);
return false;
@@ -156,7 +159,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
* @param integer $idMax fail safe article ID
* @return integer affected rows
*/
public function markReadCat($id, $idMax = 0) {
public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
@@ -167,8 +170,11 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
. 'WHERE is_read=0 AND id <= ? AND '
. 'id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.category=?)';
$values = array($idMax, $id);
$stm = $this->bd->prepare($sql);
if (!($stm && $stm->execute($values))) {
list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state);
$stm = $this->bd->prepare($sql . $search);
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
Minz_Log::error('SQL error markReadCat: ' . $info[2]);
return false;

View File

@@ -11,16 +11,19 @@
<?php echo self::headScript(); ?>
<link rel="shortcut icon" id="favicon" type="image/x-icon" sizes="16x16 64x64" href="<?php echo Minz_Url::display('/favicon.ico'); ?>" />
<link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="<?php echo Minz_Url::display('/themes/icons/favicon-256.png'); ?>" />
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>">
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>">
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('read', true); ?>">
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('unread', true); ?>">
<link rel="apple-touch-icon" href="<?php echo Minz_Url::display('/themes/icons/apple-touch-icon.png'); ?>">
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>" />
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>" />
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('read', true); ?>" />
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('unread', true); ?>" />
<link rel="apple-touch-icon" href="<?php echo Minz_Url::display('/themes/icons/apple-touch-icon.png'); ?>" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="<?php echo FreshRSS_Context::$system_conf->title; ?>">
<meta name="msapplication-TileColor" content="#FFF" />
<?php if (!FreshRSS_Context::$system_conf->allow_referrer) { ?>
<meta name="referrer" content="never" />
<?php
}
flush();
if (isset($this->callbackBeforeContent)) {
call_user_func($this->callbackBeforeContent, $this);
@@ -41,8 +44,6 @@
$url_rss['a'] = 'rss';
?>
<link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display($url_rss); ?>" />
<?php } if (!FreshRSS_Context::$system_conf->allow_referrer) { ?>
<meta name="referrer" content="never" />
<?php } if (FreshRSS_Context::$system_conf->allow_robots) { ?>
<meta name="description" content="<?php echo htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_COMPAT, 'UTF-8'); ?>" />
<?php } else { ?>

View File

@@ -22,7 +22,7 @@
?>
<a id="toggle-<?php echo $state_str; ?>"
class="btn <?php echo $state_enabled ? 'active' : ''; ?>"
aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>"
role="checkbox" aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>"
title="<?php echo _t('index.menu.' . $state_str); ?>"
href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a>
<?php } ?>
@@ -75,6 +75,8 @@
'get' => $get,
'nextGet' => FreshRSS_Context::$next_get,
'idMax' => FreshRSS_Context::$id_max,
'search' => FreshRSS_Context::$search,
'state' => FreshRSS_Context::$state,
)
);
?>

View File

@@ -10,6 +10,8 @@
'get' => FreshRSS_Context::currentGet(),
'nextGet' => FreshRSS_Context::$next_get,
'idMax' => FreshRSS_Context::$id_max,
'search' => FreshRSS_Context::$search,
'state' => FreshRSS_Context::$state,
)
);
?>

View File

@@ -15,34 +15,7 @@ if (!function_exists('json_encode')) {
}
}
if (!function_exists('array_replace_recursive')) { //PHP 5.2
function arr_recurse($array, $array1) {
foreach ($array1 as $key => $value) {
if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
$array[$key] = array(); //create new key in $array, if it is empty or not an array
}
if (is_array($value)) {
$value = arr_recurse($array[$key], $value); // overwrite the value in the base array
}
$array[$key] = $value;
}
return $array;
}
function array_replace_recursive($array, $array1) { //http://php.net/manual/function.array-replace-recursive.php#92574
// handle the arguments, merge one by one
$args = func_get_args();
$array = $args[0];
if (!is_array($array)) {
return $array;
}
for ($i = 1; $i < count($args); $i++) {
if (is_array($args[$i])) {
$array = arr_recurse($array, $args[$i]);
}
}
return $array;
}
}
defined('JSON_UNESCAPED_UNICODE') or define('JSON_UNESCAPED_UNICODE', 256); //PHP 5.3
/**
* Build a directory path by concatenating a list of directory names.
@@ -103,9 +76,7 @@ function checkUrl($url) {
$url = 'http://' . $url;
}
$url = idn_to_puny($url); //PHP bug #53474 IDN
if (filter_var($url, FILTER_VALIDATE_URL) ||
(version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($url, '-') > 0) && //PHP bug #51192
($url === filter_var($url, FILTER_SANITIZE_URL)))) {
if (filter_var($url, FILTER_VALIDATE_URL)) {
return $url;
} else {
return false;
@@ -379,12 +350,10 @@ function httpAuthUser() {
}
function cryptAvailable() {
if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
try {
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
return $hash === @crypt('password', $hash);
} catch (Exception $e) {
}
try {
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
return $hash === @crypt('password', $hash);
} catch (Exception $e) {
}
return false;
}
@@ -416,7 +385,7 @@ function check_install_php() {
$pdo_mysql = extension_loaded('pdo_mysql');
$pdo_sqlite = extension_loaded('pdo_sqlite');
return array(
'php' => version_compare(PHP_VERSION, '5.2.1') >= 0,
'php' => version_compare(PHP_VERSION, '5.3.3') >= 0,
'minz' => file_exists(LIB_PATH . '/Minz'),
'curl' => extension_loaded('curl'),
'pdo' => $pdo_mysql || $pdo_sqlite,

View File

@@ -65,11 +65,13 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
$hubJson['error'] = true; //Do not assume that PubSubHubbub works until the first successul push
}
file_put_contents('./!hub.json', json_encode($hubJson));
header('Connection: close');
exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
}
if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') {
if (empty($hubJson['lease_end']) || $hubJson['lease_end'] < time()) {
header('Connection: close');
exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
} else {
header('HTTP/1.1 422 Unprocessable Entity');

9
p/scripts/jquery.sticky-kit.min.js vendored Normal file
View File

@@ -0,0 +1,9 @@
/*
Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
*/
(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k));
if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("<div />"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q,
u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,c=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),
h.detach()),b={position:"",width:"",top:""},a.css(b).removeClass(t).trigger("sticky_kit:unstick")),B&&(b=f.height(),u+q>b&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}),
a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize",
y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n<K;n++)d=this[n],J(b(d));return this}}).call(this);

View File

@@ -493,6 +493,27 @@ function init_posts() {
}
}
function inject_script(name) {
var script = document.createElement('script');
script.async = 'async';
script.defer = 'defer';
script.src = '../scripts/' + name;
document.head.appendChild(script);
}
function init_sticky_column() {
if (!window.$ || !window.$.fn.stick_in_parent) {
if (window.console) {
console.log('FreshRSS waiting for Sticky-kit…');
}
window.setTimeout(init_sticky_column, 200);
return;
}
if ($('.toggle_aside').css('display') === 'none') {
$('#aside_feed .tree').stick_in_parent({parent:'#aside_feed'});
}
}
function init_column_categories() {
if (context.current_view !== 'normal') {
return;
@@ -508,7 +529,7 @@ function init_column_categories() {
this.alt = '▽';
}
});
$(this).parent().next(".tree-folder-items").slideToggle();
$(this).parent().next(".tree-folder-items").slideToggle(300 , function() { $(document.body).trigger("sticky_kit:recalc"); });
return false;
});
$('#aside_feed').on('click', '.tree-folder-items .item .dropdown-toggle', function () {
@@ -519,6 +540,8 @@ function init_column_categories() {
$(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template);
}
});
init_sticky_column();
}
function init_shortcuts() {
@@ -526,7 +549,7 @@ function init_shortcuts() {
if (window.console) {
console.log('FreshRSS waiting for sortcut.js…');
}
window.setTimeout(init_shortcuts, 50);
window.setTimeout(init_shortcuts, 200);
return;
}
// Touches de manipulation
@@ -970,12 +993,12 @@ function load_more_posts() {
box_load_more.children('.flux:last').after($('#stream', data).children('.flux, .day'));
$('.pagination').replaceWith($('.pagination', data));
if (context.display_order === 'ASC') {
$('#nav_menu_read_all > .read_all').attr(
$('#nav_menu_read_all .read_all').attr(
'formaction', $('#bigMarkAsRead').attr('formaction')
);
} else {
$('#bigMarkAsRead').attr(
'formaction', $('#nav_menu_read_all > .read_all').attr('formaction')
'formaction', $('#nav_menu_read_all .read_all').attr('formaction')
);
}
@@ -990,6 +1013,7 @@ function load_more_posts() {
$('#load_more').removeClass('loading');
load_more = false;
$(document.body).trigger('sticky_kit:recalc');
});
}
@@ -1310,7 +1334,7 @@ function init_normal() {
if (window.console) {
console.log('FreshRSS waiting for content…');
}
window.setTimeout(init_normal, 50);
window.setTimeout(init_normal, 100);
return;
}
init_column_categories();
@@ -1325,11 +1349,12 @@ function init_beforeDOM() {
if (window.console) {
console.log('FreshRSS waiting for jQuery…');
}
window.setTimeout(init_beforeDOM, 50);
window.setTimeout(init_beforeDOM, 100);
return;
}
init_confirm_action();
if (['normal', 'reader', 'global'].indexOf(context.current_view) >= 0) {
inject_script('jquery.sticky-kit.min.js');
init_normal();
}
}
@@ -1339,7 +1364,7 @@ function init_afterDOM() {
if (window.console) {
console.log('FreshRSS waiting again for jQuery…');
}
window.setTimeout(init_afterDOM, 50);
window.setTimeout(init_afterDOM, 100);
return;
}
init_notifications();

View File

@@ -753,7 +753,7 @@ a.btn {
border: 1px solid #CCC;
box-shadow: 0px 1px #FFF;
}
#panel > .nav_menu > #nav_menu_read_all > .dropdown > .btn.dropdown-toggle{
#panel > .nav_menu > #nav_menu_read_all .dropdown > .btn.dropdown-toggle {
border-radius: 0 4px 4px 0;
border:none;
border-left: solid 1px #ccc;

View File

@@ -748,7 +748,7 @@ a.btn {
border: 1px solid #CCC;
box-shadow: 0px 1px #FFF;
}
#panel > .nav_menu > #nav_menu_read_all > .dropdown > .btn.dropdown-toggle{
#panel > .nav_menu > #nav_menu_read_all .dropdown > .btn.dropdown-toggle {
border-radius: 0 4px 4px 0;
border:none;
border-left: solid 1px #ccc;