PKG Rosetta: Check-in [1227006753]

Codebase of pkg.deparis.io website, which helps you find concordance between Gnu/Linux or BSD packages name.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add links to distros packages ref manager. Needs refactoring and external configuration\!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:12270067534a2096e5585b82db5dc69c38f79f8b
User & Date: milouse 2016-03-08 15:40:03
Context
2016-03-15
14:17
Add contribution links Leaf check-in: 3d91e255cf user: milouse tags: trunk
2016-03-08
15:40
Add links to distros packages ref manager. Needs refactoring and external configuration\! check-in: 1227006753 user: milouse tags: trunk
15:07
Fix various little glitches. Long time I didn't code in php check-in: 2112ae4b63 user: milouse tags: trunk
Changes

Changes to index.php.

28
29
30
31
32
33
34










35




    <input type="submit"> <input type="reset">
  </fieldset>
</form>

<?php if (!empty($content)){ ?>
  <h2>Results</h2>
  <?php echo $content; ?>










<?php } ?>











>
>
>
>
>
>
>
>
>
>

>
>
>
>
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    <input type="submit"> <input type="reset">
  </fieldset>
</form>

<?php if (!empty($content)){ ?>
  <h2>Results</h2>
  <?php echo $content; ?>
  <p><a href="index.php">Back to home</a></p>

<?php } else { ?>

  <h2>API</h2>
  <p>As PKG Rosetta is able to output results in txt or json format, you
    can directly use it from any other system. For example, with cURL:</p>
  <pre>curl 'http://pkg.deparis.io/search.php?q=httpd&f=txt'</pre>

  <p>Please, <a href="https://projects.depar.is/pkgrosetta">contribute</a>!</p>
<?php } ?>

<footer>
  <p>© 2016–... <a href="https://etienne.depar.is">Étienne Deparis</a></p>
</footer>

Changes to search.php.

21
22
23
24
25
26
27
28






















29

30
31
32
33
34
35
36

function print_html($data){
  $content = '<table><thead><tr>';
  foreach (DISTRO_NAMES as $dn){
    $content .= '<th>' . $dn . '</th>';
  }
  $content .= '</tr></thead><tbody><tr>';
  foreach ($data as $d){






















    $content .= '<td>' . $d . '</td>';

  }
  $content .= '</tr></tbody></table>';
  return $content;
}

$result = '';
if (!empty($_GET['q'])){







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

function print_html($data){
  $content = '<table><thead><tr>';
  foreach (DISTRO_NAMES as $dn){
    $content .= '<th>' . $dn . '</th>';
  }
  $content .= '</tr></thead><tbody><tr>';
  for($i = 0; $i < sizeof($data); $i++){
    switch(DISTRO_NAMES[$i]){
      case 'Archlinux':
        $content .= '<td><a href="https://www.archlinux.org/packages/?q='
                  . $data[$i] . '">' . $data[$i] . '</a></td>';
        break;
      case 'Debian':
        $content .= '<td><a href="https://packages.debian.org/search?keywords='
                  . $data[$i] . '">' . $data[$i] . '</a></td>';
        break;
      case 'Ubuntu':
        $content .= '<td><a href="http://packages.ubuntu.com/search?keywords='
                  . $data[$i] . '">' . $data[$i] . '</a></td>';
        break;
      case 'CentOS':
        $content .= '<td><a href="http://rpmfind.net/linux/rpm2html/search.php?query='
                  . $data[$i] . '&system=centos">' . $data[$i] . '</a></td>';
        break;
      case 'Fedora':
        $content .= '<td><a href="https://admin.fedoraproject.org/pkgdb/package/rpms/'
                  . $data[$i] . '/">' . $data[$i] . '</a></td>';
        break;
      default:
        $content .= '<td>' . $data[$i] . '</td>';
    }
  }
  $content .= '</tr></tbody></table>';
  return $content;
}

$result = '';
if (!empty($_GET['q'])){