| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * WiND - Wireless Nodes Database |
|---|
| 4 | * |
|---|
| 5 | * Copyright (C) 2011 K. Paliouras <squarious _at gmail [dot] com> |
|---|
| 6 | * |
|---|
| 7 | * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | * it under the terms of the GNU General Public License as published by |
|---|
| 9 | * the Free Software Foundation; version 2 dated June, 1991. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | * |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | require_once dirname(__FILE__) . '/tools.php'; |
|---|
| 23 | header('Content-Type: text/html;charset=utf-8;'); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | installation_session(); |
|---|
| 27 | ob_start(); |
|---|
| 28 | /* |
|---|
| 29 | * Step initialization and calculation |
|---|
| 30 | */ |
|---|
| 31 | $steps = array( |
|---|
| 32 | 'welcome' => 'Platform installer', |
|---|
| 33 | 'deps' => 'Dependencies', |
|---|
| 34 | 'file_perms' => 'File permissions', |
|---|
| 35 | 'community' => 'Community Information', |
|---|
| 36 | 'smarty' => 'Smarty configuration', |
|---|
| 37 | 'dbsetup' => 'Setup database', |
|---|
| 38 | 'dbinit' => 'Initialize database', |
|---|
| 39 | 'mapbounds' => 'Setup map boundaries', |
|---|
| 40 | 'gmap' => 'Google Maps API key', |
|---|
| 41 | 'srtm' => 'Nasa SRTM data files', |
|---|
| 42 | 'final' => 'Finish'); |
|---|
| 43 | $step_keys = array_keys($steps); |
|---|
| 44 | |
|---|
| 45 | if (!isset($_GET['step'])) { |
|---|
| 46 | $_SESSION['step'] = $step_current = $step_keys[0]; |
|---|
| 47 | } else { |
|---|
| 48 | $step_current = (!isset($_SESSION['step']) || !in_array($_SESSION['step'], $step_keys))?$step_keys[0]:$_SESSION['step']; |
|---|
| 49 | if ($_GET['step'] == get_next_step($steps, $step_current)) |
|---|
| 50 | $_SESSION['step'] = $step_current = get_next_step($steps, $step_current); |
|---|
| 51 | } |
|---|
| 52 | $next_step = get_next_step($steps, $step_current); |
|---|
| 53 | $step_current_index = array_search($step_current, $step_keys); |
|---|
| 54 | |
|---|
| 55 | ?> |
|---|
| 56 | <!DOCTYPE html> |
|---|
| 57 | <html> |
|---|
| 58 | <head> |
|---|
| 59 | <title>WiND - Installation</title> |
|---|
| 60 | <link rel="stylesheet" href="<?php echo surl('/../templates/basic/css/styles_packed.css')?>" > |
|---|
| 61 | <link rel="icon" type="image/png" href="<?php echo surl('/../templates/basic/images/favicon_32.png')?>" / > |
|---|
| 62 | <link rel="stylesheet" href="install.css"> |
|---|
| 63 | |
|---|
| 64 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> |
|---|
| 65 | |
|---|
| 66 | </head> |
|---|
| 67 | <body> |
|---|
| 68 | <div class="header"> |
|---|
| 69 | <img alt="WiND Logo" src="<?php echo surl('/../templates/basic/images/main_logo.png');?>"> |
|---|
| 70 | <ul class="steps"> |
|---|
| 71 | <?php foreach($step_keys as $idx => $sk) { |
|---|
| 72 | if ($idx < $step_current_index) |
|---|
| 73 | echo '<li class="previous"><span>' . ($idx + 1) . '</span></li>'; |
|---|
| 74 | else if ($idx == $step_current_index) |
|---|
| 75 | echo '<li class="current"><span>' . ($idx + 1) . '</span></li>'; |
|---|
| 76 | else |
|---|
| 77 | echo '<li class="next"><span>' . ($idx + 1) . '</span></li>'; |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | ?> |
|---|
| 81 | </ul> |
|---|
| 82 | <h1>Installation</h1> |
|---|
| 83 | </div> |
|---|
| 84 | <div id="content"> |
|---|
| 85 | <?php |
|---|
| 86 | echo "<h2>{$steps[$step_current]}</h2>"; |
|---|
| 87 | // Show current step and continue to next one. |
|---|
| 88 | $result = include_once(dirname(__FILE__) . "/steps/step_{$step_current}.php"); |
|---|
| 89 | if ($next_step){ |
|---|
| 90 | if ($result === 'auto') { |
|---|
| 91 | header("Location: ?step={$next_step}"); |
|---|
| 92 | exit; |
|---|
| 93 | } else if($result) |
|---|
| 94 | echo "<span class=\"continue\"><a href=\"?step={$next_step}\">Continue ></a></span>"; |
|---|
| 95 | } |
|---|
| 96 | ?> |
|---|
| 97 | </div> |
|---|
| 98 | <div class="footer"> |
|---|
| 99 | Powered by: <a href="http://wind.cube.gr/"><b>WiND - Wireless Nodes Database project</b></a><br/> |
|---|
| 100 | © 2005-2011 <a href="http://wind.cube.gr/wiki/Team">WiND development team</a> |
|---|
| 101 | </div> |
|---|
| 102 | </body> |
|---|
| 103 | </html> |
|---|
| 104 | |
|---|
| 105 | <?php |
|---|
| 106 | ob_end_flush(); |
|---|
| 107 | ?> |
|---|