Project

General

Profile

Download (4.97 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_once("guiconfig.inc");
32
require_once("pkg-utils.inc");
33

    
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
<?php
66
include("fbegin.inc");
67
?>
68
<p class="pgtitle">System: Package Manager</p>
69
<br>
70
<?php if ($savemsg) print_info_box($savemsg); ?>
71
<?php
72

    
73
$pkg_info = get_pkg_info('all', array('name', 'category', 'website', 'version', 'status', 'descr'));
74

    
75
?>
76
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
77
  <ul id="tabnav">
78
    <li class="tabact">Available Packages</a></li>
79
    <li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
80
  </ul>
81
  </td></tr>
82
  <tr>
83
    <td class="tabcont">
84
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
85
                <tr>
86
                  <td width="10%" class="listhdrr">Package Name</td>
87
                  <td width="25%" class="listhdrr">Category</td>
88
				  <td width="5%" class="listhdrr">Status</td>
89
                  <td width="50%" class="listhdr">Description</td>
90
                </tr>
91

    
92
		<?php
93
		 $pkgs = array();
94
		 $instpkgs = array();
95
		    if($config['installedpackages']['package'] != "")
96
			foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
97
		    $pkg_names = array_keys($pkg_info);
98
		    foreach($pkg_names as $name) {
99
			if(!in_array($name, $instpkgs)) $pkg_keys[] = $name;
100
		    }
101
		    sort($pkg_keys);
102
		    if(count($pkg_keys) != 0) {
103
		    	foreach($pkg_keys as $key) {
104
			    $index = &$pkg_info[$key];
105
			    if(in_array($index['name'], $instpkgs)) continue;
106
                            ?>
107
                            <tr valign="top">
108
                                <td class="listlr">
109
                                    <A target="_new" href="<?= $index['website'] ?>"><?= $index['name'] ?></a>
110
                                </td>
111
                                <td class="listlr">
112
                                    <?= $index['category'] ?>
113
    							</td>
114
                                <td class="listlr">
115
									<?= $index['status'] ?>
116
									<br>
117
									<?= $index['version'] ?>
118
                                </td>
119
                                <td class="listbg">
120
                                    <font color="#FFFFFFF">
121
                                    <?= $index['descr'] ?>
122
                                </td>
123
                                <td valign="middle" class="list" nowrap>
124
                                    <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>
125
                                </td>
126
                            </tr>
127
                            <?php
128
                        }
129
		    } else {
130
			echo "<tr><td colspan=\"3\"><center>There are currently no available packages for installation.</td></tr>";
131
		    }
132
		?>
133
        </table>
134
    </td>
135
  </tr>
136
</table>
137
<?php include("fend.inc"); ?>
138
</body>
139
</html>
(62-62/117)