Corrected default number of articles in CryptomeBridge.

The bridge was outputting a single entry when parameter n was empty.
This commit is contained in:
Sebastien SAUVAGE 2014-02-08 18:18:09 +01:00
parent a9d6fd3e46
commit 50a96a3f21

View file

@ -18,10 +18,11 @@ class CryptomeBridge extends BridgeAbstract{
//$link = 'https://secure.netsolhost.com/cryptome.org/'; //$link = 'https://secure.netsolhost.com/cryptome.org/';
$html = file_get_html($link) or $this->returnError('Could not request Cryptome.', 404); $html = file_get_html($link) or $this->returnError('Could not request Cryptome.', 404);
if (isset($param['n'])) { /* number of documents */ if (!empty($param['n'])) { /* number of documents */
$num = min(max(1, $param['n']+0), $num); $num = min(max(1, $param['n']+0), $num);
} }
foreach($html->find('pre') as $element) { foreach($html->find('pre') as $element) {
for ( $i = 0; $i < $num; ++$i ) { for ( $i = 0; $i < $num; ++$i ) {
$item = new \Item(); $item = new \Item();