Passed
Push — master ( e12440...7742f2 )
by Michael
02:31
created
blocks/blocks.php 2 patches
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -48,36 +48,36 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function b_chess_games_show($options)
50 50
 {
51
-    global $xoopsModule, $xoopsDB;
51
+	global $xoopsModule, $xoopsDB;
52 52
 
53
-    // don't display this block within owning module
53
+	// don't display this block within owning module
54 54
 
55
-    if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
56
-        return [];
57
-    }
55
+	if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
56
+		return [];
57
+	}
58 58
 
59
-    $table = $xoopsDB->prefix('chess_games');
59
+	$table = $xoopsDB->prefix('chess_games');
60 60
 
61
-    $limit = (int)$options[0]; // sanitize with intval()
61
+	$limit = (int)$options[0]; // sanitize with intval()
62 62
 
63
-    $where = 'white_uid != black_uid';
63
+	$where = 'white_uid != black_uid';
64 64
 
65
-    switch ($options[1]) {
66
-        case 1:
67
-            $where .= " AND pgn_result = '*'";
68
-            break;
69
-        case 2:
70
-            $where .= " AND pgn_result != '*'";
71
-            break;
72
-    }
65
+	switch ($options[1]) {
66
+		case 1:
67
+			$where .= " AND pgn_result = '*'";
68
+			break;
69
+		case 2:
70
+			$where .= " AND pgn_result != '*'";
71
+			break;
72
+	}
73 73
 
74
-    if (1 == $options[2]) {
75
-        $where .= " AND is_rated = '1'";
76
-    }
74
+	if (1 == $options[2]) {
75
+		$where .= " AND is_rated = '1'";
76
+	}
77 77
 
78
-    $result = $xoopsDB->query(
79
-        trim(
80
-            "
78
+	$result = $xoopsDB->query(
79
+		trim(
80
+			"
81 81
 		SELECT   game_id, fen_active_color, white_uid, black_uid, pgn_result, UNIX_TIMESTAMP(create_date) AS create_date,
82 82
 		         UNIX_TIMESTAMP(start_date) AS start_date, UNIX_TIMESTAMP(last_date) AS last_date,
83 83
 		         UNIX_TIMESTAMP(GREATEST(create_date,start_date,last_date)) AS most_recent_date
@@ -86,59 +86,59 @@  discard block
 block discarded – undo
86 86
 		ORDER BY most_recent_date DESC
87 87
 		LIMIT    $limit
88 88
 	"
89
-        )
90
-    );
89
+		)
90
+	);
91 91
 
92
-    // user IDs that will require mapping to usernames
92
+	// user IDs that will require mapping to usernames
93 93
 
94
-    $userids = [];
94
+	$userids = [];
95 95
 
96
-    $games = [];
96
+	$games = [];
97 97
 
98
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
99
-        $games[] = [
100
-            'game_id'          => $row['game_id'],
101
-            'white_uid'        => $row['white_uid'],
102
-            'black_uid'        => $row['black_uid'],
103
-            'date'             => $row['most_recent_date'],
104
-            'fen_active_color' => $row['fen_active_color'],
105
-            'pgn_result'       => $row['pgn_result'],
106
-        ];
98
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
99
+		$games[] = [
100
+			'game_id'          => $row['game_id'],
101
+			'white_uid'        => $row['white_uid'],
102
+			'black_uid'        => $row['black_uid'],
103
+			'date'             => $row['most_recent_date'],
104
+			'fen_active_color' => $row['fen_active_color'],
105
+			'pgn_result'       => $row['pgn_result'],
106
+		];
107 107
 
108
-        // save user IDs that will require mapping to usernames
108
+		// save user IDs that will require mapping to usernames
109 109
 
110
-        if ($row['white_uid']) {
111
-            $userids[$row['white_uid']] = 1;
112
-        }
110
+		if ($row['white_uid']) {
111
+			$userids[$row['white_uid']] = 1;
112
+		}
113 113
 
114
-        if ($row['black_uid']) {
115
-            $userids[$row['black_uid']] = 1;
116
-        }
117
-    }
114
+		if ($row['black_uid']) {
115
+			$userids[$row['black_uid']] = 1;
116
+		}
117
+	}
118 118
 
119
-    $xoopsDB->freeRecordSet($result);
119
+	$xoopsDB->freeRecordSet($result);
120 120
 
121
-    // get mapping of user IDs to usernames
121
+	// get mapping of user IDs to usernames
122 122
 
123
-    $memberHandler = xoops_getHandler('member');
123
+	$memberHandler = xoops_getHandler('member');
124 124
 
125
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
125
+	$criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
126 126
 
127
-    $usernames = $memberHandler->getUserList($criteria);
127
+	$usernames = $memberHandler->getUserList($criteria);
128 128
 
129
-    // add usernames to $games
129
+	// add usernames to $games
130 130
 
131
-    foreach ($games as $k => $game) {
132
-        $games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?';
131
+	foreach ($games as $k => $game) {
132
+		$games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?';
133 133
 
134
-        $games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?';
135
-    }
134
+		$games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?';
135
+	}
136 136
 
137
-    $block['games'] = $games;
137
+	$block['games'] = $games;
138 138
 
139
-    $block['date_format'] = _SHORTDATESTRING;
139
+	$block['date_format'] = _SHORTDATESTRING;
140 140
 
141
-    return $block;
141
+	return $block;
142 142
 }
143 143
 
