? files
? install_form.patch
? install_form_7_0.patch
? tplify_theme.inc.patch
? sites/logrus.com.x
? sites/all/modules
Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.42
diff -u -p -r1.42 install.php
--- install.php	6 May 2007 11:56:41 -0000	1.42
+++ install.php	7 May 2007 21:03:42 -0000
@@ -27,16 +27,20 @@ function install_main() {
   // Check existing settings.php.
   $verify = install_verify_settings();
 
-  // Drupal may already be installed.
-  if ($verify) {
+  global $db_url;
+  if ($db_url != 'mysql://username:password@localhost/databasename') {
     // Establish a connection to the database.
     require_once './includes/database.inc';
     db_set_active();
     // Check if Drupal is installed.
-    if (install_verify_drupal()) {
+    $state = install_verify_drupal();
+    if ($state == 'complete') {
       install_already_done_error();
     }
   }
+  else {
+    $state = NULL;
+  }
 
   // Load module basics (needed for hook invokes).
   include_once './includes/module.inc';
@@ -68,43 +72,48 @@ function install_main() {
   // Load the profile.
   require_once "./profiles/$profile/$profile.profile";
 
-  // Check the installation requirements for Drupal and this profile.
-  install_check_requirements($profile);
+  if (!$state) {
+    // Check the installation requirements for Drupal and this profile.
+    install_check_requirements($profile);
 
-  // Change the settings.php information if verification failed earlier.
-  // Note: will trigger a redirect if database credentials change.
-  if (!$verify) {
-    install_change_settings($profile, $install_locale);
-  }
+    // Change the settings.php information if verification failed earlier.
+    // Note: will trigger a redirect if database credentials change.
+    if (!$verify) {
+      install_change_settings($profile, $install_locale);
+    }
 
-  // Verify existence of all required modules.
-  $modules = drupal_verify_profile($profile, $install_locale);
-  if (!$modules) {
-    install_missing_modules_error($profile);
-  }
+    // Verify existence of all required modules.
+    $modules = drupal_verify_profile($profile, $install_locale);
+    if (!$modules) {
+      install_missing_modules_error($profile);
+    }
 
-  // Perform actual installation defined in the profile.
-  drupal_install_profile($profile, $modules);
+    // Perform actual installation defined in the profile.
+    drupal_install_profile($profile, $modules);
 
-  // Warn about settings.php permissions risk
-  $settings_file = './'. conf_path() .'/settings.php';
-  if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
-    drupal_set_message(st('All necessary changes to %file have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.', array('%file' => $settings_file)), 'error');
-  }
-  else {
-    drupal_set_message(st('All necessary changes to %file have been made. It has been set to read-only for security.', array('%file' => $settings_file)));
+    // Warn about settings.php permissions risk
+    $settings_file = './'. conf_path() .'/settings.php';
+    if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
+      drupal_set_message(st('All necessary changes to %file have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.', array('%file' => $settings_file)), 'error');
+    }
+    else {
+      drupal_set_message(st('All necessary changes to %file have been made. It has been set to read-only for security.', array('%file' => $settings_file)));
+    }
   }
 
   // Show end page.
-  install_complete($profile);
+  install_finalize($profile, $state);
 }
 
 /**
  * Verify if Drupal is installed.
  */
 function install_verify_drupal() {
-  $result = @db_query("SELECT name FROM {system} WHERE name = 'system'");
-  return $result && db_result($result) == 'system';
+  // read the variable manually using the @ so we don't trigger an error if it fails
+  $result = @db_query("SELECT value FROM {variable} WHERE name = 'install_state'");
+  if ($result) {
+    return unserialize(db_result($result));
+  }
 }
 
 /**
@@ -546,11 +555,9 @@ function install_missing_modules_error($
 /**
  * Page displayed when the installation is complete. Called from install.php.
  */
-function install_complete($profile) {
+function install_finalize($profile, $state) {
   global $base_url;
   $output = '';
-  // Store install profile for later use.
-  variable_set('install_profile', $profile);
 
   // Bootstrap newly installed Drupal, while preserving existing messages.
   $messages = $_SESSION['messages'];
@@ -559,25 +566,70 @@ function install_complete($profile) {
 
   // Build final page.
   drupal_maintenance_theme();
-  install_task_list();
-  drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
-  $output .= '<p>'. st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) .'</p>';
-
-  // Show profile finalization info.
-  $function = $profile .'_profile_final';
-  if (function_exists($function)) {
-    // More steps required
-    $profile_message = $function();
+  if (empty($state)) {
+    variable_set('install_state', 'finalize');
+    $state = 'finalize';
+  }
+  
+  if ($state == 'finalize') {
+    drupal_set_title(st('Enter site details'));
+    menu_rebuild();
+
+    // We break the form up so we can tell when it's been successfully
+    // submitted.
+    $form = drupal_retrieve_form('install_finalize_form');
+
+    // In order to find out if the form was successfully submitted or not,
+    // we do a little song and dance to set the form to 'programmed' and check
+    // to make sure this is really the form being submitted. It'd better be.
+    if ($_POST && $_POST['form_id'] == 'install_finalize_form') {
+      $form['#programmed'] = TRUE;
+      $form['#post'] = $_POST;
+    }
+
+    if (!drupal_process_form('install_finalize_form', $form)) {
+      $output = drupal_render_form('install_finalize_form', $form);
+      install_task_list('finalize');
+    }
   }
 
-  menu_rebuild();
-  // If the profile returned a welcome message, use that instead of default.
-  if (isset($profile_message)) {
-    $output .= $profile_message;
-  }
-  else {
-    // No more steps
-    $output .= '<p>'. (drupal_set_message() ? st('Please review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) .'</p>';
+  // If we have no output, then install.php is done and now we turn to
+  // our profile to finalize things.
+  if (empty($output)) {
+    // Show profile finalization info.
+    $function = $profile .'_profile_final';
+    if (function_exists($function)) {
+      // More steps required
+      $output = $function($state);
+    }
+
+    // This comes after the above so it can make decisions based upon
+    // form results.
+
+    $function = $profile .'_profile_final_task';
+    if (function_exists($function) && $task = $function($state)) {
+      $state = $task;
+    }
+    else {
+      $state = 'complete';
+    }
+
+    install_task_list($state);
+    variable_set('install_state', $state);
+
+    // Store install profile for later use.
+    if ($state == 'complete') {
+      drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
+
+      variable_set('install_profile', $profile);
+
+      $output = '<p>'. (drupal_set_message() ? st('Please review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) .'</p>';
+
+      $function = $profile .'_profile_final_message';
+      if (function_exists($function)) {
+        $output .= $function();
+      }
+    }
   }
   // Output page.
   print theme('maintenance_page', $output);
@@ -618,10 +670,12 @@ function install_task_list($active = NUL
     'requirements' => st('Verify requirements'),
     'database' => st('Database setup'),
     'install' => st('Installation'),
+    'finalize' => st('Enter site details'),
   );
 
+  $profiles = install_find_profiles();
   // Remove profiles if only one profile exists.
-  if (count(install_find_profiles()) == 1) {
+  if (count($profiles) == 1) {
     unset($tasks['profile']);
   }
 
@@ -630,7 +684,119 @@ function install_task_list($active = NUL
     unset($tasks['locale']);
   }
 
+  if (isset($_GET['profile']) && isset($profiles[$_GET['profile']])) {
+    $function = $_GET['profile'] .'_profile_tasks';
+    if (function_exists($function)) {
+      $result = $function();
+      if (is_array($result)) {
+        $tasks += $result;
+      }
+    }
+  }
+
+  // Let the theming function know that 'complete' includes everything,
+  // even though it's not in the list.
+  if ($active == 'complete') {
+    $active = NULL;
+  }
   drupal_set_content('left', theme_task_list($tasks, $active));
 }
 
+function install_finalize_form() {
+  // This is necessary to add the state to the $_GET args so the install
+  // system will know that it is done and we've taken over.
+
+  $form['intro'] = array(
+    '#value' => t('To finalize installation, please configure the following information.'),
+  );
+  $form['site_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Name'),
+    '#default_value' => variable_get('site_name', 'Drupal'),
+    '#description' => t('The name of this website.'),
+    '#required' => TRUE
+  );
+  $form['site_mail'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Site e-mail address'),
+    '#default_value' => variable_get('site_mail', ini_get('sendmail_from')),
+    '#description' => t('A valid e-mail address to be used as the "From" address by the auto-mailer during registration, new password requests, notifications, etc.  To lessen the likelihood of e-mail being marked as spam, this e-mail address should use the same domain as the website.'),
+    '#required' => TRUE,
+  );
+  $form['account']['#tree'] = TRUE;
+  $form['account']['name'] = array('#type' => 'textfield',
+    '#title' => t('Administrator username'),
+    '#maxlength' => USERNAME_MAX_LENGTH,
+    '#description' => t('Your preferred administrator username; punctuation is not allowed except for periods, hyphens, and underscores.'),
+    '#required' => TRUE,
+  );
+
+  $form['account']['mail'] = array('#type' => 'textfield',
+    '#title' => t('Administrator e-mail address'),
+    '#maxlength' => EMAIL_MAX_LENGTH,
+    '#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
+    '#required' => TRUE,
+  );
+  $form['account']['pass'] = array(
+    '#type' => 'password_confirm',
+    '#description' => t('Provide a password for the administrator account in both fields.'),
+    '#required' => TRUE,
+    '#size' => 25,
+  );
+
+  $zones = _system_zonelist();
+
+  $form['date_default_timezone'] = array(
+    '#type' => 'select',
+    '#title' => t('Default time zone'),
+    '#default_value' => variable_get('date_default_timezone', 0),
+    '#options' => $zones,
+    '#description' => t('Select the default site time zone. By default, dates in this site will be displayed in the chosen time zone.')
+  );
+
+  drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
+  drupal_add_js(array('cleanURL' => array('success' => t('Your server has been successfully tested to support this feature.'), 'failure' => t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.'), 'testing' => t('Testing clean URLs...'))), 'setting');
+  drupal_add_js('
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    Drupal.cleanURLsInstallCheck();
+    Drupal.installDefaultTimezone();
+  });
+}', 'inline');
+
+  $form['clean_url'] = array(
+    '#type' => 'radios',
+    '#title' => t('Clean URLs'),
+    '#default_value' => variable_get('clean_url', 0),
+    '#options' => array(t('Disabled'), t('Enabled')),
+    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL).'),
+    '#disabled' => TRUE,
+    '#prefix' => '<div id="clean-url" class="install">',
+    '#suffix' => '</div>',
+  );
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Submit'),
+  );
+
+  return $form;
+}
+
+function install_finalize_form_submit($form_id, $form_values) {
+  variable_set('site_name', $form_values['site_name']);
+  variable_set('site_mail', $form_values['site_mail']);
+  variable_set('date_default_timezone', $form_values['date_default_timezone']);
+  // Turn this off temporarily so that we can pass a password through.
+  variable_set('user_email_verification', FALSE);
+  user_register_submit('user_register', $form_values['account']);
+  variable_set('user_email_verification', TRUE);
+  if (isset($form_values['clean_url'])) {
+    variable_set('clean_url', $form_values['clean_url']);
+  }
+
+  return 'completed';
+}
+
 install_main();
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.25
diff -u -p -r1.25 system.css
--- modules/system/system.css	1 May 2007 06:53:03 -0000	1.25
+++ modules/system/system.css	7 May 2007 21:03:46 -0000
@@ -431,3 +431,10 @@ tr.selected td {
 thead div.sticky-header {
   background: #fff;
 }
+
+/*
+** Installation clean URLs
+*/
+#clean-url.install {
+  display: none;
+}
Index: modules/system/system.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.js,v
retrieving revision 1.3
diff -u -p -r1.3 system.js
--- modules/system/system.js	29 Apr 2007 16:06:04 -0000	1.3
+++ modules/system/system.js	7 May 2007 21:03:46 -0000
@@ -24,3 +24,35 @@ Drupal.cleanURLsSettingsCheck = function
     }
   }});
 }
+
+/**
+ * Internal function to check using Ajax if clean URLs can be enabled on the
+ * install page.
+ *
+ * This function is not used to verify whether or not clean URLs
+ * are currently enabled.
+ */
+Drupal.cleanURLsInstallCheck = function() {
+  var pathname = location.pathname +"";
+  var url = pathname.replace(/\/[^\/]*?$/, '/') +"node";
+  $("#clean-url .description").append('<span><div id="testing">'+ Drupal.settings.cleanURL.testing +"</div></span>");
+  $("#clean-url.install").css("display", "block");
+  $.ajax({url: location.protocol +"//"+ location.host + url, type: "GET", data: " ", complete: function(response) {
+    $("#testing").toggle();
+    if (response.status == 200) {
+      // Check was successful.
+      $("#clean-url input.form-radio").attr("disabled", "");
+      $("#clean-url .description span").append('<div class="ok">'+ Drupal.settings.cleanURL.success +"</div>");
+      $("#clean-url input.form-radio").attr("checked", 1);
+    }
+    else {
+      // Check failed.
+      $("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>");
+    }
+  }});
+}
+
+Drupal.installDefaultTimezone = function() {
+  var offset = new Date().getTimezoneOffset() * -60;
+  $("#edit-date-default-timezone").val(offset);
+}
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.777
diff -u -p -r1.777 user.module
--- modules/user/user.module	30 Apr 2007 17:03:29 -0000	1.777
+++ modules/user/user.module	7 May 2007 21:03:50 -0000
@@ -1375,7 +1375,10 @@ function user_register_submit($form_id, 
   // The first user may login immediately, and receives a customized welcome e-mail.
   if ($account->uid == 1) {
     drupal_mail('user-register-admin', $mail, t('Drupal user account details for !s', array('!s' => $name)), strtr(t("!username,\n\nYou may now login to !uri using the following username and password:\n\n  username: !username\n  password: !password\n\n!edit_uri\n\n--drupal"), $variables), $from);
-    drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="@settings">site information settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '@settings' => url('admin/settings/site-information'))));
+    drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="@settings">site information settings page</a>.', array('@settings' => url('admin/settings/site-information'))));
+    if (variable_get('user_email_verification', TRUE)) {
+      drupal_set_message(t('</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass)));
+    }
     user_authenticate($account->name, trim($pass));
 
     return 'user/1/edit';
Index: profiles/default/default.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v
retrieving revision 1.9
diff -u -p -r1.9 default.profile
--- profiles/default/default.profile	10 Apr 2007 10:10:27 -0000	1.9
+++ profiles/default/default.profile	7 May 2007 21:03:50 -0000
@@ -25,13 +25,50 @@ function default_profile_details() {
 }
 
 /**
+ * Return a list of tasks that this profile supports.
+ *
+ * @return
+ *   A keyed array of tasks the profile will perform during the _final stage.
+ */
+function default_profile_tasks() {
+}
+
+/**
+ * Return the current task during the final stage
+ * 
+ * @param
+ *   The current state of the install system.
+ *
+ * @return 
+ *   A key to the tasks array, as defined in *_profile_tasks(), or NULL
+ *   to indicate that everything is complete.
+ */
+function default_profile_final_task($state) {
+}
+
+/**
+ * Display a final message to the user after all install steps are complete.
+ *
+ * @return 
+ *   A string containing the message.
+ */
+function default_profile_final_message() {
+}
+
+/**
  * Perform any final installation tasks for this profile.
  *
+ * @param $key
+ *   The $key returned by default_profile_final_task (if any) or the
+ *   $state if that was not set.
+ *
  * @return
  *   An optional HTML string to display to the user on the final installation
  *   screen.
  */
-function default_profile_final() {
+function default_profile_final($key) {
+  // Should a profile want to display a form here, it can; it should set the
+
   // Insert default user-defined node types into the database. For a complete
   // list of available node type attributes, refer to the node type API
   // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
@@ -74,3 +111,4 @@ function default_profile_final() {
   $theme_settings['toggle_node_info_page'] = FALSE;
   variable_set('theme_settings', $theme_settings);
 }
+
