1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
pkg_mgr_settings.php
|
5
|
part of pfSense
|
6
|
Copyright (C) 2009 Jim Pingle <jimp@pfsense.org>
|
7
|
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
8
|
Copyright (C) 2005 Colin Smith
|
9
|
|
10
|
Redistribution and use in source and binary forms, with or without
|
11
|
modification, are permitted provided that the following conditions are met:
|
12
|
|
13
|
1. Redistributions of source code must retain the above copyright notice,
|
14
|
this list of conditions and the following disclaimer.
|
15
|
|
16
|
2. Redistributions in binary form must reproduce the above copyright
|
17
|
notice, this list of conditions and the following disclaimer in the
|
18
|
documentation and/or other materials provided with the distribution.
|
19
|
|
20
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
POSSIBILITY OF SUCH DAMAGE.
|
30
|
*/
|
31
|
/*
|
32
|
pfSense_MODULE: pkgs
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-pkg-mgr-settings
|
37
|
##|*NAME=Packages: Settings page
|
38
|
##|*DESCR=Allow access to the 'Packages: Settings' page.
|
39
|
##|*MATCH=pkg_mgr_settings.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
ini_set('max_execution_time', '0');
|
43
|
|
44
|
require_once("globals.inc");
|
45
|
require_once("guiconfig.inc");
|
46
|
require_once("pkg-utils.inc");
|
47
|
|
48
|
if ($_POST) {
|
49
|
if (!$input_errors) {
|
50
|
if($_POST['alturlenable'] == "yes") {
|
51
|
$config['system']['altpkgrepo']['enable'] = true;
|
52
|
$config['system']['altpkgrepo']['xmlrpcbaseurl'] = $_POST['pkgrepourl'];
|
53
|
} else {
|
54
|
unset($config['system']['altpkgrepo']['enable']);
|
55
|
}
|
56
|
write_config();
|
57
|
}
|
58
|
}
|
59
|
|
60
|
$curcfg = $config['system']['altpkgrepo'];
|
61
|
$closehead = false;
|
62
|
$pgtitle = array(gettext("System"),gettext("Package Settings"));
|
63
|
include("head.inc");
|
64
|
?>
|
65
|
<script type="text/javascript">
|
66
|
//<![CDATA[
|
67
|
|
68
|
function enable_altpkgrepourl(enable_over) {
|
69
|
if (document.iform.alturlenable.checked || enable_over) {
|
70
|
document.iform.pkgrepourl.disabled = 0;
|
71
|
} else {
|
72
|
document.iform.pkgrepourl.disabled = 1;
|
73
|
}
|
74
|
}
|
75
|
|
76
|
//]]>
|
77
|
</script>
|
78
|
</head>
|
79
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
80
|
<?php include("fbegin.inc");
|
81
|
|
82
|
/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
|
83
|
if (!verify_all_package_servers())
|
84
|
print_info_box(package_server_mismatch_message());
|
85
|
|
86
|
/* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */
|
87
|
if (check_package_server_ssl() === false)
|
88
|
print_info_box(package_server_ssl_failure_message()); ?>
|
89
|
|
90
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
91
|
|
92
|
<form action="pkg_mgr_settings.php" method="post" name="iform" id="iform">
|
93
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
94
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="package manager settings">
|
95
|
<tr>
|
96
|
<td>
|
97
|
<?php
|
98
|
$version = file_get_contents("/etc/version");
|
99
|
$tab_array = array();
|
100
|
$tab_array[] = array(sprintf(gettext("%s packages"), $version), false, "pkg_mgr.php");
|
101
|
$tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php");
|
102
|
$tab_array[] = array(gettext("Package Settings"), true, "pkg_mgr_settings.php");
|
103
|
display_top_tabs($tab_array);
|
104
|
?>
|
105
|
</td>
|
106
|
</tr>
|
107
|
<tr><td><div id="mainarea">
|
108
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
109
|
<tr>
|
110
|
<td colspan="2" valign="top" class="vncell">
|
111
|
<?PHP echo gettext("This page allows an alternate package repository to be configured, primarily for temporary use as a testing mechanism."); ?>
|
112
|
<?PHP echo gettext("The contents of unofficial packages servers cannot be verified and may contain malicious files."); ?>
|
113
|
<?PHP echo gettext("The package server settings should remain at their default values to ensure that verifiable and trusted packages are recevied."); ?>
|
114
|
<br/><br/>
|
115
|
<?PHP echo gettext("A warning is printed on the Dashboard and in the package manager when an unofficial package server is in use."); ?>
|
116
|
<br/><br/>
|
117
|
</td>
|
118
|
</tr>
|
119
|
<tr>
|
120
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Package Repository URL");?></td>
|
121
|
</tr>
|
122
|
<tr>
|
123
|
<td valign="top" class="vncell"><?=gettext("Package Repository URL");?></td>
|
124
|
<td class="vtable">
|
125
|
<input name="alturlenable" type="checkbox" id="alturlenable" value="yes" onclick="enable_altpkgrepourl()" <?php if(isset($curcfg['enable'])) echo "checked=\"checked\""; ?> /> <?=gettext("Use a non-official server for packages");?> <br />
|
126
|
<table summary="alternative URL">
|
127
|
<tr><td><?=gettext("Base URL:");?></td><td><input name="pkgrepourl" type="text" class="formfld url" id="pkgrepourl" size="64" value="<?php if($curcfg['xmlrpcbaseurl']) echo $curcfg['xmlrpcbaseurl']; else echo $g['']; ?>" /></td></tr>
|
128
|
</table>
|
129
|
<span class="vexpl">
|
130
|
<?php printf(gettext("This is where %s will check for packages when the"),$g['product_name']);?> <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed.");?>
|
131
|
</span>
|
132
|
</td>
|
133
|
</tr>
|
134
|
<script type="text/javascript">
|
135
|
//<![CDATA[
|
136
|
enable_altpkgrepourl();
|
137
|
//]]>
|
138
|
</script>
|
139
|
<tr>
|
140
|
<td width="22%" valign="top"> </td>
|
141
|
<td width="78%">
|
142
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
143
|
</td>
|
144
|
</tr>
|
145
|
</table></div></td></tr></table>
|
146
|
</form>
|
147
|
<?php include("fend.inc"); ?>
|
148
|
</body>
|
149
|
</html>
|