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.
' . ts('CiviCRM has been successfully installed') . '
'; $output .= '' . ts("CiviCRM has been successfully installed") . '
'; $output .= '' . ts("CiviCRM has been successfully installed") . '
'; echo '' . ts("Refer to the online documentation for more information", array(1 => "href='$docLink'")) . '
'; + } + else { + $errorMsg .= '' . sprintf("Refer to the online documentation for more information", "href='$docLink'") . '
'; + } + } + include 'error.html'; exit(); }