144 144
 /**
@@ -149,91 +149,91 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function b_chess_challenges_show($options)
151 151
 {
152
-    global $xoopsModule, $xoopsDB;
152
+	global $xoopsModule, $xoopsDB;
153 153
 
154
-    // don't display this block within owning module
154
+	// don't display this block within owning module
155 155
 
156
-    if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
157
-        return [];
158
-    }
156
+	if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
157
+		return [];
158
+	}
159 159
 
160
-    $table = $xoopsDB->prefix('chess_challenges');
160
+	$table = $xoopsDB->prefix('chess_challenges');
161 161
 
162
-    $limit = (int)$options[0]; // sanitize with intval()
162
+	$limit = (int)$options[0]; // sanitize with intval()
163 163
 
164
-    switch ($options[1]) {
165
-        case 1:
166
-            $where = "game_type = 'open'";
167
-            break;
168
-        case 2:
169
-            $where = "game_type = 'user'";
170
-            break;
171
-        default:
172
-            $where = 1;
173
-            break;
174
-    }
164
+	switch ($options[1]) {
165
+		case 1:
166
+			$where = "game_type = 'open'";
167
+			break;
168
+		case 2:
169
+			$where = "game_type = 'user'";
170
+			break;
171
+		default:
172
+			$where = 1;
173
+			break;
174
+	}
175 175
 
176
-    $result = $xoopsDB->query(
177
-        trim(
178
-            "
176
+	$result = $xoopsDB->query(
177
+		trim(
178
+			"
179 179
 		SELECT   challenge_id, game_type, player1_uid, player2_uid, UNIX_TIMESTAMP(create_date) AS create_date
180 180
 		FROM     $table
181 181
 		WHERE    $where
182 182
 		ORDER BY create_date DESC
183 183
 		LIMIT    $limit
184 184
 	"
185
-        )
186
-    );
185
+		)
186
+	);
187 187
 
188
-    // user IDs that will require mapping to usernames
188
+	// user IDs that will require mapping to usernames
189 189
 
190
-    $userids = [];
190
+	$userids = [];
191 191
 
192
-    $challenges = [];
192
+	$challenges = [];
193 193
 
194
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
195
-        $challenges[] = [
196
-            'challenge_id' => $row['challenge_id'],
197
-            'game_type'    => $row['game_type'],
198
-            'player1_uid'  => $row['player1_uid'],
199
-            'player2_uid'  => $row['player2_uid'],
200
-            'create_date'  => $row['create_date'],
201
-        ];
194
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
195
+		$challenges[] = [
196
+			'challenge_id' => $row['challenge_id'],
197
+			'game_type'    => $row['game_type'],
198
+			'player1_uid'  => $row['player1_uid'],
199
+			'player2_uid'  => $row['player2_uid'],
200
+			'create_date'  => $row['create_date'],
201
+		];
202 202
 
203
-        // save user IDs that will require mapping to usernames
203
+		// save user IDs that will require mapping to usernames
204 204
 
205
-        if ($row['player1_uid']) {
206
-            $userids[$row['player1_uid']] = 1;
207
-        }
205
+		if ($row['player1_uid']) {
206
+			$userids[$row['player1_uid']] = 1;
207
+		}
208 208
 
209
-        if ($row['player2_uid']) {
210
-            $userids[$row['player2_uid']] = 1;
211
-        }
212
-    }
209
+		if ($row['player2_uid']) {
210
+			$userids[$row['player2_uid']] = 1;
211
+		}
212
+	}
213 213
 
214
-    $xoopsDB->freeRecordSet($result);
214
+	$xoopsDB->freeRecordSet($result);
215 215
 
216
-    // get mapping of user IDs to usernames
216
+	// get mapping of user IDs to usernames
217 217
 
218
-    $memberHandler = xoops_getHandler('member');
218
+	$memberHandler = xoops_getHandler('member');
219 219
 
220
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
220
+	$criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
221 221
 
222
-    $usernames = $memberHandler->getUserList($criteria);
222
+	$usernames = $memberHandler->getUserList($criteria);
223 223
 
224
-    // add usernames to $challenges
224
+	// add usernames to $challenges
225 225
 
226
-    foreach ($challenges as $k => $challenge) {
227
-        $challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?';
226
+	foreach ($challenges as $k => $challenge) {
227
+		$challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?';
228 228
 
229
-        $challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?';
230
-    }
229
+		$challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?';
230
+	}
231 231
 
232
-    $block['challenges'] = $challenges;
232
+	$block['challenges'] = $challenges;
233 233
 
234
-    $block['date_format'] = _SHORTDATESTRING;
234
+	$block['date_format'] = _SHORTDATESTRING;
235 235
 
236
-    return $block;
236
+	return $block;
237 237
 }
238 238
 
239 239
 /**
@@ -244,103 +244,103 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function b_chess_players_show($options)
246 246
 {
247
-    global $xoopsModule, $xoopsDB;
247
+	global $xoopsModule, $xoopsDB;
248 248
 
249
-    // don't display this block within owning module
249
+	// don't display this block within owning module
250 250
 
251
-    if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
252
-        return [];
253
-    }
251
+	if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) {
252
+		return [];
253
+	}
254 254
 
255
-    require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
255
+	require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
256 256
 
257
-    $moduleHandler = xoops_getHandler('module');
257
+	$moduleHandler = xoops_getHandler('module');
258 258
 
259
-    $module = $moduleHandler->getByDirname('chess');
259
+	$module = $moduleHandler->getByDirname('chess');
260 260
 
261
-    $configHandler = xoops_getHandler('config');
261
+	$configHandler = xoops_getHandler('config');
262 262
 
263
-    $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
263
+	$moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
264 264
 
265
-    $block['rating_system'] = $moduleConfig['rating_system'];
265
+	$block['rating_system'] = $moduleConfig['rating_system'];
266 266
 
267
-    $block['provisional_games'] = chess_ratings_num_provisional_games();
267
+	$block['provisional_games'] = chess_ratings_num_provisional_games();
268 268
 
269
-    // if ratings disabled, nothing else to do
269
+	// if ratings disabled, nothing else to do
270 270
 
271
-    if ('none' == $moduleConfig['rating_system']) {
272
-        return $block;
273
-    }
271
+	if ('none' == $moduleConfig['rating_system']) {
272
+		return $block;
273
+	}
274 274
 
275
-    $table = $xoopsDB->prefix('chess_ratings');
275
+	$table = $xoopsDB->prefix('chess_ratings');
276 276
 
277
-    $limit = (int)$options[0]; // sanitize with intval()
277
+	$limit = (int)$options[0]; // sanitize with intval()
278 278
 
279
-    switch ($options[1]) {
280
-        case 1:
281
-            $block['show_provisional_ratings'] = false;
282
-            $where                             = "(games_won+games_lost+games_drawn) >= '{$block['provisional_games']}'";
283
-            break;
284
-        case 2:
285
-        default:
286
-            $block['show_provisional_ratings'] = true;
287
-            $where                             = 1;
288
-            break;
289
-    }
279
+	switch ($options[1]) {
280
+		case 1:
281
+			$block['show_provisional_ratings'] = false;
282
+			$where                             = "(games_won+games_lost+games_drawn) >= '{$block['provisional_games']}'";
283
+			break;
284
+		case 2:
285
+		default:
286
+			$block['show_provisional_ratings'] = true;
287
+			$where                             = 1;
288
+			break;
289
+	}
290 290
 
291
-    $result = $xoopsDB->query(
292
-        trim(
293
-            "
291
+	$result = $xoopsDB->query(
292
+		trim(
293
+			"
294 294
 		SELECT   player_uid, rating, (games_won+games_lost+games_drawn) AS games_played
295 295
 		FROM     $table
296 296
 		WHERE    $where
297 297
 		ORDER BY rating DESC, player_uid ASC
298 298
 		LIMIT    $limit
299 299
 	"
300
-        )
301
-    );
300
+		)
301
+	);
302 302
 
303
-    // user IDs that will require mapping to usernames
303
+	// user IDs that will require mapping to usernames
304 304
 
305
-    $userids = [];
305
+	$userids = [];
306 306
 
307
-    $players = [];
307
+	$players = [];
308 308
 
309
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
310
-        $players[] = [
311
-            'player_uid'   => $row['player_uid'],
312
-            'rating'       => $row['rating'],
313
-            'games_played' => $row['games_played'],
314
-        ];
309
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
310
+		$players[] = [
311
+			'player_uid'   => $row['player_uid'],
312
+			'rating'       => $row['rating'],
313
+			'games_played' => $row['games_played'],
314
+		];
315 315
 
316
-        // save user IDs that will require mapping to usernames
316
+		// save user IDs that will require mapping to usernames
317 317
 
318
-        if ($row['player_uid']) {
319
-            $userids[$row['player_uid']] = 1;
320
-        }
321
-    }
318
+		if ($row['player_uid']) {
319
+			$userids[$row['player_uid']] = 1;
320
+		}
321
+	}
322 322
 
323
-    $xoopsDB->freeRecordSet($result);
323
+	$xoopsDB->freeRecordSet($result);
324 324
 
325
-    // get mapping of user IDs to usernames
325
+	// get mapping of user IDs to usernames
326 326
 
327
-    if (!empty($userids)) {
328
-        $memberHandler = xoops_getHandler('member');
327
+	if (!empty($userids)) {
328
+		$memberHandler = xoops_getHandler('member');
329 329
 
330
-        $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
330
+		$criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
331 331
 
332
-        $usernames = $memberHandler->getUserList($criteria);
333
-    }
332
+		$usernames = $memberHandler->getUserList($criteria);
333
+	}
334 334
 
335
-    // add usernames to $players
335
+	// add usernames to $players
336 336
 
337
-    foreach ($players as $k => $player) {
338
-        $players[$k]['player_uname'] = $usernames[$player['player_uid']] ?? '?';
339
-    }
337
+	foreach ($players as $k => $player) {
338
+		$players[$k]['player_uname'] = $usernames[$player['player_uid']] ?? '?';
339
+	}
340 340
 
341
-    $block['players'] = $players;
341
+	$block['players'] = $players;
342 342
 
343
-    return $block;
343
+	return $block;
344 344
 }
345 345
 
346 346
 /**
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
  */
352 352
 function b_chess_games_edit($options)
353 353
 {
354
-    $show_inplay = 1 == $options[1] ? 'checked' : '';
354
+	$show_inplay = 1 == $options[1] ? 'checked' : '';
355 355
 
356
-    $show_concluded = 2 == $options[1] ? 'checked' : '';
356
+	$show_concluded = 2 == $options[1] ? 'checked' : '';
357 357
 
358
-    $show_both = 3 == $options[1] ? 'checked' : '';
358
+	$show_both = 3 == $options[1] ? 'checked' : '';
359 359
 
360
-    $show_rated_only = 1 == $options[2] ? 'checked' : '';
360
+	$show_rated_only = 1 == $options[2] ? 'checked' : '';
361 361
 
362
-    $show_unrated = 2 == $options[2] ? 'checked' : '';
362
+	$show_unrated = 2 == $options[2] ? 'checked' : '';
363 363
 
364
-    return '
364
+	return '
365 365
 		' . _MB_CHESS_NUM_GAMES . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
366 366
 		<br>
367 367
 		<br>
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
  */
384 384
 function b_chess_challenges_edit($options)
385 385
 {
386
-    $show_open = 1 == $options[1] ? 'checked' : '';
386
+	$show_open = 1 == $options[1] ? 'checked' : '';
387 387
 
388
-    $show_user = 2 == $options[1] ? 'checked' : '';
388
+	$show_user = 2 == $options[1] ? 'checked' : '';
389 389
 
390
-    $show_both = 3 == $options[1] ? 'checked' : '';
390
+	$show_both = 3 == $options[1] ? 'checked' : '';
391 391
 
392
-    return '
392
+	return '
393 393
 		' . _MB_CHESS_NUM_CHALLENGES . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
394 394
 		<br>
395 395
 		<input type='radio' name='options[1]' value='1' $show_open> " . _MB_CHESS_SHOW_CHALLENGES_OPEN . "
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function b_chess_players_edit($options)
408 408
 {
409
-    $show_nonprovisional = 1 == $options[1] ? 'checked' : '';
409
+	$show_nonprovisional = 1 == $options[1] ? 'checked' : '';
410 410
 
411
-    $show_all = 2 == $options[1] ? 'checked' : '';
411
+	$show_all = 2 == $options[1] ? 'checked' : '';
412 412
 
413
-    return '
413
+	return '
414 414
 		' . _MB_CHESS_NUM_PLAYERS . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
415 415
 		<br>
416 416
 		<input type='radio' name='options[1]' value='1' $show_nonprovisional> " . _MB_CHESS_SHOW_NONPROVISIONAL . "
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 /**#@+
38 38
  */
39
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
40
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
39
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
40
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
41 41
 /**#@-*/
42 42
 
43 43
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     $table = $xoopsDB->prefix('chess_games');
60 60
 
61
-    $limit = (int)$options[0]; // sanitize with intval()
61
+    $limit = (int) $options[0]; // sanitize with intval()
62 62
 
63 63
     $where = 'white_uid != black_uid';
64 64
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
     $memberHandler = xoops_getHandler('member');
124 124
 
125
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
125
+    $criteria = new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN');
126 126
 
127 127
     $usernames = $memberHandler->getUserList($criteria);
128 128
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     $table = $xoopsDB->prefix('chess_challenges');
161 161
 
162
-    $limit = (int)$options[0]; // sanitize with intval()
162
+    $limit = (int) $options[0]; // sanitize with intval()
163 163
 
164 164
     switch ($options[1]) {
165 165
         case 1:
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
     $memberHandler = xoops_getHandler('member');
219 219
 
220
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
220
+    $criteria = new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN');
221 221
 
222 222
     $usernames = $memberHandler->getUserList($criteria);
223 223
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         return [];
253 253
     }
254 254
 
255
-    require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.php';
255
+    require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.php';
256 256
 
257 257
     $moduleHandler = xoops_getHandler('module');
258 258
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
     $table = $xoopsDB->prefix('chess_ratings');
276 276
 
277
-    $limit = (int)$options[0]; // sanitize with intval()
277
+    $limit = (int) $options[0]; // sanitize with intval()
278 278
 
279 279
     switch ($options[1]) {
280 280
         case 1:
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     if (!empty($userids)) {
328 328
         $memberHandler = xoops_getHandler('member');
329 329
 
330
-        $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
330
+        $criteria = new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN');
331 331
 
332 332
         $usernames = $memberHandler->getUserList($criteria);
333 333
     }
@@ -362,16 +362,16 @@  discard block
 block discarded – undo
362 362
     $show_unrated = 2 == $options[2] ? 'checked' : '';
363 363
 
364 364
     return '
365
-		' . _MB_CHESS_NUM_GAMES . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
365
+		' . _MB_CHESS_NUM_GAMES.": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
366 366
 		<br>
367 367
 		<br>
368
-		<input type='radio' name='options[1]' value='1' $show_inplay    > " . _MB_CHESS_SHOW_GAMES_INPLAY . "
369
-		<input type='radio' name='options[1]' value='2' $show_concluded > " . _MB_CHESS_SHOW_GAMES_CONCLUDED . "
370
-		<input type='radio' name='options[1]' value='3' $show_both      > " . _MB_CHESS_SHOW_GAMES_BOTH . "
368
+		<input type='radio' name='options[1]' value='1' $show_inplay    > "._MB_CHESS_SHOW_GAMES_INPLAY."
369
+		<input type='radio' name='options[1]' value='2' $show_concluded > "._MB_CHESS_SHOW_GAMES_CONCLUDED."
370
+		<input type='radio' name='options[1]' value='3' $show_both      > "._MB_CHESS_SHOW_GAMES_BOTH."
371 371
 		<br>
372 372
 		<br>
373
-		<input type='radio' name='options[2]' value='1' $show_rated_only> " . _MB_CHESS_SHOW_GAMES_RATED . "
374
-		<input type='radio' name='options[2]' value='2' $show_unrated   > " . _MB_CHESS_SHOW_GAMES_UNRATED . '
373
+		<input type='radio' name='options[2]' value='1' $show_rated_only> "._MB_CHESS_SHOW_GAMES_RATED."
374
+		<input type='radio' name='options[2]' value='2' $show_unrated   > "._MB_CHESS_SHOW_GAMES_UNRATED.'
375 375
 	';
376 376
 }
377 377
 
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
     $show_both = 3 == $options[1] ? 'checked' : '';
391 391
 
392 392
     return '
393
-		' . _MB_CHESS_NUM_CHALLENGES . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
393
+		' . _MB_CHESS_NUM_CHALLENGES.": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
394 394
 		<br>
395
-		<input type='radio' name='options[1]' value='1' $show_open> " . _MB_CHESS_SHOW_CHALLENGES_OPEN . "
396
-		<input type='radio' name='options[1]' value='2' $show_user> " . _MB_CHESS_SHOW_CHALLENGES_USER . "
397
-		<input type='radio' name='options[1]' value='3' $show_both> " . _MB_CHESS_SHOW_CHALLENGES_BOTH . '
395
+		<input type='radio' name='options[1]' value='1' $show_open> "._MB_CHESS_SHOW_CHALLENGES_OPEN."
396
+		<input type='radio' name='options[1]' value='2' $show_user> "._MB_CHESS_SHOW_CHALLENGES_USER."
397
+		<input type='radio' name='options[1]' value='3' $show_both> "._MB_CHESS_SHOW_CHALLENGES_BOTH.'
398 398
 	';
399 399
 }
400 400
 
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
     $show_all = 2 == $options[1] ? 'checked' : '';
412 412
 
413 413
     return '
414
-		' . _MB_CHESS_NUM_PLAYERS . ": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
414
+		' . _MB_CHESS_NUM_PLAYERS.": <input type='text' name='options[0]' value='{$options[0]}' size='3' maxlength='3'>
415 415
 		<br>
416
-		<input type='radio' name='options[1]' value='1' $show_nonprovisional> " . _MB_CHESS_SHOW_NONPROVISIONAL . "
417
-		<input type='radio' name='options[1]' value='2' $show_all           > " . _MB_CHESS_SHOW_ALL_RATINGS . '
416
+		<input type='radio' name='options[1]' value='1' $show_nonprovisional> "._MB_CHESS_SHOW_NONPROVISIONAL."
417
+		<input type='radio' name='options[1]' value='2' $show_all           > "._MB_CHESS_SHOW_ALL_RATINGS.'
418 418
 	';
419 419
 }
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -47,98 +47,98 @@  discard block
 block discarded – undo
47 47
 
48 48
 #var_dump($_REQUEST);#*#DEBUG#
49 49
 
50
-    global $xoopsDB, $xoopsTpl;
50
+	global $xoopsDB, $xoopsTpl;
51 51
 
52
-    // ----------
52
+	// ----------
53 53
 
54
-    // user input
54
+	// user input
55 55
 
56
-    // ----------
56
+	// ----------
57 57
 
58
-    // offset of first row of challenges table to display (default to 0)
58
+	// offset of first row of challenges table to display (default to 0)
59 59
 
60
-    $cstart = (int)($_POST['cstart'] ?? @$_GET['cstart']);
60
+	$cstart = (int)($_POST['cstart'] ?? @$_GET['cstart']);
61 61
 
62
-    // offset of first row of games table to display (default to 0)
62
+	// offset of first row of games table to display (default to 0)
63 63
 
64
-    $gstart = (int)($_POST['gstart'] ?? @$_GET['gstart']);
64
+	$gstart = (int)($_POST['gstart'] ?? @$_GET['gstart']);
65 65
 
66
-    // challenges display option
66
+	// challenges display option
67 67
 
68
-    $cshow = (int)($_POST['cshow'] ?? @$_GET['cshow']);
68
+	$cshow = (int)($_POST['cshow'] ?? @$_GET['cshow']);
69 69
 
70
-    // games display option 1
70
+	// games display option 1
71 71
 
72
-    $gshow1 = (int)($_POST['gshow1'] ?? @$_GET['gshow1']);
72
+	$gshow1 = (int)($_POST['gshow1'] ?? @$_GET['gshow1']);
73 73
 
74
-    // games display option 2
74
+	// games display option 2
75 75
 
76
-    $gshow2 = (int)($_POST['gshow2'] ?? @$_GET['gshow2']);
76
+	$gshow2 = (int)($_POST['gshow2'] ?? @$_GET['gshow2']);
77 77
 
78
-    // set show-options to default if undefined
78
+	// set show-options to default if undefined
79 79
 
80
-    if (!$cshow) {
81
-        $cshow = _CHESS_SHOW_CHALLENGES_BOTH;
82
-    }
80
+	if (!$cshow) {
81
+		$cshow = _CHESS_SHOW_CHALLENGES_BOTH;
82
+	}
83 83
 
84
-    if (!$gshow1) {
85
-        $gshow1 = _CHESS_SHOW_GAMES_BOTH;
86
-    }
84
+	if (!$gshow1) {
85
+		$gshow1 = _CHESS_SHOW_GAMES_BOTH;
86
+	}
87 87
 
88
-    if (!$gshow2) {
89
-        $gshow2 = _CHESS_SHOW_GAMES_UNRATED;
90
-    }
88
+	if (!$gshow2) {
89
+		$gshow2 = _CHESS_SHOW_GAMES_UNRATED;
90
+	}
91 91
 
92
-    // get maximum number of items to display on a page, and constrain it to a reasonable value
92
+	// get maximum number of items to display on a page, and constrain it to a reasonable value
93 93
 
94
-    $max_items_to_display = chess_moduleConfig('max_items');
94
+	$max_items_to_display = chess_moduleConfig('max_items');
95 95
 
96
-    $max_items_to_display = min(max($max_items_to_display, 1), 1000);
96
+	$max_items_to_display = min(max($max_items_to_display, 1), 1000);
97 97
 
98
-    $xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING);
98
+	$xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING);
99 99
 
100
-    // user IDs that will require mapping to usernames
100
+	// user IDs that will require mapping to usernames
101 101
 
102
-    $userids = [];
102
+	$userids = [];
103 103
 
104
-    // -----
104
+	// -----
105 105
 
106
-    // games
106
+	// games
107 107
 
108
-    // -----
108
+	// -----
109 109
 
110
-    // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
110
+	// Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
111 111
 
112
-    // and one with a limit clause to get the data for display on the current page.
112
+	// and one with a limit clause to get the data for display on the current page.
113 113
 
114
-    // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
114
+	// SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
115 115
 
116
-    $games_table = $xoopsDB->prefix('chess_games');
116
+	$games_table = $xoopsDB->prefix('chess_games');
117 117
 
118
-    $where = 'white_uid != black_uid';
118
+	$where = 'white_uid != black_uid';
119 119
 
120
-    switch ($gshow1) {
121
-        case 1:
122
-            $where .= " AND pgn_result = '*'";
123
-            break;
124
-        case 2:
125
-            $where .= " AND pgn_result != '*'";
126
-            break;
127
-    }
120
+	switch ($gshow1) {
121
+		case 1:
122
+			$where .= " AND pgn_result = '*'";
123
+			break;
124
+		case 2:
125
+			$where .= " AND pgn_result != '*'";
126
+			break;
127
+	}
128 128
 
129
-    if (1 == $gshow2) {
130
-        $where .= " AND is_rated = '1'";
131
-    }
129
+	if (1 == $gshow2) {
130
+		$where .= " AND is_rated = '1'";
131
+	}
132 132
 
133
-    $result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where");
133
+	$result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where");
134 134
 
135
-    [$num_games] = $xoopsDB->fetchRow($result);
135
+	[$num_games] = $xoopsDB->fetchRow($result);
136 136
 
137
-    $xoopsDB->freeRecordSet($result);
137
+	$xoopsDB->freeRecordSet($result);
138 138
 
139
-    $result = $xoopsDB->query(
140
-        trim(
141
-            "
139
+	$result = $xoopsDB->query(
140
+		trim(
141
+			"
142 142
 		SELECT   game_id, fen_active_color, white_uid, black_uid, pgn_result, is_rated,
143 143
 			UNIX_TIMESTAMP(GREATEST(create_date,start_date,last_date)) AS last_activity
144 144
 		FROM     $games_table
@@ -146,211 +146,211 @@  discard block
 block discarded – undo
146 146
 		ORDER BY last_activity DESC
147 147
 		LIMIT    $gstart, $max_items_to_display
148 148
 	"
149
-        )
150
-    );
149
+		)
150
+	);
151 151
 
152
-    $games = [];
152
+	$games = [];
153 153
 
154
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
155
-        $games[] = [
156
-            'game_id'          => $row['game_id'],
157
-            'white_uid'        => $row['white_uid'],
158
-            'black_uid'        => $row['black_uid'],
159
-            'last_activity'    => $row['last_activity'],
160
-            'fen_active_color' => $row['fen_active_color'],
161
-            'pgn_result'       => $row['pgn_result'],
162
-            'is_rated'         => $row['is_rated'],
163
-        ];
154
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
155
+		$games[] = [
156
+			'game_id'          => $row['game_id'],
157
+			'white_uid'        => $row['white_uid'],
158
+			'black_uid'        => $row['black_uid'],
159
+			'last_activity'    => $row['last_activity'],
160
+			'fen_active_color' => $row['fen_active_color'],
161
+			'pgn_result'       => $row['pgn_result'],
162
+			'is_rated'         => $row['is_rated'],
163
+		];
164 164
 
165
-        // save user IDs that will require mapping to usernames
165
+		// save user IDs that will require mapping to usernames
166 166
 
167
-        if ($row['white_uid']) {
168
-            $userids[$row['white_uid']] = 1;
169
-        }
167
+		if ($row['white_uid']) {
168
+			$userids[$row['white_uid']] = 1;
169
+		}
170 170
 
171
-        if ($row['black_uid']) {
172
-            $userids[$row['black_uid']] = 1;
173
-        }
174
-    }
171
+		if ($row['black_uid']) {
172
+			$userids[$row['black_uid']] = 1;
173
+		}
174
+	}
175 175
 
176
-    $xoopsDB->freeRecordSet($result);
176
+	$xoopsDB->freeRecordSet($result);
177 177
 
178
-    $games_pagenav = new XoopsPageNav($num_games, $max_items_to_display, $gstart, 'gstart', "cstart=$cstart&amp;cshow=$cshow&amp;gshow1=$gshow1&amp;gshow2=$gshow2");
178
+	$games_pagenav = new XoopsPageNav($num_games, $max_items_to_display, $gstart, 'gstart', "cstart=$cstart&amp;cshow=$cshow&amp;gshow1=$gshow1&amp;gshow2=$gshow2");
179 179
 
180
-    $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav());
180
+	$xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav());
181 181
 
182
-    // ----------
182
+	// ----------
183 183
 
184
-    // challenges
184
+	// challenges
185 185
 
186
-    // ----------
186
+	// ----------
187 187
 
188
-    // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
188
+	// Two queries are performed, one without a limit clause to count the total number of rows for the page navigator,
189 189
 
190
-    // and one with a limit clause to get the data for display on the current page.
190
+	// and one with a limit clause to get the data for display on the current page.
191 191
 
192
-    // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
192
+	// SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this.
193 193
 
194
-    $challenges_table = $xoopsDB->prefix('chess_challenges');
194
+	$challenges_table = $xoopsDB->prefix('chess_challenges');
195 195
 
196
-    switch ($cshow) {
197
-        case _CHESS_SHOW_CHALLENGES_OPEN:
198
-            $where = "game_type = 'open'";
199
-            break;
200
-        case _CHESS_SHOW_CHALLENGES_USER:
201
-            $where = "game_type = 'user'";
202
-            break;
203
-        default:
204
-            $where = 1;
205
-            break;
206
-    }
196
+	switch ($cshow) {
197
+		case _CHESS_SHOW_CHALLENGES_OPEN:
198
+			$where = "game_type = 'open'";
199
+			break;
200
+		case _CHESS_SHOW_CHALLENGES_USER:
201
+			$where = "game_type = 'user'";
202
+			break;
203
+		default:
204
+			$where = 1;
205
+			break;
206
+	}
207 207
 
208
-    $result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where");
208
+	$result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where");
209 209
 
210
-    [$num_challenges] = $xoopsDB->fetchRow($result);
210
+	[$num_challenges] = $xoopsDB->fetchRow($result);
211 211
 
212
-    $xoopsDB->freeRecordSet($result);
212
+	$xoopsDB->freeRecordSet($result);
213 213
 
214
-    $result = $xoopsDB->query(
215
-        trim(
216
-            "
214
+	$result = $xoopsDB->query(
215
+		trim(
216
+			"
217 217
 		SELECT   challenge_id, game_type, color_option, player1_uid, player2_uid, UNIX_TIMESTAMP(create_date) AS create_date, is_rated
218 218
 		FROM     $challenges_table
219 219
 		WHERE    $where
220 220
 		ORDER BY create_date DESC
221 221
 		LIMIT    $cstart, $max_items_to_display
222 222
 	"
223
-        )
224
-    );
223
+		)
224
+	);
225 225
 
226
-    $challenges = [];
226
+	$challenges = [];
227 227
 
228
-    while (false !== ($row = $xoopsDB->fetchArray($result))) {
229
-        $challenges[] = [
230
-            'challenge_id' => $row['challenge_id'],
231
-            'game_type'    => $row['game_type'],
232
-            'color_option' => $row['color_option'],
233
-            'player1_uid'  => $row['player1_uid'],
234
-            'player2_uid'  => $row['player2_uid'],
235
-            'create_date'  => $row['create_date'],
236
-            'is_rated'     => $row['is_rated'],
237
-        ];
228
+	while (false !== ($row = $xoopsDB->fetchArray($result))) {
229
+		$challenges[] = [
230
+			'challenge_id' => $row['challenge_id'],
231
+			'game_type'    => $row['game_type'],
232
+			'color_option' => $row['color_option'],
233
+			'player1_uid'  => $row['player1_uid'],
234
+			'player2_uid'  => $row['player2_uid'],
235
+			'create_date'  => $row['create_date'],
236
+			'is_rated'     => $row['is_rated'],
237
+		];
238 238
 
239
-        // save user IDs that will require mapping to usernames
239
+		// save user IDs that will require mapping to usernames
240 240
 
241
-        if ($row['player1_uid']) {
242
-            $userids[$row['player1_uid']] = 1;
243
-        }
241
+		if ($row['player1_uid']) {
242
+			$userids[$row['player1_uid']] = 1;
243
+		}
244 244
 
245
-        if ($row['player2_uid']) {
246
-            $userids[$row['player2_uid']] = 1;
247
-        }
248
-    }
245
+		if ($row['player2_uid']) {
246
+			$userids[$row['player2_uid']] = 1;
247
+		}
248
+	}
249 249
 
250
-    $xoopsDB->freeRecordSet($result);
250
+	$xoopsDB->freeRecordSet($result);
251 251
 
252
-    $challenges_pagenav = new XoopsPageNav($num_challenges, $max_items_to_display, $cstart, 'cstart', "gstart=$gstart&amp;cshow=$cshow&amp;gshow1=$gshow1&amp;gshow2=$gshow2");
252
+	$challenges_pagenav = new XoopsPageNav($num_challenges, $max_items_to_display, $cstart, 'cstart', "gstart=$gstart&amp;cshow=$cshow&amp;gshow1=$gshow1&amp;gshow2=$gshow2");
253 253
 
254
-    $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav());
254
+	$xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav());
255 255
 
256
-    // ---------
256
+	// ---------
257 257
 
258
-    // usernames
258
+	// usernames
259 259
 
260
-    // ---------
260
+	// ---------
261 261
 
262
-    // get mapping of user IDs to usernames
262
+	// get mapping of user IDs to usernames
263 263
 
264
-    $memberHandler = xoops_getHandler('member');
264
+	$memberHandler = xoops_getHandler('member');
265 265
 
266
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
266
+	$criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
267 267
 
268
-    $usernames = $memberHandler->getUserList($criteria);
268
+	$usernames = $memberHandler->getUserList($criteria);
269 269
 
270
-    // add usernames to $games
270
+	// add usernames to $games
271 271
 
272
-    foreach ($games as $k => $game) {
273
-        $games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?';
272
+	foreach ($games as $k => $game) {
273
+		$games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?';
274 274
 
275
-        $games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?';
276
-    }
275
+		$games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?';
276
+	}
277 277
 
278
-    // add usernames to $challenges
278
+	// add usernames to $challenges
279 279
 
280
-    foreach ($challenges as $k => $challenge) {
281
-        $challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?';
280
+	foreach ($challenges as $k => $challenge) {
281
+		$challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?';
282 282
 
283
-        $challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?';
284
-    }
283
+		$challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?';
284
+	}
285 285
 
286
-    $xoopsTpl->assign('chess_games', $games);
286
+	$xoopsTpl->assign('chess_games', $games);
287 287
 
288
-    $xoopsTpl->assign('chess_challenges', $challenges);
288
+	$xoopsTpl->assign('chess_challenges', $challenges);
289 289
 
290
-    $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system'));
290
+	$xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system'));
291 291
 
292
-    // -----
292
+	// -----
293 293
 
294
-    // forms
294
+	// forms
295 295
 
296
-    // -----
296
+	// -----
297 297
 
298
-    // security token not needed for this form
298
+	// security token not needed for this form
299 299
 
300
-    $form1 = new XoopsThemeForm('', 'form1', 'index.php');
300
+	$form1 = new XoopsThemeForm('', 'form1', 'index.php');
301 301
 
302
-    $form1->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
302
+	$form1->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
303 303
 
304
-    $menu_cshow = new XoopsFormSelect('', 'cshow', $cshow, 1, false);
304
+	$menu_cshow = new XoopsFormSelect('', 'cshow', $cshow, 1, false);
305 305
 
306
-    $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_OPEN, _MD_CHESS_SHOW_CHALLENGES_OPEN);
306
+	$menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_OPEN, _MD_CHESS_SHOW_CHALLENGES_OPEN);
307 307
 
308
-    $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_USER, _MD_CHESS_SHOW_CHALLENGES_USER);
308
+	$menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_USER, _MD_CHESS_SHOW_CHALLENGES_USER);
309 309
 
310
-    $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_BOTH, _MD_CHESS_SHOW_CHALLENGES_BOTH);
310
+	$menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_BOTH, _MD_CHESS_SHOW_CHALLENGES_BOTH);
311 311
 
312
-    $form1->addElement($menu_cshow);
312
+	$form1->addElement($menu_cshow);
313 313
 
314
-    $form1->addElement(new XoopsFormHidden('gstart', $gstart));
314
+	$form1->addElement(new XoopsFormHidden('gstart', $gstart));
315 315
 
316
-    $form1->addElement(new XoopsFormHidden('gshow1', $gshow1));
316
+	$form1->addElement(new XoopsFormHidden('gshow1', $gshow1));
317 317
 
318
-    $form1->addElement(new XoopsFormHidden('gshow2', $gshow2));
318
+	$form1->addElement(new XoopsFormHidden('gshow2', $gshow2));
319 319
 
320
-    $form1->assign($xoopsTpl);
320
+	$form1->assign($xoopsTpl);
321 321
 
322
-    // security token not needed for this form
322
+	// security token not needed for this form
323 323
 
324
-    $form2 = new XoopsThemeForm('', 'form2', 'index.php');
324
+	$form2 = new XoopsThemeForm('', 'form2', 'index.php');
325 325
 
326
-    $form2->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
326
+	$form2->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit'));
327 327
 
328
-    $menu_gshow1 = new XoopsFormSelect('', 'gshow1', $gshow1, 1, false);
328
+	$menu_gshow1 = new XoopsFormSelect('', 'gshow1', $gshow1, 1, false);
329 329
 
330
-    $menu_gshow1->addOption(_CHESS_SHOW_GAMES_INPLAY, _MD_CHESS_SHOW_GAMES_INPLAY);
330
+	$menu_gshow1->addOption(_CHESS_SHOW_GAMES_INPLAY, _MD_CHESS_SHOW_GAMES_INPLAY);
331 331
 
332
-    $menu_gshow1->addOption(_CHESS_SHOW_GAMES_CONCLUDED, _MD_CHESS_SHOW_GAMES_CONCLUDED);
332
+	$menu_gshow1->addOption(_CHESS_SHOW_GAMES_CONCLUDED, _MD_CHESS_SHOW_GAMES_CONCLUDED);
333 333
 
334
-    $menu_gshow1->addOption(_CHESS_SHOW_GAMES_BOTH, _MD_CHESS_SHOW_GAMES_BOTH);
334
+	$menu_gshow1->addOption(_CHESS_SHOW_GAMES_BOTH, _MD_CHESS_SHOW_GAMES_BOTH);
335 335
 
336
-    $form2->addElement($menu_gshow1);
336
+	$form2->addElement($menu_gshow1);
337 337
 
