Project

General

Profile

Download (5.27 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/* $Id$ */
4
/*
5
    pkg_mgr.php
6
    Copyright (C) 2004, 2005 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("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
<?php
68
include("fbegin.inc");
69
?>
70
<p class="pgtitle">System: Package Manager</p>
71
<?php if ($savemsg) print_info_box($savemsg); ?>
72
<?php
73

    
74
if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) {
75
	fetch_latest_pkg_config();
76
}
77

    
78
$pkg_config = parse_xml_config_pkg("{$g['tmp_path']}/pkg_config.xml", "pfsensepkgs");
79

    
80
if(!$pkg_config['packages']) {
81
            print_info_box_np("Could not find any packages in pkg_config.xml");
82
}
83
?>
84
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
85
  <ul id="tabnav">
86
    <li class="tabact">Available Packages</a></li>
87
    <li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
88
  </ul>
89
  </td></tr>
90
  <tr>
91
    <td class="tabcont">
92
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
93
                <tr>
94
                  <td width="10%" class="listhdrr">Package Name</td>
95
                  <td width="25%" class="listhdrr">Category</td>
96
				  <td width="5%" class="listhdrr">Status</td>
97
                  <td width="50%" class="listhdr">Description</td>
98
                </tr>
99

    
100
		<?php
101
		 $i = 0;
102
		    foreach ($pkg_config['packages']['package'] as $pkg) {
103
			$pkgname = $pkg['name'];
104
                        if($config['installedpackages']['package'] != "") {
105
                            foreach ($config['installedpackages']['package'] as $installed) {
106
                                        if($installed['name'] == $pkg['name'])
107
                                                    $pkgname = "";
108
                            }
109
                        }
110
                        if($pkgname <> "") {
111
                            ?>
112
                            <tr valign="top">
113
                                <td class="listlr">
114
                                    <A target="_new" href="<?= $pkg['website'] ?>"><?= $pkg['name'] ?></a>
115
                                </td>
116
                                <td class="listlr">
117
                                    <?= $pkg['category'] ?>
118
    							</td>
119
                                <td class="listlr">
120
									<?= $pkg['status'] ?>
121
									<br>
122
									<?= $pkg['version'] ?>
123
                                </td>
124
                                <td class="listbg">
125
                                    <font color="#FFFFFFF">
126
                                    <?= $pkg['descr'] ?>
127
                                </td>
128
                                <td valign="middle" class="list" nowrap>
129
                                    <a onclick="return confirm('Do you really want to install this package?')" href="pkg_mgr_install.php?id=<?=$i;?>"><img src="plus.gif" width="17" height="17" border="0"></a>
130
                                </td>
131
                            </tr>
132
                            <?php
133
                        }
134
			$i++;
135
		    }
136
                    if($i == 0) {
137
                        echo "<tr><td colspan=\"3\"><center>There are currently no available packages for installation.</td></tr>";
138
                    }
139
		?>
140
        </table>
141
    </td>
142
  </tr>
143
</table>
144
<?php include("fend.inc"); ?>
145
</body>
146
</html>
147

    
148
<?php unlink_if_exists("{$g['tmp_path']}/pkg*"); ?>
(59-59/112)