Passed
Push — master ( e12440...7742f2 )
by Michael
02:31
created
comment_reply.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require dirname(__DIR__, 2) . '/mainfile.php';
39
-require XOOPS_ROOT_PATH . '/include/comment_reply.php';
38
+require dirname(__DIR__, 2).'/mainfile.php';
39
+require XOOPS_ROOT_PATH.'/include/comment_reply.php';
40 40
 /**#@-*/
Please login to merge, or discard this patch.
player_stats.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 
58 58
 // If player username provided, map it to a user ID, overriding any provided value of player user ID.
59 59
 if (!empty($player_uname)) {
60
-    $player_uid = chess_uname_to_uid($player_uname);
61
-    // Otherwise, if player user ID provided, map it to a username.
60
+	$player_uid = chess_uname_to_uid($player_uname);
61
+	// Otherwise, if player user ID provided, map it to a username.
62 62
 } elseif (0 != $player_uid) {
63
-    $memberHandler = xoops_getHandler('member');
63
+	$memberHandler = xoops_getHandler('member');
64 64
 
65
-    $player_user = $memberHandler->getUser($player_uid);
65
+	$player_user = $memberHandler->getUser($player_uid);
66 66
 
67
-    $player_uname = is_object($player_user) ? $player_user->getVar('uname') : '';
67
+	$player_uname = is_object($player_user) ? $player_user->getVar('uname') : '';
68 68
 }
69 69
 
70 70
 // Check that both user ID and username are now defined.
71 71
 if (0 == $player_uid || empty($player_uname)) {
72
-    redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND);
72
+	redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND);
73 73
 }
74 74
 
75 75
 // Display stats
@@ -89,96 +89,96 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function chess_player_stats($player_uid, $player_uname, $show_option = _CHESS_SHOW_EXCEPT_SELFPLAY, $cstart = 0, $gstart = 0)
91 91
 {
92
-    global $xoopsDB, $xoopsTpl;
92
+	global $xoopsDB, $xoopsTpl;
93 93
 
94
-    $rating_system = chess_moduleConfig('rating_system');
94
+	$rating_system = chess_moduleConfig('rating_system');
95 95
 
96
-    $num_provisional_games = chess_ratings_num_provisional_games();
96
+	$num_provisional_games = chess_ratings_num_provisional_games();
97 97
 
98
-    // set show_option to default if appropriate
98
+	// set show_option to default if appropriate
99 99
 
100
-    if (!$show_option || ('none' == $rating_system && _CHESS_SHOW_RATED_ONLY == $show_option)) {
101
-        $show_option = _CHESS_SHOW_EXCEPT_SELFPLAY;
102
-    }
100
+	if (!$show_option || ('none' == $rating_system && _CHESS_SHOW_RATED_ONLY == $show_option)) {
101
+		$show_option = _CHESS_SHOW_EXCEPT_SELFPLAY;
102
+	}
103 103
 
104
-    // get maximum number of items to display on a page, and constrain it to a reasonable value
104
+	// get maximum number of items to display on a page, and constrain it to a reasonable value
105 105
 
106
-    $max_items_to_display = chess_moduleConfig('max_items');
106
+	$max_items_to_display = chess_moduleConfig('max_items');
107 107
 
108
-    $max_items_to_display = min(max($max_items_to_display, 1), 1000);
108
+	$max_items_to_display = min(max($max_items_to_display, 1), 1000);
109 109
 
110
-    $challenges_table = $xoopsDB->prefix('chess_challenges');
110
+	$challenges_table = $xoopsDB->prefix('chess_challenges');
111 111
 
112
-    $games_table = $xoopsDB->prefix('chess_games');
112
+	$games_table = $xoopsDB->prefix('chess_games');
113 113
 
114
-    $ratings_table = $xoopsDB->prefix('chess_ratings');
114
+	$ratings_table = $xoopsDB->prefix('chess_ratings');
115 115
 
116
-    $player = [];
116
+	$player = [];
117 117
 
118
-    $player['uid'] = $player_uid;
118
+	$player['uid'] = $player_uid;
119 119
 
120
-    $player['uname'] = $player_uname;
120
+	$player['uname'] = $player_uname;
121 121
 
122
-    // ---------------------------------------------
122
+	// ---------------------------------------------
123 123
 
124
-    // form for selecting player and display-options
124
+	// form for selecting player and display-options
125 125
 
126
-    // ---------------------------------------------
126
+	// ---------------------------------------------
127 127
 
128
-    // security token not needed for this form
128
+	// security token not needed for this form
129 129
 
130
-    $form = new XoopsThemeForm(_MD_CHESS_SELECT_PLAYER, 'form1', 'player_stats.php');
130
+	$form = new XoopsThemeForm(_MD_CHESS_SELECT_PLAYER, 'form1', 'player_stats.php');
131 131
 
132
-    $form->addElement(new XoopsFormText('', 'player_uname', 25, 50, $player_uname));
132
+	$form->addElement(new XoopsFormText('', 'player_uname', 25, 50, $player_uname));
133 133
 
134
-    $form->addElement(new XoopsFormButton('', 'submit_select_player', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
134
+	$form->addElement(new XoopsFormButton('', 'submit_select_player', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
135 135
 
136
-    $menu_show_option = new XoopsFormSelect('', 'show_option', $show_option, 1, false);
136
+	$menu_show_option = new XoopsFormSelect('', 'show_option', $show_option, 1, false);
137 137
 
138
-    $menu_show_option->addOption(_CHESS_SHOW_ALL_GAMES, _MD_CHESS_SHOW_ALL_GAMES);
138
+	$menu_show_option->addOption(_CHESS_SHOW_ALL_GAMES, _MD_CHESS_SHOW_ALL_GAMES);
139 139
 
140
-    $menu_show_option->addOption(_CHESS_SHOW_EXCEPT_SELFPLAY, _MD_CHESS_SHOW_EXCEPT_SELFPLAY); // default
140
+	$menu_show_option->addOption(_CHESS_SHOW_EXCEPT_SELFPLAY, _MD_CHESS_SHOW_EXCEPT_SELFPLAY); // default
141 141
 
142
-    if ('none' != $rating_system) {
143
-        $menu_show_option->addOption(_CHESS_SHOW_RATED_ONLY, _MD_CHESS_SHOW_RATED_ONLY);
144
-    }
142
+	if ('none' != $rating_system) {
143
+		$menu_show_option->addOption(_CHESS_SHOW_RATED_ONLY, _MD_CHESS_SHOW_RATED_ONLY);
144
+	}
145 145
 
146
-    $form->addElement($menu_show_option);
146
+	$form->addElement($menu_show_option);
147 147
 
148
-    $form->assign($xoopsTpl);
148
+	$form->assign($xoopsTpl);
149 149
 
150
-    // user IDs that will require mapping to usernames
150
+	// user IDs that will require mapping to usernames
151 151
 
152
-    $userids = [];
152
+	$userids = [];
153 153
 
154
-    // --------------
154
+	// --------------
155 155
 
156
-    // player's games
156
+	// player's games
157 157
 
158
-    // --------------
158
+	// --------------
159 159
 
160
-    // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
160
+	// Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
161 161
 
162
-    // and one with a limit clause to get the data for display on the current page.
162
+	// and one with a limit clause to get the data for display on the current page.
163 163
 
164
-    // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
164
+	// SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
165 165
 
166
-    $where = "'$player_uid' IN (white_uid, black_uid)";
166
+	$where = "'$player_uid' IN (white_uid, black_uid)";
167 167
 
168
-    if (_CHESS_SHOW_EXCEPT_SELFPLAY == $show_option) {
169
-        $where .= ' AND white_uid != black_uid';
170
-    } elseif (_CHESS_SHOW_RATED_ONLY == $show_option) {
171
-        $where .= ' AND is_rated = "1" AND white_uid != black_uid';
172
-    }
168
+	if (_CHESS_SHOW_EXCEPT_SELFPLAY == $show_option) {
169
+		$where .= ' AND white_uid != black_uid';
170
+	} elseif (_CHESS_SHOW_RATED_ONLY == $show_option) {
171
+		$where .= ' AND is_rated = "1" AND white_uid != black_uid';
172
+	}
173 173
 
174
-    $result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where");
174
+	$result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where");
175 175
 
176
-    [$num_items] = $xoopsDB->fetchRow($result);
176
+	[$num_items] = $xoopsDB->fetchRow($result);
177 177
 
178
-    $xoopsDB->freeRecordSet($result);
178
+	$xoopsDB->freeRecordSet($result);
179 179
 
180
-    $result = $xoopsDB->query(
181
-        "
180
+	$result = $xoopsDB->query(
181
+		"
182 182
 		SELECT   game_id, fen_active_color, white_uid, black_uid, pgn_result, is_rated,
183 183
 			UNIX_TIMESTAMP(GREATEST(create_date,start_date,last_date)) AS last_activity
184 184
 		FROM      $games_table
@@ -186,191 +186,191 @@  discard block
 block discarded – undo
186 186
 		ORDER BY  last_activity DESC
187 187
 		LIMIT     $gstart, $max_items_to_display
188 188
 	"
189
-    );
189
+	);
190 190
 
191
-    $games = [];
191
+	$games = [];
192 192
 
193
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
194
-        $games[] = [
195
-            'game_id'          => $row['game_id'],
196
-            'white_uid'        => $row['white_uid'],
197
-            'black_uid'        => $row['black_uid'],
198
-            'fen_active_color' => $row['fen_active_color'],
199
-            'pgn_result'       => $row['pgn_result'],
200
-            'last_activity'    => $row['last_activity'],
201
-            'is_rated'         => $row['is_rated'],
202
-        ];
193
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
194
+		$games[] = [
195
+			'game_id'          => $row['game_id'],
196
+			'white_uid'        => $row['white_uid'],
197
+			'black_uid'        => $row['black_uid'],
198
+			'fen_active_color' => $row['fen_active_color'],
199
+			'pgn_result'       => $row['pgn_result'],
200
+			'last_activity'    => $row['last_activity'],
201
+			'is_rated'         => $row['is_rated'],
202
+		];
203 203
 
204
-        // save user IDs that will require mapping to usernames
204
+		// save user IDs that will require mapping to usernames
205 205
 
206
-        if ($row['white_uid']) {
207
-            $userids[$row['white_uid']] = 1;
208
-        }
206
+		if ($row['white_uid']) {
207
+			$userids[$row['white_uid']] = 1;
208
+		}
209 209
 
210
-        if ($row['black_uid']) {
211
-            $userids[$row['black_uid']] = 1;
212
-        }
213
-    }
210
+		if ($row['black_uid']) {
211
+			$userids[$row['black_uid']] = 1;
212
+		}
213
+	}
214 214
 
215
-    $xoopsDB->freeRecordSet($result);
215
+	$xoopsDB->freeRecordSet($result);
216 216
 
217
-    $show_option_urlparam = "&show_option=$show_option";
217
+	$show_option_urlparam = "&show_option=$show_option";
218 218
 
219
-    $games_pagenav = new XoopsPageNav($num_items, $max_items_to_display, $gstart, 'gstart', "player_uid=$player_uid$show_option_urlparam");
219
+	$games_pagenav = new XoopsPageNav($num_items, $max_items_to_display, $gstart, 'gstart', "player_uid=$player_uid$show_option_urlparam");
220 220
 
221
-    // -------------------
221
+	// -------------------
222 222
 
223
-    // player's challenges
223
+	// player's challenges
224 224
 
225
-    // -------------------
225
+	// -------------------
226 226
 
227
-    // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
227
+	// Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
228 228
 
229
-    // and one with a limit clause to get the data for display on the current page.
229
+	// and one with a limit clause to get the data for display on the current page.
230 230
 
231
-    // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
231
+	// SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
232 232
 
233
-    $where = "'$player_uid' IN (player1_uid, player2_uid)";
233
+	$where = "'$player_uid' IN (player1_uid, player2_uid)";
234 234
 
235
-    if (_CHESS_SHOW_RATED_ONLY == $show_option) {
236
-        $where .= ' AND is_rated = "1"';
237
-    }
235
+	if (_CHESS_SHOW_RATED_ONLY == $show_option) {
236
+		$where .= ' AND is_rated = "1"';
237
+	}
238 238
 
239
-    $result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where");
239
+	$result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where");
240 240
 
241
-    [$num_items] = $xoopsDB->fetchRow($result);
241
+	[$num_items] = $xoopsDB->fetchRow($result);
242 242
 
243
-    $xoopsDB->freeRecordSet($result);
243
+	$xoopsDB->freeRecordSet($result);
244 244
 
245
-    $result = $xoopsDB->query(
246
-        "
245
+	$result = $xoopsDB->query(
246
+		"
247 247
 		SELECT   challenge_id, game_type, color_option, player1_uid, player2_uid, UNIX_TIMESTAMP(create_date) AS create_date, is_rated
248 248
 		FROM     $challenges_table
249 249
 		WHERE    $where
250 250
 		ORDER BY create_date DESC
251 251
 		LIMIT    $cstart, $max_items_to_display
252 252
 	"
253
-    );
253
+	);
254 254
 
255
-    $challenges = [];
255
+	$challenges = [];
256 256
 
257
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
258
-        $challenges[] = [
259
-            'challenge_id' => $row['challenge_id'],
260
-            'game_type'    => $row['game_type'],
261
-            'color_option' => $row['color_option'],
262
-            'player1_uid'  => $row['player1_uid'],
263
-            'player2_uid'  => $row['player2_uid'],
264
-            'create_date'  => $row['create_date'],
265
-            'is_rated'     => $row['is_rated'],
266
-        ];
257
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
258
+		$challenges[] = [
259
+			'challenge_id' => $row['challenge_id'],
260
+			'game_type'    => $row['game_type'],
261
+			'color_option' => $row['color_option'],
262
+			'player1_uid'  => $row['player1_uid'],
263
+			'player2_uid'  => $row['player2_uid'],
264
+			'create_date'  => $row['create_date'],
265
+			'is_rated'     => $row['is_rated'],
266
+		];
267 267
 
268
-        // save user IDs that will require mapping to usernames
268
+		// save user IDs that will require mapping to usernames
269 269
 
270
-        if ($row['player1_uid']) {
271
-            $userids[$row['player1_uid']] = 1;
272
-        }
270
+		if ($row['player1_uid']) {
271
+			$userids[$row['player1_uid']] = 1;
272
+		}
273 273
 
274
-        if ($row['player2_uid']) {
275
-            $userids[$row['player2_uid']] = 1;
276
-        }
277
-    }
274
+		if ($row['player2_uid']) {
275
+			$userids[$row['player2_uid']] = 1;
276
+		}
277
+	}
278 278
 
279
-    $xoopsDB->freeRecordSet($result);
279
+	$xoopsDB->freeRecordSet($result);
280 280
 
281
-    $show_option_urlparam = "&show_option=$show_option";
281
+	$show_option_urlparam = "&show_option=$show_option";
282 282
 
283
-    $challenges_pagenav = new XoopsPageNav($num_items, $max_items_to_display, $cstart, 'cstart', "player_uid=$player_uid$show_option_urlparam");
283
+	$challenges_pagenav = new XoopsPageNav($num_items, $max_items_to_display, $cstart, 'cstart', "player_uid=$player_uid$show_option_urlparam");
284 284
 
285
-    // ---------
285
+	// ---------
286 286
 
287
-    // usernames
287
+	// usernames
288 288
 
289
-    // ---------
289
+	// ---------
290 290
 
291
-    // get mapping of user IDs to usernames
291
+	// get mapping of user IDs to usernames
292 292
 
293
-    $memberHandler = xoops_getHandler('member');
293
+	$memberHandler = xoops_getHandler('member');
294 294
 
295
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
295
+	$criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
296 296
 
297
-    $usernames = $memberHandler->getUserList($criteria);
297
+	$usernames = $memberHandler->getUserList($criteria);
298 298
 
299
-    // add usernames to $games
299
+	// add usernames to $games
300 300
 
301
-    foreach ($games as $k => $game) {
302
-        $games[$k]['white_uname'] = $usernames[$game['white_uid']] ?? '?';
301
+	foreach ($games as $k => $game) {
302
+		$games[$k]['white_uname'] = $usernames[$game['white_uid']] ?? '?';
303 303
 
304
-        $games[$k]['black_uname'] = $usernames[$game['black_uid']] ?? '?';
305
-    }
304
+		$games[$k]['black_uname'] = $usernames[$game['black_uid']] ?? '?';
305
+	}
306 306
 
307
-    // add usernames to $challenges
307
+	// add usernames to $challenges
308 308
 
309
-    foreach ($challenges as $k => $challenge) {
310
-        $challenges[$k]['player1_uname'] = $usernames[$challenge['player1_uid']] ?? '?';
309
+	foreach ($challenges as $k => $challenge) {
310
+		$challenges[$k]['player1_uname'] = $usernames[$challenge['player1_uid']] ?? '?';
311 311
 
312
-        $challenges[$k]['player2_uname'] = $usernames[$challenge['player2_uid']] ?? '?';
313
-    }
312
+		$challenges[$k]['player2_uname'] = $usernames[$challenge['player2_uid']] ?? '?';
313
+	}
314 314
 
315
-    // ---------------------------------------------------
315
+	// ---------------------------------------------------
316 316
 
317
-    // player's rating info (if rating feature is enabled)
317
+	// player's rating info (if rating feature is enabled)
318 318
 
319
-    // ---------------------------------------------------
319
+	// ---------------------------------------------------
320 320
 
321
-    if ('none' != $rating_system) {
322
-        $result = $xoopsDB->query(
323
-            "
321
+	if ('none' != $rating_system) {
322
+		$result = $xoopsDB->query(
323
+			"
324 324
 			SELECT   player_uid, rating, games_won, games_lost, games_drawn, (games_won+games_lost+games_drawn) AS games_played
325 325
 			FROM     $ratings_table
326 326
 			ORDER BY rating DESC, player_uid ASC
327 327
 		"
328
-        );
328
+		);
329 329
 
330
-        $ranking = 0;
330
+		$ranking = 0;
331 331
 
332
-        while (false !== ($row = $xoopsDB->fetchArray($result))) {
333
-            if ($row['games_played'] >= $num_provisional_games) {
334
-                ++$ranking;
335
-            }
332
+		while (false !== ($row = $xoopsDB->fetchArray($result))) {
333
+			if ($row['games_played'] >= $num_provisional_games) {
334
+				++$ranking;
335
+			}
336 336
 
337
-            if ($row['player_uid'] == $player_uid) {
338
-                break;
339
-            }
340
-        }
337
+			if ($row['player_uid'] == $player_uid) {
338
+				break;
339
+			}
340
+		}
341 341
 
342
-        $xoopsDB->freeRecordSet($result);
342
+		$xoopsDB->freeRecordSet($result);
343 343
 
344
-        if ($row['player_uid'] == $player_uid) {
345
-            $player['ranking'] = $ranking;
344
+		if ($row['player_uid'] == $player_uid) {
345
+			$player['ranking'] = $ranking;
346 346
 
347
-            $player['rating'] = $row['rating'];
347
+			$player['rating'] = $row['rating'];
348 348
 
349
-            $player['games_won'] = $row['games_won'];
349
+			$player['games_won'] = $row['games_won'];
350 350
 
351
-            $player['games_lost'] = $row['games_lost'];
351
+			$player['games_lost'] = $row['games_lost'];
352 352
 
353
-            $player['games_drawn'] = $row['games_drawn'];
353
+			$player['games_drawn'] = $row['games_drawn'];
354 354
 
355
-            $player['games_played'] = $row['games_played'];
356
-        }
357
-    }
355
+			$player['games_played'] = $row['games_played'];
356
+		}
357
+	}
358 358
 
359
-    // Template variables
359
+	// Template variables
360 360
 
361
-    $player['games'] = $games;
361
+	$player['games'] = $games;
362 362
 
363
-    $player['challenges'] = $challenges;
363
+	$player['challenges'] = $challenges;
364 364
 
365
-    $xoopsTpl->assign('chess_player', $player);
365
+	$xoopsTpl->assign('chess_player', $player);
366 366
 
367
-    $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system'));
367
+	$xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system'));
368 368
 
369
-    $xoopsTpl->assign('chess_provisional_games', $num_provisional_games);
369
+	$xoopsTpl->assign('chess_provisional_games', $num_provisional_games);
370 370
 
371
-    $xoopsTpl->assign('chess_show_option_urlparam', $show_option_urlparam);
371
+	$xoopsTpl->assign('chess_show_option_urlparam', $show_option_urlparam);
372 372
 
373
-    $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav());
373
+	$xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav());
374 374
 
375
-    $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav());
375
+	$xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav());
376 376
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require_once dirname(__DIR__, 2) . '/mainfile.php';
39
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
40
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
41
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
42
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
43
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
38
+require_once dirname(__DIR__, 2).'/mainfile.php';
39
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
40
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
41
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
42
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
43
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.php';
44 44
 
45 45
 $GLOBALS['xoopsOption']['template_main']                  = 'chess_player_stats.tpl';
46 46
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
47
-require_once XOOPS_ROOT_PATH . '/header.php';
47
+require_once XOOPS_ROOT_PATH.'/header.php';
48 48
 
49 49
 // user input
50
-$player_uid   = (int)($_POST['player_uid'] ?? @$_GET['player_uid']);
50
+$player_uid   = (int) ($_POST['player_uid'] ?? @$_GET['player_uid']);
51 51
 $player_uname = trim(@$_POST['player_uname']); // unsanitized
52
-$cstart       = (int)@$_GET['cstart']; // for page nav: offset of first row of results (challenges) to display (default to 0)
53
-$gstart       = (int)@$_GET['gstart']; // for page nav: offset of first row of results (games) to display (default to 0)
54
-$show_option  = (int)($_POST['show_option'] ?? @$_GET['show_option']);
52
+$cstart       = (int) @$_GET['cstart']; // for page nav: offset of first row of results (challenges) to display (default to 0)
53
+$gstart       = (int) @$_GET['gstart']; // for page nav: offset of first row of results (games) to display (default to 0)
54
+$show_option  = (int) ($_POST['show_option'] ?? @$_GET['show_option']);
55 55
 
56 56
 #var_dump($_REQUEST);#*#DEBUG#
57 57
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 
70 70
 // Check that both user ID and username are now defined.
71 71
 if (0 == $player_uid || empty($player_uname)) {
72
-    redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND);
72
+    redirect_header(XOOPS_URL.'/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_PLAYER_NOT_FOUND);
73 73
 }
74 74
 
75 75
 // Display stats
76 76
 chess_player_stats($player_uid, $player_uname, $show_option, $cstart, $gstart);
77 77
 
78
-require_once XOOPS_ROOT_PATH . '/footer.php';
78
+require_once XOOPS_ROOT_PATH.'/footer.php';
79 79
 /**#@-*/
80 80
 
81 81
 /**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
     $memberHandler = xoops_getHandler('member');
294 294
 
295
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
295
+    $criteria = new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN');
296 296
 
297 297
     $usernames = $memberHandler->getUserList($criteria);
298 298
 
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
  * @since        2.01
18 18
  * @author       XOOPS Development Team
19 19
  */
20
-include dirname(__DIR__) . '/preloads/autoloader.php';
20
+include dirname(__DIR__).'/preloads/autoloader.php';
21 21
 
22
-require dirname(__DIR__, 3) . '/include/cp_header.php';
22
+require dirname(__DIR__, 3).'/include/cp_header.php';
23 23
 //require $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
24
-require dirname(__DIR__) . '/include/common.php';
24
+require dirname(__DIR__).'/include/common.php';
25 25
 
26 26
 $helper = \XoopsModules\Chess\Helper::getInstance();
27 27
 
Please login to merge, or discard this patch.
admin/about.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
  * @since        2.01
18 18
  * @author       XOOPS Development Team
19 19
  */
20
-require __DIR__ . '/admin_header.php';
20
+require __DIR__.'/admin_header.php';
21 21
 xoops_cp_header();
22 22
 
23 23
 $adminObject->displayNavigation(basename(__FILE__));
24 24
 $adminObject::setPaypal('[email protected]');
25 25
 $adminObject->displayAbout(false);
26 26
 
27
-require __DIR__ . '/admin_footer.php';
27
+require __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/migrate.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -69,33 +69,33 @@
 block discarded – undo
69 69
 $message = '';
70 70
 
71 71
 switch ($op) {
72
-    case 'show':
73
-    default:
74
-        $queue = $migrator->getSynchronizeDDL();
75
-        if (!empty($queue)) {
76
-            echo "<pre>\n";
77
-
78
-            foreach ($queue as $line) {
79
-                echo $line . ";\n";
80
-            }
81
-
82
-            echo "</pre>\n";
83
-        }
84
-        break;
85
-    case 'migrate':
86
-        $migrator->synchronizeSchema();
87
-        $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
88
-        break;
89
-    case 'schema':
90
-        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
91
-        break;
92
-    case 'confirmwrite':
93
-        if ($GLOBALS['xoopsSecurity']->check()) {
94
-            $migrator->saveCurrentSchema();
95
-
96
-            $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
97
-        }
98
-        break;
72
+	case 'show':
73
+	default:
74
+		$queue = $migrator->getSynchronizeDDL();
75
+		if (!empty($queue)) {
76
+			echo "<pre>\n";
77
+
78
+			foreach ($queue as $line) {
79
+				echo $line . ";\n";
80
+			}
81
+
82
+			echo "</pre>\n";
83
+		}
84
+		break;
85
+	case 'migrate':
86
+		$migrator->synchronizeSchema();
87
+		$message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
88
+		break;
89
+	case 'schema':
90
+		xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
91
+		break;
92
+	case 'confirmwrite':
93
+		if ($GLOBALS['xoopsSecurity']->check()) {
94
+			$migrator->saveCurrentSchema();
95
+
96
+			$message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
97
+		}
98
+		break;
99 99
 }
100 100
 
101 101
 echo "<div>$message</div>";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use Xmf\Request;
34 34
 use XoopsModules\Chess;
35 35
 
36
-require_once __DIR__ . '/admin_header.php';
36
+require_once __DIR__.'/admin_header.php';
37 37
 xoops_cp_header();
38 38
 
39 39
 $adminObject->displayNavigation(basename(__FILE__));
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             echo "<pre>\n";
77 77
 
78 78
             foreach ($queue as $line) {
79
-                echo $line . ";\n";
79
+                echo $line.";\n";
80 80
             }
81 81
 
82 82
             echo "</pre>\n";
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
         break;
85 85
     case 'migrate':
86 86
         $migrator->synchronizeSchema();
87
-        $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
87
+        $message = constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_OK');
88 88
         break;
89 89
     case 'schema':
90
-        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
90
+        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_WARNING'), constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM'));
91 91
         break;
92 92
     case 'confirmwrite':
93 93
         if ($GLOBALS['xoopsSecurity']->check()) {
94 94
             $migrator->saveCurrentSchema();
95 95
 
96
-            $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
96
+            $message = constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_SCHEMA_OK');
97 97
         }
98 98
         break;
99 99
 }
100 100
 
101 101
 echo "<div>$message</div>";
102 102
 
103
-require_once __DIR__ . '/admin_footer.php';
103
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
comment_delete.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require dirname(__DIR__, 2) . '/mainfile.php';
39
-require XOOPS_ROOT_PATH . '/include/comment_delete.php';
38
+require dirname(__DIR__, 2).'/mainfile.php';
39
+require XOOPS_ROOT_PATH.'/include/comment_delete.php';
40 40
 /**#@-*/
Please login to merge, or discard this patch.
ratings.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 // check whether the rating feature is enabled
46 46
 if ('none' == chess_moduleConfig('rating_system')) {
47
-    redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF);
47
+	redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF);
48 48
 }
49 49
 
50 50
 $GLOBALS['xoopsOption']['template_main']                  = 'chess_ratings.tpl';
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 
61 61
 // If form-submit, check security token.
62 62
 if ($submit_recalc_ratings && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
63
-    redirect_header(
64
-        XOOPS_URL . '/modules/chess/ratings.php',
65
-        _CHESS_REDIRECT_DELAY_FAILURE,
66
-        _MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
67
-    );
63
+	redirect_header(
64
+		XOOPS_URL . '/modules/chess/ratings.php',
65
+		_CHESS_REDIRECT_DELAY_FAILURE,
66
+		_MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
67
+	);
68 68
 }
69 69
 
70 70
 $msg       = '';
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 
73 73
 // If arbiter requested recalculation of ratings, do it.
74 74
 if ($submit_recalc_ratings && is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
75
-    if ($confirm_recalc_ratings) {
76
-        chess_recalc_ratings();
75
+	if ($confirm_recalc_ratings) {
76
+		chess_recalc_ratings();
77 77
 
78
-        $msg = _MD_CHESS_RECALC_DONE;
78
+		$msg = _MD_CHESS_RECALC_DONE;
79 79
 
80
-        $msg_class = 'resultMsg';
81
-    } else {
82
-        $msg = _MD_CHESS_RECALC_NOT_DONE;
80
+		$msg_class = 'resultMsg';
81
+	} else {
82
+		$msg = _MD_CHESS_RECALC_NOT_DONE;
83 83
 
84
-        $msg_class = 'errorMsg';
85
-    }
84
+		$msg_class = 'errorMsg';
85
+	}
86 86
 }
87 87
 
88 88
 // Display the ratings.
@@ -100,119 +100,119 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function chess_ratings($start = 0, $msg = '', $msg_class = 'errorMsg')
102 102
 {
103
-    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsTpl;
103
+	global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsTpl;
104 104
 
105
-    // Display ratings.
105
+	// Display ratings.
106 106
 
107
-    // Get maximum number of items to display on a page, and constrain it to a reasonable value.
107
+	// Get maximum number of items to display on a page, and constrain it to a reasonable value.
108 108
 
109
-    $max_items_to_display = chess_moduleConfig('max_items');
109
+	$max_items_to_display = chess_moduleConfig('max_items');
110 110
 
111
-    $max_items_to_display = min(max($max_items_to_display, 1), 1000);
111
+	$max_items_to_display = min(max($max_items_to_display, 1), 1000);
112 112
 
113
-    $games_table = $xoopsDB->prefix('chess_games');
113
+	$games_table = $xoopsDB->prefix('chess_games');
114 114
 
115
-    $ratings_table = $xoopsDB->prefix('chess_ratings');
115
+	$ratings_table = $xoopsDB->prefix('chess_ratings');
116 116
 
117
-    // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
117
+	// Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
118 118
 
119
-    // and one with a limit clause to get the data for display on the current page.
119
+	// and one with a limit clause to get the data for display on the current page.
120 120
 
121
-    // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
121
+	// SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
122 122
 
123
-    $result = $xoopsDB->query(
124
-        "
123
+	$result = $xoopsDB->query(
124
+		"
125 125
 		SELECT    COUNT(*)
126 126
 		FROM      $ratings_table AS p
127 127
 	"
128
-    );
128
+	);
129 129
 
130
-    [$num_items] = $xoopsDB->fetchRow($result);
130
+	[$num_items] = $xoopsDB->fetchRow($result);
131 131
 
132
-    $xoopsDB->freeRecordSet($result);
132
+	$xoopsDB->freeRecordSet($result);
133 133
 
134
-    $pagenav = new XoopsPageNav($num_items, $max_items_to_display, $start, 'start');
134
+	$pagenav = new XoopsPageNav($num_items, $max_items_to_display, $start, 'start');
135 135
 
136
-    $result = $xoopsDB->query(
137
-        "
136
+	$result = $xoopsDB->query(
137
+		"
138 138
 		SELECT    player_uid, rating, (games_won+games_lost+games_drawn) AS games_played
139 139
 		FROM      $ratings_table
140 140
 		ORDER BY  rating DESC, player_uid ASC
141 141
 		LIMIT     $start, $max_items_to_display
142 142
 	"
143
-    );
143
+	);
144 144
 
145
-    // user IDs that will require mapping to usernames
145
+	// user IDs that will require mapping to usernames
146 146
 
147
-    $userids = [];
147
+	$userids = [];
148 148
 
149
-    $players = [];
149
+	$players = [];
150 150
 
151
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
152
-        // save user IDs that will require mapping to usernames
151
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
152
+		// save user IDs that will require mapping to usernames
153 153
 
154
-        $userids[] = $row['player_uid'];
154
+		$userids[] = $row['player_uid'];
155 155
 
156
-        $players[] = [
157
-            'player_uid'   => $row['player_uid'],
158
-            'rating'       => $row['rating'],
159
-            'games_played' => $row['games_played'],
160
-        ];
161
-    }
156
+		$players[] = [
157
+			'player_uid'   => $row['player_uid'],
158
+			'rating'       => $row['rating'],
159
+			'games_played' => $row['games_played'],
160
+		];
161
+	}
162 162
 
163
-    $xoopsDB->freeRecordSet($result);
163
+	$xoopsDB->freeRecordSet($result);
164 164
 
165
-    // get mapping of user IDs to usernames
165
+	// get mapping of user IDs to usernames
166 166
 
167
-    $memberHandler = xoops_getHandler('member');
167
+	$memberHandler = xoops_getHandler('member');
168 168
 
169
-    $criteria = new \Criteria('uid', '(' . implode(',', $userids) . ')', 'IN');
169
+	$criteria = new \Criteria('uid', '(' . implode(',', $userids) . ')', 'IN');
170 170
 
171
-    $usernames = $memberHandler->getUserList($criteria);
171
+	$usernames = $memberHandler->getUserList($criteria);
172 172
 
173
-    // add usernames to $players
173
+	// add usernames to $players
174 174
 
175
-    foreach ($players as $k => $player) {
176
-        $players[$k]['player_uname'] = $usernames[$player['player_uid']] ?? '?';
177
-    }
175
+	foreach ($players as $k => $player) {
176
+		$players[$k]['player_uname'] = $usernames[$player['player_uid']] ?? '?';
177
+	}
178 178
 
179
-    // Display form for arbiter to recalculate ratings.
179
+	// Display form for arbiter to recalculate ratings.
180 180
 
181
-    if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
182
-        // security token added below
181
+	if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
182
+		// security token added below
183 183
 
184
-        $form = new XoopsThemeForm(_MD_CHESS_RECALC_RATINGS, 'form1', 'ratings.php');
184
+		$form = new XoopsThemeForm(_MD_CHESS_RECALC_RATINGS, 'form1', 'ratings.php');
185 185
 
186
-        // checkbox (initially unchecked)
186
+		// checkbox (initially unchecked)
187 187
 
188
-        $checked_value = 1;
188
+		$checked_value = 1;
189 189
 
190
-        $checkbox_confirm_recalc_ratings = new XoopsFormCheckBox('', 'confirm_recalc_ratings', !$checked_value);
190
+		$checkbox_confirm_recalc_ratings = new XoopsFormCheckBox('', 'confirm_recalc_ratings', !$checked_value);
191 191
 
192
-        $checkbox_confirm_recalc_ratings->addOption($checked_value, _MD_CHESS_RECALC_CONFIRM);
192
+		$checkbox_confirm_recalc_ratings->addOption($checked_value, _MD_CHESS_RECALC_CONFIRM);
193 193
 
194
-        $form->addElement($checkbox_confirm_recalc_ratings);
194
+		$form->addElement($checkbox_confirm_recalc_ratings);
195 195
 
