/
proxy.php
44 lines (40 loc) · 1.72 KB
/
proxy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Environment;
use Concrete\Core\Page\Controller\DashboardPageController;
use Config;
class Proxy extends DashboardPageController
{
public function view()
{
$httpProxyHost = Config::get('concrete.proxy.host');
//Log::addEntry('Proxy Host view config: ' . $httpProxyHost);
$httpProxyPort = Config::get('concrete.proxy.port');
$httpProxyUser = Config::get('concrete.proxy.user');
$httpProxyPwd = Config::get('concrete.proxy.password');
$this->set('http_proxy_host', $httpProxyHost);
$this->set('http_proxy_port', $httpProxyPort);
$this->set('http_proxy_user', $httpProxyUser);
$this->set('http_proxy_pwd', $httpProxyPwd);
}
public function update_proxy()
{
if ($this->token->validate("update_proxy")) {
if ($this->isPost()) {
//Log::addEntry('Proxy Host: ' . $this->post('http_proxy_host'));
Config::save('concrete.proxy.host', $this->post('http_proxy_host'));
Config::save('concrete.proxy.port', $this->post('http_proxy_port'));
Config::save('concrete.proxy.user', $this->post('http_proxy_user'));
Config::save('concrete.proxy.password', $this->post('http_proxy_pwd'));
//Log::addEntry('Proxy Host config: ' . Config::get('concrete.proxy.host'));
$this->redirect('/dashboard/system/environment/proxy', 'proxy_saved');
}
} else {
$this->set('error', array($this->token->getErrorMessage()));
}
}
public function proxy_saved()
{
$this->set('message', t('Proxy configuration saved.'));
$this->view();
}
}