本文整理汇总了PHP中ft_display_page函数的典型用法代码示例。如果您正苦于以下问题:PHP ft_display_page函数的具体用法?PHP ft_display_page怎么用?PHP ft_display_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ft_display_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ft_initialize_form
/**
* Called by test form submission during form setup procedure. This stores a complete form submission
* in the database for examination and pruning by the administrator. Error / notification messages are
* displayed in the language of the currently logged in administrator.
*
* It works with both submissions sent through process.php and the API.
*
* @param array $form_data a hash of the COMPLETE form data (i.e. all fields)
*/
function ft_initialize_form($form_data)
{
global $g_table_prefix, $g_root_dir, $g_multi_val_delimiter, $LANG, $g_default_datetime_format;
$textbox_field_type_id = ft_get_field_type_id_by_identifier("textbox");
$date_field_type_id = ft_get_field_type_id_by_identifier("date");
$date_field_type_datetime_setting_id = ft_get_field_type_setting_id_by_identifier($date_field_type_id, "display_format");
$date_field_type_timezone_setting_id = ft_get_field_type_setting_id_by_identifier($date_field_type_id, "apply_timezone_offset");
$display_notification_page = isset($form_data["form_tools_display_notification_page"]) ? $form_data["form_tools_display_notification_page"] : true;
// escape the incoming values
$form_data = ft_sanitize($form_data);
$form_id = $form_data["form_tools_form_id"];
// check the form ID is valid
if (!ft_check_form_exists($form_id, true)) {
$page_vars = array("message_type" => "error", "error_code" => 100);
ft_display_page("error.tpl", $page_vars);
exit;
}
$form_info = ft_get_form($form_id, true);
// if this form has already been completed, exit with an error message
if ($form_info["is_complete"] == "yes") {
$page_vars = array("message_type" => "error", "error_code" => 101);
ft_display_page("error.tpl", $page_vars);
exit;
}
// since this form is still incomplete, remove any old records from form_fields concerning this form
$query = mysql_query("\n DELETE FROM {$g_table_prefix}form_fields\n WHERE form_id = {$form_id}\n ");
// remove irrelevant key-values
unset($form_data["form_tools_initialize_form"]);
unset($form_data["form_tools_submission_id"]);
unset($form_data["form_tools_form_id"]);
unset($form_data["form_tools_display_notification_page"]);
$order = 1;
// add the submission ID system field ("ID" can be changed by the user via the interface)
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_test_value, field_type_id, is_system_field,\n data_type, field_title, col_name, list_order, is_new_sort_group)\n VALUES ({$form_id}, 'core__submission_id', '', {$textbox_field_type_id}, 'yes', 'number', '{$LANG["word_id"]}',\n 'submission_id', '{$order}', 'yes')\n ");
if (!$query) {
$page_vars = array("message_type" => "error", "error_code" => 102, "error_type" => "system", "debugging" => "<b>" . __FUNCTION__ . ", " . __FILE__ . "</b>, failed query: " . mysql_error());
ft_display_page("error.tpl", $page_vars);
exit;
}
$order++;
while (list($key, $value) = each($form_data)) {
// if the value is an array, it's either a checkbox field or a multi-select field. Just
// comma-separate them
if (is_array($value)) {
$value = join("{$g_multi_val_delimiter}", $value);
}
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_type_id, is_system_field,\n field_test_value, data_type, list_order, is_new_sort_group)\n VALUES ({$form_id}, '{$key}', 1, 'no', '{$value}', 'string', '{$order}', 'yes')\n ");
if (!$query) {
$page_vars = array("message_type" => "error", "error_code" => 103, "error_type" => "system", "debugging" => "<b>" . __FUNCTION__ . ", " . __FILE__ . "</b>, failed query: " . mysql_error());
ft_display_page("error.tpl", $page_vars);
exit;
}
$order++;
}
// now see if any files were uploaded, too. ** don't actually upload the file, just allocate a
// spot for the filename string in the database. The user will have to configure the field settings
// later
while (list($key, $fileinfo) = each($_FILES)) {
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_type_id, is_system_field,\n field_test_value, data_type, list_order)\n VALUES ({$form_id}, '{$key}', 8, 'no', '{$LANG["word_file_b_uc"]}', 'string', '{$order}')\n ");
if (!$query) {
$page_vars = array("message_type" => "error", "error_code" => 104, "error_type" => "system", "debugging" => "<b>" . __FUNCTION__ . ", " . __FILE__ . "</b>, failed query: " . mysql_error());
ft_display_page("error.tpl", $page_vars);
exit;
}
$order++;
}
// add the Submission Date, Last Modified Date and IP Address system fields. For the date fields, we also
// add in a custom formatting to display the full datetime. This is because the default date formatting is date only -
// I think that's probably going to be more useful as a default than a datetime - hence the extra work here
// submission date
$order1 = $order;
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_test_value, field_type_id, is_system_field,\n field_title, data_type, col_name, list_order)\n VALUES ({$form_id}, 'core__submission_date', '', {$date_field_type_id}, 'yes', '{$LANG["word_date"]}',\n 'date', 'submission_date', '{$order1}')\n ");
$submission_date_field_id = mysql_insert_id();
mysql_query("\n INSERT INTO {$g_table_prefix}field_settings (field_id, setting_id, setting_value)\n VALUES ({$submission_date_field_id}, {$date_field_type_datetime_setting_id}, '{$g_default_datetime_format}')\n ");
mysql_query("\n INSERT INTO {$g_table_prefix}field_settings (field_id, setting_id, setting_value)\n VALUES ({$submission_date_field_id}, {$date_field_type_timezone_setting_id}, 'yes')\n ");
// last modified date
$order2 = $order + 1;
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_test_value, field_type_id, is_system_field,\n field_title, data_type, col_name, list_order)\n VALUES ({$form_id}, 'core__last_modified', '', {$date_field_type_id}, 'yes', '{$LANG["phrase_last_modified"]}',\n 'date', 'last_modified_date', '{$order2}')\n ");
$last_modified_date_field_id = mysql_insert_id();
mysql_query("\n INSERT INTO {$g_table_prefix}field_settings (field_id, setting_id, setting_value)\n VALUES ({$last_modified_date_field_id}, {$date_field_type_datetime_setting_id}, '{$g_default_datetime_format}')\n ");
mysql_query("\n INSERT INTO {$g_table_prefix}field_settings (field_id, setting_id, setting_value)\n VALUES ({$last_modified_date_field_id}, {$date_field_type_timezone_setting_id}, 'yes')\n ");
// ip address
$order3 = $order + 2;
$query = mysql_query("\n INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_test_value, field_type_id, is_system_field,\n field_title, data_type, col_name, list_order)\n VALUES ({$form_id}, 'core__ip_address', '', {$textbox_field_type_id}, 'yes', '{$LANG["phrase_ip_address"]}',\n 'number', 'ip_address', '{$order3}')\n ");
if (!$query) {
$page_vars = array("message_type" => "error", "error_code" => 105, "error_type" => "system", "debugging" => "<b>" . __FUNCTION__ . ", " . __FILE__ . "</b>, failed query: " . mysql_error());
ft_display_page("error.tpl", $page_vars);
exit;
}
// finally, set this form's "is_initialized" value to "yes", so the administrator can proceed to
// the next step of the Add Form process.
//.........这里部分代码省略.........
示例2: foreach
foreach ($updated_modules as $module_info) {
// we can rely on these guys being returned first
if ($module_info["is_installed"] == "no") {
$sorted_modules[] = $module_info;
} else {
if ($module_info["needs_upgrading"]) {
$sorted_modules[] = $module_info;
} else {
$installed_modules[] = $module_info;
}
}
}
$modules = array_merge($sorted_modules, $installed_modules);
// ------------------------------------------------------------------------------------------
// compile header information
$page_vars = array();
$page_vars["page"] = "modules";
$page_vars["page_url"] = ft_get_page_url("modules");
$page_vars["head_title"] = $LANG["word_modules"];
$page_vars["modules"] = $modules;
$page_vars["num_modules"] = $num_modules;
$page_vars["order"] = $order;
$page_vars["search_criteria"] = $search_criteria;
$page_vars["module_ids_in_page"] = $module_ids_in_page;
$page_vars["pagination"] = ft_get_dhtml_page_nav(count($modules), $_SESSION["ft"]["settings"]["num_modules_per_page"], 1);
$page_vars["js_messages"] = array("validation_modules_search_no_status", "phrase_please_enter_license_key", "word_yes", "word_no", "phrase_please_confirm", "confirm_uninstall_module", "word_close", "word_verify", "notify_invalid_license_key", "notify_license_key_no_longer_valid", "notify_unknown_error");
$page_vars["head_string"] = <<<END
<script src="../../global/scripts/manage_modules.js"></script>
END;
ft_display_page("admin/modules/index.tpl", $page_vars);
示例3: function
ms.num_results_per_page = {$results_per_page};
\$(function() {
ms.init_submissions_page();
if (\$("#search_field").length) {
ms.change_search_field(\$("#search_field").val());
\$("#search_field").bind("keyup change", function() {
ms.change_search_field(this.value);
});
}
if (\$("#search_date").length) {
\$("#search_date").daterangepicker({
dateFormat: "{$date_field_search_js_format}",
doneButtonText: "{$LANG["word_done"]}",
presetRanges: [
{text: '{$LANG["word_today"]}', dateStart: 'today', dateEnd: 'today' },
{text: '{$LANG["phrase_last_7_days"]}', dateStart: 'today-7days', dateEnd: 'today' },
{text: '{$LANG["phrase_month_to_date"]}', dateStart: function(){ return Date.parse('today').moveToFirstDayOfMonth(); }, dateEnd: 'today' },
{text: '{$LANG["phrase_year_to_date"]}', dateStart: function(){ var x= Date.parse('today'); x.setMonth(0); x.setDate(1); return x; }, dateEnd: 'today' },
{text: '{$LANG["phrase_the_previous_month"]}', dateStart: function(){ return Date.parse('1 month ago').moveToFirstDayOfMonth(); }, dateEnd: function(){ return Date.parse('1 month ago').moveToLastDayOfMonth(); } }
],
datepickerOptions: {
changeYear: true,
changeMonth: true
}
});
}
});
END;
ft_display_page("admin/forms/submissions.tpl", $page_vars);
示例4: list
<?php
if (isset($request["update_main"])) {
list($g_success, $g_message) = ft_update_main_settings($_POST);
}
$page_vars = array();
$page_vars["page"] = "main";
$page_vars["page_url"] = ft_get_page_url("settings_main");
$page_vars["tabs"] = $tabs;
$page_vars["head_title"] = "{$LANG["word_settings"]} - {$LANG["word_main"]}";
$replacement_info = array("datefunctionlink" => '<a href="http://ca3.php.net/manual/en/function.date.php" target="_blank">date()</a>');
$page_vars["text_date_formatting_link"] = ft_eval_smarty_string($LANG["text_date_formatting_link"], $replacement_info);
$page_vars["head_js"] = <<<END
var rules = [];
rules.push("required,program_name,{$LANG["validation_no_program_name"]}");
rules.push("required,num_clients_per_page,{$LANG["validation_no_num_clients_per_page"]}");
rules.push("digits_only,num_clients_per_page,{$LANG["validation_invalid_num_clients_per_page"]}");
rules.push("required,num_emails_per_page,{$LANG["validation_no_num_emails_per_page"]}");
rules.push("digits_only,num_emails_per_page,{$LANG["validation_invalid_num_emails_per_page"]}");
rules.push("required,num_forms_per_page,{$LANG["validation_no_num_forms_per_page"]}");
rules.push("digits_only,num_forms_per_page,{$LANG["validation_invalid_num_forms_per_page"]}");
rules.push("required,num_option_lists_per_page,{$LANG["validation_no_num_option_lists_per_page"]}");
rules.push("digits_only,num_option_lists_per_page,{$LANG["validation_invalid_num_option_lists_per_page"]}");
rules.push("required,num_menus_per_page,{$LANG["validation_no_num_menus_per_page"]}");
rules.push("digits_only,num_menus_per_page,{$LANG["validation_invalid_num_menus_per_page"]}");
rules.push("required,num_modules_per_page,{$LANG["validation_no_num_modules_per_page"]}");
rules.push("digits_only,num_modules_per_page,{$LANG["validation_invalid_num_modules_per_page"]}");
END;
ft_display_page("admin/settings/index.tpl", $page_vars);
示例5: array
$updated_option_lists = array();
foreach ($option_lists as $option_list) {
$list_id = $option_list["list_id"];
// add the number of fields that use this option group
$option_list["num_fields"] = ft_get_num_fields_using_option_list($list_id);
if ($option_list["num_fields"] > 0) {
$option_list["fields"] = ft_get_fields_using_option_list($list_id, array("group_by_form" => true));
}
// add the total number of options in this group
$option_list["num_option_list_options"] = ft_get_num_options_in_option_list($list_id);
$updated_option_lists[] = $option_list;
}
$all_option_lists = ft_get_option_lists("all");
// ------------------------------------------------------------------------------------------------
// compile template info
$page_vars = array();
$page_vars["page"] = "option_lists";
$page_vars["text_option_list_page"] = ft_eval_smarty_string($LANG["text_option_list_page"], array("link" => "../add/step1.php"));
$page_vars["page_url"] = ft_get_page_url("option_lists");
$page_vars["head_title"] = $LANG["phrase_option_lists"];
$page_vars["option_lists"] = $updated_option_lists;
$page_vars["num_option_lists"] = $num_option_lists;
$page_vars["all_option_lists"] = $all_option_lists["results"];
$page_vars["order"] = $order;
$page_vars["js_messages"] = array("validation_delete_non_empty_option_list", "confirm_delete_option_list", "phrase_please_confirm", "word_yes", "word_no", "word_edit", "word_remove");
$page_vars["pagination"] = ft_get_page_nav($num_option_lists, $num_option_lists_per_page, $option_list_page);
$page_vars["head_string"] = <<<END
<script src="{$g_root_url}/global/scripts/manage_option_lists.js"></script>
END;
ft_display_page("admin/forms/option_lists/index.tpl", $page_vars);
示例6: list
<?php
if (isset($request["update_public_form_omit_list"])) {
list($g_success, $g_message) = ft_update_public_form_omit_list($request, $form_id);
}
$form_info = ft_get_form($form_id);
$form_omit_list = ft_get_public_form_omit_list($form_id);
// ------------------------------------------------------------------------------------------------
// a little hacky, but not too bad. Override the form nav links so that it always links to the main tab, not this
// (possibly non-relevant) omit list page
$page_vars["prev_tabset_link"] = !empty($links["prev_form_id"]) ? "edit.php?page=main&form_id={$links["prev_form_id"]}" : "";
$page_vars["next_tabset_link"] = !empty($links["next_form_id"]) ? "edit.php?page=main&form_id={$links["next_form_id"]}" : "";
$page_vars["page"] = "public_form_omit_list";
$page_vars["page_url"] = ft_get_page_url("edit_form_public_form_omit_list", array("form_id" => $form_id));
$page_vars["head_title"] = "{$LANG["phrase_edit_form"]} - {$LANG["phrase_public_form_omit_list"]}";
$page_vars["form_info"] = $form_info;
$page_vars["form_omit_list"] = $form_omit_list;
$page_vars["head_js"] = <<<EOF
var page_ns = {};
page_ns.clear_omit_list = function() \t{
ft.select_all('selected_client_ids[]');
ft.move_options('selected_client_ids[]', 'available_client_ids[]');
}
EOF;
ft_display_page("admin/forms/edit.tpl", $page_vars);
示例7: ft_get_dhtml_page_nav
$page_vars["pagination"] = ft_get_dhtml_page_nav(count($clients), $_SESSION["ft"]["settings"]["num_clients_per_page"], 1);
$page_vars["js_messages"] = array("phrase_delete_row");
$page_vars["head_js"] = <<<END
var page_ns = {};
page_ns.dialog = \$("<div></div>");
page_ns.delete_client = function(account_id) {
ft.create_dialog({
dialog: page_ns.dialog,
title: "{$LANG["phrase_please_confirm"]}",
content: "{$LANG["validation_check_delete_client"]}",
popup_type: "warning",
buttons: [
{
text: "{$LANG["word_yes"]}",
click: function() {
window.location = "index.php?delete=1&client_id=" + account_id;
}
},
{
text: "{$LANG["word_no"]}",
click: function() {
\$(this).dialog("close");
}
}
]
});
return false;
}
END;
ft_display_page("admin/clients/index.tpl", $page_vars);
示例8: ft_eval_smarty_string
$page_vars["required_password_chars"] = $required_password_chars;
$page_vars["password_special_chars"] = $g_password_special_chars;
$page_vars["has_extra_password_requirements"] = !empty($settings["required_password_chars"]) || !empty($settings["min_password_length"]);
$page_vars["has_min_password_length"] = !empty($settings["min_password_length"]);
$page_vars["password_special_char"] = ft_eval_smarty_string($LANG["phrase_password_special_char"], array("chars" => $g_password_special_chars));
$page_vars["phrase_password_min"] = ft_eval_smarty_string($LANG["phrase_password_min"], array("length" => $settings["min_password_length"]));
$page_vars["vals"] = $post_values;
$page_vars["head_js"] = <<<END
var rules = [];
rules.push("required,first_name,{$LANG['validation_no_client_first_name']}");
rules.push("required,last_name,{$LANG['validation_no_client_first_name']}");
rules.push("required,email,{$LANG['validation_no_client_email']}");
rules.push("valid_email,email,{$LANG['validation_invalid_email']}");
rules.push("required,username,{$LANG['validation_no_client_username']}");
rules.push("function,validate_username");
rules.push("required,password,{$LANG['validation_no_client_password']}");
rules.push("same_as,password,password_2,{$LANG['validation_passwords_different']}");
{$conditional_rules}
function validate_username() {
var username = \$("input[name=username]").val();
if (username.match(/[^\\.@a-zA-Z0-9_]/)) {
return [[\$("input[name=username]")[0], "{$LANG['validation_invalid_client_username']}"]];
}
return true;
}
\$(function() { \$("#first_name").focus(); });
END;
ft_display_page("admin/clients/add.tpl", $page_vars);
示例9: function
\$(function() {
ms.init_submissions_page();
ms.change_search_field(\$("#search_field").val());
if (\$("#search_field").length) {
\$("#search_field").bind("keyup change", function() {
ms.change_search_field(this.value);
});
}
if (\$("#search_date").length) {
\$("#search_date").daterangepicker({
dateFormat: "{$date_field_search_js_format}",
doneButtonText: "{$LANG["word_done"]}",
presetRanges: [
{text: '{$LANG["word_today"]}', dateStart: 'today', dateEnd: 'today' },
{text: '{$LANG["phrase_last_7_days"]}', dateStart: 'today-7days', dateEnd: 'today' },
{text: '{$LANG["phrase_month_to_date"]}', dateStart: function(){ return Date.parse('today').moveToFirstDayOfMonth(); }, dateEnd: 'today' },
{text: '{$LANG["phrase_year_to_date"]}', dateStart: function(){ var x= Date.parse('today'); x.setMonth(0); x.setDate(1); return x; }, dateEnd: 'today' },
{text: '{$LANG["phrase_the_previous_month"]}', dateStart: function(){ return Date.parse('1 month ago').moveToFirstDayOfMonth(); }, dateEnd: function(){ return Date.parse('1 month ago').moveToLastDayOfMonth(); } }
],
datepickerOptions: {
changeYear: true,
changeMonth: true
}
});
}
});
END;
ft_display_page("clients/forms/index.tpl", $page_vars);
示例10: validate_swatch
rules.push("function,validate_swatch");
rules.push("required,login_page,{$LANG["validation_no_login_page"]}");
rules.push("required,logout_url,{$LANG["validation_no_account_logout_url"]}");
rules.push("required,ui_language,{$LANG["validation_no_ui_language"]}");
rules.push("required,sessions_timeout,{$LANG["validation_no_sessions_timeout"]}");
rules.push("required,date_format,{$LANG["validation_no_date_format"]}");
rules.push("required,username,{$LANG["validation_no_username"]}");
rules.push("function,validate_username");
rules.push("if:password!=,required,password_2,{$LANG["validation_no_account_password_confirmed"]}");
rules.push("if:password!=,same_as,password,password_2,{$LANG["validation_passwords_different"]}");
function validate_swatch() {
var theme = \$("#theme").val();
var swatch_id = "#" + theme + "_theme_swatches";
if (\$(swatch_id).length > 0 && \$(swatch_id).val() == "") {
return [[\$(swatch_id)[0], "{$LANG["validation_no_theme_swatch"]}"]];
}
return true;
}
function validate_username() {
var username = \$("input[name=username]").val();
if (username.match(/[^\\.@a-zA-Z0-9_]/)) {
return [[\$("input[name=username]")[0], "{$LANG['validation_invalid_admin_username']}"]];
}
return true;
}
\$(function() { document.login_info.first_name.focus(); });
END;
ft_display_page("admin/account/index.tpl", $page_vars);
示例11: list
continue;
}
// if this is a NEW field, we just ignore it here. New fields are only added by updating the main page, not
// via the Edit Field dialog
if (preg_match("/^NEW/", $field_id)) {
continue;
}
list($success, $message) = ft_update_field($form_id, $field_id, $request["data"]["field_{$field_id}"]);
if (!$success) {
$problems[] = array("field_id" => $field_id, "error" => $message);
}
}
if (!empty($problems)) {
$problems_json = ft_convert_to_json($problems);
echo "{ \"success\": \"0\", \"problems\": {$problems_json}{$return_str} }";
} else {
echo "{ \"success\": \"1\"{$return_str} }";
}
break;
// used to return a page outlining all the form field placeholders available
// used to return a page outlining all the form field placeholders available
case "get_form_field_placeholders":
$form_id = $request["form_id"];
$text_reference_tab_info = ft_eval_smarty_string($LANG["text_reference_tab_info"], array("g_root_url" => $g_root_url));
$page_vars = array();
$page_vars["form_id"] = $form_id;
$page_vars["form_fields"] = ft_get_form_fields($form_id, array("include_field_type_info" => true));
$page_vars["text_reference_tab_info"] = $text_reference_tab_info;
ft_display_page("admin/forms/form_placeholders.tpl", $page_vars);
break;
}
示例12: ft_api_get_submission
/**
* Returns all information about a submission. N.B. Would have been nice to have made this just a
* wrapper for ft_get_submission_info, but that function contains hooks. Need to revise all core
* code to allow external calls to optionally avoid any hook calls.
*
* @param integer $form_id
* @param integer $submission_id
*/
function ft_api_get_submission($form_id, $submission_id)
{
global $g_table_prefix, $g_api_debug;
// confirm the form is valid
if (!ft_check_form_exists($form_id)) {
if ($g_api_debug) {
$page_vars = array("message_type" => "error", "error_code" => 405, "error_type" => "user");
ft_display_page("error.tpl", $page_vars);
exit;
} else {
return array(false, 405);
}
}
if (!is_numeric($submission_id)) {
if ($g_api_debug) {
$page_vars = array("message_type" => "error", "error_code" => 406, "error_type" => "user");
ft_display_page("error.tpl", $page_vars);
exit;
} else {
return array(false, 406);
}
}
// get the form submission info
$submission_info = mysql_query("\n SELECT *\n FROM {$g_table_prefix}form_{$form_id}\n WHERE submission_id = {$submission_id}\n ");
$submission = mysql_fetch_assoc($submission_info);
return $submission;
}
示例13: ft_check_permission
<?php
require "../../global/session_start.php";
ft_check_permission("admin");
$request = array_merge($_POST, $_GET);
$theme_id = isset($request["theme_id"]) ? $request["theme_id"] : "";
if (empty($theme_id)) {
header("location: index.php");
exit;
}
$theme_info = ft_get_theme($theme_id);
// if this theme uses swatches, generate a list of all available swatches
if ($theme_info["uses_swatches"] == "yes") {
$theme_info["available_swatches"] = ft_get_theme_swatch_list($theme_info["swatches"]);
}
// compile header information
$page_vars = array();
$page_vars["page"] = "themes_about";
$page_vars["page_url"] = ft_get_page_url("themes_about");
$page_vars["head_title"] = "{$LANG["word_themes"]} - {$LANG["word_about"]}";
$page_vars["theme_info"] = $theme_info;
ft_display_page("admin/themes/about.tpl", $page_vars);
示例14: ft_process_form
/**
* This function processes the form submissions, after the form has been set up in the database.
*/
function ft_process_form($form_data)
{
global $g_table_prefix, $g_multi_val_delimiter, $g_query_str_multi_val_separator, $g_root_dir, $LANG, $g_api_version, $g_api_recaptcha_private_key;
// ensure the incoming values are escaped
$form_data = ft_sanitize($form_data);
$form_id = $form_data["form_tools_form_id"];
$form_info = ft_get_form($form_id);
// do we have a form for this id?
if (!ft_check_form_exists($form_id)) {
$page_vars = array("message_type" => "error", "message" => $LANG["processing_invalid_form_id"]);
ft_display_page("error.tpl", $page_vars);
exit;
}
extract(ft_process_hook_calls("start", compact("form_info", "form_id", "form_data"), array("form_data")), EXTR_OVERWRITE);
// check to see if this form has been completely set up
if ($form_info["is_complete"] == "no") {
$page_vars = array("message_type" => "error", "message" => $LANG["processing_form_incomplete"]);
ft_display_page("error.tpl", $page_vars);
exit;
}
// check to see if this form has been disabled
if ($form_info["is_active"] == "no") {
if (isset($form_data["form_tools_inactive_form_redirect_url"])) {
header("location: {$form_data["form_tools_inactive_form_redirect_url"]}");
exit;
}
$page_vars = array("message_type" => "error", "message" => $LANG["processing_form_disabled"]);
ft_display_page("error.tpl", $page_vars);
exit;
}
// do we have a form for this id?
if (!ft_check_form_exists($form_id)) {
$page_vars = array("message_type" => "error", "message" => $LANG["processing_invalid_form_id"]);
ft_display_page("error.tpl", $page_vars);
exit;
}
// was there a reCAPTCHA response? If so, a recaptcha was just submitted. This generally implies the
// form page included the API, so check it was entered correctly. If not, return the user to the webpage
if (isset($g_api_version) && isset($form_data["recaptcha_response_field"])) {
$passes_captcha = false;
$recaptcha_challenge_field = $form_data["recaptcha_challenge_field"];
$recaptcha_response_field = $form_data["recaptcha_response_field"];
$folder = dirname(__FILE__);
require_once "{$folder}/global/api/recaptchalib.php";
$resp = recaptcha_check_answer($g_api_recaptcha_private_key, $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field);
if ($resp->is_valid) {
$passes_captcha = true;
} else {
// since we need to pass all the info back to the form page we do it by storing the data in sessions. Enable 'em.
@ft_api_start_sessions();
$_SESSION["form_tools_form_data"] = $form_data;
$_SESSION["form_tools_form_data"]["api_recaptcha_error"] = $resp->error;
// if there's a form_tools_form_url specified, redirect to that
if (isset($form_data["form_tools_form_url"])) {
header("location: {$form_data["form_tools_form_url"]}");
exit;
} else {
if (isset($_SERVER["HTTP_REFERER"])) {
header("location: {$_SERVER["HTTP_REFERER"]}");
exit;
} else {
$page_vars = array("message_type" => "error", "message" => $LANG["processing_no_form_url_for_recaptcha"]);
ft_display_page("error.tpl", $page_vars);
exit;
}
}
}
}
// get a list of the custom form fields (i.e. non-system) for this form
$form_fields = ft_get_form_fields($form_id, array("include_field_type_info" => true));
$custom_form_fields = array();
$file_fields = array();
foreach ($form_fields as $field_info) {
$field_id = $field_info["field_id"];
$is_system_field = $field_info["is_system_field"];
$field_name = $field_info["field_name"];
// ignore system fields
if ($is_system_field == "yes") {
continue;
}
if ($field_info["is_file_field"] == "no") {
$custom_form_fields[$field_name] = array("field_id" => $field_id, "col_name" => $field_info["col_name"], "field_title" => $field_info["field_title"], "include_on_redirect" => $field_info["include_on_redirect"], "field_type_id" => $field_info["field_type_id"], "is_date_field" => $field_info["is_date_field"]);
} else {
$file_fields[] = array("field_id" => $field_id, "field_info" => $field_info);
}
}
// now examine the contents of the POST/GET submission and get a list of those fields
// which we're going to update
$valid_form_fields = array();
while (list($form_field, $value) = each($form_data)) {
// if this field is included, store the value for adding to DB
if (array_key_exists($form_field, $custom_form_fields)) {
$curr_form_field = $custom_form_fields[$form_field];
$cleaned_value = $value;
if (is_array($value)) {
if ($form_info["submission_strip_tags"] == "yes") {
for ($i = 0; $i < count($value); $i++) {
//.........这里部分代码省略.........
示例15: validate_swatch
$js[] = "rules.push(\"function,validate_swatch\")";
}
if ($client_info["settings"]["may_edit_logout_url"] == "yes") {
$js[] = "rules.push(\"required,logout_url,{$LANG["validation_no_logout_url"]}\")";
}
if ($client_info["settings"]["may_edit_language"] == "yes") {
$js[] = "rules.push(\"required,ui_language,{$LANG["validation_no_ui_language"]}\")";
}
if ($client_info["settings"]["may_edit_timezone_offset"] == "yes") {
$js[] = "rules.push(\"required,timezone_offset,{$LANG["validation_no_timezone_offset"]}\")";
}
if ($client_info["settings"]["may_edit_sessions_timeout"] == "yes") {
$js[] = "rules.push(\"required,sessions_timeout,{$LANG["validation_no_sessions_timeout"]}\")";
$js[] = "rules.push(\"digits_only,sessions_timeout,{$LANG["validation_invalid_sessions_timeout"]}\")";
}
if ($client_info["settings"]["may_edit_date_format"] == "yes") {
$js[] = "rules.push(\"required,date_format,{$LANG["validation_no_date_format"]}\")";
}
$js[] = <<<END
function validate_swatch() {
var theme = \$("#theme").val();
var swatch_id = "#" + theme + "_theme_swatches";
if (\$(swatch_id).length > 0 && \$(swatch_id).val() == "") {
return [[\$(swatch_id)[0], "{$LANG["validation_no_theme_swatch"]}"]];
}
return true;
}
END;
$page_vars["head_js"] = implode(";\n", $js);
ft_display_page("clients/account/index.tpl", $page_vars);