5 Jappix - An open social platform
6 This is the Jappix Install PHP/HTML code
8 -------------------------------------------------
12 Last revision: 25/08/11
16 // Someone is trying to hack us?
17 if(!defined('JAPPIX_BASE'))
20 // Define the configuration folder
21 $conf_folder = JAPPIX_BASE.'/store/conf';
23 // Initialize the step
26 // Initialize some vars
27 $form_parent = 'install';
32 if(isset($_POST['step']) && !empty($_POST['step'])) {
33 $step = intval($_POST['step']);
36 // Administrator account configuration submitted
38 include(JAPPIX_BASE.'/php/post-users.php');
41 // Main configuration submitted
43 include(JAPPIX_BASE.'/php/post-main.php');
46 // Hosts configuration submitted
48 include(JAPPIX_BASE.'/php/post-hosts.php');
53 // Not frozen on the previous step?
54 if(!isset($_POST['check']) && (isset($_POST['submit']) || isset($_POST['finish']))) {
55 // Checks the current step is valid
56 if(($step >= 2) && !is_dir($conf_folder))
58 else if(($step >= 3) && !usersConfName())
60 else if(($step >= 4) && !file_exists($conf_folder.'/main.xml'))
62 else if(($step >= 5) && !file_exists($conf_folder.'/hosts.xml'))
68 // These steps are not available
69 if(($step > 6) || !is_int($step))
72 // Get the current step title
75 T_("Storage configuration"),
76 T_("Administrator account"),
77 T_("Main configuration"),
78 T_("Hosts configuration"),
79 T_("Services installation")
87 $form_action = './?m=install'.keepGet('m', false);
89 $form_action = './'.keepGet('m', true);
93 <?php htmlTag($locale); ?>
96 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
97 <meta name="robots" content="none" />
98 <title><?php _e("Jappix installation"); ?> • <?php echo($names[$step - 1]); ?></title>
99 <link rel="shortcut icon" href="./favicon.ico" />
100 <?php echoGetFiles($hash, '', 'css', 'install.xml', ''); echo "\n"; ?>
101 <!--[if lt IE 9]><?php echoGetFiles($hash, '', 'css', '', 'ie.css'); ?><![endif]-->
104 <body class="body-images">
105 <form id="install" method="post" action="<?php echo $form_action; ?>">
106 <div id="install-top">
107 <div class="logo install-images"><?php _e("Installation"); ?></div>
108 <div class="step"><?php echo $step; ?> <span>/ 6</span></div>
109 <div class="clear"></div>
111 <input type="hidden" name="step" value="<?php echo($step); ?>" />
114 <div id="install-content">
117 // First step: welcome
119 <h3 class="start install-images"><?php _e("Welcome to the Jappix installation!"); ?></h3>
121 <p><?php _e("This tool will help you fastly install Jappix, the first full-featured XMPP-based social platform, on your server. You don't even need any technical knowledge."); ?></p>
122 <p><?php _e("Let's have a look at the installation steps:"); ?></p>
125 <li><?php _e("Welcome"); ?></li>
126 <li><?php _e("Storage configuration"); ?></li>
127 <li><?php _e("Administrator account"); ?></li>
128 <li><?php _e("Main configuration"); ?></li>
129 <li><?php _e("Hosts configuration"); ?></li>
130 <li><?php _e("Services installation"); ?></li>
133 <p><?php printf(T_("If the current language does not match yours (%1s), you can make Jappix speak %2s it will be saved."), getLanguageName($locale), languageSwitcher($locale)); ?></p>
135 <p><?php _e("If you want to get some help about the Jappix installation and configuration, you can use our whole documentation, available at:"); ?> <a href="http://codingteam.net/project/jappix/doc" target="_blank">http://codingteam.net/project/jappix/doc</a></p>
137 <p><?php _e("It's time to build your own social cloud: just go to the next step!"); ?></p>
140 // Second step: storage configuration
141 else if($step == 2) { ?>
142 <h3 class="storage install-images"><?php _e("Storage configuration"); ?></h3>
144 <p><?php _e("Jappix stores persistent data (such as shared files, chat logs, your own music and its configuration) into a single secured storage folder."); ?></p>
146 <p><?php printf(T_("Jappix must be able to write in this folder to create its sub-directories. If not, you must set the rights to %1s or change the folder owner to %2s (depending of your configuration)."), '<em>777</em>', '<em>www-data</em>'); ?></p>
148 <?php if(is_writable(JAPPIX_BASE.'/store')) {
149 // Create the store tree
150 include(JAPPIX_BASE.'/php/store-tree.php');
152 <p class="info bigspace success"><?php _e("The folder is writable, you can continue!"); ?></p>
158 <p class="info bigspace fail"><?php printf(T_("The folder is not writable, set the right permissions to the %s directory."), "<em>./store</em>"); ?></p>
162 // Third step: administrator account
163 else if($step == 3) { ?>
164 <h3 class="account install-images"><?php _e("Administrator account"); ?></h3>
166 <p><?php _e("Jappix offers you the possibility to manage your configuration, install new plugins or search for updates. That's why you must create an administrator account to access the manager."); ?></p>
168 <p><?php _e("When Jappix will be installed, just click on the manager link on the home page to access it."); ?></p>
172 // Include the user add form
173 include(JAPPIX_BASE.'/php/form-users.php');
175 if(!$valid_user) { ?>
176 <p class="info bigspace fail"><?php _e("Oops, you missed something or the two passwords do not match!"); ?></p>
180 // Fourth step: main configuration
181 else if($step == 4) { ?>
182 <h3 class="main install-images"><?php _e("Main configuration"); ?></h3>
184 <p><?php _e("Jappix needs that you specify some values to work. Please correct the following inputs (or keep the default values, which are sufficient for most people)."); ?></p>
186 <p><?php _e("Note that if you don't specify a value which is compulsory, it will be automatically completed with the default one."); ?></p>
190 // Define the main configuration variables
191 include(JAPPIX_BASE.'/php/vars-main.php');
193 // Are we using developer mode?
194 if(preg_match('/~dev/i', $version))
197 // Include the main configuration form
198 include(JAPPIX_BASE.'/php/form-main.php');
201 // Fifth step: hosts configuration
202 else if($step == 5) { ?>
203 <h3 class="hosts install-images"><?php _e("Hosts configuration"); ?></h3>
205 <p><?php _e("This page helps you specify the default hosts Jappix will connect to. You can leave it as it is and continue if you want to use the official service hosts."); ?></p>
207 <p><?php _e("Maybe you don't know what a BOSH server is? In fact, this is a relay between a Jappix client and a XMPP server, which is necessary because of technical limitations."); ?></p>
209 <p><?php _e("Note that if you don't specify a value which is compulsory, it will be automatically completed with the default one."); ?></p>
213 // Define the hosts configuration variables
214 include(JAPPIX_BASE.'/php/vars-hosts.php');
216 // Include the hosts configuration form
217 include(JAPPIX_BASE.'/php/form-hosts.php');
220 // Last step: services installation
221 else if($step == 6) { ?>
222 <h3 class="services install-images"><?php _e("Services installation"); ?></h3>
224 <p><?php _e("You can install some extra softwares on your server, to extend your Jappix features. Some others might be modified, because of security restrictions which are set by default."); ?></p>
225 <p><?php _e("To perform this, you must be able to access your server's shell and be logged in as root. Remember this is facultative, Jappix will work without these modules, but some of its features will be unavailable."); ?></p>
229 // Write the installed marker
230 writeXML('conf', 'installed', '<installed>true</installed>');
232 // Checks some services are installed
233 $services_functions = array('gd_info', 'curl_init');
234 $services_names = array('GD', 'cURL');
235 $services_packages = array('php5-gd', 'php5-curl');
237 for($i = 0; $i < count($services_names); $i++) {
238 $service_class = 'info smallspace';
242 $service_class .= ' first';
244 // Service installed?
245 if(function_exists($services_functions[$i])) { ?>
246 <p class="<?php echo($service_class) ?> success"><?php printf(T_("%s is installed on your system."), $services_names[$i]); ?></p>
251 <p class="<?php echo($service_class) ?> fail"><?php printf(T_("%1s is not installed on your system, you should install %2s."), $services_names[$i], '<em>'.$services_packages[$i].'</em>'); ?></p>
255 // Checks the upload size limit
256 $upload_max = uploadMaxSize();
257 $upload_human = formatBytes($upload_max);
259 if($upload_max >= 7000000) { ?>
260 <p class="info smallspace last success"><?php printf(T_("PHP maximum upload size is sufficient (%s)."), $upload_human); ?></p>
264 <p class="info smallspace last fail"><?php printf(T_("PHP maximum upload size is not sufficient (%1s), you should define it to %2s in %3s."), $upload_human, '8M', '<em>php.ini</em>'); ?></p>
267 <p><?php _e("After you finished the setup, Jappix will generate the cache files. It might be slow, just wait until the application is displayed and do not press any button."); ?></p>
269 <p><?php _e("Thanks for using Jappix!"); ?></p>
273 <div id="install-buttons">
274 <?php if($continue && ($step < 6)) { ?>
275 <input type="submit" name="submit" value="<?php _e("Next"); ?> »" />
276 <?php } if($step == 6) { ?>
277 <input type="submit" name="finish" value="<?php _e("Finish"); ?> »" />
278 <?php } if(!$continue) { ?>
279 <input type="submit" name="check" value="<?php _e("Check again"); ?>" />
282 <div class="clear"></div>
289 <!-- Jappix Install <?php echo $version; ?> - An open social platform -->