X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=install%2Findex.php;h=3e461f52818203d7f17a1e9bc7b1299aca97536f;hb=ebe74440841ad798104df78244ee35e481a68282;hp=77477eae500fd9764cf7c4928fc48752e3f7ec17;hpb=c148483e8b3e53123202d411b6635535b1b1b4d9;p=civicrm-core.git diff --git a/install/index.php b/install/index.php index 77477eae50..3e461f5281 100644 --- a/install/index.php +++ b/install/index.php @@ -3,13 +3,40 @@ /** * Note that this installer has been based of the SilverStripe installer. * You can get more information from the SilverStripe Website at - * http://www.silverstripe.com/. Please check - * http://www.silverstripe.com/licensing for licensing details. + * http://www.silverstripe.com/. * * Copyright (c) 2006-7, SilverStripe Limited - www.silverstripe.com * All rights reserved. * - * Changes and modifications (c) 2007-8 by CiviCRM LLC + * License: BSD-3-clause + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of SilverStripe nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Changes and modifications (c) 2007-2015 by CiviCRM LLC * */ @@ -48,19 +75,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 +91,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 +193,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 +234,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 +254,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 +265,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 +308,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 +1259,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 +1290,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 +1308,20 @@ class Installer extends InstallRequirements { $output .= ''; $output .= ''; $output .= '' . ts('CiviCRM Installed') . ''; + $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= '

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

    '; $output .= '