3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for Site Url.
21 class CRM_Admin_Form_Setting_Url
extends CRM_Admin_Form_Setting
{
22 protected $_settings = [
23 'disable_core_css' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
24 'userFrameworkResourceURL' => CRM_Core_BAO_Setting
::URL_PREFERENCES_NAME
,
25 'imageUploadURL' => CRM_Core_BAO_Setting
::URL_PREFERENCES_NAME
,
26 'customCSSURL' => CRM_Core_BAO_Setting
::URL_PREFERENCES_NAME
,
27 'extensionsURL' => CRM_Core_BAO_Setting
::URL_PREFERENCES_NAME
,
31 * Build the form object.
33 public function buildQuickForm() {
34 CRM_Utils_System
::setTitle(ts('Settings - Resource URLs'));
35 $settingFields = civicrm_api('setting', 'getfields', [
39 $this->addYesNo('enableSSL', ts('Force Secure URLs (SSL)'));
40 $this->addYesNo('verifySSL', ts('Verify SSL Certs'));
41 // FIXME: verifySSL should use $_settings instead of manually adding fields
42 $this->assign('verifySSL_description', $settingFields['values']['verifySSL']['description']);
44 $this->addFormRule(['CRM_Admin_Form_Setting_Url', 'formRule']);
46 parent
::buildQuickForm();
54 public static function formRule($fields) {
55 if (isset($fields['enableSSL']) &&
58 $config = CRM_Core_Config
::singleton();
59 $url = str_replace('http://', 'https://',
60 CRM_Utils_System
::url('civicrm/dashboard', 'reset=1', TRUE,
64 if (!CRM_Utils_System
::checkURL($url, TRUE)) {
66 'enableSSL' => ts('You need to set up a secure server before you can use the Force Secure URLs option'),
74 public function postProcess() {
75 // if extensions url is set, lets clear session status messages to avoid
76 // a potentially spurious message which might already have been set. This
79 $session = CRM_Core_Session
::singleton();
80 $session->getStatus(TRUE);
82 parent
::postProcess();
84 parent
::rebuildMenu();