Project

General

Profile

Download (6.29 KB) Statistics
| Branch: | Tag: | Revision:
1 ee11cc6e Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 ee11cc6e Scott Ullrich
/*
4
    pkg_mgr.php
5
    Copyright (C) 2004 Scott Ullrich
6
    All rights reserved.
7
8
    Redistribution and use in source and binary forms, with or without
9
    modification, are permitted provided that the following conditions are met:
10
11
    1. Redistributions of source code must retain the above copyright notice,
12
       this list of conditions and the following disclaimer.
13
14
    2. Redistributions in binary form must reproduce the above copyright
15
       notice, this list of conditions and the following disclaimer in the
16
       documentation and/or other materials provided with the distribution.
17
18
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
    POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30 9f9dcd98 Scott Ullrich
require_once("guiconfig.inc");
31 f8e335a3 Scott Ullrich
require_once("pkg-utils.inc");
32 ee11cc6e Scott Ullrich
33 746ec897 Colin Smith
if(is_array($config['installedpackages']['package'])) {
34
	foreach($config['installedpackages']['package'] as $instpkg) {
35
		$tocheck[] = $instpkg['name'];
36
	}
37
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver'));
38 78dde2d7 Colin Smith
}
39 83ddedcd Scott Ullrich
40 96d9f5c9 Bill Marquette
$pgtitle = "System: Package Manager";
41 83ddedcd Scott Ullrich
include("head.inc");
42
43 ee11cc6e Scott Ullrich
?>
44
45
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
46 96d9f5c9 Bill Marquette
<?php include("fbegin.inc"); ?>
47
<p class="pgtitle"><?=$pgtitle?></p>
48 ee11cc6e Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
49
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
50 e3ebc979 Scott Ullrich
<?php
51 61a48553 Scott Ullrich
	$version = file_get_contents("/etc/version");
52 e3ebc979 Scott Ullrich
	$tab_array = array();
53 64b243d2 Scott Ullrich
	$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
54
	$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
55
/*  $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
56
	$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
57 e3ebc979 Scott Ullrich
	display_top_tabs($tab_array);
58 7ca3849a Scott Ullrich
?>
59 ee11cc6e Scott Ullrich
  </td></tr>
60
  <tr>
61 d732f186 Bill Marquette
    <td>
62
	<div id="mainarea">
63
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
64 ee11cc6e Scott Ullrich
                <tr>
65 c473adbc Colin Smith
                  <td width="15%" class="listhdrr">Package Name</td>
66 3a003406 Scott Ullrich
                  <td width="20%" class="listhdrr">Category</td>
67 c473adbc Colin Smith
		  <td width="10%" class="listhdrr">Package Version</td>
68 3a003406 Scott Ullrich
                  <td width="45%" class="listhdr">Description</td>
69 ee11cc6e Scott Ullrich
                </tr>
70
		<?php
71 3732dec3 Colin Smith
                 if($config['installedpackages']['package'] != "") {
72 2d4d79ac Colin Smith
		    $instpkgs = array();
73 5f78ff71 Colin Smith
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
74 fc160034 Colin Smith
		    asort($instpkgs);
75 5f78ff71 Colin Smith
		    foreach ($instpkgs as $index => $pkgname){
76
			$pkg = $config['installedpackages']['package'][$index];
77 ee11cc6e Scott Ullrich
                        if($pkg['name'] <> "") {
78
                            ?>
79
                            <tr valign="top">
80
                                <td class="listlr">
81
                                    <?= $pkg['name'] ?>
82
                                </td>
83
                                <td class="listlr">
84
                                    <?= $pkg['category'] ?>
85
                                </td>
86 c473adbc Colin Smith
                                <?php
87
                                        $latest_package = $currentvers[$pkg['name']]['version'];
88
					if($latest_package == false) {
89 3732dec3 Colin Smith
						// We can't determine this package's version status.
90 c473adbc Colin Smith
						?><td class="listlr"><?php
91
						echo "Current: Unknown.<br>Installed: " . $pkg['version'];
92 7ca3849a Scott Ullrich
                                       		?></td><?php
93 40326f36 Colin Smith
					} elseif(strcmp($pkg['version'], $latest_package) > 0) {
94 c473adbc Colin Smith
                                            /* we're running a newer version of the package */
95 588b7fc5 Bill Marquette
					    ?><td class="listbggrey"><font color="#FFFFFF"><?php
96 7ca3849a Scott Ullrich
                                            echo "Current: {$latest_package}";
97 c473adbc Colin Smith
                                            echo "<br>Installed: {$pkg['version']}";
98
					    ?></td><?php
99 40326f36 Colin Smith
                                        } elseif(strcmp($pkg['version'], $latest_package) < 0) {
100 c473adbc Colin Smith
					    /* our package is out of date */
101 588b7fc5 Bill Marquette
					    ?><td class="listbg"><font color="#FFFFFF"><?php
102 7ca3849a Scott Ullrich
                                            echo "Current: {$latest_package}";
103 c473adbc Colin Smith
					    echo "<br>Installed: {$pkg['version']}";
104
					    ?></td><?php
105 3a003406 Scott Ullrich
                                        } else {
106 c473adbc Colin Smith
					    ?><td class="listlr"><?php
107
					    echo $pkg['version'];
108
					    ?></td><?php
109
					}
110
                                ?>
111 ee11cc6e Scott Ullrich
                                <td class="listbg">
112 ae0c2a1c Scott Ullrich
                                    <font color="#ffffff">
113 ee11cc6e Scott Ullrich
                                    <?= $pkg['descr'] ?>
114
                                </td>
115
                                <td valign="middle" class="list" nowrap>
116 677c0869 Erik Kristensen
                                    <a onclick="return confirm('Do you really want to remove this package?')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>"><img title="Remove this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
117 c473adbc Colin Smith
                                    <br>
118 677c0869 Erik Kristensen
				    <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0"</a>
119
				    <a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package's GUI components." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0"</a>
120 c473adbc Colin Smith
				</td>
121 ee11cc6e Scott Ullrich
                            </tr>
122
                            <?php
123
                        }
124
		    }
125 2d4d79ac Colin Smith
                 } else {
126 1b8f9d6e Scott Ullrich
                    echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>";
127 ee11cc6e Scott Ullrich
                 }
128
		?>
129
        </table>
130 d732f186 Bill Marquette
	</div>
131 ee11cc6e Scott Ullrich
    </td>
132
  </tr>
133
</table>
134
<?php include("fend.inc"); ?>
135
</body>
136
</html>
137 d732f186 Bill Marquette
<?php conf_mount_ro(); ?>