Project

General

Profile

Download (7.1 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
$pgtitle = "System: Package Manager";
42
include("head.inc");
43

    
44
?>
45

    
46
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
47
<?php include("fbegin.inc"); ?>
48
<p class="pgtitle"><?=$pgtitle?></p>
49
<?php if ($savemsg) print_info_box($savemsg); ?>
50
<div id="mainarea">
51
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
52
<?php
53
	$tab_array = array();
54
	$tab_array[0] = array("Available Packages", false, "pkg_mgr.php");
55
	$tab_array[1] = array("Installed Packages", true, "pkg_mgr_installed.php");
56
	display_top_tabs($tab_array);
57
?>  
58
  </td></tr>
59
  <tr>
60
    <td class="tabcont">
61
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
62
                <tr>
63
                  <td width="15%" class="listhdrr">Package Name</td>
64
                  <td width="20%" class="listhdrr">Category</td>
65
		  <td width="10%" class="listhdrr">Package Version</td>
66
                  <td width="10%" class="listhdrr">XML Version</td>
67
                  <td width="45%" class="listhdr">Description</td>
68
                </tr>
69
		<?php
70
                 if($config['installedpackages']['package'] != "") {
71
		    $instpkgs = array();
72
		    foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
73
		    asort($instpkgs);
74
		    foreach ($instpkgs as $index => $pkgname){
75
			$pkg = $config['installedpackages']['package'][$index];
76
                        if($pkg['name'] <> "") {
77
                            ?>
78
                            <tr valign="top">
79
                                <td class="listlr">
80
                                    <?= $pkg['name'] ?>
81
                                </td>
82
                                <td class="listlr">
83
                                    <?= $pkg['category'] ?>
84
                                </td>
85
                                <?php
86
                                        $latest_package = $currentvers[$pkg['name']]['version'];
87
					if($latest_package == false) {
88
						// We can't determine this package's version status.
89
						?><td class="listlr"><?php
90
						echo "Current: Unknown.<br>Installed: " . $pkg['version'];
91
                                       		?></td><?php 
92
					} elseif($pkg['version'] > $latest_package) {
93
                                            /* we're running a newer version of the package */
94
					    ?><td class="listbggrey"><font color="#FFFFFFF"><?php
95
                                            echo "Current: {$latest_version}";
96
                                            echo "<br>Installed: {$pkg['version']}";
97
					    ?></td><?php
98
                                        } elseif($pkg['version'] < $latest_package) {
99
					    /* our package is out of date */
100
					    ?><td class="listbg"><font color="#FFFFFFF"><?php
101
                                            echo "Current: {$latest_version}";
102
					    echo "<br>Installed: {$pkg['version']}";
103
					    ?></td><?php
104
                                        } else {
105
					    ?><td class="listlr"><?php
106
					    echo $pkg['version'];
107
					    ?></td><?php
108
					}
109
					$latest_xml = $currentvers[$pkg['name']]['xmlver'];
110
					if(($latest_xml == false) and ($pkg['xmlver']) == false) {
111
						?><td class="listlr"><?php
112
						echo "Unknown.";
113
						?></td><?php
114
					} elseif($latest_xml == false) {
115
						?><td class="listlr"><?php
116
						echo "Current: Unknown.<br>Installed: {$pkg['xmlver']}";
117
						?></td><?php
118
					} elseif($pkg['xmlver'] > $latest_xml) {
119
						?><td class="listbggrey"><font color="#FFFFFFF"><?php
120
                                                echo "Current: {$latest_xml}";
121
                                                echo "<br>Installed: {$pkg['xmlver']}";
122
                                                ?></td><?php
123
					} elseif($pkg['xmlver'] < $latest_xml) {
124
						?><td class="listbg"><font color="#FFFFFFF"><?php
125
	                                        echo "Current: {$latest_xml}";
126
						echo "<br>Installed: {$pkg['xmlver']}";
127
                            			?></td><?php
128
					} else {
129
						?><td class="listlr"><?php
130
						echo $pkg['xmlver'];
131
						?></td><?php
132
					}
133
                                ?>
134
                                <td class="listbg">
135
                                    <font color="#FFFFFFF">
136
                                    <?= $pkg['descr'] ?>
137
                                </td>
138
                                <td valign="middle" class="list" nowrap>
139
                                    <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>
140
                                    <br>
141
				    <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>
142
				    <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>
143
				</td>
144
                            </tr>
145
                            <?php
146
                        }
147
		    }
148
                 } else {
149
                    echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>";
150
                 }
151
		?>
152
        </table>
153
    </td>
154
  </tr>
155
</table>
156
</div>
157
<?php include("fend.inc"); ?>
158

    
159
<script type="text/javascript">
160
NiftyCheck();
161
Rounded("div#mainarea","bl br","#FFF","#eeeeee","smooth");
162
</script>
163

    
164
</body>
165
</html>
166

    
167
<?php
168
    conf_mount_ro();
169
?>
(69-69/128)