|
From: OryNider <ory...@us...> - 2007-12-20 10:58:03
|
Update of /cvsroot/mxbb/mx_phpbb/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1356/includes Modified Files: Tag: core28x forum_hack.php Log Message: -Adeed compatibility with cash mod; -Added a shared cash mod file in the 'contrib' folder with phpbb_root_path added; Index: forum_hack.php =================================================================== RCS file: /cvsroot/mxbb/mx_phpbb/includes/forum_hack.php,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -C2 -d -r1.24 -r1.24.2.1 *** forum_hack.php 22 Jul 2007 22:31:04 -0000 1.24 --- forum_hack.php 20 Dec 2007 10:57:57 -0000 1.24.2.1 *************** *** 23,29 **** --- 23,51 ---- include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_post.' . $phpEx); + + //Check for mx_smartor fap version + if (file_exists($mx_root_path . 'modules/mx_smartor/album_mod/album_bbconstants.' . $phpEx)) + { + include_once($mx_root_path . 'modules/mx_smartor/album_mod/album_bbconstants.' . $phpEx); + } + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); include_once($phpbb_root_path . 'includes/auth.' . $phpEx); + //Check for cash mod + if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) + { + define('IN_CASHMOD', true); + + if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_cash.'.$phpEx)) ) + { + include_once($phpbb_root_path . 'language/lang_english/lang_cash.' . $phpEx); + } + else + { + include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_cash.' . $phpEx); + } + } + // -------------------------------------------------------------------------------- // Class: mx_forum *************** *** 322,325 **** --- 344,348 ---- 'search' => $this->phpbb_config['search'], 'viewonline' => $this->phpbb_config['viewonline'], + 'cash' => $this->phpbb_config['other'], 'other' => $this->phpbb_config['other'], ); *************** *** 346,350 **** 'viewforum' => 0, 'viewonline' => 0, ! 'viewtopic' => 0 ); } --- 369,374 ---- 'viewforum' => 0, 'viewonline' => 0, ! 'viewtopic' => 0, ! 'cash' => 0 ); } *************** *** 618,623 **** { case 'index': ! //global $s_last_visit; // declared here: includes/page_header.php ! $s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : ''; $script_vars = array( 'LAST_VISIT_DATE' => sprintf( $lang['You_last_visit'], $s_last_visit ), --- 642,646 ---- { case 'index': ! global $s_last_visit; // declared here: includes/page_header.php $script_vars = array( 'LAST_VISIT_DATE' => sprintf( $lang['You_last_visit'], $s_last_visit ), *************** *** 1287,1290 **** --- 1310,1382 ---- global $server_url; // used globally by usercp_register.php + //Check for cash mod + if (defined('IN_CASHMOD')) + { + global $cash, $cm_groups; // allways used globally by cash mod + + switch ( $phpbb_file ) + { + case 'memberlist': + define('CM_MEMBERLIST', true); + global $cm_memberlist; + break; + case 'posting': + define('CM_POSTING', true); + global $cm_posting; + break; + case 'viewtopic': + define('CM_VIEWTOPIC', true); + global $cm_viewtopic; + break; + case 'viewprofile': + define('CM_VIEWPROFILE', true); + global $cm_viewprofile; + break; + } + $cashcode=file_get_contents($phpbb_root_path . 'includes/functions_cash.'.$phpEx); + + // + // Remove php tags + // + $cashcode = str_replace('<?php','',$cashcode); + $cashcode = str_replace('?>','',$cashcode); + + // + // Commment out the main includes + // + $cashcode = preg_replace('#^(.?include).*(extension).*(\r\n?|\n)#m','// mxBB: Removed include extension.inc' . "\n", $cashcode); + $cashcode = preg_replace('#^(.?include).*(common).*(\r\n?|\n)#m','// mxBB: Removed include common.php' . "\n", $cashcode); + + // + // Remove some includes already included by mxBB + // + $cashcode = preg_replace ("/include(.*)bbcode/", "//", $cashcode); + $cashcode = preg_replace ("/include(.*)functions_post/", "//", $cashcode); + + // + // NOTE: This regex will only work if "global" is stated on a new line... + // + //$cashcode = preg_replace('#^(.?).*(global)(.*?)($)(.*?)(\r\n?|\n)#m', '// mxBB rewrite of global, to instance $this in this function' . "\n " . 'global $phpbb_root_path, \\3', $cashcode); + + // + // Rewrite the $template + // + $cashcode = preg_replace ("/$template = (.*)\;/", "$template = '" . $template . "';", $cashcode); + + + // + // Rewrite the phpbb_root_path + // + $cashcode = preg_replace ("/phpbb_root_path = (.*)\;/", "phpbb_root_path = '" . $phpbb_root_path . "';", $cashcode); + + + // + // Add the phpbb_root_path to the append_sid function - if not already there + // + // + $template = new mx_Template( $phpbb_root_path . 'templates/'. $theme['template_name'] ); + eval($cashcode); + } + $code=file_get_contents($phpbb_root_path . $phpbb_file . ".$phpEx"); *************** *** 1367,1370 **** --- 1459,1463 ---- $code = str_replace('$is_auth_ary[$forum_data[$i][\'forum_id\']][\'auth_view\']', '$is_auth_ary[$forum_data[$i][\'forum_id\']][\'auth_view\'] && $mx_forum->phpbb2_auth_cat($forum_data[$i][\'forum_id\'])', $code); // For phpBB 2.0.21 and later $code = str_replace('$is_auth_ary[$forum_id][\'auth_view\']', '$is_auth_ary[$forum_id][\'auth_view\'] && $mx_forum->phpbb2_auth_cat($forum_data[$i][\'forum_id\'])', $code); // For phpBB 2.0.21 and later + // Hack for XS/Simple SubForum $code = str_replace('$images = unserialize($item[\'FORUM_FOLDERS\'])', '$mx_forum->images = unserialize($item[\'FORUM_FOLDERS\'])', $code); *************** *** 1385,1389 **** $code = str_replace('$temp_url = "modcp.', '$temp_url = "' . $phpbb_root_path . 'modcp.', $code); $code = str_replace('$temp_url = "posting.', '$temp_url = "' . $phpbb_root_path . 'posting.', $code); ! // // Avatars and ranks --- 1478,1482 ---- $code = str_replace('$temp_url = "modcp.', '$temp_url = "' . $phpbb_root_path . 'modcp.', $code); $code = str_replace('$temp_url = "posting.', '$temp_url = "' . $phpbb_root_path . 'posting.', $code); ! // // Avatars and ranks *************** *** 1419,1441 **** case 'includes/usercp_avatar': // ! // Avatars and ranks // ! $code = str_replace('\'./\' . $board_config[\'avatar_gallery_path\']', '$board_config[\'avatar_gallery_path\']', $code); ! $code = str_replace('\'./\' . $board_config[\'avatar_path\']', '$board_config[\'avatar_path\']', $code); ! $code = str_replace('$board_config[\'avatar_gallery_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_gallery_path\']', $code); ! $code = str_replace('$board_config[\'avatar_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_path\']', $code); break; ! case 'includes/usercp_viewprofile': ! // ! // Avatars and ranks ! // ! $code = str_replace('\'./\' . $board_config[\'avatar_gallery_path\']', '$board_config[\'avatar_gallery_path\']', $code); ! $code = str_replace('\'./\' . $board_config[\'avatar_path\']', '$board_config[\'avatar_path\']', $code); ! ! $code = str_replace('$board_config[\'avatar_gallery_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_gallery_path\']', $code); ! $code = str_replace('$board_config[\'avatar_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_path\']', $code); ! break; } --- 1512,1543 ---- case 'includes/usercp_avatar': // ! // Avatars and ranks // ! $code = str_replace( '\'./\' . $board_config[\'avatar_gallery_path\']', '$board_config[\'avatar_gallery_path\']', $code ); ! $code = str_replace( '\'./\' . $board_config[\'avatar_path\']', '$board_config[\'avatar_path\']', $code ); ! ! $code = str_replace( '$board_config[\'avatar_gallery_path\']', '\'' . $phpbb_root_path . '\' . $board_config[\'avatar_gallery_path\']', $code ); ! $code = str_replace( '$board_config[\'avatar_path\']', '\'' . $phpbb_root_path . '\' . $board_config[\'avatar_path\']', $code ); ! $code = str_replace( 'if (!is_uploaded_file($avatar_filename))', 'if (!file_exists($avatar_filename))', $code); ! $code = str_replace( '$move_file($avatar_filename, \'' . $phpbb_root_path .'\' . $board_config[\'avatar_path\'] . "/$new_filename");','$move_file($avatar_filename, \'' . $phpbb_root_path .'\' . $board_config[\'avatar_path\'] . "/$new_filename"); ! @unlink( $avatar_filename);', $code); break; + + case 'includes/usercp_viewprofile': + // + // Avatars and ranks + // + $code = str_replace('\'./\' . $board_config[\'avatar_gallery_path\']', '$board_config[\'avatar_gallery_path\']', $code); + $code = str_replace('\'./\' . $board_config[\'avatar_path\']', '$board_config[\'avatar_path\']', $code); ! $code = str_replace('$board_config[\'avatar_gallery_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_gallery_path\']', $code); ! $code = str_replace('$board_config[\'avatar_path\']', '\''.$phpbb_root_path.'\' . $board_config[\'avatar_path\']', $code); ! break; ! ! case 'cash': ! ! $code = str_replace('exit;', 'return;', $code); ! break; } *************** *** 1497,1500 **** --- 1599,1612 ---- if ($mx_forum->phpbb_config['enable_module']) { + if ( isset( $HTTP_POST_FILES ) && !empty( $HTTP_POST_FILES ) ) + { + $up_files_keys = array_keys( $HTTP_POST_FILES ); + foreach( $up_files_keys as $up_file ) + { + @rename( $HTTP_POST_FILES[$up_file]['tmp_name'], $HTTP_POST_FILES[$up_file]['tmp_name'] . '.mxbb' ); + $HTTP_POST_FILES[$up_file]['tmp_name'] .= '.mxbb'; + $_FILES[$up_file]['tmp_name'] .= '.mxbb'; + } + } $http_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; $http_server = preg_replace( '#^\/?(.*?)\/?$#', '\1', trim( $board_config['server_name'] ) ); |