]> git.mxchange.org Git - friendica-addons.git/blob - jappixmini/jappix/php/read-main.php
Merge branch '3.6-release'
[friendica-addons.git] / jappixmini / jappix / php / read-main.php
1 <?php
2
3 /*
4
5 Jappix - An open social platform
6 This is the main configuration reader
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 // Define the default main configuration values
21 $main_conf = array(
22                 'name'                  => 'Jappix',
23                 'desc'                  => 'a free social network',
24                 'resource'              => 'Jappix',
25                 'lock'                  => 'on',
26                 'anonymous'             => 'on',
27                 'registration'          => 'on',
28                 'bosh_proxy'            => 'on',
29                 'manager_link'          => 'on',
30                 'groupchats_join'       => '',
31                 'encryption'            => 'on',
32                 'https_storage'         => 'off',
33                 'https_force'           => 'off',
34                 'compression'           => 'off',
35                 'multi_files'           => 'off',
36                 'developer'             => 'off'
37              );
38
39 // Define a default values array
40 $main_default = $main_conf;
41
42 // Read the main configuration file
43 $main_data = readXML('conf', 'main');
44
45 // Read the main configuration file
46 if($main_data) {
47         // Initialize the main configuration XML data
48         $main_xml = new SimpleXMLElement($main_data);
49         
50         // Loop the main configuration elements
51         foreach($main_xml->children() as $main_child) {
52                 $main_value = $main_child->getName();
53                 
54                 // Only push this to the array if it exists
55                 if(isset($main_conf[$main_value]) && $main_child)
56                         $main_conf[$main_value] = $main_child;
57         }
58 }
59
60 // Finally, define the main configuration globals
61 define('SERVICE_NAME', $main_conf['name']);
62 define('SERVICE_DESC', $main_conf['desc']);
63 define('JAPPIX_RESOURCE', $main_conf['resource']);
64 define('LOCK_HOST', $main_conf['lock']);
65 define('ANONYMOUS', $main_conf['anonymous']);
66 define('REGISTRATION', $main_conf['registration']);
67 define('BOSH_PROXY', $main_conf['bosh_proxy']);
68 define('MANAGER_LINK', $main_conf['manager_link']);
69 define('GROUPCHATS_JOIN', $main_conf['groupchats_join']);
70 define('ENCRYPTION', $main_conf['encryption']);
71 define('HTTPS_STORAGE', $main_conf['https_storage']);
72 define('HTTPS_FORCE', $main_conf['https_force']);
73 define('COMPRESSION', $main_conf['compression']);
74 define('MULTI_FILES', $main_conf['multi_files']);
75 define('DEVELOPER', $main_conf['developer']);
76
77 ?>