1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-10 17:45:18 +02:00

Fix the module insertion

git-svn-id: file:///svn/phpbb/trunk@5900 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-05-12 19:44:28 +00:00
parent aa42a83b9e
commit 8a37c7572c
2 changed files with 59 additions and 13 deletions

View File

@ -766,7 +766,7 @@ class install_install extends module
'BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'],
'L_DL_CONFIG' => $lang['DL_CONFIG'],
'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'],
'L_DL_DONE' => $lang['DL_DONE'],
'L_DL_DONE' => $lang['DONE'],
'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'],
'S_HIDDEN' => $s_hidden_fields,
'S_SHOW_DOWNLOAD' => true,
@ -1107,6 +1107,12 @@ class install_install extends module
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
// recalculate binary tree
if (!function_exists('recalc_btree'))
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
$_module = &new acp_modules();
$module_classes = array('acp', 'mcp', 'ucp');
@ -1133,7 +1139,8 @@ class install_install extends module
$error = $db->sql_error();
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
}
$categories[$cat_name] = $db->sql_nextid();
$categories[$cat_name]['id'] = $db->sql_nextid();
$categories[$cat_name]['parent_id'] = 0;
if (is_array($subs))
{
@ -1143,7 +1150,7 @@ class install_install extends module
'module_name' => '',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $categories[$cat_name],
'parent_id' => $categories[$cat_name]['id'],
'module_class' => $module_class,
'module_langname' => $level2_name,
'module_mode' => '',
@ -1156,11 +1163,14 @@ class install_install extends module
$error = $db->sql_error();
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
}
$categories[$level2_name] = $db->sql_nextid();
$categories[$level2_name]['id'] = $db->sql_nextid();
$categories[$level2_name]['parent_id'] = $categories[$cat_name]['id'];
}
}
}
recalc_btree('module_id', MODULES_TABLE, $module_class);
// Get the modules we want to add...
$module_info = $_module->get_module_infos('', $module_class);
@ -1174,7 +1184,7 @@ class install_install extends module
'module_name' => $module_name,
'module_enabled' => 1,
'module_display' => (isset($row['display'])) ? $row['display'] : 1,
'parent_id' => $categories[$cat_name],
'parent_id' => $categories[$cat_name]['id'],
'module_class' => $module_class,
'module_langname' => $row['title'],
'module_mode' => $module_mode,
@ -1182,20 +1192,51 @@ class install_install extends module
);
// $_module->update_module_data($module_data);
$sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data);
/* $sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data);
if (!$db->sql_query($sql))
{
$error = $db->sql_error();
$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
}
}
}
}
}*/
$sql = 'SELECT left_id, right_id
FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $module_class . "'
AND module_id = {$module_data['parent_id']}";
$result = $db->sql_query($sql);
// recalculate binary tree
if (!function_exists('recalc_btree'))
$row = $db->sql_fetchrow($result);
//print_r($row);
$db->sql_freeresult($result);
if ($categories[$cat_name]['parent_id'])
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
$sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + 2, right_id = right_id + 2
WHERE module_class = '" . $module_class . "'
AND left_id > {$row['right_id']}";
$db->sql_query($sql);
$sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id + 2
WHERE module_class = '" . $module_class . "'
AND {$row['left_id']} BETWEEN left_id AND right_id";
$db->sql_query($sql);
}
else
{
$sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + 3, right_id = right_id + 3
WHERE module_class = '" . $module_class . "'
AND left_id > {$row['left_id']}";
$db->sql_query($sql);
}
$module_data['left_id'] = ($categories[$cat_name]['parent_id']) ? $row['right_id'] : $row['left_id'] + 1;
$module_data['right_id'] = ($categories[$cat_name]['parent_id']) ? $row['right_id'] + 1 : $row['left_id'] + 2;
$sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data);
$db->sql_query($sql);
}
}
}
recalc_btree('module_id', MODULES_TABLE, $module_class);

View File

@ -52,7 +52,9 @@ $lang = array_merge($lang, array(
'CONFIG_RETRY' => 'Retry',
'CONTACT_EMAIL' => 'Contact email address',
'CONTACT_EMAIL_CONFIRM' => 'Confirm contact email',
'CONTINUE_CONVERT' => 'Continue conversion',
'CONVERT' => 'Convert',
'CONVERT_COMPLETE' => 'Conversion completed',
'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework',
'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) forum systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the forum software you wish to convert from, please check our website where further conversion modules may be available for download.',
'CONVERT_NOT_EXIST' => 'The specified convertor does not exist',
@ -90,7 +92,7 @@ $lang = array_merge($lang, array(
'DL_CONFIG' => 'Download config',
'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.0 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click "Done" to move to the next stage.',
'DL_DOWNLOAD' => 'Download',
'DL_DONE' => 'Done',
'DONE' => 'Done',
'FILE_FOUND' => 'Found',
'FILE_NOT_FOUND' => 'Cannot find',
@ -191,6 +193,7 @@ $lang = array_merge($lang, array(
'STAGE_DATABASE' => 'Database Settings',
'STAGE_FINAL' => 'Final Stage',
'STAGE_INTRO' => 'Introduction',
'STAGE_IN_PROGRESS' => 'Conversion in progress',
'STAGE_REQUIREMENTS' => 'Requirements',
'STAGE_SETTINGS' => 'Settings',
'SUB_INTRO' => 'Introduction',
@ -199,6 +202,8 @@ $lang = array_merge($lang, array(
'SUCCESSFUL_CONNECT' => 'Successful Connection',
// TODO: Write some text on obtaining support
'SUPPORT_BODY' => '<p>Some text on obtaining support, etc can go here.</p><p>Probably this can be copied from the documentation</p><p>To ensure you stay up to date with the latest news and releases, why not <a href="http://www.phpbb.com/support/" target="_new">subscribe to our mailing list</a></p>',
'SYNC_FORUMS' => 'Starting to sync forums',
'SYNC_TOPICS' => 'Starting to sync topics',
'TABLE_PREFIX' => 'Prefix for tables in database',
'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.<br />&#187; Specified table prefix was %s',