Example #1
0
/**
 * The Export Manager installation function. This is automatically called by the installation script if the
 * module is contained in the zipfile. Otherwise it's called when the user manually installs the module.
 */
function export_manager__install($module_id)
{
    global $g_table_prefix, $g_root_dir, $g_root_url, $LANG;
    $queries = array();
    $word_display = ft_sanitize($LANG["word_display"]);
    $queries[] = "\n    CREATE TABLE {$g_table_prefix}module_export_groups (\n      export_group_id smallint(5) unsigned NOT NULL auto_increment,\n      group_name varchar(255) NOT NULL,\n      access_type enum('admin','public','private') NOT NULL default 'public',\n      form_view_mapping enum('all','except','only') NOT NULL default 'all',\n      forms_and_views mediumtext NULL,\n      visibility enum('show','hide') NOT NULL default 'show',\n      icon varchar(100) NOT NULL,\n      action enum('file','popup','new_window') NOT NULL default 'popup',\n      action_button_text varchar(255) NOT NULL default '{$word_display}',\n      popup_height varchar(5) default NULL,\n      popup_width varchar(5) default NULL,\n      headers text,\n      smarty_template mediumtext NOT NULL,\n      list_order tinyint(4) NOT NULL,\n      PRIMARY KEY  (export_group_id)\n    ) DEFAULT CHARSET=utf8\n      ";
    $queries[] = "\n    CREATE TABLE {$g_table_prefix}module_export_group_clients (\n      export_group_id mediumint(8) unsigned NOT NULL,\n      account_id mediumint(8) unsigned NOT NULL,\n      PRIMARY KEY  (export_group_id, account_id)\n    ) DEFAULT CHARSET=utf8\n      ";
    $queries[] = "\n    CREATE TABLE {$g_table_prefix}module_export_types (\n      export_type_id mediumint(8) unsigned NOT NULL auto_increment,\n      export_type_name varchar(255) NOT NULL,\n      export_type_visibility enum('show','hide') NOT NULL default 'show',\n      filename varchar(255) NOT NULL,\n      export_group_id smallint(6) default NULL,\n      smarty_template text NOT NULL,\n      list_order tinyint(3) unsigned NOT NULL,\n      PRIMARY KEY (export_type_id)\n    ) DEFAULT CHARSET=utf8\n      ";
    foreach ($queries as $query) {
        $result = mysql_query($query);
        if (!$result) {
            exp_remove_tables();
            return array(false, $LANG["export_manager"]["notify_installation_problem_c"] . " <b>" . mysql_error() . "</b>");
        }
    }
    // now populate the tables
    list($success, $message) = exp_insert_default_data();
    if (!$success) {
        exp_remove_tables();
        exp_clear_table_data();
        return array(false, $message);
    }
    ft_register_hook("template", "export_manager", "admin_submission_listings_bottom", "", "exp_display_export_options");
    ft_register_hook("template", "export_manager", "client_submission_listings_bottom", "", "exp_display_export_options");
    return array(true, "");
}
Example #2
0
function field_type_tinymce_reset_hooks()
{
    ft_unregister_module_hooks("field_type_tinymce");
    ft_register_hook("template", "field_type_tinymce", "head_bottom", "", "tinymce_include_files");
    ft_register_hook("template", "field_type_tinymce", "standalone_form_fields_head_bottom", "", "tinymce_include_standalone_files");
}
Example #3
0
/**
 * The module update function.
 *
 * @param string $old_version
 * @param string $new_version
 */
function swift_mailer__upgrade($old_version, $new_version)
{
    global $g_table_prefix;
    $old_version_info = ft_get_version_info($old_version);
    $new_version_info = ft_get_version_info($new_version);
    if ($old_version_info["release_date"] < 20090409) {
        @mysql_query("CREATE TABLE {$g_table_prefix}module_swift_mailer_email_template_fields (\n      email_template_id MEDIUMINT NOT NULL,\n      return_path VARCHAR(255) NOT NULL,\n      PRIMARY KEY (email_template_id)\n      )");
        ft_register_hook("template", "swift_mailer", "edit_template_tab2", "", "swift_display_extra_fields_tab2");
        ft_register_hook("code", "swift_mailer", "end", "ft_create_blank_email_template", "swift_map_email_template_field");
        ft_register_hook("code", "swift_mailer", "end", "ft_delete_email_template", "swift_delete_email_template_field");
        ft_register_hook("code", "swift_mailer", "end", "ft_update_email_template", "swift_update_email_template_append_extra_fields");
        ft_register_hook("code", "swift_mailer", "end", "ft_get_email_template", "swift_get_email_template_append_extra_fields");
        // now map all the email template IDs for the extra return path field
        $email_template_ids = array();
        $query = mysql_query("SELECT email_id FROM {$g_table_prefix}email_templates");
        while ($row = mysql_fetch_assoc($query)) {
            $email_template_id = $row["email_id"];
            mysql_query("INSERT INTO {$g_table_prefix}module_swift_mailer_email_template_fields (email_template_id, return_path) VALUE ({$email_template_id}, '')");
        }
    }
    if ($old_version_info["release_date"] < 20090711) {
        $queries = array();
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('use_encryption', '', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('encryption_type', '', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('charset', 'UTF-8', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('server_connection_timeout', '15', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('use_anti_flooding', '', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('anti_flooding_email_batch_size', '', 'swift_mailer')";
        $queries[] = "INSERT INTO {$g_table_prefix}settings (setting_name, setting_value, module) VALUES ('anti_flooding_email_batch_wait_time', '', 'swift_mailer')";
        foreach ($queries as $query) {
            $result = mysql_query($query);
        }
    }
    if ($old_version_info["release_date"] < 20100911) {
        @mysql_query("ALTER TABLE {$g_table_prefix}module_swift_mailer_email_template_fields TYPE=MyISAM");
    }
}
Example #4
0
/**
 * Called on installation and upgrades.
 */
function ft_file_reset_hooks()
{
    ft_unregister_module_hooks("field_type_file");
    ft_register_hook("code", "field_type_file", "manage_files", "ft_update_submission", "ft_file_update_submission_hook", 50, true);
    ft_register_hook("code", "field_type_file", "manage_files", "ft_process_form", "ft_file_process_form_hook", 50, true);
    ft_register_hook("code", "field_type_file", "manage_files", "ft_api_process_form", "ft_file_api_process_form_hook", 50, true);
    ft_register_hook("code", "field_type_file", "start", "ft_delete_submission_files", "ft_file_delete_submissions_hook", 50, true);
    ft_register_hook("code", "field_type_file", "start", "ft_get_uploaded_files", "ft_file_get_uploaded_files_hook", 50, true);
    ft_register_hook("template", "field_type_file", "head_bottom", "", "ft_file_include_js");
    ft_register_hook("template", "field_type_file", "standalone_form_fields_head_bottom", "", "ft_file_include_standalone_js");
}