本文整理汇总了PHP中mf_do_fetch_result函数的典型用法代码示例。如果您正苦于以下问题:PHP mf_do_fetch_result函数的具体用法?PHP mf_do_fetch_result怎么用?PHP mf_do_fetch_result使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mf_do_fetch_result函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mf_validate_unique
function mf_validate_unique($value)
{
global $mf_lang;
$input_value = $value[0];
$exploded = explode('#', $value[1]);
$form_id = $exploded[0];
$element_name = $exploded[1];
$dbh = $value[2]['dbh'];
if (!empty($_SESSION['edit_entry']) && $_SESSION['edit_entry']['form_id'] == $form_id) {
//if admin is editing through edit_entry.php, bypass the unique checking if the new entry is the same as previous
$query = "select count({$element_name}) total from " . MF_TABLE_PREFIX . "form_{$form_id} where {$element_name}=? and `id` != ? and {$element_name} is not null and {$element_name} <> ''";
$params = array($input_value, $_SESSION['edit_entry']['entry_id']);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
} else {
$query = "select count({$element_name}) total from " . MF_TABLE_PREFIX . "form_{$form_id} where {$element_name}=? and resume_key is null";
$params = array($input_value);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
}
if (!empty($row['total'])) {
return $mf_lang['val_unique'];
} else {
return true;
}
}
示例2: mf_theme_get_fonts_link
function mf_theme_get_fonts_link($dbh, $theme_id)
{
$font_family_array = array();
$query = "SELECT\r\n\t\t\t\t\t\tform_title_font_type,\r\n\t\t\t\t\t\tform_desc_font_type,\r\n\t\t\t\t\t\tfield_title_font_type,\r\n\t\t\t\t\t\tguidelines_font_type,\r\n\t\t\t\t\t\tsection_title_font_type,\r\n\t\t\t\t\t\tsection_desc_font_type,\r\n\t\t\t\t\t\tfield_text_font_type\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`" . MF_TABLE_PREFIX . "form_themes`\r\n\t\t\t\t WHERE\r\n\t\t\t\t \t\ttheme_id=? and `status`=1";
$params = array($theme_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$font_family_array[] = $row['form_title_font_type'];
$font_family_array[] = $row['form_desc_font_type'];
$font_family_array[] = $row['field_title_font_type'];
$font_family_array[] = $row['guidelines_font_type'];
$font_family_array[] = $row['section_title_font_type'];
$font_family_array[] = $row['section_desc_font_type'];
$font_family_array[] = $row['field_text_font_type'];
/** Build the font CSS tag **/
if (!empty($font_family_array)) {
$font_family_joined = implode("','", $font_family_array);
$query = "SELECT font_family,font_variants FROM " . MF_TABLE_PREFIX . "fonts WHERE font_family IN('{$font_family_joined}')";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
$font_css_array = array();
while ($row = mf_do_fetch_result($sth)) {
$font_css_array[] = urlencode($row['font_family']) . ":" . $row['font_variants'];
}
$ssl_suffix = mf_get_ssl_suffix();
$font_css_markup = implode('|', $font_css_array);
if (!empty($font_css_array)) {
$font_css_markup = "<link href='http{$ssl_suffix}://fonts.googleapis.com/css?family={$font_css_markup}' rel='stylesheet' type='text/css'>\n";
} else {
$font_css_markup = '';
}
}
return $font_css_markup;
}
示例3: strtolower
break;
}
$font_variants_pair[$font_variant_raw] = $primary_style . $secondary_style;
}
$font_family_slug = strtolower(str_replace(' ', '', $row['font_family']));
$font_data[$font_family_slug] = $font_variants_pair;
//build the css markup for each font
$font_css_array[] = urlencode($row['font_family']) . ":" . $row['font_variants'];
}
$font_css_markup = implode('|', $font_css_array);
$font_css_markup = "<link href='http://fonts.googleapis.com/css?family={$font_css_markup}' rel='stylesheet' type='text/css'>\n";
//determine if the font list is reaching the end or not
$query = "select max(font_id) max_font_id from " . MF_TABLE_PREFIX . "fonts";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
if ($end_font_id > $row['max_font_id']) {
$list_end = true;
} else {
$list_end = false;
}
//send the final markup and data
$response_data = new stdClass();
$response_data->status = "ok";
$response_data->markup = $font_list_markup;
$response_data->last_font_id = $end_font_id - 1;
$response_data->list_end = $list_end;
$response_data->font_styles = $font_data;
$response_data->font_css_markup = $font_css_markup;
$response_json = json_encode($response_data);
echo $response_json;
示例4: mf_get_required_elements_status
function mf_get_required_elements_status($dbh, $form_id, $page_number, $user_input)
{
//get all fields within current page which has "required" property and has conditions
$query = "SELECT \r\n\t\t\t\t\t\tA.element_id \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "form_elements A LEFT JOIN " . MF_TABLE_PREFIX . "field_logic_elements B \r\n\t\t\t\t\t ON \r\n\t\t\t\t\t \tA.form_id=B.form_id and A.element_id=B.element_id\r\n\t\t\t\t WHERE \r\n\t\t\t\t \t\tA.form_id = ? and \r\n\t\t\t\t \t\tA.element_status = 1 and \r\n\t\t\t\t \t\tA.element_page_number = ? and \r\n\t\t\t\t \t\tA.element_is_required = 1 and \r\n\t\t\t\t \t\tB.element_id is not null\r\n\t\t\t\tORDER BY \r\n\t\t\t\t\t\tA.element_position asc";
$params = array($form_id, $page_number);
$sth = mf_do_query($query, $params, $dbh);
$required_fields_array = array();
while ($row = mf_do_fetch_result($sth)) {
$required_fields_array[] = $row['element_id'];
}
$required_elements_status = array();
//loop through each field and check for the conditions
if (!empty($required_fields_array)) {
foreach ($required_fields_array as $element_id) {
$current_element_conditions_status = array();
$query = "select rule_show_hide,rule_all_any from " . MF_TABLE_PREFIX . "field_logic_elements where form_id = ? and element_id = ?";
$params = array($form_id, $element_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$rule_show_hide = $row['rule_show_hide'];
$rule_all_any = $row['rule_all_any'];
//get all conditions for current field
$query = "SELECT \r\n\t\t\t\t\t\tA.target_element_id,\r\n\t\t\t\t\t\tA.element_name,\r\n\t\t\t\t\t\tA.rule_condition,\r\n\t\t\t\t\t\tA.rule_keyword,\r\n\t\t\t\t\t\ttrim(leading 'element_' from substring_index(A.element_name,'_',2)) as condition_element_id,\r\n\t\t\t\t\t\t(select \r\n\t\t\t\t\t\t\t B.element_page_number \r\n\t\t\t\t\t\t from \r\n\t\t\t\t\t\t \t " . MF_TABLE_PREFIX . "form_elements B \r\n\t\t\t\t\t\t where \r\n\t\t\t\t\t\t \t\tform_id=A.form_id and \r\n\t\t\t\t\t\t \t\telement_id=condition_element_id\r\n\t\t\t\t\t\t) condition_element_page_number,\r\n\t\t\t\t\t\t(select \r\n\t\t\t\t\t\t\t C.element_type \r\n\t\t\t\t\t\t from \r\n\t\t\t\t\t\t \t " . MF_TABLE_PREFIX . "form_elements C \r\n\t\t\t\t\t\t where \r\n\t\t\t\t\t\t \t\tform_id=A.form_id and \r\n\t\t\t\t\t\t \t\telement_id=condition_element_id\r\n\t\t\t\t\t\t) condition_element_type\r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "field_logic_conditions A \r\n\t\t\t\t WHERE\r\n\t\t\t\t\t\tA.form_id = ? and A.target_element_id = ?";
$params = array($form_id, $element_id);
$sth = mf_do_query($query, $params, $dbh);
$i = 0;
$logic_conditions_array = array();
while ($row = mf_do_fetch_result($sth)) {
$logic_conditions_array[$i]['element_name'] = $row['element_name'];
$logic_conditions_array[$i]['element_type'] = $row['condition_element_type'];
$logic_conditions_array[$i]['rule_condition'] = $row['rule_condition'];
$logic_conditions_array[$i]['rule_keyword'] = $row['rule_keyword'];
$logic_conditions_array[$i]['element_page_number'] = (int) $row['condition_element_page_number'];
$i++;
}
//loop through each condition which is not coming from the current page
foreach ($logic_conditions_array as $value) {
if ($value['element_page_number'] == $page_number) {
continue;
}
$condition_params = array();
$condition_params['form_id'] = $form_id;
$condition_params['element_name'] = $value['element_name'];
$condition_params['rule_condition'] = $value['rule_condition'];
$condition_params['rule_keyword'] = $value['rule_keyword'];
$current_element_conditions_status[] = mf_get_condition_status_from_table($dbh, $condition_params);
}
//loop through each condition which is coming from the current page
foreach ($logic_conditions_array as $value) {
if ($value['element_page_number'] != $page_number) {
continue;
}
$condition_params = array();
$condition_params['form_id'] = $form_id;
$condition_params['element_name'] = $value['element_name'];
$condition_params['rule_condition'] = $value['rule_condition'];
$condition_params['rule_keyword'] = $value['rule_keyword'];
$current_element_conditions_status[] = mf_get_condition_status_from_input($dbh, $condition_params, $user_input);
}
//decide the status of the current element_id based on all conditions
//required field should only being applied to an element which is being shown into the form
//any field which is hidden due to conditions, shouldn't have any required attribute
if ($rule_all_any == 'all') {
if (in_array(false, $current_element_conditions_status)) {
$all_conditions_status = false;
} else {
$all_conditions_status = true;
}
} else {
if ($rule_all_any == 'any') {
if (in_array(true, $current_element_conditions_status)) {
$all_conditions_status = true;
} else {
$all_conditions_status = false;
}
}
}
if ($rule_show_hide == 'show') {
if ($all_conditions_status === true) {
$element_status = true;
} else {
$element_status = false;
}
} else {
if ($rule_show_hide == 'hide') {
if ($all_conditions_status === true) {
$element_status = false;
} else {
$element_status = true;
}
}
}
if ($element_status === true) {
$required_elements_status[$element_id] = 1;
} else {
$required_elements_status[$element_id] = 0;
}
}
//end foreach required fields
}
//.........这里部分代码省略.........
示例5: sort
sort($all_tagnames);
$jquery_data_code .= "\$('#dialog-enter-tagname-input').data('available_tags'," . json_encode($all_tagnames) . ");\n";
//get the available custom themes
$query = "SELECT theme_id,theme_name FROM " . MF_TABLE_PREFIX . "form_themes WHERE theme_built_in=0 and status=1 ORDER BY theme_name ASC";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
$theme_list_array = array();
while ($row = mf_do_fetch_result($sth)) {
$theme_list_array[$row['theme_id']] = htmlspecialchars($row['theme_name']);
}
//get built-in themes
$query = "SELECT theme_id,theme_name FROM " . MF_TABLE_PREFIX . "form_themes WHERE theme_built_in=1 and status=1 ORDER BY theme_name ASC";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
$theme_builtin_list_array = array();
while ($row = mf_do_fetch_result($sth)) {
$theme_builtin_list_array[$row['theme_id']] = htmlspecialchars($row['theme_name']);
}
$header_data = <<<EOT
<link type="text/css" href="js/jquery-ui/themes/base/jquery.ui.all.css" rel="stylesheet" />
<link type="text/css" href="css/pagination_classic.css" rel="stylesheet" />
<link type="text/css" href="css/dropui.css" rel="stylesheet" />
EOT;
$current_nav_tab = 'manage_forms';
?>
<br />
<div id="content" class="full">
<div class="post manage_forms">
<?php
示例6: mf_display_form_review
function mf_display_form_review($dbh, $form_id, $record_id, $from_page_num, $form_params = array())
{
global $mf_lang;
if (!empty($form_params['integration_method'])) {
$integration_method = $form_params['integration_method'];
} else {
$integration_method = '';
}
if (!empty($form_params['machform_path'])) {
$machform_path = $form_params['machform_path'];
} else {
$machform_path = '';
}
if (!empty($form_params['machform_data_path'])) {
$machform_data_path = $form_params['machform_data_path'];
} else {
$machform_data_path = '';
}
$mf_settings = mf_get_settings($dbh);
//get form properties data
$query = "select \r\n\t\t\t\t\t\t form_name,\r\n\t\t\t\t\t\t form_has_css,\r\n\t\t\t\t\t\t form_redirect,\r\n\t\t\t\t\t\t form_review_primary_text,\r\n\t\t\t\t\t\t form_review_secondary_text,\r\n\t\t\t\t\t\t form_review_primary_img,\r\n\t\t\t\t\t\t form_review_secondary_img,\r\n\t\t\t\t\t\t form_review_use_image,\r\n\t\t\t\t\t\t form_review_title,\r\n\t\t\t\t\t\t form_review_description,\r\n\t\t\t\t\t\t form_page_total,\r\n\t\t\t\t\t\t form_lastpage_title,\r\n\t\t\t\t\t\t form_pagination_type,\r\n\t\t\t\t\t\t form_theme_id,\r\n\t\t\t\t\t\t payment_show_total,\r\n\t\t\t\t\t\t payment_total_location,\r\n\t\t\t\t\t\t payment_enable_merchant,\r\n\t\t\t\t\t\t payment_currency,\r\n\t\t\t\t\t\t payment_price_type,\r\n\t\t\t\t\t\t payment_price_amount\r\n\t\t\t\t from \r\n\t\t\t\t \t " . MF_TABLE_PREFIX . "forms \r\n\t\t\t\t where \r\n\t\t\t\t \t form_id=?";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$form_has_css = $row['form_has_css'];
$form_redirect = $row['form_redirect'];
$form_review_primary_text = $row['form_review_primary_text'];
$form_review_secondary_text = $row['form_review_secondary_text'];
$form_review_primary_img = $row['form_review_primary_img'];
$form_review_secondary_img = $row['form_review_secondary_img'];
$form_review_use_image = (int) $row['form_review_use_image'];
$form_review_title = $row['form_review_title'];
$form_review_description = $row['form_review_description'];
$form_page_total = $row['form_page_total'];
$form_lastpage_title = $row['form_lastpage_title'];
$form_pagination_type = $row['form_pagination_type'];
$form_name = htmlspecialchars($row['form_name'], ENT_QUOTES);
$form_theme_id = $row['form_theme_id'];
$payment_show_total = (int) $row['payment_show_total'];
$payment_total_location = $row['payment_total_location'];
$payment_enable_merchant = (int) $row['payment_enable_merchant'];
if ($payment_enable_merchant < 1) {
$payment_enable_merchant = 0;
}
$payment_currency = $row['payment_currency'];
$payment_price_type = $row['payment_price_type'];
$payment_price_amount = $row['payment_price_amount'];
//prepare entry data for previewing
$param['strip_download_link'] = true;
$param['review_mode'] = true;
$param['show_attach_image'] = true;
$param['machform_data_path'] = $machform_data_path;
$entry_details = mf_get_entry_details($dbh, $form_id, $record_id, $param);
$entry_data = '<table id="machform_review_table" width="100%" border="0" cellspacing="0" cellpadding="0"><tbody>' . "\n";
$toggle = false;
foreach ($entry_details as $data) {
if ($toggle) {
$toggle = false;
$row_style = 'class="alt"';
} else {
$toggle = true;
$row_style = '';
}
if ($data['label'] == 'mf_page_break' && $data['value'] == 'mf_page_break') {
$data['label'] = ' ';
$data['value'] = ' ';
$row_style = '';
}
$entry_data .= "<tr {$row_style}>\n";
$entry_data .= "<td class=\"mf_review_label\" width=\"40%\">{$data['label']}</td>\n";
$entry_data .= "<td class=\"mf_review_value\" width=\"60%\">" . nl2br($data['value']) . "</td>\n";
$entry_data .= "</tr>\n";
}
$entry_data .= '</tbody></table>';
//check for specific form css, if any, use it instead
if ($form_has_css) {
$css_dir = $mf_settings['data_dir'] . "/form_{$form_id}/css/";
}
if ($integration_method == 'iframe') {
$embed_class = 'class="embed"';
}
//if the form has multiple pages
//display the pagination header
if ($form_page_total > 1) {
//build pagination header based on the selected type. possible values:
//steps - display multi steps progress
//percentage - display progress bar with percentage
//disabled - disabled
$page_breaks_data = array();
$page_title_array = array();
//get page titles
$query = "SELECT \r\n\t\t\t\t\t\t\telement_page_title\r\n\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t" . MF_TABLE_PREFIX . "form_elements\r\n\t\t\t\t\t WHERE\r\n\t\t\t\t\t\t\tform_id = ? and element_status = 1 and element_type = 'page_break'\r\n\t\t\t\t\tORDER BY \r\n\t\t\t\t\t \t\telement_page_number asc";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$page_title_array[] = $row['element_page_title'];
}
if ($form_pagination_type == 'steps') {
$page_titles_markup = '';
$i = 1;
//.........这里部分代码省略.........
示例7: mf_mysql_column_exist
function mf_mysql_column_exist($table_name, $column_name, $dbh)
{
$query = "SHOW COLUMNS FROM {$table_name} LIKE '{$column_name}'";
$sth = mf_do_query($query, array(), $dbh);
$row = mf_do_fetch_result($sth);
if (!empty($row)) {
return true;
} else {
return false;
}
}
示例8: mf_get_user_permissions_all
function mf_get_user_permissions_all($dbh, $user_id)
{
$query = "SELECT \r\n\t\t\t\t\t\t`edit_form`,`edit_entries`,`view_entries`,`form_id` \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\t`" . MF_TABLE_PREFIX . "permissions`\r\n\t\t\t\t WHERE\r\n\t\t\t\t \t\t`user_id` = ?";
$params = array($user_id);
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$form_id = $row['form_id'];
$edit_form = false;
$edit_entries = false;
$view_entries = false;
if (!empty($row['edit_form'])) {
$edit_form = true;
}
if (!empty($row['edit_entries'])) {
$edit_entries = true;
}
if (!empty($row['view_entries'])) {
$view_entries = true;
}
$perms[$form_id]['edit_form'] = $edit_form;
$perms[$form_id]['edit_entries'] = $edit_entries;
$perms[$form_id]['view_entries'] = $view_entries;
}
return $perms;
}
示例9: mf_get_settings
function mf_get_settings($dbh)
{
$query = "SELECT * FROM " . MF_TABLE_PREFIX . "settings";
$sth = mf_do_query($query, array(), $dbh);
$row = mf_do_fetch_result($sth);
return $row;
}
示例10: mf_get_filtered_entries_ids
function mf_get_filtered_entries_ids($dbh, $form_id)
{
//get filter keywords from ap_form_filters table
$query = "select\r\n\t\t\t\t\t\telement_name,\r\n\t\t\t\t\t\tfilter_condition,\r\n\t\t\t\t\t\tfilter_keyword\r\n\t\t\t\t\tfrom \r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "form_filters\r\n\t\t\t\t where\r\n\t\t\t\t \t\tform_id = ?\r\n\t\t\t\torder by \r\n\t\t\t\t \t\taff_id asc";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$i = 0;
while ($row = mf_do_fetch_result($sth)) {
$filter_data[$i]['element_name'] = $row['element_name'];
$filter_data[$i]['filter_condition'] = $row['filter_condition'];
$filter_data[$i]['filter_keyword'] = $row['filter_keyword'];
$i++;
}
$query = "select \r\n\t\t\t\t\t\t entries_filter_type,\r\n\t\t\t\t\t\t entries_sort_by\r\n\t\t\t\t from \r\n\t\t\t\t \t " . MF_TABLE_PREFIX . "forms \r\n\t\t\t\t where \r\n\t\t\t\t \t form_id = ?";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
if (!empty($row)) {
$filter_type = $row['entries_filter_type'];
$sort_by = $row['entries_sort_by'];
$exploded = explode('-', $sort_by);
$sort_element = $exploded[0];
//the element name, e.g. element_2
$sort_order = $exploded[1];
//asc or desc
}
/******************************************************************************************/
//prepare column header names lookup
//get form element options first (checkboxes, choices, dropdown)
$query = "select \r\n\t\t\t\t\t\telement_id,\r\n\t\t\t\t\t\toption_id,\r\n\t\t\t\t\t\t`option`\r\n\t\t\t\t\tfrom \r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "element_options \r\n\t\t\t\t where \r\n\t\t\t\t \t\tform_id=? and live=1 \r\n\t\t\t\torder by \r\n\t\t\t\t\t\telement_id,option_id asc";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$element_id = $row['element_id'];
$option_id = $row['option_id'];
$element_option_lookup[$element_id][$option_id] = htmlspecialchars($row['option'], ENT_QUOTES);
}
//get element options for matrix fields
$query = "select \r\n\t\t\t\t\t\tA.element_id,\r\n\t\t\t\t\t\tA.option_id,\r\n\t\t\t\t\t\t(select if(B.element_matrix_parent_id=0,A.option,\r\n\t\t\t\t\t\t\t(select \r\n\t\t\t\t\t\t\t\t\tC.`option` \r\n\t\t\t\t\t\t\t from \r\n\t\t\t\t\t\t\t \t\t" . MF_TABLE_PREFIX . "element_options C \r\n\t\t\t\t\t\t\t where \r\n\t\t\t\t\t\t\t \t\tC.element_id=B.element_matrix_parent_id and \r\n\t\t\t\t\t\t\t \t\tC.form_id=A.form_id and \r\n\t\t\t\t\t\t\t \t\tC.live=1 and \r\n\t\t\t\t\t\t\t \t\tC.option_id=A.option_id))\r\n\t\t\t\t\t\t) 'option_label'\r\n\t\t\t\t\tfrom \r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "element_options A left join " . MF_TABLE_PREFIX . "form_elements B on (A.element_id=B.element_id and A.form_id=B.form_id)\r\n\t\t\t\t where \r\n\t\t\t\t \t\tA.form_id=? and A.live=1 and B.element_type='matrix' and B.element_status=1\r\n\t\t\t\torder by \r\n\t\t\t\t\t\tA.element_id,A.option_id asc";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$element_id = $row['element_id'];
$option_id = $row['option_id'];
$matrix_element_option_lookup[$element_id][$option_id] = htmlspecialchars($row['option_label'], ENT_QUOTES);
}
//get 'multiselect' status of matrix fields
$query = "select \r\n\t\t\t\t\t\t A.element_id,\r\n\t\t\t\t\t\t A.element_matrix_parent_id,\r\n\t\t\t\t\t\t A.element_matrix_allow_multiselect,\r\n\t\t\t\t\t\t (select if(A.element_matrix_parent_id=0,A.element_matrix_allow_multiselect,\r\n\t\t\t\t\t\t \t\t\t (select B.element_matrix_allow_multiselect from " . MF_TABLE_PREFIX . "form_elements B where B.form_id=A.form_id and B.element_id=A.element_matrix_parent_id)\r\n\t\t\t\t\t\t \t\t\t)\r\n\t\t\t\t\t\t ) 'multiselect' \r\n\t\t\t\t\t from \r\n\t\t\t\t\t \t " . MF_TABLE_PREFIX . "form_elements A\r\n\t\t\t\t\t where \r\n\t\t\t\t\t \t A.form_id=? and A.element_status=1 and A.element_type='matrix'";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$matrix_multiselect_status[$row['element_id']] = $row['multiselect'];
}
/******************************************************************************************/
//set column properties for basic fields
$column_name_lookup['date_created'] = 'Date Created';
$column_name_lookup['date_updated'] = 'Date Updated';
$column_name_lookup['ip_address'] = 'IP Address';
$column_type_lookup['id'] = 'number';
$column_type_lookup['row_num'] = 'number';
$column_type_lookup['date_created'] = 'date';
$column_type_lookup['date_updated'] = 'date';
$column_type_lookup['ip_address'] = 'text';
//get column properties for other fields
$query = "select \r\n\t\t\t\t\t\t element_id,\r\n\t\t\t\t\t\t element_title,\r\n\t\t\t\t\t\t element_type,\r\n\t\t\t\t\t\t element_constraint,\r\n\t\t\t\t\t\t element_choice_has_other,\r\n\t\t\t\t\t\t element_choice_other_label,\r\n\t\t\t\t\t\t element_time_showsecond,\r\n\t\t\t\t\t\t element_time_24hour,\r\n\t\t\t\t\t\t element_matrix_allow_multiselect \r\n\t\t\t\t from \r\n\t\t\t\t `" . MF_TABLE_PREFIX . "form_elements` \r\n\t\t\t\t where \r\n\t\t\t\t \t form_id=? and element_status=1 and element_type not in('section','page_break')\r\n\t\t\t\t order by \r\n\t\t\t\t \t\t element_position asc";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$element_radio_has_other = array();
while ($row = mf_do_fetch_result($sth)) {
$element_type = $row['element_type'];
$element_constraint = $row['element_constraint'];
//get 'other' field label for checkboxes and radio button
if ($element_type == 'checkbox' || $element_type == 'radio') {
if (!empty($row['element_choice_has_other'])) {
$element_option_lookup[$row['element_id']]['other'] = htmlspecialchars($row['element_choice_other_label'], ENT_QUOTES);
if ($element_type == 'radio') {
$element_radio_has_other['element_' . $row['element_id']] = true;
}
}
}
$row['element_title'] = htmlspecialchars($row['element_title'], ENT_QUOTES);
if ('address' == $element_type) {
//address has 6 fields
$column_name_lookup['element_' . $row['element_id'] . '_1'] = $row['element_title'] . ' - Street Address';
$column_name_lookup['element_' . $row['element_id'] . '_2'] = 'Address Line 2';
$column_name_lookup['element_' . $row['element_id'] . '_3'] = 'City';
$column_name_lookup['element_' . $row['element_id'] . '_4'] = 'State/Province/Region';
$column_name_lookup['element_' . $row['element_id'] . '_5'] = 'Zip/Postal Code';
$column_name_lookup['element_' . $row['element_id'] . '_6'] = 'Country';
$column_type_lookup['element_' . $row['element_id'] . '_1'] = $row['element_type'];
$column_type_lookup['element_' . $row['element_id'] . '_2'] = $row['element_type'];
$column_type_lookup['element_' . $row['element_id'] . '_3'] = $row['element_type'];
$column_type_lookup['element_' . $row['element_id'] . '_4'] = $row['element_type'];
$column_type_lookup['element_' . $row['element_id'] . '_5'] = $row['element_type'];
$column_type_lookup['element_' . $row['element_id'] . '_6'] = $row['element_type'];
} elseif ('simple_name' == $element_type) {
//simple name has 2 fields
$column_name_lookup['element_' . $row['element_id'] . '_1'] = $row['element_title'] . ' - First';
$column_name_lookup['element_' . $row['element_id'] . '_2'] = $row['element_title'] . ' - Last';
$column_type_lookup['element_' . $row['element_id'] . '_1'] = $row['element_type'];
//.........这里部分代码省略.........
示例11: mf_get_payment_total
function mf_get_payment_total($dbh, $form_id, $session_id, $exclude_page_number)
{
$total_payment_amount = 0;
//get price fields information from ap_element_prices table
$query = "select \r\n\t\t\t\t\t\tA.element_id,\r\n\t\t\t\t\t\tA.option_id,\r\n\t\t\t\t\t\tA.price,\r\n\t\t\t\t\t\tB.element_title,\r\n\t\t\t\t\t\tB.element_type,\r\n\t\t\t\t\t\t(select `option` from " . MF_TABLE_PREFIX . "element_options where form_id=A.form_id and element_id=A.element_id and option_id=A.option_id and live=1 limit 1) option_title\r\n\t\t\t\t\tfrom\r\n\t\t\t\t\t\t" . MF_TABLE_PREFIX . "element_prices A left join " . MF_TABLE_PREFIX . "form_elements B on (A.form_id=B.form_id and A.element_id=B.element_id)\r\n\t\t\t\t where\r\n\t\t\t\t\t\tA.form_id = ? and B.element_page_number <> ?\r\n\t\t\t\torder by \r\n\t\t\t\t\t\tA.element_id,A.option_id asc";
$params = array($form_id, $exclude_page_number);
$sth = mf_do_query($query, $params, $dbh);
$price_field_columns = array();
while ($row = mf_do_fetch_result($sth)) {
$element_id = (int) $row['element_id'];
$option_id = (int) $row['option_id'];
$element_type = $row['element_type'];
if ($element_type == 'checkbox') {
$column_name = 'element_' . $element_id . '_' . $option_id;
} else {
$column_name = 'element_' . $element_id;
}
if (!in_array($column_name, $price_field_columns)) {
$price_field_columns[] = $column_name;
$price_field_types[$column_name] = $row['element_type'];
}
$price_values[$element_id][$option_id] = $row['price'];
}
if (empty($price_field_columns)) {
return 0;
}
$price_field_columns_joined = implode(',', $price_field_columns);
//check the value of the price fields from the ap_form_x_review table
$query = "select {$price_field_columns_joined} from " . MF_TABLE_PREFIX . "form_{$form_id}_review where `session_id`=?";
$params = array($session_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$processed_column_name = array();
foreach ($price_field_columns as $column_name) {
if (!empty($row[$column_name]) && !in_array($column_name, $processed_column_name)) {
$temp = explode('_', $column_name);
$element_id = (int) $temp[1];
$option_id = (int) $temp[2];
if ($price_field_types[$column_name] == 'money') {
$total_payment_amount += $row[$column_name];
} else {
if ($price_field_types[$column_name] == 'checkbox') {
$total_payment_amount += $price_values[$element_id][$option_id];
} else {
$option_id = $row[$column_name];
$total_payment_amount += $price_values[$element_id][$option_id];
}
}
$processed_column_name[] = $column_name;
}
}
return $total_payment_amount;
}
示例12: mf_display_form_payment
function mf_display_form_payment($dbh, $form_id, $record_id, $form_params = array())
{
global $mf_lang;
if (!empty($form_params['integration_method'])) {
$integration_method = $form_params['integration_method'];
} else {
$integration_method = '';
}
if (!empty($form_params['machform_path'])) {
$machform_path = $form_params['machform_path'];
} else {
$machform_path = '';
}
if (!empty($form_params['machform_data_path'])) {
$machform_data_path = $form_params['machform_data_path'];
} else {
$machform_data_path = '';
}
//check permission to access this page
if ($_SESSION['mf_form_payment_access'][$form_id] !== true) {
return "Your session has been expired. Please <a href='view.php?id={$form_id}'>click here</a> to start again.";
}
$mf_settings = mf_get_settings($dbh);
//get form properties data
$query = "select \r\n\t\t\t\t\t\t form_name,\r\n\t\t\t\t\t\t form_has_css,\r\n\t\t\t\t\t\t form_redirect,\r\n\t\t\t\t\t\t form_language,\r\n\t\t\t\t\t\t form_review,\r\n\t\t\t\t\t\t form_review_primary_text,\r\n\t\t\t\t\t\t form_review_secondary_text,\r\n\t\t\t\t\t\t form_review_primary_img,\r\n\t\t\t\t\t\t form_review_secondary_img,\r\n\t\t\t\t\t\t form_review_use_image,\r\n\t\t\t\t\t\t form_review_title,\r\n\t\t\t\t\t\t form_review_description,\r\n\t\t\t\t\t\t form_resume_enable,\r\n\t\t\t\t\t\t form_page_total,\r\n\t\t\t\t\t\t form_lastpage_title,\r\n\t\t\t\t\t\t form_pagination_type,\r\n\t\t\t\t\t\t form_theme_id,\r\n\t\t\t\t\t\t payment_show_total,\r\n\t\t\t\t\t\t payment_total_location,\r\n\t\t\t\t\t\t payment_enable_merchant,\r\n\t\t\t\t\t\t payment_merchant_type,\r\n\t\t\t\t\t\t payment_currency,\r\n\t\t\t\t\t\t payment_price_type,\r\n\t\t\t\t\t\t payment_price_name,\r\n\t\t\t\t\t\t payment_price_amount,\r\n\t\t\t\t\t\t payment_ask_billing,\r\n\t\t\t\t\t\t payment_ask_shipping,\r\n\t\t\t\t\t\t payment_stripe_live_public_key,\r\n\t\t\t\t\t\t payment_stripe_test_public_key,\r\n\t\t\t\t\t\t payment_stripe_enable_test_mode,\r\n\t\t\t\t\t\t payment_enable_recurring,\r\n\t\t\t\t\t\t payment_recurring_cycle,\r\n\t\t\t\t\t\t payment_recurring_unit,\r\n\t\t\t\t\t\t payment_enable_trial,\r\n\t\t\t\t\t\t payment_trial_period,\r\n\t\t\t\t\t\t payment_trial_unit,\r\n\t\t\t\t\t\t payment_trial_amount,\r\n\t\t\t\t\t\t payment_delay_notifications\r\n\t\t\t\t from \r\n\t\t\t\t \t " . MF_TABLE_PREFIX . "forms \r\n\t\t\t\t where \r\n\t\t\t\t \t form_id=?";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$form_language = $row['form_language'];
if (!empty($form_language)) {
mf_set_language($form_language);
}
$form_payment_title = $mf_lang['form_payment_title'];
$form_payment_description = $mf_lang['form_payment_description'];
$form_has_css = $row['form_has_css'];
$form_redirect = $row['form_redirect'];
$form_review = (int) $row['form_review'];
$form_review_primary_text = $row['form_review_primary_text'];
$form_review_secondary_text = $row['form_review_secondary_text'];
$form_review_primary_img = $row['form_review_primary_img'];
$form_review_secondary_img = $row['form_review_secondary_img'];
$form_review_use_image = (int) $row['form_review_use_image'];
$form_review_title = $row['form_review_title'];
$form_review_description = $row['form_review_description'];
$form_page_total = (int) $row['form_page_total'];
$form_lastpage_title = $row['form_lastpage_title'];
$form_pagination_type = $row['form_pagination_type'];
$form_name = htmlspecialchars($row['form_name'], ENT_QUOTES);
$form_theme_id = $row['form_theme_id'];
$form_resume_enable = (int) $row['form_resume_enable'];
$payment_show_total = (int) $row['payment_show_total'];
$payment_total_location = $row['payment_total_location'];
$payment_enable_merchant = (int) $row['payment_enable_merchant'];
if ($payment_enable_merchant < 1) {
$payment_enable_merchant = 0;
}
$payment_currency = $row['payment_currency'];
$payment_price_type = $row['payment_price_type'];
$payment_price_amount = $row['payment_price_amount'];
$payment_price_name = htmlspecialchars($row['payment_price_name'], ENT_QUOTES);
$payment_ask_billing = (int) $row['payment_ask_billing'];
$payment_ask_shipping = (int) $row['payment_ask_shipping'];
$payment_merchant_type = $row['payment_merchant_type'];
$payment_stripe_enable_test_mode = (int) $row['payment_stripe_enable_test_mode'];
$payment_stripe_live_public_key = trim($row['payment_stripe_live_public_key']);
$payment_stripe_test_public_key = trim($row['payment_stripe_test_public_key']);
$payment_enable_recurring = (int) $row['payment_enable_recurring'];
$payment_recurring_cycle = (int) $row['payment_recurring_cycle'];
$payment_recurring_unit = $row['payment_recurring_unit'];
$payment_enable_trial = (int) $row['payment_enable_trial'];
$payment_trial_period = (int) $row['payment_trial_period'];
$payment_trial_unit = $row['payment_trial_unit'];
$payment_trial_amount = (double) $row['payment_trial_amount'];
$payment_delay_notifications = (int) $row['payment_delay_notifications'];
//check for specific form css, if any, use it instead
if ($form_has_css) {
$css_dir = $mf_settings['data_dir'] . "/form_{$form_id}/css/";
}
if ($integration_method == 'iframe') {
$embed_class = 'class="embed"';
}
//get total payment
$currency_symbol = '$';
if ($payment_price_type == 'variable') {
$total_payment_amount = (double) mf_get_payment_total($dbh, $form_id, $record_id, 0, 'live');
$payment_items = mf_get_payment_items($dbh, $form_id, $record_id, 'live');
//build the payment list markup
$payment_list_items_markup = '';
if (!empty($payment_items)) {
foreach ($payment_items as $item) {
if ($item['type'] == 'money') {
$payment_list_items_markup .= "<li>{$item['title']} <span>{$currency_symbol}{$item['amount']}</span></li>" . "\n";
} else {
if ($item['type'] == 'checkbox') {
$payment_list_items_markup .= "<li>{$item['sub_title']} <span>{$currency_symbol}{$item['amount']}</span></li>" . "\n";
} else {
if ($item['type'] == 'select' || $item['type'] == 'radio') {
$payment_list_items_markup .= "<li>{$item['title']} <em>({$item['sub_title']})</em> <span>{$currency_symbol}{$item['amount']}</span></li>" . "\n";
}
}
//.........这里部分代码省略.........
示例13: mf_get_form_properties
function mf_get_form_properties($dbh, $form_id, $columns = array())
{
if (!empty($columns)) {
$columns_joined = implode("`,`", $columns);
} else {
//if no columns array specified, get all columns of ap_forms table
$query = "show columns from " . MF_TABLE_PREFIX . "forms";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
if ($row['Field'] == 'form_id' || $row['Field'] == 'form_name') {
continue;
//MySQL 4.1 doesn't support WHERE on show columns, hence we need this
}
$columns[] = $row['Field'];
}
$columns_joined = implode("`,`", $columns);
}
$query = "select `{$columns_joined}` from " . MF_TABLE_PREFIX . "forms where form_id = ?";
$params = array($form_id);
$sth = mf_do_query($query, $params, $dbh);
$row = mf_do_fetch_result($sth);
$form_properties = array();
foreach ($columns as $column_name) {
$form_properties[$column_name] = $row[$column_name];
}
return $form_properties;
}
示例14: do_delta_update_3_3_to_3_4
function do_delta_update_3_3_to_3_4($dbh, $options = array())
{
$post_install_error = '';
$mf_settings = mf_get_settings($dbh);
//1. Create table ap_field_logic_elements
$query = "CREATE TABLE `" . MF_TABLE_PREFIX . "field_logic_elements` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `element_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_show_hide` varchar(4) NOT NULL DEFAULT 'show',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_all_any` varchar(3) NOT NULL DEFAULT 'all',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t PRIMARY KEY (`form_id`,`element_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//2. Create table ap_field_logic_conditions
$query = "CREATE TABLE `" . MF_TABLE_PREFIX . "field_logic_conditions` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `alc_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `target_element_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `element_name` varchar(50) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_condition` varchar(15) NOT NULL DEFAULT 'is',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_keyword` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t PRIMARY KEY (`alc_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) DEFAULT CHARACTER SET utf8;";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//3. Create table ap_form_payments
$query = "CREATE TABLE `" . MF_TABLE_PREFIX . "form_payments` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `afp_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `form_id` int(11) unsigned NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `record_id` int(11) unsigned NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_id` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `date_created` datetime DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_date` datetime DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_status` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_fullname` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_amount` decimal(62,2) NOT NULL DEFAULT '0.00',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_currency` varchar(3) NOT NULL DEFAULT 'usd',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_test_mode` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `payment_merchant_type` varchar(25) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `status` int(1) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `billing_street` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `billing_city` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `billing_state` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `billing_zipcode` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `billing_country` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `same_shipping_address` int(1) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `shipping_street` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `shipping_city` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `shipping_state` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `shipping_zipcode` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `shipping_country` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t PRIMARY KEY (`afp_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) DEFAULT CHARACTER SET utf8;";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//4. Create table ap_page_logic
$query = "CREATE TABLE `" . MF_TABLE_PREFIX . "page_logic` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t`page_id` varchar(15) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t`rule_all_any` varchar(3) NOT NULL DEFAULT 'all',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t PRIMARY KEY (`form_id`,`page_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) DEFAULT CHARACTER SET utf8;";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//5. Create table ap_page_logic_conditions
$query = "CREATE TABLE `" . MF_TABLE_PREFIX . "page_logic_conditions` (\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `apc_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `form_id` int(11) NOT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `target_page_id` varchar(15) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `element_name` varchar(50) NOT NULL DEFAULT '',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_condition` varchar(15) NOT NULL DEFAULT 'is',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t `rule_keyword` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t PRIMARY KEY (`apc_id`)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t ) DEFAULT CHARACTER SET utf8;";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//6. Alter ap_forms table. Add new columns
$query = "ALTER TABLE `" . MF_TABLE_PREFIX . "forms` \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `logic_field_enable` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `logic_page_enable` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_enable_trial` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_trial_period` int(11) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_trial_unit` varchar(5) NOT NULL DEFAULT 'month',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_trial_amount` decimal(62,2) NOT NULL DEFAULT '0.00',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_stripe_live_secret_key` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t ADD COLUMN `payment_stripe_live_public_key` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t ADD COLUMN `payment_stripe_test_secret_key` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t ADD COLUMN `payment_stripe_test_public_key` varchar(50) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t ADD COLUMN `payment_stripe_enable_test_mode` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t ADD COLUMN `payment_paypal_enable_test_mode` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_enable_invoice` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_invoice_email` varchar(255) DEFAULT NULL,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_delay_notifications` int(1) NOT NULL DEFAULT '1',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_ask_billing` int(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ADD COLUMN `payment_ask_shipping` int(1) NOT NULL DEFAULT '0';";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//7. Update ap_forms records, set the value of 'payment_delay_notifications' to 0 for all records.
//so that all existing paypal payments will still working as it is now.
$query = "UPDATE `" . MF_TABLE_PREFIX . "forms` SET `payment_delay_notifications`=0";
$params = array();
$sth = $dbh->prepare($query);
try {
$sth->execute($params);
} catch (PDOException $e) {
$post_install_error .= $e->getMessage() . '<br/><br/>';
}
//8. Loop through each form CSS file and add new CSS code
$query = "select `form_id` from " . MF_TABLE_PREFIX . "forms";
$params = array();
$sth = mf_do_query($query, $params, $dbh);
while ($row = mf_do_fetch_result($sth)) {
$form_id = $row['form_id'];
$form_id_array[] = $form_id;
}
$new_css_code = <<<EOT
#main_body select.select { background-image: none; }
#main_body form li.guidelines_bottom .guidelines { clear: both; }
#main_body ul.payment_summary{
\toverflow: hidden;
}
#main_body form li.payment_summary_list{
\tborder-right: 1px dashed #ccc;
\tpadding-right: 10px;
\twidth: 70%;
\tfloat: right;
\tclear: none;
\ttext-align: right;
}
#main_body form li.payment_summary_amount{
\twidth: auto;
\tfloat: right;
\tclear: none;
}
#main_body form ul.payment_list_items li{
\twidth: 98%;
\tfont-size: 95%;
\tpadding-top: 0px;
//.........这里部分代码省略.........