Project

General

Profile

Download (5.76 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    pkg_mgr.php
5
    Copyright (C) 2004, 2005 Scott Ullrich
6
    All rights reserved.
7

    
8
    Redistribution and use in source and binary forms, with or without
9
    modification, are permitted provided that the following conditions are met:
10

    
11
    1. Redistributions of source code must retain the above copyright notice,
12
       this list of conditions and the following disclaimer.
13

    
14
    2. Redistributions in binary form must reproduce the above copyright
15
       notice, this list of conditions and the following disclaimer in the
16
       documentation and/or other materials provided with the distribution.
17

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

    
30
require_once("guiconfig.inc");
31
require_once("pkg-utils.inc");
32

    
33
$pkg_info = get_pkg_info('all', array('name', 'category', 'website', 'version', 'status', 'descr', 'maintainer'));
34
if($pkg_info) {
35
	$fout = fopen("{$g['tmp_path']}/pkg_info.cache", "w");
36
	fwrite($fout, serialize($pkg_info));
37
	fclose($fout);
38
        //$pkg_sizes = get_pkg_sizes();
39
} else {
40
	$using_cache = true;
41
        $savemsg = "Unable to retrieve package info from {$g['xmlrpcbaseurl']}. Cached data will be used.";
42
	$pkg_info = unserialize(@file_get_contents("{$g['tmp_path']}/pkg_info.cache"));
43
}
44

    
45
$pgtitle = "System: Package Manager";
46
include("head.inc");
47

    
48
?>
49

    
50
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
51
<?php
52
include("fbegin.inc");
53
?>
54
<p class="pgtitle"><?=$pgtitle?></p>
55
<?php if ($savemsg) print_info_box($savemsg); ?>
56
<?php
57

    
58
?>
59

    
60
<br>
61

    
62
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
63
<?php
64
	$tab_array = array();
65
	$tab_array[0] = array("Available Packages", true, "pkg_mgr.php");
66
	$tab_array[1] = array("Installed Packages", false, "pkg_mgr_installed.php");
67
	display_top_tabs($tab_array);
68
?> 
69
  </td></tr>
70
  <tr>
71
    <td>
72
	<div id="mainarea">
73
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
74
                <tr>
75
                  <td width="10%" class="listhdrr">Package Name</td>
76
                  <td width="25%" class="listhdrr">Category</td>
77
<!--
78
		  <td width="10%" class="listhdrr">Size</td>
79
-->
80
		  <td width="5%" class="listhdrr">Status</td>
81
		  <td width="5%" class="listhdrr">Maintainer</td>
82
                  <td width="50%" class="listhdr">Description</td>
83
                </tr>
84

    
85
		<?php
86
		 if(!$pkg_info) {
87
			echo "<tr><td colspan=\"5\"><center>There are currently no packages available for installation.</td></tr>";
88
		 } else {
89
		 $pkgs = array();
90
		 $instpkgs = array();
91
		    if($config['installedpackages']['package'] != "")
92
			foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
93
		    $pkg_names = array_keys($pkg_info);
94
		    $pkg_keys = array();
95
		    foreach($pkg_names as $name) {
96
			if(!in_array($name, $instpkgs)) $pkg_keys[] = $name;
97
		    }
98
		    sort($pkg_keys);
99
		    if(count($pkg_keys) != 0) {
100
		    	foreach($pkg_keys as $key) {
101
			    $index = &$pkg_info[$key];
102
			    if(in_array($index['name'], $instpkgs)) continue;
103
                            ?>
104
                            <tr valign="top">
105
                                <td class="listlr">
106
                                    <A target="_new" href="<?= $index['website'] ?>"><?= $index['name'] ?></a>
107
                                </td>
108
                                <td class="listlr">
109
                                    <?= $index['category'] ?>
110
    				</td>
111
				<?php
112
					/*
113
					if(!$using_cache) {
114
						$size = get_package_install_size($index['name'], $pkg_sizes);
115
                               			$size = squash_from_bytes($size[$index['name']], 1);
116
					}
117
					if(!$size) $size = "Unknown.";
118
					*/
119
				?>
120
				<!--
121
				<td class="listlr">
122
                                 	<?= $size ?>
123
                                </td>
124
				-->
125
				<td class="listlr">
126
					<?= $index['status'] ?>
127
					<br>
128
					<?= $index['version'] ?>
129
                                </td>
130
                                <td class="listlr">
131
					<?php
132
						if($index['maintainer'] != "") {
133
							echo "<a href='mailto:{$index['maintainer']}'>{$index['maintainer']}</a>";
134
						} else {
135
							echo "Nobody. <a href='mailto:coreteam@pfsense.com'>Apply</a> for it!";
136
						}
137
					?>
138
                                </td>									
139
                                <td class="listbg">
140
                                    <font color="#ffffff">
141
                                    <?= $index['descr'] ?>
142
                                </td>
143
                                <td valign="middle" class="list" nowrap>
144
                                    <a onclick="return confirm('Do you really want to install this package?')" href="pkg_mgr_install.php?id=<?=$index['name'];?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
145
                                </td>
146
                            </tr>
147
                            <?php
148
                        }
149
		    } else {
150
			echo '<tr><td colspan="5"><center>There are currently no packages available for installation.</center></td></tr>';
151
		    }
152
		}
153
		?>
154
        </table>
155
	</div>
156
    </td>
157
  </tr>
158
</table>
159
<?php include("fend.inc"); ?>
160
</body>
161
</html>
(83-83/159)