function EveDBInit() { // force register_globals=off // force register_globals = off if (!defined('_PNINSTALLVER') && ini_get('register_globals')) { foreach ($GLOBALS as $s_variable_name => $m_variable_value) { if (!in_array($s_variable_name, array('GLOBALS', 'argv', 'argc', '_FILES', '_COOKIE', '_POST', '_GET', '_SERVER', '_ENV', '_SESSION', '_REQUEST', 's_variable_name', 'm_variable_value'))) { unset($GLOBALS[$s_variable_name]); } } unset($GLOBALS['s_variable_name']); unset($GLOBALS['m_variable_value']); } // proper error_repoting // E_ALL for development // error_reporting(E_ALL); // without warnings and notices for release //error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); //fix solution from i420bdawg if (phpversion() >= '5.3.0') { error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING); } else { error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING); } // Hack for some weird PHP systems that should have the // LC_* constants defined, but don't if (!defined('LC_TIME')) { define('LC_TIME', 'LC_TIME'); } // Initialise and load configuration $dbconfig = array(); $dbdebug = array(); include_once 'eveconfig/dbconfig.php'; $GLOBALS['dbconfig'] = $dbconfig; $GLOBALS['dbdebug'] = $dbdebug; //echo '<pre>';print_r($GLOBALS);echo '</pre>';exit; // Connect to database if (!DBInit()) { die('Database initialisation failed'); } if (!defined('TBL_PREFIX')) { define('TBL_PREFIX', DBGetPrefix()); } return true; }
function Ajax_CheckDB() { global $eve, $eveRender, $stoppage; $host = $eve->VarCleanFromInput('dbhost'); $user = $eve->VarCleanFromInput('dbuname'); $pass = $eve->VarCleanFromInput('dbpass'); $db = $eve->VarCleanFromInput('dbname'); if (empty($host)) { $host = 'localhost'; } $dbok = false; $server = false; $goforit = false; include_once 'includes/dbfunctions.php'; $GLOBALS['dbconfig']['dbtype'] = 'mysql'; $GLOBALS['dbconfig']['dbhost'] = $host; $GLOBALS['dbconfig']['dbname'] = $db; $GLOBALS['dbconfig']['dbuname'] = $user; $GLOBALS['dbconfig']['dbpass'] = $pass; $GLOBALS['dbconfig']['pconnect'] = 0; $GLOBALS['dbconfig']['encoded'] = 0; $GLOBALS['dbconfig']['debug'] = 0; $GLOBALS['dbdebug']['debug_sql'] = 0; $answer = ''; if (empty($user)) { return 'No database username'; } if (!DBInit()) { $mysqlerror = 'Database Failure!'; //$dbconn->ErrorMsg(); $server = false; $selectdb = false; $stoppage = true; } else { $server = true; if (!($dbconn =& DBGetConn(true))) { $answer .= 'Connection Failed!'; $stoppage = true; } else { $selectdb = $dbconn->SelectDB($db); if (!$selectdb) { $mysqlerror = 'Unknown Database'; $stoppage = true; } if (!$stoppage) { $result = $dbconn->Execute('SELECT VERSION() AS version'); if ($dbconn->ErrorNo() != 0) { $selectdb = true; $mysqlerror = $dbconn->ErrorMsg(); $stoppage = true; } else { list($version) = $result->fields; } } } if (!$stoppage) { $goforit = true; } } if ($goforit) { $answer .= 'DATABASE OK - Version: ' . $version . ' - Hit the Write button to save the configuration.'; } else { $answer .= $mysqlerror; } return $answer; }
// include required files require_once(USERPANEL_LIB_DIR.'/checkdirs.php'); require_once(LIB_DIR.'/config.php'); // Initialize database $_DBTYPE = $CONFIG['database']['type']; $_DBHOST = $CONFIG['database']['host']; $_DBUSER = $CONFIG['database']['user']; $_DBPASS = $CONFIG['database']['password']; $_DBNAME = $CONFIG['database']['database']; require_once(LIB_DIR.'/LMSDB.php'); $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); if (!$DB) die; // Initialize templates engine (must be before locale settings) require_once(LIB_DIR.'/Smarty/Smarty.class.php'); $SMARTY = new Smarty; // test for proper version of Smarty if (constant('Smarty::SMARTY_VERSION')) $ver_chunks = preg_split('/[- ]/', Smarty::SMARTY_VERSION); else $ver_chunks = NULL;
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * * $Id$ */ $_MAILDBTYPE = $CONFIG['database']['mail_db_type']; $_MAILDBHOST = $CONFIG['database']['mail_db_host']; $_MAILDBUSER = $CONFIG['database']['mail_db_user']; $_MAILDBPASS = $CONFIG['database']['mail_db_password']; $_MAILDBNAME = $CONFIG['database']['mail_db_database']; // Initialize mail database $DB_MAIL = DBInit($_MAILDBTYPE, $_MAILDBHOST, $_MAILDBUSER, $_MAILDBPASS, $_MAILDBNAME); if (defined('USERPANEL_SETUPMODE')) { function module_setup() { global $SMARTY, $LMS; $SMARTY->assign('mail_limit', $LMS->CONFIG['userpanel']['mail_limit']); $SMARTY->assign('mail_allowed_domains', $LMS->CONFIG['userpanel']['mail_allowed_domains']); $SMARTY->display('module:accounts:setup.html'); } function module_submit_setup() { global $DB; $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'mail_limit\'', array($_POST['mail_limit'])); $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'mail_allowed_domains\'', array($_POST['mail_allowed_domains'])); header('Location: ?m=userpanel&module=accounts'); }