function rsfp_getPayment(&$items, $formId)
 {
     if ($components = RSFormProHelper::componentExists($formId, $this->componentId)) {
         $data = RSFormProHelper::getComponentProperties($components[0]);
         $item = new stdClass();
         $item->value = $this->componentValue;
         $item->text = $data['LABEL'];
         // add to array
         $items[] = $item;
     }
 }
示例#2
0
 function RSFormProCaptcha($componentId = 0)
 {
     $this->data = RSFormProHelper::getComponentProperties($componentId);
     if (!isset($this->data['IMAGETYPE'])) {
         $this->data['IMAGETYPE'] = 'FREETYPE';
     }
     if (!isset($this->data['LENGTH'])) {
         $this->data['LENGTH'] = 4;
     }
     if ($this->data['IMAGETYPE'] == 'INVISIBLE') {
         die;
     }
     if (!function_exists('imagecreate')) {
         header('Location:' . JURI::root() . 'components/com_rsform/assets/images/nogd.gif');
         die;
     }
     header('Content-type: image/png');
     $this->Length = $this->data['LENGTH'];
     $this->Size = is_numeric($this->data['SIZE']) && $this->data['SIZE'] > 0 ? $this->data['SIZE'] : 15;
     $this->fontpath = JPATH_SITE . DS . 'components' . DS . 'com_rsform' . DS . 'assets' . DS . 'fonts';
     $this->fonts = $this->getFonts();
     if ($this->data['IMAGETYPE'] == 'FREETYPE') {
         if (!count($this->fonts)) {
             $error = new RSFormProCaptchaError();
             $error->addError('No fonts available!');
             $error->displayError();
             die;
         }
         if (!function_exists('imagettftext')) {
             $error = new RSFormProCaptchaError();
             $error->addError('The function imagettftext does not exist.');
             $error->displayError();
             die;
         }
     }
     $this->stringGenerate();
     $this->makeCaptcha($componentId);
 }
示例#3
0
 function getComponentData()
 {
     $componentId = $this->getComponentId();
     $data = array();
     if ($componentId > 0) {
         $data = RSFormProHelper::getComponentProperties($componentId);
     }
     return $data;
 }
