Project

General

Profile

Download (7.11 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 = $currentvers[$pkg['name']]['xmlver'];
112
					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
	                                        echo "Current: {$latest_xml}";
128
						echo "<br>Installed: {$pkg['xmlver']}";
129
                            			?></td><?php
130
					} else {
131
						?><td class="listlr"><?php
132
						echo $pkg['xmlver'];
133
						?></td><?php
134
					}
135
                                ?>
136
                                <td class="listbg">
137
                                    <font color="#FFFFFFF">
138
                                    <?= $pkg['descr'] ?>
139
                                </td>
140
                                <td valign="middle" class="list" nowrap>
141
                                    <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
                                    <br>
143
				    <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
				</td>
146
                            </tr>
147
                            <?php
148
                        }
149
		    }
150
                 } else {
151
                    echo "<tr><td colspan=\"3\"><center>There are no packages currently installed.</td></tr>";
152
                 }
153
		?>
154
        </table>
155
    </td>
156
  </tr>
157
</table>
158
<?php include("fend.inc"); ?>
159
</body>
160
</html>
161

    
162
<?php
163
    conf_mount_ro();
164
?>
(65-65/122)