1
0
Fork 0
forked from blallo/rss-bridge
Commit graph

109 commits

Author SHA1 Message Date
logmanoriginal
99e7e7876e exception: Use built-in HTTP response codes
PHP >= 5.4 provides a built-in function to generate valid HTTP
error header including the error description: http_response_code()

See: http://php.net/manual/en/function.http-response-code.php
See also: https://stackoverflow.com/a/12018482

This commit removes the '\Http' utility class and replaces all
calls to 'Http::getMessageForCode()' by 'http_response_code()'
2017-08-06 12:55:11 +02:00
logmanoriginal
84d2c02a09 whitelist: Do case-insensitive whitelist matching
Matching whitelisted bridges using a case-insensitive match makes
sense for following reasons:

- Wrong upper/lower case spelling in the whitelist is not easily
discovered. Example: Misspelling 'Youtube' as 'YouTube' will not
show the 'Youtube' bridge (while it is expected to show)

- Two bridges with the same name but different letter casing are
discouraged to prevent confusion and keep the project compatible
with Windows machines
2017-08-06 00:01:32 +02:00
logmanoriginal
ccd8af09b9 [index] Use single quotes instead of double quotes 2017-08-05 15:46:16 +02:00
logmanoriginal
f2d02a4187 [index] Simplify debug mode detection
This removes superfluous variables and if-statements when checking
whether the debug mode is active or not.
2017-08-05 15:43:48 +02:00
logmanoriginal
f19d34a5a1 [index] Check permissions for cache folder and whitelist file
* The cache folder requires write permissions at all times
* The whitelist file requires write permissions if it does not
exist (can be created manually)
2017-08-05 15:23:30 +02:00
logmanoriginal
f1534c91e2 [index] Use constant instead of variable for the whitelist file path
Like the cache folder the whitelist file is assumed static and thus
should be defined as constant.
2017-08-05 15:23:08 +02:00
logmanoriginal
f7265ca77b [index] Bump version number 2017-08-03 20:51:59 +02:00
logmanoriginal
a4b9611e66 [phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis

  // Wrong
  if( !is_null($var) ) {
    ...
  }

  // Right
  if(!is_null($var)) {
    ...
  }

- Add space after closing parenthesis

  // Wrong
  if(true){
    ...
  }

  // Right
  if(true) {
    ...
  }

- Add body into new line
- Close body in new line

  // Wrong
  if(true) { ... }

  // Right
  if(true) {
    ...
  }

Notice: Spaces after keywords are not detected:

  // Wrong (not detected)
  // -> space after 'if' and missing space after 'else'
  if (true) {
    ...
  } else{
    ...
  }

  // Right
  if(true) {
    ...
  } else {
    ...
  }
2017-07-29 19:55:12 +02:00
LogMANOriginal
38b56bf23a [index] Improve error handling (#555)
Add additional information to error message:

- Name of the bridge
- Possible solutions
- Error description
- Error code
- Error message

* Output type changed from 'text' to 'html'
* Added styles for the error page
* Added a button to remotely open a GitHub issue

Closes #525
2017-07-29 19:16:16 +02:00
Teromene
1a4c3f4418 Add a search bar to simplify looking for a bridge. (#494)
* Add a search bar to simplify looking for a bridge.

* Fix phpcs line length.

* Change the phpcs config.
2017-03-21 20:31:10 +00:00
Teromene
c803396d7e Correct phpcs check. 2017-03-09 22:27:14 +00:00
Teromene
ac518ca297 Fix line return in user-agent. 2017-03-08 11:47:55 +00:00
Teromene
1763a1518c Restore the ability to whitelist all the bridges by putting a wildcard into the whitelist file. 2017-03-08 10:56:39 +00:00
logmanoriginal
ff83410534 style: Fix coding styles 2017-02-14 17:28:07 +01:00
Badet Aurélien
c702a0e69f Bridge getExtraInfos (#432)
* add function getExtraInfos() to BridgeAbstract

* replace call to $bridge->getName() and $bridge->getURI() by $bridge->getExtraInfos()

replace call to $bridge->getName() and $bridge->getURI() by $bridge->getExtraInfos() defined by default in BridgeAbstract.
So we could pass additionals ExtraInfos from custom bridges to custom formats.
2016-11-29 00:48:59 +00:00
logmanoriginal
d39c1ed63a [index] Add check for 'allow_url_fopen' 2016-11-05 13:09:20 +01:00
logmanoriginal
04a195361a [index] Add check for 'libxml' extension 2016-11-05 13:05:28 +01:00
logmanoriginal
3bcd98404b [index] Add check for correct PHP version 2016-11-05 13:02:48 +01:00
logmanoriginal
5790ebc6ba [index] Initialize variable before using it 2016-10-20 22:12:54 +02:00
logmanoriginal
85149add61 [index] Fixes a bug where requests could result in same cache file names
Previously the cache file name was only build upon bridge
parameters. If two bridges don't make use of any parameter
this would result into equal file names.
2016-10-20 22:03:23 +02:00
logmanoriginal
8fb4db8914 [index] Introduce CACHE_DIR 2016-10-08 16:21:00 +02:00
logmanoriginal
5c309e93dc [cache] Specify cache duration for 'purgeCache' 2016-10-08 16:18:10 +02:00
logmanoriginal
2d56b717cf [FileCache] Add property to define cache folder 2016-10-08 16:03:08 +02:00
logmanoriginal
5de4a59d41 [index] Initialize cache before loading to bridge
Previously BridgeAbstract needed to know which exact implementation
of CacheInterface was used (since we only got one right now its
not a problem). Initializing the cache in index.php instead allows
to change cache types more easily.
2016-10-08 15:29:21 +02:00
logmanoriginal
9ac678aac5 [Cache] Move 'purge' function to implementations
The purge function is cache specific and thus belongs
to the specific implementation.
2016-10-07 22:33:45 +02:00
logmanoriginal
b61ea84950 [index] Show debug status on main page 2016-10-02 18:43:20 +02:00
logmanoriginal
b32cfd5dc3 [index] Explicitly define DEBUG with Boolean value 2016-10-02 17:16:21 +02:00
logmanoriginal
978e5cdbf5 [index] Define cache even in DEBUG mode 2016-10-02 16:43:08 +02:00
Pierre Mazière
747be13849 [core] extract HTMLUtils methods to make them functions
Methods displayBridgeCard, sanitize, defaultImageSrcTo are now
functions in lib/html.php
getHelperButtinsFormat and getFormHeader are now anonymous functions
defined in displayBridgeCard

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-25 23:58:52 +02:00
Pierre Mazière
f1fb95b257 [core] extract BridgeAbstract methods to make them functions
- returnError, returnServerError, returnClientError ,debugMessage are
  moved to lib/error.php

- getContents, getSimpleHTMLDOM, getSimpleHTMLDOMCached are moved to
  lib/contents.php

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-25 23:22:33 +02:00
logmanoriginal
3438b96197 [index] Fix another github URL 2016-09-17 20:21:48 +02:00
Pierre Mazière
2ca7129e22 [core] fix user agent url to rss-bridge github project
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-17 19:37:41 +02:00
logmanoriginal
e3392a738b [phpcs] Remove check for Zend OperatorSpacing
This check is not helping as code is quite readable
2016-09-10 21:05:29 +02:00
logmanoriginal
ab16af631e [core] Apply some fixes 2016-09-10 21:01:02 +02:00
logmanoriginal
a84016bcb6 [core] Rename item getter/setter
getDatas -> getItems
setDatas -> setItems

Note: Bridge->setDatas actually sets data, where Bridge->getItems
only returns items (this is why Bridge->setDatas was not changed)
2016-08-29 19:42:58 +02:00
Pierre Mazière
de1b39c8e5 [core + bridges] get rid of loadMetadata
if a bridge needs to modify some of the data that were initialized
there, ::__construct() should be used instead.

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-28 13:05:03 +02:00
Pierre Mazière
2670a0e400 [core] get parameters from $_GET rather than $_REQUEST
No need to play with parameters that RSS-Bridge did not ask for

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-25 17:28:47 +02:00
Pierre Mazière
1bb94aecc6 [core] leave $_REQUEST alone
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-25 01:07:49 +02:00
Pierre Mazière
b31b6667f6 [core] fix missing filter_input
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-23 17:22:51 +02:00
Pierre Mazière
3c089c1b11 [core] keep compatibility with nameBridge and nameFormat naming scheme
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-23 16:10:26 +02:00
Pierre Mazière
7e0ac1a6b6 [core] better use of filter_input
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-23 14:42:53 +02:00
Pierre Mazière
0a86d572c2 [core] simplify cache related code and remove misleading comment
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-23 14:41:41 +02:00
Pierre Mazière
13285f080a [core] use filter_input() instead of direct access to $_REQUEST
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-23 14:22:02 +02:00
logmanoriginal
251d7646b7 [index] Fix loading of metadata
Re-introduces commit a1257126bc
2016-08-19 14:46:22 +02:00
Pierre Mazière
10cd3a61a9 check for PROXY_NAME definition before using it
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-19 10:20:27 +02:00
Pierre Mazière
d71674d2ba proxy settings must be the service provider decision
therefore, the provider decides if the service use a
proxy or not, and if users can have the possibility to
disable it on a bridge basis.

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-19 10:19:56 +02:00
Pierre Mazière
09d4e21bdc possibility to hide proxy address
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-19 10:19:56 +02:00
Pierre Mazière
3dd63ab6fd enable proxy usage for individual bridge
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-19 10:19:56 +02:00
logmanoriginal
c0b607c841 [index] Fix whitelist default array
WikipediaBridge recently replaced WikipediaENBridge,
WikipediaEOBridge and WikipediaFRBridge
2016-08-07 15:36:50 +02:00
logmanoriginal
3f83763ff9 [index] Don't render 'Show inactive bridges' if non inactive 2016-08-07 15:15:55 +02:00