initial files for igorcms
[igorcms.git] / common.php
blob874707302275e8742e8494cb652bc9f060e6ef09
1 <?php
3 if (!defined('ROOT_PATH'))
5 exit;
8 error_reporting(E_ALL);
10 // includes
11 include(ROOT_PATH . 'includes/functions.' . PHP_EXT);
12 include(ROOT_PATH . 'includes/functions_format.' . PHP_EXT);
13 include(ROOT_PATH . 'includes/class/module.' . PHP_EXT);
14 include(ROOT_PATH . 'includes/class/cute_url.' . PHP_EXT);
16 // vendors
17 foreach (array_diff(scandir(ROOT_PATH . 'vendor/'), array('.', '..')) as $vendor)
19 if (file_exists(ROOT_PATH . 'vendor/' . $vendor . '/vendor.' . PHP_EXT))
21 include(ROOT_PATH . 'vendor/' . $vendor . '/vendor.' . PHP_EXT);
25 // general objects
26 $module = new module(ROOT_PATH . 'modules/', 'm_');
27 $cute_url = new cute_url(file_exists(ROOT_PATH . '.htaccess'));
29 // db
30 include(ROOT_PATH . 'includes/class/dbal_mysqli.' . PHP_EXT);
31 $db = new dbal_mysqli();
32 try
34 $db->sql_connect('localhost', NULL, 'cms', 'root', NULL);
36 catch (Exception $e)
38 echo '<h1>an error occured</h1>';
39 echo $e->getMessage();
40 exit;
43 // template
44 $template->assign('ROOT_PATH', $_SERVER['SCRIPT_NAME'] === '/' ? '/' : dirname($_SERVER['SCRIPT_NAME']) . '/');