/** * 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, ""); }
<?php require_once "../../global/library.php"; ft_init_module_page(); $request = array_merge($_POST, $_GET); if (isset($request["reset"])) { list($g_success, $g_message) = exp_insert_default_data(); } // ------------------------------------------------------------------------------------------------ $page_vars = array(); $page_vars["head_title"] = "{$L["module_name"]} - {$L["phrase_reset_defaults"]}"; $page_vars["head_string"] = <<<END <link type="text/css" rel="stylesheet" href="{$g_root_url}/modules/export_manager/global/css/styles.css"> END; ft_display_module_page("templates/reset.tpl", $page_vars);