Esempio n. 1
0
/**
 * Renders either stage 3: admin user details panel (on success), or stage 2:
 * config details error message (on fail).
 */
function getTxpLogin()
{
    $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']);
    global $txpcfg;
    $problems = array();
    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(2) . n . '<div class="txp-setup">' . n . join(n, $problems) . setup_config_contents() . n . '</div>';
        exit;
    }
    // Default theme selector.
    $core_themes = array('classic', 'remora', 'hive');
    $themes = \Textpattern\Admin\Theme::names();
    foreach ($themes as $t) {
        $theme = \Textpattern\Admin\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, isset($_SESSION['theme']) ? txpspecialchars($_SESSION['theme']) : 'hive', '', '', 'setup_admin_theme');
    echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">' . n . '<form class="prefs-form" method="post" action="' . txpspecialchars($_SERVER['PHP_SELF']) . '">' . hed(setup_gTxt('creating_db_tables'), 2) . graf(setup_gTxt('about_to_create')) . inputLabel('setup_user_realname', fInput('text', 'RealName', isset($_SESSION['realname']) ? txpspecialchars($_SESSION['realname']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_realname', '', true), 'your_full_name', '', array('class' => 'txp-form-field')) . inputLabel('setup_user_email', fInput('text', 'email', isset($_SESSION['email']) ? txpspecialchars($_SESSION['email']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_email', '', true), 'your_email', '', array('class' => 'txp-form-field')) . inputLabel('setup_user_login', fInput('text', 'name', isset($_SESSION['name']) ? txpspecialchars($_SESSION['name']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_login', '', true), 'setup_login', 'setup_user_login', array('class' => 'txp-form-field')) . inputLabel('setup_user_pass', fInput('password', 'pass', isset($_SESSION['pass']) ? txpspecialchars($_SESSION['pass']) : '', 'txp-maskable txp-strength-hint', '', '', INPUT_REGULAR, '', 'setup_user_pass', '', true) . n . tag(null, 'div', array('class' => 'strength-meter')) . n . tag(checkbox('unmask', 1, false, 0, 'show_password') . n . tag(gTxt('setup_show_password'), 'label', array('for' => 'show_password')), 'div', array('class' => 'show-password')), 'choose_password', 'setup_user_pass', array('class' => 'txp-form-field')) . hed(setup_gTxt('site_config'), 2) . inputLabel('setup_admin_theme', $theme_chooser, 'admin_theme', 'theme_name', array('class' => 'txp-form-field')) . graf(fInput('submit', 'Submit', setup_gTxt('next_step'), 'publish')) . sInput('createTxp') . n . '</form>' . n . '</div>';
}
Esempio n. 2
0
/**
 * Renders a HTML &lt;select&gt; list of installed admin-side themes.
 *
 * Can be altered by plugins via the 'prefs_ui > theme_name'
 * pluggable UI callback event.
 *
 * @param  string $name HTML name and id of the widget
 * @param  string $val  Initial (or current) selected item
 * @return string HTML
 */
function themename($name, $val)
{
    $themes = \Textpattern\Admin\Theme::names();
    foreach ($themes as $t) {
        $theme = \Textpattern\Admin\Theme::factory($t);
        if ($theme) {
            $m = $theme->manifest();
            $title = empty($m['title']) ? ucwords($theme->name) : $m['title'];
            $vals[$t] = $title;
            unset($theme);
        }
    }
    asort($vals, SORT_STRING);
    return pluggable_ui('prefs_ui', 'theme_name', selectInput($name, $vals, $val, '', '', $name));
}
Esempio n. 3
0
 janitor();
 // Article or form preview.
 if (isset($_GET['txpreview'])) {
     include txpath . '/publish.php';
     textpattern();
     exit;
 }
 if (!empty($admin_side_plugins) and gps('event') != 'plugin') {
     load_plugins(1);
 }
 // Plugins may have altered privilege settings.
 if (!defined('TXP_UPDATE_DONE') && !gps('event') && !empty($default_event) && has_privs($default_event)) {
     $event = $default_event;
 }
 // Initialise private theme.
 $theme = \Textpattern\Admin\Theme::init();
 include txpath . '/lib/txplib_head.php';
 require_privs($event);
 callback_event($event, $step, 1);
 $inc = txpath . '/include/txp_' . $event . '.php';
 if (is_readable($inc)) {
     include $inc;
 }
 callback_event($event, $step, 0);
 end_page();
 if ($app_mode != 'async') {
     trace_log(TEXTPATTERN_TRACE_DISPLAY);
 } else {
     $trace = trace_log(TEXTPATTERN_TRACE_RESULT);
     header('X-Textpattern-Runtime: ' . @$trace['microdiff']);
     header('X-Textpattern-Memory: ' . @$trace['memory_peak']);