From 4bb8548eccf22b40c25352fe27c66f1f8039ebcd Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 8 Feb 2015 20:51:41 -0500 Subject: Add a way to parse search string to extract keywords This feature is not in use at the moment, but it will be handy to reorganize the query building process. It allows to have more than one keyword in the search box. Full tests are available as well. It probably needs a refactoring later, but I think this is the first step to make the application full object oriented and testable. --- app/Models/Context.php | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) (limited to 'app') diff --git a/app/Models/Context.php b/app/Models/Context.php index 1c770c756..645639907 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -301,4 +301,153 @@ class FreshRSS_Context { } return false; } + + /** + * Parse search string to extract the different keywords. + * + * @return array + */ + public function parseSearch() { + $search = self::$search; + $intitle = $this->parseIntitleSearch($search); + $author = $this->parseAuthorSearch($intitle['string']); + $inurl = $this->parseInurlSearch($author['string']); + $pubdate = $this->parsePubdateSearch($inurl['string']); + $date = $this->parseDateSearch($pubdate['string']); + + $remaining = array(); + $remaining_search = trim($date['string']); + if (strcmp($remaining_search, '') != 0) { + $remaining['search'] = $remaining_search; + } + + return array_merge($intitle['search'], $author['search'], $inurl['search'], $date['search'], $pubdate['search'], $remaining); + } + + /** + * Parse the search string to find intitle keyword and the search related + * to it. + * The search is the first word following the keyword. + * It returns an array containing the matched string and the search. + * + * @param string $search + * @return array + */ + private function parseIntitleSearch($search) { + if (preg_match('/intitle:(?P[\'"])(?P.*)(?P=delim)/U', $search, $matches)) { + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('intitle' => $matches['search']), + ); + } + if (preg_match('/intitle:(?P\w*)/', $search, $matches)) { + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('intitle' => $matches['search']), + ); + } + return array( + 'string' => $search, + 'search' => array(), + ); + } + + /** + * Parse the search string to find author keyword and the search related + * to it. + * The search is the first word following the keyword except when using + * a delimiter. Supported delimiters are single quote (') and double + * quotes ("). + * It returns an array containing the matched string and the search. + * + * @param string $search + * @return array + */ + private function parseAuthorSearch($search) { + if (preg_match('/author:(?P[\'"])(?P.*)(?P=delim)/U', $search, $matches)) { + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('author' => $matches['search']), + ); + } + if (preg_match('/author:(?P\w*)/', $search, $matches)) { + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('author' => $matches['search']), + ); + } + return array( + 'string' => $search, + 'search' => array(), + ); + } + + /** + * Parse the search string to find inurl keyword and the search related + * to it. + * The search is the first word following the keyword except. + * It returns an array containing the matched string and the search. + * + * @param string $search + * @return array + */ + private function parseInurlSearch($search) { + if (preg_match('/inurl:(?P[^\s]*)/', $search, $matches)) { + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('inurl' => $matches['search']), + ); + } + return array( + 'string' => $search, + 'search' => array(), + ); + } + + /** + * Parse the search string to find date keyword and the search related + * to it. + * The search is the first word following the keyword. + * It returns an array containing the matched string and the search. + * + * @param string $search + * @return array + */ + private function parseDateSearch($search) { + if (preg_match('/date:(?P[^\s]*)/', $search, $matches)) { + list($min_date, $max_date) = parseDateInterval($matches['search']); + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('min_date' => $min_date, 'max_date' => $max_date), + ); + } + return array( + 'string' => $search, + 'search' => array(), + ); + } + + /** + * Parse the search string to find pubdate keyword and the search related + * to it. + * The search is the first word following the keyword. + * It returns an array containing the matched string and the search. + * + * @param string $search + * @return array + */ + private function parsePubdateSearch($search) { + if (preg_match('/pubdate:(?P[^\s]*)/', $search, $matches)) { + list($min_date, $max_date) = parseDateInterval($matches['search']); + return array( + 'string' => str_replace($matches[0], '', $search), + 'search' => array('min_pubdate' => $min_date, 'max_pubdate' => $max_date), + ); + } + return array( + 'string' => $search, + 'search' => array(), + ); + } + } -- cgit v1.2.3 From f30ded2f863ed4a33ae8194d6cf00eaa877c9b6a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 11 Feb 2015 20:41:00 -0500 Subject: Extract the search code from the context I figured that the code for the search could be extracted from the context to have separation of concern. It supports multiple keywords. It suports also multiple tag keywords. --- app/Models/Context.php | 148 --------------------- app/Models/Search.php | 189 +++++++++++++++++++++++++++ tests/app/Models/ContextTest.php | 236 --------------------------------- tests/app/Models/SearchTest.php | 276 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 465 insertions(+), 384 deletions(-) create mode 100644 app/Models/Search.php create mode 100644 tests/app/Models/SearchTest.php (limited to 'app') diff --git a/app/Models/Context.php b/app/Models/Context.php index 645639907..f00bb1e97 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -302,152 +302,4 @@ class FreshRSS_Context { return false; } - /** - * Parse search string to extract the different keywords. - * - * @return array - */ - public function parseSearch() { - $search = self::$search; - $intitle = $this->parseIntitleSearch($search); - $author = $this->parseAuthorSearch($intitle['string']); - $inurl = $this->parseInurlSearch($author['string']); - $pubdate = $this->parsePubdateSearch($inurl['string']); - $date = $this->parseDateSearch($pubdate['string']); - - $remaining = array(); - $remaining_search = trim($date['string']); - if (strcmp($remaining_search, '') != 0) { - $remaining['search'] = $remaining_search; - } - - return array_merge($intitle['search'], $author['search'], $inurl['search'], $date['search'], $pubdate['search'], $remaining); - } - - /** - * Parse the search string to find intitle keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseIntitleSearch($search) { - if (preg_match('/intitle:(?P[\'"])(?P.*)(?P=delim)/U', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('intitle' => $matches['search']), - ); - } - if (preg_match('/intitle:(?P\w*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('intitle' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find author keyword and the search related - * to it. - * The search is the first word following the keyword except when using - * a delimiter. Supported delimiters are single quote (') and double - * quotes ("). - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseAuthorSearch($search) { - if (preg_match('/author:(?P[\'"])(?P.*)(?P=delim)/U', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('author' => $matches['search']), - ); - } - if (preg_match('/author:(?P\w*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('author' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find inurl keyword and the search related - * to it. - * The search is the first word following the keyword except. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseInurlSearch($search) { - if (preg_match('/inurl:(?P[^\s]*)/', $search, $matches)) { - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('inurl' => $matches['search']), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find date keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parseDateSearch($search) { - if (preg_match('/date:(?P[^\s]*)/', $search, $matches)) { - list($min_date, $max_date) = parseDateInterval($matches['search']); - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('min_date' => $min_date, 'max_date' => $max_date), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - - /** - * Parse the search string to find pubdate keyword and the search related - * to it. - * The search is the first word following the keyword. - * It returns an array containing the matched string and the search. - * - * @param string $search - * @return array - */ - private function parsePubdateSearch($search) { - if (preg_match('/pubdate:(?P[^\s]*)/', $search, $matches)) { - list($min_date, $max_date) = parseDateInterval($matches['search']); - return array( - 'string' => str_replace($matches[0], '', $search), - 'search' => array('min_pubdate' => $min_date, 'max_pubdate' => $max_date), - ); - } - return array( - 'string' => $search, - 'search' => array(), - ); - } - } diff --git a/app/Models/Search.php b/app/Models/Search.php new file mode 100644 index 000000000..0475bc685 --- /dev/null +++ b/app/Models/Search.php @@ -0,0 +1,189 @@ +raw_input = $input; + $input = $this->parseIntitleSearch($input); + $input = $this->parseAuthorSearch($input); + $input = $this->parseInurlSearch($input); + $input = $this->parsePubdateSearch($input); + $input = $this->parseDateSearch($input); + $input = $this->parseTagsSeach($input); + $this->search = $input; + } + + public function getRawInput() { + return $this->raw_input; + } + + public function getIntitle() { + return $this->intitle; + } + + public function getMinDate() { + return $this->min_date; + } + + public function getMaxDate() { + return $this->max_date; + } + + public function getMinPubdate() { + return $this->min_pubdate; + } + + public function getMaxPubdate() { + return $this->max_pubdate; + } + + public function getInurl() { + return $this->inurl; + } + + public function getAuthor() { + return $this->author; + } + + public function getTags() { + return $this->tags; + } + + public function getSearch() { + return $this->search; + } + + /** + * Parse the search string to find intitle keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseIntitleSearch($input) { + if (preg_match('/intitle:(?P[\'"])(?P.*)(?P=delim)/U', $input, $matches)) { + $this->intitle = $matches['search']; + $input = str_replace($matches[0], '', $input); + } else if (preg_match('/intitle:(?P\w*)/', $input, $matches)) { + $this->intitle = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + /** + * Parse the search string to find author keyword and the search related + * to it. + * The search is the first word following the keyword except when using + * a delimiter. Supported delimiters are single quote (') and double + * quotes ("). + * + * @param string $input + * @return string + */ + private function parseAuthorSearch($input) { + if (preg_match('/author:(?P[\'"])(?P.*)(?P=delim)/U', $input, $matches)) { + $this->author = $matches['search']; + $input = str_replace($matches[0], '', $input); + } else if (preg_match('/author:(?P\w*)/', $input, $matches)) { + $this->author = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + /** + * Parse the search string to find inurl keyword and the search related + * to it. + * The search is the first word following the keyword except. + * + * @param string $input + * @return string + */ + private function parseInurlSearch($input) { + if (preg_match('/inurl:(?P[^\s]*)/', $input, $matches)) { + $this->inurl = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + /** + * Parse the search string to find date keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseDateSearch($input) { + if (preg_match('/date:(?P[^\s]*)/', $input, $matches)) { + list($this->min_date, $this->max_date) = parseDateInterval($matches['search']); + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + /** + * Parse the search string to find pubdate keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parsePubdateSearch($input) { + if (preg_match('/pubdate:(?P[^\s]*)/', $input, $matches)) { + list($this->min_pubdate, $this->max_pubdate) = parseDateInterval($matches['search']); + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + /** + * Parse the search string to find tags keyword (# followed by a word) + * and the search related to it. + * The search is the first word following the #. + * + * @param string $input + * @return string + */ + private function parseTagsSeach($input) { + if (preg_match_all('/#(?P[^\s]+)/', $input, $matches)) { + $this->tags = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + return $this->cleanSearch($input); + } + + private function cleanSearch($input) { + $input = preg_replace('/\s+/', ' ', $input); + return trim($input); + } + +} diff --git a/tests/app/Models/ContextTest.php b/tests/app/Models/ContextTest.php index c5da6f667..4dc8b7757 100644 --- a/tests/app/Models/ContextTest.php +++ b/tests/app/Models/ContextTest.php @@ -1,241 +1,5 @@ context = new FreshRSS_Context(); - } - - public function testParseSearch_whenEmpty_returnsEmptyArray() { - $this->assertCount(0, $this->context->parseSearch()); - } - - /** - * @dataProvider provideMultipleKeywordSearch - * @param string $search - * @param string $expected_values - */ - public function testParseSearch_whenMultipleKeywords_returnArrayWithMultipleValues($search, $expected_values) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_values, $parsed_search); - } - - /** - * @return array - */ - public function provideMultipleKeywordSearch() { - return array( - array( - 'intitle:word1 author:word2', - array( - 'intitle' => 'word1', - 'author' => 'word2', - ), - ), - array( - 'author:word2 intitle:word1', - array( - 'intitle' => 'word1', - 'author' => 'word2', - ), - ), - array( - 'author:word1 inurl:word2', - array( - 'author' => 'word1', - 'inurl' => 'word2', - ), - ), - array( - 'inurl:word2 author:word1', - array( - 'author' => 'word1', - 'inurl' => 'word2', - ), - ), - array( - 'date:2008-01-01/2008-02-01 pubdate:2007-01-01/2007-02-01', - array( - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - ), - ), - array( - 'pubdate:2007-01-01/2007-02-01 date:2008-01-01/2008-02-01', - array( - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - ), - ), - array( - 'inurl:word1 author:word2 intitle:word3 pubdate:2007-01-01/2007-02-01 date:2008-01-01/2008-02-01 hello world', - array( - 'inurl' => 'word1', - 'author' => 'word2', - 'intitle' => 'word3', - 'min_date' => '1199163600', - 'max_date' => '1201928399', - 'min_pubdate' => '1167627600', - 'max_pubdate' => '1170392399', - 'search' => 'hello world', - ), - ), - ); - } - - /** - * @dataProvider provideIntitleSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenIntitleKeyword_returnArrayWithIntitleValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['intitle']); - } - - /** - * @return array - */ - public function provideIntitleSearch() { - return array( - array('intitle:word1', 'word1'), - array('intitle:word1 word2', 'word1'), - array('intitle:"word1 word2"', 'word1 word2'), - array("intitle:'word1 word2'", 'word1 word2'), - array('word1 intitle:word2', 'word2'), - array('word1 intitle:word2 word3', 'word2'), - array('word1 intitle:"word2 word3"', 'word2 word3'), - array("word1 intitle:'word2 word3'", 'word2 word3'), - array('intitle:word1 intitle:word2', 'word1'), - array('intitle: word1 word2', ''), - array('intitle:123', '123'), - array('intitle:"word1 word2" word3"', 'word1 word2'), - array("intitle:'word1 word2' word3'", 'word1 word2'), - array('intitle:"word1 word2\' word3"', "word1 word2' word3"), - array("intitle:'word1 word2\" word3'", 'word1 word2" word3'), - ); - } - - /** - * @dataProvider provideAuthorSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenAuthorKeyword_returnArrayWithAuthorValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['author']); - } - - /** - * @return array - */ - public function provideAuthorSearch() { - return array( - array('author:word1', 'word1'), - array('author:word1 word2', 'word1'), - array('author:"word1 word2"', 'word1 word2'), - array("author:'word1 word2'", 'word1 word2'), - array('word1 author:word2', 'word2'), - array('word1 author:word2 word3', 'word2'), - array('word1 author:"word2 word3"', 'word2 word3'), - array("word1 author:'word2 word3'", 'word2 word3'), - array('author:word1 author:word2', 'word1'), - array('author: word1 word2', ''), - array('author:123', '123'), - array('author:"word1 word2" word3"', 'word1 word2'), - array("author:'word1 word2' word3'", 'word1 word2'), - array('author:"word1 word2\' word3"', "word1 word2' word3"), - array("author:'word1 word2\" word3'", 'word1 word2" word3'), - ); - } - - /** - * @dataProvider provideInurlSearch - * @param string $search - * @param string $expected_value - */ - public function testParseSearch_whenInurlKeyword_returnArrayWithInurlValue($search, $expected_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_value, $parsed_search['inurl']); - } - - /** - * @return array - */ - public function provideInurlSearch() { - return array( - array('inurl:word1', 'word1'), - array('inurl: word1', ''), - array('inurl:123', '123'), - array('inurl:word1 word2', 'word1'), - array('inurl:"word1 word2"', '"word1'), - ); - } - - /** - * @dataProvider provideDateSearch - * @param string $search - * @param string $expected_min_value - * @param string $expected_max_value - */ - public function testParseSearch_whenDateKeyword_returnArrayWithDateValues($search, $expected_min_value, $expected_max_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_min_value, $parsed_search['min_date']); - $this->assertEquals($expected_max_value, $parsed_search['max_date']); - } - - /** - * @return array - */ - 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', '1172725200', '1210564799'), - array('date:2007-03-01/', '1172725200', ''), - array('date:/2008-05-11', '', '1210564799'), - ); - } - - /** - * @dataProvider providePubdateSearch - * @param string $search - * @param string $expected_min_value - * @param string $expected_max_value - */ - public function testParseSearch_whenPubdateKeyword_returnArrayWithPubdateValues($search, $expected_min_value, $expected_max_value) { - FreshRSS_Context::$search = $search; - $parsed_search = $this->context->parseSearch(); - $this->assertEquals($expected_min_value, $parsed_search['min_pubdate']); - $this->assertEquals($expected_max_value, $parsed_search['max_pubdate']); - } - - /** - * @return array - */ - 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', '1172725200', '1210564799'), - array('pubdate:2007-03-01/', '1172725200', ''), - array('pubdate:/2008-05-11', '', '1210564799'), - ); - } - } diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php new file mode 100644 index 000000000..6ddfc0370 --- /dev/null +++ b/tests/app/Models/SearchTest.php @@ -0,0 +1,276 @@ +assertNull($search->getRawInput()); + $this->assertNull($search->getIntitle()); + $this->assertNull($search->getMinDate()); + $this->assertNull($search->getMaxDate()); + $this->assertNull($search->getMinPubdate()); + $this->assertNull($search->getMaxPubdate()); + $this->assertNull($search->getAuthor()); + $this->assertNull($search->getTags()); + $this->assertNull($search->getSearch()); + } + + /** + * Return an array of values for the search object. + * Here is the description of the values + * @return array + */ + public function provideEmptyInput() { + return array( + array(''), + array(null), + ); + } + + /** + * @dataProvider provideIntitleSearch + * @param string $input + * @param string $intitle_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsIntitle_setsIntitlePropery($input, $intitle_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($intitle_value, $search->getIntitle()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideIntitleSearch() { + return array( + array('intitle:word1', 'word1', null), + array('intitle:word1 word2', 'word1', 'word2'), + array('intitle:"word1 word2"', 'word1 word2', null), + array("intitle:'word1 word2'", 'word1 word2', null), + array('word1 intitle:word2', 'word2', 'word1'), + array('word1 intitle:word2 word3', 'word2', 'word1 word3'), + array('word1 intitle:"word2 word3"', 'word2 word3', 'word1'), + array("word1 intitle:'word2 word3'", 'word2 word3', 'word1'), + array('intitle:word1 intitle:word2', 'word1', 'intitle:word2'), + array('intitle: word1 word2', null, 'word1 word2'), + array('intitle:123', '123', null), + array('intitle:"word1 word2" word3"', 'word1 word2', 'word3"'), + array("intitle:'word1 word2' word3'", 'word1 word2', "word3'"), + array('intitle:"word1 word2\' word3"', "word1 word2' word3", null), + array("intitle:'word1 word2\" word3'", 'word1 word2" word3', null), + ); + } + + /** + * @dataProvider provideAuthorSearch + * @param string $input + * @param string $author_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsAuthor_setsAuthorValue($input, $author_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($author_value, $search->getAuthor()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideAuthorSearch() { + return array( + array('author:word1', 'word1', null), + array('author:word1 word2', 'word1', 'word2'), + array('author:"word1 word2"', 'word1 word2', null), + array("author:'word1 word2'", 'word1 word2', null), + array('word1 author:word2', 'word2', 'word1'), + array('word1 author:word2 word3', 'word2', 'word1 word3'), + array('word1 author:"word2 word3"', 'word2 word3', 'word1'), + array("word1 author:'word2 word3'", 'word2 word3', 'word1'), + array('author:word1 author:word2', 'word1', 'author:word2'), + array('author: word1 word2', null, 'word1 word2'), + array('author:123', '123', null), + array('author:"word1 word2" word3"', 'word1 word2', 'word3"'), + array("author:'word1 word2' word3'", 'word1 word2', "word3'"), + array('author:"word1 word2\' word3"', "word1 word2' word3", null), + array("author:'word1 word2\" word3'", 'word1 word2" word3', null), + ); + } + + /** + * @dataProvider provideInurlSearch + * @param string $input + * @param string $inurl_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsInurl_setsInurlValue($input, $inurl_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($inurl_value, $search->getInurl()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideInurlSearch() { + return array( + array('inurl:word1', 'word1', null), + array('inurl: word1', null, 'word1'), + array('inurl:123', '123', null), + array('inurl:word1 word2', 'word1', 'word2'), + array('inurl:"word1 word2"', '"word1', 'word2"'), + ); + } + + /** + * @dataProvider provideDateSearch + * @param string $input + * @param string $min_date_value + * @param string $max_date_value + */ + public function test__construct_whenInputContainsDate_setsDateValues($input, $min_date_value, $max_date_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($min_date_value, $search->getMinDate()); + $this->assertEquals($max_date_value, $search->getMaxDate()); + } + + /** + * @return array + */ + 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', '1172725200', '1210564799'), + array('date:2007-03-01/', '1172725200', ''), + array('date:/2008-05-11', '', '1210564799'), + ); + } + + /** + * @dataProvider providePubdateSearch + * @param string $input + * @param string $min_pubdate_value + * @param string $max_pubdate_value + */ + public function test__construct_whenInputContainsPubdate_setsPubdateValues($input, $min_pubdate_value, $max_pubdate_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($min_pubdate_value, $search->getMinPubdate()); + $this->assertEquals($max_pubdate_value, $search->getMaxPubdate()); + } + + /** + * @return array + */ + 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', '1172725200', '1210564799'), + array('pubdate:2007-03-01/', '1172725200', ''), + array('pubdate:/2008-05-11', '', '1210564799'), + ); + } + + /** + * @dataProvider provideTagsSearch + * @param string $input + * @param string $tags_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsTags_setsTagsValue($input, $tags_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($tags_value, $search->getTags()); + $this->assertEquals($search_value, $search->getSearch()); + } + + /** + * @return array + */ + public function provideTagsSearch() { + return array( + array('#word1', array('word1'), null), + array('# word1', null, '# word1'), + array('#123', array('123'), null), + array('#word1 word2', array('word1'), 'word2'), + array('#"word1 word2"', array('"word1'), 'word2"'), + array('#word1 #word2', array('word1', 'word2'), null), + ); + } + + /** + * @dataProvider provideMultipleSearch + * @param string $input + * @param string $author_value + * @param string $min_date_value + * @param string $max_date_value + * @param string $intitle_value + * @param string $inurl_value + * @param string $min_pubdate_value + * @param string $max_pubdate_value + * @param array $tags_value + * @param string|null $search_value + */ + public function test__construct_whenInputContainsMultipleKeywords_setsValues($input, $author_value, $min_date_value, $max_date_value, $intitle_value, $inurl_value, $min_pubdate_value, $max_pubdate_value, $tags_value, $search_value) { + $search = new FreshRSS_Search($input); + $this->assertEquals($author_value, $search->getAuthor()); + $this->assertEquals($min_date_value, $search->getMinDate()); + $this->assertEquals($max_date_value, $search->getMaxDate()); + $this->assertEquals($intitle_value, $search->getIntitle()); + $this->assertEquals($inurl_value, $search->getInurl()); + $this->assertEquals($min_pubdate_value, $search->getMinPubdate()); + $this->assertEquals($max_pubdate_value, $search->getMaxPubdate()); + $this->assertEquals($tags_value, $search->getTags()); + $this->assertEquals($search_value, $search->getSearch()); + } + + 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', + 'word1', + '1172725200', + '1210564799', + 'word2', + 'word3', + '1172725200', + '1210564799', + 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', + 'word1', + '1172725200', + '1210564799', + 'word2', + 'word3', + '1172725200', + '1210564799', + array('word4', 'word5'), + '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', + 'word1', + '1172725200', + '1210564799', + 'word2', + 'word3', + '1172725200', + '1210564799', + array('word4', 'word5'), + 'word6 word7', + ), + ); + } + +} -- cgit v1.2.3 From 9cee5c1a17947d3f3d10554844b7089e28cf8500 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 11 Feb 2015 21:52:10 -0500 Subject: Remove code generated by netbeans --- app/Models/Search.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'app') diff --git a/app/Models/Search.php b/app/Models/Search.php index 0475bc685..e64f6cb88 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -5,8 +5,6 @@ * * It allows to extract meaningful bits of the search and store them in a * convenient object - * - * @author alexis */ class FreshRSS_Search { -- cgit v1.2.3 From 9f83aa5fe79618be98cb027bb1070f5a11c51723 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Thu, 12 Feb 2015 21:05:33 -0500 Subject: Refactor the code to make less unnecessaty calls There were multiple calls made to the cleaning method that were unnecessary since it is useful only on the last call. It allows to simplify code by returning values ealier. --- app/Models/Search.php | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'app') diff --git a/app/Models/Search.php b/app/Models/Search.php index e64f6cb88..ef8fc883d 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -32,7 +32,7 @@ class FreshRSS_Search { $input = $this->parsePubdateSearch($input); $input = $this->parseDateSearch($input); $input = $this->parseTagsSeach($input); - $this->search = $input; + $this->search = $this->cleanSearch($input); } public function getRawInput() { @@ -86,12 +86,13 @@ class FreshRSS_Search { private function parseIntitleSearch($input) { if (preg_match('/intitle:(?P[\'"])(?P.*)(?P=delim)/U', $input, $matches)) { $this->intitle = $matches['search']; - $input = str_replace($matches[0], '', $input); - } else if (preg_match('/intitle:(?P\w*)/', $input, $matches)) { + return str_replace($matches[0], '', $input); + } + if (preg_match('/intitle:(?P\w*)/', $input, $matches)) { $this->intitle = $matches['search']; - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } /** @@ -107,12 +108,13 @@ class FreshRSS_Search { private function parseAuthorSearch($input) { if (preg_match('/author:(?P[\'"])(?P.*)(?P=delim)/U', $input, $matches)) { $this->author = $matches['search']; - $input = str_replace($matches[0], '', $input); - } else if (preg_match('/author:(?P\w*)/', $input, $matches)) { + return str_replace($matches[0], '', $input); + } + if (preg_match('/author:(?P\w*)/', $input, $matches)) { $this->author = $matches['search']; - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } /** @@ -126,9 +128,9 @@ class FreshRSS_Search { private function parseInurlSearch($input) { if (preg_match('/inurl:(?P[^\s]*)/', $input, $matches)) { $this->inurl = $matches['search']; - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } /** @@ -142,9 +144,9 @@ class FreshRSS_Search { private function parseDateSearch($input) { if (preg_match('/date:(?P[^\s]*)/', $input, $matches)) { list($this->min_date, $this->max_date) = parseDateInterval($matches['search']); - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } /** @@ -158,9 +160,9 @@ class FreshRSS_Search { private function parsePubdateSearch($input) { if (preg_match('/pubdate:(?P[^\s]*)/', $input, $matches)) { list($this->min_pubdate, $this->max_pubdate) = parseDateInterval($matches['search']); - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } /** @@ -174,11 +176,17 @@ class FreshRSS_Search { private function parseTagsSeach($input) { if (preg_match_all('/#(?P[^\s]+)/', $input, $matches)) { $this->tags = $matches['search']; - $input = str_replace($matches[0], '', $input); + return str_replace($matches[0], '', $input); } - return $this->cleanSearch($input); + return $input; } + /** + * Remove all unnecessary spaces in the search + * + * @param string $input + * @return string + */ private function cleanSearch($input) { $input = preg_replace('/\s+/', ' ', $input); return trim($input); -- cgit v1.2.3 From b8fd3caf8306e8616fcb2f2c0add95b74c2ec024 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 14 Feb 2015 11:00:26 -0500 Subject: Harmonize share configuration view. Before, for shares that don't need options, only a button to remove it was visible. It was source of confusion for users. I changed the look of those shares by using the same layout as others (minus the help). As there is no configuration possible for the url, the field is disabled but it is possible to change the name of the share. See #787 --- app/Models/Share.php | 2 +- app/i18n/de/gen.php | 1 + app/i18n/en/gen.php | 1 + app/i18n/fr/gen.php | 1 + app/views/configure/sharing.phtml | 20 +++++++++++--------- p/scripts/main.js | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) (limited to 'app') diff --git a/app/Models/Share.php b/app/Models/Share.php index db6feda19..2a05f2ee9 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -152,7 +152,7 @@ class FreshRSS_Share { * Return the current name of the share option. */ public function name($real = false) { - if ($real || is_null($this->custom_name)) { + if ($real || is_null($this->custom_name) || empty($this->custom_name)) { return $this->name; } else { return $this->custom_name; diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index f3479ed53..3170b29c2 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -156,6 +156,7 @@ return array( 'damn' => 'Verdammt!', 'default_category' => 'Unkategorisiert', 'no' => 'Nein', + 'not_applicable' => 'N/A', 'ok' => 'OK!', 'or' => 'oder', 'yes' => 'Ja', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 2143822ed..420e73f36 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -156,6 +156,7 @@ return array( 'damn' => 'Damn!', 'default_category' => 'Uncategorized', 'no' => 'No', + 'not_applicable' => 'N/A', 'ok' => 'Ok!', 'or' => 'or', 'yes' => 'Yes', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 1cfec6969..ae946ce0c 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -156,6 +156,7 @@ return array( 'damn' => 'Arf !', 'default_category' => 'Sans catégorie', 'no' => 'Non', + 'not_applicable' => 'N/A', 'ok' => 'Ok !', 'or' => 'ou', 'yes' => 'Oui', diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index da7557480..deb1ed6b7 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -4,7 +4,8 @@
+ data-simple='
+
' data-advanced='
@@ -26,16 +27,17 @@
+
+ formType() === 'advanced') { ?> -
- - - -
- - + - + + + +
+ formType() === 'advanced') { ?> +
diff --git a/p/scripts/main.js b/p/scripts/main.js index 1be75bb12..7fb583d39 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1097,7 +1097,7 @@ function init_share_observers() { $('.share.add').on('click', function(e) { var opt = $(this).siblings('select').find(':selected'); var row = $(this).parents('form').data(opt.data('form')); - row = row.replace('##label##', opt.html(), 'g'); + row = row.replace('##label##', opt.html().trim(), 'g'); row = row.replace('##type##', opt.val(), 'g'); row = row.replace('##help##', opt.data('help'), 'g'); row = row.replace('##key##', shares, 'g'); -- cgit v1.2.3 From 58bf976f6923b5ad9c6e8e57a0daa06ec05462f4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 17 Feb 2015 21:05:28 -0500 Subject: Change translation I change the translation for the 3 languages. German has to be checked since I used Google translate to get the translation. --- app/i18n/de/gen.php | 2 +- app/i18n/en/gen.php | 2 +- app/i18n/fr/gen.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 3170b29c2..1b30a5be4 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -156,7 +156,7 @@ return array( 'damn' => 'Verdammt!', 'default_category' => 'Unkategorisiert', 'no' => 'Nein', - 'not_applicable' => 'N/A', + 'not_applicable' => 'Nicht verfügbar', 'ok' => 'OK!', 'or' => 'oder', 'yes' => 'Ja', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 420e73f36..fdca01a43 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -156,7 +156,7 @@ return array( 'damn' => 'Damn!', 'default_category' => 'Uncategorized', 'no' => 'No', - 'not_applicable' => 'N/A', + 'not_applicable' => 'Not available', 'ok' => 'Ok!', 'or' => 'or', 'yes' => 'Yes', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index ae946ce0c..48fc4a7e9 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -156,7 +156,7 @@ return array( 'damn' => 'Arf !', 'default_category' => 'Sans catégorie', 'no' => 'Non', - 'not_applicable' => 'N/A', + 'not_applicable' => 'Non disponible', 'ok' => 'Ok !', 'or' => 'ou', 'yes' => 'Oui', -- cgit v1.2.3 From f5028d30d047ae50ac2d89a9a66266de086ac718 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 21 Feb 2015 07:53:45 -0500 Subject: Add required library The lib_date.php library was missing in the Search object file. It is required to make date conversion in that object. --- app/Models/Search.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/Models/Search.php b/app/Models/Search.php index ef8fc883d..a22e242af 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -1,5 +1,7 @@ Date: Sat, 21 Feb 2015 09:08:06 -0500 Subject: Use the search object to get values in the search It is now possible to combine multiple keywords to do a search. The separation of concern is better now since the search extraction is not done in the DAO anymore. At the moment, a multiple keyword search is stored as this. It could be nice to have it rendered differently in the search page to make it more readable. At the moment, there is a problem with search enclosed by ". Same search works well when enclosed by '. --- app/Controllers/indexController.php | 2 +- app/Models/Context.php | 2 +- app/Models/EntryDAO.php | 84 +++++++++++++++++-------------------- 3 files changed, 40 insertions(+), 48 deletions(-) (limited to 'app') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index c53d3223e..c1aaca53f 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -173,7 +173,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { FreshRSS_Context::$state |= FreshRSS_Entry::STATE_READ; } - FreshRSS_Context::$search = Minz_Request::param('search', ''); + FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', '')); FreshRSS_Context::$order = Minz_Request::param( 'order', FreshRSS_Context::$user_conf->sort_order ); diff --git a/app/Models/Context.php b/app/Models/Context.php index f00bb1e97..dbdbfaa69 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -30,7 +30,7 @@ class FreshRSS_Context { public static $state = 0; public static $order = 'DESC'; public static $number = 0; - public static $search = ''; + public static $search; public static $first_id = ''; public static $next_id = ''; public static $id_max = ''; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 61beeea13..0cf4e1367 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -441,54 +441,46 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e1.id >= ' . $date_min . '000000 '; } $search = ''; - if ($filter !== '') { - require_once(LIB_PATH . '/lib_date.php'); - $filter = trim($filter); - $filter = addcslashes($filter, '\\%_'); - $terms = array_unique(explode(' ', $filter)); - //sort($terms); //Put #tags first //TODO: Put the cheapest filters first - foreach ($terms as $word) { - $word = trim($word); - if (stripos($word, 'intitle:') === 0) { - $word = substr($word, strlen('intitle:')); - $search .= 'AND e1.title LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'inurl:') === 0) { - $word = substr($word, strlen('inurl:')); - $search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'author:') === 0) { - $word = substr($word, strlen('author:')); - $search .= 'AND e1.author LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif (stripos($word, 'date:') === 0) { - $word = substr($word, strlen('date:')); - list($minDate, $maxDate) = parseDateInterval($word); - if ($minDate) { - $search .= 'AND e1.id >= ' . $minDate . '000000 '; - } - if ($maxDate) { - $search .= 'AND e1.id <= ' . $maxDate . '000000 '; - } - } elseif (stripos($word, 'pubdate:') === 0) { - $word = substr($word, strlen('pubdate:')); - list($minDate, $maxDate) = parseDateInterval($word); - if ($minDate) { - $search .= 'AND e1.date >= ' . $minDate . ' '; - } - if ($maxDate) { - $search .= 'AND e1.date <= ' . $maxDate . ' '; - } - } else { - if ($word[0] === '#' && isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; - $values[] = '%' . $word .'%'; - } else { - $search .= 'AND ' . $this->sqlconcat('e1.title', $this->isCompressed() ? 'UNCOMPRESS(content_bin)' : 'content') . ' LIKE ? '; - $values[] = '%' . $word .'%'; - } + if ($filter instanceof FreshRSS_Search) { + if ($filter->getIntitle()) { + $search .= 'AND e1.title LIKE ? '; + $values[] = "%{$filter->getIntitle()}%"; + } + if ($filter->getInurl()) { + $search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? '; + $values[] = "%{$filter->getInurl()}%"; + } + if ($filter->getAuthor()) { + $search .= 'AND e1.author LIKE ? '; + $values[] = "%{$filter->getAuthor()}%"; + } + if ($filter->getMinDate()) { + $search .= 'AND e1.id >= ? '; + $values[] = "{$filter->getMinDate()}000000"; + } + if ($filter->getMaxDate()) { + $search .= 'AND e1.id <= ?'; + $values[] = "{$filter->getMaxDate()}000000"; + } + if ($filter->getMinPubdate()) { + $search .= 'AND e1.date >= ? '; + $values[] = $filter->getMinPubdate(); + } + if ($filter->getMaxPubdate()) { + $search .= 'AND e1.date <= ? '; + $values[] = $filter->getMaxPubdate(); + } + if ($filter->getTags()) { + $tags = $filter->getTags(); + foreach ($tags as $tag) { + $search .= 'AND e1.tags LIKE ? '; + $values[] = "%{$tag}%"; } } + if ($filter->getSearch()) { + $search .= 'AND ' . $this->sqlconcat('e1.title', $this->isCompressed() ? 'UNCOMPRESS(content_bin)' : 'content') . ' LIKE ? '; + $values[] = "%{$filter->getSearch()}%"; + } } return array($values, -- cgit v1.2.3 From 50b6a02578c29c780e6fe36af712bdc7cfe81d3d Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 21 Feb 2015 09:42:06 -0500 Subject: Add search default raw value Before, the default value was undefined. Now it always has a value even when no value is provided. --- app/Models/Search.php | 2 +- tests/app/Models/SearchTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Models/Search.php b/app/Models/Search.php index a22e242af..85340ff13 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -11,7 +11,7 @@ require_once(LIB_PATH . '/lib_date.php'); class FreshRSS_Search { // This contains the user input string - private $raw_input; + private $raw_input = ''; // The following properties are extracted from the raw input private $intitle; private $min_date; diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 20ea09433..9e3ca6765 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -10,7 +10,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase { */ public function test__construct_whenInputIsEmpty_getsOnlyNullValues($input) { $search = new FreshRSS_Search($input); - $this->assertNull($search->getRawInput()); + $this->assertEquals('', $search->getRawInput()); $this->assertNull($search->getIntitle()); $this->assertNull($search->getMinDate()); $this->assertNull($search->getMaxDate()); -- cgit v1.2.3 From 74c020edc846d0afdecb05ae1e1f30a516dee002 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 21 Feb 2015 09:44:02 -0500 Subject: Add a default string representation In some part of the code, the search is displayed as is and crash since there is no way to display the search object as a string. --- app/Models/Search.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app') diff --git a/app/Models/Search.php b/app/Models/Search.php index 85340ff13..84688be2e 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -36,6 +36,10 @@ class FreshRSS_Search { $input = $this->parseTagsSeach($input); $this->search = $this->cleanSearch($input); } + + public function __toString() { + return $this->getRawInput(); + } public function getRawInput() { return $this->raw_input; -- cgit v1.2.3 From e897afa7ccb2c625705bce25c003d9cf37179227 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 22 Feb 2015 17:38:33 -0500 Subject: Change test to verify if there is a filter --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 0cf4e1367..d2a8e0fd9 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -441,7 +441,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $where .= 'AND e1.id >= ' . $date_min . '000000 '; } $search = ''; - if ($filter instanceof FreshRSS_Search) { + if ($filter !== null) { if ($filter->getIntitle()) { $search .= 'AND e1.title LIKE ? '; $values[] = "%{$filter->getIntitle()}%"; -- cgit v1.2.3 From fe24636e0416df4bb3507a0ac8cfe7e27d5b4c90 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 2 Mar 2015 20:27:15 -0500 Subject: Add missing white space --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index d2a8e0fd9..cf75a02c9 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -459,7 +459,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $values[] = "{$filter->getMinDate()}000000"; } if ($filter->getMaxDate()) { - $search .= 'AND e1.id <= ?'; + $search .= 'AND e1.id <= ? '; $values[] = "{$filter->getMaxDate()}000000"; } if ($filter->getMinPubdate()) { -- cgit v1.2.3 From aacd1ffd4052b04c724c2783b3ee2845ca4ada35 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 4 Mar 2015 23:32:20 -0500 Subject: Refactor exceptions I removed unnecessary constructors and unnecessary inheritance --- app/Exceptions/BadUrlException.php | 5 ++++- app/Exceptions/ContextException.php | 6 ++---- app/Exceptions/EntriesGetterException.php | 6 ++---- app/Exceptions/FeedException.php | 7 +++---- 4 files changed, 11 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php index 59574e1e5..406efb9b3 100644 --- a/app/Exceptions/BadUrlException.php +++ b/app/Exceptions/BadUrlException.php @@ -1,6 +1,9 @@ Date: Thu, 5 Mar 2015 06:51:16 -0500 Subject: Revert inheritance As I do not have the time at the moment to verify the change of inheritance, I changed it back to the original. --- app/Exceptions/BadUrlException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php index 406efb9b3..d2509e4ba 100644 --- a/app/Exceptions/BadUrlException.php +++ b/app/Exceptions/BadUrlException.php @@ -1,6 +1,6 @@ Date: Sun, 1 Mar 2015 09:18:06 -0500 Subject: Introduce user queries objects There is now an object to manipulate user queries. It allows to move logic to handle those from the view and the controller in the model. Thus making the view and the controller easier to read. I introduced a new interface to start using dependency injection. There is still some rough edges but we are moving in the right direction. The new object is fully tested but it still need some improvements, for instance, it is still tied to the search object. There might be a better way to do that. --- app/Controllers/configureController.php | 83 +++--------- app/Exceptions/DAOException.php | 5 + app/Models/CategoryDAO.php | 2 +- app/Models/ConfigurationSetter.php | 7 +- app/Models/EntryDAO.php | 2 +- app/Models/FeedDAO.php | 2 +- app/Models/Searchable.php | 6 + app/Models/UserQuery.php | 226 +++++++++++++++++++++++++++++++ app/views/configure/queries.phtml | 47 +++---- tests/app/Models/UserQueryTest.php | 229 ++++++++++++++++++++++++++++++++ 10 files changed, 505 insertions(+), 104 deletions(-) create mode 100644 app/Exceptions/DAOException.php create mode 100644 app/Models/Searchable.php create mode 100644 app/Models/UserQuery.php create mode 100644 tests/app/Models/UserQueryTest.php (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 38ccd2b2d..fc92aa0c2 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -241,13 +241,16 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * checking if categories and feeds are still in use. */ public function queriesAction() { + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); if (Minz_Request::isPost()) { - $queries = Minz_Request::param('queries', array()); + $params = Minz_Request::param('queries', array()); - foreach ($queries as $key => $query) { + foreach ($params as $key => $query) { if (!$query['name']) { $query['name'] = _t('conf.query.number', $key + 1); } + $queries[] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); @@ -255,62 +258,9 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.updated'), array('c' => 'configure', 'a' => 'queries')); } else { - $this->view->query_get = array(); - $cat_dao = new FreshRSS_CategoryDAO(); - $feed_dao = FreshRSS_Factory::createFeedDao(); + $this->view->queries = array(); foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { - if (!isset($query['get'])) { - continue; - } - - switch ($query['get'][0]) { - case 'c': - $category = $cat_dao->searchById(substr($query['get'], 2)); - - $deprecated = true; - $cat_name = ''; - if ($category) { - $cat_name = $category->name(); - $deprecated = false; - } - - $this->view->query_get[$key] = array( - 'type' => 'category', - 'name' => $cat_name, - 'deprecated' => $deprecated, - ); - break; - case 'f': - $feed = $feed_dao->searchById(substr($query['get'], 2)); - - $deprecated = true; - $feed_name = ''; - if ($feed) { - $feed_name = $feed->name(); - $deprecated = false; - } - - $this->view->query_get[$key] = array( - 'type' => 'feed', - 'name' => $feed_name, - 'deprecated' => $deprecated, - ); - break; - case 's': - $this->view->query_get[$key] = array( - 'type' => 'favorite', - 'name' => 'favorite', - 'deprecated' => false, - ); - break; - case 'a': - $this->view->query_get[$key] = array( - 'type' => 'all', - 'name' => 'all', - 'deprecated' => false, - ); - break; - } + $this->view->queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } } @@ -325,16 +275,17 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * lean data. */ public function addQueryAction() { - $whitelist = array('get', 'order', 'name', 'search', 'state'); - $queries = FreshRSS_Context::$user_conf->queries; - $query = Minz_Request::params(); - $query['name'] = _t('conf.query.number', count($queries) + 1); - foreach ($query as $key => $value) { - if (!in_array($key, $whitelist)) { - unset($query[$key]); - } + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); + $queries = array(); + foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { + $queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } - $queries[] = $query; + $params = Minz_Request::params(); + $params['url'] = Minz_Url::display(array('params' => $params)); + $params['name'] = _t('conf.query.number', count($queries) + 1); + $queries[] = new FreshRSS_UserQuery($params, $feed_dao, $category_dao); + FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php new file mode 100644 index 000000000..6bd8f4ff0 --- /dev/null +++ b/app/Exceptions/DAOException.php @@ -0,0 +1,5 @@ +prefix . 'category`(name) VALUES(?)'; $stm = $this->bd->prepare($sql); diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index eeb1f2f4c..d7689752f 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -117,12 +117,7 @@ class FreshRSS_ConfigurationSetter { private function _queries(&$data, $values) { $data['queries'] = array(); foreach ($values as $value) { - $value = array_filter($value); - $params = $value; - unset($params['name']); - unset($params['url']); - $value['url'] = Minz_Url::display(array('params' => $params)); - $data['queries'][] = $value; + $data['queries'][] = $value->toArray(); } } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index cf75a02c9..b8a1a43b0 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1,6 +1,6 @@ prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history, ttl) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)'; $stm = $this->bd->prepare($sql); diff --git a/app/Models/Searchable.php b/app/Models/Searchable.php new file mode 100644 index 000000000..d5bcea49d --- /dev/null +++ b/app/Models/Searchable.php @@ -0,0 +1,6 @@ +category_dao = $category_dao; + $this->feed_dao = $feed_dao; + if (isset($query['get'])) { + $this->parseGet($query['get']); + } + if (isset($query['name'])) { + $this->name = $query['name']; + } + if (isset($query['order'])) { + $this->order = $query['order']; + } + if (!isset($query['search'])) { + $query['search'] = ''; + } + // linked to deeply with the search object, need to use dependency injection + $this->search = new FreshRSS_Search($query['search']); + if (isset($query['state'])) { + $this->state = $query['state']; + } + if (isset($query['url'])) { + $this->url = $query['url']; + } + } + + /** + * Convert the current object to an array. + * + * @return array + */ + public function toArray() { + return array_filter(array( + 'get' => $this->get, + 'name' => $this->name, + 'order' => $this->order, + 'search' => $this->search->__toString(), + 'state' => $this->state, + 'url' => $this->url, + )); + } + + /** + * Parse the get parameter in the query string to extract its name and + * type + * + * @param string $get + */ + private function parseGet($get) { + $this->get = $get; + if (preg_match('/(?P[acfs])(_(?P\d+))?/', $get, $matches)) { + switch ($matches['type']) { + case 'a': + $this->parseAll(); + break; + case 'c': + $this->parseCategory($matches['id']); + break; + case 'f': + $this->parseFeed($matches['id']); + break; + case 's': + $this->parseFavorite(); + break; + } + } + } + + /** + * Parse the query string when it is an "all" query + */ + private function parseAll() { + $this->get_name = 'all'; + $this->get_type = 'all'; + } + + /** + * Parse the query string when it is a "category" query + * + * @param integer $id + * @throws FreshRSS_DAOException + */ + private function parseCategory($id) { + if (is_null($this->category_dao)) { + throw new FreshRSS_DAOException('Category DAO is not loaded i UserQuery'); + } + $category = $this->category_dao->searchById($id); + if ($category) { + $this->get_name = $category->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'category'; + } + + /** + * Parse the query string when it is a "feed" query + * + * @param integer $id + * @throws FreshRSS_DAOException + */ + private function parseFeed($id) { + if (is_null($this->feed_dao)) { + throw new FreshRSS_DAOException('Feed DAO is not loaded i UserQuery'); + } + $feed = $this->feed_dao->searchById($id); + if ($feed) { + $this->get_name = $feed->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'feed'; + } + + /** + * Parse the query string when it is a "favorite" query + */ + private function parseFavorite() { + $this->get_name = 'favorite'; + $this->get_type = 'favorite'; + } + + /** + * Check if the current user query is deprecated. + * It is deprecated if the category or the feed used in the query are + * not existing. + * + * @return boolean + */ + public function isDeprecated() { + return $this->deprecated; + } + + /** + * Check if the user query has parameters. + * If the type is 'all', it is considered equal to no parameters + * + * @return boolean + */ + public function hasParameters() { + if ($this->get_type === 'all') { + return false; + } + if ($this->hasSearch()) { + return true; + } + if ($this->state) { + return true; + } + if ($this->order) { + return true; + } + if ($this->get) { + return true; + } + return false; + } + + /** + * Check if there is a search in the search object + * + * @return boolean + */ + public function hasSearch() { + return $this->search->getRawInput() != ""; + } + + public function getGet() { + return $this->get; + } + + public function getGetName() { + return $this->get_name; + } + + public function getGetType() { + return $this->get_type; + } + + public function getName() { + return $this->name; + } + + public function getOrder() { + return $this->order; + } + + public function getSearch() { + return $this->search; + } + + public function getState() { + return $this->state; + } + + public function getUrl() { + return $this->url; + } + +} diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index 5f449deb3..69efcf365 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -6,27 +6,28 @@ - queries as $key => $query) { ?> + queries as $key => $query) { ?>
- "/> - "/> - "/> - "/> + + + + +
- + @@ -35,23 +36,11 @@
- query_get[$key]) && - $this->query_get[$key]['deprecated']); - ?> - - + hasParameters()) { ?>
- + isDeprecated()) { ?>
@@ -60,20 +49,20 @@
    - -
  • + hasSearch()) { ?> +
  • getSearch()->getRawInput()); ?>
  • - -
  • + getState()) { ?> +
  • getState()); ?>
  • - -
  • + getOrder()) { ?> +
  • getOrder())); ?>
  • - -
  • query_get[$key]['type'], $this->query_get[$key]['name']); ?>
  • + getGet()) { ?> +
  • getGetType(), $query->getGetName()); ?>
diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php new file mode 100644 index 000000000..2234be6e1 --- /dev/null +++ b/tests/app/Models/UserQueryTest.php @@ -0,0 +1,229 @@ + 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals('all', $user_query->getGetName()); + $this->assertEquals('all', $user_query->getGetType()); + } + + public function test__construct_whenFavoriteQuery_storesFavoriteParameters() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals('favorite', $user_query->getGetName()); + $this->assertEquals('favorite', $user_query->getGetType()); + } + + /** + * @expectedException Exceptions/FreshRSS_DAOException + * @expectedExceptionMessage Category DAO is not loaded in UserQuery + */ + public function test__construct_whenCategoryQueryAndNoDao_throwsException() { + $this->markTestIncomplete('There is a problem with the exception autoloading. We need to make a better autoloading process'); + $query = array('get' => 'c_1'); + new FreshRSS_UserQuery($query); + } + + public function test__construct_whenCategoryQuery_storesCategoryParameters() { + $category_name = 'some category name'; + $cat = $this->getMock('FreshRSS_Category'); + $cat->expects($this->atLeastOnce()) + ->method('name') + ->withAnyParameters() + ->willReturn($category_name); + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->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()); + $this->assertEquals('category', $user_query->getGetType()); + } + + /** + * @expectedException Exceptions/FreshRSS_DAOException + * @expectedExceptionMessage Feed DAO is not loaded in UserQuery + */ + public function test__construct_whenFeedQueryAndNoDao_throwsException() { + $this->markTestIncomplete('There is a problem with the exception autoloading. We need to make a better autoloading process'); + $query = array('get' => 'c_1'); + new FreshRSS_UserQuery($query); + } + + public function test__construct_whenFeedQuery_storesFeedParameters() { + $feed_name = 'some feed name'; + $feed = $this->getMock('FreshRSS_Feed', array(), array('', false)); + $feed->expects($this->atLeastOnce()) + ->method('name') + ->withAnyParameters() + ->willReturn($feed_name); + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->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()); + $this->assertEquals('feed', $user_query->getGetType()); + } + + public function test__construct_whenUnknownQuery_doesStoreParameters() { + $query = array('get' => 'q'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertNull($user_query->getGetName()); + $this->assertNull($user_query->getGetType()); + } + + public function test__construct_whenName_storesName() { + $name = 'some name'; + $query = array('name' => $name); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($name, $user_query->getName()); + } + + public function test__construct_whenOrder_storesOrder() { + $order = 'some order'; + $query = array('order' => $order); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($order, $user_query->getOrder()); + } + + public function test__construct_whenState_storesState() { + $state = 'some state'; + $query = array('state' => $state); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($state, $user_query->getState()); + } + + public function test__construct_whenUrl_storesUrl() { + $url = 'some url'; + $query = array('url' => $url); + $user_query = new FreshRSS_UserQuery($query); + $this->assertEquals($url, $user_query->getUrl()); + } + + public function testToArray_whenNoData_returnsEmptyArray() { + $user_query = new FreshRSS_UserQuery(array()); + $this->assertInternalType('array', $user_query->toArray()); + $this->assertCount(0, $user_query->toArray()); + } + + public function testToArray_whenData_returnsArray() { + $query = array( + '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()); + $this->assertCount(6, $user_query->toArray()); + $this->assertEquals($query, $user_query->toArray()); + } + + public function testHasSearch_whenSearch_returnsTrue() { + $query = array( + 'search' => 'some search', + ); + $user_query = new FreshRSS_UserQuery($query); + $this->assertTrue($user_query->hasSearch()); + } + + public function testHasSearch_whenNoSearch_returnsFalse() { + $user_query = new FreshRSS_UserQuery(array()); + $this->assertFalse($user_query->hasSearch()); + } + + public function testHasParameters_whenAllQuery_returnsFalse() { + $query = array('get' => 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->hasParameters()); + } + + public function testHasParameters_whenNoParameter_returnsFalse() { + $query = array(); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->hasParameters()); + } + + public function testHasParameters_whenParameter_returnTrue() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertTrue($user_query->hasParameters()); + } + + public function testIsDeprecated_whenCategoryExists_returnFalse() { + $cat = $this->getMock('FreshRSS_Category'); + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($cat); + $query = array('get' => 'c_1'); + $user_query = new FreshRSS_UserQuery($query, null, $cat_dao); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenCategoryDoesNotExist_returnTrue() { + $cat_dao = $this->getMock('FreshRSS_Searchable'); + $cat_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn(null); + $query = array('get' => 'c_1'); + $user_query = new FreshRSS_UserQuery($query, null, $cat_dao); + $this->assertTrue($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFeedExists_returnFalse() { + $feed = $this->getMock('FreshRSS_Feed', array(), array('', false)); + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn($feed); + $query = array('get' => 'f_1'); + $user_query = new FreshRSS_UserQuery($query, $feed_dao, null); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFeedDoesNotExist_returnTrue() { + $feed_dao = $this->getMock('FreshRSS_Searchable'); + $feed_dao->expects($this->atLeastOnce()) + ->method('searchById') + ->withAnyParameters() + ->willReturn(null); + $query = array('get' => 'f_1'); + $user_query = new FreshRSS_UserQuery($query, $feed_dao, null); + $this->assertTrue($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenAllQuery_returnFalse() { + $query = array('get' => 'a'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenFavoriteQuery_returnFalse() { + $query = array('get' => 's'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + + public function testIsDeprecated_whenUnknownQuery_returnFalse() { + $query = array('get' => 'q'); + $user_query = new FreshRSS_UserQuery($query); + $this->assertFalse($user_query->isDeprecated()); + } + +} -- cgit v1.2.3 From 96d5d9d034daadb2357f27b3763854b647f2086c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Thu, 5 Mar 2015 06:45:00 -0500 Subject: Fix DAO exception Change the name and messages --- app/Exceptions/DAOException.php | 2 +- app/Models/UserQuery.php | 8 ++++---- tests/app/Models/UserQueryTest.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php index 6bd8f4ff0..e48e521ab 100644 --- a/app/Exceptions/DAOException.php +++ b/app/Exceptions/DAOException.php @@ -1,5 +1,5 @@ category_dao)) { - throw new FreshRSS_DAOException('Category DAO is not loaded i UserQuery'); + throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery'); } $category = $this->category_dao->searchById($id); if ($category) { @@ -123,11 +123,11 @@ class FreshRSS_UserQuery { * Parse the query string when it is a "feed" query * * @param integer $id - * @throws FreshRSS_DAOException + * @throws FreshRSS_DAO_Exception */ private function parseFeed($id) { if (is_null($this->feed_dao)) { - throw new FreshRSS_DAOException('Feed DAO is not loaded i UserQuery'); + throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery'); } $feed = $this->feed_dao->searchById($id); if ($feed) { diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php index 2234be6e1..a0928d5ae 100644 --- a/tests/app/Models/UserQueryTest.php +++ b/tests/app/Models/UserQueryTest.php @@ -20,7 +20,7 @@ class UserQueryTest extends \PHPUnit_Framework_TestCase { } /** - * @expectedException Exceptions/FreshRSS_DAOException + * @expectedException Exceptions/FreshRSS_DAO_Exception * @expectedExceptionMessage Category DAO is not loaded in UserQuery */ public function test__construct_whenCategoryQueryAndNoDao_throwsException() { @@ -48,7 +48,7 @@ class UserQueryTest extends \PHPUnit_Framework_TestCase { } /** - * @expectedException Exceptions/FreshRSS_DAOException + * @expectedException Exceptions/FreshRSS_DAO_Exception * @expectedExceptionMessage Feed DAO is not loaded in UserQuery */ public function test__construct_whenFeedQueryAndNoDao_throwsException() { -- cgit v1.2.3 From 24f6c1eabb4cea941e40307c2f732c0ca384ffd2 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Thu, 5 Mar 2015 06:47:13 -0500 Subject: Fix spacing --- app/Models/CategoryDAO.php | 2 +- app/Models/EntryDAO.php | 2 +- app/Models/FeedDAO.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 4eee226ba..189a5f0e4 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -1,6 +1,6 @@ prefix . 'category`(name) VALUES(?)'; $stm = $this->bd->prepare($sql); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index b8a1a43b0..9736d5cd3 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1,6 +1,6 @@ prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history, ttl) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)'; $stm = $this->bd->prepare($sql); -- cgit v1.2.3 From dd4fb519be801254a8aa9baedb2a7f87dd608f2b Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 14 Mar 2015 09:43:08 -0400 Subject: Add an unsaved changes alert on config pages Before, you could leave a configuration page without knowing if you saved your changes or not. Now, there is an alert poping up if you have unsaved changes. It will ask you if you want to stay on the page and save your changes or leave the page and loose your changes. See #739 --- app/views/auth/index.phtml | 12 ++++++------ app/views/configure/archiving.phtml | 6 +++--- app/views/configure/display.phtml | 28 ++++++++++++++-------------- app/views/configure/queries.phtml | 1 + app/views/configure/reading.phtml | 34 +++++++++++++++++----------------- app/views/configure/sharing.phtml | 4 ++-- app/views/configure/shortcut.phtml | 28 ++++++++++++++-------------- p/scripts/main.js | 28 ++++++++++++++++++++++++++++ 8 files changed, 85 insertions(+), 56 deletions(-) (limited to 'app') diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index f7a862ac9..8e4df8c2c 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -9,7 +9,7 @@
- auth_type, array('form', 'persona', 'http_auth', 'none'))) { ?> @@ -25,7 +25,7 @@
@@ -35,7 +35,7 @@
@@ -45,7 +45,7 @@
@@ -58,7 +58,7 @@ token; ?>
/> + echo FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation=""/> array('output' => 'rss', 'token' => $token)), 'html', true); ?>
@@ -69,7 +69,7 @@
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 875463137..52ee98a48 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -10,14 +10,14 @@
- +  
- ttl_default; ?>"> '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 02249bc55..91b0b8189 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -9,7 +9,7 @@
- @@ -24,7 +24,7 @@
    themes); $i = 1; ?> themes as $theme) { ?> - theme === $theme['id']) {echo "checked";}?> value=""/> + theme === $theme['id']) {echo "checked";}?> value="" data-leave-validation="theme === $theme['id']) ? 1 : 0; ?>"/>
  • @@ -53,7 +53,7 @@
    - @@ -87,20 +87,20 @@ - topline_read ? ' checked="checked"' : ''; ?> /> - topline_favorite ? ' checked="checked"' : ''; ?> /> + topline_read ? ' checked="checked"' : ''; ?> data-leave-validation="topline_read; ?>"/> + topline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="topline_favorite; ?>"/> - topline_date ? ' checked="checked"' : ''; ?> /> - topline_link ? ' checked="checked"' : ''; ?> /> + topline_date ? ' checked="checked"' : ''; ?> data-leave-validation="topline_date; ?>"/> + topline_link ? ' checked="checked"' : ''; ?> data-leave-validation="topline_link; ?>"/> - bottomline_read ? ' checked="checked"' : ''; ?> /> - bottomline_favorite ? ' checked="checked"' : ''; ?> /> - bottomline_sharing ? ' checked="checked"' : ''; ?> /> - bottomline_tags ? ' checked="checked"' : ''; ?> /> - bottomline_date ? ' checked="checked"' : ''; ?> /> - bottomline_link ? ' checked="checked"' : ''; ?> /> + bottomline_read ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_read; ?>"/> + bottomline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_favorite; ?>"/> + bottomline_sharing ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_sharing; ?>"/> + bottomline_tags ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_tags; ?>"/> + bottomline_date ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_date; ?>"/> + bottomline_link ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_link; ?>"/>
    @@ -109,7 +109,7 @@
    - +
    diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index 69efcf365..50df4cfea 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -25,6 +25,7 @@ id="queries__name" name="queries[][name]" value="getName(); ?>" + data-leave-validation="getName(); ?>" /> diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 636671f14..8b123afa8 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -9,7 +9,7 @@
    - +
    @@ -17,7 +17,7 @@
    - @@ -27,7 +27,7 @@
    - @@ -38,7 +38,7 @@
    - @@ -49,7 +49,7 @@
    @@ -58,7 +58,7 @@
    @@ -68,7 +68,7 @@
    @@ -78,7 +78,7 @@
    @@ -88,7 +88,7 @@
    @@ -98,7 +98,7 @@
    @@ -108,7 +108,7 @@
    @@ -118,7 +118,7 @@
    @@ -129,19 +129,19 @@
    @@ -151,7 +151,7 @@
    diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index deb1ed6b7..7bf435777 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -28,9 +28,9 @@
    - + formType() === 'advanced') { ?> - + diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index f68091af9..264a5f805 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -23,28 +23,28 @@
    - +
    - +
    - +
    - +
    @@ -53,7 +53,7 @@
    - +
    @@ -61,21 +61,21 @@
    - +
    - +
    - +
    @@ -83,7 +83,7 @@
    - +
    @@ -92,21 +92,21 @@
    - +
    - +
    - +
    @@ -114,14 +114,14 @@
    - +
    - +
    diff --git a/p/scripts/main.js b/p/scripts/main.js index b7c143cc1..eaf6067f7 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1229,6 +1229,33 @@ function init_slider_observers() { }); } +function init_configuration_alert() { + $(window).on('beforeunload', function(e){ + if (e.originalEvent.explicitOriginalTarget.type === 'submit') { + // we don't want an alert when submitting the form with the submit button + return; + } + if ($(e.originalEvent.explicitOriginalTarget).attr('data-leave-validation') !== undefined) { + // we don't want an alert when submitting the form by pressing the enter key + return; + } + var fields = $("[data-leave-validation]"); + for (var i = 0; i < fields.length; i++) { + if ($(fields[i]).attr('type') === 'checkbox' || $(fields[i]).attr('type') === 'radio') { + // The use of != is done on purpose to check boolean against integer + if ($(fields[i]).is(':checked') != $(fields[i]).attr('data-leave-validation')) { + return false; + } + } else { + if ($(fields[i]).attr('data-leave-validation') !== $(fields[i]).val()) { + return false; + } + } + } + return; + }); +} + function init_all() { if (!(window.$ && window.context)) { if (window.console) { @@ -1260,6 +1287,7 @@ function init_all() { init_password_observers(); init_stats_observers(); init_slider_observers(); + init_configuration_alert(); } if (window.console) { -- cgit v1.2.3 From 1a35e2271d3b9383e882371d37d5fef16abd745d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 21 Mar 2015 18:20:36 +0100 Subject: SimplePie option to restaure syslog of HTTP requests https://github.com/FreshRSS/FreshRSS/issues/711 --- app/Models/Feed.php | 4 ++-- data/config.default.php | 1 + lib/SimplePie/SimplePie.php | 41 ++++++++++++++++++++++++++++++++++------ lib/SimplePie/SimplePie/File.php | 7 +++++-- lib/lib_rss.php | 1 + 5 files changed, 44 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5ce03be5d..5f67ea6ce 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -246,10 +246,10 @@ class FreshRSS_Feed extends Minz_Model { } if (($mtime === true) ||($mtime > $this->lastUpdate)) { - Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); + //Minz_Log::debug('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); $this->loadEntries($feed); // et on charge les articles du flux } else { - Minz_Log::notice('FreshRSS use cache for ' . $clean_url); + //Minz_Log::debug('FreshRSS use cache for ' . $clean_url); $this->entries = array(); } diff --git a/data/config.default.php b/data/config.default.php index 97df3a299..839bd1687 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -12,6 +12,7 @@ return array( 'auth_type' => 'none', 'api_enabled' => false, 'unsafe_autologin_enabled' => false, + 'simplepie_syslog_enabled' => true, 'limits' => array( 'cache_duration' => 800, 'timeout' => 10, diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index c4872b5be..bb8ce4191 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -74,6 +74,12 @@ define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed */ define('SIMPLEPIE_LINKBACK', '' . SIMPLEPIE_NAME . ''); +/** + * Use syslog to report HTTP requests done by SimplePie. + * @see SimplePie::set_syslog() + */ +define('SIMPLEPIE_SYSLOG', true); //FreshRSS + /** * No Autodiscovery * @see SimplePie::set_autodiscovery_level() @@ -622,6 +628,12 @@ class SimplePie */ public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + /** + * Use syslog to report HTTP requests done by SimplePie. + * @see SimplePie::set_syslog() + */ + public $syslog_enabled = SIMPLEPIE_SYSLOG; + /** * The SimplePie class contains feed level data and options * @@ -1136,7 +1148,7 @@ class SimplePie $this->sanitize->strip_attributes($attribs); } - public function add_attributes($attribs = '') + public function add_attributes($attribs = '') //FreshRSS { if ($attribs === '') { @@ -1145,6 +1157,14 @@ class SimplePie $this->sanitize->add_attributes($attribs); } + /** + * Use syslog to report HTTP requests done by SimplePie. + */ + public function set_syslog($value = SIMPLEPIE_SYSLOG) //FreshRSS + { + $this->syslog_enabled = $value == true; + } + /** * Set the output encoding * @@ -1231,7 +1251,8 @@ class SimplePie $this->enable_exceptions = $enable; } - function cleanMd5($rss) { //FreshRSS + function cleanMd5($rss) //FreshRSS + { return md5(preg_replace(array('#<(lastBuildDate|pubDate|updated|feedDate|dc:date|slash:comments)>[^<]+#', '##s'), '', $rss)); } @@ -1329,7 +1350,8 @@ class SimplePie list($headers, $sniffed) = $fetched; - if (isset($this->data['md5'])) { //FreshRSS + if (isset($this->data['md5'])) //FreshRSS + { $md5 = $this->data['md5']; } } @@ -1455,7 +1477,8 @@ class SimplePie { // Load the Cache $this->data = $cache->load(); - if ($cache->mtime() + $this->cache_duration > time()) { //FreshRSS + if ($cache->mtime() + $this->cache_duration > time()) //FreshRSS + { $this->raw_data = false; return true; // If the cache is still valid, just return true } @@ -1529,11 +1552,17 @@ class SimplePie { //FreshRSS $md5 = $this->cleanMd5($file->body); if ($this->data['md5'] === $md5) { - // syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); + if ($this->syslog_enabled) + { + syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); + } $cache->touch(); return true; //Content unchanged even though server did not send a 304 } else { - // syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); + if ($this->syslog_enabled) + { + syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); + } $this->data['md5'] = $md5; } } diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php index 9625af2a9..56fe72196 100644 --- a/lib/SimplePie/SimplePie/File.php +++ b/lib/SimplePie/SimplePie/File.php @@ -66,7 +66,7 @@ class SimplePie_File var $method = SIMPLEPIE_FILE_SOURCE_NONE; var $permanent_url; //FreshRSS - public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) + public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $syslog_enabled = SIMPLEPIE_SYSLOG) { if (class_exists('idna_convert')) { @@ -79,7 +79,10 @@ class SimplePie_File $this->useragent = $useragent; if (preg_match('/^http(s)?:\/\//i', $url)) { - // syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS + if ($syslog_enabled) + { + syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS + } if ($useragent === null) { $useragent = ini_get('user_agent'); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index e5fe73041..16ae3097f 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -123,6 +123,7 @@ function customSimplePie() { $limits = $system_conf->limits; $simplePie = new SimplePie(); $simplePie->set_useragent(_t('gen.freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); + $simplePie->set_syslog($system_conf->simplepie_syslog_enabled); $simplePie->set_cache_location(CACHE_PATH); $simplePie->set_cache_duration($limits['cache_duration']); $simplePie->set_timeout($limits['timeout']); -- cgit v1.2.3 From ad9fe52f5a76faf58d13fcf7bde8f58e85abe82b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Mar 2015 22:54:29 +0100 Subject: SimplePie sanitize URLs for syslog https://github.com/FreshRSS/FreshRSS/issues/711 https://github.com/FreshRSS/FreshRSS/pull/715 --- app/Models/Feed.php | 2 +- lib/SimplePie/SimplePie.php | 4 ++-- lib/SimplePie/SimplePie/File.php | 2 +- lib/SimplePie/SimplePie/Misc.php | 10 ++++++++++ lib/lib_rss.php | 12 +----------- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'app') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5f67ea6ce..15cbb7d0a 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -240,7 +240,7 @@ class FreshRSS_Feed extends Minz_Model { $subscribe_url = $feed->subscribe_url(true); } - $clean_url = url_remove_credentials($subscribe_url); + $clean_url = SimplePie_Misc::url_remove_credentials($subscribe_url); if ($subscribe_url !== null && $subscribe_url !== $url) { $this->_url($clean_url); } diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index bb8ce4191..54f4c5770 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1554,14 +1554,14 @@ class SimplePie if ($this->data['md5'] === $md5) { if ($this->syslog_enabled) { - syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url); + syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url)); } $cache->touch(); return true; //Content unchanged even though server did not send a 304 } else { if ($this->syslog_enabled) { - syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url); + syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url)); } $this->data['md5'] = $md5; } diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php index 56fe72196..1f9e3d502 100644 --- a/lib/SimplePie/SimplePie/File.php +++ b/lib/SimplePie/SimplePie/File.php @@ -81,7 +81,7 @@ class SimplePie_File { if ($syslog_enabled) { - syslog(LOG_INFO, 'SimplePie GET ' . $url); //FreshRSS + syslog(LOG_INFO, 'SimplePie GET ' . SimplePie_Misc::url_remove_credentials($url)); //FreshRSS } if ($useragent === null) { diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php index 5a263a2e5..de50d37b8 100644 --- a/lib/SimplePie/SimplePie/Misc.php +++ b/lib/SimplePie/SimplePie/Misc.php @@ -2240,5 +2240,15 @@ function embed_wmedia(width, height, link) { { // No-op } + + /** + * Sanitize a URL by removing HTTP credentials. + * @param $url the URL to sanitize. + * @return the same URL without HTTP credentials. + */ + function url_remove_credentials($url) //FreshRSS + { + return preg_replace('#(?<=//)[^/:@]+:[^/:@]+@#', '', $url); + } } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 16ae3097f..65a1a8e04 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -181,7 +181,7 @@ function sanitizeHTML($data, $base = '') { function get_content_by_parsing ($url, $path) { require_once (LIB_PATH . '/lib_phpQuery.php'); - Minz_Log::notice('FreshRSS GET ' . url_remove_credentials($url)); + Minz_Log::notice('FreshRSS GET ' . SimplePie_Misc::url_remove_credentials($url)); $html = file_get_contents ($url); if ($html) { @@ -430,13 +430,3 @@ function array_push_unique(&$array, $value) { function array_remove(&$array, $value) { $array = array_diff($array, array($value)); } - - -/** - * Sanitize a URL by removing HTTP credentials. - * @param $url the URL to sanitize. - * @return the same URL without HTTP credentials. - */ -function url_remove_credentials($url) { - return preg_replace('/[^\/]*:[^:]*@/', '', $url); -} -- cgit v1.2.3 From 239a010ef23127429698b6be5f4a5453b0bfbad7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 24 Mar 2015 22:45:27 +0100 Subject: Error when deleting a feed https://github.com/FreshRSS/FreshRSS/issues/816 --- app/Models/ConfigurationSetter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index d7689752f..978cc8cb9 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -117,7 +117,9 @@ class FreshRSS_ConfigurationSetter { private function _queries(&$data, $values) { $data['queries'] = array(); foreach ($values as $value) { - $data['queries'][] = $value->toArray(); + if ($value != null) { + $data['queries'][] = $value->toArray(); + } } } -- cgit v1.2.3 From d7706b66f586b36e44e471b5c06526de258af8b8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 24 Mar 2015 22:51:51 +0100 Subject: Error when deleting a feed, wrong object https://github.com/FreshRSS/FreshRSS/issues/816 --- app/Models/ConfigurationSetter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 978cc8cb9..7f433239c 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -117,7 +117,7 @@ class FreshRSS_ConfigurationSetter { private function _queries(&$data, $values) { $data['queries'] = array(); foreach ($values as $value) { - if ($value != null) { + if ($value instanceof FreshRSS_UserQuery) { $data['queries'][] = $value->toArray(); } } -- cgit v1.2.3 From 4744a2a2d82f2b18df70b37f8cff5043dde12770 Mon Sep 17 00:00:00 2001 From: Tets Date: Thu, 26 Mar 2015 09:27:23 +0100 Subject: Added Czech translation --- app/i18n/cz/admin.php | 170 +++++++++++++++++++++++++++++++++++++++++++++++ app/i18n/cz/conf.php | 169 ++++++++++++++++++++++++++++++++++++++++++++++ app/i18n/cz/feedback.php | 110 ++++++++++++++++++++++++++++++ app/i18n/cz/gen.php | 164 +++++++++++++++++++++++++++++++++++++++++++++ app/i18n/cz/index.php | 61 +++++++++++++++++ app/i18n/cz/install.php | 107 +++++++++++++++++++++++++++++ app/i18n/cz/sub.php | 61 +++++++++++++++++ 7 files changed, 842 insertions(+) create mode 100644 app/i18n/cz/admin.php create mode 100644 app/i18n/cz/conf.php create mode 100644 app/i18n/cz/feedback.php create mode 100644 app/i18n/cz/gen.php create mode 100644 app/i18n/cz/index.php create mode 100644 app/i18n/cz/install.php create mode 100644 app/i18n/cz/sub.php (limited to 'app') diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php new file mode 100644 index 000000000..b9ef707cf --- /dev/null +++ b/app/i18n/cz/admin.php @@ -0,0 +1,170 @@ + array( + 'allow_anonymous' => 'Umožnit anonymně číst články výchozího uživatele (%s)', + 'allow_anonymous_refresh' => 'Umožnit anonymní obnovení článků', + 'api_enabled' => 'Povolit přístup k API (vyžadováno mobilními aplikacemi)', + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'persona' => 'Mozilla Persona (moderní, vyžaduje JavaScript)', + 'title' => 'Přihlášení', + 'title_reset' => 'Reset přihlášení', + 'token' => 'Authentizační token', + 'token_help' => 'Umožňuje přístup k RSS kanálu článků výchozího uživatele bez přihlášení:', + 'type' => 'Způsob přihlášení', + 'unsafe_autologin' => 'Povolit nebezpečné automatické přihlášení přes: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/cache. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'categories' => array( + 'nok' => 'Tabulka kategorií je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'connection' => array( + 'nok' => 'Nelze navázat spojení s databází.', + 'ok' => 'Připojení k databázi je v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro ověřování znaků (php-ctype).', + 'ok' => 'Máte požadovanou knihovnu pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php5-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'database' => 'Instalace databáze', + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM (balíček php-xml).', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'entries' => array( + 'nok' => 'Tabulka článků je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/favicons. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'feeds' => array( + 'nok' => 'Tabulka kanálů je nastavena špatně.', + 'ok' => 'Tabulka kanálů je v pořádku.', + ), + 'files' => 'Instalace souborů', + 'json' => array( + 'nok' => 'Nemáte JSON (balíček php5-json).', + 'ok' => 'Máte rozšíření JSON.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/persona. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře Mozilla Persona jsou v pořádku.', + ), + 'php' => array( + '_' => 'PHP instalace', + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'tables' => array( + 'nok' => 'V databázi chybí jedna nevo více tabulek.', + 'ok' => 'V databázi jsou všechny tabulky.', + ), + 'title' => 'Kontrola instalace', + 'tokens' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/tokens. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře tokens jsou v pořádku.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/users. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + 'zip' => array( + 'nok' => 'Nemáte rozšíření ZIP (balíček php5-zip).', + 'ok' => 'Máte rozšíření ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Vypnuto', + 'empty_list' => 'Není naistalováno žádné rozšíření', + 'enabled' => 'Zapnuto', + 'no_configure_view' => 'Toto rozšíření nemá žádné možnosti nastavení.', + 'system' => array( + '_' => 'Systémová rozšíření', + 'no_rights' => 'Systémová rozšíření (na ně nemáte oprávnění)', + ), + 'title' => 'Rozšíření', + 'user' => 'Uživatelská rozšíření', + ), + 'stats' => array( + '_' => 'Statistika', + 'all_feeds' => 'Všechny kanály', + 'category' => 'Kategorie', + 'entry_count' => 'Počet článků', + 'entry_per_category' => 'Článků na kategorii', + 'entry_per_day' => 'Článků za den (posledních 30 dní)', + 'entry_per_day_of_week' => 'Za den v týdnu (průměr: %.2f zprávy)', + 'entry_per_hour' => 'Za hodinu (průměr: %.2f zprávy)', + 'entry_per_month' => 'Za měsíc (průměr: %.2f zprávy)', + 'entry_repartition' => 'Rozdělení článků', + 'feed' => 'Kanál', + 'feed_per_category' => 'Článků na kategorii', + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'menu' => array( + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'repartition' => 'Rozdělení článků', + ), + 'no_idle' => 'Žádné neaktivní kanály!', + 'number_entries' => '%d článků', + 'percent_of_total' => '%% ze všech', + 'repartition' => 'Rozdělení článků', + 'status_favorites' => 'Oblíbené', + 'status_read' => 'Přečtené', + 'status_total' => 'Celkem', + 'status_unread' => 'Nepřečtené', + 'title' => 'Statistika', + 'top_feed' => 'Top ten kanálů', + ), + 'update' => array( + '_' => 'Aktualizace systému', + 'apply' => 'Použít', + 'check' => 'Zkontrolovat aktualizace', + 'current_version' => 'Vaše instalace FreshRSS je verze %s.', + 'last' => 'Poslední kontrola: %s', + 'none' => 'Žádné nové aktualizace', + 'title' => 'Aktualizovat systém', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'create' => 'Vytvořit nového uživatele', + 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', + 'language' => 'Jazyk', + 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Správa uživatelů', + 'user_list' => 'Seznam uživatelů', + 'username' => 'Přihlašovací jméno', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php new file mode 100644 index 000000000..29fb1e4d4 --- /dev/null +++ b/app/i18n/cz/conf.php @@ -0,0 +1,169 @@ + array( + '_' => 'Archivace', + 'advanced' => 'Pokročilé', + 'delete_after' => 'Smazat články starší než', + 'help' => 'Více možností je dostupných v nastavení jednotlivých kanálů', + 'keep_history_by_feed' => 'Zachovat tento minimální počet článků v každém kanálu', + 'optimize' => 'Optimalizovat databázi', + 'optimize_help' => 'Občasná údržba zmenší velikost databáze', + 'purge_now' => 'Vyčistit nyní', + 'title' => 'Archivace', + 'ttl' => 'Neaktualizovat častěji než', + ), + 'display' => array( + '_' => 'Zobrazení', + 'icon' => array( + 'bottom_line' => 'Spodní řádek', + 'entry' => 'Ikony článků', + 'publication_date' => 'Datum vydání', + 'related_tags' => 'Související tagy', + 'sharing' => 'Sdílení', + 'top_line' => 'Horní řádek', + ), + 'language' => 'Jazyk', + 'notif_html5' => array( + 'seconds' => 'sekund (0 znamená žádný timeout)', + 'timeout' => 'Timeout HTML5 notifikací', + ), + 'theme' => 'Vzhled', + 'title' => 'Zobrazení', + 'width' => array( + 'content' => 'Šířka obsahu', + 'large' => 'Velká', + 'medium' => 'Střední', + 'no_limit' => 'Bez limitu', + 'thin' => 'Tenká', + ), + ), + 'query' => array( + '_' => 'Uživatelské dotazy', + 'deprecated' => 'Tento dotaz již není platný. Odkazovaná kategorie nebo kanál byly smazány.', + 'filter' => 'Filtr aplikován:', + 'get_all' => 'Zobrazit všechny články', + 'get_category' => 'Zobrazit "%s" kategorii', + 'get_favorite' => 'Zobrazit oblíbené články', + 'get_feed' => 'Zobrazit "%s" článkek', + 'no_filter' => 'Zrušit filtr', + 'none' => 'Ještě jste nevytvořil žádný uživatelský dotaz.', + 'number' => 'Dotaz n°%d', + 'order_asc' => 'Zobrazit nejdříve nejstarší články', + 'order_desc' => 'Zobrazit nejdříve nejnovější články', + 'search' => 'Hledat "%s"', + 'state_0' => 'Zobrazit všechny články', + 'state_1' => 'Zobrazit přečtené články', + 'state_2' => 'Zobrazit nepřečtené články', + 'state_3' => 'Zobrazit všechny články', + 'state_4' => 'Zobrazit oblíbené články', + 'state_5' => 'Zobrazit oblíbené přečtené články', + 'state_6' => 'Zobrazit oblíbené nepřečtené články', + 'state_7' => 'Zobrazit oblíbené články', + 'state_8' => 'Zobrazit všechny články vyjma oblíbených', + 'state_9' => 'Zobrazit všechny přečtené články vyjma oblíbených', + 'state_10' => 'Zobrazit všechny nepřečtené články vyjma oblíbených', + 'state_11' => 'Zobrazit všechny články vyjma oblíbených', + 'state_12' => 'Zobrazit všechny články', + 'state_13' => 'Zobrazit přečtené články', + 'state_14' => 'Zobrazit nepřečtené články', + 'state_15' => 'Zobrazit všechny články', + 'title' => 'Uživatelské dotazy', + ), + 'profile' => array( + '_' => 'Správa profilu', + 'email_persona' => 'Email pro přihlášení
    (pro
    Mozilla Persona)', + 'password_api' => 'Password API
    (tzn. pro mobilní aplikace)', + 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Čtení', + 'after_onread' => 'Po “označit vše jako přečtené”,', + 'articles_per_page' => 'Počet článků na stranu', + 'auto_load_more' => 'Načítat další články dole na stránce', + 'auto_remove_article' => 'Po přečtení články schovat', + 'confirm_enabled' => 'Vyžadovat potvrzení pro akci “označit vše jako přečtené”', + 'display_articles_unfolded' => 'Ve výchozím stavu zobrazovat články otevřené', + 'display_categories_unfolded' => 'Ve výchozím stavu zobrazovat kategorie zavřené', + 'hide_read_feeds' => 'Schovat kategorie a kanály s nulovým počtem nepřečtených článků (nefunguje s nastavením “Zobrazit všechny články”)', + 'img_with_lazyload' => 'Použít "lazy load" mód pro načítaní obrázků', + 'jump_next' => 'skočit na další nepřečtený (kanál nebo kategorii)', + 'number_divided_when_reader' => 'V režimu “Čtení” děleno dvěma.', + 'read' => array( + 'article_open_on_website' => 'když je otevřen původní web s článkem', + 'article_viewed' => 'během čtení článku', + 'scroll' => 'během skrolování', + 'upon_reception' => 'po načtení článku', + 'when' => 'Označit článek jako přečtený…', + ), + 'show' => array( + '_' => 'Počet zobrazených článků', + 'adaptive' => 'Vyberte zobrazení', + 'all_articles' => 'Zobrazit všechny články', + 'unread' => 'Zobrazit jen nepřečtené', + ), + 'sort' => array( + '_' => 'Řazení', + 'newer_first' => 'Nejdříve nejnovější', + 'older_first' => 'Nejdříve nejstarší', + ), + 'sticky_post' => 'Při otevření posunout článek nahoru', + 'title' => 'Čtení', + 'view' => array( + 'default' => 'Výchozí', + 'global' => 'Přehled', + 'normal' => 'Normální', + 'reader' => 'Čtení', + ), + ), + 'sharing' => array( + '_' => 'Sdílení', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Více informací', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'share_name' => 'Jméno pro zobrazení', + 'share_url' => 'Jakou URL použít pro sdílení', + 'title' => 'Sdílení', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Zkratky', + 'article_action' => 'Články - akce', + 'auto_share' => 'Sdílet', + 'auto_share_help' => 'Je-li nastavena pouze jedna možnost sdílení, bude použita. Další možnosti jsou dostupné pomocí jejich čísla.', + 'close_dropdown' => 'Zavřít menu', + 'collapse_article' => 'Srolovat', + 'first_article' => 'Skočit na první článek', + 'focus_search' => 'Hledání', + 'help' => 'Zobrazit documentaci', + 'javascript' => 'Pro použití zkratek musí být povolen JavaScript', + 'last_article' => 'Skočit na poslední článek', + 'load_more' => 'Načíst více článků', + 'mark_read' => 'Označit jako přečtené', + 'mark_favorite' => 'Označit jako oblíbené', + 'navigation' => 'Navigace', + 'navigation_help' => 'Pomocí přepínače "Shift" fungují navigační zkratky v rámci kanálů.
    Pomocí přepínače "Alt" fungují v rámci kategorií.', + 'next_article' => 'Skočit na další článek', + 'other_action' => 'Ostatní akce', + 'previous_article' => 'Skočit na předchozí článek', + 'see_on_website' => 'Navštívit původní webovou stránku', + 'shift_for_all_read' => '+ shift označí vše jako přečtené', + 'title' => 'Zkratky', + 'user_filter' => 'Aplikovat uživatelské filtry', + 'user_filter_help' => 'Je-li nastaven pouze jeden filtr, bude použit. Další filtry jsou dostupné pomocí jejich čísla.', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'current' => 'Aktuální uživatel', + 'is_admin' => 'je administrátor', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php new file mode 100644 index 000000000..52ff029ef --- /dev/null +++ b/app/i18n/cz/feedback.php @@ -0,0 +1,110 @@ + array( + 'optimization_complete' => 'Optimalizace dokončena', + ), + 'access' => array( + 'denied' => 'Nemáte oprávnění přistupovat na tuto stránku', + 'not_found' => 'Tato stránka neexistuje', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Nastal problém s konfigurací přihlašovacího systému. Zkuste to prosím později.', + 'set' => 'Webové formulář je nyní výchozí přihlašovací systém.', + ), + 'login' => array( + 'invalid' => 'Login není platný', + 'success' => 'Jste přihlášen', + ), + 'logout' => array( + 'success' => 'Jste odhlášen', + ), + 'no_password_set' => 'Heslo administrátora nebylo nastaveno. Tato funkce není k dispozici.', + 'not_persona' => 'Resetovat lze pouze systém Persona.', + ), + 'conf' => array( + 'error' => 'Během ukládání nastavení došlo k chybě', + 'query_created' => 'Dotaz "%s" byl vytvořen.', + 'shortcuts_updated' => 'Zkratky byly aktualizovány', + 'updated' => 'Nastavení bylo aktualizováno', + ), + 'extensions' => array( + 'already_enabled' => '%s je již zapnut', + 'disable' => array( + 'ko' => '%s nelze vypnout. Pro více detailů zkontrolujte logy FressRSS.', + 'ok' => '%s je nyní vypnut', + ), + 'enable' => array( + 'ko' => '%s nelze zapnout. Pro více detailů zkontrolujte logy FressRSS.', + 'ok' => '%s je nyní zapnut', + ), + 'no_access' => 'Nemáte přístup k %s', + 'not_enabled' => '%s není ještě zapnut', + 'not_found' => '%s neexistuje', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Na serveru není naistalována podpora zip. Zkuste prosím exportovat soubory jeden po druhém.', + 'feeds_imported' => 'Vaše kanály byly naimportovány a nyní budou aktualizovány', + 'feeds_imported_with_errors' => 'Vaše kanály byly naimportovány, došlo ale k nějakým chybám', + 'file_cannot_be_uploaded' => 'Soubor nelze nahrát!', + 'no_zip_extension' => 'Na serveru není naistalována podpora zip.', + 'zip_error' => 'Během importu zip souboru došlo k chybě.', + ), + 'sub' => array( + 'actualize' => 'Aktualizovat', + 'category' => array( + 'created' => 'Kategorie %s byla vytvořena.', + 'deleted' => 'Kategorie byla smazána.', + 'emptied' => 'Kategorie byla vyprázdněna', + 'error' => 'Kategorii nelze aktualizovat', + 'name_exists' => 'Název kategorie již existuje.', + 'no_id' => 'Musíte upřesnit id kategorie.', + 'no_name' => 'Název kategorie nemůže být prázdný.', + 'not_delete_default' => 'Nelze smazat výchozí kategorii!', + 'not_exist' => 'Tato kategorie neexistuje!', + 'over_max' => 'Dosáhl jste maximálního počtu kategorií (%d)', + 'updated' => 'Kategorie byla aktualizována.', + ), + 'feed' => array( + 'actualized' => '%s bylo aktualizováno', + 'actualizeds' => 'RSS kanály byly aktualizovány', + 'added' => 'RSS kanál %s byl přidán', + 'already_subscribed' => 'Již jste přihlášen k odběru %s', + 'deleted' => 'Kanál byl smazán', + 'error' => 'Kanál nelze aktualizovat', + 'internal_problem' => 'RSS kanál nelze přidat. Pro detaily zkontrolujte logy FressRSS.', + 'invalid_url' => 'URL %s není platné', + 'marked_read' => 'Kanály byly označeny jako přečtené', + 'n_actualized' => '%d kanálů bylo aktualizováno', + 'n_entries_deleted' => '%d článků bylo smazáno', + 'no_refresh' => 'Nelze obnovit žádné kanály…', + 'not_added' => '%s nemůže být přidán', + 'over_max' => 'Dosáhl jste maximálního počtu kanálů (%d)', + 'updated' => 'Kanál byl aktualizován', + ), + 'purge_completed' => 'Vyprázdněno (smazáno %d článků)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS bude nyní upgradováno na verzi %s.', + 'error' => 'Během upgrade došlo k chybě: %s', + 'file_is_nok' => 'Zkontrolujte oprávnění adresáře %s. HTTP server musí mít do tohoto adresáře práva zápisu', + 'finished' => 'Upgrade hotov!', + 'none' => 'Novější verze není k dispozici', + 'server_not_found' => 'Nelze nalézt server s instalačním souborem. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Uživatel %s byl vytvořen', + 'error' => 'Uživatele %s nelze vytvořit', + ), + 'deleted' => array( + '_' => 'Uživatel %s byl smazán', + 'error' => 'Uživatele %s nelze smazat', + ), + ), + 'profile' => array( + 'error' => 'Váš profil nelze změnit', + 'updated' => 'Váš profil byl změněn', + ), +); diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php new file mode 100644 index 000000000..7c333a9c8 --- /dev/null +++ b/app/i18n/cz/gen.php @@ -0,0 +1,164 @@ + array( + 'actualize' => 'Aktualizovat', + 'back_to_rss_feeds' => '← Zpět na seznam RSS kanálů', + 'cancel' => 'Zrušit', + 'create' => 'Vytvořit', + 'disable' => 'Zakázat', + 'empty' => 'Vyprázdnit', + 'enable' => 'Povolit', + 'export' => 'Export', + 'filter' => 'Filtrovat', + 'import' => 'Import', + 'manage' => 'Spravovat', + 'mark_read' => 'Označit jako přečtené', + 'mark_favorite' => 'Označit jako oblíbené', + 'remove' => 'Odstranit', + 'see_website' => 'Navštívit WWW stránku', + 'submit' => 'Odeslat', + 'truncate' => 'Smazat všechny články', + ), + 'auth' => array( + 'keep_logged_in' => 'Zapamatovat přihlášení (1 měsíc)', + 'login' => 'Login', + 'login_persona' => 'Přihlášení pomocí Persona', + 'login_persona_problem' => 'Problém s připojením k Persona?', + 'logout' => 'Odhlášení', + 'password' => 'Heslo', + 'reset' => 'Reset přihlášení', + 'username' => 'Uživatel', + 'username_admin' => 'Název administrátorského účtu', + 'will_reset' => 'Přihlašovací systém bude vyresetován: místo sytému Persona bude použito přihlášení formulářem.', + ), + 'date' => array( + 'Apr' => '\\D\\u\\b\\e\\n', + 'Aug' => '\\S\\r\\p\\e\\n', + 'Dec' => '\\P\\r\\o\\s\\i\\n\\e\\c', + 'Feb' => '\\Ú\\n\\o\\r', + 'Jan' => '\\L\\e\\d\\e\\n', + 'Jul' => '\\Č\\e\\r\\v\\e\\n\\e\\c', + 'Jun' => '\\Č\\e\\r\\v\\e\\n', + 'Mar' => '\\B\\ř\\e\\z\\e\\n', + 'May' => '\\K\\v\\ě\\t\\e\\n', + 'Nov' => '\\L\\i\\s\\t\\o\\p\\a\\d', + 'Oct' => '\\Ř\\í\\j\\e\\n', + 'Sep' => '\\Z\\á\\ř\\í', + 'apr' => 'dub', + 'april' => 'Dub', + 'aug' => 'srp', + 'august' => 'Srp', + 'before_yesterday' => 'Předevčírem', + 'dec' => 'pro', + 'december' => 'Pro', + 'feb' => 'úno', + 'february' => 'Úno', + 'format_date' => 'j\\. %s Y', + 'format_date_hour' => 'j\\. %s Y \\v H\\:i', + 'fri' => 'Pá', + 'jan' => 'led', + 'january' => 'Led', + 'jul' => 'čvn', + 'july' => 'Čvn', + 'jun' => 'čer', + 'june' => 'Čer', + 'last_3_month' => 'Minulé tři měsíce', + 'last_6_month' => 'Minulých šest měsíců', + 'last_month' => 'Minulý měsíc', + 'last_week' => 'Minulý týden', + 'last_year' => 'Minulý rok', + 'mar' => 'bře', + 'march' => 'Bře', + 'may' => 'Kvě', + 'mon' => 'Po', + 'month' => 'měsíce', + 'nov' => 'lis', + 'november' => 'Lis', + 'oct' => 'říj', + 'october' => 'Říj', + 'sat' => 'So', + 'sep' => 'zář', + 'september' => 'Zář', + 'sun' => 'Ne', + 'thu' => 'Čt', + 'today' => 'Dnes', + 'tue' => 'Út', + 'wed' => 'St', + 'yesterday' => 'Včera', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'O FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Prázdná kategorie', + 'confirm_action' => 'Jste si jist, že chcete provést tuto akci? Změny nelze vrátit zpět!', + 'confirm_action_feed_cat' => 'Jste si jist, že chcete provést tuto akci? Přijdete o související oblíbené položky a uživatelské dotazy. Změny nelze vrátit zpět!', + 'feedback' => array( + 'body_new_articles' => 'Je \\d nových článků k přečtení v FreshRSS.', + 'request_failed' => 'Požadavek selhal, což může být způsobeno problémy s připojení k internetu.', + 'title_new_articles' => 'FreshRSS: nové články!', + ), + 'new_article' => 'Jsou k dispozici nové články, stránku obnovíte kliknutím zde.', + 'should_be_activated' => 'JavaScript musí být povolen', + ), + 'lang' => array( + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'cz' => 'Čeština', + ), + 'menu' => array( + 'about' => 'O aplikaci', + 'admin' => 'Administrace', + 'archiving' => 'Archivace', + 'authentication' => 'Přihlášení', + 'check_install' => 'Ověření instalace', + 'configuration' => 'Nastavení', + 'display' => 'Zobrazení', + 'extensions' => 'Rozšíření', + 'logs' => 'Logy', + 'queries' => 'Uživatelské dotazy', + 'reading' => 'Čtení', + 'search' => 'Hledat výraz nebo #tagy', + 'sharing' => 'Sdílení', + 'shortcuts' => 'Zkratky', + 'stats' => 'Statistika', + 'update' => 'Aktualizace', + 'user_management' => 'Správa uživatelů', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'První', + 'last' => 'Poslední', + 'load_more' => 'Načíst více článků', + 'mark_all_read' => 'Označit vše jako přečtené', + 'next' => 'Další', + 'nothing_to_load' => 'Žádné nové články', + 'previous' => 'Předchozí', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'short' => array( + 'attention' => 'Upozornění!', + 'blank_to_disable' => 'Zakázat - ponechte prázdné', + 'by_author' => 'Od %s', + 'by_default' => 'Výchozí', + 'damn' => 'Sakra!', + 'default_category' => 'Nezařazeno', + 'no' => 'Ne', + 'ok' => 'Ok!', + 'or' => 'nebo', + 'yes' => 'Ano', + ), +); diff --git a/app/i18n/cz/index.php b/app/i18n/cz/index.php new file mode 100644 index 000000000..5691d12af --- /dev/null +++ b/app/i18n/cz/index.php @@ -0,0 +1,61 @@ + array( + '_' => 'O FreshRSS', + 'agpl3' => 'AGPL 3', + 'bugs_reports' => 'Hlášení chyb', + 'credits' => 'Poděkování', + 'credits_content' => 'Některé designové prvky pocházejí z Bootstrap, FreshRSS ale tuto platformu nevyužívá. Ikony pocházejí z GNOME projektu. Font Open Sans vytvořil Steve Matteson. Favicony jsou shromažďovány pomocí getFavicon API. FreshRSS je založen na PHP framework Minz.', + 'freshrss_description' => 'FreshRSS je čtečka RSS kanálů určená k provozu na vlastním serveru, podobná Kriss Feed nebo Leed. Je to nenáročný a jednoduchý, zároveň ale mocný a konfigurovatelný nástroj.', + 'github' => 'na Github', + 'license' => 'Licence', + 'project_website' => 'Stránka projektu', + 'title' => 'O FreshRSS', + 'version' => 'Verze', + 'website' => 'Webové stránka', + ), + 'feed' => array( + 'add' => 'Můžete přidat kanály.', + 'empty' => 'Žádné články k zobrazení.', + 'rss_of' => 'RSS kanál %s', + 'title' => 'RSS kanály', + 'title_global' => 'Přehled', + 'title_fav' => 'Oblíbené', + ), + 'log' => array( + '_' => 'Logy', + 'clear' => 'Vymazat logy', + 'empty' => 'Log je prázdný', + 'title' => 'Logy', + ), + 'menu' => array( + 'about' => 'O FreshRSS', + 'add_query' => 'Vytvořit dotaz', + 'before_one_day' => 'Den nazpět', + 'before_one_week' => 'Před týdnem', + 'favorites' => 'Oblíbené (%s)', + 'global_view' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'mark_all_read' => 'Označit vše jako přečtené', + 'mark_cat_read' => 'Označit kategorii jako přečtenou', + 'mark_feed_read' => 'Označit kanál jako přečtený', + 'newer_first' => 'Nové nejdříve', + 'non-starred' => 'Zobrazit vše vyjma oblíbených', + 'normal_view' => 'Normální', + 'older_first' => 'Nejstarší nejdříve', + 'queries' => 'Uživatelské dotazy', + 'read' => 'Zobrazovat přečtené', + 'reader_view' => 'Čtení', + 'rss_view' => 'RSS kanál', + 'search_short' => 'Hledat', + 'starred' => 'Zobrazit oblíbené', + 'stats' => 'Statistika', + 'subscription' => 'Správa subskripcí', + 'unread' => 'Zobrazovat nepřečtené', + ), + 'share' => 'Sdílet', + 'tag' => array( + 'related' => 'Související tagy', + ), +); diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php new file mode 100644 index 000000000..53257c84f --- /dev/null +++ b/app/i18n/cz/install.php @@ -0,0 +1,107 @@ + array( + 'finish' => 'Dokončit instalaci', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'next_step' => 'Přejít na další krok', + ), + 'auth' => array( + 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', + 'password_format' => 'Alespoň 7 znaků', + 'persona' => 'Mozilla Persona (moderní, vyžaduje JavaScript)', + 'type' => 'Způsob přihlášení', + ), + 'bdd' => array( + '_' => 'Databáze', + 'conf' => array( + '_' => 'Nastavení databáze', + 'ko' => 'Ověřte informace o databázi.', + 'ok' => 'Nastavení databáze bylo uloženo.', + ), + 'host' => 'Hostitel', + 'prefix' => 'Prefix tabulky', + 'password' => 'Heslo', + 'type' => 'Typ databáze', + 'username' => 'Uživatel', + ), + 'check' => array( + '_' => 'Kontrola', + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/cache. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Není nainstalována požadovaná knihovna pro ověřování znaků (php-ctype).', + 'ok' => 'Je nainstalována požadovaná knihovna pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php5-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM (balíček php-xml).', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/favicons. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'http_referer' => array( + 'nok' => 'Zkontrolujte prosím že neměníte HTTP REFERER.', + 'ok' => 'Váš HTTP REFERER je znám a odpovídá Vašemu serveru.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/persona. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře Mozilla Persona jsou v pořádku.', + ), + 'php' => array( + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře ./data/users. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + ), + 'conf' => array( + '_' => 'Obecná nastavení', + 'ok' => 'Nastavení bylo uloženo.', + ), + 'congratulations' => 'Gratulujeme!', + 'default_user' => 'Jméno výchozího uživatele (maximálně 16 alfanumerických znaků)', + 'delete_articles_after' => 'Smazat články starší než', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'javascript_is_better' => 'Práce s FreshRSS je příjemnější se zapnutým JavaScriptem', + 'language' => array( + '_' => 'Jazyk', + 'choose' => 'Vyberte jazyk FreshRSS', + 'defined' => 'Jazyk byl nastaven.', + ), + 'not_deleted' => 'Nastala chyba, soubor %s musíte smazat ručně.', + 'ok' => 'Instalace byla úspěšná.', + 'step' => 'krok %d', + 'steps' => 'Kroky', + 'title' => 'Instalace · FreshRSS', + 'this_is_the_end' => 'Konec', +); diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php new file mode 100644 index 000000000..d7ff63fe9 --- /dev/null +++ b/app/i18n/cz/sub.php @@ -0,0 +1,61 @@ + array( + '_' => 'Kategorie', + 'add' => 'Přidat kategorii', + 'empty' => 'Vyprázdit kategorii', + 'new' => 'Nová kategorie', + ), + 'feed' => array( + 'add' => 'Přidat RSS kanál', + 'advanced' => 'Pokročilé', + 'archiving' => 'Archivace', + 'auth' => array( + 'configuration' => 'Přihlášení', + 'help' => 'Umožní přístup k RSS kanálům chráneným HTTP autentizací', + 'http' => 'HTTP přihlášení', + 'password' => 'Heslo', + 'username' => 'Přihlašovací jméno', + ), + 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', + 'css_path' => 'Původní CSS soubor článku z webových stránek', + 'description' => 'Popis', + 'empty' => 'Kanál je prazdný. Ověřte prosím zda je ještě autorem udržován.', + 'error' => 'Vyskytl se problém s kanálem. Ověřte že je vždy dostupný, prosím, a poté jej aktualizujte.', + 'in_main_stream' => 'Zobrazit ve “Všechny kanály”', + 'informations' => 'Informace', + 'keep_history' => 'Zachovat tento minimální počet článků', + 'moved_category_deleted' => 'Po smazání kategorie budou v ní obsažené kanály automaticky přesunuty do %s.', + 'no_selected' => 'Nejsou označeny žádné kanály.', + 'number_entries' => '%d článků', + 'stats' => 'Statistika', + 'think_to_add' => 'Můžete přidat kanály.', + 'title' => 'Název', + 'title_add' => 'Přidat RSS kanál', + 'ttl' => 'Neobnovovat častěji než', + 'url' => 'URL kanálu', + 'validator' => 'Zkontrolovat platnost kanálu', + 'website' => 'URL webové stránky', + ), + 'import_export' => array( + 'export' => 'Export', + 'export_opml' => 'Exportovat seznam kanálů (OPML)', + 'export_starred' => 'Exportovat oblíbené', + 'feed_list' => 'Seznam %s článků', + 'file_to_import' => 'Soubor k importu
    (OPML, Json nebo Zip)', + 'file_to_import_no_zip' => 'Soubor k importu
    (OPML nebo Json)', + 'import' => 'Import', + 'starred_list' => 'Seznam oblíbených článků', + 'title' => 'Import / export', + ), + 'menu' => array( + 'bookmark' => 'Přihlásit (FreshRSS bookmark)', + 'import_export' => 'Import / export', + 'subscription_management' => 'Správa subskripcí', + ), + 'title' => array( + '_' => 'Správa subskripcí', + 'feed_management' => 'Správa RSS kanálů', + ), +); -- cgit v1.2.3 From 6283fe99b2ded06d05d01c595a1d067010b4b886 Mon Sep 17 00:00:00 2001 From: Tets Date: Fri, 27 Mar 2015 08:13:34 +0100 Subject: Added Czech to the list in other languages in gen.php --- app/i18n/de/gen.php | 1 + app/i18n/en/gen.php | 1 + app/i18n/fr/gen.php | 1 + 3 files changed, 3 insertions(+) (limited to 'app') diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 1b30a5be4..8970d5003 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -104,6 +104,7 @@ return array( 'should_be_activated' => 'JavaScript muss aktiviert sein', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index fdca01a43..b02b9f0f2 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -104,6 +104,7 @@ return array( 'should_be_activated' => 'JavaScript must be enabled', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 48fc4a7e9..c81e57bf7 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -104,6 +104,7 @@ return array( 'should_be_activated' => 'Le JavaScript doit être activé.', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', -- cgit v1.2.3 From 711530a512b370d79b079205ce1f8376174f7f03 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 4 Apr 2015 22:39:31 +0200 Subject: SQL: detection of updates, and preparation for better burge https://github.com/FreshRSS/FreshRSS/issues/798 https://github.com/FreshRSS/FreshRSS/issues/493 SQLite not yet tested. Only MySQL tested so far. --- app/Controllers/feedController.php | 98 ++++++++------ app/Controllers/importExportController.php | 3 +- app/Models/Entry.php | 16 +++ app/Models/EntryDAO.php | 198 +++++++++++++++++++++-------- app/Models/Feed.php | 1 + app/SQL/install.sql.mysql.php | 7 +- app/SQL/install.sql.sqlite.php | 7 +- lib/lib_rss.php | 2 +- 8 files changed, 231 insertions(+), 101 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 6f544d834..08a0257a2 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -145,7 +145,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Call the extension hook $name = $feed->name(); $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); - if (is_null($feed)) { + if ($feed === null) { Minz_Request::bad(_t('feed_not_added', $name), $url_redirect); } @@ -181,7 +181,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Use a shared statement and a transaction to improve a LOT the // performances. - $prepared_statement = $entryDAO->addEntryPrepare(); $feedDAO->beginTransaction(); foreach ($entries as $entry) { // Entries are added without any verification. @@ -190,13 +189,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entry->_isRead($is_read); $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); - if (is_null($entry)) { + if ($entry === null) { // An extension has returned a null value, there is nothing to insert. continue; } $values = $entry->toArray(); - $entryDAO->addEntry($values, $prepared_statement); + $entryDAO->addEntry($values); } $feedDAO->updateLastUpdate($feed->id()); $feedDAO->commit(); @@ -307,7 +306,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed->load(false); } catch (FreshRSS_Feed_Exception $e) { Minz_Log::notice($e->getMessage()); - $feedDAO->updateLastUpdate($feed->id(), 1); + $feedDAO->updateLastUpdate($feed->id(), true); $feed->unlock(); continue; } @@ -323,50 +322,69 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // We want chronological order and SimplePie uses reverse order. $entries = array_reverse($feed->entries()); if (count($entries) > 0) { - // For this feed, check last n entry GUIDs already in database. - $existing_guids = array_fill_keys($entryDAO->listLastGuidsByFeed( - $feed->id(), count($entries) + 10 - ), 1); - $use_declared_date = empty($existing_guids); + $newGuids = array(); + foreach ($entries as $entry) { + $newGuids[] = $entry->guid(); + } + // For this feed, check existing GUIDs already in database. + $existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids); + unset($newGuids); + $use_declared_date = empty($existingHashForGuids); + $oldGuids = array(); // Add entries in database if possible. - $prepared_statement = $entryDAO->addEntryPrepare(); - $feedDAO->beginTransaction(); foreach ($entries as $entry) { $entry_date = $entry->date(true); - if (isset($existing_guids[$entry->guid()]) || - ($feed_history == 0 && $entry_date < $date_min)) { - // This entry already exists in DB or should not be added - // considering configuration and date. - continue; - } - - $id = uTimeString(); - if ($use_declared_date || $entry_date < $date_min) { - // Use declared date at first import. - $id = min(time(), $entry_date) . uSecString(); + if (isset($existingHashForGuids[$entry->guid()])) { + $existingHash = $existingHashForGuids[$entry->guid()]; + if (strcasecmp($existingHash, $entry->hash()) === 0 || $existingHash === '00000000000000000000000000000000') { + //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 + $oldGuids[] = $entry->guid(); + } else { //This entry already exists but has been updated + Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . + ', old hash ' . $existingHash . ', new hash ' . $entry->hash()); + $entry->_isRead($is_read); //Reset is_read + if (!$entryDAO->hasTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->updateEntry($entry->toArray()); + } + } elseif ($feed_history == 0 && $entry_date < $date_min) { + // This entry should not be added considering configuration and date. + $oldGuids[] = $entry->guid(); + } else { + $id = uTimeString(); + if ($use_declared_date || $entry_date < $date_min) { + // Use declared date at first import. + $id = min(time(), $entry_date) . uSecString(); + } + + $entry->_id($id); + $entry->_isRead($is_read); + + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); + if ($entry === null) { + // An extension has returned a null value, there is nothing to insert. + continue; + } + + if (!$entryDAO->hasTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->addEntry($entry->toArray()); } - - $entry->_id($id); - $entry->_isRead($is_read); - - $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); - if (is_null($entry)) { - // An extension has returned a null value, there is nothing to insert. - continue; - } - - $values = $entry->toArray(); - $entryDAO->addEntry($values, $prepared_statement); } + $entryDAO->updateLastSeen($feed->id(), $oldGuids); } + //TODO: updateLastSeen old GUIDS once in a while, in the case of caching (i.e. the whole feed content has not changed) if ($feed_history >= 0 && rand(0, 30) === 1) { // TODO: move this function in web cron when available (see entry::purge) // Remove old entries once in 30. - if (!$feedDAO->hasTransaction()) { - $feedDAO->beginTransaction(); + if (!$entryDAO->hasTransaction()) { + $entryDAO->beginTransaction(); } + //TODO: more robust system based on entry.lastSeen to avoid cleaning entries that are still published in the RSS feed. $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, @@ -377,9 +395,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } - $feedDAO->updateLastUpdate($feed->id(), 0, $feedDAO->hasTransaction()); - if ($feedDAO->hasTransaction()) { - $feedDAO->commit(); + $feedDAO->updateLastUpdate($feed->id(), 0, $entryDAO->hasTransaction()); + if ($entryDAO->hasTransaction()) { + $entryDAO->commit(); } if ($feed->url() !== $url) { diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 589777b2a..26b163e43 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -361,7 +361,6 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } // Then, articles are imported. - $prepared_statement = $this->entryDAO->addEntryPrepare(); $this->entryDAO->beginTransaction(); foreach ($article_object['items'] as $item) { if (!isset($article_to_feed[$item['id']])) { @@ -396,7 +395,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } $values = $entry->toArray(); - $id = $this->entryDAO->addEntry($values, $prepared_statement); + $id = $this->entryDAO->addEntry($values); if (!$error && ($id === false)) { $error = true; diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 346c98a92..6931c9f25 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -14,6 +14,7 @@ class FreshRSS_Entry extends Minz_Model { private $content; private $link; private $date; + private $hash = null; private $is_read; private $is_favorite; private $feed; @@ -88,6 +89,14 @@ class FreshRSS_Entry extends Minz_Model { } } + public function hash() { + if ($this->hash === null) { + //Do not include $this->date because it may be automatically generated when lacking + $this->hash = md5($this->link . $this->title . $this->author . $this->content . $this->tags(true)); + } + return $this->hash; + } + public function _id($value) { $this->id = $value; } @@ -95,18 +104,23 @@ class FreshRSS_Entry extends Minz_Model { $this->guid = $value; } public function _title($value) { + $this->hash = null; $this->title = $value; } public function _author($value) { + $this->hash = null; $this->author = $value; } public function _content($value) { + $this->hash = null; $this->content = $value; } public function _link($value) { + $this->hash = null; $this->link = $value; } public function _date($value) { + $this->hash = null; $value = intval($value); $this->date = $value > 1 ? $value : time(); } @@ -120,6 +134,7 @@ class FreshRSS_Entry extends Minz_Model { $this->feed = $value; } public function _tags($value) { + $this->hash = null; if (!is_array($value)) { $value = array($value); } @@ -182,6 +197,7 @@ class FreshRSS_Entry extends Minz_Model { 'content' => $this->content(), 'link' => $this->link(), 'date' => $this->date(true), + 'hash' => $this->hash(), 'is_read' => $this->isRead(), 'is_favorite' => $this->isFavorite(), 'id_feed' => $this->feed(), diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 9736d5cd3..5b4b85547 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -6,20 +6,57 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return parent::$sharedDbType !== 'sqlite'; } - public function addEntryPrepare() { - $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, ' - . ($this->isCompressed() ? 'content_bin' : 'content') - . ', link, date, is_read, is_favorite, id_feed, tags) ' - . 'VALUES(?, ?, ?, ?, ' - . ($this->isCompressed() ? 'COMPRESS(?)' : '?') - . ', ?, ?, ?, ?, ?, ?)'; - return $this->bd->prepare($sql); + protected function autoAddColumn($errorInfo) { + if (isset($errorInfo[0])) { + if ($errorInfo[0] == '42S22') { //ER_BAD_FIELD_ERROR + $hasTransaction = false; + try { + $stm = null; + if (stripos($errorInfo[2], 'lastSeen') !== false) { //v1.2 + if (!$this->bd->inTransaction()) { + $this->bd->beginTransaction(); + $hasTransaction = true; + } + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN lastSeen INT(11) NOT NULL'); + if ($stm && $stm->execute()) { + $stm = $this->bd->prepare('CREATE INDEX entry_lastSeen_index ON `' . $this->prefix . 'entry`(`lastSeen`);'); //"IF NOT EXISTS" does not exist in MySQL 5.7 + if ($stm && $stm->execute()) { + if ($hasTransaction) { + $this->bd->commit(); + } + return true; + } + } + if ($hasTransaction) { + $this->bd->rollBack(); + } + } elseif (stripos($errorInfo[2], 'hash') !== false) { //v1.2 + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16) NOT NULL'); + return $stm && $stm->execute(); + } + } catch (Exception $e) { + Minz_Log::debug('FreshRSS_EntryDAO::autoAddColumn error: ' . $e->getMessage()); + if ($hasTransaction) { + $this->bd->rollBack(); + } + } + } + } + return false; } - public function addEntry($valuesTmp, $preparedStatement = null) { - $stm = $preparedStatement === null ? - FreshRSS_EntryDAO::addEntryPrepare() : - $preparedStatement; + private $addEntryPrepared = null; + + public function addEntry($valuesTmp) { + if ($this->addEntryPrepared === null) { + $sql = 'INSERT INTO `' . $this->prefix . 'entry` (id, guid, title, author, ' + . ($this->isCompressed() ? 'content_bin' : 'content') + . ', link, date, lastSeen, hash, is_read, is_favorite, id_feed, tags) ' + . 'VALUES(?, ?, ?, ?, ' + . ($this->isCompressed() ? 'COMPRESS(?)' : '?') + . ', ?, ?, ?, X?, ?, ?, ?, ?)'; + $this->addEntryPrepared = $this->bd->prepare($sql); + } $values = array( $valuesTmp['id'], @@ -29,55 +66,65 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $valuesTmp['content'], substr($valuesTmp['link'], 0, 1023), $valuesTmp['date'], + time(), + $valuesTmp['hash'], $valuesTmp['is_read'] ? 1 : 0, $valuesTmp['is_favorite'] ? 1 : 0, $valuesTmp['id_feed'], substr($valuesTmp['tags'], 0, 1023), ); - if ($stm && $stm->execute($values)) { + if ($this->addEntryPrepared && $this->addEntryPrepared->execute($values)) { return $this->bd->lastInsertId(); } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - if ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries + $info = $this->addEntryPrepared == null ? array(2 => 'syntax error') : $this->addEntryPrepared->errorInfo(); + if ($this->autoAddColumn($info)) { + return $this->addEntry($valuesTmp); + } elseif ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); - } /*else { - Minz_Log::debug('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); - }*/ + } return false; } } - public function addEntryObject($entry, $conf, $feedHistory) { - $existingGuids = array_fill_keys( - $this->listLastGuidsByFeed($entry->feed(), 20), 1 - ); - - $nb_month_old = max($conf->old_entries, 1); - $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + private $updateEntryPrepared = null; - $eDate = $entry->date(true); - - if ($feedHistory == -2) { - $feedHistory = $conf->keep_history_default; + public function updateEntry($valuesTmp) { + if ($this->updateEntryPrepared === null) { + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET title=?, author=?, ' + . ($this->isCompressed() ? 'content_bin=COMPRESS(?)' : 'content=?') + . ', link=?, date=?, lastSeen=?, hash=X?, is_read=?, tags=? ' + . 'WHERE id_feed=? AND guid=?'; + $this->updateEntryPrepared = $this->bd->prepare($sql); } - if (!isset($existingGuids[$entry->guid()]) && - ($feedHistory != 0 || $eDate >= $date_min || $entry->isFavorite())) { - $values = $entry->toArray(); - - $useDeclaredDate = empty($existingGuids); - $values['id'] = ($useDeclaredDate || $eDate < $date_min) ? - min(time(), $eDate) . uSecString() : - uTimeString(); + $values = array( + substr($valuesTmp['title'], 0, 255), + substr($valuesTmp['author'], 0, 255), + $valuesTmp['content'], + substr($valuesTmp['link'], 0, 1023), + $valuesTmp['date'], + time(), + $valuesTmp['hash'], + $valuesTmp['is_read'] ? 1 : 0, + substr($valuesTmp['tags'], 0, 1023), + $valuesTmp['id_feed'], + substr($valuesTmp['guid'], 0, 760), + ); - return $this->addEntry($values); + if ($this->updateEntryPrepared && $this->updateEntryPrepared->execute($values)) { + return $this->bd->lastInsertId(); + } else { + $info = $this->updateEntryPrepared == null ? array(2 => 'syntax error') : $this->updateEntryPrepared->errorInfo(); + if ($this->autoAddColumn($info)) { + return $this->updateEntry($valuesTmp); + } + Minz_Log::error('SQL error updateEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating entry with GUID ' . $valuesTmp['guid'] . ' in feed ' . $valuesTmp['id_feed']); + return false; } - - // We don't return Entry object to avoid a research in DB - return -1; } /** @@ -94,6 +141,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if (!is_array($ids)) { $ids = array($ids); } + if (count($ids) < 1) { + return 0; + } $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET is_favorite=? ' . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; @@ -296,11 +346,11 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { * * If $idMax equals 0, a deprecated debug message is logged * - * @param integer $id feed ID + * @param integer $id_feed feed ID * @param integer $idMax fail safe article ID * @return integer affected rows */ - public function markReadFeed($id, $idMax = 0) { + public function markReadFeed($id_feed, $idMax = 0) { if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadFeed(0) is deprecated!'); @@ -310,7 +360,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET is_read=1 ' . 'WHERE id_feed=? AND is_read=0 AND id <= ?'; - $values = array($id, $idMax); + $values = array($id_feed, $idMax); $stm = $this->bd->prepare($sql); if (!($stm && $stm->execute($values))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); @@ -324,7 +374,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $sql = 'UPDATE `' . $this->prefix . 'feed` ' . 'SET cache_nbUnreads=cache_nbUnreads-' . $affected . ' WHERE id=?'; - $values = array($id); + $values = array($id_feed); $stm = $this->bd->prepare($sql); if (!($stm && $stm->execute($values))) { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); @@ -338,7 +388,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $affected; } - public function searchByGuid($feed_id, $id) { + 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') @@ -347,8 +397,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $stm = $this->bd->prepare($sql); $values = array( - $feed_id, - $id + $id_feed, + $guid, ); $stm->execute($values); @@ -519,12 +569,52 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $stm->fetchAll(PDO::FETCH_COLUMN, 0); } - public function listLastGuidsByFeed($id, $n) { - $sql = 'SELECT guid FROM `' . $this->prefix . 'entry` WHERE id_feed=? ORDER BY id DESC LIMIT ' . intval($n); + public function listHashForFeedGuids($id_feed, $guids) { + if (count($guids) < 1) { + return array(); + } + $sql = 'SELECT guid, hex(hash) AS hexHash FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; $stm = $this->bd->prepare($sql); - $values = array($id); - $stm->execute($values); - return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + $values = array($id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + $result = array(); + $rows = $stm->fetchAll(PDO::FETCH_ASSOC); + foreach ($rows as $row) { + $result[$row['guid']] = $row['hexHash']; + } + return $result; + } else { + + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoAddColumn($info)) { + return $this->listHashForFeedGuids($id_feed, $guids); + } + Minz_Log::error('SQL error listHashForFeedGuids: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while querying feed ' . $id_feed); + return false; + } + } + + public function updateLastSeen($id_feed, $guids) { + if (count($guids) < 1) { + return 0; + } + $sql = 'UPDATE `' . $this->prefix . 'entry` SET lastSeen=? WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $stm = $this->bd->prepare($sql); + $values = array(time(), $id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoAddColumn($info)) { + return $this->updateLastSeen($id_feed, $guids); + } + Minz_Log::error('SQL error updateLastSeen: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating feed ' . $id_feed); + return false; + } } public function countUnreadRead() { diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 5ce03be5d..27c83ffd5 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -255,6 +255,7 @@ class FreshRSS_Feed extends Minz_Model { $feed->__destruct(); //http://simplepie.org/wiki/faq/i_m_getting_memory_leaks unset($feed); + //TODO: Return a different information in case of cache/no-cache, and give access to the GUIDs in case of cache } } } diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index cf0159199..afdd821b2 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS `%1$sfeed` ( `name` varchar(255) NOT NULL, `website` varchar(255) CHARACTER SET latin1, `description` text, - `lastUpdate` int(11) DEFAULT 0, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 `priority` tinyint(2) NOT NULL DEFAULT 10, `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, @@ -40,7 +40,9 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( `author` varchar(255), `content_bin` blob, -- v0.7 `link` varchar(1023) CHARACTER SET latin1 NOT NULL, - `date` int(11), + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) NOT NULL, -- v1.2, Until year 2038 + `hash` BINARY(16), -- v1.2 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, -- v0.7 @@ -50,6 +52,7 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( UNIQUE KEY (`id_feed`,`guid`), -- v0.7 INDEX (`is_favorite`), -- v0.7 INDEX (`is_read`) -- v0.7 + INDEX entry_lastSeen_index (`lastSeen`) -- v1.2 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB; diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 30bca2810..7517ead45 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -14,7 +14,7 @@ $SQL_CREATE_TABLES = array( `name` varchar(255) NOT NULL, `website` varchar(255), `description` text, - `lastUpdate` int(11) DEFAULT 0, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 `priority` tinyint(2) NOT NULL DEFAULT 10, `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, @@ -38,7 +38,9 @@ $SQL_CREATE_TABLES = array( `author` varchar(255), `content` text, `link` varchar(1023) NOT NULL, - `date` int(11), + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) NOT NULL, -- v1.2, Until year 2038 + `hash` BINARY(16), -- v1.2 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, @@ -50,6 +52,7 @@ $SQL_CREATE_TABLES = array( 'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `%1$sentry`(`is_favorite`);', 'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `%1$sentry`(`is_read`);', +'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.2 'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', ); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index e5fe73041..c6bdfde0e 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -38,7 +38,7 @@ function classAutoloader($class) { include(APP_PATH . '/Models/' . $components[1] . '.php'); return; case 3: //Controllers, Exceptions - @include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); + include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); return; } } elseif (strpos($class, 'Minz') === 0) { -- cgit v1.2.3 From d229216cccbd746b46630a44fa508ef0367ea1a1 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 22 Apr 2015 00:24:22 -0400 Subject: Split the search into values Before, the search was a single value. Now it is splited in chuncks when separated by spaces. Except if they are enclosed by single quotes or double quotes. For some reasons, the unit tests are working for both single and double quotes but the search box isn't. It is working only with single quotes. We need to investigate the reason of this behavior. See #823 --- app/Models/EntryDAO.php | 8 +++-- app/Models/Search.php | 32 +++++++++++++++++-- tests/app/Models/SearchTest.php | 68 +++++++++++++++++++++++++---------------- 3 files changed, 77 insertions(+), 31 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 9736d5cd3..5bdc216bc 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -478,11 +478,13 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } } if ($filter->getSearch()) { - $search .= 'AND ' . $this->sqlconcat('e1.title', $this->isCompressed() ? 'UNCOMPRESS(content_bin)' : 'content') . ' LIKE ? '; - $values[] = "%{$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 ? '; + $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 ' : '') diff --git a/app/Models/Search.php b/app/Models/Search.php index 84688be2e..575a9a2cb 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -34,9 +34,9 @@ class FreshRSS_Search { $input = $this->parsePubdateSearch($input); $input = $this->parseDateSearch($input); $input = $this->parseTagsSeach($input); - $this->search = $this->cleanSearch($input); + $this->parseSearch($input); } - + public function __toString() { return $this->getRawInput(); } @@ -187,6 +187,34 @@ class FreshRSS_Search { return $input; } + /** + * Parse the search string to find search values. + * Every word is a distinct search value, except when using a delimiter. + * Supported delimiters are single quote (') and double quotes ("). + * + * @param string $input + * @return string + */ + private function parseSearch($input) { + $input = $this->cleanSearch($input); + if (strcmp($input, '') == 0) { + return; + } + if (preg_match_all('/(?P[\'"])(?P.*)(?P=delim)/U', $input, $matches)) { + $this->search = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $input = $this->cleanSearch($input); + if (strcmp($input, '') == 0) { + return; + } + if (is_array($this->search)) { + $this->search = array_merge($this->search, explode(' ', $input)); + } else { + $this->search = explode(' ', $input); + } + } + /** * Remove all unnecessary spaces in the search * diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 9e3ca6765..73ff56cc6 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -51,20 +51,21 @@ class SearchTest extends \PHPUnit_Framework_TestCase { public function provideIntitleSearch() { return array( array('intitle:word1', 'word1', null), - array('intitle:word1 word2', 'word1', 'word2'), + array('intitle:word1 word2', 'word1', array('word2')), array('intitle:"word1 word2"', 'word1 word2', null), array("intitle:'word1 word2'", 'word1 word2', null), - array('word1 intitle:word2', 'word2', 'word1'), - array('word1 intitle:word2 word3', 'word2', 'word1 word3'), - array('word1 intitle:"word2 word3"', 'word2 word3', 'word1'), - array("word1 intitle:'word2 word3'", 'word2 word3', 'word1'), - array('intitle:word1 intitle:word2', 'word1', 'intitle:word2'), - array('intitle: word1 word2', null, 'word1 word2'), + array('word1 intitle:word2', 'word2', array('word1')), + array('word1 intitle:word2 word3', 'word2', array('word1', 'word3')), + array('word1 intitle:"word2 word3"', 'word2 word3', array('word1')), + array("word1 intitle:'word2 word3'", 'word2 word3', array('word1')), + array('intitle:word1 intitle:word2', 'word1', array('intitle:word2')), + array('intitle: word1 word2', null, array('word1', 'word2')), array('intitle:123', '123', null), - array('intitle:"word1 word2" word3"', 'word1 word2', 'word3"'), - array("intitle:'word1 word2' word3'", 'word1 word2', "word3'"), + array('intitle:"word1 word2" word3"', 'word1 word2', array('word3"')), + array("intitle:'word1 word2' word3'", 'word1 word2', array("word3'")), array('intitle:"word1 word2\' word3"', "word1 word2' word3", null), array("intitle:'word1 word2\" word3'", 'word1 word2" word3', null), + array("intitle:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')), ); } @@ -86,20 +87,21 @@ class SearchTest extends \PHPUnit_Framework_TestCase { public function provideAuthorSearch() { return array( array('author:word1', 'word1', null), - array('author:word1 word2', 'word1', 'word2'), + array('author:word1 word2', 'word1', array('word2')), array('author:"word1 word2"', 'word1 word2', null), array("author:'word1 word2'", 'word1 word2', null), - array('word1 author:word2', 'word2', 'word1'), - array('word1 author:word2 word3', 'word2', 'word1 word3'), - array('word1 author:"word2 word3"', 'word2 word3', 'word1'), - array("word1 author:'word2 word3'", 'word2 word3', 'word1'), - array('author:word1 author:word2', 'word1', 'author:word2'), - array('author: word1 word2', null, 'word1 word2'), + array('word1 author:word2', 'word2', array('word1')), + array('word1 author:word2 word3', 'word2', array('word1', 'word3')), + array('word1 author:"word2 word3"', 'word2 word3', array('word1')), + array("word1 author:'word2 word3'", 'word2 word3', array('word1')), + array('author:word1 author:word2', 'word1', array('author:word2')), + array('author: word1 word2', null, array('word1', 'word2')), array('author:123', '123', null), - array('author:"word1 word2" word3"', 'word1 word2', 'word3"'), - array("author:'word1 word2' word3'", 'word1 word2', "word3'"), + array('author:"word1 word2" word3"', 'word1 word2', array('word3"')), + array("author:'word1 word2' word3'", 'word1 word2', array("word3'")), array('author:"word1 word2\' word3"', "word1 word2' word3", null), array("author:'word1 word2\" word3'", 'word1 word2" word3', null), + array("author:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')), ); } @@ -121,10 +123,11 @@ class SearchTest extends \PHPUnit_Framework_TestCase { public function provideInurlSearch() { return array( array('inurl:word1', 'word1', null), - array('inurl: word1', null, 'word1'), + array('inurl: word1', null, array('word1')), array('inurl:123', '123', null), - array('inurl:word1 word2', 'word1', 'word2'), - array('inurl:"word1 word2"', '"word1', 'word2"'), + array('inurl:word1 word2', 'word1', array('word2')), + array('inurl:"word1 word2"', '"word1', array('word2"')), + array("inurl:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')), ); } @@ -198,11 +201,12 @@ class SearchTest extends \PHPUnit_Framework_TestCase { public function provideTagsSearch() { return array( array('#word1', array('word1'), null), - array('# word1', null, '# word1'), + array('# word1', null, array('#', 'word1')), array('#123', array('123'), null), - array('#word1 word2', array('word1'), 'word2'), - array('#"word1 word2"', array('"word1'), 'word2"'), + 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')), ); } @@ -257,7 +261,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase { '1172725200', '1210564799', array('word4', 'word5'), - 'word6', + 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', @@ -269,7 +273,19 @@ class SearchTest extends \PHPUnit_Framework_TestCase { '1172725200', '1210564799', array('word4', 'word5'), - 'word6 word7', + 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', + 'word1', + '1172725200', + '1210564799', + 'word2', + 'word3', + '1172725200', + '1210564799', + array('word4', 'word5'), + array('word7 word8', 'word6'), ), ); } -- cgit v1.2.3 From 7f7de31c1dcb6599be5c5713f36b4bde1d03d47a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 9 May 2015 13:07:54 +0200 Subject: SQL: update request for updated articles https://github.com/FreshRSS/FreshRSS/issues/798 --- app/Controllers/feedController.php | 2 +- app/Models/Entry.php | 4 ++-- app/Models/EntryDAO.php | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 08a0257a2..59c9174fb 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -343,7 +343,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } else { //This entry already exists but has been updated Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . ', old hash ' . $existingHash . ', new hash ' . $entry->hash()); - $entry->_isRead($is_read); //Reset is_read + $entry->_isRead(null); //Change is_read according to policy. //TODO: Implement option if (!$entryDAO->hasTransaction()) { $entryDAO->beginTransaction(); } diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 6931c9f25..a562a963a 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -15,7 +15,7 @@ class FreshRSS_Entry extends Minz_Model { private $link; private $date; private $hash = null; - private $is_read; + private $is_read; //Nullable boolean private $is_favorite; private $feed; private $tags; @@ -125,7 +125,7 @@ class FreshRSS_Entry extends Minz_Model { $this->date = $value > 1 ? $value : time(); } public function _isRead($value) { - $this->is_read = $value; + $this->is_read = $value === null ? null : (bool)$value; } public function _isFavorite($value) { $this->is_favorite = $value; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 5b4b85547..543b61573 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -91,11 +91,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { private $updateEntryPrepared = null; public function updateEntry($valuesTmp) { + if (!isset($valuesTmp['is_read'])) { + $valuesTmp['is_read'] = null; + } + if ($this->updateEntryPrepared === null) { $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET title=?, author=?, ' . ($this->isCompressed() ? 'content_bin=COMPRESS(?)' : 'content=?') - . ', link=?, date=?, lastSeen=?, hash=X?, is_read=?, tags=? ' + . ', link=?, date=?, lastSeen=?, hash=X?, ' + . ($valuesTmp['is_read'] === null ? '' : 'is_read=?, ') + . 'tags=? ' . 'WHERE id_feed=? AND guid=?'; $this->updateEntryPrepared = $this->bd->prepare($sql); } @@ -108,11 +114,15 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $valuesTmp['date'], time(), $valuesTmp['hash'], - $valuesTmp['is_read'] ? 1 : 0, + ); + if ($valuesTmp['is_read'] !== null) { + $values[] = $valuesTmp['is_read'] ? 1 : 0; + } + $values = array_merge($values, array( substr($valuesTmp['tags'], 0, 1023), $valuesTmp['id_feed'], substr($valuesTmp['guid'], 0, 760), - ); + )); if ($this->updateEntryPrepared && $this->updateEntryPrepared->execute($values)) { return $this->bd->lastInsertId(); -- cgit v1.2.3 From 993466844405bd9854d890d6d5ebf763ed8b78cb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 9 May 2015 23:37:56 +0200 Subject: SQL: more robust purge https://github.com/FreshRSS/FreshRSS/issues/798 https://github.com/FreshRSS/FreshRSS/issues/493 --- app/Controllers/feedController.php | 13 +++++-------- app/Models/Feed.php | 3 +-- app/Models/FeedDAO.php | 8 +++++--- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 59c9174fb..5657d4a88 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -329,7 +329,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // For this feed, check existing GUIDs already in database. $existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids); unset($newGuids); - $use_declared_date = empty($existingHashForGuids); $oldGuids = array(); // Add entries in database if possible. @@ -353,14 +352,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // This entry should not be added considering configuration and date. $oldGuids[] = $entry->guid(); } else { - $id = uTimeString(); - if ($use_declared_date || $entry_date < $date_min) { - // Use declared date at first import. + if ($entry_date < $date_min) { $id = min(time(), $entry_date) . uSecString(); + $entry->_isRead(true); //Old article that was not in database. Probably an error, so mark as read + } else { + $id = uTimeString(); + $entry->_isRead($is_read); } - $entry->_id($id); - $entry->_isRead($is_read); $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); if ($entry === null) { @@ -376,7 +375,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } $entryDAO->updateLastSeen($feed->id(), $oldGuids); } - //TODO: updateLastSeen old GUIDS once in a while, in the case of caching (i.e. the whole feed content has not changed) if ($feed_history >= 0 && rand(0, 30) === 1) { // TODO: move this function in web cron when available (see entry::purge) @@ -384,7 +382,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if (!$entryDAO->hasTransaction()) { $entryDAO->beginTransaction(); } - //TODO: more robust system based on entry.lastSeen to avoid cleaning entries that are still published in the RSS feed. $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 27c83ffd5..5d377de9a 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -245,7 +245,7 @@ class FreshRSS_Feed extends Minz_Model { $this->_url($clean_url); } - if (($mtime === true) ||($mtime > $this->lastUpdate)) { + if (($mtime === true) || ($mtime > $this->lastUpdate)) { Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); $this->loadEntries($feed); // et on charge les articles du flux } else { @@ -255,7 +255,6 @@ class FreshRSS_Feed extends Minz_Model { $feed->__destruct(); //http://simplepie.org/wiki/faq/i_m_getting_memory_leaks unset($feed); - //TODO: Return a different information in case of cache/no-cache, and give access to the GUIDs in case of cache } } } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index f48beee6e..c13e2b008 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -322,10 +322,12 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $affected; } - public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) just after + public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) or updateCachedValues() just after $sql = 'DELETE FROM `' . $this->prefix . 'entry` ' - . 'WHERE id_feed = :id_feed AND id <= :id_max AND is_favorite=0 AND id NOT IN ' - . '(SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed = :id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' + . 'WHERE id_feed = :id_feed AND id <= :id_max ' + . 'AND is_favorite=0 ' //Do not remove favourites + . 'AND lastSeen < (SELECT maxLastSeen FROM (SELECT (MAX(e3.lastSeen) - 99) AS maxLastSeen FROM `' . $this->prefix . 'entry` e3 WHERE e3.id_feed = :id_feed) recent) ' //Do not remove the most newly seen articles, plus a few seconds of tolerance + . 'AND id NOT IN (SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed = :id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select: MySQL doesn't support 'LIMIT & IN/ALL/ANY/SOME subquery' $stm = $this->bd->prepare($sql); $id_max = intval($date_min) . '000000'; -- cgit v1.2.3 From a7bc54bb996a87a66127101be548d181dc8dd935 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 9 May 2015 23:45:52 +0200 Subject: Minor spaces --- app/Models/FeedDAO.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index c13e2b008..76025ff53 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -324,10 +324,10 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) or updateCachedValues() just after $sql = 'DELETE FROM `' . $this->prefix . 'entry` ' - . 'WHERE id_feed = :id_feed AND id <= :id_max ' + . 'WHERE id_feed=:id_feed AND id<=:id_max ' . 'AND is_favorite=0 ' //Do not remove favourites - . 'AND lastSeen < (SELECT maxLastSeen FROM (SELECT (MAX(e3.lastSeen) - 99) AS maxLastSeen FROM `' . $this->prefix . 'entry` e3 WHERE e3.id_feed = :id_feed) recent) ' //Do not remove the most newly seen articles, plus a few seconds of tolerance - . 'AND id NOT IN (SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed = :id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select: MySQL doesn't support 'LIMIT & IN/ALL/ANY/SOME subquery' + . 'AND lastSeen < (SELECT maxLastSeen FROM (SELECT (MAX(e3.lastSeen)-99) AS maxLastSeen FROM `' . $this->prefix . 'entry` e3 WHERE e3.id_feed=:id_feed) recent) ' //Do not remove the most newly seen articles, plus a few seconds of tolerance + . 'AND id NOT IN (SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=:id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select: MySQL doesn't support 'LIMIT & IN/ALL/ANY/SOME subquery' $stm = $this->bd->prepare($sql); $id_max = intval($date_min) . '000000'; -- cgit v1.2.3 From 5f545dfda2b6700579b856c815e1914a2dd62553 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 May 2015 12:14:38 +0200 Subject: Global option to mark updated articles as unread https://github.com/FreshRSS/FreshRSS/issues/798 --- app/Controllers/feedController.php | 3 ++- data/config.default.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 5657d4a88..03f438888 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -342,7 +342,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } else { //This entry already exists but has been updated Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . ', old hash ' . $existingHash . ', new hash ' . $entry->hash()); - $entry->_isRead(null); //Change is_read according to policy. //TODO: Implement option + //TODO: Make an updated/is_read policy by feed, in addition to the global one. + $entry->_isRead(FreshRSS_Context::$system_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. if (!$entryDAO->hasTransaction()) { $entryDAO->beginTransaction(); } diff --git a/data/config.default.php b/data/config.default.php index 8be203d36..dc947f154 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -55,6 +55,10 @@ return array( # SimplePie, which is retrieving RSS feeds via HTTP requests. 'simplepie_syslog_enabled' => true, + # In the case an article has changed (e.g. updated content): + # Set to `true` to mark it unread, or `false` to leave it as-is. + 'mark_updated_article_unread' => false, + 'limits' => array( # Duration in seconds of the SimplePie cache, -- cgit v1.2.3 From 0d0c6b7493161d350ca2eb1d4c45c0c70cfcbb92 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 May 2015 14:04:12 +0200 Subject: Moved updated/unread option from global to user https://github.com/FreshRSS/FreshRSS/issues/798 --- app/Controllers/configureController.php | 1 + app/Controllers/feedController.php | 2 +- app/Models/ConfigurationSetter.php | 4 ++++ app/i18n/de/conf.php | 1 + app/i18n/en/conf.php | 1 + app/i18n/fr/conf.php | 1 + app/views/configure/reading.phtml | 9 +++++++++ data/config.default.php | 4 ---- data/users/_/config.default.php | 5 +++++ 9 files changed, 23 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index fc92aa0c2..248a3edcc 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -112,6 +112,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->sticky_post = Minz_Request::param('sticky_post', false); FreshRSS_Context::$user_conf->reading_confirm = Minz_Request::param('reading_confirm', false); FreshRSS_Context::$user_conf->auto_remove_article = Minz_Request::param('auto_remove_article', false); + FreshRSS_Context::$user_conf->mark_updated_article_unread = Minz_Request::param('mark_updated_article_unread', false); FreshRSS_Context::$user_conf->sort_order = Minz_Request::param('sort_order', 'DESC'); FreshRSS_Context::$user_conf->mark_when = array( 'article' => Minz_Request::param('mark_open_article', false), diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 03f438888..a36a38ce2 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -343,7 +343,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . ', old hash ' . $existingHash . ', new hash ' . $entry->hash()); //TODO: Make an updated/is_read policy by feed, in addition to the global one. - $entry->_isRead(FreshRSS_Context::$system_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. + $entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. if (!$entryDAO->hasTransaction()) { $entryDAO->beginTransaction(); } diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 7f433239c..4bd29ecb0 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -189,6 +189,10 @@ class FreshRSS_ConfigurationSetter { $data['auto_remove_article'] = $this->handleBool($value); } + private function _mark_updated_article_unread(&$data, $value) { + $data['mark_updated_article_unread'] = $this->handleBool($value); + } + private function _display_categories(&$data, $value) { $data['display_categories'] = $this->handleBool($value); } diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 64c2c0945..df2c07d49 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -84,6 +84,7 @@ return array( 'articles_per_page' => 'Anzahl der Artikel pro Seite', 'auto_load_more' => 'Die nächsten Artikel am Seitenende laden', 'auto_remove_article' => 'Artikel nach dem Lesen verstecken', + 'mark_updated_article_unread' => 'Markieren Sie aktualisierte Artikel als ungelesen', 'confirm_enabled' => 'Bei der Aktion „Alle als gelesen markieren“ einen Bestätigungsdialog anzeigen', 'display_articles_unfolded' => 'Artikel standardmäßig ausgeklappt zeigen', 'display_categories_unfolded' => 'Kategorien standardmäßig eingeklappt zeigen', diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 308c45d2c..683781696 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -84,6 +84,7 @@ return array( 'articles_per_page' => 'Number of articles per page', 'auto_load_more' => 'Load next articles at the page bottom', 'auto_remove_article' => 'Hide articles after reading', + 'mark_updated_article_unread' => 'Mark updated articles as unread', 'confirm_enabled' => 'Display a confirmation dialog on “mark all as read” actions', 'display_articles_unfolded' => 'Show articles unfolded by default', 'display_categories_unfolded' => 'Show categories folded by default', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index d38445b99..87f9be290 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -84,6 +84,7 @@ return array( 'articles_per_page' => 'Nombre d’articles par page', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'auto_remove_article' => 'Cacher les articles après lecture', + 'mark_updated_article_unread' => 'Marquer les articles mis à jour comme non-lus', 'confirm_enabled' => 'Afficher une confirmation lors des actions “marquer tout comme lu”', 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', 'display_categories_unfolded' => 'Afficher les catégories pliées par défaut', diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 8b123afa8..1b7a101df 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -125,6 +125,15 @@
    +
    +
    + +
    +
    +
    diff --git a/data/config.default.php b/data/config.default.php index dc947f154..8be203d36 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -55,10 +55,6 @@ return array( # SimplePie, which is retrieving RSS feeds via HTTP requests. 'simplepie_syslog_enabled' => true, - # In the case an article has changed (e.g. updated content): - # Set to `true` to mark it unread, or `false` to leave it as-is. - 'mark_updated_article_unread' => false, - 'limits' => array( # Duration in seconds of the SimplePie cache, diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index 6d3f73a13..bf74ca1de 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -22,6 +22,11 @@ return array ( 'sticky_post' => true, 'reading_confirm' => false, 'auto_remove_article' => false, + + # In the case an article has changed (e.g. updated content): + # Set to `true` to mark it unread, or `false` to leave it as-is. + 'mark_updated_article_unread' => false, + 'sort_order' => 'DESC', 'anon_access' => false, 'mark_when' => array ( -- cgit v1.2.3 From 79f0f2bbb48f5f4fb1ebd9350bf9bf6e1182e6cf Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 May 2015 18:21:21 +0200 Subject: Bug Page 403 ne peut s'afficher si Translate n'est pas instancié avant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/FreshRSS/FreshRSS/issues/821 --- app/Controllers/feedController.php | 2 +- app/FreshRSS.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index a36a38ce2..0443b4159 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -146,7 +146,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $name = $feed->name(); $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); if ($feed === null) { - Minz_Request::bad(_t('feed_not_added', $name), $url_redirect); + Minz_Request::bad(_t('feedback.sub.feed.not_added', $name), $url_redirect); } $values = array( diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 021687999..044de9cd4 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -63,10 +63,11 @@ class FreshRSS extends Minz_FrontController { // Basic protection against XSRF attacks FreshRSS_Auth::removeAccess(); $http_referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; + Minz_Translate::init('en'); //TODO: Better choice of fallback language Minz_Error::error( 403, array('error' => array( - _t('access_denied'), + _t('feedback.access.denied'), ' [HTTP_REFERER=' . htmlspecialchars($http_referer) . ']' )) ); -- cgit v1.2.3 From f7a502b06e7b0fe0b8bbc5f41d96d4ea08eee98a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 May 2015 19:20:46 +0200 Subject: Cannot create an account with sqlite https://github.com/FreshRSS/FreshRSS/issues/770 --- app/install.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app') diff --git a/app/install.php b/app/install.php index 177173fdb..5f43b6415 100644 --- a/app/install.php +++ b/app/install.php @@ -741,6 +741,13 @@ function printStep3() { -- cgit v1.2.3 From 0745252b68f6f9b7c91ea437893b5f33b7a224c3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 May 2015 20:31:03 +0200 Subject: Hexadecimal literals do not work with SQLite/PDO X'09AF' hexadecimal literals do not work with SQLite/PDO. Replaced by PHP hex2bin(). https://github.com/FreshRSS/FreshRSS/commit/711530a512b370d79b079205ce1f8376174f7f03 --- app/Models/EntryDAO.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index ebaeb3868..172eac897 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -54,7 +54,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { . ', link, date, lastSeen, hash, is_read, is_favorite, id_feed, tags) ' . 'VALUES(?, ?, ?, ?, ' . ($this->isCompressed() ? 'COMPRESS(?)' : '?') - . ', ?, ?, ?, X?, ?, ?, ?, ?)'; + . ', ?, ?, ?, ?, ?, ?, ?, ?)'; $this->addEntryPrepared = $this->bd->prepare($sql); } @@ -67,7 +67,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { substr($valuesTmp['link'], 0, 1023), $valuesTmp['date'], time(), - $valuesTmp['hash'], + hex2bin($valuesTmp['hash']), // X'09AF' hexadecimal literals do not work with SQLite/PDO $valuesTmp['is_read'] ? 1 : 0, $valuesTmp['is_favorite'] ? 1 : 0, $valuesTmp['id_feed'], @@ -77,7 +77,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if ($this->addEntryPrepared && $this->addEntryPrepared->execute($values)) { return $this->bd->lastInsertId(); } else { - $info = $this->addEntryPrepared == null ? array(2 => 'syntax error') : $this->addEntryPrepared->errorInfo(); + $info = $this->addEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->addEntryPrepared->errorInfo(); if ($this->autoAddColumn($info)) { return $this->addEntry($valuesTmp); } elseif ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries @@ -99,7 +99,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET title=?, author=?, ' . ($this->isCompressed() ? 'content_bin=COMPRESS(?)' : 'content=?') - . ', link=?, date=?, lastSeen=?, hash=X?, ' + . ', link=?, date=?, lastSeen=?, hash=?, ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=?, ') . 'tags=? ' . 'WHERE id_feed=? AND guid=?'; @@ -113,7 +113,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { substr($valuesTmp['link'], 0, 1023), $valuesTmp['date'], time(), - $valuesTmp['hash'], + hex2bin($valuesTmp['hash']), ); if ($valuesTmp['is_read'] !== null) { $values[] = $valuesTmp['is_read'] ? 1 : 0; @@ -127,7 +127,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if ($this->updateEntryPrepared && $this->updateEntryPrepared->execute($values)) { return $this->bd->lastInsertId(); } else { - $info = $this->updateEntryPrepared == null ? array(2 => 'syntax error') : $this->updateEntryPrepared->errorInfo(); + $info = $this->updateEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->updateEntryPrepared->errorInfo(); if ($this->autoAddColumn($info)) { return $this->updateEntry($valuesTmp); } @@ -598,7 +598,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $result; } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); if ($this->autoAddColumn($info)) { return $this->listHashForFeedGuids($id_feed, $guids); } @@ -619,7 +619,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); if ($this->autoAddColumn($info)) { return $this->updateLastSeen($id_feed, $guids); } -- cgit v1.2.3 From ead849dbe3717966dff50e55d6bf849dafde87b7 Mon Sep 17 00:00:00 2001 From: Tets Date: Mon, 11 May 2015 10:20:17 +0200 Subject: Czech translation --- app/i18n/cz/feedback.php | 2 +- app/i18n/cz/sub.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php index 52ff029ef..b75a4a15a 100644 --- a/app/i18n/cz/feedback.php +++ b/app/i18n/cz/feedback.php @@ -11,7 +11,7 @@ return array( 'auth' => array( 'form' => array( 'not_set' => 'Nastal problém s konfigurací přihlašovacího systému. Zkuste to prosím později.', - 'set' => 'Webové formulář je nyní výchozí přihlašovací systém.', + 'set' => 'Webový formulář je nyní výchozí přihlašovací systém.', ), 'login' => array( 'invalid' => 'Login není platný', diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php index d7ff63fe9..78712506c 100644 --- a/app/i18n/cz/sub.php +++ b/app/i18n/cz/sub.php @@ -21,7 +21,7 @@ return array( 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', 'css_path' => 'Původní CSS soubor článku z webových stránek', 'description' => 'Popis', - 'empty' => 'Kanál je prazdný. Ověřte prosím zda je ještě autorem udržován.', + 'empty' => 'Kanál je prázdný. Ověřte prosím zda je ještě autorem udržován.', 'error' => 'Vyskytl se problém s kanálem. Ověřte že je vždy dostupný, prosím, a poté jej aktualizujte.', 'in_main_stream' => 'Zobrazit ve “Všechny kanály”', 'informations' => 'Informace', -- cgit v1.2.3 From 217c191a1ba3ac03b847d261a32e19975380fcad Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 May 2015 22:42:41 +0200 Subject: More SQLite compatibility Additional changes to add compatibility with SQLite for the new hash/lastSeen mode of updating articles. --- app/Models/EntryDAO.php | 71 ++++++++++++++++++++++++------------------ app/Models/EntryDAOSQLite.php | 15 +++++++++ app/Models/FeedDAO.php | 11 ++++--- app/SQL/install.sql.mysql.php | 2 +- app/SQL/install.sql.sqlite.php | 2 +- app/install.php | 2 ++ lib/Minz/ModelPdo.php | 5 +++ 7 files changed, 70 insertions(+), 38 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 172eac897..eae9683ad 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -6,38 +6,48 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return parent::$sharedDbType !== 'sqlite'; } - protected function autoAddColumn($errorInfo) { - if (isset($errorInfo[0])) { - if ($errorInfo[0] == '42S22') { //ER_BAD_FIELD_ERROR - $hasTransaction = false; - try { - $stm = null; - if (stripos($errorInfo[2], 'lastSeen') !== false) { //v1.2 - if (!$this->bd->inTransaction()) { - $this->bd->beginTransaction(); - $hasTransaction = true; - } - $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN lastSeen INT(11) NOT NULL'); - if ($stm && $stm->execute()) { - $stm = $this->bd->prepare('CREATE INDEX entry_lastSeen_index ON `' . $this->prefix . 'entry`(`lastSeen`);'); //"IF NOT EXISTS" does not exist in MySQL 5.7 - if ($stm && $stm->execute()) { - if ($hasTransaction) { - $this->bd->commit(); - } - return true; - } - } + protected function addColumn($name) { + Minz_Log::debug('FreshRSS_EntryDAO::autoAddColumn: ' . $name); + $hasTransaction = false; + try { + $stm = null; + if ($name === 'lastSeen') { //v1.2 + if (!$this->bd->inTransaction()) { + $this->bd->beginTransaction(); + $hasTransaction = true; + } + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN lastSeen INT(11) DEFAULT 0'); + if ($stm && $stm->execute()) { + $stm = $this->bd->prepare('CREATE INDEX entry_lastSeen_index ON `' . $this->prefix . 'entry`(`lastSeen`);'); //"IF NOT EXISTS" does not exist in MySQL 5.7 + if ($stm && $stm->execute()) { if ($hasTransaction) { - $this->bd->rollBack(); + $this->bd->commit(); } - } elseif (stripos($errorInfo[2], 'hash') !== false) { //v1.2 - $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16) NOT NULL'); - return $stm && $stm->execute(); + return true; } - } catch (Exception $e) { - Minz_Log::debug('FreshRSS_EntryDAO::autoAddColumn error: ' . $e->getMessage()); - if ($hasTransaction) { - $this->bd->rollBack(); + } + if ($hasTransaction) { + $this->bd->rollBack(); + } + } elseif ($name === 'hash') { //v1.2 + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)'); + return $stm && $stm->execute(); + } + } catch (Exception $e) { + Minz_Log::debug('FreshRSS_EntryDAO::autoAddColumn error: ' . $e->getMessage()); + if ($hasTransaction) { + $this->bd->rollBack(); + } + } + return false; + } + + protected function autoAddColumn($errorInfo) { + if (isset($errorInfo[0])) { + if ($errorInfo[0] == '42S22') { //ER_BAD_FIELD_ERROR + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($errorInfo[2], $column) !== false) { + return $this->addColumn($column); } } } @@ -82,7 +92,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $this->addEntry($valuesTmp); } elseif ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); + . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']. ' ' . $this->addEntryPrepared); } return false; } @@ -597,7 +607,6 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } return $result; } else { - $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); if ($this->autoAddColumn($info)) { return $this->listHashForFeedGuids($id_feed, $guids); diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index ffe0f037c..ff049d813 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -2,6 +2,21 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { + protected function autoAddColumn($errorInfo) { + if (empty($errorInfo[0]) || $errorInfo[0] == '42S22') { //ER_BAD_FIELD_ERROR + if ($tableInfo = $this->bd->query("SELECT sql FROM sqlite_master where name='entry'")) { + $showCreate = $tableInfo->fetchColumn(); + Minz_Log::debug('FreshRSS_EntryDAOSQLite::autoAddColumn: ' . $showCreate); + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($showCreate, $column) === false) { + return $this->addColumn($column); + } + } + } + } + return false; + } + protected function sqlConcat($s1, $s2) { return $s1 . '||' . $s2; } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 76025ff53..475d39286 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -330,11 +330,12 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { . 'AND id NOT IN (SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=:id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select: MySQL doesn't support 'LIMIT & IN/ALL/ANY/SOME subquery' $stm = $this->bd->prepare($sql); - $id_max = intval($date_min) . '000000'; - - $stm->bindParam(':id_feed', $id, PDO::PARAM_INT); - $stm->bindParam(':id_max', $id_max, PDO::PARAM_STR); - $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + if ($stm) { + $id_max = intval($date_min) . '000000'; + $stm->bindParam(':id_feed', $id, PDO::PARAM_INT); + $stm->bindParam(':id_max', $id_max, PDO::PARAM_STR); + $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + } if ($stm && $stm->execute()) { return $stm->rowCount(); diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index afdd821b2..9c6af405d 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( `content_bin` blob, -- v0.7 `link` varchar(1023) CHARACTER SET latin1 NOT NULL, `date` int(11), -- Until year 2038 - `lastSeen` INT(11) NOT NULL, -- v1.2, Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.2, Until year 2038 `hash` BINARY(16), -- v1.2 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 7517ead45..77e8e094c 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -39,7 +39,7 @@ $SQL_CREATE_TABLES = array( `content` text, `link` varchar(1023) NOT NULL, `date` int(11), -- Until year 2038 - `lastSeen` INT(11) NOT NULL, -- v1.2, Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.2, Until year 2038 `hash` BINARY(16), -- v1.2 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, diff --git a/app/install.php b/app/install.php index 177173fdb..86afb9318 100644 --- a/app/install.php +++ b/app/install.php @@ -168,8 +168,10 @@ function saveStep3() { $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] .(empty($_SESSION['default_user']) ? '' :($_SESSION['default_user'] . '_')); } + //TODO: load `config.default.php` as default $config_array = array( 'environment' => 'production', + 'simplepie_syslog_enabled' => true, 'salt' => $_SESSION['salt'], 'title' => $_SESSION['title'], 'default_user' => $_SESSION['default_user'], diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index ac7a1bed7..3e8ec1f43 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -134,4 +134,9 @@ class MinzPDO extends PDO { MinzPDO::check($statement); return parent::exec($statement); } + + public function query($statement) { + MinzPDO::check($statement); + return parent::query($statement); + } } -- cgit v1.2.3 From 256c8613a4046931dcd28ab22b6aebe8752a98c2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 15 May 2015 03:21:36 +0200 Subject: First draft of PubSubHubbub https://github.com/FreshRSS/FreshRSS/issues/312 Requires setting base_url in config.php. Currently using the filesystem (no change to the database) --- app/Controllers/feedController.php | 55 +++++++++++------ app/Models/Feed.php | 69 ++++++++++++++++++++- constants.php | 1 + data/PubSubHubbub/feeds/.gitignore | 1 + data/PubSubHubbub/feeds/README.md | 12 ++++ data/PubSubHubbub/secrets/.gitignore | 1 + data/PubSubHubbub/secrets/README.md | 4 ++ data/config.default.php | 8 ++- lib/lib_rss.php | 9 +++ p/api/pshb.php | 116 +++++++++++++++++++++++++++++++++++ 10 files changed, 252 insertions(+), 24 deletions(-) create mode 100644 data/PubSubHubbub/feeds/.gitignore create mode 100644 data/PubSubHubbub/feeds/README.md create mode 100644 data/PubSubHubbub/secrets/.gitignore create mode 100644 data/PubSubHubbub/secrets/README.md create mode 100644 p/api/pshb.php (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 0443b4159..9117da639 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -168,6 +168,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Ok, feed has been added in database. Now we have to refresh entries. $feed->_id($id); $feed->faviconPrepare(); + $feed->pubSubHubbubPrepare(); $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; @@ -261,12 +262,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { * This action actualizes entries from one or several feeds. * * Parameters are: - * - id (default: false) + * - id (default: false): Feed ID + * - url (default: false): Feed URL * - force (default: false) - * If id is not specified, all the feeds are actualized. But if force is + * If id and url are not specified, all the feeds are actualized. But if force is * false, process stops at 10 feeds to avoid time execution problem. */ - public function actualizeAction() { + public function actualizeAction($simplePie = null) { @set_time_limit(300); $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -274,14 +276,15 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Session::_param('actualize_feeds', false); $id = Minz_Request::param('id'); + $url = Minz_Request::param('url'); $force = Minz_Request::param('force'); // Create a list of feeds to actualize. // If id is set and valid, corresponding feed is added to the list but // alone in order to automatize further process. $feeds = array(); - if ($id) { - $feed = $feedDAO->searchById($id); + if ($id || $url) { + $feed = $id ? $feedDAO->searchById($id) : $feedDAO->searchByUrl($url); if ($feed) { $feeds[] = $feed; } @@ -302,8 +305,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } try { - // Load entries - $feed->load(false); + if ($simplePie) { + $feed->loadEntries($simplePie); //Used by PubSubHubbub + } else { + $feed->load(false); + } } catch (FreshRSS_Feed_Exception $e) { Minz_Log::notice($e->getMessage()); $feedDAO->updateLastUpdate($feed->id(), true); @@ -404,7 +410,16 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } - $feed->faviconPrepare(); + if ($simplePie === null) { + $feed->faviconPrepare(); + if ($feed->url() === 'http://push-pub.appspot.com/feed') { + $secret = $feed->pubSubHubbubPrepare(); + if ($secret != '') { + Minz_Log::debug('PubSubHubbub subscribe ' . $feed->url()); + $feed->pubSubHubbubSubscribe(true, $secret); + } + } + } $feed->unlock(); $updated_feeds++; unset($feed); @@ -427,20 +442,20 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); // No layout in ajax request. $this->view->_useLayout(false); - return; - } - - // Redirect to the main page with correct notification. - if ($updated_feeds === 1) { - $feed = reset($feeds); - Minz_Request::good(_t('feedback.sub.feed.actualized', $feed->name()), array( - 'params' => array('get' => 'f_' . $feed->id()) - )); - } elseif ($updated_feeds > 1) { - Minz_Request::good(_t('feedback.sub.feed.n_actualized', $updated_feeds), array()); } else { - Minz_Request::good(_t('feedback.sub.feed.no_refresh'), array()); + // Redirect to the main page with correct notification. + if ($updated_feeds === 1) { + $feed = reset($feeds); + Minz_Request::good(_t('feedback.sub.feed.actualized', $feed->name()), array( + 'params' => array('get' => 'f_' . $feed->id()) + )); + } elseif ($updated_feeds > 1) { + Minz_Request::good(_t('feedback.sub.feed.n_actualized', $updated_feeds), array()); + } else { + Minz_Request::good(_t('feedback.sub.feed.no_refresh'), array()); + } } + return $updated_feeds; } /** diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 85fb173ec..dcf083ea8 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -19,6 +19,8 @@ class FreshRSS_Feed extends Minz_Model { private $ttl = -2; private $hash = null; private $lockPath = ''; + private $hubUrl = ''; + private $selfUrl = ''; public function __construct($url, $validate=true) { if ($validate) { @@ -226,6 +228,11 @@ class FreshRSS_Feed extends Minz_Model { throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Feed error' : $errorMessage) . ' [' . $url . ']'); } + $links = $feed->get_links('self'); + $this->selfUrl = isset($links[0]) ? $links[0] : null; + $links = $feed->get_links('hub'); + $this->hubUrl = isset($links[0]) ? $links[0] : null; + if ($loadDetails) { // si on a utilisé l'auto-discover, notre url va avoir changé $subscribe_url = $feed->subscribe_url(false); @@ -259,7 +266,7 @@ class FreshRSS_Feed extends Minz_Model { } } - private function loadEntries($feed) { + public function loadEntries($feed) { $entries = array(); foreach ($feed->get_items() as $item) { @@ -333,4 +340,64 @@ class FreshRSS_Feed extends Minz_Model { function unlock() { @unlink($this->lockPath); } + + // + + function pubSubHubbubPrepare() { + $secret = ''; + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { + $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); + if (!file_exists($path . '/hub.txt')) { + @mkdir($path, 0777, true); + file_put_contents($path . '/hub.txt', $this->hubUrl); + $secret = sha1(FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); + file_put_contents($path . '/secret.txt', $secret); + @mkdir(PSHB_PATH . '/secrets/'); + file_put_contents(PSHB_PATH . '/secrets/' . $secret . '.txt', base64url_encode($this->selfUrl)); + Minz_Log::notice('PubSubHubbub prepared for ' . $this->url); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . + 'PubSubHubbub prepared for ' . $this->url . "\n", FILE_APPEND); + } + $path .= '/' . base64url_encode($this->url); + $currentUser = Minz_Session::param('currentUser'); + if (ctype_alnum($currentUser) && !file_exists($path . '/' . $currentUser . '.txt')) { + @mkdir($path, 0777, true); + touch($path . '/' . $currentUser . '.txt'); + } + } + return $secret; + } + + //Parameter true to subscribe, false to unsubscribe. + function pubSubHubbubSubscribe($state, $secret = '') { + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { + $callbackUrl = checkUrl(FreshRSS_Context::$system_conf->base_url . 'api/pshb.php?s=' . $secret); + if ($callbackUrl == '') { + return false; + } + + $ch = curl_init(); + curl_setopt_array($ch, array( + CURLOPT_URL => $this->hubUrl, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_USERAGENT => _t('gen.freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')', + CURLOPT_POSTFIELDS => 'hub.verify=sync' + . '&hub.mode=' . ($state ? 'subscribe' : 'unsubscribe') + . '&hub.topic=' . urlencode($this->selfUrl) + . '&hub.callback=' . urlencode($callbackUrl) + ) + ); + $response = curl_exec($ch); + $info = curl_getinfo($ch); + + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . + 'PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $this->selfUrl . + ' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response . "\n", FILE_APPEND); + return substr($info['http_code'], 0, 1) == '2'; + } + return false; + } + + // } diff --git a/constants.php b/constants.php index b20bf0710..5bb410e29 100644 --- a/constants.php +++ b/constants.php @@ -18,6 +18,7 @@ define('FRESHRSS_PATH', dirname(__FILE__)); define('UPDATE_FILENAME', DATA_PATH . '/update.php'); define('USERS_PATH', DATA_PATH . '/users'); define('CACHE_PATH', DATA_PATH . '/cache'); + define('PSHB_PATH', DATA_PATH . '/PubSubHubbub'); define('LIB_PATH', FRESHRSS_PATH . '/lib'); define('APP_PATH', FRESHRSS_PATH . '/app'); diff --git a/data/PubSubHubbub/feeds/.gitignore b/data/PubSubHubbub/feeds/.gitignore new file mode 100644 index 000000000..150f68c80 --- /dev/null +++ b/data/PubSubHubbub/feeds/.gitignore @@ -0,0 +1 @@ +*/* diff --git a/data/PubSubHubbub/feeds/README.md b/data/PubSubHubbub/feeds/README.md new file mode 100644 index 000000000..15fa8e521 --- /dev/null +++ b/data/PubSubHubbub/feeds/README.md @@ -0,0 +1,12 @@ +List of canonical URLS of the various feeds users have subscribed to. +Several feeds can share the same canonical URL (rel="self"). +Several users can have subscribed to the same feed. + +* ./base64url(canonicalUrl)/ + * ./secret.txt + * ./base64url(feedUrl1)/ + * ./user1.txt + * ./user2.txt + * ./base64url(feedUrl2)/ + * ./user3.txt + * ./user4.txt diff --git a/data/PubSubHubbub/secrets/.gitignore b/data/PubSubHubbub/secrets/.gitignore new file mode 100644 index 000000000..2211df63d --- /dev/null +++ b/data/PubSubHubbub/secrets/.gitignore @@ -0,0 +1 @@ +*.txt diff --git a/data/PubSubHubbub/secrets/README.md b/data/PubSubHubbub/secrets/README.md new file mode 100644 index 000000000..ad8158839 --- /dev/null +++ b/data/PubSubHubbub/secrets/README.md @@ -0,0 +1,4 @@ +List of secrets given to PubSubHubbub hubs + +* ./sha1(random + salt).txt + * base64url(canonicalUrl) diff --git a/data/config.default.php b/data/config.default.php index 8be203d36..80d331df7 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -11,9 +11,11 @@ return array( # Used to make crypto more unique. Generated during install. 'salt' => '', - # Leave empty for most cases. - # Ability to override the address of the FreshRSS instance, - # used when building absolute URLs. + # Specify address of the FreshRSS instance, + # used when building absolute URLs, e.g. for PubSubHubbub. + # Examples: + # https://example.net/FreshRSS/p/ + # https://freshrss.example.net/ 'base_url' => '', # Natural language of the user interface, e.g. `en`, `fr`. diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 6342011c8..191a58f35 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -446,3 +446,12 @@ function array_push_unique(&$array, $value) { function array_remove(&$array, $value) { $array = array_diff($array, array($value)); } + +//RFC 4648 +function base64url_encode($data) { + return strtr(rtrim(base64_encode($data), '='), '+/', '-_'); +} +//RFC 4648 +function base64url_decode($data) { + return base64_decode(strtr($data, '-_', '+/')); +} diff --git a/p/api/pshb.php b/p/api/pshb.php new file mode 100644 index 000000000..bcb8341b1 --- /dev/null +++ b/p/api/pshb.php @@ -0,0 +1,116 @@ + $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); + +$secret = isset($_GET['s']) ? substr($_GET['s'], 0, 128) : ''; +if (!ctype_xdigit($secret)) { + header('HTTP/1.1 422 Unprocessable Entity'); + die('Invalid feed secret format!'); +} +chdir(PSHB_PATH); +$canonical64 = @file_get_contents('secrets/' . $secret . '.txt'); +if ($canonical64 === false) { + header('HTTP/1.1 404 Not Found'); + logMe('Feed secret not found!: ' . $secret); + die('Feed secret not found!'); +} +$canonical64 = trim($canonical64); +if (!preg_match('/^[A-Za-z0-9_-]+$/D', $canonical64)) { + header('HTTP/1.1 500 Internal Server Error'); + logMe('Invalid secret reference!: ' . $canonical64); + die('Invalid secret reference!'); +} +$secret2 = @file_get_contents('feeds/' . $canonical64 . '/secret.txt'); +if ($secret2 === false) { + header('HTTP/1.1 404 Not Found'); + //@unlink('secrets/' . $secret . '.txt'); + logMe('Feed reverse secret not found!: ' . $canonical64); + die('Feed reverse secret not found!'); +} +if ($secret !== $secret2) { + header('HTTP/1.1 500 Internal Server Error'); + logMe('Invalid secret cross-check!: ' . $secret); + die('Invalid secret cross-check!'); +} +chdir('feeds/' . $canonical64); +$users = glob('*/*.txt', GLOB_NOSORT); +if (empty($users)) { + header('HTTP/1.1 410 Gone'); + logMe('Nobody is subscribed to this feed anymore!: ' . $canonical64); + die('Nobody is subscribed to this feed anymore!'); +} + +if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { + //TODO: hub_lease_seconds + exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); +} + +Minz_Configuration::register('system', DATA_PATH . '/config.php', DATA_PATH . '/config.default.php'); +$system_conf = Minz_Configuration::get('system'); +$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) +Minz_Translate::init('en'); +Minz_Request::_param('ajax', true); +$feedController = new FreshRSS_feed_Controller(); + +$simplePie = customSimplePie(); +$simplePie->set_raw_data($ORIGINAL_INPUT); +$simplePie->init(); +unset($ORIGINAL_INPUT); + +$links = $simplePie->get_links('self'); +$self = isset($links[0]) ? $links[0] : null; + +if ($self !== base64url_decode($canonical64)) { + header('HTTP/1.1 422 Unprocessable Entity'); + logMe('Self URL does not match registered canonical URL!: ' . $self); + die('Self URL does not match registered canonical URL!'); +} +Minz_Request::_param('url', $self); + +$nb = 0; +foreach ($users as $userLine) { + $userLine = strtr($userLine, '\\', '/'); + $userInfos = explode('/', $userLine); + $feedUrl = isset($userInfos[0]) ? base64url_decode($userInfos[0]) : ''; + $username = isset($userInfos[1]) ? basename($userInfos[1], '.txt') : ''; + if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) { + break; + } + + try { + Minz_Session::_param('currentUser', $username); + Minz_Configuration::register('user', + join_path(USERS_PATH, $username, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php')); + FreshRSS_Context::init(); + if ($feedController->actualizeAction($simplePie) > 0) { + $nb++; + } + } catch (Exception $e) { + logMe($e->getMessage()); + } +} + +$simplePie->__destruct(); +unset($simplePie); + +if ($nb === 0) { + header('HTTP/1.1 410 Gone'); + logMe('Nobody is subscribed to this feed anymore after all!: ' . $self); + die('Nobody is subscribed to this feed anymore after all!'); +} + +logMe($self . ' done: ' . $nb); +exit('Done: ' . $nb . "\n"); -- cgit v1.2.3 From c472569b3861541c322c850c4ff8ca3471572f40 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 15 May 2015 15:34:51 +0200 Subject: First alpha of PubSubHubbub https://github.com/FreshRSS/FreshRSS/issues/312 Using a white list limited to http://push-pub.appspot.com/feed for alpha testing. --- app/Controllers/feedController.php | 31 ++++++++++++++------ app/Models/Feed.php | 53 +++++++++++++++++++++++++--------- data/PubSubHubbub/feeds/README.md | 11 ++------ data/PubSubHubbub/keys/.gitignore | 1 + data/PubSubHubbub/keys/README.md | 4 +++ data/PubSubHubbub/secrets/.gitignore | 1 - data/PubSubHubbub/secrets/README.md | 4 --- p/api/pshb.php | 55 ++++++++++++++++++++---------------- 8 files changed, 102 insertions(+), 58 deletions(-) create mode 100644 data/PubSubHubbub/keys/.gitignore create mode 100644 data/PubSubHubbub/keys/README.md delete mode 100644 data/PubSubHubbub/secrets/.gitignore delete mode 100644 data/PubSubHubbub/secrets/README.md (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 9117da639..0fb4bdf03 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -304,6 +304,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } + $url = $feed->url(); //For detection of HTTP 301 try { if ($simplePie) { $feed->loadEntries($simplePie); //Used by PubSubHubbub @@ -317,7 +318,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } - $url = $feed->url(); $feed_history = $feed->keepHistory(); if ($feed_history == -2) { // TODO: -2 must be a constant! @@ -404,19 +404,34 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entryDAO->commit(); } - if ($feed->url() !== $url) { - // HTTP 301 Moved Permanently + if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for PubSubHubbub + if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs + $selfUrl = checkUrl($feed->selfUrl()); + if ($selfUrl) { + Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe + Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url()); + } + $feed->_url($selfUrl, false); + Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url()); + $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); + } + } + } + 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())); } if ($simplePie === null) { $feed->faviconPrepare(); - if ($feed->url() === 'http://push-pub.appspot.com/feed') { - $secret = $feed->pubSubHubbubPrepare(); - if ($secret != '') { - Minz_Log::debug('PubSubHubbub subscribe ' . $feed->url()); - $feed->pubSubHubbubSubscribe(true, $secret); + if (in_array($feed->url(), array('http://push-pub.appspot.com/feed'))) { //TODO: Remove white-list after testing + Minz_Log::debug('PubSubHubbub match ' . $feed->url()); + if ($feed->pubSubHubbubPrepare()) { + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); + } } } } diff --git a/app/Models/Feed.php b/app/Models/Feed.php index dcf083ea8..a17cf415d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -51,6 +51,12 @@ class FreshRSS_Feed extends Minz_Model { public function url() { return $this->url; } + public function selfUrl() { + return $this->selfUrl; + } + public function hubUrl() { + return $this->hubUrl; + } public function category() { return $this->category; } @@ -344,38 +350,59 @@ class FreshRSS_Feed extends Minz_Model { // function pubSubHubbubPrepare() { - $secret = ''; + $key = ''; if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); - if (!file_exists($path . '/hub.txt')) { + if ($hubFile = @file_get_contents($path . '/!hub.json')) { + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { + Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url); + return false; + } + if (empty($hubJson['lease_end']) || $hubJson['lease_end'] <= time()) { + Minz_Log::warning('PubSubHubbub lease expired: ' . $this->url); + $key = $hubJson['key']; //To renew our lease + } + } else { @mkdir($path, 0777, true); - file_put_contents($path . '/hub.txt', $this->hubUrl); - $secret = sha1(FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); - file_put_contents($path . '/secret.txt', $secret); - @mkdir(PSHB_PATH . '/secrets/'); - file_put_contents(PSHB_PATH . '/secrets/' . $secret . '.txt', base64url_encode($this->selfUrl)); + $key = sha1(FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); + $hubJson = array( + 'hub' => $this->hubUrl, + 'key' => $key, + ); + file_put_contents($path . '/!hub.json', json_encode($hubJson)); + @mkdir(PSHB_PATH . '/keys/'); + file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl)); Minz_Log::notice('PubSubHubbub prepared for ' . $this->url); file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . 'PubSubHubbub prepared for ' . $this->url . "\n", FILE_APPEND); } - $path .= '/' . base64url_encode($this->url); $currentUser = Minz_Session::param('currentUser'); if (ctype_alnum($currentUser) && !file_exists($path . '/' . $currentUser . '.txt')) { - @mkdir($path, 0777, true); touch($path . '/' . $currentUser . '.txt'); } } - return $secret; + return $key; } //Parameter true to subscribe, false to unsubscribe. - function pubSubHubbubSubscribe($state, $secret = '') { + function pubSubHubbubSubscribe($state) { if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { - $callbackUrl = checkUrl(FreshRSS_Context::$system_conf->base_url . 'api/pshb.php?s=' . $secret); + $hubFile = @file_get_contents(PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl) . '/!hub.json'); + if ($hubFile === false) { + Minz_Log::warning('JSON not found for PubSubHubbub: ' . $this->url); + return false; + } + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { + Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url); + return false; + } + $callbackUrl = checkUrl(FreshRSS_Context::$system_conf->base_url . 'api/pshb.php?k=' . $hubJson['key']); if ($callbackUrl == '') { + Minz_Log::warning('Invalid callback for PubSubHubbub: ' . $this->url); return false; } - $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $this->hubUrl, diff --git a/data/PubSubHubbub/feeds/README.md b/data/PubSubHubbub/feeds/README.md index 15fa8e521..a01a3197f 100644 --- a/data/PubSubHubbub/feeds/README.md +++ b/data/PubSubHubbub/feeds/README.md @@ -1,12 +1,7 @@ List of canonical URLS of the various feeds users have subscribed to. -Several feeds can share the same canonical URL (rel="self"). Several users can have subscribed to the same feed. * ./base64url(canonicalUrl)/ - * ./secret.txt - * ./base64url(feedUrl1)/ - * ./user1.txt - * ./user2.txt - * ./base64url(feedUrl2)/ - * ./user3.txt - * ./user4.txt + * ./!hub.json + * ./user1.txt + * ./user2.txt diff --git a/data/PubSubHubbub/keys/.gitignore b/data/PubSubHubbub/keys/.gitignore new file mode 100644 index 000000000..2211df63d --- /dev/null +++ b/data/PubSubHubbub/keys/.gitignore @@ -0,0 +1 @@ +*.txt diff --git a/data/PubSubHubbub/keys/README.md b/data/PubSubHubbub/keys/README.md new file mode 100644 index 000000000..bb1e57cd4 --- /dev/null +++ b/data/PubSubHubbub/keys/README.md @@ -0,0 +1,4 @@ +List of keys given to PubSubHubbub hubs + +* ./sha1(random + salt).txt + * base64url(canonicalUrl) diff --git a/data/PubSubHubbub/secrets/.gitignore b/data/PubSubHubbub/secrets/.gitignore deleted file mode 100644 index 2211df63d..000000000 --- a/data/PubSubHubbub/secrets/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.txt diff --git a/data/PubSubHubbub/secrets/README.md b/data/PubSubHubbub/secrets/README.md deleted file mode 100644 index ad8158839..000000000 --- a/data/PubSubHubbub/secrets/README.md +++ /dev/null @@ -1,4 +0,0 @@ -List of secrets given to PubSubHubbub hubs - -* ./sha1(random + salt).txt - * base64url(canonicalUrl) diff --git a/p/api/pshb.php b/p/api/pshb.php index bcb8341b1..90d4c52bb 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -12,40 +12,41 @@ function logMe($text) { $ORIGINAL_INPUT = file_get_contents('php://input', false, null, -1, MAX_PAYLOAD); -logMe(print_r(array('_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); +logMe(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); -$secret = isset($_GET['s']) ? substr($_GET['s'], 0, 128) : ''; -if (!ctype_xdigit($secret)) { +$key = isset($_GET['k']) ? substr($_GET['k'], 0, 128) : ''; +if (!ctype_xdigit($key)) { header('HTTP/1.1 422 Unprocessable Entity'); - die('Invalid feed secret format!'); + die('Invalid feed key format!'); } chdir(PSHB_PATH); -$canonical64 = @file_get_contents('secrets/' . $secret . '.txt'); +$canonical64 = @file_get_contents('keys/' . $key . '.txt'); if ($canonical64 === false) { header('HTTP/1.1 404 Not Found'); - logMe('Feed secret not found!: ' . $secret); - die('Feed secret not found!'); + logMe('Feed key not found!: ' . $key); + die('Feed key not found!'); } $canonical64 = trim($canonical64); if (!preg_match('/^[A-Za-z0-9_-]+$/D', $canonical64)) { header('HTTP/1.1 500 Internal Server Error'); - logMe('Invalid secret reference!: ' . $canonical64); - die('Invalid secret reference!'); + logMe('Invalid key reference!: ' . $canonical64); + die('Invalid key reference!'); } -$secret2 = @file_get_contents('feeds/' . $canonical64 . '/secret.txt'); -if ($secret2 === false) { +$hubFile = @file_get_contents('feeds/' . $canonical64 . '/!hub.json'); +if ($hubFile === false) { header('HTTP/1.1 404 Not Found'); - //@unlink('secrets/' . $secret . '.txt'); - logMe('Feed reverse secret not found!: ' . $canonical64); - die('Feed reverse secret not found!'); + //@unlink('keys/' . $key . '.txt'); + logMe('Feed info not found!: ' . $canonical64); + die('Feed info not found!'); } -if ($secret !== $secret2) { +$hubJson = json_decode($hubFile, true); +if (!$hubJson || empty($hubJson['key']) || $hubJson['key'] !== $key) { header('HTTP/1.1 500 Internal Server Error'); - logMe('Invalid secret cross-check!: ' . $secret); - die('Invalid secret cross-check!'); + logMe('Invalid key cross-check!: ' . $key); + die('Invalid key cross-check!'); } chdir('feeds/' . $canonical64); -$users = glob('*/*.txt', GLOB_NOSORT); +$users = glob('*.txt', GLOB_NOSORT); if (empty($users)) { header('HTTP/1.1 410 Gone'); logMe('Nobody is subscribed to this feed anymore!: ' . $canonical64); @@ -53,10 +54,19 @@ if (empty($users)) { } if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { - //TODO: hub_lease_seconds + $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : intval($_REQUEST['hub_lease_seconds']); + if ($leaseSeconds > 60) { + $hubJson['lease_end'] = time() + $leaseSeconds; + file_put_contents('./!hub.json', json_encode($hubJson)); + } exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); } +if ($ORIGINAL_INPUT == '') { + header('HTTP/1.1 422 Unprocessable Entity'); + die('Missing XML payload!'); +} + Minz_Configuration::register('system', DATA_PATH . '/config.php', DATA_PATH . '/config.default.php'); $system_conf = Minz_Configuration::get('system'); $system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) @@ -80,11 +90,8 @@ if ($self !== base64url_decode($canonical64)) { Minz_Request::_param('url', $self); $nb = 0; -foreach ($users as $userLine) { - $userLine = strtr($userLine, '\\', '/'); - $userInfos = explode('/', $userLine); - $feedUrl = isset($userInfos[0]) ? base64url_decode($userInfos[0]) : ''; - $username = isset($userInfos[1]) ? basename($userInfos[1], '.txt') : ''; +foreach ($users as $userFilename) { + $username = basename($userFilename, '.txt'); if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) { break; } -- cgit v1.2.3 From 5adaf177210bcd7af0df30d8bebea9b3de67b443 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 15 May 2015 15:38:54 +0200 Subject: Revert bug HTTP 301 introduced by Refactor feedController https://github.com/FreshRSS/FreshRSS/commit/e2da6e6e6b871dc3dbc289cdd40ba401a21d8e91 --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 0443b4159..8db273aca 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -301,6 +301,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } + $url = $feed->url(); //For detection of HTTP 301 try { // Load entries $feed->load(false); @@ -311,7 +312,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } - $url = $feed->url(); $feed_history = $feed->keepHistory(); if ($feed_history == -2) { // TODO: -2 must be a constant! -- cgit v1.2.3 From 18831a89efadf8a05fcc3285fa6af0051e41df2b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 15 May 2015 15:46:51 +0200 Subject: PubSubHubbub active only when refreshing, not adding a feed https://github.com/FreshRSS/FreshRSS/issues/312 --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 0fb4bdf03..ab73879d0 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -168,7 +168,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Ok, feed has been added in database. Now we have to refresh entries. $feed->_id($id); $feed->faviconPrepare(); - $feed->pubSubHubbubPrepare(); + //$feed->pubSubHubbubPrepare(); //TODO: prepare PubSubHubbub already when adding the feed $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; -- cgit v1.2.3 From 0163564b9e02bc399c26d3083048f38d3374cbd7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 15 May 2015 17:58:56 +0200 Subject: Change some error messages --- app/Models/Feed.php | 2 +- p/api/pshb.php | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index a17cf415d..d2b552265 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -373,7 +373,7 @@ class FreshRSS_Feed extends Minz_Model { file_put_contents($path . '/!hub.json', json_encode($hubJson)); @mkdir(PSHB_PATH . '/keys/'); file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl)); - Minz_Log::notice('PubSubHubbub prepared for ' . $this->url); + Minz_Log::debug('PubSubHubbub prepared for ' . $this->url); file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . 'PubSubHubbub prepared for ' . $this->url . "\n", FILE_APPEND); } diff --git a/p/api/pshb.php b/p/api/pshb.php index 90d4c52bb..6280c04ac 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -12,7 +12,7 @@ function logMe($text) { $ORIGINAL_INPUT = file_get_contents('php://input', false, null, -1, MAX_PAYLOAD); -logMe(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); +//logMe(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true)); $key = isset($_GET['k']) ? substr($_GET['k'], 0, 128) : ''; if (!ctype_xdigit($key)) { @@ -23,33 +23,33 @@ chdir(PSHB_PATH); $canonical64 = @file_get_contents('keys/' . $key . '.txt'); if ($canonical64 === false) { header('HTTP/1.1 404 Not Found'); - logMe('Feed key not found!: ' . $key); + logMe('Error: Feed key not found!: ' . $key); die('Feed key not found!'); } $canonical64 = trim($canonical64); if (!preg_match('/^[A-Za-z0-9_-]+$/D', $canonical64)) { header('HTTP/1.1 500 Internal Server Error'); - logMe('Invalid key reference!: ' . $canonical64); + logMe('Error: Invalid key reference!: ' . $canonical64); die('Invalid key reference!'); } $hubFile = @file_get_contents('feeds/' . $canonical64 . '/!hub.json'); if ($hubFile === false) { header('HTTP/1.1 404 Not Found'); //@unlink('keys/' . $key . '.txt'); - logMe('Feed info not found!: ' . $canonical64); + logMe('Error: Feed info not found!: ' . $canonical64); die('Feed info not found!'); } $hubJson = json_decode($hubFile, true); if (!$hubJson || empty($hubJson['key']) || $hubJson['key'] !== $key) { header('HTTP/1.1 500 Internal Server Error'); - logMe('Invalid key cross-check!: ' . $key); + logMe('Error: Invalid key cross-check!: ' . $key); die('Invalid key cross-check!'); } chdir('feeds/' . $canonical64); $users = glob('*.txt', GLOB_NOSORT); if (empty($users)) { header('HTTP/1.1 410 Gone'); - logMe('Nobody is subscribed to this feed anymore!: ' . $canonical64); + logMe('Error: Nobody is subscribed to this feed anymore!: ' . $canonical64); die('Nobody is subscribed to this feed anymore!'); } @@ -83,9 +83,10 @@ $links = $simplePie->get_links('self'); $self = isset($links[0]) ? $links[0] : null; if ($self !== base64url_decode($canonical64)) { - header('HTTP/1.1 422 Unprocessable Entity'); - logMe('Self URL does not match registered canonical URL!: ' . $self); - die('Self URL does not match registered canonical URL!'); + //header('HTTP/1.1 422 Unprocessable Entity'); + logMe('Warning: Self URL ' . $self . ' does not match registered canonical URL!: ' . base64url_decode($canonical64)); + //die('Self URL does not match registered canonical URL!'); + $self = base64url_decode($canonical64); } Minz_Request::_param('url', $self); @@ -106,7 +107,7 @@ foreach ($users as $userFilename) { $nb++; } } catch (Exception $e) { - logMe($e->getMessage()); + logMe('Error: ' . $e->getMessage()); } } @@ -115,7 +116,7 @@ unset($simplePie); if ($nb === 0) { header('HTTP/1.1 410 Gone'); - logMe('Nobody is subscribed to this feed anymore after all!: ' . $self); + logMe('Error: Nobody is subscribed to this feed anymore after all!: ' . $self); die('Nobody is subscribed to this feed anymore after all!'); } -- cgit v1.2.3 From 3adab4b70fab858048bd68ed72e71676c4d5badf Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 16 May 2015 13:05:43 +0200 Subject: More PubSubHubbub https://github.com/FreshRSS/FreshRSS/issues/312 Show whether PubSubHubbub is enabled in the Web interface of feed configuration. When PubSubHubbub is used, do not pull refresh so often (hard-coded to max once per 24h for now). Improved logic for lease renewal, and some detection of lease problems. Updated read-me and changelog. --- CHANGELOG | 9 ++++++ README.fr.md | 22 +++++++------- README.md | 34 ++++++++++----------- app/Controllers/feedController.php | 36 ++++++++++++++-------- app/Models/Feed.php | 59 +++++++++++++++++++++++++++++++------ app/i18n/cz/conf.php | 1 + app/i18n/cz/sub.php | 1 + app/i18n/de/sub.php | 1 + app/i18n/en/sub.php | 1 + app/i18n/fr/sub.php | 1 + app/views/helpers/feed/update.phtml | 8 +++++ data/users/_/config.default.php | 2 +- p/api/pshb.php | 8 +++-- 13 files changed, 128 insertions(+), 55 deletions(-) (limited to 'app') diff --git a/CHANGELOG b/CHANGELOG index d1b49d339..f3559ccc4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,15 @@ ## 2015-xx-xx FreshRSS 1.1.1 (beta) +* Features + * Support for PubSubHubbub for instant notifications from compatible Web sites. + * New option to detect and mark updated articles as unread. + * Support for internationalized domain name (IDN). +* Misc. + * Improved logic for automatic deletion of old articles. + * Attempt to better handle encoded titles. + + ## 2015-01-31 FreshRSS 1.0.0 / 1.1.0 (beta) * UI diff --git a/README.fr.md b/README.fr.md index 6c77ccf51..1110eb8e5 100644 --- a/README.fr.md +++ b/README.fr.md @@ -6,6 +6,7 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed] Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture anonyme. +Il supporte [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) pour des notifications instantanées depuis les sites compatibles. * Site officiel : http://freshrss.org * Démo : http://demo.freshrss.org/ @@ -14,28 +15,25 @@ Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture an ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) # Note sur les branches -**Ce logiciel est encore en développement !** Veuillez vous assurer d'utiliser la branche qui vous correspond : +**Ce logiciel est en développement permanent !** Veuillez vous assurer d'utiliser la branche qui vous correspond : * Utilisez [la branche master](https://github.com/FreshRSS/FreshRSS/tree/master/) si vous visez la stabilité. * [La branche beta](https://github.com/FreshRSS/FreshRSS/tree/beta) est celle par défaut : les nouveautés y sont ajoutées environ tous les mois. -* Pour les développeurs et ceux qui savent ce qu'ils font, [la branche dev](https://github.com/FreshRSS/FreshRSS/tree/dev) vous ouvre les bras ! +* Pour les développeurs et ceux qui veulent aider à tester les toutes dernières fonctionnalités, [la branche dev](https://github.com/FreshRSS/FreshRSS/tree/dev) vous ouvre les bras ! # Disclaimer -Cette application a été développée pour s’adapter à des besoins personnels et non professionnels. -Je ne garantis en aucun cas la sécurité de celle-ci, ni son bon fonctionnement. -Je m’engage néanmoins à répondre dans la mesure du possible aux demandes d’évolution si celles-ci me semblent justifiées. -Privilégiez pour cela des demandes sur GitHub -(https://github.com/FreshRSS/FreshRSS/issues). +Cette application a été développée pour s’adapter principalement à des besoins personnels, et aucune garantie n'est fournie. +Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont les bienvenues. Privilégiez pour cela des [demandes sur GitHub](https://github.com/FreshRSS/FreshRSS/issues). -# Pré-requis +# Prérequis * Serveur modeste, par exemple sous Linux ou Windows * Fonctionne même sur un Raspberry Pi avec des temps de réponse < 1s (testé sur 150 flux, 22k articles, soit 32Mo de données partiellement compressées) * Serveur Web Apache2 (recommandé), ou nginx, lighttpd (non testé sur les autres) * PHP 5.2.1+ (PHP 5.3.7+ recommandé) - * 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 platformes < 64 bits), [IDN](http://php.net/intl.idn) (pour les noms de domaines internationalisés) + * 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 : [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [zlib](http://php.net/zlib), [Zip](http://php.net/zip) * MySQL 5.0.3+ (recommandé) ou SQLite 3.7.4+ -* Un navigateur Web récent tel Firefox 4+, Chrome, Opera, Safari, Internet Explorer 9+ +* Un navigateur Web récent tel Firefox, Chrome, Opera, Safari. [Internet Explorer ne fonctionne plus, mais ce sera corrigé](https://github.com/FreshRSS/FreshRSS/issues/772). * Fonctionne aussi sur mobile ![Capture d’écran de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png) @@ -63,7 +61,7 @@ C’est une bonne idée d’utiliser le même utilisateur que votre serveur Web Par exemple, pour exécuter le script toutes les heures : ``` -7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +7 * * * * php /votre-chemin/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` # Conseils @@ -75,7 +73,7 @@ Par exemple, pour exécuter le script toutes les heures : # Sauvegarde * Il faut conserver vos fichiers `./data/config.php` ainsi que `./data/*_user.php` et éventuellement `./data/persona/` * Vous pouvez exporter votre liste de flux depuis FreshRSS au format OPML -* Pour sauvegarder les articles eux-même, vous pouvez utiliser [phpMyAdmin](http://www.phpmyadmin.net) ou les outils de MySQL : +* Pour sauvegarder les articles eux-mêmes, vous pouvez utiliser [phpMyAdmin](http://www.phpmyadmin.net) ou les outils de MySQL : ```bash mysqldump -u utilisateur -p --databases freshrss > freshrss.sql diff --git a/README.md b/README.md index 089bbd780..4430560fe 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ * [Version française](README.fr.md) # FreshRSS -FreshRSS is a self-hosted RSS feed agregator like [Leed](http://projet.idleman.fr/leed/) or [Kriss Feed](http://tontof.net/kriss/feed/). +FreshRSS is a self-hosted RSS feed aggregator such as [Leed](http://projet.idleman.fr/leed/) or [Kriss Feed](http://tontof.net/kriss/feed/). -It is at the same time light-weight, easy to work with, powerful and customizable. +It is at the same time lightweight, easy to work with, powerful and customizable. It is a multi-user application with an anonymous reading mode. +It supports [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) for instant notifications from compatible Web sites. * Official website: http://freshrss.org * Demo: http://demo.freshrss.org/ @@ -14,28 +15,25 @@ It is a multi-user application with an anonymous reading mode. ![FreshRSS logo](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) # Note on branches -**This application is still in development!** Please use the branch that suits your needs: +**This application is under continuous development!** Please use the branch that suits your needs: * Use [the master branch](https://github.com/FreshRSS/FreshRSS/tree/master/) if you need a stable version. * [The beta branch](https://github.com/FreshRSS/FreshRSS/tree/beta) is the default branch: new features are added on a monthly basis. -* For developers and tech savvy persons, [the dev branch](https://github.com/FreshRSS/FreshRSS/tree/dev) is waiting for you! +* For developers and tech savvy persons willing to help testing the latest features, [the dev branch](https://github.com/FreshRSS/FreshRSS/tree/dev) is waiting for you! # Disclaimer -This application was developed to fulfill personal needs not professional needs. -There is no guarantee neither on its security nor its proper functioning. -If there is feature requests which I think are good for the project, I'll do my best to include them. -The best way is to open issues on GitHub -(https://github.com/FreshRSS/FreshRSS/issues). +This application was developed to fulfil personal needs primarily, and comes with absolutely no warranty. +Feature requests, bug reports, and other contributions are welcome. The best way is to [open issues on GitHub](https://github.com/FreshRSS/FreshRSS/issues). # Requirements * Light server running Linux or Windows * It even works on Raspberry Pi with response time under a second (tested with 150 feeds, 22k articles, or 32Mo of compressed data) -* A web server: Apache2 (recommanded), nginx, lighttpd (not tested on others) -* PHP 5.2.1+ (PHP 5.3.7+ recommanded) +* A web server: Apache2 (recommended), nginx, lighttpd (not tested on others) +* PHP 5.2.1+ (PHP 5.3.7+ recommended) * 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) - * Recommanded extensions : [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [zlib](http://php.net/zlib), [Zip](http://php.net/zip) -* MySQL 5.0.3+ (recommanded) or SQLite 3.7.4+ -* A recent browser like Firefox 4+, Chrome, Opera, Safari, Internet Explorer 9+ + * Recommended extensions: [JSON](http://php.net/json), [mbstring](http://php.net/mbstring), [zlib](http://php.net/zlib), [Zip](http://php.net/zip) +* MySQL 5.0.3+ (recommended) or SQLite 3.7.4+ +* A recent browser like Firefox, Chrome, Opera, Safari. [Internet Explorer currently not supported, but support will come back](https://github.com/FreshRSS/FreshRSS/issues/772). * Works on mobile ![FreshRSS screenshot](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png) @@ -45,7 +43,7 @@ The best way is to open issues on GitHub 2. Dump the application on your server (expose only the `./p/` folder) 3. Add write access on `./data/` folder to the webserver user 4. Access FreshRSS with your browser and follow the installation process -5. Every thing should be working :) If you encounter any problem, feel free to contact me. +5. Everything should be working :) If you encounter any problem, feel free to contact me. 6. Advanced configuration settings can be seen in [config.php](./data/config.default.php). # Access control @@ -59,18 +57,18 @@ It is needed for the multi-user mode to limit access to FreshRSS. You can: # Automatic feed update * You can add a Cron job to launch the update script. Check the Cron documentation related to your distribution ([Debian/Ubuntu](https://help.ubuntu.com/community/CronHowto), [Red Hat/Fedora](https://fedoraproject.org/wiki/Administration_Guide_Draft/Cron), [Slackware](http://docs.slackware.com/fr:slackbook:process_control?#cron), [Gentoo](https://wiki.gentoo.org/wiki/Cron), [Arch Linux](https://wiki.archlinux.org/index.php/Cron)…). -It’s a good idea to use the web server user . +It’s a good idea to use the Web server user. For example, if you want to run the script every hour: ``` -7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +7 * * * * php /your-path/FreshRSS/app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` # Advices * For a better security, expose only the `./p/` folder on the web. * Be aware that the `./data/` folder contains all personal data, so it is a bad idea to expose it. * The `./constants.php` file defines access to application folder. If you want to customize your installation, every thing happens here. -* If you encounter any problem, logs are accessibles from the interface or manually in `./data/log/*.log` files. +* If you encounter any problem, logs are accessible from the interface or manually in `./data/log/*.log` files. # Backup * You need to keep `./data/config.php`, `./data/*_user.php` and `./data/persona/` files diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index ab73879d0..dfdf0dc16 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -268,7 +268,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { * If id and url are not specified, all the feeds are actualized. But if force is * false, process stops at 10 feeds to avoid time execution problem. */ - public function actualizeAction($simplePie = null) { + public function actualizeAction($simplePiePush = null) { @set_time_limit(300); $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -295,10 +295,16 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Calculate date of oldest entries we accept in DB. $nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + $pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration. $updated_feeds = 0; $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { + $pubSubHubbubEnabled = $feed->pubSubHubbubEnabled(); + if ((!$simplePiePush) && (!$id) && (!$force) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { + continue; //When PubSubHubbub is used, do not pull refresh so often + } + if (!$feed->lock()) { Minz_Log::notice('Feed already being actualized: ' . $feed->url()); continue; @@ -306,8 +312,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $url = $feed->url(); //For detection of HTTP 301 try { - if ($simplePie) { - $feed->loadEntries($simplePie); //Used by PubSubHubbub + if ($simplePiePush) { + $feed->loadEntries($simplePiePush); //Used by PubSubHubbub } else { $feed->load(false); } @@ -374,6 +380,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } + if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull! + $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url . ' GUID ' . $entry->guid(); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + Minz_Log::warning($text); + $pubSubHubbubEnabled = false; + $feed->pubSubHubbubEnabled(false); //To force the renewal of our lease + } + if (!$entryDAO->hasTransaction()) { $entryDAO->beginTransaction(); } @@ -423,15 +437,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } - if ($simplePie === null) { - $feed->faviconPrepare(); - if (in_array($feed->url(), array('http://push-pub.appspot.com/feed'))) { //TODO: Remove white-list after testing - Minz_Log::debug('PubSubHubbub match ' . $feed->url()); - if ($feed->pubSubHubbubPrepare()) { - Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); - if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe - Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); - } + $feed->faviconPrepare(); + if (in_array($feed->url(), array('http://push-pub.appspot.com/feed'))) { //TODO: Remove white-list after testing + Minz_Log::debug('PubSubHubbub match ' . $feed->url()); + if ($feed->pubSubHubbubPrepare()) { + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); } } } diff --git a/app/Models/Feed.php b/app/Models/Feed.php index d2b552265..7bc60dfc9 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -104,6 +104,16 @@ class FreshRSS_Feed extends Minz_Model { public function ttl() { return $this->ttl; } + // public function ttlExpire() { + // $ttl = $this->ttl; + // if ($ttl == -2) { //Default + // $ttl = FreshRSS_Context::$user_conf->ttl_default; + // } + // if ($ttl == -1) { //Never + // $ttl = 64000000; //~2 years. Good enough for PubSubHubbub logic + // } + // return $this->lastUpdate + $ttl; + // } public function nbEntries() { if ($this->nbEntries < 0) { $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -349,18 +359,42 @@ class FreshRSS_Feed extends Minz_Model { // + function pubSubHubbubEnabled($keep = true) { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { + $hubJson = json_decode($hubFile, true); + if (!$keep) { + $hubJson['lease_end'] = time() - 60; + file_put_contents($hubFilename, json_encode($hubJson)); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" + . 'Force expire lease for ' . $url . "\n", FILE_APPEND); + } elseif ($hubJson && (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { + return true; + } + } + return false; + } + function pubSubHubbubPrepare() { $key = ''; if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); - if ($hubFile = @file_get_contents($path . '/!hub.json')) { + $hubFilename = $path . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { $hubJson = json_decode($hubFile, true); if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { - Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url); + $text = 'Invalid JSON for PubSubHubbub: ' . $this->url; + Minz_Log::warning($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); return false; } - if (empty($hubJson['lease_end']) || $hubJson['lease_end'] <= time()) { - Minz_Log::warning('PubSubHubbub lease expired: ' . $this->url); + if (empty($hubJson['lease_end']) || ($hubJson['lease_end'] <= (time() + (3600 * 24)))) { //TODO: Make a better policy + $text = 'PubSubHubbub lease ends at ' + . date('c', empty($hubJson['lease_end']) ? time() : $hubJson['lease_end']) + . ' and needs renewal: ' . $this->url; + Minz_Log::warning($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); $key = $hubJson['key']; //To renew our lease } } else { @@ -370,12 +404,12 @@ class FreshRSS_Feed extends Minz_Model { 'hub' => $this->hubUrl, 'key' => $key, ); - file_put_contents($path . '/!hub.json', json_encode($hubJson)); + file_put_contents($hubFilename, json_encode($hubJson)); @mkdir(PSHB_PATH . '/keys/'); file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl)); - Minz_Log::debug('PubSubHubbub prepared for ' . $this->url); - file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . - 'PubSubHubbub prepared for ' . $this->url . "\n", FILE_APPEND); + $text = 'PubSubHubbub prepared for ' . $this->url; + Minz_Log::debug($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); } $currentUser = Minz_Session::param('currentUser'); if (ctype_alnum($currentUser) && !file_exists($path . '/' . $currentUser . '.txt')) { @@ -388,7 +422,8 @@ class FreshRSS_Feed extends Minz_Model { //Parameter true to subscribe, false to unsubscribe. function pubSubHubbubSubscribe($state) { if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { - $hubFile = @file_get_contents(PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl) . '/!hub.json'); + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); if ($hubFile === false) { Minz_Log::warning('JSON not found for PubSubHubbub: ' . $this->url); return false; @@ -421,6 +456,12 @@ class FreshRSS_Feed extends Minz_Model { file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . 'PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $this->selfUrl . ' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response . "\n", FILE_APPEND); + + if (!$state) { //unsubscribe + $hubJson['lease_end'] = time() - 60; + file_put_contents($hubFilename, json_encode($hubJson)); + } + return substr($info['http_code'], 0, 1) == '2'; } return false; diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index 29fb1e4d4..9518df66d 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -84,6 +84,7 @@ return array( 'articles_per_page' => 'Počet článků na stranu', 'auto_load_more' => 'Načítat další články dole na stránce', 'auto_remove_article' => 'Po přečtení články schovat', + 'mark_updated_article_unread' => 'Označte aktualizované položky jako nepřečtené', 'confirm_enabled' => 'Vyžadovat potvrzení pro akci “označit vše jako přečtené”', 'display_articles_unfolded' => 'Ve výchozím stavu zobrazovat články otevřené', 'display_categories_unfolded' => 'Ve výchozím stavu zobrazovat kategorie zavřené', diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php index 78712506c..cea0541e3 100644 --- a/app/i18n/cz/sub.php +++ b/app/i18n/cz/sub.php @@ -37,6 +37,7 @@ return array( 'url' => 'URL kanálu', 'validator' => 'Zkontrolovat platnost kanálu', 'website' => 'URL webové stránky', + 'pubsubhubbub' => 'Okamžité oznámení s PubSubHubbub', ), 'import_export' => array( 'export' => 'Export', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 0479b8f46..7433bd61c 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -37,6 +37,7 @@ return array( 'url' => 'Feed-URL', 'validator' => 'Überprüfen Sie die Gültigkeit des Feeds', 'website' => 'Webseiten-URL', + 'pubsubhubbub' => 'Sofortige Benachrichtigung mit PubSubHubbub', ), 'import_export' => array( 'export' => 'Exportieren', diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 2b62e4775..d8b5ced04 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -37,6 +37,7 @@ return array( 'url' => 'Feed URL', 'validator' => 'Check the validity of the feed', 'website' => 'Website URL', + 'pubsubhubbub' => 'Instant notification with PubSubHubbub', ), 'import_export' => array( 'export' => 'Export', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index a3f7c4d6d..0a1a03e41 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -37,6 +37,7 @@ return array( 'url' => 'URL du flux', 'validator' => 'Vérifier la valididé du flux', 'website' => 'URL du site', + 'pubsubhubbub' => 'Notification instantanée par PubSubHubbub', ), 'import_export' => array( 'export' => 'Exporter', diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 0b08d036c..b2cf9f93c 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -126,6 +126,14 @@ ?>
    +
    + +
    + +
    +
    diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index bf74ca1de..8f8ff528c 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -25,7 +25,7 @@ return array ( # In the case an article has changed (e.g. updated content): # Set to `true` to mark it unread, or `false` to leave it as-is. - 'mark_updated_article_unread' => false, + 'mark_updated_article_unread' => false, //TODO: -1 => ignore, 0 => update, 1 => update and mark as unread 'sort_order' => 'DESC', 'anon_access' => false, diff --git a/p/api/pshb.php b/p/api/pshb.php index 6280c04ac..2f7f48cd8 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -57,8 +57,10 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : intval($_REQUEST['hub_lease_seconds']); if ($leaseSeconds > 60) { $hubJson['lease_end'] = time() + $leaseSeconds; - file_put_contents('./!hub.json', json_encode($hubJson)); + } else { + unset($hubJson['lease_end']); } + file_put_contents('./!hub.json', json_encode($hubJson)); exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); } @@ -84,7 +86,7 @@ $self = isset($links[0]) ? $links[0] : null; if ($self !== base64url_decode($canonical64)) { //header('HTTP/1.1 422 Unprocessable Entity'); - logMe('Warning: Self URL ' . $self . ' does not match registered canonical URL!: ' . base64url_decode($canonical64)); + logMe('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64)); //die('Self URL does not match registered canonical URL!'); $self = base64url_decode($canonical64); } @@ -120,5 +122,5 @@ if ($nb === 0) { die('Nobody is subscribed to this feed anymore after all!'); } -logMe($self . ' done: ' . $nb); +logMe('PubSubHubbub ' . $self . ' done: ' . $nb); exit('Done: ' . $nb . "\n"); -- cgit v1.2.3 From 9fe8a7c62dcd815065983613991f000b17444f5c Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Fri, 15 May 2015 20:09:58 +0200 Subject: Update admin.php --- app/i18n/de/admin.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index bcd0fcc61..8550805ee 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -19,15 +19,15 @@ return array( 'check_install' => array( 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/cache. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', ), 'categories' => array( 'nok' => 'Die Tabelle category ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle category ist in Ordnung.', + 'ok' => 'Die Tabelle category ist korrekt konfiguriert.', ), 'connection' => array( 'nok' => 'Verbindung zur Datenbank kann nicht aufgebaut werden.', - 'ok' => 'Verbindung zur Datenbank ist in Ordnung.', + 'ok' => 'Verbindung zur Datenbank konnte aufgebaut werden.', ), 'ctype' => array( 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', @@ -39,7 +39,7 @@ return array( ), 'data' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data sind in Ordnung.', ), 'database' => 'Datenbank-Installation', 'dom' => array( @@ -48,19 +48,19 @@ return array( ), 'entries' => array( 'nok' => 'Die Tabelle entry ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle entry ist in Ordnung.', + 'ok' => 'Die Tabelle entry ist korrekt konfiguriert.', ), 'favicons' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/favicons. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/favicons sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/favicons sind in Ordnung.', ), 'feeds' => array( 'nok' => 'Die Tabelle feed ist schlecht konfiguriert.', - 'ok' => 'Die Tabelle feed ist in Ordnung.', + 'ok' => 'Die Tabelle feed ist korrekt konfiguriert.', ), 'files' => 'Datei-Installation', 'json' => array( - 'nok' => 'Ihnen fehlt JSON (Paket php5-json).', + 'nok' => 'Ihnen fehlt die JSON-Erweiterung (Paket php5-json).', 'ok' => 'Sie haben die JSON-Erweiterung.', ), 'minz' => array( @@ -77,7 +77,7 @@ return array( ), 'persona' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/persona. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/persona sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/persona sind in Ordnung.', ), 'php' => array( '_' => 'PHP-Installation', @@ -91,11 +91,11 @@ return array( 'title' => 'Installationsüberprüfung', 'tokens' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/tokens. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/tokens sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/tokens sind in Ordnung.', ), 'users' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/users. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/users sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/users sind in Ordnung.', ), 'zip' => array( 'nok' => 'Ihnen fehlt die ZIP-Erweiterung (Paket php5-zip).', @@ -120,22 +120,22 @@ return array( 'category' => 'Kategorie', 'entry_count' => 'Anzahl der Einträge', 'entry_per_category' => 'Einträge pro Kategorie', - 'entry_per_day' => 'Einträge pro Tag (letzte 30 Tage)', + 'entry_per_day' => 'Einträge pro Tag (letzten 30 Tage)', 'entry_per_day_of_week' => 'Pro Wochentag (Durchschnitt: %.2f Nachrichten)', 'entry_per_hour' => 'Pro Stunde (Durchschnitt: %.2f Nachrichten)', 'entry_per_month' => 'Pro Monat (Durchschnitt: %.2f Nachrichten)', 'entry_repartition' => 'Einträge-Verteilung', 'feed' => 'Feed', 'feed_per_category' => 'Feeds pro Kategorie', - 'idle' => 'Untätige Feeds', + 'idle' => 'Inkative Feeds', 'main' => 'Haupt-Statistiken', 'main_stream' => 'Haupt-Feeds', 'menu' => array( - 'idle' => 'Untätige Feeds', + 'idle' => 'Inkative Feeds', 'main' => 'Haupt-Statistiken', 'repartition' => 'Artikel-Verteilung', ), - 'no_idle' => 'Es gibt keinen untätigen Feed!', + 'no_idle' => 'Es gibt keinen inaktiven Feed!', 'number_entries' => '%d Artikel', 'percent_of_total' => '%% Gesamt', 'repartition' => 'Artikel-Verteilung', @@ -152,7 +152,7 @@ return array( 'check' => 'Auf neue Aktualisierungen prüfen', 'current_version' => 'Ihre aktuelle Version von FreshRSS ist %s.', 'last' => 'Letzte Überprüfung: %s', - 'none' => 'Keine Aktualisierung zum Anwenden', + 'none' => 'Keine ausstehende Aktualisierung', 'title' => 'System aktualisieren', ), 'user' => array( -- cgit v1.2.3 From bd21838bd0edd0169c583d25a475f9eea7636333 Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Fri, 15 May 2015 20:18:24 +0200 Subject: Update conf.php --- app/i18n/de/conf.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index df2c07d49..4a0a77ddd 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -5,8 +5,8 @@ return array( '_' => 'Archivierung', 'advanced' => 'Erweitert', 'delete_after' => 'Entferne Artikel nach', - 'help' => 'Weitere Optionen sind in den Einstellungen der individuellen Nachrichten-Feeds vorhanden.', - 'keep_history_by_feed' => 'Minimale Anzahl an Artikeln, die pro Feed behalten wird', + 'help' => 'Weitere Optionen sind in den Einstellungen der individuellen Feeds verfügbar.', + 'keep_history_by_feed' => 'Minimale Anzahl an Artikeln, die pro Feed behalten werden', 'optimize' => 'Datenbank optimieren', 'optimize_help' => 'Sollte gelegentlich durchgeführt werden, um die Größe der Datenbank zu reduzieren.', 'purge_now' => 'Jetzt bereinigen', @@ -32,10 +32,10 @@ return array( 'title' => 'Anzeige', 'width' => array( 'content' => 'Inhaltsbreite', - 'large' => 'Weit', + 'large' => 'Gross', 'medium' => 'Mittel', 'no_limit' => 'Keine Begrenzung', - 'thin' => 'Schmal', + 'thin' => 'Klein', ), ), 'query' => array( @@ -136,14 +136,14 @@ return array( 'wallabag' => 'wallabag', ), 'shortcut' => array( - '_' => 'Tastaturkürzel', + '_' => 'Tastenkombination', 'article_action' => 'Artikelaktionen', 'auto_share' => 'Teilen', 'auto_share_help' => 'Wenn es nur eine Option zum Teilen gibt, wird diese verwendet. Ansonsten sind die Optionen über ihre Nummer erreichbar.', 'close_dropdown' => 'Menüs schließen', - 'collapse_article' => 'Zusammenfalten', + 'collapse_article' => 'Einklappen', 'first_article' => 'Zum ersten Artikel springen', - 'focus_search' => 'Auf Suchfeld zugreifen', + 'focus_search' => 'Auf das Suchfeld zugreifen', 'help' => 'Dokumentation anzeigen', 'javascript' => 'JavaScript muss aktiviert sein, um Tastaturkürzel benutzen zu können', 'last_article' => 'Zum letzten Artikel springen', @@ -151,13 +151,13 @@ return array( 'mark_read' => 'Als gelesen markieren', 'mark_favorite' => 'Als Favorit markieren', 'navigation' => 'Navigation', - 'navigation_help' => 'Mit der "Umschalttaste" finden die Tastaturkürzel auf Feeds Anwendung.
    Mit der "Alt-Taste" finden die Tastaturkürzel auf Kategorien Anwendung.', + 'navigation_help' => 'Mit der "Umschalttaste" finden die Tastenkombination auf Feeds Anwendung.
    Mit der "Alt-Taste" finden die Tastenkombination auf Kategorien Anwendung.', 'next_article' => 'Zum nächsten Artikel springen', 'other_action' => 'Andere Aktionen', 'previous_article' => 'Zum vorherigen Artikel springen', 'see_on_website' => 'Auf der Original-Webseite ansehen', 'shift_for_all_read' => '+ Umschalttaste, um alle Artikel als gelesen zu markieren.', - 'title' => 'Tastaturkürzel', + 'title' => 'Tastenkombination', 'user_filter' => 'Auf Benutzerfilter zugreifen', 'user_filter_help' => 'Wenn es nur einen Benutzerfilter gibt, wird dieser verwendet. Ansonsten sind die Filter über ihre Nummer erreichbar.', ), -- cgit v1.2.3 From 70f0fc8d614ae49aa21ef9f1ce1b3f06e294512f Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Sat, 16 May 2015 18:52:08 +0200 Subject: Update feedback.php --- app/i18n/de/feedback.php | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'app') diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index 48f8b74f5..4c15aadc3 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -15,19 +15,19 @@ return array( ), 'login' => array( 'invalid' => 'Anmeldung ist ungültig', - 'success' => 'Sie sind verbunden', + 'success' => 'Sie sind angemeldet', ), 'logout' => array( - 'success' => 'Sie sind getrennt', + 'success' => 'Sie sind abgemeldet', ), 'no_password_set' => 'Administrator-Passwort ist nicht gesetzt worden. Dieses Feature ist nicht verfügbar.', 'not_persona' => 'Nur das Persona-System kann zurückgesetzt werden.', ), 'conf' => array( - 'error' => 'Während des Speicherung der Konfiguration trat ein Fehler auf', + 'error' => 'Während der Speicherung der Konfiguration trat ein Fehler auf', 'query_created' => 'Abfrage "%s" ist erstellt worden.', - 'shortcuts_updated' => 'Tastaturkürzel sind aktualisiert worden', - 'updated' => 'Konfiguration ist aktualisiert worden', + 'shortcuts_updated' => 'Die Tastenkombinationen sind aktualisiert worden', + 'updated' => 'Die Konfiguration ist aktualisiert worden', ), 'extensions' => array( 'already_enabled' => '%s ist bereits aktiviert', @@ -44,44 +44,44 @@ return array( 'not_found' => '%s existiert nicht', ), 'import_export' => array( - 'export_no_zip_extension' => 'Die Zip-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie, Dateien eine nach der anderen zu exportieren.', + 'export_no_zip_extension' => 'Die Zip-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie die Dateien eine nach der anderen zu exportieren.', 'feeds_imported' => 'Ihre Feeds sind importiert worden und werden jetzt aktualisiert', 'feeds_imported_with_errors' => 'Ihre Feeds sind importiert worden, aber es traten einige Fehler auf', - 'file_cannot_be_uploaded' => 'Datei kann nicht hochgeladen werden!', + 'file_cannot_be_uploaded' => 'Die Datei kann nicht hochgeladen werden!', 'no_zip_extension' => 'Die Zip-Erweiterung ist auf Ihrem Server nicht vorhanden.', 'zip_error' => 'Ein Fehler trat während des Zip-Imports auf.', ), 'sub' => array( 'actualize' => 'Aktualisieren', 'category' => array( - 'created' => 'Kategorie %s ist erstellt worden.', - 'deleted' => 'Kategorie ist gelöscht worden.', - 'emptied' => 'Kategorie ist geleert worden.', - 'error' => 'Kategorie kann nicht aktualisiert werden', - 'name_exists' => 'Kategorie-Name existiert bereits.', + 'created' => 'Die Kategorie %s ist erstellt worden.', + 'deleted' => 'Die Kategorie ist gelöscht worden.', + 'emptied' => 'Die Kategorie ist geleert worden.', + 'error' => 'Die Kategorie kann nicht aktualisiert werden', + 'name_exists' => 'Der Kategorie-Name existiert bereits.', 'no_id' => 'Sie müssen die ID der Kategorie präzisieren.', - 'no_name' => 'Kategorie-Name kann nicht leer sein.', + 'no_name' => 'Der Kategorie-Name kann nicht leer sein.', 'not_delete_default' => 'Sie können die Vorgabe-Kategorie nicht löschen!', 'not_exist' => 'Die Kategorie existiert nicht!', - 'over_max' => 'Sie haben Ihr Kategorien-Limit erreicht (%d)', - 'updated' => 'Kategorie ist aktualisiert worden.', + 'over_max' => 'Sie haben Ihre Kategorien-Limite erreicht (%d)', + 'updated' => 'Die Kategorie ist aktualisiert worden.', ), 'feed' => array( 'actualized' => '%s ist aktualisiert worden', - 'actualizeds' => 'RSS-Feeds sind aktualisiert worden', - 'added' => 'RSS-Feed %s ist hinzugefügt worden', + 'actualizeds' => 'Die RSS-Feeds sind aktualisiert worden', + 'added' => 'Der RSS-Feed %s ist hinzugefügt worden', 'already_subscribed' => 'Sie haben %s bereits abonniert', - 'deleted' => 'Feed ist gelöscht worden', - 'error' => 'Feed kann nicht aktualisiert werden', + 'deleted' => 'Der Feed ist gelöscht worden', + 'error' => 'Der Feed kann nicht aktualisiert werden', 'internal_problem' => 'Der RSS-Feed konnte nicht hinzugefügt werden. Für Details prüfen Sie die FressRSS-Protokolle.', - 'invalid_url' => 'URL %s ist ungültig', - 'marked_read' => 'Feeds sind als gelesen markiert worden', - 'n_actualized' => '%d Feeds sind aktualisiert worden', - 'n_entries_deleted' => '%d Artikel sind gelöscht worden', + 'invalid_url' => 'Die URL %s ist ungültig', + 'marked_read' => 'Die Feeds sind als gelesen markiert worden', + 'n_actualized' => 'Die %d Feeds sind aktualisiert worden', + 'n_entries_deleted' => 'Die %d Artikel sind gelöscht worden', 'no_refresh' => 'Es gibt keinen Feed zum Aktualisieren…', 'not_added' => '%s konnte nicht hinzugefügt werden', - 'over_max' => 'Sie haben Ihr Feeds-Limit erreicht (%d)', - 'updated' => 'Feed ist aktualisiert worden', + 'over_max' => 'Sie haben Ihre Feeds-Limite erreicht (%d)', + 'updated' => 'Der Feed ist aktualisiert worden', ), 'purge_completed' => 'Bereinigung abgeschlossen (%d Artikel gelöscht)', ), @@ -91,16 +91,16 @@ return array( 'file_is_nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses %s. Der HTTP-Server muss Schreibrechte besitzen', 'finished' => 'Aktualisierung abgeschlossen!', 'none' => 'Keine Aktualisierung zum Anwenden', - 'server_not_found' => 'Aktualisierungs-Server kann nicht gefunden werden. [%s]', + 'server_not_found' => 'Der Aktualisierungs-Server kann nicht gefunden werden. [%s]', ), 'user' => array( 'created' => array( - '_' => 'Benutzer %s ist erstellt worden', - 'error' => 'Benutzer %s kann nicht erstellt werden', + '_' => 'Der Benutzer %s ist erstellt worden', + 'error' => 'Der Benutzer %s kann nicht erstellt werden', ), 'deleted' => array( - '_' => 'Benutzer %s ist gelöscht worden', - 'error' => 'Benutzer %s kann nicht gelöscht werden', + '_' => 'Der Benutzer %s ist gelöscht worden', + 'error' => 'Der Benutzer %s kann nicht gelöscht werden', ), ), 'profile' => array( -- cgit v1.2.3 From 7c6ce30f59295d06ad7fc7f6c3e935d058836877 Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Sat, 16 May 2015 18:54:23 +0200 Subject: Update gen.php --- app/i18n/de/gen.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 8970d5003..f24a52c2e 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -49,7 +49,7 @@ return array( 'april' => 'April', 'aug' => 'Aug', 'august' => 'August', - 'before_yesterday' => 'Vor gestern', + 'before_yesterday' => 'Vor vorgestern', 'dec' => 'Dez', 'december' => 'Dezember', 'feb' => 'Feb', @@ -93,7 +93,7 @@ return array( ), 'js' => array( 'category_empty' => 'Kategorie leeren', - 'confirm_action' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Dies kann nicht abgebrochen werden!', + 'confirm_action' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Diese Aktion kann nicht abgebrochen werden!', 'confirm_action_feed_cat' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Sie werden zugehörige Favoriten und Benutzerabfragen verlieren. Dies kann nicht abgebrochen werden!', 'feedback' => array( 'body_new_articles' => 'Es gibt \\d neue Artikel zum Lesen auf FreshRSS.', -- cgit v1.2.3 From 450cc2d66f55817f85090ab742ebc351df9cbc43 Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Sat, 16 May 2015 18:55:31 +0200 Subject: Update index.php --- app/i18n/de/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/de/index.php b/app/i18n/de/index.php index 3449de87d..04798cdce 100644 --- a/app/i18n/de/index.php +++ b/app/i18n/de/index.php @@ -17,7 +17,7 @@ return array( ), 'feed' => array( 'add' => 'Sie können Feeds hinzufügen.', - 'empty' => 'Es gibt keinen Artikel zum Zeigen.', + 'empty' => 'Es gibt keinen Artikel zum Anzeigen.', 'rss_of' => 'RSS-Feed von %s', 'title' => 'Ihre RSS-Feeds', 'title_global' => 'Globale Ansicht', -- cgit v1.2.3 From fe2f6c74b9b2f5ed0f4c3f57b4bf2828e38e1f6a Mon Sep 17 00:00:00 2001 From: thomasE1993 Date: Sat, 16 May 2015 18:58:57 +0200 Subject: Update install.php --- app/i18n/de/install.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index e9267bbbd..a5899bb52 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -3,8 +3,8 @@ return array( 'action' => array( 'finish' => 'Installation fertigstellen', - 'fix_errors_before' => 'Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', - 'next_step' => 'Zum nächsten Schritt gehen', + 'fix_errors_before' => 'Bitte Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'next_step' => 'Zum nächsten Schritt springen', ), 'auth' => array( 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', @@ -33,7 +33,7 @@ return array( '_' => 'Überprüfungen', 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/cache. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', ), 'ctype' => array( 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', @@ -45,7 +45,7 @@ return array( ), 'data' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data sind in Ordnung.', ), 'dom' => array( 'nok' => 'Ihnen fehlt eine benötigte Bibliothek um DOM zu durchstöbern (Paket php-xml).', @@ -53,7 +53,7 @@ return array( ), 'favicons' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/favicons. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/favicons sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/favicons sind in Ordnung.', ), 'http_referer' => array( 'nok' => 'Bitte stellen Sie sicher, dass Sie Ihren HTTP REFERER nicht abändern.', @@ -73,7 +73,7 @@ return array( ), 'persona' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/persona. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/persona sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/persona sind in Ordnung.', ), 'php' => array( 'nok' => 'Ihre PHP-Version ist %s aber FreshRSS benötigt mindestens Version %s.', @@ -81,22 +81,22 @@ return array( ), 'users' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/users. Der HTTP-Server muss Schreibrechte besitzen.', - 'ok' => 'Berechtigungen des Verzeichnisses ./data/users sind in Ordnung.', + 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/users sind in Ordnung.', ), ), 'conf' => array( '_' => 'Allgemeine Konfiguration', - 'ok' => 'Allgemeine Konfiguration ist gespeichert worden.', + 'ok' => 'Die allgemeine Konfiguration ist gespeichert worden.', ), 'congratulations' => 'Glückwunsch!', 'default_user' => 'Nutzername des Standardbenutzers (maximal 16 alphanumerische Zeichen)', 'delete_articles_after' => 'Entferne Artikel nach', - 'fix_errors_before' => 'Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'fix_errors_before' => 'Bitte den Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', 'javascript_is_better' => 'FreshRSS ist ansprechender mit aktiviertem JavaScript', 'language' => array( '_' => 'Sprache', 'choose' => 'Wählen Sie eine Sprache für FreshRSS', - 'defined' => 'Sprache ist festgelegt worden.', + 'defined' => 'Die Sprache ist festgelegt worden.', ), 'not_deleted' => 'Etwas ist schiefgelaufen; Sie müssen die Datei %s manuell löschen.', 'ok' => 'Der Installationsvorgang war erfolgreich.', -- cgit v1.2.3 From 044c4428062ea215c9fe2f46fb47078854048e61 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 16 May 2015 19:36:42 +0200 Subject: i18n: German Completed cherry-pick of https://github.com/FreshRSS/FreshRSS/pull/832 + corrections --- app/i18n/de/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index 8550805ee..c0cbf6787 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -127,11 +127,11 @@ return array( 'entry_repartition' => 'Einträge-Verteilung', 'feed' => 'Feed', 'feed_per_category' => 'Feeds pro Kategorie', - 'idle' => 'Inkative Feeds', + 'idle' => 'Inaktive Feeds', 'main' => 'Haupt-Statistiken', 'main_stream' => 'Haupt-Feeds', 'menu' => array( - 'idle' => 'Inkative Feeds', + 'idle' => 'Inaktive Feeds', 'main' => 'Haupt-Statistiken', 'repartition' => 'Artikel-Verteilung', ), -- cgit v1.2.3 From d3af903301ce2b59d2720e94727945cf9ff31a40 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 16 May 2015 21:47:26 +0200 Subject: i18n: German PubSubHubbub https://github.com/FreshRSS/FreshRSS/pull/831/files#r30463016 https://github.com/FreshRSS/FreshRSS/issues/312 --- app/i18n/de/sub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 7433bd61c..0f05a5635 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -37,7 +37,7 @@ return array( 'url' => 'Feed-URL', 'validator' => 'Überprüfen Sie die Gültigkeit des Feeds', 'website' => 'Webseiten-URL', - 'pubsubhubbub' => 'Sofortige Benachrichtigung mit PubSubHubbub', + 'pubsubhubbub' => 'Sofortbenachrichtigung mit PubSubHubbub', ), 'import_export' => array( 'export' => 'Exportieren', -- cgit v1.2.3 From 6985a73f1c2f9ca774d50f5b4aa3a5f4742e1faf Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Sat, 16 May 2015 23:37:28 +0200 Subject: Typo fix --- app/i18n/en/gen.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index b02b9f0f2..013c3495d 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -10,7 +10,7 @@ return array( 'empty' => 'Empty', 'enable' => 'Enable', 'export' => 'Export', - 'filter' => 'Filtrer', + 'filter' => 'Filter', 'import' => 'Import', 'manage' => 'Manage', 'mark_read' => 'Mark as read', -- cgit v1.2.3 From 84ea636d2d8c55e04d0c2d07688b66d7730b6c7c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 16 May 2015 23:44:36 +0200 Subject: PubSubHubbub bug skip pull Do not pull refresh feeds that are PubSubHubbub too often during cron refresh. And more debugging info during the test phase. https://github.com/FreshRSS/FreshRSS/pull/831 --- app/Controllers/feedController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index dfdf0dc16..5e845027f 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -300,8 +300,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $updated_feeds = 0; $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { + $url = $feed->url(); //For detection of HTTP 301 + $pubSubHubbubEnabled = $feed->pubSubHubbubEnabled(); - if ((!$simplePiePush) && (!$id) && (!$force) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { + if ((!$simplePiePush) && (!$id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { + $text = 'Skip pull of feed using PubSubHubbub: ' . $url; + Minz_Log::debug($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); continue; //When PubSubHubbub is used, do not pull refresh so often } @@ -310,7 +315,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { continue; } - $url = $feed->url(); //For detection of HTTP 301 try { if ($simplePiePush) { $feed->loadEntries($simplePiePush); //Used by PubSubHubbub -- cgit v1.2.3 From 6d31c60976f2cf8ca8adab7cb64a3d67f1ac6a00 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Sun, 17 May 2015 01:18:49 +0200 Subject: Language fix --- app/i18n/en/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index d2fcd3e82..155384afd 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -12,7 +12,7 @@ return array( 'title' => 'Authentication', 'title_reset' => 'Authentication reset', 'token' => 'Authentication token', - 'token_help' => 'Allows to access RSS output of the default user without authentication:', + 'token_help' => 'Allows access to RSS output of the default user without authentication:', 'type' => 'Authentication method', 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', ), -- cgit v1.2.3 From 35cdb89eed82ec7458b85cc734d384bdada111a3 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Sun, 17 May 2015 01:30:35 +0200 Subject: Language fix + en_GB standardisation --- app/i18n/en/feedback.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index 19af81e5b..c9189c0d0 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -2,7 +2,7 @@ return array( 'admin' => array( - 'optimization_complete' => 'Optimization complete', + 'optimization_complete' => 'Optimisation complete', ), 'access' => array( 'denied' => 'You don’t have permission to access this page', @@ -52,7 +52,7 @@ return array( 'zip_error' => 'An error occured during Zip import.', ), 'sub' => array( - 'actualize' => 'Actualize', + 'actualize' => 'Actualise', 'category' => array( 'created' => 'Category %s has been created.', 'deleted' => 'Category has been deleted.', @@ -86,7 +86,7 @@ return array( 'purge_completed' => 'Purge completed (%d articles deleted)', ), 'update' => array( - 'can_apply' => 'FreshRSS will be now updated to the version %s.', + 'can_apply' => 'FreshRSS will now be updated to the version %s.', 'error' => 'The update process has encountered an error: %s', 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', 'finished' => 'Update completed!', -- cgit v1.2.3 From af166f6c5344d727744e08d22f605cc57ec618f8 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Sun, 17 May 2015 01:33:43 +0200 Subject: Language fix --- app/i18n/en/install.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index 2bc6bd38f..742c73313 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -3,11 +3,11 @@ return array( 'action' => array( 'finish' => 'Complete installation', - 'fix_errors_before' => 'Fix errors before skip to the next step.', + 'fix_errors_before' => 'Please fix errors before before skipping to the next step.', 'next_step' => 'Go to the next step', ), 'auth' => array( - 'email_persona' => 'Login mail address
    (for Mozilla Persona)', + 'email_persona' => 'Login email address
    (for Mozilla Persona)', 'form' => 'Web form (traditional, requires JavaScript)', 'http' => 'HTTP (for advanced users with HTTPS)', 'none' => 'None (dangerous)', @@ -91,7 +91,7 @@ return array( 'congratulations' => 'Congratulations!', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', 'delete_articles_after' => 'Remove articles after', - 'fix_errors_before' => 'Fix errors before skip to the next step.', + 'fix_errors_before' => 'Please fix errors before before skipping to the next step.', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', 'language' => array( '_' => 'Language', -- cgit v1.2.3 From cad42ea55f8f974899328bed74cf2b9d7fffe4a2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 May 2015 12:32:46 +0200 Subject: i18n: en-GB revert https://github.com/FreshRSS/FreshRSS/commit/af166f6c5344d727744e08d22f605cc57ec618f8#commitcomment-11229341 --- app/i18n/en/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index 742c73313..d4137309a 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -3,7 +3,7 @@ return array( 'action' => array( 'finish' => 'Complete installation', - 'fix_errors_before' => 'Please fix errors before before skipping to the next step.', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', 'next_step' => 'Go to the next step', ), 'auth' => array( @@ -91,7 +91,7 @@ return array( 'congratulations' => 'Congratulations!', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', 'delete_articles_after' => 'Remove articles after', - 'fix_errors_before' => 'Please fix errors before before skipping to the next step.', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', 'language' => array( '_' => 'Language', -- cgit v1.2.3 From 001c713f030d51b74a860e20014153c6b4d9661f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 May 2015 22:06:11 +0200 Subject: PubSubHubbub better gestion of errors Do not assume that PubSubHubbub works until the first successul push https://github.com/FreshRSS/FreshRSS/issues/312#issuecomment-102706500 --- app/Controllers/feedController.php | 4 ++-- app/Models/Feed.php | 31 ++++++++++++++++++++++--------- p/api/pshb.php | 7 +++++++ 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 5e845027f..3d8a6deb7 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -305,7 +305,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $pubSubHubbubEnabled = $feed->pubSubHubbubEnabled(); if ((!$simplePiePush) && (!$id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { $text = 'Skip pull of feed using PubSubHubbub: ' . $url; - Minz_Log::debug($text); + //Minz_Log::debug($text); file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); continue; //When PubSubHubbub is used, do not pull refresh so often } @@ -389,7 +389,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); Minz_Log::warning($text); $pubSubHubbubEnabled = false; - $feed->pubSubHubbubEnabled(false); //To force the renewal of our lease + $feed->pubSubHubbubError(true); } if (!$entryDAO->hasTransaction()) { diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 7bc60dfc9..ed0a862c3 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -359,23 +359,33 @@ class FreshRSS_Feed extends Minz_Model { // - function pubSubHubbubEnabled($keep = true) { + function pubSubHubbubEnabled() { $url = $this->selfUrl ? $this->selfUrl : $this->url; $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; if ($hubFile = @file_get_contents($hubFilename)) { $hubJson = json_decode($hubFile, true); - if (!$keep) { - $hubJson['lease_end'] = time() - 60; - file_put_contents($hubFilename, json_encode($hubJson)); - file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" - . 'Force expire lease for ' . $url . "\n", FILE_APPEND); - } elseif ($hubJson && (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { + if ($hubJson && empty($hubJson['error']) && + (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { return true; } } return false; } + function pubSubHubbubError($error = true) { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); + $hubJson = $hubFile ? json_decode($hubFile, true) : array(); + if (!isset($hubJson['error']) || $hubJson['error'] !== (bool)$error) { + $hubJson['error'] = (bool)$error; + file_put_contents($hubFilename, json_encode($hubJson)); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" + . 'Set error to ' . ($error ? 1 : 0) . ' for ' . $url . "\n", FILE_APPEND); + } + return false; + } + function pubSubHubbubPrepare() { $key = ''; if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { @@ -389,17 +399,20 @@ class FreshRSS_Feed extends Minz_Model { file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); return false; } - if (empty($hubJson['lease_end']) || ($hubJson['lease_end'] <= (time() + (3600 * 24)))) { //TODO: Make a better policy + if ((!empty($hubJson['lease_end'])) && ($hubJson['lease_end'] < (time() + (3600 * 23)))) { //TODO: Make a better policy $text = 'PubSubHubbub lease ends at ' . date('c', empty($hubJson['lease_end']) ? time() : $hubJson['lease_end']) . ' and needs renewal: ' . $this->url; Minz_Log::warning($text); file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); $key = $hubJson['key']; //To renew our lease + } elseif (((!empty($hubJson['error'])) || empty($hubJson['lease_end'])) && + (empty($hubJson['lease_start']) || $hubJson['lease_start'] < time() - (3600 * 23))) { //Do not renew too often + $key = $hubJson['key']; //To renew our lease } } else { @mkdir($path, 0777, true); - $key = sha1(FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); + $key = sha1($path . FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); $hubJson = array( 'hub' => $this->hubUrl, 'key' => $key, diff --git a/p/api/pshb.php b/p/api/pshb.php index 2f7f48cd8..4bb4694b3 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -60,6 +60,10 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { } else { unset($hubJson['lease_end']); } + $hubJson['lease_start'] = time(); + if (!isset($hubJson['error'])) { + $hubJson['error'] = true; //Do not assume that PubSubHubbub works until the first successul push + } file_put_contents('./!hub.json', json_encode($hubJson)); exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); } @@ -120,6 +124,9 @@ if ($nb === 0) { header('HTTP/1.1 410 Gone'); logMe('Error: Nobody is subscribed to this feed anymore after all!: ' . $self); die('Nobody is subscribed to this feed anymore after all!'); +} elseif (!empty($hubJson['error'])) { + $hubJson['error'] = false; + file_put_contents('./!hub.json', json_encode($hubJson)); } logMe('PubSubHubbub ' . $self . ' done: ' . $nb); -- cgit v1.2.3 From 265f09f25726102249ff3819ae810f85dee2849f Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Mon, 18 May 2015 09:02:28 +0200 Subject: Language fix --- app/i18n/en/gen.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 013c3495d..6e47e0921 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -150,7 +150,7 @@ return array( 'wallabag' => 'wallabag', ), 'short' => array( - 'attention' => 'Attention!', + 'attention' => 'Warning!', 'blank_to_disable' => 'Leave blank to disable', 'by_author' => 'By %s', 'by_default' => 'By default', -- cgit v1.2.3 From 6263ecef2fde84aa317ccd4d0b784ac6c2ad2295 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Mon, 18 May 2015 09:06:37 +0200 Subject: Language fix --- app/i18n/en/conf.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 683781696..42a06906d 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -5,9 +5,9 @@ return array( '_' => 'Archiving', 'advanced' => 'Advanced', 'delete_after' => 'Remove articles after', - 'help' => 'More options are available in the individual stream settings', + 'help' => 'More options are available in the individual feed settings', 'keep_history_by_feed' => 'Minimum number of articles to keep by feed', - 'optimize' => 'Optimize database', + 'optimize' => 'Optimise database', 'optimize_help' => 'To do occasionally to reduce the size of the database', 'purge_now' => 'Purge now', 'title' => 'Archiving', @@ -72,7 +72,7 @@ return array( ), 'profile' => array( '_' => 'Profile management', - 'email_persona' => 'Login mail address
    (for Mozilla Persona)', + 'email_persona' => 'Login email address
    (for Mozilla Persona)', 'password_api' => 'Password API
    (e.g., for mobile apps)', 'password_form' => 'Password
    (for the Web-form login method)', 'password_format' => 'At least 7 characters', -- cgit v1.2.3 From 7524811c963d4e90df60ef9b3ebdae62e4da3e60 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Mon, 18 May 2015 09:09:28 +0200 Subject: Language fix --- app/i18n/en/sub.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 2b62e4775..8fe150bb2 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -18,7 +18,7 @@ return array( 'password' => 'HTTP password', 'username' => 'HTTP username', ), - 'css_help' => 'Retrieves truncated RSS feeds (attention, requires more time!)', + 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', 'css_path' => 'Articles CSS path on original website', 'description' => 'Description', 'empty' => 'This feed is empty. Please verify that it is still maintained.', @@ -26,7 +26,7 @@ return array( 'in_main_stream' => 'Show in main stream', 'informations' => 'Information', 'keep_history' => 'Minimum number of articles to keep', - 'moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under %s.', + 'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under %s.', 'no_selected' => 'No feed selected.', 'number_entries' => '%d articles', 'stats' => 'Statistics', -- cgit v1.2.3 From 27d2b88a19345dfc665dc086d3c2b2e4547e1b7f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 23 May 2015 02:23:38 +0200 Subject: Minz getBaseUrl correction and RSS template bug https://github.com/FreshRSS/FreshRSS/issues/848 Corrections in Minz (HTTP_HOST was not sanitized, getURI() was never used and not working anyway with absolute base_url) $this->url was not defined in rss.phtml --- app/Controllers/indexController.php | 1 + constants.php | 3 ++- lib/Minz/Request.php | 46 +++++++++++-------------------------- lib/Minz/Url.php | 10 +------- 4 files changed, 18 insertions(+), 42 deletions(-) (limited to 'app') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index c1aaca53f..baaf99065 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -137,6 +137,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } // No layout for RSS output. + $this->view->url = empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']; $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); $this->view->_useLayout(false); header('Content-Type: application/rss+xml; charset=utf-8'); diff --git a/constants.php b/constants.php index b20bf0710..d32fdfa9b 100644 --- a/constants.php +++ b/constants.php @@ -11,7 +11,8 @@ define('PHP_COMPRESSION', false); define('FRESHRSS_PATH', dirname(__FILE__)); define('PUBLIC_PATH', FRESHRSS_PATH . '/p'); - define('INDEX_PATH', PUBLIC_PATH . '/i'); + define('PUBLIC_TO_INDEX_PATH', '/i'); + define('INDEX_PATH', PUBLIC_PATH . PUBLIC_TO_INDEX_PATH); define('PUBLIC_RELATIVE', '..'); define('DATA_PATH', FRESHRSS_PATH . '/data'); diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index 6db2e9c7a..b9eda82a5 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -84,45 +84,27 @@ class Minz_Request { self::magicQuotesOff(); } - /** - * Retourn le nom de domaine du site - */ - public static function getDomainName() { - return $_SERVER['HTTP_HOST']; - } - /** * Détermine la base de l'url * @return la base de l'url */ - public static function getBaseUrl() { + public static function getBaseUrl($baseUrlSuffix = '') { $conf = Minz_Configuration::get('system'); - $defaultBaseUrl = $conf->base_url; - if (!empty($defaultBaseUrl)) { - return $defaultBaseUrl; - } elseif (isset($_SERVER['REQUEST_URI'])) { - return dirname($_SERVER['REQUEST_URI']) . '/'; - } else { - return '/'; - } - } - - /** - * Récupère l'URI de la requête - * @return l'URI - */ - public static function getURI() { - if (isset($_SERVER['REQUEST_URI'])) { - $base_url = self::getBaseUrl(); - $uri = $_SERVER['REQUEST_URI']; - - $len_base_url = strlen($base_url); - $real_uri = substr($uri, $len_base_url); + $url = $conf->base_url; + if ($url == '' || !preg_match('%^https?://%i', $url)) { + $url = 'http'; + $host = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; + $port = empty($_SERVER['SERVER_PORT']) ? 80 : $_SERVER['SERVER_PORT']; + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { + $url .= 's://' . $host . ($port == 443 ? '' : ':' . $port); + } else { + $url .= '://' . $host . ($port == 80 ? '' : ':' . $port); + } + $url .= isset($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : ''; } else { - $real_uri = ''; + $url = rtrim($url, '/\\') . $baseUrlSuffix; } - - return $real_uri; + return filter_var($url . '/', FILTER_SANITIZE_URL); } /** diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index af555a277..a47d8f1a6 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -10,7 +10,6 @@ class Minz_Url { * $url['c'] = controller * $url['a'] = action * $url['params'] = tableau des paramètres supplémentaires - * $url['protocol'] = protocole à utiliser (http par défaut) * ou comme une chaîne de caractère * @param $encodage pour indiquer comment encoder les & (& ou & pour html) * @return l'url formatée @@ -25,14 +24,7 @@ class Minz_Url { $url_string = ''; if ($absolute) { - if ($isArray && isset ($url['protocol'])) { - $protocol = $url['protocol']; - } elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $protocol = 'https:'; - } else { - $protocol = 'http:'; - } - $url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl (); + $url_string = Minz_Request::getBaseUrl(PUBLIC_TO_INDEX_PATH); } else { $url_string = $isArray ? '.' : PUBLIC_RELATIVE; } -- cgit v1.2.3 From 694dfa1f8b90d8f693ef39c7099c0e8f23c5c777 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 23 May 2015 16:37:08 +0200 Subject: PubSubHubbub: remove white list The tests so far are good. Ready to test more broadly. https://github.com/FreshRSS/FreshRSS/pull/831 https://github.com/FreshRSS/FreshRSS/issues/312 --- app/Controllers/feedController.php | 11 ++++------- app/Models/Feed.php | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 3d8a6deb7..957a809cd 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -442,13 +442,10 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } $feed->faviconPrepare(); - if (in_array($feed->url(), array('http://push-pub.appspot.com/feed'))) { //TODO: Remove white-list after testing - Minz_Log::debug('PubSubHubbub match ' . $feed->url()); - if ($feed->pubSubHubbubPrepare()) { - Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); - if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe - Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); - } + if ($feed->pubSubHubbubPrepare()) { + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); } } $feed->unlock(); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index ed0a862c3..bf7ed3967 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -388,7 +388,7 @@ class FreshRSS_Feed extends Minz_Model { function pubSubHubbubPrepare() { $key = ''; - if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); $hubFilename = $path . '/!hub.json'; if ($hubFile = @file_get_contents($hubFilename)) { -- cgit v1.2.3 From 9d55ee5ae9e41fe460ff82b4d51bf1673fb1b836 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 24 May 2015 01:49:13 +0200 Subject: Bug EntryDAO filter https://github.com/FreshRSS/FreshRSS/issues/850 --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index eae9683ad..f939a0fb3 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -511,7 +511,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $where .= 'AND e1.id >= ' . $date_min . '000000 '; } $search = ''; - if ($filter !== null) { + if ($filter) { if ($filter->getIntitle()) { $search .= 'AND e1.title LIKE ? '; $values[] = "%{$filter->getIntitle()}%"; -- cgit v1.2.3 From 96ba71e618468f7d28a04c4ebc7c46dd912ccd75 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 31 May 2015 20:22:27 +0200 Subject: MySQL create table bug https://github.com/FreshRSS/FreshRSS/issues/845 And updated version comments to 1.1.1 --- app/Models/EntryDAO.php | 2 +- app/SQL/install.sql.mysql.php | 8 ++++---- app/SQL/install.sql.sqlite.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f939a0fb3..bd575989d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -92,7 +92,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $this->addEntry($valuesTmp); } elseif ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']. ' ' . $this->addEntryPrepared); + . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); } return false; } diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 9c6af405d..c5787d25b 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -41,8 +41,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( `content_bin` blob, -- v0.7 `link` varchar(1023) CHARACTER SET latin1 NOT NULL, `date` int(11), -- Until year 2038 - `lastSeen` INT(11) DEFAULT 0, -- v1.2, Until year 2038 - `hash` BINARY(16), -- v1.2 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, -- v0.7 @@ -51,8 +51,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, UNIQUE KEY (`id_feed`,`guid`), -- v0.7 INDEX (`is_favorite`), -- v0.7 - INDEX (`is_read`) -- v0.7 - INDEX entry_lastSeen_index (`lastSeen`) -- v1.2 + INDEX (`is_read`), -- v0.7 + INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB; diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 77e8e094c..71bad7311 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -39,8 +39,8 @@ $SQL_CREATE_TABLES = array( `content` text, `link` varchar(1023) NOT NULL, `date` int(11), -- Until year 2038 - `lastSeen` INT(11) DEFAULT 0, -- v1.2, Until year 2038 - `hash` BINARY(16), -- v1.2 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 `is_read` boolean NOT NULL DEFAULT 0, `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` SMALLINT, @@ -52,7 +52,7 @@ $SQL_CREATE_TABLES = array( 'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `%1$sentry`(`is_favorite`);', 'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `%1$sentry`(`is_read`);', -'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.2 +'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.1.1 'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', ); -- cgit v1.2.3 From 384a146883548ba0274f8cbee0c2e67dc053f70e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 31 May 2015 20:48:18 +0200 Subject: Minor comment 1.1.1 https://github.com/FreshRSS/FreshRSS/issues/845 --- app/Models/EntryDAO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index bd575989d..9ddcfcfb3 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -11,7 +11,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $hasTransaction = false; try { $stm = null; - if ($name === 'lastSeen') { //v1.2 + if ($name === 'lastSeen') { //v1.1.1 if (!$this->bd->inTransaction()) { $this->bd->beginTransaction(); $hasTransaction = true; @@ -29,7 +29,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if ($hasTransaction) { $this->bd->rollBack(); } - } elseif ($name === 'hash') { //v1.2 + } elseif ($name === 'hash') { //v1.1.1 $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)'); return $stm && $stm->execute(); } -- cgit v1.2.3 From 214a5cc9a4c2b821961bc21f22b4b08e34b5be68 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 3 Jun 2015 20:21:32 +0200 Subject: PHP 5.2 compatiblity Namespaces are not needed so far. https://github.com/FreshRSS/FreshRSS/commit/aacd1ffd4052b04c724c2783b3ee2845ca4ada35#commitcomment-11503581 --- app/Exceptions/ContextException.php | 2 +- app/Exceptions/DAOException.php | 2 +- app/Exceptions/EntriesGetterException.php | 2 +- app/Exceptions/FeedException.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/Exceptions/ContextException.php b/app/Exceptions/ContextException.php index 8f05eccd6..00934cbfd 100644 --- a/app/Exceptions/ContextException.php +++ b/app/Exceptions/ContextException.php @@ -3,6 +3,6 @@ /** * An exception raised when a context is invalid */ -class FreshRSS_Context_Exception extends \Exception { +class FreshRSS_Context_Exception extends Exception { } diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php index e48e521ab..14bee3403 100644 --- a/app/Exceptions/DAOException.php +++ b/app/Exceptions/DAOException.php @@ -1,5 +1,5 @@ Date: Fri, 5 Jun 2015 20:44:45 +0200 Subject: PDO option example --- app/install.php | 3 ++- data/config.default.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 3cdd59d11..313081c14 100644 --- a/app/install.php +++ b/app/install.php @@ -165,7 +165,7 @@ function saveStep3() { $_SESSION['bd_user'] = $_POST['user']; $_SESSION['bd_password'] = $_POST['pass']; $_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16); - $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] .(empty($_SESSION['default_user']) ? '' :($_SESSION['default_user'] . '_')); + $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); } //TODO: load `config.default.php` as default @@ -183,6 +183,7 @@ function saveStep3() { 'password' => $_SESSION['bd_password'], 'base' => $_SESSION['bd_base'], 'prefix' => $_SESSION['bd_prefix'], + 'pdo_options' => array(), ), ); diff --git a/data/config.default.php b/data/config.default.php index 7c179c8a0..97085df29 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -100,6 +100,9 @@ return array( 'prefix' => '', 'pdo_options' => array( + //PDO::MYSQL_ATTR_SSL_KEY => '/path/to/client-key.pem', + //PDO::MYSQL_ATTR_SSL_CERT => '/path/to/client-cert.pem', + //PDO::MYSQL_ATTR_SSL_CA => '/path/to/ca-cert.pem', ), ), -- cgit v1.2.3 From 111c9f757274f547c9789ad127fde886bedc1925 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 6 Jun 2015 14:18:49 +0200 Subject: Bug label --- app/views/configure/display.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 91b0b8189..db6d7951c 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -107,7 +107,7 @@
    - +
    -- cgit v1.2.3 From fcc94c733afe4e745ca4b12a47942ae0419c4786 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 6 Jun 2015 09:09:39 -0400 Subject: Remove the auto-focus on install The javascript code used was confusing on Chrome and Internet Explorer. So I removed it. It has no real value so I think it is better without it. See #855 --- app/install.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 3cdd59d11..15206b6e3 100644 --- a/app/install.php +++ b/app/install.php @@ -636,7 +636,7 @@ function printStep2() { toggles[i].addEventListener('mouseup', hide_password); } - function auth_type_change(focus) { + function auth_type_change() { var auth_value = document.getElementById('auth_type').value, password_input = document.getElementById('passwordPlain'), mail_input = document.getElementById('mail_login'); @@ -644,21 +644,15 @@ function printStep2() { if (auth_value === 'form') { password_input.required = true; mail_input.required = false; - if (focus) { - password_input.focus(); - } } else if (auth_value === 'persona') { password_input.required = false; mail_input.required = true; - if (focus) { - mail_input.focus(); - } } else { password_input.required = false; mail_input.required = false; } } - auth_type_change(false); + auth_type_change();
    -- cgit v1.2.3 From ff9091e4a0373fc2b8331fe1672f784cec6cc666 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 6 Jun 2015 15:22:02 +0200 Subject: Increased max number of posts per page https://github.com/FreshRSS/FreshRSS/issues/872 --- app/views/configure/reading.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 1b7a101df..9c54b6bd5 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -9,7 +9,7 @@
    - +
    -- cgit v1.2.3 From f2f758e6bd0fe4f1b95377badefaf404c3160d62 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 6 Jun 2015 09:34:11 -0400 Subject: Add tab navigation on install --- app/install.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 3cdd59d11..417c76733 100644 --- a/app/install.php +++ b/app/install.php @@ -427,7 +427,7 @@ function printStep0() {
    -
  • - +
  • - +
-- cgit v1.2.3 From 5cb3d017ab893f1e99df5cfd373e47df88f53960 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 29 Jun 2015 20:46:51 +0200 Subject: Orthographe validité MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/i18n/fr/sub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index 0a1a03e41..e3631eb8b 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -35,7 +35,7 @@ return array( 'title_add' => 'Ajouter un flux RSS', 'ttl' => 'Ne pas automatiquement rafraîchir plus souvent que', 'url' => 'URL du flux', - 'validator' => 'Vérifier la valididé du flux', + 'validator' => 'Vérifier la validité du flux', 'website' => 'URL du site', 'pubsubhubbub' => 'Notification instantanée par PubSubHubbub', ), -- cgit v1.2.3 From 9f0b8ce70d84182676eab89e1c681e5d8bbf7539 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 3 Jul 2015 23:29:46 +0200 Subject: Add default feeds https://github.com/FreshRSS/FreshRSS/issues/859 --- app/SQL/install.sql.mysql.php | 2 ++ app/SQL/install.sql.sqlite.php | 2 ++ 2 files changed, 4 insertions(+) (limited to 'app') diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index c5787d25b..0f4e04620 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -57,6 +57,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( ENGINE = INNODB; INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s"); +INSERT IGNORE INTO `%1$sfeed` (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 IGNORE INTO `%1$sfeed` (url, category, name, website, description, ttl) VALUES("https://github.com/FreshRSS/FreshRSS/releases.atom", 1, "FreshRSS @ GitHub", "https://github.com/FreshRSS/FreshRSS/", "FreshRSS releases @ GitHub", 86400); '); define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 71bad7311..87d5cf286 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -55,6 +55,8 @@ $SQL_CREATE_TABLES = array( 'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.1.1 'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', +'INSERT OR IGNORE INTO `%1$sfeed` (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 `%1$sfeed` (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 TABLES %1$sentry, %1$sfeed, %1$scategory'); -- cgit v1.2.3 From 079150eee4eebce3549c3d7db84dd0180bdd11e7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 3 Jul 2015 23:47:18 +0200 Subject: Updated log visibility In particular, ensure that ERROR is only used for errors that may affect FreshRSS integrity, and ensure that feed errors are visible also in production, i.e. visibility of WARNING https://github.com/FreshRSS/FreshRSS/issues/885 https://github.com/FreshRSS/FreshRSS/issues/884 --- app/Controllers/authController.php | 2 +- app/Controllers/feedController.php | 2 +- app/Controllers/importExportController.php | 6 +++--- app/Controllers/updateController.php | 2 +- app/Models/CategoryDAO.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 937c0759d..b55892475 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -253,7 +253,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { FreshRSS_Auth::giveAccess(); invalidateHttpCache(); } else { - Minz_Log::error($reason); + Minz_Log::warning($reason); $res = array(); $res['status'] = 'failure'; diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index b91f63b5b..488d066a9 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -322,7 +322,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed->load(false); } } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::notice($e->getMessage()); + Minz_Log::warning($e->getMessage()); $feedDAO->updateLastUpdate($feed->id(), true); $feed->unlock(); continue; diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 26b163e43..60e467255 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -47,7 +47,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $status_file = $file['error']; if ($status_file !== 0) { - Minz_Log::error('File cannot be uploaded. Error code: ' . $status_file); + Minz_Log::warning('File cannot be uploaded. Error code: ' . $status_file); Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), array('c' => 'importExport', 'a' => 'index')); } @@ -69,7 +69,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { if (!is_resource($zip)) { // zip_open cannot open file: something is wrong - Minz_Log::error('Zip archive cannot be imported. Error code: ' . $zip); + Minz_Log::warning('Zip archive cannot be imported. Error code: ' . $zip); Minz_Request::bad(_t('feedback.import_export.zip_error'), array('c' => 'importExport', 'a' => 'index')); } @@ -77,7 +77,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { while (($zipfile = zip_read($zip)) !== false) { if (!is_resource($zipfile)) { // zip_entry() can also return an error code! - Minz_Log::error('Zip file cannot be imported. Error code: ' . $zipfile); + Minz_Log::warning('Zip file cannot be imported. Error code: ' . $zipfile); } else { $type_zipfile = $this->guessFileType(zip_entry_name($zipfile)); if ($type_file !== 'unknown') { diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 4797a3486..84a33fe85 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -63,7 +63,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { curl_close($c); if ($c_status !== 200) { - Minz_Log::error( + Minz_Log::warning( 'Error during update (HTTP code ' . $c_status . '): ' . $c_error ); diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 189a5f0e4..b5abac519 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -13,7 +13,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable return $this->bd->lastInsertId(); } else { $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); - Minz_Log::error('SQL error addCategory: ' . $info[2] ); + Minz_Log::error('SQL error addCategory: ' . $info[2]); return false; } } -- cgit v1.2.3 From 6b7d94626656674b60d6f970bd4ada46383dde1e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 10 Jul 2015 21:40:28 +0200 Subject: Avoid hex2bin for PHP 5.3 https://github.com/FreshRSS/FreshRSS/issues/894 And use native hexadecimal function when available (MySQL) to avoid having binary data in the SQL logs. --- app/Models/EntryDAO.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 9ddcfcfb3..f74055835 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -6,6 +6,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return parent::$sharedDbType !== 'sqlite'; } + public function hasNativeHex() { + return parent::$sharedDbType !== 'sqlite'; + } + protected function addColumn($name) { Minz_Log::debug('FreshRSS_EntryDAO::autoAddColumn: ' . $name); $hasTransaction = false; @@ -64,7 +68,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { . ', link, date, lastSeen, hash, is_read, is_favorite, id_feed, tags) ' . 'VALUES(?, ?, ?, ?, ' . ($this->isCompressed() ? 'COMPRESS(?)' : '?') - . ', ?, ?, ?, ?, ?, ?, ?, ?)'; + . ', ?, ?, ?, ' + . ($this->hasNativeHex() ? 'X?' : '?') + . ', ?, ?, ?, ?)'; $this->addEntryPrepared = $this->bd->prepare($sql); } @@ -77,7 +83,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { substr($valuesTmp['link'], 0, 1023), $valuesTmp['date'], time(), - hex2bin($valuesTmp['hash']), // X'09AF' hexadecimal literals do not work with SQLite/PDO + $this->hasNativeHex() ? $valuesTmp['hash'] : pack('H*', $valuesTmp['hash']), // X'09AF' hexadecimal literals do not work with SQLite/PDO //hex2bin() is PHP5.4+ $valuesTmp['is_read'] ? 1 : 0, $valuesTmp['is_favorite'] ? 1 : 0, $valuesTmp['id_feed'], @@ -109,8 +115,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET title=?, author=?, ' . ($this->isCompressed() ? 'content_bin=COMPRESS(?)' : 'content=?') - . ', link=?, date=?, lastSeen=?, hash=?, ' - . ($valuesTmp['is_read'] === null ? '' : 'is_read=?, ') + . ', link=?, date=?, lastSeen=?, hash=' + . ($this->hasNativeHex() ? 'X?' : '?') + . ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=?, ') . 'tags=? ' . 'WHERE id_feed=? AND guid=?'; $this->updateEntryPrepared = $this->bd->prepare($sql); @@ -123,7 +130,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { substr($valuesTmp['link'], 0, 1023), $valuesTmp['date'], time(), - hex2bin($valuesTmp['hash']), + $this->hasNativeHex() ? $valuesTmp['hash'] : pack('H*', $valuesTmp['hash']), ); if ($valuesTmp['is_read'] !== null) { $values[] = $valuesTmp['is_read'] ? 1 : 0; -- cgit v1.2.3 From 1f42a5d6db957434ef4cbed7758218a7ca13581d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 17 Jul 2015 17:27:45 +0200 Subject: Remove unnecessary hard-coded config information See https://github.com/FreshRSS/FreshRSS/issues/890 --- app/install.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index effe0e7ff..4c66932db 100644 --- a/app/install.php +++ b/app/install.php @@ -168,10 +168,7 @@ function saveStep3() { $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); } - //TODO: load `config.default.php` as default $config_array = array( - 'environment' => 'production', - 'simplepie_syslog_enabled' => true, 'salt' => $_SESSION['salt'], 'title' => $_SESSION['title'], 'default_user' => $_SESSION['default_user'], -- cgit v1.2.3 From 815a943e01af416e997c7081e158c9a6922a897f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 17 Jul 2015 18:13:43 +0200 Subject: Use default user/system config in install Change all hard-coded values by default user or system values. We need to set db['host'] and db['prefix'] See https://github.com/FreshRSS/FreshRSS/issues/890 --- app/install.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 4c66932db..745629aa7 100644 --- a/app/install.php +++ b/app/install.php @@ -9,6 +9,9 @@ session_name('FreshRSS'); session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true); session_start(); +Minz_Configuration::register('system', DATA_PATH . '/config.default.php'); +Minz_Configuration::register('user', USERS_PATH . '/_/config.default.php'); + if (isset($_GET['step'])) { define('STEP',(int)$_GET['step']); } else { @@ -77,9 +80,10 @@ function saveLanguage() { } function saveStep2() { + $user_default_config = Minz_Configuration::get('user'); if (!empty($_POST)) { $_SESSION['title'] = substr(trim(param('title', _t('gen.freshrss'))), 0, 25); - $_SESSION['old_entries'] = param('old_entries', 3); + $_SESSION['old_entries'] = param('old_entries', $user_default_config->old_entries); $_SESSION['auth_type'] = param('auth_type', 'form'); $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', param('default_user', '')), 0, 16); $_SESSION['mail_login'] = filter_var(param('mail_login', ''), FILTER_VALIDATE_EMAIL); @@ -108,7 +112,7 @@ function saveStep2() { $_SESSION['salt'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); if ((!ctype_digit($_SESSION['old_entries'])) ||($_SESSION['old_entries'] < 1)) { - $_SESSION['old_entries'] = 3; + $_SESSION['old_entries'] = $user_default_config->old_entries; } $token = ''; @@ -118,7 +122,7 @@ function saveStep2() { $config_array = array( 'language' => $_SESSION['language'], - 'theme' => 'Origine', + 'theme' => $user_default_config->theme, 'old_entries' => $_SESSION['old_entries'], 'mail_login' => $_SESSION['mail_login'], 'passwordHash' => $_SESSION['passwordHash'], @@ -542,6 +546,7 @@ function printStep1() { } function printStep2() { + $user_default_config = Minz_Configuration::get('user'); ?>

@@ -562,7 +567,7 @@ function printStep2() {
- +
@@ -667,6 +672,7 @@ function printStep2() { } function printStep3() { + $system_default_config = Minz_Configuration::get('system'); ?>

@@ -700,7 +706,7 @@ function printStep3() {
- +
@@ -728,7 +734,7 @@ function printStep3() {
- +
-- cgit v1.2.3 From e954275c06d790c2d0c163a59bff1aa30a8bd17b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 15:13:23 +0200 Subject: First structure to skip steps during installation See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/install.php | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 745629aa7..6238f8a20 100644 --- a/app/install.php +++ b/app/install.php @@ -79,6 +79,31 @@ function saveLanguage() { } } +function saveStep1() { + if (isset($_POST['freshrss-keep-reinstall']) && + $_POST['freshrss-keep-reinstall'] === '1') { + // We want to keep our previous installation of FreshRSS + // so we need to make next steps valid by setting $_SESSION vars + // with values from the previous installation + + // TODO: set $_SESSION vars + $_SESSION['title'] = ''; + $_SESSION['old_entries'] = ''; + $_SESSION['mail_login'] = ''; + $_SESSION['default_user'] = ''; + + $_SESSION['bd_type'] = ''; + $_SESSION['bd_host'] = ''; + $_SESSION['bd_user'] = ''; + $_SESSION['bd_password'] = ''; + $_SESSION['bd_base'] = ''; + $_SESSION['bd_prefix'] = ''; + $_SESSION['bd_error'] = ''; + + header('Location: index.php?step=4'); + } +} + function saveStep2() { $user_default_config = Minz_Configuration::get('user'); if (!empty($_POST)) { @@ -302,6 +327,10 @@ function checkStep1() { ); } +function freshrss_already_installed() { + return false; +} + function checkStep2() { $conf = !empty($_SESSION['title']) && !empty($_SESSION['old_entries']) && @@ -537,7 +566,15 @@ function printStep1() {

- + +

+ + + + + + +

@@ -788,6 +825,7 @@ default: saveLanguage(); break; case 1: + saveStep1(); break; case 2: saveStep2(); -- cgit v1.2.3 From 3dd2d56867db8aea8049c4b398e6ca2e1814cf67 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 15:40:18 +0200 Subject: Load previous configuration during saveStep1() See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/install.php | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 6238f8a20..75a211064 100644 --- a/app/install.php +++ b/app/install.php @@ -9,8 +9,8 @@ session_name('FreshRSS'); session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true); session_start(); -Minz_Configuration::register('system', DATA_PATH . '/config.default.php'); -Minz_Configuration::register('user', USERS_PATH . '/_/config.default.php'); +Minz_Configuration::register('default_system', DATA_PATH . '/config.default.php'); +Minz_Configuration::register('default_user', USERS_PATH . '/_/config.default.php'); if (isset($_GET['step'])) { define('STEP',(int)$_GET['step']); @@ -86,18 +86,31 @@ function saveStep1() { // so we need to make next steps valid by setting $_SESSION vars // with values from the previous installation - // TODO: set $_SESSION vars - $_SESSION['title'] = ''; - $_SESSION['old_entries'] = ''; - $_SESSION['mail_login'] = ''; - $_SESSION['default_user'] = ''; - - $_SESSION['bd_type'] = ''; - $_SESSION['bd_host'] = ''; - $_SESSION['bd_user'] = ''; - $_SESSION['bd_password'] = ''; - $_SESSION['bd_base'] = ''; - $_SESSION['bd_prefix'] = ''; + // First, we try to get previous configurations + Minz_Configuration::register('system', + DATA_PATH . '/config.php', + DATA_PATH . '/config.default.php'); + $system_conf = Minz_Configuration::get('system'); + + $current_user = $system_conf->default_user; + Minz_Configuration::register('user', + USERS_PATH . '/' . $current_user . '/config.php', + USERS_PATH . '/_/config.default.php'); + $user_conf = Minz_Configuration::get('user'); + + // Then, we set $_SESSION vars + $_SESSION['title'] = $system_conf->title; + $_SESSION['old_entries'] = $user_conf->old_entries; + $_SESSION['mail_login'] = $user_conf->mail_login; + $_SESSION['default_user'] = $current_user; + + $db = $system_conf->db; + $_SESSION['bd_type'] = $db['type']; + $_SESSION['bd_host'] = $db['host']; + $_SESSION['bd_user'] = $db['user']; + $_SESSION['bd_password'] = $db['password']; + $_SESSION['bd_base'] = $db['base']; + $_SESSION['bd_prefix'] = $db['prefix']; $_SESSION['bd_error'] = ''; header('Location: index.php?step=4'); @@ -105,7 +118,7 @@ function saveStep1() { } function saveStep2() { - $user_default_config = Minz_Configuration::get('user'); + $user_default_config = Minz_Configuration::get('default_user'); if (!empty($_POST)) { $_SESSION['title'] = substr(trim(param('title', _t('gen.freshrss'))), 0, 25); $_SESSION['old_entries'] = param('old_entries', $user_default_config->old_entries); @@ -583,7 +596,7 @@ function printStep1() { } function printStep2() { - $user_default_config = Minz_Configuration::get('user'); + $user_default_config = Minz_Configuration::get('default_user'); ?>

@@ -709,7 +722,7 @@ function printStep2() { } function printStep3() { - $system_default_config = Minz_Configuration::get('system'); + $system_default_config = Minz_Configuration::get('default_system'); ?>

-- cgit v1.2.3 From 7925a5125b6a095cde4b2c92846dac384d66d20e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 15:59:33 +0200 Subject: Detect previous FreshRSS installation See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/install.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 75a211064..3312208c0 100644 --- a/app/install.php +++ b/app/install.php @@ -9,6 +9,7 @@ session_name('FreshRSS'); session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true); session_start(); +// TODO: use join_path() instead Minz_Configuration::register('default_system', DATA_PATH . '/config.default.php'); Minz_Configuration::register('default_user', USERS_PATH . '/_/config.default.php'); @@ -80,6 +81,7 @@ function saveLanguage() { } function saveStep1() { + // TODO: rename reinstall in install if (isset($_POST['freshrss-keep-reinstall']) && $_POST['freshrss-keep-reinstall'] === '1') { // We want to keep our previous installation of FreshRSS @@ -87,6 +89,7 @@ function saveStep1() { // with values from the previous installation // First, we try to get previous configurations + // TODO: use join_path() instead Minz_Configuration::register('system', DATA_PATH . '/config.php', DATA_PATH . '/config.default.php'); @@ -100,9 +103,11 @@ function saveStep1() { // Then, we set $_SESSION vars $_SESSION['title'] = $system_conf->title; + $_SESSION['auth_type'] = $system_conf->auth_type; $_SESSION['old_entries'] = $user_conf->old_entries; $_SESSION['mail_login'] = $user_conf->mail_login; $_SESSION['default_user'] = $current_user; + $_SESSION['passwordHash'] = $user_conf->passwordHash; $db = $system_conf->db; $_SESSION['bd_type'] = $db['type']; @@ -341,7 +346,30 @@ function checkStep1() { } function freshrss_already_installed() { - return false; + $conf_path = join_path(DATA_PATH, 'config.php'); + if (!file_exists($conf_path)) { + return false; + } + + // A configuration file already exists, we try to load it. + $system_conf = null; + try { + Minz_Configuration::register('system', $conf_path); + $system_conf = Minz_Configuration::get('system'); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, the global conf exists... but what about default user conf? + $current_user = $system_conf->default_user; + try { + Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php')); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, ok, default user exists too! + return true; } function checkStep2() { -- cgit v1.2.3 From 118e0ddd0a3dcd7e08d695567c6caa2d79d4b606 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 16:12:21 +0200 Subject: Remove TODO (join_path and reinstall) See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/install.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 3312208c0..208bef0e9 100644 --- a/app/install.php +++ b/app/install.php @@ -9,9 +9,8 @@ session_name('FreshRSS'); session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true); session_start(); -// TODO: use join_path() instead -Minz_Configuration::register('default_system', DATA_PATH . '/config.default.php'); -Minz_Configuration::register('default_user', USERS_PATH . '/_/config.default.php'); +Minz_Configuration::register('default_system', join_path(DATA_PATH, 'config.default.php')); +Minz_Configuration::register('default_user', join_path(USERS_PATH, '_', 'config.default.php')); if (isset($_GET['step'])) { define('STEP',(int)$_GET['step']); @@ -81,24 +80,22 @@ function saveLanguage() { } function saveStep1() { - // TODO: rename reinstall in install - if (isset($_POST['freshrss-keep-reinstall']) && - $_POST['freshrss-keep-reinstall'] === '1') { + if (isset($_POST['freshrss-keep-install']) && + $_POST['freshrss-keep-install'] === '1') { // We want to keep our previous installation of FreshRSS // so we need to make next steps valid by setting $_SESSION vars // with values from the previous installation // First, we try to get previous configurations - // TODO: use join_path() instead Minz_Configuration::register('system', - DATA_PATH . '/config.php', - DATA_PATH . '/config.default.php'); + join_path(DATA_PATH, 'config.php'), + join_path(DATA_PATH, 'config.default.php')); $system_conf = Minz_Configuration::get('system'); $current_user = $system_conf->default_user; Minz_Configuration::register('user', - USERS_PATH . '/' . $current_user . '/config.php', - USERS_PATH . '/_/config.default.php'); + join_path(USERS_PATH, $current_user, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php')); $user_conf = Minz_Configuration::get('user'); // Then, we set $_SESSION vars @@ -611,7 +608,7 @@ function printStep1() {

- +
-- cgit v1.2.3 From 2c8b4f5a502cb387f5eccfcc38aa7434bd75637a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 16:27:10 +0200 Subject: Add translations TODO: german and czech translations See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/i18n/cz/install.php | 3 +++ app/i18n/de/install.php | 3 +++ app/i18n/en/install.php | 3 +++ app/i18n/fr/install.php | 3 +++ app/install.php | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php index 53257c84f..5f84d1cac 100644 --- a/app/i18n/cz/install.php +++ b/app/i18n/cz/install.php @@ -4,7 +4,9 @@ return array( 'action' => array( 'finish' => 'Dokončit instalaci', 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'keep_install' => 'Keep previous installation', // TODO: translate 'next_step' => 'Přejít na další krok', + 'reinstall' => 'Reinstall FreshRSS', // TODO: translate ), 'auth' => array( 'email_persona' => 'Email pro přihlášení
(pro Mozilla Persona)', @@ -31,6 +33,7 @@ return array( ), 'check' => array( '_' => 'Kontrola', + 'already_installed' => 'We have detected that FreshRSS is already installed!', // TODO: translate 'cache' => array( 'nok' => 'Zkontrolujte oprávnění adresáře ./data/cache. HTTP server musí mít do tohoto adresáře práva zápisu', 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index a5899bb52..6d937a638 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -4,7 +4,9 @@ return array( 'action' => array( 'finish' => 'Installation fertigstellen', 'fix_errors_before' => 'Bitte Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'keep_install' => 'Keep previous installation', // TODO: translate 'next_step' => 'Zum nächsten Schritt springen', + 'reinstall' => 'Reinstall FreshRSS', // TODO: translate ), 'auth' => array( 'email_persona' => 'Anmelde-E-Mail-Adresse
(für Mozilla Persona)', @@ -31,6 +33,7 @@ return array( ), 'check' => array( '_' => 'Überprüfungen', + 'already_installed' => 'We have detected that FreshRSS is already installed!', // TODO: translate 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/cache. Der HTTP-Server muss Schreibrechte besitzen.', 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index d4137309a..80488ca4a 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -4,7 +4,9 @@ return array( 'action' => array( 'finish' => 'Complete installation', 'fix_errors_before' => 'Please fix errors before skipping to the next step.', + 'keep_install' => 'Keep previous installation', 'next_step' => 'Go to the next step', + 'reinstall' => 'Reinstall FreshRSS', ), 'auth' => array( 'email_persona' => 'Login email address
(for Mozilla Persona)', @@ -31,6 +33,7 @@ return array( ), 'check' => array( '_' => 'Checks', + 'already_installed' => 'We have detected that FreshRSS is already installed!', 'cache' => array( 'nok' => 'Check permissions on ./data/cache directory. HTTP server must have rights to write into', 'ok' => 'Permissions on cache directory are good.', diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php index 245a20c56..6eca90458 100644 --- a/app/i18n/fr/install.php +++ b/app/i18n/fr/install.php @@ -4,7 +4,9 @@ return array( 'action' => array( 'finish' => 'Terminer l’installation', 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', + 'keep_install' => 'Garder l’ancienne configuration', 'next_step' => 'Passer à l’étape suivante', + 'reinstall' => 'Réinstaller FreshRSS', ), 'auth' => array( 'email_persona' => 'Adresse courriel de connexion
(pour Mozilla Persona)', @@ -31,6 +33,7 @@ return array( ), 'check' => array( '_' => 'Vérifications', + 'already_installed' => 'FreshRSS semble avoir déjà été installé !', 'cache' => array( 'nok' => 'Veuillez vérifier les droits sur le répertoire ./data/cache. Le serveur HTTP doit être capable d’écrire dedans', 'ok' => 'Les droits sur le répertoire de cache sont bons.', diff --git a/app/install.php b/app/install.php index 208bef0e9..61d2f5df9 100644 --- a/app/install.php +++ b/app/install.php @@ -605,7 +605,7 @@ function printStep1() { -

+

-- cgit v1.2.3 From 5d9b5f07feee3e388e747e5791cd91d1b98f55ef Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 17:10:18 +0200 Subject: Ask confirmation before reinstallation See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/install.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 61d2f5df9..ebd785f65 100644 --- a/app/install.php +++ b/app/install.php @@ -609,9 +609,31 @@ function printStep1() { - - + + + + -- cgit v1.2.3 From 3c35cdd7b7e8353d10cd299e19a23e528ad51280 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Jul 2015 19:07:33 +0200 Subject: Add translations for confirmation (installation) See https://github.com/FreshRSS/FreshRSS/issues/909 --- app/i18n/cz/install.php | 3 +++ app/i18n/de/install.php | 3 +++ app/i18n/en/install.php | 3 +++ app/i18n/fr/install.php | 3 +++ 4 files changed, 12 insertions(+) (limited to 'app') diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php index 5f84d1cac..cca717513 100644 --- a/app/i18n/cz/install.php +++ b/app/i18n/cz/install.php @@ -96,6 +96,9 @@ return array( 'delete_articles_after' => 'Smazat články starší než', 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', 'javascript_is_better' => 'Práce s FreshRSS je příjemnější se zapnutým JavaScriptem', + 'js' => array( + 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', // TODO: translate + ), 'language' => array( '_' => 'Jazyk', 'choose' => 'Vyberte jazyk FreshRSS', diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index 6d937a638..222c65b32 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -96,6 +96,9 @@ return array( 'delete_articles_after' => 'Entferne Artikel nach', 'fix_errors_before' => 'Bitte den Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', 'javascript_is_better' => 'FreshRSS ist ansprechender mit aktiviertem JavaScript', + 'js' => array( + 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', // TODO: translate + ), 'language' => array( '_' => 'Sprache', 'choose' => 'Wählen Sie eine Sprache für FreshRSS', diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index 80488ca4a..b94fbc299 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -96,6 +96,9 @@ return array( 'delete_articles_after' => 'Remove articles after', 'fix_errors_before' => 'Please fix errors before skipping to the next step.', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', + 'js' => array( + 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', + ), 'language' => array( '_' => 'Language', 'choose' => 'Choose a language for FreshRSS', diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php index 6eca90458..0401e1bbd 100644 --- a/app/i18n/fr/install.php +++ b/app/i18n/fr/install.php @@ -96,6 +96,9 @@ return array( 'delete_articles_after' => 'Supprimer les articles après', 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', + 'js' => array( + 'confirm_reinstall' => 'Réinstaller FreshRSS vous fera perdre la configuration précédente. Êtes-vous sûr de vouloir continuer ?', + ), 'language' => array( '_' => 'Langue', 'choose' => 'Choisissez la langue pour FreshRSS', -- cgit v1.2.3 From fa76e863c5622609b944542b0255c30f2f67c97e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 21 Jul 2015 14:26:15 +0200 Subject: Fix link for step 4 (install) Fix https://github.com/FreshRSS/FreshRSS/issues/912 --- app/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index ebd785f65..d5455f17d 100644 --- a/app/install.php +++ b/app/install.php @@ -925,7 +925,7 @@ case 5:
  • -
  • +
  • -- cgit v1.2.3 From ac8bd3d2512dd1bfca43d71ea10202ba9e6a82a6 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 21 Jul 2015 15:31:23 +0200 Subject: Add a max_registrations limit - Allow user to create accounts (not implemented) - Admin only can set this limit See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/userController.php | 24 ++++++++++++++++++++++++ app/Models/ConfigurationSetter.php | 3 +++ app/views/user/manage.phtml | 19 +++++++++++++++++++ data/config.default.php | 4 ++++ 4 files changed, 50 insertions(+) (limited to 'app') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index ed01b83c5..1c7745753 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -211,4 +211,28 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); } + + /** + * This action updates the max number of registrations. + * + * Request parameter is: + * - max-registrations (int >= 0) + */ + public function setRegistrationAction() { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { + $limits = FreshRSS_Context::$system_conf->limits; + $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); + FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->save(); + + invalidateHttpCache(); + + Minz_Session::_param('notification', array( + 'type' => 'good', + 'content' => _t('feedback.user.set_registration') + )); + } + + Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + } } diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 4bd29ecb0..236bf5b0b 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -352,6 +352,9 @@ class FreshRSS_ConfigurationSetter { 'min' => 0, 'max' => $max_small_int, ), + 'max_registrations' => array( + 'min' => 0, + ), ); foreach ($values as $key => $value) { diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index fe1b6618b..a7cbf0795 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -3,6 +3,25 @@
    +
    + + +
    + +
    + + +
    +
    + +
    +
    + + +
    +
    +
    +
    diff --git a/data/config.default.php b/data/config.default.php index 6013b13b8..5db933ff8 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -77,6 +77,10 @@ return array( # Max number of categories for a user. 'max_categories' => 16384, + # Max number of accounts that anonymous users can create + # 0 for an unlimited number of accounts + # 1 is to not allow user registrations (1 is corresponding to the admin account) + 'max_registrations' => 1, ), # Options used by cURL when making HTTP requests, e.g. when the SimplePie library retrieves feeds. -- cgit v1.2.3 From 37f06799589d9bb92ecfa6368197daf187251ab4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 21 Jul 2015 16:03:46 +0200 Subject: First draft for registration form See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/authController.php | 6 ++++++ app/views/auth/formLogin.phtml | 2 ++ app/views/auth/register.phtml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 app/views/auth/register.phtml (limited to 'app') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index b55892475..1c8ad2193 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -346,4 +346,10 @@ class FreshRSS_auth_Controller extends Minz_ActionController { } } } + + /** + * This action gives possibility to a user to create an account. + */ + public function registerAction() { + } } diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml index 979e17349..75537ee26 100644 --- a/app/views/auth/formLogin.phtml +++ b/app/views/auth/formLogin.phtml @@ -1,6 +1,8 @@

    + +
    diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml new file mode 100644 index 000000000..f67ecc4d9 --- /dev/null +++ b/app/views/auth/register.phtml @@ -0,0 +1,31 @@ +
    +

    + + +
    + + +
    + +
    + +
    + + +
    + +
    + +
    + + +
    + +
    + + +
    + + +

    +
    -- cgit v1.2.3 From 9fca5c70f33291cacc04e7bdfa01a12c6df3f97c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 12:20:00 +0200 Subject: Add some comments --- app/Controllers/userController.php | 19 +++++++++++++++++++ app/views/auth/register.phtml | 7 +++++++ 2 files changed, 26 insertions(+) (limited to 'app') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 1c7745753..c198d1328 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -103,6 +103,17 @@ class FreshRSS_user_Controller extends Minz_ActionController { $this->view->size_user = $entryDAO->size(); } + /** + * This action creates a new user. + * + * Request parameters are: + * - new_user_language + * - new_user_name + * - new_user_passwordPlain + * - new_user_email + * + * @todo clean up this method. Idea: write a method to init a user with basic information. + */ public function createAction() { if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { $db = FreshRSS_Context::$system_conf->db; @@ -178,6 +189,14 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); } + /** + * This action delete an existing user. + * + * Request parameter is: + * - username + * + * @todo clean up this method. Idea: create a User->clean() method. + */ public function deleteAction() { if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { $db = FreshRSS_Context::$system_conf->db; diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index f67ecc4d9..31ab89d26 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -1,3 +1,10 @@ +

    -- cgit v1.2.3 From 02c3546440f961018adc1e2c8e97c16f2aca18fc Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 13:52:03 +0200 Subject: Registration action is handled and create a user See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/userController.php | 20 +++++++++++++++++--- app/views/auth/register.phtml | 7 +++++++ lib/lib_rss.php | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index c198d1328..46f4f434d 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -12,9 +12,14 @@ class FreshRSS_user_Controller extends Minz_ActionController { * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the * underlying framework. + * + * @todo clean up the access condition. */ public function firstAction() { - if (!FreshRSS_Auth::hasAccess()) { + if (!FreshRSS_Auth::hasAccess() && !( + Minz_Request::actionName() === 'create' && + !max_registrations_reached() + )) { Minz_Error::error(403); } } @@ -111,11 +116,16 @@ class FreshRSS_user_Controller extends Minz_ActionController { * - new_user_name * - new_user_passwordPlain * - new_user_email + * - r (i.e. a redirection url, optional) * * @todo clean up this method. Idea: write a method to init a user with basic information. + * @todo handle r redirection in Minz_Request::forward directly? */ public function createAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { + if (Minz_Request::isPost() && ( + FreshRSS_Auth::hasAccess('admin') || + !max_registrations_reached() + )) { $db = FreshRSS_Context::$system_conf->db; require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); @@ -186,7 +196,11 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); } - Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } + Minz_Request::forward($redirect_url, true); } /** diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index 31ab89d26..96c91f411 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -29,6 +29,13 @@
    + 'index', 'a' => 'index'), + 'php', true + )); + ?> +
    diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 0118e0f46..c99e2c7e8 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -266,6 +266,22 @@ function listUsers() { } +/** + * Return if the maximum number of registrations has been reached. + * + * Note a max_regstrations of 0 means there is no limit. + * + * @return true if number of users >= max registrations, false else. + */ +function max_registrations_reached() { + $system_conf = Minz_Configuration::get('system'); + $limit_registrations = $system_conf->limits['max_registrations']; + $number_accounts = count(listUsers()); + + return $limit_registrations > 0 && $number_accounts >= $limit_registrations; +} + + /** * Register and return the configuration for a given user. * -- cgit v1.2.3 From f560c44a003ca69644f8e7262dca2f8f7e6932d5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 14:00:08 +0200 Subject: Hide registration form if max registration reached See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/authController.php | 3 +++ app/views/auth/formLogin.phtml | 4 +++- app/views/auth/personaLogin.phtml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 1c8ad2193..223282afb 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -351,5 +351,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { * This action gives possibility to a user to create an account. */ public function registerAction() { + if (max_registrations_reached()) { + Minz_Error::error(403); + } } } diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml index 75537ee26..3a6053065 100644 --- a/app/views/auth/formLogin.phtml +++ b/app/views/auth/formLogin.phtml @@ -1,7 +1,9 @@

    - + + +
    Mozilla Persona)', 'language' => 'Jazyk', + 'number' => 'There is %d account created yet', // TODO: translate + 'numbers' => 'There are %d accounts created yet', // TODO: translate 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', 'password_format' => 'Alespoň 7 znaků', + 'registration' => array( + 'allow' => 'Allow account creation', // TODO: translate + 'help' => '0 means that there is no account limit', // TODO: translate + 'number' => 'Max number of accounts', // TODO: translate + ), 'title' => 'Správa uživatelů', 'user_list' => 'Seznam uživatelů', 'username' => 'Přihlašovací jméno', diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index 9518df66d..859eeac89 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -72,6 +72,10 @@ return array( ), 'profile' => array( '_' => 'Správa profilu', + 'delete' => array( + '_' => 'Account deletion', // TODO: translate + 'warn' => 'Your account and all the related data will be deleted.', // TODO: translate + ), 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', 'password_api' => 'Password API
    (tzn. pro mobilní aplikace)', 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 7c333a9c8..13e0db261 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -21,12 +21,17 @@ return array( 'truncate' => 'Smazat všechny články', ), 'auth' => array( + 'email' => 'Email', 'keep_logged_in' => 'Zapamatovat přihlášení (1 měsíc)', 'login' => 'Login', 'login_persona' => 'Přihlášení pomocí Persona', 'login_persona_problem' => 'Problém s připojením k Persona?', 'logout' => 'Odhlášení', 'password' => 'Heslo', + 'registration' => array( + '_' => 'New account', // TODO: translate + 'ask' => 'Create an account?', // TODO: translate + ), 'reset' => 'Reset přihlášení', 'username' => 'Uživatel', 'username_admin' => 'Název administrátorského účtu', diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index c0cbf6787..667f7af8d 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -160,8 +160,15 @@ return array( 'create' => 'Neuen Benutzer erstellen', 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', 'language' => 'Sprache', + 'number' => 'There is %d account created yet', // TODO: translate + 'numbers' => 'There are %d accounts created yet', // TODO: translate 'password_form' => 'Passwort
    (für die Anmeldemethode per Webformular)', 'password_format' => 'mindestens 7 Zeichen', + 'registration' => array( + 'allow' => 'Allow account creation', // TODO: translate + 'help' => '0 means that there is no account limit', // TODO: translate + 'number' => 'Max number of accounts', // TODO: translate + ), 'title' => 'Benutzer verwalten', 'user_list' => 'Liste der Benutzer', 'username' => 'Nutzername', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 4a0a77ddd..5313ec3fd 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -72,6 +72,10 @@ return array( ), 'profile' => array( '_' => 'Profil-Verwaltung', + 'delete' => array( + '_' => 'Account deletion', // TODO: translate + 'warn' => 'Your account and all the related data will be deleted.', // TODO: translate + ), 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', 'password_api' => 'Passwort-API
    (z. B. für mobile Anwendungen)', 'password_form' => 'Passwort
    (für die Anmeldemethode per Webformular)', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index f24a52c2e..9682a4a21 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -21,12 +21,17 @@ return array( 'truncate' => 'Alle Artikel löschen', ), 'auth' => array( + 'email' => 'E-Mail-Adresse', 'keep_logged_in' => 'Eingeloggt bleiben (1 Monat)', 'login' => 'Anmelden', 'login_persona' => 'Anmelden mit Persona', 'login_persona_problem' => 'Verbindungsproblem mit Persona?', 'logout' => 'Abmelden', 'password' => 'Passwort', + 'registration' => array( + '_' => 'New account', // TODO: translate + 'ask' => 'Create an account?', // TODO: translate + ), 'reset' => 'Zurücksetzen der Authentifizierung', 'username' => 'Nutzername', 'username_admin' => 'Administrator-Nutzername', diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 155384afd..aeea61631 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -160,8 +160,15 @@ return array( 'create' => 'Create new user', 'email_persona' => 'Login mail address
    (for Mozilla Persona)', 'language' => 'Language', + 'number' => 'There is %d account created yet', + 'numbers' => 'There are %d accounts created yet', 'password_form' => 'Password
    (for the Web-form login method)', 'password_format' => 'At least 7 characters', + 'registration' => array( + 'allow' => 'Allow account creation', + 'help' => '0 means that there is no account limit', + 'number' => 'Max number of accounts', + ), 'title' => 'Manage users', 'user_list' => 'List of users', 'username' => 'Username', diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 42a06906d..69162932f 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -72,6 +72,10 @@ return array( ), 'profile' => array( '_' => 'Profile management', + 'delete' => array( + '_' => 'Account deletion', + 'warn' => 'Your account and all the related data will be deleted.', + ), 'email_persona' => 'Login email address
    (for Mozilla Persona)', 'password_api' => 'Password API
    (e.g., for mobile apps)', 'password_form' => 'Password
    (for the Web-form login method)', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 6e47e0921..ac55a1a3b 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -21,12 +21,17 @@ return array( 'truncate' => 'Delete all articles', ), 'auth' => array( + 'email' => 'Email address', 'keep_logged_in' => 'Keep me logged in (1 month)', 'login' => 'Login', 'login_persona' => 'Login with Persona', 'login_persona_problem' => 'Connection problem with Persona?', 'logout' => 'Logout', 'password' => 'Password', + 'registration' => array( + '_' => 'New account', + 'ask' => 'Create an account?', + ), 'reset' => 'Authentication reset', 'username' => 'Username', 'username_admin' => 'Administrator username', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index b740bd0d2..01e0cb3c7 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -160,8 +160,15 @@ return array( 'create' => 'Créer un nouvel utilisateur', 'email_persona' => 'Adresse courriel de connexion
    (pour Mozilla Persona)', 'language' => 'Langue', + 'number' => '%d compte a déjà été créé', + 'numbers' => '%d comptes ont déjà été créés', 'password_form' => 'Mot de passe
    (pour connexion par formulaire)', 'password_format' => '7 caractères minimum', + 'registration' => array( + 'allow' => 'Autoriser la création de comptes', + 'help' => 'Un chiffre de 0 signifie que l’on peut créer un nombre infini de comptes', + 'number' => 'Nombre max de comptes', + ), 'title' => 'Gestion des utilisateurs', 'user_list' => 'Liste des utilisateurs', 'username' => 'Nom d’utilisateur', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index 87f9be290..6193b7a01 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -72,6 +72,10 @@ return array( ), 'profile' => array( '_' => 'Gestion du profil', + 'delete' => array( + '_' => 'Suppression du compte', + 'warn' => 'Le compte et toutes les données associées vont être supprimées.', + ), 'email_persona' => 'Adresse courriel de connexion
    (pour Mozilla Persona)', 'password_api' => 'Mot de passe API
    (ex. : pour applis mobiles)', 'password_form' => 'Mot de passe
    (pour connexion par formulaire)', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index c81e57bf7..3336b6a03 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -21,12 +21,17 @@ return array( 'truncate' => 'Supprimer tous les articles', ), 'auth' => array( + 'email' => 'Adresse courriel', 'keep_logged_in' => 'Rester connecté (1 mois)', 'login' => 'Connexion', 'login_persona' => 'Connexion avec Persona', 'login_persona_problem' => 'Problème de connexion à Persona ?', 'logout' => 'Déconnexion', 'password' => 'Mot de passe', + 'registration' => array( + '_' => 'Nouveau compte', + 'ask' => 'Créer un compte ?', + ), 'reset' => 'Réinitialisation de l’authentification', 'username' => 'Nom d’utilisateur', 'username_admin' => 'Nom d’utilisateur administrateur', diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml index 3a6053065..b0083944f 100644 --- a/app/views/auth/formLogin.phtml +++ b/app/views/auth/formLogin.phtml @@ -2,7 +2,7 @@

    - +
    diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml index 91349a67e..c6d738bf6 100644 --- a/app/views/auth/personaLogin.phtml +++ b/app/views/auth/personaLogin.phtml @@ -3,7 +3,7 @@

    - +

    diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index 96c91f411..ada654b15 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -1,12 +1,10 @@

    -

    +

    diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 61b296528..3d3bc3ddf 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -16,7 +16,10 @@
    - + 1 ? 'admin.user.numbers' : 'admin.user.number', $number); + ?>
    -- cgit v1.2.3 From 669c41114f60a5a31253bed766f52e1840e00599 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 22:28:21 +0200 Subject: Show indications for username and password formats See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/i18n/cz/gen.php | 12 +++++++++--- app/i18n/de/gen.php | 12 +++++++++--- app/i18n/en/gen.php | 12 +++++++++--- app/i18n/fr/gen.php | 12 +++++++++--- app/views/auth/register.phtml | 9 ++------- app/views/auth/reset.phtml | 2 +- 6 files changed, 39 insertions(+), 20 deletions(-) (limited to 'app') diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 13e0db261..a89bf6b49 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -27,14 +27,20 @@ return array( 'login_persona' => 'Přihlášení pomocí Persona', 'login_persona_problem' => 'Problém s připojením k Persona?', 'logout' => 'Odhlášení', - 'password' => 'Heslo', + 'password' => array( + '_' => 'Heslo', + 'format' => 'Alespoň 7 znaků', + ), 'registration' => array( '_' => 'New account', // TODO: translate 'ask' => 'Create an account?', // TODO: translate ), 'reset' => 'Reset přihlášení', - 'username' => 'Uživatel', - 'username_admin' => 'Název administrátorského účtu', + 'username' => array( + '_' => 'Uživatel', + 'admin' => 'Název administrátorského účtu', + 'format' => 'maximálně 16 alfanumerických znaků', + ), 'will_reset' => 'Přihlašovací systém bude vyresetován: místo sytému Persona bude použito přihlášení formulářem.', ), 'date' => array( diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 9682a4a21..d6fcfe1e4 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -27,14 +27,20 @@ return array( 'login_persona' => 'Anmelden mit Persona', 'login_persona_problem' => 'Verbindungsproblem mit Persona?', 'logout' => 'Abmelden', - 'password' => 'Passwort', + 'password' => array( + '_' => 'Passwort', + 'format' => 'mindestens 7 Zeichen', + ), 'registration' => array( '_' => 'New account', // TODO: translate 'ask' => 'Create an account?', // TODO: translate ), 'reset' => 'Zurücksetzen der Authentifizierung', - 'username' => 'Nutzername', - 'username_admin' => 'Administrator-Nutzername', + 'username' => array( + '_' => 'Nutzername', + 'admin' => 'Administrator-Nutzername', + 'format' => 'maximal 16 alphanumerische Zeichen', + ), 'will_reset' => 'Authentifikationssystem wird zurückgesetzt: ein Formular wird anstelle von Persona benutzt.', ), 'date' => array( diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index ac55a1a3b..063322cbf 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -27,14 +27,20 @@ return array( 'login_persona' => 'Login with Persona', 'login_persona_problem' => 'Connection problem with Persona?', 'logout' => 'Logout', - 'password' => 'Password', + 'password' => array( + '_' => 'Password', + 'format' => 'At least 7 characters', + ), 'registration' => array( '_' => 'New account', 'ask' => 'Create an account?', ), 'reset' => 'Authentication reset', - 'username' => 'Username', - 'username_admin' => 'Administrator username', + 'username' => array( + '_' => 'Username', + 'admin' => 'Administrator username', + 'format' => 'maximum 16 alphanumeric characters', + ), 'will_reset' => 'Authentication system will be reset: a form will be used instead of Persona.', ), 'date' => array( diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 3336b6a03..5abc7a27b 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -27,14 +27,20 @@ return array( 'login_persona' => 'Connexion avec Persona', 'login_persona_problem' => 'Problème de connexion à Persona ?', 'logout' => 'Déconnexion', - 'password' => 'Mot de passe', + 'password' => array( + '_' => 'Mot de passe', + 'format' => '7 caractères minimum', + ), 'registration' => array( '_' => 'Nouveau compte', 'ask' => 'Créer un compte ?', ), 'reset' => 'Réinitialisation de l’authentification', - 'username' => 'Nom d’utilisateur', - 'username_admin' => 'Nom d’utilisateur administrateur', + 'username' => array( + '_' => 'Nom d’utilisateur', + 'admin' => 'Nom d’utilisateur administrateur', + 'format' => '16 caractères alphanumériques maximum', + ), 'will_reset' => 'Le système d’authentification va être réinitialisé : un formulaire sera utilisé à la place de Persona.', ), 'date' => array( diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index ada654b15..306679601 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -1,19 +1,14 @@ -

    - +
    - +
    diff --git a/app/views/auth/reset.phtml b/app/views/auth/reset.phtml index 6e9816ad3..9c820c7c8 100644 --- a/app/views/auth/reset.phtml +++ b/app/views/auth/reset.phtml @@ -16,7 +16,7 @@

    - +
    -- cgit v1.2.3 From 8751c344f384e19dd2fd2f0b5607ecc2aac58541 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 22:58:00 +0200 Subject: Ask password to user before deleting its account See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/userController.php | 37 +++++++++++++++++++++++++++---------- app/views/user/profile.phtml | 21 +++++++++++++++------ 2 files changed, 42 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index cebfcd5ec..428cd145d 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -30,13 +30,17 @@ class FreshRSS_user_Controller extends Minz_ActionController { public function profileAction() { Minz_View::prependTitle(_t('conf.profile.title') . ' · '); + Minz_View::appendScript(Minz_Url::display( + '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') + )); + if (Minz_Request::isPost()) { $ok = true; - $passwordPlain = Minz_Request::param('passwordPlain', '', true); + $passwordPlain = Minz_Request::param('newPasswordPlain', '', true); if ($passwordPlain != '') { - Minz_Request::_param('passwordPlain'); //Discard plain-text password ASAP - $_POST['passwordPlain'] = ''; + Minz_Request::_param('newPasswordPlain'); //Discard plain-text password ASAP + $_POST['newPasswordPlain'] = ''; if (!function_exists('password_hash')) { include_once(LIB_PATH . '/password_compat.php'); } @@ -213,10 +217,16 @@ class FreshRSS_user_Controller extends Minz_ActionController { */ public function deleteAction() { $username = Minz_Request::param('username'); + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } + + $self_deletion = Minz_Session::param('currentUser', '_') === $username; if (Minz_Request::isPost() && ( FreshRSS_Auth::hasAccess('admin') || - Minz_Session::param('currentUser', '_') === $username + $self_deletion )) { $db = FreshRSS_Context::$system_conf->db; require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); @@ -228,6 +238,16 @@ class FreshRSS_user_Controller extends Minz_ActionController { $default_user = FreshRSS_Context::$system_conf->default_user; $ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user } + if ($ok && $self_deletion) { + // We check the password if it's a self-destruction + $nonce = Minz_Session::param('nonce'); + $challenge = Minz_Request::param('challenge', ''); + + $ok &= FreshRSS_FormAuth::checkCredentials( + $username, FreshRSS_Context::$user_conf->passwordHash, + $nonce, $challenge + ); + } if ($ok) { $ok &= is_dir($user_data); } @@ -237,10 +257,11 @@ class FreshRSS_user_Controller extends Minz_ActionController { $ok &= recursive_unlink($user_data); //TODO: delete Persona file } - invalidateHttpCache(); - if (Minz_Session::param('currentUser', '_') === $username) { + if ($ok && $self_deletion) { FreshRSS_Auth::removeAccess(); + $redirect_url = array('c' => 'index', 'a' => 'index'); } + invalidateHttpCache(); $notif = array( 'type' => $ok ? 'good' : 'bad', @@ -249,10 +270,6 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); } - $redirect_url = urldecode(Minz_Request::param('r', false, true)); - if (!$redirect_url) { - $redirect_url = array('c' => 'user', 'a' => 'manage'); - } Minz_Request::forward($redirect_url, true); } diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index 11097e546..7ae2c7ede 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -18,11 +18,11 @@
    - +
    - /> - + /> +
    @@ -59,21 +59,30 @@ -
    +

    +
    + +
    + +
    + +
    +
    +
    'index', 'a' => 'index'), + array('c' => 'user', 'a' => 'profile'), 'php', true )); ?> - +
    -- cgit v1.2.3 From f0a1b26584787e173c8c9cd1a5fea27bb3044f1c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 23:06:46 +0200 Subject: Add title to the account creation page See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/Controllers/authController.php | 2 ++ app/i18n/cz/gen.php | 1 + app/i18n/de/gen.php | 1 + app/i18n/en/gen.php | 1 + app/i18n/fr/gen.php | 1 + 5 files changed, 6 insertions(+) (limited to 'app') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 223282afb..aff184263 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -354,5 +354,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { if (max_registrations_reached()) { Minz_Error::error(403); } + + Minz_View::prependTitle(_t('gen.auth.registration.title') . ' · '); } } diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index a89bf6b49..53127998f 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -34,6 +34,7 @@ return array( 'registration' => array( '_' => 'New account', // TODO: translate 'ask' => 'Create an account?', // TODO: translate + 'title' => 'Account creation', // TODO: translate ), 'reset' => 'Reset přihlášení', 'username' => array( diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index d6fcfe1e4..f8f4823a6 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -34,6 +34,7 @@ return array( 'registration' => array( '_' => 'New account', // TODO: translate 'ask' => 'Create an account?', // TODO: translate + 'title' => 'Account creation', // TODO: translate ), 'reset' => 'Zurücksetzen der Authentifizierung', 'username' => array( diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 063322cbf..1feb8d6ac 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -34,6 +34,7 @@ return array( 'registration' => array( '_' => 'New account', 'ask' => 'Create an account?', + 'title' => 'Account creation', ), 'reset' => 'Authentication reset', 'username' => array( diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 5abc7a27b..67d278be4 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -34,6 +34,7 @@ return array( 'registration' => array( '_' => 'Nouveau compte', 'ask' => 'Créer un compte ?', + 'title' => 'Création de compte', ), 'reset' => 'Réinitialisation de l’authentification', 'username' => array( -- cgit v1.2.3 From d6e632fc09ff391da39a42853f0eae87ef4a20f4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 23:22:50 +0200 Subject: Fix a bug in ConfigurationSetter --- app/Models/ConfigurationSetter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 236bf5b0b..d7378d4d8 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -364,8 +364,8 @@ class FreshRSS_ConfigurationSetter { $limits = $limits_keys[$key]; if ( - (!isset($limits['min']) || $value > $limits['min']) && - (!isset($limits['max']) || $value < $limits['max']) + (!isset($limits['min']) || $value >= $limits['min']) && + (!isset($limits['max']) || $value <= $limits['max']) ) { $data['limits'][$key] = $value; } -- cgit v1.2.3 From 1ad36c420e774d6f66b6a7ecf5b37ed1103ea464 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Jul 2015 23:27:22 +0200 Subject: Fix translations for feedback See https://github.com/FreshRSS/FreshRSS/issues/679 --- app/i18n/cz/feedback.php | 1 + app/i18n/de/feedback.php | 1 + app/i18n/en/feedback.php | 1 + app/i18n/fr/feedback.php | 1 + 4 files changed, 4 insertions(+) (limited to 'app') diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php index b75a4a15a..cf2ee518c 100644 --- a/app/i18n/cz/feedback.php +++ b/app/i18n/cz/feedback.php @@ -102,6 +102,7 @@ return array( '_' => 'Uživatel %s byl smazán', 'error' => 'Uživatele %s nelze smazat', ), + 'set_registration' => 'The maximum amount of accounts has been updated.', // TODO: translate ), 'profile' => array( 'error' => 'Váš profil nelze změnit', diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index 4c15aadc3..61a7d9d61 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -102,6 +102,7 @@ return array( '_' => 'Der Benutzer %s ist gelöscht worden', 'error' => 'Der Benutzer %s kann nicht gelöscht werden', ), + 'set_registration' => 'The maximum amount of accounts has been updated.', // TODO: translate ), 'profile' => array( 'error' => 'Ihr Profil kann nicht geändert werden', diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index c9189c0d0..c9f73dc1d 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -102,6 +102,7 @@ return array( '_' => 'User %s has been deleted', 'error' => 'User %s cannot be deleted', ), + 'set_registration' => 'The maximum amount of accounts has been updated.', ), 'profile' => array( 'error' => 'Your profile cannot be modified', diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index e2364a251..99c193d28 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -102,6 +102,7 @@ return array( '_' => 'L’utilisateur %s a été supprimé.', 'error' => 'L’utilisateur %s ne peut pas être supprimé.', ), + 'set_registration' => 'Le nombre maximal de comptes a été mis à jour.', ), 'profile' => array( 'error' => 'Votre profil n’a pas pu être mis à jour', -- cgit v1.2.3 From eaccc1eba4bf7a00a6cce26de9e4da22067fe86b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 23 Jul 2015 12:24:24 +0200 Subject: Generate base_url during installation See https://github.com/FreshRSS/FreshRSS/issues/865 --- app/install.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/install.php b/app/install.php index d5455f17d..3930a3d41 100644 --- a/app/install.php +++ b/app/install.php @@ -212,8 +212,11 @@ function saveStep3() { $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); } + // We use dirname to remove the /i part + $base_url = dirname(Minz_Request::guessBaseUrl()); $config_array = array( 'salt' => $_SESSION['salt'], + 'base_url' => $base_url, 'title' => $_SESSION['title'], 'default_user' => $_SESSION['default_user'], 'auth_type' => $_SESSION['auth_type'], -- cgit v1.2.3 From 339e32424fa60fc0c99a4c10890abef139444f6d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 23 Jul 2015 12:38:22 +0200 Subject: Add a simple test to detect if server is public If the server is not accessible by an external server, pubsubhubbub should be disable. See https://github.com/FreshRSS/FreshRSS/issues/865 --- app/install.php | 1 + lib/lib_rss.php | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'app') diff --git a/app/install.php b/app/install.php index 3930a3d41..65138a683 100644 --- a/app/install.php +++ b/app/install.php @@ -229,6 +229,7 @@ function saveStep3() { 'prefix' => $_SESSION['bd_prefix'], 'pdo_options' => array(), ), + 'enable_pubsubhubbub' => server_is_public($base_url), ); @unlink(join_path(DATA_PATH, 'config.php')); //To avoid access-rights problems diff --git a/lib/lib_rss.php b/lib/lib_rss.php index c99e2c7e8..2a23fca45 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -83,6 +83,33 @@ function checkUrl($url) { } } + +/** + * Test if a given server address is publicly accessible. + * + * Note: for the moment it tests only if address is corresponding to a + * localhost address. + * + * @param $address the address to test, can be an IP or a URL. + * @return true if server is accessible, false else. + * @todo improve test with a more valid technique (e.g. test with an external server?) + */ +function server_is_public($address) { + $host = parse_url($address, PHP_URL_HOST); + + $is_public = !in_array($host, array( + '127.0.0.1', + 'localhost', + 'localhost.localdomain', + '[::1]', + 'localhost6', + 'localhost6.localdomain6', + )); + + return $is_public; +} + + function format_number($n, $precision = 0) { // number_format does not seem to be Unicode-compatible return str_replace(' ', ' ', //Espace fine insécable -- cgit v1.2.3 From baa36f158b59c9229e3f1a5a0edb6f1bb3a54198 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 23 Jul 2015 13:54:34 +0200 Subject: Add pubsubhubbub_enabled to default configuration Rename enable_pubsubhubbub into pubsubhubbub_enabled See https://github.com/FreshRSS/FreshRSS/issues/865 --- app/install.php | 2 +- data/config.default.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/install.php b/app/install.php index 65138a683..5a774d7c1 100644 --- a/app/install.php +++ b/app/install.php @@ -229,7 +229,7 @@ function saveStep3() { 'prefix' => $_SESSION['bd_prefix'], 'pdo_options' => array(), ), - 'enable_pubsubhubbub' => server_is_public($base_url), + 'pubsubhubbub_enabled' => server_is_public($base_url), ); @unlink(join_path(DATA_PATH, 'config.php')); //To avoid access-rights problems diff --git a/data/config.default.php b/data/config.default.php index 5db933ff8..a7a29b12c 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -57,6 +57,10 @@ return array( # SimplePie, which is retrieving RSS feeds via HTTP requests. 'simplepie_syslog_enabled' => true, + # Enable or not support of PubSubHubbub. + # /!\ It should NOT be enabled if base_url is not reachable by an external server. + 'pubsubhubbub_enabled' => false, + 'limits' => array( # Duration in seconds of the SimplePie cache, -- cgit v1.2.3 From f4472fc918c1fa1d1cfb2adae6c38a9a261e8c9b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 23 Jul 2015 13:59:40 +0200 Subject: Do not use PubSubHubbub if disabled See https://github.com/FreshRSS/FreshRSS/issues/865 --- app/Controllers/feedController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 488d066a9..ec3dce777 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -295,14 +295,17 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Calculate date of oldest entries we accept in DB. $nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); - $pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration. + + // PubSubHubbub support + $pubsubhubbubEnabledGeneral = FreshRSS_Context::$system_conf->pubsubhubbub_enabled; + $pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration. $updated_feeds = 0; $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { $url = $feed->url(); //For detection of HTTP 301 - $pubSubHubbubEnabled = $feed->pubSubHubbubEnabled(); + $pubSubHubbubEnabled = $pubsubhubbubEnabledGeneral && $feed->pubSubHubbubEnabled(); if ((!$simplePiePush) && (!$id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { $text = 'Skip pull of feed using PubSubHubbub: ' . $url; //Minz_Log::debug($text); @@ -442,7 +445,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } $feed->faviconPrepare(); - if ($feed->pubSubHubbubPrepare()) { + if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) { Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); -- cgit v1.2.3 From 9817743cd7fbe10e361873a0a5d6cb591c720c23 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 27 Jul 2015 14:52:13 +0200 Subject: Cast $limits values in int (config) Fix https://github.com/FreshRSS/FreshRSS/issues/925 --- app/Models/ConfigurationSetter.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index d7378d4d8..992a3a387 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -362,6 +362,7 @@ class FreshRSS_ConfigurationSetter { continue; } + $value = intval($value); $limits = $limits_keys[$key]; if ( (!isset($limits['min']) || $value >= $limits['min']) && -- cgit v1.2.3 From d1c1a6358072eb3ce8bd55c9f9e813aa8a7c4b5b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 29 Jul 2015 22:43:50 +0200 Subject: Add translations for German and Czech Fix https://github.com/FreshRSS/FreshRSS/issues/930 --- app/i18n/cz/admin.php | 10 +++++----- app/i18n/cz/conf.php | 4 ++-- app/i18n/cz/feedback.php | 2 +- app/i18n/cz/gen.php | 6 +++--- app/i18n/cz/install.php | 8 ++++---- app/i18n/de/admin.php | 10 +++++----- app/i18n/de/conf.php | 4 ++-- app/i18n/de/feedback.php | 2 +- app/i18n/de/gen.php | 6 +++--- app/i18n/de/install.php | 8 ++++---- 10 files changed, 30 insertions(+), 30 deletions(-) (limited to 'app') diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php index bfa67573e..4ca56cc37 100644 --- a/app/i18n/cz/admin.php +++ b/app/i18n/cz/admin.php @@ -160,14 +160,14 @@ return array( 'create' => 'Vytvořit nového uživatele', 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', 'language' => 'Jazyk', - 'number' => 'There is %d account created yet', // TODO: translate - 'numbers' => 'There are %d accounts created yet', // TODO: translate + 'number' => 'Zatím je vytvořen %d účet', + 'numbers' => 'Zatím je vytvořeno %d účtů', 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', 'password_format' => 'Alespoň 7 znaků', 'registration' => array( - 'allow' => 'Allow account creation', // TODO: translate - 'help' => '0 means that there is no account limit', // TODO: translate - 'number' => 'Max number of accounts', // TODO: translate + 'allow' => 'Povolit vytváření účtů', + 'help' => '0 znamená žádná omezení účtu', + 'number' => 'Maximální počet účtů', ), 'title' => 'Správa uživatelů', 'user_list' => 'Seznam uživatelů', diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index 859eeac89..823ab1ea3 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -73,8 +73,8 @@ return array( 'profile' => array( '_' => 'Správa profilu', 'delete' => array( - '_' => 'Account deletion', // TODO: translate - 'warn' => 'Your account and all the related data will be deleted.', // TODO: translate + '_' => 'Smazání účtu', + 'warn' => 'Váš účet bude smazán spolu se všemi souvisejícími daty', ), 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', 'password_api' => 'Password API
    (tzn. pro mobilní aplikace)', diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php index cf2ee518c..5ba64b938 100644 --- a/app/i18n/cz/feedback.php +++ b/app/i18n/cz/feedback.php @@ -102,7 +102,7 @@ return array( '_' => 'Uživatel %s byl smazán', 'error' => 'Uživatele %s nelze smazat', ), - 'set_registration' => 'The maximum amount of accounts has been updated.', // TODO: translate + 'set_registration' => 'Maximální počet účtů byl změněn', ), 'profile' => array( 'error' => 'Váš profil nelze změnit', diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 53127998f..138def772 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -32,9 +32,9 @@ return array( 'format' => 'Alespoň 7 znaků', ), 'registration' => array( - '_' => 'New account', // TODO: translate - 'ask' => 'Create an account?', // TODO: translate - 'title' => 'Account creation', // TODO: translate + '_' => 'Nový účet', + 'ask' => 'Vytvořit účet?', + 'title' => 'Vytvoření účtu', ), 'reset' => 'Reset přihlášení', 'username' => array( diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php index cca717513..a8bc62909 100644 --- a/app/i18n/cz/install.php +++ b/app/i18n/cz/install.php @@ -4,9 +4,9 @@ return array( 'action' => array( 'finish' => 'Dokončit instalaci', 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', - 'keep_install' => 'Keep previous installation', // TODO: translate + 'keep_install' => 'Zachovat předchozí instalaci', 'next_step' => 'Přejít na další krok', - 'reinstall' => 'Reinstall FreshRSS', // TODO: translate + 'reinstall' => 'Reinstalovat FreshRSS', ), 'auth' => array( 'email_persona' => 'Email pro přihlášení
    (pro Mozilla Persona)', @@ -33,7 +33,7 @@ return array( ), 'check' => array( '_' => 'Kontrola', - 'already_installed' => 'We have detected that FreshRSS is already installed!', // TODO: translate + 'already_installed' => 'Zjistili jsme, že FreshRSS je již nainstalován!', 'cache' => array( 'nok' => 'Zkontrolujte oprávnění adresáře ./data/cache. HTTP server musí mít do tohoto adresáře práva zápisu', 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', @@ -97,7 +97,7 @@ return array( 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', 'javascript_is_better' => 'Práce s FreshRSS je příjemnější se zapnutým JavaScriptem', 'js' => array( - 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', // TODO: translate + 'confirm_reinstall' => 'Reinstalací FreshRSS ztratíte předchozí konfiguraci. Opravdu chcete pokračovat?', ), 'language' => array( '_' => 'Jazyk', diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index 667f7af8d..68dcc2ebf 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -160,14 +160,14 @@ return array( 'create' => 'Neuen Benutzer erstellen', 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', 'language' => 'Sprache', - 'number' => 'There is %d account created yet', // TODO: translate - 'numbers' => 'There are %d accounts created yet', // TODO: translate + 'number' => 'Es wurde bis jetzt %d Account erstellt', + 'numbers' => 'Es wurden bis jetzt %d Accounts erstellt', 'password_form' => 'Passwort
    (für die Anmeldemethode per Webformular)', 'password_format' => 'mindestens 7 Zeichen', 'registration' => array( - 'allow' => 'Allow account creation', // TODO: translate - 'help' => '0 means that there is no account limit', // TODO: translate - 'number' => 'Max number of accounts', // TODO: translate + 'allow' => 'Erlaube die Accounterstellung', + 'help' => '0 meint, dass es kein Account Limit gibt', + 'number' => 'Maximale Anzahl von Accounts', ), 'title' => 'Benutzer verwalten', 'user_list' => 'Liste der Benutzer', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 5313ec3fd..c1a762f12 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -73,8 +73,8 @@ return array( 'profile' => array( '_' => 'Profil-Verwaltung', 'delete' => array( - '_' => 'Account deletion', // TODO: translate - 'warn' => 'Your account and all the related data will be deleted.', // TODO: translate + '_' => 'Accountlöschung', + 'warn' => 'Dein Account und alle damit bezogenen Daten werden gelöscht.', ), 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', 'password_api' => 'Passwort-API
    (z. B. für mobile Anwendungen)', diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index 61a7d9d61..e92dacfe9 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -102,7 +102,7 @@ return array( '_' => 'Der Benutzer %s ist gelöscht worden', 'error' => 'Der Benutzer %s kann nicht gelöscht werden', ), - 'set_registration' => 'The maximum amount of accounts has been updated.', // TODO: translate + 'set_registration' => 'Die maximale Anzahl von Accounts wurde aktualisiert.', ), 'profile' => array( 'error' => 'Ihr Profil kann nicht geändert werden', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index f8f4823a6..de2d846c5 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -32,9 +32,9 @@ return array( 'format' => 'mindestens 7 Zeichen', ), 'registration' => array( - '_' => 'New account', // TODO: translate - 'ask' => 'Create an account?', // TODO: translate - 'title' => 'Account creation', // TODO: translate + '_' => 'Neuer Account', + 'ask' => 'Erstelle einen Account?', + 'title' => 'Accounterstellung', ), 'reset' => 'Zurücksetzen der Authentifizierung', 'username' => array( diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index 222c65b32..286272e71 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -4,9 +4,9 @@ return array( 'action' => array( 'finish' => 'Installation fertigstellen', 'fix_errors_before' => 'Bitte Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', - 'keep_install' => 'Keep previous installation', // TODO: translate + 'keep_install' => 'Vorherige Installation beibehalten (Daten)', 'next_step' => 'Zum nächsten Schritt springen', - 'reinstall' => 'Reinstall FreshRSS', // TODO: translate + 'reinstall' => 'Neuinstallation von FreshRSS', ), 'auth' => array( 'email_persona' => 'Anmelde-E-Mail-Adresse
    (für Mozilla Persona)', @@ -33,7 +33,7 @@ return array( ), 'check' => array( '_' => 'Überprüfungen', - 'already_installed' => 'We have detected that FreshRSS is already installed!', // TODO: translate + 'already_installed' => 'Wir haben festgestellt, dass FreshRSS bereits installiert wurde!', 'cache' => array( 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses ./data/cache. Der HTTP-Server muss Schreibrechte besitzen.', 'ok' => 'Die Berechtigungen des Verzeichnisses ./data/cache sind in Ordnung.', @@ -97,7 +97,7 @@ return array( 'fix_errors_before' => 'Bitte den Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', 'javascript_is_better' => 'FreshRSS ist ansprechender mit aktiviertem JavaScript', 'js' => array( - 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', // TODO: translate + 'confirm_reinstall' => 'Du wirst deine vorherige Konfiguration (Daten) verlieren FreshRSS. Bist du sicher, dass du fortfahren willst?', ), 'language' => array( '_' => 'Sprache', -- cgit v1.2.3 From 9e43937f8c7f51c1bcd4e8009c6d1233868d5479 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 4 Aug 2015 12:36:00 +0200 Subject: PubSubHubbub prevent subscribing too often in case of error https://github.com/FreshRSS/FreshRSS/issues/939 --- app/Models/Feed.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index bf7ed3967..23491ee8d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -475,7 +475,14 @@ class FreshRSS_Feed extends Minz_Model { file_put_contents($hubFilename, json_encode($hubJson)); } - return substr($info['http_code'], 0, 1) == '2'; + if (substr($info['http_code'], 0, 1) == '2') { + return true; + } else { + $hubJson['lease_start'] = time(); //Prevent trying again too soon + $hubJson['error'] = true; + file_put_contents($hubFilename, json_encode($hubJson)); + return false; + } } return false; } -- cgit v1.2.3 From 390f2ce5f09b41f91f6328eb9370eb7d68839eff Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 18 Aug 2015 19:58:09 +0200 Subject: i18n: Dutch https://github.com/FreshRSS/FreshRSS/issues/949 https://github.com/Wanabo/FreshRSS-Dutch-translation --- app/i18n/nl/admin.php | 177 +++++++++++++++++++++++++++++++++++++++++++++++ app/i18n/nl/conf.php | 170 +++++++++++++++++++++++++++++++++++++++++++++ app/i18n/nl/feedback.php | 110 +++++++++++++++++++++++++++++ app/i18n/nl/gen.php | 166 ++++++++++++++++++++++++++++++++++++++++++++ app/i18n/nl/index.php | 61 ++++++++++++++++ app/i18n/nl/install.php | 107 ++++++++++++++++++++++++++++ app/i18n/nl/sub.php | 62 +++++++++++++++++ 7 files changed, 853 insertions(+) create mode 100644 app/i18n/nl/admin.php create mode 100644 app/i18n/nl/conf.php create mode 100644 app/i18n/nl/feedback.php create mode 100644 app/i18n/nl/gen.php create mode 100644 app/i18n/nl/index.php create mode 100644 app/i18n/nl/install.php create mode 100644 app/i18n/nl/sub.php (limited to 'app') diff --git a/app/i18n/nl/admin.php b/app/i18n/nl/admin.php new file mode 100644 index 000000000..5c6a14fda --- /dev/null +++ b/app/i18n/nl/admin.php @@ -0,0 +1,177 @@ + array( + 'allow_anonymous' => 'Sta bezoekers toe om artikelen te lezen van de standaard gebruiker (%s)', + 'allow_anonymous_refresh' => 'Sta bezoekers toe om de artikelen te vernieuwen', + 'api_enabled' => 'Sta API toegang toe (nodig voor mobiele apps)', + 'form' => 'Web formulier (traditioneel, benodigd JavaScript)', + 'http' => 'HTTP (voor geavanceerde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'persona' => 'Mozilla Persona (modern, benodigd JavaScript)', + 'title' => 'Authenticatie', + 'title_reset' => 'Authenticatie terugzetten', + 'token' => 'Authenticatie teken', + 'token_help' => 'Sta toegang toe tot de RSS uitvoer van de standaard gebruiker zonder authenticatie:', + 'type' => 'Authenticatie methode', + 'unsafe_autologin' => 'Sta onveilige automatische log in toe met het volgende formaat: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Controleer de permissies van de ./data/cache map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'categories' => array( + 'nok' => 'Categorie tabel is slecht geconfigureerd.', + 'ok' => 'Categorie tabel is ok.', + ), + 'connection' => array( + 'nok' => 'Verbinding met de database kan niet worden gemaakt.', + 'ok' => 'Verbinding met de database is ok.', + ), + 'ctype' => array( + 'nok' => 'U mist de benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist de cURL (php5-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer de permissies op de ./data map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de data map zijn goed.', + ), + 'database' => 'Database installatie', + 'dom' => array( + 'nok' => 'U mist de benodigde bibliotheek voor het bladeren van DOM (php-xml package).', + 'ok' => 'U hebt de benodigde bibliotheek voor het bladeren van DOM.', + ), + 'entries' => array( + 'nok' => 'Invoer tabel is slecht geconfigureerd.', + 'ok' => 'Invoer tabel is ok.', + ), + 'favicons' => array( + 'nok' => 'Controleer de permissies op de ./data/favicons map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de favicons map zijn goed.', + ), + 'feeds' => array( + 'nok' => 'Feed tabel is slecht geconfigureerd.', + 'ok' => 'Feed tabel is ok.', + ), + 'files' => 'Bestanden installatie', + 'json' => array( + 'nok' => 'U mist JSON (php5-json package).', + 'ok' => 'U hebt JSON uitbreiding.', + ), + 'minz' => array( + 'nok' => 'U mist Minz framework.', + 'ok' => 'U hebt Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist de benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of een van de ondersteunde drivers (pdo_mysql, pdo_sqlite).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Controleer de permissies op de ./data/persona map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de Mozilla Persona map zijn goed.', + ), + 'php' => array( + '_' => 'PHP installatie', + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Er zijn één of meer ontbrekende tabellen in de database.', + 'ok' => 'Alle tabellen zijn aanwezig in de database.', + ), + 'title' => 'Installatie controle', + 'tokens' => array( + 'nok' => 'Controleer de permissies op de ./data/tokens map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de tokens map zijn goed.', + ), + 'users' => array( + 'nok' => 'Controleer de permissies op de ./data/users map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de users map zijn goed.', + ), + 'zip' => array( + 'nok' => 'U mist ZIP uitbreiding (php5-zip package).', + 'ok' => 'U hebt ZIP uitbreiding.', + ), + ), + 'extensions' => array( + 'disabled' => 'Uitgeschakeld', + 'empty_list' => 'Er zijn geïnstalleerde uitbreidingen', + 'enabled' => 'Ingeschakeld', + 'no_configure_view' => 'Deze uitbreiding kan niet worden geconfigureerd.', + 'system' => array( + '_' => 'Systeem uitbreidingen', + 'no_rights' => 'Systeem uitbreidingen (U hebt hier geen rechten op)', + ), + 'title' => 'Uitbreidingen', + 'user' => 'Gebruikers uitbreidingen', + ), + 'stats' => array( + '_' => 'Statistieken', + 'all_feeds' => 'Alle feeds', + 'category' => 'Categorie', + 'entry_count' => 'Invoer aantallen', + 'entry_per_category' => 'Aantallen per categorie', + 'entry_per_day' => 'Aantallen per day (laatste 30 dagen)', + 'entry_per_day_of_week' => 'Per dag of week (gemiddeld: %.2f berichten)', + 'entry_per_hour' => 'Per uur (gemiddeld: %.2f berichten)', + 'entry_per_month' => 'Per maand (gemiddeld: %.2f berichten)', + 'entry_repartition' => 'Invoer verdeling', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categorie', + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'main_stream' => 'Overzicht', + 'menu' => array( + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'repartition' => 'Artikelen verdeling', + ), + 'no_idle' => 'Er is geen gepauzeerde feed!', + 'number_entries' => '%d artikelen', + 'percent_of_total' => '%% van totaal', + 'repartition' => 'Artikelen verdeling', + 'status_favorites' => 'Favorieten', + 'status_read' => 'Gelezen', + 'status_total' => 'Totaal', + 'status_unread' => 'Ongelezen', + 'title' => 'Statistieken', + 'top_feed' => 'Top tien feeds', + ), + 'update' => array( + '_' => 'Versie controle', + 'apply' => 'Toepassen', + 'check' => 'Controleer op nieuwe versies', + 'current_version' => 'Uw huidige versie van FreshRSS is %s.', + 'last' => 'Laatste controle: %s', + 'none' => 'Geen nieuwe versie om toe te passen', + 'title' => 'Vernieuw systeem', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'create' => 'Creëer nieuwe gebruiker', + 'email_persona' => 'Log in mail adres
    (voor Mozilla Persona)', + 'language' => 'Taal', + 'number' => 'Er is %d accounts gemaakt', + 'numbers' => 'Er zijn %d accounts gemaakt', + 'password_form' => 'Wachtwoord
    (voor de Web-formulier log in methode)', + 'password_format' => 'Ten minste 7 tekens', + 'registration' => array( + 'allow' => 'Sta het maken van nieuwe accounts toe', + 'help' => '0 betekent dat er geen account limiet is', + 'number' => 'Max aantal van accounts', + ), + 'title' => 'Beheer gebruikers', + 'user_list' => 'Lijst van gebruikers ', + 'username' => 'Gebruikers naam', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php new file mode 100644 index 000000000..16ad336a9 --- /dev/null +++ b/app/i18n/nl/conf.php @@ -0,0 +1,170 @@ + array( + '_' => 'Archivering', + 'advanced' => 'Geavanceerd', + 'delete_after' => 'Verwijder artikelen na', + 'help' => 'Meer opties zijn beschikbaar in de persoonlijke stroom instellingen', + 'keep_history_by_feed' => 'Minimum aantal te behouden artikelen in de feed', + 'optimize' => 'Optimaliseer database', + 'optimize_help' => 'Doe dit zo af en toe om de omvang van de database te verkleinen', + 'purge_now' => 'Schoon nu op', + 'title' => 'Archivering', + 'ttl' => 'Vernieuw niet automatisch meer dan', + ), + 'display' => array( + '_' => 'Opmaak', + 'icon' => array( + 'bottom_line' => 'Onderaan', + 'entry' => 'Artikel pictogrammen', + 'publication_date' => 'Publicatie datum', + 'related_tags' => 'Gerelateerde labels', + 'sharing' => 'Delen', + 'top_line' => 'Bovenaan', + ), + 'language' => 'Taal', + 'notif_html5' => array( + 'seconds' => 'seconden (0 betekent geen stop)', + 'timeout' => 'HTML5 notificatie stop', + ), + 'theme' => 'Thema', + 'title' => 'Opmaak', + 'width' => array( + 'content' => 'Content width', + 'large' => 'Breed', + 'medium' => 'Normaal', + 'no_limit' => 'Geen limiet', + 'thin' => 'Smal', + ), + ), + 'query' => array( + '_' => 'Gebruikers queries (informatie aanvragen)', + 'deprecated' => 'Deze query (informatie aanvraag) is niet langer geldig. De bedoelde categorie of feed is al verwijderd.', + 'filter' => 'Filter toegepast:', + 'get_all' => 'Toon alle artikelen', + 'get_category' => 'Toon "%s" categorie', + 'get_favorite' => 'Toon favoriete artikelen', + 'get_feed' => 'Toon "%s" feed', + 'no_filter' => 'Geen filter', + 'none' => 'U hebt nog geen gebruikers query aangemaakt..', + 'number' => 'Query n°%d', + 'order_asc' => 'Toon oudste artikelen eerst', + 'order_desc' => 'Toon nieuwste artikelen eerst', + 'search' => 'Zoek naar "%s"', + 'state_0' => 'Toon alle artikelen', + 'state_1' => 'Toon gelezen artikelen', + 'state_2' => 'Toon ongelezen artikelen', + 'state_3' => 'Toon alle artikelen', + 'state_4' => 'Toon favoriete artikelen', + 'state_5' => 'Toon gelezen favoriete artikelen', + 'state_6' => 'Toon ongelezen favoriete artikelen', + 'state_7' => 'Toon favoriete artikelen', + 'state_8' => 'Toon niet favoriete artikelen', + 'state_9' => 'Toon gelezen niet favoriete artikelen', + 'state_10' => 'Toon ongelezen niet favoriete artikelen', + 'state_11' => 'Toon niet favoriete artikelen', + 'state_12' => 'Toon alle artikelen', + 'state_13' => 'Toon gelezen artikelen', + 'state_14' => 'Toon ongelezen artikelen', + 'state_15' => 'Toon alle artikelen', + 'title' => 'Gebruikers queries', + ), + 'profile' => array( + '_' => 'Profiel beheer', + 'email_persona' => 'Log in mail adres
    (voor Mozilla Persona)', + 'password_api' => 'Wachtwoord API
    (e.g., voor mobiele apps)', + 'password_form' => 'Wachtwoord
    (voor de Web-formulier log in methode)', + 'password_format' => 'Ten minste 7 tekens', + 'title' => 'Profiel', + ), + 'reading' => array( + '_' => 'Lezen', + 'after_onread' => 'Na “markeer alles als gelezen”,', + 'articles_per_page' => 'Aantal artikelen per pagina', + 'auto_load_more' => 'Laad volgende artikel onderaan de pagina', + 'auto_remove_article' => 'Verberg artikel na lezen', + 'confirm_enabled' => 'Toon een bevestigings dialoog op “markeer alles als gelezen” acties', + 'display_articles_unfolded' => 'Toon artikelen uitgeklapt als standaard', + 'display_categories_unfolded' => 'Toon categoriën ingeklapt als standaard', + 'hide_read_feeds' => 'Verberg categoriën en feeds zonder ongelezen artikelen (werkt niet met “Toon alle artikelen” configuratie)', + 'img_with_lazyload' => 'Gebruik "lazy load" methode om afbeeldingen te laden', + 'jump_next' => 'Ga naar volgende ongelezen (feed of categorie)', + 'mark_updated_article_unread' => 'Markeer vernieuwd artikel als ongelezen', + 'number_divided_when_reader' => 'Gedeeld door 2 in de lees modus.', + 'read' => array( + 'article_open_on_website' => 'Als het artikel is geopend op de originele website', + 'article_viewed' => 'Als het artikel is bekeken', + 'scroll' => 'Tijdens scrollen', + 'upon_reception' => 'Tijdens ontvangst van het artikel', + 'when' => 'Markeer artikel als gelezen…', + ), + 'show' => array( + '_' => 'Artikelen om te tonen', + 'adaptive' => 'Pas weergave aan', + 'all_articles' => 'Bekijk alle artikelen', + 'unread' => 'Bekijk alleen ongelezen', + ), + 'sort' => array( + '_' => 'Sorteer volgorde', + 'newer_first' => 'Nieuwste eerst', + 'older_first' => 'Oudste eerst', + ), + 'sticky_post' => 'Koppel artikel aan de bovenkant als het geopend wordt', + 'title' => 'Lees modus', + 'view' => array( + 'default' => 'Standaard weergave', + 'global' => 'Globale weergave', + 'normal' => 'Normale weergave', + 'reader' => 'Lees weergave', + ), + ), + 'sharing' => array( + '_' => 'Delen', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Meer informatie', + 'print' => 'Afdrukken', + 'shaarli' => 'Shaarli', + 'share_name' => 'Gedeelde naam om weer te geven', + 'share_url' => 'Deel URL voor gebruik', + 'title' => 'Delen', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Artikel acties', + 'auto_share' => 'Delen', + 'auto_share_help' => 'Als er slechts één deel methode i, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + 'close_dropdown' => 'Sluit menu', + 'collapse_article' => 'Inklappen', + 'first_article' => 'Spring naar eerste artikel', + 'focus_search' => 'Toegang zoek venster', + 'help' => 'Toon documentatie', + 'javascript' => 'JavaScript moet geactiveerd zijn om verwijzingen te gebruiken', + 'last_article' => 'Spring naar laatste artikel', + 'load_more' => 'Laad meer artikelen', + 'mark_read' => 'Markeer als gelezen', + 'mark_favorite' => 'Markeer als favoriet', + 'navigation' => 'Navigatie', + 'navigation_help' => 'Met de "Shift" toets, kunt u navigatie verwijzingen voor feeds gebruiken.
    Met de "Alt" toets, kunt u navigatie verwijzingen voor categoriën gebruiken.', + 'next_article' => 'Spring naar volgende artikel', + 'other_action' => 'Andere acties', + 'previous_article' => 'Spring naar vorige artikel', + 'see_on_website' => 'Bekijk op originale website', + 'shift_for_all_read' => '+ shift om alle artikelen als gelezen te markeren', + 'title' => 'Verwijzingen', + 'user_filter' => 'Toegang gebruikers filters', + 'user_filter_help' => 'Als er slechts één gebruikers filter s, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'current' => 'Huidige gebruiker', + 'is_admin' => 'is administrateur', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/feedback.php b/app/i18n/nl/feedback.php new file mode 100644 index 000000000..2bc5cb665 --- /dev/null +++ b/app/i18n/nl/feedback.php @@ -0,0 +1,110 @@ + array( + 'optimization_complete' => 'Optimalisatie compleet', + ), + 'access' => array( + 'denied' => 'U hebt geen rechten om deze pagina te bekijken.', + 'not_found' => 'Deze pagina bestaat niet', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Een probleem is opgetreden tijdens de controle van de systeem configuratie. Probeer het later nog eens.', + 'set' => 'Formulier is nu uw standaard authenticatie systeem.', + ), + 'login' => array( + 'invalid' => 'Log in is ongeldig', + 'success' => 'U bent ingelogd', + ), + 'logout' => array( + 'success' => 'U bent uitgelogd', + ), + 'no_password_set' => 'Administrateur wachtwoord is niet ingesteld. Deze mogelijkheid is niet beschikbaar.', + 'not_persona' => 'Alleen Persona systeem kan worden gereset.', + ), + 'conf' => array( + 'error' => 'Er is een fout opgetreden tijdens het opslaan van de configuratie', + 'query_created' => 'Query "%s" is gemaakt.', + 'shortcuts_updated' => 'Verwijzingen zijn vernieuwd', + 'updated' => 'Configuratie is vernieuwd', + ), + 'extensions' => array( + 'already_enabled' => '%s is al ingeschakeld', + 'disable' => array( + 'ko' => '%s kan niet worden uitgeschakeld. Controleer FressRSS log bestanden voor details.', + 'ok' => '%s is nu uitgeschakeld', + ), + 'enable' => array( + 'ko' => '%s kan niet worden ingeschakeld. Controleer FressRSS log bestanden voor details.', + 'ok' => '%s is nn ingeschakeld', + ), + 'no_access' => 'U hebt geen toegang voor %s', + 'not_enabled' => '%s is nog niet ingeschakeld', + 'not_found' => '%s bestaat niet', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Zip uitbreiding is niet aanwezig op uw server. Exporteer a.u.b. uw bestanden één voor één.', + 'feeds_imported' => 'Uw feeds zijn geimporteerd en worden nu vernieuwd', + 'feeds_imported_with_errors' => 'Uw feeds zijn geimporteerd maar er zijn enige fouten opgetreden', + 'file_cannot_be_uploaded' => 'Bestand kan niet worden verzonden!', + 'no_zip_extension' => 'Zip uitbreiding is niet aanwezig op uw server.', + 'zip_error' => 'Er is een fout opgetreden tijdens het imporeren van het Zip bestand.', + ), + 'sub' => array( + 'actualize' => 'Actualiseren', + 'category' => array( + 'created' => 'Categorie %s is gemaakt.', + 'deleted' => 'Categorie is verwijderd.', + 'emptied' => 'Categorie is leeg gemaakt', + 'error' => 'Categorie kan niet worden vernieuwd', + 'name_exists' => 'Categorie naam bestaat al.', + 'no_id' => 'U moet de id specificeren of de categorie.', + 'no_name' => 'Categorie naam mag niet leeg zijn.', + 'not_delete_default' => 'U kunt de standaard categorie niet verwijderen!', + 'not_exist' => 'De categorie bestaat niet!', + 'over_max' => 'U hebt het maximale aantal categoriën bereikt (%d)', + 'updated' => 'Categorie is vernieuwd.', + ), + 'feed' => array( + 'actualized' => '%s is vernieuwd', + 'actualizeds' => 'RSS feeds zijn vernieuwd', + 'added' => 'RSS feed %s is toegevoegd', + 'already_subscribed' => 'U bent al geabonneerd op %s', + 'deleted' => 'Feed is verwijderd', + 'error' => 'Feed kan niet worden vernieuwd', + 'internal_problem' => 'De RSS feed kon niet worden toegevoegd. Controleer FressRSS log bestanden voor details.', + 'invalid_url' => 'URL %s is ongeldig', + 'marked_read' => 'Feeds zijn gemarkeerd als gelezen', + 'n_actualized' => '%d feeds zijn vernieuwd', + 'n_entries_deleted' => '%d artikelen zijn verwijderd', + 'no_refresh' => 'Er is geen feed om te vernieuwen…', + 'not_added' => '%s kon niet worden toegevoegd', + 'over_max' => 'U hebt het maximale aantal feeds bereikt(%d)', + 'updated' => 'Feed is vernieuwd', + ), + 'purge_completed' => 'Opschonen klaar (%d artikelen verwijderd)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS word nu vernieud naar versie %s.', + 'error' => 'Het vernieuwingsproces kwam een fout tegen: %s', + 'file_is_nok' => 'Controleer permissies op %s map. HTTP server moet rechten hebben om er in te schrijven', + 'finished' => 'Vernieuwing compleet!', + 'none' => 'Geen vernieuwing om toe te passen', + 'server_not_found' => 'Vernieuwings server kan niet worden gevonden. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Gebruiker %s is aangemaakt', + 'error' => 'Gebruiker %s kan niet worden aangemaakt', + ), + 'deleted' => array( + '_' => 'Gebruiker %s is verwijderd', + 'error' => 'Gebruiker %s kan niet worden verwijderd', + ), + ), + 'profile' => array( + 'error' => 'Uw profiel kan niet worden aangepast', + 'updated' => 'Uw profiel is aangepast', + ), +); diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php new file mode 100644 index 000000000..9d7a868dd --- /dev/null +++ b/app/i18n/nl/gen.php @@ -0,0 +1,166 @@ + array( + 'actualize' => 'Actualiseren', + 'back_to_rss_feeds' => '← Ga terug naar je RSS feeds', + 'cancel' => 'Annuleren', + 'create' => 'Opslaan', + 'disable' => 'Uitzetten', + 'empty' => 'Leeg', + 'enable' => 'Aanzetten', + 'export' => 'Exporteren', + 'filter' => 'Filteren', + 'import' => 'Importeren', + 'manage' => 'Beheren', + 'mark_read' => 'Markeer als gelezen', + 'mark_favorite' => 'Markeer als favoriet', + 'remove' => 'Verwijder', + 'see_website' => 'Bekijk website', + 'submit' => 'Opslaan', + 'truncate' => 'Verwijder alle artikelen', + ), + 'auth' => array( + 'keep_logged_in' => 'Ingelogd blijven voor (1 maand)', + 'login' => 'Log in', + 'login_persona' => 'Login met Persona', + 'login_persona_problem' => 'Connectiviteits problemen met Persona?', + 'logout' => 'Log uit', + 'password' => 'Wachtwoord', + 'reset' => 'Authenticatie reset', + 'username' => 'Gebruikersnaam', + 'username_admin' => 'Administrator gebruikersnaam', + 'will_reset' => 'Het authenticatie system zal worden gereset: een formulier zal worden gebruikt in plaats van Persona.', + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t\\u\\s', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\i', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\i', + 'Jul' => '\\J\\u\\l\\i', + 'Jun' => '\\J\\u\\n\\i', + 'Mar' => '\\M\\a\\a\\r\\t', + 'May' => '\\M\\e\\i', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\k\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Ouder', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', +// 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date' => 'j %s Y', // European date format +// 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', + 'format_date_hour' => 'j %s Y \\o\\m H\\:i', // European date format + 'fri' => 'Vr', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Laatste drie maanden', + 'last_6_month' => 'Laatste zes maanden', + 'last_month' => 'Vorige maand', + 'last_week' => 'Vorige week', + 'last_year' => 'Vorig jaar', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'Mei', + 'mon' => 'Ma', + 'month' => 'maanden', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'okt', + 'october' => 'Okt', + 'sat' => 'Za', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Zo', + 'thu' => 'Do', + 'today' => 'Vandaag', + 'tue' => 'Di', + 'wed' => 'Wo', + 'yesterday' => 'Gisteren', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Over FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Lege categorie', + 'confirm_action' => 'Weet u zeker dat u dit wilt doen? Het kan niet ongedaan worden gemaakt!', + 'confirm_action_feed_cat' => 'Weet u zeker dat u dit wilt doen? U verliest alle gereleteerde favorieten en gebruikers informatie. Het kan niet ongedaan worden gemaakt!', + 'feedback' => array( + 'body_new_articles' => 'Er zijn \\d nieuwe artikelen om te lezen op FreshRSS.', + 'request_failed' => 'Een opdracht is mislukt, mogelijk door Internet verbindings problemen.', + 'title_new_articles' => 'FreshRSS: nieuwe artikelen!', + ), + 'new_article' => 'Er zijn nieuwe artikelen beschikbaar, klik om de pagina te vernieuwen.', + 'should_be_activated' => 'JavaScript moet aan staan', + ), + 'lang' => array( + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'nl' => 'Nederlands', + ), + 'menu' => array( + 'about' => 'Over', + 'admin' => 'Administratie', + 'archiving' => 'Archiveren', + 'authentication' => 'Authenticatie', + 'check_install' => 'Installatie controle', + 'configuration' => 'Configuratie', + 'display' => 'Opmaak', + 'extensions' => 'Uitbreidingen', + 'logs' => 'Log boeken', + 'queries' => 'Gebruikers informatie', + 'reading' => 'Lezen', + 'search' => 'Zoek woorden of #labels', + 'sharing' => 'Delen', + 'shortcuts' => 'Snelle toegang', + 'stats' => 'Statistieken', + 'update' => 'Versie controle', + 'user_management' => 'Beheer gebruikers', + 'user_profile' => 'Profiel', + ), + 'pagination' => array( + 'first' => 'Eerste', + 'last' => 'Laatste', + 'load_more' => 'Laad meer artikelen', + 'mark_all_read' => 'Markeer alle als gelezen', + 'next' => 'Volgende', + 'nothing_to_load' => 'Er zijn geen artikelen meer', + 'previous' => 'Vorige', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'short' => array( + 'attention' => 'Attentie!', + 'blank_to_disable' => 'Laat leeg om uit te zetten', + 'by_author' => 'Door %s', + 'by_default' => 'Door standaard', + 'damn' => 'Potverdorie!', + 'default_category' => 'Niet ingedeeld', + 'no' => 'Nee', + 'ok' => 'Ok!', + 'or' => 'of', + 'yes' => 'Ja', + ), +); diff --git a/app/i18n/nl/index.php b/app/i18n/nl/index.php new file mode 100644 index 000000000..df6a064e4 --- /dev/null +++ b/app/i18n/nl/index.php @@ -0,0 +1,61 @@ + array( + '_' => 'Over', + 'agpl3' => 'AGPL 3', + 'bugs_reports' => 'Rapporteer fouten', + 'credits' => 'Waarderingen', + 'credits_content' => 'Sommige ontwerp elementen komen van Bootstrap alhoewel FreshRSS dit raamwerk niet gebruikt. Pictogrammen komen van het GNOME project. De Open Sans font police is gemaakt door Steve Matteson. Favicons zijn verzameld met de getFavicon API. FreshRSS is gebaseerd op Minz, een PHP raamwerk. Nederlandse vertaling door Wanabo, NieuwsKop.be. Link naar de Nederlandse vertaling, FreshRSS-Dutch-translation.', + 'freshrss_description' => 'FreshRSS is een RSS feed aggregator om zelf te hosten zoals Kriss Feed of Leed. Het gebruikt weinig systeembronnen en is makkelijk te administreren terwijl het een krachtig en makkelijk te configureren programma is.', + 'github' => 'op Github', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'Over', + 'version' => 'Versie', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'U kunt wat feeds toevoegen.', + 'empty' => 'Er is geen artikel om te laten zien.', + 'rss_of' => 'RSS feed van %s', + 'title' => 'Overzicht RSS feeds', + 'title_global' => 'Globale weergave', + 'title_fav' => 'Uw favorieten', + ), + 'log' => array( + '_' => 'Log bestanden', + 'clear' => 'Leeg de log bestanden', + 'empty' => 'Log bestand is leeg', + 'title' => 'Log bestanden', + ), + 'menu' => array( + 'about' => 'Over FreshRSS', + 'add_query' => 'Voeg een query toe', + 'before_one_day' => 'Ouder als een dag', + 'before_one_week' => 'Ouder als een week', + 'favorites' => 'Favorieten (%s)', + 'global_view' => 'Globale weergave', + 'main_stream' => 'Overzicht', + 'mark_all_read' => 'Markeer alles als gelezen', + 'mark_cat_read' => 'Markeer categorie als gelezen', + 'mark_feed_read' => 'Markeer feed als gelezen', + 'newer_first' => 'Nieuwste eerst', + 'non-starred' => 'Laat alles zien behalve favorieten', + 'normal_view' => 'Normale weergave', + 'older_first' => 'Oudste eerst', + 'queries' => 'Gebruikers queries', + 'read' => 'Laat alleen gelezen zien', + 'reader_view' => 'Lees modus', + 'rss_view' => 'RSS feed', + 'search_short' => 'Zoeken', + 'starred' => 'Laat alleen favorieten zien', + 'stats' => 'Statistieken', + 'subscription' => 'Abonnementen beheer', + 'unread' => 'Laat alleen ongelezen zien', + ), + 'share' => 'Delen', + 'tag' => array( + 'related' => 'Verwante labels', + ), +); diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.php new file mode 100644 index 000000000..c00966caa --- /dev/null +++ b/app/i18n/nl/install.php @@ -0,0 +1,107 @@ + array( + 'finish' => 'Completeer installatie', + 'fix_errors_before' => 'Repareer de fouten alvorens naar de volgende stap te gaan.', + 'next_step' => 'Ga naar de volgende stap', + ), + 'auth' => array( + 'email_persona' => 'Log in mail adres
    (voor Mozilla Persona)', + 'form' => 'Web formulier (traditioneel, benodigd JavaScript)', + 'http' => 'HTTP (voor geavanceerde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'password_form' => 'Wachtwoord
    (voor de Web-formulier log in methode)', + 'password_format' => 'Tenminste 7 tekens', + 'persona' => 'Mozilla Persona (modern, benodigd JavaScript)', + 'type' => 'Authenticatie methode', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Database configuratie', + 'ko' => 'Controleer uw database informatie.', + 'ok' => 'Database configuratie is opgeslagen.', + ), + 'host' => 'Host', + 'prefix' => 'Tabel voorvoegsel', + 'password' => 'HTTP wachtwoord', + 'type' => 'Type database', + 'username' => 'HTTP gebruikersnaam', + ), + 'check' => array( + '_' => 'Controles', + 'cache' => array( + 'nok' => 'Controleer permissies van de ./data/cache map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'ctype' => array( + 'nok' => 'U mist een benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist cURL (php5-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer permissies van de ./data map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de data map zijn goed.', + ), + 'dom' => array( + 'nok' => 'U mist een benodigde bibliotheek om te bladeren in de DOM (php-xml package).', + 'ok' => 'U hebt de benodigde bibliotheek om te bladeren in de DOM.', + ), + 'favicons' => array( + 'nok' => 'Controleer permissies van de ./data/favicons map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de favicons map zijn goed.', + ), + 'http_referer' => array( + 'nok' => 'Controleer a.u.b. dat u niet uw HTTP REFERER wijzigd.', + 'ok' => 'Uw HTTP REFERER is bekend en komt overeen met uw server.', + ), + 'minz' => array( + 'nok' => 'U mist het Minz framework.', + 'ok' => 'U hebt het Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist een benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of één van de ondersteunde (pdo_mysql, pdo_sqlite).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Controleer permissies van de ./data/persona map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de Mozilla Persona map zijn goed.', + ), + 'php' => array( + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'users' => array( + 'nok' => 'Controleer permissies van de ./data/users map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de users map zijn goed.', + ), + ), + 'conf' => array( + '_' => 'Algemene configuratie', + 'ok' => 'Algemene configuratie is opgeslagen.', + ), + 'congratulations' => 'Gefeliciteerd!', + 'default_user' => 'Gebruikersnaam van de standaard gebruiker (maximaal 16 alphanumerieke tekens)', + 'delete_articles_after' => 'Verwijder artikelen na', + 'fix_errors_before' => 'Repareer fouten alvorens U naar de volgende stap gaat.', + 'javascript_is_better' => 'FreshRSS werkt beter JavaScript ingeschakeld', + 'language' => array( + '_' => 'Taal', + 'choose' => 'Kies een taal voor FreshRSS', + 'defined' => 'Taal is bepaald.', + ), + 'not_deleted' => 'Er ging iets fout! U moet het bestand %s handmatig verwijderen.', + 'ok' => 'De installatie procedure is geslaagd.', + 'step' => 'stap %d', + 'steps' => 'Stappen', + 'title' => 'Installatie · FreshRSS', + 'this_is_the_end' => 'Dit is het einde', +); diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php new file mode 100644 index 000000000..159a58b27 --- /dev/null +++ b/app/i18n/nl/sub.php @@ -0,0 +1,62 @@ + array( + '_' => 'Categorie', + 'add' => 'Voeg categorie toe', + 'empty' => 'Lege categorie', + 'new' => 'Nieuwe categorie', + ), + 'feed' => array( + 'add' => 'Voeg een RSS feed toe', + 'advanced' => 'Geavanceerd', + 'archiving' => 'Archiveren', + 'auth' => array( + 'configuration' => 'Log in', + 'help' => 'Verbinding toestaan toegang te krijgen tot HTTP beveiligde RSS feeds', + 'http' => 'HTTP Authenticatie', + 'password' => 'HTTP wachtwoord', + 'username' => 'HTTP gebruikers naam', + ), + 'css_help' => 'Haalt verstoorde RSS feeds op (attentie, heeft meer tijd nodig!)', + 'css_path' => 'Artikelen CSS pad op originele website', + 'description' => 'Omschrijving', + 'empty' => 'Deze feed is leeg. Controleer of deze nog actueel is.', + 'error' => 'Deze feed heeft problemen. Verifieer a.u.b het doeladres en actualiseer het.', + 'in_main_stream' => 'Zichtbaar in het overzicht', + 'informations' => 'Informatie', + 'keep_history' => 'Minimum aantal artikelen om te houden', + 'moved_category_deleted' => 'Als u een categorie verwijderd, worden de feeds automatisch geclassificeerd onder %s.', + 'no_selected' => 'Geen feed geselecteerd.', + 'number_entries' => '%d artikelen', + 'pubsubhubbub' => 'Directe notificaties met PubSubHubbub', + 'stats' => 'Statistieken', + 'think_to_add' => 'Voeg wat feeds toe.', + 'title' => 'Titel', + 'title_add' => 'Voeg een RSS feed toe', + 'ttl' => 'Vernieuw automatisch niet vaker dan', + 'url' => 'Feed URL', + 'validator' => 'Controleer de geldigheid van de feed', + 'website' => 'Website URL', + ), + 'import_export' => array( + 'export' => 'Exporteer', + 'export_opml' => 'Exporteer lijst van feeds (OPML)', + 'export_starred' => 'Exporteer je fovorieten', + 'feed_list' => 'Lijst van %s artikelen', + 'file_to_import' => 'Bestand om te importeren
    (OPML, Json of Zip)', + 'file_to_import_no_zip' => 'Bestand om te importeren
    (OPML of Json)', + 'import' => 'Importeer', + 'starred_list' => 'Lijst van favoriete artikelen', + 'title' => 'Importeren / exporteren', + ), + 'menu' => array( + 'bookmark' => 'Abonneer (FreshRSS bladwijzer)', + 'import_export' => 'Importeer / exporteer', + 'subscription_management' => 'Abonnementen beheer', + ), + 'title' => array( + '_' => 'Abonnementen beheer', + 'feed_management' => 'RSS feed beheer', + ), +); -- cgit v1.2.3 From c75863ff0f5a464cabe0bbcc79526a1362235427 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 21 Aug 2015 11:49:46 +0200 Subject: UI: Add feed ID in article container https://github.com/FreshRSS/FreshRSS/issues/953 --- app/views/index/normal.phtml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index f71abf158..91ebcebd3 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -56,7 +56,11 @@ if (!empty($this->entries)) { ?>
    renderHelper('index/normal/entry_header'); -- cgit v1.2.3 From 501e3312101893b147767c9f3a36c947869d6580 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 21 Aug 2015 13:35:46 +0200 Subject: Reference other languages https://github.com/FreshRSS/FreshRSS/issues/949 https://github.com/FreshRSS/FreshRSS/pull/950 --- app/i18n/cz/gen.php | 3 ++- app/i18n/de/gen.php | 1 + app/i18n/en/gen.php | 1 + app/i18n/fr/gen.php | 1 + app/i18n/nl/gen.php | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 53127998f..2094d6a60 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -116,10 +116,11 @@ return array( 'should_be_activated' => 'JavaScript musí být povolen', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'cz' => 'Čeština', + 'nl' => 'Nederlands', ), 'menu' => array( 'about' => 'O aplikaci', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index f8f4823a6..fd9ee3f62 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'nl' => 'Nederlands', ), 'menu' => array( 'about' => 'Über', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 1feb8d6ac..484911444 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'nl' => 'Nederlands', ), 'menu' => array( 'about' => 'About', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 67d278be4..2a2fffe3e 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'nl' => 'Nederlands', ), 'menu' => array( 'about' => 'À propos', diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index 9d7a868dd..8680bef11 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -106,6 +106,7 @@ return array( 'should_be_activated' => 'JavaScript moet aan staan', ), 'lang' => array( + 'cz' => 'Čeština', 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', -- cgit v1.2.3 From b3ae9407aca2223000c4f3a5b56648382de8ef48 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 21 Aug 2015 16:26:33 +0200 Subject: i18n nl: content width https://github.com/FreshRSS/FreshRSS/pull/950#issuecomment-133429503 --- app/i18n/nl/conf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php index 16ad336a9..effc9dce2 100644 --- a/app/i18n/nl/conf.php +++ b/app/i18n/nl/conf.php @@ -31,7 +31,7 @@ return array( 'theme' => 'Thema', 'title' => 'Opmaak', 'width' => array( - 'content' => 'Content width', + 'content' => 'Inhoud breedte', 'large' => 'Breed', 'medium' => 'Normaal', 'no_limit' => 'Geen limiet', -- cgit v1.2.3 From b33004c38145d4f4c0d2532e3832743b8ad5ba27 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 21 Aug 2015 18:07:18 +0200 Subject: i18n nl: update Merge changes from https://github.com/Wanabo/FreshRSS-Dutch-translation https://github.com/FreshRSS/FreshRSS/issues/949 --- app/i18n/nl/conf.php | 4 ++++ app/i18n/nl/feedback.php | 1 + app/i18n/nl/gen.php | 27 +++++++++++++++++++-------- app/i18n/nl/install.php | 6 ++++++ 4 files changed, 30 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php index effc9dce2..9b0aff793 100644 --- a/app/i18n/nl/conf.php +++ b/app/i18n/nl/conf.php @@ -72,6 +72,10 @@ return array( ), 'profile' => array( '_' => 'Profiel beheer', + 'delete' => array( + '_' => 'Account verwijderen', + 'warn' => 'Uw account en alle gerelateerde gegvens worden verwijderd.', + ), 'email_persona' => 'Log in mail adres
    (voor Mozilla Persona)', 'password_api' => 'Wachtwoord API
    (e.g., voor mobiele apps)', 'password_form' => 'Wachtwoord
    (voor de Web-formulier log in methode)', diff --git a/app/i18n/nl/feedback.php b/app/i18n/nl/feedback.php index 2bc5cb665..54d84f7d6 100644 --- a/app/i18n/nl/feedback.php +++ b/app/i18n/nl/feedback.php @@ -102,6 +102,7 @@ return array( '_' => 'Gebruiker %s is verwijderd', 'error' => 'Gebruiker %s kan niet worden verwijderd', ), + 'set_registration' => 'Het maximale aantal accounts is vernieuwd.', ), 'profile' => array( 'error' => 'Uw profiel kan niet worden aangepast', diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index 8680bef11..ed57669a1 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -21,15 +21,27 @@ return array( 'truncate' => 'Verwijder alle artikelen', ), 'auth' => array( + 'email' => 'Email adres', 'keep_logged_in' => 'Ingelogd blijven voor (1 maand)', 'login' => 'Log in', 'login_persona' => 'Login met Persona', - 'login_persona_problem' => 'Connectiviteits problemen met Persona?', + 'login_persona_problem' => 'Connectiviteits problemen met Persona', 'logout' => 'Log uit', - 'password' => 'Wachtwoord', + 'password' => array( + '_' => 'Wachtwoord', + 'format' => 'Ten minste 7 tekens', + ), + 'registration' => array( + '_' => 'Nieuw account', + 'ask' => 'Maak een account?', + 'title' => 'Account maken', + ), 'reset' => 'Authenticatie reset', - 'username' => 'Gebruikersnaam', - 'username_admin' => 'Administrator gebruikersnaam', + 'username' => array( + '_' => 'Gebruikersnaam', + 'admin' => 'Administrator gebruikersnaam', + 'format' => 'maximaal 16 alphanumerieke tekens', + ), 'will_reset' => 'Het authenticatie system zal worden gereset: een formulier zal worden gebruikt in plaats van Persona.', ), 'date' => array( @@ -54,10 +66,8 @@ return array( 'december' => 'Dec', 'feb' => 'feb', 'february' => 'Feb', -// 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', - 'format_date' => 'j %s Y', // European date format -// 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', - 'format_date_hour' => 'j %s Y \\o\\m H\\:i', // European date format + 'format_date' => 'j %s Y', //<-- European date format // 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date_hour' => 'j %s Y \\o\\m H\\:i', //<-- European date format // 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', 'fri' => 'Vr', 'jan' => 'jan', 'january' => 'Jan', @@ -160,6 +170,7 @@ return array( 'damn' => 'Potverdorie!', 'default_category' => 'Niet ingedeeld', 'no' => 'Nee', + 'not_applicable' => 'Niet aanwezig', 'ok' => 'Ok!', 'or' => 'of', 'yes' => 'Ja', diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.php index c00966caa..e788261ea 100644 --- a/app/i18n/nl/install.php +++ b/app/i18n/nl/install.php @@ -4,7 +4,9 @@ return array( 'action' => array( 'finish' => 'Completeer installatie', 'fix_errors_before' => 'Repareer de fouten alvorens naar de volgende stap te gaan.', + 'keep_install' => 'Behoud de vorige installatie', 'next_step' => 'Ga naar de volgende stap', + 'reinstall' => 'Installeer FreshRSS opnieuw', ), 'auth' => array( 'email_persona' => 'Log in mail adres
    (voor Mozilla Persona)', @@ -31,6 +33,7 @@ return array( ), 'check' => array( '_' => 'Controles', + 'already_installed' => 'We hebben geconstateerd dat FreshRSS al is geïnstallerd!', 'cache' => array( 'nok' => 'Controleer permissies van de ./data/cache map. HTTP server moet rechten hebben om er in te kunnen schrijven', 'ok' => 'Permissies van de cache map zijn goed.', @@ -93,6 +96,9 @@ return array( 'delete_articles_after' => 'Verwijder artikelen na', 'fix_errors_before' => 'Repareer fouten alvorens U naar de volgende stap gaat.', 'javascript_is_better' => 'FreshRSS werkt beter JavaScript ingeschakeld', + 'js' => array( + 'confirm_reinstall' => 'U verliest uw vorige configuratie door FreshRSS opnieuw te installeren. Weet u zeker dat u verder wilt gaan?', + ), 'language' => array( '_' => 'Taal', 'choose' => 'Kies een taal voor FreshRSS', -- cgit v1.2.3 From 269c6b88c4486a0ae1a92df65578ee6ab6f0bbca Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 22 Aug 2015 09:33:58 -0400 Subject: Add a system configuration page It allows to modify system configuration from the interface. At the moment, only limits are modifiable. The user limit was removed from the user page and added here along with categories and feeds limits. --- app/Controllers/configureController.php | 33 +++++++++++++++++++++++ app/Controllers/userController.php | 24 ----------------- app/i18n/cz/admin.php | 14 ++++++---- app/i18n/cz/feedback.php | 1 - app/i18n/cz/gen.php | 1 + app/i18n/de/admin.php | 14 ++++++---- app/i18n/de/feedback.php | 1 - app/i18n/de/gen.php | 1 + app/i18n/en/admin.php | 14 ++++++---- app/i18n/en/feedback.php | 1 - app/i18n/en/gen.php | 1 + app/i18n/fr/admin.php | 14 ++++++---- app/i18n/fr/feedback.php | 1 - app/i18n/fr/gen.php | 1 + app/layout/aside_configure.phtml | 3 +++ app/layout/header.phtml | 1 + app/views/configure/system.phtml | 47 +++++++++++++++++++++++++++++++++ app/views/user/manage.phtml | 28 -------------------- 18 files changed, 124 insertions(+), 76 deletions(-) create mode 100644 app/views/configure/system.phtml (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 248a3edcc..7a4d0ecd7 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -293,4 +293,37 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.query_created', $query['name']), array('c' => 'configure', 'a' => 'queries')); } + + /** + * This action handles the system configuration page. + * + * It displays the system configuration page. + * If this action is reach through a POST request, it stores all new + * configuration values then sends a notification to the user. + * + * The options available on the page are: + * - user limit (default: 1) + * - user category limit (default: 16384) + * - user feed limit (default: 16384) + */ + public function systemAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + if (Minz_Request::isPost()) { + $limits = FreshRSS_Context::$system_conf->limits; + $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); + $limits['max_feeds'] = Minz_Request::param('max-feeds', 16384); + $limits['max_categories'] = Minz_Request::param('max-categories', 16384); + FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->save(); + + invalidateHttpCache(); + + Minz_Session::_param('notification', array( + 'type' => 'good', + 'content' => _t('feedback.conf.updated') + )); + } + } } diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 428cd145d..1c7d621f1 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -272,28 +272,4 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::forward($redirect_url, true); } - - /** - * This action updates the max number of registrations. - * - * Request parameter is: - * - max-registrations (int >= 0) - */ - public function setRegistrationAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { - $limits = FreshRSS_Context::$system_conf->limits; - $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); - FreshRSS_Context::$system_conf->limits = $limits; - FreshRSS_Context::$system_conf->save(); - - invalidateHttpCache(); - - Minz_Session::_param('notification', array( - 'type' => 'good', - 'content' => _t('feedback.user.set_registration') - )); - } - - Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); - } } diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php index 4ca56cc37..92c300709 100644 --- a/app/i18n/cz/admin.php +++ b/app/i18n/cz/admin.php @@ -146,6 +146,15 @@ return array( 'title' => 'Statistika', 'top_feed' => 'Top ten kanálů', ), + 'system' => array( + '_' => 'System configuration', + 'max-categories' => 'Categories per user limit', + 'max-feeds' => 'Feeds per user limit', + 'registration' => array( + 'help' => '0 znamená žádná omezení účtu', + 'number' => 'Maximální počet účtů', + ), + ), 'update' => array( '_' => 'Aktualizace systému', 'apply' => 'Použít', @@ -164,11 +173,6 @@ return array( 'numbers' => 'Zatím je vytvořeno %d účtů', 'password_form' => 'Heslo
    (pro přihlášení webovým formulářem)', 'password_format' => 'Alespoň 7 znaků', - 'registration' => array( - 'allow' => 'Povolit vytváření účtů', - 'help' => '0 znamená žádná omezení účtu', - 'number' => 'Maximální počet účtů', - ), 'title' => 'Správa uživatelů', 'user_list' => 'Seznam uživatelů', 'username' => 'Přihlašovací jméno', diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php index 5ba64b938..b75a4a15a 100644 --- a/app/i18n/cz/feedback.php +++ b/app/i18n/cz/feedback.php @@ -102,7 +102,6 @@ return array( '_' => 'Uživatel %s byl smazán', 'error' => 'Uživatele %s nelze smazat', ), - 'set_registration' => 'Maximální počet účtů byl změněn', ), 'profile' => array( 'error' => 'Váš profil nelze změnit', diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 138def772..436e4f0c2 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -137,6 +137,7 @@ return array( 'sharing' => 'Sdílení', 'shortcuts' => 'Zkratky', 'stats' => 'Statistika', + 'system' => 'System configuration', 'update' => 'Aktualizace', 'user_management' => 'Správa uživatelů', 'user_profile' => 'Profil', diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index 68dcc2ebf..365f065af 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -146,6 +146,15 @@ return array( 'title' => 'Statistiken', 'top_feed' => 'Top 10-Feeds', ), + 'system' => array( + '_' => 'System configuration', + 'max-categories' => 'Categories per user limit', + 'max-feeds' => 'Feeds per user limit', + 'registration' => array( + 'help' => '0 meint, dass es kein Account Limit gibt', + 'number' => 'Maximale Anzahl von Accounts', + ), + ), 'update' => array( '_' => 'System aktualisieren', 'apply' => 'Anwenden', @@ -164,11 +173,6 @@ return array( 'numbers' => 'Es wurden bis jetzt %d Accounts erstellt', 'password_form' => 'Passwort
    (für die Anmeldemethode per Webformular)', 'password_format' => 'mindestens 7 Zeichen', - 'registration' => array( - 'allow' => 'Erlaube die Accounterstellung', - 'help' => '0 meint, dass es kein Account Limit gibt', - 'number' => 'Maximale Anzahl von Accounts', - ), 'title' => 'Benutzer verwalten', 'user_list' => 'Liste der Benutzer', 'username' => 'Nutzername', diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index e92dacfe9..4c15aadc3 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -102,7 +102,6 @@ return array( '_' => 'Der Benutzer %s ist gelöscht worden', 'error' => 'Der Benutzer %s kann nicht gelöscht werden', ), - 'set_registration' => 'Die maximale Anzahl von Accounts wurde aktualisiert.', ), 'profile' => array( 'error' => 'Ihr Profil kann nicht geändert werden', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index de2d846c5..f3450abc0 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -137,6 +137,7 @@ return array( 'sharing' => 'Teilen', 'shortcuts' => 'Tastaturkürzel', 'stats' => 'Statistiken', + 'system' => 'System configuration', 'update' => 'Aktualisieren', 'user_management' => 'Benutzer verwalten', 'user_profile' => 'Profil', diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index aeea61631..ad9038203 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -146,6 +146,15 @@ return array( 'title' => 'Statistics', 'top_feed' => 'Top ten feeds', ), + 'system' => array( + '_' => 'System configuration', + 'max-categories' => 'Categories per user limit', + 'max-feeds' => 'Feeds per user limit', + 'registration' => array( + 'help' => '0 means that there is no account limit', + 'number' => 'Max number of accounts', + ), + ), 'update' => array( '_' => 'Update system', 'apply' => 'Apply', @@ -164,11 +173,6 @@ return array( 'numbers' => 'There are %d accounts created yet', 'password_form' => 'Password
    (for the Web-form login method)', 'password_format' => 'At least 7 characters', - 'registration' => array( - 'allow' => 'Allow account creation', - 'help' => '0 means that there is no account limit', - 'number' => 'Max number of accounts', - ), 'title' => 'Manage users', 'user_list' => 'List of users', 'username' => 'Username', diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index c9f73dc1d..c9189c0d0 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -102,7 +102,6 @@ return array( '_' => 'User %s has been deleted', 'error' => 'User %s cannot be deleted', ), - 'set_registration' => 'The maximum amount of accounts has been updated.', ), 'profile' => array( 'error' => 'Your profile cannot be modified', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 1feb8d6ac..9aef45768 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -137,6 +137,7 @@ return array( 'sharing' => 'Sharing', 'shortcuts' => 'Shortcuts', 'stats' => 'Statistics', + 'system' => 'System configuration', 'update' => 'Update', 'user_management' => 'Manage users', 'user_profile' => 'Profile', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 01e0cb3c7..44e013c2f 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -146,6 +146,15 @@ return array( 'title' => 'Statistiques', 'top_feed' => 'Les dix plus gros flux', ), + 'system' => array( + '_' => 'Configuration du système', + 'max-categories' => 'Limite de catégories par utilisateur', + 'max-feeds' => 'Limite de flux par utilisateur', + 'registration' => array( + 'help' => 'Un chiffre de 0 signifie que l’on peut créer un nombre infini de comptes', + 'number' => 'Nombre max de comptes', + ), + ), 'update' => array( '_' => 'Système de mise à jour', 'apply' => 'Appliquer la mise à jour', @@ -164,11 +173,6 @@ return array( 'numbers' => '%d comptes ont déjà été créés', 'password_form' => 'Mot de passe
    (pour connexion par formulaire)', 'password_format' => '7 caractères minimum', - 'registration' => array( - 'allow' => 'Autoriser la création de comptes', - 'help' => 'Un chiffre de 0 signifie que l’on peut créer un nombre infini de comptes', - 'number' => 'Nombre max de comptes', - ), 'title' => 'Gestion des utilisateurs', 'user_list' => 'Liste des utilisateurs', 'username' => 'Nom d’utilisateur', diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index 99c193d28..e2364a251 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -102,7 +102,6 @@ return array( '_' => 'L’utilisateur %s a été supprimé.', 'error' => 'L’utilisateur %s ne peut pas être supprimé.', ), - 'set_registration' => 'Le nombre maximal de comptes a été mis à jour.', ), 'profile' => array( 'error' => 'Votre profil n’a pas pu être mis à jour', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 67d278be4..9df5b6f05 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -137,6 +137,7 @@ return array( 'sharing' => 'Partage', 'shortcuts' => 'Raccourcis', 'stats' => 'Statistiques', + 'system' => 'Configuration du système', 'update' => 'Mise à jour', 'user_management' => 'Gestion des utilisateurs', 'user_profile' => 'Profil', diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 7567a8206..d956ec21f 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -27,6 +27,9 @@ +
  • + +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 41a63a565..238c664b0 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -67,6 +67,7 @@ if (FreshRSS_Auth::accessNeedsAction()) {
  • +
  • diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml new file mode 100644 index 000000000..cbedc511b --- /dev/null +++ b/app/views/configure/system.phtml @@ -0,0 +1,47 @@ +partial('aside_configure'); ?> + +
    + + + + + +
    + +
    + + +
    +
    + +
    +
    + 1 ? 'admin.user.numbers' : 'admin.user.number', $number); + ?> +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + + +
    +
    + +
    \ No newline at end of file diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 3d3bc3ddf..fe1b6618b 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -3,34 +3,6 @@
    -
    - - -
    - -
    - - -
    -
    - -
    -
    - 1 ? 'admin.user.numbers' : 'admin.user.number', $number); - ?> -
    -
    - -
    -
    - - -
    -
    -
    -
    -- cgit v1.2.3 From 428e3f5c96c91e3e1b249215a3d7c0d299324642 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 24 Aug 2015 18:26:20 -0400 Subject: Add new line to comply with coding style --- app/views/configure/system.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml index cbedc511b..9c9813729 100644 --- a/app/views/configure/system.phtml +++ b/app/views/configure/system.phtml @@ -44,4 +44,4 @@
    -
    \ No newline at end of file +
    -- cgit v1.2.3 From fac236a04151af2b65b39fdd8f5169ef5abbf16e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 24 Aug 2015 18:30:25 -0400 Subject: Add todo comments for translation --- app/i18n/cz/admin.php | 6 +++--- app/i18n/cz/gen.php | 2 +- app/i18n/de/admin.php | 6 +++--- app/i18n/de/gen.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php index 92c300709..6c9156335 100644 --- a/app/i18n/cz/admin.php +++ b/app/i18n/cz/admin.php @@ -147,9 +147,9 @@ return array( 'top_feed' => 'Top ten kanálů', ), 'system' => array( - '_' => 'System configuration', - 'max-categories' => 'Categories per user limit', - 'max-feeds' => 'Feeds per user limit', + '_' => 'System configuration', // @todo translate + 'max-categories' => 'Categories per user limit', // @todo translate + 'max-feeds' => 'Feeds per user limit', // @todo translate 'registration' => array( 'help' => '0 znamená žádná omezení účtu', 'number' => 'Maximální počet účtů', diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 436e4f0c2..0883cb669 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -137,7 +137,7 @@ return array( 'sharing' => 'Sdílení', 'shortcuts' => 'Zkratky', 'stats' => 'Statistika', - 'system' => 'System configuration', + 'system' => 'System configuration',// @todo translate 'update' => 'Aktualizace', 'user_management' => 'Správa uživatelů', 'user_profile' => 'Profil', diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index 365f065af..26d0bcd36 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -147,9 +147,9 @@ return array( 'top_feed' => 'Top 10-Feeds', ), 'system' => array( - '_' => 'System configuration', - 'max-categories' => 'Categories per user limit', - 'max-feeds' => 'Feeds per user limit', + '_' => 'System configuration', // @todo translate + 'max-categories' => 'Categories per user limit', // @todo translate + 'max-feeds' => 'Feeds per user limit', // @todo translate 'registration' => array( 'help' => '0 meint, dass es kein Account Limit gibt', 'number' => 'Maximale Anzahl von Accounts', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index f3450abc0..1f06e156f 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -137,7 +137,7 @@ return array( 'sharing' => 'Teilen', 'shortcuts' => 'Tastaturkürzel', 'stats' => 'Statistiken', - 'system' => 'System configuration', + 'system' => 'System configuration',// @todo translate 'update' => 'Aktualisieren', 'user_management' => 'Benutzer verwalten', 'user_profile' => 'Profil', -- cgit v1.2.3 From d396dd71524694766bde852834be15f477ceaf3e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 24 Aug 2015 18:41:57 -0400 Subject: Add instance name in system configuration page --- app/Controllers/configureController.php | 1 + app/i18n/cz/admin.php | 1 + app/i18n/de/admin.php | 1 + app/i18n/en/admin.php | 1 + app/i18n/fr/admin.php | 1 + app/views/configure/system.phtml | 7 +++++++ 6 files changed, 12 insertions(+) (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 7a4d0ecd7..0dc7ceab2 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -316,6 +316,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $limits['max_feeds'] = Minz_Request::param('max-feeds', 16384); $limits['max_categories'] = Minz_Request::param('max-categories', 16384); FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->title = Minz_Request::param('instance-name', 'FreshRSS'); FreshRSS_Context::$system_conf->save(); invalidateHttpCache(); diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php index 6c9156335..e1fa5d141 100644 --- a/app/i18n/cz/admin.php +++ b/app/i18n/cz/admin.php @@ -148,6 +148,7 @@ return array( ), 'system' => array( '_' => 'System configuration', // @todo translate + 'instance-name' => 'Instance name', // @todo translate 'max-categories' => 'Categories per user limit', // @todo translate 'max-feeds' => 'Feeds per user limit', // @todo translate 'registration' => array( diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index 26d0bcd36..395b51acf 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -148,6 +148,7 @@ return array( ), 'system' => array( '_' => 'System configuration', // @todo translate + 'instance-name' => 'Instance name', // @todo translate 'max-categories' => 'Categories per user limit', // @todo translate 'max-feeds' => 'Feeds per user limit', // @todo translate 'registration' => array( diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index ad9038203..6edb38cf0 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -148,6 +148,7 @@ return array( ), 'system' => array( '_' => 'System configuration', + 'instance-name' => 'Instance name', 'max-categories' => 'Categories per user limit', 'max-feeds' => 'Feeds per user limit', 'registration' => array( diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 44e013c2f..e73622577 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -148,6 +148,7 @@ return array( ), 'system' => array( '_' => 'Configuration du système', + 'instance-name' => 'Nom de l’instance', 'max-categories' => 'Limite de catégories par utilisateur', 'max-feeds' => 'Limite de flux par utilisateur', 'registration' => array( diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml index 9c9813729..9406c34d6 100644 --- a/app/views/configure/system.phtml +++ b/app/views/configure/system.phtml @@ -6,6 +6,13 @@
    +
    + +
    + +
    +
    +
    -- cgit v1.2.3 From 9fcdaf99e24a23724c2b95b29b85b8112b6263fb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 8 Sep 2015 20:52:37 +0200 Subject: Error encoding tag link https://github.com/FreshRSS/FreshRSS/issues/970 --- app/views/helpers/index/normal/entry_bottom.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml index 20b4b332c..66c9d0e74 100644 --- a/app/views/helpers/index/normal/entry_bottom.phtml +++ b/app/views/helpers/index/normal/entry_bottom.phtml @@ -71,7 +71,7 @@
    -- cgit v1.2.3 From d073331d2496d427dad972b9e024f247015e50ce Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 8 Sep 2015 21:31:24 +0200 Subject: Tag link double encoding problem https://github.com/FreshRSS/FreshRSS/issues/970 Tags coming from the database are already HTML-encoded. --- app/views/helpers/index/normal/entry_bottom.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml index 66c9d0e74..3af7436c3 100644 --- a/app/views/helpers/index/normal/entry_bottom.phtml +++ b/app/views/helpers/index/normal/entry_bottom.phtml @@ -71,7 +71,7 @@
    -- cgit v1.2.3 From 5a2bc9261ca5104022ce64e00d0384791b0443d1 Mon Sep 17 00:00:00 2001 From: Marcus Rohrmoser Date: Thu, 10 Sep 2015 09:52:24 +0200 Subject: fixed misleading i18n wording bug. --- app/i18n/de/install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index 286272e71..9bada0869 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -27,9 +27,9 @@ return array( ), 'host' => 'Host', 'prefix' => 'Tabellen-Präfix', - 'password' => 'HTTP-Password', + 'password' => 'SQL-Password', 'type' => 'Datenbank-Typ', - 'username' => 'HTTP-Nutzername', + 'username' => 'SQL-Nutzername', ), 'check' => array( '_' => 'Überprüfungen', -- cgit v1.2.3 From 271d43b5692de4d56f05d38ca802b7807c8743cf Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 11 Sep 2015 18:45:25 -0400 Subject: Fix feed and category side effect Before, when deleting a feed or a category, the user queries were deleted as well. No matter if they were related or not. Now, they are deleted only if they are related. I this this fix is not the best way to handle that. I think it would be better if we could find a way to create a UserQuery object from the array. The same applies when displaying the user queries in the interface. See #980 --- app/Models/ConfigurationSetter.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index 992a3a387..5c8a1ce29 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -119,6 +119,8 @@ class FreshRSS_ConfigurationSetter { foreach ($values as $value) { if ($value instanceof FreshRSS_UserQuery) { $data['queries'][] = $value->toArray(); + } elseif (is_array($value)) { + $data['queries'][] = $value; } } } -- cgit v1.2.3 From 84824f8599ef8b7613c7c6829221aa8b88aa3846 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 12 Sep 2015 18:58:08 -0400 Subject: Add a visual alert on categories When a category has one or more feeds with errors, a visual warning is displayed before the name of the category. --- app/Models/Category.php | 7 +++++++ app/layout/aside_feed.phtml | 2 +- p/themes/base-theme/template.css | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Models/Category.php b/app/Models/Category.php index 37cb44dc3..9a44a2d09 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -6,6 +6,7 @@ class FreshRSS_Category extends Minz_Model { private $nbFeed = -1; private $nbNotRead = -1; private $feeds = null; + private $hasFeedsWithError = false; public function __construct($name = '', $feeds = null) { $this->_name($name); @@ -16,6 +17,7 @@ class FreshRSS_Category extends Minz_Model { foreach ($feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } } @@ -51,12 +53,17 @@ class FreshRSS_Category extends Minz_Model { foreach ($this->feeds as $feed) { $this->nbFeed++; $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } return $this->feeds; } + public function hasFeedsWithError() { + return $this->hasFeedsWithError; + } + public function _id($value) { $this->id = $value; } diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index a6d22f878..307db6af8 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -45,7 +45,7 @@
    • diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index a299a5ddf..918d05942 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -776,6 +776,9 @@ input:checked + .slide-container .properties { .category .title:not([data-unread="0"]):after { content: attr(data-unread); } +.category .title.error::before { + content: "⚠"; +} .feed .item-title:not([data-unread="0"]):before { content: "(" attr(data-unread) ") "; } -- cgit v1.2.3 From 468015dad6a76700f1e3e304c497e08e6636d1a2 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 14 Oct 2015 01:11:31 -0400 Subject: Add Movim share See #992 --- app/i18n/cz/gen.php | 1 + app/i18n/de/gen.php | 1 + app/i18n/en/gen.php | 1 + app/i18n/fr/gen.php | 1 + app/i18n/nl/gen.php | 1 + data/shares.php | 6 ++++++ 6 files changed, 11 insertions(+) (limited to 'app') diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index d3e93c0a1..cbcc1f8fa 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -158,6 +158,7 @@ return array( 'email' => 'Email', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'movim' => 'Movim', 'print' => 'Tisk', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 38beb5016..d2d8e78e6 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -158,6 +158,7 @@ return array( 'email' => 'E-Mail', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'movim' => 'Movim', 'print' => 'Drucken', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index b71af91f1..1ae9c60a2 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -158,6 +158,7 @@ return array( 'email' => 'Email', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'movim' => 'Movim', 'print' => 'Print', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index f09c73ca1..b2d36c9d6 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -158,6 +158,7 @@ return array( 'email' => 'Courriel', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'movim' => 'Movim', 'print' => 'Imprimer', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index ed57669a1..10b665791 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -157,6 +157,7 @@ return array( 'email' => 'Email', 'facebook' => 'Facebook', 'g+' => 'Google+', + 'movim' => 'Movim', 'print' => 'Print', 'shaarli' => 'Shaarli', 'twitter' => 'Twitter', diff --git a/data/shares.php b/data/shares.php index 6e0e9ea0c..b3df54188 100644 --- a/data/shares.php +++ b/data/shares.php @@ -44,6 +44,12 @@ return array( 'help' => 'https://diasporafoundation.org/', 'form' => 'advanced', ), + 'movim' => array( + 'url' => '~URL~/index.php/share?url=~LINK~', + 'transform' => array('rawurlencode'), + 'help' => 'https://github.com/edhelas/movim', + 'form' => 'advanced', + ), 'twitter' => array( 'url' => 'https://twitter.com/share?url=~LINK~&text=~TITLE~', 'transform' => array('rawurlencode'), -- cgit v1.2.3 From 9fa74af0dad6334bd650d420aaf8ead6b68ddef6 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:10:14 +0200 Subject: Create conf.php --- app/i18n/it/conf.php | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 app/i18n/it/conf.php (limited to 'app') diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php new file mode 100644 index 000000000..b757b3210 --- /dev/null +++ b/app/i18n/it/conf.php @@ -0,0 +1,174 @@ + array( + '_' => 'Archiviazione', + 'advanced' => 'Avanzate', + 'delete_after' => 'Rimuovi articoli dopo', + 'help' => 'Altre opzioni sono disponibili nelle impostazioni dei singoli feed', + 'keep_history_by_feed' => 'Numero minimo di articoli da mantenere per feed', + 'optimize' => 'Ottimizza database', + 'optimize_help' => 'Da fare occasionalmente per ridurre le dimensioni del database', + 'purge_now' => 'Cancella ora', + 'title' => 'Archiviazione', + 'ttl' => 'Non effettuare aggiornamenti per più di', + ), + 'display' => array( + '_' => 'Visualizzazione', + 'icon' => array( + 'bottom_line' => 'Barra in fondo', + 'entry' => 'Icone degli articoli', + 'publication_date' => 'Data di pubblicazione', + 'related_tags' => 'Tags correlati', + 'sharing' => 'Condivisione', + 'top_line' => 'Barra in alto', + ), + 'language' => 'Lingua', + 'notif_html5' => array( + 'seconds' => 'secondi (0 significa nessun timeout)', + 'timeout' => 'Notifica timeout HTML5', + ), + 'theme' => 'Tema', + 'title' => 'Visualizzazione', + 'width' => array( + 'content' => 'Larghezza contenuto', + 'large' => 'Largo', + 'medium' => 'Medio', + 'no_limit' => 'Nessun limite', + 'thin' => 'Stretto', + ), + ), + 'query' => array( + '_' => 'Ricerche personali', + 'deprecated' => 'Questa query non è più valida. La categoria o il feed di riferimento non stati cancellati.', + 'filter' => 'Filtro applicato:', + 'get_all' => 'Mostra tutti gli articoli', + 'get_category' => 'Mostra la categoria "%s" ', + 'get_favorite' => 'Mostra articoli preferiti', + 'get_feed' => 'Mostra feed "%s" ', + 'no_filter' => 'Nessun filtro', + 'none' => 'Non hai creato nessuna ricerca personale.', + 'number' => 'Ricerca n°%d', + 'order_asc' => 'Mostra prima gli articoli più vecchi', + 'order_desc' => 'Mostra prima gli articoli più nuovi', + 'search' => 'Cerca per "%s"', + 'state_0' => 'Mostra tutti gli articoli', + 'state_1' => 'Mostra gli articoli letti', + 'state_2' => 'Mostra gli articoli non letti', + 'state_3' => 'Mostra tutti gli articoli', + 'state_4' => 'Mostra gli articoli preferiti', + 'state_5' => 'Mostra gli articoli preferiti letti', + 'state_6' => 'Mostra gli articoli preferiti non letti', + 'state_7' => 'Mostra gli articoli preferiti', + 'state_8' => 'Non mostrare gli articoli preferiti', + 'state_9' => 'Mostra gli articoli letti non preferiti', + 'state_10' => 'Mostra gli articoli non letti e non preferiti', + 'state_11' => 'Non mostrare gli articoli preferiti', + 'state_12' => 'Mostra tutti gli articoli', + 'state_13' => 'Mostra gli articoli letti', + 'state_14' => 'Mostra gli articoli non letti', + 'state_15' => 'Mostra tutti gli articoli', + 'title' => 'Ricerche personali', + ), + 'profile' => array( + '_' => 'Gestione profili', + 'delete' => array( + '_' => 'Cancellazione account', + 'warn' => 'Il tuo account e tutti i dati associati saranno cancellati.', + ), + 'email_persona' => 'Indirizzo email
      (Login Mozilla Persona)', + 'password_api' => 'Password API
      (e.g., per applicazioni mobili)', + 'password_form' => 'Password
      (per il login classico)', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Profilo', + ), + 'reading' => array( + '_' => 'Lettura', + 'after_onread' => 'Dopo “segna tutto come letto”,', + 'articles_per_page' => 'Numero di articoli per pagina', + 'auto_load_more' => 'Carica articoli successivi a fondo pagina', + 'auto_remove_article' => 'Nascondi articoli dopo la lettura', + 'mark_updated_article_unread' => 'Segna articoli aggiornati come non letti', + 'confirm_enabled' => 'Mostra una conferma per “segna tutto come letto”', + 'display_articles_unfolded' => 'Mostra articoli aperti di predefinito', + 'display_categories_unfolded' => 'Mostra categorie aperte di predefinito', + 'hide_read_feeds' => 'Nascondi categorie e feeds con articoli già letti (non funziona se “Mostra tutti gli articoli” è selezionato)', + 'img_with_lazyload' => 'Usa la modalità "caricamento ritardato" per le immagini', + 'jump_next' => 'Salta al successivo feed o categoria non letto', + 'number_divided_when_reader' => 'Diviso 2 nella modalità di lettura.', + 'read' => array( + 'article_open_on_website' => 'Quando un articolo è aperto nel suo sito di origine', + 'article_viewed' => 'Quando un articolo viene letto', + 'scroll' => 'Scorrendo la pagina', + 'upon_reception' => 'Alla ricezione del contenuto', + 'when' => 'Segna articoli come letti…', + ), + 'show' => array( + '_' => 'Articoli da visualizzare', + 'adaptive' => 'Adatta visualizzazione', + 'all_articles' => 'Mostra tutti gli articoli', + 'unread' => 'Mostra solo non letti', + ), + 'sort' => array( + '_' => 'Ordinamento', + 'newer_first' => 'Prima i più recenti', + 'older_first' => 'Prima i più vecchi', + ), + 'sticky_post' => 'Blocca il contenuto a inizio pagina quando aperto', + 'title' => 'Lettura', + 'view' => array( + 'default' => 'Visualizzazione predefinita', + 'global' => 'Vista globale per categorie', + 'normal' => 'Vista elenco', + 'reader' => 'Modalità di lettura', + ), + ), + 'sharing' => array( + '_' => 'Condivisione', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Ulteriori informazioni', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'share_name' => 'Nome condivisione', + 'share_url' => 'URL condivisione', + 'title' => 'Condividi', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Comandi tastiera', + 'article_action' => 'Azioni sugli articoli', + 'auto_share' => 'Condividi', + 'auto_share_help' => 'Se è presente un solo servizio di condivisione verrà usato quello, altrimenti usare anche il numero associato.', + 'close_dropdown' => 'Chiudi menù', + 'collapse_article' => 'Collassa articoli', + 'first_article' => 'Salta al primo articolo', + 'focus_search' => 'Modulo di ricerca', + 'help' => 'Mostra documentazione', + 'javascript' => 'JavaScript deve essere abilitato per poter usare i comandi da tastiera', + 'last_article' => 'Salta all ultimo articolo', + 'load_more' => 'Carica altri articoli', + 'mark_read' => 'Segna come letto', + 'mark_favorite' => 'Segna come preferito', + 'navigation' => 'Navigazione', + 'navigation_help' => 'Con il tasto "Shift" i comandi di navigazione verranno applicati ai feeds.
      Con il tasto "Alt" i comandi di navigazione verranno applicati alle categorie.', + 'next_article' => 'Salta al contenuto successivo', + 'other_action' => 'Altre azioni', + 'previous_article' => 'Salta al contenuto precedente', + 'see_on_website' => 'Vai al sito fonte', + 'shift_for_all_read' => '+ shift per segnare tutti gli articoli come letti', + 'title' => 'Comandi da tastiera', + 'user_filter' => 'Accedi alle ricerche personali', + 'user_filter_help' => 'Se è presente una sola ricerca personale verrà usata quella, altrimenti usare anche il numero associato.', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'current' => 'Utente connesso', + 'is_admin' => 'è amministratore', + 'users' => 'Utenti', + ), +); -- cgit v1.2.3 From a22bca1aaa1c7989e16d55b8dc4ad2c8f932a72a Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:11:08 +0200 Subject: Create admin.php --- app/i18n/it/admin.php | 182 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 app/i18n/it/admin.php (limited to 'app') diff --git a/app/i18n/it/admin.php b/app/i18n/it/admin.php new file mode 100644 index 000000000..cb9a55c0b --- /dev/null +++ b/app/i18n/it/admin.php @@ -0,0 +1,182 @@ + array( + 'allow_anonymous' => 'Consenti la lettura agli utenti anonimi degli articoli dell utente predefinito (%s)', + 'allow_anonymous_refresh' => 'Consenti agli utenti anonimi di aggiornare gli articoli', + 'api_enabled' => 'Consenti le API di accesso (richiesto per le app mobili)', + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'persona' => 'Mozilla Persona (moderno, richiede JavaScript)', + 'title' => 'Autenticazione', + 'title_reset' => 'Reset autenticazione', + 'token' => 'Token di autenticazione', + 'token_help' => 'Consenti accesso agli RSS dell utente predefinito senza autenticazione:', + 'type' => 'Metodo di autenticazione', + 'unsafe_autologin' => 'Consenti accesso automatico non sicuro usando il formato: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/cache. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'categories' => array( + 'nok' => 'La tabella delle categorie ha una configurazione errata.', + 'ok' => 'Tabella delle categorie OK.', + ), + 'connection' => array( + 'nok' => 'La connessione al database non può essere stabilita.', + 'ok' => 'Connessione al database OK', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php5-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'database' => 'Installazione database', + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM (pacchetto php-xml).', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'entries' => array( + 'nok' => 'La tabella Entry ha una configurazione errata.', + 'ok' => 'Tabella Entry OK.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/favicons. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'feeds' => array( + 'nok' => 'La tabella Feed ha una configurazione errata.', + 'ok' => 'Tabella Feed OK.', + ), + 'files' => 'Installazione files', + 'json' => array( + 'nok' => 'Manca il supoorto a JSON (pacchetto php5-json).', + 'ok' => 'Estensione JSON presente.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/persona. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella Mozilla Persona sono corretti.', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione PHP %s, compatibile con FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Rilevate tabelle mancanti nel database.', + 'ok' => 'Tutte le tabelle sono presenti nel database.', + ), + 'title' => 'Verifica installazione', + 'tokens' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/tokens. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella tokens sono corretti.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/users. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + 'zip' => array( + 'nok' => 'Manca estensione ZIP (pacchetto php5-zip).', + 'ok' => 'Estensione ZIP presente.', + ), + ), + 'extensions' => array( + 'disabled' => 'Disabilitata', + 'empty_list' => 'Non ci sono estensioni installate', + 'enabled' => 'Abilitata', + 'no_configure_view' => 'Questa estensioni non può essere configurata.', + 'system' => array( + '_' => 'Estensioni di sistema', + 'no_rights' => 'Estensione di sistema (non hai i permessi su questo tipo)', + ), + 'title' => 'Estensioni', + 'user' => 'Estensioni utente', + ), + 'stats' => array( + '_' => 'Statistiche', + 'all_feeds' => 'Tutti i feeds', + 'category' => 'Categoria', + 'entry_count' => 'Articoli', + 'entry_per_category' => 'Articoli per categoria', + 'entry_per_day' => 'Articoli per giorno (ultimi 30 giorni)', + 'entry_per_day_of_week' => 'Per giorno della settimana (media: %.2f articoli)', + 'entry_per_hour' => 'Per ora (media: %.2f articoli)', + 'entry_per_month' => 'Per mese (media: %.2f articoli)', + 'entry_repartition' => 'Ripartizione contenuti', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categoria', + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'main_stream' => 'Flusso principale', + 'menu' => array( + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'repartition' => 'Ripartizione articoli', + ), + 'no_idle' => 'Non ci sono feed non aggiornati', + 'number_entries' => '%d articoli', + 'percent_of_total' => '%% del totale', + 'repartition' => 'Ripartizione articoli', + 'status_favorites' => 'Preferiti', + 'status_read' => 'Letti', + 'status_total' => 'Totale', + 'status_unread' => 'Non letti', + 'title' => 'Statistiche', + 'top_feed' => 'I migliori 10 feeds', + ), + 'system' => array( + '_' => 'Configurazione di sistema', + 'instance-name' => 'Nome istanza', + 'max-categories' => 'Limite categorie per utente', + 'max-feeds' => 'Limite feeds per utente', + 'registration' => array( + 'help' => '0 significa che non esiste limite sui profili', + 'number' => 'Numero massimo di profili', + ), + ), + 'update' => array( + '_' => 'Aggiornamento sistema', + 'apply' => 'Applica', + 'check' => 'Controlla la presenza di nuovi aggiornamenti', + 'current_version' => 'FreshRSS versione %s.', + 'last' => 'Ultima verifica: %s', + 'none' => 'Nessun aggiornamento da applicare', + 'title' => 'Aggiorna sistema', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'create' => 'Crea nuovo utente', + 'email_persona' => 'Indirizzo mail
      (Login Mozilla Persona)', + 'language' => 'Lingua', + 'number' => ' %d profilo utente creato', + 'numbers' => 'Sono presenti %d profili utente', + 'password_form' => 'Password
      (per il login classico)', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Gestione utenti', + 'user_list' => 'Lista utenti', + 'username' => 'Nome utente', + 'users' => 'Utenti', + ), +); -- cgit v1.2.3 From fb085db9e333cad910e8be56cdb274d988245477 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:11:26 +0200 Subject: Create install.php --- app/i18n/it/install.php | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 app/i18n/it/install.php (limited to 'app') diff --git a/app/i18n/it/install.php b/app/i18n/it/install.php new file mode 100644 index 000000000..3ad22c5e9 --- /dev/null +++ b/app/i18n/it/install.php @@ -0,0 +1,114 @@ + array( + 'finish' => 'Installazione completata', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'keep_install' => 'Mantieni installazione precedente', + 'next_step' => 'Vai al prossimo passaggio', + 'reinstall' => 'Reinstalla FreshRSS', + ), + 'auth' => array( + 'email_persona' => 'Indirizzo mail
      (per Mozilla Persona)', + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'password_form' => 'Password
      (per il login tramite Web-form tradizionale)', + 'password_format' => 'Almeno 7 caratteri', + 'persona' => 'Mozilla Persona (moderno, richiede JavaScript)', + 'type' => 'Metodo di autenticazione', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Configurazione database', + 'ko' => 'Verifica le informazioni del database.', + 'ok' => 'Le configurazioni del database sono state salvate.', + ), + 'host' => 'Host', + 'prefix' => 'Prefisso tabella', + 'password' => 'HTTP password', + 'type' => 'Tipo di database', + 'username' => 'HTTP username', + ), + 'check' => array( + '_' => 'Controlli', + 'already_installed' => 'FreshRSS risulta già installato!', + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/cache. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php5-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM (pacchetto php-xml).', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/favicons. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'http_referer' => array( + 'nok' => 'Per favore verifica che non stai alterando il tuo HTTP REFERER.', + 'ok' => 'Il tuo HTTP REFERER riconosciuto corrisponde al tuo server.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite).', + ), + 'persona' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/persona. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella Mozilla Persona sono corretti.', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione di PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione di PHP %s, compatibile con FreshRSS.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella ./data/users. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + ), + 'conf' => array( + '_' => 'Configurazioni generali', + 'ok' => 'Configurazioni generali salvate.', + ), + 'congratulations' => 'Congratulazione!', + 'default_user' => 'Username utente predefinito (massimo 16 caratteri alfanumerici)', + 'delete_articles_after' => 'Rimuovi articoli dopo', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'javascript_is_better' => 'FreshRSS funziona meglio con JavaScript abilitato', + 'js' => array( + 'confirm_reinstall' => 'Reinstallando FreshRSS perderai la configurazione precedente. Sei sicuro di voler procedere?', + ), + 'language' => array( + '_' => 'Lingua', + 'choose' => 'Seleziona la lingua per FreshRSS', + 'defined' => 'Lingua impostata.', + ), + 'not_deleted' => 'Qualcosa non ha funzionato; devi cancellare il file %s manualmente.', + 'ok' => 'Processo di installazione terminato con successo.', + 'step' => 'Passaggio %d', + 'steps' => 'Passaggi', + 'title' => 'Installazione · FreshRSS', + 'this_is_the_end' => 'Fine', +); -- cgit v1.2.3 From 07b252ad4380bad10614660264773608a5378fb6 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:11:50 +0200 Subject: Create feedback.php --- app/i18n/it/feedback.php | 110 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 app/i18n/it/feedback.php (limited to 'app') diff --git a/app/i18n/it/feedback.php b/app/i18n/it/feedback.php new file mode 100644 index 000000000..caf1cd2b4 --- /dev/null +++ b/app/i18n/it/feedback.php @@ -0,0 +1,110 @@ + array( + 'optimization_complete' => 'Ottimizzazione completata', + ), + 'access' => array( + 'denied' => 'Non hai i permessi per accedere a questa pagina', + 'not_found' => 'Pagina non disponibile', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Si è verificato un problema alla configurazione del sistema di autenticazione. Per favore riprova più tardi.', + 'set' => 'Sistema di autenticazione tramite Form impostato come predefinito.', + ), + 'login' => array( + 'invalid' => 'Autenticazione non valida', + 'success' => 'Autenticazione effettuata', + ), + 'logout' => array( + 'success' => 'Disconnessione effettuata', + ), + 'no_password_set' => 'Password di amministrazione non impostata. Opzione non disponibile.', + 'not_persona' => 'Solo il sistema Mozilla Persona può essere resettato.', + ), + 'conf' => array( + 'error' => 'Si è verificato un errore durante il salvataggio della configurazione', + 'query_created' => 'Ricerca "%s" creata.', + 'shortcuts_updated' => 'Collegamenti tastiera aggiornati', + 'updated' => 'Configurazione aggiornata', + ), + 'extensions' => array( + 'already_enabled' => '%s è già abilitata', + 'disable' => array( + 'ko' => '%s non può essere disabilitata. Verifica i logs per dettagli.', + 'ok' => '%s è disabilitata', + ), + 'enable' => array( + 'ko' => '%s non può essere abilitata. Verifica i logs per dettagli.', + 'ok' => '%s è ora abilitata', + ), + 'no_access' => 'Accesso negato a %s', + 'not_enabled' => '%s non abilitato', + 'not_found' => '%s non disponibile', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Estensione Zip non presente sul server. Per favore esporta i files singolarmente.', + 'feeds_imported' => 'I tuoi feed sono stati importati e saranno aggiornati', + 'feeds_imported_with_errors' => 'I tuoi feeds sono stati importati ma si sono verificati alcuni errori', + 'file_cannot_be_uploaded' => 'Il file non può essere caricato!', + 'no_zip_extension' => 'Estensione Zip non presente sul server.', + 'zip_error' => 'Si è verificato un errore importando il file Zip', + ), + 'sub' => array( + 'actualize' => 'Aggiorna', + 'category' => array( + 'created' => 'Categoria %s creata.', + 'deleted' => 'Categoria cancellata', + 'emptied' => 'Categoria svuotata', + 'error' => 'Categoria non aggiornata', + 'name_exists' => 'Categoria già esistente.', + 'no_id' => 'Categoria senza ID.', + 'no_name' => 'Il nome della categoria non può essere lasciato vuoto.', + 'not_delete_default' => 'Non puoi cancellare la categoria predefinita!', + 'not_exist' => 'La categoria non esite!', + 'over_max' => 'Hai raggiunto il numero limite di categorie (%d)', + 'updated' => 'Categoria aggiornata.', + ), + 'feed' => array( + 'actualized' => '%s aggiornato', + 'actualizeds' => 'RSS feeds aggiornati', + 'added' => 'RSS feed %s aggiunti', + 'already_subscribed' => 'Hai già sottoscritto %s', + 'deleted' => 'Feed cancellato', + 'error' => 'Feed non aggiornato', + 'internal_problem' => 'RSS feed non aggiunto. Verifica i logs per dettagli.', + 'invalid_url' => 'URL %s non valido', + 'marked_read' => 'Feeds segnati come letti', + 'n_actualized' => '%d feeds aggiornati', + 'n_entries_deleted' => '%d articoli cancellati', + 'no_refresh' => 'Nessun aggiornamento disponibile…', + 'not_added' => '%s non può essere aggiunto', + 'over_max' => 'Hai raggiunto il numero limite di feed (%d)', + 'updated' => 'Feed aggiornato', + ), + 'purge_completed' => 'Svecchiamento completato (%d articoli cancellati)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS verrà aggiornato alla versione %s.', + 'error' => 'Il processo di aggiornamento ha riscontrato il seguente errore: %s', + 'file_is_nok' => 'Verifica i permessi della cartella %s. Il server HTTP deve avere i permessi per la scrittura ', + 'finished' => 'Aggiornamento completato con successo!', + 'none' => 'Nessun aggiornamento disponibile', + 'server_not_found' => 'Server per aggiornamento non disponibile. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Utente %s creato', + 'error' => 'Errore nella creazione utente %s ', + ), + 'deleted' => array( + '_' => 'Utente %s cancellato', + 'error' => 'Utente %s non cancellato', + ), + ), + 'profile' => array( + 'error' => 'Il tuo profilo non può essere modificato', + 'updated' => 'Il tuo profilo è stato modificato', + ), +); -- cgit v1.2.3 From 78a7586e205cae03e5468561d3a4a1b0012557dd Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:12:14 +0200 Subject: Create gen.php --- app/i18n/it/gen.php | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 app/i18n/it/gen.php (limited to 'app') diff --git a/app/i18n/it/gen.php b/app/i18n/it/gen.php new file mode 100644 index 000000000..eb545b8cf --- /dev/null +++ b/app/i18n/it/gen.php @@ -0,0 +1,180 @@ + array( + 'actualize' => 'Aggiorna', + 'back_to_rss_feeds' => '← Indietro', + 'cancel' => 'Annulla', + 'create' => 'Crea', + 'disable' => 'Disabilita', + 'empty' => 'Vuoto', + 'enable' => 'Abilita', + 'export' => 'Esporta', + 'filter' => 'Filtra', + 'import' => 'Importa', + 'manage' => 'Gestisci', + 'mark_read' => 'Segna come letto', + 'mark_favorite' => 'Segna come preferito', + 'remove' => 'Rimuovi', + 'see_website' => 'Vai al sito', + 'submit' => 'Conferma', + 'truncate' => 'Cancella tutti gli articoli', + ), + 'auth' => array( + 'email' => 'Indirizzo email', + 'keep_logged_in' => 'Ricorda i dati (1 mese)', + 'login' => 'Accedi', + 'login_persona' => 'Accedi con Mozilla Persona', + 'login_persona_problem' => 'Problemi di connessione con Mozilla Persona?', + 'logout' => 'Esci', + 'password' => array( + '_' => 'Password', + 'format' => 'almeno 7 caratteri', + ), + 'registration' => array( + '_' => 'Nuovo profilo', + 'ask' => 'Vuoi creare un nuovo profilo?', + 'title' => 'Creazione profilo', + ), + 'reset' => 'Reset autenticazione', + 'username' => array( + '_' => 'Username', + 'admin' => 'Username amministratore', + 'format' => 'massimo 16 caratteri alfanumerici', + ), + 'will_reset' => 'Il sistema di autenticazione verrà resettato: un form verrà usato per Mozilla Persona.', + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l\\e', + 'Aug' => '\\A\\g\\o\\s\\t\\o', + 'Dec' => '\\D\\i\\c\\e\\m\\b\\r\\e', + 'Feb' => '\\F\\e\\b\\b\\r\\a\\i\\o', + 'Jan' => '\\G\\e\\n\\u\\a\\i\\o', + 'Jul' => '\\L\\u\\g\\l\\i\\o', + 'Jun' => '\\G\\i\\u\\g\\n\\o', + 'Mar' => '\\M\\a\\r\\z\\o', + 'May' => '\\M\\a\\g\\g\\i\\o', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\r\\e', + 'Oct' => '\\O\\t\\t\\o\\b\\r\\e', + 'Sep' => '\\S\\e\\t\\t\\e\\m\\b\\r\\e', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Meno recenti', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => 'j\\ %s Y', + 'format_date_hour' => 'j\\ %s Y \\o\\r\\e H\\:i', + 'fri' => 'Fri', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Ultimi 3 mesi', + 'last_6_month' => 'Ultimi 6 mesi', + 'last_month' => 'Ultimo mese', + 'last_week' => 'Ultima settimana', + 'last_year' => 'Ultimo anno', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'mon' => 'Mon', + 'month' => 'mesi', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'oct', + 'october' => 'Oct', + 'sat' => 'Sat', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Oggi', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Ieri', + ), + 'freshrss' => array( + '_' => 'Feed RSS Reader', + 'about' => 'Informazioni', + ), + 'js' => array( + 'category_empty' => 'Categoria vuota', + 'confirm_action' => 'Sei sicuro di voler continuare?', + 'confirm_action_feed_cat' => 'Sei sicuro di voler continuare? Verranno persi i preferiti e le ricerche utente correlate!', + 'feedback' => array( + 'body_new_articles' => 'Ci sono \\d nuovi articoli da leggere.', + 'request_failed' => 'Richiesta fallita, probabilmente a causa di problemi di connessione', + 'title_new_articles' => 'Feed RSS Reader: nuovi articoli!', + ), + 'new_article' => 'Sono disponibili nuovi articoli, clicca qui per caricarli.', + 'should_be_activated' => 'JavaScript deve essere abilitato', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'admin' => 'Amministrazione', + 'archiving' => 'Archiviazione', + 'authentication' => 'Autenticazione', + 'check_install' => 'Installazione', + 'configuration' => 'Configurazione', + 'display' => 'Visualizzazione', + 'extensions' => 'Estensioni', + 'logs' => 'Logs', + 'queries' => 'Ricerche personali', + 'reading' => 'Lettura', + 'search' => 'Ricerca parole o #tags', + 'sharing' => 'Condivisione', + 'shortcuts' => 'Comandi tastiera', + 'stats' => 'Statistiche', + 'system' => 'Configurazione sistema', + 'update' => 'Aggiornamento', + 'user_management' => 'Gestione utenti', + 'user_profile' => 'Profilo', + ), + 'pagination' => array( + 'first' => 'Prima', + 'last' => 'Ultima', + 'load_more' => 'Carica altri articoli', + 'mark_all_read' => 'Segna tutto come letto', + 'next' => 'Successiva', + 'nothing_to_load' => 'Non ci sono altri articoli', + 'previous' => 'Precedente', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'short' => array( + 'attention' => 'Attenzione!', + 'blank_to_disable' => 'Lascia vuoto per disabilitare', + 'by_author' => 'di %s', + 'by_default' => 'predefinito', + 'damn' => 'Ops!', + 'default_category' => 'Senza categoria', + 'no' => 'No', + 'not_applicable' => 'Non disponibile', + 'ok' => 'OK!', + 'or' => 'o', + 'yes' => 'Si', + ), +); -- cgit v1.2.3 From 30fe1a152175ad01c8748fb767f42f1eda117b33 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:12:33 +0200 Subject: Create index.php --- app/i18n/it/index.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/i18n/it/index.php (limited to 'app') diff --git a/app/i18n/it/index.php b/app/i18n/it/index.php new file mode 100644 index 000000000..584b044b1 --- /dev/null +++ b/app/i18n/it/index.php @@ -0,0 +1,61 @@ + array( + '_' => 'Informazioni', + 'agpl3' => 'AGPL 3', + 'bugs_reports' => 'Bugs', + 'credits' => 'Crediti', + 'credits_content' => 'Alcuni elementi di design provengono da Bootstrap sebbene FreshRSS non usi questo framework. Le icone provengono dal progetto GNOME. Il carattere Open Sans è stato creato da Steve Matteson. Le Favicons vengono estratte con le API getFavicon. FreshRSS è basato su Minz, un framework PHP.', + 'freshrss_description' => 'FreshRSS è un aggregatore di feeds RSS da installare sul proprio host come Kriss Feed o Leed. Leggero e facile da mantenere pur essendo molto configurabile e potente.', + 'github' => 'su Github', + 'license' => 'Licenza', + 'project_website' => 'Sito del progetto', + 'title' => 'Informazioni', + 'version' => 'Versione', + 'website' => 'Sito', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'empty' => 'Non ci sono articoli da mostrare.', + 'rss_of' => 'RSS feed di %s', + 'title' => 'RSS feeds', + 'title_global' => 'Vista globale per categorie', + 'title_fav' => 'Preferiti', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Svuota logs', + 'empty' => 'File di log vuoto', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'add_query' => 'Aggiungi ricerca', + 'before_one_day' => 'Giorno precedente', + 'before_one_week' => 'Settimana precedente', + 'favorites' => 'Preferiti (%s)', + 'global_view' => 'Vista globale per categorie', + 'main_stream' => 'Flusso principale', + 'mark_all_read' => 'Segna tutto come letto', + 'mark_cat_read' => 'Segna la categoria come letta', + 'mark_feed_read' => 'Segna il feed come letto', + 'newer_first' => 'Mostra prima i recenti', + 'non-starred' => 'Escludi preferiti', + 'normal_view' => 'Vista elenco', + 'older_first' => 'Ordina per meno recenti', + 'queries' => 'Chiavi di ricerca', + 'read' => 'Mostra solo letti', + 'reader_view' => 'Modalità di lettura', + 'rss_view' => 'RSS feed', + 'search_short' => 'Cerca', + 'starred' => 'Mostra solo preferiti', + 'stats' => 'Statistiche', + 'subscription' => 'Gestione sottoscrizioni', + 'unread' => 'Mostra solo non letti', + ), + 'share' => 'Condividi', + 'tag' => array( + 'related' => 'Tags correlati', + ), +); -- cgit v1.2.3 From 64953e6b5cb8ec287bcb9f28882bdb2d338bfebd Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:12:51 +0200 Subject: Create sub.php --- app/i18n/it/sub.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 app/i18n/it/sub.php (limited to 'app') diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php new file mode 100644 index 000000000..dfcee2ce3 --- /dev/null +++ b/app/i18n/it/sub.php @@ -0,0 +1,62 @@ + array( + '_' => 'Categoria', + 'add' => 'Aggiungi una categoria', + 'empty' => 'Categoria vuota', + 'new' => 'Nuova categoria', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'advanced' => 'Avanzate', + 'archiving' => 'Archiviazione', + 'auth' => array( + 'configuration' => 'Autenticazione', + 'help' => 'Accesso per feeds protetti', + 'http' => 'Autenticazione HTTP', + 'password' => 'HTTP password', + 'username' => 'HTTP username', + ), + 'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)', + 'css_path' => 'Percorso del foglio di stile CSS del sito di origine', + 'description' => 'Descrizione', + 'empty' => 'Questo feed non contiene articoli. Per favore verifica il sito direttamente.', + 'error' => 'Questo feed ha generato un errore. Per favore verifica se ancora disponibile.', + 'in_main_stream' => 'Mostra in homepage', + 'informations' => 'Informazioni', + 'keep_history' => 'Numero minimo di articoli da mantenere', + 'moved_category_deleted' => 'Cancellando una categoria i feed al suo interno verranno classificati automaticamente come %s.', + 'no_selected' => 'Nessun feed selezionato.', + 'number_entries' => '%d articoli', + 'stats' => 'Statistiche', + 'think_to_add' => 'Aggiungi feed.', + 'title' => 'Titolo', + 'title_add' => 'Aggiungi RSS feed', + 'ttl' => 'Non aggiornare automaticamente piu di', + 'url' => 'Feed URL', + 'validator' => 'Controlla la validita del feed ', + 'website' => 'URL del sito', + 'pubsubhubbub' => 'Notifica istantanea con PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Esporta', + 'export_opml' => 'Esporta tutta la lista dei feed (OPML)', + 'export_starred' => 'Esporta i tuoi preferiti', + 'feed_list' => 'Elenco di %s articoli', + 'file_to_import' => 'File da importare
      (OPML, Json o Zip)', + 'file_to_import_no_zip' => 'File da importare
      (OPML o Json)', + 'import' => 'Importa', + 'starred_list' => 'Elenco articoli preferiti', + 'title' => 'Importa / esporta', + ), + 'menu' => array( + 'bookmark' => 'Bookmark (trascina nei preferiti)', + 'import_export' => 'Importa / esporta', + 'subscription_management' => 'Gestione sottoscrizioni', + ), + 'title' => array( + '_' => 'Gestione sottoscrizioni', + 'feed_management' => 'Gestione RSS feeds', + ), +); -- cgit v1.2.3 From 7be1dde4e09676b87493e0124d43c82a2de3bc7f Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:36:17 +0200 Subject: Update gen.php --- app/i18n/cz/gen.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index d3e93c0a1..f549eaaea 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'it' => 'Italian', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From 0a0ae09d02db2da8cf83e848feea999e9148a9fc Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:36:37 +0200 Subject: Update gen.php --- app/i18n/de/gen.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 38beb5016..50eaed1c5 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'it' => 'Italian', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From 89965d656c2f56fb6adc9d7440eae6b9ca04b7d9 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:37:02 +0200 Subject: Update gen.php --- app/i18n/en/gen.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index b71af91f1..785ab0279 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'it' => 'Italian', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From b4f80f96119fd8c3e8ab8f70c2ad55224bad2a59 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:37:21 +0200 Subject: Update gen.php --- app/i18n/fr/gen.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index f09c73ca1..2a83a14dd 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'it' => 'Italian', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From fe21c0bb5cc544cb89d207b50e17e44907a14133 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Oct 2015 15:37:38 +0200 Subject: Update gen.php --- app/i18n/nl/gen.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index ed57669a1..f33438702 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -120,6 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', + 'it' => 'Italian', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From f4a0bb25e20552fae109689cfab13e2c09c3f48a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 24 Oct 2015 21:48:29 +0200 Subject: i18n: Italiano https://github.com/FreshRSS/FreshRSS/issues/1003 --- app/i18n/cz/gen.php | 2 +- app/i18n/de/gen.php | 2 +- app/i18n/en/gen.php | 2 +- app/i18n/fr/gen.php | 2 +- app/i18n/nl/gen.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index 6b89cf627..ffc138abb 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -120,7 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'it' => 'Italian', + 'it' => 'Italiano', 'nl' => 'Nederlands', ), 'menu' => array( diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index 6e5dc7c3f..842383498 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -120,7 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'it' => 'Italian', + 'it' => 'Italiano', 'nl' => 'Nederlands', ), 'menu' => array( diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index c9a7e2d4e..d23b12f95 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -120,7 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'it' => 'Italian', + 'it' => 'Italiano', 'nl' => 'Nederlands', ), 'menu' => array( diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index fc16c74ab..2f16f09b9 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -120,7 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'it' => 'Italian', + 'it' => 'Italiano', 'nl' => 'Nederlands', ), 'menu' => array( diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index f61cb638b..b8467f92f 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -120,7 +120,7 @@ return array( 'de' => 'Deutsch', 'en' => 'English', 'fr' => 'Français', - 'it' => 'Italian', + 'it' => 'Italiano', 'nl' => 'Nederlands', ), 'menu' => array( -- cgit v1.2.3 From 481c2a671913cdd6099a1b6ee4d5491dff16c0bf Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 24 Oct 2015 22:25:48 +0200 Subject: Clean logs Reduced login of API and PubSubHubbub (both are quite stable now). When clearing logs as admin, also clear API and PubSubHubbub logs. https://github.com/FreshRSS/FreshRSS/issues/988 --- app/Controllers/feedController.php | 4 ++-- app/Models/LogDAO.php | 5 +++++ p/api/greader.php | 38 +++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 21 deletions(-) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index ec3dce777..4ec661115 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -307,9 +307,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $pubSubHubbubEnabled = $pubsubhubbubEnabledGeneral && $feed->pubSubHubbubEnabled(); if ((!$simplePiePush) && (!$id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { - $text = 'Skip pull of feed using PubSubHubbub: ' . $url; + //$text = 'Skip pull of feed using PubSubHubbub: ' . $url; //Minz_Log::debug($text); - file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + //file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); continue; //When PubSubHubbub is used, do not pull refresh so often } diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php index 4c56e3150..ab258cd58 100644 --- a/app/Models/LogDAO.php +++ b/app/Models/LogDAO.php @@ -21,5 +21,10 @@ class FreshRSS_LogDAO { public static function truncate() { file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), ''); + if (FreshRSS_Auth::hasAccess('admin')) { + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_api.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_pshb.txt'), ''); + } } } diff --git a/p/api/greader.php b/p/api/greader.php index 5a23af006..b9942f0bc 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -77,7 +77,7 @@ class MyPDO extends Minz_ModelPdo { } function logMe($text) { - file_put_contents(join_path(USERS_PATH, '_', 'log_api.txt'), $text, FILE_APPEND); + file_put_contents(join_path(USERS_PATH, '_', 'log_api.txt'), date('c') . "\t" . $text . "\n", FILE_APPEND); } function debugInfo() { @@ -96,7 +96,7 @@ function debugInfo() { } function badRequest() { - logMe("badRequest()\n"); + logMe("badRequest()"); logMe(debugInfo()); header('HTTP/1.1 400 Bad Request'); header('Content-Type: text/plain; charset=UTF-8'); @@ -104,7 +104,7 @@ function badRequest() { } function unauthorized() { - logMe("unauthorized()\n"); + logMe("unauthorized()"); logMe(debugInfo()); header('HTTP/1.1 401 Unauthorized'); header('Content-Type: text/plain; charset=UTF-8'); @@ -113,7 +113,7 @@ function unauthorized() { } function notImplemented() { - logMe("notImplemented()\n"); + logMe("notImplemented()"); logMe(debugInfo()); header('HTTP/1.1 501 Not Implemented'); header('Content-Type: text/plain; charset=UTF-8'); @@ -121,14 +121,14 @@ function notImplemented() { } function serviceUnavailable() { - logMe("serviceUnavailable()\n"); + logMe("serviceUnavailable()"); header('HTTP/1.1 503 Service Unavailable'); header('Content-Type: text/plain; charset=UTF-8'); die('Service Unavailable!'); } function checkCompatibility() { - logMe("checkCompatibility()\n"); + logMe("checkCompatibility()"); header('Content-Type: text/plain; charset=UTF-8'); if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) { die('FAIL 64-bit or GMP extension!'); @@ -159,7 +159,7 @@ function authorizationToUser() { if ($headerAuthX[1] === sha1($system_conf->salt . $user . $conf->apiPasswordHash)) { return $user; } else { - logMe('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1] . "\n"); + logMe('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1]); Minz_Log::warning('Invalid API authorisation for user ' . $user . ': ' . $headerAuthX[1]); unauthorized(); } @@ -172,7 +172,7 @@ function authorizationToUser() { } function clientLogin($email, $pass) { //http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html - logMe('clientLogin(' . $email . ")\n"); + //logMe('clientLogin(' . $email . ")"); if (ctype_alnum($email)) { if (!function_exists('password_verify')) { include_once(LIB_PATH . '/password_compat.php'); @@ -205,7 +205,7 @@ function token($conf) { //http://blog.martindoms.com/2009/08/15/using-the-google-reader-api-part-1/ //https://github.com/ericmann/gReader-Library/blob/master/greader.class.php $user = Minz_Session::param('currentUser', '_'); - logMe('token('. $user . ")\n"); //TODO: Implement real token that expires + //logMe('token('. $user . ")"); //TODO: Implement real token that expires $system_conf = Minz_Configuration::get('system'); $token = str_pad(sha1($system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z'); //Must have 57 characters echo $token, "\n"; @@ -215,7 +215,7 @@ function token($conf) { function checkToken($conf, $token) { //http://code.google.com/p/google-reader-api/wiki/ActionToken $user = Minz_Session::param('currentUser', '_'); - logMe('checkToken(' . $token . ")\n"); + //logMe('checkToken(' . $token . ")"); $system_conf = Minz_Configuration::get('system'); if ($token === str_pad(sha1($system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z')) { return true; @@ -224,7 +224,7 @@ function checkToken($conf, $token) { } function tagList() { - logMe("tagList()\n"); + //logMe("tagList()"); header('Content-Type: application/json; charset=UTF-8'); $pdo = new MyPDO(); @@ -249,7 +249,7 @@ function tagList() { } function subscriptionList() { - logMe("subscriptionList()\n"); + //logMe("subscriptionList()"); header('Content-Type: application/json; charset=UTF-8'); $pdo = new MyPDO(); @@ -283,7 +283,7 @@ function subscriptionList() { } function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count - logMe("unreadCount()\n"); + //logMe("unreadCount()"); header('Content-Type: application/json; charset=UTF-8'); $totalUnreads = 0; @@ -330,7 +330,7 @@ function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-googl function streamContents($path, $include_target, $start_time, $count, $order, $exclude_target, $continuation) { //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - logMe("streamContents($path, $include_target, $start_time, $count, $order, $exclude_target, $continuation)\n"); + //logMe("streamContents($path, $include_target, $start_time, $count, $order, $exclude_target, $continuation)"); header('Content-Type: application/json; charset=UTF-8'); $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -436,7 +436,7 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude //http://code.google.com/p/google-reader-api/wiki/ApiStreamItemsIds //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - logMe("streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target)\n"); + //logMe("streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target)"); $type = 'A'; $id = ''; @@ -484,7 +484,7 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude } function editTag($e_ids, $a, $r) { - logMe("editTag()\n"); + //logMe("editTag()"); foreach ($e_ids as $i => $e_id) { $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' @@ -520,7 +520,7 @@ function editTag($e_ids, $a, $r) { } function markAllAsRead($streamId, $olderThanId) { - logMe("markAllAsRead($streamId, $olderThanId)\n"); + //logMe("markAllAsRead($streamId, $olderThanId)"); $entryDAO = FreshRSS_Factory::createEntryDao(); if (strpos($streamId, 'feed/') === 0) { $f_id = basename($streamId); @@ -538,7 +538,7 @@ function markAllAsRead($streamId, $olderThanId) { exit(); } -logMe('----------------------------------------------------------------'."\n"); +//logMe('----------------------------------------------------------------'); //logMe(debugInfo()); $pathInfo = empty($_SERVER['PATH_INFO']) ? '/Error' : urldecode($_SERVER['PATH_INFO']); @@ -560,7 +560,7 @@ if ($user !== '') { $conf = get_user_configuration($user); } -logMe('User => ' . $user . "\n"); +//logMe('User => ' . $user); Minz_Session::_param('currentUser', $user); -- cgit v1.2.3 From 02a3cb4652d4c87ec3202d39f6cd8a240a1a7373 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 24 Oct 2015 23:47:13 +0200 Subject: Config allow robots https://github.com/FreshRSS/FreshRSS/issues/938 --- app/Models/Context.php | 13 +++++++++++-- app/layout/layout.phtml | 4 ++++ data/config.default.php | 3 +++ index.html | 2 +- p/index.html | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/Models/Context.php b/app/Models/Context.php index dbdbfaa69..d8dd81e88 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -10,6 +10,7 @@ class FreshRSS_Context { public static $categories = array(); public static $name = ''; + public static $description = ''; public static $total_unread = 0; public static $total_starred = array( @@ -93,6 +94,13 @@ class FreshRSS_Context { } } + /** + * Return true iif the current requests target a feed and not a category or all articles. + */ + public static function isFeed() { + return self::$current_get['feed'] != false; + } + /** * Return true if $get parameter correspond to the $current_get attribute. */ @@ -146,8 +154,8 @@ class FreshRSS_Context { self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE; break; case 'f': - // We try to find the corresponding feed. - $feed = FreshRSS_CategoryDAO::findFeed(self::$categories, $id); + // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description + $feed = FreshRSS_Context::$system_conf->allow_robots ? null : FreshRSS_CategoryDAO::findFeed(self::$categories, $id); if ($feed === null) { $feedDAO = FreshRSS_Factory::createFeedDao(); $feed = $feedDAO->searchById($id); @@ -160,6 +168,7 @@ class FreshRSS_Context { self::$current_get['feed'] = $id; self::$current_get['category'] = $feed->category(); self::$name = $feed->name(); + self::$description = $feed->description(); self::$get_unread = $feed->nbNotRead(); break; case 'c': diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 083ffd4b3..d7e9d115b 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -36,7 +36,11 @@ +allow_robots) { ?> + + + partial('header'); ?> diff --git a/data/config.default.php b/data/config.default.php index a7a29b12c..8eccee8a5 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -61,6 +61,9 @@ return array( # /!\ It should NOT be enabled if base_url is not reachable by an external server. 'pubsubhubbub_enabled' => false, + # Allow or not Web robots (e.g. search engines) in HTML headers. + 'allow_robots' => false, + 'limits' => array( # Duration in seconds of the SimplePie cache, diff --git a/index.html b/index.html index 6ac025960..5414211a1 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Redirection - + diff --git a/p/index.html b/p/index.html index 260f437bd..ef5cb87ce 100644 --- a/p/index.html +++ b/p/index.html @@ -8,7 +8,7 @@ - +