Project

General

Profile

Download (6.29 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
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
require_once("guiconfig.inc");
31
require_once("pkg-utils.inc");
32

    
33
if(is_array($config['installedpackages']['package'])) {
34
	foreach($config['installedpackages']['package'] as $instpkg) {
35
		$tocheck[] = $instpkg['name'];
36
	}
37
	$currentvers = get_pkg_info($tocheck, array('version', 'xmlver'));
38
}
39

    
40
$pgtitle = "System: Package Manager";
41
include("head.inc");
42

    
43
?>
44

    
45
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
46
<?php include("fbegin.inc"); ?>
47
<p class="pgtitle"><?=$pgtitle?></p>
48
<?php if ($savemsg) print_info_box($savemsg); ?>
49
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
50
<?php
51
	$version = file_get_contents("/etc/version");
52
	$tab_array = array();
53
	$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
54
	$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
55
/*  $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
56
	$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
57
	display_top_tabs($tab_array);
58
?>
59
  </td></tr>
60
  <tr>
61
    <td>
62
	<div id="mainarea">
63
              <table class="tabcont" 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="45%" class="listhdr">Description</td>
69
                </tr>
70
		<?php
71
                 if($config['installedpackages']['package'] != "") {
72
		    $instpkgs = array();
73
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
74
		    asort($instpkgs);
75
		    foreach ($instpkgs as $index => $pkgname){
76
			$pkg = $config['installedpackages']['package'][$index];
77
                        if($pkg['name'] <> "") {
78
                            ?>
79
                            <tr valign="top">
80
                                <td class="listlr">
81
                                    <?= $pkg['name'] ?>
82
                                </td>
83
                                <td class="listlr">
84
                                    <?= $pkg['category'] ?>
85
                                </td>
86
                                <?php
87
                                        $latest_package = $currentvers[$pkg['name']]['version'];
88
					if($latest_package == false) {
89
						// We can't determine this package's version status.
90
						?><td class="listlr"><?php
91
						echo "Current: Unknown.<br>Installed: " . $pkg['version'];
92
                                       		?></td><?php
93
					} elseif(strcmp($pkg['version'], $latest_package) > 0) {
94
                                            /* we're running a newer version of the package */
95
					    ?><td class="listbggrey"><font color="#FFFFFF"><?php
96
                                            echo "Current: {$latest_package}";
97
                                            echo "<br>Installed: {$pkg['version']}";
98
					    ?></td><?php
99
                                        } elseif(strcmp($pkg['version'], $latest_package) < 0) {
100
					    /* our package is out of date */
101
					    ?><td class="listbg"><font color="#FFFFFF"><?php
102
                                            echo "Current: {$latest_package}";
103
					    echo "<br>Installed: {$pkg['version']}";
104
					    ?></td><?php
105
                                        } else {
106
					    ?><td class="listlr"><?php
107
					    echo $pkg['version'];
108
					    ?></td><?php
109
					}
110
                                ?>
111
                                <td class="listbg">
112
                                    <font color="#ffffff">
113
                                    <?= $pkg['descr'] ?>
114
                                </td>
115
                                <td valign="middle" class="list" nowrap>
116
                                    <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>
117
                                    <br>
118
				    <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>
119
				    <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>
120
				</td>
121
                            </tr>
122
                            <?php
123
                        }
124
		    }
125
                 } else {
126
                    echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>";
127
                 }
128
		?>
129
        </table>
130
	</div>
131
    </td>
132
  </tr>
133
</table>
134
<?php include("fend.inc"); ?>
135
</body>
136
</html>
137
<?php conf_mount_ro(); ?>
(96-96/181)