|
From: Markus P. <mar...@us...> - 2005-04-19 18:02:37
|
Update of /cvsroot/mxbb/core/modules/mx_coreblocks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3613 Modified Files: mx_language.php mx_theme.php Log Message: Fixed some named array with non-quoted indexes and code layout. Added use of new mx_request_vars class. Index: mx_language.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_coreblocks/mx_language.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mx_language.php 19 Apr 2005 17:14:19 -0000 1.8 --- mx_language.php 19 Apr 2005 18:02:26 -0000 1.9 *************** *** 51,55 **** if ( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update user lang configuration", "", __LINE__, __FILE__, $sql); } } --- 51,55 ---- if ( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update user lang configuration", '', __LINE__, __FILE__, $sql); } } *************** *** 75,79 **** $template->assign_vars(array( ! 'ACTION_URL' => $mx_root_path . "index.$phpEx?page=" . $page_id, 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), 'L_SELECT_LANG' => $lang['Board_lang'], --- 75,79 ---- $template->assign_vars(array( ! 'ACTION_URL' => append_sid(PORTAL_URL . "index.$phpEx?page=$page_id"), 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), 'L_SELECT_LANG' => $lang['Board_lang'], Index: mx_theme.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_coreblocks/mx_theme.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mx_theme.php 11 Feb 2005 22:05:55 -0000 1.8 --- mx_theme.php 19 Apr 2005 18:02:27 -0000 1.9 *************** *** 9,16 **** * description : * ------------------------------------------------------------------------- * $Id$ */ ! /** * 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 --- 9,17 ---- * description : * ------------------------------------------------------------------------- + * * $Id$ */ ! /** * 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 *************** *** 18,88 **** * (at your option) any later version. */ ! if ( !defined( 'IN_PORTAL' ) ) { ! die( "Hacking attempt" ); } ! if ( isset( $HTTP_POST_VARS['change_default_theme'] ) && $userdata['user_level'] == ADMIN ) { ! $board_config['default_style'] = ( isset( $HTTP_POST_VARS['default_style'] ) ) ? $HTTP_POST_VARS['default_style'] : $board_config['default_style']; $sql = "UPDATE " . CONFIG_TABLE . " SET ! config_value = '" . str_replace( "\'", "''", $board_config['default_style'] ) . "' ! WHERE config_name = 'default_style'"; ! if ( !$db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, "Failed to update default style configuration for $config_name", "", __LINE__, __FILE__, $sql ); } } ! if ( isset( $HTTP_POST_VARS['change_user_theme'] ) && $userdata['session_logged_in'] ) { ! $userdata['user_style'] = ( isset( $HTTP_POST_VARS['user_style'] ) ) ? $HTTP_POST_VARS['user_style'] : $board_config['default_style']; ! $mx_user_id = $userdata['user_id']; $sql = "UPDATE " . USERS_TABLE . " SET ! user_style = '" . str_replace( "\'", "''", $userdata['user_style'] ) . "' ! WHERE user_id = '$mx_user_id'"; if ( !$db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, "Failed to update user style configuration for $config_name", "", __LINE__, __FILE__, $sql ); } } ! $template->set_filenames( array( ! "body_theme" => 'mx_theme.tpl' ) ! ); if ( $userdata['user_level'] == ADMIN ) { ! $template->assign_block_vars( "switch_is_admin", array( 'L_CHANGE_NOW' => $lang['Change_default_style'], ! 'STYLE_SELECT' => style_select( $board_config['default_style'], 'default_style' ) ! ) ); } if ( $userdata['session_logged_in'] ) { ! $template->assign_block_vars( "switch_is_user", array( 'L_CHANGE_NOW' => $lang['Change_user_style'], ! 'STYLE_SELECT' => style_select( $userdata['user_style'], 'user_style' ) ! ) ); ! } ! else ! { ! $block_rows[$block]['show_title'] = 0; ! $block_rows[$block]['show_block'] = 0; } ! $template->assign_vars( array( 'ACTION_URL' => $mx_root_path . "index." . $phpEx . "?page=" . $page_id, ! 'BLOCK_SIZE' => $block_size, ! 'L_BOARD_STYLE' => $board_config['default_style'], ! 'L_CHANGE_NOW' => $lang['Change'], ! 'L_TITLE' => $lang['Theme'], ! 'L_SUBTITLE' => $lang['SelectTheme'] ) ! ); // Display only when the user is logged in ! if ( $userdata['session_logged_in'] ) { ! $template->pparse( "body_theme" ); } --- 19,97 ---- * (at your option) any later version. */ ! ! if ( !defined('IN_PORTAL') ) { ! die("Hacking attempt"); } ! $user_style = $mx_request_vars->post('change_default_theme', MX_TYPE_NO_TAGS, ''); ! $user_style = ( preg_match('#^[a-z_]+$#', $user_style) ? strip_tags($user_style) : '' ); ! if ( !empty($user_style) && $userdata['user_level'] == ADMIN ) { ! $board_config['default_style'] = $user_style; $sql = "UPDATE " . CONFIG_TABLE . " SET ! config_value = '$user_style' ! WHERE config_name = 'default_style'"; ! if ( !$db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update default style configuration", '', __LINE__, __FILE__, $sql); } } ! $user_style = $mx_request_vars->post('change_user_theme', MX_TYPE_NO_TAGS, ''); ! $user_style = ( preg_match('#^[a-z_]+$#', $user_style) ? strip_tags($user_style) : '' ); ! if ( !empty($user_style) && $userdata['session_logged_in'] ) { ! $userdata['user_style'] = $user_style; $sql = "UPDATE " . USERS_TABLE . " SET ! user_style = '$user_style' ! WHERE user_id = '" . $userdata['user_id'] . "'"; if ( !$db->sql_query( $sql ) ) { ! mx_message_die(GENERAL_ERROR, "Failed to update user style configuration", '', __LINE__, __FILE__, $sql); } } ! $template->set_filenames(array( ! 'body_theme' => 'mx_theme.tpl') ! ); if ( $userdata['user_level'] == ADMIN ) { ! $template->assign_block_vars('switch_is_admin', array( ! 'L_CHANGE_NOW' => $lang['Change_default_style'], ! 'STYLE_SELECT' => style_select($board_config['default_style'], 'default_style') ! )); } if ( $userdata['session_logged_in'] ) { ! $template->assign_block_vars('switch_is_user', array( ! 'L_CHANGE_NOW' => $lang['Change_user_style'], ! 'STYLE_SELECT' => style_select($userdata['user_style'], 'user_style') ! )); } ! $template->assign_vars(array( ! 'ACTION_URL' => append_sid(PORTAL_URL . "index.$phpEx?page=$page_id"), ! 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), ! 'L_BOARD_STYLE' => $board_config['default_style'], ! 'L_CHANGE_NOW' => $lang['Change'], ! 'L_TITLE' => $lang['Theme'], ! 'L_SUBTITLE' => $lang['SelectTheme'] ! )); + // // Display only when the user is logged in ! // if ( $userdata['session_logged_in'] ) { ! $template->pparse('body_theme'); ! } ! else ! { ! $block_rows[$block]['show_title'] = 0; ! $block_rows[$block]['show_block'] = 0; } |