196
-        $form->addElement(new XoopsFormButton('', 'submit_recalc_ratings', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
196
+		$form->addElement(new XoopsFormButton('', 'submit_recalc_ratings', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
197 197
 
198
-        $form->assign($xoopsTpl);
198
+		$form->assign($xoopsTpl);
199 199
 
200
-        // security token
200
+		// security token
201 201
 
202
-        // This method is used because form is templated.
202
+		// This method is used because form is templated.
203 203
 
204
-        $xoopsTpl->assign('chess_xoops_request_token', is_object($GLOBALS['xoopsSecurity']) ? $GLOBALS['xoopsSecurity']->getTokenHTML() : '');
205
-    }
204
+		$xoopsTpl->assign('chess_xoops_request_token', is_object($GLOBALS['xoopsSecurity']) ? $GLOBALS['xoopsSecurity']->getTokenHTML() : '');
205
+	}
206 206
 
207
-    // Template variables
207
+	// Template variables
208 208
 
209
-    $xoopsTpl->assign('chess_provisional_games', chess_ratings_num_provisional_games());
209
+	$xoopsTpl->assign('chess_provisional_games', chess_ratings_num_provisional_games());
210 210
 
211
-    $xoopsTpl->assign('chess_msg', $msg);
211
+	$xoopsTpl->assign('chess_msg', $msg);
212 212
 
213
-    $xoopsTpl->assign('chess_msg_class', $msg_class);
213
+	$xoopsTpl->assign('chess_msg_class', $msg_class);
214 214
 
215
-    $xoopsTpl->assign('chess_players_pagenav', $pagenav->renderNav());
215
+	$xoopsTpl->assign('chess_players_pagenav', $pagenav->renderNav());
216 216
 
217
-    $xoopsTpl->assign('chess_players', $players);
217
+	$xoopsTpl->assign('chess_players', $players);
218 218
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require_once dirname(__DIR__, 2) . '/mainfile.php';
39
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
40
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
41
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
42
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
43
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
38
+require_once dirname(__DIR__, 2).'/mainfile.php';
39
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
40
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
41
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
42
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
43
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.php';
44 44
 
45 45
 // check whether the rating feature is enabled
46 46
 if ('none' == chess_moduleConfig('rating_system')) {
47
-    redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF);
47
+    redirect_header(XOOPS_URL.'/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF);
48 48
 }
49 49
 
50 50
 $GLOBALS['xoopsOption']['template_main']                  = 'chess_ratings.tpl';
51 51
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
52
-require_once XOOPS_ROOT_PATH . '/header.php';
52
+require_once XOOPS_ROOT_PATH.'/header.php';
53 53
 
54 54
 // user input
55 55
 $submit_recalc_ratings  = isset($_POST['submit_recalc_ratings']);
56
-$confirm_recalc_ratings = (int)@$_POST['confirm_recalc_ratings'];
57
-$start                  = (int)@$_GET['start']; // for page nav: offset of first row of results to display (default to 0)
56
+$confirm_recalc_ratings = (int) @$_POST['confirm_recalc_ratings'];
57
+$start                  = (int) @$_GET['start']; // for page nav: offset of first row of results to display (default to 0)
58 58
 
59 59
 #var_dump($_REQUEST);#*#DEBUG#
60 60
 
61 61
 // If form-submit, check security token.
62 62
 if ($submit_recalc_ratings && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
63 63
     redirect_header(
64
-        XOOPS_URL . '/modules/chess/ratings.php',
64
+        XOOPS_URL.'/modules/chess/ratings.php',
65 65
         _CHESS_REDIRECT_DELAY_FAILURE,
66
-        _MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
66
+        _MD_CHESS_TOKEN_ERROR.'<br>'.implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
67 67
     );
68 68
 }
69 69
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 // Display the ratings.
89 89
 chess_ratings($start, $msg, $msg_class);
90 90
 
91
-require_once XOOPS_ROOT_PATH . '/footer.php';
91
+require_once XOOPS_ROOT_PATH.'/footer.php';
92 92
 /**#@-*/
93 93
 
94 94
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
     $memberHandler = xoops_getHandler('member');
168 168
 
169
-    $criteria = new \Criteria('uid', '(' . implode(',', $userids) . ')', 'IN');
169
+    $criteria = new \Criteria('uid', '('.implode(',', $userids).')', 'IN');
170 170
 
171 171
     $usernames = $memberHandler->getUserList($criteria);
172 172
 
Please login to merge, or discard this patch.
game.php 2 patches
Indentation   +635 added lines, -635 removed lines patch added patch discarded remove patch
@@ -66,402 +66,402 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function chess_game()
68 68
 {
69
-    // user input
69
+	// user input
70 70
 
71
-    $game_id = (int)@$_GET['game_id'];
71
+	$game_id = (int)@$_GET['game_id'];
72 72
 
73
-    $submit_move = isset($_POST['submit_move']);
73
+	$submit_move = isset($_POST['submit_move']);
74 74
 
75
-    $submit_refresh = isset($_POST['submit_refresh']);
75
+	$submit_refresh = isset($_POST['submit_refresh']);
76 76
 
77
-    $move = chess_sanitize(trim(@$_POST['chessmove']), 'A-Za-z0-9=-');
77
+	$move = chess_sanitize(trim(@$_POST['chessmove']), 'A-Za-z0-9=-');
78 78
 
79
-    $movetype = chess_sanitize(@$_POST['movetype']);
79
+	$movetype = chess_sanitize(@$_POST['movetype']);
80 80
 
81
-    $confirm = isset($_POST['confirm']) ? 1 : 0;
81
+	$confirm = isset($_POST['confirm']) ? 1 : 0;
82 82
 
83
-    $move_explain = chess_sanitize(trim(@$_POST['move_explain']), 'A-Za-z0-9 .,;:=()[]*?!-');
83
+	$move_explain = chess_sanitize(trim(@$_POST['move_explain']), 'A-Za-z0-9 .,;:=()[]*?!-');
84 84
 
85
-    $arbiter_explain = chess_sanitize(trim(@$_POST['arbiter_explain']), 'A-Za-z0-9 .,;:=()[]*?!-');
85
+	$arbiter_explain = chess_sanitize(trim(@$_POST['arbiter_explain']), 'A-Za-z0-9 .,;:=()[]*?!-');
86 86
 
87
-    $orientation = chess_sanitize(@$_POST['orientation']);
87
+	$orientation = chess_sanitize(@$_POST['orientation']);
88 88
 
89
-    $show_arbiter_ctrl = isset($_POST['show_arbiter_ctrl']);
89
+	$show_arbiter_ctrl = isset($_POST['show_arbiter_ctrl']);
90 90
 
91
-    $submit_arbitrate = isset($_POST['submit_arbitrate']);
91
+	$submit_arbitrate = isset($_POST['submit_arbitrate']);
92 92
 
93
-    $arbiter_action = chess_sanitize(@$_POST['arbiter_action']);
93
+	$arbiter_action = chess_sanitize(@$_POST['arbiter_action']);
94 94
 
95
-    // If form-submit, check security token.
95
+	// If form-submit, check security token.
96 96
 
97
-    if (($submit_move || $submit_refresh || $submit_arbitrate || $show_arbiter_ctrl) && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
98
-        redirect_header(
99
-            XOOPS_URL . '/modules/chess/',
100
-            _CHESS_REDIRECT_DELAY_FAILURE,
101
-            _MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
102
-        );
103
-    }
97
+	if (($submit_move || $submit_refresh || $submit_arbitrate || $show_arbiter_ctrl) && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
98
+		redirect_header(
99
+			XOOPS_URL . '/modules/chess/',
100
+			_CHESS_REDIRECT_DELAY_FAILURE,
101
+			_MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
102
+		);
103
+	}
104 104
 
105
-    // Fetch the game data from the database.
105
+	// Fetch the game data from the database.
106 106
 
107
-    $gamedata = chess_get_game($game_id);
107
+	$gamedata = chess_get_game($game_id);
108 108
 
109
-    if (false === $gamedata) {
110
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
111
-    }
109
+	if (false === $gamedata) {
110
+		redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
111
+	}
112 112
 
113
-    $gamedata_updated = false;
113
+	$gamedata_updated = false;
114 114
 
115
-    $move_performed        = false; // status result from move-handler
116
-    $move_result_text      = '';    // text result from move-handler
117
-    $draw_claim_error_text = '';    // text describing invalid draw-claim
118
-    $notify                = '';    // text description of action for notification
119
-    $delete_game           = false;
115
+	$move_performed        = false; // status result from move-handler
116
+	$move_result_text      = '';    // text result from move-handler
117
+	$draw_claim_error_text = '';    // text describing invalid draw-claim
118
+	$notify                = '';    // text description of action for notification
119
+	$delete_game           = false;
120 120
 
121
-    global $xoopsUser;
121
+	global $xoopsUser;
122 122
 
123
-    $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
123
+	$uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
124 124
 
125
-    $selfplay = $gamedata['white_uid'] == $gamedata['black_uid'];
125
+	$selfplay = $gamedata['white_uid'] == $gamedata['black_uid'];
126 126
 
127
-    if ($selfplay) {
128
-        if ($uid == $gamedata['white_uid']) {
129
-            $user_color = $gamedata['fen_active_color']; // current user is either player, so consider him active player
130
-        } else {
131
-            $user_color = '';                            // current user is not a player
132
-        }
133
-        // not self-play
134
-    } else {
135
-        if ($uid == $gamedata['white_uid']) {
136
-            $user_color = 'w'; // current user is white
137
-        } elseif ($uid == $gamedata['black_uid']) {
138
-            $user_color = 'b'; // current user is black
139
-        } else {
140
-            $user_color = '';  // current user is not a player
141
-        }
142
-    }
127
+	if ($selfplay) {
128
+		if ($uid == $gamedata['white_uid']) {
129
+			$user_color = $gamedata['fen_active_color']; // current user is either player, so consider him active player
130
+		} else {
131
+			$user_color = '';                            // current user is not a player
132
+		}
133
+		// not self-play
134
+	} else {
135
+		if ($uid == $gamedata['white_uid']) {
136
+			$user_color = 'w'; // current user is white
137
+		} elseif ($uid == $gamedata['black_uid']) {
138
+			$user_color = 'b'; // current user is black
139
+		} else {
140
+			$user_color = '';  // current user is not a player
141
+		}
142
+	}
143 143
 
144
-    // Determine whether current user is a player in the current game, and whether it's his move.
144
+	// Determine whether current user is a player in the current game, and whether it's his move.
145 145
 
146
-    $user_is_player = 'w' == $user_color || 'b' == $user_color;
146
+	$user_is_player = 'w' == $user_color || 'b' == $user_color;
147 147
 
148
-    $user_is_player_to_move = $user_color == $gamedata['fen_active_color'];
148
+	$user_is_player_to_move = $user_color == $gamedata['fen_active_color'];
149 149
 
150
-    $user_color_name = 'w' == $user_color ? _MD_CHESS_WHITE : _MD_CHESS_BLACK;
150
+	$user_color_name = 'w' == $user_color ? _MD_CHESS_WHITE : _MD_CHESS_BLACK;
151 151
 
152
-    if ($submit_move && !$gamedata['suspended']) {
153
-        // If the player has changed his confirm-move preference, it needs to be updated in the database.
152
+	if ($submit_move && !$gamedata['suspended']) {
153
+		// If the player has changed his confirm-move preference, it needs to be updated in the database.
154 154
 
155
-        // For a self-play game, the white and black confirm-move preferences are kept the same, to avoid confusion.
155
+		// For a self-play game, the white and black confirm-move preferences are kept the same, to avoid confusion.
156 156
 
157
-        if ($user_is_player) {
158
-            if ('w' == $user_color && $gamedata['white_confirm'] != $confirm) {
159
-                $gamedata['white_confirm'] = $confirm;
157
+		if ($user_is_player) {
158
+			if ('w' == $user_color && $gamedata['white_confirm'] != $confirm) {
159
+				$gamedata['white_confirm'] = $confirm;
160 160
 
161
-                if ($selfplay) {
162
-                    $gamedata['black_confirm'] = $confirm;
163
-                }
161
+				if ($selfplay) {
162
+					$gamedata['black_confirm'] = $confirm;
163
+				}
164 164
 
165
-                $gamedata_updated = true;
166
-            } elseif ('b' == $user_color && $gamedata['black_confirm'] != $confirm) {
167
-                $gamedata['black_confirm'] = $confirm;
165
+				$gamedata_updated = true;
166
+			} elseif ('b' == $user_color && $gamedata['black_confirm'] != $confirm) {
167
+				$gamedata['black_confirm'] = $confirm;
168 168
 
169
-                if ($selfplay) {
170
-                    $gamedata['white_confirm'] = $confirm;
171
-                }
169
+				if ($selfplay) {
170
+					$gamedata['white_confirm'] = $confirm;
171
+				}
172 172
 
173
-                $gamedata_updated = true;
174
-            }
175
-        }
173
+				$gamedata_updated = true;
174
+			}
175
+		}
176 176
 
177
-        switch ($movetype) {
178
-            default:
179
-            case _CHESS_MOVETYPE_NORMAL:
180
-                if ($user_is_player_to_move && $gamedata['offer_draw'] != $user_color) {
181
-                    [$move_performed, $move_result_text] = chess_move($gamedata, $move);
177
+		switch ($movetype) {
178
+			default:
179
+			case _CHESS_MOVETYPE_NORMAL:
180
+				if ($user_is_player_to_move && $gamedata['offer_draw'] != $user_color) {
181
+					[$move_performed, $move_result_text] = chess_move($gamedata, $move);
182 182
 
183
-                    if ($move_performed) {
184
-                        if ($selfplay) { // If self-play, the current user's color switches.
185
-                            $user_color = $gamedata['fen_active_color'];
186
-                        }
183
+					if ($move_performed) {
184
+						if ($selfplay) { // If self-play, the current user's color switches.
185
+							$user_color = $gamedata['fen_active_color'];
186
+						}
187 187
 
188
-                        $gamedata['offer_draw'] = '';
188
+						$gamedata['offer_draw'] = '';
189 189
 
190
-                        $gamedata_updated = true;
190
+						$gamedata_updated = true;
191 191
 
192
-                        $notify = "$user_color_name: $move";
193
-                    }
194
-                }
195
-                break;
196
-            case _CHESS_MOVETYPE_CLAIM_DRAW_3:
197
-            case _CHESS_MOVETYPE_CLAIM_DRAW_50:
198
-                if ($user_is_player_to_move && $gamedata['offer_draw'] != $user_color) {
199
-                    if (!empty($move)) {
200
-                        [$move_performed, $move_result_text] = chess_move($gamedata, $move);
192
+						$notify = "$user_color_name: $move";
193
+					}
194
+				}
195
+				break;
196
+			case _CHESS_MOVETYPE_CLAIM_DRAW_3:
197
+			case _CHESS_MOVETYPE_CLAIM_DRAW_50:
198
+				if ($user_is_player_to_move && $gamedata['offer_draw'] != $user_color) {
199
+					if (!empty($move)) {
200
+						[$move_performed, $move_result_text] = chess_move($gamedata, $move);
201 201
 
202
-                        #var_dump('chess_game', $move_performed, $move_result_text);#*#DEBUG#
202
+						#var_dump('chess_game', $move_performed, $move_result_text);#*#DEBUG#
203 203
 
204
-                        if ($move_performed) {
205
-                            if ($selfplay) { // If self-play, the current user's color switches.
206
-                                $user_color = $gamedata['fen_active_color'];
207
-                            }
204
+						if ($move_performed) {
205
+							if ($selfplay) { // If self-play, the current user's color switches.
206
+								$user_color = $gamedata['fen_active_color'];
207
+							}
208 208
 
209
-                            $gamedata['offer_draw'] = '';
209
+							$gamedata['offer_draw'] = '';
210 210
 
211
-                            $gamedata_updated = true;
211
+							$gamedata_updated = true;
212 212
 
213
-                            $notify = "$user_color_name: $move";
214
-                        } else {
215
-                            break; // move invalid, so don't bother checking draw-claim
216
-                        }
217
-                    }
213
+							$notify = "$user_color_name: $move";
214
+						} else {
215
+							break; // move invalid, so don't bother checking draw-claim
216
+						}
217
+					}
218 218
 
219
-                    [$draw_claim_valid, $draw_claim_text] = _CHESS_MOVETYPE_CLAIM_DRAW_3 == $movetype ? chess_is_draw_threefold_repetition($gamedata) : chess_is_draw_50_move_rule($gamedata);
219
+					[$draw_claim_valid, $draw_claim_text] = _CHESS_MOVETYPE_CLAIM_DRAW_3 == $movetype ? chess_is_draw_threefold_repetition($gamedata) : chess_is_draw_50_move_rule($gamedata);
220 220
 
221
-                    #var_dump('chess_game', $draw_claim_valid, $draw_claim_text);#*#DEBUG#
221
+					#var_dump('chess_game', $draw_claim_valid, $draw_claim_text);#*#DEBUG#
222 222
 
223
-                    if ($draw_claim_valid) {
224
-                        $gamedata['offer_draw'] = '';
223
+					if ($draw_claim_valid) {
224
+						$gamedata['offer_draw'] = '';
225 225
 
226
-                        $gamedata['pgn_result'] = '1/2-1/2';
226
+						$gamedata['pgn_result'] = '1/2-1/2';
227 227
 
228
-                        $comment = '{' . $draw_claim_text . '}';
228
+						$comment = '{' . $draw_claim_text . '}';
229 229
 
230
-                        $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
230
+						$gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
231 231
 
232
-                        $gamedata_updated = true;
232
+						$gamedata_updated = true;
233 233
 
234
-                        $notify = !empty($move) ? "$user_color_name: $move: $draw_claim_text" : "$user_color_name: $draw_claim_text";
235
-                    } else {
236
-                        $draw_claim_error_text = $draw_claim_text;
237
-                    }
238
-                }
239
-                break;
240
-            case _CHESS_MOVETYPE_RESIGN:
241
-                if ($user_is_player) {
242
-                    $gamedata['offer_draw'] = '';
234
+						$notify = !empty($move) ? "$user_color_name: $move: $draw_claim_text" : "$user_color_name: $draw_claim_text";
235
+					} else {
236
+						$draw_claim_error_text = $draw_claim_text;
237
+					}
238
+				}
239
+				break;
240
+			case _CHESS_MOVETYPE_RESIGN:
241
+				if ($user_is_player) {
242
+					$gamedata['offer_draw'] = '';
243 243
 
244
-                    $gamedata['pgn_result'] = 'w' == $user_color ? '0-1' : '1-0';
244
+					$gamedata['pgn_result'] = 'w' == $user_color ? '0-1' : '1-0';
245 245
 
246
-                    $comment = '{' . $user_color_name . ' ' . _MD_CHESS_RESIGNED . '}';
246
+					$comment = '{' . $user_color_name . ' ' . _MD_CHESS_RESIGNED . '}';
247 247
 
248
-                    $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
248
+					$gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
249 249
 
250
-                    $gamedata_updated = true;
250
+					$gamedata_updated = true;
251 251
 
252
-                    $notify = "$user_color_name " . _MD_CHESS_RESIGNED;
253
-                }
254
-                break;
255
-            case _CHESS_MOVETYPE_OFFER_DRAW:
256
-                if ($user_is_player && empty($gamedata['offer_draw']) && !$selfplay) {
257
-                    $gamedata['offer_draw'] = $user_color;
252
+					$notify = "$user_color_name " . _MD_CHESS_RESIGNED;
253
+				}
254
+				break;
255
+			case _CHESS_MOVETYPE_OFFER_DRAW:
256
+				if ($user_is_player && empty($gamedata['offer_draw']) && !$selfplay) {
257
+					$gamedata['offer_draw'] = $user_color;
258 258
 
259
-                    $gamedata_updated = true;
259
+					$gamedata_updated = true;
260 260
 
261
-                    $notify = "$user_color_name " . _MD_CHESS_OFFERED_DRAW;
262
-                }
263
-                break;
264
-            case _CHESS_MOVETYPE_ACCEPT_DRAW:
265
-                if ($user_is_player && !empty($gamedata['offer_draw']) && $gamedata['offer_draw'] != $user_color && !$selfplay) {
266
-                    $gamedata['offer_draw'] = '';
261
+					$notify = "$user_color_name " . _MD_CHESS_OFFERED_DRAW;
262
+				}
263
+				break;
264
+			case _CHESS_MOVETYPE_ACCEPT_DRAW:
265
+				if ($user_is_player && !empty($gamedata['offer_draw']) && $gamedata['offer_draw'] != $user_color && !$selfplay) {
266
+					$gamedata['offer_draw'] = '';
267 267
 
268
-                    $gamedata['pgn_result'] = '1/2-1/2';
268
+					$gamedata['pgn_result'] = '1/2-1/2';
269 269
 
270
-                    $comment = '{' . _MD_CHESS_DRAW_BY_AGREEMENT . '}';
270
+					$comment = '{' . _MD_CHESS_DRAW_BY_AGREEMENT . '}';
271 271
 
272
-                    $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
272
+					$gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
273 273
 
274
-                    $gamedata_updated = true;
274
+					$gamedata_updated = true;
275 275
 
276
-                    $notify = "$user_color_name " . _MD_CHESS_ACCEPTED_DRAW;
277
-                }
276
+					$notify = "$user_color_name " . _MD_CHESS_ACCEPTED_DRAW;
277
+				}
278 278
 
279
-            // no break
280
-            case _CHESS_MOVETYPE_REJECT_DRAW:
281
-                if ($user_is_player && !empty($gamedata['offer_draw']) && $gamedata['offer_draw'] != $user_color && !$selfplay) {
282
-                    $gamedata['offer_draw'] = '';
279
+			// no break
280
+			case _CHESS_MOVETYPE_REJECT_DRAW:
281
+				if ($user_is_player && !empty($gamedata['offer_draw']) && $gamedata['offer_draw'] != $user_color && !$selfplay) {
282
+					$gamedata['offer_draw'] = '';
283 283
 
284
-                    $gamedata_updated = true;
284
+					$gamedata_updated = true;
285 285
 
286
-                    $notify = "$user_color_name " . _MD_CHESS_REJECTED_DRAW;
287
-                }
288
-                break;
289
-            case _CHESS_MOVETYPE_RESTART:
290
-                if ($user_is_player && $selfplay) {
291
-                    // instantiate a ChessGame to get a "fresh" gamestate
286
+					$notify = "$user_color_name " . _MD_CHESS_REJECTED_DRAW;
287
+				}
288
+				break;
289
+			case _CHESS_MOVETYPE_RESTART:
290
+				if ($user_is_player && $selfplay) {
291
+					// instantiate a ChessGame to get a "fresh" gamestate
292 292
 
293
-                    $chessgame = new Chess\ChessGame($gamedata['pgn_fen']);
293
+					$chessgame = new Chess\ChessGame($gamedata['pgn_fen']);
294 294
 
295
-                    $new_gamestate = $chessgame->gamestate();
295
+					$new_gamestate = $chessgame->gamestate();
296 296
 
297
-                    // update the game data
297
+					// update the game data
298 298
 
299
-                    $gamedata['fen_piece_placement'] = $new_gamestate['fen_piece_placement'];
299
+					$gamedata['fen_piece_placement'] = $new_gamestate['fen_piece_placement'];
300 300
 
301
-                    $gamedata['fen_active_color'] = $new_gamestate['fen_active_color'];
301
+					$gamedata['fen_active_color'] = $new_gamestate['fen_active_color'];
302 302
 
303
-                    $gamedata['fen_castling_availability'] = $new_gamestate['fen_castling_availability'];
303
+					$gamedata['fen_castling_availability'] = $new_gamestate['fen_castling_availability'];
304 304
 
305
-                    $gamedata['fen_en_passant_target_square'] = $new_gamestate['fen_en_passant_target_square'];
305
+					$gamedata['fen_en_passant_target_square'] = $new_gamestate['fen_en_passant_target_square'];
306 306
 
307
-                    $gamedata['fen_halfmove_clock'] = $new_gamestate['fen_halfmove_clock'];
307
+					$gamedata['fen_halfmove_clock'] = $new_gamestate['fen_halfmove_clock'];
308 308
 
309
-                    $gamedata['fen_fullmove_number'] = $new_gamestate['fen_fullmove_number'];
309
+					$gamedata['fen_fullmove_number'] = $new_gamestate['fen_fullmove_number'];
310 310
 
311
-                    $gamedata['pgn_fen'] = $new_gamestate['pgn_fen'];
311
+					$gamedata['pgn_fen'] = $new_gamestate['pgn_fen'];
312 312
 
313
-                    $gamedata['pgn_result'] = $new_gamestate['pgn_result'];
313
+					$gamedata['pgn_result'] = $new_gamestate['pgn_result'];
314 314
 
315
-                    $gamedata['pgn_movetext'] = $new_gamestate['pgn_movetext'];
315
+					$gamedata['pgn_movetext'] = $new_gamestate['pgn_movetext'];
316 316
 
317
-                    // update user color
317
+					// update user color
318 318
 
319
-                    $user_color = $gamedata['fen_active_color'];
319
+					$user_color = $gamedata['fen_active_color'];
320 320
 
321
-                    $gamedata_updated = true;
322
-                }
323
-                break;
324
-            case _CHESS_MOVETYPE_DELETE:
325
-                if ($user_is_player && ($selfplay || chess_can_delete())) {
326
-                    $delete_game = true; // must defer actual deletion until after notifications are sent
327
-                    $notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
328
-                }
329
-                break;
330
-            case _CHESS_MOVETYPE_WANT_ARBITRATION:
331
-                if ($user_is_player) {
332
-                    // Ensure that $move_explain does not contain separator $sep.
321
+					$gamedata_updated = true;
322
+				}
323
+				break;
324
+			case _CHESS_MOVETYPE_DELETE:
325
+				if ($user_is_player && ($selfplay || chess_can_delete())) {
326
+					$delete_game = true; // must defer actual deletion until after notifications are sent
327
+					$notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
328
+				}
329
+				break;
330
+			case _CHESS_MOVETYPE_WANT_ARBITRATION:
331
+				if ($user_is_player) {
332
+					// Ensure that $move_explain does not contain separator $sep.
333 333
 
334
-                    $sep = '|';
334
+					$sep = '|';
335 335
 
336
-                    $move_explain = str_replace($sep, '_', $move_explain);
336
+					$move_explain = str_replace($sep, '_', $move_explain);
337 337
 
338
-                    $gamedata['suspended'] = implode($sep, [date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_WANT_ARBITRATION, $move_explain]);
338
+					$gamedata['suspended'] = implode($sep, [date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_WANT_ARBITRATION, $move_explain]);
339 339
 
340
-                    $gamedata_updated = true;
340
+					$gamedata_updated = true;
341 341
 
342
-                    $notify = "$user_color_name " . _MD_CHESS_RQSTED_ARBT . ' ' . _MD_CHESS_BEEN_SUSPENDED;
343
-                }
344
-                break;
345
-        }
346
-    }
342
+					$notify = "$user_color_name " . _MD_CHESS_RQSTED_ARBT . ' ' . _MD_CHESS_BEEN_SUSPENDED;
343
+				}
344
+				break;
345
+		}
346
+	}
347 347
 
348
-    // If board orientation setting uninitialized or invalid, set it to the appropriate default.
348
+	// If board orientation setting uninitialized or invalid, set it to the appropriate default.
349 349
 
350
-    if (!in_array($orientation, [_CHESS_ORIENTATION_ACTIVE, _CHESS_ORIENTATION_WHITE, _CHESS_ORIENTATION_BLACK])) {
351
-        if ($user_is_player && 'b' == $user_color) {
352
-            $orientation = _CHESS_ORIENTATION_BLACK;
353
-        } else {
354
-            $orientation = _CHESS_ORIENTATION_WHITE;
355
-        }
356
-    }
350
+	if (!in_array($orientation, [_CHESS_ORIENTATION_ACTIVE, _CHESS_ORIENTATION_WHITE, _CHESS_ORIENTATION_BLACK])) {
351
+		if ($user_is_player && 'b' == $user_color) {
352
+			$orientation = _CHESS_ORIENTATION_BLACK;
353
+		} else {
354
+			$orientation = _CHESS_ORIENTATION_WHITE;
355
+		}
356
+	}
357 357
 
358
-    // Determine if user is a valid arbiter.
358
+	// Determine if user is a valid arbiter.
359 359
 
360
-    global $xoopsModule;
360
+	global $xoopsModule;
361 361
 
362
-    $is_arbiter = is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
362
+	$is_arbiter = is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
363 363
 
364
-    // If arbiter action was submitted, and user is a valid arbiter, process the action.
364
+	// If arbiter action was submitted, and user is a valid arbiter, process the action.
365 365
 
366
-    if ($submit_arbitrate && $is_arbiter) {
367
-        $username = $xoopsUser ? $xoopsUser->getVar('uname') : '*unknown*';
366
+	if ($submit_arbitrate && $is_arbiter) {
367
+		$username = $xoopsUser ? $xoopsUser->getVar('uname') : '*unknown*';
368 368
 
369
-        switch ($arbiter_action) {
370
-            case _CHESS_ARBITER_RESUME:
371
-                if ($gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
372
-                    $gamedata['suspended'] = '';
369
+		switch ($arbiter_action) {
370
+			case _CHESS_ARBITER_RESUME:
371
+				if ($gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
372
+					$gamedata['suspended'] = '';
373 373
 
374
-                    $gamedata_updated = true;
374
+					$gamedata_updated = true;
375 375
 
376
-                    $notify = eval('return \'' . _MD_CHESS_RESUMED_PLAY . '\';'); // eval references $username
377
-                }
378
-                break;
379
-            case _CHESS_ARBITER_DRAW:
380
-                if ($gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
381
-                    $gamedata['offer_draw'] = '';
376
+					$notify = eval('return \'' . _MD_CHESS_RESUMED_PLAY . '\';'); // eval references $username
377
+				}
378
+				break;
379
+			case _CHESS_ARBITER_DRAW:
380
+				if ($gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
381
+					$gamedata['offer_draw'] = '';
382 382
 
383
-                    $gamedata['pgn_result'] = '1/2-1/2';
383
+					$gamedata['pgn_result'] = '1/2-1/2';
384 384
 
385
-                    $arbiter_explain = str_replace('{', '(', $arbiter_explain);
385
+					$arbiter_explain = str_replace('{', '(', $arbiter_explain);
386 386
 
387
-                    $arbiter_explain = str_replace('}', ')', $arbiter_explain);
387
+					$arbiter_explain = str_replace('}', ')', $arbiter_explain);
388 388
 
389
-                    $comment = '{' . sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain) . '}';
389
+					$comment = '{' . sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain) . '}';
390 390
 
391
-                    $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
391
+					$gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
392 392
 
393
-                    $gamedata['suspended'] = '';
393
+					$gamedata['suspended'] = '';
394 394
 
395
-                    $gamedata_updated = true;
395
+					$gamedata_updated = true;
396 396
 
397
-                    $notify = eval('return \'' . _MD_CHESS_DECLARED_DRAW . '\';'); // eval references $username
398
-                }
399
-                break;
400
-            case _CHESS_ARBITER_DELETE:
401
-                if ($gamedata['suspended']) {
402
-                    $delete_game = true; // must defer actual deletion until after notifications are sent
403
-                    $notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
404
-                }
405
-                break;
406
-            case _CHESS_ARBITER_SUSPEND:
407
-                if (!$gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
408
-                    // Ensure that $arbiter_explain does not contain separator $sep.
397
+					$notify = eval('return \'' . _MD_CHESS_DECLARED_DRAW . '\';'); // eval references $username
398
+				}
399
+				break;
400
+			case _CHESS_ARBITER_DELETE:
401
+				if ($gamedata['suspended']) {
402
+					$delete_game = true; // must defer actual deletion until after notifications are sent
403
+					$notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
404
+				}
405
+				break;
406
+			case _CHESS_ARBITER_SUSPEND:
407
+				if (!$gamedata['suspended'] && '*' == $gamedata['pgn_result']) {
408
+					// Ensure that $arbiter_explain does not contain separator $sep.
409 409
 
410
-                    $sep = '|';
410
+					$sep = '|';
411 411
 
412
-                    $arbiter_explain = str_replace($sep, '_', $arbiter_explain);
412
+					$arbiter_explain = str_replace($sep, '_', $arbiter_explain);
413 413
 
414
-                    $gamedata['suspended'] = implode('|', [date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_ARBITER_SUSPEND, $arbiter_explain]);
414
+					$gamedata['suspended'] = implode('|', [date('Y-m-d H:i:s'), $uid, _CHESS_MOVETYPE_ARBITER_SUSPEND, $arbiter_explain]);
415 415
 
416
-                    $gamedata_updated = true;
416
+					$gamedata_updated = true;
417 417
 
418
-                    $notify = eval('return \'' . _MD_CHESS_SUSPENDED_PLAY . '\';'); // eval references $username
419
-                }
420
-                break;
421
-            default:
422
-                break;
423
-        }
424
-    }
418
+					$notify = eval('return \'' . _MD_CHESS_SUSPENDED_PLAY . '\';'); // eval references $username
419
+				}
420
+				break;
421
+			default:
422
+				break;
423
+		}
424
+	}
425 425
 
426
-    // Store the updated game data in the database.
426
+	// Store the updated game data in the database.
427 427
 
428
-    if ($gamedata_updated) {
429
-        chess_put_game($game_id, $gamedata);
430
-    }
428
+	if ($gamedata_updated) {
429
+		chess_put_game($game_id, $gamedata);
430
+	}
431 431
 
432
-    // Display the (possibly updated) board.
432
+	// Display the (possibly updated) board.
433 433
 
434
-    if (!$delete_game) {
435
-        chess_show_board($gamedata, $orientation, $user_color, $move_performed, $move_result_text, $draw_claim_error_text, $show_arbiter_ctrl && $is_arbiter);
436
-    }
434
+	if (!$delete_game) {
435
+		chess_show_board($gamedata, $orientation, $user_color, $move_performed, $move_result_text, $draw_claim_error_text, $show_arbiter_ctrl && $is_arbiter);
436
+	}
437 437
 
438
-    // If a move (or other action) was made, notify any subscribers.
438
+	// If a move (or other action) was made, notify any subscribers.
439 439
 
440
-    if (!empty($notify)) {
441
-        $notificationHandler = xoops_getHandler('notification');
440
+	if (!empty($notify)) {
441
+		$notificationHandler = xoops_getHandler('notification');
442 442
 
443
-        $notificationHandler->triggerEvent('game', $game_id, 'notify_game_move', ['CHESS_ACTION' => $notify]);
443
+		$notificationHandler->triggerEvent('game', $game_id, 'notify_game_move', ['CHESS_ACTION' => $notify]);
444 444
 
445
-        // admin notifications
445
+		// admin notifications
446 446
 
447
-        if (_CHESS_MOVETYPE_WANT_ARBITRATION == $movetype) {
448
-            $event = 'notify_request_arbitration';
447
+		if (_CHESS_MOVETYPE_WANT_ARBITRATION == $movetype) {
448
+			$event = 'notify_request_arbitration';
449 449
 
450
-            $username = $xoopsUser ? $xoopsUser->getVar('uname') : '(' . _MD_CHESS_UNKNOWN . ')';
450
+			$username = $xoopsUser ? $xoopsUser->getVar('uname') : '(' . _MD_CHESS_UNKNOWN . ')';
451 451
 
452
-            $extra_tags = ['CHESS_REQUESTOR' => $username, 'CHESS_GAME_ID' => $game_id, 'CHESS_EXPLAIN' => $move_explain];
452
+			$extra_tags = ['CHESS_REQUESTOR' => $username, 'CHESS_GAME_ID' => $game_id, 'CHESS_EXPLAIN' => $move_explain];
453 453
 
454
-            $notificationHandler->triggerEvent('global', 0, $event, $extra_tags);
455
-        }
456
-    }
454
+			$notificationHandler->triggerEvent('global', 0, $event, $extra_tags);
455
+		}
456
+	}
457 457
 
458
-    // Handle delete-game action.
458
+	// Handle delete-game action.
459 459
 
460
-    if ($delete_game) {
461
-        chess_delete_game($game_id);
460
+	if ($delete_game) {
461
+		chess_delete_game($game_id);
462 462
 
463
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
464
-    }
463
+		redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
464
+	}
465 465
 }
466 466
 
467 467
 /**
@@ -472,19 +472,19 @@  discard block
 block discarded – undo
472 472
  */
473 473
 function chess_get_game($game_id)
474 474
 {
475
-    global $xoopsDB;
475
+	global $xoopsDB;
476 476
 
477
-    $games_table = $xoopsDB->prefix('chess_games');
477
+	$games_table = $xoopsDB->prefix('chess_games');
478 478
 
479
-    $result = $xoopsDB->query("SELECT * FROM $games_table WHERE game_id = '$game_id'");
479
+	$result = $xoopsDB->query("SELECT * FROM $games_table WHERE game_id = '$game_id'");
480 480
 
481
-    $gamedata = $xoopsDB->fetchArray($result);
481
+	$gamedata = $xoopsDB->fetchArray($result);
482 482
 
483
-    #var_dump('chess_get_game, gamedata', $gamedata);#*#DEBUG#
483
+	#var_dump('chess_get_game, gamedata', $gamedata);#*#DEBUG#
484 484
 
485
-    $xoopsDB->freeRecordSet($result);
485
+	$xoopsDB->freeRecordSet($result);
486 486
 
487
-    return $gamedata;
487
+	return $gamedata;
488 488
 }
489 489
 
490 490
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  */
496 496
 function chess_put_game($game_id, $gamedata)
497 497
 {
498
-    global $xoopsDB;
498
+	global $xoopsDB;
499 499
 
500
-    $myts = MyTextSanitizer::getInstance();
500
+	$myts = MyTextSanitizer::getInstance();
501 501
 
502
-    $suspended_q = $myts->addSlashes($gamedata['suspended']);
502
+	$suspended_q = $myts->addSlashes($gamedata['suspended']);
503 503
 
504
-    $movetext_q = $myts->addSlashes($gamedata['pgn_movetext']);
504
+	$movetext_q = $myts->addSlashes($gamedata['pgn_movetext']);
505 505
 
506
-    $table = $xoopsDB->prefix('chess_games');
506
+	$table = $xoopsDB->prefix('chess_games');
507 507
 
508
-    #echo "updating database table $table<br>\n";#*#DEBUG#
508
+	#echo "updating database table $table<br>\n";#*#DEBUG#
509 509
 
510
-    $xoopsDB->query(
511
-        trim(
512
-            "
510
+	$xoopsDB->query(
511
+		trim(
512
+			"
513 513
 		UPDATE $table
514 514
 		SET
515 515
 			start_date                   = '{$gamedata['start_date']}',
@@ -528,18 +528,18 @@  discard block
 block discarded – undo
528 528
 			black_confirm                = '{$gamedata['black_confirm']}'
529 529
 		WHERE  game_id = '$game_id'
530 530
 	"
531
-        )
532
-    );
531
+		)
532
+	);
533 533
 
534
-    if ($xoopsDB->errno()) {
535
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
536
-    }
534
+	if ($xoopsDB->errno()) {
535
+		trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
536
+	}
537 537
 
538
-    if ('*' != $gamedata['pgn_result'] && '1' == $gamedata['is_rated']) {
539
-        require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
538
+	if ('*' != $gamedata['pgn_result'] && '1' == $gamedata['is_rated']) {
539
+		require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
540 540
 
541
-        chess_ratings_adj($game_id);
542
-    }
541
+		chess_ratings_adj($game_id);
542
+	}
543 543
 }
544 544
 
545 545
 /**
@@ -549,19 +549,19 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function chess_delete_game($game_id)
551 551
 {
552
-    global $xoopsModule, $xoopsDB;
552
+	global $xoopsModule, $xoopsDB;
553 553
 
554
-    // delete notifications associated with this game
554
+	// delete notifications associated with this game
555 555
 
556
-    xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'game', $game_id);
556
+	xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'game', $game_id);
557 557
 
558
-    $table = $xoopsDB->prefix('chess_games');
558
+	$table = $xoopsDB->prefix('chess_games');
559 559
 
560
-    $xoopsDB->query("DELETE FROM $table WHERE game_id='$game_id'");
560
+	$xoopsDB->query("DELETE FROM $table WHERE game_id='$game_id'");
561 561
 
562
-    if ($xoopsDB->errno()) {
563
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
564
-    }
562
+	if ($xoopsDB->errno()) {
563
+		trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
564
+	}
565 565
 }
566 566
 
567 567
 /**
@@ -575,71 +575,71 @@  discard block
 block discarded – undo
575 575
  */
576 576
 function chess_move(&$gamedata, $move)
