当前位置: 首页>>代码示例>>PHP>>正文


PHP mf_get_settings函数代码示例

本文整理汇总了PHP中mf_get_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP mf_get_settings函数的具体用法?PHP mf_get_settings怎么用?PHP mf_get_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mf_get_settings函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mf_theme_get_css_content

function mf_theme_get_css_content($dbh, $theme_id)
{
    $css_content = "/** DO NOT MODIFY THIS FILE. All code here are generated by MachForm Theme Editor **/\n\n";
    $theme_properties = new stdClass();
    $mf_settings = mf_get_settings($dbh);
    $ssl_suffix = mf_get_ssl_suffix();
    if (!empty($ssl_suffix)) {
        $mf_settings['base_url'] = str_replace('http', 'https', $mf_settings['base_url']);
    }
    $query = "SELECT\r\n\t\t\t\t\t\ttheme_name,\r\n\t\t\t\t\t\tlogo_type,\r\n\t\t\t\t\t\tifnull(logo_custom_image,'') logo_custom_image,\r\n\t\t\t\t\t\tlogo_custom_height,\r\n\t\t\t\t\t\tlogo_default_image,\r\n\t\t\t\t\t\twallpaper_bg_type,\r\n\t\t\t\t\t\twallpaper_bg_color,\r\n\t\t\t\t\t\twallpaper_bg_pattern,\r\n\t\t\t\t\t\twallpaper_bg_custom,\r\n\t\t\t\t\t\theader_bg_type,\r\n\t\t\t\t\t\theader_bg_color,\r\n\t\t\t\t\t\theader_bg_pattern,\r\n\t\t\t\t\t\theader_bg_custom,\r\n\t\t\t\t\t\tform_bg_type,\r\n\t\t\t\t\t\tform_bg_color,\r\n\t\t\t\t\t\tform_bg_pattern,\r\n\t\t\t\t\t\tform_bg_custom,\r\n\t\t\t\t\t\thighlight_bg_type,\r\n\t\t\t\t\t\thighlight_bg_color,\r\n\t\t\t\t\t\thighlight_bg_pattern,\r\n\t\t\t\t\t\thighlight_bg_custom,\r\n\t\t\t\t\t\tguidelines_bg_type,\r\n\t\t\t\t\t\tguidelines_bg_color,\r\n\t\t\t\t\t\tguidelines_bg_pattern,\r\n\t\t\t\t\t\tguidelines_bg_custom,\r\n\t\t\t\t\t\tfield_bg_type,\r\n\t\t\t\t\t\tfield_bg_color,\r\n\t\t\t\t\t\tfield_bg_pattern,\r\n\t\t\t\t\t\tfield_bg_custom,\r\n\t\t\t\t\t\tform_title_font_type,\r\n\t\t\t\t\t\tform_title_font_weight,\r\n\t\t\t\t\t\tform_title_font_style,\r\n\t\t\t\t\t\tform_title_font_size,\r\n\t\t\t\t\t\tform_title_font_color,\r\n\t\t\t\t\t\tform_desc_font_type,\r\n\t\t\t\t\t\tform_desc_font_weight,\r\n\t\t\t\t\t\tform_desc_font_style,\r\n\t\t\t\t\t\tform_desc_font_size,\r\n\t\t\t\t\t\tform_desc_font_color,\r\n\t\t\t\t\t\tfield_title_font_type,\r\n\t\t\t\t\t\tfield_title_font_weight,\r\n\t\t\t\t\t\tfield_title_font_style,\r\n\t\t\t\t\t\tfield_title_font_size,\r\n\t\t\t\t\t\tfield_title_font_color,\r\n\t\t\t\t\t\tguidelines_font_type,\r\n\t\t\t\t\t\tguidelines_font_weight,\r\n\t\t\t\t\t\tguidelines_font_style,\r\n\t\t\t\t\t\tguidelines_font_size,\r\n\t\t\t\t\t\tguidelines_font_color,\r\n\t\t\t\t\t\tsection_title_font_type,\r\n\t\t\t\t\t\tsection_title_font_weight,\r\n\t\t\t\t\t\tsection_title_font_style,\r\n\t\t\t\t\t\tsection_title_font_size,\r\n\t\t\t\t\t\tsection_title_font_color,\r\n\t\t\t\t\t\tsection_desc_font_type,\r\n\t\t\t\t\t\tsection_desc_font_weight,\r\n\t\t\t\t\t\tsection_desc_font_style,\r\n\t\t\t\t\t\tsection_desc_font_size,\r\n\t\t\t\t\t\tsection_desc_font_color,\r\n\t\t\t\t\t\tfield_text_font_type,\r\n\t\t\t\t\t\tfield_text_font_weight,\r\n\t\t\t\t\t\tfield_text_font_style,\r\n\t\t\t\t\t\tfield_text_font_size,\r\n\t\t\t\t\t\tfield_text_font_color,\r\n\t\t\t\t\t\tborder_form_width,\r\n\t\t\t\t\t\tborder_form_style,\r\n\t\t\t\t\t\tborder_form_color,\r\n\t\t\t\t\t\tborder_guidelines_width,\r\n\t\t\t\t\t\tborder_guidelines_style,\r\n\t\t\t\t\t\tborder_guidelines_color,\r\n\t\t\t\t\t\tborder_section_width,\r\n\t\t\t\t\t\tborder_section_style,\r\n\t\t\t\t\t\tborder_section_color,\r\n\t\t\t\t\t\tform_shadow_style,\r\n\t\t\t\t\t\tform_shadow_size,\r\n\t\t\t\t\t\tform_shadow_brightness,\r\n\t\t\t\t\t\tform_button_type,\r\n\t\t\t\t\t\tform_button_text,\r\n\t\t\t\t\t\tform_button_image,\r\n\t\t\t\t\t\tadvanced_css\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);
    $theme_properties->theme_id = $theme_id;
    $theme_properties->theme_name = $row['theme_name'];
    $theme_properties->logo_type = $row['logo_type'];
    $theme_properties->logo_custom_image = $row['logo_custom_image'];
    $theme_properties->logo_custom_height = (int) $row['logo_custom_height'];
    $theme_properties->logo_default_image = $row['logo_default_image'];
    $theme_properties->wallpaper_bg_type = $row['wallpaper_bg_type'];
    $theme_properties->wallpaper_bg_color = $row['wallpaper_bg_color'];
    $theme_properties->wallpaper_bg_pattern = $row['wallpaper_bg_pattern'];
    $theme_properties->wallpaper_bg_custom = $row['wallpaper_bg_custom'];
    $theme_properties->header_bg_type = $row['header_bg_type'];
    $theme_properties->header_bg_color = $row['header_bg_color'];
    $theme_properties->header_bg_pattern = $row['header_bg_pattern'];
    $theme_properties->header_bg_custom = $row['header_bg_custom'];
    $theme_properties->form_bg_type = $row['form_bg_type'];
    $theme_properties->form_bg_color = $row['form_bg_color'];
    $theme_properties->form_bg_pattern = $row['form_bg_pattern'];
    $theme_properties->form_bg_custom = $row['form_bg_custom'];
    $theme_properties->highlight_bg_type = $row['highlight_bg_type'];
    $theme_properties->highlight_bg_color = $row['highlight_bg_color'];
    $theme_properties->highlight_bg_pattern = $row['highlight_bg_pattern'];
    $theme_properties->highlight_bg_custom = $row['highlight_bg_custom'];
    $theme_properties->guidelines_bg_type = $row['guidelines_bg_type'];
    $theme_properties->guidelines_bg_color = $row['guidelines_bg_color'];
    $theme_properties->guidelines_bg_pattern = $row['guidelines_bg_pattern'];
    $theme_properties->guidelines_bg_custom = $row['guidelines_bg_custom'];
    $theme_properties->field_bg_type = $row['field_bg_type'];
    $theme_properties->field_bg_color = $row['field_bg_color'];
    $theme_properties->field_bg_pattern = $row['field_bg_pattern'];
    $theme_properties->field_bg_custom = $row['field_bg_custom'];
    $theme_properties->form_title_font_type = $row['form_title_font_type'];
    $theme_properties->form_title_font_weight = (int) $row['form_title_font_weight'];
    $theme_properties->form_title_font_style = $row['form_title_font_style'];
    $theme_properties->form_title_font_size = $row['form_title_font_size'];
    $theme_properties->form_title_font_color = $row['form_title_font_color'];
    $theme_properties->form_desc_font_type = $row['form_desc_font_type'];
    $theme_properties->form_desc_font_weight = (int) $row['form_desc_font_weight'];
    $theme_properties->form_desc_font_style = $row['form_desc_font_style'];
    $theme_properties->form_desc_font_size = $row['form_desc_font_size'];
    $theme_properties->form_desc_font_color = $row['form_desc_font_color'];
    $theme_properties->field_title_font_type = $row['field_title_font_type'];
    $theme_properties->field_title_font_weight = (int) $row['field_title_font_weight'];
    $theme_properties->field_title_font_style = $row['field_title_font_style'];
    $theme_properties->field_title_font_size = $row['field_title_font_size'];
    $theme_properties->field_title_font_color = $row['field_title_font_color'];
    $theme_properties->guidelines_font_type = $row['guidelines_font_type'];
    $theme_properties->guidelines_font_weight = (int) $row['guidelines_font_weight'];
    $theme_properties->guidelines_font_style = $row['guidelines_font_style'];
    $theme_properties->guidelines_font_size = $row['guidelines_font_size'];
    $theme_properties->guidelines_font_color = $row['guidelines_font_color'];
    $theme_properties->section_title_font_type = $row['section_title_font_type'];
    $theme_properties->section_title_font_weight = (int) $row['section_title_font_weight'];
    $theme_properties->section_title_font_style = $row['section_title_font_style'];
    $theme_properties->section_title_font_size = $row['section_title_font_size'];
    $theme_properties->section_title_font_color = $row['section_title_font_color'];
    $theme_properties->section_desc_font_type = $row['section_desc_font_type'];
    $theme_properties->section_desc_font_weight = (int) $row['section_desc_font_weight'];
    $theme_properties->section_desc_font_style = $row['section_desc_font_style'];
    $theme_properties->section_desc_font_size = $row['section_desc_font_size'];
    $theme_properties->section_desc_font_color = $row['section_desc_font_color'];
    $theme_properties->field_text_font_type = $row['field_text_font_type'];
    $theme_properties->field_text_font_weight = (int) $row['field_text_font_weight'];
    $theme_properties->field_text_font_style = $row['field_text_font_style'];
    $theme_properties->field_text_font_size = $row['field_text_font_size'];
    $theme_properties->field_text_font_color = $row['field_text_font_color'];
    $theme_properties->border_form_width = (int) $row['border_form_width'];
    $theme_properties->border_form_style = $row['border_form_style'];
    $theme_properties->border_form_color = $row['border_form_color'];
    $theme_properties->border_guidelines_width = (int) $row['border_guidelines_width'];
    $theme_properties->border_guidelines_style = $row['border_guidelines_style'];
    $theme_properties->border_guidelines_color = $row['border_guidelines_color'];
    $theme_properties->border_section_width = (int) $row['border_section_width'];
    $theme_properties->border_section_style = $row['border_section_style'];
    $theme_properties->border_section_color = $row['border_section_color'];
    $theme_properties->form_shadow_style = $row['form_shadow_style'];
    $theme_properties->form_shadow_size = $row['form_shadow_size'];
    $theme_properties->form_shadow_brightness = $row['form_shadow_brightness'];
    $theme_properties->form_button_type = $row['form_button_type'];
    $theme_properties->form_button_text = $row['form_button_text'];
    $theme_properties->form_button_image = $row['form_button_image'];
    $theme_properties->advanced_css = $row['advanced_css'];
    /** Form Logo **/
    $form_logo_style = "#main_body h1 a";
    $form_logo_style .= "\n" . "{" . "\n";
    $form_logo_height = 40;
    if ($theme_properties->logo_type == 'disabled') {
        //logo disabled
//.........这里部分代码省略.........
开发者ID:janssit,项目名称:machform.janss.be,代码行数:101,代码来源:theme-functions.php

示例2: mf_connect_db

  
 Copyright 2007-2012 Appnitro Software. This code cannot be redistributed without
 permission from http://www.appnitro.com/
 
 More info at: http://www.appnitro.com/
 ********************************************************************************/
require 'includes/init.php';
require 'config.php';
require 'includes/db-core.php';
require 'includes/helper-functions.php';
require 'includes/check-session.php';
require 'includes/filter-functions.php';
require 'includes/theme-functions.php';
require 'includes/users-functions.php';
$dbh = mf_connect_db();
$mf_settings = mf_get_settings($dbh);
if (empty($_POST['form_id'])) {
    die("Error! You can't open this file directly");
}
$form_id = (int) $_POST['form_id'];
$theme_id = (int) $_POST['theme_id'];
//check permission, is the user allowed to access this page?
if (empty($_SESSION['mf_user_privileges']['priv_administer'])) {
    $user_perms = mf_get_user_permissions($dbh, $form_id, $_SESSION['mf_user_id']);
    //this page need edit_form permission
    if (empty($user_perms['edit_form'])) {
        die("Access Denied. You don't have permission to edit this form.");
    }
}
$query = "update " . MF_TABLE_PREFIX . "forms set form_theme_id=? where form_id=?";
$params = array($theme_id, $form_id);
开发者ID:janssit,项目名称:machform.janss.be,代码行数:30,代码来源:change_theme.php

示例3: 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'] = '&nbsp;';
            $data['value'] = '&nbsp;';
            $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;
//.........这里部分代码省略.........
开发者ID:habb0,项目名称:HabboPHP,代码行数:101,代码来源:view-functions.php

示例4: mf_get_merchant_redirect_url

function mf_get_merchant_redirect_url($dbh, $form_id, $entry_id)
{
    $mf_settings = mf_get_settings($dbh);
    $merchant_redirect_url = '';
    $payment_has_value = false;
    $query = "select \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 ifnull(payment_paypal_email,'') payment_paypal_email,\r\n\t\t\t\t\t\t payment_paypal_language,\r\n\t\t\t\t\t\t payment_currency,\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_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_price_type,\r\n\t\t\t\t\t\t payment_price_amount,\r\n\t\t\t\t\t\t payment_price_name,\r\n\t\t\t\t\t\t payment_paypal_enable_test_mode,\r\n\t\t\t\t\t\t form_redirect,\r\n\t\t\t\t\t\t form_redirect_enable\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);
    $payment_enable_merchant = (int) $row['payment_enable_merchant'];
    if ($payment_enable_merchant < 1) {
        $payment_enable_merchant = 0;
    }
    $payment_merchant_type = $row['payment_merchant_type'];
    $payment_paypal_email = $row['payment_paypal_email'];
    $payment_paypal_language = $row['payment_paypal_language'];
    $payment_currency = $row['payment_currency'];
    $payment_show_total = (int) $row['payment_show_total'];
    $payment_total_location = $row['payment_total_location'];
    $payment_enable_recurring = (int) $row['payment_enable_recurring'];
    $payment_recurring_cycle = (int) $row['payment_recurring_cycle'];
    $payment_recurring_unit = $row['payment_recurring_unit'];
    $payment_paypal_enable_test_mode = (int) $row['payment_paypal_enable_test_mode'];
    if (!empty($payment_paypal_enable_test_mode)) {
        $paypal_url = "www.sandbox.paypal.com";
    } else {
        $paypal_url = "www.paypal.com";
    }
    $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 = $row['payment_trial_amount'];
    $payment_price_type = $row['payment_price_type'];
    $payment_price_amount = (double) $row['payment_price_amount'];
    $payment_price_name = $row['payment_price_name'];
    if (!empty($row['form_redirect_enable'])) {
        $form_redirect = $row['form_redirect'];
    }
    if (!empty($payment_enable_merchant)) {
        //if merchant is enabled
        //paypal website payment standard
        if ($payment_merchant_type == 'paypal_standard') {
            //get current entry timestamp
            $query = "select unix_timestamp(date_created) entry_timestamp from " . MF_TABLE_PREFIX . "form_{$form_id} where `id` = ? and `status` = 1";
            $params = array($entry_id);
            $sth = mf_do_query($query, $params, $dbh);
            $row = mf_do_fetch_result($sth);
            $entry_timestamp = $row['entry_timestamp'];
            $paypal_params = array();
            $paypal_params['charset'] = 'UTF-8';
            $paypal_params['upload'] = 1;
            $paypal_params['business'] = $payment_paypal_email;
            $paypal_params['currency_code'] = $payment_currency;
            $paypal_params['custom'] = $form_id . '_' . $entry_id . '_' . $entry_timestamp;
            $paypal_params['rm'] = 2;
            //the buyer’s browser is redirected to the return URL by using the POST method, and all payment variables are included
            $paypal_params['lc'] = $payment_paypal_language;
            if (!empty($form_redirect)) {
                $paypal_params['return'] = $form_redirect;
            } else {
                $paypal_params['return'] = $mf_settings['base_url'] . 'view.php?id=' . $form_id . '&done=1';
            }
            $paypal_params['notify_url'] = $mf_settings['base_url'] . 'paypal_ipn.php';
            $paypal_params['no_shipping'] = 1;
            if (!empty($payment_enable_recurring)) {
                //this is recurring payment
                $paypal_params['cmd'] = '_xclick-subscriptions';
                $paypal_params['src'] = 1;
                //subscription payments recur, until user cancel it
                $paypal_params['sra'] = 1;
                //reattempt failed recurring payments before canceling
                $paypal_params['item_name'] = $payment_price_name;
                $paypal_params['p3'] = $payment_recurring_cycle;
                $paypal_params['t3'] = strtoupper($payment_recurring_unit[0]);
                if ($paypal_params['t3'] == 'Y' && $payment_recurring_cycle > 5) {
                    $paypal_params['p3'] = 5;
                    //paypal can only handle 5-year-period recurring payments, maximum
                }
                if ($payment_price_type == 'fixed') {
                    //this is fixed amount payment
                    $paypal_params['a3'] = $payment_price_amount;
                    if (!empty($payment_price_amount) && $payment_price_amount !== '0.00') {
                        $payment_has_value = true;
                    }
                } else {
                    if ($payment_price_type == 'variable') {
                        $total_payment_amount = 0;
                        //get price fields information from ap_element_prices table
                        $query = "select \r\n\t\t\t\t\t\t\t\t\t\t\tA.element_id,\r\n\t\t\t\t\t\t\t\t\t\t\tA.option_id,\r\n\t\t\t\t\t\t\t\t\t\t\tA.price,\r\n\t\t\t\t\t\t\t\t\t\t\tB.element_title,\r\n\t\t\t\t\t\t\t\t\t\t\tB.element_type,\r\n\t\t\t\t\t\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\t\t\t\t\t\tfrom\r\n\t\t\t\t\t\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\t\t\t\t\t\twhere\r\n\t\t\t\t\t\t\t\t\t\t\tA.form_id = ?\r\n\t\t\t\t\t\t\t\t\t\torder by \r\n\t\t\t\t\t\t\t\t\t\t\tA.element_id,A.option_id asc";
                        $params = array($form_id);
                        $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;
//.........这里部分代码省略.........
开发者ID:janssit,项目名称:machform.janss.be,代码行数:101,代码来源:post-functions.php

示例5: mf_send_resume_link

function mf_send_resume_link($dbh, $form_name, $form_resume_url, $resume_email)
{
    global $mf_lang;
    //get settings first
    $mf_settings = mf_get_settings($dbh);
    $subject = sprintf($mf_lang['resume_email_subject'], $form_name);
    $email_content = sprintf($mf_lang['resume_email_content'], $form_name, $form_resume_url, $form_resume_url);
    $subject = utf8_encode($subject);
    //create the mail transport
    if (!empty($mf_settings['smtp_enable'])) {
        $s_transport = Swift_SmtpTransport::newInstance($mf_settings['smtp_host'], $mf_settings['smtp_port']);
        if (!empty($mf_settings['smtp_secure'])) {
            $s_transport->setEncryption('tls');
        }
        if (!empty($mf_settings['smtp_auth'])) {
            $s_transport->setUsername($mf_settings['smtp_username']);
            $s_transport->setPassword($mf_settings['smtp_password']);
        }
    } else {
        $s_transport = Swift_MailTransport::newInstance();
        //use PHP mail() transport
    }
    //create mailer instance
    $s_mailer = Swift_Mailer::newInstance($s_transport);
    if (file_exists($mf_settings['upload_dir'] . "/form_{$form_id}/files")) {
        Swift_Preferences::getInstance()->setCacheType('disk')->setTempDir($mf_settings['upload_dir'] . "/form_{$form_id}/files");
    }
    $from_name = html_entity_decode($mf_settings['default_from_name'], ENT_QUOTES);
    $from_email = $mf_settings['default_from_email'];
    if (!empty($resume_email) && !empty($form_resume_url)) {
        $s_message = Swift_Message::newInstance()->setCharset('utf-8')->setMaxLineLength(1000)->setSubject($subject)->setFrom(array($from_email => $from_name))->setSender($from_email)->setReturnPath($from_email)->setTo($resume_email)->setBody($email_content, 'text/html');
        //send the message
        $send_result = $s_mailer->send($s_message);
        if (empty($send_result)) {
            echo "Error sending email!";
        }
    }
}
开发者ID:habb0,项目名称:HabboPHP,代码行数:38,代码来源:helper-functions.php

示例6: mf_get_entry_details

function mf_get_entry_details($dbh, $form_id, $entry_id, $options = array())
{
    $mf_settings = mf_get_settings($dbh);
    $admin_clause = '';
    if (!empty($options['review_mode'])) {
        //hide admin fields in review page
        $admin_clause = ' and element_is_private=0 ';
    }
    if (!empty($options['checkbox_image'])) {
        $checkbox_image = $options['checkbox_image'];
    } else {
        $checkbox_image = $options['machform_path'] . 'images/icons/checkbox_16.gif';
    }
    //get form elements
    $query = "select \r\n\t\t\t\t\t\t element_id,\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_title,\r\n\t\t\t\t\t\t element_file_as_attachment,\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 (select if(element_matrix_parent_id=0,\r\n\t\t\t\t\t\t\t \t\telement_matrix_allow_multiselect,\r\n\t\t\t\t\t\t\t\t\t(select \r\n\t\t\t\t\t\t\t\t\t\t\tB.element_matrix_allow_multiselect \r\n\t\t\t\t\t\t\t\t\t   from \r\n\t\t\t\t\t\t\t\t\t   \t\t" . MF_TABLE_PREFIX . "form_elements B \r\n\t\t\t\t\t\t\t\t\t  where \r\n\t\t\t\t\t\t\t\t\t  \t\tB.form_id=A.form_id and \r\n\t\t\t\t\t\t\t\t\t  \t\tB.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\t\t )\r\n\t\t\t\t\t\t ) matrix_multiselect_status  \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\twhere \r\n\t\t\t\t\t\t form_id=? and \r\n\t\t\t\t\t\t element_status = 1 and\r\n\t\t\t\t\t\t element_type <> 'section'\r\n\t\t\t\t\t\t {$admin_clause} \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);
    $i = 0;
    while ($row = mf_do_fetch_result($sth)) {
        $form_elements[$i]['element_id'] = $row['element_id'];
        $form_elements[$i]['element_type'] = $row['element_type'];
        $form_elements[$i]['element_constraint'] = $row['element_constraint'];
        $form_elements[$i]['element_file_as_attachment'] = $row['element_file_as_attachment'];
        $form_elements[$i]['element_time_showsecond'] = $row['element_time_showsecond'];
        $form_elements[$i]['element_time_24hour'] = $row['element_time_24hour'];
        $form_elements[$i]['element_matrix_allow_multiselect'] = $row['matrix_multiselect_status'];
        //store element title into array for reference later
        $element_title_lookup[$row['element_id']] = $row['element_title'];
        $i++;
    }
    if (!empty($options['review_mode'])) {
        $table_suffix = '_review';
    } else {
        $table_suffix = '';
    }
    //get whole entry for current id
    $query = "select * from `" . MF_TABLE_PREFIX . "form_{$form_id}{$table_suffix}` where id=? limit 1";
    $params = array($entry_id);
    $sth = mf_do_query($query, $params, $dbh);
    $row = mf_do_fetch_result($sth);
    foreach ($row as $column_name => $column_data) {
        $entry_data[$column_name] = htmlspecialchars($column_data, ENT_QUOTES);
    }
    //get form element options
    $query = "select element_id,option_id,`option` from " . MF_TABLE_PREFIX . "element_options where form_id=? and live=1 order by position 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] = $row['option'];
        //array index will hold option_id
    }
    //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);
    }
    //loop through each element to get the values
    $i = 0;
    foreach ($form_elements as $element) {
        $element_type = $element['element_type'];
        $element_id = $element['element_id'];
        $element_constraint = $element['element_constraint'];
        $element_file_as_attachment = $element['element_file_as_attachment'];
        $element_time_24hour = $element['element_time_24hour'];
        $element_time_showsecond = $element['element_time_showsecond'];
        $element_matrix_allow_multiselect = $element['element_matrix_allow_multiselect'];
        $entry_details[$i]['label'] = $element_title_lookup[$element_id];
        $entry_details[$i]['value'] = '&nbsp;';
        //default value
        $entry_details[$i]['element_id'] = $element_id;
        $entry_details[$i]['element_type'] = $element_type;
        if ('simple_name' == $element_type) {
            //Simple Name - 2 elements
            $simple_name_value = trim($entry_data['element_' . $element_id . '_1'] . ' ' . $entry_data['element_' . $element_id . '_2']);
            if (!empty($simple_name_value)) {
                $entry_details[$i]['value'] = $simple_name_value;
            }
        } elseif ('simple_name_wmiddle' == $element_type) {
            //Simple Name with Middle - 3 elements
            $simple_name_wmiddle_value = trim($entry_data['element_' . $element_id . '_1'] . ' ' . $entry_data['element_' . $element_id . '_2'] . ' ' . $entry_data['element_' . $element_id . '_3']);
            if (!empty($simple_name_wmiddle_value)) {
                $entry_details[$i]['value'] = $simple_name_wmiddle_value;
            }
        } elseif ('name' == $element_type) {
            //Extended Name - 4 elements
            $name_value = trim($entry_data['element_' . $element_id . '_1'] . ' ' . $entry_data['element_' . $element_id . '_2'] . ' ' . $entry_data['element_' . $element_id . '_3'] . ' ' . $entry_data['element_' . $element_id . '_4']);
            if (!empty($name_value)) {
                $entry_details[$i]['value'] = $name_value;
            }
        } elseif ('name_wmiddle' == $element_type) {
            //Extended Name  with Middle- 5 elements
            $name_wmiddle_value = trim($entry_data['element_' . $element_id . '_1'] . ' ' . $entry_data['element_' . $element_id . '_2'] . ' ' . $entry_data['element_' . $element_id . '_3'] . ' ' . $entry_data['element_' . $element_id . '_4'] . ' ' . $entry_data['element_' . $element_id . '_5']);
            if (!empty($name_wmiddle_value)) {
                $entry_details[$i]['value'] = $name_wmiddle_value;
//.........这里部分代码省略.........
开发者ID:habb0,项目名称:HabboPHP,代码行数:101,代码来源:entry-functions.php

示例7: 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 = '&#36;';
    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";
                        }
                    }
//.........这里部分代码省略.........
开发者ID:janssit,项目名称:machform.janss.be,代码行数:101,代码来源:view-functions.php

示例8: mf_send_login_info

function mf_send_login_info($dbh, $user_id, $password)
{
    global $mf_lang;
    //get settings first
    $mf_settings = mf_get_settings($dbh);
    //get user information
    $query = "select user_fullname,user_email from " . MF_TABLE_PREFIX . "users where user_id=? and `status`=1";
    $params = array($user_id);
    $sth = mf_do_query($query, $params, $dbh);
    $row = mf_do_fetch_result($sth);
    $user_fullname = $row['user_fullname'];
    $user_email = $row['user_email'];
    $subject = 'Your MachForm login information';
    $email_template = <<<EOT
Hello %s,

You can login to MachForm panel using the following information:

<b>URL:</b> %s

<b>Email:</b> %s
<b>Password:</b> %s

Thank you.
EOT;
    $email_template = nl2br($email_template);
    $email_content = sprintf($email_template, $user_fullname, $mf_settings['base_url'], $user_email, $password);
    $subject = utf8_encode($subject);
    //create the mail transport
    if (!empty($mf_settings['smtp_enable'])) {
        $s_transport = Swift_SmtpTransport::newInstance($mf_settings['smtp_host'], $mf_settings['smtp_port']);
        if (!empty($mf_settings['smtp_secure'])) {
            $s_transport->setEncryption('tls');
        }
        if (!empty($mf_settings['smtp_auth'])) {
            $s_transport->setUsername($mf_settings['smtp_username']);
            $s_transport->setPassword($mf_settings['smtp_password']);
        }
    } else {
        $s_transport = Swift_MailTransport::newInstance();
        //use PHP mail() transport
    }
    //create mailer instance
    $s_mailer = Swift_Mailer::newInstance($s_transport);
    if (file_exists($mf_settings['upload_dir'] . "/form_{$form_id}/files") && is_writable($mf_settings['upload_dir'] . "/form_{$form_id}/files")) {
        Swift_Preferences::getInstance()->setCacheType('disk')->setTempDir($mf_settings['upload_dir'] . "/form_{$form_id}/files");
    } else {
        Swift_Preferences::getInstance()->setCacheType('array');
    }
    $from_name = html_entity_decode($mf_settings['default_from_name'], ENT_QUOTES);
    $from_email = $mf_settings['default_from_email'];
    if (!empty($user_email)) {
        $s_message = Swift_Message::newInstance()->setCharset('utf-8')->setMaxLineLength(1000)->setSubject($subject)->setFrom(array($from_email => $from_name))->setSender($from_email)->setReturnPath($from_email)->setTo($user_email)->setBody($email_content, 'text/html');
        //send the message
        $send_result = $s_mailer->send($s_message);
        if (empty($send_result)) {
            echo "Error sending email!";
        }
    }
}
开发者ID:janssit,项目名称:machform.janss.be,代码行数:60,代码来源:helper-functions.php

示例9: 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;
//.........这里部分代码省略.........
开发者ID:janssit,项目名称:machform.janss.be,代码行数:101,代码来源:setup-functions.php


注:本文中的mf_get_settings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。