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


PHP ft_get_settings函数代码示例

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


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

示例1: smarty_function_languages_dropdown

function smarty_function_languages_dropdown($params, &$smarty)
{
    global $LANG;
    if (empty($params["name_id"])) {
        $smarty->trigger_error("assign: missing 'name_id' parameter. This is used to give the select field a name and id value.");
        return;
    }
    $default_value = isset($params["default"]) ? $params["default"] : "";
    $onchange = isset($params["onchange"]) ? $params["onchange"] : "";
    $attributes = array("id" => $params["name_id"], "name" => $params["name_id"], "onchange" => $onchange);
    $attribute_str = "";
    while (list($key, $value) = each($attributes)) {
        if (!empty($value)) {
            $attribute_str .= " {$key}=\"{$value}\"";
        }
    }
    $available_language_info = ft_get_settings("available_languages");
    $available_language_arr = explode("|", $available_language_info);
    $html = "<select {$attribute_str}>\n\t           <option value=\"\">{$LANG["phrase_please_select"]}</option>";
    foreach ($available_language_arr as $lang_info) {
        list($lang_file, $lang_display) = explode(",", $lang_info);
        $selected = $default_value == $lang_file ? "selected" : "";
        $html .= "<option value=\"{$lang_file}\" {$selected}>{$lang_display}</option>\n";
    }
    $html .= "</select>";
    return $html;
}
开发者ID:jdearaujo,项目名称:core,代码行数:27,代码来源:function.languages_dropdown.php

示例2: ft_eval_smarty_string

$placeholders["export_group_name"] = ft_eval_smarty_string($export_group_info["group_name"]);
$placeholders["export_types"] = $export_types;
$placeholders["export_type_smarty_template"] = $export_type_smarty_template;
$page = ft_eval_smarty_string($template, $placeholders);
if ($export_group_info["action"] == "new_window" || $export_group_info["action"] == "popup") {
    // if required, send the HTTP headers
    if (!empty($export_group_info["headers"])) {
        $headers = preg_replace("/\r\n|\r/", "\n", $export_group_info["headers"]);
        $header_lines = explode("\n", $headers);
        foreach ($header_lines as $header) {
            header(ft_eval_smarty_string($header, $placeholders));
        }
    }
    echo $page;
} else {
    $settings = ft_get_settings("", "export_manager");
    $file_upload_dir = $settings["file_upload_dir"];
    $file_upload_url = $settings["file_upload_url"];
    $file = "{$file_upload_dir}/{$placeholders["filename"]}";
    if ($handle = @fopen($file, "w")) {
        fwrite($handle, $page);
        fclose($handle);
        @chmod($file, 0777);
        $placeholders = array("url" => "{$file_upload_url}/{$placeholders["filename"]}");
        $message = ft_eval_smarty_string($LANG["export_manager"]["notify_file_generated"], $placeholders);
        echo "{ \"success\": 1, \"message\": \"{$message}\", \"target_message_id\": \"ft_message\" }";
        exit;
    } else {
        $placeholders = array("url" => "{$file_upload_url}/{$placeholders["filename"]}", "folder" => $file_upload_dir, "export_manager_settings_link" => "{$g_root_url}/modules/export_manager/settings.php");
        $message = ft_eval_smarty_string($LANG["export_manager"]["notify_file_not_generated"], $placeholders);
        echo "{ \"success\": 0, \"message\": \"{$message}\", \"target_message_id\": \"ft_message\" }";
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:export.php

示例3: array

     } else {
         $params = array("\"success\": \"1\"");
         $count = 1;
         foreach ($uploaded_file_info as $url) {
             $params[] = "\"url_{$count}\": \"{$url}\"";
             $count++;
         }
         echo "{ " . implode(", ", $params) . " }";
     }
     break;
     // used on Edit Field Options pages. It uploads the files to the /upload folder and returns the filenames (renamed
     // & stored in sessions). That information is then used by the JS to load and process the page content
 // used on Edit Field Options pages. It uploads the files to the /upload folder and returns the filenames (renamed
 // & stored in sessions). That information is then used by the JS to load and process the page content
 case "upload_scraped_page_for_smart_fill":
     $settings = ft_get_settings(array("file_upload_dir", "file_upload_url"), "core");
     $file_upload_dir = $settings["file_upload_dir"];
     $file_upload_url = $settings["file_upload_url"];
     $upload_tmp_file_prefix = "ft_sf_tmp_";
     if (!isset($_SESSION["ft"]["smart_fill_tmp_uploaded_files"])) {
         $_SESSION["ft"]["smart_fill_tmp_uploaded_files"] = array();
     }
     $uploaded_file_info = array();
     $error = false;
     if (!isset($_FILES["form_page_1"])) {
         continue;
     }
     $filename = $upload_tmp_file_prefix . $_FILES["form_page_1"]["name"];
     $tmp_location = $_FILES["form_page_1"]["tmp_name"];
     list($g_success, $g_message, $final_filename) = ft_upload_file($file_upload_dir, $filename, $tmp_location);
     if ($g_success) {
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:actions.php

示例4: implode

}
$preselected_subids_str = implode(",", $preselected_subids);
$field_types = ft_get_field_types(true);
$has_searchable_field = false;
foreach ($view_info["fields"] as $field_info) {
    if ($field_info["is_searchable"] == "yes") {
        $has_searchable_field = true;
        break;
    }
}
$settings = ft_get_settings("", "core");
$date_picker_info = ft_get_default_date_field_search_value($settings["default_date_field_search_value"]);
$default_date_field_search_value = $date_picker_info["default_date_field_search_value"];
$date_field_search_js_format = $date_picker_info["date_field_search_js_format"];
// get all the shared resources
$shared_resources_list = ft_get_settings("edit_submission_onload_resources");
$shared_resources_array = explode("|", $shared_resources_list);
$shared_resources = "";
foreach ($shared_resources_array as $resource) {
    $shared_resources .= ft_eval_smarty_string($resource, array("g_root_url" => $g_root_url)) . "\n";
}
// ------------------------------------------------------------------------------------------------
// compile the header information
$page_vars = array();
$page_vars["page"] = "client_forms";
$page_vars["page_url"] = ft_get_page_url("client_form_submissions", array("form_id" => $form_id));
$page_vars["head_title"] = $LANG["word_submissions"];
$page_vars["form_info"] = $form_info;
$page_vars["form_id"] = $form_id;
$page_vars["view_id"] = $view_id;
$page_vars["search_rows"] = $search_rows;
开发者ID:jdearaujo,项目名称:core,代码行数:31,代码来源:index.php

示例5: smarty_function_edit_custom_field

/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.edit_custom_field
 * Type:     function
 * Name:     edit_custom_field
 * Purpose:  This is used on the Edit Submission pages. It does all the clever stuff needed to generate the
 *           actual markup for a single field, with whatever user-defined settings have been employed.
 *
 *           It's strongly coupled to the ft_get_grouped_view_fields function (when called with the form ID &
 *           submission ID params) to ensure that all data is efficiently returned for use by this function.
 * -------------------------------------------------------------
 */
function smarty_function_edit_custom_field($params, &$smarty)
{
    global $LANG, $g_root_url, $g_root_dir, $g_multi_val_delimiter, $g_table_prefix;
    if (empty($params["form_id"])) {
        $smarty->trigger_error("assign: missing 'form_id' parameter.");
        return;
    }
    if (empty($params["field_info"])) {
        $smarty->trigger_error("assign: missing 'field_info' parameter.");
        return;
    }
    if (empty($params["field_types"])) {
        $smarty->trigger_error("assign: missing 'field_types' parameter.");
        return;
    }
    if (empty($params["settings"])) {
        $smarty->trigger_error("assign: missing 'settings' parameter.");
        return;
    }
    $form_id = $params["form_id"];
    $field_info = $params["field_info"];
    $field_types = $params["field_types"];
    $settings = $params["settings"];
    $submission_id = isset($params["submission_id"]) ? $params["submission_id"] : "";
    // loop through the field types and store the one we're interested in in $field_type_info
    $field_type_info = array();
    foreach ($field_types as $curr_field_type) {
        if ($field_info["field_type_id"] == $curr_field_type["field_type_id"]) {
            $field_type_info = $curr_field_type;
            break;
        }
    }
    if ($field_info["is_editable"] == "no") {
        $markup_with_placeholders = trim($field_type_info["view_field_smarty_markup"]);
        if (empty($markup_with_placeholders)) {
            echo $field_info["submission_info"]["value"];
            return;
        }
    } else {
        $markup_with_placeholders = $field_type_info["edit_field_smarty_markup"];
    }
    // now construct all available placeholders
    $placeholders = array("FORM_ID" => $form_id, "VIEW_ID" => $field_info["view_id"], "SUBMISSION_ID" => $submission_id, "FIELD_ID" => $field_info["field_id"], "NAME" => $field_info["field_name"], "COLNAME" => $field_info["col_name"], "VALUE" => isset($field_info["submission_value"]) ? $field_info["submission_value"] : "", "SETTINGS" => $settings, "CONTEXTPAGE" => "edit_submission", "ACCOUNT_INFO" => isset($_SESSION["ft"]["account"]) ? $_SESSION["ft"]["account"] : array(), "g_root_url" => $g_root_url, "g_root_dir" => $g_root_dir, "g_multi_val_delimiter" => $g_multi_val_delimiter);
    // add in all field type settings and their replacements
    foreach ($field_type_info["settings"] as $setting_info) {
        $curr_setting_id = $setting_info["setting_id"];
        $curr_setting_field_type = $setting_info["field_type"];
        $default_value_type = $setting_info["default_value_type"];
        $value = $setting_info["default_value"];
        $identifier = $setting_info["field_setting_identifier"];
        foreach ($field_info["field_settings"] as $setting) {
            $found = false;
            while (list($setting_id, $setting_value) = each($setting)) {
                if ($setting_id == $curr_setting_id) {
                    $value = $setting_value;
                    break;
                }
            }
            reset($setting);
            if ($found) {
                break;
            }
        }
        // next, if the setting is dynamic, convert the stored value
        if ($default_value_type == "dynamic") {
            // dynamic setting values should ALWAYS be of the form "setting_name,module_folder/'core'". If they're not, just ignore it
            $parts = explode(",", $value);
            if (count($parts) == 2) {
                $value = ft_get_settings($parts[0], $parts[1]);
            }
        }
        // if this setting type is a dropdown list and $value is non-empty, get the list of options
        if ($curr_setting_field_type == "option_list_or_form_field" && !empty($value)) {
            if (preg_match("/^form_field/", $value)) {
                $value = ft_get_mapped_form_field_data($value);
            } else {
                $value = ft_get_option_list($value);
            }
        }
        $placeholders[$identifier] = $value;
    }
    echo ft_eval_smarty_string($markup_with_placeholders, $placeholders);
}
开发者ID:jdearaujo,项目名称:core,代码行数:96,代码来源:function.edit_custom_field.php

示例6: ft_process_form


//.........这里部分代码省略.........
            $valid_form_fields[$curr_form_field["col_name"]] = "'{$cleaned_value}'";
        }
    }
    $now = ft_get_current_datetime();
    $ip_address = $_SERVER["REMOTE_ADDR"];
    $col_names = array_keys($valid_form_fields);
    $col_names_str = join(", ", $col_names);
    if (!empty($col_names_str)) {
        $col_names_str .= ", ";
    }
    $col_values = array_values($valid_form_fields);
    $col_values_str = join(", ", $col_values);
    if (!empty($col_values_str)) {
        $col_values_str .= ", ";
    }
    // build our query
    $query = "\r\n    INSERT INTO {$g_table_prefix}form_{$form_id} ({$col_names_str} submission_date, last_modified_date, ip_address, is_finalized)\r\n    VALUES ({$col_values_str} '{$now}', '{$now}', '{$ip_address}', 'yes')\r\n           ";
    // add the submission to the database (if form_tools_ignore_submission key isn't set by either the form or a module)
    $submission_id = "";
    if (!isset($form_data["form_tools_ignore_submission"])) {
        $result = mysql_query($query);
        if (!$result) {
            $page_vars = array("message_type" => "error", "error_code" => 304, "error_type" => "system", "debugging" => "Failed query in <b>" . __FUNCTION__ . ", " . __FILE__ . "</b>, line " . __LINE__ . ": <i>" . nl2br($query) . "</i>", mysql_error());
            ft_display_page("error.tpl", $page_vars);
            exit;
        }
        $submission_id = mysql_insert_id();
        extract(ft_process_hook_calls("end", compact("form_id", "submission_id"), array()), EXTR_OVERWRITE);
    }
    $redirect_query_params = array();
    // build the redirect query parameter array
    foreach ($form_fields as $field_info) {
        if ($field_info["include_on_redirect"] == "no" || $field_info["is_file_field"] == "yes") {
            continue;
        }
        switch ($field_info["col_name"]) {
            case "submission_id":
                $redirect_query_params[] = "submission_id={$submission_id}";
                break;
            case "submission_date":
                $settings = ft_get_settings();
                $submission_date_formatted = ft_get_date($settings["default_timezone_offset"], $now, $settings["default_date_format"]);
                $redirect_query_params[] = "submission_date=" . rawurlencode($submission_date_formatted);
                break;
            case "last_modified_date":
                $settings = ft_get_settings();
                $submission_date_formatted = ft_get_date($settings["default_timezone_offset"], $now, $settings["default_date_format"]);
                $redirect_query_params[] = "last_modified_date=" . rawurlencode($submission_date_formatted);
                break;
            case "ip_address":
                $redirect_query_params[] = "ip_address={$ip_address}";
                break;
            default:
                $field_name = $field_info["field_name"];
                // if $value is an array, convert it to a string, separated by $g_query_str_multi_val_separator
                if (isset($form_data[$field_name])) {
                    if (is_array($form_data[$field_name])) {
                        $value_str = join($g_query_str_multi_val_separator, $form_data[$field_name]);
                        $redirect_query_params[] = "{$field_name}=" . rawurlencode($value_str);
                    } else {
                        $redirect_query_params[] = "{$field_name}=" . rawurlencode($form_data[$field_name]);
                    }
                }
                break;
        }
    }
    // only upload files & send emails if we're not ignoring the submission
    if (!isset($form_data["form_tools_ignore_submission"])) {
        // now process any file fields. This is placed after the redirect query param code block above to allow whatever file upload
        // module to append the filename to the query string, if needed
        extract(ft_process_hook_calls("manage_files", compact("form_id", "submission_id", "file_fields", "redirect_query_params"), array("success", "message", "redirect_query_params")), EXTR_OVERWRITE);
        // send any emails
        ft_send_emails("on_submission", $form_id, $submission_id);
    }
    // if the redirect URL has been specified either in the database or as part of the form
    // submission, redirect the user [form submission form_tools_redirect_url value overrides
    // database value]
    if (!empty($form_info["redirect_url"]) || !empty($form_data["form_tools_redirect_url"])) {
        // build redirect query string
        $redirect_url = isset($form_data["form_tools_redirect_url"]) && !empty($form_data["form_tools_redirect_url"]) ? $form_data["form_tools_redirect_url"] : $form_info["redirect_url"];
        $query_str = "";
        if (!empty($redirect_query_params)) {
            $query_str = join("&", $redirect_query_params);
        }
        if (!empty($query_str)) {
            // only include the ? if it's not already there
            if (strpos($redirect_url, "?")) {
                $redirect_url .= "&" . $query_str;
            } else {
                $redirect_url .= "?" . $query_str;
            }
        }
        header("Location: " . $redirect_url);
        exit;
    }
    // the user should never get here! This means that the no redirect URL has been specified
    $page_vars = array("message_type" => "error", "message" => $LANG["processing_no_redirect_url"]);
    ft_display_page("error.tpl", $page_vars);
    exit;
}
开发者ID:jdearaujo,项目名称:core,代码行数:101,代码来源:process.php

示例7: ft_get_current_timezone_offset

/**
 * A helper function to return Form Tool's best guess at the timezone offset. First it checks
 * sessions to see if a person's logged in; if so it uses that. If NOT, it pulls the default
 * timezone offset value from settings.
 *
 * @return string $timezone_offset
 */
function ft_get_current_timezone_offset()
{
    $timezone_offset = "";
    if (isset($_SESSION["ft"]["account"]["timezone_offset"])) {
        $timezone_offset = $_SESSION["ft"]["account"]["timezone_offset"];
    } else {
        $timezone_offset = ft_get_settings("timezone_offset");
    }
    return $timezone_offset;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:17,代码来源:settings.php

示例8: isset

// They need to exactly correspond to the ordering of the search results or they don't make sense
$search = isset($_SESSION["ft"]["current_search"]) ? $_SESSION["ft"]["current_search"] : array();
if (isset($_SESSION["ft"]["new_search"]) && $_SESSION["ft"]["new_search"] == "yes") {
    $searchable_columns = ft_get_view_searchable_fields("", $view_info["fields"]);
    // extract the original search settings and get the list of IDs
    $submission_ids = ft_get_search_submission_ids($form_id, $view_id, $search["results_per_page"], $search["order"], $search["search_fields"], $searchable_columns);
    $_SESSION["ft"]["form_{$form_id}_view_{$view_id}_submissions"] = $submission_ids;
    $_SESSION["ft"]["new_search"] = "no";
}
list($prev_link_html, $search_results_link_html, $next_link_html) = _ft_code_get_link_html($form_id, $view_id, $submission_id, $search["results_per_page"]);
// construct the page label
$submission_placeholders = ft_get_submission_placeholders($form_id, $submission_id);
$edit_submission_page_label = ft_eval_smarty_string($form_info["edit_submission_page_label"], $submission_placeholders);
$validation_js = ft_generate_submission_js_validation($grouped_fields);
// get all the shared resources
$settings = ft_get_settings("", "core");
$shared_resources_list = $settings["edit_submission_onload_resources"];
$shared_resources_array = explode("|", $shared_resources_list);
$shared_resources = "";
foreach ($shared_resources_array as $resource) {
    $shared_resources .= ft_eval_smarty_string($resource, array("g_root_url" => $g_root_url)) . "\n";
}
// ------------------------------------------------------------------------------------------------
// compile the header information
$page_vars = array();
$page_vars["page"] = "admin_edit_submission";
$page_vars["page_url"] = ft_get_page_url("admin_edit_submission");
$page_vars["head_title"] = $edit_submission_page_label;
$page_vars["form_info"] = $form_info;
$page_vars["form_id"] = $form_id;
$page_vars["view_id"] = $view_id;
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:edit_submission.php

示例9: ft_update_admin_account

/**
 * Updates the administrator account. With the addition of the "UI Language" option, this action
 * gets a little more complicated. The problem is that we can't just update the UI language in
 * sessions *within* this function, because by the time this function is called, the appropriate
 * language file is already in memory and being used. So, to get around this problem, the login
 * information form now passes along both the new and old UI languages. If it's different, AFTER
 * this function is called, you need to reset sessions and refresh the page. So be aware that
 * this problem is NOT handled by this function, see:
 *     /admin/accounts/index.php to see how it's solved.
 *
 * @param array $infohash This parameter should be a hash (e.g. $_POST or $_GET) containing the
 *               following keys: first_name, last_name, user_name, password.
 * @param integer $user_id the administrator's user ID
 * @return array [0]: true/false (success / failure)
 *               [1]: message string
 */
function ft_update_admin_account($infohash, $account_id)
{
    global $g_table_prefix, $g_root_url, $LANG;
    $success = true;
    $message = $LANG["notify_account_updated"];
    $infohash = ft_sanitize($infohash);
    extract(ft_process_hook_calls("start", compact("infohash", "account_id"), array("infohash")), EXTR_OVERWRITE);
    $rules = array();
    $rules[] = "required,first_name,{$LANG["validation_no_first_name"]}";
    $rules[] = "required,last_name,{$LANG["validation_no_last_name"]}";
    $rules[] = "required,email,{$LANG["validation_no_email"]}";
    $rules[] = "required,theme,{$LANG["validation_no_theme"]}";
    $rules[] = "required,login_page,{$LANG["validation_no_login_page"]}";
    $rules[] = "required,logout_url,{$LANG["validation_no_account_logout_url"]}";
    $rules[] = "required,ui_language,{$LANG["validation_no_ui_language"]}";
    $rules[] = "required,sessions_timeout,{$LANG["validation_no_sessions_timeout"]}";
    $rules[] = "required,date_format,{$LANG["validation_no_date_format"]}";
    $rules[] = "required,username,{$LANG["validation_no_username"]}";
    $rules[] = "if:password!=,required,password_2,{$LANG["validation_no_account_password_confirmed"]}";
    $rules[] = "if:password!=,same_as,password,password_2,{$LANG["validation_passwords_different"]}";
    $errors = validate_fields($infohash, $rules);
    if (!empty($errors)) {
        $success = false;
        array_walk($errors, create_function('&$el', '$el = "&bull;&nbsp; " . $el;'));
        $message = implode("<br />", $errors);
        return array($success, $message);
    }
    $first_name = $infohash["first_name"];
    $last_name = $infohash["last_name"];
    $email = $infohash["email"];
    $theme = $infohash["theme"];
    $login_page = $infohash["login_page"];
    $logout_url = $infohash["logout_url"];
    $ui_language = $infohash["ui_language"];
    $timezone_offset = $infohash["timezone_offset"];
    $sessions_timeout = $infohash["sessions_timeout"];
    $date_format = $infohash["date_format"];
    $username = $infohash["username"];
    $password = $infohash["password"];
    $swatch = "";
    if (isset($infohash["{$theme}_theme_swatches"])) {
        $swatch = $infohash["{$theme}_theme_swatches"];
    }
    // if the password is defined, md5 it
    $password_sql = !empty($password) ? "password = '" . md5(md5($password)) . "', " : "";
    // check to see if username is already taken
    list($valid_username, $problem) = _ft_is_valid_username($username, $account_id);
    if (!$valid_username) {
        return array(false, $problem);
    }
    $query = "\n      UPDATE  {$g_table_prefix}accounts\n      SET     {$password_sql}\n              first_name = '{$first_name}',\n              last_name = '{$last_name}',\n              email = '{$email}',\n              theme = '{$theme}',\n              swatch = '{$swatch}',\n              login_page = '{$login_page}',\n              logout_url = '{$logout_url}',\n              ui_language = '{$ui_language}',\n              timezone_offset = '{$timezone_offset}',\n              sessions_timeout = '{$sessions_timeout}',\n              date_format = '{$date_format}',\n              username = '{$username}'\n      WHERE   account_id = {$account_id}\n           ";
    mysql_query($query) or ft_handle_error("Failed query in <b>" . __FUNCTION__ . "</b>: <i>{$query}</i>", mysql_error());
    // update the settings
    $_SESSION["ft"]["settings"] = ft_get_settings();
    $_SESSION["ft"]["account"] = ft_get_account_info($account_id);
    $_SESSION["ft"]["account"]["is_logged_in"] = true;
    // if the password just changed, update sessions and empty any temporary password that happens to have been
    // stored
    if (!empty($password)) {
        $_SESSION["ft"]["account"] = ft_get_account_info($account_id);
        $_SESSION["ft"]["account"]["is_logged_in"] = true;
        $_SESSION["ft"]["account"]["password"] = md5(md5($password));
        mysql_query("UPDATE {$g_table_prefix}accounts SET temp_reset_password = NULL where account_id = {$account_id}");
    }
    extract(ft_process_hook_calls("end", compact("infohash", "account_id"), array("success", "message")), EXTR_OVERWRITE);
    return array($success, $message);
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:83,代码来源:administrator.php

示例10: ft_send_password

/**
 * Used by the "forget password?" page to have a client's login information sent to them.
 *
 * @param array $info the $_POST containing a "username" key. That value is used to find the user
 *      account information to email them.
 * @return array [0]: true/false (success / failure)
 *               [1]: message string
 */
function ft_send_password($info)
{
    global $g_root_url, $g_root_dir, $g_table_prefix, $LANG;
    $info = ft_sanitize($info);
    extract(ft_process_hook_calls("start", compact("info"), array("info")), EXTR_OVERWRITE);
    $success = true;
    $message = $LANG["notify_login_info_emailed"];
    if (!isset($info["username"]) || empty($info["username"])) {
        $success = false;
        $message = $LANG["validation_no_username_or_js"];
        return array($success, $message);
    }
    $username = $info["username"];
    $query = mysql_query("\r\n     SELECT *\r\n     FROM   {$g_table_prefix}accounts\r\n     WHERE  username = '{$username}'\r\n          ");
    // not found
    if (!mysql_num_rows($query)) {
        $success = false;
        $message = $LANG["validation_account_not_recognized_info"];
        return array($success, $message);
    }
    $account_info = mysql_fetch_assoc($query);
    $email = $account_info["email"];
    // one final check: confirm the email is defined & valid
    if (empty($email) || !ft_is_valid_email($email)) {
        $success = false;
        $message = $LANG["validation_email_not_found_or_invalid"];
        return array($success, $message);
    }
    $account_id = $account_info["account_id"];
    $username = $account_info["username"];
    $new_password = ft_generate_password();
    $encrypted_password = md5(md5($new_password));
    // update the database with the new password (encrypted). As of 2.1.0 there's a second field to store the
    // temporary generated password, leaving the original password intact. This prevents a situation arising when
    // someone other than the admin / client uses the "Forget Password" feature and invalidates a valid, known password.
    // Any time the user successfully logs in,
    mysql_query("\r\n    UPDATE {$g_table_prefix}accounts\r\n    SET    temp_reset_password = '{$encrypted_password}'\r\n    WHERE  account_id = {$account_id}\r\n      ");
    // now build and sent the email
    // 1. build the email content
    $placeholders = array("login_url" => "{$g_root_url}/?id={$account_id}", "email" => $email, "username" => $username, "new_password" => $new_password);
    $smarty_template_email_content = file_get_contents("{$g_root_dir}/global/emails/forget_password.tpl");
    $email_content = ft_eval_smarty_string($smarty_template_email_content, $placeholders);
    // 2. build the email subject line
    $placeholders = array("program_name" => ft_get_settings("program_name"));
    $smarty_template_email_subject = file_get_contents("{$g_root_dir}/global/emails/forget_password_subject.tpl");
    $email_subject = trim(ft_eval_smarty_string($smarty_template_email_subject, $placeholders));
    // if Swift Mailer is enabled, send the emails with that. In case there's a problem sending the message with
    // Swift, it falls back the default mail() function.
    $swift_mail_error = false;
    $swift_mail_enabled = ft_check_module_enabled("swift_mailer");
    if ($swift_mail_enabled) {
        $sm_settings = ft_get_module_settings("", "swift_mailer");
        if ($sm_settings["swiftmailer_enabled"] == "yes") {
            ft_include_module("swift_mailer");
            // get the admin info. We'll use that info for the "from" and "reply-to" values. Note
            // that we DON'T use that info for the regular mail() function. This is because retrieving
            // the password is important functionality and we don't want to cause problems that could
            // prevent the email being sent. Many servers don't all the 4th headers parameter of the mail()
            // function
            $admin_info = ft_get_admin_info();
            $admin_email = $admin_info["email"];
            $email_info = array();
            $email_info["to"] = array();
            $email_info["to"][] = array("email" => $email);
            $email_info["from"] = array();
            $email_info["from"]["email"] = $admin_email;
            $email_info["subject"] = $email_subject;
            $email_info["text_content"] = $email_content;
            list($success, $sm_message) = swift_send_email($email_info);
            // if the email couldn't be sent, display the appropriate error message. Otherwise
            // the default success message is used
            if (!$success) {
                $swift_mail_error = true;
                $message = $sm_message;
            }
        }
    }
    // if there was an error sending with Swift, or if it wasn't installed, send it by mail()
    if (!$swift_mail_enabled || $swift_mail_error) {
        // send email [note: the double quotes around the email recipient and content are intentional: some systems fail without it]
        if (!@mail("{$email}", $email_subject, $email_content)) {
            $success = false;
            $message = $LANG["notify_email_not_sent"];
            return array($success, $message);
        }
    }
    extract(ft_process_hook_calls("end", compact("success", "message", "info"), array("success", "message")), EXTR_OVERWRITE);
    return array($success, $message);
}
开发者ID:jdearaujo,项目名称:core,代码行数:97,代码来源:accounts.php

示例11: ft_get_submission_placeholders

/**
 * Generates the placeholders for a particular form submission. This is used in the email templates, and here and there
 * for providing placeholder functionality to fields (like the "Edit Submission Label" textfield for a form, where they can
 * enter placeholders populated here).
 *
 * This returns ALL available placeholders for a form, regardless of View.
 *
 * @param integer $form_id
 * @param integer $submission_id
 * @param array $client_info a hash of information about the appropriate user (optional)
 * @return array a hash of placeholders and their replacement values (e.g. $arr["FORMURL"] => 17)
 */
function ft_get_submission_placeholders($form_id, $submission_id, $client_info = "")
{
    global $g_root_url;
    $placeholders = array();
    $settings = ft_get_settings();
    $form_info = ft_get_form($form_id);
    $submission_info = ft_get_submission($form_id, $submission_id);
    $admin_info = ft_get_admin_info();
    $file_field_type_ids = ft_get_file_field_type_ids();
    $field_types = ft_get_field_types(true);
    // now loop through the info stored for this particular submission and for this particular field,
    // add the custom submission responses to the placeholder hash
    $form_field_params = array("include_field_type_info" => true, "include_field_settings" => true, "evaluate_dynamic_settings" => true);
    $form_fields = ft_get_form_fields($form_id, $form_field_params);
    foreach ($submission_info as $field_info) {
        $field_id = $field_info["field_id"];
        $field_name = $field_info["field_name"];
        $field_type_id = $field_info["field_type_id"];
        if ($field_info["is_system_field"] == "no") {
            $placeholders["QUESTION_{$field_name}"] = $field_info["field_title"];
        }
        if (in_array($field_type_id, $file_field_type_ids)) {
            $field_settings = ft_get_field_settings($field_id);
            $placeholders["FILENAME_{$field_name}"] = $field_info["content"];
            $placeholders["FILEURL_{$field_name}"] = "{$field_settings["folder_url"]}/{$field_info["content"]}";
        } else {
            $detailed_field_info = array();
            foreach ($form_fields as $curr_field_info) {
                if ($curr_field_info["field_id"] != $field_id) {
                    continue;
                }
                $detailed_field_info = $curr_field_info;
                break;
            }
            $params = array("form_id" => $form_id, "submission_id" => $submission_id, "value" => $field_info["content"], "field_info" => $detailed_field_info, "field_types" => $field_types, "settings" => $settings, "context" => "email_template");
            $value = ft_generate_viewable_field($params);
            $placeholders["ANSWER_{$field_name}"] = $value;
            // for backward compatibility
            if ($field_name == "core__submission_date") {
                $placeholders["SUBMISSIONDATE"] = $value;
            } else {
                if ($field_name == "core__last_modified") {
                    $placeholders["LASTMODIFIEDDATE"] = $value;
                } else {
                    if ($field_name == "core__ip_address") {
                        $placeholders["IPADDRESS"] = $value;
                    }
                }
            }
        }
    }
    // other misc placeholders
    $placeholders["ADMINEMAIL"] = $admin_info["email"];
    $placeholders["FORMNAME"] = $form_info["form_name"];
    $placeholders["FORMURL"] = $form_info["form_url"];
    $placeholders["SUBMISSIONID"] = $submission_id;
    $placeholders["LOGINURL"] = $g_root_url . "/index.php";
    if (!empty($client_info)) {
        $placeholders["EMAIL"] = $client_info["email"];
        $placeholders["FIRSTNAME"] = $client_info["first_name"];
        $placeholders["LASTNAME"] = $client_info["last_name"];
        $placeholders["COMPANYNAME"] = $client_info["company_name"];
    }
    extract(ft_process_hook_calls("end", compact("placeholders"), array("placeholders")), EXTR_OVERWRITE);
    return $placeholders;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:78,代码来源:general.php

示例12: ft_update_client


//.........这里部分代码省略.........
                array_walk($errors, create_function('&$el', '$el = "&bull;&nbsp; " . $el;'));
                $message = implode("<br />", $errors);
                return array($success, $message);
            }
            $query = "\n          UPDATE  {$g_table_prefix}accounts\n          SET     {$password_clause}\n                  first_name = '{$first_name}',\n                  last_name = '{$last_name}',\n                  username = '{$username}',\n                  email = '{$email}'\n          WHERE   account_id = {$account_id}\n               ";
            if (mysql_query($query)) {
                // if the password wasn't empty, reset the temporary password, in case it was set
                if (!empty($info["password"])) {
                    mysql_query("UPDATE {$g_table_prefix}accounts SET temp_reset_password = NULL where account_id = {$account_id}");
                }
            } else {
                ft_handle_error("Failed query in <b>" . __FUNCTION__ . "</b>: <i>{$query}</i>", mysql_error());
            }
            break;
        case "settings":
            $rules = array();
            if ($client_info["settings"]["may_edit_page_titles"] == "yes") {
                $rules[] = "required,page_titles,{$LANG["validation_no_titles"]}";
            }
            if ($client_info["settings"]["may_edit_theme"] == "yes") {
                $rules[] = "required,theme,{$LANG["validation_no_theme"]}";
            }
            if ($client_info["settings"]["may_edit_logout_url"] == "yes") {
                $rules[] = "required,logout_url,{$LANG["validation_no_logout_url"]}";
            }
            if ($client_info["settings"]["may_edit_language"] == "yes") {
                $rules[] = "required,ui_language,{$LANG["validation_no_ui_language"]}";
            }
            if ($client_info["settings"]["may_edit_timezone_offset"] == "yes") {
                $rules[] = "required,timezone_offset,{$LANG["validation_no_timezone_offset"]}";
            }
            if ($client_info["settings"]["may_edit_sessions_timeout"] == "yes") {
                $rules[] = "required,sessions_timeout,{$LANG["validation_no_sessions_timeout"]}";
                $rules[] = "digits_only,sessions_timeout,{$LANG["validation_invalid_sessions_timeout"]}";
            }
            if ($client_info["settings"]["may_edit_date_format"] == "yes") {
                $rules[] = "required,date_format,{$LANG["validation_no_date_format"]}";
            }
            $errors = validate_fields($info, $rules);
            if (!empty($errors)) {
                $success = false;
                array_walk($errors, create_function('&$el', '$el = "&bull;&nbsp; " . $el;'));
                $message = implode("<br />", $errors);
                return array($success, $message);
            }
            // update the main accounts table. Only update those settings they're ALLOWED to
            $settings = array();
            if ($client_info["settings"]["may_edit_language"] == "yes") {
                $settings["ui_language"] = $info["ui_language"];
            }
            if ($client_info["settings"]["may_edit_timezone_offset"] == "yes") {
                $settings["timezone_offset"] = $info["timezone_offset"];
            }
            if ($client_info["settings"]["may_edit_logout_url"] == "yes") {
                $settings["logout_url"] = $info["logout_url"];
            }
            if ($client_info["settings"]["may_edit_sessions_timeout"] == "yes") {
                $settings["sessions_timeout"] = $info["sessions_timeout"];
            }
            if ($client_info["settings"]["may_edit_theme"] == "yes") {
                $settings["theme"] = $info["theme"];
                $settings["swatch"] = "";
                if (isset($info["{$info["theme"]}_theme_swatches"])) {
                    $settings["swatch"] = $info["{$info["theme"]}_theme_swatches"];
                }
            }
            if ($client_info["settings"]["may_edit_date_format"] == "yes") {
                $settings["date_format"] = $info["date_format"];
            }
            if (!empty($settings)) {
                $sql_rows = array();
                while (list($column, $value) = each($settings)) {
                    $sql_rows[] = "{$column} = '{$value}'";
                }
                $sql = implode(",\n", $sql_rows);
                $query = "\n            UPDATE  {$g_table_prefix}accounts\n            SET     {$sql}\n            WHERE   account_id = {$account_id}\n                 ";
                mysql_query($query) or ft_handle_error("Failed query in <b>" . __FUNCTION__ . "</b>: <i>{$query}</i>", mysql_error());
            }
            $settings = array();
            if (isset($info["page_titles"])) {
                $settings["page_titles"] = $info["page_titles"];
            }
            if (isset($info["footer_text"])) {
                $settings["footer_text"] = $info["footer_text"];
            }
            if (isset($info["max_failed_login_attempts"])) {
                $settings["max_failed_login_attempts"] = $info["max_failed_login_attempts"];
            }
            if (!empty($settings)) {
                ft_set_account_settings($account_id, $settings);
            }
            break;
    }
    extract(ft_process_hook_calls("end", compact("account_id", "info"), array("success", "message")), EXTR_OVERWRITE);
    // update sessions
    $_SESSION["ft"]["settings"] = ft_get_settings();
    $_SESSION["ft"]["account"] = ft_get_account_info($account_id);
    $_SESSION["ft"]["account"]["is_logged_in"] = true;
    return array($success, $message);
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:101,代码来源:clients.php

示例13: ft_api_create_client_account

/**
 * Creates a client account in the database.
 *
 * @param array $account_info this has has 4 required keys: first_name, last_name, user_name, password
 *
 * The password is automatically encrypted by this function.
 *
 * It also accepts the following optional keys:
 *   account_status: "active", "disabled", "pending"
 *   ui_language: (should only be one of the languages currently supported by the script, e.g. "en_us")
 *   timezone_offset: +- an integer value, for each hour
 *   sessions_timeout:
 *   date_format:
 *   login_page:
 *   logout_url:
 *   theme:
 *   menu_id:
 *
 * @return array [0] true / false
 *               [1] an array of error codes (if false) or the new account ID
 */
function ft_api_create_client_account($account_info)
{
    global $g_api_debug, $g_table_prefix;
    $account_info = ft_sanitize($account_info);
    $error_codes = array();
    // check all the valid fields
    if (!isset($account_info["first_name"]) || empty($account_info["first_name"])) {
        $error_codes[] = 700;
    }
    if (!isset($account_info["last_name"]) || empty($account_info["last_name"])) {
        $error_codes[] = 701;
    }
    if (!isset($account_info["email"]) || empty($account_info["email"])) {
        $error_codes[] = 702;
    }
    if (!ft_is_valid_email($account_info["email"])) {
        $error_codes[] = 703;
    }
    if (!isset($account_info["username"]) || empty($account_info["username"])) {
        $error_codes[] = 704;
    } else {
        if (preg_match('/[^A-Za-z0-9]/', $account_info["username"])) {
            $error_codes[] = 705;
        }
        if (!_ft_is_valid_username($account_info["username"])) {
            $error_codes[] = 706;
        }
    }
    if (!isset($account_info["password"]) || empty($account_info["password"])) {
        $error_codes[] = 707;
    } else {
        if (preg_match('/[^A-Za-z0-9]/', $account_info["password"])) {
            $error_codes[] = 708;
        }
    }
    if (!empty($error_codes)) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_codes" => $error_codes);
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, $error_codes);
        }
    }
    $first_name = $account_info["first_name"];
    $last_name = $account_info["last_name"];
    $email = $account_info["email"];
    $username = $account_info["username"];
    $password = md5(md5($account_info["password"]));
    $settings = ft_get_settings();
    $account_status = isset($account_info["account_status"]) ? $account_info["account_status"] : "pending";
    $language = isset($account_info["ui_language"]) ? $account_info["ui_language"] : $settings["default_language"];
    $timezone_offset = isset($account_info["timezone_offset"]) ? $account_info["timezone_offset"] : $settings["default_timezone_offset"];
    $sessions_timeout = isset($account_info["sessions_timeout"]) ? $account_info["sessions_timeout"] : $settings["default_sessions_timeout"];
    $date_format = isset($account_info["date_format"]) ? $account_info["date_format"] : $settings["default_date_format"];
    $login_page = isset($account_info["login_page"]) ? $account_info["login_page"] : $settings["default_login_page"];
    $logout_url = isset($account_info["logout_url"]) ? $account_info["logout_url"] : $settings["default_logout_url"];
    $theme = isset($account_info["theme"]) ? $account_info["theme"] : $settings["default_theme"];
    $menu_id = isset($account_info["menu_id"]) ? $account_info["menu_id"] : $settings["default_client_menu_id"];
    // first, insert the record into the accounts table. This contains all the settings common to ALL
    // accounts (including the administrator and any other future account types)
    $query = "\n     INSERT INTO {$g_table_prefix}accounts (account_type, account_status, ui_language, timezone_offset, sessions_timeout,\n       date_format, login_page, logout_url, theme, menu_id, first_name, last_name, email, username, password)\n     VALUES ('client', '{$account_status}', '{$language}', '{$timezone_offset}', '{$sessions_timeout}',\n       '{$date_format}', '{$login_page}', '{$logout_url}', '{$theme}', {$menu_id}, '{$first_name}', '{$last_name}', '{$email}',\n       '{$username}', '{$password}')\n         ";
    if (!mysql_query($query)) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 709, "error_type" => "user", "debugging" => "Failed query in <b>" . __FUNCTION__ . "</b>: <i>{$query}</i> " . mysql_error());
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, $error_codes);
        }
    }
    $new_user_id = mysql_insert_id();
    // now create all the custom client account settings, most of which are based on the default values
    // in the settings table
    $account_settings = array("client_notes" => "", "company_name" => "", "page_titles" => $settings["default_page_titles"], "footer_text" => $settings["default_footer_text"], "may_edit_page_titles" => $settings["clients_may_edit_page_titles"], "may_edit_footer_text" => $settings["clients_may_edit_footer_text"], "may_edit_theme" => $settings["clients_may_edit_theme"], "may_edit_logout_url" => $settings["clients_may_edit_logout_url"], "may_edit_language" => $settings["clients_may_edit_ui_language"], "may_edit_timezone_offset" => $settings["clients_may_edit_timezone_offset"], "may_edit_sessions_timeout" => $settings["clients_may_edit_sessions_timeout"], "may_edit_date_format" => $settings["clients_may_edit_date_format"]);
    ft_set_account_settings($new_user_id, $account_settings);
    return array(true, $new_user_id);
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:99,代码来源:api.php

示例14: ft_display_module_page

/**
 * Loads a theme opening page for a module. This should be used loaded for every page in a
 * module. It serves the same function as ft_display_page, except that it sets the appropriate root
 * folder for the module and loads the
 *
 * @param array $page_vars a hash of information to display / provide to the template.
 * @param string $theme
 */
function ft_display_module_page($template, $page_vars = array(), $theme = "", $swatch = "")
{
    global $g_root_dir, $g_root_url, $g_success, $g_message, $g_link, $g_smarty_debug, $g_language, $LANG, $g_smarty, $L, $g_smarty_use_sub_dirs, $g_js_debug, $g_benchmark_start, $g_enable_benchmarking, $g_hide_upgrade_link;
    $module_folder = _ft_get_current_module_folder();
    // $module_id = ft_get_module_id_from_module_folder($module_folder);
    $default_module_language = "en_us";
    if (empty($theme) && isset($_SESSION["ft"]["account"]["theme"])) {
        $theme = $_SESSION["ft"]["account"]["theme"];
        $swatch = isset($_SESSION["ft"]["account"]["swatch"]) ? $_SESSION["ft"]["account"]["swatch"] : "";
    } elseif (empty($theme)) {
        $settings = ft_get_settings(array("default_theme", "default_client_swatch"));
        $theme = $settings["default_theme"];
        $swatch = $settings["default_client_swatch"];
    }
    if (!isset($_SESSION["ft"]["account"]["is_logged_in"])) {
        $_SESSION["ft"]["account"]["is_logged_in"] = false;
    }
    if (!isset($_SESSION["ft"]["account"]["account_type"])) {
        $_SESSION["ft"]["account"]["account_type"] = "";
    }
    // common variables. These are sent to EVERY template
    $g_smarty->template_dir = "{$g_root_dir}/themes/{$theme}";
    $g_smarty->compile_dir = "{$g_root_dir}/themes/{$theme}/cache/";
    $g_smarty->use_sub_dirs = $g_smarty_use_sub_dirs;
    $g_smarty->assign("LANG", $LANG);
    // this contains the custom language content of the module, in the language required. It's populated by
    // ft_init_module_page(), called on every module page
    $g_smarty->assign("L", $L);
    $g_smarty->assign("SESSION", $_SESSION["ft"]);
    $settings = isset($_SESSION["ft"]["settings"]) ? $_SESSION["ft"]["settings"] : array();
    $g_smarty->assign("settings", $settings);
    $g_smarty->assign("account", $_SESSION["ft"]["account"]);
    $g_smarty->assign("g_root_dir", $g_root_dir);
    $g_smarty->assign("g_root_url", $g_root_url);
    $g_smarty->assign("g_js_debug", $g_js_debug ? "true" : "false");
    $g_smarty->assign("g_hide_upgrade_link", $g_hide_upgrade_link);
    $g_smarty->assign("same_page", ft_get_clean_php_self());
    $g_smarty->assign("query_string", $_SERVER["QUERY_STRING"]);
    // TODO FIX
    $g_smarty->assign("dir", $LANG["special_text_direction"]);
    $g_smarty->assign("g_enable_benchmarking", $g_enable_benchmarking);
    $g_smarty->assign("swatch", $swatch);
    // if this page has been told to dislay a custom message, override g_success and g_message
    if (isset($_GET["message"])) {
        list($g_success, $g_message) = ft_display_custom_page_message($_GET["message"]);
    }
    $g_smarty->assign("g_success", $g_success);
    $g_smarty->assign("g_message", $g_message);
    $module_id = ft_get_module_id_from_module_folder($module_folder);
    $module_nav = ft_get_module_menu_items($module_id, $module_folder);
    $g_smarty->assign("module_nav", $module_nav);
    // if there's no module title, display the module name. TODO not compatible with languages...
    if (!isset($page_vars["head_title"])) {
        $module_id = ft_get_module_id_from_module_folder($module_folder);
        $module_info = ft_get_module($module_id);
        $page_vars["head_title"] = $module_info["module_name"];
    }
    // check the "required" vars are at least set so they don't produce warnings when smarty debug is enabled
    if (!isset($page_vars["head_css"])) {
        $page_vars["head_css"] = "";
    }
    if (!isset($page_vars["head_js"])) {
        $page_vars["head_js"] = "";
    }
    if (!isset($page_vars["page"])) {
        $page_vars["page"] = "";
    }
    // if we need to include custom JS messages in the page, add it to the generated JS. Note: even if the js_messages
    // key is defined but still empty, the ft_generate_js_messages function is called, returning the "base" JS - like
    // the JS version of g_root_url. Only if it is not defined will that info not be included. This feature was hacked
    // in 2.1 to support js_messages from a single module file
    $js_messages = "";
    if (isset($page_vars["js_messages"]) || isset($page_vars["module_js_messages"])) {
        $core_js_messages = isset($page_vars["js_messages"]) ? $page_vars["js_messages"] : "";
        $module_js_messages = isset($page_vars["module_js_messages"]) ? $page_vars["module_js_messages"] : "";
        $js_messages = ft_generate_js_messages($core_js_messages, $module_js_messages);
    }
    if (!empty($page_vars["head_js"]) || !empty($js_messages)) {
        $page_vars["head_js"] = "<script type=\"text/javascript\">\n//<![CDATA[\n{$page_vars["head_js"]}\n{$js_messages}\n//]]>\n</script>";
    }
    if (!isset($page_vars["head_css"])) {
        $page_vars["head_css"] = "";
    } else {
        if (!empty($page_vars["head_css"])) {
            $page_vars["head_css"] = "<style type=\"text/css\">\n{$page_vars["head_css"]}\n</style>";
        }
    }
    // theme-specific vars
    $g_smarty->assign("images_url", "{$g_root_url}/themes/{$theme}/images");
    $g_smarty->assign("theme_url", "{$g_root_url}/themes/{$theme}");
    $g_smarty->assign("theme_dir", "{$g_root_dir}/themes/{$theme}");
    // if there's a Smarty folder, import any of its resources
//.........这里部分代码省略.........
开发者ID:jdearaujo,项目名称:core,代码行数:101,代码来源:themes.php

示例15: list

<?php

$sortable_id = "edit_fields";
if (isset($request["update_fields"])) {
    $request["sortable_id"] = $sortable_id;
    list($g_success, $g_message) = ft_update_form_fields_tab($form_id, $request);
}
$form_info = ft_get_form($form_id);
if (isset($request["num_fields_per_page"])) {
    $num_fields_per_page = $request["num_fields_per_page"];
    ft_set_settings(array("admin_num_fields_per_page_{$form_id}" => $request["num_fields_per_page"]));
    $_GET["fields_page"] = 1;
} else {
    $saved_num_fields_per_page = ft_get_settings("admin_num_fields_per_page_{$form_id}");
    $num_fields_per_page = !empty($saved_num_fields_per_page) ? $saved_num_fields_per_page : "all";
}
if (empty($num_fields_per_page)) {
    ft_set_settings("admin_num_fields_per_page_{$form_id}", "all");
}
$fields_page = ft_load_field("fields_page", "fields_page", 1);
$form_fields = ft_get_form_fields($form_id, array("page" => $fields_page, "num_fields_per_page" => $num_fields_per_page));
$total_form_fields = ft_get_num_form_fields($form_id);
$reserved_words = ft_get_mysql_reserved_words();
$escaped_words = array();
foreach ($reserved_words as $word) {
    $escaped_words[] = "\"{$word}\"";
}
$reserved_words = implode(",", $escaped_words);
$field_type_sizes_js = ft_generate_field_type_sizes_map_js();
$field_sizes_js = ft_generate_field_type_size_labels();
$field_settings_js = ft_generate_field_type_settings_js();
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:page_fields.php


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