/** * The old upgrade script. */ function export_manager__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"] < 20090908) { @mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups ENGINE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_group_clients TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_group_clients ENGINE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_types TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_export_types ENGINE=MyISAM"); } if ($old_version_info["release_date"] < 20110525) { mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups ADD form_view_mapping ENUM('all', 'except', 'only') NOT NULL DEFAULT all AFTER access_type"); mysql_query("ALTER TABLE {$g_table_prefix}module_export_groups ADD forms_and_views MEDIUMTEXT NULL AFTER form_view_mapping"); } }
function field_type_file__upgrade($old_version, $new_version) { global $g_table_prefix, $LANG; $old_version_info = ft_get_version_info($old_version); $field_type_id = ft_get_field_type_id_by_identifier("file"); if ($old_version_info["release_date"] < 20110609) { mysql_query("\n UPDATE {$g_table_prefix}field_types\n SET view_field_smarty_markup = '{if \$VALUE}\r\n <a href=\"{\$folder_url}/{\$VALUE}\" \r\n {if \$use_fancybox == \"yes\"}class=\"fancybox\"{/if}>{\$VALUE}</a>\r\n{/if}'\n WHERE field_type_id = {$field_type_id}\n "); 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); } if ($old_version_info["release_date"] < 20110612) { ft_register_hook("code", "field_type_file", "start", "ft_delete_submission_files", "ft_file_delete_submissions_hook", 50, true); } if ($old_version_info["release_date"] < 20110613) { ft_register_hook("code", "field_type_file", "start", "ft_get_uploaded_files", "ft_file_get_uploaded_files_hook", 50, true); } if ($old_version_info["release_date"] < 20111007) { @mysql_query("\n \t INSERT INTO {$g_table_prefix}field_type_validation_rules (field_type_id, rsv_rule, rule_label, rsv_field_name,\n \t custom_function, custom_function_required, default_error_message, list_order)\n \t VALUES ({$field_type_id}, 'function', '{\$LANG.word_required}', '', 'files_ns.check_required', 'yes',\n \t '{\$LANG.validation_default_rule_required}', 1)\n \t"); } ft_file_reset_hooks(); }
/** * 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"); } }
function field_type_tinymce__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); $field_type_id = ft_get_field_type_id_by_identifier("tinymce"); if ($old_version_info["release_date"] < 20110526) { mysql_query("\n UPDATE {$g_table_prefix}field_types\n SET view_field_smarty_markup = '{if \$CONTEXTPAGE == \"edit_submission\"}\r\n {\$VALUE}\r\n{elseif \$CONTEXTPAGE == \"submission_listing\"}\r\n {\$VALUE|strip_tags}\r\n{else}\r\n {\$VALUE|nl2br}\r\n{/if}'\n WHERE field_type_identifier = 'tinymce'\n "); } if ($old_version_info["release_date"] < 2011107) { mysql_query("\n UPDATE {$g_table_prefix}field_types\n SET edit_field_smarty_markup = '<textarea name=\"{\$NAME}\" id=\"cf_{\$NAME}_id\" class=\"cf_tinymce\">{\$VALUE}</textarea>\r\n<script>\r\ncf_tinymce_settings[\"{\$NAME}\"] = {literal}{{/literal}\r\n{if \$toolbar == \"basic\"}\r\n theme_advanced_buttons1: \"bold,italic,underline,strikethrough,|,bullist,numlist\",\r\n theme_advanced_buttons2: \"\",\r\n{elseif \$toolbar == \"simple\"}\r\n theme_advanced_buttons1: \"bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,blockquote,hr,|,link,unlink,forecolorpicker,backcolorpicker\",\r\n theme_advanced_buttons2: \"\",\r\n{elseif \$toolbar == \"advanced\"}\r\n theme_advanced_buttons1: \"bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,blockquote,hr,|,undo,redo,link,unlink,|,fontselect,fontsizeselect\",\r\n theme_advanced_buttons2: \"forecolorpicker,backcolorpicker,|,sub,sup,code\",\r\n{elseif \$toolbar == \"expert\"}\r\n theme_advanced_buttons1 : \"bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,blockquote,hr,|,undo,redo,link,unlink,|,formatselect,fontselect,fontsizeselect\",\r\n theme_advanced_buttons1 : \"bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,blockquote,hr,|,undo,redo,link,unlink,|,formatselect,fontselect,fontsizeselect\",\r\n theme_advanced_buttons2 : \"undo,redo,|,forecolorpicker,backcolorpicker,|,sub,sup,|,newdocument,blockquote,charmap,removeformat,cleanup,code\",\r\n{/if}\r\n theme_advanced_buttons3: \"\",\r\n{if \$show_path == \"yes\"}\r\n theme_advanced_path_location: \"{\$path_info_location}\",\r\n theme_advanced_resizing: {\$resizing},\r\n{/if}\r\n theme_advanced_resize_horizontal: false,\r\n theme_advanced_toolbar_location: \"{\$location}\",\r\n theme_advanced_toolbar_align: \"{\$alignment}\" \r\n{literal}}{/literal}\r\n</script>\r\n{if \$comments}\r\n <div class=\"cf_field_comments\">{\$comments}</div>\r\n{/if}\r\n',\n resources_js = '// this is populated by each tinyMCE WYWISYG with their settings on page load\r\nvar cf_tinymce_settings = {};\r\n\r\n\$(function() {\r\n \$(''textarea.cf_tinymce'').each(function() {\r\n var field_name = \$(this).attr(\"name\");\r\n var settings = cf_tinymce_settings[field_name];\r\n settings.script_url = g.root_url + \"/modules/field_type_tinymce/tinymce/tiny_mce.js\";\r\n settings.theme = \"advanced\",\r\n \$(this).tinymce(settings);\r\n });\r\n});\r\n\r\ncf_tinymce_settings.check_required = function() {\r\n var errors = [];\r\n for (var i=0; i<rsv_custom_func_errors.length; i++) {\r\n if (rsv_custom_func_errors[i].func != \"cf_tinymce_settings.check_required\") {\r\n continue;\r\n }\r\n var field_name = rsv_custom_func_errors[i].field;\r\n var val = \$.trim(tinyMCE.get(\"cf_\" + field_name + \"_id\").getContent());\r\n if (!val) {\r\n var el = document.edit_submission_form[field_name];\r\n errors.push([el, rsv_custom_func_errors[i].err]);\r\n }\r\n }\r\n if (errors.length) {\r\n return errors;\r\n }\r\n return true; \r\n}\r\n'\n WHERE field_type_id = {$field_type_id}\n "); mysql_query("\n \t INSERT INTO {$g_table_prefix}field_type_validation_rules (field_type_id, rsv_rule, rule_label, rsv_field_name,\n \t custom_function, custom_function_required, default_error_message, list_order)\n \t VALUES ({$field_type_id}, 'function', '{\$LANG.word_required}', '', 'cf_tinymce_settings.check_required', 'yes',\n \t '{\$LANG.validation_default_rule_required}', 1)\n \t"); } field_type_tinymce_reset_hooks(); }
function pages__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"] < 20091020) { // update the pages table @mysql_query("ALTER TABLE {$g_table_prefix}module_pages ADD content_type ENUM('html','php','smarty') NOT NULL DEFAULT 'html' AFTER page_name"); @mysql_query("ALTER TABLE {$g_table_prefix}module_pages ADD use_wysiwyg ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER content_type"); @mysql_query("ALTER TABLE {$g_table_prefix}module_pages ADD access_type ENUM('admin','public','private') NOT NULL DEFAULT 'admin' AFTER page_name"); @mysql_query("\n CREATE TABLE IF NOT EXISTS {$g_table_prefix}module_pages_clients (\n page_id mediumint(9) unsigned NOT NULL,\n client_id mediumint(9) unsigned NOT NULL,\n PRIMARY KEY (page_id, client_id)\n ) DEFAULT CHARSET=utf8\n "); } if ($old_version_info["release_date"] < 20100911) { @mysql_query("ALTER TABLE {$g_table_prefix}module_pages TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_pages ENGINE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_pages_clients TYPE=MyISAM"); @mysql_query("ALTER TABLE {$g_table_prefix}module_pages_clients ENGINE=MyISAM"); } }