Project

General

Profile

Download (6.48 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 6b07c15a Matthew Grooms
##|+PRIV
31
##|*IDENT=page-system-packagemanager-installed
32
##|*NAME=System: Package Manager: Installed page
33
##|*DESCR=Allow access to the 'System: Package Manager: Installed' page.
34
##|*MATCH=pkg_mgr_installed.php*
35
##|-PRIV
36
37
38 9f9dcd98 Scott Ullrich
require_once("guiconfig.inc");
39 f8e335a3 Scott Ullrich
require_once("pkg-utils.inc");
40 ee11cc6e Scott Ullrich
41 746ec897 Colin Smith
if(is_array($config['installedpackages']['package'])) {
42
	foreach($config['installedpackages']['package'] as $instpkg) {
43
		$tocheck[] = $instpkg['name'];
44
	}
45
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver'));
46 78dde2d7 Colin Smith
}
47 83ddedcd Scott Ullrich
48 d88c6a9f Scott Ullrich
$pgtitle = array("System","Package Manager");
49 83ddedcd Scott Ullrich
include("head.inc");
50
51 ee11cc6e Scott Ullrich
?>
52
53
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
54 96d9f5c9 Bill Marquette
<?php include("fbegin.inc"); ?>
55 ee11cc6e Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
56
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
57 e3ebc979 Scott Ullrich
<?php
58 61a48553 Scott Ullrich
	$version = file_get_contents("/etc/version");
59 e3ebc979 Scott Ullrich
	$tab_array = array();
60 64b243d2 Scott Ullrich
	$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
61
	$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
62
/*  $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
63
	$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
64 e3ebc979 Scott Ullrich
	display_top_tabs($tab_array);
65 7ca3849a Scott Ullrich
?>
66 ee11cc6e Scott Ullrich
  </td></tr>
67
  <tr>
68 d732f186 Bill Marquette
    <td>
69
	<div id="mainarea">
70
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
71 ee11cc6e Scott Ullrich
                <tr>
72 c473adbc Colin Smith
                  <td width="15%" class="listhdrr">Package Name</td>
73 3a003406 Scott Ullrich
                  <td width="20%" class="listhdrr">Category</td>
74 c473adbc Colin Smith
		  <td width="10%" class="listhdrr">Package Version</td>
75 3a003406 Scott Ullrich
                  <td width="45%" class="listhdr">Description</td>
76 ee11cc6e Scott Ullrich
                </tr>
77
		<?php
78 3732dec3 Colin Smith
                 if($config['installedpackages']['package'] != "") {
79 2d4d79ac Colin Smith
		    $instpkgs = array();
80 5f78ff71 Colin Smith
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
81 fc160034 Colin Smith
		    asort($instpkgs);
82 5f78ff71 Colin Smith
		    foreach ($instpkgs as $index => $pkgname){
83
			$pkg = $config['installedpackages']['package'][$index];
84 ee11cc6e Scott Ullrich
                        if($pkg['name'] <> "") {
85
                            ?>
86
                            <tr valign="top">
87
                                <td class="listlr">
88
                                    <?= $pkg['name'] ?>
89
                                </td>
90
                                <td class="listlr">
91
                                    <?= $pkg['category'] ?>
92
                                </td>
93 c473adbc Colin Smith
                                <?php
94
                                        $latest_package = $currentvers[$pkg['name']]['version'];
95
					if($latest_package == false) {
96 3732dec3 Colin Smith
						// We can't determine this package's version status.
97 c473adbc Colin Smith
						?><td class="listlr"><?php
98
						echo "Current: Unknown.<br>Installed: " . $pkg['version'];
99 7ca3849a Scott Ullrich
                                       		?></td><?php
100 40326f36 Colin Smith
					} elseif(strcmp($pkg['version'], $latest_package) > 0) {
101 c473adbc Colin Smith
                                            /* we're running a newer version of the package */
102 588b7fc5 Bill Marquette
					    ?><td class="listbggrey"><font color="#FFFFFF"><?php
103 7ca3849a Scott Ullrich
                                            echo "Current: {$latest_package}";
104 c473adbc Colin Smith
                                            echo "<br>Installed: {$pkg['version']}";
105
					    ?></td><?php
106 40326f36 Colin Smith
                                        } elseif(strcmp($pkg['version'], $latest_package) < 0) {
107 c473adbc Colin Smith
					    /* our package is out of date */
108 588b7fc5 Bill Marquette
					    ?><td class="listbg"><font color="#FFFFFF"><?php
109 7ca3849a Scott Ullrich
                                            echo "Current: {$latest_package}";
110 c473adbc Colin Smith
					    echo "<br>Installed: {$pkg['version']}";
111
					    ?></td><?php
112 3a003406 Scott Ullrich
                                        } else {
113 c473adbc Colin Smith
					    ?><td class="listlr"><?php
114
					    echo $pkg['version'];
115
					    ?></td><?php
116
					}
117
                                ?>
118 ee11cc6e Scott Ullrich
                                <td class="listbg">
119 ae0c2a1c Scott Ullrich
                                    <font color="#ffffff">
120 ee11cc6e Scott Ullrich
                                    <?= $pkg['descr'] ?>
121
                                </td>
122
                                <td valign="middle" class="list" nowrap>
123 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>
124 c473adbc Colin Smith
                                    <br>
125 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>
126
				    <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>
127 c473adbc Colin Smith
				</td>
128 ee11cc6e Scott Ullrich
                            </tr>
129
                            <?php
130
                        }
131
		    }
132 2d4d79ac Colin Smith
                 } else {
133 1b8f9d6e Scott Ullrich
                    echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>";
134 ee11cc6e Scott Ullrich
                 }
135
		?>
136
        </table>
137 d732f186 Bill Marquette
	</div>
138 ee11cc6e Scott Ullrich
    </td>
139
  </tr>
140
</table>
141
<?php include("fend.inc"); ?>
142
</body>
143
</html>
144 d732f186 Bill Marquette
<?php conf_mount_ro(); ?>