Beispiel #1
0
/**
 * Add cf7skins classes to the CF7 HTML form class
 * 
 * Based on selected template & style
 * eg. class="wpcf7-form cf7t-fieldset cf7s-wild-west"
 * 
 * @uses 'wpcf7_form_class_attr' filter in WPCF7_ContactForm->form_html()
 * @uses wpcf7_get_current_contact_form()
 * @file wp-content\plugins\contact-form-7\includes\contact-form.php
 * 
 * @param $class is the CF7 HTML form class
 * @since 0.0.1
 */
function form_class_attr($class, $id)
{
    // Get the current CF7 form ID
    $cf7 = wpcf7_get_current_contact_form();
    // Current contact form 7 object
    $form_id = get_form_id($cf7);
    $template_class = '';
    $cf7_style_id = get_post_meta($form_id, 'cf7_style_id');
    if (isset($cf7_style_id[0])) {
        $cf7_style_data = get_post($cf7_style_id[0], OBJECT);
        if (has_term('custom-style', 'style_category', $cf7_style_data)) {
            $template_class = "cf7-style-" . $cf7_style_id[0];
        } else {
            $template_class = $cf7_style_data->post_name;
        }
    }
    // Return the modified class
    return $template_class;
}
Beispiel #2
0
function prefs_smarty_show($user_id)
{
    assert(is_numeric($user_id));
    global $_RUN;
    global $_USER;
    $template = new Smarty();
    help_set_template_vars($template, "PREFERENCES");
    $template->debugging = true;
    $result = sql_query("SELECT * FROM perihelion.t_themes");
    while ($row = sql_fetchrow($result)) {
        $tmpvar['ids'][] = $row['id'];
        $tmpvar['names'][] = $row['name'];
    }
    $template->assign("themes_ids", $tmpvar['ids']);
    $template->assign("themes_names", $tmpvar['names']);
    $user = user_get_perihelion_user($_USER['id']);
    if (SmartyValidate::is_init()) {
        $template->assign($_POST);
    } else {
        SmartyValidate::init();
        SmartyValidate::register_criteria("validate_email_is_ours_or_does_not_exists");
        SmartyValidate::register_criteria("validate_passwd");
        $template->assign("name", $user['name']);
        $template->assign("email", $user['email']);
        $template->assign("inform", $user['inform']);
        $template->assign("gender", $user['gender']);
        $template->assign("country", $user['country']);
        $template->assign("city", $user['city']);
        $template->assign("tag", $user['tag']);
        $tmp = split('-', $user['birthday']);
        $template->assign("dob_Day", $tmp[2]);
        $template->assign("dob_Month", $tmp[1]);
        $template->assign("dob_Year", $tmp[0]);
        $template->assign("theme", $user['theme_id']);
    }
    $template->assign("uid", encrypt_get_vars($user_id));
    $template->assign("cmd", encrypt_get_vars("post"));
    $template->assign("frmid", encrypt_get_vars(get_form_id()));
    $template->display($_RUN['theme_path'] . "/preferences.tpl");
}
function display_form($sub_id)
{
    $form_id = get_form_id($sub_id);
    if ($form_id != -1) {
        // set session variables required by the
        // display_form form
        // note that this has to be done by session
        // variables because when we use the
        // header function, POST variables are
        // NOT transmitted to the php page
        // that we are redirecting to.
        $_SESSION['form_id'] = $form_id;
        $_SESSION['submission_id'] = $sub_id;
        $_SESSION['readonly'] = 'true';
        //header("Location: tng_display_form.php");
        //echo "<META HTTP-EQUIV='Refresh' Content='0; URL=tng_display_form.php'>";
    }
}
                echo "could not extract layer to shapefile";
                return;
            }
            download_file($zip_file, basename($zip_file));
        } else {
            if ($selection_type == "form") {
                // user wishes to view the data (fields)
                // in the form.
                // set session variables required by the
                // display_form form
                // note that this has to be done by session
                // variables because when we use the
                // header function, POST variables are
                // NOT transmitted to the php page
                // that we are redirecting to.
                $_SESSION['form_id'] = get_form_id($id);
                $_SESSION['submission_id'] = $id;
                $_SESSION['readonly'] = 'true';
                header("Location: tng_display_form.php");
            }
        }
    }
}
///
/// download_file()
/// given the path to a file, download that
/// file for the user
///
function download_file($file_path, $file_name)
{
    header("Content-Type: application/octet-stream");