Exemplo n.º 1
0
function createTxp()
{
    $GLOBALS['textarray'] = setup_load_lang(ps('lang'));
    if (!is_valid_email(ps('email'))) {
        exit(graf(gTxt('email_required')));
    }
    require txpath . '/config.php';
    $ddb = $txpcfg['db'];
    $duser = $txpcfg['user'];
    $dpass = $txpcfg['pass'];
    $dhost = $txpcfg['host'];
    $dprefix = $txpcfg['table_prefix'];
    $dbcharset = $txpcfg['dbcharset'];
    $siteurl = str_replace("http://", '', ps('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(doSlash(psa(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 = '" . 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'");
    echo fbCreate();
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
/**
 * 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();
}
Exemplo n.º 4
0
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();
}
Exemplo n.º 5
0
function createTxp()
{
    $GLOBALS['textarray'] = setup_load_lang(ps('lang'));
    if (ps('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() . n . '</div>' . n . '</div>';
        exit;
    }
    if (!ps('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() . n . '</div>' . n . '</div>';
        exit;
    }
    if (!is_valid_email(ps('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() . n . '</div>' . n . '</div>';
        exit;
    }
    global $txpcfg;
    if (!isset($txpcfg['db'])) {
        require txpath . '/config.php';
    }
    $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://", '', ps('siteurl'));
    $siteurl = 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';
    // This has to come after txpsql.php, because otherwise we can't call mysql_real_escape_string
    extract(doSlash(psa(array('name', 'pass', 'RealName', 'email', 'theme'))));
    $nonce = md5(uniqid(rand(), true));
    $hash = doSlash(txp_hash_password($pass));
    mysql_query("INSERT INTO `" . PFX . "txp_users` VALUES\n\t\t\t(1,'{$name}','{$hash}','{$RealName}','{$email}',1,now(),'{$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 = $theme ? $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();
}
Exemplo n.º 6
0
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();
}