• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ft_get_settings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ft_load_field函数代码示例发布时间:2022-05-15
下一篇:
PHP ft_get_page_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap