Project

General

Profile

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