本文整理汇总了PHP中RSFormProHelper::getLegacyAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::getLegacyAdapter方法的具体用法?PHP RSFormProHelper::getLegacyAdapter怎么用?PHP RSFormProHelper::getLegacyAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::getLegacyAdapter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
public static function processForm($formId)
{
$mainframe = JFactory::getApplication();
$formId = (int) $formId;
$db = JFactory::getDBO();
$db->setQuery("SELECT `FormLayoutName`, `Keepdata`, `ConfirmSubmission`, `ScriptProcess`, `ScriptProcess2`, `UserEmailScript`, `AdminEmailScript`, `ReturnUrl`, `ShowThankyou`, `Thankyou`, `ShowContinue` FROM #__rsform_forms WHERE `FormId`='" . $formId . "'");
$form = $db->loadObject();
$lang = RSFormProHelper::getCurrentLanguage();
$translations = RSFormProHelper::getTranslations('forms', $formId, $lang);
if ($translations) {
foreach ($translations as $field => $value) {
if (isset($form->{$field})) {
$form->{$field} = $value;
}
}
}
$invalid = RSFormProHelper::validateForm($formId);
$post = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
//Trigger Event - onBeforeFormValidation
$mainframe->triggerEvent('rsfp_f_onBeforeFormValidation', array(array('invalid' => &$invalid, 'formId' => $formId, 'post' => &$post)));
$userEmail = array('to' => '', 'cc' => '', 'bcc' => '', 'from' => '', 'replyto' => '', 'fromName' => '', 'text' => '', 'subject' => '', 'files' => array());
$adminEmail = array('to' => '', 'cc' => '', 'bcc' => '', 'from' => '', 'replyto' => '', 'fromName' => '', 'text' => '', 'subject' => '', 'files' => array());
$_POST['form'] = $post;
$RSadapter = RSFormProHelper::getLegacyAdapter();
eval($form->ScriptProcess);
if (!empty($invalid)) {
return $invalid;
}
$post = $_POST['form'];
//Trigger Event - onBeforeFormProcess
$mainframe->triggerEvent('rsfp_f_onBeforeFormProcess', array(array('post' => &$post)));
if (empty($invalid)) {
// Cache enabled ?
jimport('joomla.plugin.helper');
$cache_enabled = JPluginHelper::isEnabled('system', 'cache');
if ($cache_enabled) {
RSFormProHelper::cleanCache();
}
$user = JFactory::getUser();
$confirmsubmission = $form->ConfirmSubmission ? 0 : 1;
// Add to db (submission)
$date = JFactory::getDate();
$db->setQuery("INSERT INTO #__rsform_submissions SET `FormId`='" . $formId . "', `DateSubmitted`='" . $date->toSql() . "', `UserIp`='" . (isset($_SERVER['REMOTE_ADDR']) ? $db->escape($_SERVER['REMOTE_ADDR']) : '') . "', `Username`='" . $db->escape($user->get('username')) . "', `UserId`='" . (int) $user->get('id') . "', `Lang`='" . RSFormProHelper::getCurrentLanguage() . "', `confirmed` = '" . $confirmsubmission . "' ");
$db->execute();
$SubmissionId = $db->insertid();
$files = JRequest::get('files');
if (isset($files['form']['tmp_name']) && is_array($files['form']['tmp_name'])) {
$names = array();
foreach ($files['form']['tmp_name'] as $fieldName => $val) {
if ($files['form']['error'][$fieldName]) {
continue;
}
$names[] = $db->escape($fieldName);
}
$componentIds = array();
if (!empty($names)) {
$db->setQuery("SELECT c.ComponentId, p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId AND p.PropertyName='NAME') WHERE c.FormId='" . $formId . "' AND p.PropertyValue IN ('" . implode("','", $names) . "')");
$results = $db->loadObjectList();
foreach ($results as $result) {
$componentIds[$result->PropertyValue] = $result->ComponentId;
}
}
$all_data = RSFormProHelper::getComponentProperties($componentIds);
jimport('joomla.filesystem.file');
foreach ($files['form']['tmp_name'] as $fieldName => $val) {
if ($files['form']['error'][$fieldName]) {
continue;
}
$data = @$all_data[$componentIds[$fieldName]];
if (empty($data)) {
continue;
}
// Prefix
$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['form']['name'][$fieldName];
// Upload File
JFile::upload($files['form']['tmp_name'][$fieldName], $file);
// Add to db (submission value)
$db->setQuery("INSERT INTO #__rsform_submission_values SET `SubmissionId`='" . $SubmissionId . "', `FormId`='" . $formId . "', `FieldName`='" . $db->escape($fieldName) . "', `FieldValue`='" . $db->escape($file) . "'");
$db->execute();
$emails = !empty($data['EMAILATTACH']) ? explode(',', $data['EMAILATTACH']) : array();
// Attach to user and admin email
if (in_array('useremail', $emails)) {
$userEmail['files'][] = $file;
}
if (in_array('adminemail', $emails)) {
$adminEmail['files'][] = $file;
}
}
}
// birthDay Field
//.........这里部分代码省略.........
示例2: defined
<?php
/**
* @version 1.4.0
* @package RSform!Pro 1.4.0
* @copyright (C) 2007-2011 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsform' . DS . 'helpers' . DS . 'rsform.php';
global $RSadapter;
$RSadapter = RSFormProHelper::getLegacyAdapter();
$GLOBALS['RSadapter'] = $RSadapter;
示例3: processForm
function processForm($formId)
{
$mainframe =& JFactory::getApplication();
$formId = (int) $formId;
$db = JFactory::getDBO();
$db->setQuery("SELECT `Keepdata`, `ConfirmSubmission`, `ScriptProcess`, `ScriptProcess2`, `UserEmailScript`, `AdminEmailScript`, `ReturnUrl`, `ShowThankyou`, `Thankyou`, `ShowContinue` FROM #__rsform_forms WHERE `FormId`='" . $formId . "'");
$form = $db->loadObject();
$lang = RSFormProHelper::getCurrentLanguage();
$translations = RSFormProHelper::getTranslations('forms', $formId, $lang);
if ($translations) {
foreach ($translations as $field => $value) {
if (isset($form->{$field})) {
$form->{$field} = $value;
}
}
}
$invalid = RSFormProHelper::validateForm($formId);
//Trigger Event - onBeforeFormValidation
$mainframe->triggerEvent('rsfp_f_onBeforeFormValidation', array(array('invalid' => &$invalid)));
$userEmail = array('to' => '', 'cc' => '', 'bcc' => '', 'from' => '', 'replyto' => '', 'fromName' => '', 'text' => '', 'subject' => '', 'files' => array());
$adminEmail = array('to' => '', 'cc' => '', 'bcc' => '', 'from' => '', 'replyto' => '', 'fromName' => '', 'text' => '', 'subject' => '', 'files' => array());
$post = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
$_POST['form'] = $post;
$RSadapter = RSFormProHelper::getLegacyAdapter();
eval($form->ScriptProcess);
if (!empty($invalid)) {
return $invalid;
}
$post = $_POST['form'];
//Trigger Event - onBeforeFormProcess
$mainframe->triggerEvent('rsfp_f_onBeforeFormProcess');
if (empty($invalid)) {
// Cache enabled ?
jimport('joomla.plugin.helper');
$cache_enabled = JPluginHelper::isEnabled('system', 'cache');
if ($cache_enabled) {
RSFormProHelper::cleanCache();
}
$user = JFactory::getUser();
$confirmsubmission = $form->ConfirmSubmission ? 0 : 1;
// Add to db (submission)
$db->setQuery("INSERT INTO #__rsform_submissions SET `FormId`='" . $formId . "', `DateSubmitted`=NOW(), `UserIp`='" . (isset($_SERVER['REMOTE_ADDR']) ? $db->getEscaped($_SERVER['REMOTE_ADDR']) : '') . "', `Username`='" . $db->getEscaped($user->get('username')) . "', `UserId`='" . (int) $user->get('id') . "', `Lang`='" . RSFormProHelper::getCurrentLanguage() . "', `confirmed` = '" . $confirmsubmission . "' ");
$db->query();
$SubmissionId = $db->insertid();
$files = JRequest::get('files');
if (isset($files['form']['tmp_name']) && is_array($files['form']['tmp_name'])) {
$names = array();
foreach ($files['form']['tmp_name'] as $fieldName => $val) {
if ($files['form']['error'][$fieldName]) {
continue;
}
$names[] = $db->getEscaped($fieldName);
}
$componentIds = array();
if (!empty($names)) {
$db->setQuery("SELECT c.ComponentId, p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId AND p.PropertyName='NAME') WHERE c.FormId='" . $formId . "' AND p.PropertyValue IN ('" . implode("','", $names) . "')");
$results = $db->loadObjectList();
foreach ($results as $result) {
$componentIds[$result->PropertyValue] = $result->ComponentId;
}
}
$all_data = RSFormProHelper::getComponentProperties($componentIds);
jimport('joomla.filesystem.file');
foreach ($files['form']['tmp_name'] as $fieldName => $val) {
if ($files['form']['error'][$fieldName]) {
continue;
}
$data = @$all_data[$componentIds[$fieldName]];
if (empty($data)) {
continue;
}
// Prefix
$prefix = uniqid('') . '-';
if (isset($data['PREFIX']) && strlen(trim($data['PREFIX'])) > 0) {
$prefix = RSFormProHelper::isCode($data['PREFIX']);
}
// Path
$realpath = realpath($data['DESTINATION'] . DS);
if (substr($realpath, -1) != DS) {
$realpath .= DS;
}
// Filename
$file = $realpath . $prefix . $files['form']['name'][$fieldName];
// Upload File
JFile::upload($files['form']['tmp_name'][$fieldName], $file);
// Add to db (submission value)
$db->setQuery("INSERT INTO #__rsform_submission_values SET `SubmissionId`='" . $SubmissionId . "', `FormId`='" . $formId . "', `FieldName`='" . $db->getEscaped($fieldName) . "', `FieldValue`='" . $db->getEscaped($file) . "'");
$db->query();
$emails = !empty($data['EMAILATTACH']) ? explode(',', $data['EMAILATTACH']) : array();
// Attach to user and admin email
if (in_array('useremail', $emails)) {
$userEmail['files'][] = $file;
}
if (in_array('adminemail', $emails)) {
$adminEmail['files'][] = $file;
}
}
}
//Trigger Event - onBeforeStoreSubmissions
$mainframe->triggerEvent('rsfp_f_onBeforeStoreSubmissions', array(array('formId' => $formId, 'post' => &$post, 'SubmissionId' => $SubmissionId)));
//.........这里部分代码省略.........