|
From: FlorinCB <ory...@us...> - 2008-09-03 22:10:00
|
Update of /cvsroot/mxbb/mx_phpbb3/admin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10258 Modified Files: mx_module_defs.php Log Message: this file is outdated Index: mx_module_defs.php =================================================================== RCS file: /cvsroot/mxbb/mx_phpbb3/admin/mx_module_defs.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_module_defs.php 1 Sep 2008 04:00:46 -0000 1.1 --- mx_module_defs.php 3 Sep 2008 22:09:52 -0000 1.2 *************** *** 83,122 **** } ! function display_edit_Phpbb_type_select( $block_id, $parameter_id, $parameter_data ) { ! global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix; $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; ! include_once( $module_root_path . "includes/phpbb_constants.$phpEx" ); include_once( $module_root_path . "includes/phpbb_defs.$phpEx" ); $template->set_filenames(array( 'parameter' => 'admin/mx_module_parameters.tpl') ); ! // Get number of forums in db ! $sql = "SELECT * ! FROM " . NEWS_CAT_TABLE . " ! ORDER BY $cat_extract_order"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, "Couldn't obtain forums information.", "", __LINE__, __FILE__, $sql ); } ! $forums = $db->sql_fetchrowset( $result ); $db->sql_freeresult($result); ! // Get array of categories from the database ! $sql = "SELECT cat_id, cat_title ! FROM " . CATEGORIES_TABLE . " ! ORDER BY cat_order"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql ); } ! $categories = $db->sql_fetchrowset( $result ); ! $db->sql_freeresult($result); $phpbb_type_select_data = ( !empty( $mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value'] ) ) ? unserialize($mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value']) : array(); --- 83,172 ---- } ! function display_edit_Phpbb_type_select($block_id, $parameter_id, $parameter_data) { ! global $template, $board_config, $phpbb_auth, $mx_user, $db, $theme, $lang, $images; ! global $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix; $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; ! include_once( $module_root_path . "includes/phpbb3_constants.$phpEx" ); include_once( $module_root_path . "includes/phpbb_defs.$phpEx" ); + if (!function_exists('mx_get_forum_parents')) + { + require_once($mx_root_path . 'modules/mx_phpbb3blocks/includes/mx_functions_display.' . $phpEx); + } $template->set_filenames(array( 'parameter' => 'admin/mx_module_parameters.tpl') ); + + // Get number of forums in db ! $sql = 'SELECT forum_id ! FROM ' . FORUMS_TABLE; ! ! if (sizeof($phpbb_auth->acl)) { ! $sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($phpbb_auth->acl), true); } + $result = $db->sql_query($sql); ! $forum_ids = array(); ! while ($row = $db->sql_fetchrow($result)) ! { ! $forum_ids[] = $row['forum_id']; ! } $db->sql_freeresult($result); ! //print_r($forum_ids); ! $sql_from = FORUMS_TABLE . ' f'; ! ! $sql = "SELECT f.* ! FROM $sql_from"; ! //WHERE forum_id <> 0"; ! $sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($forum_ids), true); ! $result = $db->sql_query($sql); ! $forums = $db->sql_fetchrow($result); ! $db->sql_freeresult($result); ! ! if (!$forums) { ! trigger_error('NO_FORUM'); } + + // Get array of categories from the database + $categories = array(); + + //if ($forums['parent_id'] > 0) + //{ + if ($forums['forum_parents'] == '') + { + $sql = 'SELECT forum_id, forum_name, forum_type + FROM ' . FORUMS_TABLE . ' + WHERE left_id < ' . $forums['left_id'] . ' + AND right_id > ' .$forums['right_id'] . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); ! while ($row = $db->sql_fetchrow($result)) ! { ! $categories[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']); ! } ! $db->sql_freeresult($result); ! ! $forums['forum_parents'] = serialize($categories); ! ! $sql = 'UPDATE ' . FORUMS_TABLE . " ! SET forum_parents = '" . $db->sql_escape($forums['forum_parents']) . "' ! WHERE parent_id = " . $forums['parent_id']; ! $db->sql_query($sql); ! } ! else ! { ! $categories = unserialize($forums['forum_parents']); ! } ! //} ! ! print_r($categories); $phpbb_type_select_data = ( !empty( $mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value'] ) ) ? unserialize($mx_blockcp->block_parameters['Source_phpBB_Forums']['parameter_value']) : array(); *************** *** 125,129 **** // Check that some categories exist // ! if ( $total_categories = count( $categories ) ) { // --- 175,179 ---- // Check that some categories exist // ! if ($total_categories = count($categories)) { // *************** *** 160,164 **** $template->assign_vars(array( 'SCRIPT_PATH' => $module_root_path, ! 'MX_IMAGES_ROOT' => $mx_root_path . 'templates/subSilver/images/admin_icons/', 'MX_ROOT_PATH' => $mx_root_path, 'NAME' => $lang[$parameter_data['parameter_name']], --- 210,214 ---- $template->assign_vars(array( 'SCRIPT_PATH' => $module_root_path, ! 'MX_IMAGES_ROOT' => $mx_root_path . 'templates/_core/images/admin_icons/', 'MX_ROOT_PATH' => $mx_root_path, 'NAME' => $lang[$parameter_data['parameter_name']], |