mambax7 /
chess
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | // ------------------------------------------------------------------------ // |
||
| 4 | // XOOPS - PHP Content Management System // |
||
| 5 | // Copyright (c) 2000 XOOPS.org // |
||
| 6 | // <https://xoops.org> // |
||
| 7 | // ------------------------------------------------------------------------ // |
||
| 8 | // This program is free software; you can redistribute it and/or modify // |
||
| 9 | // it under the terms of the GNU General Public License as published by // |
||
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
||
| 11 | // (at your option) any later version. // |
||
| 12 | // // |
||
| 13 | // You may not change or alter any portion of this comment or credits // |
||
| 14 | // of supporting developers from this source code or any supporting // |
||
| 15 | // source code which is considered copyrighted (c) material of the // |
||
| 16 | // original comment or credit authors. // |
||
| 17 | // // |
||
| 18 | // This program is distributed in the hope that it will be useful, // |
||
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
| 21 | // GNU General Public License for more details. // |
||
| 22 | // // |
||
| 23 | // You should have received a copy of the GNU General Public License // |
||
| 24 | // along with this program; if not, write to the Free Software // |
||
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
| 26 | // ------------------------------------------------------------------------ // |
||
| 27 | |||
| 28 | $moduleDirName = basename(__DIR__); |
||
| 29 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
| 30 | |||
| 31 | // ------------------- Informations ------------------- // |
||
| 32 | $modversion = [ |
||
| 33 | 'version' => 2.01, |
||
| 34 | 'module_status' => 'Alpha 1', |
||
| 35 | 'release_date' => '2020/05/25', |
||
| 36 | 'name' => _MI_CHESS, |
||
| 37 | 'description' => _MI_CHESS_DES, |
||
| 38 | 'official' => 0, |
||
| 39 | //1 indicates official XOOPS module supported by XOOPS Dev Team, 0 means 3rd party supported |
||
| 40 | 'author' => '<a target="_blank" href="http://Dave-L.com/">Dave Lerner</a>, Mamba', |
||
| 41 | |||
| 42 | 'credits' => 'XOOPS Development Team', |
||
| 43 | 'author_mail' => 'author-email', |
||
| 44 | 'author_website_url' => 'https://xoops.org', |
||
| 45 | 'author_website_name' => 'XOOPS', |
||
| 46 | 'license' => 'GPL 2.0 or later', |
||
| 47 | 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
||
| 48 | // ------------------- Folders & Files ------------------- |
||
| 49 | 'release_info' => 'Changelog', |
||
| 50 | 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", |
||
| 51 | |||
| 52 | 'manual' => 'link to manual file', |
||
| 53 | 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", |
||
| 54 | // images |
||
| 55 | 'image' => 'assets/images/logoModule.png', |
||
| 56 | 'iconsmall' => 'assets/images/iconsmall.png', |
||
| 57 | 'iconbig' => 'assets/images/iconbig.png', |
||
| 58 | 'dirname' => $moduleDirName, |
||
| 59 | //Frameworks |
||
| 60 | // 'dirmoduleadmin' => 'Frameworks/moduleclasses/moduleadmin', |
||
| 61 | // 'sysicons16' => 'Frameworks/moduleclasses/icons/16', |
||
| 62 | // 'sysicons32' => 'Frameworks/moduleclasses/icons/32', |
||
| 63 | // Local path icons |
||
| 64 | 'modicons16' => 'assets/images/icons/16', |
||
| 65 | 'modicons32' => 'assets/images/icons/32', |
||
| 66 | //About |
||
| 67 | 'demo_site_url' => 'https://xoops.org', |
||
| 68 | 'demo_site_name' => 'XOOPS Demo Site', |
||
| 69 | 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', |
||
| 70 | 'support_name' => 'Support Forum', |
||
| 71 | 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', |
||
| 72 | 'module_website_url' => 'www.xoops.org', |
||
| 73 | 'module_website_name' => 'XOOPS Project', |
||
| 74 | // ------------------- Min Requirements ------------------- |
||
| 75 | 'min_php' => '7.2', |
||
| 76 | 'min_xoops' => '2.5.10', |
||
| 77 | 'min_admin' => '1.2', |
||
| 78 | 'min_db' => ['mysql' => '5.5'], |
||
| 79 | // ------------------- Admin Menu ------------------- |
||
| 80 | 'system_menu' => 1, |
||
| 81 | 'hasAdmin' => 1, |
||
| 82 | 'adminindex' => 'admin/index.php', |
||
| 83 | 'adminmenu' => 'admin/menu.php', |
||
| 84 | // ------------------- Install/Update ------------------- |
||
| 85 | 'onInstall' => 'include/install.php', |
||
| 86 | // 'onInstall' => 'include/oninstall.php', |
||
| 87 | // 'onUpdate' => 'include/onupdate.php', |
||
| 88 | // 'onUninstall' => 'include/onuninstall.php', |
||
| 89 | // ------------------- PayPal --------------------------- |
||
| 90 | 'paypal' => [ |
||
| 91 | 'business' => '[email protected]', |
||
| 92 | 'item_name' => 'Donation : ' . _MI_CHESS_NAME, |
||
| 93 | 'amount' => 0, |
||
| 94 | 'currency_code' => 'USD', |
||
| 95 | ], |
||
| 96 | // ------------------- Search --------------------------- |
||
| 97 | 'hasSearch' => 0, |
||
| 98 | // 'search' => [ |
||
| 99 | // 'file' => 'include/search.inc.php', |
||
| 100 | // 'func' => 'pedigree_search', |
||
| 101 | // ], |
||
| 102 | // ------------------- Comments ------------------------- |
||
| 103 | 'hasComments' => 1, |
||
| 104 | 'comments' => [ |
||
| 105 | 'itemName' => 'game_id', |
||
| 106 | 'pageName' => 'game.php', |
||
| 107 | ], |
||
| 108 | // ------------------- Mysql ----------------------------- |
||
| 109 | 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
||
| 110 | // ------------------- Tables ---------------------------- |
||
| 111 | 'tables' => [ |
||
| 112 | $moduleDirName . '_' . 'games', |
||
| 113 | $moduleDirName . '_' . 'challenges', |
||
| 114 | $moduleDirName . '_' . 'ratings', |
||
| 115 | ], |
||
| 116 | ]; |
||
| 117 | |||
| 118 | // ------------------- Help files ------------------- // |
||
| 119 | $modversion['help'] = 'page=help'; |
||
| 120 | $modversion['helpsection'] = [ |
||
| 121 | ['name' => _MI_CHESS_OVERVIEW, 'link' => 'page=help'], |
||
| 122 | ['name' => _MI_CHESS_DISCLAIMER, 'link' => 'page=disclaimer'], |
||
| 123 | ['name' => _MI_CHESS_LICENSE, 'link' => 'page=license'], |
||
| 124 | ['name' => _MI_CHESS_SUPPORT, 'link' => 'page=support'], |
||
| 125 | ]; |
||
| 126 | |||
| 127 | // Config |
||
| 128 | $grouparray = []; |
||
| 129 | $memberHandler = xoops_getHandler('member'); |
||
| 130 | $groups = $memberHandler->getGroups(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 131 | foreach ($groups as $group) { |
||
| 132 | if (XOOPS_GROUP_ANONYMOUS != $group->getVar('groupid')) { |
||
| 133 | $grouparray[$group->getVar('name')] = $group->getVar('groupid'); |
||
| 134 | } |
||
| 135 | } |
||
| 136 | |||
| 137 | $modversion['config'][] = [ |
||
| 138 | 'name' => 'groups_play', |
||
| 139 | 'title' => '_MI_CHESS_GROUPS_PLAY', |
||
| 140 | 'description' => '_MI_CHESS_GROUPS_PLAY_DES', |
||
| 141 | 'formtype' => 'group_multi', |
||
| 142 | 'valuetype' => 'array', |
||
| 143 | 'default' => [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS], |
||
| 144 | ]; |
||
| 145 | |||
| 146 | $modversion['config'][] = [ |
||
| 147 | 'name' => 'groups_delete', |
||
| 148 | 'title' => '_MI_CHESS_GROUPS_DELETE', |
||
| 149 | 'description' => '_MI_CHESS_GROUPS_DELETE_DES', |
||
| 150 | 'formtype' => 'group_multi', |
||
| 151 | 'valuetype' => 'array', |
||
| 152 | 'default' => [], |
||
| 153 | ]; |
||
| 154 | |||
| 155 | $modversion['config'][] = [ |
||
| 156 | 'name' => 'allow_setup', |
||
| 157 | 'title' => '_MI_CHESS_ALLOW_SETUP', |
||
| 158 | 'description' => '_MI_CHESS_ALLOW_SETUP_DES', |
||
| 159 | 'formtype' => 'yesno', |
||
| 160 | 'valuetype' => 'int', |
||
| 161 | 'default' => 0, |
||
| 162 | ]; |
||
| 163 | |||
| 164 | $modversion['config'][] = [ |
||
| 165 | 'name' => 'max_items', |
||
| 166 | 'title' => '_MI_CHESS_MAX_ITEMS', |
||
| 167 | 'description' => '_MI_CHESS_MAX_ITEMS_DES', |
||
| 168 | 'formtype' => 'textbox', |
||
| 169 | 'valuetype' => 'int', |
||
| 170 | 'default' => 10, |
||
| 171 | ]; |
||
| 172 | |||
| 173 | $modversion['config'][] = [ |
||
| 174 | 'name' => 'rating_system', |
||
| 175 | 'title' => '_MI_CHESS_RATING_SYSTEM', |
||
| 176 | 'description' => '_MI_CHESS_RATING_SYSTEM_DES', |
||
| 177 | 'formtype' => 'select', |
||
| 178 | 'valuetype' => 'text', |
||
| 179 | 'options' => [ |
||
| 180 | _MI_CHESS_RATING_SYSTEM_NONE => 'none', |
||
| 181 | _MI_CHESS_RATING_SYSTEM_CXR => 'cxr', |
||
| 182 | _MI_CHESS_RATING_SYSTEM_LINEAR => 'linear', |
||
| 183 | ], |
||
| 184 | 'default' => 'cxr', |
||
| 185 | ]; |
||
| 186 | |||
| 187 | $modversion['config'][] = [ |
||
| 188 | 'name' => 'initial_rating', |
||
| 189 | 'title' => '_MI_CHESS_INITIAL_RATING', |
||
| 190 | 'description' => '_MI_CHESS_INITIAL_RATING_DES', |
||
| 191 | 'formtype' => 'textbox', |
||
| 192 | 'valuetype' => 'int', |
||
| 193 | 'default' => 1200, |
||
| 194 | ]; |
||
| 195 | |||
| 196 | $modversion['config'][] = [ |
||
| 197 | 'name' => 'allow_unrated_games', |
||
| 198 | 'title' => '_MI_CHESS_ALLOW_UNRATED', |
||
| 199 | 'description' => '_MI_CHESS_ALLOW_UNRATED_DES', |
||
| 200 | 'formtype' => 'yesno', |
||
| 201 | 'valuetype' => 'int', |
||
| 202 | 'default' => 1, |
||
| 203 | ]; |
||
| 204 | |||
| 205 | // Menu |
||
| 206 | $modversion['hasMain'] = 1; |
||
| 207 | |||
| 208 | $modversion['sub'][1]['name'] = _MI_CHESS_SMNAME1; |
||
| 209 | $modversion['sub'][1]['url'] = 'help.php'; |
||
| 210 | |||
| 211 | $modversion['sub'][2]['name'] = _MI_CHESS_SMNAME2; |
||
| 212 | $modversion['sub'][2]['url'] = 'index.php'; |
||
| 213 | |||
| 214 | // Conditional menu items |
||
| 215 | global $xoopsModule, $xoopsModuleConfig, $xoopsUser; |
||
| 216 | if (is_object($xoopsModule) && 'chess' == $xoopsModule->getVar('dirname')) { |
||
| 217 | // Display create-game menu item if current user has the play-chess right. |
||
| 218 | |||
| 219 | if (!empty($xoopsModuleConfig['groups_play']) && is_array($xoopsModuleConfig['groups_play']) |
||
| 220 | && (in_array(XOOPS_GROUP_ANONYMOUS, $xoopsModuleConfig['groups_play']) |
||
| 221 | || (is_object($xoopsUser) && count(array_intersect($xoopsUser->getGroups(), $xoopsModuleConfig['groups_play'])) > 0))) { |
||
| 222 | $modversion['sub'][3]['name'] = _MI_CHESS_SMNAME3; |
||
| 223 | $modversion['sub'][3]['url'] = 'create.php'; |
||
| 224 | } |
||
| 225 | |||
| 226 | // Display ratings menu item if ratings system is enabled. |
||
| 227 | |||
| 228 | if ('none' != $xoopsModuleConfig['rating_system']) { |
||
| 229 | $modversion['sub'][4]['name'] = _MI_CHESS_SMNAME4; |
||
| 230 | $modversion['sub'][4]['url'] = 'ratings.php'; |
||
| 231 | } |
||
| 232 | |||
| 233 | // Display my-games menu item if current user is logged in. |
||
| 234 | |||
| 235 | if (is_object($xoopsUser)) { |
||
| 236 | $modversion['sub'][5]['name'] = _MI_CHESS_SMNAME5; |
||
| 237 | $modversion['sub'][5]['url'] = 'player_stats.php?player_uid=' . $xoopsUser->getVar('uid'); |
||
| 238 | } |
||
| 239 | } |
||
| 240 | |||
| 241 | // Page Awareness |
||
| 242 | $modversion['pages'][] = [ |
||
| 243 | ['name' => _MI_CHESS_SMNAME1, 'url' => 'help.php'], |
||
| 244 | ['name' => _MI_CHESS_SMNAME2, 'url' => 'index.php'], |
||
| 245 | ['name' => _MI_CHESS_SMNAME3, 'url' => 'create.php'], |
||
| 246 | ['name' => _MI_CHESS_SMNAME4, 'url' => 'ratings.php'], |
||
| 247 | ['name' => _MI_CHESS_SMNAME5, 'url' => 'player_stats.php'], |
||
| 248 | ]; |
||
| 249 | |||
| 250 | // Templates |
||
| 251 | $modversion['templates'] = [ |
||
| 252 | ['file' => 'chess_games.tpl', 'description' => _MI_CHESS_INDEX], |
||
| 253 | ['file' => 'chess_game_main.tpl', 'description' => _MI_CHESS_GAME], |
||
| 254 | ['file' => 'chess_game_moveform.tpl', 'description' => _MI_CHESS_MOVE_FORM], |
||
| 255 | ['file' => 'chess_game_promote_popup.tpl', 'description' => _MI_CHESS_PROMOTE_POPUP], |
||
| 256 | ['file' => 'chess_game_board.tpl', 'description' => _MI_CHESS_BOARD], |
||
| 257 | ['file' => 'chess_game_prefsform.tpl', 'description' => _MI_CHESS_PREFS_FORM], |
||
| 258 | ['file' => 'chess_game_arbitrateform.tpl', 'description' => _MI_CHESS_ARBITER_FORM], |
||
| 259 | ['file' => 'chess_help.tpl', 'description' => _MI_CHESS_HELP], |
||
| 260 | ['file' => 'chess_ratings.tpl', 'description' => _MI_CHESS_RATINGS], |
||
| 261 | ['file' => 'chess_player_stats.tpl', 'description' => _MI_CHESS_PLAYER_STATS], |
||
| 262 | ]; |
||
| 263 | // Blocks |
||
| 264 | $modversion['blocks'][] = [ |
||
| 265 | 'file' => 'blocks.php', |
||
| 266 | 'name' => _MI_CHESS_GAMES, |
||
| 267 | 'description' => _MI_CHESS_GAMES_DES, |
||
| 268 | 'show_func' => 'b_chess_games_show', |
||
| 269 | // options: maximum number of games to display | 1=show games in play only/2=show concluded games only/3=show both | 1=show rated games only/2=show rated and unrated games |
||
| 270 | 'options' => '4|3', |
||
| 271 | 'edit_func' => 'b_chess_games_edit', |
||
| 272 | 'template' => 'chess_block_games.tpl', |
||
| 273 | ]; |
||
| 274 | |||
| 275 | $modversion['blocks'][] = [ |
||
| 276 | 'file' => 'blocks.php', |
||
| 277 | 'name' => _MI_CHESS_CHALLENGES, |
||
| 278 | 'description' => _MI_CHESS_CHALLENGES_DES, |
||
| 279 | 'show_func' => 'b_chess_challenges_show', |
||
| 280 | // options: maximum number of challenges to display | 1=show open challenges only/2=show individual challenges only/3=show both |
||
| 281 | 'options' => '4|3', |
||
| 282 | 'edit_func' => 'b_chess_challenges_edit', |
||
| 283 | 'template' => 'chess_block_challenges.tpl', |
||
| 284 | ]; |
||
| 285 | $modversion['blocks'][] = [ |
||
| 286 | 'file' => 'blocks.php', |
||
| 287 | 'name' => _MI_CHESS_PLAYERS, |
||
| 288 | 'description' => _MI_CHESS_PLAYERS_DES, |
||
| 289 | 'show_func' => 'b_chess_players_show', |
||
| 290 | // options: maximum number of players to display | 1=show non-provisional ratings only/2=show all ratings |
||
| 291 | 'options' => '4|1', |
||
| 292 | 'edit_func' => 'b_chess_players_edit', |
||
| 293 | 'template' => 'chess_block_players.tpl', |
||
| 294 | ]; |
||
| 295 | |||
| 296 | // Notification |
||
| 297 | $modversion['hasNotification'] = 1; |
||
| 298 | $modversion['notification']['lookup_file'] = 'include/notification.inc.php'; |
||
| 299 | $modversion['notification']['lookup_func'] = 'chess_notify_item_info'; |
||
| 300 | |||
| 301 | $modversion['notification']['category'][] = [ |
||
| 302 | 'name' => 'game', |
||
| 303 | 'title' => _MI_CHESS_NCAT_GAME, |
||
| 304 | 'description' => _MI_CHESS_NCAT_GAME_DES, |
||
| 305 | 'subscribe_from' => 'game.php', |
||
| 306 | 'item_name' => 'game_id', |
||
| 307 | 'allow_bookmark' => 1, |
||
| 308 | ]; |
||
| 309 | |||
| 310 | $modversion['notification']['category'][] = [ |
||
| 311 | 'name' => 'global', |
||
| 312 | 'title' => _MI_CHESS_NCAT_GLOBAL, |
||
| 313 | 'description' => _MI_CHESS_NCAT_GLOBAL_DES, |
||
| 314 | 'subscribe_from' => ['index.php', 'game.php'], |
||
| 315 | ]; |
||
| 316 | |||
| 317 | $modversion['notification']['event'][] = [ |
||
| 318 | 'name' => 'notify_game_move', |
||
| 319 | 'category' => 'game', |
||
| 320 | 'title' => _MI_CHESS_NEVT_MOVE, |
||
| 321 | 'caption' => _MI_CHESS_NEVT_MOVE_CAP, |
||
| 322 | 'description' => _MI_CHESS_NEVT_MOVE_DES, |
||
| 323 | 'mail_template' => 'notify_game_move', |
||
| 324 | 'mail_subject' => _MI_CHESS_NEVT_MOVE_SUB, |
||
| 325 | ]; |
||
| 326 | |||
| 327 | $modversion['notification']['event'][] = [ |
||
| 328 | 'name' => 'notify_challenge_user', |
||
| 329 | 'category' => 'global', |
||
| 330 | 'title' => _MI_CHESS_NEVT_CHAL_USER, |
||
| 331 | 'caption' => _MI_CHESS_NEVT_CHAL_USER_CAP, |
||
| 332 | 'description' => _MI_CHESS_NEVT_CHAL_USER_DES, |
||
| 333 | 'mail_template' => 'notify_challenge_user', |
||
| 334 | 'mail_subject' => _MI_CHESS_NEVT_CHAL_USER_SUB, |
||
| 335 | ]; |
||
| 336 | |||
| 337 | $modversion['notification']['event'][] = [ |
||
| 338 | 'name' => 'notify_challenge_open', |
||
| 339 | 'category' => 'global', |
||
| 340 | 'title' => _MI_CHESS_NEVT_CHAL_OPEN, |
||
| 341 | 'caption' => _MI_CHESS_NEVT_CHAL_OPEN_CAP, |
||
| 342 | 'description' => _MI_CHESS_NEVT_CHAL_OPEN_DES, |
||
| 343 | 'mail_template' => 'notify_challenge_open', |
||
| 344 | 'mail_subject' => _MI_CHESS_NEVT_CHAL_OPEN_SUB, |
||
| 345 | ]; |
||
| 346 | |||
| 347 | $modversion['notification']['event'][] = [ |
||
| 348 | 'name' => 'notify_accept_challenge', |
||
| 349 | 'category' => 'global', |
||
| 350 | 'title' => _MI_CHESS_NEVT_ACPT_CHAL, |
||
| 351 | 'caption' => _MI_CHESS_NEVT_ACPT_CHAL_CAP, |
||
| 352 | 'description' => _MI_CHESS_NEVT_ACPT_CHAL_DES, |
||
| 353 | 'mail_template' => 'notify_accept_challenge', |
||
| 354 | 'mail_subject' => _MI_CHESS_NEVT_ACPT_CHAL_SUB, |
||
| 355 | ]; |
||
| 356 | |||
| 357 | $modversion['notification']['event'][] = [ |
||
| 358 | 'name' => 'notify_request_arbitration', |
||
| 359 | 'category' => 'global', |
||
| 360 | 'title' => _MI_CHESS_NEVT_RQST_ARBT, |
||
| 361 | 'caption' => _MI_CHESS_NEVT_RQST_ARBT_CAP, |
||
| 362 | 'description' => _MI_CHESS_NEVT_RQST_ARBT_DES, |
||
| 363 | 'mail_template' => 'notify_request_arbitration', |
||
| 364 | 'mail_subject' => _MI_CHESS_NEVT_RQST_ARBT_SUB, |
||
| 365 | 'admin_only' => 1, |
||
| 366 | ]; |
||
| 367 |