577 577
 {
578
-    $gamestate = [
579
-        'fen_piece_placement'          => $gamedata['fen_piece_placement'],
580
-        'fen_active_color'             => $gamedata['fen_active_color'],
581
-        'fen_castling_availability'    => $gamedata['fen_castling_availability'],
582
-        'fen_en_passant_target_square' => $gamedata['fen_en_passant_target_square'],
583
-        'fen_halfmove_clock'           => $gamedata['fen_halfmove_clock'],
584
-        'fen_fullmove_number'          => $gamedata['fen_fullmove_number'],
585
-        'pgn_fen'                      => $gamedata['pgn_fen'],
586
-        'pgn_result'                   => $gamedata['pgn_result'],
587
-        'pgn_movetext'                 => $gamedata['pgn_movetext'],
588
-    ];
578
+	$gamestate = [
579
+		'fen_piece_placement'          => $gamedata['fen_piece_placement'],
580
+		'fen_active_color'             => $gamedata['fen_active_color'],
581
+		'fen_castling_availability'    => $gamedata['fen_castling_availability'],
582
+		'fen_en_passant_target_square' => $gamedata['fen_en_passant_target_square'],
583
+		'fen_halfmove_clock'           => $gamedata['fen_halfmove_clock'],
584
+		'fen_fullmove_number'          => $gamedata['fen_fullmove_number'],
585
+		'pgn_fen'                      => $gamedata['pgn_fen'],
586
+		'pgn_result'                   => $gamedata['pgn_result'],
587
+		'pgn_movetext'                 => $gamedata['pgn_movetext'],
588
+	];
589 589
 
590
-    $chessgame = new Chess\ChessGame($gamestate);
590
+	$chessgame = new Chess\ChessGame($gamestate);
591 591
 
592
-    #echo "Performing move: '$move'<br>\n";#*#DEBUG#
592
+	#echo "Performing move: '$move'<br>\n";#*#DEBUG#
593 593
 
594
-    [$move_performed, $move_result_text] = $chessgame->move($move);
594
+	[$move_performed, $move_result_text] = $chessgame->move($move);
595 595
 
596
-    #echo "Move result: '$move_result_text'<br>\n";#*#DEBUG#
596
+	#echo "Move result: '$move_result_text'<br>\n";#*#DEBUG#
597 597
 
598
-    if ($move_performed) {
599
-        // The move was valid - update the game data.
598
+	if ($move_performed) {
599
+		// The move was valid - update the game data.
600 600
 
601
-        $new_gamestate = $chessgame->gamestate();
601
+		$new_gamestate = $chessgame->gamestate();
602 602
 
603
-        #var_dump('new_gamestate', $new_gamestate);#*#DEBUG#
603
+		#var_dump('new_gamestate', $new_gamestate);#*#DEBUG#
604 604
 
605
-        #*#DEBUG# - start
605
+		#*#DEBUG# - start
606 606
 
607
-        #if ($new_gamestate['fen_castling_availability'] != $gamedata['fen_castling_availability']) {
607
+		#if ($new_gamestate['fen_castling_availability'] != $gamedata['fen_castling_availability']) {
608 608
 
609
-        #	echo "*** castling_availability changed from '{$gamedata['fen_castling_availability']}' to '{$new_gamestate['fen_castling_availability']}' ***<br>\n";
609
+		#	echo "*** castling_availability changed from '{$gamedata['fen_castling_availability']}' to '{$new_gamestate['fen_castling_availability']}' ***<br>\n";
610 610
 
611
-        #}
611
+		#}
612 612
 
613
-        #*#DEBUG# - end
613
+		#*#DEBUG# - end
614 614
 
615
-        $gamedata['fen_piece_placement'] = $new_gamestate['fen_piece_placement'];
615
+		$gamedata['fen_piece_placement'] = $new_gamestate['fen_piece_placement'];
616 616
 
617
-        $gamedata['fen_active_color'] = $new_gamestate['fen_active_color'];
617
+		$gamedata['fen_active_color'] = $new_gamestate['fen_active_color'];
618 618
 
619
-        $gamedata['fen_castling_availability'] = $new_gamestate['fen_castling_availability'];
619
+		$gamedata['fen_castling_availability'] = $new_gamestate['fen_castling_availability'];
620 620
 
621
-        $gamedata['fen_en_passant_target_square'] = $new_gamestate['fen_en_passant_target_square'];
621
+		$gamedata['fen_en_passant_target_square'] = $new_gamestate['fen_en_passant_target_square'];
622 622
 
623
-        $gamedata['fen_halfmove_clock'] = $new_gamestate['fen_halfmove_clock'];
623
+		$gamedata['fen_halfmove_clock'] = $new_gamestate['fen_halfmove_clock'];
624 624
 
625
-        $gamedata['fen_fullmove_number'] = $new_gamestate['fen_fullmove_number'];
625
+		$gamedata['fen_fullmove_number'] = $new_gamestate['fen_fullmove_number'];
626 626
 
627
-        $gamedata['pgn_fen'] = $new_gamestate['pgn_fen'];
627
+		$gamedata['pgn_fen'] = $new_gamestate['pgn_fen'];
628 628
 
629
-        $gamedata['pgn_result'] = $new_gamestate['pgn_result'];
629
+		$gamedata['pgn_result'] = $new_gamestate['pgn_result'];
630 630
 
631
-        $gamedata['pgn_movetext'] = $new_gamestate['pgn_movetext'];
631
+		$gamedata['pgn_movetext'] = $new_gamestate['pgn_movetext'];
632 632
 
633
-        $gamedata['last_date'] = date('Y-m-d H:i:s');
633
+		$gamedata['last_date'] = date('Y-m-d H:i:s');
634 634
 
635
-        // if start_date undefined (first move), initialize it
635
+		// if start_date undefined (first move), initialize it
636 636
 
637
-        if ('0000-00-00 00:00:00' == $gamedata['start_date']) {
638
-            $gamedata['start_date'] = $gamedata['last_date'];
639
-        }
640
-    }
637
+		if ('0000-00-00 00:00:00' == $gamedata['start_date']) {
638
+			$gamedata['start_date'] = $gamedata['last_date'];
639
+		}
640
+	}
641 641
 
642
-    return [$move_performed, $move_result_text];
642
+	return [$move_performed, $move_result_text];
643 643
 }
644 644
 
645 645
 /**
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
  */
653 653
 function chess_is_draw_50_move_rule($gamedata)
654 654
 {
655
-    #var_dump('gamedata', $gamedata);#*#DEBUG#
655
+	#var_dump('gamedata', $gamedata);#*#DEBUG#
656 656
 
657
-    if ($gamedata['fen_halfmove_clock'] >= 100) {
658
-        $draw_claim_valid = true;
657
+	if ($gamedata['fen_halfmove_clock'] >= 100) {
658
+		$draw_claim_valid = true;
659 659
 
660
-        $draw_claim_text = _MD_CHESS_DRAW_50;
661
-    } else {
662
-        $draw_claim_valid = false;
660
+		$draw_claim_text = _MD_CHESS_DRAW_50;
661
+	} else {
662
+		$draw_claim_valid = false;
663 663
 
664
-        $draw_claim_text = _MD_CHESS_NO_DRAW_50;
665
-    }
664
+		$draw_claim_text = _MD_CHESS_NO_DRAW_50;
665
+	}
666 666
 
667
-    return [$draw_claim_valid, $draw_claim_text];
667
+	return [$draw_claim_valid, $draw_claim_text];
668 668
 }
669 669
 
670 670
 /**
@@ -680,41 +680,41 @@  discard block
 block discarded – undo
680 680
  */
681 681
 function chess_is_draw_threefold_repetition($gamedata)
682 682
 {
683
-    #var_dump('gamedata', $gamedata);#*#DEBUG#
683
+	#var_dump('gamedata', $gamedata);#*#DEBUG#
684 684
 
685
-    // Define this constant as true to output a log file containing a move analysis.
685
+	// Define this constant as true to output a log file containing a move analysis.
686 686
 
687
-    define('CHESS_LOG_3FOLD', false);
687
+	define('CHESS_LOG_3FOLD', false);
688 688
 
689
-    if (CHESS_LOG_3FOLD) {
690
-        $log = [];
691
-    }
689
+	if (CHESS_LOG_3FOLD) {
690
+		$log = [];
691
+	}
692 692
 
693
-    $chessgame = new Chess\ChessGame($gamedata);
693
+	$chessgame = new Chess\ChessGame($gamedata);
694 694
 
695
-    // board position against which to check for repetitions
695
+	// board position against which to check for repetitions
696 696
 
697
-    $last_board_state = "{$gamedata['fen_piece_placement']} {$gamedata['fen_active_color']} {$gamedata['fen_castling_availability']} {$gamedata['fen_en_passant_target_square']}";
697
+	$last_board_state = "{$gamedata['fen_piece_placement']} {$gamedata['fen_active_color']} {$gamedata['fen_castling_availability']} {$gamedata['fen_en_passant_target_square']}";
698 698
 
699
-    $last_move_number = $gamedata['fen_fullmove_number'];
699
+	$last_move_number = $gamedata['fen_fullmove_number'];
700 700
 
701
-    #echo "last_board_state='$last_board_state'<br>\n";#*#DEBUG#
701
+	#echo "last_board_state='$last_board_state'<br>\n";#*#DEBUG#
702 702
 
703
-    if (CHESS_LOG_3FOLD) {
704
-        $log[] = sprintf('%08x %03d%1s %s', crc32($last_board_state), $gamedata['fen_fullmove_number'], $gamedata['fen_active_color'], $last_board_state);
705
-    }
703
+	if (CHESS_LOG_3FOLD) {
704
+		$log[] = sprintf('%08x %03d%1s %s', crc32($last_board_state), $gamedata['fen_fullmove_number'], $gamedata['fen_active_color'], $last_board_state);
705
+	}
706 706
 
707
-    $chessgame = new Chess\ChessGame($gamedata['pgn_fen']);
707
+	$chessgame = new Chess\ChessGame($gamedata['pgn_fen']);
708 708
 
709
-    empty($chessgame->error) or trigger_error('chessgame invalid', E_USER_ERROR);
709
+	empty($chessgame->error) or trigger_error('chessgame invalid', E_USER_ERROR);
710 710
 
711
-    $tmp_gamedata = $chessgame->gamestate();
711
+	$tmp_gamedata = $chessgame->gamestate();
712 712
 
713
-    is_array($tmp_gamedata) or trigger_error('gamestate invalid', E_USER_ERROR);
713
+	is_array($tmp_gamedata) or trigger_error('gamestate invalid', E_USER_ERROR);
714 714
 
715
-    #*#DEBUG# - start
715
+	#*#DEBUG# - start
716 716
 
717
-    /***
717
+	/***
718 718
      * if (function_exists('posix_times')) {
719 719
      * $posix_times = posix_times();
720 720
      * var_dump('posix_times', $posix_times);
@@ -725,31 +725,31 @@  discard block
 block discarded – undo
725 725
      * }
726 726
      ***/
727 727
 
728
-    #*#DEBUG# - end
728
+	#*#DEBUG# - end
729 729
 
730
-    // $repeats is the list of moves for which the board positions are identical.
730
+	// $repeats is the list of moves for which the board positions are identical.
731 731
 
732
-    // For example, '6w' would represent the board position immediately before white's sixth move.
732
+	// For example, '6w' would represent the board position immediately before white's sixth move.
733 733
 
734
-    // The current position is included, since that's the position against which the other positions will be compared.
734
+	// The current position is included, since that's the position against which the other positions will be compared.
735 735
 
736
-    $repeats[] = $gamedata['fen_fullmove_number'] . $gamedata['fen_active_color'];
736
+	$repeats[] = $gamedata['fen_fullmove_number'] . $gamedata['fen_active_color'];
737 737
 
738
-    // Compare initial board position with last board position, unless the move number is the same, meaning that there haven't been any moves.
738
+	// Compare initial board position with last board position, unless the move number is the same, meaning that there haven't been any moves.
739 739
 
740
-    #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#
740
+	#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#
741 741
 
742
-    $board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}";
742
+	$board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}";
743 743
 
744
-    if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
745
-        $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
744
+	if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
745
+		$repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
746 746
 
747
-        if (CHESS_LOG_3FOLD) {
748
-            $log[] = sprintf('%08x %03d%1s %s', crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state);
749
-        }
747
+		if (CHESS_LOG_3FOLD) {
748
+			$log[] = sprintf('%08x %03d%1s %s', crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state);
749
+		}
750 750
 
751
-        #*#DEBUG# - start
752
-        /***
751
+		#*#DEBUG# - start
752
+		/***
753 753
          * if (count($repeats) >= 3) {
754 754
          * echo "*** Three repetitions! {$repeats[1]},{$repeats[2]},{$repeats[0]} ***<br>\n";
755 755
          * } elseif (count($repeats) >= 2) {
@@ -757,61 +757,61 @@  discard block
 block discarded – undo
757 757
          * }
758 758
          ***/
759 759
 
760
-        #*#DEBUG# - end
761
-    }
760
+		#*#DEBUG# - end
761
+	}
762 762
 
763
-    // Convert pgn_movetext into Nx3 array $movelist.
763
+	// Convert pgn_movetext into Nx3 array $movelist.
764 764
 
765
-    $movelist = chess_make_movelist($gamedata['pgn_movetext']);
765
+	$movelist = chess_make_movelist($gamedata['pgn_movetext']);
766 766
 
767
-    #var_dump('movelist', $movelist);#*#DEBUG#
767
+	#var_dump('movelist', $movelist);#*#DEBUG#
768 768
 
769
-    // Compare board positions after each move with last board position.
769
+	// Compare board positions after each move with last board position.
770 770
 
771
-    foreach ($movelist as $fullmove) {
772
-        #echo "'{$fullmove[0]}' '{$fullmove[1]}' '{$fullmove[2]}'<br>\n";#*#DEBUG#
771
+	foreach ($movelist as $fullmove) {
772
+		#echo "'{$fullmove[0]}' '{$fullmove[1]}' '{$fullmove[2]}'<br>\n";#*#DEBUG#
773 773
 
774
-        if (CHESS_LOG_3FOLD) {
775
-            #$log[] = "'{$fullmove[0]}' '{$fullmove[1]}' '{$fullmove[2]}'";#*#LOG_3FOLD# #*#DEBUG#
776
-        }
774
+		if (CHESS_LOG_3FOLD) {
775
+			#$log[] = "'{$fullmove[0]}' '{$fullmove[1]}' '{$fullmove[2]}'";#*#LOG_3FOLD# #*#DEBUG#
776
+		}
777 777
 
778
-        for ($i = 1; $i <= 2; ++$i) {
779
-            if (!empty($fullmove[$i])) {
780
-                $move = $fullmove[$i];
781
-            } else {
782
-                continue; // $fullmove[$i] can be empty if last move was white's, or if game was setup with black to move first.
783
-            }
778
+		for ($i = 1; $i <= 2; ++$i) {
779
+			if (!empty($fullmove[$i])) {
780
+				$move = $fullmove[$i];
781
+			} else {
782
+				continue; // $fullmove[$i] can be empty if last move was white's, or if game was setup with black to move first.
783
+			}
784 784
 
785
-            // Remove check/checkmate annotation, if present.
785
+			// Remove check/checkmate annotation, if present.
786 786
 
787
-            $move = str_replace('+', '', $move);
787
+			$move = str_replace('+', '', $move);
788 788
 
789
-            $move = str_replace('#', '', $move);
789
+			$move = str_replace('#', '', $move);
790 790
 
791
-            #echo "Performing move: '$move'<br>\n";#*#DEBUG#
791
+			#echo "Performing move: '$move'<br>\n";#*#DEBUG#
792 792
 
793
-            [$tmp_move_performed, $tmp_move_result_text] = $chessgame->move($move);
793
+			[$tmp_move_performed, $tmp_move_result_text] = $chessgame->move($move);
794 794
 
795
-            #echo "Move result: '$tmp_move_result_text'<br>\n";#*#DEBUG#
795
+			#echo "Move result: '$tmp_move_result_text'<br>\n";#*#DEBUG#
796 796
 
797
-            $tmp_move_performed or trigger_error("Failed to perform move $move: $tmp_move_result_text", E_USER_ERROR);
797
+			$tmp_move_performed or trigger_error("Failed to perform move $move: $tmp_move_result_text", E_USER_ERROR);
798 798
 
799
-            $tmp_gamedata = $chessgame->gamestate();
799
+			$tmp_gamedata = $chessgame->gamestate();
800 800
 
801
-            #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#
801
+			#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#
802 802
 
803
-            $board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}";
803
+			$board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}";
804 804
 
805
-            if (CHESS_LOG_3FOLD) {
806
-                $log[] = sprintf('%08x %03d%1s %s', crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state);
807
-            }
805
+			if (CHESS_LOG_3FOLD) {
806
+				$log[] = sprintf('%08x %03d%1s %s', crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state);
807
+			}
808 808
 
809
-            if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
810
-                $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
809
+			if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
810
+				$repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
811 811
 
812
-                #*#DEBUG# - start
812
+				#*#DEBUG# - start
813 813
 
814
-                /***
814
+				/***
815 815
                  * if (count($repeats) >= 3) {
816 816
                  * echo "*** Three repetitions! {$repeats[1]},{$repeats[2]},{$repeats[0]} ***<br>\n";
817 817
                  * } elseif (count($repeats) >= 2) {
@@ -819,18 +819,18 @@  discard block
 block discarded – undo
819 819
                  * }
820 820
                  ***/
821 821
 
822
-                #*#DEBUG# - end
822
+				#*#DEBUG# - end
823 823
 
824
-                if (count($repeats) >= 3) {
825
-                    break 2;
826
-                }
827
-            }
828
-        }
829
-    }
824
+				if (count($repeats) >= 3) {
825
+					break 2;
826
+				}
827
+			}
828
+		}
829
+	}
830 830
 
831
-    #*#DEBUG# - start
831
+	#*#DEBUG# - start
832 832
 
833
-    /***
833
+	/***
834 834
      * if (function_exists('posix_times')) {
835 835
      * $posix_times = posix_times();
836 836
      * var_dump('posix_times', $posix_times);
@@ -841,27 +841,27 @@  discard block
 block discarded – undo
841 841
      * }
842 842
      ***/
843 843
 
844
-    #*#DEBUG# - end
844
+	#*#DEBUG# - end
845 845
 
846
-    if (count($repeats) >= 3) {
847
-        $draw_claim_valid = true;
846
+	if (count($repeats) >= 3) {
847
+		$draw_claim_valid = true;
848 848
 
849
-        $draw_claim_text = sprintf(_MD_CHESS_DRAW_3, "{$repeats[1]},{$repeats[2]},{$repeats[0]}");
850
-    } else {
851
-        $draw_claim_valid = false;
849
+		$draw_claim_text = sprintf(_MD_CHESS_DRAW_3, "{$repeats[1]},{$repeats[2]},{$repeats[0]}");
850
+	} else {
851
+		$draw_claim_valid = false;
852 852
 
853
-        $draw_claim_text = _MD_CHESS_NO_DRAW_3;
854
-    }
853
+		$draw_claim_text = _MD_CHESS_NO_DRAW_3;
854
+	}
855 855
 
856
-    if (CHESS_LOG_3FOLD) {
857
-        $logfile = XOOPS_ROOT_PATH . '/cache/' . date('Ymd_His') . '_3fold.log';
856
+	if (CHESS_LOG_3FOLD) {
857
+		$logfile = XOOPS_ROOT_PATH . '/cache/' . date('Ymd_His') . '_3fold.log';
858 858
 
859
-        sort($log);
859
+		sort($log);
860 860
 
861
-        error_log(implode("\n", $log), 3, $logfile);
862
-    }
861
+		error_log(implode("\n", $log), 3, $logfile);
862
+	}
863 863
 
864
-    return [$draw_claim_valid, $draw_claim_text];
864
+	return [$draw_claim_valid, $draw_claim_text];
865 865
 }
866 866
 
867 867
 /**
@@ -872,31 +872,31 @@  discard block
 block discarded – undo
872 872
  */
873 873
 function chess_make_movelist($movetext)
874 874
 {
875
-    $movelist = [];
875
+	$movelist = [];
876 876
 
877
-    $move_tokens = explode(' ', preg_replace('/\{.*\}/', '', $movetext));
877
+	$move_tokens = explode(' ', preg_replace('/\{.*\}/', '', $movetext));
878 878
 
879
-    $index = -1;
879
+	$index = -1;
880 880
 
881
-    while ($move_tokens) {
882
-        $move_token = array_shift($move_tokens);
881
+	while ($move_tokens) {
882
+		$move_token = array_shift($move_tokens);
883 883
 
884
-        if (in_array($move_token, ['1-0', '0-1', '1/2-1/2', '*'])) {
885
-            break;
886
-        } elseif (preg_match('/^\d+(\.|\.\.\.)$/', $move_token, $matches)) {
887
-            ++$index;
884
+		if (in_array($move_token, ['1-0', '0-1', '1/2-1/2', '*'])) {
885
+			break;
886
+		} elseif (preg_match('/^\d+(\.|\.\.\.)$/', $move_token, $matches)) {
887
+			++$index;
888 888
 
889
-            $movelist[$index][] = $move_token;
889
+			$movelist[$index][] = $move_token;
890 890
 
891
-            if ('...' == $matches[1]) { // setup-game with initial black move - add padding for white's move
892
-                $movelist[$index][] = '';
893
-            }
894
-        } else {
895
-            $movelist[$index][] = $move_token;
896
-        }
897
-    }
891
+			if ('...' == $matches[1]) { // setup-game with initial black move - add padding for white's move
892
+				$movelist[$index][] = '';
893
+			}
894
+		} else {
895
+			$movelist[$index][] = $move_token;
896
+		}
897
+	}
898 898
 
899
-    return $movelist;
899
+	return $movelist;
900 900
 }
901 901
 
902 902
 /**
@@ -912,252 +912,252 @@  discard block
 block discarded – undo
912 912
  */
913 913
 function chess_show_board($gamedata, $orientation, $user_color, $move_performed, $move_result_text = '', $draw_claim_error_text = '', $show_arbiter_ctrl = false)
914 914
 {
915
-    global $xoopsTpl;
915
+	global $xoopsTpl;
916 916
 
917
-    $xoopsTpl->assign(
918
-        'xoops_module_header',
919
-        '
917
+	$xoopsTpl->assign(
918
+		'xoops_module_header',
919
+		'
920 920
 		<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL . '/modules/chess/assets/css/style.css">
921 921
 	'
922
-    );
922
+	);
923 923
 
924
-    $memberHandler = xoops_getHandler('member');
924
+	$memberHandler = xoops_getHandler('member');
925 925
 
926
-    $white_user = $memberHandler->getUser($gamedata['white_uid']);
926
+	$white_user = $memberHandler->getUser($gamedata['white_uid']);
927 927
 
928
-    $white_username = is_object($white_user) ? $white_user->getVar('uname') : '?';
928
+	$white_username = is_object($white_user) ? $white_user->getVar('uname') : '?';
929 929
 
930
-    $black_user = $memberHandler->getUser($gamedata['black_uid']);
930
+	$black_user = $memberHandler->getUser($gamedata['black_uid']);
931 931
 
932
-    $black_username = is_object($black_user) ? $black_user->getVar('uname') : '?';
932
+	$black_username = is_object($black_user) ? $black_user->getVar('uname') : '?';
933 933
 
934
-    // Determine whether board is flipped (black at bottom) or "normal" (white at bottom).
934
+	// Determine whether board is flipped (black at bottom) or "normal" (white at bottom).
935 935
 
936
-    switch ($orientation) {
937
-        default:
938
-        case _CHESS_ORIENTATION_ACTIVE:
939
-            $flip = 'b' == $gamedata['fen_active_color'];
940
-            break;
941
-        case _CHESS_ORIENTATION_WHITE:
942
-            $flip = false;
943
-            break;
944
-        case _CHESS_ORIENTATION_BLACK:
945
-            $flip = true;
946
-            break;
947
-    }
936
+	switch ($orientation) {
937
+		default:
938
+		case _CHESS_ORIENTATION_ACTIVE:
939
+			$flip = 'b' == $gamedata['fen_active_color'];
940
+			break;
941
+		case _CHESS_ORIENTATION_WHITE:
942
+			$flip = false;
943
+			break;
944
+		case _CHESS_ORIENTATION_BLACK:
945
+			$flip = true;
946
+			break;
947
+	}
948 948
 
949
-    // Convert fen_piece_placement string into 8x8-array $tiles.
949
+	// Convert fen_piece_placement string into 8x8-array $tiles.
950 950
 
951
-    $tiles = [];
951
+	$tiles = [];
952 952
 
953
-    $ranks = explode('/', $gamedata['fen_piece_placement']);
953
+	$ranks = explode('/', $gamedata['fen_piece_placement']);
954 954
 
955
-    if ($flip) {
956
-        $ranks = array_reverse($ranks);
957
-    }
955
+	if ($flip) {
956
+		$ranks = array_reverse($ranks);
957
+	}
958 958
 
959
-    foreach ($ranks as $rank) {
960
-        $expanded_row = preg_replace_callback(
961
-            '/(\d)/',
959
+	foreach ($ranks as $rank) {
960
+		$expanded_row = preg_replace_callback(
961
+			'/(\d)/',
962 962
 
963
-            function ($matches) {
964
-                return str_repeat('x', $matches[1]);
965
-            },
966
-            $rank
967
-        );
963
+			function ($matches) {
964
+				return str_repeat('x', $matches[1]);
965
+			},
966
+			$rank
967
+		);
968 968
 
969
-        $rank_tiles = preg_split('//', $expanded_row, -1, PREG_SPLIT_NO_EMPTY);
969
+		$rank_tiles = preg_split('//', $expanded_row, -1, PREG_SPLIT_NO_EMPTY);
970 970
 
971
-        $tiles[] = $flip ? array_reverse($rank_tiles) : $rank_tiles;
972
-    }
971
+		$tiles[] = $flip ? array_reverse($rank_tiles) : $rank_tiles;
972
+	}
973 973
 
974
-    #var_dump('tiles', $tiles);#*#DEBUG#
974
+	#var_dump('tiles', $tiles);#*#DEBUG#
975 975
 
976
-    // Convert pgn_movetext into Nx3 array $movelist.
976
+	// Convert pgn_movetext into Nx3 array $movelist.
977 977
 
978
-    $movelist = chess_make_movelist($gamedata['pgn_movetext']);
978
+	$movelist = chess_make_movelist($gamedata['pgn_movetext']);
979 979
 
980
-    static $file_labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
980
+	static $file_labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
981 981
 
982
-    if ($flip) {
983
-        $file_labels = array_reverse($file_labels);
984
-    }
982
+	if ($flip) {
983
+		$file_labels = array_reverse($file_labels);
984
+	}
985 985
 
986
-    $xoopsTpl->assign('chess_gamedata', $gamedata);
986
+	$xoopsTpl->assign('chess_gamedata', $gamedata);
987 987
 
988
-    // comment at end of movetext
988
+	// comment at end of movetext
989 989
 
990
-    if (preg_match('/\{(.*?)\}\s*$/', $gamedata['pgn_movetext'], $matches)) {
991
-        $xoopsTpl->assign('chess_result_comment', $matches[1]);
992
-    } else {
993
-        $xoopsTpl->assign('chess_result_comment', '');
994
-    }
990
+	if (preg_match('/\{(.*?)\}\s*$/', $gamedata['pgn_movetext'], $matches)) {
991
+		$xoopsTpl->assign('chess_result_comment', $matches[1]);
992
+	} else {
993
+		$xoopsTpl->assign('chess_result_comment', '');
994
+	}
995 995
 
996
-    $xoopsTpl->assign('chess_create_date', '0000-00-00 00:00:00' != $gamedata['create_date'] ? strtotime($gamedata['create_date']) : 0);
996
+	$xoopsTpl->assign('chess_create_date', '0000-00-00 00:00:00' != $gamedata['create_date'] ? strtotime($gamedata['create_date']) : 0);
997 997
 
998
-    $xoopsTpl->assign('chess_start_date', '0000-00-00 00:00:00' != $gamedata['start_date'] ? strtotime($gamedata['start_date']) : 0);
998
+	$xoopsTpl->assign('chess_start_date', '0000-00-00 00:00:00' != $gamedata['start_date'] ? strtotime($gamedata['start_date']) : 0);
999 999
 
1000
-    $xoopsTpl->assign('chess_last_date', '0000-00-00 00:00:00' != $gamedata['last_date'] ? strtotime($gamedata['last_date']) : 0);
1000
+	$xoopsTpl->assign('chess_last_date', '0000-00-00 00:00:00' != $gamedata['last_date'] ? strtotime($gamedata['last_date']) : 0);
1001 1001
 
1002
-    $xoopsTpl->assign('chess_white_user', $white_username);
1002
+	$xoopsTpl->assign('chess_white_user', $white_username);
1003 1003
 
1004
-    $xoopsTpl->assign('chess_black_user', $black_username);
1004
+	$xoopsTpl->assign('chess_black_user', $black_username);
1005 1005
 
1006
-    $xoopsTpl->assign('chess_tiles', $tiles);
1006
+	$xoopsTpl->assign('chess_tiles', $tiles);
1007 1007
 
1008
-    $xoopsTpl->assign('chess_file_labels', $file_labels);
1008
+	$xoopsTpl->assign('chess_file_labels', $file_labels);
1009 1009
 
1010
-    $xoopsTpl->assign(
1011
-        'chess_pgn_string',
1012
-        chess_to_pgn_string(
1013
-            [
1014
-                'event'    => '?',
1015
-                'site'     => $_SERVER['SERVER_NAME'],
1016
-                'datetime' => $gamedata['start_date'],
1017
-                'round'    => '?',
1018
-                'white'    => $white_username,
1019
-                'black'    => $black_username,
1020
-                'result'   => $gamedata['pgn_result'],
1021
-                'setup'    => !empty($gamedata['pgn_fen']) ? 1 : 0,
1022
-                'fen'      => $gamedata['pgn_fen'],
1023
-                'movetext' => $gamedata['pgn_movetext'],
1024
-            ]
1025
-        )
1026
-    );
1010
+	$xoopsTpl->assign(
1011
+		'chess_pgn_string',
1012
+		chess_to_pgn_string(
1013
+			[
1014
+				'event'    => '?',
1015
+				'site'     => $_SERVER['SERVER_NAME'],
1016
+				'datetime' => $gamedata['start_date'],
1017
+				'round'    => '?',
1018
+				'white'    => $white_username,
1019
+				'black'    => $black_username,
1020
+				'result'   => $gamedata['pgn_result'],
1021
+				'setup'    => !empty($gamedata['pgn_fen']) ? 1 : 0,
1022
+				'fen'      => $gamedata['pgn_fen'],
1023
+				'movetext' => $gamedata['pgn_movetext'],
1024
+			]
1025
+		)
1026
+	);
1027 1027
 
1028
-    $xoopsTpl->assign('chess_movelist', $movelist);
1028
+	$xoopsTpl->assign('chess_movelist', $movelist);
1029 1029
 
1030
-    $xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING);
1030
+	$xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING);
1031 1031
 
1032
-    #if (empty($move_result_text)) {$move_result_text = 'test';}#*#DEBUG#
1032
+	#if (empty($move_result_text)) {$move_result_text = 'test';}#*#DEBUG#
1033 1033
 
1034
-    $xoopsTpl->assign('chess_move_performed', $move_performed);
1034
+	$xoopsTpl->assign('chess_move_performed', $move_performed);
1035 1035
 
1036
-    $xoopsTpl->assign('chess_move_result', $move_result_text);
1036
+	$xoopsTpl->assign('chess_move_result', $move_result_text);
1037 1037
 
1038
-    $xoopsTpl->assign('chess_draw_claim_error_text', $draw_claim_error_text);
1038
+	$xoopsTpl->assign('chess_draw_claim_error_text', $draw_claim_error_text);
1039 1039
 
1040
-    $xoopsTpl->assign('chess_user_color', $user_color);
1040
+	$xoopsTpl->assign('chess_user_color', $user_color);
1041 1041
 
1042
-    $xoopsTpl->assign('chess_confirm', $gamedata['w' == $user_color ? 'white_confirm' : 'black_confirm']);
1042
+	$xoopsTpl->assign('chess_confirm', $gamedata['w' == $user_color ? 'white_confirm' : 'black_confirm']);
1043 1043
 
1044
-    $xoopsTpl->assign('chess_orientation', $orientation);
1044
+	$xoopsTpl->assign('chess_orientation', $orientation);
1045 1045
 
1046
-    $xoopsTpl->assign('chess_rank_start', $flip ? 1 : 8);
1046
+	$xoopsTpl->assign('chess_rank_start', $flip ? 1 : 8);
1047 1047
 
1048
-    $xoopsTpl->assign('chess_rank_direction', $flip ? 'up' : 'down');
1048
+	$xoopsTpl->assign('chess_rank_direction', $flip ? 'up' : 'down');
1049 1049
 
1050
-    $xoopsTpl->assign('chess_file_start', $flip ? 8 : 1);
1050
+	$xoopsTpl->assign('chess_file_start', $flip ? 8 : 1);
1051 1051
 
1052
-    $xoopsTpl->assign('chess_file_direction', $flip ? 'down' : 'up');
1052
+	$xoopsTpl->assign('chess_file_direction', $flip ? 'down' : 'up');
1053 1053
 
1054
-    static $pieces = [
1055
-        'K' => ['color' => 'w', 'name' => 'wking', 'alt' => _MD_CHESS_ALT_WKING],
1056
-        'Q' => ['color' => 'w', 'name' => 'wqueen', 'alt' => _MD_CHESS_ALT_WQUEEN],
1057
-        'R' => ['color' => 'w', 'name' => 'wrook', 'alt' => _MD_CHESS_ALT_WROOK],
1058
-        'B' => ['color' => 'w', 'name' => 'wbishop', 'alt' => _MD_CHESS_ALT_WBISHOP],
1059
-        'N' => ['color' => 'w', 'name' => 'wknight', 'alt' => _MD_CHESS_ALT_WKNIGHT],
1060
-        'P' => ['color' => 'w', 'name' => 'wpawn', 'alt' => _MD_CHESS_ALT_WPAWN],
1061
-        'k' => ['color' => 'b', 'name' => 'bking', 'alt' => _MD_CHESS_ALT_BKING],
1062
-        'q' => ['color' => 'b', 'name' => 'bqueen', 'alt' => _MD_CHESS_ALT_BQUEEN],
1063
-        'r' => ['color' => 'b', 'name' => 'brook', 'alt' => _MD_CHESS_ALT_BROOK],
1064
-        'b' => ['color' => 'b', 'name' => 'bbishop', 'alt' => _MD_CHESS_ALT_BBISHOP],
1065
-        'n' => ['color' => 'b', 'name' => 'bknight', 'alt' => _MD_CHESS_ALT_BKNIGHT],
1066
-        'p' => ['color' => 'b', 'name' => 'bpawn', 'alt' => _MD_CHESS_ALT_BPAWN],
1067
-        'x' => ['color' => 'x', 'name' => 'empty', 'alt' => _MD_CHESS_ALT_EMPTY],
1068
-    ];
1054
+	static $pieces = [
1055
+		'K' => ['color' => 'w', 'name' => 'wking', 'alt' => _MD_CHESS_ALT_WKING],
1056
+		'Q' => ['color' => 'w', 'name' => 'wqueen', 'alt' => _MD_CHESS_ALT_WQUEEN],
1057
+		'R' => ['color' => 'w', 'name' => 'wrook', 'alt' => _MD_CHESS_ALT_WROOK],
1058
+		'B' => ['color' => 'w', 'name' => 'wbishop', 'alt' => _MD_CHESS_ALT_WBISHOP],
1059
+		'N' => ['color' => 'w', 'name' => 'wknight', 'alt' => _MD_CHESS_ALT_WKNIGHT],
1060
+		'P' => ['color' => 'w', 'name' => 'wpawn', 'alt' => _MD_CHESS_ALT_WPAWN],
1061
+		'k' => ['color' => 'b', 'name' => 'bking', 'alt' => _MD_CHESS_ALT_BKING],
1062
+		'q' => ['color' => 'b', 'name' => 'bqueen', 'alt' => _MD_CHESS_ALT_BQUEEN],
1063
+		'r' => ['color' => 'b', 'name' => 'brook', 'alt' => _MD_CHESS_ALT_BROOK],
1064
+		'b' => ['color' => 'b', 'name' => 'bbishop', 'alt' => _MD_CHESS_ALT_BBISHOP],
1065
+		'n' => ['color' => 'b', 'name' => 'bknight', 'alt' => _MD_CHESS_ALT_BKNIGHT],
1066
+		'p' => ['color' => 'b', 'name' => 'bpawn', 'alt' => _MD_CHESS_ALT_BPAWN],
1067
+		'x' => ['color' => 'x', 'name' => 'empty', 'alt' => _MD_CHESS_ALT_EMPTY],
1068
+	];
1069 1069
 
1070
-    $xoopsTpl->assign('chess_pieces', $pieces);
1070
+	$xoopsTpl->assign('chess_pieces', $pieces);
1071 1071
 
1072
-    $xoopsTpl->assign('chess_show_arbitration_controls', $show_arbiter_ctrl);
1072
+	$xoopsTpl->assign('chess_show_arbitration_controls', $show_arbiter_ctrl);
1073 1073
 
1074
-    if ($show_arbiter_ctrl && $gamedata['suspended']) {
1075
-        [$susp_date, $susp_uid, $susp_type, $susp_explain] = explode('|', $gamedata['suspended']);
1074
+	if ($show_arbiter_ctrl && $gamedata['suspended']) {
1075
+		[$susp_date, $susp_uid, $susp_type, $susp_explain] = explode('|', $gamedata['suspended']);
1076 1076
 
1077
-        switch ($susp_type) {
1078
-            case 'arbiter_suspend':
1079
-                $susp_type_display = _MD_CHESS_SUSP_TYPE_ARBITER;
1080
-                break;
1081
-            case 'want_arbitration':
1082
-                $susp_type_display = _MD_CHESS_SUSP_TYPE_PLAYER;
1083
-                break;
1084
-            default:
1085
-                $susp_type_display = _MD_CHESS_LABEL_ERROR;
1086
-                break;
1087
-        }
1077
+		switch ($susp_type) {
1078
+			case 'arbiter_suspend':
1079
+				$susp_type_display = _MD_CHESS_SUSP_TYPE_ARBITER;
1080
+				break;
1081
+			case 'want_arbitration':
1082
+				$susp_type_display = _MD_CHESS_SUSP_TYPE_PLAYER;
1083
+				break;
1084
+			default:
1085
+				$susp_type_display = _MD_CHESS_LABEL_ERROR;
1086
+				break;
1087
+		}
1088 1088
 
1089
-        $susp_user = $memberHandler->getUser($susp_uid);
1089
+		$susp_user = $memberHandler->getUser($susp_uid);
1090 1090
 
1091
-        $susp_username = is_object($susp_user) ? $susp_user->getVar('uname') : _MD_CHESS_UNKNOWN;
1091
+		$susp_username = is_object($susp_user) ? $susp_user->getVar('uname') : _MD_CHESS_UNKNOWN;
1092 1092
 
1093
-        $suspend_info = [
1094
-            'date'   => strtotime($susp_date),
1095
-            'user'   => $susp_username,
1096
-            'type'   => $susp_type_display,
1097
-            'reason' => $susp_explain,
1098
-        ];
1093
+		$suspend_info = [
1094
+			'date'   => strtotime($susp_date),
1095
+			'user'   => $susp_username,
1096
+			'type'   => $susp_type_display,
1097
+			'reason' => $susp_explain,
1098
+		];
1099 1099
 
1100
-        $xoopsTpl->assign('chess_suspend_info', $suspend_info);
1101
-    }
1100
+		$xoopsTpl->assign('chess_suspend_info', $suspend_info);
1101
+	}
1102 1102
 
1103
-    // Initialize $captured_pieces_all to indicate all pieces captured, then subtract off the pieces remaining on the board.
1103
+	// Initialize $captured_pieces_all to indicate all pieces captured, then subtract off the pieces remaining on the board.
1104 1104
 
1105
-    $captured_pieces_all = [
1106
-        'Q' => 1,
1107
-        'R' => 2,
1108
-        'B' => 2,
1109
-        'N' => 2,
1110
-        'P' => 8,
1111
-        'q' => 1,
1112
-        'r' => 2,
1113
-        'b' => 2,
1114
-        'n' => 2,
1115
-        'p' => 8,
1116
-    ];
1105
+	$captured_pieces_all = [
1106
+		'Q' => 1,
1107
+		'R' => 2,
1108
+		'B' => 2,
1109
+		'N' => 2,
1110
+		'P' => 8,
1111
+		'q' => 1,
1112
+		'r' => 2,
1113
+		'b' => 2,
1114
+		'n' => 2,
1115
+		'p' => 8,
1116
+	];
1117 1117
 
1118
-    for ($i = 0, $iMax = mb_strlen($gamedata['fen_piece_placement']); $i < $iMax; ++$i) {
1119
-        $piece = $gamedata['fen_piece_placement'][$i];
1118
+	for ($i = 0, $iMax = mb_strlen($gamedata['fen_piece_placement']); $i < $iMax; ++$i) {
1119
+		$piece = $gamedata['fen_piece_placement'][$i];
1120 1120
 
1121
-        if (!empty($captured_pieces_all[$piece])) {
1122
-            --$captured_pieces_all[$piece];
1123
-        }
1124
-    }
1121
+		if (!empty($captured_pieces_all[$piece])) {
1122
+			--$captured_pieces_all[$piece];
1123
+		}
1124
+	}
1125 1125
 
1126
-    // Construct lists of white's and black's captured pieces.
1126
+	// Construct lists of white's and black's captured pieces.
1127 1127
 
1128
-    $captured_pieces = ['white' => [], 'black' => []];
1128
+	$captured_pieces = ['white' => [], 'black' => []];
1129 1129
 
1130
-    foreach ($captured_pieces_all as $piece => $count) {
1131
-        if ($count > 0) {
1132
-            if (ctype_upper($piece)) {
1133
-                $captured_pieces['white'] = array_merge($captured_pieces['white'], array_pad([], $count, $piece));
1134
-            } elseif (ctype_lower($piece)) {
1135
-                $captured_pieces['black'] = array_merge($captured_pieces['black'], array_pad([], $count, $piece));
1136
-            }
1137
-        }
1138
-    }
1130
+	foreach ($captured_pieces_all as $piece => $count) {
1131
+		if ($count > 0) {
1132
+			if (ctype_upper($piece)) {
1133
+				$captured_pieces['white'] = array_merge($captured_pieces['white'], array_pad([], $count, $piece));
1134
+			} elseif (ctype_lower($piece)) {
1135
+				$captured_pieces['black'] = array_merge($captured_pieces['black'], array_pad([], $count, $piece));
1136
+			}
1137
+		}
1138
+	}
1139 1139
 
1140
-    #var_dump('captured_pieces_all', $captured_pieces_all);#*#DEBUG#
1140
+	#var_dump('captured_pieces_all', $captured_pieces_all);#*#DEBUG#
1141 1141
 
1142
-    #var_dump('captured_pieces', $captured_pieces);#*#DEBUG#
1142
+	#var_dump('captured_pieces', $captured_pieces);#*#DEBUG#
1143 1143
 
1144
-    $xoopsTpl->assign('chess_captured_pieces', $captured_pieces);
1144
+	$xoopsTpl->assign('chess_captured_pieces', $captured_pieces);
1145 1145
 
1146
-    $xoopsTpl->assign('chess_pawn_promote_choices', 'w' == $gamedata['fen_active_color'] ? ['Q', 'R', 'B', 'N'] : ['q', 'r', 'b', 'n']);
1146
+	$xoopsTpl->assign('chess_pawn_promote_choices', 'w' == $gamedata['fen_active_color'] ? ['Q', 'R', 'B', 'N'] : ['q', 'r', 'b', 'n']);
1147 1147
 
1148
-    $xoopsTpl->assign('chess_allow_delete', chess_can_delete());
1148
+	$xoopsTpl->assign('chess_allow_delete', chess_can_delete());
1149 1149
 
1150
-    // popup window contents for selecting piece to which pawn is promoted
1150
+	// popup window contents for selecting piece to which pawn is promoted
1151 1151
 
1152
-    // (Note that template is compiled here by fetch(), so any template variables it uses must already be defined.)
1152
+	// (Note that template is compiled here by fetch(), so any template variables it uses must already be defined.)
1153 1153
 
1154
-    $xoopsTpl->assign('chess_pawn_promote_popup', $user_color ? $xoopsTpl->fetch('db:chess_game_promote_popup.tpl') : '');
1154
+	$xoopsTpl->assign('chess_pawn_promote_popup', $user_color ? $xoopsTpl->fetch('db:chess_game_promote_popup.tpl') : '');
1155 1155
 
1156
-    $xoopsTpl->assign('chess_ratings_enabled', 'none' != chess_moduleConfig('rating_system'));
1156
+	$xoopsTpl->assign('chess_ratings_enabled', 'none' != chess_moduleConfig('rating_system'));
1157 1157
 
1158
-    // security token
1158
+	// security token
1159 1159
 
1160
-    $xoopsTpl->assign('chess_xoops_request_token', is_object($GLOBALS['xoopsSecurity']) ? $GLOBALS['xoopsSecurity']->getTokenHTML() : '');
1160
+	$xoopsTpl->assign('chess_xoops_request_token', is_object($GLOBALS['xoopsSecurity']) ? $GLOBALS['xoopsSecurity']->getTokenHTML() : '');
1161 1161
 }
1162 1162
 
1163 1163
 ?>
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
 
41 41
 /**#@+
42 42
  */
43
-require_once dirname(__DIR__, 2) . '/mainfile.php';
44
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
43
+require_once dirname(__DIR__, 2).'/mainfile.php';
44
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
45 45
 
46 46
 $GLOBALS['xoopsOption']['template_main']                  = 'chess_game_main.tpl';
47 47
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
48
-require_once XOOPS_ROOT_PATH . '/header.php';
49
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
50
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
48
+require_once XOOPS_ROOT_PATH.'/header.php';
49
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
50
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
51 51
 
52 52
 chess_game();
53 53
 
54
-require_once XOOPS_ROOT_PATH . '/include/comment_view.php';
55
-require_once XOOPS_ROOT_PATH . '/footer.php';
54
+require_once XOOPS_ROOT_PATH.'/include/comment_view.php';
55
+require_once XOOPS_ROOT_PATH.'/footer.php';
56 56
 /**#@-*/
57 57
 
58 58
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 {
69 69
     // user input
70 70
 
71
-    $game_id = (int)@$_GET['game_id'];
71
+    $game_id = (int) @$_GET['game_id'];
72 72
 
73 73
     $submit_move = isset($_POST['submit_move']);
74 74
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
     if (($submit_move || $submit_refresh || $submit_arbitrate || $show_arbiter_ctrl) && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
98 98
         redirect_header(
99
-            XOOPS_URL . '/modules/chess/',
99
+            XOOPS_URL.'/modules/chess/',
100 100
             _CHESS_REDIRECT_DELAY_FAILURE,
101
-            _MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
101
+            _MD_CHESS_TOKEN_ERROR.'<br>'.implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
102 102
         );
103 103
     }
104 104
 
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
     $gamedata = chess_get_game($game_id);
108 108
 
109 109
     if (false === $gamedata) {
110
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
110
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
111 111
     }
112 112
 
113 113
     $gamedata_updated = false;
114 114
 
115 115
     $move_performed        = false; // status result from move-handler
116
-    $move_result_text      = '';    // text result from move-handler
117
-    $draw_claim_error_text = '';    // text describing invalid draw-claim
118
-    $notify                = '';    // text description of action for notification
116
+    $move_result_text      = ''; // text result from move-handler
117
+    $draw_claim_error_text = ''; // text describing invalid draw-claim
118
+    $notify                = ''; // text description of action for notification
119 119
     $delete_game           = false;
120 120
 
121 121
     global $xoopsUser;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         if ($uid == $gamedata['white_uid']) {
129 129
             $user_color = $gamedata['fen_active_color']; // current user is either player, so consider him active player
130 130
         } else {
131
-            $user_color = '';                            // current user is not a player
131
+            $user_color = ''; // current user is not a player
132 132
         }
133 133
         // not self-play
134 134
     } else {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         } elseif ($uid == $gamedata['black_uid']) {
138 138
             $user_color = 'b'; // current user is black
139 139
         } else {
140
-            $user_color = '';  // current user is not a player
140
+            $user_color = ''; // current user is not a player
141 141
         }
142 142
     }
143 143
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
                         $gamedata['pgn_result'] = '1/2-1/2';
227 227
 
228
-                        $comment = '{' . $draw_claim_text . '}';
228
+                        $comment = '{'.$draw_claim_text.'}';
229 229
 
230 230
                         $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
231 231
 
@@ -243,13 +243,13 @@  discard block
 block discarded – undo
243 243
 
244 244
                     $gamedata['pgn_result'] = 'w' == $user_color ? '0-1' : '1-0';
245 245
 
246
-                    $comment = '{' . $user_color_name . ' ' . _MD_CHESS_RESIGNED . '}';
246
+                    $comment = '{'.$user_color_name.' '._MD_CHESS_RESIGNED.'}';
247 247
 
248 248
                     $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
249 249
 
250 250
                     $gamedata_updated = true;
251 251
 
252
-                    $notify = "$user_color_name " . _MD_CHESS_RESIGNED;
252
+                    $notify = "$user_color_name "._MD_CHESS_RESIGNED;
253 253
                 }
254 254
                 break;
255 255
             case _CHESS_MOVETYPE_OFFER_DRAW:
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
                     $gamedata_updated = true;
260 260
 
261
-                    $notify = "$user_color_name " . _MD_CHESS_OFFERED_DRAW;
261
+                    $notify = "$user_color_name "._MD_CHESS_OFFERED_DRAW;
262 262
                 }
263 263
                 break;
264 264
             case _CHESS_MOVETYPE_ACCEPT_DRAW:
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 
268 268
                     $gamedata['pgn_result'] = '1/2-1/2';
269 269
 
270
-                    $comment = '{' . _MD_CHESS_DRAW_BY_AGREEMENT . '}';
270
+                    $comment = '{'._MD_CHESS_DRAW_BY_AGREEMENT.'}';
271 271
 
272 272
                     $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
273 273
 
274 274
                     $gamedata_updated = true;
275 275
 
276
-                    $notify = "$user_color_name " . _MD_CHESS_ACCEPTED_DRAW;
276
+                    $notify = "$user_color_name "._MD_CHESS_ACCEPTED_DRAW;
277 277
                 }
278 278
 
279 279
             // no break
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
                     $gamedata_updated = true;
285 285
 
286
-                    $notify = "$user_color_name " . _MD_CHESS_REJECTED_DRAW;
286
+                    $notify = "$user_color_name "._MD_CHESS_REJECTED_DRAW;
287 287
                 }
288 288
                 break;
289 289
             case _CHESS_MOVETYPE_RESTART:
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
             case _CHESS_MOVETYPE_DELETE:
325 325
                 if ($user_is_player && ($selfplay || chess_can_delete())) {
326 326
                     $delete_game = true; // must defer actual deletion until after notifications are sent
327
-                    $notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
327
+                    $notify      = eval('return \''._MD_CHESS_DELETED_GAME.'\';'); // eval references $username
328 328
                 }
329 329
                 break;
330 330
             case _CHESS_MOVETYPE_WANT_ARBITRATION:
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
                     $gamedata_updated = true;
341 341
 
342
-                    $notify = "$user_color_name " . _MD_CHESS_RQSTED_ARBT . ' ' . _MD_CHESS_BEEN_SUSPENDED;
342
+                    $notify = "$user_color_name "._MD_CHESS_RQSTED_ARBT.' '._MD_CHESS_BEEN_SUSPENDED;
343 343
                 }
344 344
                 break;
345 345
         }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
                     $gamedata_updated = true;
375 375
 
376
-                    $notify = eval('return \'' . _MD_CHESS_RESUMED_PLAY . '\';'); // eval references $username
376
+                    $notify = eval('return \''._MD_CHESS_RESUMED_PLAY.'\';'); // eval references $username
377 377
                 }
378 378
                 break;
379 379
             case _CHESS_ARBITER_DRAW:
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
                     $arbiter_explain = str_replace('}', ')', $arbiter_explain);
388 388
 
389
-                    $comment = '{' . sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain) . '}';
389
+                    $comment = '{'.sprintf(_MD_CHESS_DRAW_DECLARED, $arbiter_explain).'}';
390 390
 
391 391
                     $gamedata['pgn_movetext'] = str_replace('*', "{$gamedata['pgn_result']} $comment", $gamedata['pgn_movetext']);
392 392
 
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
 
395 395
                     $gamedata_updated = true;
396 396
 
397
-                    $notify = eval('return \'' . _MD_CHESS_DECLARED_DRAW . '\';'); // eval references $username
397
+                    $notify = eval('return \''._MD_CHESS_DECLARED_DRAW.'\';'); // eval references $username
398 398
                 }
399 399
                 break;
400 400
             case _CHESS_ARBITER_DELETE:
401 401
                 if ($gamedata['suspended']) {
402 402
                     $delete_game = true; // must defer actual deletion until after notifications are sent
403
-                    $notify      = eval('return \'' . _MD_CHESS_DELETED_GAME . '\';'); // eval references $username
403
+                    $notify      = eval('return \''._MD_CHESS_DELETED_GAME.'\';'); // eval references $username
404 404
                 }
405 405
                 break;
406 406
             case _CHESS_ARBITER_SUSPEND:
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
                     $gamedata_updated = true;
417 417
 
418
-                    $notify = eval('return \'' . _MD_CHESS_SUSPENDED_PLAY . '\';'); // eval references $username
418
+                    $notify = eval('return \''._MD_CHESS_SUSPENDED_PLAY.'\';'); // eval references $username
419 419
                 }
420 420
                 break;
421 421
             default:
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
         if (_CHESS_MOVETYPE_WANT_ARBITRATION == $movetype) {
448 448
             $event = 'notify_request_arbitration';
449 449
 
450
-            $username = $xoopsUser ? $xoopsUser->getVar('uname') : '(' . _MD_CHESS_UNKNOWN . ')';
450
+            $username = $xoopsUser ? $xoopsUser->getVar('uname') : '('._MD_CHESS_UNKNOWN.')';
451 451
 
452 452
             $extra_tags = ['CHESS_REQUESTOR' => $username, 'CHESS_GAME_ID' => $game_id, 'CHESS_EXPLAIN' => $move_explain];
453 453
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     if ($delete_game) {
461 461
         chess_delete_game($game_id);
462 462
 
463
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
463
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
464 464
     }
465 465
 }
466 466
 
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
     );
533 533
 
534 534
     if ($xoopsDB->errno()) {
535
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
535
+        trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR);
536 536
     }
537 537
 
538 538
     if ('*' != $gamedata['pgn_result'] && '1' == $gamedata['is_rated']) {
539
-        require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
539
+        require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.php';
540 540
 
541 541
         chess_ratings_adj($game_id);
542 542
     }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
     $xoopsDB->query("DELETE FROM $table WHERE game_id='$game_id'");
561 561
 
562 562
     if ($xoopsDB->errno()) {
563
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
563
+        trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR);
564 564
     }
565 565
 }
566 566
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 
734 734
     // The current position is included, since that's the position against which the other positions will be compared.
735 735
 
736
-    $repeats[] = $gamedata['fen_fullmove_number'] . $gamedata['fen_active_color'];
736
+    $repeats[] = $gamedata['fen_fullmove_number'].$gamedata['fen_active_color'];
737 737
 
738 738
     // Compare initial board position with last board position, unless the move number is the same, meaning that there haven't been any moves.
739 739
 
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
     $board_state = "{$tmp_gamedata['fen_piece_placement']} {$tmp_gamedata['fen_active_color']} {$tmp_gamedata['fen_castling_availability']} {$tmp_gamedata['fen_en_passant_target_square']}";
743 743
 
744 744
     if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
745
-        $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
745
+        $repeats[] = $tmp_gamedata['fen_fullmove_number'].$tmp_gamedata['fen_active_color'];
746 746
 
747 747
         if (CHESS_LOG_3FOLD) {
748 748
             $log[] = sprintf('%08x %03d%1s %s', crc32($board_state), $tmp_gamedata['fen_fullmove_number'], $tmp_gamedata['fen_active_color'], $board_state);
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
             }
808 808
 
809 809
             if ($tmp_gamedata['fen_fullmove_number'] != $last_move_number && $board_state == $last_board_state) {
810
-                $repeats[] = $tmp_gamedata['fen_fullmove_number'] . $tmp_gamedata['fen_active_color'];
810
+                $repeats[] = $tmp_gamedata['fen_fullmove_number'].$tmp_gamedata['fen_active_color'];
811 811
 
812 812
                 #*#DEBUG# - start
813 813
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     }
855 855
 
856 856
     if (CHESS_LOG_3FOLD) {
857
-        $logfile = XOOPS_ROOT_PATH . '/cache/' . date('Ymd_His') . '_3fold.log';
857
+        $logfile = XOOPS_ROOT_PATH.'/cache/'.date('Ymd_His').'_3fold.log';
858 858
 
859 859
         sort($log);
860 860
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
     $xoopsTpl->assign(
918 918
         'xoops_module_header',
919 919
         '
920
-		<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL . '/modules/chess/assets/css/style.css">
920
+		<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL.'/modules/chess/assets/css/style.css">
921 921
 	'
922 922
     );
923 923
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
         $expanded_row = preg_replace_callback(
961 961
             '/(\d)/',
962 962
 
963
-            function ($matches) {
963
+            function($matches) {
964 964
                 return str_repeat('x', $matches[1]);
965 965
             },
966 966
             $rank
Please login to merge, or discard this patch.
create.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 
47 47
 /**#@+
48 48
  */
49
-require_once dirname(__DIR__, 2) . '/mainfile.php';
49
+require_once dirname(__DIR__, 2).'/mainfile.php';
50 50
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
51
-require_once XOOPS_ROOT_PATH . '/header.php';
52
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
53
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
54
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
51
+require_once XOOPS_ROOT_PATH.'/header.php';
52
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
53
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
54
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
55 55
 
56 56
 #var_dump($_REQUEST);#*#DEBUG#
57 57
 
58 58
 if (!chess_can_play()) {
59
-    redirect_header(XOOPS_URL . '/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _NOPERM);
59
+    redirect_header(XOOPS_URL.'/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _NOPERM);
60 60
 }
61 61
 
62 62
 // user input
63 63
 //$gametype          = chess_sanitize(@$_POST['gametype']);
64 64
 //$opponent          = chess_sanitize(trim(@$_POST['opponent']), _CHESS_USERNAME_ALLOWED_CHARACTERS);
65 65
 $gametype     = Request::getCmd('gametype', '', 'POST');
66
-$opponent     = preg_replace('/[^' . _CHESS_USERNAME_ALLOWED_CHARACTERS . ']/i', '', Request::getString('opponent', '', 'POST'));
66
+$opponent     = preg_replace('/[^'._CHESS_USERNAME_ALLOWED_CHARACTERS.']/i', '', Request::getString('opponent', '', 'POST'));
67 67
 $opponent     = trim($opponent);
68 68
 $opponent_uid      = !empty($opponent) ? chess_opponent_uid($opponent) : 0;
69 69
 //$fen               = chess_moduleConfig('allow_setup') ? chess_sanitize(trim(@$_POST['fen']), 'A-Za-z0-9 /-') : '';
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 // If form-submit, check security token.
89 89
 if (($submit_challenge1 || $submit_challenge2 || $submit_challenge3 || $submit_accept || $submit_delete || $show_arbiter_ctrl) && is_object($GLOBALS['xoopsSecurity']) && !$GLOBALS['xoopsSecurity']->check()) {
90 90
     redirect_header(
91
-        XOOPS_URL . '/modules/chess/',
91
+        XOOPS_URL.'/modules/chess/',
92 92
         _CHESS_REDIRECT_DELAY_FAILURE,
93
-        _MD_CHESS_TOKEN_ERROR . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
93
+        _MD_CHESS_TOKEN_ERROR.'<br>'.implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())
94 94
     );
95 95
 }
96 96
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 $is_arbiter = is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
106 106
 
107 107
 if ($cancel_challenge1) {
108
-    redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _TAKINGBACK);
108
+    redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _TAKINGBACK);
109 109
 } elseif ($cancel_challenge2) {
110 110
     chess_show_create_form1($gametype);
111 111
 } elseif ($cancel_challenge3) {
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
         chess_show_create_form1($gametype, $fen);
116 116
     }
117 117
 } elseif ($cancel_accept) {
118
-    redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _TAKINGBACK);
118
+    redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _TAKINGBACK);
119 119
 } elseif ($submit_challenge1) {
120 120
     $fen_error = chess_fen_error($fen);
121 121
 
122 122
     if (!empty($fen_error)) {
123
-        chess_show_create_form1($gametype, $fen, _MD_CHESS_FEN_INVALID . ': ' . $fen_error);
123
+        chess_show_create_form1($gametype, $fen, _MD_CHESS_FEN_INVALID.': '.$fen_error);
124 124
     } elseif (_CHESS_GAMETYPE_OPEN == $gametype || _CHESS_GAMETYPE_USER == $gametype) {
125 125
         chess_show_create_form2($gametype, $fen);
126 126
     } else {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     if (_CHESS_GAMETYPE_OPEN == $gametype) {
145 145
         chess_create_challenge($gametype, $fen, $coloroption, $rated, $notify_accept, $notify_move);
146 146
 
147
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
147
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
148 148
     } elseif (_CHESS_GAMETYPE_USER == $gametype) {
149 149
         if (empty($opponent)) {
150 150
             chess_show_create_form2($gametype, $fen, $coloroption, $opponent_uid, $rated, _MD_CHESS_OPPONENT_MISSING);
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
         } else {
156 156
             chess_create_challenge($gametype, $fen, $coloroption, $rated, $notify_accept, $notify_move, $opponent_uid);
157 157
 
158
-            redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
158
+            redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
159 159
         }
160 160
     } elseif (_CHESS_GAMETYPE_SELF == $gametype) {
161 161
         $game_id = chess_create_game($uid, $uid, $fen, $rated);
162 162
 
163
-        redirect_header(XOOPS_URL . "/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
163
+        redirect_header(XOOPS_URL."/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
164 164
     } else {
165 165
         chess_show_create_form1($gametype, $fen, _MD_CHESS_GAMETYPE_INVALID);
166 166
     }
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
         if ($is_arbiter || chess_is_challenger($challenge_id)) {
172 172
             chess_delete_challenge($challenge_id);
173 173
 
174
-            redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
174
+            redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_DELETED);
175 175
         } else {
176
-            redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _NOPERM);
176
+            redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _NOPERM);
177 177
         }
178 178
     } else {
179 179
         chess_show_delete_form($challenge_id, $show_arbiter_ctrl && $is_arbiter, _MD_CHESS_NO_CONFIRM_DELETE);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     chess_show_create_form1($gametype);
189 189
 }
190 190
 
191
-require_once XOOPS_ROOT_PATH . '/footer.php';
191
+require_once XOOPS_ROOT_PATH.'/footer.php';
192 192
 /**#@-*/
193 193
 
194 194
 /**
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
     $form = new XoopsThemeForm(_MD_CHESS_CREATE_FORM, 'create_form1', 'create.php', 'post', true);
204 204
 
205 205
     if ($error_msg) {
206
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ': ', '<div class="errorMsg">' . $error_msg . '</div>'));
206
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.': ', '<div class="errorMsg">'.$error_msg.'</div>'));
207 207
     }
208 208
 
209
-    $menu_gametype = new XoopsFormSelect(_MD_CHESS_LABEL_GAMETYPE . ':', 'gametype', $gametype, 1, false);
209
+    $menu_gametype = new XoopsFormSelect(_MD_CHESS_LABEL_GAMETYPE.':', 'gametype', $gametype, 1, false);
210 210
 
211 211
     $menu_gametype->addOption(_CHESS_GAMETYPE_OPEN, _MD_CHESS_MENU_GAMETYPE_OPEN);
212 212
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
         $form->addElement(new XoopsFormLabel('', _MD_CHESS_LABEL_FEN_EXPLAIN));
223 223
 
224
-        $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_FEN_SETUP . ':', 'fen', 80, _CHESS_TEXTBOX_FEN_MAXLEN, $fen));
224
+        $form->addElement(new XoopsFormText(_MD_CHESS_LABEL_FEN_SETUP.':', 'fen', 80, _CHESS_TEXTBOX_FEN_MAXLEN, $fen));
225 225
     }
226 226
 
227 227
     $form->addElement(new XoopsFormLabel('&nbsp;', '&nbsp;'));
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     $form->addElement(new XoopsFormHidden('fen', $fen));
257 257
 
258 258
     if ($error_msg) {
259
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ':', '<div class="errorMsg">' . $error_msg . '</div>'));
259
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.':', '<div class="errorMsg">'.$error_msg.'</div>'));
260 260
     }
261 261
 
262 262
     $memberHandler = xoops_getHandler('member');
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
     if (_CHESS_GAMETYPE_USER == $gametype) {
269 269
         $form->addElement(
270 270
             new XoopsFormText(
271
-                _MD_CHESS_LABEL_OPPONENT . ':', 'opponent', _CHESS_TEXTBOX_OPPONENT_SIZE, _CHESS_TEXTBOX_OPPONENT_MAXLEN, $opponent_username
271
+                _MD_CHESS_LABEL_OPPONENT.':', 'opponent', _CHESS_TEXTBOX_OPPONENT_SIZE, _CHESS_TEXTBOX_OPPONENT_MAXLEN, $opponent_username
272 272
             )
273 273
         );
274 274
     }
275 275
 
276
-    $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR . ':', 'coloroption', $coloroption);
276
+    $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR.':', 'coloroption', $coloroption);
277 277
 
278 278
     $radio_color->addOption(_CHESS_COLOROPTION_OPPONENT, _MD_CHESS_RADIO_COLOR_OPPONENT);
279 279
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     if ('none' !== chess_moduleConfig('rating_system')) {
289 289
         if (_CHESS_GAMETYPE_OPEN == $gametype || _CHESS_GAMETYPE_USER == $gametype) {
290 290
             if (chess_moduleConfig('allow_unrated_games')) {
291
-                $radio_rated = new XoopsFormRadio(_MD_CHESS_RATED_GAME . ':', 'rated', $rated);
291
+                $radio_rated = new XoopsFormRadio(_MD_CHESS_RATED_GAME.':', 'rated', $rated);
292 292
 
293 293
                 $radio_rated->addOption(1, _YES);
294 294
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
     $form->addElement(new XoopsFormHidden('rated', $rated));
345 345
 
346
-    $form->addElement(new XoopsFormLabel('', '<div class="confirmMsg">' . _MD_CHESS_GAME_CONFIRM . '</div>'));
346
+    $form->addElement(new XoopsFormLabel('', '<div class="confirmMsg">'._MD_CHESS_GAME_CONFIRM.'</div>'));
347 347
 
348 348
     switch ($gametype) {
349 349
         case _CHESS_GAMETYPE_OPEN:
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
             break;
361 361
     }
362 362
 
363
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype));
363
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype));
364 364
 
365 365
     if (!empty($fen)) {
366
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $fen));
366
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $fen));
367 367
     }
368 368
 
369 369
     if (_CHESS_GAMETYPE_USER == $gametype) {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
         $opponent_username = is_object($opponent_user) ? $opponent_user->getVar('uname') : '';
375 375
 
376
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT . ':', $opponent_username));
376
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT.':', $opponent_username));
377 377
     }
378 378
 
379 379
     if (_CHESS_GAMETYPE_OPEN == $gametype || _CHESS_GAMETYPE_USER == $gametype) {
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
                 break;
396 396
         }
397 397
 
398
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption));
398
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption));
399 399
 
400 400
         if ('none' != chess_moduleConfig('rating_system')) {
401
-            $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $rated ? _YES : _NO));
401
+            $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $rated ? _YES : _NO));
402 402
         }
403 403
 
404 404
         // Determine whether current user is subscribed to receive a notification when his challenge is accepted.
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     );
468 468
 
469 469
     if ($xoopsDB->getRowsNum($result) < 1) {
470
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
470
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
471 471
     }
472 472
 
473 473
     $row = $xoopsDB->fetchArray($result);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
     $form->addElement(new XoopsFormHidden('challenge_id', $challenge_id));
480 480
 
481
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED . ':', formatTimestamp($row['create_date'], 'm')));
481
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED.':', formatTimestamp($row['create_date'], 'm')));
482 482
 
483 483
     $memberHandler = xoops_getHandler('member');
484 484
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         case _CHESS_GAMETYPE_USER:
490 490
             $player2_user     = $memberHandler->getUser($row['player2_uid']);
491 491
             $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?';
492
-            $label_gametype   = _MD_CHESS_LABEL_GAMETYPE_USER . ': ' . $player2_username;
492
+            $label_gametype   = _MD_CHESS_LABEL_GAMETYPE_USER.': '.$player2_username;
493 493
             break;
494 494
         case _CHESS_GAMETYPE_SELF:
495 495
             $label_gametype = _MD_CHESS_LABEL_GAMETYPE_SELF;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             break;
500 500
     }
501 501
 
502
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype));
502
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype));
503 503
 
504 504
     $player1_user = $memberHandler->getUser($row['player1_uid']);
505 505
 
@@ -507,20 +507,20 @@  discard block
 block discarded – undo
507 507
 
508 508
     $form->addElement(
509 509
         new XoopsFormLabel(
510
-            _MD_CHESS_LABEL_CHALLENGER . ':', "<a href='" . XOOPS_URL . "/modules/chess/player_stats.php?player_uid={$row['player1_uid']}'>$player1_username</a>"
510
+            _MD_CHESS_LABEL_CHALLENGER.':', "<a href='".XOOPS_URL."/modules/chess/player_stats.php?player_uid={$row['player1_uid']}'>$player1_username</a>"
511 511
         )
512 512
     );
513 513
 
514 514
     $player2_username = $xoopsUser ? $xoopsUser->getVar('uname') : '?';
515 515
 
516
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT . ':', $player2_username));
516
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_OPPONENT.':', $player2_username));
517 517
 
518 518
     if (!empty($row['fen'])) {
519
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $row['fen']));
519
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $row['fen']));
520 520
     }
521 521
 
522 522
     if (_CHESS_COLOROPTION_OPPONENT == $row['color_option']) {
523
-        $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR . ':', 'coloroption', _CHESS_COLOROPTION_RANDOM);
523
+        $radio_color = new XoopsFormRadio(_MD_CHESS_LABEL_COLOR.':', 'coloroption', _CHESS_COLOROPTION_RANDOM);
524 524
 
525 525
         $radio_color->addOption(_CHESS_COLOROPTION_RANDOM, _MD_CHESS_RADIO_COLOR_RANDOM);
526 526
 
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
                 break;
546 546
         }
547 547
 
548
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption));
548
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption));
549 549
     }
550 550
 
551 551
     if ('none' != chess_moduleConfig('rating_system')) {
552
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $row['is_rated'] ? _YES : _NO));
552
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $row['is_rated'] ? _YES : _NO));
553 553
     }
554 554
 
555 555
     // Display notification-subscribe checkbox, initially checked.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     );
598 598
 
599 599
     if ($xoopsDB->getRowsNum($result) < 1) {
600
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
600
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
601 601
     }
602 602
 
603 603
     $row = $xoopsDB->fetchArray($result);
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
     }
614 614
 
615 615
     if ($error_msg) {
616
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR . ': ', '<div class="errorMsg">' . $error_msg . '</div>'));
616
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_ERROR.': ', '<div class="errorMsg">'.$error_msg.'</div>'));
617 617
     }
618 618
 
619
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED . ':', formatTimestamp($row['create_date'], 'm')));
619
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_DATE_CREATED.':', formatTimestamp($row['create_date'], 'm')));
620 620
 
621 621
     $memberHandler = xoops_getHandler('member');
622 622
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
         case _CHESS_GAMETYPE_USER:
628 628
             $player2_user     = $memberHandler->getUser($row['player2_uid']);
629 629
             $player2_username = is_object($player2_user) ? $player2_user->getVar('uname') : '?';
630
-            $label_gametype   = _MD_CHESS_LABEL_GAMETYPE_USER . ': ' . $player2_username;
630
+            $label_gametype   = _MD_CHESS_LABEL_GAMETYPE_USER.': '.$player2_username;
631 631
             break;
632 632
         case _CHESS_GAMETYPE_SELF:
633 633
             $label_gametype = _MD_CHESS_LABEL_GAMETYPE_SELF;
@@ -637,16 +637,16 @@  discard block
 block discarded – undo
637 637
             break;
638 638
     }
639 639
 
640
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE . ':', $label_gametype));
640
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_GAMETYPE.':', $label_gametype));
641 641
 
642 642
     $player1_user = $memberHandler->getUser($row['player1_uid']);
643 643
 
644 644
     $player1_username = is_object($player1_user) ? $player1_user->getVar('uname') : '?';
645 645
 
646
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER . ':', $player1_username));
646
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_CHALLENGER.':', $player1_username));
647 647
 
648 648
     if (!empty($row['fen'])) {
649
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP . ':', $row['fen']));
649
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_FEN_SETUP.':', $row['fen']));
650 650
     }
651 651
 
652 652
     switch ($row['color_option']) {
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
             break;
668 668
     }
669 669
 
670
-    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR . ':', $label_coloroption));
670
+    $form->addElement(new XoopsFormLabel(_MD_CHESS_LABEL_COLOR.':', $label_coloroption));
671 671
 
672 672
     if ('none' != chess_moduleConfig('rating_system')) {
673
-        $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME . ':', $row['is_rated'] ? _YES : _NO));
673
+        $form->addElement(new XoopsFormLabel(_MD_CHESS_RATED_GAME.':', $row['is_rated'] ? _YES : _NO));
674 674
     }
675 675
 
676 676
     // Display confirm-delete checkbox, initially unchecked.
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
     );
718 718
 
719 719
     if ($xoopsDB->getRowsNum($result) < 1) {
720
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
720
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
721 721
     }
722 722
 
723 723
     $row = $xoopsDB->fetchArray($result);
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
     $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
728 728
 
729 729
     if (_CHESS_GAMETYPE_USER == $row['game_type'] && $uid != $row['player2_uid']) {
730
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_WRONG_PLAYER2);
730
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_WRONG_PLAYER2);
731 731
     } elseif ($uid == $row['player1_uid']) {
732
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_SAME_PLAYER2);
732
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_SAME_PLAYER2);
733 733
     }
734 734
 
735 735
     switch ($row['color_option']) {
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
     $xoopsDB->query("DELETE FROM $challenges_table WHERE challenge_id = '$challenge_id'");
783 783
 
784 784
     if ($xoopsDB->errno()) {
785
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
785
+        trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR);
786 786
     }
787 787
 
788 788
     // Notify player 1 that his challenge has been accepted (if he has subscribed to the notification).
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 
796 796
     $notificationHandler->triggerEvent('global', 0, 'notify_accept_challenge', $extra_tags, [$row['player1_uid']]);
797 797
 
798
-    redirect_header(XOOPS_URL . "/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
798
+    redirect_header(XOOPS_URL."/modules/chess/game.php?game_id=$game_id", _CHESS_REDIRECT_DELAY_SUCCESS, _MD_CHESS_GAME_CREATED);
799 799
 }
800 800
 
801 801
 /**
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
     $result = $xoopsDB->query("SELECT player1_uid FROM $challenges_table WHERE challenge_id = '$challenge_id'");
814 814
 
815 815
     if ($xoopsDB->getRowsNum($result) < 1) {
816
-        redirect_header(XOOPS_URL . '/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
816
+        redirect_header(XOOPS_URL.'/modules/chess/', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_GAME_NOT_FOUND);
817 817
     }
818 818
 
819 819
     $row = $xoopsDB->fetchArray($result);
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
     );
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
     $challenge_id = $xoopsDB->getInsertId();
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
     $xoopsDB->query("DELETE FROM $table WHERE challenge_id='$challenge_id'");
917 917
 
918 918
     if ($xoopsDB->errno()) {
919
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
919
+        trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR);
920 920
     }
921 921
 }
922 922
 
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
     );
983 983
 
984 984
     if ($xoopsDB->errno()) {
985
-        trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR);
985
+        trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR);
986 986
     }
987 987
 
988 988
     $game_id = $xoopsDB->getInsertId();
Please login to merge, or discard this patch.