/** * Re-renders stage 3: admin user details panel, due to user input errors. */ function createTxp() { global $link; $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']); $_SESSION['name'] = ps('name'); $_SESSION['realname'] = ps('RealName'); $_SESSION['pass'] = ps('pass'); $_SESSION['email'] = ps('email'); $_SESSION['theme'] = ps('theme'); if ($_SESSION['name'] == '') { echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('name_required'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>'; exit; } if (!$_SESSION['pass']) { echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('pass_required'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>'; exit; } if (!is_valid_email($_SESSION['email'])) { echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('email_required'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>'; exit; } global $txpcfg; if (!isset($txpcfg['db'])) { if (!is_readable(txpath . '/config.php')) { $problems[] = graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('config_php_not_found', array('{file}' => txpspecialchars(txpath . '/config.php')), 'raw'), array('class' => 'alert-block error')); } else { @(include txpath . '/config.php'); } } if (!isset($txpcfg) || $txpcfg['db'] != $_SESSION['ddb'] || $txpcfg['table_prefix'] != $_SESSION['dprefix']) { $problems[] = graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('config_php_does_not_match_input', '', 'raw'), array('class' => 'alert-block error')); echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . join(n, $problems) . n . setup_config_contents() . n . '</div>'; exit; } define('TXP_INSTALL', 1); include_once txpath . '/lib/txplib_update.php'; include txpath . '/setup/txpsql.php'; echo fbCreate(); }
function createTxp() { $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']); $_SESSION['name'] = ps('name'); $_SESSION['realname'] = ps('RealName'); $_SESSION['pass'] = ps('pass'); $_SESSION['email'] = ps('email'); $_SESSION['theme'] = ps('theme'); if ($_SESSION['name'] == '') { echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('name_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>'; exit; } if (!$_SESSION['pass']) { echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('pass_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>'; exit; } if (!is_valid_email($_SESSION['email'])) { echo n . '<div id="setup_container" class="txp-container">' . txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . graf('<span class="error">' . setup_gTxt('email_required') . '</span>') . n . setup_back_button(__FUNCTION__) . n . '</div>' . n . '</div>'; exit; } global $txpcfg; 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'] != $_SESSION['ddb'] || $txpcfg['table_prefix'] != $_SESSION['dprefix']) { $problems[] = graf('<span class="error">' . setup_gTxt('config_php_does_not_match_input', 'raw') . '</span>'); echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . join(n, $problems) . n . setup_config_contents() . n . '</div>' . n . '</div>'; exit; } $ddb = $txpcfg['db']; $duser = $txpcfg['user']; $dpass = $txpcfg['pass']; $dhost = $txpcfg['host']; $dclient_flags = isset($txpcfg['client_flags']) ? $txpcfg['client_flags'] : 0; $dprefix = $txpcfg['table_prefix']; $dbcharset = $txpcfg['dbcharset']; $siteurl = str_replace("http://", '', $_SESSION['siteurl']); $siteurl = str_replace(' ', '%20', rtrim($siteurl, "/")); $urlpath = preg_replace('#^[^/]+#', '', $siteurl); define("PFX", trim($dprefix)); define('TXP_INSTALL', 1); include_once txpath . '/lib/txplib_update.php'; include txpath . '/setup/txpsql.php'; $nonce = md5(uniqid(rand(), true)); $hash = doSlash(txp_hash_password($_SESSION['pass'])); mysql_query("INSERT INTO `" . PFX . "txp_users` VALUES\n\t\t\t(1,\n\t\t\t'" . doSlash($_SESSION['name']) . "',\n\t\t\t'{$hash}',\n\t\t\t'" . doSlash($_SESSION['realname']) . "',\n\t\t\t'" . doSlash($_SESSION['email']) . "',\n\t\t\t1,\n\t\t\tnow(),\n\t\t\t'{$nonce}')"); mysql_query("update `" . PFX . "txp_prefs` set val = '" . doSlash($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'"); mysql_query("update `" . PFX . "textpattern` set Body = replace(Body, 'siteurl', '" . doSlash($urlpath) . "'), Body_html = replace(Body_html, 'siteurl', '" . doSlash($urlpath) . "') WHERE ID = 1"); // cf. update/_to_4.2.0.php. // TODO: Position might need altering when prefs panel layout is altered $theme = $_SESSION['theme'] ? $_SESSION['theme'] : 'classic'; mysql_query("insert `" . PFX . "txp_prefs` set prefs_id = 1, name = 'theme_name', val = '" . doSlash($theme) . "', type = '1', event = 'admin', html = 'themename', position = '160'"); 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>'; }