| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * WiND - Wireless Nodes Database |
|---|
| 4 | * |
|---|
| 5 | * Copyright (C) 2005 Nikolaos Nikalexis <winner@cube.gr> |
|---|
| 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 | if (file_exists(ROOT_PATH."/install")) { |
|---|
| 22 | die("WiND error: Please delete \"install/\" folder if you have completed installation ..."); |
|---|
| 23 | } |
|---|
| 24 | if (!file_exists(ROOT_PATH."config/config.php")) { |
|---|
| 25 | die("WiND error: Please make config/config.php file ..."); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | include_once(ROOT_PATH."globals/vars.php"); |
|---|
| 29 | include_once(ROOT_PATH."config/config.php"); |
|---|
| 30 | $vars = array_merge($vars, $config); |
|---|
| 31 | include_once($vars['templates']['path'].$vars['templates']['default'].'/config.php'); |
|---|
| 32 | $vars = array_merge($vars, $template_config); |
|---|
| 33 | include_once(ROOT_PATH."globals/functions.php"); |
|---|
| 34 | |
|---|
| 35 | $php_start = getmicrotime(); |
|---|
| 36 | |
|---|
| 37 | include_once(ROOT_PATH."globals/classes/mysql.php"); |
|---|
| 38 | include_once(ROOT_PATH."globals/classes/construct.php"); |
|---|
| 39 | include_once(ROOT_PATH."globals/classes/form.php"); |
|---|
| 40 | include_once(ROOT_PATH."globals/classes/table.php"); |
|---|
| 41 | |
|---|
| 42 | if (!file_exists($vars['smarty']['class'])) { |
|---|
| 43 | die("WiND error: Cannot find Smarty lib. Please check config.php ..."); |
|---|
| 44 | } |
|---|
| 45 | include_once($vars['smarty']['class']); |
|---|
| 46 | |
|---|
| 47 | if ($vars['template']['version'] < $vars['info']['min_template_version'] |
|---|
| 48 | || $vars['template']['version'] > $vars['info']['version']) { |
|---|
| 49 | die("WiND error: Template version does not match."); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | $smarty = new Smarty; |
|---|
| 53 | $smarty->template_dir = $vars['templates']['path'].$vars['templates']['default'].'/'; |
|---|
| 54 | $smarty->plugins_dir = array($vars['templates']['path'].$vars['templates']['default'].'/plugins/', 'plugins'); |
|---|
| 55 | $smarty->compile_dir = $vars['templates']['compiled_path'].$vars['templates']['default'].'/'; |
|---|
| 56 | $smarty->register_modifier('stripslashes', 'stripslashes'); |
|---|
| 57 | reset_smarty(); |
|---|
| 58 | |
|---|
| 59 | $construct = new construct; |
|---|
| 60 | |
|---|
| 61 | if ($vars['mail']['smtp'] != '') { |
|---|
| 62 | ini_set('SMTP', $vars['mail']['smtp']); |
|---|
| 63 | ini_set('smtp_port', $vars['mail']['smtp_port']); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | $db = new mysql($vars['db']['server'], $vars['db']['username'], $vars['db']['password'], $vars['db']['database']); |
|---|
| 67 | |
|---|
| 68 | if ($db->error) { |
|---|
| 69 | die("WiND MySQL database error: $db->error_report"); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | ?> |
|---|