Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
e5621835
Commit
e5621835
authored
Mar 15, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whitespace vpn_openvpn_export_shared.php
parent
eab8c64c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
104 deletions
+104
-104
vpn_openvpn_export_shared.php
src/www/vpn_openvpn_export_shared.php
+104
-104
No files found.
src/www/vpn_openvpn_export_shared.php
View file @
e5621835
<?php
/*
Copyright (C) 2008 Shrew Soft Inc.
Copyright (C) 2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2008 Shrew Soft Inc.
Copyright (C) 2010 Ermal Luçi
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"guiconfig.inc"
);
...
...
@@ -153,7 +153,7 @@ $( document ).ready(function() {
});
var
servers
=
new
Array
();
<?php
foreach
(
$ras_server
as
$sindex
=>
$server
)
:
<?php
foreach
(
$ras_server
as
$sindex
=>
$server
)
:
?>
servers
[
<?=
$sindex
;
?>
]
=
new
Array
();
servers
[
<?=
$sindex
;
...
...
@@ -166,102 +166,102 @@ endforeach; ?>
function
download_begin
(
act
)
{
var
index
=
document
.
getElementById
(
"
server
"
).
selectedIndex
;
var
useaddr
;
if
(
document
.
getElementById
(
"
useaddr
"
).
value
==
"
other
"
)
{
if
(
document
.
getElementById
(
"
useaddr_hostname
"
).
value
==
""
)
{
alert
(
"
<?=
gettext
(
'Please specify an IP address or hostname.'
)
?>
"
);
return
;
}
useaddr
=
document
.
getElementById
(
"
useaddr_hostname
"
).
value
;
}
else
useaddr
=
document
.
getElementById
(
"
useaddr
"
).
value
;
var
useproxy
=
0
;
var
useproxypass
=
0
;
if
(
document
.
getElementById
(
"
useproxy
"
).
checked
)
useproxy
=
1
;
var
proxyaddr
=
document
.
getElementById
(
"
proxyaddr
"
).
value
;
var
proxyport
=
document
.
getElementById
(
"
proxyport
"
).
value
;
if
(
useproxy
)
{
if
(
!
proxyaddr
||
!
proxyport
)
{
alert
(
"
<?=
gettext
(
'The proxy ip and port cannot be empty'
)
?>
"
);
return
;
}
if
(
document
.
getElementById
(
"
useproxypass
"
).
value
!=
'
none
'
)
useproxypass
=
1
;
var
proxytype
=
document
.
getElementById
(
"
useproxytype
"
).
value
;
var
proxyauth
=
document
.
getElementById
(
"
useproxypass
"
).
value
;
var
proxyuser
=
document
.
getElementById
(
"
proxyuser
"
).
value
;
var
proxypass
=
document
.
getElementById
(
"
proxypass
"
).
value
;
var
proxyconf
=
document
.
getElementById
(
"
proxyconf
"
).
value
;
if
(
useproxypass
)
{
if
(
!
proxyuser
)
{
alert
(
"
<?=
gettext
(
'Please fill the proxy username and password.'
)
?>
"
);
return
;
}
if
(
!
proxypass
||
!
proxyconf
)
{
alert
(
"
<?=
gettext
(
'The proxy password or confirm field is empty'
)
?>
"
);
return
;
}
if
(
proxypass
!=
proxyconf
)
{
alert
(
"
<?=
gettext
(
'The proxy password and confirm fields must match'
)
?>
"
);
return
;
}
}
}
var
dlurl
;
dlurl
=
"
/vpn_openvpn_export_shared.php?act=
"
+
act
;
dlurl
+=
"
&srvid=
"
+
servers
[
index
][
0
];
dlurl
+=
"
&useaddr=
"
+
useaddr
;
if
(
useproxy
)
{
dlurl
+=
"
&proxy_type=
"
+
escape
(
proxytype
);
dlurl
+=
"
&proxy_addr=
"
+
proxyaddr
;
dlurl
+=
"
&proxy_port=
"
+
proxyport
;
dlurl
+=
"
&proxy_authtype=
"
+
proxyauth
;
if
(
useproxypass
)
{
dlurl
+=
"
&proxy_user=
"
+
proxyuser
;
dlurl
+=
"
&proxy_password=
"
+
proxypass
;
}
}
window
.
open
(
dlurl
,
"
_self
"
);
var
index
=
document
.
getElementById
(
"
server
"
).
selectedIndex
;
var
useaddr
;
if
(
document
.
getElementById
(
"
useaddr
"
).
value
==
"
other
"
)
{
if
(
document
.
getElementById
(
"
useaddr_hostname
"
).
value
==
""
)
{
alert
(
"
<?=
gettext
(
'Please specify an IP address or hostname.'
)
?>
"
);
return
;
}
useaddr
=
document
.
getElementById
(
"
useaddr_hostname
"
).
value
;
}
else
useaddr
=
document
.
getElementById
(
"
useaddr
"
).
value
;
var
useproxy
=
0
;
var
useproxypass
=
0
;
if
(
document
.
getElementById
(
"
useproxy
"
).
checked
)
useproxy
=
1
;
var
proxyaddr
=
document
.
getElementById
(
"
proxyaddr
"
).
value
;
var
proxyport
=
document
.
getElementById
(
"
proxyport
"
).
value
;
if
(
useproxy
)
{
if
(
!
proxyaddr
||
!
proxyport
)
{
alert
(
"
<?=
gettext
(
'The proxy ip and port cannot be empty'
)
?>
"
);
return
;
}
if
(
document
.
getElementById
(
"
useproxypass
"
).
value
!=
'
none
'
)
useproxypass
=
1
;
var
proxytype
=
document
.
getElementById
(
"
useproxytype
"
).
value
;
var
proxyauth
=
document
.
getElementById
(
"
useproxypass
"
).
value
;
var
proxyuser
=
document
.
getElementById
(
"
proxyuser
"
).
value
;
var
proxypass
=
document
.
getElementById
(
"
proxypass
"
).
value
;
var
proxyconf
=
document
.
getElementById
(
"
proxyconf
"
).
value
;
if
(
useproxypass
)
{
if
(
!
proxyuser
)
{
alert
(
"
<?=
gettext
(
'Please fill the proxy username and password.'
)
?>
"
);
return
;
}
if
(
!
proxypass
||
!
proxyconf
)
{
alert
(
"
<?=
gettext
(
'The proxy password or confirm field is empty'
)
?>
"
);
return
;
}
if
(
proxypass
!=
proxyconf
)
{
alert
(
"
<?=
gettext
(
'The proxy password and confirm fields must match'
)
?>
"
);
return
;
}
}
}
var
dlurl
;
dlurl
=
"
/vpn_openvpn_export_shared.php?act=
"
+
act
;
dlurl
+=
"
&srvid=
"
+
servers
[
index
][
0
];
dlurl
+=
"
&useaddr=
"
+
useaddr
;
if
(
useproxy
)
{
dlurl
+=
"
&proxy_type=
"
+
escape
(
proxytype
);
dlurl
+=
"
&proxy_addr=
"
+
proxyaddr
;
dlurl
+=
"
&proxy_port=
"
+
proxyport
;
dlurl
+=
"
&proxy_authtype=
"
+
proxyauth
;
if
(
useproxypass
)
{
dlurl
+=
"
&proxy_user=
"
+
proxyuser
;
dlurl
+=
"
&proxy_password=
"
+
proxypass
;
}
}
window
.
open
(
dlurl
,
"
_self
"
);
}
function
server_changed
()
{
var
table
=
document
.
getElementById
(
"
clients
"
);
while
(
table
.
rows
.
length
>
1
)
{
var
table
=
document
.
getElementById
(
"
clients
"
);
while
(
table
.
rows
.
length
>
1
)
{
table
.
deleteRow
(
1
);
}
var
index
=
document
.
getElementById
(
"
server
"
).
selectedIndex
;
var
index
=
document
.
getElementById
(
"
server
"
).
selectedIndex
;
if
(
servers
[
index
][
2
]
==
'
p2p_shared_key
'
)
{
var
row
=
table
.
insertRow
(
table
.
rows
.
length
);
var
cell0
=
row
.
insertCell
(
0
);
var
cell1
=
row
.
insertCell
(
1
);
cell0
.
innerHTML
=
"
Other Shared Key OS Client
"
;
if
(
servers
[
index
][
2
]
==
'
p2p_shared_key
'
)
{
var
row
=
table
.
insertRow
(
table
.
rows
.
length
);
var
cell0
=
row
.
insertCell
(
0
);
var
cell1
=
row
.
insertCell
(
1
);
cell0
.
innerHTML
=
"
Other Shared Key OS Client
"
;
cell1
.
innerHTML
+=
"
<div>
"
;
cell1
.
innerHTML
+=
"
<button type='button' class='btn btn-primary btn-xs' onclick='download_begin(
\"
skconf
\"
)'>Configuration</button>
"
;
cell1
.
innerHTML
+=
"
"
;
cell1
.
innerHTML
+=
"
<button type='button' class='btn btn-primary btn-xs' onclick='download_begin(
\"
skzipconf
\"
)'>Configuration archive</button>
"
;
cell1
.
innerHTML
+=
"
</div>
"
;
}
}
}
function
useaddr_changed
(
obj
)
{
if
(
obj
.
value
==
"
other
"
)
$
(
'
#HostName
'
).
show
();
else
$
(
'
#HostName
'
).
hide
();
if
(
obj
.
value
==
"
other
"
)
$
(
'
#HostName
'
).
show
();
else
$
(
'
#HostName
'
).
hide
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment