@@ -41,28 +41,28 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function chess_ratings_adj($gid) |
| 43 | 43 | { |
| 44 | - global $xoopsDB; |
|
| 44 | + global $xoopsDB; |
|
| 45 | 45 | |
| 46 | - $rating_system = chess_moduleConfig('rating_system'); |
|
| 46 | + $rating_system = chess_moduleConfig('rating_system'); |
|
| 47 | 47 | |
| 48 | - $init_rating = chess_moduleConfig('initial_rating'); |
|
| 48 | + $init_rating = chess_moduleConfig('initial_rating'); |
|
| 49 | 49 | |
| 50 | - if ('none' == $rating_system) { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 50 | + if ('none' == $rating_system) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // determine function for calculating new ratings using configured rating system |
|
| 54 | + // determine function for calculating new ratings using configured rating system |
|
| 55 | 55 | |
| 56 | - $func = chess_ratings_get_func_adj($rating_system); |
|
| 56 | + $func = chess_ratings_get_func_adj($rating_system); |
|
| 57 | 57 | |
| 58 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 58 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 59 | 59 | |
| 60 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 60 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 61 | 61 | |
| 62 | - // get the game info |
|
| 62 | + // get the game info |
|
| 63 | 63 | |
| 64 | - $result = $xoopsDB->query( |
|
| 65 | - " |
|
| 64 | + $result = $xoopsDB->query( |
|
| 65 | + " |
|
| 66 | 66 | SELECT |
| 67 | 67 | g.white_uid AS white_uid, g.black_uid AS black_uid, g.pgn_result AS pgn_result, w.rating AS white_rating, b.rating AS black_rating, |
| 68 | 68 | (w.games_won+w.games_lost+w.games_drawn) AS white_games, (b.games_won+b.games_lost+b.games_drawn) AS black_games |
@@ -72,77 +72,77 @@ discard block |
||
| 72 | 72 | WHERE g.game_id = '$gid' AND g.is_rated = '1' AND g.pgn_result != '*' |
| 73 | 73 | AND (w.player_uid IS NULL OR b.player_uid IS NULL OR w.player_uid != b.player_uid) |
| 74 | 74 | " |
| 75 | - ); |
|
| 75 | + ); |
|
| 76 | 76 | |
| 77 | - // check that game exists and is rated |
|
| 77 | + // check that game exists and is rated |
|
| 78 | 78 | |
| 79 | - if (1 != $xoopsDB->getRowsNum($result)) { |
|
| 80 | - return false; |
|
| 81 | - } |
|
| 79 | + if (1 != $xoopsDB->getRowsNum($result)) { |
|
| 80 | + return false; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $row = $xoopsDB->fetchArray($result); |
|
| 83 | + $row = $xoopsDB->fetchArray($result); |
|
| 84 | 84 | |
| 85 | - $xoopsDB->freeRecordSet($result); |
|
| 85 | + $xoopsDB->freeRecordSet($result); |
|
| 86 | 86 | |
| 87 | - #var_dump($row);#*#DEBUG# |
|
| 87 | + #var_dump($row);#*#DEBUG# |
|
| 88 | 88 | |
| 89 | - // make sure the users are in the players' table |
|
| 89 | + // make sure the users are in the players' table |
|
| 90 | 90 | |
| 91 | - $value_list = []; |
|
| 91 | + $value_list = []; |
|
| 92 | 92 | |
| 93 | - if (!isset($row['white_rating'])) { |
|
| 94 | - $row['white_rating'] = $init_rating; |
|
| 93 | + if (!isset($row['white_rating'])) { |
|
| 94 | + $row['white_rating'] = $init_rating; |
|
| 95 | 95 | |
| 96 | - $row['white_games'] = 0; |
|
| 96 | + $row['white_games'] = 0; |
|
| 97 | 97 | |
| 98 | - $value_list[] = "('{$row['white_uid']}','{$row['white_rating']}')"; |
|
| 99 | - } |
|
| 98 | + $value_list[] = "('{$row['white_uid']}','{$row['white_rating']}')"; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - if (!isset($row['black_rating'])) { |
|
| 102 | - $row['black_rating'] = $init_rating; |
|
| 101 | + if (!isset($row['black_rating'])) { |
|
| 102 | + $row['black_rating'] = $init_rating; |
|
| 103 | 103 | |
| 104 | - $row['black_games'] = 0; |
|
| 104 | + $row['black_games'] = 0; |
|
| 105 | 105 | |
| 106 | - $value_list[] = "('{$row['black_uid']}','{$row['black_rating']}')"; |
|
| 107 | - } |
|
| 106 | + $value_list[] = "('{$row['black_uid']}','{$row['black_rating']}')"; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - if (!empty($value_list)) { |
|
| 110 | - $values = implode(',', $value_list); |
|
| 109 | + if (!empty($value_list)) { |
|
| 110 | + $values = implode(',', $value_list); |
|
| 111 | 111 | |
| 112 | - $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating) VALUES $values"); |
|
| 112 | + $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating) VALUES $values"); |
|
| 113 | 113 | |
| 114 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 115 | - } |
|
| 114 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - // calculate new ratings using configured rating system |
|
| 117 | + // calculate new ratings using configured rating system |
|
| 118 | 118 | |
| 119 | - [$white_rating_new, $black_rating_new] = $func($row['white_rating'], $row['white_games'], $row['black_rating'], $row['black_games'], $row['pgn_result']); |
|
| 119 | + [$white_rating_new, $black_rating_new] = $func($row['white_rating'], $row['white_games'], $row['black_rating'], $row['black_games'], $row['pgn_result']); |
|
| 120 | 120 | |
| 121 | - // determine game-count columns to increment |
|
| 121 | + // determine game-count columns to increment |
|
| 122 | 122 | |
| 123 | - [$white_col, $black_col] = chess_ratings_get_columns($row['pgn_result']); |
|
| 123 | + [$white_col, $black_col] = chess_ratings_get_columns($row['pgn_result']); |
|
| 124 | 124 | |
| 125 | - $xoopsDB->query( |
|
| 126 | - " |
|
| 125 | + $xoopsDB->query( |
|
| 126 | + " |
|
| 127 | 127 | UPDATE $ratings_table |
| 128 | 128 | SET rating = '$white_rating_new', $white_col = $white_col + 1 |
| 129 | 129 | WHERE player_uid = '{$row['white_uid']}' |
| 130 | 130 | " |
| 131 | - ); |
|
| 131 | + ); |
|
| 132 | 132 | |
| 133 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 133 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 134 | 134 | |
| 135 | - $xoopsDB->query( |
|
| 136 | - " |
|
| 135 | + $xoopsDB->query( |
|
| 136 | + " |
|
| 137 | 137 | UPDATE $ratings_table |
| 138 | 138 | SET rating = '$black_rating_new', $black_col = $black_col + 1 |
| 139 | 139 | WHERE player_uid = '{$row['black_uid']}' |
| 140 | 140 | " |
| 141 | - ); |
|
| 141 | + ); |
|
| 142 | 142 | |
| 143 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 143 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 144 | 144 | |
| 145 | - return true; |
|
| 145 | + return true; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -152,98 +152,98 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function chess_recalc_ratings() |
| 154 | 154 | { |
| 155 | - global $xoopsDB; |
|
| 155 | + global $xoopsDB; |
|
| 156 | 156 | |
| 157 | - $rating_system = chess_moduleConfig('rating_system'); |
|
| 157 | + $rating_system = chess_moduleConfig('rating_system'); |
|
| 158 | 158 | |
| 159 | - $init_rating = chess_moduleConfig('initial_rating'); |
|
| 159 | + $init_rating = chess_moduleConfig('initial_rating'); |
|
| 160 | 160 | |
| 161 | - if ('none' == $rating_system) { |
|
| 162 | - return false; |
|
| 163 | - } |
|
| 161 | + if ('none' == $rating_system) { |
|
| 162 | + return false; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - // determine function for calculating new ratings using configured rating system |
|
| 165 | + // determine function for calculating new ratings using configured rating system |
|
| 166 | 166 | |
| 167 | - $func = chess_ratings_get_func_adj($rating_system); |
|
| 167 | + $func = chess_ratings_get_func_adj($rating_system); |
|
| 168 | 168 | |
| 169 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 169 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 170 | 170 | |
| 171 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 171 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 172 | 172 | |
| 173 | - // Nuke the current ratings. #*#TBD# - don't want to empty this table, since there will be other info in it besides ratings (?) |
|
| 173 | + // Nuke the current ratings. #*#TBD# - don't want to empty this table, since there will be other info in it besides ratings (?) |
|
| 174 | 174 | |
| 175 | - $xoopsDB->query("DELETE FROM $ratings_table"); |
|
| 175 | + $xoopsDB->query("DELETE FROM $ratings_table"); |
|
| 176 | 176 | |
| 177 | - // get all games |
|
| 177 | + // get all games |
|
| 178 | 178 | |
| 179 | - $result = $xoopsDB->query( |
|
| 180 | - " |
|
| 179 | + $result = $xoopsDB->query( |
|
| 180 | + " |
|
| 181 | 181 | SELECT white_uid, black_uid, pgn_result |
| 182 | 182 | FROM $games_table |
| 183 | 183 | WHERE is_rated = '1' AND pgn_result != '*' AND white_uid != black_uid |
| 184 | 184 | ORDER BY last_date ASC |
| 185 | 185 | " |
| 186 | - ); |
|
| 186 | + ); |
|
| 187 | 187 | |
| 188 | - $players = []; |
|
| 188 | + $players = []; |
|
| 189 | 189 | |
| 190 | - // process the games |
|
| 190 | + // process the games |
|
| 191 | 191 | |
| 192 | - while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 193 | - #var_dump($row);#*#DEBUG# |
|
| 192 | + while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 193 | + #var_dump($row);#*#DEBUG# |
|
| 194 | 194 | |
| 195 | - if (!isset($players[$row['white_uid']])) { |
|
| 196 | - $players[$row['white_uid']] = ['rating' => $init_rating, 'games_won' => 0, 'games_lost' => 0, 'games_drawn' => 0]; |
|
| 197 | - } |
|
| 195 | + if (!isset($players[$row['white_uid']])) { |
|
| 196 | + $players[$row['white_uid']] = ['rating' => $init_rating, 'games_won' => 0, 'games_lost' => 0, 'games_drawn' => 0]; |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - if (!isset($players[$row['black_uid']])) { |
|
| 200 | - $players[$row['black_uid']] = ['rating' => $init_rating, 'games_won' => 0, 'games_lost' => 0, 'games_drawn' => 0]; |
|
| 201 | - } |
|
| 199 | + if (!isset($players[$row['black_uid']])) { |
|
| 200 | + $players[$row['black_uid']] = ['rating' => $init_rating, 'games_won' => 0, 'games_lost' => 0, 'games_drawn' => 0]; |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - $player_white = &$players[$row['white_uid']]; |
|
| 203 | + $player_white = &$players[$row['white_uid']]; |
|
| 204 | 204 | |
| 205 | - $player_black = &$players[$row['black_uid']]; |
|
| 205 | + $player_black = &$players[$row['black_uid']]; |
|
| 206 | 206 | |
| 207 | - // calculate new ratings using configured rating system |
|
| 207 | + // calculate new ratings using configured rating system |
|
| 208 | 208 | |
| 209 | - [$white_rating_new, $black_rating_new] = $func( |
|
| 210 | - $player_white['rating'], |
|
| 211 | - $player_white['games_won'] + $player_white['games_lost'] + $player_white['games_drawn'], |
|
| 212 | - $player_black['rating'], |
|
| 213 | - $player_black['games_won'] + $player_black['games_lost'] + $player_black['games_drawn'], |
|
| 214 | - $row['pgn_result'] |
|
| 215 | - ); |
|
| 209 | + [$white_rating_new, $black_rating_new] = $func( |
|
| 210 | + $player_white['rating'], |
|
| 211 | + $player_white['games_won'] + $player_white['games_lost'] + $player_white['games_drawn'], |
|
| 212 | + $player_black['rating'], |
|
| 213 | + $player_black['games_won'] + $player_black['games_lost'] + $player_black['games_drawn'], |
|
| 214 | + $row['pgn_result'] |
|
| 215 | + ); |
|
| 216 | 216 | |
| 217 | - // determine game-count columns to increment |
|
| 217 | + // determine game-count columns to increment |
|
| 218 | 218 | |
| 219 | - [$white_col, $black_col] = chess_ratings_get_columns($row['pgn_result']); |
|
| 219 | + [$white_col, $black_col] = chess_ratings_get_columns($row['pgn_result']); |
|
| 220 | 220 | |
| 221 | - $player_white['rating'] = $white_rating_new; |
|
| 221 | + $player_white['rating'] = $white_rating_new; |
|
| 222 | 222 | |
| 223 | - ++$player_white[$white_col]; |
|
| 223 | + ++$player_white[$white_col]; |
|
| 224 | 224 | |
| 225 | - $player_black['rating'] = $black_rating_new; |
|
| 225 | + $player_black['rating'] = $black_rating_new; |
|
| 226 | 226 | |
| 227 | - ++$player_black[$black_col]; |
|
| 228 | - } |
|
| 227 | + ++$player_black[$black_col]; |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - $xoopsDB->freeRecordSet($result); |
|
| 230 | + $xoopsDB->freeRecordSet($result); |
|
| 231 | 231 | |
| 232 | - if (!empty($players)) { |
|
| 233 | - $value_list = []; |
|
| 232 | + if (!empty($players)) { |
|
| 233 | + $value_list = []; |
|
| 234 | 234 | |
| 235 | - foreach ($players as $player_uid => $player) { |
|
| 236 | - $value_list[] = "('$player_uid', '{$player['rating']}', '{$player['games_won']}', '{$player['games_lost']}', '{$player['games_drawn']}')"; |
|
| 237 | - } |
|
| 235 | + foreach ($players as $player_uid => $player) { |
|
| 236 | + $value_list[] = "('$player_uid', '{$player['rating']}', '{$player['games_won']}', '{$player['games_lost']}', '{$player['games_drawn']}')"; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - $values = implode(',', $value_list); |
|
| 239 | + $values = implode(',', $value_list); |
|
| 240 | 240 | |
| 241 | - $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating, games_won, games_lost, games_drawn) VALUES $values"); |
|
| 241 | + $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating, games_won, games_lost, games_drawn) VALUES $values"); |
|
| 242 | 242 | |
| 243 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 244 | - } |
|
| 243 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - return true; |
|
| 246 | + return true; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -253,25 +253,25 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | function chess_ratings_num_provisional_games() |
| 255 | 255 | { |
| 256 | - $rating_system = chess_moduleConfig('rating_system'); |
|
| 256 | + $rating_system = chess_moduleConfig('rating_system'); |
|
| 257 | 257 | |
| 258 | - if ('none' == $rating_system) { |
|
| 259 | - return 0; |
|
| 260 | - } |
|
| 258 | + if ('none' == $rating_system) { |
|
| 259 | + return 0; |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - // determine function for getting number of provisional games using configured rating system |
|
| 262 | + // determine function for getting number of provisional games using configured rating system |
|
| 263 | 263 | |
| 264 | - $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 264 | + $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 265 | 265 | |
| 266 | - file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
|
| 266 | + file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
|
| 267 | 267 | |
| 268 | - require_once $file; |
|
| 268 | + require_once $file; |
|
| 269 | 269 | |
| 270 | - $func = "chess_ratings_num_provisional_games_{$rating_system}"; |
|
| 270 | + $func = "chess_ratings_num_provisional_games_{$rating_system}"; |
|
| 271 | 271 | |
| 272 | - function_exists($func) or trigger_error("missing function '$func' for rating system '$rating_system'", E_USER_ERROR); |
|
| 272 | + function_exists($func) or trigger_error("missing function '$func' for rating system '$rating_system'", E_USER_ERROR); |
|
| 273 | 273 | |
| 274 | - return $func(); |
|
| 274 | + return $func(); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -282,17 +282,17 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | function chess_ratings_get_func_adj($rating_system) |
| 284 | 284 | { |
| 285 | - $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 285 | + $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 286 | 286 | |
| 287 | - file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
|
| 287 | + file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
|
| 288 | 288 | |
| 289 | - require_once $file; |
|
| 289 | + require_once $file; |
|
| 290 | 290 | |
| 291 | - $func = "chess_ratings_adj_{$rating_system}"; |
|
| 291 | + $func = "chess_ratings_adj_{$rating_system}"; |
|
| 292 | 292 | |
| 293 | - function_exists($func) or trigger_error("missing function '$func' for rating system '$rating_system'", E_USER_ERROR); |
|
| 293 | + function_exists($func) or trigger_error("missing function '$func' for rating system '$rating_system'", E_USER_ERROR); |
|
| 294 | 294 | |
| 295 | - return $func; |
|
| 295 | + return $func; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
@@ -307,21 +307,21 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | function chess_ratings_get_columns($pgn_result) |
| 309 | 309 | { |
| 310 | - switch ($pgn_result) { |
|
| 311 | - case '1-0': |
|
| 312 | - $white_col = 'games_won'; |
|
| 313 | - $black_col = 'games_lost'; |
|
| 314 | - break; |
|
| 315 | - case '1/2-1/2': |
|
| 316 | - default: // should not occur |
|
| 317 | - $white_col = 'games_drawn'; |
|
| 318 | - $black_col = 'games_drawn'; |
|
| 319 | - break; |
|
| 320 | - case '0-1': |
|
| 321 | - $white_col = 'games_lost'; |
|
| 322 | - $black_col = 'games_won'; |
|
| 323 | - break; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - return [$white_col, $black_col]; |
|
| 310 | + switch ($pgn_result) { |
|
| 311 | + case '1-0': |
|
| 312 | + $white_col = 'games_won'; |
|
| 313 | + $black_col = 'games_lost'; |
|
| 314 | + break; |
|
| 315 | + case '1/2-1/2': |
|
| 316 | + default: // should not occur |
|
| 317 | + $white_col = 'games_drawn'; |
|
| 318 | + $black_col = 'games_drawn'; |
|
| 319 | + break; |
|
| 320 | + case '0-1': |
|
| 321 | + $white_col = 'games_lost'; |
|
| 322 | + $black_col = 'games_won'; |
|
| 323 | + break; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + return [$white_col, $black_col]; |
|
| 327 | 327 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | /**#@+ |
| 32 | 32 | */ |
| 33 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.php'; |
|
| 33 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.php'; |
|
| 34 | 34 | /**#@-*/ |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating) VALUES $values"); |
| 113 | 113 | |
| 114 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 114 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // calculate new ratings using configured rating system |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | " |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 133 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 134 | 134 | |
| 135 | 135 | $xoopsDB->query( |
| 136 | 136 | " |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | " |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 143 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 144 | 144 | |
| 145 | 145 | return true; |
| 146 | 146 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | $xoopsDB->query("INSERT INTO $ratings_table (player_uid, rating, games_won, games_lost, games_drawn) VALUES $values"); |
| 242 | 242 | |
| 243 | - $xoopsDB->errno() and trigger_error($xoopsDB->errno() . ':' . $xoopsDB->error(), E_USER_ERROR); |
|
| 243 | + $xoopsDB->errno() and trigger_error($xoopsDB->errno().':'.$xoopsDB->error(), E_USER_ERROR); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | return true; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | // determine function for getting number of provisional games using configured rating system |
| 263 | 263 | |
| 264 | - $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 264 | + $file = XOOPS_ROOT_PATH."/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 265 | 265 | |
| 266 | 266 | file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
| 267 | 267 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | function chess_ratings_get_func_adj($rating_system) |
| 284 | 284 | { |
| 285 | - $file = XOOPS_ROOT_PATH . "/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 285 | + $file = XOOPS_ROOT_PATH."/modules/chess/include/ratings_{$rating_system}.php"; |
|
| 286 | 286 | |
| 287 | 287 | file_exists($file) or trigger_error("missing file '$file' for rating system '$rating_system'", E_USER_ERROR); |
| 288 | 288 | |
@@ -49,74 +49,74 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function xoops_module_pre_update_chess($module, $oldversion) |
| 51 | 51 | { |
| 52 | - global $xoopsDB; |
|
| 53 | - |
|
| 54 | - // For downward-compatiblity, in case this function doesn't get called by the module handler. |
|
| 55 | - $GLOBALS['chess_module_pre_update_called'] = true; |
|
| 56 | - |
|
| 57 | - if ($oldversion < 102) { // old version < 1.02: direct update not supported. |
|
| 58 | - |
|
| 59 | - $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT'; |
|
| 60 | - chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true); |
|
| 61 | - return false; |
|
| 62 | - } elseif ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 63 | - |
|
| 64 | - return true; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - // 1.02 <= old version < 1.07: perform update. |
|
| 68 | - |
|
| 69 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 70 | - $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 71 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 72 | - |
|
| 73 | - // Check that ratings table does not already exist. |
|
| 74 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table)); |
|
| 75 | - $result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'"); |
|
| 76 | - if (!$result) { |
|
| 77 | - $mysql_errno = $xoopsDB->errno(); |
|
| 78 | - $mysql_error = $xoopsDB->error(); |
|
| 79 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true); |
|
| 80 | - return false; |
|
| 81 | - } |
|
| 82 | - if ($xoopsDB->getRowsNum($result) > 0) { |
|
| 83 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true); |
|
| 84 | - return false; |
|
| 85 | - } |
|
| 86 | - $xoopsDB->freeRecordSet($result); |
|
| 87 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 88 | - |
|
| 89 | - // Check database tables. |
|
| 90 | - chess_set_message($module, _MI_CHESS_CHK_DB_TABLES); |
|
| 91 | - $table_check_messages = chess_check_tables([$challenges_table, $games_table]); |
|
| 92 | - if (!empty($table_check_messages)) { |
|
| 93 | - foreach ($table_check_messages as $message) { |
|
| 94 | - chess_set_message($module, $message, true); |
|
| 95 | - } |
|
| 96 | - return false; |
|
| 97 | - } |
|
| 98 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 99 | - |
|
| 100 | - // Check that values in column pgn_result of games table are in range. |
|
| 101 | - $pgn_result_values = "'*','1-0','0-1','1/2-1/2'"; |
|
| 102 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table)); |
|
| 103 | - $result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)"); |
|
| 104 | - if (!$result) { |
|
| 105 | - $mysql_errno = $xoopsDB->errno(); |
|
| 106 | - $mysql_error = $xoopsDB->error(); |
|
| 107 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true); |
|
| 108 | - return false; |
|
| 109 | - } |
|
| 110 | - [$count] = $xoopsDB->fetchRow($result); |
|
| 111 | - if ($count > 0) { |
|
| 112 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true); |
|
| 113 | - chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true); |
|
| 114 | - return false; |
|
| 115 | - } |
|
| 116 | - $xoopsDB->freeRecordSet($result); |
|
| 117 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 118 | - |
|
| 119 | - return true; // successful |
|
| 52 | + global $xoopsDB; |
|
| 53 | + |
|
| 54 | + // For downward-compatiblity, in case this function doesn't get called by the module handler. |
|
| 55 | + $GLOBALS['chess_module_pre_update_called'] = true; |
|
| 56 | + |
|
| 57 | + if ($oldversion < 102) { // old version < 1.02: direct update not supported. |
|
| 58 | + |
|
| 59 | + $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT'; |
|
| 60 | + chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true); |
|
| 61 | + return false; |
|
| 62 | + } elseif ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 63 | + |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + // 1.02 <= old version < 1.07: perform update. |
|
| 68 | + |
|
| 69 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 70 | + $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 71 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 72 | + |
|
| 73 | + // Check that ratings table does not already exist. |
|
| 74 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table)); |
|
| 75 | + $result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'"); |
|
| 76 | + if (!$result) { |
|
| 77 | + $mysql_errno = $xoopsDB->errno(); |
|
| 78 | + $mysql_error = $xoopsDB->error(); |
|
| 79 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true); |
|
| 80 | + return false; |
|
| 81 | + } |
|
| 82 | + if ($xoopsDB->getRowsNum($result) > 0) { |
|
| 83 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true); |
|
| 84 | + return false; |
|
| 85 | + } |
|
| 86 | + $xoopsDB->freeRecordSet($result); |
|
| 87 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 88 | + |
|
| 89 | + // Check database tables. |
|
| 90 | + chess_set_message($module, _MI_CHESS_CHK_DB_TABLES); |
|
| 91 | + $table_check_messages = chess_check_tables([$challenges_table, $games_table]); |
|
| 92 | + if (!empty($table_check_messages)) { |
|
| 93 | + foreach ($table_check_messages as $message) { |
|
| 94 | + chess_set_message($module, $message, true); |
|
| 95 | + } |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 98 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 99 | + |
|
| 100 | + // Check that values in column pgn_result of games table are in range. |
|
| 101 | + $pgn_result_values = "'*','1-0','0-1','1/2-1/2'"; |
|
| 102 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table)); |
|
| 103 | + $result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)"); |
|
| 104 | + if (!$result) { |
|
| 105 | + $mysql_errno = $xoopsDB->errno(); |
|
| 106 | + $mysql_error = $xoopsDB->error(); |
|
| 107 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true); |
|
| 108 | + return false; |
|
| 109 | + } |
|
| 110 | + [$count] = $xoopsDB->fetchRow($result); |
|
| 111 | + if ($count > 0) { |
|
| 112 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true); |
|
| 113 | + chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true); |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 116 | + $xoopsDB->freeRecordSet($result); |
|
| 117 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 118 | + |
|
| 119 | + return true; // successful |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -128,25 +128,25 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | function xoops_module_update_chess(&$module, $oldversion) |
| 130 | 130 | { |
| 131 | - global $xoopsDB; |
|
| 131 | + global $xoopsDB; |
|
| 132 | 132 | |
| 133 | - // Before proceeding, ensure that pre-update processing has been done, and that all the checks pass. |
|
| 134 | - // For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler. |
|
| 135 | - if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) { |
|
| 136 | - return false; |
|
| 137 | - } |
|
| 133 | + // Before proceeding, ensure that pre-update processing has been done, and that all the checks pass. |
|
| 134 | + // For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler. |
|
| 135 | + if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) { |
|
| 136 | + return false; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - if ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 140 | - return true; |
|
| 141 | - } |
|
| 139 | + if ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 140 | + return true; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 144 | - $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 145 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 143 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 144 | + $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 145 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 146 | 146 | |
| 147 | - $queries = [ |
|
| 147 | + $queries = [ |
|
| 148 | 148 | |
| 149 | - "CREATE TABLE `$ratings_table` ( |
|
| 149 | + "CREATE TABLE `$ratings_table` ( |
|
| 150 | 150 | `player_uid` mediumint(8) unsigned NOT NULL default '0', |
| 151 | 151 | `rating` smallint(6) unsigned NOT NULL default '1200', |
| 152 | 152 | `games_won` smallint(6) unsigned NOT NULL default '0', |
@@ -157,40 +157,40 @@ discard block |
||
| 157 | 157 | KEY `games` (`games_won`,`games_lost`,`games_drawn`) |
| 158 | 158 | ) TYPE=MyISAM", |
| 159 | 159 | |
| 160 | - "ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 161 | - "ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)", |
|
| 162 | - "ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)", |
|
| 163 | - "ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)", |
|
| 164 | - "ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)", |
|
| 165 | - "ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 166 | - |
|
| 167 | - "ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL", |
|
| 168 | - "ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 169 | - "ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)", |
|
| 170 | - "ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)", |
|
| 171 | - "ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)", |
|
| 172 | - "ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)", |
|
| 173 | - "ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))", |
|
| 174 | - "ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 175 | - |
|
| 176 | - "UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`", |
|
| 177 | - ]; |
|
| 178 | - |
|
| 179 | - // Update database tables. |
|
| 180 | - chess_set_message($module, _MI_CHESS_UPDATING_DATABASE); |
|
| 181 | - foreach ($queries as $query) { |
|
| 182 | - chess_set_message($module, "> $query"); |
|
| 183 | - $result = $xoopsDB->query($query); |
|
| 184 | - if (!$result) { |
|
| 185 | - $mysql_errno = $xoopsDB->errno(); |
|
| 186 | - $mysql_error = $xoopsDB->error(); |
|
| 187 | - chess_set_message($module, " ... ($mysql_errno) $mysql_error"); |
|
| 188 | - return false; |
|
| 189 | - } |
|
| 190 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /*** |
|
| 160 | + "ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 161 | + "ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)", |
|
| 162 | + "ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)", |
|
| 163 | + "ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)", |
|
| 164 | + "ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)", |
|
| 165 | + "ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 166 | + |
|
| 167 | + "ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL", |
|
| 168 | + "ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 169 | + "ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)", |
|
| 170 | + "ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)", |
|
| 171 | + "ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)", |
|
| 172 | + "ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)", |
|
| 173 | + "ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))", |
|
| 174 | + "ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 175 | + |
|
| 176 | + "UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`", |
|
| 177 | + ]; |
|
| 178 | + |
|
| 179 | + // Update database tables. |
|
| 180 | + chess_set_message($module, _MI_CHESS_UPDATING_DATABASE); |
|
| 181 | + foreach ($queries as $query) { |
|
| 182 | + chess_set_message($module, "> $query"); |
|
| 183 | + $result = $xoopsDB->query($query); |
|
| 184 | + if (!$result) { |
|
| 185 | + $mysql_errno = $xoopsDB->errno(); |
|
| 186 | + $mysql_error = $xoopsDB->error(); |
|
| 187 | + chess_set_message($module, " ... ($mysql_errno) $mysql_error"); |
|
| 188 | + return false; |
|
| 189 | + } |
|
| 190 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /*** |
|
| 194 | 194 | * #*#TODO# - Leave this here for now, in case I think of a way to get it to work. |
| 195 | 195 | * # This causes an error about the rating_system module configuration parameter not being defined, |
| 196 | 196 | * # so I added a note in INSTALL.TXT about manually recalculating the ratings after install. |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | * chess_recalc_ratings(); |
| 202 | 202 | ***/ |
| 203 | 203 | |
| 204 | - chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL); |
|
| 204 | + chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL); |
|
| 205 | 205 | |
| 206 | - return true; // successful |
|
| 206 | + return true; // successful |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -214,37 +214,37 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | function chess_check_tables($table_names) |
| 216 | 216 | { |
| 217 | - global $xoopsDB; |
|
| 217 | + global $xoopsDB; |
|
| 218 | 218 | |
| 219 | - $messages = []; |
|
| 219 | + $messages = []; |
|
| 220 | 220 | |
| 221 | - foreach ($table_names as $table_name) { |
|
| 222 | - $query = "CHECK TABLE `$table_name`"; |
|
| 223 | - $result = $xoopsDB->query($query); |
|
| 224 | - if (!$result) { |
|
| 225 | - $mysql_errno = $xoopsDB->errno(); |
|
| 226 | - $mysql_error = $xoopsDB->error(); |
|
| 227 | - $messages[] = $query; |
|
| 228 | - $messages[] = " ... ($mysql_errno) $mysql_error"; |
|
| 229 | - continue; |
|
| 230 | - } |
|
| 221 | + foreach ($table_names as $table_name) { |
|
| 222 | + $query = "CHECK TABLE `$table_name`"; |
|
| 223 | + $result = $xoopsDB->query($query); |
|
| 224 | + if (!$result) { |
|
| 225 | + $mysql_errno = $xoopsDB->errno(); |
|
| 226 | + $mysql_error = $xoopsDB->error(); |
|
| 227 | + $messages[] = $query; |
|
| 228 | + $messages[] = " ... ($mysql_errno) $mysql_error"; |
|
| 229 | + continue; |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - // Initialize, in case the real table status fails to get retrieved. |
|
| 233 | - $table_status = '*** STATUS UNKNOWN ***'; |
|
| 232 | + // Initialize, in case the real table status fails to get retrieved. |
|
| 233 | + $table_status = '*** STATUS UNKNOWN ***'; |
|
| 234 | 234 | |
| 235 | - // The query may return multiple rows. Only the last row is normally of interest, so only that row is saved. |
|
| 236 | - while ($row = $xoopsDB->fetchArray($result)) { |
|
| 237 | - $table_status = $row['Msg_text']; |
|
| 238 | - } |
|
| 235 | + // The query may return multiple rows. Only the last row is normally of interest, so only that row is saved. |
|
| 236 | + while ($row = $xoopsDB->fetchArray($result)) { |
|
| 237 | + $table_status = $row['Msg_text']; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - $xoopsDB->freeRecordSet($result); |
|
| 240 | + $xoopsDB->freeRecordSet($result); |
|
| 241 | 241 | |
| 242 | - if ('OK' != $table_status) { |
|
| 243 | - $messages[] = " ... $table_name: $table_status"; |
|
| 244 | - } |
|
| 245 | - } |
|
| 242 | + if ('OK' != $table_status) { |
|
| 243 | + $messages[] = " ... $table_name: $table_status"; |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - return $messages; |
|
| 247 | + return $messages; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function chess_load_lang_file($filename, $module = '', $default = 'english') |
| 261 | 261 | { |
| 262 | - $lang = $GLOBALS['xoopsConfig']['language']; |
|
| 263 | - $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language'; |
|
| 264 | - if (!($ret = @include_once("$path/$lang/$filename.php"))) { |
|
| 265 | - $ret = include_once("$path/$default/$filename.php"); |
|
| 266 | - } |
|
| 267 | - return $ret; |
|
| 262 | + $lang = $GLOBALS['xoopsConfig']['language']; |
|
| 263 | + $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language'; |
|
| 264 | + if (!($ret = @include_once("$path/$lang/$filename.php"))) { |
|
| 265 | + $ret = include_once("$path/$default/$filename.php"); |
|
| 266 | + } |
|
| 267 | + return $ret; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -276,14 +276,14 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | function chess_set_message($module, $text = '', $error = false) |
| 278 | 278 | { |
| 279 | - $text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text; |
|
| 280 | - |
|
| 281 | - // For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage. |
|
| 282 | - if (is_object($module) && method_exists($module, 'setMessage')) { |
|
| 283 | - $module->setMessage($text); |
|
| 284 | - } else { |
|
| 285 | - echo "<code>$text</code><br />\n"; |
|
| 286 | - } |
|
| 279 | + $text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text; |
|
| 280 | + |
|
| 281 | + // For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage. |
|
| 282 | + if (is_object($module) && method_exists($module, 'setMessage')) { |
|
| 283 | + $module->setMessage($text); |
|
| 284 | + } else { |
|
| 285 | + echo "<code>$text</code><br />\n"; |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | ?> |
@@ -50,105 +50,105 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function xoops_module_pre_update_chess($module, $oldversion) |
| 52 | 52 | { |
| 53 | - global $xoopsDB; |
|
| 53 | + global $xoopsDB; |
|
| 54 | 54 | |
| 55 | - // For downward-compatiblity, in case this function doesn't get called by the module handler. |
|
| 55 | + // For downward-compatiblity, in case this function doesn't get called by the module handler. |
|
| 56 | 56 | |
| 57 | - $GLOBALS['chess_module_pre_update_called'] = true; |
|
| 57 | + $GLOBALS['chess_module_pre_update_called'] = true; |
|
| 58 | 58 | |
| 59 | - if ($oldversion < 102) { // old version < 1.02: direct update not supported. |
|
| 60 | - $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT'; |
|
| 59 | + if ($oldversion < 102) { // old version < 1.02: direct update not supported. |
|
| 60 | + $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT'; |
|
| 61 | 61 | |
| 62 | - chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true); |
|
| 62 | + chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true); |
|
| 63 | 63 | |
| 64 | - return false; |
|
| 65 | - } elseif ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 66 | - return true; |
|
| 67 | - } |
|
| 64 | + return false; |
|
| 65 | + } elseif ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 66 | + return true; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - // 1.02 <= old version < 1.07: perform update. |
|
| 69 | + // 1.02 <= old version < 1.07: perform update. |
|
| 70 | 70 | |
| 71 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 71 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 72 | 72 | |
| 73 | - $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 73 | + $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 74 | 74 | |
| 75 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 75 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 76 | 76 | |
| 77 | - // Check that ratings table does not already exist. |
|
| 77 | + // Check that ratings table does not already exist. |
|
| 78 | 78 | |
| 79 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table)); |
|
| 79 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table)); |
|
| 80 | 80 | |
| 81 | - $result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'"); |
|
| 81 | + $result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'"); |
|
| 82 | 82 | |
| 83 | - if (!$result) { |
|
| 84 | - $mysql_errno = $xoopsDB->errno(); |
|
| 83 | + if (!$result) { |
|
| 84 | + $mysql_errno = $xoopsDB->errno(); |
|
| 85 | 85 | |
| 86 | - $mysql_error = $xoopsDB->error(); |
|
| 86 | + $mysql_error = $xoopsDB->error(); |
|
| 87 | 87 | |
| 88 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true); |
|
| 88 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true); |
|
| 89 | 89 | |
| 90 | - return false; |
|
| 91 | - } |
|
| 90 | + return false; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - if ($xoopsDB->getRowsNum($result) > 0) { |
|
| 94 | - chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true); |
|
| 93 | + if ($xoopsDB->getRowsNum($result) > 0) { |
|
| 94 | + chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true); |
|
| 95 | 95 | |
| 96 | - return false; |
|
| 97 | - } |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - $xoopsDB->freeRecordSet($result); |
|
| 99 | + $xoopsDB->freeRecordSet($result); |
|
| 100 | 100 | |
| 101 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 101 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 102 | 102 | |
| 103 | - // Check database tables. |
|
| 103 | + // Check database tables. |
|
| 104 | 104 | |
| 105 | - chess_set_message($module, _MI_CHESS_CHK_DB_TABLES); |
|
| 105 | + chess_set_message($module, _MI_CHESS_CHK_DB_TABLES); |
|
| 106 | 106 | |
| 107 | - $table_check_messages = chess_check_tables([$challenges_table, $games_table]); |
|
| 107 | + $table_check_messages = chess_check_tables([$challenges_table, $games_table]); |
|
| 108 | 108 | |
| 109 | - if (!empty($table_check_messages)) { |
|
| 110 | - foreach ($table_check_messages as $message) { |
|
| 111 | - chess_set_message($module, $message, true); |
|
| 112 | - } |
|
| 109 | + if (!empty($table_check_messages)) { |
|
| 110 | + foreach ($table_check_messages as $message) { |
|
| 111 | + chess_set_message($module, $message, true); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return false; |
|
| 115 | - } |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 117 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 118 | 118 | |
| 119 | - // Check that values in column pgn_result of games table are in range. |
|
| 119 | + // Check that values in column pgn_result of games table are in range. |
|
| 120 | 120 | |
| 121 | - $pgn_result_values = "'*','1-0','0-1','1/2-1/2'"; |
|
| 121 | + $pgn_result_values = "'*','1-0','0-1','1/2-1/2'"; |
|
| 122 | 122 | |
| 123 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table)); |
|
| 123 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table)); |
|
| 124 | 124 | |
| 125 | - $result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)"); |
|
| 125 | + $result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)"); |
|
| 126 | 126 | |
| 127 | - if (!$result) { |
|
| 128 | - $mysql_errno = $xoopsDB->errno(); |
|
| 127 | + if (!$result) { |
|
| 128 | + $mysql_errno = $xoopsDB->errno(); |
|
| 129 | 129 | |
| 130 | - $mysql_error = $xoopsDB->error(); |
|
| 130 | + $mysql_error = $xoopsDB->error(); |
|
| 131 | 131 | |
| 132 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true); |
|
| 132 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true); |
|
| 133 | 133 | |
| 134 | - return false; |
|
| 135 | - } |
|
| 134 | + return false; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - [$count] = $xoopsDB->fetchRow($result); |
|
| 137 | + [$count] = $xoopsDB->fetchRow($result); |
|
| 138 | 138 | |
| 139 | - if ($count > 0) { |
|
| 140 | - chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true); |
|
| 139 | + if ($count > 0) { |
|
| 140 | + chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true); |
|
| 141 | 141 | |
| 142 | - chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true); |
|
| 142 | + chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true); |
|
| 143 | 143 | |
| 144 | - return false; |
|
| 145 | - } |
|
| 144 | + return false; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - $xoopsDB->freeRecordSet($result); |
|
| 147 | + $xoopsDB->freeRecordSet($result); |
|
| 148 | 148 | |
| 149 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 149 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 150 | 150 | |
| 151 | - return true; // successful |
|
| 151 | + return true; // successful |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -160,28 +160,28 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | function xoops_module_update_chess($module, $oldversion) |
| 162 | 162 | { |
| 163 | - global $xoopsDB; |
|
| 163 | + global $xoopsDB; |
|
| 164 | 164 | |
| 165 | - // Before proceeding, ensure that pre-update processing has been done, and that all the checks pass. |
|
| 165 | + // Before proceeding, ensure that pre-update processing has been done, and that all the checks pass. |
|
| 166 | 166 | |
| 167 | - // For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler. |
|
| 167 | + // For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler. |
|
| 168 | 168 | |
| 169 | - if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) { |
|
| 170 | - return false; |
|
| 171 | - } |
|
| 169 | + if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - if ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 174 | - return true; |
|
| 175 | - } |
|
| 173 | + if ($oldversion >= 107) { // old version >= 1.07: no action needed. |
|
| 174 | + return true; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 177 | + $ratings_table = $xoopsDB->prefix('chess_ratings'); |
|
| 178 | 178 | |
| 179 | - $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 179 | + $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 180 | 180 | |
| 181 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 181 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 182 | 182 | |
| 183 | - $queries = [ |
|
| 184 | - "CREATE TABLE `$ratings_table` ( |
|
| 183 | + $queries = [ |
|
| 184 | + "CREATE TABLE `$ratings_table` ( |
|
| 185 | 185 | `player_uid` mediumint(8) unsigned NOT NULL default '0', |
| 186 | 186 | `rating` smallint(6) unsigned NOT NULL default '1200', |
| 187 | 187 | `games_won` smallint(6) unsigned NOT NULL default '0', |
@@ -192,48 +192,48 @@ discard block |
||
| 192 | 192 | KEY `games` (`games_won`,`games_lost`,`games_drawn`) |
| 193 | 193 | ) ENGINE=MyISAM", |
| 194 | 194 | |
| 195 | - "ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 196 | - "ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)", |
|
| 197 | - "ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)", |
|
| 198 | - "ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)", |
|
| 199 | - "ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)", |
|
| 200 | - "ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 195 | + "ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 196 | + "ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)", |
|
| 197 | + "ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)", |
|
| 198 | + "ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)", |
|
| 199 | + "ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)", |
|
| 200 | + "ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 201 | 201 | |
| 202 | - "ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL", |
|
| 203 | - "ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 204 | - "ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)", |
|
| 205 | - "ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)", |
|
| 206 | - "ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)", |
|
| 207 | - "ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)", |
|
| 208 | - "ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))", |
|
| 209 | - "ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 202 | + "ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL", |
|
| 203 | + "ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL", |
|
| 204 | + "ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)", |
|
| 205 | + "ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)", |
|
| 206 | + "ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)", |
|
| 207 | + "ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)", |
|
| 208 | + "ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))", |
|
| 209 | + "ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)", |
|
| 210 | 210 | |
| 211 | - "UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`", |
|
| 212 | - ]; |
|
| 211 | + "UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`", |
|
| 212 | + ]; |
|
| 213 | 213 | |
| 214 | - // Update database tables. |
|
| 214 | + // Update database tables. |
|
| 215 | 215 | |
| 216 | - chess_set_message($module, _MI_CHESS_UPDATING_DATABASE); |
|
| 216 | + chess_set_message($module, _MI_CHESS_UPDATING_DATABASE); |
|
| 217 | 217 | |
| 218 | - foreach ($queries as $query) { |
|
| 219 | - chess_set_message($module, "> $query"); |
|
| 218 | + foreach ($queries as $query) { |
|
| 219 | + chess_set_message($module, "> $query"); |
|
| 220 | 220 | |
| 221 | - $result = $xoopsDB->query($query); |
|
| 221 | + $result = $xoopsDB->query($query); |
|
| 222 | 222 | |
| 223 | - if (!$result) { |
|
| 224 | - $mysql_errno = $xoopsDB->errno(); |
|
| 223 | + if (!$result) { |
|
| 224 | + $mysql_errno = $xoopsDB->errno(); |
|
| 225 | 225 | |
| 226 | - $mysql_error = $xoopsDB->error(); |
|
| 226 | + $mysql_error = $xoopsDB->error(); |
|
| 227 | 227 | |
| 228 | - chess_set_message($module, " ... ($mysql_errno) $mysql_error"); |
|
| 228 | + chess_set_message($module, " ... ($mysql_errno) $mysql_error"); |
|
| 229 | 229 | |
| 230 | - return false; |
|
| 231 | - } |
|
| 230 | + return false; |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - chess_set_message($module, _MI_CHESS_OK); |
|
| 234 | - } |
|
| 233 | + chess_set_message($module, _MI_CHESS_OK); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - /*** |
|
| 236 | + /*** |
|
| 237 | 237 | * #*#TODO# - Leave this here for now, in case I think of a way to get it to work. |
| 238 | 238 | * # This causes an error about the rating_system module configuration parameter not being defined, |
| 239 | 239 | * # so I added a note in INSTALL.TXT about manually recalculating the ratings after install. |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | * chess_recalc_ratings(); |
| 245 | 245 | ***/ |
| 246 | 246 | |
| 247 | - chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL); |
|
| 247 | + chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL); |
|
| 248 | 248 | |
| 249 | - return true; // successful |
|
| 249 | + return true; // successful |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -257,45 +257,45 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | function chess_check_tables($table_names) |
| 259 | 259 | { |
| 260 | - global $xoopsDB; |
|
| 260 | + global $xoopsDB; |
|
| 261 | 261 | |
| 262 | - $messages = []; |
|
| 262 | + $messages = []; |
|
| 263 | 263 | |
| 264 | - foreach ($table_names as $table_name) { |
|
| 265 | - $query = "CHECK TABLE `$table_name`"; |
|
| 264 | + foreach ($table_names as $table_name) { |
|
| 265 | + $query = "CHECK TABLE `$table_name`"; |
|
| 266 | 266 | |
| 267 | - $result = $xoopsDB->query($query); |
|
| 267 | + $result = $xoopsDB->query($query); |
|
| 268 | 268 | |
| 269 | - if (!$result) { |
|
| 270 | - $mysql_errno = $xoopsDB->errno(); |
|
| 269 | + if (!$result) { |
|
| 270 | + $mysql_errno = $xoopsDB->errno(); |
|
| 271 | 271 | |
| 272 | - $mysql_error = $xoopsDB->error(); |
|
| 272 | + $mysql_error = $xoopsDB->error(); |
|
| 273 | 273 | |
| 274 | - $messages[] = $query; |
|
| 274 | + $messages[] = $query; |
|
| 275 | 275 | |
| 276 | - $messages[] = " ... ($mysql_errno) $mysql_error"; |
|
| 276 | + $messages[] = " ... ($mysql_errno) $mysql_error"; |
|
| 277 | 277 | |
| 278 | - continue; |
|
| 279 | - } |
|
| 278 | + continue; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - // Initialize, in case the real table status fails to get retrieved. |
|
| 281 | + // Initialize, in case the real table status fails to get retrieved. |
|
| 282 | 282 | |
| 283 | - $table_status = '*** STATUS UNKNOWN ***'; |
|
| 283 | + $table_status = '*** STATUS UNKNOWN ***'; |
|
| 284 | 284 | |
| 285 | - // The query may return multiple rows. Only the last row is normally of interest, so only that row is saved. |
|
| 285 | + // The query may return multiple rows. Only the last row is normally of interest, so only that row is saved. |
|
| 286 | 286 | |
| 287 | - while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 288 | - $table_status = $row['Msg_text']; |
|
| 289 | - } |
|
| 287 | + while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 288 | + $table_status = $row['Msg_text']; |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | - $xoopsDB->freeRecordSet($result); |
|
| 291 | + $xoopsDB->freeRecordSet($result); |
|
| 292 | 292 | |
| 293 | - if ('OK' != $table_status) { |
|
| 294 | - $messages[] = " ... $table_name: $table_status"; |
|
| 295 | - } |
|
| 296 | - } |
|
| 293 | + if ('OK' != $table_status) { |
|
| 294 | + $messages[] = " ... $table_name: $table_status"; |
|
| 295 | + } |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - return $messages; |
|
| 298 | + return $messages; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | function chess_load_lang_file($filename, $module = '', $default = 'english') |
| 312 | 312 | { |
| 313 | - $lang = $GLOBALS['xoopsConfig']['language']; |
|
| 313 | + $lang = $GLOBALS['xoopsConfig']['language']; |
|
| 314 | 314 | |
| 315 | - $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language'; |
|
| 315 | + $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language'; |
|
| 316 | 316 | |
| 317 | - if (!($ret = @include_once("$path/$lang/$filename.php"))) { |
|
| 318 | - $ret = include_once("$path/$default/$filename.php"); |
|
| 319 | - } |
|
| 317 | + if (!($ret = @include_once("$path/$lang/$filename.php"))) { |
|
| 318 | + $ret = include_once("$path/$default/$filename.php"); |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - return $ret; |
|
| 321 | + return $ret; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -330,13 +330,13 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | function chess_set_message($module, $text = '', $error = false) |
| 332 | 332 | { |
| 333 | - $text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text; |
|
| 333 | + $text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text; |
|
| 334 | 334 | |
| 335 | - // For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage. |
|
| 335 | + // For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage. |
|
| 336 | 336 | |
| 337 | - if (is_object($module) && method_exists($module, 'setMessage')) { |
|
| 338 | - $module->setMessage($text); |
|
| 339 | - } else { |
|
| 340 | - echo "<code>$text</code><br>\n"; |
|
| 341 | - } |
|
| 337 | + if (is_object($module) && method_exists($module, 'setMessage')) { |
|
| 338 | + $module->setMessage($text); |
|
| 339 | + } else { |
|
| 340 | + echo "<code>$text</code><br>\n"; |
|
| 341 | + } |
|
| 342 | 342 | } |
@@ -48,36 +48,36 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 . " |
@@ -36,8 +36,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 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 | 58 | // offset of first row of challenges table to display (default to 0) |
| 59 | 59 | $cstart = Request::getInt('cstart', 0); |
@@ -71,70 +71,70 @@ discard block |
||
| 71 | 71 | $gshow2 = Request::getInt('gshow2', 0); |
| 72 | 72 | //$gshow2 = intval(isset($_POST['gshow2']) ? $_POST['gshow2'] : @$_GET['gshow2']); |
| 73 | 73 | |
| 74 | - // set show-options to default if undefined |
|
| 74 | + // set show-options to default if undefined |
|
| 75 | 75 | |
| 76 | - if (!$cshow) { |
|
| 77 | - $cshow = _CHESS_SHOW_CHALLENGES_BOTH; |
|
| 78 | - } |
|
| 76 | + if (!$cshow) { |
|
| 77 | + $cshow = _CHESS_SHOW_CHALLENGES_BOTH; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - if (!$gshow1) { |
|
| 81 | - $gshow1 = _CHESS_SHOW_GAMES_BOTH; |
|
| 82 | - } |
|
| 80 | + if (!$gshow1) { |
|
| 81 | + $gshow1 = _CHESS_SHOW_GAMES_BOTH; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - if (!$gshow2) { |
|
| 85 | - $gshow2 = _CHESS_SHOW_GAMES_UNRATED; |
|
| 86 | - } |
|
| 84 | + if (!$gshow2) { |
|
| 85 | + $gshow2 = _CHESS_SHOW_GAMES_UNRATED; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - // get maximum number of items to display on a page, and constrain it to a reasonable value |
|
| 88 | + // get maximum number of items to display on a page, and constrain it to a reasonable value |
|
| 89 | 89 | |
| 90 | - $max_items_to_display = chess_moduleConfig('max_items'); |
|
| 90 | + $max_items_to_display = chess_moduleConfig('max_items'); |
|
| 91 | 91 | |
| 92 | - $max_items_to_display = min(max($max_items_to_display, 1), 1000); |
|
| 92 | + $max_items_to_display = min(max($max_items_to_display, 1), 1000); |
|
| 93 | 93 | |
| 94 | - $xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING); |
|
| 94 | + $xoopsTpl->assign('chess_date_format', _MEDIUMDATESTRING); |
|
| 95 | 95 | |
| 96 | - // user IDs that will require mapping to usernames |
|
| 96 | + // user IDs that will require mapping to usernames |
|
| 97 | 97 | |
| 98 | - $userids = []; |
|
| 98 | + $userids = []; |
|
| 99 | 99 | |
| 100 | - // ----- |
|
| 100 | + // ----- |
|
| 101 | 101 | |
| 102 | - // games |
|
| 102 | + // games |
|
| 103 | 103 | |
| 104 | - // ----- |
|
| 104 | + // ----- |
|
| 105 | 105 | |
| 106 | - // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
|
| 106 | + // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
|
| 107 | 107 | |
| 108 | - // and one with a limit clause to get the data for display on the current page. |
|
| 108 | + // and one with a limit clause to get the data for display on the current page. |
|
| 109 | 109 | |
| 110 | - // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this. |
|
| 110 | + // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this. |
|
| 111 | 111 | |
| 112 | - $games_table = $xoopsDB->prefix('chess_games'); |
|
| 112 | + $games_table = $xoopsDB->prefix('chess_games'); |
|
| 113 | 113 | |
| 114 | - $where = 'white_uid != black_uid'; |
|
| 114 | + $where = 'white_uid != black_uid'; |
|
| 115 | 115 | |
| 116 | - switch ($gshow1) { |
|
| 117 | - case 1: |
|
| 118 | - $where .= " AND pgn_result = '*'"; |
|
| 119 | - break; |
|
| 120 | - case 2: |
|
| 121 | - $where .= " AND pgn_result != '*'"; |
|
| 122 | - break; |
|
| 123 | - } |
|
| 116 | + switch ($gshow1) { |
|
| 117 | + case 1: |
|
| 118 | + $where .= " AND pgn_result = '*'"; |
|
| 119 | + break; |
|
| 120 | + case 2: |
|
| 121 | + $where .= " AND pgn_result != '*'"; |
|
| 122 | + break; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - if (1 == $gshow2) { |
|
| 126 | - $where .= " AND is_rated = '1'"; |
|
| 127 | - } |
|
| 125 | + if (1 == $gshow2) { |
|
| 126 | + $where .= " AND is_rated = '1'"; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - $result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where"); |
|
| 129 | + $result = $xoopsDB->query("SELECT COUNT(*) FROM $games_table WHERE $where"); |
|
| 130 | 130 | |
| 131 | - [$num_games] = $xoopsDB->fetchRow($result); |
|
| 131 | + [$num_games] = $xoopsDB->fetchRow($result); |
|
| 132 | 132 | |
| 133 | - $xoopsDB->freeRecordSet($result); |
|
| 133 | + $xoopsDB->freeRecordSet($result); |
|
| 134 | 134 | |
| 135 | - $result = $xoopsDB->query( |
|
| 136 | - trim( |
|
| 137 | - " |
|
| 135 | + $result = $xoopsDB->query( |
|
| 136 | + trim( |
|
| 137 | + " |
|
| 138 | 138 | SELECT game_id, fen_active_color, white_uid, black_uid, pgn_result, is_rated, |
| 139 | 139 | UNIX_TIMESTAMP(GREATEST(create_date,start_date,last_date)) AS last_activity |
| 140 | 140 | FROM $games_table |
@@ -142,211 +142,211 @@ discard block |
||
| 142 | 142 | ORDER BY last_activity DESC |
| 143 | 143 | LIMIT $gstart, $max_items_to_display |
| 144 | 144 | " |
| 145 | - ) |
|
| 146 | - ); |
|
| 145 | + ) |
|
| 146 | + ); |
|
| 147 | 147 | |
| 148 | - $games = []; |
|
| 148 | + $games = []; |
|
| 149 | 149 | |
| 150 | - while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 151 | - $games[] = [ |
|
| 152 | - 'game_id' => $row['game_id'], |
|
| 153 | - 'white_uid' => $row['white_uid'], |
|
| 154 | - 'black_uid' => $row['black_uid'], |
|
| 155 | - 'last_activity' => $row['last_activity'], |
|
| 156 | - 'fen_active_color' => $row['fen_active_color'], |
|
| 157 | - 'pgn_result' => $row['pgn_result'], |
|
| 158 | - 'is_rated' => $row['is_rated'], |
|
| 159 | - ]; |
|
| 150 | + while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 151 | + $games[] = [ |
|
| 152 | + 'game_id' => $row['game_id'], |
|
| 153 | + 'white_uid' => $row['white_uid'], |
|
| 154 | + 'black_uid' => $row['black_uid'], |
|
| 155 | + 'last_activity' => $row['last_activity'], |
|
| 156 | + 'fen_active_color' => $row['fen_active_color'], |
|
| 157 | + 'pgn_result' => $row['pgn_result'], |
|
| 158 | + 'is_rated' => $row['is_rated'], |
|
| 159 | + ]; |
|
| 160 | 160 | |
| 161 | - // save user IDs that will require mapping to usernames |
|
| 161 | + // save user IDs that will require mapping to usernames |
|
| 162 | 162 | |
| 163 | - if ($row['white_uid']) { |
|
| 164 | - $userids[$row['white_uid']] = 1; |
|
| 165 | - } |
|
| 163 | + if ($row['white_uid']) { |
|
| 164 | + $userids[$row['white_uid']] = 1; |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - if ($row['black_uid']) { |
|
| 168 | - $userids[$row['black_uid']] = 1; |
|
| 169 | - } |
|
| 170 | - } |
|
| 167 | + if ($row['black_uid']) { |
|
| 168 | + $userids[$row['black_uid']] = 1; |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $xoopsDB->freeRecordSet($result); |
|
| 172 | + $xoopsDB->freeRecordSet($result); |
|
| 173 | 173 | |
| 174 | - $games_pagenav = new XoopsPageNav($num_games, $max_items_to_display, $gstart, 'gstart', "cstart=$cstart&cshow=$cshow&gshow1=$gshow1&gshow2=$gshow2"); |
|
| 174 | + $games_pagenav = new XoopsPageNav($num_games, $max_items_to_display, $gstart, 'gstart', "cstart=$cstart&cshow=$cshow&gshow1=$gshow1&gshow2=$gshow2"); |
|
| 175 | 175 | |
| 176 | - $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav()); |
|
| 176 | + $xoopsTpl->assign('chess_games_pagenav', $games_pagenav->renderNav()); |
|
| 177 | 177 | |
| 178 | - // ---------- |
|
| 178 | + // ---------- |
|
| 179 | 179 | |
| 180 | - // challenges |
|
| 180 | + // challenges |
|
| 181 | 181 | |
| 182 | - // ---------- |
|
| 182 | + // ---------- |
|
| 183 | 183 | |
| 184 | - // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
|
| 184 | + // Two queries are performed, one without a limit clause to count the total number of rows for the page navigator, |
|
| 185 | 185 | |
| 186 | - // and one with a limit clause to get the data for display on the current page. |
|
| 186 | + // and one with a limit clause to get the data for display on the current page. |
|
| 187 | 187 | |
| 188 | - // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this. |
|
| 188 | + // SQL_CALC_FOUND_ROWS and FOUND_ROWS(), available in MySQL 4.0.0, provide a more efficient way of doing this. |
|
| 189 | 189 | |
| 190 | - $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 190 | + $challenges_table = $xoopsDB->prefix('chess_challenges'); |
|
| 191 | 191 | |
| 192 | - switch ($cshow) { |
|
| 193 | - case _CHESS_SHOW_CHALLENGES_OPEN: |
|
| 194 | - $where = "game_type = 'open'"; |
|
| 195 | - break; |
|
| 196 | - case _CHESS_SHOW_CHALLENGES_USER: |
|
| 197 | - $where = "game_type = 'user'"; |
|
| 198 | - break; |
|
| 199 | - default: |
|
| 200 | - $where = 1; |
|
| 201 | - break; |
|
| 202 | - } |
|
| 192 | + switch ($cshow) { |
|
| 193 | + case _CHESS_SHOW_CHALLENGES_OPEN: |
|
| 194 | + $where = "game_type = 'open'"; |
|
| 195 | + break; |
|
| 196 | + case _CHESS_SHOW_CHALLENGES_USER: |
|
| 197 | + $where = "game_type = 'user'"; |
|
| 198 | + break; |
|
| 199 | + default: |
|
| 200 | + $where = 1; |
|
| 201 | + break; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - $result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where"); |
|
| 204 | + $result = $xoopsDB->query("SELECT COUNT(*) FROM $challenges_table WHERE $where"); |
|
| 205 | 205 | |
| 206 | - [$num_challenges] = $xoopsDB->fetchRow($result); |
|
| 206 | + [$num_challenges] = $xoopsDB->fetchRow($result); |
|
| 207 | 207 | |
| 208 | - $xoopsDB->freeRecordSet($result); |
|
| 208 | + $xoopsDB->freeRecordSet($result); |
|
| 209 | 209 | |
| 210 | - $result = $xoopsDB->query( |
|
| 211 | - trim( |
|
| 212 | - " |
|
| 210 | + $result = $xoopsDB->query( |
|
| 211 | + trim( |
|
| 212 | + " |
|
| 213 | 213 | SELECT challenge_id, game_type, color_option, player1_uid, player2_uid, UNIX_TIMESTAMP(create_date) AS create_date, is_rated |
| 214 | 214 | FROM $challenges_table |
| 215 | 215 | WHERE $where |
| 216 | 216 | ORDER BY create_date DESC |
| 217 | 217 | LIMIT $cstart, $max_items_to_display |
| 218 | 218 | " |
| 219 | - ) |
|
| 220 | - ); |
|
| 219 | + ) |
|
| 220 | + ); |
|
| 221 | 221 | |
| 222 | - $challenges = []; |
|
| 222 | + $challenges = []; |
|
| 223 | 223 | |
| 224 | - while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 225 | - $challenges[] = [ |
|
| 226 | - 'challenge_id' => $row['challenge_id'], |
|
| 227 | - 'game_type' => $row['game_type'], |
|
| 228 | - 'color_option' => $row['color_option'], |
|
| 229 | - 'player1_uid' => $row['player1_uid'], |
|
| 230 | - 'player2_uid' => $row['player2_uid'], |
|
| 231 | - 'create_date' => $row['create_date'], |
|
| 232 | - 'is_rated' => $row['is_rated'], |
|
| 233 | - ]; |
|
| 224 | + while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 225 | + $challenges[] = [ |
|
| 226 | + 'challenge_id' => $row['challenge_id'], |
|
| 227 | + 'game_type' => $row['game_type'], |
|
| 228 | + 'color_option' => $row['color_option'], |
|
| 229 | + 'player1_uid' => $row['player1_uid'], |
|
| 230 | + 'player2_uid' => $row['player2_uid'], |
|
| 231 | + 'create_date' => $row['create_date'], |
|
| 232 | + 'is_rated' => $row['is_rated'], |
|
| 233 | + ]; |
|
| 234 | 234 | |
| 235 | - // save user IDs that will require mapping to usernames |
|
| 235 | + // save user IDs that will require mapping to usernames |
|
| 236 | 236 | |
| 237 | - if ($row['player1_uid']) { |
|
| 238 | - $userids[$row['player1_uid']] = 1; |
|
| 239 | - } |
|
| 237 | + if ($row['player1_uid']) { |
|
| 238 | + $userids[$row['player1_uid']] = 1; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - if ($row['player2_uid']) { |
|
| 242 | - $userids[$row['player2_uid']] = 1; |
|
| 243 | - } |
|
| 244 | - } |
|
| 241 | + if ($row['player2_uid']) { |
|
| 242 | + $userids[$row['player2_uid']] = 1; |
|
| 243 | + } |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - $xoopsDB->freeRecordSet($result); |
|
| 246 | + $xoopsDB->freeRecordSet($result); |
|
| 247 | 247 | |
| 248 | - $challenges_pagenav = new XoopsPageNav($num_challenges, $max_items_to_display, $cstart, 'cstart', "gstart=$gstart&cshow=$cshow&gshow1=$gshow1&gshow2=$gshow2"); |
|
| 248 | + $challenges_pagenav = new XoopsPageNav($num_challenges, $max_items_to_display, $cstart, 'cstart', "gstart=$gstart&cshow=$cshow&gshow1=$gshow1&gshow2=$gshow2"); |
|
| 249 | 249 | |
| 250 | - $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav()); |
|
| 250 | + $xoopsTpl->assign('chess_challenges_pagenav', $challenges_pagenav->renderNav()); |
|
| 251 | 251 | |
| 252 | - // --------- |
|
| 252 | + // --------- |
|
| 253 | 253 | |
| 254 | - // usernames |
|
| 254 | + // usernames |
|
| 255 | 255 | |
| 256 | - // --------- |
|
| 256 | + // --------- |
|
| 257 | 257 | |
| 258 | - // get mapping of user IDs to usernames |
|
| 258 | + // get mapping of user IDs to usernames |
|
| 259 | 259 | |
| 260 | - $memberHandler = xoops_getHandler('member'); |
|
| 260 | + $memberHandler = xoops_getHandler('member'); |
|
| 261 | 261 | |
| 262 | - $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'); |
|
| 262 | + $criteria = new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'); |
|
| 263 | 263 | |
| 264 | - $usernames = $memberHandler->getUserList($criteria); |
|
| 264 | + $usernames = $memberHandler->getUserList($criteria); |
|
| 265 | 265 | |
| 266 | - // add usernames to $games |
|
| 266 | + // add usernames to $games |
|
| 267 | 267 | |
| 268 | - foreach ($games as $k => $game) { |
|
| 269 | - $games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?'; |
|
| 268 | + foreach ($games as $k => $game) { |
|
| 269 | + $games[$k]['username_white'] = $usernames[$game['white_uid']] ?? '?'; |
|
| 270 | 270 | |
| 271 | - $games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?'; |
|
| 272 | - } |
|
| 271 | + $games[$k]['username_black'] = $usernames[$game['black_uid']] ?? '?'; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - // add usernames to $challenges |
|
| 274 | + // add usernames to $challenges |
|
| 275 | 275 | |
| 276 | - foreach ($challenges as $k => $challenge) { |
|
| 277 | - $challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?'; |
|
| 276 | + foreach ($challenges as $k => $challenge) { |
|
| 277 | + $challenges[$k]['username_player1'] = $usernames[$challenge['player1_uid']] ?? '?'; |
|
| 278 | 278 | |
| 279 | - $challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?'; |
|
| 280 | - } |
|
| 279 | + $challenges[$k]['username_player2'] = $usernames[$challenge['player2_uid']] ?? '?'; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - $xoopsTpl->assign('chess_games', $games); |
|
| 282 | + $xoopsTpl->assign('chess_games', $games); |
|
| 283 | 283 | |
| 284 | - $xoopsTpl->assign('chess_challenges', $challenges); |
|
| 284 | + $xoopsTpl->assign('chess_challenges', $challenges); |
|
| 285 | 285 | |
| 286 | - $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system')); |
|
| 286 | + $xoopsTpl->assign('chess_rating_system', chess_moduleConfig('rating_system')); |
|
| 287 | 287 | |
| 288 | - // ----- |
|
| 288 | + // ----- |
|
| 289 | 289 | |
| 290 | - // forms |
|
| 290 | + // forms |
|
| 291 | 291 | |
| 292 | - // ----- |
|
| 292 | + // ----- |
|
| 293 | 293 | |
| 294 | - // security token not needed for this form |
|
| 294 | + // security token not needed for this form |
|
| 295 | 295 | |
| 296 | - $form1 = new XoopsThemeForm('', 'form1', 'index.php'); |
|
| 296 | + $form1 = new XoopsThemeForm('', 'form1', 'index.php'); |
|
| 297 | 297 | |
| 298 | - $form1->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit')); |
|
| 298 | + $form1->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit')); |
|
| 299 | 299 | |
| 300 | - $menu_cshow = new XoopsFormSelect('', 'cshow', $cshow, 1, false); |
|
| 300 | + $menu_cshow = new XoopsFormSelect('', 'cshow', $cshow, 1, false); |
|
| 301 | 301 | |
| 302 | - $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_OPEN, _MD_CHESS_SHOW_CHALLENGES_OPEN); |
|
| 302 | + $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_OPEN, _MD_CHESS_SHOW_CHALLENGES_OPEN); |
|
| 303 | 303 | |
| 304 | - $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_USER, _MD_CHESS_SHOW_CHALLENGES_USER); |
|
| 304 | + $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_USER, _MD_CHESS_SHOW_CHALLENGES_USER); |
|
| 305 | 305 | |
| 306 | - $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_BOTH, _MD_CHESS_SHOW_CHALLENGES_BOTH); |
|
| 306 | + $menu_cshow->addOption(_CHESS_SHOW_CHALLENGES_BOTH, _MD_CHESS_SHOW_CHALLENGES_BOTH); |
|
| 307 | 307 | |
| 308 | - $form1->addElement($menu_cshow); |
|
| 308 | + $form1->addElement($menu_cshow); |
|
| 309 | 309 | |
| 310 | - $form1->addElement(new XoopsFormHidden('gstart', $gstart)); |
|
| 310 | + $form1->addElement(new XoopsFormHidden('gstart', $gstart)); |
|
| 311 | 311 | |
| 312 | - $form1->addElement(new XoopsFormHidden('gshow1', $gshow1)); |
|
| 312 | + $form1->addElement(new XoopsFormHidden('gshow1', $gshow1)); |
|
| 313 | 313 | |
| 314 | - $form1->addElement(new XoopsFormHidden('gshow2', $gshow2)); |
|
| 314 | + $form1->addElement(new XoopsFormHidden('gshow2', $gshow2)); |
|
| 315 | 315 | |
| 316 | - $form1->assign($xoopsTpl); |
|
| 316 | + $form1->assign($xoopsTpl); |
|
| 317 | 317 | |
| 318 | - // security token not needed for this form |
|
| 318 | + // security token not needed for this form |
|
| 319 | 319 | |
| 320 | - $form2 = new XoopsThemeForm('', 'form2', 'index.php'); |
|
| 320 | + $form2 = new XoopsThemeForm('', 'form2', 'index.php'); |
|
| 321 | 321 | |
| 322 | - $form2->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit')); |
|
| 322 | + $form2->addElement(new XoopsFormButton('', 'submit', _MD_CHESS_SUBMIT_BUTTON, 'submit')); |
|
| 323 | 323 | |
| 324 | - $menu_gshow1 = new XoopsFormSelect('', 'gshow1', $gshow1, 1, false); |
|
| 324 | + $menu_gshow1 = new XoopsFormSelect('', 'gshow1', $gshow1, 1, false); |
|
| 325 | 325 | |
| 326 | - $menu_gshow1->addOption(_CHESS_SHOW_GAMES_INPLAY, _MD_CHESS_SHOW_GAMES_INPLAY); |
|
| 326 | + $menu_gshow1->addOption(_CHESS_SHOW_GAMES_INPLAY, _MD_CHESS_SHOW_GAMES_INPLAY); |
|
| 327 | 327 | |
| 328 | - $menu_gshow1->addOption(_CHESS_SHOW_GAMES_CONCLUDED, _MD_CHESS_SHOW_GAMES_CONCLUDED); |
|
| 328 | + $menu_gshow1->addOption(_CHESS_SHOW_GAMES_CONCLUDED, _MD_CHESS_SHOW_GAMES_CONCLUDED); |
|
| 329 | 329 | |
| 330 | - $menu_gshow1->addOption(_CHESS_SHOW_GAMES_BOTH, _MD_CHESS_SHOW_GAMES_BOTH); |
|
| 330 | + $menu_gshow1->addOption(_CHESS_SHOW_GAMES_BOTH, _MD_CHESS_SHOW_GAMES_BOTH); |
|
| 331 | 331 | |
| 332 | - $form2->addElement($menu_gshow1); |
|
| 332 | + $form2->addElement($menu_gshow1); |
|
| 333 | 333 | |
| 334 | - $menu_gshow2 = new XoopsFormSelect('', 'gshow2', $gshow2, 1, false); |
|
| 334 | + $menu_gshow2 = new XoopsFormSelect('', 'gshow2', $gshow2, 1, false); |
|
| 335 | 335 | |
| 336 | - $menu_gshow2->addOption(_CHESS_SHOW_GAMES_RATED, _MD_CHESS_SHOW_GAMES_RATED); |
|
| 336 | + $menu_gshow2->addOption(_CHESS_SHOW_GAMES_RATED, _MD_CHESS_SHOW_GAMES_RATED); |
|
| 337 | 337 | |
| 338 | - $menu_gshow2->addOption(_CHESS_SHOW_GAMES_UNRATED, _MD_CHESS_SHOW_GAMES_UNRATED); |
|
| 338 | + $menu_gshow2->addOption(_CHESS_SHOW_GAMES_UNRATED, _MD_CHESS_SHOW_GAMES_UNRATED); |
|
| 339 | 339 | |
| 340 | - $form2->addElement($menu_gshow2); |
|
| 340 | + $form2->addElement($menu_gshow2); |
|
| 341 | 341 | |
| 342 | - $form2->addElement(new XoopsFormHidden('cstart', $cstart)); |
|
| 342 | + $form2->addElement(new XoopsFormHidden('cstart', $cstart)); |
|
| 343 | 343 | |
| 344 | - $form2->addElement(new XoopsFormHidden('cshow', $cshow)); |
|
| 344 | + $form2->addElement(new XoopsFormHidden('cshow', $cshow)); |
|
| 345 | 345 | |
| 346 | - $form2->assign($xoopsTpl); |
|
| 346 | + $form2->assign($xoopsTpl); |
|
| 347 | 347 | |
| 348 | - #*#DEBUG# - trying something unrelated to the chess module |
|
| 349 | - /*** |
|
| 348 | + #*#DEBUG# - trying something unrelated to the chess module |
|
| 349 | + /*** |
|
| 350 | 350 | * $configHandler = xoops_getHandler('config'); |
| 351 | 351 | * $clist = $configHandler->getConfigList(18); |
| 352 | 352 | * var_dump('clist', $clist); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | define('_HE_CHESS_INTRO_TITLE', 'Introduction'); |
| 23 | 23 | |
| 24 | 24 | define( |
| 25 | - '_HE_CHESS_INTRO_010', |
|
| 26 | - ' |
|
| 25 | + '_HE_CHESS_INTRO_010', |
|
| 26 | + ' |
|
| 27 | 27 | This software is intended to comply with the <a href="http://fide.com/official/handbook.asp?level=EE1">Laws of Chess</a> |
| 28 | 28 | as stipulated by the Fédération Internationale des Échecs (International Chess Federation), |
| 29 | 29 | commonly known as FIDE. |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | define('_HE_CHESS_CREATE_TITLE', 'Creating new games'); |
| 36 | 36 | |
| 37 | 37 | define( |
| 38 | - '_HE_CHESS_CREATE_010', |
|
| 39 | - ' |
|
| 38 | + '_HE_CHESS_CREATE_010', |
|
| 39 | + ' |
|
| 40 | 40 | There are three types of games that you may create: |
| 41 | 41 | ' |
| 42 | 42 | ); |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | define('_HE_CHESS_CREATE_010_3', 'Self-play'); |
| 46 | 46 | |
| 47 | 47 | define( |
| 48 | - '_HE_CHESS_CREATE_020', |
|
| 49 | - ' |
|
| 48 | + '_HE_CHESS_CREATE_020', |
|
| 49 | + ' |
|
| 50 | 50 | An <em>open challenge</em> may be accepted by anyone. |
| 51 | 51 | An <em>individual challenge</em> may only be accepted by a specified user. |
| 52 | 52 | A <em>self-play</em> game may be created if you wish to experiment with this software. |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | 56 | define( |
| 57 | - '_HE_CHESS_CREATE_030', |
|
| 58 | - ' |
|
| 57 | + '_HE_CHESS_CREATE_030', |
|
| 58 | + ' |
|
| 59 | 59 | You may optionally provide an initial board setup position using Forsyth-Edwards Notation (FEN). |
| 60 | 60 | ' |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | define( |
| 64 | - '_HE_CHESS_CREATE_040', |
|
| 65 | - ' |
|
| 64 | + '_HE_CHESS_CREATE_040', |
|
| 65 | + ' |
|
| 66 | 66 | You may specify that your opponent will choose the colors, |
| 67 | 67 | that the colors will be assigned randomly, |
| 68 | 68 | or you may choose a specific color. |
@@ -70,23 +70,23 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | define( |
| 73 | - '_HE_CHESS_CREATE_050', |
|
| 74 | - ' |
|
| 73 | + '_HE_CHESS_CREATE_050', |
|
| 74 | + ' |
|
| 75 | 75 | You may specify whether the game will be rated. |
| 76 | 76 | ' |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | define( |
| 80 | - '_HE_CHESS_CREATE_060', |
|
| 81 | - ' |
|
| 80 | + '_HE_CHESS_CREATE_060', |
|
| 81 | + ' |
|
| 82 | 82 | A challenge game will be created as soon as another user accepts the challenge. |
| 83 | 83 | A self-play game will be created immediately. |
| 84 | 84 | ' |
| 85 | 85 | ); |
| 86 | 86 | |
| 87 | 87 | define( |
| 88 | - '_HE_CHESS_CREATE_070', |
|
| 89 | - ' |
|
| 88 | + '_HE_CHESS_CREATE_070', |
|
| 89 | + ' |
|
| 90 | 90 | A challenger may delete his challenge at any time prior to its acceptance. |
| 91 | 91 | ' |
| 92 | 92 | ); |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | define('_HE_CHESS_RATINGS_TITLE', 'Player rating system'); |
| 97 | 97 | |
| 98 | 98 | define( |
| 99 | - '_HE_CHESS_RATINGS_CXR', |
|
| 100 | - ' |
|
| 99 | + '_HE_CHESS_RATINGS_CXR', |
|
| 100 | + ' |
|
| 101 | 101 | CXR - An adaptation of the ELO rating system, used by permission of <a target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</a> |
| 102 | 102 | ' |
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | 105 | define( |
| 106 | - '_HE_CHESS_RATINGS_LINEAR', |
|
| 107 | - ' |
|
| 106 | + '_HE_CHESS_RATINGS_LINEAR', |
|
| 107 | + ' |
|
| 108 | 108 | Linear - A very simple system that adds (subtracts) a fixed number of points for a win (loss). |
| 109 | 109 | ' |
| 110 | 110 | ); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | define('_HE_CHESS_PLAY_TITLE', 'Playing a game'); |
| 115 | 115 | |
| 116 | 116 | define( |
| 117 | - '_HE_CHESS_PLAY_010', |
|
| 118 | - ' |
|
| 117 | + '_HE_CHESS_PLAY_010', |
|
| 118 | + ' |
|
| 119 | 119 | A player can choose from the following actions. |
| 120 | 120 | Not all of these actions are available all of the time. |
| 121 | 121 | ' |
@@ -131,16 +131,16 @@ discard block |
||
| 131 | 131 | define('_HE_CHESS_PLAY_010_9', 'Request arbitration'); |
| 132 | 132 | |
| 133 | 133 | define( |
| 134 | - '_HE_CHESS_PLAY_020', |
|
| 135 | - ' |
|
| 134 | + '_HE_CHESS_PLAY_020', |
|
| 135 | + ' |
|
| 136 | 136 | You may make a <em>normal move</em> if it is your turn to move. |
| 137 | 137 | Moving is discussed in detail <a href="#moving">below</a>. |
| 138 | 138 | ' |
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | define( |
| 142 | - '_HE_CHESS_PLAY_030', |
|
| 143 | - ' |
|
| 142 | + '_HE_CHESS_PLAY_030', |
|
| 143 | + ' |
|
| 144 | 144 | You may <em>claim a draw</em> if the conditions are satisfied for the 50-move rule or the threefold repetition rule, |
| 145 | 145 | and it is your turn to move. |
| 146 | 146 | You may optionally enter a (legal) move that will cause the conditions to be satisfied. |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | 152 | define( |
| 153 | - '_HE_CHESS_PLAY_040', |
|
| 154 | - ' |
|
| 153 | + '_HE_CHESS_PLAY_040', |
|
| 154 | + ' |
|
| 155 | 155 | You may <em>offer a draw</em> either on your turn or on your opponent\'s turn. |
| 156 | 156 | You may not withdraw the offer. |
| 157 | 157 | Your opponent must either <em>accept</em> it or <em>reject</em> it. |
@@ -164,40 +164,40 @@ discard block |
||
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | define( |
| 167 | - '_HE_CHESS_PLAY_050', |
|
| 168 | - ' |
|
| 167 | + '_HE_CHESS_PLAY_050', |
|
| 168 | + ' |
|
| 169 | 169 | You may <em>resign</em> either on your turn or on your opponent\'s turn. |
| 170 | 170 | This will immediately end the game, and your opponent will be the winner. |
| 171 | 171 | ' |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | define( |
| 175 | - '_HE_CHESS_PLAY_060', |
|
| 176 | - ' |
|
| 175 | + '_HE_CHESS_PLAY_060', |
|
| 176 | + ' |
|
| 177 | 177 | In a self-play game, you may <em>restart</em> the game at any time. |
| 178 | 178 | This will delete all moves made in the game and restart the game at its initial position. |
| 179 | 179 | ' |
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | 182 | define( |
| 183 | - '_HE_CHESS_PLAY_070', |
|
| 184 | - ' |
|
| 183 | + '_HE_CHESS_PLAY_070', |
|
| 184 | + ' |
|
| 185 | 185 | You may <em>delete</em> the game at any time. |
| 186 | 186 | This will permanently remove the game from the database. |
| 187 | 187 | ' |
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | 190 | define( |
| 191 | - '_HE_CHESS_PLAY_075', |
|
| 192 | - ' |
|
| 191 | + '_HE_CHESS_PLAY_075', |
|
| 192 | + ' |
|
| 193 | 193 | In a self-play game, you may <em>delete</em> the game at any time. |
| 194 | 194 | This will permanently remove the game from the database. |
| 195 | 195 | ' |
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | 198 | define( |
| 199 | - '_HE_CHESS_PLAY_080', |
|
| 200 | - ' |
|
| 199 | + '_HE_CHESS_PLAY_080', |
|
| 200 | + ' |
|
| 201 | 201 | You may <em>request arbitration</em> either on your turn or on your opponent\'s turn. |
| 202 | 202 | This will immediately suspend the game so that an arbiter may review it. |
| 203 | 203 | This action may be used for any situation that warrants it, including software bugs. |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | 209 | define( |
| 210 | - '_HE_CHESS_PLAY_090', |
|
| 211 | - ' |
|
| 210 | + '_HE_CHESS_PLAY_090', |
|
| 211 | + ' |
|
| 212 | 212 | If your browser is Javascript-enabled, a dialog will popup to <em>confirm</em> your move or other action. |
| 213 | 213 | If you prefer, you may disable that dialog by unchecking the Confirm checkbox. |
| 214 | 214 | (But remember, just like in "real" chess, once you make a move, you can\'t withdraw it.) |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | define('_HE_CHESS_ARBITRATION_TITLE', 'Suspended games and arbitration'); |
| 223 | 223 | |
| 224 | 224 | define( |
| 225 | - '_HE_CHESS_ARBITRATION_010', |
|
| 226 | - ' |
|
| 225 | + '_HE_CHESS_ARBITRATION_010', |
|
| 226 | + ' |
|
| 227 | 227 | While a game is suspended, no moves or other player actions can be made. |
| 228 | 228 | An arbiter will review the game and make a decision in compliance with the accepted Laws of Chess. |
| 229 | 229 | If necessary, the arbiter will consult the player(s) and/or seek advice elsewhere prior to making a decision. |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | define('_HE_CHESS_ARBITRATION_010_3', 'Delete game'); |
| 237 | 237 | |
| 238 | 238 | define( |
| 239 | - '_HE_CHESS_ARBITRATION_020', |
|
| 240 | - ' |
|
| 239 | + '_HE_CHESS_ARBITRATION_020', |
|
| 240 | + ' |
|
| 241 | 241 | When appropriate, an arbiter may also suspend a game that\'s in normal play. |
| 242 | 242 | ' |
| 243 | 243 | ); |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | define('_HE_CHESS_DISPLAY_TITLE', 'Board orientation and refreshing the display'); |
| 248 | 248 | |
| 249 | 249 | define( |
| 250 | - '_HE_CHESS_DISPLAY_010', |
|
| 251 | - ' |
|
| 250 | + '_HE_CHESS_DISPLAY_010', |
|
| 251 | + ' |
|
| 252 | 252 | There are three choices for how the chess board is oriented: |
| 253 | 253 | ' |
| 254 | 254 | ); |
@@ -258,24 +258,24 @@ discard block |
||
| 258 | 258 | define('_HE_CHESS_DISPLAY_010_3', 'Black at bottom'); |
| 259 | 259 | |
| 260 | 260 | define( |
| 261 | - '_HE_CHESS_DISPLAY_020', |
|
| 262 | - ' |
|
| 261 | + '_HE_CHESS_DISPLAY_020', |
|
| 262 | + ' |
|
| 263 | 263 | When you view a game in which you\'re playing, your color is at the bottom by default. |
| 264 | 264 | Otherwise white is at the bottom by default. |
| 265 | 265 | ' |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | 268 | define( |
| 269 | - '_HE_CHESS_DISPLAY_030', |
|
| 270 | - ' |
|
| 269 | + '_HE_CHESS_DISPLAY_030', |
|
| 270 | + ' |
|
| 271 | 271 | If you change the orientation setting, click the <em>Refresh</em> button to effect the change. |
| 272 | 272 | The orientation setting will revert to the default if you leave the page and later return to it. |
| 273 | 273 | ' |
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | 276 | define( |
| 277 | - '_HE_CHESS_DISPLAY_040', |
|
| 278 | - ' |
|
| 277 | + '_HE_CHESS_DISPLAY_040', |
|
| 278 | + ' |
|
| 279 | 279 | Note that if your opponent moves while you\'re viewing the board, your view will not automatically update. |
| 280 | 280 | You would need to use the Refresh button to update the board to see his move. |
| 281 | 281 | ' |
@@ -286,16 +286,16 @@ discard block |
||
| 286 | 286 | define('_HE_CHESS_NOTIFY_TITLE', 'Notifications and comments'); |
| 287 | 287 | |
| 288 | 288 | define( |
| 289 | - '_HE_CHESS_NOTIFY_010', |
|
| 290 | - ' |
|
| 289 | + '_HE_CHESS_NOTIFY_010', |
|
| 290 | + ' |
|
| 291 | 291 | You can subscribe to any of several <em>Notification Options</em> related to chess games, |
| 292 | 292 | such as notification when a new move is made and notification when a new challenge game is created. |
| 293 | 293 | ' |
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | 296 | define( |
| 297 | - '_HE_CHESS_NOTIFY_020', |
|
| 298 | - ' |
|
| 297 | + '_HE_CHESS_NOTIFY_020', |
|
| 298 | + ' |
|
| 299 | 299 | <em>Comments</em> may be posted for each game. |
| 300 | 300 | ' |
| 301 | 301 | ); |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | define('_HE_CHESS_MOUSE_TITLE', 'Moving (using the mouse)'); |
| 306 | 306 | |
| 307 | 307 | define( |
| 308 | - '_HE_CHESS_MOUSE_010', |
|
| 309 | - ' |
|
| 308 | + '_HE_CHESS_MOUSE_010', |
|
| 309 | + ' |
|
| 310 | 310 | Moves are made either by using a mouse (recommended), or by typing the notation for the move in the text box. |
| 311 | 311 | ' |
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | 314 | define( |
| 315 | - '_HE_CHESS_MOUSE_020', |
|
| 316 | - ' |
|
| 315 | + '_HE_CHESS_MOUSE_020', |
|
| 316 | + ' |
|
| 317 | 317 | To use the mouse, click on the piece to move, and then click on the destination tile. |
| 318 | 318 | (To castle, click on the king and its destination tile.) |
| 319 | 319 | Each tile clicked will be highlighted. |
@@ -324,8 +324,8 @@ discard block |
||
| 324 | 324 | ); |
| 325 | 325 | |
| 326 | 326 | define( |
| 327 | - '_HE_CHESS_MOUSE_030', |
|
| 328 | - ' |
|
| 327 | + '_HE_CHESS_MOUSE_030', |
|
| 328 | + ' |
|
| 329 | 329 | Moving with the mouse requires that your browser be Javascript-enabled. |
| 330 | 330 | ' |
| 331 | 331 | ); |
@@ -335,15 +335,15 @@ discard block |
||
| 335 | 335 | define('_HE_CHESS_NOTATION_TITLE', 'Moving (using notation)'); |
| 336 | 336 | |
| 337 | 337 | define( |
| 338 | - '_HE_CHESS_NOTATION_010', |
|
| 339 | - ' |
|
| 338 | + '_HE_CHESS_NOTATION_010', |
|
| 339 | + ' |
|
| 340 | 340 | As an alternative to using the mouse, you may enter moves by typing the notation in the text box. |
| 341 | 341 | ' |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | define( |
| 345 | - '_HE_CHESS_NOTATION_020', |
|
| 346 | - ' |
|
| 345 | + '_HE_CHESS_NOTATION_020', |
|
| 346 | + ' |
|
| 347 | 347 | The notation for a move is composed of four parts (and an optional fifth part for pawn promotion): |
| 348 | 348 | ' |
| 349 | 349 | ); |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | define('_HE_CHESS_NOTATION_020_5_A', 'Possible values: =Q, =R, =B, =N'); |
| 366 | 366 | |
| 367 | 367 | define( |
| 368 | - '_HE_CHESS_NOTATION_030', |
|
| 369 | - ' |
|
| 368 | + '_HE_CHESS_NOTATION_030', |
|
| 369 | + ' |
|
| 370 | 370 | Examples of complete moves: |
| 371 | 371 | ' |
| 372 | 372 | ); |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | define('_HE_CHESS_NOTATION_030_7', 'Pe7-e8=Q (pawn moves from e7 to e8 and is promoted to queen)'); |
| 380 | 380 | |
| 381 | 381 | define( |
| 382 | - '_HE_CHESS_NOTATION_040', |
|
| 383 | - ' |
|
| 382 | + '_HE_CHESS_NOTATION_040', |
|
| 383 | + ' |
|
| 384 | 384 | Instead of the above notation, you may use Standard Algebraic Notation (SAN). Examples: |
| 385 | 385 | ' |
| 386 | 386 | ); |
@@ -393,22 +393,22 @@ discard block |
||
| 393 | 393 | define('_HE_CHESS_NOTATION_040_7', 'e8Q (pawn moves to e8 and is promoted to queen)'); |
| 394 | 394 | |
| 395 | 395 | define( |
| 396 | - '_HE_CHESS_NOTATION_050', |
|
| 397 | - ' |
|
| 396 | + '_HE_CHESS_NOTATION_050', |
|
| 397 | + ' |
|
| 398 | 398 | The notation for castling uses the uppercase letter "O" (oh), not the digit "0" (zero). |
| 399 | 399 | ' |
| 400 | 400 | ); |
| 401 | 401 | |
| 402 | 402 | define( |
| 403 | - '_HE_CHESS_NOTATION_060', |
|
| 404 | - ' |
|
| 403 | + '_HE_CHESS_NOTATION_060', |
|
| 404 | + ' |
|
| 405 | 405 | SAN is described in more detail at the <a href="#fide">FIDE</a> site. |
| 406 | 406 | ' |
| 407 | 407 | ); |
| 408 | 408 | |
| 409 | 409 | define( |
| 410 | - '_HE_CHESS_NOTATION_070', |
|
| 411 | - ' |
|
| 410 | + '_HE_CHESS_NOTATION_070', |
|
| 411 | + ' |
|
| 412 | 412 | <em>The piece identifier must be upper case, and the file coordinate must be lower case. |
| 413 | 413 | Only valid, non-ambiguous moves will be accepted.</em> |
| 414 | 414 | ' |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | define('_HE_CHESS_EXPORT_TITLE', 'Exporting games'); |
| 420 | 420 | |
| 421 | 421 | define( |
| 422 | - '_HE_CHESS_EXPORT_010', |
|
| 423 | - ' |
|
| 422 | + '_HE_CHESS_EXPORT_010', |
|
| 423 | + ' |
|
| 424 | 424 | The current state of the game is displayed in both Portable Game Notation (PGN) and Forsyth-Edwards Notation (FEN). |
| 425 | 425 | These are widely used notations for representing chess games. |
| 426 | 426 | You may save the PGN or FEN representation of the game for your own records, |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | define('_HE_CHESS_MISC_TITLE', 'Miscellaneous'); |
| 434 | 434 | |
| 435 | 435 | define( |
| 436 | - '_HE_CHESS_MISC_010', |
|
| 437 | - ' |
|
| 436 | + '_HE_CHESS_MISC_010', |
|
| 437 | + ' |
|
| 438 | 438 | The stalemate test does not recognize whether a piece, other than the king, |
| 439 | 439 | is bound by check (unable to move because it would place the king in check). |
| 440 | 440 | So although the player won\'t be able to make any moves, the situation will not be detected as stalemate. |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | define('_HE_CHESS_MISC_010_IMAGE', 'stalemate example'); |
| 447 | 447 | |
| 448 | 448 | define( |
| 449 | - '_HE_CHESS_MISC_020', |
|
| 450 | - ' |
|
| 449 | + '_HE_CHESS_MISC_020', |
|
| 450 | + ' |
|
| 451 | 451 | Article 9.6 of the FIDE Laws of Chess states that |
| 452 | 452 | <em>The game is drawn when a position is reached from which a checkmate cannot occur by any possible series of legal moves, |
| 453 | 453 | even with the most unskilled play. This immediately ends the game.</em> |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | ); |
| 460 | 460 | |
| 461 | 461 | define( |
| 462 | - '_HE_CHESS_MISC_030', |
|
| 463 | - ' |
|
| 462 | + '_HE_CHESS_MISC_030', |
|
| 463 | + ' |
|
| 464 | 464 | There are no time constraints on play. |
| 465 | 465 | None of the FIDE rules concerning clocks, time limits or flags are applicable here. |
| 466 | 466 | ' |
@@ -471,29 +471,29 @@ discard block |
||
| 471 | 471 | define('_HE_CHESS_ADMIN_TITLE', 'Administration and arbitration'); |
| 472 | 472 | |
| 473 | 473 | define( |
| 474 | - '_HE_CHESS_ADMIN_010', |
|
| 475 | - ' |
|
| 474 | + '_HE_CHESS_ADMIN_010', |
|
| 475 | + ' |
|
| 476 | 476 | An <em>arbiter</em> is a user with module admin rights for the chess module. |
| 477 | 477 | ' |
| 478 | 478 | ); |
| 479 | 479 | |
| 480 | 480 | define( |
| 481 | - '_HE_CHESS_ADMIN_020', |
|
| 482 | - ' |
|
| 481 | + '_HE_CHESS_ADMIN_020', |
|
| 482 | + ' |
|
| 483 | 483 | From the Xoops control panel, an arbiter may view or edit the chess module preferences, and may arbitrate games and challenges. |
| 484 | 484 | ' |
| 485 | 485 | ); |
| 486 | 486 | |
| 487 | 487 | define( |
| 488 | - '_HE_CHESS_ADMIN_030', |
|
| 489 | - ' |
|
| 488 | + '_HE_CHESS_ADMIN_030', |
|
| 489 | + ' |
|
| 490 | 490 | When an arbiter accesses a challenge from the control panel, he has the option of deleting that challenge. |
| 491 | 491 | ' |
| 492 | 492 | ); |
| 493 | 493 | |
| 494 | 494 | define( |
| 495 | - '_HE_CHESS_ADMIN_040', |
|
| 496 | - ' |
|
| 495 | + '_HE_CHESS_ADMIN_040', |
|
| 496 | + ' |
|
| 497 | 497 | When an arbiter accesses an active or suspended game from the control panel, |
| 498 | 498 | he will see the normal game page, with the addition of <em>arbiter controls</em>. |
| 499 | 499 | If a game is active, the arbiter controls allow the arbiter to suspend the game. |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | ); |
| 505 | 505 | |
| 506 | 506 | define( |
| 507 | - '_HE_CHESS_ADMIN_050', |
|
| 508 | - ' |
|
| 507 | + '_HE_CHESS_ADMIN_050', |
|
| 508 | + ' |
|
| 509 | 509 | An arbiter may subscribe to be notified when a player requests arbitration in a chess game. |
| 510 | 510 | ' |
| 511 | 511 | ); |
@@ -14,15 +14,15 @@ |
||
| 14 | 14 | * @ignore |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -define('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE', "<span style='color: #008000;'>Available</span>"); |
|
| 18 | -define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE', "<span style='color: #ff0000;'>Not available</span>"); |
|
| 19 | -define('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTWRITABLE', "<span style='color: #ff0000;'>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: #008000;'>Available</span>"); |
|
| 18 | +define('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE', "<span style='color: #ff0000;'>Not available</span>"); |
|
| 19 | +define('CO_'.$moduleDirNameUpper.'_'.'FC_NOTWRITABLE', "<span style='color: #ff0000;'>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 | /**#@-*/ |
@@ -17,8 +17,8 @@ discard block |
||
| 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 |
||
| 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 | ' . _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 |
||
| 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 |
||
| 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. |
@@ -73,25 +73,25 @@ discard block |
||
| 73 | 73 | ' |
| 74 | 74 | Available rating systems: |
| 75 | 75 | <br><br> |
| 76 | - ' . _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> |
|
| 76 | + ' . _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> |
|
| 77 | 77 | <br><br> |
| 78 | - ' . _MI_CHESS_RATING_SYSTEM_LINEAR . ' - A very simple system that adds (subtracts) a fixed number of points for a win (loss). |
|
| 78 | + ' . _MI_CHESS_RATING_SYSTEM_LINEAR.' - A very simple system that adds (subtracts) a fixed number of points for a win (loss). |
|
| 79 | 79 | <br><br> |
| 80 | - Select "' . _MI_CHESS_RATING_SYSTEM_NONE . '" to disable the rating feature. |
|
| 80 | + Select "' . _MI_CHESS_RATING_SYSTEM_NONE.'" to disable the rating feature. |
|
| 81 | 81 | <br><br> |
| 82 | 82 | After changing this setting, you should rebuild the player ratings data from Main Menu >> Chess >> |
| 83 | - ' . _MI_CHESS_SMNAME4 . '. |
|
| 83 | + ' . _MI_CHESS_SMNAME4.'. |
|
| 84 | 84 | ' |
| 85 | 85 | ); |
| 86 | 86 | define('_MI_CHESS_INITIAL_RATING', 'Initial player rating'); |
| 87 | 87 | define( |
| 88 | 88 | '_MI_CHESS_INITIAL_RATING_DES', |
| 89 | 89 | ' |
| 90 | - If the "' . _MI_CHESS_RATING_SYSTEM_CXR . '" rating system is selected, this value should be between 800 and 2000. |
|
| 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. |
| 93 | 93 | <br><br> |
| 94 | - If you change this value, you should rebuild the player ratings data from Main Menu >> Chess >> ' . _MI_CHESS_SMNAME4 . '. |
|
| 94 | + If you change this value, you should rebuild the player ratings data from Main Menu >> Chess >> ' . _MI_CHESS_SMNAME4.'. |
|
| 95 | 95 | ' |
| 96 | 96 | ); |
| 97 | 97 | define('_MI_CHESS_ALLOW_UNRATED', 'Allow unrated games?'); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | //Help |
| 172 | 172 | define('_MI_CHESS_DIRNAME', basename(dirname(__DIR__, 2))); |
| 173 | -define('_MI_CHESS_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); |
|
| 173 | +define('_MI_CHESS_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); |
|
| 174 | 174 | define('_MI_CHESS_BACK_2_ADMIN', 'Back to Administration of '); |
| 175 | 175 | define('_MI_CHESS_OVERVIEW', 'Overview'); |
| 176 | 176 | |
@@ -25,132 +25,132 @@ discard block |
||
| 25 | 25 | $moduleDirName = basename(dirname(__DIR__, 2)); |
| 26 | 26 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
| 27 | 27 | |
| 28 | -define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); |
|
| 29 | -define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); |
|
| 30 | -define('CO_' . $moduleDirNameUpper . '_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)"); |
|
| 31 | -define('CO_' . $moduleDirNameUpper . '_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)"); |
|
| 32 | -define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); |
|
| 33 | -define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); |
|
| 34 | -define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); |
|
| 35 | -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); |
|
| 36 | -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> "); |
|
| 37 | -define('CO_' . $moduleDirNameUpper . '_OFF', "<span style='font-weight: bold;'>OFF</span>"); |
|
| 38 | -define('CO_' . $moduleDirNameUpper . '_ON', "<span style='font-weight: bold;'>ON</span>"); |
|
| 39 | -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); |
|
| 40 | -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); |
|
| 41 | -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>"); |
|
| 42 | -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); |
|
| 43 | - |
|
| 44 | -define('CO_' . $moduleDirNameUpper . '_PRINT', "<span style='font-weight: bold;'>Print</span>"); |
|
| 45 | -define('CO_' . $moduleDirNameUpper . '_PDF', "<span style='font-weight: bold;'>Create PDF</span>"); |
|
| 46 | - |
|
| 47 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); |
|
| 48 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); |
|
| 49 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); |
|
| 50 | -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); |
|
| 51 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); |
|
| 52 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); |
|
| 53 | -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); |
|
| 54 | - |
|
| 55 | -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); |
|
| 28 | +define('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS', 'GD library support: '); |
|
| 29 | +define('CO_'.$moduleDirNameUpper.'_GDLIBVERSION', 'GD Library version: '); |
|
| 30 | +define('CO_'.$moduleDirNameUpper.'_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)"); |
|
| 31 | +define('CO_'.$moduleDirNameUpper.'_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)"); |
|
| 32 | +define('CO_'.$moduleDirNameUpper.'_IMAGEINFO', 'Server status'); |
|
| 33 | +define('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); |
|
| 34 | +define('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); |
|
| 35 | +define('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); |
|
| 36 | +define('CO_'.$moduleDirNameUpper.'_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> "); |
|
| 37 | +define('CO_'.$moduleDirNameUpper.'_OFF', "<span style='font-weight: bold;'>OFF</span>"); |
|
| 38 | +define('CO_'.$moduleDirNameUpper.'_ON', "<span style='font-weight: bold;'>ON</span>"); |
|
| 39 | +define('CO_'.$moduleDirNameUpper.'_SERVERPATH', 'Server path to XOOPS root: '); |
|
| 40 | +define('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS', 'Server uploads status: '); |
|
| 41 | +define('CO_'.$moduleDirNameUpper.'_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>"); |
|
| 42 | +define('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); |
|
| 43 | + |
|
| 44 | +define('CO_'.$moduleDirNameUpper.'_PRINT', "<span style='font-weight: bold;'>Print</span>"); |
|
| 45 | +define('CO_'.$moduleDirNameUpper.'_PDF', "<span style='font-weight: bold;'>Create PDF</span>"); |
|
| 46 | + |
|
| 47 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); |
|
| 48 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED1', "Update failed - couldn't add new fields"); |
|
| 49 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); |
|
| 50 | +define('CO_'.$moduleDirNameUpper.'_ERROR_COLUMN', 'Could not create column in database : %s'); |
|
| 51 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); |
|
| 52 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); |
|
| 53 | +define('CO_'.$moduleDirNameUpper.'_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); |
|
| 54 | + |
|
| 55 | +define('CO_'.$moduleDirNameUpper.'_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); |
|
| 56 | 56 | |
| 57 | 57 | // Error Msgs |
| 58 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); |
|
| 59 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); |
|
| 60 | -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); |
|
| 58 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); |
|
| 59 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_REMOVE', 'Could not delete %s'); |
|
| 60 | +define('CO_'.$moduleDirNameUpper.'_ERROR_NO_PLUGIN', 'Could not load plugin'); |
|
| 61 | 61 | |
| 62 | 62 | //Help |
| 63 | -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__, 2))); |
|
| 64 | -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); |
|
| 65 | -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); |
|
| 66 | -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); |
|
| 63 | +define('CO_'.$moduleDirNameUpper.'_DIRNAME', basename(dirname(__DIR__, 2))); |
|
| 64 | +define('CO_'.$moduleDirNameUpper.'_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); |
|
| 65 | +define('CO_'.$moduleDirNameUpper.'_BACK_2_ADMIN', 'Back to Administration of '); |
|
| 66 | +define('CO_'.$moduleDirNameUpper.'_OVERVIEW', 'Overview'); |
|
| 67 | 67 | |
| 68 | 68 | //define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); |
| 69 | 69 | |
| 70 | 70 | //help multi-page |
| 71 | -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); |
|
| 72 | -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); |
|
| 73 | -define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); |
|
| 71 | +define('CO_'.$moduleDirNameUpper.'_DISCLAIMER', 'Disclaimer'); |
|
| 72 | +define('CO_'.$moduleDirNameUpper.'_LICENSE', 'License'); |
|
| 73 | +define('CO_'.$moduleDirNameUpper.'_SUPPORT', 'Support'); |
|
| 74 | 74 | |
| 75 | 75 | //Sample Data |
| 76 | -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); |
|
| 77 | -define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully'); |
|
| 78 | -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); |
|
| 79 | -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); |
|
| 80 | -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); |
|
| 81 | -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); |
|
| 82 | -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); |
|
| 83 | -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); |
|
| 84 | -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); |
|
| 85 | -define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); |
|
| 86 | -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); |
|
| 87 | -define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); |
|
| 76 | +define('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); |
|
| 77 | +define('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully'); |
|
| 78 | +define('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA', 'Export Tables to YAML'); |
|
| 79 | +define('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); |
|
| 80 | +define('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); |
|
| 81 | +define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA', 'Export DB Schema to YAML'); |
|
| 82 | +define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); |
|
| 83 | +define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); |
|
| 84 | +define('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); |
|
| 85 | +define('CO_'.$moduleDirNameUpper.'_'.'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); |
|
| 86 | +define('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); |
|
| 87 | +define('CO_'.$moduleDirNameUpper.'_'.'CONFIRM', 'Confirm'); |
|
| 88 | 88 | |
| 89 | 89 | //letter choice |
| 90 | -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "<span style='font-weight: bold;'>Browse items alphabetically</span>"); |
|
| 91 | -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); |
|
| 92 | -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); |
|
| 90 | +define('CO_'.$moduleDirNameUpper.'_'.'BROWSETOTOPIC', "<span style='font-weight: bold;'>Browse items alphabetically</span>"); |
|
| 91 | +define('CO_'.$moduleDirNameUpper.'_'.'OTHER', 'Other'); |
|
| 92 | +define('CO_'.$moduleDirNameUpper.'_'.'ALL', 'All'); |
|
| 93 | 93 | |
| 94 | 94 | // block defines |
| 95 | -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); |
|
| 96 | -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); |
|
| 97 | -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); |
|
| 98 | -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); |
|
| 99 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); |
|
| 100 | -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); |
|
| 101 | -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); |
|
| 102 | -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); |
|
| 103 | -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); |
|
| 104 | -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); |
|
| 105 | -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); |
|
| 106 | -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); |
|
| 107 | -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); |
|
| 108 | -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); |
|
| 109 | -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); |
|
| 110 | - |
|
| 111 | -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); |
|
| 112 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); |
|
| 113 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); |
|
| 114 | - |
|
| 115 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); |
|
| 116 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); |
|
| 117 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); |
|
| 118 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); |
|
| 95 | +define('CO_'.$moduleDirNameUpper.'_'.'ACCESSRIGHTS', 'Access Rights'); |
|
| 96 | +define('CO_'.$moduleDirNameUpper.'_'.'ACTION', 'Action'); |
|
| 97 | +define('CO_'.$moduleDirNameUpper.'_'.'ACTIVERIGHTS', 'Active Rights'); |
|
| 98 | +define('CO_'.$moduleDirNameUpper.'_'.'BADMIN', 'Block Administration'); |
|
| 99 | +define('CO_'.$moduleDirNameUpper.'_'.'BLKDESC', 'Description'); |
|
| 100 | +define('CO_'.$moduleDirNameUpper.'_'.'CBCENTER', 'Center Middle'); |
|
| 101 | +define('CO_'.$moduleDirNameUpper.'_'.'CBLEFT', 'Center Left'); |
|
| 102 | +define('CO_'.$moduleDirNameUpper.'_'.'CBRIGHT', 'Center Right'); |
|
| 103 | +define('CO_'.$moduleDirNameUpper.'_'.'SBLEFT', 'Left'); |
|
| 104 | +define('CO_'.$moduleDirNameUpper.'_'.'SBRIGHT', 'Right'); |
|
| 105 | +define('CO_'.$moduleDirNameUpper.'_'.'SIDE', 'Alignment'); |
|
| 106 | +define('CO_'.$moduleDirNameUpper.'_'.'TITLE', 'Title'); |
|
| 107 | +define('CO_'.$moduleDirNameUpper.'_'.'VISIBLE', 'Visible'); |
|
| 108 | +define('CO_'.$moduleDirNameUpper.'_'.'VISIBLEIN', 'Visible In'); |
|
| 109 | +define('CO_'.$moduleDirNameUpper.'_'.'WEIGHT', 'Weight'); |
|
| 110 | + |
|
| 111 | +define('CO_'.$moduleDirNameUpper.'_'.'PERMISSIONS', 'Permissions'); |
|
| 112 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS', 'Blocks Admin'); |
|
| 113 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_DESC', 'Blocks/Group Admin'); |
|
| 114 | + |
|
| 115 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_MANAGMENT', 'Manage'); |
|
| 116 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_ADDBLOCK', 'Add a new block'); |
|
| 117 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_EDITBLOCK', 'Edit a block'); |
|
| 118 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_CLONEBLOCK', 'Clone a block'); |
|
| 119 | 119 | |
| 120 | 120 | //myblocksadmin |
| 121 | -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); |
|
| 122 | -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); |
|
| 123 | -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); |
|
| 121 | +define('CO_'.$moduleDirNameUpper.'_'.'AGDS', 'Admin Groups'); |
|
| 122 | +define('CO_'.$moduleDirNameUpper.'_'.'BCACHETIME', 'Cache Time'); |
|
| 123 | +define('CO_'.$moduleDirNameUpper.'_'.'BLOCKS_ADMIN', 'Blocks Admin'); |
|
| 124 | 124 | |
| 125 | 125 | //Template Admin |
| 126 | -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); |
|
| 127 | -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); |
|
| 128 | -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); |
|
| 126 | +define('CO_'.$moduleDirNameUpper.'_'.'TPLSETS', 'Template Management'); |
|
| 127 | +define('CO_'.$moduleDirNameUpper.'_'.'GENERATE', 'Generate'); |
|
| 128 | +define('CO_'.$moduleDirNameUpper.'_'.'FILENAME', 'File Name'); |
|
| 129 | 129 | |
| 130 | 130 | //Menu |
| 131 | -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); |
|
| 132 | -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); |
|
| 133 | -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); |
|
| 134 | -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); |
|
| 135 | -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); |
|
| 136 | -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); |
|
| 137 | -define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK', 'Database migrated to current schema.'); |
|
| 138 | -define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING', 'Warning! This is intended for developers only. Confirm write schema file from current database.'); |
|
| 139 | -define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK', 'Current schema file written'); |
|
| 131 | +define('CO_'.$moduleDirNameUpper.'_'.'ADMENU_MIGRATE', 'Migrate'); |
|
| 132 | +define('CO_'.$moduleDirNameUpper.'_'.'FOLDER_YES', 'Folder "%s" exist'); |
|
| 133 | +define('CO_'.$moduleDirNameUpper.'_'.'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); |
|
| 134 | +define('CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); |
|
| 135 | +define('CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); |
|
| 136 | +define('CO_'.$moduleDirNameUpper.'_'.'ADMENU_FEEDBACK', 'Feedback'); |
|
| 137 | +define('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_OK', 'Database migrated to current schema.'); |
|
| 138 | +define('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_WARNING', 'Warning! This is intended for developers only. Confirm write schema file from current database.'); |
|
| 139 | +define('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_SCHEMA_OK', 'Current schema file written'); |
|
| 140 | 140 | |
| 141 | 141 | //Latest Version Check |
| 142 | -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); |
|
| 142 | +define('CO_'.$moduleDirNameUpper.'_'.'NEW_VERSION', 'New Version: '); |
|
| 143 | 143 | |
| 144 | 144 | //DirectoryChecker |
| 145 | -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "<span style='color: #008000;'>Available</span>"); |
|
| 146 | -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "<span style='color: #ff0000;'>Not available</span>"); |
|
| 147 | -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "<span style='color: #ff0000;'>Should have permission ( %d ), but it has ( %d )</span>"); |
|
| 148 | -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); |
|
| 149 | -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); |
|
| 150 | -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); |
|
| 151 | -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); |
|
| 152 | -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); |
|
| 153 | -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); |
|
| 145 | +define('CO_'.$moduleDirNameUpper.'_'.'AVAILABLE', "<span style='color: #008000;'>Available</span>"); |
|
| 146 | +define('CO_'.$moduleDirNameUpper.'_'.'NOTAVAILABLE', "<span style='color: #ff0000;'>Not available</span>"); |
|
| 147 | +define('CO_'.$moduleDirNameUpper.'_'.'NOTWRITABLE', "<span style='color: #ff0000;'>Should have permission ( %d ), but it has ( %d )</span>"); |
|
| 148 | +define('CO_'.$moduleDirNameUpper.'_'.'CREATETHEDIR', 'Create it'); |
|
| 149 | +define('CO_'.$moduleDirNameUpper.'_'.'SETMPERM', 'Set the permission'); |
|
| 150 | +define('CO_'.$moduleDirNameUpper.'_'.'DIRCREATED', 'The directory has been created'); |
|
| 151 | +define('CO_'.$moduleDirNameUpper.'_'.'DIRNOTCREATED', 'The directory cannot be created'); |
|
| 152 | +define('CO_'.$moduleDirNameUpper.'_'.'PERMSET', 'The permission has been set'); |
|
| 153 | +define('CO_'.$moduleDirNameUpper.'_'.'PERMNOTSET', 'The permission cannot be set'); |
|
| 154 | 154 | |
| 155 | 155 | //FileChecker |
| 156 | 156 | //define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "<span style='color: green;'>Available</span>"); |
@@ -160,36 +160,36 @@ discard block |
||
| 160 | 160 | //define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); |
| 161 | 161 | //define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); |
| 162 | 162 | |
| 163 | -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); |
|
| 164 | -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); |
|
| 163 | +define('CO_'.$moduleDirNameUpper.'_'.'FILECOPIED', 'The file has been copied'); |
|
| 164 | +define('CO_'.$moduleDirNameUpper.'_'.'FILENOTCOPIED', 'The file cannot be copied'); |
|
| 165 | 165 | |
| 166 | 166 | //define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); |
| 167 | 167 | //define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); |
| 168 | 168 | |
| 169 | 169 | //image config |
| 170 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); |
|
| 171 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); |
|
| 172 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); |
|
| 173 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); |
|
| 174 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '<span style="color: #FF0000; font-size: Small; font-weight: bold;">--- EXTERNAL Image configuration ---</span> '); |
|
| 175 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); |
|
| 176 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); |
|
| 177 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); |
|
| 178 | - |
|
| 179 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE', 'Image File Size (in Bytes)'); |
|
| 180 | -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC', 'The maximum file size of the image file (in Bytes)'); |
|
| 170 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_WIDTH', 'Image Display Width'); |
|
| 171 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_WIDTH_DSC', 'Display width for image'); |
|
| 172 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_HEIGHT', 'Image Display Height'); |
|
| 173 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_HEIGHT_DSC', 'Display height for image'); |
|
| 174 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_CONFIG', '<span style="color: #FF0000; font-size: Small; font-weight: bold;">--- EXTERNAL Image configuration ---</span> '); |
|
| 175 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_CONFIG_DSC', ''); |
|
| 176 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_UPLOAD_PATH', 'Image Upload path'); |
|
| 177 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); |
|
| 178 | + |
|
| 179 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_FILE_SIZE', 'Image File Size (in Bytes)'); |
|
| 180 | +define('CO_'.$moduleDirNameUpper.'_'.'IMAGE_FILE_SIZE_DSC', 'The maximum file size of the image file (in Bytes)'); |
|
| 181 | 181 | |
| 182 | 182 | //Preferences |
| 183 | -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); |
|
| 184 | -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); |
|
| 183 | +define('CO_'.$moduleDirNameUpper.'_'.'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); |
|
| 184 | +define('CO_'.$moduleDirNameUpper.'_'.'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); |
|
| 185 | 185 | |
| 186 | 186 | //Module Stats |
| 187 | -define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); |
|
| 188 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); |
|
| 189 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); |
|
| 190 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); |
|
| 191 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); |
|
| 192 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); |
|
| 193 | -define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); |
|
| 187 | +define('CO_'.$moduleDirNameUpper.'_'.'STATS_SUMMARY', 'Module Statistics'); |
|
| 188 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_CATEGORIES', 'Categories:'); |
|
| 189 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_ITEMS', 'Items'); |
|
| 190 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_OFFLINE', 'Offline'); |
|
| 191 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_PUBLISHED', 'Published'); |
|
| 192 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_REJECTED', 'Rejected'); |
|
| 193 | +define('CO_'.$moduleDirNameUpper.'_'.'TOTAL_SUBMITTED', 'Submitted'); |
|
| 194 | 194 | |
| 195 | 195 | /**#@-*/ |