LibreY

- privacy respecting meta search engine
git clone git://git.acid.vegas/LibreY.git
Log | Files | Refs | Archive | README | LICENSE

instances.php (1922B)

      1 <?php 
      2     require "misc/header.php";
      3     require "misc/tools.php";
      4             
      5     $instances_json = json_decode(file_get_contents("instances.json"), true);
      6 
      7     $librey_instances = array_filter($instances_json['instances'], fn($n) => $n['librey']);
      8     $librex_instances = array_filter($instances_json['instances'], fn($n) => !$n['librey']);
      9 
     10 
     11     function list_instances($instances) 
     12     {
     13         echo "<table><tr>";
     14         echo "<th>Clearnet</th>";
     15         echo "<th>Tor</th>";
     16         echo "<th>I2P</th>";
     17         echo "<th>Country</th>";
     18         echo "</tr>";
     19 
     20         foreach($instances as $instance) {
     21             $hostname = parse_url($instance["clearnet"])["host"];
     22             $country = get_country_emote($instance["country"]) . $instance["country"];
     23 
     24             $is_tor = !is_null($instance["tor"]);
     25             $is_i2p = !is_null($instance["i2p"]);
     26 
     27             echo "<tr>";
     28             echo "<td><a href=\"" . $instance["clearnet"] . "\">" . $hostname . "</a></td>";
     29 
     30             echo $is_tor
     31                 ? "<td><a href=\"" . $instance["tor"] . "\">\u{2705}</a></td>"
     32                 : "<td>\u{274C}</td>";
     33 
     34             echo $is_i2p
     35                 ? "<td><a href=\"" . $instance["i2p"] . "\">\u{2705}</a></td>"
     36                 :"<td>\u{274C}</td>";
     37 
     38             echo "<td>$country</td>";
     39             echo "</tr>";
     40         }
     41         echo "</table>";
     42     }
     43 ?>
     44     <title>LibreY - instances</title>
     45     </head>
     46     <body>
     47         <div class="misc-container">
     48         <center>
     49             <h2>Libre<span class="Y">Y</span> instances</h2>
     50             <?php
     51                 list_instances($librey_instances);
     52             ?>
     53 
     54                 <p><?php printftext("instances_librex", "<a href=\"https://github.com/hnhx/librex\">LibreX</a>")?>:</p>
     55             <?php
     56                 list_instances($librex_instances);
     57             ?>
     58         </center>
     59         </div>
     60     
     61 
     62 <?php require "misc/footer.php"; ?>