function createTxp() { $carry = isPost('carry'); extract(postDecode($carry)); extract(gpsa(array('name', 'pass', 'RealName', 'email'))); define("PFX", trim($dprefix)); include './txpsql.php'; mysql_query("INSERT INTO " . PFX . "txp_users VALUES\n\t\t\t(1,'{$name}',password(lower('{$pass}')),'{$RealName}','{$email}',1,now(),'')"); echo fbCreate(); }
function getTxpLogin() { $carry = postDecode(ps('carry')); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); @(include txpath . '/config.php'); if (!isset($txpcfg) || $txpcfg['db'] != $ddb || $txpcfg['table_prefix'] != $dprefix) { echo graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config', array('{txpath}' => txpath))), '<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>'; return; } echo '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', startTable('edit'), tr(tda(graf(gTxt('thanks')) . graf(gTxt('about_to_create')), ' width="400" colspan="2" align="center"')), tr(fLabelCell(gTxt('your_full_name')) . fInputCell('RealName')), tr(fLabelCell(gTxt('setup_login')) . fInputCell('name')), tr(fLabelCell(gTxt('choose_password')) . fInputCell('pass')), tr(fLabelCell(gTxt('your_email')) . fInputCell('email')), tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish'))), endTable(), sInput('createTxp'), hInput('lang', htmlspecialchars($lang)), hInput('siteurl', htmlspecialchars($siteurl)), '</form>'; }
function createTxp() { $carry = isPost('carry'); extract(postDecode($carry)); require txpath . '/config.php'; $dbb = $txpcfg['db']; $duser = $txpcfg['user']; $dpass = $txpcfg['pass']; $dhost = $txpcfg['host']; $dprefix = $txpcfg['table_prefix']; $GLOBALS['textarray'] = setup_load_lang($lang); $siteurl = str_replace("http://", '', $siteurl); $siteurl = rtrim($siteurl, "/"); define("PFX", trim($dprefix)); define('TXP_INSTALL', 1); include_once txpath . '/lib/txplib_update.php'; include txpath . '/setup/txpsql.php'; // This has to come after txpsql.php, because otherwise we can't call mysql_real_escape_string extract(sDoSlash(gpsa(array('name', 'pass', 'RealName', 'email')))); $nonce = md5(uniqid(rand(), true)); mysql_query("INSERT INTO " . PFX . "txp_users VALUES\n\t\t\t(1,'{$name}',password(lower('{$pass}')),'{$RealName}','{$email}',1,now(),'{$nonce}')"); mysql_query("update " . PFX . "txp_prefs set val = '{$siteurl}' where `name`='siteurl'"); mysql_query("update " . PFX . "txp_prefs set val = '{$lang}' where `name`='language'"); mysql_query("update " . PFX . "txp_prefs set val = '" . getlocale($lang) . "' where `name`='locale'"); echo fbCreate(); }
function getTxpLogin() { $carry = postDecode(ps('carry')); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); global $txpcfg; echo n . '<div id="setup_container" class="txp-container">'; $problems = array(); if (!isset($txpcfg['db'])) { if (!is_readable(txpath . '/config.php')) { $problems[] = graf('<span class="error">' . setup_gTxt('config_php_not_found', array('{file}' => txpspecialchars(txpath . '/config.php')), 'raw') . '</span>'); } else { @(include txpath . '/config.php'); } } if (!isset($txpcfg) || $txpcfg['db'] != $ddb || $txpcfg['table_prefix'] != $dprefix) { $problems[] = graf('<span class="error">' . setup_gTxt('config_php_does_not_match_input', 'raw') . '</span>'); echo txp_setup_progress_meter(2) . n . '<div class="txp-setup">' . n . join(n, $problems) . n . setup_config_contents($carry) . n . '</div>' . n . '</div>'; exit; } // Default theme selector $core_themes = array('classic', 'remora', 'hive'); $themes = theme::names(); foreach ($themes as $t) { $theme = theme::factory($t); if ($theme) { $m = $theme->manifest(); $title = empty($m['title']) ? ucwords($theme->name) : $m['title']; $vals[$t] = in_array($t, $core_themes) ? setup_gTxt('core_theme', array('{theme}' => $title)) : $title; unset($theme); } } asort($vals, SORT_STRING); $theme_chooser = selectInput('theme', $vals, 'classic', '', '', '', 'setup_admin_theme'); echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . n . hed(setup_gTxt('creating_db_tables'), 2) . n . graf(setup_gTxt('about_to_create')) . n . graf('<span class="edit-label"><label for="setup_user_realname">' . setup_gTxt('your_full_name') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'RealName', '', '', '', '', INPUT_REGULAR, '', 'setup_user_realname') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_login">' . setup_gTxt('setup_login') . '</label>' . sp . popHelp('setup_user_login') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'name', '', '', '', '', INPUT_REGULAR, '', 'setup_user_login') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_pass">' . setup_gTxt('choose_password') . '</label>' . sp . popHelp('setup_user_pass') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'pass', '', '', '', '', INPUT_REGULAR, '', 'setup_user_pass') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_email">' . setup_gTxt('your_email') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'email', '', '', '', '', INPUT_REGULAR, '', 'setup_user_email') . '</span>') . n . hed(setup_gTxt('site_config'), 2) . n . graf('<span class="edit-label"><label for="setup_admin_theme">' . setup_gTxt('admin_theme') . '</label>' . sp . popHelp('theme_name') . '</span>' . n . '<span class="edit-value">' . $theme_chooser . '</span>') . n . graf(fInput('submit', 'Submit', setup_gTxt('next_step'), 'publish')) . n . sInput('createTxp'), n . hInput('lang', txpspecialchars($lang)), n . hInput('siteurl', txpspecialchars($siteurl)), n . '</form>' . n . '</div>' . n . '</div>'; }
function createTxp() { $email = ps('email'); if (!is_valid_email($email)) { exit(graf(gTxt('email_required'))); } $carry = ps('carry'); extract(postDecode($carry)); require txpath . '/config.php'; $dbb = $txpcfg['db']; $duser = $txpcfg['user']; $dpass = $txpcfg['pass']; $dhost = $txpcfg['host']; $dprefix = $txpcfg['table_prefix']; $GLOBALS['txpcfg']['dbtype'] = $txpcfg['dbtype']; $dbcharset = $txpcfg['dbcharset']; include_once txpath . '/lib/mdb.php'; $GLOBALS['textarray'] = setup_load_lang($lang); $siteurl = str_replace("http://", '', $siteurl); $siteurl = rtrim($siteurl, "/"); define("PFX", trim($dprefix)); define('TXP_INSTALL', 1); $name = addslashes(gps('name')); include_once txpath . '/lib/txplib_update.php'; include txpath . '/setup/txpsql.php'; extract(gpsa(array('name', 'pass', 'RealName', 'email'))); $nonce = md5(uniqid(rand(), true)); global $DB; $DB =& mdb_factory($dhost, $ddb, $duser, $dpass, $dbcharset); $DB->query("INSERT INTO " . PFX . "txp_users VALUES\n\t\t\t(1,'" . $DB->escape($name) . "',password(lower('" . $DB->escape($pass) . "')),'" . $DB->escape($RealName) . "','" . $DB->escape($email) . "',1,now(),'" . $DB->escape($nonce) . "')"); $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape($siteurl) . "' where name='siteurl'"); $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape($lang) . "' where name='language'"); $DB->query("update " . PFX . "txp_prefs set val = '" . $DB->escape(getlocale($lang)) . "' where name='locale'"); echo fbCreate(); }