[Phpbbproject-svn] SF.net SVN: phpbbproject:[286] trunk
phpBB download manager, mainly aimed at MOD authors
Status: Planning
Brought to you by:
lord_le_brand
From: <lor...@us...> - 2008-07-31 11:15:15
|
Revision: 286 http://phpbbproject.svn.sourceforge.net/phpbbproject/?rev=286&view=rev Author: lord_le_brand Date: 2008-07-31 11:15:23 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Cleaned up install_install.php. Moved all data except dummy MOD to install_install.php (Dummy MOD is todo). Updated ToDo list Modified Paths: -------------- trunk/develop/todo_list.txt trunk/phpbb3/root/project_install/index.php trunk/phpbb3/root/project_install/install_install.php trunk/phpbb3/root/project_install/schemas/schema_data.sql Modified: trunk/develop/todo_list.txt =================================================================== --- trunk/develop/todo_list.txt 2008-07-30 20:36:15 UTC (rev 285) +++ trunk/develop/todo_list.txt 2008-07-31 11:15:23 UTC (rev 286) @@ -1,16 +1,15 @@ Todo list for phpBB Project -- Move database inserts for ACL tables to PHP +- Add table for authors-project relation (also get rid of project_owner in projects_table?) - Author ordering in MOD(X) file/project overview page +- Expand validate_project_title() +- Add functions for assigning authors etc. +- Decide on what information will go on view category module +- Target version information??? - Definitive decision on storing versioned files - Generate filetree more efficiently (download class) -- Expand validate_project_title() -- Decide on what information will go on view category module -- Target version information -- Implement ACL Locations MOD - - Change the way authors are tied to projects using acl tables? - Decide on better module structure -- Modules: +- Create modules: - Import project - Manage project - Diff generator @@ -28,6 +27,7 @@ - License handler - phpbb.com MOD database sender - Add language entries +- Move dummy MOD out of sql file, get rid of schema_data.sql - Add text and options to installer - Add links to header (and index?) - Make modx file... -_-' Modified: trunk/phpbb3/root/project_install/index.php =================================================================== --- trunk/phpbb3/root/project_install/index.php 2008-07-30 20:36:15 UTC (rev 285) +++ trunk/phpbb3/root/project_install/index.php 2008-07-31 11:15:23 UTC (rev 286) @@ -44,6 +44,12 @@ trigger_error($user->lang['PROJECT_PHP_VERSION_TOO_LOW'] . $return_index, E_USER_WARNING); } +if (!function_exists('get_acl_location_array')) +{ + $return_index = '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + trigger_error($user->lang['PROJECT_ACL_LOCATIONS_NOT_INSTALLED'] . $return_index, E_USER_WARNING); +} + $module = request_var('i', 'main'); $mode = request_var('mode', 'intro'); Modified: trunk/phpbb3/root/project_install/install_install.php =================================================================== --- trunk/phpbb3/root/project_install/install_install.php 2008-07-30 20:36:15 UTC (rev 285) +++ trunk/phpbb3/root/project_install/install_install.php 2008-07-31 11:15:23 UTC (rev 286) @@ -120,16 +120,18 @@ $template->assign_vars(array( 'INSTALL_TEXT' => $user->lang['PROJECT_INSTALL_TABLES_TEXT'], - 'U_NEXT' => append_sid("index.$phpEx", 'i=install&mode=config'), + 'U_NEXT' => append_sid("index.$phpEx", 'i=install&mode=insert_data'), )); add_form_key('project_install_tables'); break; - case 'config': + case 'insert_data': check_form_key('project_install_tables', false, '', true); + include_once("{$phpbb_root_path}includes/acp/auth.$phpEx"); + $auth_admin = new auth_admin(); $page_title = $user->lang['PROJECT_INSTALL'] . ' » ' . $user->lang['PROJECT_INSTALL_CONFIG_TITLE']; @@ -147,6 +149,42 @@ $current_time = time(); + $db->sql_transaction('begin'); + + // Add auth options + foreach ($this->acl_options_local as $location => $options) + { + $sql = 'SELECT location_id + FROM ' . ACL_LOCATIONS_TABLE . " + WHERE location_table = '$location'"; + $result = $db->sql_query($sql); + $location_id = $db->sql_fetchfield('location_id', 0, $result); + $db->sql_freeresult($result); + + $options = array('local' => $options); + $auth_admin->acl_add_option($options); + } + $auth_admin->acl_add_option($this->acl_options_global); + + // Add roles + data + foreach ($this->acl_roles as $acl_role) + { + $auth = $acl_role['auth']; + unset($acl_role['auth']); + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $db->sql_build_array('INSERT', $acl_role); + $db->sql_query($sql); + + $role_id = $db->sql_nextid(); + + $auth_admin->acl_set_role($role_id, array_fill_keys($auth, ACL_YES)); + if ($acl_role['role_name'] == 'ROLE_PROJECT_TEAM') + { + $team_role_id = $role_id; + } + } + + // Add Project Autoposting Bot $bot_userdata = array( 'username' => $user->lang['PROJECT_BOT_USERNAME'], 'user_password' => '', @@ -157,8 +195,6 @@ 'user_email' => '', ); - $db->sql_transaction('begin'); - $bot_user_id = user_add($bot_userdata); if (!$bot_user_id) @@ -167,37 +203,24 @@ trigger_error($user->lang['PROJECT_BOT_NOT_ADDED'], E_USER_WARNING); } - $gpl_text = file_get_contents('licenses/gpl.txt'); - $gpl_text = $db->sql_escape($gpl_text); - $cc_by_text = file_get_contents('licenses/cc_by.txt'); - $cc_by_text = $db->sql_escape($cc_by_text); + // Add licenses + $gpl_text = file_get_contents('licenses/gpl.txt'); + $gpl_text = $db->sql_escape($gpl_text); + $cc_by_text = file_get_contents('licenses/cc_by.txt'); + $cc_by_text = $db->sql_escape($cc_by_text); + $licenses_insert = array( + array( + 'license_title' => 'GNU General Public License version 2', + 'license_acronym' => 'GPLv2', + 'license_description' => 'This is a short explanation of what the GPL is.... Well it should be anyway.', + 'license_text' => $gpl_text, + 'license_url' => 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html', + ), + array( + 'license_title' => 'Creative Commons Attribution 3.0', + 'license_acronym' => 'CC-BY 3.0', + 'license_description' => 'You are free: - $team_group_id = 0; - $error_message_ary = group_create($team_group_id, GROUP_SPECIAL, 'PROJECT_TEAM', '', array('group_colour' => 'E67300', 'group_receive_pm' => 1, 'group_legend' => 1)); - - if ($error_message_ary !== false) - { - $db->sql_transaction('rollback'); - trigger_error(implode("<br />\n", $error_message_ary)); - } - - $sql = 'SELECT role_id - FROM ' . ACL_ROLES_TABLE . " - WHERE role_name = 'ROLE_PROJECT_TEAM' - OR role_name = 'ROLE_PROJECT_MANAGER' - ORDER BY role_order DESC"; - - $db->sql_query($sql); - - $team_role_id = $db->sql_fetchfield('role_id', 0); - $manager_role_id = $db->sql_fetchfield('role_id', 1); - - $sql_ary = array( - 'INSERT INTO ' . PROJECT_LICENSES_TABLE . " (license_title, license_acronym, license_description, license_text, license_url) - VALUES ('GNU General Public License version 2', 'GPLv2', 'This is a short explanation of what the GPL is.... Well it should be anyway.', '$gpl_text', 'http://www.gnu.org/licenses/old-licenses/gpl-2.0.html')", - 'INSERT INTO ' . PROJECT_LICENSES_TABLE . " (license_title, license_acronym, license_description, license_text, license_url) - VALUES ('Creative Commons Attribution 3.0', 'CC-BY 3.0', 'You are free: - * to Share - to copy, distribute and transmit the work * to Remix - to adapt the work @@ -207,20 +230,38 @@ * For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. * Any of the above conditions can be waived if you get permission from the copyright holder. -* Nothing in this license impairs or restricts the author''s moral rights.', '$cc_by_text', 'http://creativecommons.org/licenses/by/3.0/legalcode')", - 'INSERT INTO ' . PROJECT_AUTHORS_TABLE . " (author_id, author_username, author_realname, author_email, author_website) - VALUES ({$user->data['user_id']}, '{$user->data['username']}', '', '{$user->data['user_email']}', '{$user->data['user_website']}')", - 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) - VALUES ($team_group_id, 0, 0, $team_role_id, 0)", +* Nothing in this license impairs or restricts the author\'s moral rights.', + 'license_text' => $cc_by_text, + 'license_url' => 'http://creativecommons.org/licenses/by/3.0/legalcode', + ), ); - foreach ($sql_ary AS $sql_query) + $sql = 'INSERT INTO ' . PROJECT_LICENSES_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $licenses_insert); + + // Create Project Team group + $team_group_id = 0; + $error_message_ary = group_create($team_group_id, GROUP_SPECIAL, 'PROJECT_TEAM', '', array('group_colour' => 'E67300', 'group_receive_pm' => 1, 'group_legend' => 1)); + + if ($error_message_ary !== false) { - $db->sql_query($sql_query); + $db->sql_transaction('rollback'); + trigger_error(implode("<br />\n", $error_message_ary)); } $error_message = group_user_add($team_group_id, array($user->data['user_id']), false, false, false, 1); + $auth_admin->acl_set('group', 0, $team_group_id, 0, $team_role_id); + + $sql = 'INSERT INTO ' . PROJECT_AUTHORS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'author_id' => $user->data['user_id'], + 'author_username' => $user->data['username'], + 'author_realname' => '', + 'author_email' => $user->data['user_email'], + 'author_website' => $user->data['user_website'] + )); + + $db->sql_query($sql); + $this->default_config = array_merge($this->default_config, array( array('project_install_date', $current_time, 0), array('phpbbproject_version', PROJECT_CURRENT_VERSION, 0), @@ -232,6 +273,8 @@ set_config($config_row[0], $config_row[1], $config_row[2]); } + $this->add_modules(); + if ($error_message) { $db->sql_transaction('rollback'); @@ -240,27 +283,10 @@ $db->sql_transaction('commit'); - $template->assign_vars(array( - 'INSTALL_TEXT' => $user->lang['PROJECT_INSTALL_CONFIG_TEXT'], - 'U_NEXT' => append_sid("index.$phpEx", 'i=install&mode=modules'), - )); - - add_form_key('project_install_config'); - - break; - - case 'modules': - - check_form_key('project_install_config', false, '', true); - - $page_title = $user->lang['PROJECT_INSTALL'] . ' » ' . $user->lang['PROJECT_INSTALL_MODULES_TITLE']; - - $this->add_modules(); - $cache->purge(); $template->assign_vars(array( - 'INSTALL_TEXT' => sprintf($user->lang['PROJECT_INSTALL_MODULES_TEXT'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'), + 'INSTALL_TEXT' => $user->lang['PROJECT_INSTALL_CONFIG_TEXT'], 'U_NEXT' => append_sid("{$phpbb_root_path}project.$phpEx"), )); @@ -452,4 +478,77 @@ array('newest_project_id', '0', 1), array('newest_project_title', '', 1), ); + + protected $acl_options_local = array( + 'PROJECT_PROJECTS_TABLE' => array( + 'p_view_project', + 'p_edit_project', + 'p_delete_project', + 'p_download_project', + + 'p_view_docs', + 'p_manage_docs', + + 'p_add_author', + 'p_remove_author', + 'p_assign_role', + 'p_assign_auth', + ), + 'PROJECT_TRACKERS_TABLE' => array( + 'p_post_tickets', + 'p_comment_tickets', + 'p_manage_tickets', + ), + 'PROJECT_CATEGORIES_TABLE' => array( + 'p_view_category', + 'p_category_add_project', + ), + ); + + protected $acl_options_global = array( + 'global' => array( + 'p_add_project', + 'p_manage_category', + 'p_manage_roles', + 'p_approve_project', + ), + ); + + protected $acl_roles = array( + array( + 'role_name' => 'ROLE_PROJECT_USER', + 'role_description' => 'ROLE_DESCRIPTION_PROJECT_USER', + 'role_type' => 'project_', + 'role_order' => 1, + 'auth' => array('p_', 'p_view_project', 'p_download_project', 'p_view_docs'), + ), + array( + 'role_name' => 'ROLE_PROJECT_DOCUMENTOR', + 'role_description' => 'ROLE_DESCRIPTION_PROJECT_DOCUMENTOR', + 'role_type' => 'project_', + 'role_order' => 2, + 'auth' => array('p_', 'p_view_project', 'p_download_project', 'p_view_docs', 'p_manage_docs'), + ), + array( + 'role_name' => 'ROLE_PROJECT_AUTHOR', + 'role_description' => 'ROLE_DESCRIPTION_PROJECT_AUTHOR', + 'role_type' => 'project_', + 'role_order' => 3, + 'auth' => array('p_', 'p_view_project', 'p_edit_project', 'p_download_project', 'p_view_docs', 'p_manage_docs'), + ), + array( + 'role_name' => 'ROLE_PROJECT_MANAGER', + 'role_description' => 'ROLE_DESCRIPTION_PROJECT_MANAGER', + 'role_type' => 'project_', + 'role_order' => 4, + 'auth' => array('p_', 'p_view_project', 'p_edit_project', 'p_delete_project', 'p_download_project', 'p_view_docs', 'p_manage_docs', 'p_add_author', 'p_remove_author', 'p_assign_role', 'p_assign_auth', 'p_manage_tracker'), + ), + array( + 'role_name' => 'ROLE_PROJECT_TEAM', + 'role_description' => 'ROLE_DESCRIPTION_PROJECT_TEAM', + 'role_type' => 'project_', + 'role_order' => 5, + 'auth' => array('p_', 'p_manage_category', 'p_manage_roles', 'p_approve_project'), + ), + ); } \ No newline at end of file Modified: trunk/phpbb3/root/project_install/schemas/schema_data.sql =================================================================== --- trunk/phpbb3/root/project_install/schemas/schema_data.sql 2008-07-30 20:36:15 UTC (rev 285) +++ trunk/phpbb3/root/project_install/schemas/schema_data.sql 2008-07-31 11:15:23 UTC (rev 286) @@ -7,87 +7,6 @@ #------------------------------------------ # -# Auth options -# - -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_', 1, 1); - -# project based auths -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_view_project', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_edit_project', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_delete_project', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_download_project', 1, 0); - -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_view_docs', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_manage_docs', 1, 0); - -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_add_author', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_remove_author', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_assign_role', 1, 0); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_assign_auth', 1, 0); - -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_manage_tracker', 1, 0); - -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_view_category', 1, 0); - -# global auths -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_add_project', 0, 1); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_manage_category', 0, 1); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_manage_roles', 0, 1); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('p_approve_project', 0, 1); - -#------------------------------------------ - -# -# Auth roles -# - -INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_PROJECT_USER', 'ROLE_DESCRIPTION_PROJECT_USER', 'p_', 1); -INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_PROJECT_DOCUMENTOR', 'ROLE_DESCRIPTION_PROJECT_DOCUMENTOR', 'p_', 2); -INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_PROJECT_AUTHOR', 'ROLE_DESCRIPTION_PROJECT_AUTHOR', 'p_', 3); -INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_PROJECT_MANAGER', 'ROLE_DESCRIPTION_PROJECT_MANAGER', 'p_', 4); -INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_PROJECT_TEAM', 'ROLE_DESCRIPTION_PROJECT_TEAM', 'p_', 5); - -#------------------------------------------ - -# -# Roles data -# - -# Regular user -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT r.role_id, a.auth_option_id, 1 FROM phpbb_acl_roles r, phpbb_acl_options a WHERE r.role_name = 'ROLE_PROJECT_USER' AND a.auth_option IN ('p_', 'p_view_project', 'p_download_project', 'p_view_docs'); - -# Documentor -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT r.role_id, a.auth_option_id, 1 FROM phpbb_acl_roles r, phpbb_acl_options a WHERE r.role_name = 'ROLE_PROJECT_DOCUMENTOR' AND a.auth_option IN ('p_', 'p_view_project', 'p_download_project', 'p_view_docs', 'p_manage_docs'); - -# Author -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT r.role_id, a.auth_option_id, 1 FROM phpbb_acl_roles r, phpbb_acl_options a WHERE r.role_name = 'ROLE_PROJECT_AUTHOR' AND a.auth_option IN ('p_', 'p_view_project', 'p_edit_project', 'p_download_project', 'p_view_docs', 'p_manage_docs'); - -# Manager -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT r.role_id, a.auth_option_id, 1 FROM phpbb_acl_roles r, phpbb_acl_options a WHERE r.role_name = 'ROLE_PROJECT_MANAGER' AND a.auth_option IN ('p_', 'p_view_project', 'p_edit_project', 'p_delete_project', 'p_download_project', 'p_view_docs', 'p_manage_docs', 'p_add_author', 'p_remove_author', 'p_assign_role', 'p_assign_auth', 'p_manage_tracker'); - -# Team -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT r.role_id, a.auth_option_id, 1 FROM phpbb_acl_roles r, phpbb_acl_options a WHERE r.role_name = 'ROLE_PROJECT_TEAM' AND a.auth_option IN ('p_', 'p_manage_category', 'p_manage_roles', 'p_approve_project'); - -#------------------------------------------ - -# -# ACL Groups -# - -# Registered users get access to the test category and project :) -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 2, 0, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option = 'p_'; -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 3, 0, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option = 'p_'; - -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 2, 1, 0, role_id, 0 FROM phpbb_acl_roles WHERE role_name = 'ROLE_PROJECT_USER'; -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 3, 1, 0, role_id, 0 FROM phpbb_acl_roles WHERE role_name = 'ROLE_PROJECT_USER'; - -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 2, 1, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option = 'p_view_category'; -INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 3, 1, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option = 'p_view_category'; - -#------------------------------------------ - -# # Demo project # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |