]> git.mxchange.org Git - friendica-addons.git/blob - jappixmini/jappix/php/post-main.php
Merge branch '3.6-release'
[friendica-addons.git] / jappixmini / jappix / php / post-main.php
1 <?php
2
3 /*
4
5 Jappix - An open social platform
6 This is the main configuration POST handler (install & manager)
7
8 -------------------------------------------------
9
10 License: AGPL
11 Author: Vanaryon
12 Last revision: 26/08/11
13
14 */
15
16 // Someone is trying to hack us?
17 if(!defined('JAPPIX_BASE'))
18         exit;
19
20 // Service name
21 if(isset($_POST['service_name']) && !empty($_POST['service_name']))
22         $service_name = stripslashes(htmlspecialchars($_POST['service_name']));
23 else
24         $service_name = stripslashes(htmlspecialchars($main_default['name']));
25
26 // Service description
27 if(isset($_POST['service_desc']) && !empty($_POST['service_desc']))
28         $service_desc = stripslashes(htmlspecialchars($_POST['service_desc']));
29 else
30         $service_desc = stripslashes(htmlspecialchars($main_default['desc']));
31
32 // Jappix resource
33 if(isset($_POST['jappix_resource']) && !empty($_POST['jappix_resource']))
34         $jappix_resource = stripslashes(htmlspecialchars($_POST['jappix_resource']));
35 else
36         $jappix_resource = stripslashes(htmlspecialchars($main_default['resource']));
37
38 // Lock host
39 if(isset($_POST['lock_host']) && !empty($_POST['lock_host']))
40         $lock_host = 'on';
41 else
42         $lock_host = 'off';
43
44 // Anonymous mode
45 if(isset($_POST['anonymous_mode']) && !empty($_POST['anonymous_mode']))
46         $anonymous_mode = 'on';
47 else
48         $anonymous_mode = 'off';
49
50 // Registration
51 if(isset($_POST['registration']) && !empty($_POST['registration']))
52         $registration = 'on';
53 else
54         $registration = 'off';
55
56 // BOSH proxy
57 if(isset($_POST['bosh_proxy']) && !empty($_POST['bosh_proxy']))
58         $bosh_proxy = 'on';
59 else
60         $bosh_proxy = 'off';
61
62 // Manager link
63 if(isset($_POST['manager_link']) && !empty($_POST['manager_link']))
64         $manager_link = 'on';
65 else
66         $manager_link = 'off';
67
68 // Groupchats to join
69 if(isset($_POST['groupchats_join']) && !empty($_POST['groupchats_join']))
70         $groupchats_join = stripslashes(htmlspecialchars(trim($_POST['groupchats_join'])));
71 else
72         $groupchats_join = stripslashes(htmlspecialchars($main_default['groupchats_join']));
73
74 // Encryption
75 if(isset($_POST['encryption']) && !empty($_POST['encryption']))
76         $encryption = 'on';
77 else
78         $encryption = 'off';
79
80 // HTTPS storage
81 if(isset($_POST['https_storage']) && !empty($_POST['https_storage']))
82         $https_storage = 'on';
83 else
84         $https_storage = 'off';
85
86 // Force HTTPS
87 if(isset($_POST['https_force']) && !empty($_POST['https_force']))
88         $https_force = 'on';
89 else
90         $https_force = 'off';
91
92 // Compression
93 if(isset($_POST['compression']) && !empty($_POST['compression']))
94         $compression = 'on';
95 else
96         $compression = 'off';
97
98 // Multiple resources
99 if(isset($_POST['multi_files']) && ($_POST['multi_files'] == 'on'))
100         $multi_files = 'on';
101 else
102         $multi_files = 'off';
103
104 // Developer mode
105 if(isset($_POST['developer']) && ($_POST['developer'] == 'on'))
106         $developer = 'on';
107 else
108         $developer = 'off';
109
110 // Generate the configuration XML content
111 $conf_xml = 
112         '<name>'.$service_name.'</name>
113         <desc>'.$service_desc.'</desc>
114         <resource>'.$jappix_resource.'</resource>
115         <lock>'.$lock_host.'</lock>
116         <anonymous>'.$anonymous_mode.'</anonymous>
117         <registration>'.$registration.'</registration>
118         <bosh_proxy>'.$bosh_proxy.'</bosh_proxy>
119         <manager_link>'.$manager_link.'</manager_link>
120         <groupchats_join>'.$groupchats_join.'</groupchats_join>
121         <encryption>'.$encryption.'</encryption>
122         <https_storage>'.$https_storage.'</https_storage>
123         <https_force>'.$https_force.'</https_force>
124         <compression>'.$compression.'</compression>
125         <multi_files>'.$multi_files.'</multi_files>
126         <developer>'.$developer.'</developer>'
127 ;
128
129 // Write the main configuration
130 writeXML('conf', 'main', $conf_xml);