338
-    $menu_gshow2 = new XoopsFormSelect('', 'gshow2', $gshow2, 1, false);
338
+	$menu_gshow2 = new XoopsFormSelect('', 'gshow2', $gshow2, 1, false);
339 339
 
340
-    $menu_gshow2->addOption(_CHESS_SHOW_GAMES_RATED, _MD_CHESS_SHOW_GAMES_RATED);
340
+	$menu_gshow2->addOption(_CHESS_SHOW_GAMES_RATED, _MD_CHESS_SHOW_GAMES_RATED);
341 341
 
342
-    $menu_gshow2->addOption(_CHESS_SHOW_GAMES_UNRATED, _MD_CHESS_SHOW_GAMES_UNRATED);
342
+	$menu_gshow2->addOption(_CHESS_SHOW_GAMES_UNRATED, _MD_CHESS_SHOW_GAMES_UNRATED);
343 343
 
344
-    $form2->addElement($menu_gshow2);
344
+	$form2->addElement($menu_gshow2);
345 345
 
346
-    $form2->addElement(new XoopsFormHidden('cstart', $cstart));
346
+	$form2->addElement(new XoopsFormHidden('cstart', $cstart));
347 347
 
348
-    $form2->addElement(new XoopsFormHidden('cshow', $cshow));
348
+	$form2->addElement(new XoopsFormHidden('cshow', $cshow));
349 349
 
350
-    $form2->assign($xoopsTpl);
350
+	$form2->assign($xoopsTpl);
351 351
 
352
-    #*#DEBUG# - trying something unrelated to the chess module
353
-    /***
352
+	#*#DEBUG# - trying something unrelated to the chess module
353
+	/***
354 354
      * $configHandler = xoops_getHandler('config');
355 355
      * $clist = $configHandler->getConfigList(18);
356 356
      * var_dump('clist', $clist);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 
38 38
 /**#@+
39 39
  */
40
-require dirname(__DIR__, 2) . '/mainfile.php';
40
+require dirname(__DIR__, 2).'/mainfile.php';
41 41
 $GLOBALS['xoopsOption']['template_main'] = 'chess_games.tpl';
42
-require_once XOOPS_ROOT_PATH . '/header.php';
43
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
44
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
45
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php';
46
-require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php';
42
+require_once XOOPS_ROOT_PATH.'/header.php';
43
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
44
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
45
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php';
46
+require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php';
47 47
 
48 48
 #var_dump($_REQUEST);#*#DEBUG#
49 49
 
@@ -57,23 +57,23 @@  discard block
 block discarded – undo
57 57
 
58 58
     // offset of first row of challenges table to display (default to 0)
59 59
 
60
-    $cstart = (int)($_POST['cstart'] ?? @$_GET['cstart']);
60
+    $cstart = (int) ($_POST['cstart'] ?? @$_GET['cstart']);
61 61
 
62 62
     // offset of first row of games table to display (default to 0)
63 63
 
64
-    $gstart = (int)($_POST['gstart'] ?? @$_GET['gstart']);
64
+    $gstart = (int) ($_POST['gstart'] ?? @$_GET['gstart']);
65 65
 
66 66
     // challenges display option
67 67
 
68
-    $cshow = (int)($_POST['cshow'] ?? @$_GET['cshow']);
68
+    $cshow = (int) ($_POST['cshow'] ?? @$_GET['cshow']);
69 69
 
70 70
     // games display option 1
71 71
 
72
-    $gshow1 = (int)($_POST['gshow1'] ?? @$_GET['gshow1']);
72
+    $gshow1 = (int) ($_POST['gshow1'] ?? @$_GET['gshow1']);
73 73
 
74 74
     // games display option 2
75 75
 
76
-    $gshow2 = (int)($_POST['gshow2'] ?? @$_GET['gshow2']);
76
+    $gshow2 = (int) ($_POST['gshow2'] ?? @$_GET['gshow2']);
77 77
 
78 78
     // set show-options to default if undefined
79 79
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
     $memberHandler = xoops_getHandler('member');
265 265
 
266
-    $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN');
266
+    $criteria = new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN');
267 267
 
268 268
     $usernames = $memberHandler->getUserList($criteria);
269 269
 
@@ -355,4 +355,4 @@  discard block
 block discarded – undo
355 355
      * $clist = $configHandler->getConfigList(18);
356 356
      * var_dump('clist', $clist);
357 357
      ***/
358
-include_once XOOPS_ROOT_PATH . '/footer.php';
358
+include_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
testdata/index.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 use XoopsModules\Chess\Common;
20 20
 use XoopsModules\Chess\Utility;
21 21
 
22
-require_once dirname(__DIR__, 3) . '/include/cp_header.php';
23
-require dirname(__DIR__) . '/preloads/autoloader.php';
22
+require_once dirname(__DIR__, 3).'/include/cp_header.php';
23
+require dirname(__DIR__).'/preloads/autoloader.php';
24 24
 
25 25
 $op = \Xmf\Request::getCmd('op', '');
26 26
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         } else {
43 43
             xoops_cp_header();
44 44
 
45
-            xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true);
45
+            xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA_OK')), constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM'), true);
46 46
 
47 47
             xoops_cp_footer();
48 48
         }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 
71 71
     $language = 'english/';
72 72
 
73
-    if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) {
74
-        $language = $xoopsConfig['language'] . '/';
73
+    if (is_dir(__DIR__.'/'.$xoopsConfig['language'])) {
74
+        $language = $xoopsConfig['language'].'/';
75 75
     }
76 76
 
77 77
     foreach ($tables as $table) {
78
-        $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml');
78
+        $tabledata = \Xmf\Yaml::readWrapped($language.$table.'.yml');
79 79
 
80 80
         if (is_array($tabledata)) {
81 81
             \Xmf\Database\TableLoad::truncateTable($table);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
     }
100 100
 
101
-    redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS'));
101
+    redirect_header('../admin/index.php', 1, constant('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS'));
102 102
 }
103 103
 
104 104
 function saveSampleData()
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 
114 114
     $language = 'english/';
115 115
 
116
-    if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) {
117
-        $language = $xoopsConfig['language'] . '/';
116
+    if (is_dir(__DIR__.'/'.$xoopsConfig['language'])) {
117
+        $language = $xoopsConfig['language'].'/';
118 118
     }
119 119
 
120
-    $languageFolder = __DIR__ . '/' . $language;
120
+    $languageFolder = __DIR__.'/'.$language;
121 121
 
122
-    if (!file_exists($languageFolder . '/')) {
123
-        Utility::createFolder($languageFolder . '/');
122
+    if (!file_exists($languageFolder.'/')) {
123
+        Utility::createFolder($languageFolder.'/');
124 124
     }
125 125
 
126
-    $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/';
126
+    $exportFolder = $languageFolder.'/Exports-'.date('Y-m-d-H-i-s').'/';
127 127
 
128 128
     Utility::createFolder($exportFolder);
129 129
 
130 130
     foreach ($tables as $table) {
131
-        \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml');
131
+        \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder.$table.'.yml');
132 132
     }
133 133
 
134
-    redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS'));
134
+    redirect_header('../admin/index.php', 1, constant('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS'));
135 135
 }
136 136
 
137 137
 function exportSchema()
@@ -147,6 +147,6 @@  discard block
 block discarded – undo
147 147
         //
148 148
         //        redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS'));
149 149
     } catch (\Throwable $e) {
150
-        exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR'));
150
+        exit(constant('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_ERROR'));
151 151
     }
152 152
 }
Please login to merge, or discard this patch.
comment_edit.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_edit.php';
38
+require dirname(__DIR__, 2).'/mainfile.php';
39
+require XOOPS_ROOT_PATH.'/include/comment_edit.php';
40 40
 /**#@-*/
Please login to merge, or discard this patch.
help.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@
 block discarded – undo
40 40
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
41 41
 require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php';
42 42
 if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/help.php')) {
43
-    require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/help.php';
43
+	require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/help.php';
44 44
 } else {
45
-    require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/help.php';
45
+	require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/help.php';
46 46
 }
47 47
 
48 48
 $rating_system          = chess_moduleConfig('rating_system');
49 49
 $rating_system_des_name = '_HE_CHESS_RATINGS_' . mb_strtoupper($rating_system);
50 50
 if (defined($rating_system_des_name)) {
51
-    $rating_system_des = constant($rating_system_des_name);
51
+	$rating_system_des = constant($rating_system_des_name);
52 52
 } else {
53
-    // missing constant definition - display name of constant for diagnostic use
53
+	// missing constant definition - display name of constant for diagnostic use
54 54
 
55
-    $rating_system_des = $rating_system_des_name;
55
+	$rating_system_des = $rating_system_des_name;
56 56
 }
57 57
 
58 58
 $xoopsTpl->assign('chess_allow_setup', chess_moduleConfig('allow_setup'));
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 
36 36
 /**#@+
37 37
  */
38
-require_once XOOPS_ROOT_PATH . '/header.php';
38
+require_once XOOPS_ROOT_PATH.'/header.php';
39 39
 $GLOBALS['xoopsOption']['template_main']                  = 'chess_help.tpl';
40 40
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching
41
-require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php';
42
-if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/help.php')) {
43
-    require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/help.php';
41
+require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/functions.php';
42
+if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php')) {
43
+    require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/help.php';
44 44
 } else {
45
-    require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/help.php';
45
+    require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/help.php';
46 46
 }
47 47
 
48 48
 $rating_system          = chess_moduleConfig('rating_system');
49
-$rating_system_des_name = '_HE_CHESS_RATINGS_' . mb_strtoupper($rating_system);
49
+$rating_system_des_name = '_HE_CHESS_RATINGS_'.mb_strtoupper($rating_system);
50 50
 if (defined($rating_system_des_name)) {
51 51
     $rating_system_des = constant($rating_system_des_name);
52 52
 } else {
@@ -62,6 +62,6 @@  discard block
 block discarded – undo
62 62
 $xoopsTpl->assign('chess_allow_delete', chess_can_delete());
63 63
 $xoopsTpl->assign('chess_is_admin', is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid')));
64 64
 
65
-require_once XOOPS_ROOT_PATH . '/footer.php';
65
+require_once XOOPS_ROOT_PATH.'/footer.php';
66 66
 
67 67
 /**#@-*/
Please login to merge, or discard this patch.
docs/maketestdata.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -30,63 +30,63 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function perform()
32 32
 {
33
-    $challenges_table = 'chess_challenges';
33
+	$challenges_table = 'chess_challenges';
34 34
 
35
-    $games_table = 'chess_games';
35
+	$games_table = 'chess_games';
36 36
 
37
-    $ratings_table = 'chess_ratings';
37
+	$ratings_table = 'chess_ratings';
38 38
 
39
-    mysqli_connect(DBHOST, DBUSER, DBPASS) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
39
+	mysqli_connect(DBHOST, DBUSER, DBPASS) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
40 40
 
41
-    mysqli_select_db($GLOBALS['xoopsDB']->conn, DBNAME) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
41
+	mysqli_select_db($GLOBALS['xoopsDB']->conn, DBNAME) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
42 42
 
43
-    // For safety, don't generate test data unless the tables are empty.
43
+	// For safety, don't generate test data unless the tables are empty.
44 44
 
45
-    if (!table_empty($challenges_table) || !table_empty($games_table) || !table_empty($ratings_table)) {
46
-        echo "Tables already contain data - no action performed.\n";
45
+	if (!table_empty($challenges_table) || !table_empty($games_table) || !table_empty($ratings_table)) {
46
+		echo "Tables already contain data - no action performed.\n";
47 47
 
48
-        exit;
49
-    }
48
+		exit;
49
+	}
50 50
 
51
-    // Generate the challenges table
51
+	// Generate the challenges table
52 52
 
53
-    $game_types = ['open', 'user'];
53
+	$game_types = ['open', 'user'];
54 54
 
55
-    $color_options = ['player2', 'random', 'white', 'black'];
55
+	$color_options = ['player2', 'random', 'white', 'black'];
56 56
 
57
-    for ($i = 0; $i < NUM_CHALLENGES; ++$i) {
58
-        $game_type = rand_array_value($game_types);
57
+	for ($i = 0; $i < NUM_CHALLENGES; ++$i) {
58
+		$game_type = rand_array_value($game_types);
59 59
 
60
-        $fen_index = random_int(1, 10);
60
+		$fen_index = random_int(1, 10);
61 61
 
62
-        $fen = 10 == $fen_index ? 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' : '';
62
+		$fen = 10 == $fen_index ? 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' : '';
63 63
 
64
-        $color_option = rand_array_value($color_options);
64
+		$color_option = rand_array_value($color_options);
65 65
 
66
-        $notify_move_player1 = random_int(0, 1);
66
+		$notify_move_player1 = random_int(0, 1);
67 67
 
68
-        $player1_uid = random_int(1, NUM_USERS);
68
+		$player1_uid = random_int(1, NUM_USERS);
69 69
 
70
-        if ('open' == $game_type) {
71
-            $player2_uid = 0;
72
-        } else {
73
-            // select $player2_uid != $player1_uid
70
+		if ('open' == $game_type) {
71
+			$player2_uid = 0;
72
+		} else {
73
+			// select $player2_uid != $player1_uid
74 74
 
75
-            do {
76
-                $player2_uid = random_int(1, NUM_USERS);
77
-            } while ($player2_uid == $player1_uid);
78
-        }
75
+			do {
76
+				$player2_uid = random_int(1, NUM_USERS);
77
+			} while ($player2_uid == $player1_uid);
78
+		}
79 79
 
80
-        $create_date_max = time();
80
+		$create_date_max = time();
81 81
 
82
-        $create_date_min = $create_date_max - 30 * 24 * 3600;
82
+		$create_date_min = $create_date_max - 30 * 24 * 3600;
83 83
 
84
-        $create_date = date('Y-m-d H:i:s', random_int($create_date_min, $create_date_max));
84
+		$create_date = date('Y-m-d H:i:s', random_int($create_date_min, $create_date_max));
85 85
 
86
-        $is_rated = random_int(0, 1);
86
+		$is_rated = random_int(0, 1);
87 87
 
88
-        do_query(
89
-            "
88
+		do_query(
89
+			"
90 90
 			INSERT INTO $challenges_table
91 91
 			SET
92 92
 				game_type           = '$game_type',
@@ -98,68 +98,68 @@  discard block
 block discarded – undo
98 98
 				create_date         = '$create_date',
99 99
 				is_rated            = '$is_rated'
100 100
 		"
101
-        );
102
-    }
101
+		);
102
+	}
103 103
 
104
-    // Generate the games table
104
+	// Generate the games table
105 105
 
106
-    $pgn_results = ['*', '0-1', '1-0', '1/2-1/2'];
106
+	$pgn_results = ['*', '0-1', '1-0', '1/2-1/2'];
107 107
 
108
-    $suspended_explains = ['foo', 'bar', 'baz', 'quux'];
108
+	$suspended_explains = ['foo', 'bar', 'baz', 'quux'];
109 109
 
110
-    for ($i = 0; $i < NUM_GAMES; ++$i) {
111
-        $white_uid = random_int(1, NUM_USERS);
110
+	for ($i = 0; $i < NUM_GAMES; ++$i) {
111
+		$white_uid = random_int(1, NUM_USERS);
112 112
 
113
-        $black_uid = random_int(1, NUM_USERS);
113
+		$black_uid = random_int(1, NUM_USERS);
114 114
 
115
-        // Force some games to be self-play.
115
+		// Force some games to be self-play.
116 116
 
117
-        if (10 == random_int(1, 10)) {
118
-            $black_uid = $white_uid;
119
-        }
117
+		if (10 == random_int(1, 10)) {
118
+			$black_uid = $white_uid;
119
+		}
120 120
 
121
-        $create_date_max = time();
121
+		$create_date_max = time();
122 122
 
123
-        $create_date_min = $create_date_max - 365 * 24 * 3600;
123
+		$create_date_min = $create_date_max - 365 * 24 * 3600;
124 124
 
125
-        $create_date_sec = random_int($create_date_min, $create_date_max);
125
+		$create_date_sec = random_int($create_date_min, $create_date_max);
126 126
 
127
-        $create_date = date('Y-m-d H:i:s', $create_date_sec);
127
+		$create_date = date('Y-m-d H:i:s', $create_date_sec);
128 128
 
129
-        $is_started = random_int(1, 4) < 4;
129
+		$is_started = random_int(1, 4) < 4;
130 130
 
131
-        $start_date_sec = $is_started ? $create_date_sec + random_int(3600, 3 * 24 * 3600) : 0;
131
+		$start_date_sec = $is_started ? $create_date_sec + random_int(3600, 3 * 24 * 3600) : 0;
132 132
 
133
-        $start_date = $is_started ? date('Y-m-d H:i:s', $start_date_sec) : '0000-00-00 00:00:00';
133
+		$start_date = $is_started ? date('Y-m-d H:i:s', $start_date_sec) : '0000-00-00 00:00:00';
134 134
 
135
-        $multiple_moves = $is_started && random_int(1, 10) < 10;
135
+		$multiple_moves = $is_started && random_int(1, 10) < 10;
136 136
 
137
-        $last_date_sec = $multiple_moves ? $start_date_sec + random_int(3600, 90 * 24 * 3600) : 0;
137
+		$last_date_sec = $multiple_moves ? $start_date_sec + random_int(3600, 90 * 24 * 3600) : 0;
138 138
 
139
-        $last_date = $multiple_moves ? date('Y-m-d H:i:s', $last_date_sec) : '0000-00-00 00:00:00';
139
+		$last_date = $multiple_moves ? date('Y-m-d H:i:s', $last_date_sec) : '0000-00-00 00:00:00';
140 140
 
141
-        $pgn_result = $multiple_moves ? rand_array_value($pgn_results) : '*';
141
+		$pgn_result = $multiple_moves ? rand_array_value($pgn_results) : '*';
142 142
 
143
-        if ($multiple_moves && '*' == $pgn_result && 5 == random_int(1, 5)) {
144
-            $suspended_date = date('Y-m-d H:i:s', $last_date_sec + random_int(60, 72 * 3600));
143
+		if ($multiple_moves && '*' == $pgn_result && 5 == random_int(1, 5)) {
144
+			$suspended_date = date('Y-m-d H:i:s', $last_date_sec + random_int(60, 72 * 3600));
145 145
 
146
-            $suspended_uids = [1, $white_uid, $black_uid];
146
+			$suspended_uids = [1, $white_uid, $black_uid];
147 147
 
148
-            $suspended_uid = rand_array_value($suspended_uids);
148
+			$suspended_uid = rand_array_value($suspended_uids);
149 149
 
150
-            $suspended_type = 1 == $suspended_uid ? 'arbiter_suspend' : 'want_arbitration';
150
+			$suspended_type = 1 == $suspended_uid ? 'arbiter_suspend' : 'want_arbitration';
151 151
 
152
-            $suspended_explain = rand_array_value($suspended_explains);
152
+			$suspended_explain = rand_array_value($suspended_explains);
153 153
 
154
-            $suspended = "$suspended_date|$suspended_uid|$suspended_type|$suspended_explain";
155
-        } else {
156
-            $suspended = '';
157
-        }
154
+			$suspended = "$suspended_date|$suspended_uid|$suspended_type|$suspended_explain";
155
+		} else {
156
+			$suspended = '';
157
+		}
158 158
 
159
-        $is_rated = $white_uid != $black_uid ? random_int(0, 1) : 0;
159
+		$is_rated = $white_uid != $black_uid ? random_int(0, 1) : 0;
160 160
 
161
-        do_query(
162
-            "
161
+		do_query(
162
+			"
163 163
 			INSERT INTO $games_table
164 164
 			SET
165 165
 				white_uid   = '$white_uid',
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 				suspended   = '$suspended',
172 172
 				is_rated    = '$is_rated'
173 173
 		"
174
-        );
175
-    }
174
+		);
175
+	}
176 176
 
177
-    $GLOBALS['xoopsDB']->close();
177
+	$GLOBALS['xoopsDB']->close();
178 178
 }
179 179
 
180 180
 /**
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function table_empty($table)
187 187
 {
188
-    $result = do_query("SELECT COUNT(*) FROM $table");
188
+	$result = do_query("SELECT COUNT(*) FROM $table");
189 189
 
190
-    [$num_rows] = $GLOBALS['xoopsDB']->fetchRow($result);
190
+	[$num_rows] = $GLOBALS['xoopsDB']->fetchRow($result);
191 191
 
192
-    $GLOBALS['xoopsDB']->freeRecordSet($result);
192
+	$GLOBALS['xoopsDB']->freeRecordSet($result);
193 193
 
194
-    return 0 == $num_rows;
194
+	return 0 == $num_rows;
195 195
 }
196 196
 
197 197
 /**
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
  */
205 205
 function do_query($query)
206 206
 {
207
-    $result = $GLOBALS['xoopsDB']->queryF($query);
207
+	$result = $GLOBALS['xoopsDB']->queryF($query);
208 208
 
209
-    if (false === $result) {
210
-        $errno = $GLOBALS['xoopsDB']->errno();
209
+	if (false === $result) {
210
+		$errno = $GLOBALS['xoopsDB']->errno();
211 211
 
212
-        $error = $GLOBALS['xoopsDB']->error();
212
+		$error = $GLOBALS['xoopsDB']->error();
213 213
 
214
-        trigger_error("[$errno] $error\n$query", E_USER_ERROR);
215
-    }
214
+		trigger_error("[$errno] $error\n$query", E_USER_ERROR);
215
+	}
216 216
 
217
-    return $result;
217
+	return $result;
218 218
 }
219 219
 
220 220
 /**
@@ -223,5 +223,5 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function rand_array_value($array)
225 225
 {
226
-    return $array[array_rand($array)];
226
+	return $array[array_rand($array)];
227 227
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
 
37 37
     $ratings_table = 'chess_ratings';
38 38
 
39
-    mysqli_connect(DBHOST, DBUSER, DBPASS) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
39
+    mysqli_connect(DBHOST, DBUSER, DBPASS) or trigger_error('['.$GLOBALS['xoopsDB']->errno().'] '.$GLOBALS['xoopsDB']->error(), E_USER_ERROR);
40 40
 
41
-    mysqli_select_db($GLOBALS['xoopsDB']->conn, DBNAME) or trigger_error('[' . $GLOBALS['xoopsDB']->errno() . '] ' . $GLOBALS['xoopsDB']->error(), E_USER_ERROR);
41
+    mysqli_select_db($GLOBALS['xoopsDB']->conn, DBNAME) or trigger_error('['.$GLOBALS['xoopsDB']->errno().'] '.$GLOBALS['xoopsDB']->error(), E_USER_ERROR);
42 42
 
43 43
     // For safety, don't generate test data unless the tables are empty.
44 44
 
Please login to merge, or discard this patch.
comment_new.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_new.php';
38
+require dirname(__DIR__, 2).'/mainfile.php';
39
+require XOOPS_ROOT_PATH.'/include/comment_new.php';
40 40
 /**#@-*/
Please login to merge, or discard this patch.
notification_update.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
 
10 10
 /**#@+
11 11
  */
12
-require dirname(__DIR__, 2) . '/mainfile.php';
13
-require XOOPS_ROOT_PATH . '/include/notification_update.php';
12
+require dirname(__DIR__, 2).'/mainfile.php';
13
+require XOOPS_ROOT_PATH.'/include/notification_update.php';
14 14
 /**#@-*/
Please login to merge, or discard this patch.
language/english/filechecker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
  * @ignore
15 15
  */
16 16
 
17
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE', "<span style='color: green;'>Available</span>");
18
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE', "<span style='color: red;'>Not available</span>");
19
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTWRITABLE', "<span style='color: red;'>Should have permission ( %d ), but it has ( %d )</span>");
20
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_COPYTHEFILE', 'Copy it');
21
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE', 'Create it');
22
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_SETMPERM', 'Set the permission');
23
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED', 'The file has been copied');
24
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED', 'The file cannot be copied');
25
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_PERMSET', 'The permission has been set');
26
-define('CO_' . $moduleDirNameUpper . '_' . 'FC_PERMNOTSET', 'The permission cannot be set');
17
+define('CO_'.$moduleDirNameUpper.'_'.'FC_AVAILABLE', "<span style='color: green;'>Available</span>");
18
+define('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE', "<span style='color: red;'>Not available</span>");
19
+define('CO_'.$moduleDirNameUpper.'_'.'FC_NOTWRITABLE', "<span style='color: red;'>Should have permission ( %d ), but it has ( %d )</span>");
20
+define('CO_'.$moduleDirNameUpper.'_'.'FC_COPYTHEFILE', 'Copy it');
21
+define('CO_'.$moduleDirNameUpper.'_'.'FC_CREATETHEFILE', 'Create it');
22
+define('CO_'.$moduleDirNameUpper.'_'.'FC_SETMPERM', 'Set the permission');
23
+define('CO_'.$moduleDirNameUpper.'_'.'FC_FILECOPIED', 'The file has been copied');
24
+define('CO_'.$moduleDirNameUpper.'_'.'FC_FILENOTCOPIED', 'The file cannot be copied');
25
+define('CO_'.$moduleDirNameUpper.'_'.'FC_PERMSET', 'The permission has been set');
26
+define('CO_'.$moduleDirNameUpper.'_'.'FC_PERMNOTSET', 'The permission cannot be set');
27 27
 
28 28
 /**#@-*/
Please login to merge, or discard this patch.