|
From: OryNider <ory...@us...> - 2008-01-15 12:29:11
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb3/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27707 Added Files: functions_hook.php Log Message: Culprit Olympus ACP stuff. --- NEW FILE: functions_hook.php --- <?php /** * * @package Functions_phpBB3 * @version $Id: functions_hook.php,v 1.1 2008/01/15 12:29:05 orynider Exp $ * @copyright (c) 2002-2006 mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * @link http://www.mxbb.net * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } //error_reporting( E_ALL | !E_NOTICE); //include_once( $phpbb_root_path . 'adm/index.'. $phpEx); class phpbb3_hook { var $main_part = ''; var $current_tab = ''; function phpbb3() { } function hook( $part, $curr_tab = '', $mode = '') { global $lang, $mx_user, $phpEx; switch( $part) { case 'forum': case 'admin': $this->main_part = $part; //print_r( $mx_user);die(); //include_once( $mx_user->lang_path . 'acp/common.'.$phpEx); break; case 'tabs': if ( $this->main_part == 'admin') { return $this->admin_tabs( $curr_tab); } break; case 'menu': if( $this->main_part == 'admin') { return $this->admin_menu( $curr_tab); } break; case 'panel': if ( $this->main_part == 'admin') { return $this->admin_panel( $curr_tab, $mode); } break; } } function admin_menu( $part) { if ( $this->main_part != 'admin') { return false; } global $db, $lang, $template, $mx_user, $phpEx; $sql = "SELECT m1.module_langname AS m1_langname, m2.module_langname AS m2_langname, m2.module_basename AS m2_basename, m2.module_mode AS m2_mode FROM " . MODULES_TABLE . " AS m1 RIGHT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 WHERE m1.parent_id = '$part' AND m1.module_class = 'acp' ORDER BY m1.left_id "; if( !( $rs=$db->sql_query( $sql))) { mx_message_die( GENERAL_ERROR, 'Could not obtain menu data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); } $header= ''; $menu_ary = array(); while( $row = $db->sql_fetchrow( $rs) ) { if ( $header != $row['m1_langname']) { $header = $row['m1_langname']; $menu_ary[$header] = array(); } $menu_ary[$header][$row['m2_langname']] = $row['m2_basename'] ; } return $menu_ary; } function admin_tabs( $curr_tab) { if ( $this->main_part != 'admin') { return false; } global $db, $lang, $template, $mx_user, $phpEx; $this->current_tab = $curr_tab; $sql = "SELECT m1.*, count(m2.module_id) AS subcount FROM " . MODULES_TABLE . " AS m1 LEFT OUTER JOIN phpbb3_modules AS m2 ON m1.module_id = m2.parent_id AND m2.module_enabled = 1 AND m2.module_display = 1 WHERE m1.parent_id =0 AND m1.module_class = 'acp' GROUP BY m1.module_id HAVING count(m2.module_id) > 0 ORDER BY m1.left_id "; if ( !($rs = $db->sql_query( $sql)) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain data form phpbb3 modules', 'Error', __LINE__, __FILE__, $sql); } $return_category = ''; while ( $row = $db->sql_fetchrow( $rs)) { if( $row['module_id']==$curr_tab) { $return_category = isset( $lang[$row['module_langname']])?$lang[$row['module_langname']]:$row['module_langname']; } $template->assign_block_vars( 'module_phpbb', array( // 'ACTIVETAB' => $row['module_id']==$curr_tab?' id="activetab"':'', 'CATEGORY' => PORTAL_BACKEND, 'PARAMS' => '&i=' . $row['module_id'], 'L_MX_PHPBB' => (isset( $mx_user->lang[$row['module_langname']])?$mx_user->lang[$row['module_langname']]:$row['module_langname']), )); } return $return_category; } function admin_panel( $acp_panel, $mode = '') { $phpbb_admin_html = "<h1>In Progress</h1><p>Still not done.</p>"; $phpbb_admin_html .= "<p>ACP Panel: <strong>$acp_panel</strong></p>"; return $phpbb_admin_html; } } ?> |