Passed
Push — master ( e12440...7742f2 )
by Michael
02:31
created
blocks/blocks.php 1 patch
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.
index.php 1 patch
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.
help.php 1 patch
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.
docs/maketestdata.php 1 patch
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.
language/english/modinfo.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 define('_MI_CHESS', 'Chess');
18 18
 define('_MI_CHESS_DES', 'Allows users to play chess games against each other.');
19 19
 define(
20
-    '_MI_CHESS_CREDITS',
21
-    '
20
+	'_MI_CHESS_CREDITS',
21
+	'
22 22
 	Jacques Masscrier and Pierre François Gagnon (french language pack).
23 23
 	<br>
24 24
 	CXR Rating System used by permission of <a target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</a>
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 define('_MI_CHESS_MAX_ITEMS_DES', 'Applies to games, challenges and players.');
70 70
 define('_MI_CHESS_RATING_SYSTEM', 'Player rating system');
71 71
 define(
72
-    '_MI_CHESS_RATING_SYSTEM_DES',
73
-    '
72
+	'_MI_CHESS_RATING_SYSTEM_DES',
73
+	'
74 74
 	Available rating systems:
75 75
 	<br><br>
76 76
 	&nbsp;&nbsp;' . _MI_CHESS_RATING_SYSTEM_CXR . '    - Adaptation of the ELO rating system, used by permission of <a target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</a>
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 );
86 86
 define('_MI_CHESS_INITIAL_RATING', 'Initial player rating');
87 87
 define(
88
-    '_MI_CHESS_INITIAL_RATING_DES',
89
-    '
88
+	'_MI_CHESS_INITIAL_RATING_DES',
89
+	'
90 90
 	If the "' . _MI_CHESS_RATING_SYSTEM_CXR . '" rating system is selected, this value should be between 800 and 2000.
91 91
 	<br><br>
92 92
 	Applies only if a player rating system is selected.
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 );
97 97
 define('_MI_CHESS_ALLOW_UNRATED', 'Allow unrated games?');
98 98
 define(
99
-    '_MI_CHESS_ALLOW_UNRATED_DES',
100
-    '
99
+	'_MI_CHESS_ALLOW_UNRATED_DES',
100
+	'
101 101
 	When offering a challenge, may the player exclude the game from use in rating calculations?
102 102
 	<br><br>
103 103
 	Applies only if a player rating system is selected.
Please login to merge, or discard this patch.
preloads/core.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
  */
23 23
 class ChessCorePreload extends \XoopsPreloadItem
24 24
 {
25
-    // to add PSR-4 autoloader
26
-    /**
27
-     * @param $args
28
-     */
29
-    public static function eventCoreIncludeCommonEnd($args)
30
-    {
31
-        require __DIR__ . '/autoloader.php';
32
-    }
25
+	// to add PSR-4 autoloader
26
+	/**
27
+	 * @param $args
28
+	 */
29
+	public static function eventCoreIncludeCommonEnd($args)
30
+	{
31
+		require __DIR__ . '/autoloader.php';
32
+	}
33 33
 }
Please login to merge, or discard this patch.
include/notification.inc.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 // but not when viewing the notifications page via notifications.php.
41 41
 global $xoopsConfig;
42 42
 if (file_exists(XOOPS_ROOT_PATH . "/modules/chess/language/{$xoopsConfig['language']}/main.php")) {
43
-    require_once XOOPS_ROOT_PATH . "/modules/chess/language/{$xoopsConfig['language']}/main.php";
43
+	require_once XOOPS_ROOT_PATH . "/modules/chess/language/{$xoopsConfig['language']}/main.php";
44 44
 } else {
45
-    require_once XOOPS_ROOT_PATH . '/modules/chess/language/english/main.php';
45
+	require_once XOOPS_ROOT_PATH . '/modules/chess/language/english/main.php';
46 46
 }
47 47
 /**#@-*/
48 48
 
@@ -57,57 +57,57 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function chess_notify_item_info($category, $item_id)
59 59
 {
60
-    if ('global' == $category) {
61
-        $item['name'] = 'Chess';
60
+	if ('global' == $category) {
61
+		$item['name'] = 'Chess';
62 62
 
63
-        $item['url'] = XOOPS_URL . '/modules/chess/';
63
+		$item['url'] = XOOPS_URL . '/modules/chess/';
64 64
 
65
-        return $item;
66
-    } elseif ('game' == $category) {
67
-        global $xoopsDB;
65
+		return $item;
66
+	} elseif ('game' == $category) {
67
+		global $xoopsDB;
68 68
 
69
-        $table = $xoopsDB->prefix('chess_games');
69
+		$table = $xoopsDB->prefix('chess_games');
70 70
 
71
-        $result = $xoopsDB->query(
72
-            trim(
73
-                "
71
+		$result = $xoopsDB->query(
72
+			trim(
73
+				"
74 74
 			SELECT white_uid, black_uid, UNIX_TIMESTAMP(start_date) AS start_date
75 75
 			FROM   $table
76 76
 			WHERE  game_id = '$item_id'
77 77
 		"
78
-            )
79
-        );
78
+			)
79
+		);
80 80
 
81
-        $gamedata = $xoopsDB->fetchArray($result);
81
+		$gamedata = $xoopsDB->fetchArray($result);
82 82
 
83
-        $xoopsDB->freeRecordSet($result);
83
+		$xoopsDB->freeRecordSet($result);
84 84
 
85
-        if (false !== $gamedata) {
86
-            // get mapping of user IDs to usernames
85
+		if (false !== $gamedata) {
86
+			// get mapping of user IDs to usernames
87 87
 
88
-            $criteria = new \Criteria('uid', "({$gamedata['white_uid']}, {$gamedata['black_uid']})", 'IN');
88
+			$criteria = new \Criteria('uid', "({$gamedata['white_uid']}, {$gamedata['black_uid']})", 'IN');
89 89
 
90
-            $memberHandler = xoops_getHandler('member');
90
+			$memberHandler = xoops_getHandler('member');
91 91
 
92
-            $usernames = $memberHandler->getUserList($criteria);
92
+			$usernames = $memberHandler->getUserList($criteria);
93 93
 
94
-            $username_white = $usernames[$gamedata['white_uid']] ?? _MD_CHESS_NA;
94
+			$username_white = $usernames[$gamedata['white_uid']] ?? _MD_CHESS_NA;
95 95
 
96
-            $username_black = $usernames[$gamedata['black_uid']] ?? _MD_CHESS_NA;
96
+			$username_black = $usernames[$gamedata['black_uid']] ?? _MD_CHESS_NA;
97 97
 
98
-            $date = $gamedata['start_date'] ? date('Y.m.d', $gamedata['start_date']) : _MD_CHESS_NA;
99
-        } else {
100
-            $username_white = _MD_CHESS_NA;
98
+			$date = $gamedata['start_date'] ? date('Y.m.d', $gamedata['start_date']) : _MD_CHESS_NA;
99
+		} else {
100
+			$username_white = _MD_CHESS_NA;
101 101
 
102
-            $username_black = _MD_CHESS_NA;
102
+			$username_black = _MD_CHESS_NA;
103 103
 
104
-            $date = _MD_CHESS_NA;
105
-        }
104
+			$date = _MD_CHESS_NA;
105
+		}
106 106
 
107
-        $item['name'] = "$username_white " . _MD_CHESS_LABEL_VS . " $username_black ($date)";
107
+		$item['name'] = "$username_white " . _MD_CHESS_LABEL_VS . " $username_black ($date)";
108 108
 
109
-        $item['url'] = XOOPS_URL . '/modules/chess/game.php?game_id=' . $item_id;
109
+		$item['url'] = XOOPS_URL . '/modules/chess/game.php?game_id=' . $item_id;
110 110
 
111
-        return $item;
112
-    }
111
+		return $item;
112
+	}
113 113
 }
Please login to merge, or discard this patch.
include/functions.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function chess_sanitize($text, $allowed_characters = 'A-Za-z0-9')
42 42
 {
43
-    $char_class = preg_replace('/(\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\#)/', '\\${1}', $allowed_characters);
44
-    //$char_class = preg_quote($allowed_characters, '/');
45
-    return preg_replace("/[^$char_class]/i", '_', $text);
43
+	$char_class = preg_replace('/(\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\#)/', '\\${1}', $allowed_characters);
44
+	//$char_class = preg_quote($allowed_characters, '/');
45
+	return preg_replace("/[^$char_class]/i", '_', $text);
46 46
 }
47 47
 
48 48
 /**
@@ -53,29 +53,29 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function chess_moduleConfig($option)
55 55
 {
56
-    global $xoopsModule, $xoopsModuleConfig;
56
+	global $xoopsModule, $xoopsModuleConfig;
57 57
 
58
-    $value = null;
58
+	$value = null;
59 59
 
60
-    if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname') && isset($xoopsModuleConfig[$option])) {
61
-        $value = $xoopsModuleConfig[$option];
62
-    } else { // for use within a block
63
-        $moduleHandler = xoops_getHandler('module');
60
+	if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname') && isset($xoopsModuleConfig[$option])) {
61
+		$value = $xoopsModuleConfig[$option];
62
+	} else { // for use within a block
63
+		$moduleHandler = xoops_getHandler('module');
64 64
 
65
-        $module = $moduleHandler->getByDirname('chess');
65
+		$module = $moduleHandler->getByDirname('chess');
66 66
 
67
-        $configHandler = xoops_getHandler('config');
67
+		$configHandler = xoops_getHandler('config');
68 68
 
69
-        $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
69
+		$moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
70 70
 
71
-        if (isset($moduleConfig[$option])) {
72
-            $value = $moduleConfig[$option];
73
-        } else {
74
-            trigger_error("configuration option '$option' not found", E_USER_ERROR);
75
-        }
76
-    }
71
+		if (isset($moduleConfig[$option])) {
72
+			$value = $moduleConfig[$option];
73
+		} else {
74
+			trigger_error("configuration option '$option' not found", E_USER_ERROR);
75
+		}
76
+	}
77 77
 
78
-    return $value;
78
+	return $value;
79 79
 }
80 80
 
81 81
 /**
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function chess_can_play($uid = null)
88 88
 {
89
-    global $xoopsUser;
89
+	global $xoopsUser;
90 90
 
91
-    if (isset($uid)) {
92
-        $memberHandler = xoops_getHandler('member');
91
+	if (isset($uid)) {
92
+		$memberHandler = xoops_getHandler('member');
93 93
 
94
-        $user = $memberHandler->getUser($uid);
95
-    } elseif (is_object($xoopsUser)) {
96
-        $user = $xoopsUser;
97
-    } else {
98
-        $user = null;
99
-    }
94
+		$user = $memberHandler->getUser($uid);
95
+	} elseif (is_object($xoopsUser)) {
96
+		$user = $xoopsUser;
97
+	} else {
98
+		$user = null;
99
+	}
100 100
 
101
-    $groups_play = chess_moduleConfig('groups_play');
101
+	$groups_play = chess_moduleConfig('groups_play');
102 102
 
103
-    $can_play = false;
103
+	$can_play = false;
104 104
 
105
-    if (in_array(XOOPS_GROUP_ANONYMOUS, $groups_play)) {
106
-        $can_play = true;
107
-    } elseif (is_object($user)) {
108
-        $can_play = count(array_intersect($user->getGroups(), $groups_play)) > 0;
109
-    }
105
+	if (in_array(XOOPS_GROUP_ANONYMOUS, $groups_play)) {
106
+		$can_play = true;
107
+	} elseif (is_object($user)) {
108
+		$can_play = count(array_intersect($user->getGroups(), $groups_play)) > 0;
109
+	}
110 110
 
111
-    return $can_play;
111
+	return $can_play;
112 112
 }
113 113
 
114 114
 /**
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function chess_can_delete($uid = null)
121 121
 {
122
-    global $xoopsUser;
122
+	global $xoopsUser;
123 123
 
124
-    if (isset($uid)) {
125
-        $memberHandler = xoops_getHandler('member');
124
+	if (isset($uid)) {
125
+		$memberHandler = xoops_getHandler('member');
126 126
 
127
-        $user = $memberHandler->getUser($uid);
128
-    } elseif (is_object($xoopsUser)) {
129
-        $user = $xoopsUser;
130
-    } else {
131
-        $user = null;
132
-    }
127
+		$user = $memberHandler->getUser($uid);
128
+	} elseif (is_object($xoopsUser)) {
129
+		$user = $xoopsUser;
130
+	} else {
131
+		$user = null;
132
+	}
133 133
 
134
-    $groups_delete = chess_moduleConfig('groups_delete');
134
+	$groups_delete = chess_moduleConfig('groups_delete');
135 135
 
136
-    $can_delete = false;
136
+	$can_delete = false;
137 137
 
138
-    if (in_array(XOOPS_GROUP_ANONYMOUS, $groups_delete)) {
139
-        $can_delete = true;
140
-    } elseif (is_object($user)) {
141
-        $can_delete = count(array_intersect($user->getGroups(), $groups_delete)) > 0;
142
-    }
138
+	if (in_array(XOOPS_GROUP_ANONYMOUS, $groups_delete)) {
139
+		$can_delete = true;
140
+	} elseif (is_object($user)) {
141
+		$can_delete = count(array_intersect($user->getGroups(), $groups_delete)) > 0;
142
+	}
143 143
 
144
-    return $can_delete;
144
+	return $can_delete;
145 145
 }
146 146
 
147 147
 /**
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function chess_to_pgn_string($data)
158 158
 {
159
-    #var_dump('chess_to_pgn_string, data=', $data);#*#DEBUG#
159
+	#var_dump('chess_to_pgn_string, data=', $data);#*#DEBUG#
160 160
 
161
-    if ('0000-00-00 00:00:00' == $data['datetime']) {
162
-        $datetime = '????.??.?? ??:??:??';
163
-    } else {
164
-        $datetime = str_replace('-', '.', $data['datetime']);
165
-    }
161
+	if ('0000-00-00 00:00:00' == $data['datetime']) {
162
+		$datetime = '????.??.?? ??:??:??';
163
+	} else {
164
+		$datetime = str_replace('-', '.', $data['datetime']);
165
+	}
166 166
 
167
-    [$date, $time] = explode(' ', $datetime);
167
+	[$date, $time] = explode(' ', $datetime);
168 168
 
169
-    $movetext = wordwrap($data['movetext'], 75);
169
+	$movetext = wordwrap($data['movetext'], 75);
170 170
 
171
-    $rtn = <<<END
171
+	$rtn = <<<END
172 172
 [Event "{$data['event']}"]
173 173
 [Site "{$data['site']}"]
174 174
 [Date "$date"]
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 
181 181
 END;
182 182
 
183
-    if ($data['setup'] && $data['fen']) {
184
-        $rtn .= "[Setup \"1\"]\n[FEN \"{$data['fen']}\"]\n";
185
-    }
183
+	if ($data['setup'] && $data['fen']) {
184
+		$rtn .= "[Setup \"1\"]\n[FEN \"{$data['fen']}\"]\n";
185
+	}
186 186
 
187
-    $rtn .= "\n$movetext\n";
187
+	$rtn .= "\n$movetext\n";
188 188
 
189
-    return $rtn;
189
+	return $rtn;
190 190
 }
191 191
 
192 192
 /**
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function chess_uname_to_uid($uname)
199 199
 {
200
-    $criteria = new \CriteriaCompo();
200
+	$criteria = new \CriteriaCompo();
201 201
 
202
-    $criteria->add(new \Criteria('uname', MyTextSanitizer::addSlashes($uname)));
202
+	$criteria->add(new \Criteria('uname', MyTextSanitizer::addSlashes($uname)));
203 203
 
204
-    $criteria->setLimit(1);
204
+	$criteria->setLimit(1);
205 205
 
206
-    $memberHandler = xoops_getHandler('member');
206
+	$memberHandler = xoops_getHandler('member');
207 207
 
208
-    $users = $memberHandler->getUserList($criteria);
208
+	$users = $memberHandler->getUserList($criteria);
209 209
 
210
-    $uids = array_keys($users);
210
+	$uids = array_keys($users);
211 211
 
212
-    return $uids[0] ?? 0;
212
+	return $uids[0] ?? 0;
213 213
 }
214 214
 
215 215
 /*** #*#DEBUG# testing something
Please login to merge, or discard this patch.
include/onuninstall.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function xoops_module_pre_uninstall_chess(\XoopsModule $module)
31 31
 {
32
-    // Do some synchronization if needed
32
+	// Do some synchronization if needed
33 33
 
34
-    return true;
34
+	return true;
35 35
 }
36 36
 
37 37
 /**
@@ -42,50 +42,50 @@  discard block
 block discarded – undo
42 42
  */
43 43
 function xoops_module_uninstall_chess(\XoopsModule $module)
44 44
 {
45
-    require __DIR__ . '/common.php';
45
+	require __DIR__ . '/common.php';
46 46
 
47
-    $moduleDirName = basename(dirname(__DIR__));
47
+	$moduleDirName = basename(dirname(__DIR__));
48 48
 
49
-    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
49
+	$moduleDirNameUpper = mb_strtoupper($moduleDirName);
50 50
 
51
-    $helper = Chess\Helper::getInstance();
51
+	$helper = Chess\Helper::getInstance();
52 52
 
53
-    $utility = new Chess\Utility();
54
-    //    $configurator = new Chess\Common\Configurator();
53
+	$utility = new Chess\Utility();
54
+	//    $configurator = new Chess\Common\Configurator();
55 55
 
56
-    // Load language files
56
+	// Load language files
57 57
 
58
-    $helper->loadLanguage('admin');
58
+	$helper->loadLanguage('admin');
59 59
 
60
-    $helper->loadLanguage('common');
60
+	$helper->loadLanguage('common');
61 61
 
62
-    $success = true;
62
+	$success = true;
63 63
 
64
-    //------------------------------------------------------------------
64
+	//------------------------------------------------------------------
65 65
 
66
-    // Remove uploads folder (and all subfolders) if they exist
66
+	// Remove uploads folder (and all subfolders) if they exist
67 67
 
68
-    //------------------------------------------------------------------
68
+	//------------------------------------------------------------------
69 69
 
70
-    $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")];
70
+	$old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")];
71 71
 
72
-    foreach ($old_directories as $old_dir) {
73
-        $dirInfo = new SplFileInfo($old_dir);
72
+	foreach ($old_directories as $old_dir) {
73
+		$dirInfo = new SplFileInfo($old_dir);
74 74
 
75
-        if ($dirInfo->isDir()) {
76
-            // The directory exists so delete it
75
+		if ($dirInfo->isDir()) {
76
+			// The directory exists so delete it
77 77
 
78
-            if (false === $utility::rrmdir($old_dir)) {
79
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
78
+			if (false === $utility::rrmdir($old_dir)) {
79
+				$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
80 80
 
81
-                $success = false;
82
-            }
83
-        }
81
+				$success = false;
82
+			}
83
+		}
84 84
 
85
-        unset($dirInfo);
86
-    }
85
+		unset($dirInfo);
86
+	}
87 87
 
88
-    /*
88
+	/*
89 89
     //------------ START ----------------
90 90
     //------------------------------------------------------------------
91 91
     // Remove xsitemap.xml from XOOPS root folder if it exists
@@ -99,6 +99,6 @@  discard block
 block discarded – undo
99 99
 //    return $success && $delOk; // use this if you're using this routine
100 100
 */
101 101
 
102
-    return $success;
103
-    //------------ END  ----------------
102
+	return $success;
103
+	//------------ END  ----------------
104 104
 }
Please login to merge, or discard this patch.