Welcome to mirror list, hosted at ThFree Co, Russian Federation.

post-hosts.php « server - github.com/jappix/jappix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 13f749545438039efcd43988543da63e1f5082a0 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php

/*

Jappix - An open social platform
This is the hosts configuration POST handler (install & manager)

-------------------------------------------------

License: AGPL
Author: Valérian Saliou

*/

// Someone is trying to hack us?
if(!defined('JAPPIX_BASE')) {
    exit;
}

// Main host
if(isset($_POST['host_main']) && !empty($_POST['host_main'])) {
    $host_main = stripslashes(htmlspecialchars($_POST['host_main']));
} else {
    $host_main = stripslashes(htmlspecialchars($hosts_default['main']));
}

// Groupchat host
if(isset($_POST['host_muc']) && !empty($_POST['host_muc'])) {
    $host_muc = stripslashes(htmlspecialchars($_POST['host_muc']));
} else {
    $host_muc = stripslashes(htmlspecialchars($hosts_default['muc']));
}

// Pubsub host
if(isset($_POST['host_pubsub']) && !empty($_POST['host_pubsub'])) {
    $host_pubsub = stripslashes(htmlspecialchars($_POST['host_pubsub']));
} else {
    $host_pubsub = stripslashes(htmlspecialchars($hosts_default['pubsub']));
}

// Directory host
if(isset($_POST['host_vjud']) && !empty($_POST['host_vjud'])) {
    $host_vjud = stripslashes(htmlspecialchars($_POST['host_vjud']));
} else {
    $host_vjud = stripslashes(htmlspecialchars($hosts_default['vjud']));
}

// Anonymous host
if(isset($_POST['host_anonymous']) && !empty($_POST['host_anonymous'])) {
    $host_anonymous = stripslashes(htmlspecialchars($_POST['host_anonymous']));
} else {
    $host_anonymous = stripslashes(htmlspecialchars($hosts_default['anonymous']));
}

// STUN host
if(isset($_POST['host_stun']) && !empty($_POST['host_stun'])) {
    $host_stun = stripslashes(htmlspecialchars($_POST['host_stun']));
} else {
    $host_stun = stripslashes(htmlspecialchars($hosts_default['stun']));
}

// TURN host
if(isset($_POST['host_turn']) && !empty($_POST['host_turn'])) {
    $host_turn = stripslashes(htmlspecialchars($_POST['host_turn']));
} else {
    $host_turn = stripslashes(htmlspecialchars($hosts_default['turn']));
}

// TURN host username
if(isset($_POST['host_turn_username']) && !empty($_POST['host_turn_username'])) {
    $host_turn_username = stripslashes(htmlspecialchars($_POST['host_turn_username']));
} else {
    $host_turn_username = stripslashes(htmlspecialchars($hosts_default['turn_username']));
}

// TURN host password
if(isset($_POST['host_turn_password']) && !empty($_POST['host_turn_password'])) {
    $host_turn_password = stripslashes(htmlspecialchars($_POST['host_turn_password']));
} else {
    $host_turn_password = stripslashes(htmlspecialchars($hosts_default['turn_password']));
}

// BOSH host
if(isset($_POST['host_bosh']) && !empty($_POST['host_bosh'])) {
    $host_bosh = stripslashes(htmlspecialchars($_POST['host_bosh']));
} else {
    $host_bosh = stripslashes(htmlspecialchars($hosts_default['bosh']));
}

// Main BOSH host
if(isset($_POST['host_bosh_main']) && !empty($_POST['host_bosh_main'])) {
    $host_bosh_main = stripslashes(htmlspecialchars($_POST['host_bosh_main']));
} else {
    $host_bosh_main = stripslashes(htmlspecialchars($hosts_default['bosh_main']));
}

// Mini BOSH host
if(isset($_POST['host_bosh_mini']) && !empty($_POST['host_bosh_mini'])) {
    $host_bosh_mini = stripslashes(htmlspecialchars($_POST['host_bosh_mini']));
} else {
    $host_bosh_mini = stripslashes(htmlspecialchars($hosts_default['bosh_mini']));
}

// WebSocket host
if(isset($_POST['host_websocket']) && !empty($_POST['host_websocket'])) {
    $host_websocket = stripslashes(htmlspecialchars($_POST['host_websocket']));
} else {
    $host_websocket = stripslashes(htmlspecialchars($hosts_default['websocket']));
}

// Static host
if(isset($_POST['host_static']) && !empty($_POST['host_static'])) {
    $host_static = stripslashes(htmlspecialchars($_POST['host_static']));
} else {
    $host_static = stripslashes(htmlspecialchars($hosts_default['static']));
}

// Upload host
if(isset($_POST['host_upload']) && !empty($_POST['host_upload'])) {
    $host_upload = stripslashes(htmlspecialchars($_POST['host_upload']));
} else {
    $host_upload = stripslashes(htmlspecialchars($hosts_default['upload']));
}

// BOSH proxy
if(isset($_POST['bosh_proxy']) && !empty($_POST['bosh_proxy'])) {
    $bosh_proxy = 'on';
} else {
    $bosh_proxy = 'off';
}

// Generate the hosts XML content
$hosts_xml =
    '<main>'.$host_main.'</main>
    <muc>'.$host_muc.'</muc>
    <pubsub>'.$host_pubsub.'</pubsub>
    <vjud>'.$host_vjud.'</vjud>
    <anonymous>'.$host_anonymous.'</anonymous>
    <stun>'.$host_stun.'</stun>
    <turn>'.$host_turn.'</turn>
    <turn_username>'.$host_turn_username.'</turn_username>
    <turn_password>'.$host_turn_password.'</turn_password>
    <bosh>'.$host_bosh.'</bosh>
    <bosh_main>'.$host_bosh_main.'</bosh_main>
    <bosh_mini>'.$host_bosh_mini.'</bosh_mini>
    <websocket>'.$host_websocket.'</websocket>
    <static>'.$host_static.'</static>
    <upload>'.$host_upload.'</upload>
    <bosh_proxy>'.$bosh_proxy.'</bosh_proxy>'
;

// Write the main configuration
writeXML('conf', 'hosts', $hosts_xml);