Project

General

Profile

Download (7.11 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 ee11cc6e Scott Ullrich
?>
41
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
42
<html>
43
<head>
44
<title><?=gentitle("System: Package Manager");?></title>
45
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
46
<link href="gui.css" rel="stylesheet" type="text/css">
47
</head>
48
49
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
50 859329c8 Scott Ullrich
<?php
51
include("fbegin.inc");
52
?>
53 ee11cc6e Scott Ullrich
<p class="pgtitle">System: Package Manager</p>
54
<?php if ($savemsg) print_info_box($savemsg); ?>
55
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
56
  <ul id="tabnav">
57
    <li class="tabinact"><a href="pkg_mgr.php">Available Packages</a></li>
58
    <li class="tabact">Installed Packages</li>
59
  </ul>
60
  </td></tr>
61
  <tr>
62
    <td class="tabcont">
63
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
64
                <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
                  <td width="10%" class="listhdrr">XML Version</td>
69 3a003406 Scott Ullrich
                  <td width="45%" class="listhdr">Description</td>
70 ee11cc6e Scott Ullrich
                </tr>
71
		<?php
72 3732dec3 Colin Smith
                 if($config['installedpackages']['package'] != "") {
73 2d4d79ac Colin Smith
		    $instpkgs = array();
74 5f78ff71 Colin Smith
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
75 fc160034 Colin Smith
		    asort($instpkgs);
76 5f78ff71 Colin Smith
		    foreach ($instpkgs as $index => $pkgname){
77
			$pkg = $config['installedpackages']['package'][$index];
78 ee11cc6e Scott Ullrich
                        if($pkg['name'] <> "") {
79
                            ?>
80
                            <tr valign="top">
81
                                <td class="listlr">
82
                                    <?= $pkg['name'] ?>
83
                                </td>
84
                                <td class="listlr">
85
                                    <?= $pkg['category'] ?>
86
                                </td>
87 c473adbc Colin Smith
                                <?php
88
                                        $latest_package = $currentvers[$pkg['name']]['version'];
89
					if($latest_package == false) {
90 3732dec3 Colin Smith
						// We can't determine this package's version status.
91 c473adbc Colin Smith
						?><td class="listlr"><?php
92
						echo "Current: Unknown.<br>Installed: " . $pkg['version'];
93
                                       		?></td><?php 
94
					} elseif($pkg['version'] > $latest_package) {
95
                                            /* we're running a newer version of the package */
96
					    ?><td class="listbggrey"><font color="#FFFFFFF"><?php
97
                                            echo "Current: {$latest_version}";
98
                                            echo "<br>Installed: {$pkg['version']}";
99
					    ?></td><?php
100
                                        } elseif($pkg['version'] < $latest_package) {
101
					    /* our package is out of date */
102
					    ?><td class="listbg"><font color="#FFFFFFF"><?php
103
                                            echo "Current: {$latest_version}";
104
					    echo "<br>Installed: {$pkg['version']}";
105
					    ?></td><?php
106 3a003406 Scott Ullrich
                                        } else {
107 c473adbc Colin Smith
					    ?><td class="listlr"><?php
108
					    echo $pkg['version'];
109
					    ?></td><?php
110
					}
111 dcd18c94 Colin Smith
					$latest_xml = $currentvers[$pkg['name']]['xmlver'];
112 c473adbc Colin Smith
					if(($latest_xml == false) and ($pkg['xmlver']) == false) {
113
						?><td class="listlr"><?php
114
						echo "Unknown.";
115
						?></td><?php
116
					} elseif($latest_xml == false) {
117
						?><td class="listlr"><?php
118
						echo "Current: Unknown.<br>Installed: {$pkg['xmlver']}";
119
						?></td><?php
120
					} elseif($pkg['xmlver'] > $latest_xml) {
121
						?><td class="listbggrey"><font color="#FFFFFFF"><?php
122
                                                echo "Current: {$latest_xml}";
123
                                                echo "<br>Installed: {$pkg['xmlver']}";
124
                                                ?></td><?php
125
					} elseif($pkg['xmlver'] < $latest_xml) {
126
						?><td class="listbg"><font color="#FFFFFFF"><?php
127 dcd18c94 Colin Smith
	                                        echo "Current: {$latest_xml}";
128
						echo "<br>Installed: {$pkg['xmlver']}";
129 c473adbc Colin Smith
                            			?></td><?php
130
					} else {
131
						?><td class="listlr"><?php
132
						echo $pkg['xmlver'];
133
						?></td><?php
134
					}
135
                                ?>
136 ee11cc6e Scott Ullrich
                                <td class="listbg">
137
                                    <font color="#FFFFFFF">
138
                                    <?= $pkg['descr'] ?>
139
                                </td>
140
                                <td valign="middle" class="list" nowrap>
141 e45d7349 Colin Smith
                                    <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="x.gif" width="17" height="17" border="0"></a>
142 c473adbc Colin Smith
                                    <br>
143 dcd18c94 Colin Smith
				    <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package." src="reinstall_pkg.gif" width="17" height="17" border="0"</a>
144
				    <a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>"><img title="Reinstall this package's GUI components." src="reinstall_xml.gif" width="17" height="17" border="0"</a>
145 c473adbc Colin Smith
				</td>
146 ee11cc6e Scott Ullrich
                            </tr>
147
                            <?php
148
                        }
149
		    }
150 2d4d79ac Colin Smith
                 } else {
151 746ec897 Colin Smith
                    echo "<tr><td colspan=\"3\"><center>There are no packages currently installed.</td></tr>";
152 ee11cc6e Scott Ullrich
                 }
153
		?>
154
        </table>
155
    </td>
156
  </tr>
157
</table>
158
<?php include("fend.inc"); ?>
159
</body>
160
</html>
161
162 ec6879e3 Scott Ullrich
<?php
163
    conf_mount_ro();
164
?>