diff --git a/index.php b/index.php index 0ca1538b..3cc0120a 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,6 @@ date_default_timezone_set('UTC'); error_reporting(0); //ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only. - // extensions check if (!extension_loaded('openssl')) die('"openssl" extension not loaded. Please check "php.ini"'); @@ -24,8 +23,6 @@ if (!extension_loaded('openssl')) ini_set('user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20121202 Firefox/30.0 (rss-bridge/0.1; +https://github.com/sebsauvage/rss-bridge)'); // ------- - - // default whitelist $whitelist_file = './whitelist.txt'; $whitelist_default = array( @@ -122,6 +119,84 @@ function getHelperButtonFormat($value, $name){ return ''; } +function getHelperButtonsFormat($formats){ + $buttons = ''; + foreach( $formats as $name => $infos ) + { + if ( isset($infos['name']) ) + { + $buttons .= getHelperButtonFormat($name, $infos['name']) . PHP_EOL; + } + } + return $buttons; +} + +function displayBridgeCard($bridgeReference, $bridgeInformations, $formats, $isActive = true) +{ + $name = isset($bridgeInformations['homepage']) ? ''.$bridgeInformations['name'].'' : $bridgeInformations['name']; + $description = isset($bridgeInformations['description']) ? $bridgeInformations['description'] : 'No description provided'; + $card = << +

{$name}

+

+ {$description} +

+CARD; + if( isset($bridgeInformations['use']) && count($bridgeInformations['use']) > 0 ) + { + $card .= '
    ' . PHP_EOL; + foreach($bridgeInformations['use'] as $anUseNum => $anUse) + { + $card .= '
  1. ' . PHP_EOL; + $card .= '
    + + ' . PHP_EOL; + + foreach($anUse as $argName => $argDescription) + { + $idArg = 'arg-' . $bridgeReference . '-' . $anUseNum . '-' . $argName; + $card .= '' . PHP_EOL; + } + + $card .= '
    '; + + if ($isActive) + { + $card .= getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; + } + + $card .= '
  2. ' . PHP_EOL; + } + $card .= '
' . PHP_EOL; + } + else + { + $card .= '
+ + ' . PHP_EOL; + + if ($isActive) + { + $card .= getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; + } + $card .= '
' . PHP_EOL; + } + + + $card .= isset($bridgeInformations['maintainer']) ? ''.$bridgeInformations['maintainer'].'' : ''; + $card .= ''; + + return $card; +} + $bridges = Bridge::searchInformation(); $formats = Format::searchInformation(); ?> @@ -144,49 +219,27 @@ $formats = Format::searchInformation();

RSS-Bridge

·Reconnecting the Web·

- - $bridgeInformations): ?> - -
-

'.$bridgeInformations['name'].'' : $bridgeInformations['name'] ?>

-

- -

- - 0 ): ?> -
    - $anUse): ?> -
  1. -
    - - - $argDescription): ?> - - - - $infos ): ?> - - -
    -
  2. - -
- -
- - - $infos ): ?> - - -
- - '.$bridgeInformations['maintainer'].'' : '' ?> -
- + $bridgeInformations) + { + if(BridgeWhitelist($whitelist_selection, $bridgeReference)) + { + echo displayBridgeCard($bridgeReference, $bridgeInformations, $formats); + $activeFoundBridgeCount++; + } + elseif ($showInactive) + { + // inactive bridges + $inactiveBridges .= displayBridgeCard($bridgeReference, $bridgeInformations, $formats, false) . PHP_EOL; + } + } + echo '
' . $inactiveBridges; + ?>