public function processValues($vals) { I2CE::raiseError(print_r($vals, true)); I2CE::raiseError(print_r($_FILES, true)); if (!parent::processValues($vals)) { return false; } if (array_key_exists('get_all_fields', $vals) && is_scalar($vals['get_all_fields'])) { $this->setField('get_all_fields', $vals['get_all_fields'] ? 1 : 0); } if (array_key_exists('use_cache', $vals) && is_scalar($vals['use_cache'])) { $this->setField('use_cache', $vals['use_cache'] ? 1 : 0); } if (array_key_exists('use_display_fields', $vals) && is_scalar($vals['use_display_fields'])) { $this->setField('use_display_fields', $vals['use_display_fields'] ? 1 : 0); } if (array_key_exists('do_upload', $vals) && $vals['do_upload'] && array_key_exists('__files_upload', $vals) && ($tmpfile = $vals['__files_upload']) && array_key_exists($tmpfile, $_FILES) && is_array($_FILES[$tmpfile]) && array_key_exists('tmp_name', $_FILES[$tmpfile]) && ($file = $_FILES[$tmpfile]['tmp_name']) && ($contents = file_get_contents($file)) && ($transformNode = $this->storage->traverse("transform", true, false)) instanceof I2CE_MagicDataNode) { $transformNode->setAttribute('binary', 1); $transformNode->setAttribute('encoding', 'base64'); if (array_key_exists('type', $_FILES[$tmpfile])) { $transformNode->setAttribute('mime-type', $_FILES[$tmpfile]['type']); } $transformNode->setValue(base64_encode($contents)); } else { if (array_key_exists('do_select', $vals) && $vals['do_select'] && array_key_exists('select', $vals) && is_scalar($vals['select']) && is_array($options = $this->getXSLTS()) && in_array($vals['select'], $options) && ($transformNode = $this->storage->traverse("transform", true, false)) instanceof I2CE_MagicDataNode) { $transformNode->setAttribute('binary', 0); $transformNode->setValue('@' . $vals['select']); } else { if (array_key_exists('do_erase', $vals) && $vals['do_erase'] && ($transformNode = $this->storage->traverse("transform", false, false)) instanceof I2CE_MagicDataNode) { $transformNode->erase(); } } } return true; }
public function processValues($vals) { I2CE::raiseError(print_r($vals, true)); I2CE::raiseError(print_r($_FILES, true)); if (!parent::processValues($vals)) { return false; } if (array_key_exists('use_cache', $vals) && is_scalar($vals['use_cache'])) { $this->setField('use_cache', $vals['use_cache'] ? 1 : 0); } if (array_key_exists('segment_style', $vals) && is_scalar($vals['segment_style'])) { $this->setField('segment_style', $vals['segment_style']); } if (array_key_exists('segment_break', $vals) && is_scalar($vals['segment_break']) && array_key_exists($vals['segment_break'], self::$breaks)) { $this->setField('segment_break', self::$breaks[$vals['segment_break']]); } if (array_key_exists('connection', $vals) && is_scalar($vals['connection'])) { $this->setField('connection', $vals['connection']); } if (array_key_exists('tmp_dir', $vals) && is_scalar($vals['tmp_dir'])) { $this->setField('tmp_dir', $vals['tmp_dir']); } $format = false; $formats = I2CE::getConfig()->getKeys("/modules/PrintedFormsODT/unoconv/conversions"); if (array_key_exists('format', $vals) && is_scalar($format = $vals['format']) && (in_array($format, $formats) || $format == '')) { $this->setField('format', $format); } if (I2CE_MagicDataNode::checkKey($format) && array_key_exists('export_options', $vals) && is_scalar($vals['export_options'])) { $this->storage->export_options->{$format} = $vals['export_options']; } if (array_key_exists('do_upload', $vals) && $vals['do_upload'] && array_key_exists('__files_upload', $vals) && ($tmpfile = $vals['__files_upload']) && array_key_exists($tmpfile, $_FILES) && is_array($_FILES[$tmpfile]) && array_key_exists('tmp_name', $_FILES[$tmpfile]) && ($file = $_FILES[$tmpfile]['tmp_name']) && ($contents = file_get_contents($file)) && ($templateContentNode = $this->storage->traverse("template_upload/content", true, false)) instanceof I2CE_MagicDataNode) { $templateContentNode->setAttribute('binary', 1); $templateContentNode->setAttribute('encoding', 'base64'); if (array_key_exists('type', $_FILES[$tmpfile])) { $templateContentNode->setAttribute('mime-type', $_FILES[$tmpfile]['type']); } $templateContentNode->setValue(base64_encode($contents)); if (array_key_exists('name', $_FILES[$tmpfile]) && ($templateNameNode = $this->storage->traverse("template_upload/name", true, false)) instanceof I2CE_MagicDataNode) { $templateNameNode->setValue($_FILES[$tmpfile]['type']); } if (($templateFileNode = $this->storage->traverse("template_file", false, false)) instanceof I2CE_MagicDataNode) { $templateFileNode->erase(); } } else { if (array_key_exists('do_select', $vals) && $vals['do_select'] && array_key_exists('select', $vals) && is_scalar($vals['select']) && is_array($options = $this->getODTTemplates()) && in_array($vals['select'], $options) && ($templateFileNode = $this->storage->traverse("template_file", true, false)) instanceof I2CE_MagicDataNode) { $templateFileNode->setValue($vals['select']); if (($templateNode = $this->storage->traverse("template_upload", false, false)) instanceof I2CE_MagicDataNode) { $templateNode->erase(); } } } $relationships = I2CE::getConfig()->getKeys("/modules/CustomReports/relationships"); if (array_key_exists('header_relationship', $vals) && is_scalar($vals['header_relationship']) && (in_array($vals['header_relationship'], $relationships) || $vals['header_relationship'] == '')) { $this->setField('header_relationship', $vals['header_relationship']); } return true; }