getMessage(), E_USER_WARNING); // can't work without database die("Fatal error: cannot connect to database!" . PHP_EOL); } // Initialize templates engine $SMARTY = new Smarty; $SMARTY->addPluginsDir(LIB_DIR . DIRECTORY_SEPARATOR . 'SmartyPlugins'); // Include required files (including sequence is important) require_once(LIB_DIR . DIRECTORY_SEPARATOR . 'common.php'); require_once(LIB_DIR . DIRECTORY_SEPARATOR . 'language.php'); require_once(LIB_DIR . DIRECTORY_SEPARATOR . 'definitions.php'); // Initialize LMS class $SESSION = new Session($DB, ConfigHelper::getConfig('phpui.timeout')); $AUTH = new Auth($DB, $SESSION); $SYSLOG = null; $LMS = new LMS($DB, $AUTH, $SYSLOG); // set some template and layout variables $SMARTY->assignByRef('_LANG', $_LANG); $SMARTY->template_dir = getcwd(); $SMARTY->compile_dir = SMARTY_COMPILE_DIR; include('lang.php'); $SMARTY->assignByRef('layout', $layout); if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $forwarded_ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $nodeid = $LMS->GetNodeIDByIP($forwarded_ip['0']); } else { $nodeid = $LMS->GetNodeIDByIP(str_replace('::ffff:', '', $_SERVER['REMOTE_ADDR'])); } $customerid = $LMS->GetNodeOwner($nodeid); $nodeinfo = $LMS->GetNode($nodeid); if (isset($_GET['readed'])) { $DB->Execute('UPDATE nodes SET warning = 0 WHERE id = ?', array($nodeid)); header('Location: '.$_GET['oldurl']); } else { $customerinfo = $LMS->GetCustomer($customerid); $layout['oldurl'] = $_GET['oldurl']; $SMARTY->assign('customerinfo', $customerinfo); $SMARTY->assign('nodeinfo', $nodeinfo); $SMARTY->assign('layout', $layout); $SMARTY->display('message.html'); }