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


PHP ft_eval_smarty_string函数代码示例

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


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

示例1: smarty_function_display_field_type_name

function smarty_function_display_field_type_name($params, &$smarty)
{
    $field_type_id = isset($params["field_type_id"]) ? $params["field_type_id"] : "";
    if (empty($field_type_id)) {
        return;
    }
    $field_type_info = ft_get_field_type($field_type_id);
    echo ft_eval_smarty_string($field_type_info["field_type_name"]);
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:9,代码来源:function.display_field_type_name.php

示例2: smarty_function_themes_dropdown

function smarty_function_themes_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"] : "";
    $default_swatch = isset($params["default_swatch"]) ? $params["default_swatch"] : "";
    $onchange = isset($params["onchange"]) ? $params["onchange"] : "";
    // we always give theme dropdowns a special "ft_themes_dropdown" class. This is used to dynamically
    // add the event handlers to hide/show the appropriate swatch dropdown
    $attributes = array("id" => $params["name_id"], "name" => $params["name_id"], "class" => "ft_themes_dropdown", "onchange" => $onchange);
    $attribute_str = "";
    while (list($key, $value) = each($attributes)) {
        if (!empty($value)) {
            $attribute_str .= " {$key}=\"{$value}\"";
        }
    }
    $themes = ft_get_themes();
    $html = "<select {$attribute_str}>\n           <option value=\"\">{$LANG["phrase_please_select"]}</option>";
    $swatch_info = array();
    foreach ($themes as $theme) {
        if ($theme["is_enabled"] == "no") {
            continue;
        }
        $selected = $theme["theme_folder"] == $default_value ? "selected" : "";
        $html .= "<option value=\"{$theme["theme_folder"]}\" {$selected}>{$theme["theme_name"]}</option>";
        if ($theme["uses_swatches"] == "yes") {
            $swatch_info[$theme["theme_folder"]] = $theme["swatches"];
        }
    }
    $html .= "</select>";
    // now generate swatch dropdowns for all themes that have them. This is by far the simplest solution,
    // since there will always be very few themes and even fewer that have
    while (list($theme_folder, $swatches) = each($swatch_info)) {
        $classes = array("{$params["name_id"]}_swatches");
        if ($theme_folder != $default_value) {
            $classes[] = "hidden";
        }
        $class_str = implode(" ", $classes);
        $html .= "<select name=\"{$theme_folder}_{$params["name_id"]}_swatches\" id=\"{$theme_folder}_{$params["name_id"]}_swatches\" class=\"{$class_str}\">" . "<option value=\"\">{$LANG["phrase_select_swatch"]}</option>";
        $pairs = explode("|", $swatches);
        foreach ($pairs as $pair) {
            list($swatch, $swatch_label) = explode(",", $pair);
            $selected = "";
            if ($theme_folder == $default_value && $default_swatch == $swatch) {
                $selected = "selected";
            }
            $swatch_label = ft_eval_smarty_string($swatch_label);
            $html .= "<option value=\"{$swatch}\" {$selected}>{$swatch_label}</option>";
        }
        $html .= "</select>";
    }
    return $html;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:56,代码来源:function.themes_dropdown.php

示例3: smarty_function_eval_smarty_string

function smarty_function_eval_smarty_string($params, &$smarty)
{
    global $LANG;
    if (empty($params["placeholder_str"])) {
        $smarty->trigger_error("assign: missing 'placeholder_str' parameter.");
        return;
    }
    $placeholders = $params;
    unset($placeholders["placeholder_str"]);
    $placeholder_str = $params["placeholder_str"];
    return ft_eval_smarty_string($placeholder_str, $placeholders);
}
开发者ID:jdearaujo,项目名称:core,代码行数:12,代码来源:function.eval_smarty_string.php

示例4: ft_add_form_fields

/**
 * Adds new form field(s) to the database. This was totally re-written in 2.1.0, for the new Edit Fields
 * page.
 *
 * @param integer $infohash a hash containing the contents of the Edit Form Advanced -> Add Fields page.
 * @param integer $form_id The unique form ID
 * @return array Returns array with indexes:<br/>
 *               [0]: true/false (success / failure)<br/>
 *               [1]: message string<br/>
 */
function ft_add_form_fields($form_id, $fields)
{
    global $g_debug, $g_table_prefix, $LANG, $g_field_sizes;
    $success = true;
    $message = "";
    $fields = ft_sanitize($fields);
    foreach ($fields as $field_info) {
        $field_name = $field_info["form_field_name"];
        $field_size = $field_info["field_size"];
        $field_type_id = $field_info["field_type_id"];
        $display_name = $field_info["display_name"];
        $include_on_redirect = $field_info["include_on_redirect"];
        $list_order = $field_info["list_order"];
        $col_name = $field_info["col_name"];
        $is_new_sort_group = $field_info["is_new_sort_group"];
        // in order for the field to be added, it needs to have the label, name, size and column name. Otherwise they're
        // ignored
        if (empty($display_name) || empty($field_name) || empty($field_size) || empty($col_name)) {
            continue;
        }
        // add the new field to form_fields
        $query = "\n      INSERT INTO {$g_table_prefix}form_fields (form_id, field_name, field_size, field_type_id,\n        data_type, field_title, col_name, list_order, is_new_sort_group, include_on_redirect)\n      VALUES ({$form_id}, '{$field_name}', '{$field_size}', {$field_type_id},\n        'string', '{$display_name}', '{$col_name}', {$list_order}, '{$is_new_sort_group}', '{$include_on_redirect}')\n    ";
        $result = mysql_query($query) or ft_handle_error("Failed query in <b>" . __FUNCTION__ . "</b>, line " . __LINE__ . ": <i>{$query}</i>", mysql_error());
        $new_field_id = mysql_insert_id();
        $new_field_size = $g_field_sizes[$field_size]["sql"];
        list($is_success, $err_message) = _ft_add_table_column("{$g_table_prefix}form_{$form_id}", $col_name, $new_field_size);
        // if the alter table didn't work, return with an error message and remove the entry we just added to the form_fields table
        if (!$is_success) {
            if (!empty($new_field_id) && is_numeric($new_field_id)) {
                mysql_query("\n          DELETE FROM {$g_table_prefix}form_fields\n          WHERE field_id = {$new_field_id}\n          LIMIT 1\n        ");
            }
            $success = false;
            $replacement_info = array("fieldname" => $field_name);
            $message = ft_eval_smarty_string($LANG["notify_form_field_not_added"], $replacement_info);
            if ($g_debug) {
                $message .= " <i>\"{$err_message}\"</i>";
            }
            return array($success, $message);
        }
    }
    extract(ft_process_hook_calls("end", compact("infohash", "form_id"), array("success", "message")), EXTR_OVERWRITE);
    return array($success, $message);
}
开发者ID:jdearaujo,项目名称:core,代码行数:53,代码来源:fields.php

示例5: smarty_function_display_field_types_dropdown

function smarty_function_display_field_types_dropdown($params, &$smarty)
{
    global $LANG;
    $default_value = isset($params["default"]) ? $params["default"] : "";
    // this option controls whether the option values are field_type_ids or identifiers
    $value_type = isset($params["value_type"]) ? $params["value_type"] : "field_type_id";
    $attribute_whitelist = array("name", "id", "onchange", "onkeyup", "onfocus", "tabindex", "class");
    $attributes = array();
    foreach ($attribute_whitelist as $attribute_name) {
        if (isset($params[$attribute_name]) && !empty($params[$attribute_name])) {
            $attributes[] = "{$attribute_name}=\"{$params[$attribute_name]}\"";
        }
    }
    $attribute_str = implode(" ", $attributes);
    $grouped_field_types = ft_get_grouped_field_types();
    $rows = array();
    foreach ($grouped_field_types as $grouped_field_type) {
        $group_name = ft_eval_smarty_string($grouped_field_type["group"]["group_name"]);
        $rows[] = "<optgroup label=\"" . htmlspecialchars($group_name) . "\">";
        foreach ($grouped_field_type["field_types"] as $field_type_info) {
            $field_type_id = $field_type_info["field_type_id"];
            $field_type_identifier = $field_type_info["field_type_identifier"];
            $field_type_name = htmlspecialchars(ft_eval_smarty_string($field_type_info["field_type_name"]));
            if ($value_type == "field_type_id") {
                $selected = $default_value == $field_type_id ? " selected" : "";
                $rows[] = "<option value=\"{$field_type_id}\"{$selected}>{$field_type_name}</option>";
            } else {
                $selected = $default_value == $field_type_identifier ? " selected" : "";
                $rows[] = "<option value=\"{$field_type_identifier}\"{$selected}>{$field_type_name}</option>";
            }
        }
        $rows[] = "</optgroup>";
    }
    $dd = "<select {$attribute_str}>" . implode("", $rows) . "</select>";
    return $dd;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:36,代码来源:function.display_field_types_dropdown.php

示例6: smarty_function_display_field_type_settings_dropdown

function smarty_function_display_field_type_settings_dropdown($params, &$smarty)
{
    global $LANG;
    $field_type_id = $params["field_type_id"];
    $default_value = isset($params["default"]) ? $params["default"] : "";
    $attribute_whitelist = array("name", "id", "onchange", "onkeyup", "onfocus", "tabindex", "class");
    $attributes = array();
    foreach ($attribute_whitelist as $attribute_name) {
        if (isset($params[$attribute_name]) && !empty($params[$attribute_name])) {
            $attributes[] = "{$attribute_name}=\"{$params[$attribute_name]}\"";
        }
    }
    $attribute_str = implode(" ", $attributes);
    $field_type_settings = ft_get_field_type_settings($field_type_id);
    $rows = array();
    foreach ($field_type_settings as $setting_info) {
        $field_setting_identifier = $setting_info["field_setting_identifier"];
        $field_setting_label = htmlspecialchars(ft_eval_smarty_string($setting_info["field_label"]));
        $selected = $default_value == $field_setting_identifier ? " selected" : "";
        $rows[] = "<option value=\"{$field_setting_identifier}\"{$selected}>{$field_setting_label}</option>";
    }
    $dd = "<select {$attribute_str}>" . join("\n", $rows) . "</select>";
    return $dd;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:24,代码来源:function.display_field_type_settings_dropdown.php

示例7: ft_get_theme_swatch_list

/**
 * Helper function to return a human friendly version of the available theme swatches.
 *
 * @param string $str the serialized swatch string found in the theme tables "swatches" field.
 */
function ft_get_theme_swatch_list($str)
{
    $swatch_list = array();
    $pairs = explode("|", $str);
    foreach ($pairs as $pair) {
        list($swatch, $swatch_label) = explode(",", $pair);
        $swatch_list[] = ft_eval_smarty_string($swatch_label);
    }
    $swatch_list_str = implode(", ", $swatch_list);
    return $swatch_list_str;
}
开发者ID:jdearaujo,项目名称:core,代码行数:16,代码来源:themes.php

示例8: ft_validate_submission

/**
 * This is the main server-side validation function, called whenever updating a submission. The current version (Core 2.1.9)
 * only performs a subset of the total validation rules; namely, those non-custom ones that
 *
 * @param array $editable_field_ids - this contains ALL editable field IDs in the form
 * @param array $request
 * @return array an array of errors, or an empty array if no errors
 */
function ft_validate_submission($form_id, $editable_field_ids, $request)
{
    if (empty($editable_field_ids)) {
        return array();
    }
    // get the validation rules for the current page. The use of $request["field_ids"] is a fix for bug #339; this should be handled
    // a lot better. The calling page (edit_submission.php amongst other) should be figuring out what fields are editable on that particular
    // page and passing THAT info as $editable_field_ids
    $editable_field_ids_on_tab = explode(",", $request["field_ids"]);
    // return all validation rules for items on tab, including those marked as editable == "no"
    $rules = ft_get_php_field_validation_rules($editable_field_ids_on_tab);
    // gets all form fields in this View
    $form_fields = ft_get_view_fields($request["view_id"]);
    // reorganize $form_fields to be a hash of field_id => array(form_name => "", field_tield => "")
    $field_info = array();
    foreach ($form_fields as $curr_field_info) {
        $field_info[$curr_field_info["field_id"]] = array("field_name" => $curr_field_info["field_name"], "field_title" => $curr_field_info["field_title"], "is_editable" => $curr_field_info["is_editable"]);
    }
    // construct the RSV-friendly validation
    $validation = array();
    foreach ($rules as $rule_info) {
        $rule = $rule_info["rsv_rule"];
        $field_id = $rule_info["field_id"];
        $field_name = $field_info[$field_id]["field_name"];
        $field_title = $field_info[$field_id]["field_title"];
        $error_message = $rule_info["error_message"];
        // if this field is marked as non-editable, ignore it. We don't need to validate it
        if ($field_info[$field_id]["is_editable"] == "no") {
            continue;
        }
        $placeholders = array("field" => $field_title, "field_name" => $field_name);
        $error_message = ft_eval_smarty_string($error_message, $placeholders);
        $validation[] = "{$rule},{$field_name},{$error_message}";
    }
    $errors = array();
    if (!empty($validation)) {
        $form_vals = ft_sanitize($request);
        $errors = validate_fields($form_vals, $validation);
    }
    return $errors;
}
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:49,代码来源:field_validation.php

示例9: 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

示例10: ft_update_theme_settings

/**
 * Called by the administrator from the Themes settings page. It updates the list of enabled
 * themes, and which theme is assigned to the administrator and (default) client accounts. Note:
 * it doesn't disable any themes that are already assigned to a user account. If that happens,
 * it returns a message listing the accounts (each clickable) and an option to bulk assign them
 * to a different theme.
 *
 * @param array $infohash this parameter should be a hash (e.g. $_POST or $_GET) containing the
 *             various fields from the main settings admin page.
 * @return array Returns array with indexes:<br/>
 *               [0]: true/false (success / failure)<br/>
 *               [1]: message string<br/>
 */
function ft_update_theme_settings($infohash)
{
    global $g_table_prefix, $g_root_url, $g_root_dir, $LANG;
    // lots to validate! First, check the default admin & client themes have been entered
    $rules = array();
    $rules[] = "required,admin_theme,{$LANG["validation_no_admin_theme"]}";
    $rules[] = "required,default_client_theme,{$LANG["validation_no_default_client_theme"]}";
    $errors = validate_fields($infohash, $rules);
    if (!isset($infohash["is_enabled"])) {
        $errors[] = $LANG["validation_no_enabled_themes"];
    }
    if (!empty($errors)) {
        $success = false;
        array_walk($errors, create_function('&$el', '$el = "&bull;&nbsp; " . $el;'));
        $message = join("<br />", $errors);
        return array($success, $message);
    }
    $enabled_themes = $infohash["is_enabled"];
    // next, check that both the admin and default client themes are enabled
    $admin_theme = $infohash["admin_theme"];
    $default_client_theme = $infohash["default_client_theme"];
    if (!in_array($admin_theme, $enabled_themes) || !in_array($default_client_theme, $enabled_themes)) {
        return array(false, $LANG["validation_default_admin_and_client_themes_not_enabled"]);
    }
    // lastly, if there are already client accounts assigned to disabled themes, we need to sort it out.
    // We handle it the same way as deleting the client menus: if anyone is assigned to this theme,
    // we generate a list of their names, each a link to their account page (in a _blank link). We
    // then inform the user of what's going on, and underneath the name list, give them the option of
    // assigning ALL affected accounts to another (enabled) theme.
    $theme_clauses = array();
    foreach ($enabled_themes as $theme) {
        $theme_clauses[] = "theme != '{$theme}'";
    }
    $theme_clause = join(" AND ", $theme_clauses);
    $query = mysql_query("\n    SELECT account_id, first_name, last_name\n    FROM   {$g_table_prefix}accounts\n    WHERE  {$theme_clause}\n  ");
    $client_info = array();
    while ($row = mysql_fetch_assoc($query)) {
        $client_info[] = $row;
    }
    if (!empty($client_info)) {
        $message = $LANG["notify_disabled_theme_already_assigned"];
        $placeholder_str = $LANG["phrase_assign_all_listed_client_accounts_to_theme"];
        $themes = ft_get_themes(true);
        $dd = "<select id=\"mass_update_client_theme\">";
        foreach ($themes as $theme) {
            $dd .= "<option value=\"{$theme["theme_id"]}\">{$theme["theme_name"]}</option>";
        }
        $dd .= "</select>";
        // a bit bad (hardcoded HTML!), but organize the account list in 3 columns
        $client_links_table = "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n<tr>";
        $num_affected_clients = count($client_info);
        for ($i = 0; $i < $num_affected_clients; $i++) {
            $account_info = $client_info[$i];
            $client_id = $account_info["account_id"];
            $first_name = $account_info["first_name"];
            $last_name = $account_info["last_name"];
            $client_ids[] = $client_id;
            if ($i != 0 && $i % 3 == 0) {
                $client_links_table .= "</tr>\n<tr>";
            }
            $client_links_table .= "<td width=\"33%\">&bull;&nbsp;<a href=\"{$g_root_url}/admin/clients/edit.php?page=settings&client_id={$client_id}\" target=\"_blank\">{$first_name} {$last_name}</a></td>\n";
        }
        $client_id_str = join(",", $client_ids);
        // close the table
        if ($num_affected_clients % 3 == 1) {
            $client_links_table .= "<td colspan=\"2\" width=\"66%\"> </td>";
        } else {
            if ($num_affected_clients % 3 == 2) {
                $client_links_table .= "<td width=\"33%\"> </td>";
            }
        }
        $client_links_table .= "</tr></table>";
        $submit_button = "<input type=\"button\" value=\"{$LANG["phrase_update_accounts"]}\" onclick=\"window.location='index.php?page=themes&mass_assign=1&accounts={$client_id_str}&theme_id=' + \$('#mass_update_client_theme').val()\" />";
        $placeholders = array("theme_dropdown" => $dd, "submit_button" => $submit_button);
        $mass_assign_html = "<div class=\"margin_top_large margin_bottom_large\">" . ft_eval_smarty_string($placeholder_str, $placeholders) . "</div>";
        $html = $message . $mass_assign_html . $client_links_table;
        return array(false, $html);
    }
    // hoorah! Validation complete, let's update the bloomin' database at last
    // update the admin settings
    $admin_id = $_SESSION["ft"]["account"]["account_id"];
    $admin_swatch = "";
    if (isset($infohash["{$admin_theme}_admin_theme_swatches"])) {
        $admin_swatch = $infohash["{$admin_theme}_admin_theme_swatches"];
    }
    mysql_query("\n    UPDATE {$g_table_prefix}accounts\n    SET    theme = '{$admin_theme}',\n           swatch = '{$admin_swatch}'\n    WHERE  account_id = {$admin_id}\n      ");
    $_SESSION["ft"]["account"]["theme"] = $admin_theme;
//.........这里部分代码省略.........
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:101,代码来源:settings.php

示例11: preg_quote

    $password_special_chars = preg_quote($g_password_special_chars);
    $conditional_validation[] = "rules.push(\"if:password!=,reg_exp,password,[{$password_special_chars}],{$error}\")";
}
$conditional_rules = implode("\n", $conditional_validation);
// define info for template
$page_vars["page"] = "main";
$page_vars["page_url"] = ft_get_page_url("edit_client_main", array("client_id" => $client_id));
$page_vars["head_title"] = "{$LANG["phrase_edit_client"]} - {$LANG["word_main"]}";
$page_vars["client_info"] = $client_info;
$page_vars["client_id"] = $client_id;
$page_vars["required_password_chars"] = $required_password_chars;
$page_vars["password_special_chars"] = $g_password_special_chars;
$page_vars["has_extra_password_requirements"] = !empty($client_info["settings"]["required_password_chars"]) || !empty($client_info["settings"]["min_password_length"]);
$page_vars["has_min_password_length"] = !empty($client_info["settings"]["min_password_length"]);
$page_vars["password_special_char"] = ft_eval_smarty_string($LANG["phrase_password_special_char"], array("chars" => $g_password_special_chars));
$page_vars["phrase_password_min"] = ft_eval_smarty_string($LANG["phrase_password_min"], array("length" => $client_info["settings"]["min_password_length"]));
$page_vars["head_js"] = <<<END
var rules = [];
rules.push("required,first_name,{$LANG['validation_no_client_first_name']}");
rules.push("required,last_name,{$LANG['validation_no_client_last_name']}");
rules.push("required,email,{$LANG['validation_no_client_email']}");
rules.push("valid_email,email,{$LANG['validation_invalid_email']}");
rules.push("required,username,{$LANG['validation_no_client_username']}");
rules.push("function,validate_username");
rules.push("if:password!=,required,password_2,{$LANG["validation_no_account_password_confirmed2"]}");
rules.push("if:password!=,same_as,password,password_2,{$LANG["validation_passwords_different"]}");
{$conditional_rules}

function validate_username() {
  var username = \$("input[name=username]").val();
  if (username.match(/[^\\.@a-zA-Z0-9_]/)) {
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:page_main.php

示例12: ft_check_permission

<?php

require "../../../global/session_start.php";
ft_check_permission("admin");
// delete any temporary Smart Fill uploaded files
if (isset($_SESSION["ft"]["smart_fill_tmp_uploaded_files"]) && !empty($_SESSION["ft"]["smart_fill_tmp_uploaded_files"])) {
    foreach ($_SESSION["ft"]["smart_fill_tmp_uploaded_files"] as $file) {
        @unlink($file);
    }
}
$_SESSION["ft"]["method"] = "";
$form_id = ft_load_field("form_id", "add_form_form_id", "");
unset($_SESSION["ft"]["add_form_form_id"]);
// ------------------------------------------------------------------------------------------------
// compile the header information
$page_vars["page"] = "add_form6";
$page_vars["page_url"] = ft_get_page_url("add_form6");
$page_vars["head_title"] = "{$LANG['phrase_add_form']} - {$LANG["phrase_step_5"]}";
$page_vars["form_id"] = $form_id;
$page_vars["text_add_form_step_5_para"] = ft_eval_smarty_string($LANG["text_add_form_step_5_para_3"], array("editformlink" => "../edit.php?form_id={$form_id}"));
$page_vars["text_add_form_step_5_para_4"] = ft_eval_smarty_string($LANG["text_add_form_step_5_para_4"], array("editformlink" => "../edit.php?form_id={$form_id}"));
$page_vars["uploading_files"] = $_SESSION["ft"]["uploading_files"];
$page_vars["head_css"] = "";
ft_display_page("admin/forms/add/step6.tpl", $page_vars);
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:24,代码来源:step6.php

示例13: array

        if ($settings["release_type"] == "alpha") {
            $new_version = "{$settings['program_version']}-alpha-{$settings['release_date']}";
        } else {
            if ($settings["release_type"] == "beta") {
                $new_version = "{$settings['program_version']}-beta-{$settings['release_date']}";
            }
        }
        $replacements = array("version" => $new_version);
        $page_vars["upgrade_notification"] = ft_eval_smarty_string($LANG["text_upgraded"], $replacements, $g_theme);
    } else {
        $g_success = false;
        $g_message = $g_upgrade_info["message"];
    }
}
$replacements = array("program_name" => $settings["program_name"], "forgot_password_link" => "forget_password.php");
$page_vars["text_login"] = ft_eval_smarty_string($LANG["text_login"], $replacements, $g_theme);
$page_vars["program_name"] = $settings["program_name"];
$page_vars["login_heading"] = sprintf("%s %s", $settings['program_name'], $LANG["word_administration"]);
$page_vars["username"] = $username;
$page_vars["is_logged_in"] = false;
$page_vars["head_js"] = "\$(function() { document.login.username.focus(); });";
$page_vars["head_string"] = "<noscript><style type=\"text/css\">.login_outer_table { display: none; }</style></noscript>";
if (!isset($g_upgrade_info["message"]) && isset($_GET["message"])) {
    $g_success = false;
    if (array_key_exists($_GET["message"], $LANG)) {
        $g_message = $LANG[$_GET["message"]];
    } else {
        $g_message = strip_tags($_GET["message"]);
    }
}
ft_display_page("index.tpl", $page_vars, $g_theme, $g_swatch);
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:index.php

示例14: ft_get_search_submission_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;
$page_vars["submission_id"] = $submission_id;
$page_vars["tabs"] = $tabs;
$page_vars["settings"] = $settings;
$page_vars["tab_number"] = $tab_number;
$page_vars["grouped_fields"] = $grouped_fields;
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:edit_submission.php

示例15: 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


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