@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | /**#@+ |
| 36 | 36 | */ |
| 37 | 37 | require_once '../../mainfile.php'; |
| 38 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 39 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 40 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php'; |
|
| 41 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.inc.php'; |
|
| 42 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.inc.php'; |
|
| 38 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 39 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 40 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php'; |
|
| 41 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.inc.php'; |
|
| 42 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.inc.php'; |
|
| 43 | 43 | |
| 44 | 44 | $xoopsOption['template_main'] = 'chess_player_stats.html'; |
| 45 | 45 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching |
| 46 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 46 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 47 | 47 | |
| 48 | 48 | // user input |
| 49 | 49 | $player_uid = intval(isset($_POST['player_uid']) ? $_POST['player_uid'] : @$_GET['player_uid']); |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | // Otherwise, if player user ID provided, map it to a username. |
| 62 | 62 | } elseif ($player_uid != 0) { |
| 63 | - $member_handler =& xoops_gethandler('member'); |
|
| 64 | - $player_user =& $member_handler->getUser($player_uid); |
|
| 65 | - $player_uname = is_object($player_user) ? $player_user->getVar('uname') : ''; |
|
| 63 | + $member_handler = & xoops_gethandler('member'); |
|
| 64 | + $player_user = & $member_handler->getUser($player_uid); |
|
| 65 | + $player_uname = is_object($player_user) ? $player_user->getVar('uname') : ''; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Check that both user ID and username are now defined. |
| 69 | 69 | if ($player_uid == 0 or empty($player_uname)) { |
| 70 | - redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND); |
|
| 70 | + redirect_header(XOOPS_URL.'/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Display stats |
| 74 | 74 | chess_player_stats($player_uid, $player_uname, $show_option, $cstart, $gstart); |
| 75 | 75 | |
| 76 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 76 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
| 77 | 77 | /**#@-*/ |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | // --------- |
| 247 | 247 | |
| 248 | 248 | // get mapping of user IDs to usernames |
| 249 | - $member_handler =& xoops_gethandler('member'); |
|
| 250 | - $criteria = new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'); |
|
| 251 | - $usernames = $member_handler->getUserList($criteria); |
|
| 249 | + $member_handler = & xoops_gethandler('member'); |
|
| 250 | + $criteria = new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'); |
|
| 251 | + $usernames = $member_handler->getUserList($criteria); |
|
| 252 | 252 | |
| 253 | 253 | // add usernames to $games |
| 254 | 254 | foreach ($games as $k => $game) { |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | $player['games'] = $games; |
| 301 | 301 | $player['challenges'] = $challenges; |
| 302 | 302 | |
| 303 | - $xoopsTpl->assign('chess_player', $player); |
|
| 304 | - $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system')); |
|
| 305 | - $xoopsTpl->assign('chess_provisional_games', $num_provisional_games); |
|
| 303 | + $xoopsTpl->assign('chess_player', $player); |
|
| 304 | + $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system')); |
|
| 305 | + $xoopsTpl->assign('chess_provisional_games', $num_provisional_games); |
|
| 306 | 306 | $xoopsTpl->assign('chess_show_option_urlparam', $show_option_urlparam); |
| 307 | - $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav()); |
|
| 308 | - $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav()); |
|
| 307 | + $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav()); |
|
| 308 | + $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav()); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | ?> |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | /**#@+ |
| 35 | 35 | */ |
| 36 | 36 | require_once 'admin_header.php'; |
| 37 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 38 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 39 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.inc.php'; |
|
| 37 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 38 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 39 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.inc.php'; |
|
| 40 | 40 | |
| 41 | 41 | // user input |
| 42 | 42 | $op = chess_sanitize(@$_GET['op']); |
@@ -77,20 +77,20 @@ discard block |
||
| 77 | 77 | <h4> "._AM_CHESS_CONF." </h4> |
| 78 | 78 | <table width='100%' border='0' cellspacing='1' class='outer'> |
| 79 | 79 | <tr> |
| 80 | - <td><a href='" .XOOPS_URL. "/modules/" .$xoopsModule->getVar('dirname'). "/admin/index.php?op=suspended_games'>" ._AM_CHESS_SUSPENDED_GAMES. "</a> |
|
| 81 | - <td>" ._AM_CHESS_SUSPENDED_GAMES_DES. "</td> |
|
| 80 | + <td><a href='" .XOOPS_URL."/modules/".$xoopsModule->getVar('dirname')."/admin/index.php?op=suspended_games'>"._AM_CHESS_SUSPENDED_GAMES."</a> |
|
| 81 | + <td>" ._AM_CHESS_SUSPENDED_GAMES_DES."</td> |
|
| 82 | 82 | </tr> |
| 83 | 83 | <tr> |
| 84 | - <td><a href='" .XOOPS_URL. "/modules/" .$xoopsModule->getVar('dirname'). "/admin/index.php?op=active_games'>" ._AM_CHESS_ACTIVE_GAMES. "</a> |
|
| 85 | - <td>" ._AM_CHESS_ACTIVE_GAMES_DES. "</td> |
|
| 84 | + <td><a href='" .XOOPS_URL."/modules/".$xoopsModule->getVar('dirname')."/admin/index.php?op=active_games'>"._AM_CHESS_ACTIVE_GAMES."</a> |
|
| 85 | + <td>" ._AM_CHESS_ACTIVE_GAMES_DES."</td> |
|
| 86 | 86 | </tr> |
| 87 | 87 | <tr> |
| 88 | - <td><a href='" .XOOPS_URL. "/modules/" .$xoopsModule->getVar('dirname'). "/admin/index.php?op=challenges'>" ._AM_CHESS_CHALLENGES. "</a> |
|
| 89 | - <td>" ._AM_CHESS_CHALLENGES_DES. "</td> |
|
| 88 | + <td><a href='" .XOOPS_URL."/modules/".$xoopsModule->getVar('dirname')."/admin/index.php?op=challenges'>"._AM_CHESS_CHALLENGES."</a> |
|
| 89 | + <td>" ._AM_CHESS_CHALLENGES_DES."</td> |
|
| 90 | 90 | </tr> |
| 91 | 91 | <tr> |
| 92 | - <td><a href='" .XOOPS_URL. "/modules/system/admin.php?fct=preferences&op=showmod&mod=" .$xoopsModule->getVar('mid'). "'>" ._AM_CHESS_PREFS. "</a> |
|
| 93 | - <td>" ._AM_CHESS_PREFS_DESC. "</td> |
|
| 92 | + <td><a href='" .XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."'>"._AM_CHESS_PREFS."</a> |
|
| 93 | + <td>" ._AM_CHESS_PREFS_DESC."</td> |
|
| 94 | 94 | </tr> |
| 95 | 95 | </table> |
| 96 | 96 | "; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | global $start, $max_items_to_display, $op, $xoopsDB, $xoopsModule; |
| 105 | 105 | |
| 106 | - $member_handler =& xoops_gethandler('member'); |
|
| 106 | + $member_handler = & xoops_gethandler('member'); |
|
| 107 | 107 | |
| 108 | 108 | // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
| 109 | 109 | // and one with a limit clause to get the data for display on the current page. |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ($xoopsDB->getRowsNum($result) > 0) { |
| 131 | 131 | |
| 132 | - echo '<h3>' ._AM_CHESS_SUSPENDED_GAMES. "</h3>\n"; |
|
| 132 | + echo '<h3>'._AM_CHESS_SUSPENDED_GAMES."</h3>\n"; |
|
| 133 | 133 | |
| 134 | 134 | while ($row = $xoopsDB->fetchArray($result)) { |
| 135 | 135 | |
| 136 | - $user_white =& $member_handler->getUser($row['white_uid']); |
|
| 137 | - $username_white = is_object($user_white) ? $user_white->getVar('uname') : '(open)'; |
|
| 136 | + $user_white = & $member_handler->getUser($row['white_uid']); |
|
| 137 | + $username_white = is_object($user_white) ? $user_white->getVar('uname') : '(open)'; |
|
| 138 | 138 | |
| 139 | - $user_black =& $member_handler->getUser($row['black_uid']); |
|
| 140 | - $username_black = is_object($user_black) ? $user_black->getVar('uname') : '(open)'; |
|
| 139 | + $user_black = & $member_handler->getUser($row['black_uid']); |
|
| 140 | + $username_black = is_object($user_black) ? $user_black->getVar('uname') : '(open)'; |
|
| 141 | 141 | |
| 142 | 142 | $date = $row['start_date'] ? date('Y.m.d', $row['start_date']) : 'not yet started'; |
| 143 | 143 | |
| 144 | - $title_text = _AM_CHESS_GAME. " #{$row['game_id']} $username_white " ._AM_CHESS_VS. " $username_black ($date)"; |
|
| 145 | - $form = new XoopsThemeForm($title_text, "game_{$row['game_id']}", XOOPS_URL. '/modules/' .$xoopsModule->getVar('dirname'). "/game.php?game_id={$row['game_id']}", 'post', true); |
|
| 144 | + $title_text = _AM_CHESS_GAME." #{$row['game_id']} $username_white "._AM_CHESS_VS." $username_black ($date)"; |
|
| 145 | + $form = new XoopsThemeForm($title_text, "game_{$row['game_id']}", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/game.php?game_id={$row['game_id']}", 'post', true); |
|
| 146 | 146 | |
| 147 | 147 | list($date, $suspender_uid, $type, $explain) = explode('|', $row['suspended']); |
| 148 | 148 | |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | break; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $suspender_user =& $member_handler->getUser($suspender_uid); |
|
| 162 | - $suspender_username = is_object($suspender_user) ? $suspender_user->getVar('uname') : _AM_CHESS_UNKNOWN_USER; |
|
| 161 | + $suspender_user = & $member_handler->getUser($suspender_uid); |
|
| 162 | + $suspender_username = is_object($suspender_user) ? $suspender_user->getVar('uname') : _AM_CHESS_UNKNOWN_USER; |
|
| 163 | 163 | |
| 164 | - $form->addElement(new XoopsFormLabel(_AM_CHESS_WHEN_SUSPENDED . ':', formatTimestamp(strtotime($date)))); |
|
| 165 | - $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENDED_BY . ':', $suspender_username)); |
|
| 166 | - $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENSION_TYPE . ':', $type_display)); |
|
| 167 | - $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENSION_REASON . ':', $explain)); |
|
| 164 | + $form->addElement(new XoopsFormLabel(_AM_CHESS_WHEN_SUSPENDED.':', formatTimestamp(strtotime($date)))); |
|
| 165 | + $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENDED_BY.':', $suspender_username)); |
|
| 166 | + $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENSION_TYPE.':', $type_display)); |
|
| 167 | + $form->addElement(new XoopsFormLabel(_AM_CHESS_SUSPENSION_REASON.':', $explain)); |
|
| 168 | 168 | |
| 169 | 169 | $form->addElement(new XoopsFormButton('', 'submit', _AM_CHESS_ARBITRATE_SUBMIT, 'submit')); |
| 170 | 170 | |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $pagenav = new XoopsPageNav($num_rows, $max_items_to_display, $start, 'start', "op=$op"); |
| 177 | - echo '<div align="center">' . $pagenav->renderNav() . " </div>\n"; |
|
| 177 | + echo '<div align="center">'.$pagenav->renderNav()." </div>\n"; |
|
| 178 | 178 | |
| 179 | 179 | } else { |
| 180 | 180 | |
| 181 | - echo '<h3>' ._AM_CHESS_NO_SUSPENDED_GAMES. "</h3>\n"; |
|
| 181 | + echo '<h3>'._AM_CHESS_NO_SUSPENDED_GAMES."</h3>\n"; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $xoopsDB->freeRecordSet($result); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | global $start, $max_items_to_display, $op, $xoopsDB, $xoopsModule; |
| 193 | 193 | |
| 194 | - $member_handler =& xoops_gethandler('member'); |
|
| 194 | + $member_handler = & xoops_gethandler('member'); |
|
| 195 | 195 | |
| 196 | 196 | // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
| 197 | 197 | // and one with a limit clause to get the data for display on the current page. |
@@ -213,20 +213,20 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | if ($xoopsDB->getRowsNum($result) > 0) { |
| 215 | 215 | |
| 216 | - echo '<h3>' ._AM_CHESS_ACTIVE_GAMES. "</h3>\n"; |
|
| 216 | + echo '<h3>'._AM_CHESS_ACTIVE_GAMES."</h3>\n"; |
|
| 217 | 217 | |
| 218 | 218 | while ($row = $xoopsDB->fetchArray($result)) { |
| 219 | 219 | |
| 220 | - $user_white =& $member_handler->getUser($row['white_uid']); |
|
| 221 | - $username_white = is_object($user_white) ? $user_white->getVar('uname') : '(open)'; |
|
| 220 | + $user_white = & $member_handler->getUser($row['white_uid']); |
|
| 221 | + $username_white = is_object($user_white) ? $user_white->getVar('uname') : '(open)'; |
|
| 222 | 222 | |
| 223 | - $user_black =& $member_handler->getUser($row['black_uid']); |
|
| 224 | - $username_black = is_object($user_black) ? $user_black->getVar('uname') : '(open)'; |
|
| 223 | + $user_black = & $member_handler->getUser($row['black_uid']); |
|
| 224 | + $username_black = is_object($user_black) ? $user_black->getVar('uname') : '(open)'; |
|
| 225 | 225 | |
| 226 | 226 | $date = $row['start_date'] ? date('Y.m.d', $row['start_date']) : 'not yet started'; |
| 227 | 227 | |
| 228 | - $title_text = _AM_CHESS_GAME. " #{$row['game_id']} $username_white " ._AM_CHESS_VS. " $username_black ($date)"; |
|
| 229 | - $form = new XoopsThemeForm($title_text, "game_{$row['game_id']}", XOOPS_URL. '/modules/' .$xoopsModule->getVar('dirname'). "/game.php?game_id={$row['game_id']}", 'post', true); |
|
| 228 | + $title_text = _AM_CHESS_GAME." #{$row['game_id']} $username_white "._AM_CHESS_VS." $username_black ($date)"; |
|
| 229 | + $form = new XoopsThemeForm($title_text, "game_{$row['game_id']}", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/game.php?game_id={$row['game_id']}", 'post', true); |
|
| 230 | 230 | |
| 231 | 231 | $form->addElement(new XoopsFormButton('', 'submit', _AM_CHESS_ARBITRATE_SUBMIT, 'submit')); |
| 232 | 232 | |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $pagenav = new XoopsPageNav($num_rows, $max_items_to_display, $start, 'start', "op=$op"); |
| 239 | - echo '<div align="center">' . $pagenav->renderNav() . " </div>\n"; |
|
| 239 | + echo '<div align="center">'.$pagenav->renderNav()." </div>\n"; |
|
| 240 | 240 | |
| 241 | 241 | } else { |
| 242 | 242 | |
| 243 | - echo '<h3>' ._AM_CHESS_NO_ACTIVE_GAMES. "</h3>\n"; |
|
| 243 | + echo '<h3>'._AM_CHESS_NO_ACTIVE_GAMES."</h3>\n"; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $xoopsDB->freeRecordSet($result); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | global $start, $max_items_to_display, $op, $xoopsDB, $xoopsModule; |
| 255 | 255 | |
| 256 | - $member_handler =& xoops_gethandler('member'); |
|
| 256 | + $member_handler = & xoops_gethandler('member'); |
|
| 257 | 257 | |
| 258 | 258 | // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
| 259 | 259 | // and one with a limit clause to get the data for display on the current page. |
@@ -274,20 +274,20 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | if ($xoopsDB->getRowsNum($result) > 0) { |
| 276 | 276 | |
| 277 | - echo '<h3>' ._AM_CHESS_CHALLENGES. "</h3>\n"; |
|
| 277 | + echo '<h3>'._AM_CHESS_CHALLENGES."</h3>\n"; |
|
| 278 | 278 | |
| 279 | 279 | while ($row = $xoopsDB->fetchArray($result)) { |
| 280 | 280 | |
| 281 | - $user_player1 =& $member_handler->getUser($row['player1_uid']); |
|
| 282 | - $username_player1 = is_object($user_player1) ? $user_player1->getVar('uname') : '?'; |
|
| 281 | + $user_player1 = & $member_handler->getUser($row['player1_uid']); |
|
| 282 | + $username_player1 = is_object($user_player1) ? $user_player1->getVar('uname') : '?'; |
|
| 283 | 283 | |
| 284 | - $user_player2 =& $member_handler->getUser($row['player2_uid']); |
|
| 285 | - $username_player2 = is_object($user_player2) ? $user_player2->getVar('uname') : '(open)'; |
|
| 284 | + $user_player2 = & $member_handler->getUser($row['player2_uid']); |
|
| 285 | + $username_player2 = is_object($user_player2) ? $user_player2->getVar('uname') : '(open)'; |
|
| 286 | 286 | |
| 287 | 287 | $date = date('Y.m.d', $row['create_date']); |
| 288 | 288 | |
| 289 | - $title_text = _AM_CHESS_CHALLENGE. " #{$row['challenge_id']} $username_player1 " ._AM_CHESS_CHALLENGED. ": $username_player2 (" ._AM_CHESS_CREATED. " $date)"; |
|
| 290 | - $form = new XoopsThemeForm($title_text, "challenge_{$row['challenge_id']}", XOOPS_URL. '/modules/' .$xoopsModule->getVar('dirname'). "/create.php?challenge_id={$row['challenge_id']}", 'post', true); |
|
| 289 | + $title_text = _AM_CHESS_CHALLENGE." #{$row['challenge_id']} $username_player1 "._AM_CHESS_CHALLENGED.": $username_player2 ("._AM_CHESS_CREATED." $date)"; |
|
| 290 | + $form = new XoopsThemeForm($title_text, "challenge_{$row['challenge_id']}", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/create.php?challenge_id={$row['challenge_id']}", 'post', true); |
|
| 291 | 291 | |
| 292 | 292 | $form->addElement(new XoopsFormButton('', 'submit', _AM_CHESS_ARBITRATE_SUBMIT, 'submit')); |
| 293 | 293 | |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | $pagenav = new XoopsPageNav($num_rows, $max_items_to_display, $start, 'start', "op=$op"); |
| 300 | - echo '<div align="center">' . $pagenav->renderNav() . " </div>\n"; |
|
| 300 | + echo '<div align="center">'.$pagenav->renderNav()." </div>\n"; |
|
| 301 | 301 | |
| 302 | 302 | } else { |
| 303 | 303 | |
| 304 | - echo '<h3>' ._AM_CHESS_NO_CHALLENGES. "</h3>\n"; |
|
| 304 | + echo '<h3>'._AM_CHESS_NO_CHALLENGES."</h3>\n"; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $xoopsDB->freeRecordSet($result); |
@@ -39,19 +39,19 @@ discard block |
||
| 39 | 39 | /**#@+ |
| 40 | 40 | */ |
| 41 | 41 | require_once '../../mainfile.php'; |
| 42 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 42 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 43 | 43 | |
| 44 | 44 | $xoopsOption['template_main'] = 'chess_game_main.html'; |
| 45 | 45 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching |
| 46 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 47 | -require_once XOOPS_ROOT_PATH . '/modules/chess/class/chessgame.inc.php'; |
|
| 48 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php'; |
|
| 49 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.inc.php'; |
|
| 46 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 47 | +require_once XOOPS_ROOT_PATH.'/modules/chess/class/chessgame.inc.php'; |
|
| 48 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php'; |
|
| 49 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.inc.php'; |
|
| 50 | 50 | |
| 51 | 51 | chess_game(); |
| 52 | 52 | |
| 53 | -require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
|
| 54 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 53 | +require_once XOOPS_ROOT_PATH.'/include/comment_view.php'; |
|
| 54 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
| 55 | 55 | /**#@-*/ |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $move = chess_sanitize(trim(@$_POST['chessmove']), 'A-Za-z0-9=-'); |
| 73 | 73 | $movetype = chess_sanitize(@$_POST['movetype']); |
| 74 | 74 | $confirm = isset($_POST['confirm']) ? 1 : 0; |
| 75 | - $move_explain = chess_sanitize(trim(@$_POST['move_explain']), 'A-Za-z0-9 .,;:=()[]*?!-'); |
|
| 75 | + $move_explain = chess_sanitize(trim(@$_POST['move_explain']), 'A-Za-z0-9 .,;:=()[]*?!-'); |
|
| 76 | 76 | $arbiter_explain = chess_sanitize(trim(@$_POST['arbiter_explain']), 'A-Za-z0-9 .,;:=()[]*?!-'); |
| 77 | 77 | $orientation = chess_sanitize(@$_POST['orientation']); |
| 78 | 78 | $show_arbiter_ctrl = isset($_POST['show_arbiter_ctrl']); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // If form-submit, check security token. |
| 83 | 83 | if (($submit_move or $submit_refresh or $submit_arbitrate or $show_arbiter_ctrl) and is_object($GLOBALS['xoopsSecurity']) and !$GLOBALS['xoopsSecurity']->check()) { |
| 84 | - redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 85 | - _MD_CHESS_TOKEN_ERROR . '<br />' . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 84 | + redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 85 | + _MD_CHESS_TOKEN_ERROR.'<br />'.implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Fetch the game data from the database. |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $gamedata_updated = false; |
| 95 | 95 | $move_performed = false; // status result from move-handler |
| 96 | - $move_result_text = ''; // text result from move-handler |
|
| 97 | - $draw_claim_error_text = ''; // text describing invalid draw-claim |
|
| 98 | - $notify = ''; // text description of action for notification |
|
| 96 | + $move_result_text = ''; // text result from move-handler |
|
| 97 | + $draw_claim_error_text = ''; // text describing invalid draw-claim |
|
| 98 | + $notify = ''; // text description of action for notification |
|
| 99 | 99 | $delete_game = false; |
| 100 | 100 | |
| 101 | 101 | global $xoopsUser; |
| 102 | - $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
|
| 102 | + $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
|
| 103 | 103 | |
| 104 | 104 | $selfplay = $gamedata['white_uid'] == $gamedata['black_uid']; |
| 105 | 105 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | if ($uid == $gamedata['white_uid']) { |
| 108 | 108 | $user_color = $gamedata['fen_active_color']; // current user is either player, so consider him active player |
| 109 | 109 | } else { |
| 110 | - $user_color = ''; // current user is not a player |
|
| 110 | + $user_color = ''; // current user is not a player |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // not self-play |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } elseif ($uid == $gamedata['black_uid']) { |
| 118 | 118 | $user_color = 'b'; // current user is black |
| 119 | 119 | } else { |
| 120 | - $user_color = ''; // current user is not a player |
|
| 120 | + $user_color = ''; // current user is not a player |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if ($draw_claim_valid) { |
| 188 | 188 | $gamedata['offer_draw'] = ''; |
| 189 | 189 | $gamedata['pgn_result'] = '1/2-1/2'; |
| 190 | - $comment = '{' . $draw_claim_text . '}'; |
|
| 190 | + $comment = '{'.$draw_claim_text.'}'; |
|
| 191 | 191 | $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']); |
| 192 | 192 | $gamedata_updated = true; |
| 193 | 193 | $notify = !empty($move) ? "$user_color_name: $move: $draw_claim_text" : "$user_color_name: $draw_claim_text"; |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | if ($user_is_player) { |
| 202 | 202 | $gamedata['offer_draw'] = ''; |
| 203 | 203 | $gamedata['pgn_result'] = $user_color == 'w' ? '0-1' : '1-0'; |
| 204 | - $comment = '{' . $user_color_name . ' ' . _MD_CHESS_RESIGNED . '}'; |
|
| 205 | - $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment" , $gamedata['pgn_movetext']); |
|
| 204 | + $comment = '{'.$user_color_name.' '._MD_CHESS_RESIGNED.'}'; |
|
| 205 | + $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']); |
|
| 206 | 206 | $gamedata_updated = true; |
| 207 | - $notify = "$user_color_name " . _MD_CHESS_RESIGNED; |
|
| 207 | + $notify = "$user_color_name "._MD_CHESS_RESIGNED; |
|
| 208 | 208 | } |
| 209 | 209 | break; |
| 210 | 210 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if ($user_is_player and empty($gamedata['offer_draw']) and !$selfplay) { |
| 213 | 213 | $gamedata['offer_draw'] = $user_color; |
| 214 | 214 | $gamedata_updated = true; |
| 215 | - $notify = "$user_color_name " . _MD_CHESS_OFFERED_DRAW; |
|
| 215 | + $notify = "$user_color_name "._MD_CHESS_OFFERED_DRAW; |
|
| 216 | 216 | } |
| 217 | 217 | break; |
| 218 | 218 | |
@@ -220,17 +220,17 @@ discard block |
||
| 220 | 220 | if ($user_is_player and !empty($gamedata['offer_draw']) and $gamedata['offer_draw'] != $user_color and !$selfplay) { |
| 221 | 221 | $gamedata['offer_draw'] = ''; |
| 222 | 222 | $gamedata['pgn_result'] = '1/2-1/2'; |
| 223 | - $comment = '{' . _MD_CHESS_DRAW_BY_AGREEMENT . '}'; |
|
| 224 | - $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment" , $gamedata['pgn_movetext']); |
|
| 223 | + $comment = '{'._MD_CHESS_DRAW_BY_AGREEMENT.'}'; |
|
| 224 | + $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']); |
|
| 225 | 225 | $gamedata_updated = true; |
| 226 | - $notify = "$user_color_name " . _MD_CHESS_ACCEPTED_DRAW; |
|
| 226 | + $notify = "$user_color_name "._MD_CHESS_ACCEPTED_DRAW; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | case _CHESS_MOVETYPE_REJECT_DRAW: |
| 230 | 230 | if ($user_is_player and !empty($gamedata['offer_draw']) and $gamedata['offer_draw'] != $user_color and !$selfplay) { |
| 231 | 231 | $gamedata['offer_draw'] = ''; |
| 232 | 232 | $gamedata_updated = true; |
| 233 | - $notify = "$user_color_name " . _MD_CHESS_REJECTED_DRAW; |
|
| 233 | + $notify = "$user_color_name "._MD_CHESS_REJECTED_DRAW; |
|
| 234 | 234 | } |
| 235 | 235 | break; |
| 236 | 236 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | if ($user_is_player and ($selfplay or chess_can_delete())) { |
| 264 | 264 | |
| 265 | 265 | $delete_game = true; // must defer actual deletion until after notifications are sent |
| 266 | - $notify = eval('return "' ._MD_CHESS_DELETED_GAME. '";'); // eval references $username |
|
| 266 | + $notify = eval('return "'._MD_CHESS_DELETED_GAME.'";'); // eval references $username |
|
| 267 | 267 | } |
| 268 | 268 | break; |
| 269 | 269 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | $gamedata['suspended'] = implode($sep, array(date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_WANT_ARBITRATION, $move_explain)); |
| 278 | 278 | $gamedata_updated = true; |
| 279 | - $notify = "$user_color_name " . _MD_CHESS_RQSTED_ARBT . ' ' . _MD_CHESS_BEEN_SUSPENDED; |
|
| 279 | + $notify = "$user_color_name "._MD_CHESS_RQSTED_ARBT.' '._MD_CHESS_BEEN_SUSPENDED; |
|
| 280 | 280 | } |
| 281 | 281 | break; |
| 282 | 282 | } |
@@ -298,15 +298,15 @@ discard block |
||
| 298 | 298 | // If arbiter action was submitted, and user is a valid arbiter, process the action. |
| 299 | 299 | if ($submit_arbitrate and $is_arbiter) { |
| 300 | 300 | |
| 301 | - $username = $xoopsUser ? $xoopsUser->getVar('uname') : '*unknown*'; |
|
| 301 | + $username = $xoopsUser ? $xoopsUser->getVar('uname') : '*unknown*'; |
|
| 302 | 302 | |
| 303 | - switch($arbiter_action) { |
|
| 303 | + switch ($arbiter_action) { |
|
| 304 | 304 | |
| 305 | 305 | case _CHESS_ARBITER_RESUME: |
| 306 | 306 | if ($gamedata['suspended'] and $gamedata['pgn_result'] == '*') { |
| 307 | 307 | $gamedata['suspended'] = ''; |
| 308 | 308 | $gamedata_updated = true; |
| 309 | - $notify = eval('return "' ._MD_CHESS_RESUMED_PLAY. '";'); // eval references $username |
|
| 309 | + $notify = eval('return "'._MD_CHESS_RESUMED_PLAY.'";'); // eval references $username |
|
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | 312 | |
@@ -316,18 +316,18 @@ discard block |
||
| 316 | 316 | $gamedata['pgn_result'] = '1/2-1/2'; |
| 317 | 317 | $arbiter_explain = str_replace('{', '(', $arbiter_explain); |
| 318 | 318 | $arbiter_explain = str_replace('}', ')', $arbiter_explain); |
| 319 | - $comment = '{' . sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain) . '}'; |
|
| 320 | - $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment" , $gamedata['pgn_movetext']); |
|
| 319 | + $comment = '{'.sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain).'}'; |
|
| 320 | + $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']); |
|
| 321 | 321 | $gamedata['suspended'] = ''; |
| 322 | 322 | $gamedata_updated = true; |
| 323 | - $notify = eval('return "' ._MD_CHESS_DECLARED_DRAW. '";'); // eval references $username |
|
| 323 | + $notify = eval('return "'._MD_CHESS_DECLARED_DRAW.'";'); // eval references $username |
|
| 324 | 324 | } |
| 325 | 325 | break; |
| 326 | 326 | |
| 327 | 327 | case _CHESS_ARBITER_DELETE: |
| 328 | 328 | if ($gamedata['suspended']) { |
| 329 | 329 | $delete_game = true; // must defer actual deletion until after notifications are sent |
| 330 | - $notify = eval('return "' ._MD_CHESS_DELETED_GAME. '";'); // eval references $username |
|
| 330 | + $notify = eval('return "'._MD_CHESS_DELETED_GAME.'";'); // eval references $username |
|
| 331 | 331 | } |
| 332 | 332 | break; |
| 333 | 333 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | $gamedata['suspended'] = implode('|', array(date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_ARBITER_SUSPEND, $arbiter_explain)); |
| 342 | 342 | $gamedata_updated = true; |
| 343 | - $notify = eval('return "' ._MD_CHESS_SUSPENDED_PLAY. '";'); // eval references $username |
|
| 343 | + $notify = eval('return "'._MD_CHESS_SUSPENDED_PLAY.'";'); // eval references $username |
|
| 344 | 344 | } |
| 345 | 345 | break; |
| 346 | 346 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | // If a move (or other action) was made, notify any subscribers. |
| 363 | 363 | if (!empty($notify)) { |
| 364 | 364 | |
| 365 | - $notification_handler =& xoops_gethandler('notification'); |
|
| 365 | + $notification_handler = & xoops_gethandler('notification'); |
|
| 366 | 366 | |
| 367 | 367 | $notification_handler->triggerEvent('game', $game_id, 'notify_game_move', array('CHESS_ACTION' => $notify)); |
| 368 | 368 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | if ($movetype == _CHESS_MOVETYPE_WANT_ARBITRATION) { |
| 371 | 371 | |
| 372 | 372 | $event = 'notify_request_arbitration'; |
| 373 | - $username = $xoopsUser ? $xoopsUser->getVar('uname') : '(' ._MD_CHESS_UNKNOWN. ')'; |
|
| 373 | + $username = $xoopsUser ? $xoopsUser->getVar('uname') : '('._MD_CHESS_UNKNOWN.')'; |
|
| 374 | 374 | $extra_tags = array('CHESS_REQUESTOR' => $username, 'CHESS_GAME_ID' => $game_id, 'CHESS_EXPLAIN' => $move_explain); |
| 375 | 375 | $notification_handler->triggerEvent('global', 0, $event, $extra_tags); |
| 376 | 376 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $suspended_q = $myts->addslashes($gamedata['suspended']); |
| 417 | 417 | $movetext_q = $myts->addslashes($gamedata['pgn_movetext']); |
| 418 | 418 | |
| 419 | - $table = $xoopsDB->prefix('chess_games'); |
|
| 419 | + $table = $xoopsDB->prefix('chess_games'); |
|
| 420 | 420 | #echo "updating database table $table<br />\n";#*#DEBUG# |
| 421 | 421 | $xoopsDB->query(trim(" |
| 422 | 422 | UPDATE $table |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | WHERE game_id = '$game_id' |
| 439 | 439 | ")); |
| 440 | 440 | if ($xoopsDB->errno()) { |
| 441 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 441 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | if ($gamedata['pgn_result'] != '*' and $gamedata['is_rated'] == '1') { |
| 445 | - require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.inc.php'; |
|
| 445 | + require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.inc.php'; |
|
| 446 | 446 | chess_ratings_adj($game_id); |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $table = $xoopsDB->prefix('chess_games'); |
| 463 | 463 | $xoopsDB->query("DELETE FROM $table WHERE game_id='$game_id'"); |
| 464 | 464 | if ($xoopsDB->errno()) { |
| 465 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 465 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | #var_dump('gamedata', $gamedata);#*#DEBUG# |
| 569 | 569 | |
| 570 | 570 | // Define this constant as true to output a log file containing a move analysis. |
| 571 | - define ('CHESS_LOG_3FOLD', false); |
|
| 571 | + define('CHESS_LOG_3FOLD', false); |
|
| 572 | 572 | if (CHESS_LOG_3FOLD) { |
| 573 | 573 | $log = array(); |
| 574 | 574 | } |
@@ -605,13 +605,13 @@ discard block |
||
| 605 | 605 | // $repeats is the list of moves for which the board positions are identical. |
| 606 | 606 | // For example, '6w' would represent the board position immediately before white's sixth move. |
| 607 | 607 | // The current position is included, since that's the position against which the other positions will be compared. |
| 608 | - $repeats[] = $gamedata['fen_fullmove_number'] . $gamedata['fen_active_color']; |
|
| 608 | + $repeats[] = $gamedata['fen_fullmove_number'].$gamedata['fen_active_color']; |
|
| 609 | 609 | |
| 610 | 610 | // Compare initial board position with last board position, unless the move number is the same, meaning that there haven't been any moves. |
| 611 | 611 | #echo "FEN: '{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']} {$tmp_gamedata['fen_halfmove_clock']} {$tmp_gamedata['fen_fullmove_number']}'<br />\n";#*#DEBUG# |
| 612 | 612 | $board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}"; |
| 613 | 613 | if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number and $board_state == $last_board_state) { |
| 614 | - $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color']; |
|
| 614 | + $repeats[] = $tmp_gamedata['fen_fullmove_number'].$tmp_gamedata['fen_active_color']; |
|
| 615 | 615 | if (CHESS_LOG_3FOLD) { |
| 616 | 616 | $log[] = sprintf("%08x %03d%1s %s", crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state); |
| 617 | 617 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | #var_dump('movelist', $movelist);#*#DEBUG# |
| 632 | 632 | |
| 633 | 633 | // Compare board positions after each move with last board position. |
| 634 | - foreach($movelist as $fullmove) { |
|
| 634 | + foreach ($movelist as $fullmove) { |
|
| 635 | 635 | |
| 636 | 636 | #echo "'{$fullmove[0]}' '{$fullmove[1]}' '{$fullmove[2]}'<br />\n";#*#DEBUG# |
| 637 | 637 | if (CHESS_LOG_3FOLD) { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | $log[] = sprintf("%08x %03d%1s %s", crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state); |
| 662 | 662 | } |
| 663 | 663 | if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number and $board_state == $last_board_state) { |
| 664 | - $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color']; |
|
| 664 | + $repeats[] = $tmp_gamedata['fen_fullmove_number'].$tmp_gamedata['fen_active_color']; |
|
| 665 | 665 | #*#DEBUG# - start |
| 666 | 666 | /*** |
| 667 | 667 | if (count($repeats) >= 3) { |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | if (CHESS_LOG_3FOLD) { |
| 703 | - $logfile = XOOPS_ROOT_PATH . '/cache/' . date('Ymd_His') . '_3fold.log'; |
|
| 703 | + $logfile = XOOPS_ROOT_PATH.'/cache/'.date('Ymd_His').'_3fold.log'; |
|
| 704 | 704 | sort($log); |
| 705 | 705 | error_log(implode("\n", $log), 3, $logfile); |
| 706 | 706 | } |
@@ -753,14 +753,14 @@ discard block |
||
| 753 | 753 | global $xoopsTpl; |
| 754 | 754 | |
| 755 | 755 | $xoopsTpl->assign('xoops_module_header', ' |
| 756 | - <link rel="stylesheet" type="text/css" media="screen" href="' .XOOPS_URL. '/modules/chess/include/style.css" /> |
|
| 756 | + <link rel="stylesheet" type="text/css" media="screen" href="' .XOOPS_URL.'/modules/chess/include/style.css" /> |
|
| 757 | 757 | '); |
| 758 | 758 | |
| 759 | - $member_handler =& xoops_gethandler('member'); |
|
| 760 | - $white_user =& $member_handler->getUser($gamedata['white_uid']); |
|
| 761 | - $white_username = is_object($white_user) ? $white_user->getVar('uname') : '?'; |
|
| 762 | - $black_user =& $member_handler->getUser($gamedata['black_uid']); |
|
| 763 | - $black_username = is_object($black_user) ? $black_user->getVar('uname') : '?'; |
|
| 759 | + $member_handler = & xoops_gethandler('member'); |
|
| 760 | + $white_user = & $member_handler->getUser($gamedata['white_uid']); |
|
| 761 | + $white_username = is_object($white_user) ? $white_user->getVar('uname') : '?'; |
|
| 762 | + $black_user = & $member_handler->getUser($gamedata['black_uid']); |
|
| 763 | + $black_username = is_object($black_user) ? $black_user->getVar('uname') : '?'; |
|
| 764 | 764 | |
| 765 | 765 | // Determine whether board is flipped (black at bottom) or "normal" (white at bottom). |
| 766 | 766 | switch ($orientation) { |
@@ -815,11 +815,11 @@ discard block |
||
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | $xoopsTpl->assign('chess_create_date', $gamedata['create_date'] != '0000-00-00 00:00:00' ? strtotime($gamedata['create_date']) : 0); |
| 818 | - $xoopsTpl->assign('chess_start_date', $gamedata['start_date'] != '0000-00-00 00:00:00' ? strtotime($gamedata['start_date']) : 0); |
|
| 819 | - $xoopsTpl->assign('chess_last_date', $gamedata['last_date'] != '0000-00-00 00:00:00' ? strtotime($gamedata['last_date']) : 0); |
|
| 820 | - $xoopsTpl->assign('chess_white_user', $white_username); |
|
| 821 | - $xoopsTpl->assign('chess_black_user', $black_username); |
|
| 822 | - $xoopsTpl->assign('chess_tiles', $tiles); |
|
| 818 | + $xoopsTpl->assign('chess_start_date', $gamedata['start_date'] != '0000-00-00 00:00:00' ? strtotime($gamedata['start_date']) : 0); |
|
| 819 | + $xoopsTpl->assign('chess_last_date', $gamedata['last_date'] != '0000-00-00 00:00:00' ? strtotime($gamedata['last_date']) : 0); |
|
| 820 | + $xoopsTpl->assign('chess_white_user', $white_username); |
|
| 821 | + $xoopsTpl->assign('chess_black_user', $black_username); |
|
| 822 | + $xoopsTpl->assign('chess_tiles', $tiles); |
|
| 823 | 823 | $xoopsTpl->assign('chess_file_labels', $file_labels); |
| 824 | 824 | |
| 825 | 825 | $xoopsTpl->assign('chess_pgn_string', |
@@ -839,40 +839,40 @@ discard block |
||
| 839 | 839 | ) |
| 840 | 840 | ); |
| 841 | 841 | |
| 842 | - $xoopsTpl->assign('chess_movelist', $movelist); |
|
| 842 | + $xoopsTpl->assign('chess_movelist', $movelist); |
|
| 843 | 843 | $xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING); |
| 844 | 844 | |
| 845 | 845 | #if (empty($move_result_text)) {$move_result_text = 'test';}#*#DEBUG# |
| 846 | 846 | $xoopsTpl->assign('chess_move_performed', $move_performed); |
| 847 | - $xoopsTpl->assign('chess_move_result', $move_result_text); |
|
| 847 | + $xoopsTpl->assign('chess_move_result', $move_result_text); |
|
| 848 | 848 | |
| 849 | 849 | $xoopsTpl->assign('chess_draw_claim_error_text', $draw_claim_error_text); |
| 850 | 850 | |
| 851 | 851 | $xoopsTpl->assign('chess_user_color', $user_color); |
| 852 | 852 | |
| 853 | - $xoopsTpl->assign('chess_confirm', $gamedata[$user_color == 'w' ? 'white_confirm' : 'black_confirm']); |
|
| 853 | + $xoopsTpl->assign('chess_confirm', $gamedata[$user_color == 'w' ? 'white_confirm' : 'black_confirm']); |
|
| 854 | 854 | $xoopsTpl->assign('chess_orientation', $orientation); |
| 855 | 855 | |
| 856 | - $xoopsTpl->assign('chess_rank_start', $flip ? 1 : 8); |
|
| 857 | - $xoopsTpl->assign('chess_rank_direction', $flip ? 'up' : 'down'); |
|
| 856 | + $xoopsTpl->assign('chess_rank_start', $flip ? 1 : 8); |
|
| 857 | + $xoopsTpl->assign('chess_rank_direction', $flip ? 'up' : 'down'); |
|
| 858 | 858 | |
| 859 | - $xoopsTpl->assign('chess_file_start', $flip ? 8 : 1); |
|
| 859 | + $xoopsTpl->assign('chess_file_start', $flip ? 8 : 1); |
|
| 860 | 860 | $xoopsTpl->assign('chess_file_direction', $flip ? 'down' : 'up'); |
| 861 | 861 | |
| 862 | 862 | static $pieces = array( |
| 863 | - 'K' => array('color' => 'w', 'name' => 'wking', 'alt' => _MD_CHESS_ALT_WKING), |
|
| 864 | - 'Q' => array('color' => 'w', 'name' => 'wqueen', 'alt' => _MD_CHESS_ALT_WQUEEN), |
|
| 865 | - 'R' => array('color' => 'w', 'name' => 'wrook', 'alt' => _MD_CHESS_ALT_WROOK), |
|
| 863 | + 'K' => array('color' => 'w', 'name' => 'wking', 'alt' => _MD_CHESS_ALT_WKING), |
|
| 864 | + 'Q' => array('color' => 'w', 'name' => 'wqueen', 'alt' => _MD_CHESS_ALT_WQUEEN), |
|
| 865 | + 'R' => array('color' => 'w', 'name' => 'wrook', 'alt' => _MD_CHESS_ALT_WROOK), |
|
| 866 | 866 | 'B' => array('color' => 'w', 'name' => 'wbishop', 'alt' => _MD_CHESS_ALT_WBISHOP), |
| 867 | 867 | 'N' => array('color' => 'w', 'name' => 'wknight', 'alt' => _MD_CHESS_ALT_WKNIGHT), |
| 868 | - 'P' => array('color' => 'w', 'name' => 'wpawn', 'alt' => _MD_CHESS_ALT_WPAWN), |
|
| 869 | - 'k' => array('color' => 'b', 'name' => 'bking', 'alt' => _MD_CHESS_ALT_BKING), |
|
| 870 | - 'q' => array('color' => 'b', 'name' => 'bqueen', 'alt' => _MD_CHESS_ALT_BQUEEN), |
|
| 871 | - 'r' => array('color' => 'b', 'name' => 'brook', 'alt' => _MD_CHESS_ALT_BROOK), |
|
| 868 | + 'P' => array('color' => 'w', 'name' => 'wpawn', 'alt' => _MD_CHESS_ALT_WPAWN), |
|
| 869 | + 'k' => array('color' => 'b', 'name' => 'bking', 'alt' => _MD_CHESS_ALT_BKING), |
|
| 870 | + 'q' => array('color' => 'b', 'name' => 'bqueen', 'alt' => _MD_CHESS_ALT_BQUEEN), |
|
| 871 | + 'r' => array('color' => 'b', 'name' => 'brook', 'alt' => _MD_CHESS_ALT_BROOK), |
|
| 872 | 872 | 'b' => array('color' => 'b', 'name' => 'bbishop', 'alt' => _MD_CHESS_ALT_BBISHOP), |
| 873 | 873 | 'n' => array('color' => 'b', 'name' => 'bknight', 'alt' => _MD_CHESS_ALT_BKNIGHT), |
| 874 | - 'p' => array('color' => 'b', 'name' => 'bpawn', 'alt' => _MD_CHESS_ALT_BPAWN), |
|
| 875 | - 'x' => array('color' => 'x', 'name' => 'empty', 'alt' => _MD_CHESS_ALT_EMPTY), |
|
| 874 | + 'p' => array('color' => 'b', 'name' => 'bpawn', 'alt' => _MD_CHESS_ALT_BPAWN), |
|
| 875 | + 'x' => array('color' => 'x', 'name' => 'empty', 'alt' => _MD_CHESS_ALT_EMPTY), |
|
| 876 | 876 | ); |
| 877 | 877 | $xoopsTpl->assign('chess_pieces', $pieces); |
| 878 | 878 | |
@@ -891,8 +891,8 @@ discard block |
||
| 891 | 891 | $susp_type_display = _MD_CHESS_LABEL_ERROR; |
| 892 | 892 | break; |
| 893 | 893 | } |
| 894 | - $susp_user =& $member_handler->getUser($susp_uid); |
|
| 895 | - $susp_username = is_object($susp_user) ? $susp_user->getVar('uname') : _MD_CHESS_UNKNOWN; |
|
| 894 | + $susp_user = & $member_handler->getUser($susp_uid); |
|
| 895 | + $susp_username = is_object($susp_user) ? $susp_user->getVar('uname') : _MD_CHESS_UNKNOWN; |
|
| 896 | 896 | $suspend_info = array( |
| 897 | 897 | 'date' => strtotime($susp_date), |
| 898 | 898 | 'user' => $susp_username, |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | #var_dump('captured_pieces', $captured_pieces);#*#DEBUG# |
| 930 | 930 | $xoopsTpl->assign('chess_captured_pieces', $captured_pieces); |
| 931 | 931 | |
| 932 | - $xoopsTpl->assign('chess_pawn_promote_choices', $gamedata['fen_active_color'] == 'w' ? array('Q','R','B','N') : array('q','r','b','n')); |
|
| 932 | + $xoopsTpl->assign('chess_pawn_promote_choices', $gamedata['fen_active_color'] == 'w' ? array('Q', 'R', 'B', 'N') : array('q', 'r', 'b', 'n')); |
|
| 933 | 933 | |
| 934 | 934 | $xoopsTpl->assign('chess_allow_delete', chess_can_delete()); |
| 935 | 935 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | define('DBUSER', 'root'); |
| 19 | 19 | define('DBPASS', ''); |
| 20 | 20 | |
| 21 | -define('NUM_USERS', 3); |
|
| 21 | +define('NUM_USERS', 3); |
|
| 22 | 22 | define('NUM_CHALLENGES', 1000); |
| 23 | -define('NUM_GAMES', 10000); |
|
| 24 | -define('NUM_RATINGS', NUM_USERS / 2); |
|
| 23 | +define('NUM_GAMES', 10000); |
|
| 24 | +define('NUM_RATINGS', NUM_USERS / 2); |
|
| 25 | 25 | /**#@-*/ |
| 26 | 26 | |
| 27 | 27 | perform(); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | $games_table = 'chess_games'; |
| 36 | 36 | $ratings_table = 'chess_ratings'; |
| 37 | 37 | |
| 38 | - @mysql_connect(DBHOST, DBUSER, DBPASS) or trigger_error('[' .mysql_errno(). '] ' .mysql_error(), E_USER_ERROR); |
|
| 39 | - mysql_select_db(DBNAME) or trigger_error('[' .mysql_errno(). '] ' .mysql_error(), E_USER_ERROR); |
|
| 38 | + @mysql_connect(DBHOST, DBUSER, DBPASS) or trigger_error('['.mysql_errno().'] '.mysql_error(), E_USER_ERROR); |
|
| 39 | + mysql_select_db(DBNAME) or trigger_error('['.mysql_errno().'] '.mysql_error(), E_USER_ERROR); |
|
| 40 | 40 | |
| 41 | 41 | // For safety, don't generate test data unless the tables are empty. |
| 42 | 42 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * ------------------------------------------------------------- |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -function smarty_modifier_xoops_format_date($timestamp, $format, $nojavascript=null) |
|
| 34 | +function smarty_modifier_xoops_format_date($timestamp, $format, $nojavascript = null) |
|
| 35 | 35 | { |
| 36 | 36 | static $javascript_include_generated = false; |
| 37 | 37 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | if ($use_javascript) { |
| 65 | 65 | if (!$javascript_include_generated) { |
| 66 | - $file = XOOPS_URL . '/include/phpdate.js'; |
|
| 66 | + $file = XOOPS_URL.'/include/phpdate.js'; |
|
| 67 | 67 | $rtn .= "<script type='text/javascript' src='$file'></script>"; |
| 68 | 68 | $javascript_include_generated = true; |
| 69 | 69 | } |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | if ($use_javascript) { |
| 73 | 73 | |
| 74 | 74 | // backslashes have to be encoded (replaced with ASCII code) for Javascript |
| 75 | - $format_encoded = str_replace('\\', '\\x' . dechex(ord('\\')), $format); |
|
| 75 | + $format_encoded = str_replace('\\', '\\x'.dechex(ord('\\')), $format); |
|
| 76 | 76 | |
| 77 | 77 | // ampersands have to be encoded for XHTML compliancy |
| 78 | - $format_encoded = str_replace('&', '\x' . dechex(ord('&')), $format_encoded); |
|
| 78 | + $format_encoded = str_replace('&', '\x'.dechex(ord('&')), $format_encoded); |
|
| 79 | 79 | |
| 80 | 80 | // Javascript-formatted date |
| 81 | 81 | #$jdate = "'J' + phpDate('$format_encoded', $timestamp)"; #*#DEBUG# - 'J' only for debugging purposes |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | // Display my-games menu item if current user is logged in. |
| 150 | 150 | if (is_object($xoopsUser)) { |
| 151 | 151 | $modversion['sub'][5]['name'] = _MI_CHESS_SMNAME5; |
| 152 | - $modversion['sub'][5]['url'] = 'player_stats.php?player_uid=' . $xoopsUser->getVar('uid'); |
|
| 152 | + $modversion['sub'][5]['url'] = 'player_stats.php?player_uid='.$xoopsUser->getVar('uid'); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
@@ -166,24 +166,24 @@ discard block |
||
| 166 | 166 | $modversion['pages'][5]['url'] = "player_stats.php"; |
| 167 | 167 | |
| 168 | 168 | // Templates |
| 169 | -$modversion['templates'][ 1]['file'] = 'chess_games.html'; |
|
| 170 | -$modversion['templates'][ 1]['description'] = _MI_CHESS_INDEX; |
|
| 171 | -$modversion['templates'][ 2]['file'] = 'chess_game_main.html'; |
|
| 172 | -$modversion['templates'][ 2]['description'] = _MI_CHESS_GAME; |
|
| 173 | -$modversion['templates'][ 3]['file'] = 'chess_game_moveform.html'; |
|
| 174 | -$modversion['templates'][ 3]['description'] = _MI_CHESS_MOVE_FORM; |
|
| 175 | -$modversion['templates'][ 4]['file'] = 'chess_game_promote_popup.html'; |
|
| 176 | -$modversion['templates'][ 4]['description'] = _MI_CHESS_PROMOTE_POPUP; |
|
| 177 | -$modversion['templates'][ 5]['file'] = 'chess_game_board.html'; |
|
| 178 | -$modversion['templates'][ 5]['description'] = _MI_CHESS_BOARD; |
|
| 179 | -$modversion['templates'][ 6]['file'] = 'chess_game_prefsform.html'; |
|
| 180 | -$modversion['templates'][ 6]['description'] = _MI_CHESS_PREFS_FORM; |
|
| 181 | -$modversion['templates'][ 7]['file'] = 'chess_game_arbitrateform.html'; |
|
| 182 | -$modversion['templates'][ 7]['description'] = _MI_CHESS_ARBITER_FORM; |
|
| 183 | -$modversion['templates'][ 8]['file'] = 'chess_help.html'; |
|
| 184 | -$modversion['templates'][ 8]['description'] = _MI_CHESS_HELP; |
|
| 185 | -$modversion['templates'][ 9]['file'] = 'chess_ratings.html'; |
|
| 186 | -$modversion['templates'][ 9]['description'] = _MI_CHESS_RATINGS; |
|
| 169 | +$modversion['templates'][1]['file'] = 'chess_games.html'; |
|
| 170 | +$modversion['templates'][1]['description'] = _MI_CHESS_INDEX; |
|
| 171 | +$modversion['templates'][2]['file'] = 'chess_game_main.html'; |
|
| 172 | +$modversion['templates'][2]['description'] = _MI_CHESS_GAME; |
|
| 173 | +$modversion['templates'][3]['file'] = 'chess_game_moveform.html'; |
|
| 174 | +$modversion['templates'][3]['description'] = _MI_CHESS_MOVE_FORM; |
|
| 175 | +$modversion['templates'][4]['file'] = 'chess_game_promote_popup.html'; |
|
| 176 | +$modversion['templates'][4]['description'] = _MI_CHESS_PROMOTE_POPUP; |
|
| 177 | +$modversion['templates'][5]['file'] = 'chess_game_board.html'; |
|
| 178 | +$modversion['templates'][5]['description'] = _MI_CHESS_BOARD; |
|
| 179 | +$modversion['templates'][6]['file'] = 'chess_game_prefsform.html'; |
|
| 180 | +$modversion['templates'][6]['description'] = _MI_CHESS_PREFS_FORM; |
|
| 181 | +$modversion['templates'][7]['file'] = 'chess_game_arbitrateform.html'; |
|
| 182 | +$modversion['templates'][7]['description'] = _MI_CHESS_ARBITER_FORM; |
|
| 183 | +$modversion['templates'][8]['file'] = 'chess_help.html'; |
|
| 184 | +$modversion['templates'][8]['description'] = _MI_CHESS_HELP; |
|
| 185 | +$modversion['templates'][9]['file'] = 'chess_ratings.html'; |
|
| 186 | +$modversion['templates'][9]['description'] = _MI_CHESS_RATINGS; |
|
| 187 | 187 | $modversion['templates'][10]['file'] = 'chess_player_stats.html'; |
| 188 | 188 | $modversion['templates'][10]['description'] = _MI_CHESS_PLAYER_STATS; |
| 189 | 189 | |
@@ -38,16 +38,16 @@ discard block |
||
| 38 | 38 | include '../../mainfile.php'; |
| 39 | 39 | $xoopsOption['template_main'] = 'chess_help.html'; |
| 40 | 40 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching |
| 41 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 42 | -require_once XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->getVar('dirname').'/include/functions.inc.php'; |
|
| 43 | -if (file_exists(XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php')) { |
|
| 44 | - include_once XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php'; |
|
| 41 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 42 | +require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/functions.inc.php'; |
|
| 43 | +if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php')) { |
|
| 44 | + include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php'; |
|
| 45 | 45 | } else { |
| 46 | - include_once XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->getVar('dirname').'/language/english/help.php'; |
|
| 46 | + include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/help.php'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $rating_system = chess_moduleConfig('rating_system'); |
| 50 | -$rating_system_des_name = '_HE_CHESS_RATINGS_' . strtoupper($rating_system); |
|
| 50 | +$rating_system_des_name = '_HE_CHESS_RATINGS_'.strtoupper($rating_system); |
|
| 51 | 51 | if (defined($rating_system_des_name)) { |
| 52 | 52 | $rating_system_des = constant($rating_system_des_name); |
| 53 | 53 | } else { |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | $rating_system_des = $rating_system_des_name; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -$xoopsTpl->assign('chess_allow_setup', chess_moduleConfig('allow_setup')); |
|
| 59 | -$xoopsTpl->assign('chess_rating_system', $rating_system); |
|
| 60 | -$xoopsTpl->assign('chess_rating_system_des', $rating_system_des); |
|
| 58 | +$xoopsTpl->assign('chess_allow_setup', chess_moduleConfig('allow_setup')); |
|
| 59 | +$xoopsTpl->assign('chess_rating_system', $rating_system); |
|
| 60 | +$xoopsTpl->assign('chess_rating_system_des', $rating_system_des); |
|
| 61 | 61 | $xoopsTpl->assign('chess_allow_unrated_games', chess_moduleConfig('allow_unrated_games')); |
| 62 | -$xoopsTpl->assign('chess_allow_delete', chess_can_delete()); |
|
| 63 | -$xoopsTpl->assign('chess_is_admin', is_object($xoopsUser) and $xoopsUser->isAdmin($xoopsModule->getVar('mid'))); |
|
| 62 | +$xoopsTpl->assign('chess_allow_delete', chess_can_delete()); |
|
| 63 | +$xoopsTpl->assign('chess_is_admin', is_object($xoopsUser) and $xoopsUser->isAdmin($xoopsModule->getVar('mid'))); |
|
| 64 | 64 | |
| 65 | -include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 65 | +include_once XOOPS_ROOT_PATH.'/footer.php'; |
|
| 66 | 66 | |
| 67 | 67 | /**#@-*/ |
| 68 | 68 | |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | require_once '../../mainfile.php'; |
| 46 | 46 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching |
| 47 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 48 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 49 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php'; |
|
| 50 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.inc.php'; |
|
| 47 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 48 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 49 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php'; |
|
| 50 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.inc.php'; |
|
| 51 | 51 | |
| 52 | 52 | #var_dump($_REQUEST);#*#DEBUG# |
| 53 | 53 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // If form-submit, check security token. |
| 81 | 81 | if (($submit_challenge1 or $submit_challenge2 or $submit_challenge3 or $submit_accept or $submit_delete or $show_arbiter_ctrl) and is_object($GLOBALS['xoopsSecurity']) and !$GLOBALS['xoopsSecurity']->check()) { |
| 82 | - redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 83 | - _MD_CHESS_TOKEN_ERROR . '<br />' . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 82 | + redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 83 | + _MD_CHESS_TOKEN_ERROR.'<br />'.implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // If rating feature disabled, force ratings to off. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | $fen_error = chess_fen_error($fen); |
| 119 | 119 | if (!empty($fen_error)) { |
| 120 | - chess_show_create_form1($gametype, $fen, _MD_CHESS_FEN_INVALID . ': ' . $fen_error); |
|
| 120 | + chess_show_create_form1($gametype, $fen, _MD_CHESS_FEN_INVALID.': '.$fen_error); |
|
| 121 | 121 | } elseif ($gametype == _CHESS_GAMETYPE_OPEN or $gametype == _CHESS_GAMETYPE_USER) { |
| 122 | 122 | chess_show_create_form2($gametype, $fen); |
| 123 | 123 | } else { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | } elseif ($gametype == _CHESS_GAMETYPE_SELF) { |
| 160 | 160 | $game_id = chess_create_game($uid, $uid, $fen, $rated); |
| 161 | - redirect_header(XOOPS_URL . "/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED); |
|
| 161 | + redirect_header(XOOPS_URL."/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED); |
|
| 162 | 162 | } else { |
| 163 | 163 | chess_show_create_form1($gametype, $fen, _MD_CHESS_GAMETYPE_INVALID); |
| 164 | 164 | } |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | $form = new XoopsThemeForm(_MD_CHESS_CREATE_FORM, 'create_form1', 'create.php', 'post', true); |
| 209 | 209 | |
| 210 | 210 | if ($error_msg) { |
| 211 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ': ', '<div class="errorMsg">' . $error_msg . '</div>')); |
|
| 211 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.': ', '<div class="errorMsg">'.$error_msg.'</div>')); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $menu_gametype = new XoopsFormSelect(_MD_CHESS_LABEL_GAMETYPE . ':', 'gametype', $gametype, 1, false); |
|
| 214 | + $menu_gametype = new XoopsFormSelect(_MD_CHESS_LABEL_GAMETYPE.':', 'gametype', $gametype, 1, false); |
|
| 215 | 215 | $menu_gametype->addOption(_CHESS_GAMETYPE_OPEN, _MD_CHESS_MENU_GAMETYPE_OPEN); |
| 216 | 216 | $menu_gametype->addOption(_CHESS_GAMETYPE_USER, _MD_CHESS_MENU_GAMETYPE_USER); |
| 217 | 217 | $menu_gametype->addOption(_CHESS_GAMETYPE_SELF, _MD_CHESS_MENU_GAMETYPE_SELF); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if (chess_moduleConfig('allow_setup')) { |
| 221 | 221 | $form->addElement(new XoopsFormLabel('', ' ')); |
| 222 | 222 | $form->addElement(new XoopsFormLabel('', _MD_CHESS_LABEL_FEN_EXPLAIN)); |
| 223 | - $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_FEN_SETUP . ':', 'fen', 80, _CHESS_TEXTBOX_FEN_MAXLEN, $fen)); |
|
| 223 | + $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_FEN_SETUP.':', 'fen', 80, _CHESS_TEXTBOX_FEN_MAXLEN, $fen)); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $form->addElement(new XoopsFormLabel(' ', ' ')); |
@@ -248,32 +248,32 @@ discard block |
||
| 248 | 248 | $form = new XoopsThemeForm(_MD_CHESS_CREATE_FORM, 'create_form2', 'create.php', 'post', true); |
| 249 | 249 | |
| 250 | 250 | $form->addElement(new XoopsFormHidden('gametype', $gametype)); |
| 251 | - $form->addElement(new XoopsFormHidden('fen', $fen)); |
|
| 251 | + $form->addElement(new XoopsFormHidden('fen', $fen)); |
|
| 252 | 252 | |
| 253 | 253 | if ($error_msg) { |
| 254 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ':', '<div class="errorMsg">' . $error_msg . '</div>')); |
|
| 254 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.':', '<div class="errorMsg">'.$error_msg.'</div>')); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $member_handler =& xoops_gethandler('member'); |
|
| 258 | - $opponent_user =& $member_handler->getUser($opponent_uid); |
|
| 259 | - $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 257 | + $member_handler = & xoops_gethandler('member'); |
|
| 258 | + $opponent_user = & $member_handler->getUser($opponent_uid); |
|
| 259 | + $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 260 | 260 | |
| 261 | 261 | if ($gametype == _CHESS_GAMETYPE_USER) { |
| 262 | - $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_OPPONENT . ':', 'opponent', _CHESS_TEXTBOX_OPPONENT_SIZE, |
|
| 262 | + $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_OPPONENT.':', 'opponent', _CHESS_TEXTBOX_OPPONENT_SIZE, |
|
| 263 | 263 | _CHESS_TEXTBOX_OPPONENT_MAXLEN, $opponent_username)); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR . ':', 'coloroption', $coloroption); |
|
| 266 | + $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR.':', 'coloroption', $coloroption); |
|
| 267 | 267 | $radio_color->addOption(_CHESS_COLOROPTION_OPPONENT, _MD_CHESS_RADIO_COLOR_OPPONENT); |
| 268 | - $radio_color->addOption(_CHESS_COLOROPTION_RANDOM, _MD_CHESS_RADIO_COLOR_RANDOM); |
|
| 269 | - $radio_color->addOption(_CHESS_COLOROPTION_WHITE, _MD_CHESS_RADIO_COLOR_WHITE); |
|
| 270 | - $radio_color->addOption(_CHESS_COLOROPTION_BLACK, _MD_CHESS_RADIO_COLOR_BLACK); |
|
| 268 | + $radio_color->addOption(_CHESS_COLOROPTION_RANDOM, _MD_CHESS_RADIO_COLOR_RANDOM); |
|
| 269 | + $radio_color->addOption(_CHESS_COLOROPTION_WHITE, _MD_CHESS_RADIO_COLOR_WHITE); |
|
| 270 | + $radio_color->addOption(_CHESS_COLOROPTION_BLACK, _MD_CHESS_RADIO_COLOR_BLACK); |
|
| 271 | 271 | $form->addElement($radio_color); |
| 272 | 272 | |
| 273 | 273 | if (chess_moduleConfig('rating_system') !== 'none') { |
| 274 | 274 | if ($gametype == _CHESS_GAMETYPE_OPEN or $gametype == _CHESS_GAMETYPE_USER) { |
| 275 | 275 | if (chess_moduleConfig('allow_unrated_games')) { |
| 276 | - $radio_rated = new XoopsFormRadio(_MD_CHESS_RATED_GAME . ':', 'rated', $rated); |
|
| 276 | + $radio_rated = new XoopsFormRadio(_MD_CHESS_RATED_GAME.':', 'rated', $rated); |
|
| 277 | 277 | $radio_rated->addOption(1, _YES); |
| 278 | 278 | $radio_rated->addOption(0, _NO); |
| 279 | 279 | $form->addElement($radio_rated); |
@@ -304,21 +304,21 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | function chess_show_create_form3($gametype, $fen, $coloroption, $opponent_uid, $rated) |
| 306 | 306 | { |
| 307 | - $member_handler =& xoops_gethandler('member'); |
|
| 308 | - $opponent_user =& $member_handler->getUser($opponent_uid); |
|
| 309 | - $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 307 | + $member_handler = & xoops_gethandler('member'); |
|
| 308 | + $opponent_user = & $member_handler->getUser($opponent_uid); |
|
| 309 | + $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 310 | 310 | |
| 311 | 311 | $form = new XoopsThemeForm(_MD_CHESS_CREATE_FORM, 'create_form3', 'create.php', 'post', true); |
| 312 | 312 | |
| 313 | - $form->addElement(new XoopsFormHidden('gametype', $gametype)); |
|
| 314 | - $form->addElement(new XoopsFormHidden('fen', $fen)); |
|
| 315 | - $form->addElement(new XoopsFormHidden('opponent', $opponent_username)); |
|
| 313 | + $form->addElement(new XoopsFormHidden('gametype', $gametype)); |
|
| 314 | + $form->addElement(new XoopsFormHidden('fen', $fen)); |
|
| 315 | + $form->addElement(new XoopsFormHidden('opponent', $opponent_username)); |
|
| 316 | 316 | $form->addElement(new XoopsFormHidden('coloroption', $coloroption)); |
| 317 | - $form->addElement(new XoopsFormHidden('rated', $rated)); |
|
| 317 | + $form->addElement(new XoopsFormHidden('rated', $rated)); |
|
| 318 | 318 | |
| 319 | - $form->addElement(new XoopsFormLabel('', '<div class="confirmMsg">' . _MD_CHESS_GAME_CONFIRM . '</div>')); |
|
| 319 | + $form->addElement(new XoopsFormLabel('', '<div class="confirmMsg">'._MD_CHESS_GAME_CONFIRM.'</div>')); |
|
| 320 | 320 | |
| 321 | - switch($gametype) { |
|
| 321 | + switch ($gametype) { |
|
| 322 | 322 | case _CHESS_GAMETYPE_OPEN: |
| 323 | 323 | $label_gametype = _MD_CHESS_LABEL_GAMETYPE_OPEN; |
| 324 | 324 | break; |
@@ -332,24 +332,24 @@ discard block |
||
| 332 | 332 | $label_gametype = _MD_CHESS_LABEL_ERROR; |
| 333 | 333 | break; |
| 334 | 334 | } |
| 335 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype)); |
|
| 335 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype)); |
|
| 336 | 336 | |
| 337 | 337 | if (!empty($fen)) { |
| 338 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $fen)); |
|
| 338 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $fen)); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | if ($gametype == _CHESS_GAMETYPE_USER) { |
| 342 | 342 | |
| 343 | - $member_handler =& xoops_gethandler('member'); |
|
| 344 | - $opponent_user =& $member_handler->getUser($opponent_uid); |
|
| 345 | - $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 343 | + $member_handler = & xoops_gethandler('member'); |
|
| 344 | + $opponent_user = & $member_handler->getUser($opponent_uid); |
|
| 345 | + $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : ''; |
|
| 346 | 346 | |
| 347 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT . ':', $opponent_username)); |
|
| 347 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT.':', $opponent_username)); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | if ($gametype == _CHESS_GAMETYPE_OPEN or $gametype == _CHESS_GAMETYPE_USER) { |
| 351 | 351 | |
| 352 | - switch($coloroption) { |
|
| 352 | + switch ($coloroption) { |
|
| 353 | 353 | case _CHESS_COLOROPTION_OPPONENT: |
| 354 | 354 | $label_coloroption = _MD_CHESS_RADIO_COLOR_OPPONENT; |
| 355 | 355 | break; |
@@ -366,17 +366,17 @@ discard block |
||
| 366 | 366 | $label_coloroption = _MD_CHESS_LABEL_ERROR; |
| 367 | 367 | break; |
| 368 | 368 | } |
| 369 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption)); |
|
| 369 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption)); |
|
| 370 | 370 | |
| 371 | 371 | if (chess_moduleConfig('rating_system') != 'none') { |
| 372 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $rated ? _YES : _NO)); |
|
| 372 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $rated ? _YES : _NO)); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // Determine whether current user is subscribed to receive a notification when his challenge is accepted. |
| 376 | 376 | global $xoopsModule, $xoopsUser; |
| 377 | 377 | $uid = $xoopsUser->getVar('uid'); |
| 378 | 378 | $mid = $xoopsModule->getVar('mid'); |
| 379 | - $notification_handler =& xoops_gethandler('notification'); |
|
| 379 | + $notification_handler = & xoops_gethandler('notification'); |
|
| 380 | 380 | $is_subscribed = $notification_handler->isSubscribed('global', 0, 'notify_accept_challenge', $mid, $uid) != 0; |
| 381 | 381 | |
| 382 | 382 | // Display checkbox with checked-state reflecting subscription status. |
@@ -427,20 +427,20 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $form = new XoopsThemeForm(_MD_CHESS_ACCEPT_FORM, 'accept_form', 'create.php', 'post', true); |
| 429 | 429 | |
| 430 | - $form->addElement(new XoopsFormHidden('challenge_id', $challenge_id)); |
|
| 430 | + $form->addElement(new XoopsFormHidden('challenge_id', $challenge_id)); |
|
| 431 | 431 | |
| 432 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED . ':', formatTimestamp($row['create_date'], "m"))); |
|
| 432 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED.':', formatTimestamp($row['create_date'], "m"))); |
|
| 433 | 433 | |
| 434 | - $member_handler =& xoops_gethandler('member'); |
|
| 434 | + $member_handler = & xoops_gethandler('member'); |
|
| 435 | 435 | |
| 436 | - switch($row['game_type']) { |
|
| 436 | + switch ($row['game_type']) { |
|
| 437 | 437 | case _CHESS_GAMETYPE_OPEN: |
| 438 | 438 | $label_gametype = _MD_CHESS_LABEL_GAMETYPE_OPEN; |
| 439 | 439 | break; |
| 440 | 440 | case _CHESS_GAMETYPE_USER: |
| 441 | - $player2_user =& $member_handler->getUser($row['player2_uid']); |
|
| 442 | - $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?'; |
|
| 443 | - $label_gametype = _MD_CHESS_LABEL_GAMETYPE_USER . ': ' . $player2_username; |
|
| 441 | + $player2_user = & $member_handler->getUser($row['player2_uid']); |
|
| 442 | + $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?'; |
|
| 443 | + $label_gametype = _MD_CHESS_LABEL_GAMETYPE_USER.': '.$player2_username; |
|
| 444 | 444 | break; |
| 445 | 445 | case _CHESS_GAMETYPE_SELF: |
| 446 | 446 | $label_gametype = _MD_CHESS_LABEL_GAMETYPE_SELF; |
@@ -449,26 +449,26 @@ discard block |
||
| 449 | 449 | $label_gametype = _MD_CHESS_LABEL_ERROR; |
| 450 | 450 | break; |
| 451 | 451 | } |
| 452 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype)); |
|
| 452 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype)); |
|
| 453 | 453 | |
| 454 | - $player1_user =& $member_handler->getUser($row['player1_uid']); |
|
| 455 | - $player1_username = is_object($player1_user) ? $player1_user->getVar('uname') : '?'; |
|
| 456 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER . ':', |
|
| 457 | - "<a href='" .XOOPS_URL. "/modules/chess/player_stats.php?player_uid={$row['player1_uid']}'>$player1_username</a>" |
|
| 454 | + $player1_user = & $member_handler->getUser($row['player1_uid']); |
|
| 455 | + $player1_username = is_object($player1_user) ? $player1_user->getVar('uname') : '?'; |
|
| 456 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER.':', |
|
| 457 | + "<a href='".XOOPS_URL."/modules/chess/player_stats.php?player_uid={$row['player1_uid']}'>$player1_username</a>" |
|
| 458 | 458 | )); |
| 459 | 459 | |
| 460 | - $player2_username = $xoopsUser ? $xoopsUser->getVar('uname') : '?'; |
|
| 461 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT . ':', $player2_username)); |
|
| 460 | + $player2_username = $xoopsUser ? $xoopsUser->getVar('uname') : '?'; |
|
| 461 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT.':', $player2_username)); |
|
| 462 | 462 | |
| 463 | 463 | if (!empty($row['fen'])) { |
| 464 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $row['fen'])); |
|
| 464 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $row['fen'])); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | if ($row['color_option'] == _CHESS_COLOROPTION_OPPONENT) { |
| 468 | - $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR . ':', 'coloroption', _CHESS_COLOROPTION_RANDOM); |
|
| 469 | - $radio_color->addOption(_CHESS_COLOROPTION_RANDOM, _MD_CHESS_RADIO_COLOR_RANDOM); |
|
| 470 | - $radio_color->addOption(_CHESS_COLOROPTION_WHITE, _MD_CHESS_RADIO_COLOR_WHITE); |
|
| 471 | - $radio_color->addOption(_CHESS_COLOROPTION_BLACK, _MD_CHESS_RADIO_COLOR_BLACK); |
|
| 468 | + $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR.':', 'coloroption', _CHESS_COLOROPTION_RANDOM); |
|
| 469 | + $radio_color->addOption(_CHESS_COLOROPTION_RANDOM, _MD_CHESS_RADIO_COLOR_RANDOM); |
|
| 470 | + $radio_color->addOption(_CHESS_COLOROPTION_WHITE, _MD_CHESS_RADIO_COLOR_WHITE); |
|
| 471 | + $radio_color->addOption(_CHESS_COLOROPTION_BLACK, _MD_CHESS_RADIO_COLOR_BLACK); |
|
| 472 | 472 | $form->addElement($radio_color); |
| 473 | 473 | } else { |
| 474 | 474 | switch ($row['color_option']) { |
@@ -485,11 +485,11 @@ discard block |
||
| 485 | 485 | $label_coloroption = _MD_CHESS_LABEL_ERROR; |
| 486 | 486 | break; |
| 487 | 487 | } |
| 488 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption)); |
|
| 488 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption)); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | if (chess_moduleConfig('rating_system') != 'none') { |
| 492 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $row['is_rated'] ? _YES : _NO)); |
|
| 492 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $row['is_rated'] ? _YES : _NO)); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Display notification-subscribe checkbox, initially checked. |
@@ -535,28 +535,28 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | $form = new XoopsThemeForm(_MD_CHESS_DELETE_FORM, 'delete_form', 'create.php', 'post', true); |
| 537 | 537 | |
| 538 | - $form->addElement(new XoopsFormHidden('challenge_id', $challenge_id)); |
|
| 538 | + $form->addElement(new XoopsFormHidden('challenge_id', $challenge_id)); |
|
| 539 | 539 | |
| 540 | 540 | if ($show_arbiter_ctrl) { |
| 541 | 541 | $form->addElement(new XoopsFormHidden('show_arbiter_ctrl', $show_arbiter_ctrl)); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | if ($error_msg) { |
| 545 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ': ', '<div class="errorMsg">' . $error_msg . '</div>')); |
|
| 545 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.': ', '<div class="errorMsg">'.$error_msg.'</div>')); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED . ':', formatTimestamp($row['create_date'], "m"))); |
|
| 548 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED.':', formatTimestamp($row['create_date'], "m"))); |
|
| 549 | 549 | |
| 550 | - $member_handler =& xoops_gethandler('member'); |
|
| 550 | + $member_handler = & xoops_gethandler('member'); |
|
| 551 | 551 | |
| 552 | - switch($row['game_type']) { |
|
| 552 | + switch ($row['game_type']) { |
|
| 553 | 553 | case _CHESS_GAMETYPE_OPEN: |
| 554 | 554 | $label_gametype = _MD_CHESS_LABEL_GAMETYPE_OPEN; |
| 555 | 555 | break; |
| 556 | 556 | case _CHESS_GAMETYPE_USER: |
| 557 | - $player2_user =& $member_handler->getUser($row['player2_uid']); |
|
| 558 | - $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?'; |
|
| 559 | - $label_gametype = _MD_CHESS_LABEL_GAMETYPE_USER . ': ' . $player2_username; |
|
| 557 | + $player2_user = & $member_handler->getUser($row['player2_uid']); |
|
| 558 | + $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?'; |
|
| 559 | + $label_gametype = _MD_CHESS_LABEL_GAMETYPE_USER.': '.$player2_username; |
|
| 560 | 560 | break; |
| 561 | 561 | case _CHESS_GAMETYPE_SELF: |
| 562 | 562 | $label_gametype = _MD_CHESS_LABEL_GAMETYPE_SELF; |
@@ -565,17 +565,17 @@ discard block |
||
| 565 | 565 | $label_gametype = _MD_CHESS_LABEL_ERROR; |
| 566 | 566 | break; |
| 567 | 567 | } |
| 568 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype)); |
|
| 568 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype)); |
|
| 569 | 569 | |
| 570 | - $player1_user =& $member_handler->getUser($row['player1_uid']); |
|
| 571 | - $player1_username = is_object($player1_user) ? $player1_user->getVar('uname') : '?'; |
|
| 572 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER . ':', $player1_username)); |
|
| 570 | + $player1_user = & $member_handler->getUser($row['player1_uid']); |
|
| 571 | + $player1_username = is_object($player1_user) ? $player1_user->getVar('uname') : '?'; |
|
| 572 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER.':', $player1_username)); |
|
| 573 | 573 | |
| 574 | 574 | if (!empty($row['fen'])) { |
| 575 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $row['fen'])); |
|
| 575 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $row['fen'])); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - switch($row['color_option']) { |
|
| 578 | + switch ($row['color_option']) { |
|
| 579 | 579 | case _CHESS_COLOROPTION_OPPONENT: |
| 580 | 580 | $label_coloroption = _MD_CHESS_RADIO_COLOR_OPPONENT; |
| 581 | 581 | break; |
@@ -592,10 +592,10 @@ discard block |
||
| 592 | 592 | $label_coloroption = _MD_CHESS_LABEL_ERROR; |
| 593 | 593 | break; |
| 594 | 594 | } |
| 595 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption)); |
|
| 595 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption)); |
|
| 596 | 596 | |
| 597 | 597 | if (chess_moduleConfig('rating_system') != 'none') { |
| 598 | - $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $row['is_rated'] ? _YES : _NO)); |
|
| 598 | + $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $row['is_rated'] ? _YES : _NO)); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | // Display confirm-delete checkbox, initially unchecked. |
@@ -701,16 +701,16 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | $xoopsDB->query("DELETE FROM $challenges_table WHERE challenge_id = '$challenge_id'"); |
| 703 | 703 | if ($xoopsDB->errno()) { |
| 704 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 704 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // Notify player 1 that his challenge has been accepted (if he has subscribed to the notification). |
| 708 | 708 | $player2_username = $xoopsUser ? $xoopsUser->getVar('uname') : '*unknown*'; |
| 709 | - $notification_handler =& xoops_gethandler('notification'); |
|
| 709 | + $notification_handler = & xoops_gethandler('notification'); |
|
| 710 | 710 | $extra_tags = array('CHESS_PLAYER' => $player2_username, 'CHESS_GAME_ID' => $game_id); |
| 711 | 711 | $notification_handler->triggerEvent('global', 0, 'notify_accept_challenge', $extra_tags, array($row['player1_uid'])); |
| 712 | 712 | |
| 713 | - redirect_header(XOOPS_URL . "/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED); |
|
| 713 | + redirect_header(XOOPS_URL."/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -781,16 +781,16 @@ discard block |
||
| 781 | 781 | is_rated = '$rated' |
| 782 | 782 | ")); |
| 783 | 783 | if ($xoopsDB->errno()) { |
| 784 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 784 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | $challenge_id = $xoopsDB->getInsertId(); |
| 788 | 788 | |
| 789 | - $notification_handler =& xoops_gethandler('notification'); |
|
| 789 | + $notification_handler = & xoops_gethandler('notification'); |
|
| 790 | 790 | |
| 791 | 791 | // Update the challenger's subscription for receiving a notification when the challenge is accepted. |
| 792 | 792 | if ($notify_accept) { |
| 793 | - $notification_handler->subscribe ('global', 0, 'notify_accept_challenge'); |
|
| 793 | + $notification_handler->subscribe('global', 0, 'notify_accept_challenge'); |
|
| 794 | 794 | } else { |
| 795 | 795 | $notification_handler->unsubscribe('global', 0, 'notify_accept_challenge'); |
| 796 | 796 | } |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | $xoopsDB->query("DELETE FROM $table WHERE challenge_id='$challenge_id'"); |
| 820 | 820 | if ($xoopsDB->errno()) { |
| 821 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 821 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
@@ -874,12 +874,12 @@ discard block |
||
| 874 | 874 | is_rated = '$rated' |
| 875 | 875 | ")); |
| 876 | 876 | if ($xoopsDB->errno()) { |
| 877 | - trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 877 | + trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $game_id = $xoopsDB->getInsertId(); |
| 881 | 881 | |
| 882 | - $notification_handler =& xoops_gethandler('notification'); |
|
| 882 | + $notification_handler = & xoops_gethandler('notification'); |
|
| 883 | 883 | |
| 884 | 884 | // If requested, subscribe the challenger to receive a notification when a new move is made. |
| 885 | 885 | if ($notify_move_player1_uid) { |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | function chess_fen_error($fen) |
| 904 | 904 | { |
| 905 | 905 | if (!empty($fen)) { |
| 906 | - require_once XOOPS_ROOT_PATH . '/modules/chess/class/chessgame.inc.php'; |
|
| 906 | + require_once XOOPS_ROOT_PATH.'/modules/chess/class/chessgame.inc.php'; |
|
| 907 | 907 | $chessgame = new ChessGame($fen); |
| 908 | 908 | $fen_error = $chessgame->error; |
| 909 | 909 | } else { |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | // The language file gets automatically included within this module, |
| 39 | 39 | // but not when viewing the notifications page via notifications.php. |
| 40 | 40 | global $xoopsConfig; |
| 41 | -if (file_exists(XOOPS_ROOT_PATH . "/modules/chess/language/{$xoopsConfig['language']}/main.php")) { |
|
| 42 | - include_once XOOPS_ROOT_PATH . "/modules/chess/language/{$xoopsConfig['language']}/main.php"; |
|
| 41 | +if (file_exists(XOOPS_ROOT_PATH."/modules/chess/language/{$xoopsConfig['language']}/main.php")) { |
|
| 42 | + include_once XOOPS_ROOT_PATH."/modules/chess/language/{$xoopsConfig['language']}/main.php"; |
|
| 43 | 43 | } else { |
| 44 | - include_once XOOPS_ROOT_PATH . '/modules/chess/language/english/main.php'; |
|
| 44 | + include_once XOOPS_ROOT_PATH.'/modules/chess/language/english/main.php'; |
|
| 45 | 45 | } |
| 46 | 46 | /**#@-*/ |
| 47 | 47 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if ($category == 'global') { |
| 60 | 60 | |
| 61 | 61 | $item['name'] = 'Chess'; |
| 62 | - $item['url'] = XOOPS_URL . '/modules/chess/'; |
|
| 62 | + $item['url'] = XOOPS_URL.'/modules/chess/'; |
|
| 63 | 63 | return $item; |
| 64 | 64 | |
| 65 | 65 | } elseif ($category == 'game') { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | if ($gamedata !== false) { |
| 79 | 79 | |
| 80 | 80 | // get mapping of user IDs to usernames |
| 81 | - $criteria = new Criteria('uid', "({$gamedata['white_uid']}, {$gamedata['black_uid']})", 'IN'); |
|
| 82 | - $member_handler =& xoops_gethandler('member'); |
|
| 83 | - $usernames = $member_handler->getUserList($criteria); |
|
| 81 | + $criteria = new Criteria('uid', "({$gamedata['white_uid']}, {$gamedata['black_uid']})", 'IN'); |
|
| 82 | + $member_handler = & xoops_gethandler('member'); |
|
| 83 | + $usernames = $member_handler->getUserList($criteria); |
|
| 84 | 84 | |
| 85 | - $username_white = isset($usernames[$gamedata['white_uid']]) ? $usernames[$gamedata['white_uid']] : _MD_CHESS_NA; |
|
| 86 | - $username_black = isset($usernames[$gamedata['black_uid']]) ? $usernames[$gamedata['black_uid']] : _MD_CHESS_NA; |
|
| 85 | + $username_white = isset($usernames[$gamedata['white_uid']]) ? $usernames[$gamedata['white_uid']] : _MD_CHESS_NA; |
|
| 86 | + $username_black = isset($usernames[$gamedata['black_uid']]) ? $usernames[$gamedata['black_uid']] : _MD_CHESS_NA; |
|
| 87 | 87 | |
| 88 | 88 | $date = $gamedata['start_date'] ? date('Y.m.d', $gamedata['start_date']) : _MD_CHESS_NA; |
| 89 | 89 | |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | $date = _MD_CHESS_NA; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $item['name'] = "$username_white " ._MD_CHESS_LABEL_VS. " $username_black ($date)"; |
|
| 98 | - $item['url'] = XOOPS_URL . '/modules/chess/game.php?game_id=' . $item_id; |
|
| 97 | + $item['name'] = "$username_white "._MD_CHESS_LABEL_VS." $username_black ($date)"; |
|
| 98 | + $item['url'] = XOOPS_URL.'/modules/chess/game.php?game_id='.$item_id; |
|
| 99 | 99 | return $item; |
| 100 | 100 | } |
| 101 | 101 | } |