Chess game

Mods etc.

Moderator: Integra Moderator

Chess game

PostAuthor: Skywalker » Mon Jul 10, 2006 2:16 am

Who can port this to IM?

Code: Select all
################################################################### Mod Title]http://boo.ifreepages.com#[/url]# Mod Version: 0.0.1## Mod Description: Chess Game for phpBB,##                  allows registered user playing chess against another user,##                  graphical & interactive board game ##                  (just drag & drop it instead of typing a notation),##                  based on standard chess rules ##                  (castle, en passant, check, checkmate, stalemate, pawn promotion, etc),##                  one topic one game, chess board will displaying on top of topic page,##                  tested on phpBB 2.0.18, 2.0.19, 2.0.20#### Installation Level: Moderate## Installation Time: 20 Minutes#### Files To Edit: 11##         common.php##         modcp.php##         posting.php##         viewforum.php##         viewtopic.php##         admin/admin_forumauth.php##         includes/auth.php##         includes/functions.php##         includes/functions_post.php##         templates/subSilver/posting_body.tpl##         templates/subSilver/viewtopic_body.tpl#### Included Files: ##                chess_config.php##                all php and tpl files in chess/ folder################################################################### For Security Purposes, Please Check: [url=http://www.phpbb.com/mods/]http://www.phpbb.com/mods/[/url] for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: [url=http://www.phpbb.com/mods/]http://www.phpbb.com/mods/[/url] ############################################################## ## Author Notes: ## Still on dev., works fine, bugs unknown,## without php code optimizing## I don't recommend using it on a working boards############################################################## ## MOD History: ## ##   2006-04-16 - Version 0.0.1 ##      - First released################################################################### Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD#################################################################  ##-----[ SQL ]------------------------------------------ #ALTER TABLE `phpbb_auth_access` ADD `auth_chess_create` TINYINT( 1 ) NOT NULL ;ALTER TABLE `phpbb_auth_access` ADD `auth_chess_play` TINYINT( 1 ) NOT NULL ;ALTER TABLE `phpbb_forums` ADD `auth_chess_create` TINYINT( 1 ) NOT NULL ;ALTER TABLE `phpbb_forums` ADD `auth_chess_play` TINYINT( 1 ) NOT NULL ;ALTER TABLE `phpbb_topics` ADD `topic_chess` TINYINT( 1 ) NOT NULL ;  UPDATE `phpbb_forums` SET `auth_chess_create` = '1', `auth_chess_play` = '1';  DROP TABLE IF EXISTS `phpbb_chess`;CREATE TABLE IF NOT EXISTS `phpbb_chess` (   `chess_id` mediumint(8) unsigned NOT NULL auto_increment,   `topic_id` mediumint(8) unsigned NOT NULL default '0',   `chess_set_name` varchar(20) NOT NULL default '',   `chess_board_name` varchar(20) NOT NULL default '',   `chess_creator` mediumint(8) unsigned NOT NULL default '0',   `chess_p1_id` mediumint(8) unsigned NOT NULL default '0',   `chess_p2_id` mediumint(8) unsigned NOT NULL default '0',   `chess_p1_pref` tinyint(1) NOT NULL default '0',   `chess_p2_pref` tinyint(1) NOT NULL default '0',   `chess_castle` tinyint(1) NOT NULL default '0',   `chess_turn` mediumint(8) unsigned NOT NULL default '0',   `chess_winner` mediumint(8) unsigned NOT NULL default '0',   `chess_list_position` varchar(255) NOT NULL default '',   `chess_list_valid` text NOT NULL,   `chess_list_move` text NOT NULL,   `chess_message` varchar(255) NOT NULL default '',   `chess_start` int(11) NOT NULL default '0',   `chess_closed` tinyint(1) NOT NULL default '0',   PRIMARY KEY  (`chess_id`),   KEY `topic_id` (`topic_id`),   KEY `chess_p1_id` (`chess_p1_id`),   KEY `chess_p2_id` (`chess_p2_id`),   KEY `chess_turn` (`chess_turn`),   KEY `chess_creator` (`chess_creator`),   KEY `chess_winner` (`chess_winner`),   KEY `chess_closed` (`chess_closed`)) ENGINE=MyISAM;  DROP TABLE IF EXISTS `phpbb_chess_config`;CREATE TABLE IF NOT EXISTS `phpbb_chess_config` (   `config_name` varchar(255) NOT NULL default '',   `config_value` varchar(255) NOT NULL default '',   PRIMARY KEY  (`config_name`)) ENGINE=MyISAM;  INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_override_user_set', '1');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_path', 'chess');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_board_path', 'chess/board');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_set_path', 'chess/set');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_include_path', 'chess/includes');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_template_path', 'chess/templates');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_language_path', 'chess/language');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_default_board_name', 'natural');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_default_set_name', 'bc4000');INSERT INTO `phpbb_chess_config` (`config_name`, `config_value`) VALUES ('chess_override_default_language', 'nederlands');  ##-----[ COPY ]------------------------------------------ #copy chess_config.php to chess_config.phpcopy chess/*.* to chess/*.*  # #-----[ OPEN ]------------------------------------------ # common.php  # #-----[ FIND ]------------------------------------------ #?>  # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINinclude($phpbb_root_path . 'chess_config.'.$phpEx);// CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # modcp.php  # #-----[ FIND ]------------------------------------------ #             sync('forum', $forum_id);  # #-----[ BEFORE, ADD ]------------------------------------------ #             // CHESS_MOD BEGIN             include($phpbb_root_path . $board_config['chess_include_path'] . '/chess_table_delete.'.$phpEx);             chess_table_delete ( $topic_id_sql, 'Could not delete chess game data', 'LIMIT 1' );             // CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # posting.php  # #-----[ FIND ]------------------------------------------ #$refresh = $preview || $poll_add || $poll_edit || $poll_delete;  # #-----[ AFTER, ADD ]------------------------------------------ # // CHESS_MOD BEGINinclude($phpbb_root_path . $board_config['chess_include_path'] . '/chess_posting.'.$phpEx);// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ # around line 163     default:     # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     case 'chess_delete':     case 'chess_join':     case 'chess_play':         break;     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ # around line 221     default:     # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     case 'chess_delete':     case 'chess_join':     case 'chess_play':         break;     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #if ( $result = $db->sql_query($sql) )     # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINchess_posting_on_mode();// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     if ( $mode == 'poll_delete' && !isset($poll_id) )     {         message_die(GENERAL_MESSAGE, $lang['No_such_post']);     }  # #-----[ AFTER, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     $chess_id = chess_posting_get_id ();     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )     # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINchess_posting_action();// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #             $bbcode_uid = '';     # #-----[ BEFORE, ADD ]------------------------------------------ #             // CHESS_MOD BEGIN             $chess_create = ( (isset($HTTP_POST_VARS['chess_create']) || isset($HTTP_POST_VARS['chess_active'])) && $is_auth['auth_chess_create'] ) ? 1 : '';             $chess_ask = ( isset($HTTP_POST_VARS['chess_ask']) && $is_auth['auth_chess_create'] ) ? $HTTP_POST_VARS['chess_ask'] : '';             $chess_ask = (!empty($chess_ask)) ? htmlspecialchars(trim($chess_ask)) : $lang['Chess_question_message'];             $chess_side = ( isset($HTTP_POST_VARS['chess_side']) && $is_auth['auth_chess_create'] ) ? $HTTP_POST_VARS['chess_side'] : '';             $chess_position = ( isset($HTTP_POST_VARS['chess_position']) && $is_auth['auth_chess_create'] ) ? $HTTP_POST_VARS['chess_position'] : '';             $chess_set_name = ( $board_config['chess_override_user_set'] && isset($HTTP_POST_VARS['chess_set_name']) && $is_auth['auth_chess_create'] ) ? $HTTP_POST_VARS['chess_set_name'] : $board_config['chess_default_set_name'];             $chess_board_name = ( $board_config['chess_override_user_set'] && isset($HTTP_POST_VARS['chess_board_name']) && $is_auth['auth_chess_create'] ) ? $HTTP_POST_VARS['chess_board_name'] : $board_config['chess_default_board_name'];             // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #         case 'delete':         case 'poll_delete':             delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);             break;  # #-----[ BEFORE, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         case 'chess_delete':         // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #//// Topic review//if( $mode == 'reply' && $is_auth['auth_read'] )  # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINchess_posting_entry();// CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # viewforum.php  # #-----[ FIND ]------------------------------------------ #         if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )  # #-----[ BEFORE, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         include($phpbb_root_path . $board_config['chess_include_path'] . '/chess_viewforum.'.$phpEx);         // CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # viewtopic.php  # #-----[ FIND ]------------------------------------------ #//// This rather complex gaggle of code handles querying for topics but// also allows for direct linking to a post (and the calculation of which// page the post is on and the correct display of viewtopic)//$join_sql_table = (!$post_id) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";  # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINinclude($phpbb_root_path . $board_config['chess_include_path'] . '/chess_viewtopic.'.$phpEx);// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";  # #-----[ AFTER, ADD ]------------------------------------------ # // CHESS_MOD BEGINchess_viewtopic_select();// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #//// Update the topic view counter//$sql = "UPDATE " . TOPICS_TABLE . "  # #-----[ BEFORE, ADD ]------------------------------------------ # // CHESS_MOD BEGINchess_viewtopic_entry();// CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # admin/admin_forumauth.php  # #-----[ FIND ]------------------------------------------ # $forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);  # #-----[ AFTER, ADD ]------------------------------------------ # // CHESS_MOD BEGINinclude($phpbb_root_path . $board_config['chess_include_path'] . '/chess_admin_forumauth.'.$phpEx);// CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #                 $sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;  # #-----[ BEFORE, ADD ]------------------------------------------ #                 // CHESS_MOD BEGIN                 $value = chess_admin_forumauth_authfields( $value, $forum_auth_fields[$i], $HTTP_POST_VARS[$forum_auth_fields[$i]] );                 // CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # includes/auth.php  # #-----[ FIND ]------------------------------------------ #     global $db, $lang;  # #-----[ AFTER, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     global $phpbb_root_path, $phpEx, $board_config;     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     //     // If f_access has been passed, or auth is needed to return an array of forums     // then we need to pull the auth information on the given forum (or all forums)     //     if ( empty($f_access) )  # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     include($phpbb_root_path . $board_config['chess_include_path'] . '/chess_auth.'.$phpEx);     // CHESS_MOD END     # #-----[ OPEN ]------------------------------------------ # includes/functions.php  # #-----[ FIND ]------------------------------------------ #     include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);  # #-----[ AFTER, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     include($phpbb_root_path . $board_config['chess_include_path'] . '/chess_functions.'.$phpEx);     // CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # includes/functions_post.php  # #-----[ FIND ]------------------------------------------ #$unhtml_specialchars_replace = array('>', '<41>sql_nextid();         }  # #-----[ AFTER, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         chess_set_active();         // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));  # #-----[ AFTER, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     chess_create();     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     $sign = ($mode == 'delete') ? '- 1' : '+ 1';  # #-----[ AFTER, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     $sign = ($mode == 'poll_delete' || $mode == 'chess_delete') ? '' : $sign;     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #         $forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : "");  # #-----[ BEFORE, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         if ($mode != 'chess_delete')         // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #         $topic_update_sql = "topic_last_post_id = $post_id" . (($mode == 'reply') ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id");  # #-----[ BEFORE, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         if ($mode != 'chess_delete')         // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #         $topic_update_sql .= 'topic_vote = 0';  # #-----[ BEFORE, ADD ]------------------------------------------ #         // CHESS_MOD BEGIN         if ($mode == 'poll_delete')         // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     $sql = "UPDATE " . FORUMS_TABLE . " SET         $forum_update_sql         WHERE forum_id = $forum_id";  # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     if ($mode == 'chess_delete') $topic_update_sql .= 'topic_chess = 0';     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     if ($mode != 'poll_delete')     {         $sql = "UPDATE " . USERS_TABLE . "             SET user_posts = user_posts $sign             WHERE user_id = $user_id";         if (!$db->sql_query($sql, END_TRANSACTION))         {             message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);         }     }  # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     if ($mode != 'chess_delete')     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     if ($mode != 'poll_delete')     {         include($phpbb_root_path . 'includes/functions_search.'.$phpEx);  # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     global $chess_id;       if ($mode != 'chess_delete')     // CHESS_MOD END  # #-----[ FIND ]------------------------------------------ #     if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post'])  # #-----[ BEFORE, ADD ]------------------------------------------ #     // CHESS_MOD BEGIN     chess_delete();     // CHESS_MOD END  # #-----[ OPEN ]------------------------------------------ # templates/subSilver/posting_body.tpl  # #-----[ FIND ]------------------------------------------ #     {POLLBOX}  # #-----[ AFTER, ADD ]------------------------------------------ #     {CHESSBOX}  # #-----[ OPEN ]------------------------------------------ # templates/subSilver/viewtopic_body.tpl  # #-----[ FIND ]------------------------------------------ #     {POLL_DISPLAY}  # #-----[ AFTER, ADD ]------------------------------------------ #     {CHESS_DISPLAY}  ##-----[ SAVE/CLOSE ALL FILES ]--------------------------## EoM
Last edited by Skywalker on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

Skywalker
Sr Integra Member
Sr Integra Member
 
Posts: 236
Likes: 0 post
Liked in: 0 post
Joined: Fri Apr 14, 2006 5:25 pm
Cash on hand: 0.00

Return to IntegraMOD Modifications

Who is online

Registered users: App360MonitorBot, Bing [Bot], Google [Bot], Helter