本文整理汇总了PHP中RSFormProHelper::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::getConfig方法的具体用法?PHP RSFormProHelper::getConfig怎么用?PHP RSFormProHelper::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::getConfig方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RSAdapter
function RSAdapter()
{
// Get Joomla! Configuration
$this->jconfig = JFactory::getConfig();
// Define tables
$prefix = $this->jconfig->getValue('config.dbprefix');
$this->tbl_rsform_config = $prefix . 'rsform_config';
$this->tbl_rsform_components = $prefix . 'rsform_components';
$this->tbl_rsform_component_types = $prefix . 'rsform_component_types';
$this->tbl_rsform_component_type_fields = $prefix . 'rsform_component_type_fields';
$this->tbl_rsform_forms = $prefix . 'rsform_forms';
$this->tbl_rsform_mappings = $prefix . 'rsform_mappings';
$this->tbl_rsform_properties = $prefix . 'rsform_properties';
$this->tbl_rsform_submissions = $prefix . 'rsform_submissions';
$this->tbl_rsform_submission_values = $prefix . 'rsform_submission_values';
$this->tbl_users = $prefix . 'users';
// Build old config
$this->config = array();
RSFormProHelper::readConfig();
$config = RSFormProHelper::getConfig(null);
foreach ($config as $item => $value) {
$this->config[$item] = $value;
}
$this->config['list_limit'] = $this->jconfig->getValue('config.list_limit');
$this->config['absolute_path'] = JPATH_SITE;
$this->config['live_site'] = JURI::root();
$this->config['mail_from'] = $this->jconfig->getValue('config.mailfrom');
$this->config['sitename'] = $this->jconfig->getValue('config.sitename');
$this->config['dbprefix'] = $prefix;
$this->config['db'] = $this->jconfig->getValue('config.db');
$this->config['component_ids'] = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
$this->config['absolute_path'] = JPATH_SITE;
}
示例2: expression
public static function expression($calculation, $formId)
{
$return = '';
$pattern = '#{(.*?):value}#is';
$expression = $calculation->expression;
$filter = JFilterInput::getInstance();
preg_match_all($pattern, $calculation->expression, $matches);
if ($matches) {
foreach ($matches[0] as $i => $match) {
$field = $filter->clean($matches[1][$i] . "_" . $formId, 'cmd');
$return .= "\t total" . $field . " = 0;\n";
$return .= "\t values" . $field . " = rsfp_getValue(" . $formId . ", '" . $matches[1][$i] . "');\n";
$return .= "\t if (typeof values" . $field . " == 'object') { \n";
$return .= "\t\t for(i=0;i<values" . $field . ".length;i++) {\n";
$return .= "\t\t\t thevalue = values" . $field . "[i]; \n";
$return .= "\t\t\t if (isset(RSFormProPrices['" . $formId . "_" . $matches[1][$i] . "'])) { \n";
$return .= "\t\t\t\t total" . $field . " += isset(RSFormProPrices['" . $formId . "_" . $matches[1][$i] . "'][thevalue]) ? parseFloat(RSFormProPrices['" . $formId . "_" . $matches[1][$i] . "'][thevalue]) : 0; \n";
$return .= "\t\t\t }\n";
$return .= "\t\t }\n";
$return .= "\t } else { \n";
$return .= "\t\t total" . $field . " += (values" . $field . ".indexOf(',') == -1 && values" . $field . ".indexOf('.') == -1) ? parseFloat(values" . $field . ") : parseFloat(rsfp_toNumber(values" . $field . ",'" . self::escape(RSFormProHelper::getConfig('calculations.decimal')) . "','" . self::escape(RSFormProHelper::getConfig('calculations.thousands')) . "')); \n";
$return .= "\t } \n";
$return .= "\t total" . $field . " = !isNaN(total" . $field . ") ? total" . $field . " : 0; \n\n";
$expression = str_replace($match, 'total' . $field, $expression);
}
$return .= "\n\t grandTotal" . $calculation->id . $formId . " = " . $expression . ";\n";
$return .= "\t document.getElementById('" . $calculation->total . "').value = number_format(grandTotal" . $calculation->id . $formId . "," . (int) RSFormProHelper::getConfig('calculations.nodecimals') . ",'" . self::escape(RSFormProHelper::getConfig('calculations.decimal')) . "','" . self::escape(RSFormProHelper::getConfig('calculations.thousands')) . "'); \n\n";
}
return $return;
}
示例3: display
function display($tpl = null)
{
JToolBarHelper::title('RSForm! Pro', 'rsform');
if (RSFormProHelper::isJ16()) {
$lang =& JFactory::getLanguage();
$lang->load('com_rsform.sys', JPATH_ADMINISTRATOR);
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_MANAGE_FORMS'), 'index.php?option=com_rsform&task=forms.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_MANAGE_SUBMISSIONS'), 'index.php?option=com_rsform&task=submissions.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_CONFIGURATION'), 'index.php?option=com_rsform&task=configuration.edit', true);
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_BACKUP_RESTORE'), 'index.php?option=com_rsform&task=backup.restore');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_UPDATES'), 'index.php?option=com_rsform&task=updates.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_PLUGINS'), 'index.php?option=com_rsform&task=goto.plugins');
}
JToolBarHelper::apply('configuration.apply');
JToolBarHelper::save('configuration.save');
JToolBarHelper::cancel('');
$params = array('startOffset' => JRequest::getInt('tabposition', 0));
$tabs =& JPane::getInstance('Tabs', $params, true);
$this->assignRef('tabs', $tabs);
$this->assign('code', RSFormProHelper::getConfig('global.register.code'));
$lists['global.iis'] = JHTML::_('select.booleanlist', 'rsformConfig[global.iis]', 'class="inputbox"', RSFormProHelper::getConfig('global.iis'));
$lists['global.editor'] = JHTML::_('select.booleanlist', 'rsformConfig[global.editor]', 'class="inputbox"', RSFormProHelper::getConfig('global.editor'));
$lists['global.codemirror'] = JHTML::_('select.booleanlist', 'rsformConfig[global.codemirror]', 'class="inputbox"', RSFormProHelper::getConfig('global.codemirror'));
$lists['auto_responsive'] = JHTML::_('select.booleanlist', 'rsformConfig[auto_responsive]', 'class="inputbox"', RSFormProHelper::getConfig('auto_responsive'));
$this->assignRef('lists', $lists);
parent::display($tpl);
}
示例4: display
function display($tpl = null)
{
JToolBarHelper::title('RSForm! Pro', 'rsform');
if (RSFormProHelper::isJ16()) {
$lang =& JFactory::getLanguage();
$lang->load('com_rsform.sys', JPATH_ADMINISTRATOR);
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_MANAGE_FORMS'), 'index.php?option=com_rsform&task=forms.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_MANAGE_SUBMISSIONS'), 'index.php?option=com_rsform&task=submissions.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_CONFIGURATION'), 'index.php?option=com_rsform&task=configuration.edit');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_BACKUP_RESTORE'), 'index.php?option=com_rsform&task=backup.restore');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_UPDATES'), 'index.php?option=com_rsform&task=updates.manage');
JSubMenuHelper::addEntry(JText::_('COM_RSFORM_PLUGINS'), 'index.php?option=com_rsform&task=goto.plugins');
}
$this->assign('code', RSFormProHelper::getConfig('global.register.code'));
parent::display($tpl);
}
示例5: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$document->addCustomTag('<!--[if IE 7]><link href="' . JURI::root() . 'administrator/components/com_rsform/assets/css/styleie.css" rel="stylesheet" type="text/css" /><![endif]-->');
if (RSFormProHelper::getConfig('global.codemirror')) {
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/lib/codemirror.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/css/css.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/htmlmixed/htmlmixed.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/javascript/javascript.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/php/php.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/clike/clike.js');
$document->addScript(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/mode/xml/xml.js');
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/lib/codemirror.css');
$document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsform/assets/codemirror/theme/default.css');
}
JToolBarHelper::title('RSForm! Pro', 'rsform');
// adding the toolbar on 2.5
if (!RSFormProHelper::isJ('3.0')) {
$this->addToolbar();
}
$layout = $this->getLayout();
$this->isComponent = JRequest::getVar('tmpl') == 'component';
if ($layout == 'edit') {
$submissionsIcon = RSFormProHelper::isJ('3.0') ? 'database' : 'forward';
$previewIcon = RSFormProHelper::isJ('3.0') ? 'new tab' : 'preview';
JToolBarHelper::apply('forms.apply');
JToolBarHelper::save('forms.save');
JToolBarHelper::spacer();
JToolBarHelper::custom('forms.preview', $previewIcon, $previewIcon, JText::_('JGLOBAL_PREVIEW'), false);
JToolBarHelper::custom('submissions.back', $submissionsIcon, $submissionsIcon, JText::_('RSFP_SUBMISSIONS'), false);
JToolBarHelper::custom('components.copy', 'copy', 'copy', JText::_('RSFP_COPY_TO_FORM'), false);
JToolBarHelper::custom('components.duplicate', 'copy', 'copy', JText::_('RSFP_DUPLICATE'), false);
JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS'), 'components.remove', RSFormProHelper::isJ16() ? JText::_('JTOOLBAR_DELETE') : JText::_('DELETE'));
JToolBarHelper::publishList('components.publish', RSFormProHelper::isJ16() ? JText::_('JTOOLBAR_PUBLISH') : JText::_('Publish'));
JToolBarHelper::unpublishList('components.unpublish', RSFormProHelper::isJ16() ? JText::_('JTOOLBAR_UNPUBLISH') : JText::_('Unpublish'));
JToolBarHelper::spacer();
JToolBarHelper::cancel('forms.cancel');
$this->tabposition = JRequest::getInt('tabposition', 0);
$this->tab = JRequest::getInt('tab', 0);
$this->form = $this->get('form');
$this->form_post = $this->get('formPost');
$this->hasSubmitButton = $this->get('hasSubmitButton');
JToolBarHelper::title('RSForm! Pro <small>[' . JText::sprintf('RSFP_EDITING_FORM', $this->form->FormTitle) . ']</small>', 'rsform');
$this->fields = $this->get('fields');
$this->quickfields = $this->get('quickfields');
$this->pagination = $this->get('fieldspagination');
$lists['Published'] = $this->renderHTML('select.booleanlist', 'Published', '', $this->form->Published);
$lists['ShowFormTitle'] = $this->renderHTML('select.booleanlist', 'ShowFormTitle', '', $this->form->ShowFormTitle);
$lists['keepdata'] = $this->renderHTML('select.booleanlist', 'Keepdata', '', $this->form->Keepdata);
$lists['confirmsubmission'] = $this->renderHTML('select.booleanlist', 'ConfirmSubmission', '', $this->form->ConfirmSubmission);
$lists['ShowThankyou'] = $this->renderHTML('select.booleanlist', 'ShowThankyou', 'onclick="enableThankyou(this.value);"', $this->form->ShowThankyou);
$lists['ShowContinue'] = $this->renderHTML('select.booleanlist', 'ShowContinue', !$this->form->ShowThankyou ? 'disabled="true"' : '', $this->form->ShowContinue);
$lists['UserEmailMode'] = $this->renderHTML('select.booleanlist', 'UserEmailMode', 'onclick="enableEmailMode(\'User\', this.value)"', $this->form->UserEmailMode, JText::_('HTML'), JText::_('RSFP_COMP_FIELD_TEXT'));
$lists['UserEmailAttach'] = $this->renderHTML('select.booleanlist', 'UserEmailAttach', 'onclick="enableAttachFile(this.value)"', $this->form->UserEmailAttach);
$lists['AdminEmailMode'] = $this->renderHTML('select.booleanlist', 'AdminEmailMode', 'onclick="enableEmailMode(\'Admin\', this.value)"', $this->form->AdminEmailMode, JText::_('HTML'), JText::_('RSFP_COMP_FIELD_TEXT'));
$lists['MetaTitle'] = $this->renderHTML('select.booleanlist', 'MetaTitle', '', $this->form->MetaTitle);
$lists['TextareaNewLines'] = $this->renderHTML('select.booleanlist', 'TextareaNewLines', '', $this->form->TextareaNewLines);
$lists['AjaxValidation'] = $this->renderHTML('select.booleanlist', 'AjaxValidation', '', $this->form->AjaxValidation);
$lists['FormLayoutAutogenerate'] = $this->renderHTML('select.booleanlist', 'FormLayoutAutogenerate', 'onclick="changeFormAutoGenerateLayout(' . $this->form->FormId . ', this.value);"', $this->form->FormLayoutAutogenerate);
$lists['post_enabled'] = $this->renderHTML('select.booleanlist', 'form_post[enabled]', '', $this->form_post->enabled);
$lists['post_method'] = $this->renderHTML('select.booleanlist', 'form_post[method]', '', $this->form_post->method, JText::_('RSFP_POST_METHOD_POST'), JText::_('RSFP_POST_METHOD_GET'));
$lists['post_silent'] = $this->renderHTML('select.booleanlist', 'form_post[silent]', '', $this->form_post->silent);
$this->themes = $this->get('themes');
$this->lang = $this->get('lang');
// workaround for first time visit
$session = JFactory::getSession();
$session->set('com_rsform.form.' . $this->form->FormId . '.lang', $this->lang);
$lists['Languages'] = JHTML::_('select.genericlist', $this->get('languages'), 'Language', 'onchange="submitbutton(\'changeLanguage\')"', 'value', 'text', $this->lang);
$this->mappings = $this->get('mappings');
$this->mpagination = $this->get('mpagination');
$this->conditions = $this->get('conditions');
$this->formId = $this->form->FormId;
$this->emails = $this->get('emails');
$this->lists = $lists;
} elseif ($layout == 'new') {
$nextIcon = RSFormProHelper::isJ('3.0') ? 'next' : 'forward';
JToolBarHelper::custom('forms.new.steptwo', $nextIcon, $nextIcon, JText::_('JNEXT'), false);
JToolBarHelper::cancel('forms.cancel');
} elseif ($layout == 'new2') {
$nextIcon = RSFormProHelper::isJ('3.0') ? 'next' : 'forward';
JToolBarHelper::custom('forms.new.stepthree', $nextIcon, $nextIcon, JText::_('JNEXT'), false);
JToolBarHelper::cancel('forms.cancel');
$lists['AdminEmail'] = $this->renderHTML('select.booleanlist', 'AdminEmail', 'onclick="changeAdminEmail(this.value)"', 1);
$lists['UserEmail'] = $this->renderHTML('select.booleanlist', 'UserEmail', '', 1);
$actions = array(JHTML::_('select.option', 'refresh', JText::_('RSFP_SUBMISSION_REFRESH_PAGE')), JHTML::_('select.option', 'thankyou', JText::_('RSFP_SUBMISSION_THANKYOU')), JHTML::_('select.option', 'redirect', JText::_('RSFP_SUBMISSION_REDIRECT_TO')));
$lists['SubmissionAction'] = JHTML::_('select.genericlist', $actions, 'SubmissionAction', 'onclick="changeSubmissionAction(this.value)"');
$this->adminEmail = $this->get('adminEmail');
$this->lists = $lists;
$this->editor = JFactory::getEditor();
} elseif ($layout == 'new3') {
$nextIcon = RSFormProHelper::isJ('3.0') ? 'next' : 'forward';
JToolBarHelper::custom('forms.new.stepfinal', $nextIcon, $nextIcon, JText::_('Finish'), false);
JToolBarHelper::cancel('forms.cancel');
$lists['predefinedForms'] = JHTML::_('select.genericlist', $this->get('predefinedforms'), 'predefinedForm', '');
$this->lists = $lists;
} elseif ($layout == 'component_copy') {
JToolBarHelper::custom('components.copy.process', 'copy', 'copy', 'Copy', false);
JToolBarHelper::cancel('components.copy.cancel');
$formlist = $this->get('formlist');
//.........这里部分代码省略.........
示例6: getComponentPrice
public static function getComponentPrice($property, $submission)
{
$price = 0;
$pattern = '#\\[p(.*?)\\]#is';
if (isset($property['ITEMS'])) {
$products = array();
$special = array('[c]', '[g]', '[d]');
if ($items = RSFormProHelper::explode(RSFormProHelper::isCode($property['ITEMS']))) {
foreach ($items as $item) {
$item = str_replace($special, '', $item);
@(list($item_val, $item_text) = explode("|", $item, 2));
if (preg_match($pattern, $item, $match)) {
$item_val = preg_replace($pattern, '', $item_val);
$products[$item_val] = $match[1];
}
}
}
if (isset($submission->values[$property['NAME']])) {
$value = $submission->values[$property['NAME']];
$all_values = explode("\n", $value);
foreach ($all_values as $val) {
$price += isset($products[$val]) ? (double) $products[$val] : 0;
}
}
}
return number_format($price, RSFormProHelper::getConfig('calculations.nodecimals'), RSFormProHelper::getConfig('calculations.decimal'), RSFormProHelper::getConfig('calculations.thousands'));
}
示例7: paypalConfigurationScreen
public function paypalConfigurationScreen()
{
ob_start();
?>
<div id="page-paypal" class="com-rsform-css-fix">
<table class="admintable">
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="currency"><?php
echo JText::_('RSFP_PAYPAL_EMAIL');
?>
</label></td>
<td><input type="text" name="rsformConfig[paypal.email]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.email'));
?>
" size="100" maxlength="64"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="return"><?php
echo JText::_('RSFP_PAYPAL_RETURN');
?>
</label></td>
<td><input type="text" name="rsformConfig[paypal.return]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.return'));
?>
" size="100"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="cancel"><?php
echo JText::_('RSFP_PAYPAL_CANCEL');
?>
</label></td>
<td><input type="text" name="rsformConfig[paypal.cancel]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.cancel'));
?>
" size="100"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="currency"><?php
echo JText::_('RSFP_PAYPAL_TEST');
?>
</label></td>
<td><?php
echo JHTML::_('select.booleanlist', 'rsformConfig[paypal.test]', '', RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.test')));
?>
</td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="tax.type"><?php
echo JText::_('RSFP_PAYPAL_TAX_TYPE');
?>
</label></td>
<td><?php
echo JHTML::_('select.booleanlist', 'rsformConfig[paypal.tax.type]', '', RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.tax.type')), JText::_('RSFP_PAYPAL_TAX_TYPE_FIXED'), JText::_('RSFP_PAYPAL_TAX_TYPE_PERCENT'));
?>
</td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="tax.value"><?php
echo JText::_('RSFP_PAYPAL_TAX_VALUE');
?>
</label></td>
<td><input type="text" name="rsformConfig[paypal.tax.value]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.tax.value'));
?>
" size="4" maxlength="5"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="language"><?php
echo JText::_('RSFP_PAYPAL_LANGUAGE');
?>
</label></td>
<td>
<input type="text" name="rsformConfig[paypal.language]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('paypal.language'));
?>
" size="4" maxlength="2">
<?php
echo JText::_('PAYPAL_LANGUAGES_CODES');
?>
</td>
</tr>
</table>
</div>
<?php
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例8: recaptchaConfigurationScreen
function recaptchaConfigurationScreen()
{
ob_start();
$themes[] = JHTML::_('select.option', 'red', JText::_('RSFP_RED_THEME'));
$themes[] = JHTML::_('select.option', 'white', JText::_('RSFP_WHITE_THEME'));
$themes[] = JHTML::_('select.option', 'clean', JText::_('RSFP_CLEAN_THEME'));
$themes[] = JHTML::_('select.option', 'blackglass', JText::_('RSFP_BLACKGLASS_THEME'));
$theme = JHTML::_('select.genericlist', $themes, 'rsformConfig[recaptcha.theme]', 'size="1" class="inputbox"', 'value', 'text', RSFormProHelper::getConfig('recaptcha.theme'));
?>
<div id="page-recaptcha">
<table class="admintable">
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="public"><?php
echo JText::_('RSFP_RECAPTCHA_PBKEY');
?>
</label></td>
<td><input type="text" name="rsformConfig[recaptcha.public.key]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('recaptcha.public.key'));
?>
" size="100" maxlength="100"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="private"><?php
echo JText::_('RSFP_RECAPTCHA_PRKEY');
?>
</label></td>
<td><input type="text" name="rsformConfig[recaptcha.private.key]" value="<?php
echo RSFormProHelper::htmlEscape(RSFormProHelper::getConfig('recaptcha.private.key'));
?>
" size="100" maxlength="100"></td>
</tr>
<tr>
<td width="200" style="width: 200px;" align="right" class="key"><label for="theme"><?php
echo JText::_('RSFP_RECAPTCHA_THEME');
?>
</label></td>
<td><?php
echo $theme;
?>
</td>
</tr>
</table>
</div>
<?php
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例9: stripJava
public static function stripJava($val)
{
$filtering = RSFormProHelper::getConfig('global.filtering');
switch ($filtering) {
default:
case 'joomla':
static $filter;
if (is_null($filter)) {
jimport('joomla.filter.filterinput');
$filter = JFilterInput::getInstance(array('form', 'input', 'select', 'textarea'), array('style'), 1, 1);
}
$val = preg_replace('/([\\x00-\\x08][\\x0b-\\x0c][\\x0e-\\x20])/', "", $val);
$val = str_replace("", "", $val);
return $filter->clean($val);
break;
case 'rsform':
// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed
// this prevents some character re-spacing such as <java\0script>
// note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs
$val = preg_replace('/([\\x00-\\x08][\\x0b-\\x0c][\\x0e-\\x20])/', '', $val);
// straight replacements, the user should never need these since they're normal characters
// this prevents like <IMG SRC=@avascript:alert('XSS')>
$search = 'abcdefghijklmnopqrstuvwxyz';
$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$search .= '1234567890!@#$%^&*()';
$search .= '~`";:?+/={}[]-_|\'\\';
for ($i = 0; $i < strlen($search); $i++) {
// ;? matches the ;, which is optional
// 0{0,7} matches any padded zeros, which are optional and go up to 8 chars
// @ @ search for the hex values
$val = preg_replace('/(&#[x|X]0{0,8}' . dechex(ord($search[$i])) . ';?)/i', $search[$i], $val);
// with a ;
// @ @ 0{0,7} matches '0' zero to seven times
$val = preg_replace('/(�{0,8}' . ord($search[$i]) . ';?)/', $search[$i], $val);
// with a ;
}
// now the only remaining whitespace attacks are \t, \n, and \r
// ([ \t\r\n]+)?
$ra1 = array('\\/([ \\t\\r\\n]+)?javascript', '\\/([ \\t\\r\\n]+)?vbscript', ':([ \\t\\r\\n]+)?expression', '<([ \\t\\r\\n]+)?applet', '<([ \\t\\r\\n]+)?meta', '<([ \\t\\r\\n]+)?xml', '<([ \\t\\r\\n]+)?blink', '<([ \\t\\r\\n]+)?link', '<([ \\t\\r\\n]+)?style', '<([ \\t\\r\\n]+)?script', '<([ \\t\\r\\n]+)?embed', '<([ \\t\\r\\n]+)?object', '<([ \\t\\r\\n]+)?iframe', '<([ \\t\\r\\n]+)?frame', '<([ \\t\\r\\n]+)?frameset', '<([ \\t\\r\\n]+)?ilayer', '<([ \\t\\r\\n]+)?layer', '<([ \\t\\r\\n]+)?bgsound', '<([ \\t\\r\\n]+)?title', '<([ \\t\\r\\n]+)?base');
$ra2 = array('onabort([ \\t\\r\\n]+)?=', 'onactivate([ \\t\\r\\n]+)?=', 'onafterprint([ \\t\\r\\n]+)?=', 'onafterupdate([ \\t\\r\\n]+)?=', 'onbeforeactivate([ \\t\\r\\n]+)?=', 'onbeforecopy([ \\t\\r\\n]+)?=', 'onbeforecut([ \\t\\r\\n]+)?=', 'onbeforedeactivate([ \\t\\r\\n]+)?=', 'onbeforeeditfocus([ \\t\\r\\n]+)?=', 'onbeforepaste([ \\t\\r\\n]+)?=', 'onbeforeprint([ \\t\\r\\n]+)?=', 'onbeforeunload([ \\t\\r\\n]+)?=', 'onbeforeupdate([ \\t\\r\\n]+)?=', 'onblur([ \\t\\r\\n]+)?=', 'onbounce([ \\t\\r\\n]+)?=', 'oncellchange([ \\t\\r\\n]+)?=', 'onchange([ \\t\\r\\n]+)?=', 'onclick([ \\t\\r\\n]+)?=', 'oncontextmenu([ \\t\\r\\n]+)?=', 'oncontrolselect([ \\t\\r\\n]+)?=', 'oncopy([ \\t\\r\\n]+)?=', 'oncut([ \\t\\r\\n]+)?=', 'ondataavailable([ \\t\\r\\n]+)?=', 'ondatasetchanged([ \\t\\r\\n]+)?=', 'ondatasetcomplete([ \\t\\r\\n]+)?=', 'ondblclick([ \\t\\r\\n]+)?=', 'ondeactivate([ \\t\\r\\n]+)?=', 'ondrag([ \\t\\r\\n]+)?=', 'ondragend([ \\t\\r\\n]+)?=', 'ondragenter([ \\t\\r\\n]+)?=', 'ondragleave([ \\t\\r\\n]+)?=', 'ondragover([ \\t\\r\\n]+)?=', 'ondragstart([ \\t\\r\\n]+)?=', 'ondrop([ \\t\\r\\n]+)?=', 'onerror([ \\t\\r\\n]+)?=', 'onerrorupdate([ \\t\\r\\n]+)?=', 'onfilterchange([ \\t\\r\\n]+)?=', 'onfinish([ \\t\\r\\n]+)?=', 'onfocus([ \\t\\r\\n]+)?=', 'onfocusin([ \\t\\r\\n]+)?=', 'onfocusout([ \\t\\r\\n]+)?=', 'onhelp([ \\t\\r\\n]+)?=', 'onkeydown([ \\t\\r\\n]+)?=', 'onkeypress([ \\t\\r\\n]+)?=', 'onkeyup([ \\t\\r\\n]+)?=', 'onlayoutcomplete([ \\t\\r\\n]+)?=', 'onload([ \\t\\r\\n]+)?=', 'onlosecapture([ \\t\\r\\n]+)?=', 'onmousedown([ \\t\\r\\n]+)?=', 'onmouseenter([ \\t\\r\\n]+)?=', 'onmouseleave([ \\t\\r\\n]+)?=', 'onmousemove([ \\t\\r\\n]+)?=', 'onmouseout([ \\t\\r\\n]+)?=', 'onmouseover([ \\t\\r\\n]+)?=', 'onmouseup([ \\t\\r\\n]+)?=', 'onmousewheel([ \\t\\r\\n]+)?=', 'onmove([ \\t\\r\\n]+)?=', 'onmoveend([ \\t\\r\\n]+)?=', 'onmovestart([ \\t\\r\\n]+)?=', 'onpaste([ \\t\\r\\n]+)?=', 'onpropertychange([ \\t\\r\\n]+)?=', 'onreadystatechange([ \\t\\r\\n]+)?=', 'onreset([ \\t\\r\\n]+)?=', 'onresize([ \\t\\r\\n]+)?=', 'onresizeend([ \\t\\r\\n]+)?=', 'onresizestart([ \\t\\r\\n]+)?=', 'onrowenter([ \\t\\r\\n]+)?=', 'onrowexit([ \\t\\r\\n]+)?=', 'onrowsdelete([ \\t\\r\\n]+)?=', 'onrowsinserted([ \\t\\r\\n]+)?=', 'onscroll([ \\t\\r\\n]+)?=', 'onselect([ \\t\\r\\n]+)?=', 'onselectionchange([ \\t\\r\\n]+)?=', 'onselectstart([ \\t\\r\\n]+)?=', 'onstart([ \\t\\r\\n]+)?=', 'onstop([ \\t\\r\\n]+)?=', 'onsubmit([ \\t\\r\\n]+)?=', 'onunload([ \\t\\r\\n]+)?=', 'style([ \\t\\r\\n]+)?=');
$ra = array_merge($ra1, $ra2);
foreach ($ra as $tag) {
$pattern = '#' . $tag . '#i';
preg_match_all($pattern, $val, $matches);
foreach ($matches[0] as $match) {
$val = str_replace($match, substr($match, 0, 2) . '<x>' . substr($match, 2), $val);
}
}
return $val;
break;
case 'none':
return $val;
break;
}
}
示例10: rsfp_f_onBeforeFormValidation
function rsfp_f_onBeforeFormValidation($args)
{
$formId = $args['formId'];
$invalid =& $args['invalid'];
$post =& $args['post'];
$secretKey = RSFormProHelper::getConfig('recaptchav2.secret.key');
// validation:
// if there's no session token
// validate based on challenge & response codes
// if valid, set the session token
// session token gets cleared after form processes
// session token gets cleared on page refresh as well
if (($componentId = RSFormProHelper::componentExists($formId, 2424)) && $secretKey) {
$input = JFactory::getApplication()->input;
$response = $input->get('g-recaptcha-response', '', 'raw');
$ip = $input->server->get('REMOTE_ADDR');
$task = strtolower($input->get('task'));
$option = strtolower($input->get('option'));
$session = JFactory::getSession();
// already validated, move on
if ($session->get('com_rsform.recaptchav2Token' . $formId)) {
return true;
}
try {
jimport('joomla.http.factory');
$http = JHttpFactory::getHttp();
if ($request = $http->get('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($response) . '&remoteip=' . urlencode($ip))) {
$json = json_decode($request->body);
}
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
$invalid[] = $componentId[0];
return false;
}
if (empty($json->success) || !$json->success) {
$invalid[] = $componentId[0];
if (!empty($json) && isset($json->{'error-codes'}) && is_array($json->{'error-codes'})) {
foreach ($json->{'error-codes'} as $code) {
JFactory::getApplication()->enqueueMessage(JText::_('RSFP_RECAPTCHAV2_' . str_replace('-', '_', $code)), 'error');
}
}
} elseif ($option == 'com_rsform' && $task == 'ajaxvalidate') {
$session->set('com_rsform.recaptchav2Token' . $formId, md5(uniqid($response)));
}
}
}
示例11: getURL
function getURL()
{
// IIS hack
if (RSFormProHelper::getConfig('global.iis') && !empty($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') !== false && !empty($_SERVER['QUERY_STRING'])) {
$u = JRoute::_('index.php?' . $_SERVER['QUERY_STRING'], false);
} else {
$u = JFactory::getURI();
if (RSFormProHelper::isJ16()) {
// 1.6
$u = JFactory::getURI($u->get('_uri'));
$u = $u->toString($parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'));
} else {
// 1.5
$u = $u->toString();
// Joom!Fish workarounds...
if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'joomfish.php')) {
$u = JFactory::getURI();
$u = $u->_uri;
}
// sh404SEF workarounds... as usual...
if (class_exists('shRouter')) {
$shConfig = shRouter::shGetConfig();
if ($shConfig->Enabled) {
$menus =& JApplication::getMenu('site', array());
$active = $menus->getActive();
if (!empty($active->home)) {
$db =& JFactory::getDBO();
$db->setQuery("SELECT `link` FROM #__menu WHERE `home`='1' LIMIT 1");
$u = JURI::root(true) . '/' . $active->link . '&Itemid=' . $active->id;
}
}
}
}
}
return $u;
}
示例12: _getPriceMask
private function _getPriceMask($txt, $val)
{
static $init, $nodecimals, $decimal, $thousands, $currency, $mask;
if (!$init) {
$init = true;
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals');
$decimal = RSFormProHelper::getConfig('payment.decimal');
$thousands = RSFormProHelper::getConfig('payment.thousands');
$currency = RSFormProHelper::getConfig('payment.currency');
$mask = RSFormProHelper::getConfig('payment.mask');
}
$formattedPrice = number_format((double) $val, $nodecimals, $decimal, $thousands);
$replacements = array('{product}' => $txt, '{price}' => $formattedPrice, '{currency}' => $currency);
return str_replace(array_keys($replacements), array_values($replacements), $mask);
}
示例13: getURL
public static function getURL()
{
// IIS hack
if (RSFormProHelper::getConfig('global.iis') && !empty($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') !== false && !empty($_SERVER['QUERY_STRING'])) {
$u = JRoute::_('index.php?' . $_SERVER['QUERY_STRING'], false);
} else {
$uri = JUri::getInstance();
$u = $uri->toString();
}
return $u;
}