<?php error_reporting(E_ALL & ~E_NOTICE); include __DIR__ . '/load_flourish.php'; include __DIR__ . '/load_plugins.php'; require __DIR__ . '/config.php'; require __DIR__ . '/core.php'; fSession::setPath(SESSIONS_PATH); fSession::setLength('1 day 2 hours'); $db = new fDatabase('mysql', DB_NAME, DB_USER, DB_PASS, DB_HOST); fAuthorization::setLoginPage(LOGIN_BASE);
<?php ob_start(); require_once 'config.php'; require_once 'user.php'; require_once 'transaction.php'; require_once 'card.php'; $db = new fDatabase('sqlite', dirname(__FILE__) . '/../var/database.db'); fORMDatabase::attach($db); fSession::setLength('30 minutes', '1 week'); fSession::setPath(dirname(__FILE__) . '/../var/session'); if ($uid = fSession::get('user')) { $user = new User($uid); } else { $user = null; }
<?php define('DOC_ROOT', realpath(dirname(__FILE__) . '/../')); define('URL_ROOT', path_fix(substr(DOC_ROOT, strlen(realpath($_SERVER['DOCUMENT_ROOT'])))) . '/'); define('URL_ROOT_TRIM', ltrim(URL_ROOT, "\\")); error_reporting(E_STRICT | E_ALL); fCore::enableErrorHandling('html'); fCore::enableExceptionHandling('html'); fTimestamp::setDefaultTimezone('Asia/Kuala_Lumpur'); fAuthorization::setLoginPage(URL_ROOT . 'authentication.php'); fAuthorization::setAuthLevels(array('super' => 1000, 'admin' => 100, 'user' => 50, 'guest' => 25)); // This prevents cross-site session transfer fSession::setPath(DOC_ROOT . '/session/'); include DOC_ROOT . '/resources/library/flourish/constructor_functions.php'; /** * Configuration Settings * */ $config = array("db" => array("dbName" => "umw_mms", "dbHost" => "localhost", "dbUsername" => "useradmin", "password" => "test0"), "title" => "Material Management System", "version" => "v2.00b"); /** * Automatically includes classes * * @throws Exception * * @param string $class Name of the class to load * @return void */ function __autoload($class) { $flourish_file = DOC_ROOT . '/resources/library/flourish/' . $class . '.php'; if (file_exists($flourish_file)) {
$tpl->set('header', 'header.php'); $tpl->set('footer', 'footer.php'); $tpl->set('menu', 'menu.php'); // @TODO remove these when the thresholds become configurable. global $status; $status[3] = array('OK', '73D216'); // 3+ OK $status[2] = array('Low', 'EDD400'); // 2+ Warning $status[0] = array('Critical', 'CC0000'); // 0: Empty - bad. // Set up database connection $db = new fDatabase('mysql', config_item('db_name'), config_item('db_user'), config_item('db_pass'), config_item('db_host'), config_item('db_port')); fORMDatabase::attach($db); // Configure session fSession::setPath(config_item('session_path')); fSession::setLength(config_item('session_length', '1 hour')); fSession::open(); } /** * Automatically includes classes * * @throws Exception * * @param string $class_name Name of the class to load * @return void */ function printmaster_autoload($class) { $flourish_file = DOC_ROOT . '/inc/flourish/' . $class . '.php'; if (file_exists($flourish_file)) {
print $config_error; exit; } $status_array = array('0' => 'OK', '1' => 'Error', '2' => 'Warning'); $visibility_array = array('0' => 'Public', '1' => 'Private'); $over_under_array = array('0' => 'Over', '1' => 'Under'); $breadcrumbs = array(); $breadcrumbs[] = array('name' => 'Home', 'url' => '#', 'active' => false); error_reporting(E_STRICT | E_ALL); fCore::enableErrorHandling('html'); fCore::enableExceptionHandling('html'); fTimestamp::setDefaultTimezone($GLOBALS['TIMEZONE']); fAuthorization::setLoginPage(User::makeURL('login')); fAuthorization::setAuthLevels(array('admin' => 100, 'user' => 50, 'guest' => 25)); // This prevents cross-site session transfer fSession::setPath($GLOBALS['SESSION_FILES']); if (!fAuthorization::checkLoggedIn()) { if ($GLOBALS['ALLOW_HTTP_AUTH'] && (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']))) { unset($_SERVER['PHP_AUTH_PW']); //no need for a clear text password hanging around. try { $user = new User(array('username' => $_SERVER['PHP_AUTH_USER'])); // Auto Register User fAuthorization::setUserToken($user->getEmail()); fAuthorization::setUserAuthLevel($user->getRole()); fSession::set('user_id', $user->getUserId()); fSession::set('user_name', $user->getUsername()); } catch (fNotFoundException $e) { if (fURL::getWithQueryString() != TATTLE_WEB_ROOT . User::makeURL('add')) { fMessaging::create('affected', User::makeURL('add'), $_SERVER['PHP_AUTH_USER']); fMessaging::create('success', User::makeURL('add'), 'The user ' . $_SERVER['PHP_AUTH_USER'] . ' was successfully created');
$config_error .= "<br/>Tattle Error <br />" . "Bootstrap library not found : expected at : " . $root_path . BOOTSTRAP_PATH . "<br />" . "Can be changed in inc/config.php : BOOTSTRAP_PATH"; $config_exit = true; } if ($config_exit) { print $config_error; exit; } define('VIEW_PATH', $root_path . '/views/'); $status_array = array('0' => 'OK', '1' => 'Error', '2' => 'Warning'); $visibility_array = array('0' => 'Public', '1' => 'Private'); $over_under_array = array('0' => 'Over', '1' => 'Under'); $breadcrumbs = array(); $breadcrumbs[] = array('name' => 'Home', 'url' => '#', 'active' => false); error_reporting(E_STRICT | E_ALL); fCore::enableErrorHandling('html'); fCore::enableExceptionHandling('html'); fTimestamp::setDefaultTimezone('America/New_York'); fAuthorization::setLoginPage(User::makeURL('login')); fAuthorization::setAuthLevels(array('admin' => 100, 'user' => 50, 'guest' => 25)); // This prevents cross-site session transfer fSession::setPath(SESSION_FILES_PATH); $plugin_settings = array(); foreach (glob("plugins/*_plugin.php") as $plugin) { include_once $plugin; $plugin_name = str_replace(array('plugins/', '_plugin.php'), '', $plugin); $plugin_config = $plugin_name . '_config'; if (function_exists($plugin_config)) { $plugin_settings[$plugin_name] = $plugin_config(); $send_methods[$plugin_name] = $plugin_settings[$plugin_name]['name']; } }