[Phpbbproject-svn] SF.net SVN: phpbbproject: [267] trunk
phpBB download manager, mainly aimed at MOD authors
Status: Planning
Brought to you by:
lord_le_brand
From: <lor...@us...> - 2008-04-23 22:53:52
|
Revision: 267 http://phpbbproject.svn.sourceforge.net/phpbbproject/?rev=267&view=rev Author: lord_le_brand Date: 2008-04-23 15:53:55 -0700 (Wed, 23 Apr 2008) Log Message: ----------- Deleted temporary files More work on create project module, finish in sight Modified Paths: -------------- trunk/phpbb3/root/includes/project/project_main.php trunk/phpbb3/root/includes/sources_project/create_project.php trunk/phpbb3/root/includes/sources_project/functions_create.php trunk/phpbb3/root/styles/prosilver/template/project_create.html Removed Paths: ------------- trunk/develop/autopost.temp.php trunk/develop/create_project.temp.php Deleted: trunk/develop/autopost.temp.php =================================================================== --- trunk/develop/autopost.temp.php 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/develop/autopost.temp.php 2008-04-23 22:53:55 UTC (rev 267) @@ -1,331 +0,0 @@ -<? -/** - * Handle autoposting - * - * @param array $info_array - * @param array $authors - * @param boolean|array $history - * @param boolean|array $update - * @return integer|boolean Either post_id or topic_id, depending on $update, or false on failure - */ -function project_autopost($info_array, $authors, $history = false, $update = false) -{ - global $db, $config, $user, $auth; - global $phpbb_root_path, $phpEx; - - include_once("{$phpbb_root_path}includes/functions_posting.$phpEx"); - include_once("{$phpbb_root_path}includes/message_parser.$phpEx"); - - $forum_root_path = generate_board_url(); - - $stages_ary = array( - PROJECT_STAGE_ALPHA => $user->lang['PROJECT_STAGE_ALPHA'], - PROJECT_STAGE_BETA => $user->lang['PROJECT_STAGE_BETA'], - PROJECT_STAGE_DEV => $user->lang['PROJECT_STAGE_DEV'], - PROJECT_STAGE_RC => $user->lang['PROJECT_STAGE_RC'], - PROJECT_STAGE_STABLE => $user->lang['PROJECT_STAGE_STABLE'], - ); - - $post_tpl = new template(); - $post_tpl->set_custom_template("{$phpbb_root_path}store/phpbbproject/autopost", 'project_autopost'); - - if ($update) - { - // Reply to topic $info_array['topic_id'] - $topic_id = $info_array['topic_id']; - - if (!$topic_id) - { - return false; - } - - $post_tpl->set_filenames(array( - 'first_post_body' => 'topic_layout.html', - 'first_post_title' => 'topic_title.html', - 'update_post_body' => 'update_post_layout.html', - 'update_post_title' => 'update_post_title.html', - )); - - if ($history) - { - for ($i = 0, $size = sizeof($history); $i < $size; $i++) - { - $post_tpl->assign_block_vars('history', array( - 'DATE' => date('Y-m-d', $history[$i]['version_time']), - 'VERSION' => "{$history[$i]['version_major']}.{$history[$i]['version_minor']}.{$history[$i]['version_revision']}{$history[$i]['version_release']}", - 'CHANGELOG' => $history[$i]['version_changelog'], - - 'U_UPDATE_POST' => ($history[$i]['version_post_id']) ? "{$forum_root_path}viewtopic.$phpEx?t=$topic_id&p={$history[$i]['version_post_id']}#{$history[$i]['version_post_id']}" : '', - 'U_DIFF' => ($history[$i]['version_id'] && $history[$i]['previous_version_id']) ? "{$forum_root_path}project.$phpEx?i=project&mode=diff&pr={$info_array['project_id']}&dm=normal&nv={$history[$i]['version_id']}&ov={$history[$i]['previous_version_id']}" : '', - )); - } - } - - for ($i = 0, $size = sizeof($authors); $i < $size; $i++) - { - $post_tpl->assign_block_vars('author', array( - 'USERNAME' => $authors[$i]['author_username'], - 'REAL_NAME' => $authors[$i]['author_realname'], - 'EMAIL' => $authors[$i]['author_email'], - 'WEBSITE' => $authors[$i]['author_website'], - 'ROLE' => $authors[$i]['author_role_title'], - - 'S_STARTER' => ($authors[$i]['author_id'] == $info_array['project_start_id']) ? true : false, - - 'U_AUTHOR' => "{$forum_root_path}project.$phpEx?i=author&mode=view&u={$authors[$i]['author_id']}", - )); - } - - $post_tpl->assign_vars(array( - 'PROJECT_TITLE' => $info_array['project_title'], - 'PROJECT_TITLE_CLEAN' => $info_array['project_title_clean'], - 'PROJECT_DESCRIPTION' => $info_array['project_description'], - 'AUTHOR_NOTES' => $info_array['project_notes'], - - 'DATE' => $info_array['project_last_update'], - 'VERSION' => $info_array['project_version'], - 'TARGET_VERSION' => $info_array['project_target_version'], - - 'DEV_STAGE_ID' => $info_array['project_stage'], - 'DEV_STAGE_UC' => strtoupper($stages_ary[$info_array['project_stage']]), - 'DEV_STAGE_LC' => strtolower($stages_ary[$info_array['project_stage']]), - 'DEV_STAGE_NC' => $stages_ary[$info_array['project_stage']], - - 'U_DOWNLOAD' => "{$forum_root_path}project.$phpEx?i=project&mode=download&pr={$info_array['project_id']}", - 'U_PROJECT_INFO' => "{$forum_root_path}project.$phpEx?i=project&mode=view&pr={$info_array['project_id']}", - - // Update post extra vars - 'CHANGELOG' => $update['changelog'], - - 'U_DIFF' => "{$forum_root_path}project.$phpEx?i=project&mode=diff&pr={$info_array['project_id']}&dm=normal&nv={$update['version_id']}&ov={$update['previous_version_id']}", - 'U_TOPIC' => "{$forum_root_path}viewtopic.$phpEx?t=$topic_id", - - 'OLD_TARGET_VERSION' => $update['previous_target_version'], - 'OLD_VERSION' => $update['previous_version'], - 'OLD_DEV_STAGE_ID' => $update['previous_dev_stage'], - )); - - ob_start(); - $post_tpl->display('first_post_body'); - $first_post_contents = ob_get_contents(); - ob_clean(); - $post_tpl->display('first_post_title'); - $first_post_title = ob_get_contents(); - ob_clean(); - $post_tpl->display('update_post_body'); - $update_post_contents = ob_get_contents(); - ob_clean(); - $post_tpl->display('update_post_title'); - $update_post_title = ob_get_clean(); - } - else - { - $post_tpl->set_filenames(array( - 'post_body' => 'topic_layout.html', - 'post_title' => 'topic_title.html', - )); - - if ($history) - { - for ($i = 0, $size = sizeof($history); $i < $size; $i++) - { - $post_tpl->assign_block_vars('history', array( - 'DATE' => date('Y-m-d', $history[$i]['version_time']), - 'VERSION' => "{$history[$i]['version_major']}.{$history[$i]['version_minor']}.{$history[$i]['version_revision']}{$history[$i]['version_release']}", - 'CHANGELOG' => $history[$i]['version_changelog'], - - 'U_UPDATE_POST' => '', - 'U_DIFF' => '', - )); - } - } - - for ($i = 0, $size = sizeof($authors); $i < $size; $i++) - { - $post_tpl->assign_block_vars('author', array( - 'USERNAME' => $authors[$i]['author_username'], - 'REAL_NAME' => $authors[$i]['author_realname'], - 'EMAIL' => $authors[$i]['author_email'], - 'WEBSITE' => $authors[$i]['author_website'], - 'ROLE' => $authors[$i]['author_role_title'], - - 'S_STARTER' => ($authors[$i]['author_id'] == $info_array['project_start_id']) ? true : false, - 'U_AUTHOR' => "{$forum_root_path}project.$phpEx?i=author&mode=view&u={$authors[$i]['author_id']}", - )); - } - - $post_tpl->assign_vars(array( - 'PROJECT_TITLE' => $info_array['project_title'], - 'PROJECT_TITLE_CLEAN' => $info_array['project_title_clean'], - 'PROJECT_DESCRIPTION' => $info_array['project_description'], - 'AUTHOR_NOTES' => $info_array['project_notes'], - - 'DATE' => $info_array['project_last_update'], - 'VERSION' => $info_array['project_version'], - 'TARGET_VERSION' => $info_array['project_target_version'], - - 'DEV_STAGE_ID' => $info_array['project_stage'], - 'DEV_STAGE_UC' => strtoupper($stages_ary[$info_array['project_stage']]), - 'DEV_STAGE_LC' => strtolower($stages_ary[$info_array['project_stage']]), - 'DEV_STAGE_NC' => $stages_ary[$info_array['project_stage']], - - 'U_DOWNLOAD' => "{$forum_root_path}project.$phpEx?i=project&mode=download&pr={$info_array['project_id']}", - 'U_PROJECT_INFO' => "{$forum_root_path}project.$phpEx?i=project&mode=view&pr={$info_array['project_id']}", - )); - - ob_start(); - $post_tpl->display('post_body'); - $first_post_contents = ob_get_contents(); - ob_clean(); - $post_tpl->display('post_title'); - $first_post_title = ob_get_clean(); - } - - // Get forum ID - if ($config['project_autopost_forum_per_category']) - { - $sql = 'SELECT c.forum_id, f.forum_name - FROM ' . PROJECT_CATEGORIES_TABLE . ' c, ' . FORUMS_TABLE . ' f - WHERE c.category_id = ' . (int) $info_array['category_id'] . ' - AND f.forum_id = c.forum_id'; - - $db->sql_query($sql, 604800); - $forum_data = $db->sql_fetchrow(); - $db->sql_freeresult(); - } - else - { - $sql = 'SELECT forum_id, forum_name - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . (int) $config['project_autopost_forum_id']; - - $db->sql_query($sql, 604800); - $forum_data = $db->sql_fetchrow(); - $db->sql_freeresult(); - } - - $forum_id = $forum_data['forum_id']; - $forum_name = $forum_data['forum_name']; - - // submit_post() needs $user to be the info of the posting user, this is not the case here, so make a workaround - $this_user = $user; - - $user->data['is_registered'] = false; - $user->data['user_id'] = $config['project_autopost_user_id']; - - $sql = 'SELECT username, user_colour - FROM ' . USERS_TABLE . ' - WHERE user_id = ' . (int) $user->data['user_id']; - - $db->sql_query($sql, 604800); - $userdata = $db->sql_fetchrow(); - $db->sql_freeresult(); - - $user->data['username'] = $userdata['username']; - $user->data['user_colour'] = $userdata['user_colour']; - $user->data['user_permissions'] = ''; - $user->ip = '127.0.0.1'; - $auth->acl($user->data); - - $message_parser = new parse_message($first_post_contents); - - if ($update) - { - $update_message_parser = new parse_message($update_post_contents); - $update_message_parser->parse(1, 1, 1); - - $sql = 'SELECT t.topic_replies_real, p.post_id, p.bbcode_uid, p.post_time - FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p - WHERE t.topic_id = $topic_id - AND p.post_id = t.topic_first_post_id"; - - $db->sql_query($sql); - $post_data = $db->sql_fetchrow(); - $db->sql_freeresult(); - - $message_parser->bbcode_uid = $post_data['bbcode_uid']; - } - - $message_parser->parse(1, 1, 1); - - - // Build data array - $data = array( - 'topic_title' => $first_post_title, - 'post_subject' => $first_post_title, - 'forum_id' => $forum_id, - 'forum_name' => $forum_name, - 'icon_id' => 0, - - 'enable_bbcode' => 1, - 'enable_smilies' => 1, - 'enable_urls' => 1, - 'enable_sig' => 0, - 'enable_indexing' => 1, - - 'message' => $message_parser->message, - 'message_md5' => md5($message_parser->message), - - 'bbcode_bitfield' => $message_parser->bbcode_bitfield, - 'bbcode_uid' => $message_parser->bbcode_uid, - - 'attachment_data' => array(), - - 'post_edit_locked' => false, - 'post_time' => (isset($post_data['post_time'])) ? (int) $post_data['post_time'] : time(), - - ); - - $poll = array(); - - if ($update) - { - $data = array_merge($data, array('topic_id' => $topic_id, 'topic_first_post_id' => $post_data['post_id'], 'post_id' => $post_data['post_id'], 'topic_replies_real' => $post_data['topic_replies_real'], 'poster_id' => $user->data['user_id'], 'topic_approved' => true, 'post_approved' => true)); - submit_post('edit', $first_post_title, '', POST_NORMAL, $poll, $data); - - $update_data = array( - 'topic_id' => $topic_id, - 'post_subject' => $update_post_title, - 'forum_id' => $forum_id, - 'forum_name' => $forum_name, - 'icon_id' => 0, - - 'enable_bbcode' => 1, - 'enable_smilies' => 1, - 'enable_urls' => 1, - 'enable_sig' => 0, - 'enable_indexing' => 1, - - 'message' => $update_message_parser->message, - 'message_md5' => md5($update_message_parser->message), - - 'bbcode_bitfield' => $update_message_parser->bbcode_bitfield, - 'bbcode_uid' => $update_message_parser->bbcode_uid, - - 'attachment_data' => array(), - - 'post_edit_locked' => false, - 'post_time' => time(), - ); - - submit_post('reply', $update_post_title, '', POST_NORMAL, $poll, $update_data); - } - else - { - submit_post('post', $first_post_title, '', POST_NORMAL, $poll, $data); - } - - $user = $this_user; - $auth->acl($user->data); - - if (!$update) - { - $sql = 'UPDATE ' . PROJECT_PROJECTS_TABLE . ' - SET topic_id = ' . (int) $data['topic_id'] . ' - WHERE project_id = ' . $info_array['project_id']; - $db->sql_query($sql); - } - - return ($update) ? $update_data['post_id'] : $data['topic_id']; -} -?> \ No newline at end of file Deleted: trunk/develop/create_project.temp.php =================================================================== --- trunk/develop/create_project.temp.php 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/develop/create_project.temp.php 2008-04-23 22:53:55 UTC (rev 267) @@ -1,169 +0,0 @@ -<? - -/** - * Create a new project - * - * @param string $mode - * @param array $info_array - * @param array $authors - * @param array|boolean $history - * @param array|boolean $actions - * @param array|boolean $old_actions - * @return boolean|string Either false if succesful of the error message - */ -function project_create($mode, $info_array, $authors, $history = false, $actions = false, $old_actions = false) -{ - global $db, $config, $auth, $user; - - // Check permissions - if (!$auth->acl_get('p_add_project')) - { - return $user->lang['PROJECT_NOT_AUTH_CREATE']; - } - if (!$auth->acl_get('p_view_category', $info_array['category_id'])) - { - return $user->lang['PROJECT_NOT_AUTH_CAT']; - } - - // Time & date of project creation - $current_time = time(); - - // History and action information are only needed for importing - if ($mode != 'import') - { - $history = $actions = $old_actions = false; - } - - // Variable types for database protection - $info_vars = array('category_id' => 'int' - , 'project_title' => 'string', - 'project_description' => 'string', - 'project_notes' => 'string', - 'project_license' => 'int', - 'project_target_version' => 'string', - 'project_version' => 'string', - 'project_stage' => 'int', - 'project_logo' => 'string', - 'project_logo_type' => 'int', - 'project_logo_width' => 'int', - 'project_logo_height' => 'int', - 'is_active' => 'int', - 'file_only' => 'int'); - - $error_message = ''; - foreach ($info_vars AS $var => $type) - { - if (!isset($info_array[$var])) - { - $error_message .= (($error_message) ? '<br />' : '') . sprintf($user->lang['FIELD_REQUIRED'], $var); - } - - $$var = ($type == 'string') ? $db->sql_escape($info_array[$var]) : intval($info_array[$var]); - } - if (!empty($error_message)) - { - return $error_message; - } - - // Clean title for uniqueness - $info_array['project_title_clean'] = utf8_clean_string($info_array['project_title']); - $project_title_clean = $db->sql_escape($info_array['project_title_clean']); - - $info_array['project_install_time'] = ($actions) ? project_generate_install_time($actions) : 0; - $info_array['project_level'] = ($actions) ? project_generate_level('actions', $actions) : PROJECT_LEVEL_EASY; - - $info_array['project_start_time'] = (empty($info_array['project_start_time'])) ? $current_time : intval($info_array['project_start_time']); - $info_array['project_start_id'] = (empty($info_array['project_start_id'])) ? $user->data['user_id'] : intval($info_array['project_start_id']); - $info_array['project_start_author'] = (empty($info_array['project_start_author'])) ? project_get_author_name($user->data['user_id']) : $info_array['project_start_author']; - - $project_start_author = $db->sql_escape($info_array['project_start_author']); - - $info_array['project_last_update'] = $current_time; - - /** - * @todo $authors, $history, $actions, $old_actions... Also, add some setting for permissions - */ - - // All set to go into the database :-) - $db->sql_transaction('begin'); - - $sql = 'INSERT INTO ' . PROJECT_PROJECTS_TABLE . " (category_id, project_title, project_title_clean, project_description, project_level, project_install_time, project_notes, project_license, project_target_version, project_version, project_stage, project_logo, project_logo_type, project_logo_width, project_logo_height, project_start_time, project_start_id, project_start_author, project_last_update, is_active, file_only, project_downloads) - VALUES ($category_id, '$project_title', '$project_title_clean', '$project_description', {$info_array['project_level']}, {$info_array['project_install_time']}, '$project_notes', $project_license, '$project_target_version', '$project_version', $project_stage, '$project_logo', $project_logo_type, $project_logo_width, $project_logo_height, {$info_array['project_start_time']}, {$info_array['project_start_id']}, '$project_start_author', {$info_array['project_last_update']}, $is_active, $file_only, 0)"; - $db->sql_query($sql); - - $info_array['project_id'] = $project_id = $db->sql_nextid(); - - for ($i = 0, $size = sizeof($authors); $i < $size; $i++) - { - $db->sql_query('INSERT INTO ' . PROJECT_PROJECT_AUTHORS_TABLE . " (project_id, author_id, author_role) - VALUES ($project_id, {$authors[$i]['author_id']}, {$authors[$i]['author_role_id']})"); - } - - if ($history) - { - for ($i = 0, $size = sizeof($history); $i < $size; $i++) - { - $db->sql_query('INSERT INTO ' . PROJECT_VERSIONS_TABLE . " (project_id, previous_id, version_time, version_major, version_minor, version_revision, version_release, version_stage, version_changelog) - VALUES ($project_id, {$history[$i]['previous_id']}, {$history[$i]['version_time']}, {$history[$i]['version_major']}, {$history[$i]['version_minor']}, {$history[$i]['version_revision']}, '{$history[$i]['version_release']}', {$history[$i]['version_stage']}, {$history[$i]['version_changelog']})"); - } - - $version_time = $history[$i]['version_time']; - } - else - { - $db->sql_query('INSERT INTO ' . PROJECT_VERSIONS_TABLE . " (project_id, previous_id, version_time, version_major, version_minor, version_revision, version_release, version_stage, version_changelog) - VALUES ($project_id, 0, $current_time, 0, 0, 0, '', " . PROJECT_STAGE_DEV . ", '')"); - - $version_time = $current_time; - } - - $version_id = $db->sql_nextid(); - - if ($actions) - { - for ($i = 0, $size = sizeof($actions); $i < $size; $i++) - { - /** - * @todo Something tells me this could be much more efficient... - */ - $db->sql_query('INSERT INTO ' . PROJECT_ACTIONS_TABLE . " (project_id) - VALUES ($project_id)"); - - $actions[$i]['action_id'] = $action_id = $db->sql_nextid(); - - $db->sql_query('INSERT INTO ' . PROJECT_ACTION_CONTENTS_TABLE . " (action_id, version_id, version_time, action_order, action_type, action_content) - VALUES ($action_id, $version_id, $version_time, {$actions[$i]['action_order']}, {$actions[$i]['action_type']}, '{$actions[$i]['action_content']}')"); - } - } - - // Update project count for category - $sql = 'UPDATE ' . PROJECT_CATEGORIES_TABLE . " - SET category_projects = category_projects + 1, - last_update_id = $project_id, - last_update_time = {$info_array['project_last_update']} - WHERE category_id = {$info_array['category_id']}"; - $db->sql_query($sql); - - // And roll it - $db->sql_transaction('commit'); - - // Now post it if needed - if ($config['project_autopost_enable']) - { - $topic_id = project_autopost($info_array, $authors, $history); - - if (!$topic_id) - { - return $user->lang['PROJECT_AUTOPOST_FAILURE']; - } - - $sql = 'UPDATE ' . PROJECT_PROJECTS_TABLE . ' - SET topic_id = ' . (int) $topic_id . ' - WHERE project_id = ' . $project_id; - $db->sql_query($sql); - } - - return false; -} - -?> \ No newline at end of file Modified: trunk/phpbb3/root/includes/project/project_main.php =================================================================== --- trunk/phpbb3/root/includes/project/project_main.php 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/phpbb3/root/includes/project/project_main.php 2008-04-23 22:53:55 UTC (rev 267) @@ -322,41 +322,18 @@ } } - /** - * @todo Decompress archives - * @todo Handle included files - */ - $included_files = false; + $filetype = request_var('filetype', PROJECT_FILETYPE_XML); - $filetype = request_var('filetype', PROJECT_FILETYPE_TEXT); - - // Parse the file given - /** - * @todo change parser class - */ - $parser = new parse_project($project_file, $filetype); - - // If there's anything wrong, display error here... - $message = $parser->validate(); - - if ($parser->error) + if ($filetype == PROJECT_FILETYPE_XML) { - trigger_error($user->lang['PROJECT_IMPORT_FAILURE'] . ':<br /><br />' . $message, E_USER_WARNING); + $import = new project_import_modx($project_file); } + $import->process(); - if (($message = project_create('import', $parser->info_array, $parser->authors, $parser->history, $parser->actions)) !== false) + if ($import->error) { trigger_error($user->lang['PROJECT_IMPORT_FAILURE'] . ':<br /><br />' . $message, E_USER_WARNING); } - - if ($included_files) - { - /** - * @todo Function for included files... - */ - } - - trigger_error($user->lang['PROJECT_IMPORT_SUCCESS']); } $this->tpl_name = 'project_import'; @@ -376,12 +353,16 @@ } // Get the data in + /** + * @todo target_version generation + */ $data = array( 'project_category' => request_var('project_category', 0), 'project_title' => utf8_normalize_nfc(request_var('project_title', '', true)), 'project_description' => utf8_normalize_nfc(request_var('project_description', '', true)), 'project_notes' => utf8_normalize_nfc(request_var('project_notes', '', true)), 'project_license' => request_var('project_license', 0), + 'file_only' => (request_var('file_only', false)) ? true : false, ); // Validate the title (Check duplicate, length, invalid chars, etc.) @@ -390,9 +371,49 @@ $error[] = (isset($user->lang[$title_err])) ? $user->lang[$title_err] : $title_err; } - $file_only = (request_var('file_only', false)) ? true : false; + if (!sizeof($error)) + { + $create = new project_create($data, $authors); + if ($create->error) + { + $error[] = $create->error; + } + else + { + $return_ary = $create->process(); + + if (!$return_ary['project_id']) + { + trigger_error($user->lang['PROJECT_CREATE_FAILURE']); + } + + $project_link = '<a href="' . append_sid("{$phpbb_root_path}project.$phpEx", "i=project&c={$data['project_category']}&pr={$return_ary['project_id']}") . '">'; + $topic_link = (isset($return_ary['topic_id'])) ? '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$return_ary['topic_id']}") . '">' : ''; + $message = $user->lang['PROJECT_CREATE_SUCCESS']; + $message .= '<br /><br />' . sprintf($user->lang['PROJECT_VIEW_PROJECT'], $project_link, '</a>'); + $message .= (isset($return_ary['topic_id'])) ? '<br />' . sprintf($user->lang['PROJECT_VIEW_TOPIC'], $topic_link, '</a>') : ''; + $message .= '<br /><br />' . sprintf($user->lang['PROJECT_BACK_OVERVIEW'], '<a href="' . append_sid("{$phpbb_root_path}project.$phpEx", 'i=main') . '">', '</a>'); + + trigger_error($message); + } + } + + $template->assign_vars(array( + 'ERROR' => implode('<br />', $error), + 'PROJECT_TITLE' => $data['project_title'], + 'PROJECT_DESCRIPTION' => $data['project_description'], + 'PROJECT_NOTES' => $data['project_notes'], + 'PROJECT_LICENSE' => $data['project_license'], + 'FILE_ONLY' => $data['file_only'], + )); } + /** + * @todo Add queries for categories and licenses + */ + + add_form_key('project_create'); + $this->tpl_name = 'project_create'; $this->page_title = 'PROJECT_CREATE_PROJECT'; Modified: trunk/phpbb3/root/includes/sources_project/create_project.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/create_project.php 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/phpbb3/root/includes/sources_project/create_project.php 2008-04-23 22:53:55 UTC (rev 267) @@ -17,6 +17,7 @@ { public $current_time; public $error; + public $message; protected $data; protected $authors; @@ -125,10 +126,14 @@ // Now post it if needed if ($config['project_autopost_enable'] && !$config['project_approve_creation']) { - project_autopost($this->data, $this->authors); + $topic_id = project_autopost($this->data, $this->authors); + return array( + 'project_id' => $project_id, + 'topic_id' => $topic_id + ); } - return $project_id; + return array('project_id' => $project_id); } } @@ -256,10 +261,14 @@ // Now post it if needed if ($config['project_autopost_enable'] && !$config['project_approve_creation']) { - project_autopost($this->data, $this->authors, $this->history); + $topic_id = project_autopost($this->data, $this->authors, $this->history); + return array( + 'project_id' => $project_id, + 'topic_id' => $topic_id + ); } - return $project_id; + return array('project_id' => $project_id); } } Modified: trunk/phpbb3/root/includes/sources_project/functions_create.php =================================================================== --- trunk/phpbb3/root/includes/sources_project/functions_create.php 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/phpbb3/root/includes/sources_project/functions_create.php 2008-04-23 22:53:55 UTC (rev 267) @@ -3,7 +3,7 @@ * phpBB Project functions_create * * @package phpbbproject - * @version $Id:$ + * @version $Id$ * @copyright (c) 2008 phpBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License */ Modified: trunk/phpbb3/root/styles/prosilver/template/project_create.html =================================================================== --- trunk/phpbb3/root/styles/prosilver/template/project_create.html 2008-04-23 20:21:14 UTC (rev 266) +++ trunk/phpbb3/root/styles/prosilver/template/project_create.html 2008-04-23 22:53:55 UTC (rev 267) @@ -30,13 +30,13 @@ <dl> <dt><label for="project_license">{L_PROJECT_LICENSE}:</label></dt> <dd><select tabindex="5" name="project_license" id="project_license" title="{L_PROJECT_LICENSE}" onchange="set_description(this.value)"><!-- BEGIN license --> - <option value="{license.LICENSE_ID}"<!-- IF license.S_STANDARD --> selected="selected"<!-- ENDIF -->>{license.LICENSE_TITLE}</option><!-- END --> + <option value="{license.LICENSE_ID}"<!-- IF (license.S_STANDARD && not PROJECT_LICENSE) || license.LICENSE_ID == PROJECT_LICENSE --> selected="selected"<!-- ENDIF -->>{license.LICENSE_TITLE}</option><!-- END --> </select> <span id="license_description">{LICENSE_DESCRIPTION}</span></dd> </dl> <dl> <dt><label for="file_only">{L_PROJECT_FILE_ONLY}:</label><br /><span>{L_PROJECT_FILE_ONLY_EXPLAIN}</span></dt> - <dd><input type="checkbox" tabindex="6" name="file_only" id="file_only" /></dd> + <dd><input type="checkbox" tabindex="6" name="file_only" id="file_only"<!-- IF FILE_ONLY --> checked="checked"<!-- ENDIF --> /></dd> </dl> {S_FORM_TOKEN} </fieldset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |