diff options
Diffstat (limited to 'mod/setup.php')
-rwxr-xr-x | mod/setup.php | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/mod/setup.php b/mod/setup.php index 5c9e988d9..5dccc1711 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -41,6 +41,9 @@ function setup_init(&$a) { global $install_wizard_pass; if (x($_POST, 'pass')) $install_wizard_pass = intval($_POST['pass']); + else + $install_wizard_pass = 1; + } /** @@ -57,7 +60,7 @@ function setup_post(&$a) { return; break; // just in case return don't return :) case 3: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = trim($_POST['dbhost']); $dbport = intval(trim($_POST['dbport'])); $dbuser = trim($_POST['dbuser']); @@ -67,7 +70,8 @@ function setup_post(&$a) { $phpath = trim($_POST['phpath']); $adminmail = trim($_POST['adminmail']); $siteurl = trim($_POST['siteurl']); - + $advanced = ((intval($_POST['advanced'])) ? 1 : 0); + // $siteurl should not have a trailing slash $siteurl = rtrim($siteurl,'/'); @@ -79,7 +83,7 @@ function setup_post(&$a) { if(! $db->connected) { echo 'Database Connect failed: ' . $db->error; killme(); - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; } /*if(get_db_errno()) { unset($db); @@ -93,10 +97,10 @@ function setup_post(&$a) { unset($db); $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true); } else { - $a->data['db_create_failed']=true; + App::$data['db_create_failed']=true; } } else { - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; return; } }*/ @@ -107,7 +111,7 @@ function setup_post(&$a) { return; break; case 4: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = notags(trim($_POST['dbhost'])); $dbport = intval(notags(trim($_POST['dbport']))); $dbuser = notags(trim($_POST['dbuser'])); @@ -118,12 +122,13 @@ function setup_post(&$a) { $timezone = notags(trim($_POST['timezone'])); $adminmail = notags(trim($_POST['adminmail'])); $siteurl = notags(trim($_POST['siteurl'])); + $advanced = ((intval($_POST['advanced'])) ? 1 : 0); if($siteurl != z_root()) { $test = z_fetch_url($siteurl."/setup/testrewrite"); if((! $test['success']) || ($test['body'] != 'ok')) { - $a->data['url_fail'] = true; - $a->data['url_error'] = $test['error']; + App::$data['url_fail'] = true; + App::$data['url_error'] = $test['error']; return; } } @@ -138,30 +143,31 @@ function setup_post(&$a) { $tpl = get_intltext_template('htconfig.tpl'); $txt = replace_macros($tpl,array( - '$dbhost' => $dbhost, - '$dbport' => $dbport, - '$dbuser' => $dbuser, - '$dbpass' => $dbpass, - '$dbdata' => $dbdata, - '$dbtype' => $dbtype, - '$timezone' => $timezone, - '$siteurl' => $siteurl, - '$site_id' => random_string(), - '$phpath' => $phpath, + '$dbhost' => $dbhost, + '$dbport' => $dbport, + '$dbuser' => $dbuser, + '$dbpass' => $dbpass, + '$dbdata' => $dbdata, + '$dbtype' => $dbtype, + '$uno' => 1 - $advanced, + '$timezone' => $timezone, + '$siteurl' => $siteurl, + '$site_id' => random_string(), + '$phpath' => $phpath, '$adminmail' => $adminmail )); $result = file_put_contents('.htconfig.php', $txt); if(! $result) { - $a->data['txt'] = $txt; + App::$data['txt'] = $txt; } $errors = load_database($db); if($errors) - $a->data['db_failed'] = $errors; + App::$data['db_failed'] = $errors; else - $a->data['db_installed'] = true; + App::$data['db_installed'] = true; return; break; @@ -190,31 +196,31 @@ function setup_content(&$a) { $wizard_status = ''; $install_title = t('$Projectname Server - Setup'); - if(x($a->data, 'db_conn_failed')) { + if(x(App::$data, 'db_conn_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not connect to database.'); } - if(x($a->data, 'url_fail')) { + if(x(App::$data, 'url_fail')) { $install_wizard_pass = 3; $wizard_status = t('Could not connect to specified site URL. Possible SSL certificate or DNS issue.'); - if($a->data['url_error']) - $wizard_status .= ' ' . $a->data['url_error']; + if(App::$data['url_error']) + $wizard_status .= ' ' . App::$data['url_error']; } - if(x($a->data, 'db_create_failed')) { + if(x(App::$data, 'db_create_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not create table.'); } $db_return_text = ''; - if(x($a->data, 'db_installed')) { + if(x(App::$data, 'db_installed')) { $txt = '<p style="font-size: 130%;">'; $txt .= t('Your site database has been installed.') . EOL; $db_return_text .= $txt; } - if(x($a->data, 'db_failed')) { + if(x(App::$data, 'db_failed')) { $txt = t('You may need to import the file "install/schema_xxx.sql" manually using a database client.') . EOL; $txt .= t('Please see the file "install/INSTALL.txt".') . EOL ."<hr>" ; - $txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL ; + $txt .= "<pre>".App::$data['db_failed'] . "</pre>". EOL ; $db_return_text .= $txt; } if($db && $db->connected) { @@ -230,7 +236,7 @@ function setup_content(&$a) { } } - if(x($a->data, 'txt') && strlen($a->data['txt'])) { + if(x(App::$data, 'txt') && strlen(App::$data['txt'])) { $db_return_text .= manual_config($a); } @@ -285,7 +291,7 @@ function setup_content(&$a) { '$next' => t('Next'), '$reload' => t('Check again'), '$phpath' => $phpath, - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), )); return $o; }; break; @@ -321,10 +327,9 @@ function setup_content(&$a) { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), - '$lbl_10' => t('Please select a default timezone for your website'), - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$phpath' => $phpath, @@ -363,10 +368,11 @@ function setup_content(&$a) { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), + '$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$submit' => t('Submit'), )); @@ -627,7 +633,7 @@ function check_htaccess(&$checks) { $help = ''; $ssl_error = false; - $url = $a->get_baseurl() . '/setup/testrewrite'; + $url = z_root() . '/setup/testrewrite'; if (function_exists('curl_init')){ $test = z_fetch_url($url); @@ -670,7 +676,7 @@ function check_htaccess(&$checks) { function manual_config(&$a) { - $data = htmlspecialchars($a->data['txt'], ENT_COMPAT, 'UTF-8'); + $data = htmlspecialchars(App::$data['txt'], ENT_COMPAT, 'UTF-8'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>"; @@ -727,7 +733,7 @@ function what_next() { require_once ('include/identity.php'); create_sys_channel(); - $baseurl = $a->get_baseurl(); + $baseurl = z_root(); return t('<h1>What next</h1>') ."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') |