From cf3564035ab5b8972c1b725370bf43deaa85bb2a Mon Sep 17 00:00:00 2001 From: jengo Date: Sat, 10 Feb 2001 19:47:39 +0000 Subject: [PATCH] Setup will now read the directorys and figure out which applications are present, then it will insert into the phpgw_applications table depending on what was found --- addressbook/setup/setup_info.inc.php | 2 + admin/setup/setup_info.inc.php | 2 + calendar/setup/setup_info.inc.php | 2 + setup/inc/functions.inc.php | 11 ++++++ setup/sql/default_applications.inc.php | 41 +++++++++++---------- setup/sql/default_applications_plus.inc.php | 34 ----------------- 6 files changed, 38 insertions(+), 54 deletions(-) create mode 100644 addressbook/setup/setup_info.inc.php create mode 100644 admin/setup/setup_info.inc.php create mode 100644 calendar/setup/setup_info.inc.php delete mode 100644 setup/sql/default_applications_plus.inc.php diff --git a/addressbook/setup/setup_info.inc.php b/addressbook/setup/setup_info.inc.php new file mode 100644 index 0000000000..11094c5dc5 --- /dev/null +++ b/addressbook/setup/setup_info.inc.php @@ -0,0 +1,2 @@ + "Addressbook", "app_order" => 7, "version" => "0.0.1"); \ No newline at end of file diff --git a/admin/setup/setup_info.inc.php b/admin/setup/setup_info.inc.php new file mode 100644 index 0000000000..23b3cc426c --- /dev/null +++ b/admin/setup/setup_info.inc.php @@ -0,0 +1,2 @@ + "Administration", "app_order" => 1, "version" => "0.0.1"); \ No newline at end of file diff --git a/calendar/setup/setup_info.inc.php b/calendar/setup/setup_info.inc.php new file mode 100644 index 0000000000..f88e1fe828 --- /dev/null +++ b/calendar/setup/setup_info.inc.php @@ -0,0 +1,2 @@ + "Calendar", "app_order" => 9, "version" => "0.0.1"); \ No newline at end of file diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 266812a955..39fb1da30c 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -21,6 +21,17 @@ } unset($d1);unset($d2);unset($d3); /* ######## End security check ########## */ + // This is needed is some parts of setup, until we include the API directly + function filesystem_separator() + { + if (PHP_OS == 'Windows' || PHP_OS == 'OS/2') { + return '\\'; + } else { + return '/'; + } + } + define('SEP',filesystem_separator()); + // Include to check user authorization against the // password in ../header.inc.php to protect all of the setup // pages from unauthorized use. diff --git a/setup/sql/default_applications.inc.php b/setup/sql/default_applications.inc.php index 629cf52380..64fc1b614c 100644 --- a/setup/sql/default_applications.inc.php +++ b/setup/sql/default_applications.inc.php @@ -11,24 +11,25 @@ /* $Id$ */ - // This is so we can enable or disable apps for the phpGroupWare and phpGroupWare Plus packges - // This is for the base apps, which should always be included - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('admin', 'Administration', 1, 1, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('addressbook', 'Address Book', 1, 7, 'addressbook', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('filemanager', 'File manager', 1, 6, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('calendar', 'Calendar', 1, 9, 'calendar_entry,calendar_entry_users,calendar_entry_repeats', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('cron_apps', 'cron_apps', 0, 0, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('email', 'Email', 1, 10,NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('nntp', 'NNTP', 1, 11, 'newsgroups', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('notes', 'Notes', 1, 14, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - // This is for the add-on application, which are enabled/disabled based being in the regular or plus version - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('todo', 'ToDo List', 1, 8, 'todo', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('transy', 'Translation Management', 1, 13, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('tts', 'Trouble Ticket System', 1, 2, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('inv', 'Inventory', 1, 3, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('chat', 'Chat', 1, 4, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('headlines', 'Headlines', 1, 5, 'news_sites,news_headlines', '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('weather', 'Weather', 1, 12, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('bookmarks', 'Book Marks', 1, 15, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('manual', 'Manual', 1, 16, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); + $reserved_directorys = array('phpgwapi' => True, 'doc' => True, 'setup' => True, '.' => True, + '..' => True, 'CVS' => True, 'files' => True); + + $i = 30; + $dh = opendir(PHPGW_SERVER_ROOT); + while ($dir = readdir($dh)) { + if (! $reserved_directorys[$dir] && is_dir(PHPGW_SERVER_ROOT . SEP . $dir)) { + if (is_file(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php')) { + include(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php'); + } else { + $setup_info[$dir] = array('name' => $dir, 'app_order' => $i++, 'version' => '0.0.0'); + } + } + } + + while ($app = each($setup_info)) { + $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order," + . " app_tables, app_version) values ('" . $app[0] . "', '" . $app[1]["name"] + . "',1," . $app[1]['app_order'] . ", '" . $app[1]['app_tables'] . "', '" + . $app[1]['version'] . "')"); + } ?> \ No newline at end of file diff --git a/setup/sql/default_applications_plus.inc.php b/setup/sql/default_applications_plus.inc.php deleted file mode 100644 index ce8ecde361..0000000000 --- a/setup/sql/default_applications_plus.inc.php +++ /dev/null @@ -1,34 +0,0 @@ -db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('admin', 'Administration', 1, 1, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('addressbook', 'Address Book', 1, 7, 'addressbook', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('filemanager', 'File manager', 1, 6, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('calendar', 'Calendar', 1, 9, 'calendar_entry,calendar_entry_users,calendar_entry_repeats', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('cron_apps', 'cron_apps', 0, 0, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('email', 'Email', 1, 10,NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('nntp', 'NNTP', 1, 11, 'newsgroups', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('notes', 'Notes', 1, 14, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - // This is for the add-on application, which are enabled/disabled based being in the regular or plus version - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('todo', 'ToDo List', 1, 8, 'todo', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('transy', 'Translation Management', 1, 13, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('tts', 'Trouble Ticket System', 1, 2, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('inv', 'Inventory', 1, 3, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('chat', 'Chat', 1, 4, NULL, '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('headlines', 'Headlines', 1, 5, 'news_sites,news_headlines', '0.0.0')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('weather', 'Weather', 1, 12, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('bookmarks', 'Book Marks', 1, 15, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); - $phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('manual', 'Manual', 1, 16, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')"); -?>