public function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_writable(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = 'Folder is not writable. Please check permissions.';
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
 public function checkFields(&$errors, $checkForDuplicates = TRUE)
 {
     parent::checkFields($errors, $checkForDuplicates);
     $related_fields = $this->get('related_sbl_id');
     if (empty($related_fields)) {
         $errors['related_sbl_id'] = __('This is a required field.');
     }
     return is_array($errors) && !empty($errors) ? self::__ERROR__ : self::__OK__;
 }
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     parent::checkFields($errors, $checkForDuplicates);
     $this->rememberSalt();
     if (trim($this->get('salt')) == '') {
         $errors['salt'] = 'This is a required field.';
     }
 }
 /**
  * Checks fields for errors in section editor.
  *
  * @param array $errors
  * @param boolean $checkForDuplicates
  */
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     $templates = $this->get('templates');
     if (empty($templates)) {
         $errors['templates'] = __('This is a required field.');
     }
     $senders = $this->get('senders');
     if (empty($senders)) {
         $errors['senders'] = __('This is a required field.');
     }
     $recipient_groups = $this->get('recipient_groups');
     if (empty($recipient_groups)) {
         $errors['recipient_groups'] = __('This is a required field.');
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
Example #5
0
 /**
  * Checks fields for errors in section editor.
  *
  * @param array $errors
  * @param boolean $checkForDuplicates
  */
 function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     // check if a related section has been selected
     if ($this->get('related_section_id') == '') {
         $errors['related_section_id'] = __('This is a required field.');
     }
     // check if caption content is well formed
     if ($this->get('caption')) {
         $validate = simplexml_load_string('<li>' . $this->get('caption') . '</li>');
         if (!$validate) {
             $errors['caption'] = __('Caption has to be well-formed. Please check opening and closing tags.');
         }
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_dir(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Directory <code>%s</code> does not exist.', array($this->get('destination')));
     } elseif (!is_writable(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Destination folder, <code>%s</code>, is not writable. Please check permissions.', array($this->get('destination')));
     }
     if ($this->get('maximum_filesize') != NULL && !is_numeric($this->get('maximum_filesize'))) {
         $errors['maximum_filesize'] = __('Invalid value specified. Must be a number.');
     }
     if ($this->get('maximum_dimension_width') != NULL && !is_numeric($this->get('maximum_dimension_width'))) {
         $errors['maximum_dimension_width'] = __('Invalid value specified. Must be a number.');
     }
     if ($this->get('maximum_dimension_height') != NULL && !is_numeric($this->get('maximum_dimension_height'))) {
         $errors['maximum_dimension_height'] = __('Invalid value specified. Must be a number.');
     }
     if ($this->get('resize_long_edge_dimension') != NULL && !is_numeric($this->get('resize_long_edge_dimension'))) {
         $errors['resize_long_edge_dimension'] = __('Invalid value specified. Must be a number.');
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     $expression = trim($this->get('expression'));
     if (!empty($expression)) {
         $r = Conditionalizer::parse($expression);
         if (empty($r)) {
             $errors['expression'] = __('Invalid syntax');
         }
     }
     return parent::checkFields($errors, $checkForDuplicates);
 }
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     if ($this->get('cname') != '' && !preg_match('/([.]+)/i', $this->get('cname'))) {
         $errors['cname'] = __('This is an invalid CNAME. Don\'t include the protocol (http/s).');
     }
     // Check if a related section has been selected
     if ($this->get('bucket') == '') {
         $errors['bucket'] = __('You have not setup your S3 Access keys yet. Please do so <a href="' . SYMPHONY_URL . '/system/preferences/">here</a>.');
     }
     return Field::checkFields($errors, $checkForDuplicates);
 }
 /**
  *
  * Validates the field settings before saving it into the field's table
  */
 public function checkFields(array &$errors, $checkForDuplicates)
 {
     parent::checkFields($errors, $checkForDuplicates);
     $field_handles = $this->get('field-handles');
     if (empty($field_handles)) {
         $errors['field-handles'] = __('You must set at least one field handle or * to enable those settings for all fields in this section');
     }
     foreach ($this->prefixes as $key => $prefix) {
         $width = $this->get($prefix . 'width');
         $height = $this->get($prefix . 'height');
         $resize = $this->get($prefix . 'resize');
         $position = $this->get($prefix . 'position');
         if (!empty($width) && (!is_numeric($width) || intval($width) < 0)) {
             $errors[$prefix . 'width'] = __('Width must be a positive integer');
         }
         if (!empty($height) && (!is_numeric($height) || intval($height) < 0)) {
             $errors[$prefix . 'height'] = __('Height must be a positive integer');
         }
         if (!empty($resize) && (!is_numeric($resize) || intval($resize) < 1 || intval($resize) > 3)) {
             $errors[$prefix . 'resize'] = __('Resize must be a positive integer between 1 and 3');
         }
         if (!empty($position) && (!is_numeric($position) || intval($position) < 1 || intval($position) > 9)) {
             $errors[$prefix . 'position'] = __('Position must be a positive integer between 1 and 9');
         }
     }
     return !empty($errors) ? self::__ERROR__ : self::__OK__;
 }
 /**
  * @see http://symphony-cms.com/learn/api/2.3/toolkit/field/#checkFields
  */
 function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     // Check if a related section has been selected
     if ($this->get('subsection_id') == '') {
         $errors['subsection_id'] = __('This is a required field.');
     }
     // Check if caption content is well formed
     if ($this->get('caption')) {
         try {
             simplexml_load_string('<li>' . $this->get('caption') . '</li>');
         } catch (Exception $e) {
             $errors['caption'] = __('%s has to be well-formed. Please check opening and closing tags.', array(__('Caption')));
         }
     }
     // Check if droptext content is well formed
     if ($this->get('droptext')) {
         try {
             simplexml_load_string('<li>' . $this->get('droptext') . '</li>');
         } catch (Exception $e) {
             $errors['droptext'] = __('%s has to be well-formed. Please check opening and closing tags.', array(__('Drop text')));
         }
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
 function checkFields(array &$errors, $checkForDuplicates = true)
 {
     parent::checkFields($errors, $checkForDuplicates);
     if (trim($this->get('xml_location')) === '') {
         $errors['xml_location'] = __('This is a required field.');
     }
     if (trim($this->get('item_xpath')) === '') {
         $errors['item_xpath'] = __('This is a required field.');
     }
     if (trim($this->get('text_xpath')) === '') {
         $errors['text_xpath'] = __('This is a required field.');
     }
     return !empty($errors) ? self::__ERROR__ : self::__OK__;
 }
Example #12
0
 function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     if ($this->get('related_field_id') == '' || $this->get('related_field_id') == 'none') {
         $errors['related_field_id'] = __('A file upload field must be selected.');
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
 function checkFields(&$errors, $checkForDuplicates = true)
 {
     // check for presence of upload fields
     $section_id = Administration::instance()->Page->_context[1];
     $fields = FieldManager::fetch(NULL, $section_id, 'ASC', 'sortorder', NULL, NULL, sprintf("AND (type IN ('%s'))", implode("', '", $this->supported_upload_fields)));
     if (empty($fields)) {
         $errors['related_field_id'] = __('There is no upload field in this section. You have to save the section with an upload field before you can add an image cropper field.');
     } else {
         // check if a related field has been selected
         if ($this->get('related_field_id') == '') {
             $errors['related_field_id'] = __('This is a required field.');
         }
     }
     // check if ratios content is well formed
     if ($this->get('ratios')) {
         $ratios = explode(',', $this->get('ratios'));
         $ratios = array_map('trim', $ratios);
         foreach ($ratios as $ratio) {
             if (!preg_match('/^(\\d+\\/\\d+|0)$/', $ratio)) {
                 $errors['ratios'] = __('Ratios have to be well formed.');
             }
         }
     }
     // check if min fields are integers
     $min_fields = array('min_width', 'min_height');
     foreach ($min_fields as $field) {
         $i = $this->get($field);
         if ($i != '' && !preg_match('/^\\d+$/', $i)) {
             $errors[$field] = __('This has to be an integer.');
         }
     }
     return parent::checkFields($errors, $checkForDuplicates);
 }
Example #14
0
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     $expression = trim($this->get('filter_publish'));
     if ($expression) {
         $r = $this->parseExpression($expression);
         if (empty($r)) {
             $errors['filter_publish'] = __('Invalid expression.');
         }
     }
     return parent::checkFields($errors, $checkForDuplicates);
 }
Example #15
0
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     if (!is_array($errors)) {
         $errors = array();
     }
     if ($this->get('static_options') == '' && ($this->get('dynamic_options') == '' || $this->get('dynamic_options') == 'none')) {
         $errors['dynamic_options'] = __('At least one source must be specified, dynamic or static.');
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
Example #16
0
 /**
  * Checks fields for errors in section editor.
  * 
  * @param array $errors
  * @param boolean $checkForDuplicates
  */
 function checkFields(&$errors, $checkForDuplicates = true)
 {
     parent::checkFields($errors, $checkForDuplicates);
 }
 /**
  *
  * Validates the field settings before saving it into the field's table
  */
 public function checkFields(array &$errors, $checkForDuplicates)
 {
     $parent = parent::checkFields($errors, $checkForDuplicates);
     if ($parent != self::__OK__) {
         return $parent;
     }
     $sections = $this->get('sections');
     if (empty($sections)) {
         $errors['sections'] = __('At least one section must be chosen');
     }
     return !empty($errors) ? self::__ERROR__ : self::__OK__;
 }
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     Field::checkFields($errors, $checkForDuplicates);
 }
Example #19
0
 public function checkFields(&$errors, $checkForDuplicates = true)
 {
     if (!is_dir(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Directory <code>%s</code> does not exist.', array($this->get('destination')));
     } elseif (!is_writable(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Destination folder, <code>%s</code>, is not writable. Please check permissions.', array($this->get('destination')));
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
Example #20
0
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     if (!is_dir(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Directory %s does not exist.', array('<code>' . $this->get('destination') . '</code>'));
     } elseif (!is_writable(DOCROOT . $this->get('destination') . '/')) {
         $errors['destination'] = __('Destination folder is not writable.') . ' ' . __('Please check permissions on %s.', array('<code>' . $this->get('destination') . '</code>'));
     }
     parent::checkFields($errors, $checkForDuplicates);
 }
Example #21
0
 function checkFields(&$required, $checkForDuplicates = true, $checkForParentSection = true)
 {
     $required = array();
     if ($this->get('size') == '' || !is_numeric($this->get('size'))) {
         $required[] = 'size';
     }
     return parent::checkFields($required, $checkForDuplicates, $checkForParentSection);
 }
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     parent::checkFields($errors, $checkForDuplicates);
     if (trim($this->get('code_expiry')) == '') {
         $errors['code_expiry'] = __('This is a required field.');
     }
     if (!DateTimeObj::validate($this->get('code_expiry'))) {
         $errors['code_expiry'] = __('Code expiry must be a unit of time, such as <code>1 day</code> or <code>2 hours</code>');
     }
 }
Example #23
0
 public function checkFields(array &$errors, $checkForDuplicates = true)
 {
     parent::checkFields($errors, $checkForDuplicates);
     $types = $this->get('author_types');
     if (empty($types)) {
         $errors['author_types'] = __('This is a required field.');
     }
     return is_array($errors) && !empty($errors) ? self::__ERROR__ : self::__OK__;
 }
 /**
  *
  * Validates the field settings before saving it into the field's table
  */
 public function checkFields(array &$errors, $checkForDuplicates)
 {
     parent::checkFields($errors, $checkForDuplicates);
     $driver = $this->get('driver');
     if (empty($driver)) {
         $errors['driver'] = __('You must select at least one service in order to use the oEmbed field.');
     }
     return !empty($errors) ? self::__ERROR__ : self::__OK__;
 }