firmware.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <table id="models">
  2. <thead>
  3. <tr>
  4. <th width="150">Modell</th>
  5. <th>Erstinstallation</th>
  6. <th>Aktualisierung</th>
  7. </tr>
  8. </thead>
  9. <tbody>
  10. <?php
  11. $modelsfile = 'https://firmware.ffho.net/models.json';
  12. $lines = file($modelsfile);
  13. foreach($lines as $line)
  14. $data .= $line;
  15. $data = json_decode($data, $assoc=TRUE);
  16. ksort($data);
  17. function linkOpenwrt($model) {
  18. print '<a href="https://openwrt.org/start?do=search&q=';
  19. print $model['vendor'].'/'.$model['model'];
  20. print '" target="_new">Info</a>';
  21. }
  22. function linkFirmware($model, $factory=False) {
  23. print '<a href="https://firmware.ffho.net/stable/';
  24. if ($factory)
  25. print 'factory';
  26. else
  27. print 'sysupgrade';
  28. print '/gluon-ffho-'.$model['imageversion'].'-'.$model['firmware'];
  29. if (!$factory)
  30. print '-sysupgrade';
  31. print '.'.$model['imagetype'];
  32. print '" target="_new">';
  33. if ($factory)
  34. print 'Erstinstallation';
  35. else
  36. if ($model['factory'])
  37. print 'Updatefile';
  38. else
  39. print 'Erstinstallation / Updatefile';
  40. print '</a>';
  41. }
  42. foreach (array_keys($data) as $vendor) {
  43. print '<tr><th colspan="3">'.$vendor."</th></tr>\n";
  44. $models = $data[$vendor];
  45. ksort($models);
  46. foreach ($models as $model) {
  47. print '<tr><td>'.$model['model'].'<br>'.linkInfo($model).'</td><td>';
  48. if ($model['factory'] == True) {
  49. linkFirmware($model, True);
  50. }
  51. print '</td><td>';
  52. linkFirmware($model);
  53. print "</td></tr>\n";
  54. }
  55. }
  56. ?>
  57. </tbody>
  58. </table>