mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-20 09:30:36 +00:00
[ci] Add Travis (#1619)
* [ci] Add Travis * Exclude some libs * Semi-auto whitespace fixes * line length in SQLite * Exclude tests from line length * Feed.php line length * Feed.php: get rid of unnecessary concat * Feed.php: line length * bootstrap.php: no newline at end of file * Allow concatenating across multiple lines * Add Travis badge * do-install line length * update-or-create-user line length * cli/create-user line length * tests/app/Models/SearchTest.php fix indentation * tests/app/Models/UserQueryTest.php fix indentation * tests/app/Models/CategoryTest.php fix indentation * [fix] PHP 5.3 on precise * cli/do-install no spaces * cli/list-users line length * cli/reconfigure line length * empty catch statements * api/index line length nonsense * spaces before semicolon * app/Models/EntryDAO bunch of indentation * extra blank lines * spaces before comma in function call * testing tabwidth * increase to 10 * comment out tabwidth line * try older phpcs version 3.0.0RC4 * line length exception for app/install.php * proper spaces * stray spaces in i18n * Minz/ModelPdo line length * Minz whitespace * greader line length * greader elseif placement * app/Models/Feed.php spacing in function argument * ignore php 5.3 * app/Models/ConfigurationSetter.php stray whitespace * EntryDAOSQLite line length * I vote for higher max line length =P * ignore SQL * remove classname complaint * line length/more legible SQL * ignore line length nonsense * greader line length * feedController issues * uppercase TRUE, FALSE, NULL * revert * importExportController lowercase null * Share.php default value not necessary because ! is_array () a few lines down * CategoryDAO constants should be UPPERCASE * EntryDAO reduce line length * contentious autofix * Allow failures on all versions of PHP except 7.1 because reasons
This commit is contained in:
committed by
Alexandre Alapetite
parent
3ce2b4d1a8
commit
4e174ed9dd
+34
@@ -0,0 +1,34 @@
|
||||
language: php
|
||||
php:
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- hhvm
|
||||
- nightly
|
||||
|
||||
install:
|
||||
# newest version without https://github.com/squizlabs/PHP_CodeSniffer/pull/1404
|
||||
- pear install PHP_CodeSniffer-3.0.0RC4
|
||||
|
||||
script:
|
||||
- phpenv rehash
|
||||
- phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p
|
||||
|
||||
env: # important! otherwise no job will be allowed to fail
|
||||
matrix:
|
||||
# PHP 5.3 only runs on Ubuntu 12.04 (precise), not 14.04 (trusty)
|
||||
include:
|
||||
- php: "5.3"
|
||||
dist: precise
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: "5.3"
|
||||
dist: precise
|
||||
- php: "5.4"
|
||||
- php: "5.5"
|
||||
- php: "5.6"
|
||||
- php: "7.0"
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
@@ -1,3 +1,5 @@
|
||||
[![Build Status][travis-badge]][travis-link]
|
||||
|
||||
* [Version française](README.fr.md)
|
||||
|
||||
# FreshRSS
|
||||
@@ -182,3 +184,6 @@ Any client supporting a Google Reader-like API. Selection:
|
||||
* [EasyRSS](https://github.com/Alkarex/EasyRSS) (Open source, F-Droid)
|
||||
* Linux
|
||||
* [FeedReader 2.0+](https://jangernert.github.io/FeedReader/) (Open source)
|
||||
|
||||
[travis-badge]:https://travis-ci.org/FreshRSS/FreshRSS.svg?branch=master
|
||||
[travis-link]:https://travis-ci.org/FreshRSS/FreshRSS
|
||||
|
||||
@@ -127,11 +127,11 @@ class FreshRSS_category_Controller extends Minz_ActionController {
|
||||
Minz_Request::bad(_t('feedback.sub.category.no_id'), $url_redirect);
|
||||
}
|
||||
|
||||
if ($id === FreshRSS_CategoryDAO::defaultCategoryId) {
|
||||
if ($id === FreshRSS_CategoryDAO::DEFAULTCATEGORYID) {
|
||||
Minz_Request::bad(_t('feedback.sub.category.not_delete_default'), $url_redirect);
|
||||
}
|
||||
|
||||
if ($feedDAO->changeCategory($id, FreshRSS_CategoryDAO::defaultCategoryId) === false) {
|
||||
if ($feedDAO->changeCategory($id, FreshRSS_CategoryDAO::DEFAULTCATEGORYID) === false) {
|
||||
Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
if ($cat == null) {
|
||||
$catDAO->checkDefault();
|
||||
}
|
||||
$cat_id = $cat == null ? FreshRSS_CategoryDAO::defaultCategoryId : $cat->id();
|
||||
$cat_id = $cat == null ? FreshRSS_CategoryDAO::DEFAULTCATEGORYID : $cat->id();
|
||||
|
||||
$feed = new FreshRSS_Feed($url); //Throws FreshRSS_BadUrl_Exception
|
||||
$feed->_httpAuth($http_auth);
|
||||
@@ -420,8 +420,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
$feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently
|
||||
} elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently
|
||||
Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url());
|
||||
$feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
|
||||
}
|
||||
@@ -537,7 +536,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
}
|
||||
if ($cat_id <= 1) {
|
||||
$catDAO->checkDefault();
|
||||
$cat_id = FreshRSS_CategoryDAO::defaultCategoryId;
|
||||
$cat_id = FreshRSS_CategoryDAO::DEFAULTCATEGORYID;
|
||||
}
|
||||
|
||||
$feedDAO = FreshRSS_Factory::createFeedDao();
|
||||
@@ -566,6 +565,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
|
||||
if (self::moveFeed($feed_id, $cat_id)) {
|
||||
// TODO: return something useful
|
||||
// Log a notice to prevent "Empty IF statement" warning in PHP_CodeSniffer
|
||||
Minz_Log::notice('Moved feed `' . $feed_id . '` ' .
|
||||
'in the category `' . $cat_id . '`');;
|
||||
} else {
|
||||
Minz_Log::warning('Cannot move feed `' . $feed_id . '` ' .
|
||||
'in the category `' . $cat_id . '`');
|
||||
|
||||
@@ -152,8 +152,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
|
||||
// And finally, we get import status and redirect to the home page
|
||||
Minz_Session::_param('actualize_feeds', true);
|
||||
$content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') :
|
||||
_t('feedback.import_export.feeds_imported');
|
||||
$content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') : _t('feedback.import_export.feeds_imported');
|
||||
Minz_Request::good($content_notif);
|
||||
}
|
||||
|
||||
@@ -439,8 +438,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
|
||||
$feed_id = $article_to_feed[$item['id']];
|
||||
$author = isset($item['author']) ? $item['author'] : '';
|
||||
$key_content = ($google_compliant && !isset($item['content'])) ?
|
||||
'summary' : 'content';
|
||||
$key_content = ($google_compliant && !isset($item['content'])) ? 'summary' : 'content';
|
||||
$tags = $item['categories'];
|
||||
if ($google_compliant) {
|
||||
// Remove tags containing "/state/com.google" which are useless.
|
||||
@@ -501,7 +499,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
try {
|
||||
// Create a Feed object and add it in database.
|
||||
$feed = new FreshRSS_Feed($url);
|
||||
$feed->_category(FreshRSS_CategoryDAO::defaultCategoryId);
|
||||
$feed->_category(FreshRSS_CategoryDAO::DEFAULTCATEGORYID);
|
||||
$feed->_name($name);
|
||||
$feed->_website($website);
|
||||
|
||||
@@ -640,7 +638,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
|
||||
* @param FreshRSS_Feed $feed feed of which we want to get entries.
|
||||
* @return string the JSON file content.
|
||||
*/
|
||||
private function generateEntries($type, $feed = NULL, $maxFeedEntries = 50) {
|
||||
private function generateEntries($type, $feed = null, $maxFeedEntries = 50) {
|
||||
$this->view->categories = $this->catDAO->listCategories();
|
||||
|
||||
if ($type == 'starred') {
|
||||
|
||||
@@ -46,9 +46,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
|
||||
}
|
||||
|
||||
$first_entry = $nb_entries > 0 ? $entries[0] : null;
|
||||
FreshRSS_Context::$id_max = $first_entry === null ?
|
||||
(time() - 1) . '000000' :
|
||||
$first_entry->id();
|
||||
FreshRSS_Context::$id_max = $first_entry === null ? (time() - 1) . '000000' : $first_entry->id();
|
||||
if (FreshRSS_Context::$order === 'ASC') {
|
||||
// In this case we do not know but we guess id_max
|
||||
$id_max = (time() - 1) . '000000';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class FreshRSS_Zip_Exception extends Exception {
|
||||
private $zipErrorCode = 0;
|
||||
|
||||
|
||||
public function __construct($zipErrorCode) {
|
||||
parent::__construct('ZIP error! ' . $url, 2141);
|
||||
$this->zipErrorCode = $zipErrorCode;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
const defaultCategoryId = 1;
|
||||
const DEFAULTCATEGORYID = 1;
|
||||
|
||||
public function addCategory($valuesTmp) {
|
||||
$sql = 'INSERT INTO `' . $this->prefix . 'category`(name) VALUES(?)';
|
||||
@@ -53,7 +53,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
|
||||
}
|
||||
|
||||
public function deleteCategory($id) {
|
||||
if ($id <= self::defaultCategoryId) {
|
||||
if ($id <= self::DEFAULTCATEGORYID) {
|
||||
return false;
|
||||
}
|
||||
$sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?';
|
||||
@@ -123,7 +123,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
|
||||
}
|
||||
|
||||
public function getDefault() {
|
||||
$sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=' . self::defaultCategoryId;
|
||||
$sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=' . self::DEFAULTCATEGORYID;
|
||||
$stm = $this->bd->prepare($sql);
|
||||
|
||||
$stm->execute();
|
||||
@@ -137,11 +137,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable
|
||||
}
|
||||
}
|
||||
public function checkDefault() {
|
||||
$def_cat = $this->searchById(self::defaultCategoryId);
|
||||
$def_cat = $this->searchById(self::DEFAULTCATEGORYID);
|
||||
|
||||
if ($def_cat == null) {
|
||||
$cat = new FreshRSS_Category(_t('gen.short.default_category'));
|
||||
$cat->_id(self::defaultCategoryId);
|
||||
$cat->_id(self::DEFAULTCATEGORYID);
|
||||
|
||||
$values = array(
|
||||
'id' => $cat->id(),
|
||||
|
||||
@@ -56,8 +56,7 @@ class FreshRSS_ConfigurationSetter {
|
||||
switch ($value) {
|
||||
case 'all':
|
||||
$data['default_view'] = $value;
|
||||
$data['default_state'] = (FreshRSS_Entry::STATE_READ +
|
||||
FreshRSS_Entry::STATE_NOT_READ);
|
||||
$data['default_state'] = (FreshRSS_Entry::STATE_READ + FreshRSS_Entry::STATE_NOT_READ);
|
||||
break;
|
||||
case 'adaptive':
|
||||
case 'unread':
|
||||
@@ -163,7 +162,7 @@ class FreshRSS_ConfigurationSetter {
|
||||
if (!in_array($value, array('global', 'normal', 'reader'))) {
|
||||
$value = 'normal';
|
||||
}
|
||||
$data['view_mode'] = $value;
|
||||
$data['view_mode'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,7 +325,7 @@ class FreshRSS_ConfigurationSetter {
|
||||
if (!in_array($value, array('silent', 'development', 'production'))) {
|
||||
$value = 'production';
|
||||
}
|
||||
$data['environment'] = $value;
|
||||
$data['environment'] = $value;
|
||||
}
|
||||
|
||||
private function _limits(&$data, $values) {
|
||||
@@ -361,8 +360,7 @@ class FreshRSS_ConfigurationSetter {
|
||||
|
||||
$value = intval($value);
|
||||
$limits = $limits_keys[$key];
|
||||
if (
|
||||
(!isset($limits['min']) || $value >= $limits['min']) &&
|
||||
if ((!isset($limits['min']) || $value >= $limits['min']) &&
|
||||
(!isset($limits['max']) || $value <= $limits['max'])
|
||||
) {
|
||||
$data['limits'][$key] = $value;
|
||||
|
||||
@@ -250,9 +250,7 @@ class FreshRSS_Context {
|
||||
}
|
||||
|
||||
// If no feed have been found, next_get is the current category.
|
||||
self::$next_get = empty($another_unread_id) ?
|
||||
'c_' . self::$current_get['category'] :
|
||||
'f_' . $another_unread_id;
|
||||
self::$next_get = empty($another_unread_id) ? 'c_' . self::$current_get['category'] : 'f_' . $another_unread_id;
|
||||
break;
|
||||
case 'c':
|
||||
// We search the next category with at least one unread article.
|
||||
@@ -275,9 +273,7 @@ class FreshRSS_Context {
|
||||
}
|
||||
|
||||
// No unread category? The main stream will be our destination!
|
||||
self::$next_get = empty($another_unread_id) ?
|
||||
'a' :
|
||||
'c_' . $another_unread_id;
|
||||
self::$next_get = empty($another_unread_id) ? 'a' : 'c_' . $another_unread_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm->execute();
|
||||
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
$tables = array(
|
||||
$this->prefix . 'category' => false,
|
||||
$this->prefix . 'feed' => false,
|
||||
|
||||
@@ -12,7 +12,7 @@ class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAO {
|
||||
$values = array($dbowner);
|
||||
$stm->execute($values);
|
||||
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
$tables = array(
|
||||
$this->prefix . 'category' => false,
|
||||
$this->prefix . 'feed' => false,
|
||||
|
||||
@@ -9,7 +9,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm->execute();
|
||||
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
$tables = array(
|
||||
'category' => false,
|
||||
'feed' => false,
|
||||
|
||||
@@ -189,6 +189,7 @@ class FreshRSS_Entry extends Minz_Model {
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
// rien à faire, on garde l'ancien contenu(requête a échoué)
|
||||
Minz_Log::warning($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+52
-48
@@ -146,13 +146,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
public function addEntry($valuesTmp) {
|
||||
if ($this->addEntryPrepared == null) {
|
||||
$sql = 'INSERT INTO `' . $this->prefix . 'entrytmp` (id, guid, title, author, '
|
||||
. ($this->isCompressed() ? 'content_bin' : 'content')
|
||||
. ', link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) '
|
||||
. 'VALUES(:id, :guid, :title, :author, '
|
||||
. ($this->isCompressed() ? 'COMPRESS(:content)' : ':content')
|
||||
. ', :link, :date, :last_seen, '
|
||||
. $this->sqlHexDecode(':hash')
|
||||
. ', :is_read, :is_favorite, :id_feed, :tags)';
|
||||
. ($this->isCompressed() ? 'content_bin' : 'content')
|
||||
. ', link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) '
|
||||
. 'VALUES(:id, :guid, :title, :author, '
|
||||
. ($this->isCompressed() ? 'COMPRESS(:content)' : ':content')
|
||||
. ', :link, :date, :last_seen, '
|
||||
. $this->sqlHexDecode(':hash')
|
||||
. ', :is_read, :is_favorite, :id_feed, :tags)';
|
||||
$this->addEntryPrepared = $this->bd->prepare($sql);
|
||||
}
|
||||
if ($this->addEntryPrepared) {
|
||||
@@ -203,8 +203,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
public function commitNewEntries() {
|
||||
$sql = 'SET @rank=(SELECT MAX(id) - COUNT(*) FROM `' . $this->prefix . 'entrytmp`); ' . //MySQL-specific
|
||||
'INSERT IGNORE INTO `' . $this->prefix . 'entry` (id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) ' .
|
||||
'SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `' . $this->prefix . 'entrytmp` ORDER BY date; ' .
|
||||
'INSERT IGNORE INTO `' . $this->prefix . 'entry`
|
||||
(
|
||||
id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags
|
||||
) ' .
|
||||
'SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags
|
||||
FROM `' . $this->prefix . 'entrytmp`
|
||||
ORDER BY date; ' .
|
||||
'DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= @rank;';
|
||||
$hadTransaction = $this->bd->inTransaction();
|
||||
if (!$hadTransaction) {
|
||||
@@ -226,13 +231,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
if ($this->updateEntryPrepared === null) {
|
||||
$sql = 'UPDATE `' . $this->prefix . 'entry` '
|
||||
. 'SET title=:title, author=:author, '
|
||||
. ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content')
|
||||
. ', link=:link, date=:date, `lastSeen`=:last_seen, '
|
||||
. 'hash=' . $this->sqlHexDecode(':hash')
|
||||
. ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ')
|
||||
. 'tags=:tags '
|
||||
. 'WHERE id_feed=:id_feed AND guid=:guid';
|
||||
. 'SET title=:title, author=:author, '
|
||||
. ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content')
|
||||
. ', link=:link, date=:date, `lastSeen`=:last_seen, '
|
||||
. 'hash=' . $this->sqlHexDecode(':hash')
|
||||
. ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ')
|
||||
. 'tags=:tags '
|
||||
. 'WHERE id_feed=:id_feed AND guid=:guid';
|
||||
$this->updateEntryPrepared = $this->bd->prepare($sql);
|
||||
}
|
||||
|
||||
@@ -295,8 +300,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
}
|
||||
FreshRSS_UserDAO::touch();
|
||||
$sql = 'UPDATE `' . $this->prefix . 'entry` '
|
||||
. 'SET is_favorite=? '
|
||||
. 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
|
||||
. 'SET is_favorite=? '
|
||||
. 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
|
||||
$values = array($is_favorite ? 1 : 0);
|
||||
$values = array_merge($values, $ids);
|
||||
$stm = $this->bd->prepare($sql);
|
||||
@@ -322,14 +327,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
*/
|
||||
protected function updateCacheUnreads($catId = false, $feedId = false) {
|
||||
$sql = 'UPDATE `' . $this->prefix . 'feed` f '
|
||||
. 'LEFT OUTER JOIN ('
|
||||
. 'SELECT e.id_feed, '
|
||||
. 'COUNT(*) AS nbUnreads '
|
||||
. 'FROM `' . $this->prefix . 'entry` e '
|
||||
. 'WHERE e.is_read=0 '
|
||||
. 'GROUP BY e.id_feed'
|
||||
. ') x ON x.id_feed=f.id '
|
||||
. 'SET f.`cache_nbUnreads`=COALESCE(x.nbUnreads, 0)';
|
||||
. 'LEFT OUTER JOIN ('
|
||||
. 'SELECT e.id_feed, '
|
||||
. 'COUNT(*) AS nbUnreads '
|
||||
. 'FROM `' . $this->prefix . 'entry` e '
|
||||
. 'WHERE e.is_read=0 '
|
||||
. 'GROUP BY e.id_feed'
|
||||
. ') x ON x.id_feed=f.id '
|
||||
. 'SET f.`cache_nbUnreads`=COALESCE(x.nbUnreads, 0)';
|
||||
$hasWhere = false;
|
||||
$values = array();
|
||||
if ($feedId !== false) {
|
||||
@@ -558,9 +563,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
public function searchByGuid($id_feed, $guid) {
|
||||
// un guid est unique pour un flux donné
|
||||
$sql = 'SELECT id, guid, title, author, '
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', link, date, is_read, is_favorite, id_feed, tags '
|
||||
. 'FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?';
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', link, date, is_read, is_favorite, id_feed, tags '
|
||||
. 'FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?';
|
||||
$stm = $this->bd->prepare($sql);
|
||||
|
||||
$values = array(
|
||||
@@ -576,9 +581,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
public function searchById($id) {
|
||||
$sql = 'SELECT id, guid, title, author, '
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', link, date, is_read, is_favorite, id_feed, tags '
|
||||
. 'FROM `' . $this->prefix . 'entry` WHERE id=?';
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', link, date, is_read, is_favorite, id_feed, tags '
|
||||
. 'FROM `' . $this->prefix . 'entry` WHERE id=?';
|
||||
$stm = $this->bd->prepare($sql);
|
||||
|
||||
$values = array($id);
|
||||
@@ -600,16 +605,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
if (!($state & FreshRSS_Entry::STATE_READ)) {
|
||||
$search .= 'AND ' . $alias . 'is_read=0 ';
|
||||
}
|
||||
}
|
||||
elseif ($state & FreshRSS_Entry::STATE_READ) {
|
||||
} elseif ($state & FreshRSS_Entry::STATE_READ) {
|
||||
$search .= 'AND ' . $alias . 'is_read=1 ';
|
||||
}
|
||||
if ($state & FreshRSS_Entry::STATE_FAVORITE) {
|
||||
if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) {
|
||||
$search .= 'AND ' . $alias . 'is_favorite=1 ';
|
||||
}
|
||||
}
|
||||
elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
|
||||
} elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
|
||||
$search .= 'AND ' . $alias . 'is_favorite=0 ';
|
||||
}
|
||||
|
||||
@@ -621,7 +624,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!');
|
||||
}
|
||||
/*if ($firstId === '' && parent::$sharedDbType === 'mysql') {
|
||||
$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
|
||||
//MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev
|
||||
$firstId = $order === 'DESC' ? '9000000000'. '000000' : '0';
|
||||
}*/
|
||||
if ($firstId !== '') {
|
||||
$search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
|
||||
@@ -759,13 +763,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);
|
||||
|
||||
$sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, '
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', 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=e0.id '
|
||||
. 'ORDER BY e0.id ' . $order;
|
||||
. ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
|
||||
. ', 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=e0.id '
|
||||
. 'ORDER BY e0.id ' . $order;
|
||||
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm->execute($values);
|
||||
@@ -839,7 +843,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
public function countUnreadRead() {
|
||||
$sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE priority > 0'
|
||||
. ' UNION SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE priority > 0 AND is_read=0';
|
||||
. ' UNION SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE priority > 0 AND is_read=0';
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm->execute();
|
||||
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
@@ -870,9 +874,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
|
||||
public function countUnreadReadFavorites() {
|
||||
$sql = 'SELECT c FROM ('
|
||||
. 'SELECT COUNT(id) AS c, 1 as o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 '
|
||||
. 'UNION SELECT COUNT(id) AS c, 2 AS o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read=0'
|
||||
. ') u ORDER BY o';
|
||||
. 'SELECT COUNT(id) AS c, 1 as o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 '
|
||||
. 'UNION SELECT COUNT(id) AS c, 2 AS o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read=0'
|
||||
. ') u ORDER BY o';
|
||||
$stm = $this->bd->prepare($sql);
|
||||
$stm->execute();
|
||||
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
|
||||
@@ -11,7 +11,7 @@ class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {
|
||||
}
|
||||
|
||||
protected function autoUpdateDb($errorInfo) {
|
||||
if (isset($errorInfo[0])) {
|
||||
if (isset($errorInfo[0])) {
|
||||
if ($errorInfo[0] === '42P01' && stripos($errorInfo[2], 'entrytmp') !== false) { //undefined_table
|
||||
return $this->createEntryTempTable();
|
||||
}
|
||||
|
||||
@@ -27,11 +27,58 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
|
||||
|
||||
public function commitNewEntries() {
|
||||
$sql = '
|
||||
CREATE TEMP TABLE `tmp` AS SELECT id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `' . $this->prefix . 'entrytmp` ORDER BY date;
|
||||
INSERT OR IGNORE INTO `' . $this->prefix . 'entry` (id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags)
|
||||
SELECT rowid + (SELECT MAX(id) - COUNT(*) FROM `tmp`) AS id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `tmp` ORDER BY date;
|
||||
DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= (SELECT MAX(id) FROM `tmp`);
|
||||
DROP TABLE `tmp`;';
|
||||
CREATE TEMP TABLE `tmp` AS
|
||||
SELECT
|
||||
id,
|
||||
guid,
|
||||
title,
|
||||
author,
|
||||
content,
|
||||
link,
|
||||
date,
|
||||
`lastSeen`,
|
||||
hash, is_read,
|
||||
is_favorite,
|
||||
id_feed,
|
||||
tags
|
||||
FROM `' . $this->prefix . 'entrytmp`
|
||||
ORDER BY date;
|
||||
INSERT OR IGNORE INTO `' . $this->prefix . 'entry`
|
||||
(
|
||||
id,
|
||||
guid,
|
||||
title,
|
||||
author,
|
||||
content,
|
||||
link,
|
||||
date,
|
||||
`lastSeen`,
|
||||
hash,
|
||||
is_read,
|
||||
is_favorite,
|
||||
id_feed,
|
||||
tags
|
||||
)
|
||||
SELECT rowid + (SELECT MAX(id) - COUNT(*) FROM `tmp`) AS
|
||||
id,
|
||||
guid,
|
||||
title,
|
||||
author,
|
||||
content,
|
||||
link,
|
||||
date,
|
||||
`lastSeen`,
|
||||
hash,
|
||||
is_read,
|
||||
is_favorite,
|
||||
id_feed,
|
||||
tags
|
||||
FROM `tmp`
|
||||
ORDER BY date;
|
||||
DELETE FROM `' . $this->prefix . 'entrytmp`
|
||||
WHERE id <= (SELECT MAX(id)
|
||||
FROM `tmp`);
|
||||
DROP TABLE `tmp`;';
|
||||
$hadTransaction = $this->bd->inTransaction();
|
||||
if (!$hadTransaction) {
|
||||
$this->bd->beginTransaction();
|
||||
|
||||
+16
-10
@@ -22,7 +22,7 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
private $hubUrl = '';
|
||||
private $selfUrl = '';
|
||||
|
||||
public function __construct($url, $validate=true) {
|
||||
public function __construct($url, $validate = true) {
|
||||
if ($validate) {
|
||||
$this->_url($url);
|
||||
} else {
|
||||
@@ -165,7 +165,7 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
public function _id($value) {
|
||||
$this->id = $value;
|
||||
}
|
||||
public function _url($value, $validate=true) {
|
||||
public function _url($value, $validate = true) {
|
||||
$this->hash = null;
|
||||
if ($validate) {
|
||||
$value = checkUrl($value);
|
||||
@@ -182,7 +182,7 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
public function _name($value) {
|
||||
$this->name = $value === null ? '' : $value;
|
||||
}
|
||||
public function _website($value, $validate=true) {
|
||||
public function _website($value, $validate = true) {
|
||||
if ($validate) {
|
||||
$value = checkUrl($value);
|
||||
}
|
||||
@@ -254,7 +254,9 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
|
||||
if ((!$mtime) || $feed->error()) {
|
||||
$errorMessage = $feed->error();
|
||||
throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Unknown error for feed' : $errorMessage) . ' [' . $url . ']');
|
||||
throw new FreshRSS_Feed_Exception(
|
||||
($errorMessage == '' ? 'Unknown error for feed' : $errorMessage) . ' [' . $url . ']'
|
||||
);
|
||||
}
|
||||
|
||||
$links = $feed->get_links('self');
|
||||
@@ -324,9 +326,11 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
if (strpos($mime, 'image/') === 0) {
|
||||
$content .= '<p class="enclosure"><img src="' . $elink . '" alt="" /></p>';
|
||||
} elseif (strpos($mime, 'audio/') === 0) {
|
||||
$content .= '<p class="enclosure"><audio preload="none" src="' . $elink . '" controls="controls"></audio> <a download="" href="' . $elink . '">💾</a></p>';
|
||||
$content .= '<p class="enclosure"><audio preload="none" src="' . $elink
|
||||
. '" controls="controls"></audio> <a download="" href="' . $elink . '">💾</a></p>';
|
||||
} elseif (strpos($mime, 'video/') === 0) {
|
||||
$content .= '<p class="enclosure"><video preload="none" src="' . $elink . '" controls="controls"></video> <a download="" href="' . $elink . '">💾</a></p>';
|
||||
$content .= '<p class="enclosure"><video preload="none" src="' . $elink
|
||||
. '" controls="controls"></video> <a download="" href="' . $elink . '">💾</a></p>';
|
||||
} elseif (strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) {
|
||||
$content .= '<p class="enclosure"><a download="" href="' . $elink . '">💾</a></p>';
|
||||
} else {
|
||||
@@ -481,10 +485,12 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_USERAGENT => 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')',
|
||||
CURLOPT_POSTFIELDS => 'hub.verify=sync'
|
||||
. '&hub.mode=' . ($state ? 'subscribe' : 'unsubscribe')
|
||||
. '&hub.topic=' . urlencode($url)
|
||||
. '&hub.callback=' . urlencode($callbackUrl)
|
||||
CURLOPT_POSTFIELDS => http_build_query(
|
||||
'hub.verify' => 'sync',
|
||||
'hub.mode' => ($state ? 'subscribe' : 'unsubscribe'),
|
||||
'hub.topic' => urlencode($url),
|
||||
'hub.callback' => urlencode($callbackUrl),
|
||||
)
|
||||
)
|
||||
);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
+18
-2
@@ -2,7 +2,23 @@
|
||||
|
||||
class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
public function addFeed($valuesTmp) {
|
||||
$sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, `lastUpdate`, priority, `httpAuth`, error, keep_history, ttl) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)';
|
||||
$sql = '
|
||||
INSERT INTO `' . $this->prefix . 'feed`
|
||||
(
|
||||
url,
|
||||
category,
|
||||
name,
|
||||
website,
|
||||
description,
|
||||
`lastUpdate`,
|
||||
priority,
|
||||
`httpAuth`,
|
||||
error,
|
||||
keep_history,
|
||||
ttl
|
||||
)
|
||||
VALUES
|
||||
(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)';
|
||||
$stm = $this->bd->prepare($sql);
|
||||
|
||||
$valuesTmp['url'] = safe_ascii($valuesTmp['url']);
|
||||
@@ -380,7 +396,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
if ($catID === null) {
|
||||
$category = isset($dao['category']) ? $dao['category'] : 0;
|
||||
} else {
|
||||
$category = $catID ;
|
||||
$category = $catID;
|
||||
}
|
||||
|
||||
$myFeed = new FreshRSS_Feed(isset($dao['url']) ? $dao['url'] : '', false);
|
||||
|
||||
@@ -87,7 +87,7 @@ class FreshRSS_Share {
|
||||
* decentralized ones.
|
||||
* @param $help_url is an optional url to give help on this option.
|
||||
*/
|
||||
private function __construct($type, $url_transform, $transform = array(),
|
||||
private function __construct($type, $url_transform, $transform,
|
||||
$form_type, $help_url = '') {
|
||||
$this->type = $type;
|
||||
$this->name = _t('gen.share.' . $type);
|
||||
|
||||
@@ -25,7 +25,7 @@ class FreshRSS_Themes extends Minz_Model {
|
||||
}
|
||||
|
||||
public static function get_infos($theme_id) {
|
||||
$theme_dir = PUBLIC_PATH . self::$themesUrl . $theme_id ;
|
||||
$theme_dir = PUBLIC_PATH . self::$themesUrl . $theme_id;
|
||||
if (is_dir($theme_dir)) {
|
||||
$json_filename = $theme_dir . '/metadata.json';
|
||||
if (file_exists($json_filename)) {
|
||||
@@ -109,10 +109,8 @@ class FreshRSS_Themes extends Minz_Model {
|
||||
}
|
||||
|
||||
$url = $name . '.svg';
|
||||
$url = isset(self::$themeIcons[$url]) ? (self::$themeIconsUrl . $url) :
|
||||
(self::$defaultIconsUrl . $url);
|
||||
$url = isset(self::$themeIcons[$url]) ? (self::$themeIconsUrl . $url) : (self::$defaultIconsUrl . $url);
|
||||
|
||||
return $urlOnly ? Minz_Url::display($url) :
|
||||
'<img class="icon" src="' . Minz_Url::display($url) . '" alt="' . $alts[$name] . '" />';
|
||||
return $urlOnly ? Minz_Url::display($url) : '<img class="icon" src="' . Minz_Url::display($url) . '" alt="' . $alts[$name] . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,17 +83,17 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
|
||||
}
|
||||
|
||||
public static function exist($username) {
|
||||
return is_dir(join_path(DATA_PATH , 'users', $username));
|
||||
return is_dir(join_path(DATA_PATH, 'users', $username));
|
||||
}
|
||||
|
||||
public static function touch($username = '') {
|
||||
if (!FreshRSS_user_Controller::checkUsername($username)) {
|
||||
$username = Minz_Session::param('currentUser', '_');
|
||||
}
|
||||
return touch(join_path(DATA_PATH , 'users', $username, 'config.php'));
|
||||
return touch(join_path(DATA_PATH, 'users', $username, 'config.php'));
|
||||
}
|
||||
|
||||
public static function mtime($username) {
|
||||
return @filemtime(join_path(DATA_PATH , 'users', $username, 'config.php'));
|
||||
return @filemtime(join_path(DATA_PATH, 'users', $username, 'config.php'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,42 @@ $SQL_CREATE_TABLE_ENTRYTMP = array(
|
||||
|
||||
global $SQL_INSERT_FEEDS;
|
||||
$SQL_INSERT_FEEDS = array(
|
||||
'INSERT OR IGNORE INTO `feed` (url, category, name, website, description, ttl) VALUES("http://freshrss.org/feeds/all.atom.xml", 1, "FreshRSS.org", "http://freshrss.org/", "FreshRSS, a free, self-hostable aggregator…", 86400);',
|
||||
'INSERT OR IGNORE INTO `feed` (url, category, name, website, description, ttl) VALUES("https://github.com/FreshRSS/FreshRSS/releases.atom", 1, "FreshRSS releases", "https://github.com/FreshRSS/FreshRSS/", "FreshRSS releases @ GitHub", 86400);',
|
||||
'INSERT OR IGNORE INTO `feed`
|
||||
(
|
||||
url,
|
||||
category,
|
||||
name,
|
||||
website,
|
||||
description,
|
||||
ttl
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
"http://freshrss.org/feeds/all.atom.xml",
|
||||
1,
|
||||
"FreshRSS.org",
|
||||
"http://freshrss.org/",
|
||||
"FreshRSS, a free, self-hostable aggregator…",
|
||||
86400
|
||||
);',
|
||||
'INSERT OR IGNORE INTO `feed`
|
||||
(
|
||||
url,
|
||||
category,
|
||||
name,
|
||||
website,
|
||||
description,
|
||||
ttl
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
"https://github.com/FreshRSS/FreshRSS/releases.atom",
|
||||
1,
|
||||
"FreshRSS releases",
|
||||
"https://github.com/FreshRSS/FreshRSS/",
|
||||
"FreshRSS releases @ GitHub",
|
||||
86400
|
||||
);',
|
||||
);
|
||||
|
||||
define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS `entrytmp`, `entry`, `feed`, `category`');
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Označit článek jako přečtený…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Počet zobrazených článků',
|
||||
'_' => 'Počet zobrazených článků',
|
||||
'adaptive' => 'Vyberte zobrazení',
|
||||
'all_articles' => 'Zobrazit všechny články',
|
||||
'unread' => 'Zobrazit jen nepřečtené',
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ return array(
|
||||
'keep_logged_in' => 'Zapamatovat přihlášení <small>(%s dny)</small>',
|
||||
'login' => 'Login',
|
||||
'logout' => 'Odhlášení',
|
||||
'password' => array(
|
||||
'password' => array(
|
||||
'_' => 'Heslo',
|
||||
'format' => '<small>Alespoň 7 znaků</small>',
|
||||
),
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Artikel als gelesen markieren…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Artikel zum Anzeigen',
|
||||
'_' => 'Artikel zum Anzeigen',
|
||||
'adaptive' => 'Anzeige anpassen',
|
||||
'all_articles' => 'Alle Artikel zeigen',
|
||||
'unread' => 'Nur ungelesene zeigen',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Mark article as read…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Articles to display',
|
||||
'_' => 'Articles to display',
|
||||
'adaptive' => 'Adjust showing',
|
||||
'all_articles' => 'Show all articles',
|
||||
'unread' => 'Show only unread',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Segna articoli come letti…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Articoli da visualizzare',
|
||||
'_' => 'Articoli da visualizzare',
|
||||
'adaptive' => 'Adatta visualizzazione',
|
||||
'all_articles' => 'Mostra tutti gli articoli',
|
||||
'unread' => 'Mostra solo non letti',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => '읽음으로 표시…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => '글 표시 방식',
|
||||
'_' => '글 표시 방식',
|
||||
'adaptive' => '읽지 않은 글이 없으면 모든 글 표시',
|
||||
'all_articles' => '모든 글 표시',
|
||||
'unread' => '읽지 않은 글만 표시',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Markeer artikel als gelezen…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Artikelen om te tonen',
|
||||
'_' => 'Artikelen om te tonen',
|
||||
'adaptive' => 'Pas weergave aan',
|
||||
'all_articles' => 'Bekijk alle artikelen',
|
||||
'unread' => 'Bekijk alleen ongelezen',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Mark article as read…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Articles to display',
|
||||
'_' => 'Articles to display',
|
||||
'adaptive' => 'Adjust showing',
|
||||
'all_articles' => 'Show all articles',
|
||||
'unread' => 'Show only unread',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => 'Makaleyi okundu olarak işaretle…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => 'Gösterilecek makaleler',
|
||||
'_' => 'Gösterilecek makaleler',
|
||||
'adaptive' => 'Ayarlanmış gösterim',
|
||||
'all_articles' => 'Tüm makaleleri göster',
|
||||
'unread' => 'Sadece okunmamış makaleleri göster',
|
||||
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'when' => '将文章设为已读…',
|
||||
),
|
||||
'show' => array(
|
||||
'_' => '文章显示',
|
||||
'_' => '文章显示',
|
||||
'adaptive' => '智能显示',
|
||||
'all_articles' => '显示所有文章',
|
||||
'unread' => '只显示未读',
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirn
|
||||
session_start();
|
||||
|
||||
if (isset($_GET['step'])) {
|
||||
define('STEP',(int)$_GET['step']);
|
||||
define('STEP', (int)$_GET['step']);
|
||||
} else {
|
||||
define('STEP', 0);
|
||||
}
|
||||
@@ -652,7 +652,7 @@ function printStep3() {
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="prefix"><?php echo _t('install.bdd.prefix'); ?></label>
|
||||
<div class="group-controls">
|
||||
<input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : $system_default_config->db['prefix']; ?>" tabindex="6" />
|
||||
<input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : $system_default_config->db['prefix']; ?>" tabindex="6" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,8 @@ if (!$isUpdate) {
|
||||
$options = getopt('', $params);
|
||||
|
||||
if (empty($options['user'])) {
|
||||
fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) . " --user username ( --password 'password' --api_password 'api_password'" .
|
||||
fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) .
|
||||
" --user username ( --password 'password' --api_password 'api_password'" .
|
||||
" --language en --email user@example.net --token 'longRandomString'" .
|
||||
($isUpdate ? '' : '--no_default_feeds') .
|
||||
" --purge_after_months 3 --feed_min_articles_default 50 --feed_ttl_default 3600" .
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@ require('_update-or-create-user.php');
|
||||
|
||||
$username = $options['user'];
|
||||
if (!FreshRSS_user_Controller::checkUsername($username)) {
|
||||
fail('FreshRSS error: invalid username “' . $username . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
|
||||
fail('FreshRSS error: invalid username “' . $username .
|
||||
'”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
|
||||
}
|
||||
|
||||
$usernames = listUsers();
|
||||
|
||||
+6
-3
@@ -81,14 +81,17 @@ if ($requirements['all'] !== 'ok') {
|
||||
}
|
||||
|
||||
if (!FreshRSS_user_Controller::checkUsername($options['default_user'])) {
|
||||
fail('FreshRSS error: invalid default username “' . $options['default_user'] . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
|
||||
fail('FreshRSS error: invalid default username “' . $options['default_user']
|
||||
. '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
|
||||
}
|
||||
|
||||
if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) {
|
||||
fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }): ' . $options['auth_type']);
|
||||
fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }): '
|
||||
. $options['auth_type']);
|
||||
}
|
||||
|
||||
if (file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config, true) . ";\n") === false) {
|
||||
if (file_put_contents(join_path(DATA_PATH, 'config.php'),
|
||||
"<?php\n return " . var_export($config, true) . ";\n") === false) {
|
||||
fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php'));
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ require('_cli.php');
|
||||
|
||||
$users = listUsers();
|
||||
sort($users);
|
||||
if (FreshRSS_Context::$system_conf->default_user !== '' && in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) {
|
||||
if (FreshRSS_Context::$system_conf->default_user !== ''
|
||||
&& in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) {
|
||||
array_unshift($users, FreshRSS_Context::$system_conf->default_user);
|
||||
$users = array_unique($users);
|
||||
}
|
||||
|
||||
+2
-1
@@ -51,7 +51,8 @@ if (!FreshRSS_user_Controller::checkUsername($config->default_user)) {
|
||||
}
|
||||
|
||||
if (isset($config->auth_type) && !in_array($config->auth_type, array('form', 'http_auth', 'none'))) {
|
||||
fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' . $config->auth_type);
|
||||
fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: '
|
||||
. $config->auth_type);
|
||||
}
|
||||
|
||||
$config->save();
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
* This is a configuration file. You shouldn't modify it unless you know what
|
||||
* you are doing. If you want to add a share type, this is where you need to do
|
||||
* it.
|
||||
*
|
||||
*
|
||||
* For each share there is different configuration options. Here is the description
|
||||
* of those options:
|
||||
* - url is a mandatory option. It is a string representing the share URL. It
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ class Minz_ActionController {
|
||||
public function view () {
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Méthodes à redéfinir (ou non) par héritage
|
||||
* firstAction est la première méthode exécutée par le Dispatcher
|
||||
@@ -34,5 +34,3 @@ class Minz_ActionController {
|
||||
public function firstAction () { }
|
||||
public function lastAction () { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ class Minz_ActionException extends Minz_Exception {
|
||||
public function __construct ($controller_name, $action_name, $code = self::ERROR) {
|
||||
$message = '`' . $action_name . '` cannot be invoked on `'
|
||||
. $controller_name . '`';
|
||||
|
||||
|
||||
parent::__construct ($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class Minz_Configuration {
|
||||
|
||||
/**
|
||||
* Create a new Minz_Configuration object.
|
||||
*
|
||||
*
|
||||
* @param $namespace the name of the current configuration.
|
||||
* @param $config_filename the file containing configuration values.
|
||||
* @param $default_filename the file containing default values, null by default.
|
||||
@@ -145,7 +145,7 @@ class Minz_Configuration {
|
||||
|
||||
/**
|
||||
* Return the value of the given param.
|
||||
*
|
||||
*
|
||||
* @param $key the name of the param.
|
||||
* @param $default default value to return if key does not exist.
|
||||
* @return the value corresponding to the key.
|
||||
|
||||
@@ -3,7 +3,7 @@ class Minz_ControllerNotActionControllerException extends Minz_Exception {
|
||||
public function __construct ($controller_name, $code = self::ERROR) {
|
||||
$message = 'Controller `' . $controller_name
|
||||
. '` isn\'t instance of ActionController';
|
||||
|
||||
|
||||
parent::__construct ($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ class Minz_ControllerNotExistException extends Minz_Exception {
|
||||
public function __construct ($controller_name, $code = self::ERROR) {
|
||||
$message = 'Controller `' . $controller_name
|
||||
. '` doesn\'t exist';
|
||||
|
||||
|
||||
parent::__construct ($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class Minz_CurrentPagePaginationException extends Minz_Exception {
|
||||
public function __construct ($page) {
|
||||
$message = 'Page number `' . $page . '` doesn\'t exist';
|
||||
|
||||
|
||||
parent::__construct ($message, self::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class Minz_FileNotExistException extends Minz_Exception {
|
||||
public function __construct ($file_name, $code = self::ERROR) {
|
||||
$message = 'File not found: `' . $file_name.'`';
|
||||
|
||||
|
||||
parent::__construct ($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,12 +119,12 @@ class Minz_FrontController {
|
||||
switch($conf->environment) {
|
||||
case 'production':
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors','Off');
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
case 'development':
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors','On');
|
||||
ini_set('display_errors', 'On');
|
||||
ini_set('log_errors', 'On');
|
||||
break;
|
||||
case 'silent':
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -13,7 +13,7 @@ class Minz_Helper {
|
||||
* @param $var variable à traiter (tableau ou simple variable)
|
||||
*/
|
||||
public static function stripslashes_r($var) {
|
||||
if (is_array($var)){
|
||||
if (is_array($var)) {
|
||||
return array_map(array('Minz_Helper', 'stripslashes_r'), $var);
|
||||
} else {
|
||||
return stripslashes($var);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
@@ -25,8 +25,7 @@ class Minz_ModelArray {
|
||||
protected function loadArray() {
|
||||
if (!file_exists($this->filename)) {
|
||||
throw new Minz_FileNotExistException($this->filename, Minz_Exception::WARNING);
|
||||
}
|
||||
elseif (($handle = $this->getLock()) === false) {
|
||||
} elseif (($handle = $this->getLock()) === false) {
|
||||
throw new Minz_PermissionDeniedException($this->filename);
|
||||
} else {
|
||||
$data = include($this->filename);
|
||||
|
||||
@@ -39,7 +39,7 @@ class Minz_ModelPdo {
|
||||
if ($currentUser === null) {
|
||||
$currentUser = Minz_Session::param('currentUser');
|
||||
}
|
||||
if (self::$useSharedBd && self::$sharedBd != null &&
|
||||
if (self::$useSharedBd && self::$sharedBd != null &&
|
||||
($currentUser == null || $currentUser === self::$sharedCurrentUser)) {
|
||||
$this->bd = self::$sharedBd;
|
||||
$this->prefix = self::$sharedPrefix;
|
||||
|
||||
@@ -3,7 +3,7 @@ class Minz_PDOConnectionException extends Minz_Exception {
|
||||
public function __construct ($string_connection, $user, $code = self::ERROR) {
|
||||
$message = 'Access to database is denied for `' . $user . '`'
|
||||
. ' (`' . $string_connection . '`)';
|
||||
|
||||
|
||||
parent::__construct ($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ class Minz_Paginator {
|
||||
*/
|
||||
public function render ($view, $getteur) {
|
||||
$view = APP_PATH . '/views/helpers/'.$view;
|
||||
|
||||
|
||||
if (file_exists ($view)) {
|
||||
include ($view);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class Minz_Paginator {
|
||||
$begin = ($this->currentPage - 1) * $this->nbItemsPerPage;
|
||||
$counter = 0;
|
||||
$i = 0;
|
||||
|
||||
|
||||
foreach ($this->items as $key => $item) {
|
||||
if ($i >= $begin) {
|
||||
$array[$key] = $item;
|
||||
@@ -164,7 +164,7 @@ class Minz_Paginator {
|
||||
if (is_array ($items)) {
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
|
||||
$this->_nbPage ();
|
||||
}
|
||||
public function _nbItemsPerPage ($nbItemsPerPage) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* MINZ - Copyright 2011 Marien Fressinaud
|
||||
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ class Minz_Translate {
|
||||
* @param additional parameters for variable keys.
|
||||
* @return the value corresponding to the key.
|
||||
* If no value is found, return the key itself.
|
||||
*/
|
||||
*/
|
||||
public static function t($key) {
|
||||
$group = explode('.', $key);
|
||||
|
||||
|
||||
@@ -262,5 +262,3 @@ class Minz_View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ function isImgMime($content) {
|
||||
$isImage = strpos(finfo_buffer($fInfo, $content), 'image') !== false;
|
||||
finfo_close($fInfo);
|
||||
} catch (Exception $e) {
|
||||
echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
}
|
||||
return $isImage;
|
||||
}
|
||||
|
||||
+1
-2
@@ -63,8 +63,7 @@ function _dateCeiling($isoDate) {
|
||||
}
|
||||
|
||||
function _noDelimit($isoDate) {
|
||||
return $isoDate === null || $isoDate === '' ? null :
|
||||
str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone
|
||||
return $isoDate === null || $isoDate === '' ? null : str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone
|
||||
}
|
||||
|
||||
function _dateRelative($d1, $d2) {
|
||||
|
||||
+1
-2
@@ -68,8 +68,7 @@ function checkRequirements($dbType = '') {
|
||||
'http_referer' => $http_referer ? 'ok' : 'ko',
|
||||
'message' => $message ?: 'ok',
|
||||
'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml &&
|
||||
$data && $cache && $users && $favicons && $http_referer && $message == '' ?
|
||||
'ok' : 'ko'
|
||||
$data && $cache && $users && $favicons && $http_referer && $message == '' ? 'ok' : 'ko'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +348,7 @@ function get_user_configuration($username) {
|
||||
join_path(FRESHRSS_PATH, 'config-user.default.php'));
|
||||
} catch (Minz_ConfigurationNamespaceException $e) {
|
||||
// namespace already exists, do nothing.
|
||||
Minz_Log::warning($e->getMessage());
|
||||
} catch (Minz_FileNotExistException $e) {
|
||||
Minz_Log::warning($e->getMessage());
|
||||
return null;
|
||||
@@ -366,6 +367,7 @@ function cryptAvailable() {
|
||||
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
|
||||
return $hash === @crypt('password', $hash);
|
||||
} catch (Exception $e) {
|
||||
Minz_Log::warning($e->getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+39
-13
@@ -94,7 +94,16 @@ function debugInfo() {
|
||||
}
|
||||
}
|
||||
global $ORIGINAL_INPUT;
|
||||
return print_r(array('date' => date('c'), 'headers' => $ALL_HEADERS, '_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, 'INPUT' => $ORIGINAL_INPUT), true);
|
||||
return print_r(
|
||||
array(
|
||||
'date' => date('c'),
|
||||
'headers' => $ALL_HEADERS,
|
||||
'_SERVER' => $_SERVER,
|
||||
'_GET' => $_GET,
|
||||
'_POST' => $_POST,
|
||||
'_COOKIE' => $_COOKIE,
|
||||
'INPUT' => $ORIGINAL_INPUT
|
||||
), true);
|
||||
}
|
||||
|
||||
function badRequest() {
|
||||
@@ -694,8 +703,8 @@ $pathInfo = empty($_SERVER['PATH_INFO']) ? '/Error' : urldecode($_SERVER['PATH_I
|
||||
$pathInfos = explode('/', $pathInfo);
|
||||
|
||||
Minz_Configuration::register('system',
|
||||
DATA_PATH . '/config.php',
|
||||
FRESHRSS_PATH . '/config.default.php');
|
||||
DATA_PATH . '/config.php',
|
||||
FRESHRSS_PATH . '/config.default.php');
|
||||
FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
|
||||
if (!FreshRSS_Context::$system_conf->api_enabled) {
|
||||
serviceUnavailable();
|
||||
@@ -715,24 +724,34 @@ Minz_Session::_param('currentUser', $user);
|
||||
|
||||
if (count($pathInfos) < 3) {
|
||||
badRequest();
|
||||
}
|
||||
elseif ($pathInfos[1] === 'accounts') {
|
||||
} elseif ($pathInfos[1] === 'accounts') {
|
||||
if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) {
|
||||
clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']);
|
||||
}
|
||||
}
|
||||
elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) {
|
||||
} elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) {
|
||||
if ($user == '') {
|
||||
unauthorized();
|
||||
}
|
||||
$timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching.
|
||||
switch ($pathInfos[4]) {
|
||||
case 'stream':
|
||||
$exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; //xt=[exclude target] : Used to exclude certain items from the feed. For example, using xt=user/-/state/com.google/read will exclude items that the current user has marked as read, or xt=feed/[feedurl] will exclude items from a particular feed (obviously not useful in this request, but xt appears in other listing requests).
|
||||
/* xt=[exclude target] : Used to exclude certain items from the feed.
|
||||
* For example, using xt=user/-/state/com.google/read will exclude items
|
||||
* that the current user has marked as read, or xt=feed/[feedurl] will
|
||||
* exclude items from a particular feed (obviously not useful in this
|
||||
* request, but xt appears in other listing requests). */
|
||||
$exclude_target = isset($_GET['xt']) ? $_GET['xt'] : '';
|
||||
$count = isset($_GET['n']) ? intval($_GET['n']) : 20; //n=[integer] : The maximum number of results to return.
|
||||
$order = isset($_GET['r']) ? $_GET['r'] : 'd'; //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order.
|
||||
$start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; //ot=[unix timestamp] : The time from which you want to retrieve items. Only items that have been crawled by Google Reader after this time will be returned.
|
||||
$continuation = isset($_GET['c']) ? $_GET['c'] : ''; //Continuation token. If a StreamContents response does not represent all items in a timestamp range, it will have a continuation attribute. The same request can be re-issued with the value of that attribute put in this parameter to get more items
|
||||
/* ot=[unix timestamp] : The time from which you want to retrieve
|
||||
* items. Only items that have been crawled by Google Reader after
|
||||
* this time will be returned. */
|
||||
$start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0;
|
||||
/* Continuation token. If a StreamContents response does not represent
|
||||
* all items in a timestamp range, it will have a continuation attribute.
|
||||
* The same request can be re-issued with the value of that attribute put
|
||||
* in this parameter to get more items */
|
||||
$continuation = isset($_GET['c']) ? $_GET['c'] : '';
|
||||
if (isset($pathInfos[5]) && $pathInfos[5] === 'contents' && isset($pathInfos[6])) {
|
||||
if (isset($pathInfos[7])) {
|
||||
if ($pathInfos[6] === 'feed') {
|
||||
@@ -757,7 +776,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
|
||||
}
|
||||
} elseif ($pathInfos[5] === 'items') {
|
||||
if ($pathInfos[6] === 'ids' && isset($_GET['s'])) {
|
||||
$streamId = $_GET['s']; //StreamId for which to fetch the item IDs. The parameter may be repeated to fetch the item IDs from multiple streams at once (more efficient from a backend perspective than multiple requests).
|
||||
/* StreamId for which to fetch the item IDs. The parameter may
|
||||
* be repeated to fetch the item IDs from multiple streams at once
|
||||
* (more efficient from a backend perspective than multiple requests). */
|
||||
$streamId = $_GET['s'];
|
||||
streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target);
|
||||
}
|
||||
}
|
||||
@@ -779,8 +801,12 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['s']) && isset($_POST['ac'])) {
|
||||
$streamNames = multiplePosts('s'); //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once
|
||||
$titles = multiplePosts('t'); //Title to use for the subscription. For the `subscribe` action, if not specified then the feed's current title will be used. Can be used with the `edit` action to rename a subscription
|
||||
//StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once
|
||||
$streamNames = multiplePosts('s');
|
||||
/* Title to use for the subscription. For the `subscribe` action,
|
||||
* if not specified then the feed's current title will be used. Can
|
||||
* be used with the `edit` action to rename a subscription */
|
||||
$titles = multiplePosts('t');
|
||||
$action = $_POST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit`
|
||||
$add = isset($_POST['a']) ? $_POST['a'] : ''; //StreamId to add the subscription to (generally a user label)
|
||||
$remove = isset($_POST['r']) ? $_POST['r'] : ''; //StreamId to remove the subscription from (generally a user label)
|
||||
|
||||
+2
-1
@@ -22,7 +22,8 @@ echo Minz_Url::display('/api/greader.php', 'html', true);
|
||||
</dl>
|
||||
<ul>
|
||||
<li><a href="greader.php/check%2Fcompatibility" rel="nofollow">Check full server configuration</a></li>
|
||||
<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server configuration (without <code>%2F</code> support)</a></li>
|
||||
<li><a href="greader.php/check/compatibility" rel="nofollow">Check partial server
|
||||
configuration (without <code>%2F</code> support)</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="FreshRSS Ruleset">
|
||||
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/</description>
|
||||
<!-- to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 -->
|
||||
<!--<arg name="tab-width" value="10"/>-->
|
||||
<exclude-pattern>./static</exclude-pattern>
|
||||
<exclude-pattern>./vendor</exclude-pattern>
|
||||
<exclude-pattern>./lib/SimplePie/</exclude-pattern>
|
||||
<exclude-pattern>./lib/http-conditional.php</exclude-pattern>
|
||||
<exclude-pattern>./lib/JSON.php</exclude-pattern>
|
||||
<exclude-pattern>./lib/lib_phpQuery.php</exclude-pattern>
|
||||
<exclude-pattern>./lib/password_compat.php</exclude-pattern>
|
||||
<!-- Duplicate class names are not allowed -->
|
||||
<rule ref="Generic.Classes.DuplicateClassName"/>
|
||||
<!-- Statements must not be empty -->
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
|
||||
<!-- Unconditional if-statements are not allowed -->
|
||||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||
<!-- Do not use final statements inside final classes -->
|
||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||
<!-- Do not override methods to call their parent -->
|
||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||
<!-- One line should not have more than 80 characters -->
|
||||
<!-- One line must never exceed 120 characters -->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<!-- For language strings maximum line lengths make little sense. -->
|
||||
<exclude-pattern>./app/i18n/</exclude-pattern>
|
||||
<!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it -->
|
||||
<exclude-pattern>./app/install.php</exclude-pattern>
|
||||
<!-- @todo remove test exclusion -->
|
||||
<exclude-pattern>./tests/app/</exclude-pattern>
|
||||
<!-- @todo remove SQL exclusion -->
|
||||
<exclude-pattern>./app/SQL/install.sql.mysql.php</exclude-pattern>
|
||||
<exclude-pattern>./app/SQL/install.sql.pgsql.php</exclude-pattern>
|
||||
<properties>
|
||||
<property name="lineLimit" value="80"/>
|
||||
<property name="absoluteLineLimit" value="180"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<!-- When calling a function: -->
|
||||
<!-- Do not add a space before the opening parenthesis -->
|
||||
<!-- Do not add a space after the opening parenthesis -->
|
||||
<!-- Do not add a space before the closing parenthesis -->
|
||||
<!-- Do not add a space before a comma -->
|
||||
<!-- Add a space after a comma -->
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||
<rule ref="Generic.PHP.DisallowShortOpenTag" />
|
||||
<rule ref="Generic.PHP.DeprecatedFunctions" />
|
||||
<!-- Use UPPERCARE for constants -->
|
||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
||||
<!-- Use lowercase for 'true', 'false' and 'null' -->
|
||||
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
||||
<!-- Use a single string instead of concatenating -->
|
||||
<rule ref="Generic.Strings.UnnecessaryStringConcat">
|
||||
<properties>
|
||||
<!-- Allow string concatenating across multiple lines -->
|
||||
<property name="allowMultiline" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<!-- Use tabs for indentation -->
|
||||
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
|
||||
<!-- Parameters with default values must appear last in functions -->
|
||||
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
||||
<!-- Use 'elseif' instead of 'else if' -->
|
||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
||||
<!-- Do not add spaces after opening or before closing bracket -->
|
||||
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
|
||||
<!-- Add a new line at the end of a file -->
|
||||
<rule ref="PSR2.Files.EndFileNewline"/>
|
||||
<!-- Use Unix newlines -->
|
||||
<rule ref="Generic.Files.LineEndings">
|
||||
<properties>
|
||||
<property name="eolChar" value="\n" />
|
||||
</properties>
|
||||
</rule>
|
||||
<!-- Add space after closing parenthesis -->
|
||||
<!-- Add body into new line -->
|
||||
<!-- Close body in new line -->
|
||||
<rule ref="Squiz.ControlStructures.ControlSignature">
|
||||
<!-- No space after keyword (before opening parenthesis) -->
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
|
||||
</rule>
|
||||
<!-- When declaring a function: -->
|
||||
<!-- Do not add a space before a comma -->
|
||||
<!-- Add a space after a comma -->
|
||||
<!-- Add a space before and after an equal sign -->
|
||||
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
||||
<properties>
|
||||
<property name="equalsSpacing" value="1"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<!-- Do not add spaces when casting -->
|
||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||
<!-- Operators must have a space around them -->
|
||||
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
|
||||
<!-- Do not add a whitespace before a semicolon -->
|
||||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||
<!-- Do not add whitespace at start or end of a file or end of a line -->
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||
</ruleset>
|
||||
@@ -20,12 +20,12 @@ class FreshRSS_CategoryTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function provideValidNames() {
|
||||
return array(
|
||||
array('', ''),
|
||||
array('this string does not need trimming', 'this string does not need trimming'),
|
||||
array(' this string needs trimming on left', 'this string needs trimming on left'),
|
||||
array('this string needs trimming on right ', 'this string needs trimming on right'),
|
||||
array(' this string needs trimming on both ends ', 'this string needs trimming on both ends'),
|
||||
array(str_repeat('This string needs to be shortened because its length is way too long. ', 4), str_repeat('This string needs to be shortened because its length is way too long. ', 3) . 'This string needs to be shortened because its'),
|
||||
array('', ''),
|
||||
array('this string does not need trimming', 'this string does not need trimming'),
|
||||
array(' this string needs trimming on left', 'this string needs trimming on left'),
|
||||
array('this string needs trimming on right ', 'this string needs trimming on right'),
|
||||
array(' this string needs trimming on both ends ', 'this string needs trimming on both ends'),
|
||||
array(str_repeat('This string needs to be shortened because its length is way too long. ', 4), str_repeat('This string needs to be shortened because its length is way too long. ', 3) . 'This string needs to be shortened because its'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+108
-108
@@ -28,8 +28,8 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideEmptyInput() {
|
||||
return array(
|
||||
array(''),
|
||||
array(null),
|
||||
array(''),
|
||||
array(null),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,22 +50,22 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideIntitleSearch() {
|
||||
return array(
|
||||
array('intitle:word1', array('word1'), null),
|
||||
array('intitle:word1 word2', array('word1'), array('word2')),
|
||||
array('intitle:"word1 word2"', array('word1 word2'), null),
|
||||
array("intitle:'word1 word2'", array('word1 word2'), null),
|
||||
array('word1 intitle:word2', array('word2'), array('word1')),
|
||||
array('word1 intitle:word2 word3', array('word2'), array('word1', 'word3')),
|
||||
array('word1 intitle:"word2 word3"', array('word2 word3'), array('word1')),
|
||||
array("word1 intitle:'word2 word3'", array('word2 word3'), array('word1')),
|
||||
array('intitle:word1 intitle:word2', array('word1', 'word2'), null),
|
||||
array('intitle: word1 word2', array(), array('word1', 'word2')),
|
||||
array('intitle:123', array('123'), null),
|
||||
array('intitle:"word1 word2" word3"', array('word1 word2'), array('word3"')),
|
||||
array("intitle:'word1 word2' word3'", array('word1 word2'), array("word3'")),
|
||||
array('intitle:"word1 word2\' word3"', array("word1 word2' word3"), null),
|
||||
array("intitle:'word1 word2\" word3'", array('word1 word2" word3'), null),
|
||||
array("intitle:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
array('intitle:word1', array('word1'), null),
|
||||
array('intitle:word1 word2', array('word1'), array('word2')),
|
||||
array('intitle:"word1 word2"', array('word1 word2'), null),
|
||||
array("intitle:'word1 word2'", array('word1 word2'), null),
|
||||
array('word1 intitle:word2', array('word2'), array('word1')),
|
||||
array('word1 intitle:word2 word3', array('word2'), array('word1', 'word3')),
|
||||
array('word1 intitle:"word2 word3"', array('word2 word3'), array('word1')),
|
||||
array("word1 intitle:'word2 word3'", array('word2 word3'), array('word1')),
|
||||
array('intitle:word1 intitle:word2', array('word1', 'word2'), null),
|
||||
array('intitle: word1 word2', array(), array('word1', 'word2')),
|
||||
array('intitle:123', array('123'), null),
|
||||
array('intitle:"word1 word2" word3"', array('word1 word2'), array('word3"')),
|
||||
array("intitle:'word1 word2' word3'", array('word1 word2'), array("word3'")),
|
||||
array('intitle:"word1 word2\' word3"', array("word1 word2' word3"), null),
|
||||
array("intitle:'word1 word2\" word3'", array('word1 word2" word3'), null),
|
||||
array("intitle:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,22 +86,22 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideAuthorSearch() {
|
||||
return array(
|
||||
array('author:word1', array('word1'), null),
|
||||
array('author:word1 word2', array('word1'), array('word2')),
|
||||
array('author:"word1 word2"', array('word1 word2'), null),
|
||||
array("author:'word1 word2'", array('word1 word2'), null),
|
||||
array('word1 author:word2', array('word2'), array('word1')),
|
||||
array('word1 author:word2 word3', array('word2'), array('word1', 'word3')),
|
||||
array('word1 author:"word2 word3"', array('word2 word3'), array('word1')),
|
||||
array("word1 author:'word2 word3'", array('word2 word3'), array('word1')),
|
||||
array('author:word1 author:word2', array('word1', 'word2'), null),
|
||||
array('author: word1 word2', array(), array('word1', 'word2')),
|
||||
array('author:123', array('123'), null),
|
||||
array('author:"word1 word2" word3"', array('word1 word2'), array('word3"')),
|
||||
array("author:'word1 word2' word3'", array('word1 word2'), array("word3'")),
|
||||
array('author:"word1 word2\' word3"', array("word1 word2' word3"), null),
|
||||
array("author:'word1 word2\" word3'", array('word1 word2" word3'), null),
|
||||
array("author:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
array('author:word1', array('word1'), null),
|
||||
array('author:word1 word2', array('word1'), array('word2')),
|
||||
array('author:"word1 word2"', array('word1 word2'), null),
|
||||
array("author:'word1 word2'", array('word1 word2'), null),
|
||||
array('word1 author:word2', array('word2'), array('word1')),
|
||||
array('word1 author:word2 word3', array('word2'), array('word1', 'word3')),
|
||||
array('word1 author:"word2 word3"', array('word2 word3'), array('word1')),
|
||||
array("word1 author:'word2 word3'", array('word2 word3'), array('word1')),
|
||||
array('author:word1 author:word2', array('word1', 'word2'), null),
|
||||
array('author: word1 word2', array(), array('word1', 'word2')),
|
||||
array('author:123', array('123'), null),
|
||||
array('author:"word1 word2" word3"', array('word1 word2'), array('word3"')),
|
||||
array("author:'word1 word2' word3'", array('word1 word2'), array("word3'")),
|
||||
array('author:"word1 word2\' word3"', array("word1 word2' word3"), null),
|
||||
array("author:'word1 word2\" word3'", array('word1 word2" word3'), null),
|
||||
array("author:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideInurlSearch() {
|
||||
return array(
|
||||
array('inurl:word1', array('word1'), null),
|
||||
array('inurl: word1', array(), array('word1')),
|
||||
array('inurl:123', array('123'), null),
|
||||
array('inurl:word1 word2', array('word1'), array('word2')),
|
||||
array('inurl:"word1 word2"', array('"word1'), array('word2"')),
|
||||
array('inurl:word1 word2 inurl:word3', array('word1', 'word3'), array('word2')),
|
||||
array("inurl:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
array('inurl:word1', array('word1'), null),
|
||||
array('inurl: word1', array(), array('word1')),
|
||||
array('inurl:123', array('123'), null),
|
||||
array('inurl:word1 word2', array('word1'), array('word2')),
|
||||
array('inurl:"word1 word2"', array('"word1'), array('word2"')),
|
||||
array('inurl:word1 word2 inurl:word3', array('word1', 'word3'), array('word2')),
|
||||
array("inurl:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,12 +149,12 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideDateSearch() {
|
||||
return array(
|
||||
array('date:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
|
||||
array('date:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
|
||||
array('date:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
|
||||
array('date:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1),
|
||||
array('date:2007-03-01/', strtotime('2007-03-01'), ''),
|
||||
array('date:/2008-05-11', '', strtotime('2008-05-12') - 1),
|
||||
array('date:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
|
||||
array('date:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
|
||||
array('date:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
|
||||
array('date:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1),
|
||||
array('date:2007-03-01/', strtotime('2007-03-01'), ''),
|
||||
array('date:/2008-05-11', '', strtotime('2008-05-12') - 1),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -175,12 +175,12 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function providePubdateSearch() {
|
||||
return array(
|
||||
array('pubdate:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
|
||||
array('pubdate:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
|
||||
array('pubdate:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
|
||||
array('pubdate:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1),
|
||||
array('pubdate:2007-03-01/', strtotime('2007-03-01'), ''),
|
||||
array('pubdate:/2008-05-11', '', strtotime('2008-05-12') - 1),
|
||||
array('pubdate:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
|
||||
array('pubdate:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
|
||||
array('pubdate:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
|
||||
array('pubdate:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1),
|
||||
array('pubdate:2007-03-01/', strtotime('2007-03-01'), ''),
|
||||
array('pubdate:/2008-05-11', '', strtotime('2008-05-12') - 1),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,13 +201,13 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
*/
|
||||
public function provideTagsSearch() {
|
||||
return array(
|
||||
array('#word1', array('word1'), null),
|
||||
array('# word1', array(), array('#', 'word1')),
|
||||
array('#123', array('123'), null),
|
||||
array('#word1 word2', array('word1'), array('word2')),
|
||||
array('#"word1 word2"', array('"word1'), array('word2"')),
|
||||
array('#word1 #word2', array('word1', 'word2'), null),
|
||||
array("#word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
array('#word1', array('word1'), null),
|
||||
array('# word1', array(), array('#', 'word1')),
|
||||
array('#123', array('123'), null),
|
||||
array('#word1 word2', array('word1'), array('word2')),
|
||||
array('#"word1 word2"', array('"word1'), array('word2"')),
|
||||
array('#word1 #word2', array('word1', 'word2'), null),
|
||||
array("#word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -240,54 +240,54 @@ class SearchTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function provideMultipleSearch() {
|
||||
return array(
|
||||
array(
|
||||
'author:word1 date:2007-03-01/2008-05-11 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 #word5',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
null,
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word6'),
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 word7 date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word6', 'word7'),
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 "word7 word8" date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word7 word8', 'word6'),
|
||||
),
|
||||
array(
|
||||
'author:word1 date:2007-03-01/2008-05-11 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 #word5',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
null,
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word6'),
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 word7 date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word6', 'word7'),
|
||||
),
|
||||
array(
|
||||
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 "word7 word8" date:2007-03-01/2008-05-11',
|
||||
array('word1'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word2'),
|
||||
array('word3'),
|
||||
strtotime('2007-03-01'),
|
||||
strtotime('2008-05-12') - 1,
|
||||
array('word4', 'word5'),
|
||||
array('word7 word8', 'word6'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
$category_name = 'some category name';
|
||||
$cat = $this->getMock('FreshRSS_Category');
|
||||
$cat->expects($this->atLeastOnce())
|
||||
->method('name')
|
||||
->withAnyParameters()
|
||||
->willReturn($category_name);
|
||||
->method('name')
|
||||
->withAnyParameters()
|
||||
->willReturn($category_name);
|
||||
$cat_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$cat_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($cat);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($cat);
|
||||
$query = array('get' => 'c_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, null, $cat_dao);
|
||||
$this->assertEquals($category_name, $user_query->getGetName());
|
||||
@@ -61,14 +61,14 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
$feed_name = 'some feed name';
|
||||
$feed = $this->getMock('FreshRSS_Feed', array(), array('', false));
|
||||
$feed->expects($this->atLeastOnce())
|
||||
->method('name')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed_name);
|
||||
->method('name')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed_name);
|
||||
$feed_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$feed_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed);
|
||||
$query = array('get' => 'f_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, $feed_dao, null);
|
||||
$this->assertEquals($feed_name, $user_query->getGetName());
|
||||
@@ -118,12 +118,12 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testToArray_whenData_returnsArray() {
|
||||
$query = array(
|
||||
'get' => 's',
|
||||
'name' => 'some name',
|
||||
'order' => 'some order',
|
||||
'search' => 'some search',
|
||||
'state' => 'some state',
|
||||
'url' => 'some url',
|
||||
'get' => 's',
|
||||
'name' => 'some name',
|
||||
'order' => 'some order',
|
||||
'search' => 'some search',
|
||||
'state' => 'some state',
|
||||
'url' => 'some url',
|
||||
);
|
||||
$user_query = new FreshRSS_UserQuery($query);
|
||||
$this->assertInternalType('array', $user_query->toArray());
|
||||
@@ -133,7 +133,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testHasSearch_whenSearch_returnsTrue() {
|
||||
$query = array(
|
||||
'search' => 'some search',
|
||||
'search' => 'some search',
|
||||
);
|
||||
$user_query = new FreshRSS_UserQuery($query);
|
||||
$this->assertTrue($user_query->hasSearch());
|
||||
@@ -166,9 +166,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
$cat = $this->getMock('FreshRSS_Category');
|
||||
$cat_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$cat_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($cat);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($cat);
|
||||
$query = array('get' => 'c_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, null, $cat_dao);
|
||||
$this->assertFalse($user_query->isDeprecated());
|
||||
@@ -177,9 +177,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
public function testIsDeprecated_whenCategoryDoesNotExist_returnTrue() {
|
||||
$cat_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$cat_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn(null);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn(null);
|
||||
$query = array('get' => 'c_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, null, $cat_dao);
|
||||
$this->assertTrue($user_query->isDeprecated());
|
||||
@@ -189,9 +189,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
$feed = $this->getMock('FreshRSS_Feed', array(), array('', false));
|
||||
$feed_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$feed_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn($feed);
|
||||
$query = array('get' => 'f_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, $feed_dao, null);
|
||||
$this->assertFalse($user_query->isDeprecated());
|
||||
@@ -200,9 +200,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase {
|
||||
public function testIsDeprecated_whenFeedDoesNotExist_returnTrue() {
|
||||
$feed_dao = $this->getMock('FreshRSS_Searchable');
|
||||
$feed_dao->expects($this->atLeastOnce())
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn(null);
|
||||
->method('searchById')
|
||||
->withAnyParameters()
|
||||
->willReturn(null);
|
||||
$query = array('get' => 'f_1');
|
||||
$user_query = new FreshRSS_UserQuery($query, $feed_dao, null);
|
||||
$this->assertTrue($user_query->isDeprecated());
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
require('../constants.php');
|
||||
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
|
||||
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
|
||||
|
||||
Reference in New Issue
Block a user