From: Mathieu Lutfy Date: Thu, 5 Mar 2015 02:31:48 +0000 (-0500) Subject: CRM-13584: Finish internationalisation of the installer, and minor cleanups. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6a9514e12e440401c515a52a6d04ecf380c8a0e6;p=civicrm-core.git CRM-13584: Finish internationalisation of the installer, and minor cleanups. --- diff --git a/install/error.html b/install/error.html index 5e8b0a05b0..568bb4b0c9 100644 --- a/install/error.html +++ b/install/error.html @@ -2,6 +2,7 @@ <?php echo $errorTitle ?> + /> diff --git a/install/index.php b/install/index.php index 77477eae50..91c2a1dbc5 100644 --- a/install/index.php +++ b/install/index.php @@ -9,7 +9,7 @@ * Copyright (c) 2006-7, SilverStripe Limited - www.silverstripe.com * All rights reserved. * - * Changes and modifications (c) 2007-8 by CiviCRM LLC + * Changes and modifications (c) 2007-2015 by CiviCRM LLC * */ @@ -48,19 +48,13 @@ else { } global $installType; -$installType = strtolower($_SESSION['civicrm_install_type']); - -if (!in_array($installType, array('drupal', 'wordpress'))) { - $errorTitle = "Oops! Unsupported installation mode"; - $errorMsg = ""; - errorDisplayPage($errorTitle, $errorMsg); -} - global $crmPath; global $pkgPath; global $installDirPath; global $installURLPath; +$installType = strtolower($_SESSION['civicrm_install_type']); + if ($installType == 'drupal') { $crmPath = dirname(dirname($_SERVER['SCRIPT_FILENAME'])); $installDirPath = $installURLPath = ''; @@ -70,32 +64,17 @@ elseif ($installType == 'wordpress') { $installDirPath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR; $installURLPath = WP_PLUGIN_URL . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR; } +else { + $errorTitle = "Oops! Unsupported installation mode"; + $errorMsg = sprintf('%s: unknown installation mode. Please refer to the online documentation for more information.', $installType); + errorDisplayPage($errorTitle, $errorMsg, FALSE); +} $pkgPath = $crmPath . DIRECTORY_SEPARATOR . 'packages'; require_once $crmPath . '/CRM/Core/ClassLoader.php'; CRM_Core_ClassLoader::singleton()->register(); -$docLink = CRM_Utils_System::docURL2('Installation and Upgrades', FALSE, 'Installation Guide', NULL, NULL, "wiki"); - -if ($installType == 'drupal') { - //lets check only /modules/. - $pattern = '/' . preg_quote(CIVICRM_DIRECTORY_SEPARATOR . 'modules', CIVICRM_DIRECTORY_SEPARATOR) . '/'; - - if (!preg_match($pattern, - str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME']) - ) - ) { - $errorTitle = "Oops! Please Correct Your Install Location"; - $errorMsg = "Please untar (uncompress) your downloaded copy of CiviCRM in the " . implode(CIVICRM_DIRECTORY_SEPARATOR, array( - 'sites', - 'all', - 'modules', - )) . " directory below your Drupal root directory. Refer to the online " . $docLink . " for more information."; - errorDisplayPage($errorTitle, $errorMsg); - } -} - // Load civicrm database config if (isset($_REQUEST['mysql'])) { $databaseConfig = $_REQUEST['mysql']; @@ -187,21 +166,34 @@ elseif ($installType == 'wordpress') { ); } +if ($installType == 'drupal') { + // Lets check only /modules/. + $pattern = '/' . preg_quote(CIVICRM_DIRECTORY_SEPARATOR . 'modules', CIVICRM_DIRECTORY_SEPARATOR) . '/'; + + if (!preg_match($pattern, str_replace("\\", "/", $_SERVER['SCRIPT_FILENAME']))) { + $directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array('sites', 'all', 'modules')); + $errorTitle = ts("Oops! Please correct your install location"); + $errorMsg = ts("Please untar (uncompress) your downloaded copy of CiviCRM in the %1 directory below your Drupal root directory.", array(1 => $directory)); + errorDisplayPage($errorTitle, $errorMsg); + } +} + // Exit with error if CiviCRM has already been installed. if ($alreadyInstalled) { - $errorTitle = "Oops! CiviCRM is Already Installed"; - if ($installType == 'drupal') { + $errorTitle = ts("Oops! CiviCRM is already installed"); + $settings_directory = $cmsPath; - $errorMsg = "CiviCRM has already been installed in this Drupal site. "; - } - elseif ($installType == 'wordpress') { - $errorMsg = "CiviCRM has already been installed in this WordPress site. "; + if ($installType == 'drupal') { + $settings_directory = implode(CIVICRM_DIRECTORY_SEPARATOR, array( + ts('[your Drupal root directory]'), + 'sites', + $siteDir, + )); } - errorDisplayPage($errorTitle, $errorMsg); + + $docLink = CRM_Utils_System::docURL2('Installation and Upgrades', FALSE, ts('Installation Guide'), NULL, NULL, "wiki"); + $errorMsg = ts("CiviCRM has already been installed. ", array(1 => $settings_directory, 2 => $docLink)); + errorDisplayPage($errorTitle, $errorMsg, FALSE); } $versionFile = $crmPath . CIVICRM_DIRECTORY_SEPARATOR . 'civicrm-version.php'; @@ -215,11 +207,9 @@ else { if ($installType == 'drupal') { // Ensure that they have downloaded the correct version of CiviCRM - if ($civicrm_version['cms'] != 'Drupal' && - $civicrm_version['cms'] != 'Drupal6' - ) { - $errorTitle = "Oops! Incorrect CiviCRM Version"; - $errorMsg = "This installer can only be used for the Drupal version of CiviCRM. Refer to the online " . $docLink . " for information about installing CiviCRM on PHP4 servers OR installing CiviCRM for Joomla!"; + if ($civicrm_version['cms'] != 'Drupal' && $civicrm_version['cms'] != 'Drupal6') { + $errorTitle = ts("Oops! Incorrect CiviCRM version"); + $errorMsg = ts("This installer can only be used for the Drupal version of CiviCRM."); errorDisplayPage($errorTitle, $errorMsg); } @@ -237,8 +227,8 @@ if ($installType == 'drupal') { } if (!defined('VERSION') or version_compare(VERSION, '6.0') < 0) { - $errorTitle = "Oops! Incorrect Drupal Version"; - $errorMsg = "This version of CiviCRM can only be used with Drupal 6.x or 7.x. Please ensure that '" . implode("' or '", $drupalVersionFiles) . "' exists if you are running Drupal 7.0 and over. Refer to the online " . $docLink . " for information about installing CiviCRM."; + $errorTitle = ts("Oops! Incorrect Drupal version"); + $errorMsg = ts("This version of CiviCRM can only be used with Drupal 6.x or 7.x. Please ensure that '%1' exists if you are running Drupal 7.0 and over.", array(1 => implode("' or '", $drupalVersionFiles))); errorDisplayPage($errorTitle, $errorMsg); } } @@ -248,8 +238,8 @@ elseif ($installType == 'wordpress') { // Ensure that they have downloaded the correct version of CiviCRM if ($civicrm_version['cms'] != 'WordPress') { - $errorTitle = "Oops! Incorrect CiviCRM Version"; - $errorMsg = "This installer can only be used for the WordPress version of CiviCRM. Refer to the online " . $docLink . " for information about installing CiviCRM for Drupal or Joomla!"; + $errorTitle = ts("Oops! Incorrect CiviCRM version"); + $errorMsg = ts("This installer can only be used for the WordPress version of CiviCRM."); errorDisplayPage($errorTitle, $errorMsg); } } @@ -291,7 +281,7 @@ else { * This class checks requirements * Each of the requireXXX functions takes an argument which gives a user description of the test. It's an array * of 3 parts: - * $description[0] - The test catetgory + * $description[0] - The test category * $description[1] - The test title * $description[2] - The test error to show, if it goes wrong */ @@ -1242,8 +1232,8 @@ class Installer extends InstallRequirements { if (@mysql_query("CREATE DATABASE $database")) { } else { - $errorTitle = "Oops! Could not create Database $database"; - $errorMsg = "We encountered an error when attempting to create the database. Please check your mysql server permissions and the database name and try again."; + $errorTitle = ts("Oops! Could not create database %1", array(1 => $database)); + $errorMsg = ts("We encountered an error when attempting to create the database. Please check your MySQL server permissions and the database name and try again."); errorDisplayPage($errorTitle, $errorMsg); } } @@ -1273,10 +1263,9 @@ class Installer extends InstallRequirements { global $installType, $installURLPath; $registerSiteURL = "https://civicrm.org/register-site"; - $commonOutputMessage = " -
  • Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to fill out the site registration form. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).
  • -
  • We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.
  • -"; + $commonOutputMessage = + "
  • " . ts("Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to fill out the site registration form. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).", array(1 => "href='$registerSiteURL' target='_blank'")) . "
  • " + . "
  • " . ts("We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.") . "
  • "; $output = NULL; @@ -1292,22 +1281,20 @@ class Installer extends InstallRequirements { $output .= ''; $output .= ''; $output .= '' . ts('CiviCRM Installed') . ''; + $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '

    ' . ts('CiviCRM has been successfully installed') . '

    '; $output .= '