Project

General

Profile

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