<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
'max_attachments' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_undelete' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'versionAlert' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'securityUpdateAlert' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'versionCheck' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'versionCheckIgnoreDate' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'empoweredBy' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'maxFileSize' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'doNotAttachPDFReceipt' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksumTimeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);
+ public $_uploadMaxSize;
+
/**
- * Function to build the form
+ * Basic setup.
+ */
+ public function preProcess() {
+ $config = CRM_Core_Config::singleton();
+ $this->_uploadMaxSize = (int) ini_get('upload_max_filesize');
+ // check for post max size
+ CRM_Core_Config_Defaults::formatUnitSize(ini_get('post_max_size'), TRUE);
+ }
+
+ /**
+ * Build the form object.
*
* @return void
- * @access public
*/
public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)'));
$validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(FALSE);
// FIXME: for now, disable logging for multilingual sites OR if triggers are not permittted
- $domain = new CRM_Core_DAO_Domain;
+ $domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
- $attribs = $domain->locales || !$validTriggerPermission ?
- array('disabled' => 'disabled') : array();
+ $attribs = $domain->locales || !$validTriggerPermission ? array('disabled' => 'disabled') : array();
$this->assign('validTriggerPermission', $validTriggerPermission);
$this->addYesNo('logging', ts('Logging'), NULL, NULL, $attribs);
}
/**
- * global form rule
+ * Global form rule.
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param array $options additional user data
+ * @param array $fields
+ * The input form values.
+ * @param array $files
+ * The uploaded files if any.
+ * @param array $options
+ * Additional user data.
*
- * @return true if no errors, else array of errors
- * @access public
- * @static
+ * @return bool|array
+ * true if no errors, else array of errors
*/
- static function formRule($fields, $files, $options) {
+ public static function formRule($fields, $files, $options) {
$errors = array();
+ // validate max file size
+ if ($fields['maxFileSize'] > $options->_uploadMaxSize) {
+ $errors['maxFileSize'] = ts("Maximum file size cannot exceed Upload max size ('upload_max_filesize') as defined in PHP.ini.");
+ }
+
if (!empty($fields['wkhtmltopdfPath'])) {
// check and ensure that thi leads to the wkhtmltopdf binary
// and it is a valid executable binary
parent::postProcess();
if ($config->logging != $values['logging']) {
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
if ($values['logging']) {
$logging->enableLogging();
}
}
}
}
-}
+}