X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FInvoke.php;h=7cc88fc74aac8b7bfd4fef0e48ebc53eb864e98d;hb=83c6658a8aa7e98e4d24435631f8d20e9b511de7;hp=b1da8497d374c0120c4639feaa98c9fbb178b765;hpb=b100f0b5a1cfef21fdacd35deb07e13d94ecadd6;p=civicrm-core.git diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index b1da8497d3..7cc88fc74a 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -31,7 +31,7 @@ * Serves as a wrapper between the UserFrameWork and Core CRM * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 * $Id$ * */ @@ -72,6 +72,10 @@ class CRM_Core_Invoke { if ($args[0] !== 'civicrm') { return NULL; } + // CRM-15901: Turn off PHP errors display for all ajax calls + if (CRM_Utils_Array::value(1, $args) == 'ajax' || CRM_Utils_Array::value('snippet', $_REQUEST)) { + ini_set('display_errors', 0); + } if (!defined('CIVICRM_SYMFONY_PATH')) { // Traditional Civi invocation path @@ -121,7 +125,7 @@ class CRM_Core_Invoke { } /** - * Perform general setup + * Perform general setup. * * @param array $args * List of path parts. @@ -267,9 +271,11 @@ class CRM_Core_Invoke { } $result = NULL; - if (is_array($item['page_callback'])) { - require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php'; - $result = call_user_func($item['page_callback']); + // WISHLIST: Refactor this. Instead of pattern-matching on page_callback, lookup + // page_callback via Civi\Core\Resolver and check the implemented interfaces. This + // would require rethinking the default constructor. + if (is_array($item['page_callback']) || strpos($item['page_callback'], ':')) { + $result = call_user_func(Civi\Core\Resolver::singleton()->get($item['page_callback'])); } elseif (strstr($item['page_callback'], '_Form')) { $wrapper = new CRM_Utils_Wrapper(); @@ -281,18 +287,17 @@ class CRM_Core_Invoke { } else { $newArgs = explode('/', $_GET[$config->userFrameworkURLVar]); - require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback']) . '.php'; $mode = 'null'; if (isset($pageArgs['mode'])) { $mode = $pageArgs['mode']; unset($pageArgs['mode']); } $title = CRM_Utils_Array::value('title', $item); - if (strstr($item['page_callback'], '_Page')) { + if (strstr($item['page_callback'], '_Page') || strstr($item['page_callback'], '\\Page\\')) { $object = new $item['page_callback']($title, $mode); $object->urlPath = explode('/', $_GET[$config->userFrameworkURLVar]); } - elseif (strstr($item['page_callback'], '_Controller')) { + elseif (strstr($item['page_callback'], '_Controller') || strstr($item['page_callback'], '\\Controller\\')) { $addSequence = 'false'; if (isset($pageArgs['addSequence'])) { $addSequence = $pageArgs['addSequence']; @@ -317,7 +322,7 @@ class CRM_Core_Invoke { } /** - * This function contains the default action + * This function contains the default action. * * @param $action * @@ -339,7 +344,7 @@ class CRM_Core_Invoke { } /** - * Show the message about CiviCRM versions + * Show the message about CiviCRM versions. * * @param CRM_Core_Smarty $template */ @@ -396,5 +401,9 @@ class CRM_Core_Invoke { } CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE); CRM_Core_ManagedEntities::singleton(TRUE)->reconcile(); + + //CRM-16257 update Config.IDS.ini might be an old copy + CRM_Core_IDS::createConfigFile(TRUE); } + }