#error_reporting(E_ALL); if(empty($includePath)) $includePath = ""; if(!file_exists($includePath."config.inc.php")) die("File config.inc.php doesn't exists!"); // Here we include configuration and classes include_once($includePath."config.inc.php"); include_once($includePath."classes.inc.php"); // Checking if site is configured if(!$enabled) die("Site désactivé. Vous n'avez pas configuré config.inc.php."); // Initiating default classes $xhtml = new xHTML(); $userInput = new userInput(); $users = new Users(); // Initiating custom classes $billets = new Billets(); $blogs = new Blogs(); $commentaires = new Commentaires(); // Initiating Database $db_class = $includePath."class.db.".$cfg['db']['type'].".php"; if(!file_exists($db_class)) die("File $db_class doesn't exists!"); include_once($db_class); $db = new DB(); $db->config = $cfg['db'][$cfg['db']['type']]; // If we are in a protected page if(!isset($no_connect) || $no_connect != TRUE) { $db->connect(); if($db->checkDB() !== TRUE) { header("location: install.php"); exit; } else { $users->db = $db; $billets->db = $db; $commentaires->db = $db; $blogs->db = $db; if(isset($check_access) && $check_access > 0) { xHTML::noCache(); if(($userData = $users->checkSession()) == FALSE) Redirection('login'); if(!$users->haveAccess($check_access)) xHTML::Error("Vous n'avez pas le droit d'accéder à cette page.",'Access level too low: need '.$check_access.' and have only '.$userData['access'].'.',TRUE); if(!$noCurrentBlog) { if(empty($userData['currentblog'])) { $listBlogs = $blogs->getByOwner($userData['id']); if(count($listBlogs) < 1) Redirection("newBlog"); elseif(count($listBlogs) > 1) Redirection("selectBlog"); else { $blogs->setCurrent($userData['id'],$listBlogs[0]['id']); $userData['currentblog'] = $listBlogs[0]['id']; } } $currentBlog = $blogs->getById($userData['currentblog']); } } } } ?>