Project

General

Profile

Download (4.07 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	pkg_mgr_settings.php
5
	part of pfSense
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	Copyright (C) 2009 Jim Pingle <jimp@pfsense.org>
8
	Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
9
	Copyright (C) 2005 Colin Smith
10

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

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

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

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

    
36
##|+PRIV
37
##|*IDENT=page-pkg-mgr-settings
38
##|*NAME=Packages: Settings page
39
##|*DESCR=Allow access to the 'Packages: Settings' page.
40
##|*MATCH=pkg_mgr_settings.php*
41
##|-PRIV
42

    
43
ini_set('max_execution_time', '0');
44

    
45
require_once("globals.inc");
46
require_once("guiconfig.inc");
47
require_once("pkg-utils.inc");
48

    
49
if ($_POST) {
50
	if($_POST['alturlenable'] == "yes") {
51
		$config['system']['altpkgrepo']['enable'] = 'yes';
52
		$config['system']['altpkgrepo']['xmlrpcbaseurl'] = $_POST['pkgrepourl'];
53
	} else {
54
		unset($config['system']['altpkgrepo']['enable']);
55
	}
56

    
57
	write_config();
58
}
59

    
60
$curcfg = $config['system']['altpkgrepo'];
61
$closehead = false;
62
$pgtitle = array(gettext("System"),gettext("Package Settings"));
63
include("head.inc");
64

    
65
// Print package server mismatch warning. See https://redmine.pfsense.org/issues/484
66
if (!verify_all_package_servers())
67
	print_info_box(package_server_mismatch_message());
68

    
69
// Print package server SSL warning. See https://redmine.pfsense.org/issues/484
70
if (check_package_server_ssl() === false)
71
	print_info_box(package_server_ssl_failure_message());
72

    
73
if ($savemsg)
74
	print_info_box($savemsg);
75

    
76
$version = file_get_contents("/etc/version");
77
$tab_array = array();
78
$tab_array[] = array(sprintf(gettext("%s packages"), $version), false, "pkg_mgr.php");
79
$tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php");
80
$tab_array[] = array(gettext("Package Settings"), true, "pkg_mgr_settings.php");
81
display_top_tabs($tab_array);
82

    
83
print_info_box(gettext('This page allows an alternate package repository to be configured, primarily for temporary use as a testing mechanism.' .
84
					   'The contents of unofficial packages servers cannot be verified and may contain malicious files.' .
85
					   'The package server settings should remain at their default values to ensure that verifiable and trusted packages are recevied.' .
86
					   'A warning is printed on the Dashboard and in the package manager when an unofficial package server is in use.'), 'default');
87

    
88
require('classes/Form.class.php');
89

    
90
$form = new Form();
91

    
92
$section = new Form_Section('Alternate package repository');
93

    
94
$section->addInput(new Form_Checkbox(
95
	'alturlenable',
96
	'Enable Alternate',
97
	'Use a non-official server for packages',
98
	$curcfg['enable']
99
))->toggles('.form-group:not(:first-child)');
100

    
101
$section->addInput(new Form_Input(
102
	'pkgrepourl',
103
	'Package Repository URL',
104
	'text',
105
	$curcfg['xmlrpcbaseurl'] ? $curcfg['xmlrpcbaseurl'] : $g['']
106
))->setHelp(sprintf("This is where %s will check for packages when the",$g['product_name']) .
107
			'<a href="pkg_mgr.php">' . ' ' . 'System: Packages' . ' </a>' . 'page is viewed.');
108

    
109
$form->add($section);
110
print($form);
111

    
112
include("foot.inc");
(121-121/241)