Project

General

Profile

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