Project

General

Profile

Download (5.26 KB) Statistics
| Branch: | Tag: | Revision:
1 ee11cc6e Scott Ullrich
#!/usr/local/bin/php
2
<?php
3 b46bfcf5 Bill Marquette
/* $Id$ */
4 ee11cc6e Scott Ullrich
/*
5
    pkg_mgr.php
6 b49448ac Scott Ullrich
    Copyright (C) 2004, 2005 Scott Ullrich
7 ee11cc6e Scott Ullrich
    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 9f9dcd98 Scott Ullrich
require_once("guiconfig.inc");
32 f8e335a3 Scott Ullrich
require_once("pkg-utils.inc");
33 ee11cc6e Scott Ullrich
34
if ($_POST) {
35
36
    $pconfig = $_POST;
37
38
    $retval = 0;
39
40
    if (!file_exists($d_sysrebootreqd_path)) {
41
		config_lock();
42
        $retval |= filter_configure();
43
		config_unlock();
44
    }
45
    $savemsg = get_std_save_message($retval);
46
47
    if ($retval == 0) {
48
        if (file_exists($d_natconfdirty_path))
49
            unlink($d_natconfdirty_path);
50
        if (file_exists($d_filterconfdirty_path))
51
            unlink($d_filterconfdirty_path);
52
    }
53
}
54
55
?>
56
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
57
<html>
58
<head>
59
<title><?=gentitle("System: Package Manager");?></title>
60
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
61
<link href="gui.css" rel="stylesheet" type="text/css">
62
</head>
63
64
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
65 859329c8 Scott Ullrich
<?php
66
include("fbegin.inc");
67
?>
68 ee11cc6e Scott Ullrich
<p class="pgtitle">System: Package Manager</p>
69 8f6eab72 Scott Ullrich
<br>
70 ee11cc6e Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
71
<?php
72 859329c8 Scott Ullrich
73 77c6c2f7 Colin Smith
$pkg_info = get_pkg_info('all', array('name', 'category', 'website', 'version', 'status', 'descr'));
74 9345a13c Colin Smith
$pkg_sizes = get_pkg_sizes();
75 ee11cc6e Scott Ullrich
76
?>
77
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
78
  <ul id="tabnav">
79
    <li class="tabact">Available Packages</a></li>
80
    <li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
81
  </ul>
82
  </td></tr>
83
  <tr>
84
    <td class="tabcont">
85
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
86
                <tr>
87 a15a15e7 Scott Ullrich
                  <td width="10%" class="listhdrr">Package Name</td>
88 ee11cc6e Scott Ullrich
                  <td width="25%" class="listhdrr">Category</td>
89 ea395bfd Colin Smith
		  <td width="10%" class="listhdrr">Size</td>
90 9345a13c Colin Smith
		  <td width="5%" class="listhdrr">Status</td>
91 ee11cc6e Scott Ullrich
                  <td width="50%" class="listhdr">Description</td>
92
                </tr>
93
94
		<?php
95 0db271e0 Colin Smith
		 $pkgs = array();
96
		 $instpkgs = array();
97 62fc920d Scott Ullrich
		    if($config['installedpackages']['package'] != "")
98 ff3a5e37 Colin Smith
			foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
99 b426850b Colin Smith
		    $pkg_names = array_keys($pkg_info);
100 1507bd61 Colin Smith
		    $pkg_keys = array();
101 b426850b Colin Smith
		    foreach($pkg_names as $name) {
102
			if(!in_array($name, $instpkgs)) $pkg_keys[] = $name;
103 0db271e0 Colin Smith
		    }
104 b426850b Colin Smith
		    sort($pkg_keys);
105
		    if(count($pkg_keys) != 0) {
106
		    	foreach($pkg_keys as $key) {
107
			    $index = &$pkg_info[$key];
108
			    if(in_array($index['name'], $instpkgs)) continue;
109 ee11cc6e Scott Ullrich
                            ?>
110
                            <tr valign="top">
111
                                <td class="listlr">
112 b426850b Colin Smith
                                    <A target="_new" href="<?= $index['website'] ?>"><?= $index['name'] ?></a>
113 ee11cc6e Scott Ullrich
                                </td>
114
                                <td class="listlr">
115 b426850b Colin Smith
                                    <?= $index['category'] ?>
116 9345a13c Colin Smith
    				</td>
117
				<?php
118
					$size = get_package_install_size($index['name'], $pkg_sizes);
119
                               		$size = squash_from_bytes($size[$index['name']], 1);
120
				?>
121
				<td class="listlr">
122
					<?= $size ?>
123
				</td>
124
				<td class="listlr">
125 b426850b Colin Smith
									<?= $index['status'] ?>
126 1677823e Scott Ullrich
									<br>
127 b426850b Colin Smith
									<?= $index['version'] ?>
128 ee11cc6e Scott Ullrich
                                </td>
129
                                <td class="listbg">
130
                                    <font color="#FFFFFFF">
131 b426850b Colin Smith
                                    <?= $index['descr'] ?>
132 ee11cc6e Scott Ullrich
                                </td>
133
                                <td valign="middle" class="list" nowrap>
134 b426850b Colin Smith
                                    <a onclick="return confirm('Do you really want to install this package?')" href="pkg_mgr_install.php?id=<?=$index['name'];?>"><img src="plus.gif" width="17" height="17" border="0"></a>
135 ee11cc6e Scott Ullrich
                                </td>
136
                            </tr>
137
                            <?php
138 b426850b Colin Smith
                        }
139
		    } else {
140
			echo "<tr><td colspan=\"3\"><center>There are currently no available packages for installation.</td></tr>";
141
		    }
142 ee11cc6e Scott Ullrich
		?>
143
        </table>
144
    </td>
145
  </tr>
146
</table>
147
<?php include("fend.inc"); ?>
148
</body>
149
</html>