. */ if (@php_sapi_name() != 'cli') { exit; } $params = getopt('', array('config:', 'debug::', 'force::')); if (! $file = @$params['config']) { exit(<<register(); $loader = new \Textpattern\Loader(txpath.'/lib'); $loader->register(); include_once txpath.'/lib/txplib_html.php'; include_once txpath.'/lib/txplib_forms.php'; include_once txpath.'/include/txp_auth.php'; include_once txpath.'/setup/setup_lib.php'; assert_system_requirements(); setup_load_lang(@$cfg['site']['language_code']); if (!isset($params['force']) && file_exists(txpath.'/config.php')) { msg(gTxt('already_installed'), MSG_ERROR); } setup_connect(); $cfg_php = setup_makeConfig($cfg); if (@file_put_contents(txpath.'/config.php', $cfg_php) === false) { msg(gTxt('config_php_write_error'), MSG_ERROR); } @include txpath.'/config.php'; if (empty($cfg['user']['login_name'])) { msg(gTxt('name_required'), MSG_ERROR); } if (empty($cfg['user']['password'])) { msg(gTxt('pass_required'), MSG_ERROR); } if (!is_valid_email($cfg['user']['email'])) { msg(gTxt('email_required'), MSG_ERROR); } setup_db($cfg); msg(gTxt('that_went_well')); setup_die(0); function msg($msg, $class = MSG_OK, $back = false) { echo "$class\t".strip_tags($msg)."\n"; if ($class == MSG_ERROR) { setup_die(128); } } function setup_die($code = 0) { global $trace, $params; if (isset($params['debug'])) { echo $trace->summary(); echo $trace->result(); } exit((int)$code); }