Project

General

Profile

Download (7.24 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/* $Id$ */
4
/*
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
require_once("guiconfig.inc");
32
require_once("pkg-utils.inc");
33

    
34
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
}
40
?>
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
<?php
51
include("fbegin.inc");
52
?>
53
<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
                  <td width="15%" class="listhdrr">Package Name</td>
66
                  <td width="20%" class="listhdrr">Category</td>
67
		  <td width="10%" class="listhdrr">Package Version</td>
68
                  <td width="10%" class="listhdrr">XML Version</td>
69
                  <td width="45%" class="listhdr">Description</td>
70
                </tr>
71
		<?php
72
                 if($config['installedpackages']['package'] != "") {
73
		    $instpkgs = array();
74
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
75
		    asort($instpkgs);
76
		    foreach ($instpkgs as $index => $pkgname){
77
			$pkg = $config['installedpackages']['package'][$index];
78
                        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
                                <?php
88
                                        $latest_package = $currentvers[$pkg['name']]['version'];
89
					if($latest_package == false) {
90
						// We can't determine this package's version status.
91
						?><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
                                        } else {
107
					    ?><td class="listlr"><?php
108
					    echo $pkg['version'];
109
					    ?></td><?php
110
					}
111
					$latest_xml = explode(" ", $pkg['xmlver']);
112
					$latest_xml = $latest_xml[1];
113
					if(($latest_xml == false) and ($pkg['xmlver']) == false) {
114
						?><td class="listlr"><?php
115
						echo "Unknown.";
116
						?></td><?php
117
					} elseif($latest_xml == false) {
118
						?><td class="listlr"><?php
119
						echo "Current: Unknown.<br>Installed: {$pkg['xmlver']}";
120
						?></td><?php
121
					} elseif($pkg['xmlver'] > $latest_xml) {
122
						?><td class="listbggrey"><font color="#FFFFFFF"><?php
123
                                                echo "Current: {$latest_xml}";
124
                                                echo "<br>Installed: {$pkg['xmlver']}";
125
                                                ?></td><?php
126
					} elseif($pkg['xmlver'] < $latest_xml) {
127
						?><td class="listbg"><font color="#FFFFFFF"><?php
128
	                                        echo "Current: {$latest_version}";
129
						echo "<br>Installed: {$pkg['version']}";
130
                            			?></td><?php
131
					} else {
132
						?><td class="listlr"><?php
133
						echo $pkg['xmlver'];
134
						?></td><?php
135
					}
136
                                ?>
137
                                <td class="listbg">
138
                                    <font color="#FFFFFFF">
139
                                    <?= $pkg['descr'] ?>
140
                                </td>
141
                                <td valign="middle" class="list" nowrap>
142
                                    <a onclick="return confirm('Do you really want to remove this package?')" href="pkg_mgr_install.php?mode=delete&pkg=<?= $pkg['name']; ?>&version=<?= $pkg['version']; ?>"><img title="Remove this package." src="x.gif" width="17" height="17" border="0"></a>
143
                                    <br>
144
				    <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>&version=<?= $pkg['version']; ?>"><img title="Reinstall this package." src="reinstall_pkg.gif" width="17" height="17" border="0"</a>
145
				    <a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?= $pkg['name']; ?>&version=<?= $pkg['version']; ?>"><img title="Reinstall this package's GUI components." src="reinstall_xml.gif" width="17" height="17" border="0"</a>
146
				</td>
147
                            </tr>
148
                            <?php
149
                        }
150
		    }
151
                 } else {
152
                    echo "<tr><td colspan=\"3\"><center>There are no packages currently installed.</td></tr>";
153
                 }
154
		?>
155
        </table>
156
    </td>
157
  </tr>
158
</table>
159
<?php include("fend.inc"); ?>
160
</body>
161
</html>
162

    
163
<?php
164
    conf_mount_ro();
165
?>
(64-64/117)