Project

General

Profile

Download (5.67 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
    pkg_mgr.php
5
    Copyright (C) 2004 Scott Ullrich
6
    All rights reserved.
7

    
8
    originally part of m0n0wall (http://m0n0.ch/wall)
9
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
    All rights reserved.
11

    
12
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14

    
15
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17

    
18
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21

    
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33

    
34
require("guiconfig.inc");
35
require("xmlparse_pkg.inc");
36

    
37
$a_out = &$pkg_config['packages'];
38

    
39
if ($_POST) {
40

    
41
    $pconfig = $_POST;
42

    
43
    $retval = 0;
44

    
45
    if (!file_exists($d_sysrebootreqd_path)) {
46
		config_lock();
47
        $retval |= filter_configure();
48
		config_unlock();
49
    }
50
    $savemsg = get_std_save_message($retval);
51

    
52
    if ($retval == 0) {
53
        if (file_exists($d_natconfdirty_path))
54
            unlink($d_natconfdirty_path);
55
        if (file_exists($d_filterconfdirty_path))
56
            unlink($d_filterconfdirty_path);
57
    }
58
}
59

    
60
?>
61
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
62
<html>
63
<head>
64
<title><?=gentitle("System: Package Manager");?></title>
65
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
66
<link href="gui.css" rel="stylesheet" type="text/css">
67
</head>
68

    
69
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
70
<?php include("fbegin.inc"); ?>
71
<p class="pgtitle">System: Package Manager</p>
72
<form action="firewall_nat_out_load_balancing.php" method="post">
73
<?php if ($savemsg) print_info_box($savemsg); ?>
74
<?php if (file_exists($d_natconfdirty_path)): ?><p>
75
<?php print_info_box_np("The Package Manager configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
76
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
77
<?php endif; ?>
78
<?php
79
$configa = $config;
80
if(!file_exists("/tmp/pkg_config.xml")) {
81
            mwexec("cd {$g['tmp_path']} && /usr/bin/fetch \"http://www.pfsense.com/packages/pkg_config.xml\" >/dev/null 2>&1 ");
82
            if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) {
83
                        print_info_box_np("Could not download pkg_config.xml from pfSense.com.  Check your DNS settings.");
84
                        die;
85
            }
86
}
87

    
88
$pkg_config = parse_xml_config("{$g['tmp_path']}/pkg_config.xml", "pfsensepkgs");
89

    
90
if(!$pkg_config['packages']) {
91
            print_info_box_np("Could not find any packages in pkg_config.xml");
92
}
93
?>
94
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
95
  <ul id="tabnav">
96
    <li class="tabact">Available Packages</a></li>
97
    <li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
98
  </ul>
99
  </td></tr>
100
  <tr>
101
    <td class="tabcont">
102
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
103
                <tr>
104
                  <td width="25%" class="listhdrr">Package Name</td>
105
                  <td width="25%" class="listhdrr">Category</td>
106
                  <td width="50%" class="listhdr">Description</td>
107
                </tr>
108

    
109
		<?php
110
		 $i = 0;
111
		    foreach ($pkg_config['packages']['package'] as $pkg) {
112
                        if(is_array($configa['installedpackages']['package'])) {
113
                            foreach ($configa['installedpackages']['package'] as $installed) {
114
                                        if($installed['name'] == $pkg['name'])
115
                                                    $pkg['name'] = "";
116
                            }
117
                        }
118
                        if($pkg['name'] <> "") {
119
                            ?>
120
                            <tr valign="top">
121
                                <td class="listlr">
122
                                    <?= $pkg['name'] ?>
123
                                </td>
124
                                <td class="listlr">
125
                                    <?= $pkg['category'] ?>
126
                                </td>
127
                                <td class="listbg">
128
                                    <font color="#FFFFFFF">
129
                                    <?= $pkg['descr'] ?>
130
                                </td>
131
                                <td valign="middle" class="list" nowrap>
132
                                    <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>
133

    
134
                                </td>
135
                            </tr>
136

    
137
                            <?php
138
                            $i++;
139
                        }
140
		    }
141
		?>
142
        </table>
143
    </td>
144
  </tr>
145
</table>
146
</form>
147
<?php include("fend.inc"); ?>
148
</body>
149
</html>
150

    
151
<?php mwexec("rm /tmp/pkg_config.xml"); ?>
152

    
(50-50/93)