Update of /cvsroot/mxbb/core27x/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13016/admin Added Files: admin_mx_block.php admin_mx_block_edit.php admin_mx_chkobjs.php admin_mx_gen_cache.php admin_mx_menu.php admin_mx_meta.php admin_mx_module.php admin_mx_page.php admin_mx_page_setting.php admin_mx_phpinfo.php admin_mx_portal.php index.php page_footer_admin.php page_header_admin.php pagestart.php Log Message: Initital core 2.7.x commit :-) --- NEW FILE: admin_mx_phpinfo.php --- <?php /** ------------------------------------------------------------------------ * subject : mxBB-Portal * begin : june, 2002 * copyright : (C) 2002-2005 mxBB-Portal * email : jon...@ho... * project site : www.mx-system.com * * description : * ------------------------------------------------------------------------- * $Id: admin_mx_phpinfo.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ if ( !empty($setmodules) ) { $file = basename(__FILE__); $module['Portal - System']['phpInfo'] = 'admin/' . $file; return; } define('IN_PORTAL', 1); $mx_root_path = '../'; // // Security and page header // require('./pagestart.php'); // // Capture the phpInfo output // ob_start(); phpinfo(); $output = ob_get_contents(); ob_end_clean(); // // Extract the BODY part. // preg_match_all('#<body[^>]*>(.*)</body>#siU', $output, $body_part); $body_part = $body_part[1][0]; // // Remove all, but some HTML Tags. // $allowedTags = '<h1><h2><h3><hr><ul><ol><li><b><i><u>'. '<a><pre><blockquote><img><div><span><p><br>'. '<table><tr><td><th><thead><tbody><tfoot>'; $body_part = strip_tags($body_part, $allowedTags); // // Alter some CSS related attributes. // $body_part = preg_replace('# (style|class)=["\'](.*?)["\']#si', '', $body_part); $body_part = preg_replace('#<hr(.*?)>#si', '<hr size="1" width="600" />', $body_part); $body_part = preg_replace('#<img(.*?)>#si', '<img style="float:right; border:0px;"\1>', $body_part); $body_part = preg_replace('#<td(.*?)>(.*?)</td>#si', '<td\1><span class="genmed">\2</span></td>', $body_part); $body_part = preg_replace('#cellpadding="(.*?)"#si', 'cellpadding="2"', $body_part); $body_part = preg_replace('#cellspacing="(.*?)"#si', '', $body_part); $body_part = preg_replace('#<table(.*?)>#si', '<table\1 cellspacing="1" class="forumline" style="margin-left:auto;margin-right:auto;">', $body_part); $body_part = preg_replace('#<td(.*?)>#si', '<td\1 class="row1">', $body_part); $body_part = preg_replace('#<td(.*?)class="row1">#si', '<td\1class="row2">', $body_part); // // Send the formatted result to the browser. // $template->set_filenames(array('phpinfo' => 'admin/admin_mx_phpinfo.tpl')); $template->assign_vars(array('PHPINFO' => $body_part)); $template->pparse('phpinfo'); // // Send page footer. // include_once('page_footer_admin.' . $phpEx); ?> --- NEW FILE: admin_mx_page.php --- <?php /*************************************************************************** * admin_mx_page.php * ------------------- * begin : mars, 2003 * copyright : (C) 2003 MX-System * email : su...@mx... * * $Id: admin_mx_page.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ $no_page_header = TRUE; if( !empty($setmodules) ) { $file = basename(__FILE__); $module['Portal - General']['Page_admin'] = 'admin/' . $file; return; } define('IN_PORTAL', 1); $mx_root_path = '../'; // // Security and page header // require('./pagestart.php'); // // Mode setting // if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) { $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; } else { $mode = ""; } if( isset($HTTP_POST_VARS['page_id']) || isset($HTTP_GET_VARS['page_id']) ) { $page_id = ( isset($HTTP_POST_VARS['page_id']) ) ? $HTTP_POST_VARS['page_id'] : $HTTP_GET_VARS['page_id']; } if( !empty($mode) ) { switch($mode) { case 'add': case 'edit': page_edit( $mode, $page_id ); break; case 'create': case 'modify': page_modify( $mode, $page_id ); break; case 'delete': page_delete( $mode, $page_id ); break; case 'delpage': page_delete( $mode, $page_id ); break; default: mx_message_die(GENERAL_MESSAGE, $lang['No_mode']); break; } exit; } // CODE STARTS HERE $template->set_filenames(array( "body" => 'admin/mx_page_admin_edit.tpl') ); $sql = "SELECT * FROM " . PAGE_TABLE . " ORDER BY page_id"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, "Couldn't get list of page", "", __LINE__, __FILE__, $sql); } $row_count = 0; while( $tblock[$row_count] = $db->sql_fetchrow($result) ) { $page_id = $tblock[$row_count]['page_id']; $template->assign_block_vars("pages", array( 'ID' => $page_id, 'NAME' => $tblock[$row_count]['page_name'], 'U_PAGES' => append_sid( PORTAL_URL . "admin/admin_mx_page_setting.php?page_id=" . $page_id), 'ICON' => PORTAL_URL . TEMPLATE_ROOT_PATH. "images/" . $tblock[$row_count]['page_icon'], 'U_EDIT' => append_sid( PORTAL_URL . "admin/admin_mx_page.$phpEx?mode=edit&page_id=$page_id"), 'U_SETTING' => append_sid( PORTAL_URL . "admin/admin_mx_page_setting.php?page_id=" . $page_id), 'U_DELETE' => append_sid( PORTAL_URL . "admin/admin_mx_page.$phpEx?mode=delete&id=$page_id") )); $row_count++; } $template->assign_vars(array( 'S_ACTION' => append_sid( PORTAL_URL . "admin/admin_mx_page.$phpEx?mode=add"), 'BLOCK_SIZE' => ( !empty( $block_size ) ? $block_size : '100%' ) , 'L_TITLE' => $lang['Page_admin'], 'L_EDIT' => $lang['Edit'], 'L_SETTING' => $lang['Settings'], 'L_DELETE' => $lang['Delete'], 'L_CREATE_PAGE' => $lang['Add_Page'] )); include_once('./page_header_admin.'.$phpEx); $template->pparse("body"); include_once('./page_footer_admin.'.$phpEx); // CODE ENDS HERE (obviously) exit; // ****************************************************************** // // // ****************************************************************** function page_edit( $mode, $page_id ) { global $template, $lang, $db, $board_config, $theme, $HTTP_GET_VARS, $HTTP_POST_VARS; $auth_fields = array('auth_view'); $auth_ary = array( "auth_view" => AUTH_ALL ); $auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN', 'ANONYMOUS'); $auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN, AUTH_ANONYMOUS); $field_names = array( 'auth_view' => $lang['View']); // // Show form to create/modify a page // if ($mode == 'edit') { // $newmode determines if we are going to INSERT or UPDATE after posting? $newmode = 'modify'; $buttonvalue = $lang['Update']; $row = get_info( PAGE_TABLE, 'page_id', $page_id); $page_name = $row['page_name']; $page_icon = $row['page_icon']; $page_header = empty($row['page_header']) ? 'overall_header.tpl' : $row['page_header']; $page_group_auth_id = $row['auth_view_group']; } else { $newmode = 'create'; $buttonvalue = $lang['Submit']; $page_name = $HTTP_POST_VARS[page_name]; $page_icon = empty($row['page_icon']) ? 'icon_home.gif' : $row['page_icon']; $page_header = empty($row['page_header']) ? 'overall_header.tpl' : $row['page_header']; $sql = "SELECT MAX( page_id ) AS page_id FROM " . PAGE_TABLE; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't get page information", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $page_id = $row['page_id'] + 1; } $template->set_filenames(array( "edit_page" => "admin/mx_page_edit_body.tpl") ); $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode .'" /><input type="hidden" name="page_id" value="' . $page_id . '" />'; // // // Output values of individual // fields // for($j = 0; $j < count($auth_fields); $j++) { $custom_auth[$j] = ' <select name="' . $auth_fields[$j] . '">'; for($k = 0; $k < count($auth_levels); $k++) { $selected = ( $row[$auth_fields[$j]] == $auth_const[$k] ) ? ' selected="selected"' : ''; $custom_auth[$j] .= '<option value="' . $auth_const[$k] . '"' . $selected . '>' . $lang['AUTH_' . $auth_levels[$k]] . '</option>'; } $custom_auth[$j] .= '</select> '; $custom_group_auth = mx_get_groups($page_group_auth_id); $cell_title = $field_names[$auth_fields[$j]]; $template->assign_block_vars('page_auth_titles', array( 'CELL_TITLE' => $cell_title) ); $template->assign_block_vars('page_auth_data', array( 'S_AUTH_GROUP_LEVELS_SELECT' => $custom_group_auth, 'L_AUTH_GROUP_LEVELS_SELECT' => $lang['Auth_Page_group'], 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j]) ); $s_column_span++; } $template->assign_vars(array( 'L_TITLE' => $lang['Page_admin'], 'L_EXPLAIN' => $lang['Page_admin_explain'], 'L_PAGE_NAME' => $lang['Page'], 'L_PAGE_ID' => empty( $lang['Page_Id'] ) ? "Page Id" : $lang['Page_Id'] , 'L_PAGE_ICON' => empty( $lang['Page_icon'] ) ? "Page Icon" : $lang['Page_icon'] , 'L_PAGE_HEADER' => empty( $lang['Page_header'] ) ? "Page header file" : $lang['Page_header'] , 'L_AUTH_TITLE' => empty( $lang['Auth_Page'] ) ? "Permission" : $lang['Auth_Page'], 'PAGE_ID' => $page_id, 'PAGE_NAME' => $page_name, 'PAGE_ICON' => $page_icon, 'PAGE_HEADER' => $page_header, 'S_ACTION' => append_sid("admin_mx_page.php"), 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_SUBMIT_VALUE' => $buttonvalue, 'S_FUNCTION_LIST' => $functionlist, )); define('IN_ADMIN', 1); include('./page_header_admin.php'); $template->pparse("edit_page"); include('./page_footer_admin.php'); } // ****************************************************************** // // Modify a page in the DB // // ****************************************************************** function page_modify( $mode, $page_id ) { global $template, $lang, $db, $board_config, $theme, $HTTP_POST_VARS; if ( $mode == "modify" ) { if ( $page_id != intval( $HTTP_POST_VARS['page_id_new']) ) { $sql = "UPDATE " . COLUMN_TABLE . " SET page_id = " . intval( $HTTP_POST_VARS['page_id_new']) . " WHERE page_id = " . $page_id; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't update page information", "", __LINE__, __FILE__, $sql); } } $sql = "UPDATE " . PAGE_TABLE . " SET page_id = " . intval( $HTTP_POST_VARS['page_id_new']) . ", page_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['page_name']) . "', page_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['page_icon']) . "', page_header = '" . str_replace("\'", "''", $HTTP_POST_VARS['page_header']) . "', auth_view = '" . $HTTP_POST_VARS['auth_view'] . "', auth_view_group = '" . $HTTP_POST_VARS['auth_view_group'] . "' WHERE page_id = " . $page_id; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't update page information", "", __LINE__, __FILE__, $sql); } } if ( $mode == "create" ) { $sql = "INSERT INTO " . PAGE_TABLE . " ( page_id, page_name, page_icon, auth_view, auth_view_group, page_header ) VALUES ( '$HTTP_POST_VARS[page_id_new]' , '$HTTP_POST_VARS[page_name]', '$HTTP_POST_VARS[page_icon]', '$HTTP_POST_VARS[auth_view]', '$HTTP_POST_VARS[auth_view_group]', '$HTTP_POST_VARS[page_header]' )"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't insert page information", "", __LINE__, __FILE__, $sql); } } $message = $lang['Portal_Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_portal_config'], "<a href=\"" . append_sid("admin_mx_page.php") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.php?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); }; // ****************************************************************** // // Delete a page // // ****************************************************************** function page_delete( $mode, $page_id ) { global $template, $lang, $db, $board_config, $theme, $HTTP_POST_VARS; if ( $mode == "delete" ) { $template->set_filenames(array( "admin_page" => "admin/mx_page_delete_body.tpl") ); $buttonvalue = $lang['Delete']; $newmode = 'delpage'; $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" />'; $page_name = get_list( "page_id", PAGE_TABLE, 'page_id', 'page_name', $page_id, TRUE); $template->assign_vars(array( 'NAME' => $name, 'L_PAGE_DELETE' => $lang['Page_admin'], 'L_PAGE_DELETE_EXPLAIN' => $lang['Page_admin_explain'], 'L_PAGE_NAME' => $lang['Page'], 'NAME' => $page_name, "S_HIDDEN_FIELDS" => $s_hidden_fields, 'S_PAGE_ACTION' => append_sid("admin_mx_page.php"), 'S_SUBMIT_VALUE' => $buttonvalue) ); define('IN_ADMIN', 1); include_once('./page_header_admin.php'); $template->pparse("admin_page"); include_once('./page_footer_admin.php'); } if ( $mode == "delpage" ) { $sql = "SELECT column_id FROM " . COLUMN_TABLE . " WHERE page_id = " . $page_id; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't get list of Column", "", __LINE__, __FILE__, $sql); } while( $row = $db->sql_fetchrow($result) ) { $sql = "DELETE FROM " . COLUMN_BLOCK_TABLE . " WHERE column_id = " . $row[column_id] ; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't delete column/block information", "", __LINE__, __FILE__, $sql); } } $sql = "DELETE FROM " . COLUMN_TABLE . " WHERE page_id = " . $page_id; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't delete page information", "", __LINE__, __FILE__, $sql); } $sql = "DELETE FROM " . PAGE_TABLE . " WHERE page_id = " . $page_id; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't delete page information", "", __LINE__, __FILE__, $sql); } $message = $lang['Portal_Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_portal_config'], "<a href=\"" . append_sid("admin_mx_page.php") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.php?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } }; ?> --- NEW FILE: admin_mx_chkobjs.php --- <?php /*************************************************************************** * admin_mx_chkobjs.php * -------------------- * begin : June, 2003 * copyright : (C) 2002-2005 mxBB-Portal * email : su...@mx... * * $Id: admin_mx_chkobjs.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ // ====================================================== // [ ADMINCP COMMON INITIALIZATION ] // ====================================================== $no_page_header = TRUE; if( !empty($setmodules) ) { $module['Portal - System']['Objects_Integrity_Check'] = 'admin/' . basename(__FILE__); return; } define('IN_PORTAL', 1); $mx_root_path = '../'; // // Security and page header // require('./pagestart.php'); // ====================================================== // [ GLOBAL DATA ] // ====================================================== $main_title = "Check mxBB Objects"; $main_desc = "This utility allows you to check mxBB object relationships."; $main_info = "This report shows the relations between mxBB tables. " . "You'll see the object name next to its object identifier. " . "Whenever an object is missing (not found on the database), the row is marked with the symbol <font color=red>[?]</font>. " . "In this case, execute phpMyAdmin (or your favorite DB Control Center) and remove that row.<br /><br />" . "DISCLAIMER: This utility is released AS-IS. Please, ensure you have a working backup <u>before</u> you manually edit your DB."; $check_args = array( array( 'table' => FUNCTION_TABLE, 'fkeys' => array( array(MODULE_TABLE, 'module_id', 'module_name'), array(FUNCTION_TABLE, 'function_id', 'function_name') ) ), array( 'table' => PARAMETER_TABLE, 'fkeys' => array( array(FUNCTION_TABLE, 'function_id', 'function_name'), array(PARAMETER_TABLE, 'parameter_id', 'parameter_name') ) ), array( 'table' => PARAMETER_OPTION_TABLE, 'fkeys' => array( array(PARAMETER_TABLE, 'parameter_id', 'parameter_name'), array(PARAMETER_OPTION_TABLE, 'option_id', 'option_desc') ) ), array( 'table' => BLOCK_TABLE, 'fkeys' => array( array(FUNCTION_TABLE, 'function_id', 'function_name'), array(BLOCK_TABLE, 'block_id', 'block_title') ) ), array( 'table' => BLOCK_SYSTEM_PARAMETER_TABLE, 'fkeys' => array( array(BLOCK_TABLE, 'block_id', 'block_title'), array(PARAMETER_TABLE, 'parameter_id', 'parameter_name') ) ), array( 'table' => COLUMN_TABLE, 'fkeys' => array( array(PAGE_TABLE, 'page_id', 'page_name'), array(COLUMN_TABLE, 'column_id', 'column_title') ) ), array( 'table' => COLUMN_BLOCK_TABLE, 'fkeys' => array( array(COLUMN_TABLE, 'column_id', 'column_title'), array(BLOCK_TABLE, 'block_id', 'block_title') ) ) ); // ====================================================== // [ MAIN PROCESS ] // ====================================================== // // Check to see if we need to show the table selection box. // if( isset($HTTP_POST_VARS['check_mode']) || isset($HTTP_GET_VARS['check_mode']) ) { $check_mode = ( isset($HTTP_POST_VARS['check_mode']) ? $HTTP_POST_VARS['check_mode'] : $HTTP_GET_VARS['check_mode'] ); } else { if( !isset($HTTP_GET_VARS['mode']) ) { $select_options = '<select name="check_mode">'; for( $i=0; $i < count($check_args); $i++ ) { $selected = ( $i == $HTTP_GET_VARS['table'] ? ' selected="selected"' : '' ); $select_options .= '<option value="'.$i.'"'.$selected.'>'.$check_args[$i]['table'].'</option>'; } $select_options .= '</select>'; mx_message_die(GENERAL_MESSAGE, '<p>'.$main_desc.'</p>' . '<form action="' . append_sid(PORTAL_URL . "admin/admin_mx_chkobjs.$phpEx") . '" method="post"> ' . $select_options . ' <input type="submit" name="submit" value="' . $lang[Submit].'" class="mainoption" /></form>', $main_title ); } $mode = $HTTP_GET_VARS['mode']; $tb = $HTTP_GET_VARS['table']; $table = $check_args[$tb]['table']; $val0 = $HTTP_GET_VARS['val0']; $val1 = $HTTP_GET_VARS['val1']; $tab0 = $check_args[$tb]['fkeys'][0][0]; $key0 = $check_args[$tb]['fkeys'][0][1]; $tab1 = $check_args[$tb]['fkeys'][1][0]; $key1 = $check_args[$tb]['fkeys'][1][1]; switch($mode) { case 'delete': $sql = "DELETE FROM ".$table." WHERE $key0 = $val0 AND $key1 = $val1"; $get_vars = '&table='.$tb. '&val0='.$val0.'&val1='.$val1. '&key0='.$key0.'&key1='.$key1; $message = '<form method="post" action="' . basename(__FILE__) . '">' . '<table border="0" cellpadding="4" cellspacing="0">' . '<tr><td colspan="2"><b>' . $table . '</b></td></tr>' . '<tr><td><b>' . $key0 . ':</b> </td><td>[ ' . $val0 . ' ]</td></tr>' . '<tr><td><b>' . $key1 . ':</b> </td><td>[ ' . $val1 . ' ]</td></tr>' . '</table> <br /> <br />' . '<div style="width:80%; padding:10px; border:solid red 1px;">' . '<b>' . $lang['Confirm'] . '</b>:<br />' . $sql . '<br />' . '<br /> <br />' . '[ <a href="'.append_sid(basename(__FILE__)."?check_mode=$tb").'">'.$lang['No'].'</a> ]' . ' ' . '[ <a href="'.append_sid(basename(__FILE__).'?mode=db_delete'.$get_vars).'">'.$lang['Yes'].'</a> ]' . '</div><br /> ' . '</form>'; message_die(GENERAL_MESSAGE, $message, $my_script_title); break; case 'db_delete': $sql = "DELETE FROM ".$table." WHERE $key0 = $val0 AND $key1 = $val1"; if( !dbQuery($sql) ) { message_die(GENERAL_ERROR, "Couldn't DELETE data from table : " . $table, "", __LINE__, __FILE__, $sql); } $check_mode = $tb; break; default: break; } } include_once('./page_header_admin.php'); check_relationship($check_mode); include('./page_footer_admin.php'); exit; // ====================================================== // [ FUNCTIONS ] // ====================================================== // ------------ // // function check_relationship($tb) { global $db, $lang, $check_args, $main_title, $main_desc, $main_info; $table = $check_args[$tb]['table']; $fkeys = count($check_args[$tb]['fkeys']); for($i = 0; $i < $fkeys; $i++) { $ftab[] = $check_args[$tb]['fkeys'][$i][0]; $fkey[] = $check_args[$tb]['fkeys'][$i][1]; $fnam[] = $check_args[$tb]['fkeys'][$i][2]; } // // Build the query and check the table relations. // $sql = "SELECT * FROM ".$table." ORDER BY ".implode(',', $fkey); $result = $db->sql_query($sql); if( !$result ) { mx_message_die(GENERAL_ERROR, "Couldn't obtain the data from database.", '', __LINE__, __FILE__, $sql); } $html='<h1>' . $main_title.'</h1>' . "\n"; $html.='<p>' . $main_desc.'<br /><br />' . $main_info.'</p>' . "\n"; $html.='<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline" align="center">' . "\n"; $html.="\t" . '<tr>' . "\n"; $html.=tbHead('td', 'catHead', 5, '<b>Checking Table: '.$table.'</b>'); $html.="\t" . '</tr>' . "\n"; $html.="\t" . '<tr>' . "\n"; $html.=tbHead('td', 'cat', 5, '<a href="'.append_sid(basename(__FILE__)."?table=$tb").'"><b>Go Back</b></a>'); $html.="\t" . '</tr>' . "\n"; $html.="\t" . '<tr>' . "\n"; $html.=tbHead('th', 'thCornerL', 1, $fkey[0]); for($i = 0; $i < ($fkeys-1); $i++) { $html.=tbHead('th', 'thTop', 1, $fnam[$i]); $html.=tbHead('th', 'thTop', 1, $fkey[$i+1]); } $html.=tbHead('th', 'thTop', 1, $fnam[$fkeys-1]); $html.=tbHead('th', 'thCornerR', 1, $lang['Action']); $html.="\t" . '</tr>' . "\n"; $row_count = 0; while( $row = $db->sql_fetchrow($result) ) { $row_class = (($row_count % 2) == 0) ? 'row1' : 'row2'; $html.= "\t" . '<tr>' . "\n"; $get_vars = '&table='.$tb; for($i = 0; $i < $fkeys; $i++) { $field = $fkey[$i]; if( $ftab[$i] == $table ) { $field_key = $row[$field]; $fname = $fnam[$i]; $field_value = $row[$fname]; } else { if( !($field_value = dbFetchField($ftab[$i], $field.'='.$row[$field], $fnam[$i])) ) { $field_key = '<font color=red><b>'.$row[$field].'</b></font>'; $field_value = '<font color=red><b>[?]</b></font>'; } else { $field_key = $row[$field]; } } $get_vars .= '&val'.$i.'='.$row[$field]; $html.=tbItem('td', 'row1', 'center', $field_key); $html.=tbItem('td', 'row2', 'left' , $field_value); } $onclick = 'onclick="return confirm(\'Are you sure you want to delete this object?\');"'; $html.=tbItem('td', 'row1', 'center', '<a href="'.append_sid(basename(__FILE__).'?mode=delete'.$get_vars).'" '.$onclick.'>'.$lang['Delete'].'</a>'); $html.= "\t" . '</tr>' . "\n"; $row_count++; } $html.="\t" . '<tr>' . "\n"; $html.=tbHead('td', 'catBottom', 5, '<a href="'.append_sid(basename(__FILE__)."?table=$tb").'"><b>Go Back</b></a>'); $html.="\t" . '</tr>' . "\n"; $html.='</table><br />' . "\n"; echo $html; } function tbHead($td, $class, $colspan, $text) { return "\t\t" . '<'.$td.' class="'.$class.'" colspan="'.$colspan.'" align="center">'.$text.'</'.$td.'>' . "\n"; } function tbItem($td, $class, $align, $text) { return "\t\t" . '<'.$td.' class="'.$class.'" align="'.$align.'">'.$text.'</'.$td.'>' . "\n"; // return '<'.$td.' class="'.$class.'" align="'.$align.'"><span class="gen">'.$text.'</span></'.$td.'>' . "\n"; } // ------------ // DB Utilities // function dbFetchField($tbname, $where, $field) { $sql = "SELECT * FROM ".$tbname." WHERE ".$where; if( !($row = dbFetchRow($sql)) ) return false; return $row[$field]; } function dbFetchRow($sql) { global $db; if( !($result = $db->sql_query($sql)) ) return false; if( !($row = $db->sql_fetchrow($result)) ) return false; return $row; } function dbQuery($sql) { global $db; if( !($result = $db->sql_query($sql)) ) return false; return $result; } ?> --- NEW FILE: admin_mx_gen_cache.php --- <?php /*************************************************************************** * admin_mx_gen_cache.php * ------------------- * begin : Mars, 2003 * copyright : (C) 2003 MX-System * email : su...@mx... * * $Id: admin_mx_gen_cache.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * ***************************************************************************/ $no_page_header = TRUE; if( !empty($setmodules) ) { $module['Portal - System']['Generate cache'] = 'admin/' . basename(__FILE__); return; } define('IN_PORTAL', 1); $mx_root_path = '../'; // Security and page header require('./pagestart.php'); // Getting mode of operation $generate = ( $mx_request_vars->request('generate', MX_TYPE_INT, 0) == 1 ? true : false ); // // Load default template for install // $template->set_filenames(array( 'body' => 'admin/admin_message_body.tpl') ); // Main procedure if ( !$generate ) { $message = $lang['Cache_explain'] . '<br /> <br /> <br />'; $message .= '<form action="' . append_sid(PORTAL_URL . "admin/admin_mx_gen_cache.$phpEx") . '" method="post">'; $message .= '<input type="hidden" name="generate" value="1">'; $message .= '<input type="submit" name="submit" value="' . $lang['Cache_submit'] . ' >>" class="liteoption" />'; $message .= '</form>'; } else { $cache_dir = $mx_root_path . 'cache/'; include($cache_dir . "mx_cache.$phpEx"); @mkdir($cache_dir, 0777); @chmod($cache_dir, 0777); if ( !is_writable($cache_dir) ) { $message = $lang['Cache_dir_write_protect']; mx_message_die(GENERAL_MESSAGE, $message, ''); exit; } $sql = "SELECT blk.block_id , blk.block_title , blk.block_desc , blk.function_id , blk.auth_view , blk.auth_edit , blk.auth_delete , blk.auth_view_group , blk.auth_edit_group FROM " . BLOCK_TABLE . " blk ORDER BY blk.block_id"; db2xml($sql, $cache_dir. "block_config.xml"); $sql = "SELECT sys.parameter_id , sys.block_id , par.parameter_name , sys.parameter_value , sys.bbcode_uid FROM " . BLOCK_SYSTEM_PARAMETER_TABLE . " sys, " . PARAMETER_TABLE . " par WHERE sys.parameter_id = par.parameter_id ORDER BY sys.block_id, sys.parameter_id"; db2xml($sql, $cache_dir. "block_config_param.xml"); // // Unset all session variables, so it will force // loading all cached data to the admin session. // @session_unset(); $message = $lang['Cache_generate']; } $template->assign_vars(array( 'MESSAGE_TITLE' => $lang['Generate_mx_cache'], 'MESSAGE_TEXT' => $message )); include_once("./page_header_admin.$phpEx"); $template->pparse('body'); include_once("./page_footer_admin.$phpEx"); ?> --- NEW FILE: page_footer_admin.php --- <?php /*************************************************************************** * page_footer_admin.php * ------------------- * begin : Saturday, Jul 14, 2001 * copyright : (C) 2001 The phpBB Group * email : su...@ph... * * $Id: page_footer_admin.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_PHPBB') ) { die("Hacking attempt"); } // // Show the overall footer. // $template->set_filenames(array( 'page_footer' => 'admin/page_footer.tpl') ); $template->assign_vars(array( 'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '', 'MX_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? $portal_config['portal_version'] : '', 'TRANSLATION_INFO' => $lang['TRANSLATION_INFO']) ); $template->pparse('page_footer'); // // Close our DB connection. // $db->sql_close(); // // Compress buffered output if required // and send to browser // if( $do_gzip_compress ) { // // Borrowed from php.net! // $gzip_contents = ob_get_contents(); ob_end_clean(); $gzip_size = strlen($gzip_contents); $gzip_crc = crc32($gzip_contents); $gzip_contents = gzcompress($gzip_contents, 9); $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; echo $gzip_contents; echo pack('V', $gzip_crc); echo pack('V', $gzip_size); } exit; ?> --- NEW FILE: index.php --- <?php /*************************************************************************** * (admin) index.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group * email : su...@ph... * * $Id: index.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PORTAL', 1); $mx_root_path = '../'; // // Load default header // $no_page_header = TRUE; require('./pagestart.php'); session_start(); // Unset all of the session variables. session_unset(); // --------------- // Begin functions // function inarray($needle, $haystack) { for($i = 0; $i < sizeof($haystack); $i++ ) { if( $haystack[$i] == $needle ) { return true; } } return false; } function read_admin($dir_module ) { global $phpEx, $template; $module = array(); $setmodules = 1; $dir = @opendir( $dir_module ); while( $file = @readdir($dir) ) { if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) ) { include($dir_module . '/' . $file); } } @closedir($dir); unset($setmodules); return $module; } // // End functions // ------------- // // Generate relevant output // if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' ) { include('./page_header_admin.'.$phpEx); $template->set_filenames(array( "body" => "admin/index_navigate.tpl") ); $template->assign_vars(array( 'U_PHPBB_ROOT_PATH' => PHPBB_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, "U_FORUM_INDEX" => append_sid( PHPBB_URL . "index.$phpEx"), "U_PORTAL_INDEX" => append_sid( PORTAL_URL . "index.$phpEx"), "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), "L_FORUM_INDEX" => $lang['Main_index'], "L_PORTAL_INDEX" => $lang['Portal_index'], "L_ADMIN_INDEX" => $lang['Admin_Index'], "L_PREVIEW_FORUM" => $lang['Preview_forum'], "L_PREVIEW_PORTAL" => $lang['Preview_portal']) ); // // Read Portal configuration // $module_portal = read_admin( "."); ksort($module_portal); $template->assign_block_vars('module_portal', array( "L_MX_PORTAL" => $lang['MX_Portal'] ) ); while( list($cat, $action_array) = each($module_portal) ) { $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat); $template->assign_block_vars("module_portal.catrow", array( "ADMIN_CATEGORY" => $cat) ); ksort($action_array); $row_count = 0; while( list($action, $file) = each($action_array) ) { $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action); $template->assign_block_vars("module_portal.catrow.modulerow", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "ADMIN_MODULE" => $action, "U_ADMIN_MODULE" => append_sid( PORTAL_URL . $file)) ); $row_count++; } } // // Include PHPBB Administration // $module_phpbb = array_merge( $module, read_admin( $phpbb_root_path . "admin/" )); ksort($module_phpbb); $template->assign_block_vars('module_phpbb', array( "L_PHPBB" => $lang['Phpbb'] ) ); while( list($cat, $action_array) = each($module_phpbb) ) { $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat); $template->assign_block_vars("module_phpbb.catrow", array( "ADMIN_CATEGORY" => $cat) ); ksort($action_array); $row_count = 0; while( list($action, $file) = each($action_array) ) { $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action); $template->assign_block_vars("module_phpbb.catrow.modulerow", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "ADMIN_MODULE" => $action, "U_ADMIN_MODULE" => append_sid( PHPBB_URL . 'admin/' . $file)) ); $row_count++; } } // // Read Portal Module Configuration // $sql = "SELECT * FROM " . MODULE_TABLE . " WHERE module_include_admin = 1 ORDER BY module_name"; if(!$q_modules = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not query modules information", "", __LINE__, __FILE__, $sql); } if( $total_modules = $db->sql_numrows($q_modules) ) { $module_rows = $db->sql_fetchrowset($q_modules); } $module_mx = array(); for($module_cnt = 0; $module_cnt < $total_modules; $module_cnt++) { $module_path_admin = $mx_root_path . $module_rows[$module_cnt]['module_path'] . "admin/"; $module_mx = array_merge_recursive( $module_mx, read_admin( $module_path_admin ) ); } // for ... modules ksort($module_mx); $template->assign_block_vars('module_mx', array( "L_MX_MODULES" => $lang['MX_Modules'] ) ); while( list($cat, $action_array) = each($module_mx) ) { $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat); $template->assign_block_vars("module_mx.catrow", array( "ADMIN_CATEGORY" => $cat) ); ksort($action_array); $row_count = 0; while( list($action, $file) = each($action_array) ) { $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action); $template->assign_block_vars("module_mx.catrow.modulerow", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "ADMIN_MODULE" => $action, "U_ADMIN_MODULE" => append_sid( PORTAL_URL . $file)) ); $row_count++; } } $template->pparse("body"); include('./page_footer_admin.'.$phpEx); } elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' ) { include('./page_header_admin.'.$phpEx); $template->set_filenames(array( "body" => "admin/index_body.tpl") ); $template->assign_vars(array( 'U_PHPBB_ROOT_PATH' => PHPBB_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, "L_WELCOME" => $lang['Welcome_phpBB'], "L_ADMIN_INTRO" => $lang['Admin_intro'], "L_FORUM_STATS" => $lang['Forum_stats'], "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], "L_LOCATION" => $lang['Location'], "L_LAST_UPDATE" => $lang['Last_updated'], "L_IP_ADDRESS" => $lang['IP_Address'], "L_STATISTIC" => $lang['Statistic'], "L_VALUE" => $lang['Value'], "L_NUMBER_POSTS" => $lang['Number_posts'], "L_POSTS_PER_DAY" => $lang['Posts_per_day'], "L_NUMBER_TOPICS" => $lang['Number_topics'], "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], "L_NUMBER_USERS" => $lang['Number_users'], "L_USERS_PER_DAY" => $lang['Users_per_day'], "L_BOARD_STARTED" => $lang['Board_started'], "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], "L_DB_SIZE" => $lang['Database_size'], "L_FORUM_LOCATION" => $lang['Forum_Location'], "L_STARTED" => $lang['Login'], "L_GZIP_COMPRESSION" => $lang['Gzip_compression']) ); // // Get forum statistics // $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $total_topics = get_db_stat('topiccount'); $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']); $boarddays = ( time() - $board_config['board_startdate'] ) / 86400; $posts_per_day = sprintf("%.2f", $total_posts / $boarddays); $topics_per_day = sprintf("%.2f", $total_topics / $boarddays); $users_per_day = sprintf("%.2f", $total_users / $boarddays); $avatar_dir_size = 0; if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) { while( $file = @readdir($avatar_dir) ) { if( $file != "." && $file != ".." ) { $avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file); } } @closedir($avatar_dir); // // This bit of code translates the avatar directory size into human readable format // Borrowed the code from the PHP.net annoted manual, origanally written by: // Jesse (je...@je...) // if($avatar_dir_size >= 1048576) { $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; } else if($avatar_dir_size >= 1024) { $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; } else { $avatar_dir_size = $avatar_dir_size . " Bytes"; } } else { // Couldn't open Avatar dir. $avatar_dir_size = $lang['Not_available']; } if($posts_per_day > $total_posts) { $posts_per_day = $total_posts; } if($topics_per_day > $total_topics) { $topics_per_day = $total_topics; } if($users_per_day > $total_users) { $users_per_day = $total_users; } // // DB size ... MySQL only // // This code is heavily influenced by a similar routine // in phpMyAdmin 2.2.0 // if( preg_match("/^mysql/", SQL_LAYER) ) { $sql = "SELECT VERSION() AS mysql_version"; if($result = $db->sql_query($sql)) { $row = $db->sql_fetchrow($result); $version = $row['mysql_version']; if( preg_match("/^(3\.23|4\.)/", $version) ) { $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname; $sql = "SHOW TABLE STATUS FROM " . $db_name; if($result = $db->sql_query($sql)) { $tabledata_ary = $db->sql_fetchrowset($result); $dbsize = 0; for($i = 0; $i < count($tabledata_ary); $i++) { if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" ) { if( $table_prefix != "" ) { if( strstr($tabledata_ary[$i]['Name'], $table_prefix) ) { $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; } } else { $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; } } } } // Else we couldn't get the table status. } else { $dbsize = $lang['Not_available']; } } else { $dbsize = $lang['Not_available']; } } else if( preg_match("/^mssql/", SQL_LAYER) ) { $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles"; if( $result = $db->sql_query($sql) ) { $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; } else { $dbsize = $lang['Not_available']; } } else { $dbsize = $lang['Not_available']; } if ( is_integer($dbsize) ) { if( $dbsize >= 1048576 ) { $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); } else if( $dbsize >= 1024 ) { $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); } else { $dbsize = sprintf("%.2f Bytes", $dbsize); } } $template->assign_vars(array( "NUMBER_OF_POSTS" => $total_posts, "NUMBER_OF_TOPICS" => $total_topics, "NUMBER_OF_USERS" => $total_users, "START_DATE" => $start_date, "POSTS_PER_DAY" => $posts_per_day, "TOPICS_PER_DAY" => $topics_per_day, "USERS_PER_DAY" => $users_per_day, "AVATAR_DIR_SIZE" => $avatar_dir_size, "DB_SIZE" => $dbsize, "GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF']) ); // // End forum statistics // // // Get users online information. // $sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_logged_in, s.session_ip, s.session_start FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s WHERE s.session_logged_in = " . TRUE . " AND u.user_id = s.session_user_id AND u.user_id <> " . ANONYMOUS . " AND u.user_session_time >= " . ( time() - 300 ) . " ORDER BY u.user_session_time DESC"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql); } $onlinerow_reg = $db->sql_fetchrowset($result); $sql = "SELECT session_page, session_logged_in, session_time, session_ip, session_start FROM " . SESSIONS_TABLE . " WHERE session_logged_in = 0 AND session_time >= " . ( time() - 300 ) . " ORDER BY session_time DESC"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql); } $onlinerow_guest = $db->sql_fetchrowset($result); $sql = "SELECT forum_name, forum_id FROM " . FORUMS_TABLE; if($forums_result = $db->sql_query($sql)) { while($forumsrow = $db->sql_fetchrow($forums_result)) { $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; } } else { message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql); } $reg_userid_ary = array(); if( count($onlinerow_reg) ) { $registered_users = 0; for($i = 0; $i < count($onlinerow_reg); $i++) { if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) ) { $reg_userid_ary[] = $onlinerow_reg[$i]['user_id']; $username = $onlinerow_reg[$i]['username']; if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) { $registered_users++; $hidden = FALSE; } else { $hidden_users++; $hidden = TRUE; } if( $onlinerow_reg[$i]['user_session_page'] < 1 ) { switch($onlinerow_reg[$i]['user_session_page']) { case PAGE_INDEX: $location = $lang['Forum_index']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_POSTING: $location = $lang['Posting_message']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_LOGIN: $location = $lang['Logging_on']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_SEARCH: $location = $lang['Searching_forums']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_PROFILE: $location = $lang['Viewing_profile']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_VIEWONLINE: $location = $lang['Viewing_online']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_VIEWMEMBERS: $location = $lang['Viewing_member_list']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_PRIVMSGS: $location = $lang['Viewing_priv_msgs']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "index.$phpEx?pane=right"; break; default: $location = $lang['Forum_index']; $location_url = "index.$phpEx?pane=right"; } } else { $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']); $location = $forum_data[$onlinerow_reg[$i]['user_session_page']]; } $row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; $reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']); $template->assign_block_vars("reg_user_row", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "USERNAME" => $username, "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']), "FORUM_LOCATION" => $location, "IP_ADDRESS" => $reg_ip, "U_WHOIS_IP" => "http://www.samspade.org/t/ipwhois?a=$reg_ip", "U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']), "U_FORUM_LOCATION" => append_sid($location_url)) ); } } } else { $template->assign_vars(array( "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) ); } // // Guest users // if( count($onlinerow_guest) ) { $guest_users = 0; for($i = 0; $i < count($onlinerow_guest); $i++) { $guest_userip_ary[] = $onlinerow_guest[$i]['session_ip']; $guest_users++; if( $onlinerow_guest[$i]['session_page'] < 1 ) { switch( $onlinerow_guest[$i]['session_page'] ) { case PAGE_INDEX: $location = $lang['Forum_index']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_POSTING: $location = $lang['Posting_message']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_LOGIN: $location = $lang['Logging_on']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_SEARCH: $location = $lang['Searching_forums']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_PROFILE: $location = $lang['Viewing_profile']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_VIEWONLINE: $location = $lang['Viewing_online']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_VIEWMEMBERS: $location = $lang['Viewing_member_list']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_PRIVMSGS: $location = $lang['Viewing_priv_msgs']; $location_url = "index.$phpEx?pane=right"; break; case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "index.$phpEx?pane=right"; break; default: $location = $lang['Forum_index']; $location_url = "index.$phpEx?pane=right"; } } else { $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']); $location = $forum_data[$onlinerow_guest[$i]['session_page']]; } $row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']); $template->assign_block_vars("guest_user_row", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "USERNAME" => $lang['Guest'], "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']), "FORUM_LOCATION" => $location, "IP_ADDRESS" => $guest_ip, "U_WHOIS_IP" => "http://www.samspade.org/t/ipwhois?a=$guest_ip", "U_FORUM_LOCATION" => append_sid($location_url)) ); } } else { $template->assign_vars(array( "L_NO_GUESTS_BROWSING" => $lang['No_users_browsing']) ); } $template->pparse("body"); include('./page_footer_admin.'.$phpEx); } else { // // Generate frameset // $template->set_filenames(array( "body" => "admin/index_frameset.tpl") ); $template->assign_vars(array( "S_FRAME_NAV" => append_sid("index.$phpEx?pane=left"), "S_FRAME_MAIN" => append_sid("index.$phpEx?pane=right")) ); header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); $template->pparse("body"); $db->sql_close(); exit; } ?> --- NEW FILE: page_header_admin.php --- <?php /*************************************************************************** * page_header_admin.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group * email : su...@ph... * * $Id: page_header_admin.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } define('HEADER_INC', true); /********** NOTE: The following code related to GZIP initialization has been temporaly moved to the new mx_session_start() function, declared in mx_functions.php // // gzip_compression // $do_gzip_compress = FALSE; if ( $board_config['gzip_compress'] ) { $phpver = phpversion(); $useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) ) { if ( extension_loaded('zlib') ) { ob_end_clean(); ob_start('ob_gzhandler'); } } else if ( $phpver > '4.0' ) { if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') ) { if ( extension_loaded('zlib') ) { $do_gzip_compress = TRUE; ob_start(); ob_implicit_flush(0); header('Content-Encoding: gzip'); } } } } **********/ $template->set_filenames(array( 'header' => 'admin/page_header.tpl') ); // Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility $l_timezone = explode('.', $board_config['board_timezone']); $l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])]; // // The following assigns all _common_ variables that may be used at any point // in a template. Note that all URL's should be wrapped in append_sid, as // should all S_x_ACTIONS for forms. // $template->assign_vars(array( 'SITENAME' => $board_config['sitename'], 'PAGE_TITLE' => $page_title, 'L_ADMIN' => $lang['Admin'], 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), 'L_FAQ' => $lang['FAQ'], 'L_MX_ADMIN' => 'MX-System Portal Administration', 'U_INDEX' => append_sid('../index.'.$phpEx), 'S_TIMEZONE' => sprintf($lang['All_times'], $l_timezone), 'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx), 'S_JUMPBOX_ACTION' => append_sid('../viewforum.'.$phpEx), 'S_CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), 'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_ENCODING' => $lang['ENCODING'], 'S_CONTENT_DIR_LEFT' => $lang['LEFT'], 'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'], 'U_PHPBB_ROOT_PATH' => PHPBB_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'T_HEAD_STYLESHEET' => $theme['head_stylesheet'], 'T_BODY_BACKGROUND' => $theme['body_background'], 'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'], 'T_BODY_TEXT' => '#'.$theme['body_text'], 'T_BODY_LINK' => '#'.$theme['body_link'], 'T_BODY_VLINK' => '#'.$theme['body_vlink'], 'T_BODY_ALINK' => '#'.$theme['body_alink'], 'T_BODY_HLINK' => '#'.$theme['body_hlink'], 'T_TR_COLOR1' => '#'.$theme['tr_color1'], 'T_TR_COLOR2' => '#'.$theme['tr_color2'], 'T_TR_COLOR3' => '#'.$theme['tr_color3'], 'T_TR_CLASS1' => $theme['tr_class1'], 'T_TR_CLASS2' => $theme['tr_class2'], 'T_TR_CLASS3' => $theme['tr_class3'], 'T_TH_COLOR1' => '#'.$theme['th_color1'], 'T_TH_COLOR2' => '#'.$theme['th_color2'], 'T_TH_COLOR3' => '#'.$theme['th_color3'], 'T_TH_CLASS1' => $theme['th_class1'], 'T_TH_CLASS2' => $theme['th_class2'], 'T_TH_CLASS3' => $theme['th_class3'], 'T_TD_COLOR1' => '#'.$theme['td_color1'], 'T_TD_COLOR2' => '#'.$theme['td_color2'], 'T_TD_COLOR3' => '#'.$theme['td_color3'], 'T_TD_CLASS1' => $theme['td_class1'], 'T_TD_CLASS2' => $theme['td_class2'], 'T_TD_CLASS3' => $theme['td_class3'], 'T_FONTFACE1' => $theme['fontface1'], 'T_FONTFACE2' => $theme['fontface2'], 'T_FONTFACE3' => $theme['fontface3'], 'T_FONTSIZE1' => $theme['fontsize1'], 'T_FONTSIZE2' => $theme['fontsize2'], 'T_FONTSIZE3' => $theme['fontsize3'], 'T_FONTCOLOR1' => '#'.$theme['fontcolor1'], 'T_FONTCOLOR2' => '#'.$theme['fontcolor2'], 'T_FONTCOLOR3' => '#'.$theme['fontcolor3'], 'T_SPAN_CLASS1' => $theme['span_class1'], 'T_SPAN_CLASS2' => $theme['span_class2'], 'T_SPAN_CLASS3' => $theme['span_class3']) ); $template->pparse('header'); ?> --- NEW FILE: admin_mx_block.php --- <?php /*************************************************************************** * admin_mx_block.php * ------------------- * begin : juin, 2002 * copyright : (C) 2002 MX-System * email : su...@mx... * * $Id: admin_mx_block.php,v 1.1 2005/05/06 06:47:56 jonohlsson Exp $ * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ $no_page_header = TRUE; if( !empty($setmodules) ) { $file = basename(__FILE__); $module['Portal - Modules']['Block_admin'] = 'admin/' . $file; return; } define('IN_PORTAL', 1); $mx_root_path = '../'; // // Security and page header // require('./pagestart.php'); // // Mode setting // if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) { $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; } else { $mode = ""; } if( !empty($mode) ) { switch($mode) { case 'save_setting': $block_id = intval($HTTP_GET_VARS[block_id]); block_save_setting( $block_id ); break; case 'add_block': case 'edit_block': block_edit( $mode ); break; case 'create_block': block_create_block( ); break; case 'delete_block': $block_id = intval($HTTP_GET_VARS[block_id]); block_delete( $block_id ); break; case 'modify_block': $block_id = intval($HTTP_POST_VARS[block_id]); block_modify( $block_id ); break; case 'setting': $block_id = intval($HTTP_GET_VARS[block_id]); block_setting( $block_id ); break; default: mx_message_die(GENERAL_MESSAGE, $lang['No_mode']); break; } if ( ! $show_index ) { exit; } } // if .. !empty($mode) // // Start page proper // $template->set_filenames(array( "admin_block" => "admin/mx_block_admin_body.tpl") ); $template->assign_vars(array( 'S_ACTION' => append_sid("admin_mx_block." . $phpEx . '?mode=add_block'), 'L_TITLE' => $lang['Block_admin'], 'L_EXPLAIN' => $lang['Block_admin_explain'], 'U_PORTAL_ROOT_PATH' => PORTAL_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'L_CREATE_BLOCK' => ( !empty ($lang['Create_block'] )) ? $lang['Create_block'] : 'Create new block' , 'L_EDIT' => $lang['Edit'], 'L_SETTING' => $lang['Settings'], 'L_DELETE' => $lang['Delete'], 'L_MOVE_UP' => $lang['Move_up'], 'L_MOVE_DOWN' => $lang['Move_down'], 'L_RESYNC' => $lang['Resync'] ) ); $sql = "SELECT blk.*, function_admin FROM " . BLOCK_TABLE . " blk, " . FUNCTION_TABLE . " fnc WHERE blk.function_id = fnc.function_id ORDER BY block_title"; if(!$q_blocks = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not query blocks information", "", __LINE__, __FILE__, $sql); } if( $total_blocks = $db->sql_numrows($q_blocks) ) { $block_rows = $db->sql_fetchrowset($q_blocks); } // // let's build lists of module // for($j = 0; $j < $total_blocks; $j++) { $block_id = $block_rows[$j]['block_id']; if ( !empty( $block_rows[$j]['function_admin'] ) ) { $l_setting = $lang['Settings']; $u_setting = append_sid( PORTAL_URL . $block_rows[$j]['function_admin'] . "?block_id=$block_id"); } else { $u_setting = ''; $l_setting = ''; // Show Block Settings even if no BLOCK_SYSTEM_PARAMETER_TABLE row exists. // admin_mx_block.php will populate them if necessary (see B4). $param_rows = get_exists( PARAMETER_TABLE, 'function_id', $block_rows[$j]['function_id']); // $param_rows = get_exists( BLOCK_SYSTEM_PARAMETER_TABLE, 'block_id', $block_id); if ( $param_rows['number'] >0 ) { $l_setting = $lang['Settings']; $u_setting = append_sid("admin_mx_block.$phpEx?mode=setting&block_id=$block_id"); } } $template->assign_block_vars("blockrow", array( 'L_SETTING' => $l_setting, 'BLOCK_TITLE' => $block_rows[$j]['block_title'], 'BLOCK_DESC' => $blo... [truncated message content] |