function printConfig() { $carry = enumPostItems('ddb', 'duser', 'dpass', 'dhost', 'dprefix', 'txprefix', 'txpath', 'siteurl', 'ftphost', 'ftplogin', 'ftpass', 'ftpath', 'lang'); $carry['txpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['txpath']); $carry['ftpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['ftpath']); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); echo graf(gTxt("checking_database")); if (!($mylink = mysql_connect($dhost, $duser, $dpass))) { exit(graf(gTxt('db_cant_connect'))); } echo graf(gTxt('db_connected')); if (!($mydb = mysql_select_db($ddb))) { exit(graf(str_replace("{dbname}", strong($ddb), gTxt("db_doesnt_exist")))); } // On 4.1 or greater use utf8-tables $version = mysql_get_server_info(); if (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version)) { if (mysql_query("SET NAMES utf8")) { $carry['dbcharset'] = "utf8"; $carry['dbcollate'] = "utf8_general_ci"; } else { $carry['dbcharset'] = "latin1"; } } else { $carry['dbcharset'] = "latin1"; } echo graf(str_replace("{dbname}", strong($ddb), gTxt('using_db')) . ' (' . $carry['dbcharset'] . ')'), graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config')), '<textarea style="width:400px;height:200px" name="config" rows="1" cols="1">', makeConfig($carry), '</textarea>', '<form action="setup.php" method="post">', fInput('submit', 'submit', gTxt('did_it'), 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; }
function printConfig() { $carry = enumPostItems('ddb', 'duser', 'dpass', 'dhost', 'dprefix', 'dbtype', 'txprefix', 'siteurl', 'ftphost', 'ftplogin', 'ftpass', 'ftpath', 'lang'); @(include txpath . '/config.php'); if (!empty($txpcfg['db'])) { exit(graf(gTxt('already_installed', array('{txpath}' => txpath)))); } $carry['ftpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['ftpath']); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); // FIXME, remove when all languages are updated with this string if (!isset($GLOBALS['textarray']['prefix_bad_characters'])) { $GLOBALS['textarray']['prefix_bad_characters'] = 'The Table prefix {dbprefix} contains characters that are not allowed.<br />' . 'The first character must match one of <b>a-zA-Z_</b> and all following characters must match one of <b>a-zA-Z0-9_</b>'; } echo graf(gTxt("checking_database")); $GLOBALS['txpcfg']['dbtype'] = $dbtype; # include here in order to load only the required driver include_once txpath . '/lib/mdb.php'; if ($dbtype == 'pdo_sqlite') { $ddb = $txpath . DS . $ddb; $carry['ddb'] = $ddb; } global $DB; $DB =& mdb_factory($dhost, $ddb, $duser, $dpass, 'utf8'); if (!$DB->connected) { exit(graf(gTxt('db_cant_connect'))); } echo graf(gTxt('db_connected')); if (!($dprefix == '' || preg_match('#^[a-zA-Z_][a-zA-Z0-9_]*$#', $dprefix))) { exit(graf(gTxt('prefix_bad_characters', array('{dbprefix}' => strong($dprefix))))); } if (!$DB->selected) { exit(graf(gTxt('db_doesnt_exist', array('{dbname}' => strong($ddb))))); } /* // On 4.1 or greater use utf8-tables if ($dbtype!='pdo_sqlite' && db_query("SET NAMES 'utf8'")) { $carry['dbcharset'] = "utf8"; $carry['dbcollate'] = "utf8_general_ci"; }elseif ($dbtype == 'pdo_sqlite' && db_query('PRAGMA encoding="UTF-8"')){ $carry['dbcharset'] = "utf8"; } else { $carry['dbcharset'] = "latin1"; $carry['dbcollate'] = ''; } */ // the MDB driver should tell us what charset to use $carry['dbcharset'] = $DB->charset; echo graf(gTxt('using_db', array('{dbname}' => strong($ddb))) . ' (' . $carry['dbcharset'] . ')'), graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config', array('{txpath}' => txpath))), '<textarea name="config" cols="40" rows="5" style="width: 400px; height: 200px;">', makeConfig($carry), '</textarea>', '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', fInput('submit', 'submit', gTxt('did_it'), 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; }
function printConfig() { $carry = enumPostItems('ddb', 'duser', 'dpass', 'dhost', 'dprefix', 'txprefix', 'txpath', 'doc_root', 'ftphost', 'ftplogin', 'ftpass', 'ftpath'); $carry['txpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['txpath']); $carry['doc_root'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['doc_root']); $carry['ftpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['ftpath']); extract($carry); echo graf("Checking database connection..."); if (!($mylink = mysql_connect($dhost, $duser, $dpass))) { exit(graf("Can't connect to the database with the values entered.")); } echo graf('Connected.'); if (!($mydb = mysql_select_db($ddb))) { exit(graf("Database " . strong($ddb) . " doesn't exist. Please create it or choose another.")); } echo graf("Using database " . strong($ddb)), graf(strong('Before you proceed') . ', open <code>config.php</code> in the <code>/textpattern/</code> directory and replace its contents with the following:'), '<textarea style="width:400px;height:200px" name="config" rows="1" cols="1">', makeConfig($carry), '</textarea>', '<form action="setup.php" method="post">', fInput('submit', 'submit', 'I did it', 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; }
function printConfig() { $carry = enumPostItems('ddb', 'duser', 'dpass', 'dhost', 'dprefix', 'txprefix', 'txpath', 'siteurl', 'ftphost', 'ftplogin', 'ftpass', 'ftpath', 'lang'); $carry['txpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['txpath']); $carry['ftpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['ftpath']); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); echo graf(gTxt("checking_database")); if (!($mylink = mysql_connect($dhost, $duser, $dpass))) { exit(graf(gTxt('db_cant_connect'))); } echo graf(gTxt('db_connected')); if (!($mydb = mysql_select_db($ddb))) { exit(graf(str_replace("{dbname}", strong($ddb)), gTxt("db_doesnt_exist"))); } echo graf(str_replace("{dbname}", strong($ddb), gTxt('using_db'))), graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config')), '<textarea style="width:400px;height:200px" name="config" rows="1" cols="1">', makeConfig($carry), '</textarea>', '<form action="setup.php" method="post">', fInput('submit', 'submit', 'I did it', 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; }
function printConfig() { $carry = enumPostItems('ddb', 'duser', 'dpass', 'dhost', 'dprefix', 'txprefix', 'txpath', 'siteurl', 'ftphost', 'ftplogin', 'ftpass', 'ftpath', 'lang'); @(include txpath . '/config.php'); if (!empty($txpcfg['db'])) { exit(graf(gTxt('already_installed'))); } $carry['txpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['txpath']); $carry['ftpath'] = preg_replace("/^(.*)\\/\$/", "\$1", $carry['ftpath']); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); // FIXME, remove when all languages are updated with this string if (!isset($GLOBALS['textarray']['prefix_bad_characters'])) { $GLOBALS['textarray']['prefix_bad_characters'] = 'The Table prefix {dbprefix} contains characters that are not allowed.<br />' . 'The first character must match one of <b>a-zA-Z_</b> and all following characters must match one of <b>a-zA-Z0-9_</b>'; } echo graf(gTxt("checking_database")); if (!($mylink = mysql_connect($dhost, $duser, $dpass))) { exit(graf(gTxt('db_cant_connect'))); } echo graf(gTxt('db_connected')); if (!($dprefix == '' || preg_match('#^[a-zA-Z_][a-zA-Z0-9_]*$#', $dprefix))) { exit(graf(str_replace("{dbprefix}", strong($dprefix), gTxt("prefix_bad_characters")))); } if (!($mydb = mysql_select_db($ddb))) { exit(graf(str_replace("{dbname}", strong($ddb), gTxt("db_doesnt_exist")))); } // On 4.1 or greater use utf8-tables $version = mysql_get_server_info(); if (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version)) { if (mysql_query("SET NAMES utf8")) { $carry['dbcharset'] = "utf8"; $carry['dbcollate'] = "utf8_general_ci"; } else { $carry['dbcharset'] = "latin1"; } } else { $carry['dbcharset'] = "latin1"; } echo graf(str_replace("{dbname}", strong($ddb), gTxt('using_db')) . ' (' . $carry['dbcharset'] . ')'), graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config')), '<textarea style="width:400px;height:200px" name="config" rows="1" cols="1">', makeConfig($carry), '</textarea>', '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', fInput('submit', 'submit', gTxt('did_it'), 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; }