X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPage.php;h=c16e33a84fc44b66faf2d6881a7d4ea63af2db7e;hb=900eb33a20f6f8ed03c1a8da6259a61679935ac8;hp=a30dcb3c00401eb8b7d65abb796a15908843e393;hpb=444cd89f6b16c08f4312eec9739548c18b8a65b2;p=civicrm-core.git diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index a30dcb3c00..c16e33a84f 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -104,6 +104,20 @@ class CRM_Core_Page { */ static protected $_session; + /** + * What to return to the client if in ajax mode (snippet=json) + * + * @var array + */ + public $ajaxResponse = array(); + + /** + * Url path used to reach this page + * + * @var array + */ + public $urlPath = array(); + /** * class constructor * @@ -132,7 +146,8 @@ class CRM_Core_Page { elseif ($_REQUEST['snippet'] == 5) { $this->_print = CRM_Core_Smarty::PRINT_NOFORM; } - elseif ($_REQUEST['snippet'] == CRM_Core_Smarty::PRINT_JSON) { + // Support 'json' as well as legacy value '6' + elseif (in_array($_REQUEST['snippet'], array(CRM_Core_Smarty::PRINT_JSON, 6))) { $this->_print = CRM_Core_Smarty::PRINT_JSON; } else { @@ -141,7 +156,7 @@ class CRM_Core_Page { } // if the request has a reset value, initialize the controller session - if (CRM_Utils_Array::value('reset', $_REQUEST)) { + if (!empty($_REQUEST['reset'])) { $this->reset(); } } @@ -189,7 +204,8 @@ class CRM_Core_Page { ); } elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) { - CRM_Core_Page_AJAX::returnJsonResponse($content); + $this->ajaxResponse['content'] = $content; + CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse); } else { echo $content; @@ -203,6 +219,7 @@ class CRM_Core_Page { if (empty($_GET['snippet'])) { // Version check and intermittent alert to admins CRM_Utils_VersionCheck::singleton()->versionAlert(); + CRM_Utils_Check_Security::singleton()->showPeriodicAlerts(); // Debug msg once per hour if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {