diff options
Diffstat (limited to 'versioncp/show_versions.php')
-rw-r--r-- | versioncp/show_versions.php | 312 |
1 files changed, 0 insertions, 312 deletions
diff --git a/versioncp/show_versions.php b/versioncp/show_versions.php deleted file mode 100644 index 325d32b..0000000 --- a/versioncp/show_versions.php +++ /dev/null @@ -1,312 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> - <link rel="stylesheet" href="main.css" type="text/css" /> - <title>Version Displayer</title> -</head> -<body style="margin: 0; padding: 0;"> -<?php - -# == Settings == - -$dbuser = 'root'; -$dbpass = 'root'; -$dbname = 'versioncp'; - -# == End Settings == -# Connect to the database - -$db = mysql_connect(':/var/run/mysqld/mysqld.sock', $dbuser, $dbpass); -mysql_select_db($dbname, $db); - -# Check that a type is set - -if(isset($_GET['type']) - && $_GET['type'] != '' - && ($_GET['type'] === 'proj' || $_GET['type'] === 'dev')) -{ - echo '<br />' . "\n"; - echo '<p align="center"> Type: <b>' . $_GET['type'] . '</b> </p><br />' . "\n"; -} -else -{ - echo 'Please select which type of data you want to see.<br />' . "\n"; - echo 'Supported are "proj" and "dev" types, for the two<br />' . "\n"; - echo 'categories of overlays that we support.<br />' . "\n"; - echo '<br />' . "\n"; - echo '<form method="get" action="show_versions.php">' . "\n"; - echo '<select name="type">' . "\n"; - echo ' <option>proj</option>' . "\n"; - echo ' <option>dev</option>' . "\n"; - echo '</select>' . "\n"; - echo '<input type="submit" value="OK" />' . "\n"; - echo '</form>' . "\n"; - echo '</body>' . "\n"; - echo '</html>' . "\n"; - exit; -} - -# Check that a name is set - -if(isset($_GET['name']) - && $_GET['name'] != '') -{ - $names_db = mysql_query('SELECT `overname` FROM `overlays` WHERE `overtype`= "' . $_GET['type'] . '"', $db); - - while($names = mysql_fetch_array($names_db)) - { - if($_GET['name'] === $names['overname']) - { - echo '<p align="center"> Name: <b>' . $_GET['name'] . '</b> </p><br />' . "\n"; - $exitinvalid = '0'; - break; - } - else - { - $exitinvalid = '1'; - } - } - - if($exitinvalid === '1') - { - echo 'Invalid name supplied!<br />' . "\n"; - echo '</body>' . "\n"; - echo '</html>' . "\n"; - exit; - } -} -else -{ - $names_db = mysql_query('SELECT `overname` FROM `overlays` WHERE `overtype`= "' . $_GET['type'] . '"', $db); - echo 'Please select the name of the data you want to see.<br />' . "\n"; - echo '<br />' . "\n"; - echo '<form method="get" action="show_versions.php">' . "\n"; - echo '<input type="hidden" name="type" value="' . $_GET['type'] . '" />' . "\n"; - echo '<select name="name">' . "\n"; - - while($names = mysql_fetch_array($names_db)) - { - $namesarray[$names['overname']] = $names['overname']; - } - - foreach($namesarray as $namename) - { - echo ' <option>' . $namename . '</option>' . "\n"; - } - - echo '</select>' . "\n"; - echo '<input type="submit" value="OK" />' . "\n"; - echo '</form>' . "\n"; - echo '</body>' . "\n"; - echo '</html>' . "\n"; - exit; -} - -?> -<table cellpadding="5" cellspacing="5" border="0" align="center"> -<tr> - <td class="package"> Package Name </td> - <td class="package"> Latest in Portage </td> - <td class="package"> Latest in Overlay </td> - <td class="package"> Latest Upstream </td> -</tr> -<?php - -# Get the packages data, and display it - -$pkgs_db = mysql_query('SELECT `name`,`versport`,`versover`,`versupst`,`upstscript` FROM `packages` WHERE `projtype` = "' . $_GET['type'] . '" AND `projname` = "' . $_GET['name'] . '" ORDER BY `name` ASC', $db); - -while($pkgs = mysql_fetch_array($pkgs_db)) -{ - # Let's reset the color data - - if($pkgs['upstscript'] != '' - && $pkgs['versupst'] == '-') - { - $upstclass = ' class="brokenupst" title="broken upstream script ( ' . $pkgs['upstscript'] . ' )"'; - } - else - { - $upstclass = ' class="reference" title="no upstream script defined"'; - } - - $overclass = ' class="reference"'; - $portclass = ' class="reference"'; - - # Case 1: A def, B def, C def - A > B > C compare - - if($pkgs['versport'] != '-' - && $pkgs['versover'] != '-' - && $pkgs['versupst'] != '-') - { - # Let's consider upstream as being the reference here, so always up-to-date - - $upstclass = ' class="updated" title="from upstream script ( ' . $pkgs['upstscript'] . ' )"'; - - # First let's check the upstream <-> overlay relation - - switch(version_compare($pkgs['versupst'], $pkgs['versover'])) - { - case '-1': - $overclass = ' class="updated"'; - break; - case '0': - $overclass = ' class="updated"'; - break; - case '1': - $overclass = ' class="outdated"'; - break; - } - - # Then let's check the overlay <-> portage relation - - switch(version_compare($pkgs['versover'], $pkgs['versport'])) - { - case '-1': - $portclass = ' class="updated"'; - break; - case '0': - $portclass = ' class="updated"'; - break; - case '1': - $portclass = ' class="outdated"'; - break; - } - } - - # Case 2: A def, B undef, C undef - A - - if($pkgs['versport'] != '-' - && $pkgs['versover'] == '-' - && $pkgs['versupst'] == '-') - { - # Only in Portage, so it's automatically ok - - $portclass = ' class="updated"'; - } - - # Case 3: A def, B def, C undef - A > B compare - - if($pkgs['versport'] != '-' - && $pkgs['versover'] != '-' - && $pkgs['versupst'] == '-') - { - # Let's check the overlay <-> portage relation - - switch(version_compare($pkgs['versover'], $pkgs['versport'])) - { - case '-1': - $overclass = ' class="outdated"'; - $portclass = ' class="updated"'; - break; - case '0': - $overclass = ' class="updated"'; - $portclass = ' class="updated"'; - break; - case '1': - $overclass = ' class="updated"'; - $portclass = ' class="outdated"'; - break; - } - } - - # Case 4: A def, B undef, C def - A > C compare - - if($pkgs['versport'] != '-' - && $pkgs['versover'] == '-' - && $pkgs['versupst'] != '-') - { - # Let's consider upstream as being the reference here, so always up-to-date - - $upstclass = ' class="updated" title="from upstream script ( ' . $pkgs['upstscript'] . ' )"'; - - # Let's check the upstream <-> portage relation - - switch(version_compare($pkgs['versupst'], $pkgs['versport'])) - { - case '-1': - $portclass = ' class="updated"'; - break; - case '0': - $portclass = ' class="updated"'; - break; - case '1': - $portclass = ' class="outdated"'; - break; - } - } - - # Case 5: A undef, B undef, C undef - nothing - - if($pkgs['versport'] == '-' - && $pkgs['versover'] == '-' - && $pkgs['versupst'] == '-') - { - # We have absolutely no info on this package, mark as dead - - $upstclass = ' class="deadinfo" title="no info available on this package at all"'; - $overclass = ' class="deadinfo" title="no info available on this package at all"'; - $portclass = ' class="deadinfo" title="no info available on this package at all"'; - } - - # Case 6: A undef, B def, C def - B > C compare - - if($pkgs['versport'] == '-' - && $pkgs['versover'] != '-' - && $pkgs['versupst'] != '-') - { - # Let's consider upstream as being the reference here, so always up-to-date - - $upstclass = ' class="updated" title="from upstream script ( ' . $pkgs['upstscript'] . ' )"'; - - # Let's check the upstream <-> overlay relation - - switch(version_compare($pkgs['versupst'], $pkgs['versover'])) - { - case '-1': - $overclass = ' class="updated"'; - break; - case '0': - $overclass = ' class="updated"'; - break; - case '1': - $overclass = ' class="outdated"'; - break; - } - } - - # Case 7: A undef, B undef, C def - C - - if($pkgs['versport'] == '-' - && $pkgs['versover'] == '-' - && $pkgs['versupst'] != '-') - { - # Only Upstream, so it's automatically ok - - $upstclass = ' class="updated" title="from upstream script ( ' . $pkgs['upstscript'] . ' )"'; - } - - # Case 8: A undef, B def, C undef - B - - if($pkgs['versport'] == '-' - && $pkgs['versover'] != '-' - && $pkgs['versupst'] == '-') - { - # Only in Overlay, so it's automatically ok - - $overclass = ' class="updated"'; - } - - echo '<tr>' . "\n"; - echo ' <td class="package"> ' . $pkgs['name'] . ' </td>' . "\n"; - echo ' <td' . $portclass . '> ' . $pkgs['versport'] . ' </td>' . "\n"; - echo ' <td' . $overclass . '> ' . $pkgs['versover'] . ' </td>' . "\n"; - echo ' <td' . $upstclass . '> ' . $pkgs['versupst'] . ' </td>' . "\n"; - echo '</tr>' . "\n"; -} - -?> -</table> -</body> -</html>
\ No newline at end of file |