示例#4
0
 function save()
 {
     $db = JFactory::getDBO();
     $componentType = JRequest::getInt('COMPONENTTYPE');
     $componentIdToEdit = JRequest::getInt('componentIdToEdit');
     $formId = JRequest::getInt('formId');
     $params = JRequest::getVar('param', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $params['EMAILATTACH'] = !empty($params['EMAILATTACH']) ? implode(',', $params['EMAILATTACH']) : '';
     $just_added = false;
     if ($componentIdToEdit < 1) {
         $db->setQuery("SELECT MAX(`Order`)+1 AS MO FROM #__rsform_components WHERE FormId='" . $formId . "'");
         $nextOrder = $db->loadResult();
         $db->setQuery("INSERT INTO #__rsform_components SET FormId='" . $formId . "', ComponentTypeId='" . $componentType . "', `Order`='" . $nextOrder . "'");
         $db->query();
         $componentIdToEdit = $db->insertid();
         $just_added = true;
     }
     $model = $this->getModel('forms');
     $lang = $model->getLang();
     if (!$just_added && isset($params['ITEMS'])) {
         $db->setQuery("SELECT cd.* FROM #__rsform_condition_details cd LEFT JOIN #__rsform_conditions c ON (cd.condition_id=c.id) WHERE cd.component_id='" . $componentIdToEdit . "' AND c.lang_code=" . $db->quote($lang));
         if ($conditions = $db->loadObjectList()) {
             $data = RSFormProHelper::getComponentProperties($componentIdToEdit);
             $oldvalues = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS']));
             $newvalues = RSFormProHelper::explode(RSFormProHelper::isCode($params['ITEMS']));
             foreach ($oldvalues as $i => $oldvalue) {
                 $oldvalue = reset(explode('|', $oldvalue, 2));
                 $oldvalue = str_replace(array('[c]', '[g]'), '', $oldvalue);
                 $oldvalues[$i] = $oldvalue;
             }
             foreach ($newvalues as $i => $newvalue) {
                 $newvalue = reset(explode('|', $newvalue, 2));
                 $newvalue = str_replace(array('[c]', '[g]'), '', $newvalue);
                 $newvalues[$i] = $newvalue;
             }
             foreach ($conditions as $condition) {
                 $pos = array_search($condition->value, $oldvalues);
                 if ($pos !== false && isset($newvalues[$pos])) {
                     $newvalue = $newvalues[$pos];
                     if ($condition->value != $newvalue) {
                         $db->setQuery("UPDATE #__rsform_condition_details SET `value`=" . $db->quote($newvalue) . " WHERE id='" . $condition->id . "'");
                         $db->query();
                     }
                 }
             }
         }
     }
     array_walk($params, array('RSFormProHelper', 'escapeArray'));
     if ($model->_form->Lang != $lang) {
         $model->saveFormPropertyTranslation($formId, $componentIdToEdit, $params, $lang, $just_added);
     }
     if ($componentIdToEdit > 0) {
         $db->setQuery("SELECT PropertyName FROM #__rsform_properties WHERE ComponentId='" . $componentIdToEdit . "' AND PropertyName IN ('" . implode("','", array_keys($params)) . "')");
         $properties = $db->loadResultArray();
         foreach ($params as $key => $val) {
             if (in_array($key, $properties)) {
                 $db->setQuery("UPDATE #__rsform_properties SET PropertyValue='" . $val . "' WHERE PropertyName='" . $key . "' AND ComponentId='" . $componentIdToEdit . "'");
             } else {
                 $db->setQuery("INSERT INTO #__rsform_properties SET PropertyValue='" . $val . "', PropertyName='" . $key . "', ComponentId='" . $componentIdToEdit . "'");
             }
             $db->query();
         }
     }
     $link = 'index.php?option=com_rsform&task=forms.edit&formId=' . $formId;
     if (JRequest::getVar('tmpl') == 'component') {
         $link .= '&tmpl=component';
     }
     $this->setRedirect($link);
 }
 function save()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $app = JFactory::getApplication();
     $offset = $app->getCfg('offset');
     $cid = $this->getSubmissionId();
     $form = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $static = JRequest::getVar('formStatic', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $date = JFactory::getDate($static['DateSubmitted'], $offset);
     $static['DateSubmitted'] = $date->toSql();
     $formId = JRequest::getInt('formId');
     $files = JRequest::getVar('upload', array(), 'files', 'none', JREQUEST_ALLOWRAW);
     // Handle file uploads first
     if (!empty($files['error'])) {
         foreach ($files['error'] as $field => $error) {
             if ($error) {
                 continue;
             }
             $this->_db->setQuery("SELECT FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
             $original = $this->_db->loadResult();
             // already uploaded
             if (!empty($form[$field])) {
                 // Path has changed, remove the original file to save up space
                 if ($original != $form[$field] && JFile::exists($original) && is_file($original)) {
                     JFile::delete($original);
                 }
                 if (JFolder::exists(dirname($form[$field]))) {
                     JFile::upload($files['tmp_name'][$field], $form[$field]);
                 }
             } else {
                 $this->_db->setQuery("SELECT c.ComponentId FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId) WHERE c.FormId='" . $formId . "' AND p.PropertyName='NAME' AND p.PropertyValue='" . $this->_db->escape($field) . "'");
                 $componentId = $this->_db->loadResult();
                 if ($componentId) {
                     $data = RSFormProHelper::getComponentProperties($componentId);
                     // Prefix
                     $prefix = uniqid('') . '-';
                     if (isset($data['PREFIX']) && strlen(trim($data['PREFIX'])) > 0) {
                         $prefix = RSFormProHelper::isCode($data['PREFIX']);
                     }
                     if (JFolder::exists($data['DESTINATION'])) {
                         // Path
                         $realpath = realpath($data['DESTINATION'] . '/');
                         if (substr($realpath, -1) != DIRECTORY_SEPARATOR) {
                             $realpath .= DIRECTORY_SEPARATOR;
                         }
                         $path = $realpath . $prefix . '-' . $files['name'][$field];
                         $form[$field] = $path;
                         JFile::upload($files['tmp_name'][$field], $path);
                     }
                 }
             }
         }
     }
     $update = array();
     foreach ($static as $field => $value) {
         $update[] = "`" . $this->_db->escape($field) . "`='" . $this->_db->escape($value) . "'";
     }
     if (!empty($update)) {
         $this->_db->setQuery("UPDATE #__rsform_submissions SET " . implode(',', $update) . " WHERE SubmissionId='" . $cid . "'");
         $this->_db->execute();
     }
     // Update fields
     foreach ($form as $field => $value) {
         if (is_array($value)) {
             $value = implode("\n", $value);
         }
         $this->_db->setQuery("SELECT SubmissionValueId, FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
         $original = $this->_db->loadObject();
         if (!$original) {
             $this->_db->setQuery("INSERT INTO #__rsform_submission_values SET FormId='" . $formId . "', SubmissionId='" . $cid . "', FieldName='" . $this->_db->escape($field) . "', FieldValue='" . $this->_db->escape($value) . "'");
             $this->_db->execute();
         } else {
             // Update only if we've changed something
             if ($original->FieldValue != $value) {
                 // Check if this is an upload field
                 if (isset($files['error'][$field]) && JFile::exists($original->FieldValue) && is_file($original->FieldValue)) {
                     // Move the file to the new location
                     if (!empty($value) && JFolder::exists(dirname($value))) {
                         JFile::move($original->FieldValue, $value);
                     } elseif (empty($value)) {
                         JFile::delete($original->FieldValue);
                     }
                 }
                 $this->_db->setQuery("UPDATE #__rsform_submission_values SET FieldValue='" . $this->_db->escape($value) . "' WHERE SubmissionValueId='" . $original->SubmissionValueId . "' LIMIT 1");
                 $this->_db->execute();
             }
         }
     }
     // Checkboxes don't send a value if nothing is checked
     $this->_db->setQuery("SELECT p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId) WHERE c.ComponentTypeId='4' AND p.PropertyName='NAME' AND c.FormId='" . $formId . "'");
     $checkboxes = $this->_db->loadColumn();
     foreach ($checkboxes as $checkbox) {
         $value = isset($form[$checkbox]) ? $form[$checkbox] : '';
         if (is_array($value)) {
             $value = implode("\n", $value);
         }
         $this->_db->setQuery("UPDATE #__rsform_submission_values SET FieldValue='" . $this->_db->escape($value) . "' WHERE FieldName='" . $this->_db->escape($checkbox) . "' AND FormId='" . $formId . "' AND SubmissionId='" . $cid . "' LIMIT 1");
         $this->_db->execute();
     }
 }
 function getHiddenFields()
 {
     $formId = JRequest::getInt('formId');
     $names = array();
     $this->_db->setQuery("SELECT p.ComponentId FROM #__rsform_properties p LEFT JOIN #__rsform_components c ON (p.ComponentId = c.ComponentId) WHERE c.FormId='" . $formId . "' AND (p.PropertyName='LAYOUTHIDDEN' AND p.PropertyValue='YES') AND c.Published='1' ORDER BY c.Order");
     if ($results = $this->_db->loadColumn()) {
         $data = RSFormProHelper::getComponentProperties($results);
         foreach ($data as $ComponentId => $properties) {
             if (isset($properties['NAME'])) {
                 $names[] = $properties['NAME'];
             }
         }
     }
     return $names;
 }
示例#7
0
 protected function getFieldNames($type = 'all')
 {
     static $done;
     static $all = array();
     static $required = array();
     static $hidden = array();
     static $pages = array();
     if (!$done) {
         // Get field properties first
         $data = array();
         $formId = JFactory::getApplication()->input->getInt('formId');
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select($db->qn('ComponentId'))->select($db->qn('ComponentTypeId'))->from($db->qn('#__rsform_components'))->where($db->qn('FormId') . '=' . $db->q($formId))->where($db->qn('Published') . '=' . $db->q(1))->order($db->qn('Order') . ' ' . $db->escape('asc'));
         if ($components = $db->setQuery($query)->loadObjectList()) {
             $data = RSFormProHelper::getComponentProperties($components);
             foreach ($components as $component) {
                 if (!empty($data[$component->ComponentId])) {
                     $properties =& $data[$component->ComponentId];
                     if (isset($properties['NAME'])) {
                         // Populate the 'all' array
                         $all[] = $properties['NAME'];
                         // Populate the 'required' array
                         if (isset($properties['REQUIRED']) && $properties['REQUIRED'] == 'YES' || isset($properties['IMAGETYPE']) && $properties['IMAGETYPE'] != 'INVISIBLE' || $component->ComponentTypeId == 24) {
                             $required[] = $properties['NAME'];
                         }
                         // Populate the 'hidden' array
                         if (isset($properties['LAYOUTHIDDEN']) && $properties['LAYOUTHIDDEN'] == 'YES') {
                             $hidden[] = $properties['NAME'];
                         }
                         // Populate the 'pages' array
                         if ($component->ComponentTypeId == 41) {
                             $pages[] = $properties['NAME'];
                         }
                     }
                 }
             }
         }
         $done = true;
     }
     return ${$type};
 }
 public static function generateMap($id, $validation)
 {
     $data = RSFormProHelper::getComponentProperties($id);
     $zoom = !empty($data['MAPZOOM']) ? (int) $data['MAPZOOM'] : 5;
     $center = !empty($data['MAPCENTER']) ? $data['MAPCENTER'] : '39.5500507,-105.7820674';
     $geo = isset($data['GEOLOCATION']) && $data['GEOLOCATION'] == 'YES';
     $address = $data['MAPRESULT'] == 'ADDRESS';
     $html = '';
     $html .= "\n" . 'var rsformmap' . $id . '; var geocoder; var rsformmarker' . $id . ';' . "\n";
     $html .= 'function rsfp_initialize_map' . $id . '() {' . "\n";
     $html .= "\t" . 'geocoder = new google.maps.Geocoder();' . "\n";
     $html .= "\t" . 'var rsformmapDiv' . $id . ' = document.getElementById(\'rsform-map' . $id . '\');' . "\n";
     $html .= "\t" . 'rsformmap' . $id . ' = new google.maps.Map(rsformmapDiv' . $id . ', {' . "\n";
     $html .= "\t\t" . 'center: new google.maps.LatLng(' . $center . '),' . "\n";
     $html .= "\t\t" . 'zoom: ' . $zoom . ',' . "\n";
     $html .= "\t\t" . 'mapTypeId: google.maps.MapTypeId.ROADMAP,' . "\n";
     $html .= "\t\t" . 'streetViewControl: false' . "\n";
     $html .= "\t" . '});' . "\n\n";
     $html .= "\t" . 'rsformmarker' . $id . ' = new google.maps.Marker({' . "\n";
     $html .= "\t\t" . 'map: rsformmap' . $id . ',' . "\n";
     $html .= "\t\t" . 'position: new google.maps.LatLng(' . $center . '),' . "\n";
     $html .= "\t\t" . 'draggable: true' . "\n";
     $html .= "\t" . '});' . "\n\n";
     $html .= "\t" . 'google.maps.event.addListener(rsformmarker' . $id . ', \'drag\', function() {' . "\n";
     $html .= "\t\t" . 'geocoder.geocode({\'latLng\': rsformmarker' . $id . '.getPosition()}, function(results, status) {' . "\n";
     $html .= "\t\t\t" . 'if (status == google.maps.GeocoderStatus.OK) {' . "\n";
     $html .= "\t\t\t\t" . 'if (results[0]) {' . "\n";
     if ($data['MAPRESULT'] == 'ADDRESS') {
         $html .= "\t\t\t\t\t" . 'document.getElementById(\'' . $data['NAME'] . '\').value = results[0].formatted_address;' . "\n";
     } else {
         $html .= "\t\t\t\t\t" . 'document.getElementById(\'' . $data['NAME'] . '\').value = rsformmarker' . $id . '.getPosition().toUrlValue();' . "\n";
     }
     $html .= "\t\t\t\t" . '}' . "\n";
     $html .= "\t\t\t" . '}' . "\n";
     $html .= "\t\t" . '});' . "\n";
     $html .= "\t" . '});' . "\n";
     if (!empty($validation)) {
         if ($data['MAPRESULT'] == 'ADDRESS') {
             $html .= "\n\t" . 'geocoder.geocode({\'address\': document.getElementById(\'' . $data['NAME'] . '\').value}, function(results, status) {' . "\n";
             $html .= "\t\t" . 'if (status == google.maps.GeocoderStatus.OK) {' . "\n";
             $html .= "\t\t\t" . 'rsformmap' . $id . '.setCenter(results[0].geometry.location);' . "\n";
             $html .= "\t\t\t" . 'rsformmarker' . $id . '.setPosition(results[0].geometry.location);' . "\n";
             $html .= "\t\t" . '}' . "\n";
             $html .= "\t" . '});' . "\n";
         } else {
             $html .= "\t" . 'rsformCoordinates' . $id . ' = document.getElementById(\'' . $data['NAME'] . '\').value.split(\',\');' . "\n";
             $html .= "\t" . 'formPosition' . $id . ' = new google.maps.LatLng(parseFloat(rsformCoordinates' . $id . '[0]),parseFloat(rsformCoordinates' . $id . '[1]));' . "\n";
             $html .= "\t" . 'rsformmap' . $id . '.setCenter(formPosition' . $id . ');' . "\n";
             $html .= "\t" . 'rsformmarker' . $id . '.setPosition(formPosition' . $id . ');' . "\n";
         }
     }
     $html .= '}' . "\n";
     $html .= 'google.maps.event.addDomListener(window, \'load\', rsfp_initialize_map' . $id . ');' . "\n\n";
     if ($geo) {
         $html .= 'rsfp_addEvent(document.getElementById(\'' . $data['NAME'] . '\'),\'keyup\', function() { ' . "\n";
         $html .= "\t" . 'rsfp_geolocation(this.value,' . $id . ',\'' . $data['NAME'] . '\',rsformmap' . $id . ',rsformmarker' . $id . ',geocoder, ' . (int) $address . ');' . "\n";
         $html .= '});' . "\n";
     }
     return $html;
 }
示例#9
0
 public function save()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $cid = JRequest::getInt('id');
     $form = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $static = JRequest::getVar('formStatic', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $formId = JRequest::getInt('formId');
     $files = JRequest::getVar('form', array(), 'files', 'none', JREQUEST_ALLOWRAW);
     $validation = RSFormProHelper::validateForm($formId, 'directory', $cid);
     if (!empty($validation)) {
         return false;
     }
     $formFields = RSFormProHelper::getDirectoryFields($formId);
     $headers = RSFormProHelper::getDirectoryStaticHeaders();
     $staticFields = array();
     $allowed = array();
     foreach ($formFields as $field) {
         if ($field->editable) {
             if ($field->componentId < 0 && isset($headers[$field->componentId])) {
                 $staticFields[] = $field->FieldName;
             } else {
                 $allowed[] = $field->FieldName;
             }
         }
     }
     //Trigger Event - onBeforeDirectorySave
     $this->_app->triggerEvent('rsfp_f_onBeforeDirectorySave', array(array('SubmissionId' => &$cid, 'formId' => $formId, 'post' => &$form)));
     // Handle file uploads first
     if (!empty($files['error'])) {
         foreach ($files['error'] as $field => $error) {
             if (!in_array($field, $allowed) || $error) {
                 continue;
             }
             // The above $validation should suffice
             $this->_db->setQuery("SELECT FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
             $original = $this->_db->loadResult();
             // Prefix
             $componentId = RSFormProHelper::getComponentId($field, $formId);
             $data = RSFormProHelper::getComponentProperties($componentId);
             $prefix = uniqid('') . '-';
             if (isset($data['PREFIX']) && strlen(trim($data['PREFIX'])) > 0) {
                 $prefix = RSFormProHelper::isCode($data['PREFIX']);
             }
             // Path
             $realpath = realpath($data['DESTINATION'] . DIRECTORY_SEPARATOR);
             if (substr($realpath, -1) != DIRECTORY_SEPARATOR) {
                 $realpath .= DIRECTORY_SEPARATOR;
             }
             // Filename
             $file = $realpath . $prefix . $files['name'][$field];
             // Upload File
             if (JFile::upload($files['tmp_name'][$field], $file) && $file != $original) {
                 // Remove the original file to save up space
                 if (file_exists($original) && is_file($original)) {
                     JFile::delete($original);
                 }
                 // Add to db (submission value)
                 $form[$field] = $file;
             }
         }
     }
     // Update fields
     foreach ($form as $field => $value) {
         if (!in_array($field, $allowed)) {
             continue;
         }
         if (is_array($value)) {
             $value = implode("\n", $value);
         }
         // Dynamic field - update value.
         $this->_db->setQuery("SELECT SubmissionValueId, FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
         $original = $this->_db->loadObject();
         if (!$original) {
             $this->_db->setQuery("INSERT INTO #__rsform_submission_values SET FormId='" . $formId . "', SubmissionId='" . $cid . "', FieldName='" . $this->_db->escape($field) . "', FieldValue='" . $this->_db->escape($value) . "'");
             $this->_db->execute();
         } else {
             // Update only if we've changed something
             if ($original->FieldValue != $value) {
                 $this->_db->setQuery("UPDATE #__rsform_submission_values SET FieldValue='" . $this->_db->escape($value) . "' WHERE SubmissionValueId='" . $original->SubmissionValueId . "' LIMIT 1");
                 $this->_db->execute();
             }
         }
     }
     $offset = JFactory::getConfig()->get('offset');
     if ($static && $staticFields) {
         // Static, update submission
         $query = $this->_db->getQuery(true);
         $query->update('#__rsform_submissions')->where($this->_db->qn('SubmissionId') . '=' . $this->_db->q($cid));
         foreach ($staticFields as $field) {
             if (!isset($static[$field])) {
                 $static[$field] = '';
             }
             if ($field == 'DateSubmitted') {
                 $static[$field] = JFactory::getDate($static[$field], $offset)->toSql();
             }
             $query->set($this->_db->qn($field) . '=' . $this->_db->q($static[$field]));
         }
         $this->_db->setQuery($query);
         $this->_db->execute();
     }
     // Checkboxes don't send a value if nothing is checked
     $checkboxesWhere = '';
     if ($editFields = $this->getEditFields()) {
         $allowedFields = array();
         foreach ($editFields as $field) {
             $allowedFields[] = $this->_db->q($field[3]);
         }
         if (!empty($allowedFields)) {
             $checkboxesWhere = "AND p.PropertyValue IN (" . implode(',', $allowedFields) . ")";
         }
     }
     $this->_db->setQuery("SELECT p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId) WHERE c.ComponentTypeId='4' AND p.PropertyName='NAME' AND c.FormId='" . $formId . "' " . $checkboxesWhere);
     $checkboxes = $this->_db->loadColumn();
     foreach ($checkboxes as $checkbox) {
         $value = isset($form[$checkbox]) ? $form[$checkbox] : '';
         if (is_array($value)) {
             $value = implode("\n", $value);
         }
         $this->_db->setQuery("UPDATE #__rsform_submission_values SET FieldValue='" . $this->_db->escape($value) . "' WHERE FieldName='" . $this->_db->escape($checkbox) . "' AND FormId='" . $formId . "' AND SubmissionId='" . $cid . "' LIMIT 1");
         $this->_db->execute();
     }
     // Send emails
     $this->sendEmails($formId, $cid);
     return true;
 }
示例#10
0
function RSgetSubmissionValue($SubmissionId, $ComponentId)
{
    $db = JFactory::getDBO();
    $data = RSFormProHelper::getComponentProperties($ComponentId);
    $db->setQuery("SELECT `FieldValue` FROM #__rsform_submission_values WHERE FieldName = '" . $data['NAME'] . "' AND SubmissionId = '" . (int) $SubmissionId . "'");
    return $db->loadResult();
}
示例#11
0
 function getFields()
 {
     $formId = JRequest::getInt('formId');
     $return = array();
     $this->_db->setQuery("SELECT p.PropertyValue AS ComponentName, c.*, ct.ComponentTypeName FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId AND p.PropertyName='NAME') LEFT JOIN #__rsform_component_types ct ON (ct.ComponentTypeId = c.ComponentTypeId) WHERE c.FormId='" . $formId . "' ORDER BY c.Order");
     $components = $this->_db->loadObjectList();
     $properties = RSFormProHelper::getComponentProperties($components);
     foreach ($components as $component) {
         $data = $properties[$component->ComponentId];
         $data['componentId'] = $component->ComponentId;
         $data['componentTypeId'] = $component->ComponentTypeId;
         $data['ComponentTypeName'] = $component->ComponentTypeName;
         $field = new stdClass();
         $field->id = $component->ComponentId;
         $field->type_id = $component->ComponentTypeId;
         $field->name = $component->ComponentName;
         $field->published = $component->Published;
         $field->ordering = $component->Order;
         $field->preview = RSFormProHelper::showPreview($formId, $field->id, $data);
         $field->required = isset($data['REQUIRED']) && $data['REQUIRED'] == 'YES' ? '<b>' . JText::_($data['REQUIRED']) . '</b>' : JText::_('NO');
         $field->validation = isset($data['VALIDATIONRULE']) && $data['VALIDATIONRULE'] != 'none' ? '<b>' . $data['VALIDATIONRULE'] . '</b>' : '-';
         $return[] = $field;
     }
     return $return;
 }
 public static function validateForm($formId)
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $invalid = array();
     $formId = (int) $formId;
     $post = JRequest::get('post', JREQUEST_ALLOWRAW);
     $db->setQuery("SELECT ComponentId, ComponentTypeId FROM #__rsform_components WHERE FormId='" . $formId . "' AND Published=1 ORDER BY `Order`");
     if ($components = $db->loadObjectList('ComponentId')) {
         $componentIds = array_keys($components);
         // load properties
         $all_data = RSFormProHelper::getComponentProperties($componentIds);
         if (empty($all_data)) {
             return $invalid;
         }
         // load conditions
         if ($conditions = RSFormProHelper::getConditions($formId)) {
             foreach ($conditions as $condition) {
                 if ($condition->details) {
                     $condition_vars = array();
                     foreach ($condition->details as $detail) {
                         $isChecked = RSFormProHelper::verifyChecked($detail->ComponentName, $detail->value, $post);
                         $condition_vars[] = $detail->operator == 'is' ? $isChecked : !$isChecked;
                     }
                     // this check is performed like this
                     // 'all' must be true (ie. no 0s in the array); 'any' can be true (ie. one value of 1 in the array will do)
                     $result = $condition->condition == 'all' ? !in_array(0, $condition_vars) : in_array(1, $condition_vars);
                     // if the item is hidden, no need to validate it
                     if ($condition->action == 'show' && !$result || $condition->action == 'hide' && $result) {
                         foreach ($components as $i => $component) {
                             if ($component->ComponentId == $condition->component_id) {
                                 // ... just remove it from the components array
                                 unset($components[$i]);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         // load validation rules
         require_once JPATH_SITE . '/components/com_rsform/helpers/validation.php';
         require_once JPATH_SITE . '/components/com_rsform/helpers/datevalidation.php';
         $validations = array_flip(get_class_methods('RSFormProValidations'));
         $dateValidations = array_flip(get_class_methods('RSFormProDateValidations'));
         // validate through components
         foreach ($components as $component) {
             $data = $all_data[$component->ComponentId];
             $required = !empty($data['REQUIRED']) && $data['REQUIRED'] == 'YES';
             $validationRule = !empty($data['VALIDATIONRULE']) ? $data['VALIDATIONRULE'] : '';
             $typeId = $component->ComponentTypeId;
             // birthDay field
             if ($typeId == 211) {
                 // flag to check if we need to run the validation functions
                 $runValidations = false;
                 if ($required) {
                     // we need all of the fields to be selected
                     if ($data['SHOWDAY'] == 'YES' && empty($post['form'][$data['NAME']]['d']) || $data['SHOWMONTH'] == 'YES' && empty($post['form'][$data['NAME']]['m']) || $data['SHOWYEAR'] == 'YES' && empty($post['form'][$data['NAME']]['y'])) {
                         $invalid[] = $data['componentId'];
                         continue;
                     }
                     $runValidations = true;
                 } else {
                     // the field is not required, but if a selection is made it needs to be valid
                     $selections = array();
                     if ($data['SHOWDAY'] == 'YES') {
                         $selections[] = !empty($post['form'][$data['NAME']]['d']) ? $post['form'][$data['NAME']]['d'] : '';
                     }
                     if ($data['SHOWMONTH'] == 'YES') {
                         $selections[] = !empty($post['form'][$data['NAME']]['m']) ? $post['form'][$data['NAME']]['m'] : '';
                     }
                     if ($data['SHOWYEAR'] == 'YES') {
                         $selections[] = !empty($post['form'][$data['NAME']]['y']) ? $post['form'][$data['NAME']]['y'] : '';
                     }
                     $foundEmpty = false;
                     $foundValue = false;
                     foreach ($selections as $selection) {
                         if ($selection == '') {
                             $foundEmpty = true;
                         } else {
                             $foundValue = true;
                         }
                     }
                     // at least 1 value has been selected but we've found empty values as well, make sure the selection is valid first!
                     if ($foundEmpty && $foundValue) {
                         $invalid[] = $data['componentId'];
                         continue;
                     } elseif ($foundValue && !$foundEmpty) {
                         $runValidations = true;
                     }
                 }
                 // we have all the info we need, validations only work when all fields are selected
                 if ($runValidations && $data['SHOWDAY'] == 'YES' && $data['SHOWMONTH'] == 'YES' && $data['SHOWYEAR'] == 'YES') {
                     $validationRule = !empty($data['VALIDATIONRULE_DATE']) ? $data['VALIDATIONRULE_DATE'] : '';
                     $day = $post['form'][$data['NAME']]['d'];
                     $month = $post['form'][$data['NAME']]['m'];
                     $year = $post['form'][$data['NAME']]['y'];
                     // start checking validation rules
                     if (isset($dateValidations[$validationRule]) && !call_user_func(array('RSFormProDateValidations', $validationRule), $day, $month, $year, $data)) {
                         $invalid[] = $data['componentId'];
                         continue;
                     }
                 }
                 // no need to process further
                 continue;
             }
             // CAPTCHA
             if ($typeId == 8) {
                 $session = JFactory::getSession();
                 $captchaCode = $session->get('com_rsform.captcha.' . $component->ComponentId);
                 if ($data['IMAGETYPE'] == 'INVISIBLE') {
                     $words = RSFormProHelper::getInvisibleCaptchaWords();
                     if (!empty($post[$captchaCode])) {
                         $invalid[] = $data['componentId'];
                     }
                     foreach ($words as $word) {
                         if (!empty($post[$word])) {
                             $invalid[] = $data['componentId'];
                         }
                     }
                 } else {
                     if (empty($post['form'][$data['NAME']]) || empty($captchaCode) || $post['form'][$data['NAME']] != $captchaCode) {
                         $invalid[] = $data['componentId'];
                     }
                 }
                 // no sense continuing
                 continue;
             }
             // Upload field
             if ($typeId == 9) {
                 $files = JRequest::getVar('form', null, 'files');
                 // File has been *sent* to the server
                 if (isset($files['tmp_name'][$data['NAME']]) && $files['error'][$data['NAME']] != 4) {
                     // File has been uploaded correctly to the server
                     if ($files['error'][$data['NAME']] == 0) {
                         // Let's check if the extension is allowed
                         $buf = explode('.', $files['name'][$data['NAME']]);
                         $m = '#' . preg_quote($buf[count($buf) - 1]) . '#';
                         if (!empty($data['ACCEPTEDFILES']) && !preg_match(strtolower($m), strtolower($data['ACCEPTEDFILES']))) {
                             $invalid[] = $data['componentId'];
                         }
                         // Let's check if it's the correct size
                         if ($files['size'][$data['NAME']] > 0 && $data['FILESIZE'] > 0 && $files['size'][$data['NAME']] > $data['FILESIZE'] * 1024) {
                             $invalid[] = $data['componentId'];
                         }
                     } else {
                         $invalid[] = $data['componentId'];
                     }
                 } elseif ($required) {
                     $invalid[] = $data['componentId'];
                 }
                 // files have been handled, no need to continue
                 continue;
             }
             // flag to check if we need to run the validation functions
             $runValidations = false;
             if ($required) {
                 // field is required, but is missing
                 if (!isset($post['form'][$data['NAME']])) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
                 // must have a value if it's required
                 if (is_array($post['form'][$data['NAME']])) {
                     // it's an empty array
                     $valid = implode('', $post['form'][$data['NAME']]);
                     if (empty($valid)) {
                         $invalid[] = $data['componentId'];
                         continue;
                     }
                 } else {
                     // it's a string with no length
                     if (!strlen(trim($post['form'][$data['NAME']]))) {
                         $invalid[] = $data['componentId'];
                         continue;
                     }
                     $runValidations = true;
                 }
             } else {
                 // not required, perform checks only when something is selected
                 // we have a value, make sure it's the correct one
                 if (isset($post['form'][$data['NAME']]) && !is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']]))) {
                     $runValidations = true;
                 }
             }
             if ($runValidations && isset($validations[$validationRule]) && !call_user_func(array('RSFormProValidations', $validationRule), $post['form'][$data['NAME']], isset($data['VALIDATIONEXTRA']) ? $data['VALIDATIONEXTRA'] : '', $data)) {
                 $invalid[] = $data['componentId'];
                 continue;
             }
         }
     }
     return $invalid;
 }
示例#13
0
 function validateForm($formId)
 {
     $mainframe =& JFactory::getApplication();
     $invalid = array();
     $formId = (int) $formId;
     $post = JRequest::get('post', JREQUEST_ALLOWRAW);
     $db = JFactory::getDBO();
     $db->setQuery("SELECT ComponentId, ComponentTypeId FROM #__rsform_components WHERE FormId='" . $formId . "' AND Published=1 ORDER BY `Order`");
     $components = $db->loadObjectList();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_rsform' . DS . 'helpers' . DS . 'validation.php';
     $componentIds = array();
     foreach ($components as $component) {
         $componentIds[] = $component->ComponentId;
     }
     $all_data = RSFormProHelper::getComponentProperties($componentIds);
     if (empty($all_data)) {
         return $invalid;
     }
     foreach ($components as $component) {
         $data = $all_data[$component->ComponentId];
         $required = isset($data['REQUIRED']) ? $data['REQUIRED'] : 'NO';
         $validationRule = isset($data['VALIDATIONRULE']) ? $data['VALIDATIONRULE'] : '';
         $typeId = $component->ComponentTypeId;
         // CAPTCHA
         if ($typeId == 8) {
             $session =& JFactory::getSession();
             $captchaCode = $session->get('com_rsform.captcha.' . $component->ComponentId);
             if ($data['IMAGETYPE'] == 'INVISIBLE') {
                 $words = RSFormProHelper::getInvisibleCaptchaWords();
                 if (!empty($post[$captchaCode])) {
                     $invalid[] = $data['componentId'];
                 }
                 foreach ($words as $word) {
                     if (!empty($post[$word])) {
                         $invalid[] = $data['componentId'];
                     }
                 }
             } else {
                 if (empty($post['form'][$data['NAME']]) || empty($captchaCode) || $post['form'][$data['NAME']] != $captchaCode) {
                     $invalid[] = $data['componentId'];
                 }
             }
         }
         // Trigger Event - rsfp_bk_validate_onSubmitValidateRecaptcha
         if ($typeId == 24) {
             $mainframe->triggerEvent('rsfp_bk_validate_onSubmitValidateRecaptcha', array(array('data' => &$data, 'invalid' => &$invalid)));
         }
         if ($typeId == 9) {
             $files = JRequest::getVar('form', null, 'files');
             // File has been *sent* to the server
             if (isset($files['tmp_name'][$data['NAME']]) && $files['error'][$data['NAME']] != 4) {
                 // File has been uploaded correctly to the server
                 if ($files['error'][$data['NAME']] == 0) {
                     // Let's check if the extension is allowed
                     $buf = explode('.', $files['name'][$data['NAME']]);
                     $m = '#' . preg_quote($buf[count($buf) - 1]) . '#';
                     if (!empty($data['ACCEPTEDFILES']) && !preg_match(strtolower($m), strtolower($data['ACCEPTEDFILES']))) {
                         $invalid[] = $data['componentId'];
                     }
                     // Let's check if it's the correct size
                     if ($files['size'][$data['NAME']] > 0 && $data['FILESIZE'] > 0 && $files['size'][$data['NAME']] > $data['FILESIZE'] * 1024) {
                         $invalid[] = $data['componentId'];
                     }
                 } else {
                     $invalid[] = $data['componentId'];
                 }
             } elseif ($required == 'YES') {
                 $invalid[] = $data['componentId'];
             }
             continue;
         }
         if ($required == 'YES') {
             if (!isset($post['form'][$data['NAME']])) {
                 $invalid[] = $data['componentId'];
                 continue;
             }
             if (!is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) == 0) {
                 $invalid[] = $data['componentId'];
                 continue;
             }
             if (!is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) > 0 && is_callable(array('RSFormProValidations', $validationRule)) && call_user_func(array('RSFormProValidations', $validationRule), $post['form'][$data['NAME']], isset($data['VALIDATIONEXTRA']) ? $data['VALIDATIONEXTRA'] : '', $data) == false) {
                 $invalid[] = $data['componentId'];
                 continue;
             }
             if (is_array($post['form'][$data['NAME']])) {
                 $valid = implode('', $post['form'][$data['NAME']]);
                 if (empty($valid)) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
             }
         } else {
             if (isset($post['form'][$data['NAME']]) && !is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) > 0 && is_callable(array('RSFormProValidations', $validationRule)) && call_user_func(array('RSFormProValidations', $validationRule), $post['form'][$data['NAME']], isset($data['VALIDATIONEXTRA']) ? $data['VALIDATIONEXTRA'] : '', $data) == false) {
                 $invalid[] = $data['componentId'];
                 continue;
             }
         }
     }
     return $invalid;
 }
示例#14
0
 function validateForm($formId)
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_rsform' . DS . 'helpers' . DS . 'validation.php';
     $mainframe =& JFactory::getApplication();
     $db = JFactory::getDBO();
     $invalid = array();
     $formId = (int) $formId;
     $post = JRequest::get('post', JREQUEST_ALLOWRAW);
     $db->setQuery("SELECT ComponentId, ComponentTypeId FROM #__rsform_components WHERE FormId='" . $formId . "' AND Published=1 ORDER BY `Order`");
     if ($components = $db->loadObjectList()) {
         $componentIds = array();
         foreach ($components as $component) {
             $componentIds[] = $component->ComponentId;
         }
         $all_data = RSFormProHelper::getComponentProperties($componentIds);
         if (empty($all_data)) {
             return $invalid;
         }
         if ($conditions = RSFormProHelper::getConditions($formId)) {
             foreach ($conditions as $condition) {
                 if ($condition->details) {
                     $condition_vars = array();
                     foreach ($condition->details as $detail) {
                         $isChecked = RSFormProHelper::verifyChecked($detail->ComponentName, $detail->value, $post);
                         $condition_vars[] = $detail->operator == 'is' ? $isChecked : !$isChecked;
                     }
                     // this check is performed like this
                     // 'all' must be true (ie. no 0s in the array); 'any' can be true (ie. one value of 1 in the array will do)
                     $result = $condition->condition == 'all' ? !in_array(0, $condition_vars) : in_array(1, $condition_vars);
                     // if the item is hidden, no need to validate it
                     if ($condition->action == 'show' && !$result || $condition->action == 'hide' && $result) {
                         foreach ($components as $i => $component) {
                             if ($component->ComponentId == $condition->component_id) {
                                 // ... just remove it from the components array
                                 unset($components[$i]);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         foreach ($components as $component) {
             $data = $all_data[$component->ComponentId];
             $required = isset($data['REQUIRED']) ? $data['REQUIRED'] : 'NO';
             $validationRule = isset($data['VALIDATIONRULE']) ? $data['VALIDATIONRULE'] : '';
             $typeId = $component->ComponentTypeId;
             // CAPTCHA
             if ($typeId == 8) {
                 $session =& JFactory::getSession();
                 $captchaCode = $session->get('com_rsform.captcha.' . $component->ComponentId);
                 if ($data['IMAGETYPE'] == 'INVISIBLE') {
                     $words = RSFormProHelper::getInvisibleCaptchaWords();
                     if (!empty($post[$captchaCode])) {
                         $invalid[] = $data['componentId'];
                     }
                     foreach ($words as $word) {
                         if (!empty($post[$word])) {
                             $invalid[] = $data['componentId'];
                         }
                     }
                 } else {
                     if (empty($post['form'][$data['NAME']]) || empty($captchaCode) || $post['form'][$data['NAME']] != $captchaCode) {
                         $invalid[] = $data['componentId'];
                     }
                 }
             }
             // Trigger Event - rsfp_bk_validate_onSubmitValidateRecaptcha
             if ($typeId == 24) {
                 $mainframe->triggerEvent('rsfp_bk_validate_onSubmitValidateRecaptcha', array(array('data' => &$data, 'invalid' => &$invalid)));
             }
             if ($typeId == 9) {
                 $files = JRequest::getVar('form', null, 'files');
                 // File has been *sent* to the server
                 if (isset($files['tmp_name'][$data['NAME']]) && $files['error'][$data['NAME']] != 4) {
                     // File has been uploaded correctly to the server
                     if ($files['error'][$data['NAME']] == 0) {
                         // Let's check if the extension is allowed
                         $ext = strtolower(end(explode('.', $files['name'][$data['NAME']])));
                         $acceptedExts = !empty($data['ACCEPTEDFILES']) ? RSFormProHelper::explode($data['ACCEPTEDFILES']) : false;
                         // Let's check only if accepted extensions are set
                         if ($acceptedExts) {
                             $accepted = false;
                             foreach ($acceptedExts as $acceptedExt) {
                                 $acceptedExt = trim(strtolower($acceptedExt));
                                 if (strlen($acceptedExt) && $acceptedExt == $ext) {
                                     $accepted = true;
                                     break;
                                 }
                             }
                             if (!$accepted) {
                                 $invalid[] = $data['componentId'];
                             }
                         }
                         // Let's check if it's the correct size
                         if ($files['size'][$data['NAME']] > 0 && $data['FILESIZE'] > 0 && $files['size'][$data['NAME']] > $data['FILESIZE'] * 1024) {
                             $invalid[] = $data['componentId'];
                         }
                     } else {
                         $invalid[] = $data['componentId'];
                     }
                 } elseif ($required == 'YES') {
                     $invalid[] = $data['componentId'];
                 }
                 continue;
             }
             if ($required == 'YES') {
                 if (!isset($post['form'][$data['NAME']])) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
                 if (!is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) == 0) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
                 if (!is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) > 0 && is_callable(array('RSFormProValidations', $validationRule)) && call_user_func(array('RSFormProValidations', $validationRule), $post['form'][$data['NAME']], isset($data['VALIDATIONEXTRA']) ? $data['VALIDATIONEXTRA'] : '', $data) == false) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
                 if (is_array($post['form'][$data['NAME']])) {
                     $valid = implode('', $post['form'][$data['NAME']]);
                     if (empty($valid)) {
                         $invalid[] = $data['componentId'];
                         continue;
                     }
                 }
             } else {
                 if (isset($post['form'][$data['NAME']]) && !is_array($post['form'][$data['NAME']]) && strlen(trim($post['form'][$data['NAME']])) > 0 && is_callable(array('RSFormProValidations', $validationRule)) && call_user_func(array('RSFormProValidations', $validationRule), $post['form'][$data['NAME']], isset($data['VALIDATIONEXTRA']) ? $data['VALIDATIONEXTRA'] : '', $data) == false) {
                     $invalid[] = $data['componentId'];
                     continue;
                 }
             }
         }
     }
     return $invalid;
 }
示例#15
0
 public function rsfp_onAfterCreatePlaceholders($args)
 {
     $formId = $args['form']->FormId;
     $submissionId = $args['submission']->SubmissionId;
     $multipleSeparator = $args['form']->MultipleSeparator;
     if (RSFormProHelper::componentExists($formId, $this->newComponents)) {
         $singleProduct = RSFormProHelper::componentExists($formId, 21);
         $multipleProducts = RSFormProHelper::componentExists($formId, 22);
         $total = RSFormProHelper::componentExists($formId, 23);
         $donationProduct = RSFormProHelper::componentExists($formId, 28);
         $choosePayment = RSFormProHelper::componentExists($formId, 27);
         // choose payment
         if (!empty($choosePayment)) {
             $details = RSFormProHelper::getComponentProperties($choosePayment[0]);
             $items = $this->_getPayments($formId);
             $value = $this->_getSubmissionValue($submissionId, $choosePayment[0]);
             $text = '';
             if ($items) {
                 foreach ($items as $item) {
                     if ($item->value == $value) {
                         $text = $item->text;
                         break;
                     }
                 }
             }
             $args['placeholders'][] = '{' . $details['NAME'] . ':text}';
             $args['values'][] = $text;
         }
         // multiple products
         if (!empty($multipleProducts)) {
             foreach ($multipleProducts as $product) {
                 $pdetail = RSFormProHelper::getComponentProperties($product);
                 $detail = $this->_getSubmissionValue($submissionId, $product);
                 if ($detail == '') {
                     continue;
                 }
                 $detail = explode("\n", $detail);
                 $items = RSFormProHelper::explode(RSFormProHelper::isCode($pdetail['ITEMS']));
                 $replace = '{' . $pdetail['NAME'] . ':price}';
                 $with = array();
                 foreach ($items as $item) {
                     @(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
                     if (is_null($txt)) {
                         $txt = $val;
                     }
                     if (!$val) {
                         $val = 0;
                     }
                     if (in_array($txt, $detail)) {
                         $txt_price = $this->_getPriceMask($txt, $val);
                         $with[] = $txt_price;
                     }
                 }
                 $args['placeholders'][] = $replace;
                 $args['values'][] = implode($multipleSeparator, $with);
             }
         }
         // donation
         if (!empty($donationProduct)) {
             $price = $this->_getSubmissionValue($submissionId, $donationProduct[0]);
             $details = RSFormProHelper::getComponentProperties($donationProduct[0]);
             $args['placeholders'][] = '{' . $details['NAME'] . ':price}';
             $args['values'][] = $this->_getPriceMask($details['CAPTION'], $price);
         }
         // single product
         if (!empty($singleProduct)) {
             //Get Component properties
             $data = RSFormProHelper::getComponentProperties($this->_getComponentId('rsfp_Product', $formId));
             $price = $data['PRICE'];
             $args['placeholders'][] = '{rsfp_Product:price}';
             $args['values'][] = $this->_getPriceMask($data['CAPTION'], $price);
         }
         if (!empty($total)) {
             $price = $this->_getSubmissionValue($submissionId, $total[0]);
             $details = RSFormProHelper::getComponentProperties($total[0]);
             $args['placeholders'][] = '{' . $details['NAME'] . ':price}';
             $args['values'][] = $this->_getPriceMask($details['CAPTION'], $price);
         }
     }
 }