├── API ├── favicon-16x16.png ├── favicon-32x32.png ├── swagger-ui.css.map ├── include │ ├── settings.php │ ├── dependencies.php │ ├── middleware.php │ ├── Utils.class.php │ └── APIAccessDB.class.php ├── index.php ├── templates │ └── doc.html ├── oauth2-redirect.html └── key.php ├── website ├── images │ ├── close.png │ ├── next.png │ ├── prev.png │ ├── loading.gif │ ├── ribbon.xcf │ ├── ribbonBanners.png │ ├── ribbonFanarts.png │ ├── ribbonScreens.png │ ├── ribbonClearlogos.png │ ├── ribbonTitlescreens.png │ └── if_recent-time-search-reload-time_2075824.svg ├── css │ ├── webfonts │ │ ├── fa-solid-900.eot │ │ ├── fa-solid-900.ttf │ │ ├── fa-brands-400.eot │ │ ├── fa-brands-400.ttf │ │ ├── fa-brands-400.woff │ │ ├── fa-regular-400.eot │ │ ├── fa-regular-400.ttf │ │ ├── fa-solid-900.woff │ │ ├── fa-solid-900.woff2 │ │ ├── fa-brands-400.woff2 │ │ ├── fa-regular-400.woff │ │ └── fa-regular-400.woff2 │ ├── fine_uploader.5.16.2 │ │ ├── edit.gif │ │ ├── pause.gif │ │ ├── retry.gif │ │ ├── trash.gif │ │ ├── loading.gif │ │ ├── continue.gif │ │ ├── processing.gif │ │ ├── placeholders │ │ │ ├── waiting-generic.png │ │ │ └── not_available-generic.png │ │ ├── fine-uploader.min.css │ │ ├── fine-uploader-new.min.css │ │ ├── fine-uploader.css │ │ ├── fine-uploader-gallery.min.css │ │ └── fine-uploader-new.css │ ├── fa-brands.5.0.10.css │ ├── social-btn.css │ ├── select-pure.css │ └── main.css ├── actions │ ├── resolve_game_report.php │ ├── game_search_count.php │ ├── add_game_bookmark.php │ ├── add_dev_pub.php │ ├── report_game.php │ ├── delete_game.php │ ├── delete_art.php │ ├── add_game.php │ ├── edit_game.php │ ├── merge_dev_pub.php │ └── uploads.php ├── include │ ├── PaginationUtils.class.php │ ├── ErrorPage.class.php │ ├── TGDBUtils.class.php │ ├── WebUtils.class.php │ ├── login.phpbb.class.php │ ├── DiscordUtils.class.php │ ├── UploadHandler.fineupload.class.php │ └── header.footer.class.php ├── list_platforms.php ├── list_devs.php ├── list_pubs.php ├── js │ └── fancybox.config.js ├── recently_added.php ├── browse.php ├── search.php ├── contr.php ├── my_games.php ├── user_contrib.php ├── add_dev_pub.php ├── index.php ├── missing.php ├── my_games_by_platform.php ├── list_games.php ├── merge_dev_pub.php ├── login.php └── report_review.php ├── .gitignore ├── apache_config ├── 000-default.conf ├── api.conf └── cdn.conf ├── composer.json ├── include ├── db.config.template.php └── CommonUtils.class.php └── tools ├── fix_image_paths.db.php └── createimage.php /API/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/API/favicon-16x16.png -------------------------------------------------------------------------------- /API/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/API/favicon-32x32.png -------------------------------------------------------------------------------- /website/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/close.png -------------------------------------------------------------------------------- /website/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/next.png -------------------------------------------------------------------------------- /website/images/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/prev.png -------------------------------------------------------------------------------- /API/swagger-ui.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""} -------------------------------------------------------------------------------- /website/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/loading.gif -------------------------------------------------------------------------------- /website/images/ribbon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbon.xcf -------------------------------------------------------------------------------- /website/images/ribbonBanners.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbonBanners.png -------------------------------------------------------------------------------- /website/images/ribbonFanarts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbonFanarts.png -------------------------------------------------------------------------------- /website/images/ribbonScreens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbonScreens.png -------------------------------------------------------------------------------- /website/css/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /website/css/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /website/images/ribbonClearlogos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbonClearlogos.png -------------------------------------------------------------------------------- /website/images/ribbonTitlescreens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/images/ribbonTitlescreens.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | include/db.config.php 2 | .DS_Store 3 | ._.DS_Store 4 | .DAV 5 | composer.lock 6 | website/banners/ 7 | vendor 8 | cdn 9 | forum -------------------------------------------------------------------------------- /website/css/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /website/css/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /website/css/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /website/css/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /website/css/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /website/css/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /website/css/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/edit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/edit.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/pause.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/pause.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/retry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/retry.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/trash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/trash.gif -------------------------------------------------------------------------------- /website/css/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /website/css/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /website/css/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/loading.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/continue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/continue.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/processing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/processing.gif -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/placeholders/waiting-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/placeholders/waiting-generic.png -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/placeholders/not_available-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheGamesDB/TheGamesDBv2/HEAD/website/css/fine_uploader.5.16.2/placeholders/not_available-generic.png -------------------------------------------------------------------------------- /apache_config/000-default.conf: -------------------------------------------------------------------------------- 1 | 2 | # add this to 000-default.conf to redirect all no https connections to https 3 | RewriteEngine On 4 | RewriteCond %{HTTPS} off 5 | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 6 | -------------------------------------------------------------------------------- /apache_config/api.conf: -------------------------------------------------------------------------------- 1 | 2 | # this will redirect calls to `index.php` 3 | 4 | Options +FollowSymLinks 5 | RewriteEngine On 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | RewriteCond %{REQUEST_FILENAME} !-d 8 | RewriteRule ^ index.php [QSA,L] 9 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": ">=5.5.0", 4 | "slim/slim": "^3.1", 5 | "slim/php-view": "^2.0", 6 | "monolog/monolog": "^1.17", 7 | "claviska/simpleimage": "^3.3", 8 | "cloudflare/sdk": "^1.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apache_config/cdn.conf: -------------------------------------------------------------------------------- 1 | 2 | # to will force all request to non existing images to `createimage.php` which will in turn generate them 3 | 4 | Options +FollowSymLinks 5 | RewriteEngine On 6 | RewriteCond %{REQUEST_URI} \.(jpg|png)$ [NC] 7 | RewriteCond %{REQUEST_FILENAME} !-f 8 | RewriteCond %{REQUEST_FILENAME} !-d 9 | RewriteRule ^ /createimage.php [QSA,L] 10 | 11 | -------------------------------------------------------------------------------- /API/include/settings.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'displayErrorDetails' => false, // set to false in production 5 | 'addContentLengthHeader' => false, // Allow the web server to send the content-length header 6 | 7 | // Renderer settings 8 | 'renderer' => [ 9 | 'template_path' => __DIR__ . '/../templates/', 10 | ], 11 | 12 | // Monolog settings 13 | 'logger' => [ 14 | 'name' => 'slim-app', 15 | 'path' => isset($_ENV['docker']) ? 'php://stdout' : __DIR__ . '/../logs/app.log', 16 | 'level' => \Monolog\Logger::DEBUG, 17 | ], 18 | ], 19 | ]; 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /website/images/if_recent-time-search-reload-time_2075824.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /API/include/dependencies.php: -------------------------------------------------------------------------------- 1 | getContainer(); 5 | 6 | // view renderer : TODO remove? 7 | $container['renderer'] = function ($c) 8 | { 9 | $settings = $c->get('settings')['renderer']; 10 | return new Slim\Views\PhpRenderer($settings['template_path']); 11 | }; 12 | 13 | // monolog 14 | $container['logger'] = function ($c) 15 | { 16 | $settings = $c->get('settings')['logger']; 17 | $logger = new Monolog\Logger($settings['name']); 18 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); 19 | $logger->pushHandler(new Monolog\Handler\StreamHandler($settings['path'], $settings['level'])); 20 | return $logger; 21 | }; 22 | 23 | ?> 24 | -------------------------------------------------------------------------------- /website/css/fa-brands.5.0.10.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome Free 5.0.10 by @fontawesome - https://fontawesome.com 3 | * License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) 4 | */ 5 | @font-face { 6 | font-family: 'Font Awesome 5 Brands'; 7 | font-style: normal; 8 | font-weight: normal; 9 | src: url("./webfonts/fa-brands-400.eot"); 10 | src: url("./webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("./webfonts/fa-brands-400.woff2") format("woff2"), url("./webfonts/fa-brands-400.woff") format("woff"), url("./webfonts/fa-brands-400.ttf") format("truetype"), url("./webfonts/fa-brands-400.svg#fontawesome") format("svg"); } 11 | 12 | .fab { 13 | font-family: 'Font Awesome 5 Brands'; } 14 | -------------------------------------------------------------------------------- /include/db.config.template.php: -------------------------------------------------------------------------------- 1 | dbh = new PDO($this->_dsn, $this->_username, $this->_password); 14 | $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 15 | $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); 16 | } 17 | 18 | public static function getInstance() 19 | { 20 | static $instance = null; 21 | if (!isset($instance)) 22 | { 23 | $object = __CLASS__; 24 | $instance = new $object; 25 | } 26 | return $instance; 27 | } 28 | } 29 | 30 | ?> 31 | -------------------------------------------------------------------------------- /API/index.php: -------------------------------------------------------------------------------- 1 | run(); 32 | -------------------------------------------------------------------------------- /tools/fix_image_paths.db.php: -------------------------------------------------------------------------------- 1 |
 2 | dbh;
 9 | $sth = $dbh->prepare($qry);
10 | 
11 | $sth->bindValue(':name', "%original%", PDO::PARAM_STR);
12 | 
13 | if($sth->execute())
14 | {
15 | 	$res = $sth->fetchAll(PDO::FETCH_OBJ);
16 | 	$dbh->beginTransaction();
17 | 	foreach($res as $cover)
18 | 	{
19 | 		$cover->filename = str_replace("original/", "", $cover->filename);
20 | 		$sth = $dbh->prepare("UPDATE banners SET filename=:filename WHERE id=:id;");
21 | 		$sth->bindValue(':filename', $cover->filename, PDO::PARAM_STR);
22 | 		$sth->bindValue(':id', $cover->id, PDO::PARAM_INT);
23 | 		$sth->execute();
24 | 		echo "Processed $cover->id\n";
25 | 	}
26 | 	$dbh->commit();
27 | }
28 | 
29 | ?>
30 | 
-------------------------------------------------------------------------------- /website/actions/resolve_game_report.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('m_delete_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | if(!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) 25 | { 26 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 27 | } 28 | 29 | require_once __DIR__ . "/../../include/TGDB.API.php"; 30 | 31 | try 32 | { 33 | 34 | $API = TGDB::getInstance(); 35 | 36 | 37 | $res = $API->ResolveGameReport($_user->GetUserID(), $_user->GetUsername(), $_REQUEST['id']); 38 | 39 | returnJSONAndDie(1, "success!!"); 40 | 41 | 42 | } 43 | catch (Exception $e) 44 | { 45 | error_log($e); 46 | } 47 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 48 | -------------------------------------------------------------------------------- /website/include/PaginationUtils.class.php: -------------------------------------------------------------------------------- 1 | 0) 9 | { 10 | return $_GET['page']; 11 | } 12 | return 1; 13 | } 14 | 15 | public static function Create($has_next_page, $custom_url = '') 16 | { 17 | $page = PaginationUtils::getPage(); 18 | { 19 | $GET = $_GET; 20 | $GET['page'] = $page - 1; 21 | $previous_args = "?" . http_build_query($GET,'','&'); 22 | 23 | $GET['page'] = $page + 1; 24 | $next_args = "?" . http_build_query($GET,'','&'); 25 | ?> 26 | 36 | CommonUtils::$BOXART_BASE_URL . "original/", 14 | "small" => CommonUtils::$BOXART_BASE_URL . "small/", 15 | "thumb" => CommonUtils::$BOXART_BASE_URL . "thumb/", 16 | "cropped_center_thumb" => CommonUtils::$BOXART_BASE_URL . "cropped_center_thumb/", 17 | "medium" => CommonUtils::$BOXART_BASE_URL . "medium/", 18 | "large" => CommonUtils::$BOXART_BASE_URL . "large/", 19 | ]; 20 | } 21 | 22 | static function htmlspecialchars_decodeArrayRecursive(&$array) 23 | { 24 | foreach($array as &$sub_array_item) 25 | { 26 | if(is_array($sub_array_item) || is_object($sub_array_item)) 27 | { 28 | CommonUtils::htmlspecialchars_decodeArrayRecursive($sub_array_item); 29 | } 30 | else if(!is_numeric($sub_array_item) && !empty($sub_array_item)) 31 | { 32 | $sub_array_item = htmlspecialchars_decode($sub_array_item); 33 | } 34 | } 35 | } 36 | } 37 | 38 | ?> 39 | -------------------------------------------------------------------------------- /website/actions/game_search_count.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('u_edit_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | 25 | $GameArrayFields = ['game_title']; 26 | foreach($GameArrayFields as $field) 27 | { 28 | if(!isset($_REQUEST[$field]) || empty($_REQUEST[$field])) 29 | { 30 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR . ": ($field)."); 31 | } 32 | } 33 | 34 | require_once __DIR__ . "/../../include/TGDB.API.php"; 35 | 36 | try 37 | { 38 | 39 | $API = TGDB::getInstance(); 40 | $res = $API->GetGameCount($_REQUEST['game_title']); 41 | 42 | if($res > -1) 43 | { 44 | returnJSONAndDie(1, $res); 45 | } 46 | 47 | } 48 | catch (Exception $e) 49 | { 50 | error_log($e); 51 | } 52 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 53 | -------------------------------------------------------------------------------- /website/actions/add_game_bookmark.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 9 | die(); 10 | } 11 | 12 | $_user = phpBBuser::getInstance(); 13 | if(!$_user->isLoggedIn()) 14 | { 15 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 16 | } 17 | 18 | if( 19 | !isset($_REQUEST['games_id']) || !is_numeric($_REQUEST['games_id']) 20 | || !isset($_REQUEST['is_booked']) || !is_numeric($_REQUEST['is_booked']) 21 | ) 22 | { 23 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 24 | } 25 | 26 | require_once __DIR__ . "/../../include/TGDB.API.php"; 27 | try 28 | { 29 | $API = TGDB::getInstance(); 30 | $list = $API->GetGameByID($_REQUEST['games_id'], 0, 1); 31 | if(empty($Game = array_shift($list))) 32 | { 33 | returnJSONAndDie(-1, ErrorPage::$MSG_REMOVED_GAME_INVALID_PARAM_ERROR); 34 | } 35 | 36 | $is_booked = $_REQUEST['is_booked'] > 0 ? 1 : 0; 37 | $res = $API->InsertUserGameBookmark($_user->GetUserID(), $Game, $is_booked); 38 | if($res) 39 | { 40 | returnJSONAndDie(0, $is_booked); 41 | } 42 | } 43 | catch (Exception $e) 44 | { 45 | error_log($e); 46 | } 47 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 48 | 49 | ?> -------------------------------------------------------------------------------- /website/css/social-btn.css: -------------------------------------------------------------------------------- 1 | .btn-twitter 2 | { 3 | background: #00acee; 4 | border-radius: 0; 5 | color: #fff 6 | } 7 | .btn-twitter:link, .btn-twitter:visited 8 | { 9 | color: #fff 10 | } 11 | .btn-twitter:active, .btn-twitter:hover 12 | { 13 | background: #0087bd; 14 | color: #fff 15 | } 16 | .btn-facebook 17 | { 18 | background: #3b5998; 19 | border-radius: 0; 20 | color: #fff 21 | } 22 | .btn-facebook:link, .btn-facebook:visited 23 | { 24 | color: #fff 25 | } 26 | .btn-facebook:active, .btn-facebook:hover 27 | { 28 | background: #30477a; 29 | color: #fff 30 | } 31 | .btn-stumbleupon 32 | { 33 | background: #f74425; 34 | border-radius: 0; 35 | color: #fff 36 | } 37 | .btn-stumbleupon:link, .btn-stumbleupon:visited 38 | { 39 | color: #fff 40 | } 41 | .btn-stumbleupon:active, .btn-stumbleupon:hover 42 | { 43 | background: #c7371e; 44 | color: #fff 45 | } 46 | .btn-linkedin 47 | { 48 | background: #0e76a8; 49 | border-radius: 0; 50 | color: #fff 51 | } 52 | .btn-linkedin:link, .btn-linkedin:visited 53 | { 54 | color: #fff 55 | } 56 | .btn-linkedin:active, .btn-linkedin:hover 57 | { 58 | background: #0b6087; 59 | color: #fff 60 | } 61 | .btn-pinterest 62 | { 63 | background: #c8232c; 64 | border-radius: 0; 65 | color: #fff 66 | } 67 | .btn-pinterest:link, .btn-pinterest:visited 68 | { 69 | color: #fff 70 | } 71 | .btn-pinterest:active, .btn-pinterest:hover 72 | { 73 | background: #961a21; 74 | color: #fff 75 | } 76 | -------------------------------------------------------------------------------- /website/actions/add_dev_pub.php: -------------------------------------------------------------------------------- 1 | $code, 10 | "msg" => $msg, 11 | ]; 12 | if($id != 0) 13 | { 14 | $response['id'] = $id; 15 | } 16 | echo json_encode($response); 17 | die(); 18 | } 19 | 20 | $_user = phpBBuser::getInstance(); 21 | if(!$_user->isLoggedIn()) 22 | { 23 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 24 | } 25 | else 26 | { 27 | if(!$_user->hasPermission('m_delete_games')) 28 | { 29 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 30 | } 31 | } 32 | 33 | if(empty($_REQUEST['name']) || empty($_REQUEST['tbl'])) 34 | { 35 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 36 | } 37 | 38 | require_once __DIR__ . "/../../include/TGDB.API.php"; 39 | 40 | $tbl_name = $_REQUEST['tbl']; 41 | $name = $_REQUEST['name']; 42 | try 43 | { 44 | 45 | $API = TGDB::getInstance(); 46 | if($tbl_name == 'dev' && $id = $API->InsertDev($name)) 47 | { 48 | returnJSONAndDie(0, "developer Added.", $id); 49 | } 50 | else if($tbl_name == 'pub' && $id = $API->InsertPub($name)) 51 | { 52 | returnJSONAndDie(0, "publisher Added.", $id); 53 | } 54 | else 55 | { 56 | returnJSONAndDie(-2, "Unexpected Error has occured, Please try again!!"); 57 | } 58 | } 59 | catch (Exception $e) 60 | { 61 | error_log($e); 62 | } 63 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 64 | -------------------------------------------------------------------------------- /API/templates/doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 31 | 32 | 33 | 34 |
35 | 36 | 37 | 38 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /website/actions/report_game.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | 17 | $RequiredReportArrayFields = ['game_id', 'report_type', 'metadata_0']; 18 | 19 | foreach($RequiredReportArrayFields as $field) 20 | { 21 | if(!isset($_REQUEST[$field]) || empty($_REQUEST[$field])) 22 | { 23 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR . " ($field)"); 24 | } 25 | } 26 | 27 | //TODO: need a better check should we add different types 28 | if($_REQUEST['report_type'] != 1) 29 | { 30 | returnJSONAndDie(-1, ErrorPage::$MSG_INVALID_PARAM_ERROR . " (report_type)"); 31 | } 32 | require_once __DIR__ . "/../../include/TGDB.API.php"; 33 | 34 | try 35 | { 36 | 37 | $API = TGDB::getInstance(); 38 | $res = $API->ReportGame($_user->GetUserID(), $_user->GetUsername(), $_REQUEST); 39 | 40 | switch((integer) $res) 41 | { 42 | case -2: 43 | $msg = "Original game does not exist."; 44 | break; 45 | case -1: 46 | $msg = "Reported game does not exist."; 47 | break; 48 | case 1: 49 | $msg = "Thank You For The Report."; 50 | break; 51 | } 52 | returnJSONAndDie($res, $msg . "($res)"); 53 | 54 | } 55 | catch (Exception $e) 56 | { 57 | error_log($e); 58 | } 59 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 60 | 61 | 62 | -------------------------------------------------------------------------------- /website/include/ErrorPage.class.php: -------------------------------------------------------------------------------- 1 | _error_header = $error_header; 25 | } 26 | 27 | public function SetMSG($error_msg) 28 | { 29 | $this->_error_msg = $error_msg; 30 | } 31 | 32 | public function print_die() 33 | { 34 | $Header = new HEADER(); 35 | $Header->setTitle("TGDB - Error"); 36 | ?> 37 | print(); ?> 38 |
39 | 40 | 41 |
42 |
43 |
44 |
45 | _error_header ?> 46 |
47 |
48 |

_error_msg ?>

49 |
50 |
51 | 52 |
53 |
54 |
55 | 56 | 150, 5 | "thumb" => 300, 6 | "cropped_center_thumb" => 300, 7 | "medium" => 720, 8 | "large" => 1080, 9 | ); 10 | 11 | $_compression = array( 12 | "small" => 60, 13 | "thumb" => 75, 14 | "cropped_center_thumb" => 75, 15 | "medium" => 85, 16 | "large" => 90, 17 | ); 18 | 19 | if(isset($_SERVER['REDIRECT_URL'])) 20 | { 21 | $PATHs = explode("/", $_SERVER['REDIRECT_URL']); 22 | $size = $PATHs[2]; 23 | array_splice($PATHs, 1, 2); 24 | $original_image = __DIR__ . "/images/original" . implode("/", $PATHs); 25 | $dest_image = __DIR__ . "/images/$size" . implode("/", $PATHs); 26 | if(file_exists($original_image) && !file_exists($dest_image)) 27 | { 28 | include __DIR__ . "/../vendor/autoload.php"; 29 | try 30 | { 31 | $image = new \claviska\SimpleImage(); 32 | 33 | $image = $image->fromFile($original_image); 34 | if($size == "cropped_center_thumb") 35 | { 36 | if($image->getHeight() > $image->getWidth()) 37 | { 38 | $image = $image->thumbnail($_size[$size], 533, 'center'); 39 | } 40 | else 41 | { 42 | $image = $image->thumbnail(533, $_size[$size], 'center'); 43 | } 44 | } 45 | else 46 | { 47 | if($image->getHeight() > $image->getWidth()) 48 | { 49 | $image = $image->resize($_size[$size], null); 50 | } 51 | else 52 | { 53 | $image = $image->resize(null, $_size[$size]); 54 | } 55 | } 56 | 57 | if(!file_exists(dirname($dest_image))) 58 | { 59 | mkdir(dirname($dest_image), 0755, true); 60 | } 61 | 62 | $image->toFile($dest_image, 'image/jpeg', $_compression[$size]); 63 | $image->toScreen('image/jpeg'); 64 | return; 65 | } 66 | catch(Exception $err) 67 | { 68 | echo $err->getMessage() . "
"; 69 | } 70 | } 71 | } 72 | 73 | header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); 74 | echo "File Not Found"; 75 | 76 | ?> 77 | -------------------------------------------------------------------------------- /website/actions/delete_game.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('m_delete_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | if(!isset($_REQUEST['game_id']) || !is_numeric($_REQUEST['game_id'])) 25 | { 26 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 27 | } 28 | 29 | require_once __DIR__ . "/../../include/TGDB.API.php"; 30 | require_once __DIR__ . "/../include/DiscordUtils.class.php"; 31 | 32 | try 33 | { 34 | 35 | $API = TGDB::getInstance(); 36 | $filters = ['game_title' => true, 'overview' => true, 'youtube' => true, 'release_date' => true, 'players' => true, 'coop' => true, 'developers' => true, 'publishers' => true, 'genres' => true, 'rating' => true]; 37 | $games = $API->GetGameByID($_REQUEST['game_id'], 0, 1, $filters); 38 | if(empty($games)) 39 | { 40 | returnJSONAndDie(0, "No game in record to delete."); 41 | } 42 | 43 | $covers = $API->GetGameBoxartByID($_REQUEST['game_id'], 0, 99, 'ALL'); 44 | 45 | if(!empty($covers) && ($covers = $covers[$_REQUEST['game_id']])) 46 | { 47 | $sizes = ["original", "small", "thumb", "cropped_center_thumb", "medium", "large"]; 48 | foreach($covers as $cover) 49 | { 50 | foreach($sizes as $size) 51 | { 52 | $image_to_delete = __DIR__ . "/../../cdn/images/$size/" . $cover->filename; 53 | if(file_exists($image_to_delete)) 54 | { 55 | unlink($image_to_delete); 56 | } 57 | } 58 | } 59 | } 60 | 61 | $res = $API->DeleteGame($_user->GetUserID(), $_REQUEST['game_id']); 62 | DiscordUtils::PostGameUpdate($_user, [], $games[0], 2); 63 | returnJSONAndDie(1, "success!!"); 64 | 65 | 66 | } 67 | catch (Exception $e) 68 | { 69 | error_log($e); 70 | } 71 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 72 | -------------------------------------------------------------------------------- /website/include/TGDBUtils.class.php: -------------------------------------------------------------------------------- 1 | boxart)) 9 | { 10 | foreach($game->boxart as $art) 11 | { 12 | if($return_lazy_results && !isset($ret)) 13 | { 14 | $ret = $art; 15 | } 16 | 17 | if($art->type == $type) 18 | { 19 | if($art->side == $side) 20 | { 21 | $ret = $art; 22 | break; 23 | } 24 | else if($return_lazy_results) 25 | { 26 | $ret = $art; 27 | } 28 | } 29 | } 30 | if(isset($ret)) 31 | { 32 | return CommonUtils::$BOXART_BASE_URL . "$return_size/" . $ret->filename; 33 | } 34 | } 35 | if($return_placeholder) 36 | { 37 | if(isset($game->game_title)) 38 | { 39 | return "https://via.placeholder.com/200x200?text=" . urlencode($game->game_title); 40 | } 41 | elseif(isset($game->name)) 42 | { 43 | return "https://via.placeholder.com/200x200?text=" . urlencode($game->name); 44 | } 45 | return "https://via.placeholder.com/200x200"; 46 | } 47 | } 48 | 49 | public static function GetAllCovers($game, $type = '', $side = '') 50 | { 51 | $ret = array(); 52 | $BASE_URL = CommonUtils::getImagesBaseURL(); 53 | if(isset($game->boxart)) 54 | { 55 | foreach($game->boxart as $art) 56 | { 57 | if($art->type == $type) 58 | { 59 | if($art->side == $side) 60 | { 61 | $art->thumbnail = new \stdClass(); 62 | $art->original = $BASE_URL["original"] . $art->filename; 63 | $art->small = $BASE_URL["small"] . $art->filename; 64 | $art->cropped_center_thumb = $BASE_URL["cropped_center_thumb"] . $art->filename; 65 | $art->thumbnail = $BASE_URL["thumb"] . $art->filename; 66 | $art->medium = $BASE_URL["medium"] . $art->filename; 67 | $art->large = $BASE_URL["large"] . $art->filename; 68 | $ret[] = $art; 69 | } 70 | } 71 | } 72 | } 73 | return $ret; 74 | } 75 | 76 | public static function GetPlaceholderImage($Name, $size) 77 | { 78 | return "https://via.placeholder.com/200x200?text=" . urlencode($Name); 79 | } 80 | } 81 | 82 | ?> -------------------------------------------------------------------------------- /website/actions/delete_art.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('m_delete_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | if( 25 | !isset($_REQUEST['game_id']) || !is_numeric($_REQUEST['game_id']) 26 | || !isset($_REQUEST['image_id']) || !is_numeric($_REQUEST['image_id']) 27 | 28 | ) 29 | { 30 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 31 | } 32 | 33 | require_once __DIR__ . "/../../include/TGDB.API.php"; 34 | require_once __DIR__ . "/../include/WebUtils.class.php"; 35 | require_once __DIR__ . "/../include/DiscordUtils.class.php"; 36 | 37 | try 38 | { 39 | 40 | $API = TGDB::getInstance(); 41 | $covers = $API->GetGameBoxartByID($_REQUEST['game_id'], 0, 99, $_REQUEST['type']); 42 | 43 | if(!empty($covers) && ($covers = $covers[$_REQUEST['game_id']])) 44 | { 45 | $sizes = ["original", "small", "thumb", "cropped_center_thumb", "cropped_center_thumb_square", "medium", "large"]; 46 | foreach($covers as $cover) 47 | { 48 | if($cover->id == $_REQUEST['image_id']) 49 | { 50 | foreach($sizes as $size) 51 | { 52 | $image_to_delete = __DIR__ . "/../../cdn/images/$size/" . $cover->filename; 53 | if(file_exists($image_to_delete)) 54 | { 55 | unlink($image_to_delete); 56 | } 57 | } 58 | WebUtils::purgeCDNCache($cover->filename); 59 | $res = $API->DeleteGameImages($_user->GetUserID(), $_REQUEST['game_id'], $_REQUEST['image_id'], $cover->type); 60 | if($res) 61 | { 62 | DiscordUtils::PostImageUpdate($_user, $_REQUEST['game_id'], '', $cover->type, $cover->side, 2); 63 | returnJSONAndDie(1, "success!!"); 64 | } 65 | } 66 | } 67 | } 68 | returnJSONAndDie(-1, "Couldnt find image to delete, please refresh page and try again."); 69 | } 70 | catch (Exception $e) 71 | { 72 | error_log($e); 73 | } 74 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 75 | -------------------------------------------------------------------------------- /website/css/select-pure.css: -------------------------------------------------------------------------------- 1 | .select-wrapper 2 | { 3 | margin: auto; 4 | max-width: 600px; 5 | width: calc(100% - 40px); 6 | } 7 | 8 | .select-pure__select 9 | { 10 | align-items: center; 11 | background: #f9f9f8; 12 | border-radius: 4px; 13 | border: 1px solid rgba(0, 0, 0, 0.15); 14 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); 15 | box-sizing: border-box; 16 | color: #363b3e; 17 | cursor: pointer; 18 | display: flex; 19 | font-size: 16px; 20 | font-weight: 500; 21 | justify-content: left; 22 | min-height: 44px; 23 | padding: 5px 10px; 24 | position: relative; 25 | transition: 0.2s; 26 | width: 100%; 27 | } 28 | 29 | .select-pure__options 30 | { 31 | border-radius: 4px; 32 | border: 1px solid rgba(0, 0, 0, 0.15); 33 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); 34 | box-sizing: border-box; 35 | color: #363b3e; 36 | display: none; 37 | left: 0; 38 | max-height: 221px; 39 | overflow-y: scroll; 40 | position: absolute; 41 | top: 50px; 42 | width: 100%; 43 | z-index: 5; 44 | } 45 | 46 | .select-pure__select--opened .select-pure__options 47 | { 48 | display: block; 49 | } 50 | 51 | .select-pure__option 52 | { 53 | background: #fff; 54 | border-bottom: 1px solid #e4e4e4; 55 | box-sizing: border-box; 56 | height: 44px; 57 | line-height: 25px; 58 | padding: 10px; 59 | } 60 | 61 | .select-pure__option--selected 62 | { 63 | color: #e4e4e4; 64 | cursor: initial; 65 | pointer-events: none; 66 | } 67 | 68 | .select-pure__option--hidden 69 | { 70 | display: none; 71 | } 72 | 73 | .select-pure__selected-label 74 | { 75 | background: #5e6264; 76 | border-radius: 4px; 77 | color: #fff; 78 | cursor: initial; 79 | display: inline-block; 80 | margin: 5px 10px 5px 0; 81 | padding: 3px 7px; 82 | } 83 | 84 | .select-pure__selected-label:last-of-type 85 | { 86 | margin-right: 0; 87 | } 88 | 89 | .select-pure__selected-label i 90 | { 91 | cursor: pointer; 92 | display: inline-block; 93 | margin-left: 7px; 94 | } 95 | 96 | .select-pure__selected-label i:hover 97 | { 98 | color: #e4e4e4; 99 | } 100 | 101 | .select-pure__autocomplete 102 | { 103 | background: #f9f9f8; 104 | border-bottom: 1px solid #e4e4e4; 105 | border-left: none; 106 | border-right: none; 107 | border-top: none; 108 | box-sizing: border-box; 109 | font-size: 16px; 110 | outline: none; 111 | padding: 10px; 112 | width: 100%; 113 | } -------------------------------------------------------------------------------- /website/list_platforms.php: -------------------------------------------------------------------------------- 1 | GetPlatformsList(array("icon" => true)); 9 | 10 | $PlatformIDs = array(); 11 | foreach($PlatformList as &$platform) 12 | { 13 | $PlatformIDs[] = $platform->id; 14 | } 15 | $icons = $API->GetPlatformBoxartByID($PlatformIDs, 0, 99999, ['icon']); 16 | foreach($PlatformList as &$platform) 17 | { 18 | if(isset($icons[$platform->id])) 19 | { 20 | $platform->boxart = &$icons[$platform->id]; 21 | } 22 | } 23 | $Header = new HEADER(); 24 | $Header->setTitle("TGDB - Browse - Platforms"); 25 | $Header->appendRawHeader(function() 26 | { ?> 27 | 63 | 64 | print(); ?> 65 | 66 |
67 |
68 |
69 |
70 |
71 |
72 | Platforms 73 |
74 | 75 | 76 | <?= $Platform->name?> 77 |

name ?>

78 |
79 | 80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | 88 | 89 | -------------------------------------------------------------------------------- /website/list_devs.php: -------------------------------------------------------------------------------- 1 | GetDevsList(); 8 | 9 | 10 | 11 | $alpha_list = array(); 12 | foreach($DevsList as $Dev) 13 | { 14 | $alpha_list[mb_strtoupper(mb_substr($Dev->name, 0, 1))][] = $Dev; 15 | } 16 | 17 | 18 | $Header = new HEADER(); 19 | $Header->setTitle("TGDB - Browse - Developers"); 20 | $Header->appendRawHeader(function() 21 | { ?> 22 | 63 | 64 | print(); ?> 65 | 66 |
67 |
68 |
69 |
70 |
71 | $Dev) : ?> 72 | 73 | 74 |
75 |
76 |
77 | Devs 78 |
79 | $val_Devlist) : ?> 80 |


81 |
82 | 83 | 84 |

name ?>

85 |
86 | 87 |
88 |
89 | 90 | 91 |
92 |
93 |
94 |
95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /website/list_pubs.php: -------------------------------------------------------------------------------- 1 | GetPubsList(); 8 | 9 | 10 | 11 | $alpha_list = array(); 12 | foreach($PubsList as $pub) 13 | { 14 | $alpha_list[mb_strtoupper(mb_substr($pub->name, 0, 1))][] = $pub; 15 | } 16 | 17 | 18 | $Header = new HEADER(); 19 | $Header->setTitle("TGDB - Browse - Publishers"); 20 | $Header->appendRawHeader(function() 21 | { ?> 22 | 63 | 64 | print(); ?> 65 | 66 |
67 |
68 |
69 |
70 |
71 | $pub) : ?> 72 | 73 | 74 |
75 |
76 |
77 | Pubs 78 |
79 | $val_publist) : ?> 80 |


81 |
82 | 83 | 84 |

name ?>

85 |
86 | 87 |
88 |
89 | 90 | 91 |
92 |
93 |
94 |
95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /website/js/fancybox.config.js: -------------------------------------------------------------------------------- 1 | 2 | fancyboxOpts = 3 | { 4 | buttons: 5 | [ 6 | "zoom", 7 | "share", 8 | "slideShow", 9 | "fullScreen", 10 | "download", 11 | "thumbs", 12 | "close" 13 | ], 14 | slideShow: 15 | { 16 | autoStart: false, 17 | speed: 4000 18 | }, 19 | thumbs: 20 | { 21 | autoStart: true, 22 | hideOnClose: true, 23 | axis: "x" 24 | }, 25 | share: 26 | { 27 | tpl: 28 | '
' + 29 | "

{{SHARE}}

" + 30 | "

" + 31 | '' + 32 | '' + 33 | "Twitter" + 34 | "" + 35 | '' + 36 | '' + 37 | "Facebook" + 38 | "" + 39 | '' + 40 | ' Stumbleupon' + 41 | "" + 42 | '' + 43 | '' + 44 | "Pinterest" + 45 | '' + 46 | "

" + 47 | '

' + 48 | "
" 49 | } 50 | }; -------------------------------------------------------------------------------- /API/include/middleware.php: -------------------------------------------------------------------------------- 1 | withJson($JSON_Response, $JSON_Response['code']); 17 | } 18 | else 19 | { 20 | $auth = APIAccessDB::getInstance(); 21 | $User = $auth->GetUserAllowanceByAPIKey($_REQUEST['apikey']); 22 | if(!empty($User)) 23 | { 24 | $monthly_allowance = (!empty($User->monthly_allowance)) ? $User->monthly_allowance : 0; 25 | $monthly_count = (!empty($User->count)) ? $User->count : 0; 26 | $refresh = strtotime("+30 days", strtotime($User->last_refresh_date)) - time(); 27 | if($update_refresh_date = $refresh < 0) 28 | { 29 | $refresh = strtotime("+30 days", 0); 30 | $monthly_count = 0; 31 | } 32 | $remaining_monthly_allowance = $monthly_allowance - $monthly_count; 33 | if($remaining_monthly_allowance > 0 || $User->extra_allowance > 0) 34 | { 35 | $use_extra = $remaining_monthly_allowance <= 0; 36 | 37 | $response = $next($request, $response); 38 | $auth->countAPIRequest($User, $update_refresh_date, $use_extra); 39 | $JSON_Response = json_decode($response->getBody(), true); 40 | $JSON_Response['remaining_monthly_allowance'] = $remaining_monthly_allowance + (!$use_extra ? -1 : 0); 41 | $JSON_Response['extra_allowance'] = $User->extra_allowance + ($use_extra ? -1 : 0); 42 | $JSON_Response['allowance_refresh_timer'] = ($User->is_private_key == 1) ? NULL : $refresh; 43 | return $response->withJson($JSON_Response, isset($JSON_Response['code']) ? $JSON_Response['code'] : 200); 44 | } 45 | else 46 | { 47 | $JSON_Response = Utils::getStatus(403); 48 | $JSON_Response['remaining_monthly_allowance'] = 0; 49 | $JSON_Response['allowance_refresh_timer'] = ($User->is_private_key == 1) ? NULL : $refresh; 50 | return $response->withJson($JSON_Response, $JSON_Response['code']); 51 | } 52 | } 53 | else 54 | { 55 | $JSON_Response = Utils::getStatus(401); 56 | $JSON_Response['remaining_monthly_allowance'] = 0; 57 | $JSON_Response['allowance_refresh_timer'] = 0; 58 | return $response->withJson($JSON_Response, $JSON_Response['code']); 59 | } 60 | } 61 | } 62 | } 63 | 64 | ?> 65 | -------------------------------------------------------------------------------- /API/oauth2-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 68 | -------------------------------------------------------------------------------- /API/include/Utils.class.php: -------------------------------------------------------------------------------- 1 | "Success", 8 | 401 => "This route requires and API key and no API key was provided.", 9 | 403 => "Invalid API key was provided.", 10 | 406 => "Invalid request: Invalid or missing paramaters.", 11 | ); 12 | 13 | function getStatus($code) 14 | { 15 | if(isset(Utils::$_statusMSG[$code])) 16 | { 17 | $statusMSG = Utils::$_statusMSG[$code]; 18 | } 19 | else 20 | { 21 | $statusMSG = "Unknown Error Code"; 22 | } 23 | return array("code" => $code, "status" => $statusMSG); 24 | } 25 | 26 | static function getPage() 27 | { 28 | if(!empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) && $_REQUEST['page'] > 0) 29 | { 30 | return $_REQUEST['page']; 31 | } 32 | return 1; 33 | } 34 | 35 | static function parseRequestOptions() 36 | { 37 | $options = array(); 38 | if(!empty($_REQUEST['include'])) 39 | { 40 | $params = explode(',', $_REQUEST['include']); 41 | foreach($params as $key => $val) 42 | { 43 | $options[$val] = true; 44 | } 45 | } 46 | return $options; 47 | } 48 | 49 | static function parseRequestedFields() 50 | { 51 | $options = array(); 52 | if(!empty($_REQUEST['fields'])) 53 | { 54 | $params = explode(',', $_REQUEST['fields']); 55 | foreach($params as $key => $val) 56 | { 57 | $options[$val] = true; 58 | } 59 | } 60 | return $options; 61 | } 62 | 63 | static function getJsonPageUrl($current_page, $has_next_page) 64 | { 65 | $route = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : die("invalid route")); 66 | 67 | $GET = $_GET; 68 | $ret['previous'] = NULL; 69 | if($current_page > 1) 70 | { 71 | $GET['page'] = $current_page-1; 72 | $ret['previous'] = CommonUtils::$API_BASE_URL . $route . "?" . http_build_query($GET,'','&'); 73 | } 74 | 75 | $GET['page'] = $current_page; 76 | $ret['current'] = CommonUtils::$API_BASE_URL . $route . "?" . http_build_query($GET,'','&'); 77 | 78 | $ret['next'] = NULL; 79 | if($has_next_page) 80 | { 81 | $GET['page'] = $current_page+1; 82 | $ret['next'] = CommonUtils::$API_BASE_URL . $route . "?" . http_build_query($GET,'','&'); 83 | } 84 | return $ret; 85 | } 86 | 87 | static function getValidNumericFromArray(array $args, $index) 88 | { 89 | $IDs = array(); 90 | if(!empty($args[$index]) && is_numeric($args[$index])) 91 | { 92 | $IDs = $args[$index]; 93 | } 94 | else if(!empty($_REQUEST[$index])) 95 | { 96 | $tmpIDs = explode(',', $_REQUEST[$index]); 97 | foreach($tmpIDs as $key => $val) 98 | if(is_numeric($val)) 99 | $IDs[] = $val; 100 | } 101 | return $IDs; 102 | } 103 | } 104 | 105 | ?> 106 | -------------------------------------------------------------------------------- /website/recently_added.php: -------------------------------------------------------------------------------- 1 | GetAllGames($offset, $limit + 1, array('overview' => true), "id", 'DESC'); 14 | if($has_next_page = count($lastupdated) > $limit) 15 | { 16 | unset($lastupdated[$limit]); 17 | } 18 | foreach($lastupdated as $Game) 19 | { 20 | $IDs[] = $Game->id; 21 | $PlatformIDs[] = $Game->platform; 22 | } 23 | $Platforms = $API->GetPlatforms($PlatformIDs); 24 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 25 | 26 | foreach($lastupdated as $Game) 27 | { 28 | if(isset($covers[$Game->id])) 29 | { 30 | $Game->boxart = $covers[$Game->id]; 31 | } 32 | } 33 | $Game = null; 34 | 35 | $Header = new HEADER(); 36 | $Header->setTitle("TGDB - Homepage"); 37 | $Header->appendRawHeader(function() { ?> 38 | 39 | 40 | 41 | 42 | 43 | print(); ?> 44 | 45 |
46 | 47 | 48 |
49 | 50 |
51 |

Recently Added


52 | 53 |
54 |
55 | 56 | <?= $game->gamr_title?> 57 | 58 |
59 |
60 |

game_title ?>

61 |
Platform: platform]->name ?>
62 |

63 | overview) ? WebUtils::truncate($game->overview, 200) : "No overview is currently available for this title, please feel free to add one."; ?>... Read More

64 |
65 |
66 |
67 | 68 |
69 | 70 |
71 | 72 | 73 |
74 | 75 | 76 | -------------------------------------------------------------------------------- /website/css/main.css: -------------------------------------------------------------------------------- 1 | 2 | .view-width 3 | { 4 | border: 1px solid #0C0D0E; 5 | line-height: 1.42857; 6 | background-color: #1C1E22; 7 | border-radius: 4px; 8 | max-width: 100%; 9 | width: 100%; 10 | } 11 | 12 | .game-overview 13 | { 14 | white-space: pre-wrap; 15 | } 16 | 17 | .cover-text-col-3 18 | { 19 | left: 15px !important; 20 | right: 15px !important; 21 | } 22 | 23 | .cover-text 24 | { 25 | font-size: 1.8vh; 26 | max-width: 100%; 27 | padding: 4px; 28 | line-height: 1.42857; 29 | border: 1px solid #0C0D0E; 30 | line-height: 1.42857; 31 | text-align: center; 32 | left: 3.5px; 33 | right: 3.5px; 34 | position: absolute; 35 | background: rgba(0, 0, 0, 0.79) none repeat scroll 0% 0%; 36 | white-space: nowrap; 37 | overflow: hidden; 38 | text-overflow: ellipsis; 39 | transition: opacity .1s linear, margin-bottom .2s ease-out, margin-top .2s ease-out; 40 | } 41 | 42 | .cover-text-top 43 | { 44 | border-radius: 4px 4px 0 0; 45 | top: 0px; 46 | } 47 | 48 | .cover-text-2 49 | { 50 | position: absolute; 51 | text-align: left; 52 | background: rgba(0, 0, 0, 0.79) none repeat scroll 0% 0%; 53 | border: 1px solid #0C0D0E; 54 | padding-left: 10px; 55 | padding-right: 10px; 56 | white-space: nowrap; 57 | overflow: hidden; 58 | text-overflow: ellipsis; 59 | } 60 | 61 | .cover-text-top-2 62 | { 63 | top: 0px; 64 | border-radius: 4px 4px 40px 40px; 65 | } 66 | 67 | .cover-text-bottom 68 | { 69 | border-radius: 0 0 4px 4px; 70 | bottom: 0px; 71 | } 72 | 73 | .cover-text-hover 74 | { 75 | opacity: 0; 76 | } 77 | 78 | .crop 79 | { 80 | width: 151px; 81 | height: 151px; 82 | overflow: hidden; 83 | } 84 | .crop span.img 85 | { 86 | background-position: center; 87 | background-size: cover; 88 | height: 151px; 89 | display: block; 90 | border-radius: 5px; 91 | } 92 | 93 | .cover-overlay 94 | { 95 | width: 100%; 96 | border: 1px solid #ddd; 97 | border-radius: 4px; 98 | padding: 2.5px; 99 | } 100 | .border-black 101 | { 102 | border: 1px solid #000; 103 | } 104 | 105 | footer * 106 | { 107 | color: white; 108 | } 109 | 110 | .card-footer:last-child 111 | { 112 | border: 0 !important; 113 | } 114 | .card-footer 115 | { 116 | background-color: rgba(0, 0, 0, 0.0) !important; 117 | } 118 | .card-noboday 119 | { 120 | padding: 0; 121 | } 122 | 123 | .btn-wrap-text 124 | { 125 | white-space: normal; 126 | } 127 | 128 | 129 | .fancybox-thumbs 130 | { 131 | top: auto !important; 132 | width: auto !important; 133 | bottom: 0 !important;; 134 | left: 0 !important;; 135 | right : 0 !important;; 136 | height: 95px!important; 137 | padding: 10px 10px 5px 10px !important;; 138 | box-sizing: border-box !important;; 139 | background: rgba(0, 0, 0, 0.3) !important;; 140 | } 141 | 142 | .fancybox-show-thumbs .fancybox-inner 143 | { 144 | right: 0 !important; 145 | bottom: 95px !important;; 146 | } 147 | 148 | h1, h2, h3, h4, h5, h6 149 | { 150 | text-transform: none !important; 151 | } 152 | -------------------------------------------------------------------------------- /website/include/WebUtils.class.php: -------------------------------------------------------------------------------- 1 | = strlen($text))) 13 | { 14 | $ret = substr($text, 0, $pos); 15 | if ($add_leading_trail) 16 | { 17 | $ret .= "..."; 18 | } 19 | return $ret; 20 | } 21 | return $text; 22 | } 23 | 24 | static function purgeCDNCacheFile($filenames) 25 | { 26 | require_once __DIR__ . '/../../vendor/autoload.php'; 27 | require_once __DIR__ . '/../../include/config.class.php'; 28 | try 29 | { 30 | $key = new \Cloudflare\API\Auth\APIKey(Config::$_CF_EMAIL, Config::$_CF_KEY); 31 | $adapter = new Cloudflare\API\Adapter\Guzzle($key); 32 | 33 | $zones = new \Cloudflare\API\Endpoints\Zones($adapter); 34 | 35 | foreach($filenames as $filename) 36 | { 37 | $files[] = "https://cdn.thegamesdb.net/$filename"; 38 | } 39 | return $zones->cachePurge(Config::$_CF_ZONE_ID, $files); 40 | } 41 | catch (Exception $e) 42 | { 43 | error_log($err); 44 | } 45 | return false; 46 | } 47 | 48 | static function purgeCDNCache($img_name) 49 | { 50 | require_once __DIR__ . '/../../vendor/autoload.php'; 51 | require_once __DIR__ . '/../../include/config.class.php'; 52 | try 53 | { 54 | $key = new \Cloudflare\API\Auth\APIKey(Config::$_CF_EMAIL, Config::$_CF_KEY); 55 | $adapter = new Cloudflare\API\Adapter\Guzzle($key); 56 | 57 | $zones = new \Cloudflare\API\Endpoints\Zones($adapter); 58 | $sizes = array("small", "thumb", "original", "cropped_center_thumb", "cropped_center_thumb_square", "medium", "large"); 59 | 60 | foreach($sizes as $size) 61 | { 62 | $files[] = "https://cdn.thegamesdb.net/images/$size/$img_name"; 63 | } 64 | return $zones->cachePurge(Config::$_CF_ZONE_ID, $files); 65 | } 66 | catch (Exception $e) 67 | { 68 | error_log($err); 69 | } 70 | return false; 71 | } 72 | 73 | static function purgeCDNCacheArray($img_names) 74 | { 75 | require_once __DIR__ . '/../../vendor/autoload.php'; 76 | require_once __DIR__ . '/../../include/config.class.php'; 77 | 78 | $key = new \Cloudflare\API\Auth\APIKey(Config::$_CF_EMAIL, Config::$_CF_KEY); 79 | $adapter = new Cloudflare\API\Adapter\Guzzle($key); 80 | 81 | $zones = new \Cloudflare\API\Endpoints\Zones($adapter); 82 | foreach ($img_names as $value) 83 | { 84 | $sizes = array("small", "thumb", "original", "cropped_center_thumb", "cropped_center_thumb_square", "medium", "large"); 85 | 86 | foreach($sizes as $size) 87 | { 88 | $files[] = "https://cdn.thegamesdb.net/images/$size/$value"; 89 | } 90 | } 91 | $i = 0; 92 | $arrycount = 0; 93 | foreach (array_reverse(array_chunk($files, 499)) as $files_chunk) 94 | { 95 | $i++; 96 | $arrycount++; 97 | $zones->cachePurge(Config::$_CF_ZONE_ID, $files_chunk); 98 | if($i > 1100) 99 | { 100 | $i = 0; 101 | sleep(300); 102 | } 103 | echo "$arrycount\n"; 104 | 105 | } 106 | } 107 | } 108 | 109 | ?> -------------------------------------------------------------------------------- /website/include/login.phpbb.class.php: -------------------------------------------------------------------------------- 1 | enable_super_globals(); 8 | 9 | class phpBBUser 10 | { 11 | private function __construct() 12 | { 13 | global $user, $auth; 14 | $user->session_begin(); 15 | $auth->acl($user->data); 16 | $user->setup(); 17 | $this->user = $user; 18 | $this->auth = $auth; 19 | } 20 | 21 | public static function getInstance() 22 | { 23 | static $instance = null; 24 | if (!isset($instance)) 25 | { 26 | $object = __CLASS__; 27 | $instance = new $object; 28 | } 29 | return $instance; 30 | } 31 | 32 | function Login($login_autologin, $login_viewonline) 33 | { 34 | global $config, $phpbb_root_path, $phpEx, $request; 35 | $login_username = $request->variable('username', '', true, \phpbb\request\request_interface::POST); 36 | $login_password = $request->untrimmed_variable('password', '', true, \phpbb\request\request_interface::POST); 37 | 38 | $ret = $this->auth->login($login_username, $login_password); 39 | if($ret['status'] == LOGIN_ERROR_ATTEMPTS) 40 | { 41 | $ret['error_msg_str'] = "You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA," . 42 | "
CAPTCHA login can only be performed through the forums login.
" . 43 | "You will be automatically redirect to forum login, if it takes longer than 10 seconds Click Here." . 44 | ''; 45 | } 46 | elseif($ret['status'] != LOGIN_SUCCESS) 47 | { 48 | $ret['error_msg_str'] = sprintf( 49 | $this->user->lang[$ret['error_msg']], 50 | ($config['email_enable']) ? '' : '', 51 | ($config['email_enable']) ? '' : '', 52 | '', 53 | '' 54 | ); 55 | } 56 | elseif($ret['status'] == LOGIN_SUCCESS) 57 | { 58 | $this->user->session_create($ret['user_row']['user_id'], false, $login_autologin, $login_viewonline); 59 | } 60 | return $ret; 61 | } 62 | 63 | function isLoggedIn() 64 | { 65 | return ($this->user->data['is_registered'] && $this->user->data['user_id'] != ANONYMOUS); 66 | } 67 | 68 | function Logout() 69 | { 70 | global $request; 71 | if($this->user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $this->user->session_id) 72 | { 73 | $this->user->session_kill(); 74 | return true; 75 | } 76 | return false; 77 | } 78 | 79 | function GetUsername() 80 | { 81 | return $this->user->data['username']; 82 | } 83 | 84 | function GetAvatar() 85 | { 86 | if(!empty($this->user->data['user_avatar'])) 87 | { 88 | return "https://forums.thegamesdb.net/download/file.php?avatar=" . $this->user->data['user_avatar']; 89 | } 90 | } 91 | 92 | function GetUserID() 93 | { 94 | return $this->user->data['user_id']; 95 | } 96 | 97 | function GetUserSessionID() 98 | { 99 | return $this->user->session_id; 100 | } 101 | 102 | function hasPermission($perm) 103 | { 104 | // we're using permission to post in general forum as a permission to edit covers/platform information 105 | return $this->auth->acl_get($perm) > 0; 106 | } 107 | } 108 | 109 | ?> -------------------------------------------------------------------------------- /website/browse.php: -------------------------------------------------------------------------------- 1 | GetPlatformsList(array("icon" => true)); 9 | 10 | $PlatformIDs = array(); 11 | foreach($PlatformList as &$platform) 12 | { 13 | $PlatformIDs[] = $platform->id; 14 | } 15 | $icons = $API->GetPlatformBoxartByID($PlatformIDs, 0, 99999, ['icon']); 16 | foreach($PlatformList as &$platform) 17 | { 18 | if(isset($icons[$platform->id])) 19 | { 20 | $platform->boxart = &$icons[$platform->id]; 21 | } 22 | } 23 | $Header = new HEADER(); 24 | $Header->setTitle("TGDB - Browser"); 25 | $Header->appendRawHeader(function() 26 | { ?> 27 | 63 | 64 | print(); ?> 65 | 66 |
67 |
68 |
69 |
70 |
71 |
72 | Search by name 73 |
74 | 75 |
76 | 77 |
78 |
79 |
80 | 81 | 87 |
88 | 89 |
90 |
91 |
92 |
93 |
94 | 95 |
96 |

OR

97 |
98 | 99 |
100 |
101 |
102 |
103 |
104 | Browse by platform 105 |
106 | $Platform) :?> 107 | 108 | <?= $Platform->name ?> 109 |

name ?>

110 |
111 | 112 |
113 |
114 |
115 |
116 |
117 |
118 | 119 |
120 | 121 | 122 | -------------------------------------------------------------------------------- /website/actions/add_game.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('u_edit_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | 25 | $GameArrayFields = ['game_title', 'overview', 'release_date', 'players', 'coop', 'developers', 'publishers', 'platform', 'youtube', 'genres', 'rating']; 26 | foreach($GameArrayFields as $field) 27 | { 28 | if(!isset($_REQUEST[$field])) 29 | { 30 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR . ": ($field)."); 31 | } 32 | else if(empty($_REQUEST[$field]) && ($field != 'youtube' && $field != 'overview')) 33 | { 34 | returnJSONAndDie(-1, "field is empty: ($field)."); 35 | } 36 | else if(($field == 'developers' || $field == 'publishers') && (empty($_REQUEST[$field]) || count($_REQUEST[$field]) < 1 || empty($_REQUEST[$field][0]))) 37 | { 38 | //returnJSONAndDie(-2, "$field field is empty, if $field is not listed, please request it on the forum."); 39 | } 40 | } 41 | 42 | $date = explode('-', $_REQUEST['release_date']); 43 | if(!checkdate($date[1], $date[2], $date[0])) 44 | { 45 | returnJSONAndDie(-1, "Invalid Date Format"); 46 | } 47 | 48 | 49 | require_once __DIR__ . "/../../include/TGDB.API.php"; 50 | require_once __DIR__ . "/../include/DiscordUtils.class.php"; 51 | 52 | try 53 | { 54 | 55 | $API = TGDB::getInstance(); 56 | 57 | if(!empty($_REQUEST['uids']) && !empty($_REQUEST['uids'][0])) 58 | { 59 | $patterns = $API->GetUIDPattern($_REQUEST['platform']); 60 | if(empty($patterns)) 61 | { 62 | returnJSONAndDie(-3, "No format found for title id, please contact us on the forum or discord to enable UID addition for this platform."); 63 | } 64 | else 65 | { 66 | $_REQUEST["uids"] = array_filter($_REQUEST["uids"]); 67 | foreach($_REQUEST["uids"] as $uid) 68 | { 69 | $matches = []; 70 | $matched = false; 71 | foreach($patterns as $pattern) 72 | { 73 | $regex_pat = $pattern->regex_pattern; 74 | if(preg_match_all("/$regex_pat/", $uid, $matches)) 75 | { 76 | if(count($matches[0]) == 1 && $matches[0][0] == $uid) 77 | { 78 | $matched = true; 79 | break; 80 | } 81 | } 82 | } 83 | if(!$matched) 84 | { 85 | returnJSONAndDie(-2, "The UID format you're using is invalid, please contact us on the forum or discord if you please there is a mistake"); 86 | } 87 | } 88 | } 89 | } 90 | 91 | $res = $API->InsertGame($_user->GetUserID(), $_REQUEST['game_title'], $_REQUEST['overview'], $_REQUEST['youtube'], $_REQUEST['release_date'], 92 | $_REQUEST['players'], $_REQUEST['coop'], $_REQUEST['developers'], $_REQUEST['publishers'], $_REQUEST['platform'], $_REQUEST['genres'], $_REQUEST['rating'], 93 | $_REQUEST['alternate_names'], $_REQUEST['uids']); 94 | 95 | if($res) 96 | { 97 | $filters = ['game_title' => true, 'overview' => true, 'youtube' => true, 'release_date' => true, 'players' => true, 'coop' => true, 'developers' => true, 'publishers' => true, 'genres' => true, 'rating' => true, 'alternates' => true, "uids" => true]; 98 | $new_game_data = $API->GetGameByID($res, 0, 1, $filters)[0]; 99 | DiscordUtils::PostGameUpdate($_user, [], $new_game_data, 0); 100 | returnJSONAndDie(1, $res); 101 | } 102 | 103 | } 104 | catch (Exception $e) 105 | { 106 | error_log($e); 107 | } 108 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 109 | -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/fine-uploader.min.css: -------------------------------------------------------------------------------- 1 | .qq-uploader{position:relative;width:100%}.qq-upload-button{display:block;width:105px;padding:7px 0;text-align:center;background:#800;border-bottom:1px solid #ddd;color:#fff}.qq-upload-button-hover{background:#c00}.qq-upload-button-focus{outline:1px dotted #000}.qq-upload-drop-area,.qq-upload-extra-drop-area{position:absolute;top:0;left:0;width:100%;height:100%;min-height:30px;z-index:2;background:#ff9797;text-align:center}.qq-upload-drop-area span{display:block;position:absolute;top:50%;width:100%;margin-top:-8px;font-size:16px}.qq-upload-extra-drop-area{position:relative;margin-top:50px;font-size:16px;padding-top:30px;height:20px;min-height:40px}.qq-upload-drop-area-active{background:#ff7171}.qq-upload-list{margin:0;padding:0;list-style:none}.qq-upload-list li{margin:0;padding:9px;line-height:15px;font-size:16px;background-color:#fff0bd}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-failed-text,.qq-upload-file,.qq-upload-pause,.qq-upload-retry,.qq-upload-size,.qq-upload-spinner{margin-right:12px;display:inline}.qq-upload-spinner{display:inline-block;background:url(loading.gif);width:15px;height:15px;vertical-align:text-bottom}.qq-drop-processing{display:block}.qq-drop-processing-spinner{display:inline-block;background:url(processing.gif);width:24px;height:24px;vertical-align:text-bottom}.qq-upload-continue,.qq-upload-delete,.qq-upload-pause{display:inline}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-pause,.qq-upload-retry{color:#000}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-pause,.qq-upload-retry,.qq-upload-size{font-size:12px;font-weight:400}.qq-upload-failed-text{display:none;font-style:italic;font-weight:700}.qq-upload-failed-icon{display:none;width:15px;height:15px;vertical-align:text-bottom}.qq-upload-fail .qq-upload-failed-text{display:inline}.qq-upload-retrying .qq-upload-failed-text{display:inline;color:#d60000}.qq-upload-list li.qq-upload-success{background-color:#5da30c;color:#fff}.qq-upload-list li.qq-upload-fail{background-color:#d60000;color:#fff}.qq-progress-bar{display:block;background:-moz-linear-gradient(top,rgba(30,87,153,1) 0,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(30,87,153,1)),color-stop(50%,rgba(41,137,216,1)),color-stop(51%,rgba(32,124,202,1)),color-stop(100%,rgba(125,185,232,1)));background:-webkit-linear-gradient(top,rgba(30,87,153,1) 0,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%);background:-o-linear-gradient(top,rgba(30,87,153,1) 0,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%);background:-ms-linear-gradient(top,rgba(30,87,153,1) 0,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%);background:linear-gradient(to bottom,rgba(30,87,153,1) 0,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%);width:0;height:15px;border-radius:6px;margin-bottom:3px}.qq-total-progress-bar{height:25px;border-radius:9px}.qq-total-progress-bar-container{margin:9px}INPUT.qq-edit-filename{position:absolute;opacity:0;z-index:-1}.qq-upload-file.qq-editable{cursor:pointer}.qq-edit-filename-icon.qq-editable{display:inline-block;cursor:pointer}INPUT.qq-edit-filename.qq-editing{position:static;margin-top:-5px;margin-right:10px;margin-bottom:-5px;opacity:1}.qq-edit-filename-icon{display:none;background:url(edit.gif);width:15px;height:15px;vertical-align:text-bottom;margin-right:5px}.qq-hide{display:none}.qq-uploader DIALOG{display:none}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG{display:none}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG .qq-dialog-buttons{text-align:center;padding-top:10px}.qq-uploader DIALOG .qq-dialog-buttons BUTTON{margin-left:5px;margin-right:5px}.qq-uploader DIALOG .qq-dialog-message-selector{padding-bottom:10px}.qq-uploader DIALOG::backdrop{background-color:rgba(0,0,0,.7)}/*# sourceMappingURL=fine-uploader.min.css.map */ -------------------------------------------------------------------------------- /API/key.php: -------------------------------------------------------------------------------- 1 | isLoggedIn() && $_user->hasPermission('u_api_access')) 7 | { 8 | require_once __DIR__ . "/../API/include/APIAccessDB.class.php"; 9 | $auth = APIAccessDB::getInstance(); 10 | $key = $auth->RequestPublicAPIKey($_user->GetUserID()); 11 | $private_key = $auth->RequestPrivateAPIKey($_user->GetUserID()); 12 | if(!is_object($private_key)) 13 | { 14 | $private_key = new stdClass(); 15 | $private_key->key = "NA"; 16 | $private_key->extra_allowance = "NA"; 17 | 18 | } 19 | } 20 | 21 | ?> 22 | 23 | 24 | 25 | 26 | 27 | 28 | TheGamesDB API DOCs 29 | 30 | 31 | 32 | 33 | 34 | 54 | 55 | 56 | 57 |

API Keys

58 |
59 | 60 |
61 |
62 |
63 | isLoggedIn() ) : ?> 64 |

You must login to the forum to view your api key.

65 | isLoggedIn() && !$_user->hasPermission('u_api_access')) : ?> 66 |

You must request access to the api via the forum.

67 | isLoggedIn() && $_user->hasPermission('u_api_access')) : ?> 68 |
69 |
70 | Public API Key: 71 |
72 |
73 |

This key has a limit per IP.

74 |

This key should be used in your application.

75 |
76 |
77 | 78 |
79 |
80 | Private API Key: apikey ?> 81 |

Remaining Requests: extra_allowance ?>/6000

82 |

83 |
84 |

This key would contain a higher one time request rate limit, 85 | but the key must not be made available to the general public, as it has a shared limit and not an IP based one.

86 |

This key can be used to create an initial mirror of the required data on your server, 87 | which you can then subsquantly updated using the Update endpoint using the public key.

88 |

Please Note: this key should only be used server side. 89 |

90 | 91 | 92 |

93 |
94 | 95 | 96 |
97 |
98 | 99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /website/search.php: -------------------------------------------------------------------------------- 1 | GetPlatformsList(array("icon" => true)); 13 | if(isset($_GET['platform_id']) && !empty($_GET['platform_id']) && !in_array(0, $_GET['platform_id'])) 14 | { 15 | $platformIDs = $_GET['platform_id']; 16 | foreach($_GET['platform_id'] as $platform_id) 17 | { 18 | $platformIDs[$platform_id] = true; 19 | } 20 | } 21 | if(isset($_GET['name']) && !empty($_GET['name'])) 22 | { 23 | $limit = 18; 24 | $page = PaginationUtils::getPage(); 25 | $offset = ($page - 1) * $limit; 26 | if(!isset($_GET['platform_id']) || !is_array($_GET['platform_id']) || in_array(0, $_GET['platform_id'])) 27 | { 28 | $list = $API->SearchGamesByName($_GET['name'], $offset, $limit + 1); 29 | } 30 | else 31 | { 32 | $list = $API->SearchGamesByNameByPlatformID($_GET['name'], $_GET['platform_id'], $offset, $limit + 1); 33 | } 34 | $search_term = htmlspecialchars($_GET['name']); 35 | if($has_next_page = count($list) > $limit) 36 | { 37 | unset($list[$limit]); 38 | } 39 | 40 | if(!empty($list)) 41 | { 42 | foreach($list as $Game) 43 | { 44 | $IDs[] = $Game->id; 45 | } 46 | $covers = $API->GetGameBoxartByID($IDs, 0, $limit*2); 47 | foreach($list as $Game) 48 | { 49 | if(isset($covers[$Game->id])) 50 | { 51 | $Game->boxart = $covers[$Game->id]; 52 | } 53 | } 54 | } 55 | } 56 | 57 | $Header = new HEADER(); 58 | $Header->setTitle("TGDB - Search"); 59 | ?> 60 | print(); ?> 61 |
62 | 63 |
64 |
65 | 66 |
67 |
68 |
69 | Search by name 70 |
71 | 72 |
73 | 74 |
75 |
76 |
77 | 78 | 84 |
85 | 86 |
87 |
88 |
89 | 90 |
91 |
92 | 93 |
94 | 95 | 111 | 112 |
113 | 114 | 115 |
116 | 117 | 118 | -------------------------------------------------------------------------------- /website/actions/edit_game.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('u_edit_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | $GameArrayFields = ['game_title', 'overview', 'release_date', 'players', 'coop', 'developers', 'publishers', 'youtube', 'genres', 'rating']; 25 | if(!isset($_REQUEST['game_id']) || !is_numeric($_REQUEST['game_id'])) 26 | { 27 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 28 | } 29 | else 30 | { 31 | foreach($GameArrayFields as $field) 32 | { 33 | if(!isset($_REQUEST[$field])) 34 | { 35 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR . ": ($field)."); 36 | } 37 | else if(empty($_REQUEST[$field]) && ($field != 'youtube' && $field != 'overview')) 38 | { 39 | returnJSONAndDie(-1, "field is empty: ($field)."); 40 | } 41 | else if(($field == 'developers' || $field == 'publishers') && (empty($_REQUEST[$field]) || count($_REQUEST[$field]) < 1 || empty($_REQUEST[$field][0]))) 42 | { 43 | //returnJSONAndDie(-1, "developers field is empty, if developer is not listed, please request it on the forum."); 44 | } 45 | } 46 | 47 | $date = explode('-', $_REQUEST['release_date']); 48 | if(!checkdate($date[1], $date[2], $date[0])) 49 | { 50 | returnJSONAndDie(-1, "Invalid Date Format"); 51 | } 52 | } 53 | 54 | require_once __DIR__ . "/../../include/TGDB.API.php"; 55 | require_once __DIR__ . "/../include/DiscordUtils.class.php"; 56 | 57 | try 58 | { 59 | $filters = ['game_title' => true, 'overview' => true, 'platform' => true, 'youtube' => true, 'release_date' => true, 'players' => true, 'coop' => true, 'developers' => true, 'publishers' => true, 'genres' => true, 'rating' => true, 'alternates' => true, "uids" => true]; 60 | $API = TGDB::getInstance(); 61 | $old_game_data = $API->GetGameByID($_REQUEST['game_id'], 0, 1, $filters)[0]; 62 | 63 | if(!empty($_REQUEST['uids']) && !empty($_REQUEST['uids'][0])) 64 | { 65 | $patterns = $API->GetUIDPattern($old_game_data->platform); 66 | if(empty($patterns)) 67 | { 68 | returnJSONAndDie(-3, "No format found for title id, please contact us on the forum or discord to enable UID addition for this platform."); 69 | } 70 | else 71 | { 72 | $_REQUEST["uids"] = array_filter($_REQUEST["uids"]); 73 | foreach($_REQUEST["uids"] as $uid) 74 | { 75 | $matches = []; 76 | $matched = false; 77 | foreach($patterns as $pattern) 78 | { 79 | $regex_pat = $pattern->regex_pattern; 80 | if(preg_match_all("/$regex_pat/", $uid, $matches)) 81 | { 82 | if(count($matches[0]) == 1 && $matches[0][0] == $uid) 83 | { 84 | $matched = true; 85 | break; 86 | } 87 | } 88 | } 89 | if(!$matched) 90 | { 91 | returnJSONAndDie(-2, "The UID format you're using is invalid, please contact us on the forum or discord if you please there is a mistake"); 92 | } 93 | } 94 | } 95 | } 96 | 97 | if(!$_user->hasPermission('m_delete_games')) 98 | { 99 | $_REQUEST['platform'] = $old_game_data->platform; 100 | } 101 | 102 | $res = $API->UpdateGame( $_user->GetUserID(), $_REQUEST['game_id'], $_REQUEST['game_title'], $_REQUEST['overview'], $_REQUEST['youtube'], $_REQUEST['release_date'], 103 | $_REQUEST['players'], $_REQUEST['coop'], $_REQUEST['developers'], $_REQUEST['publishers'], $_REQUEST['genres'], $_REQUEST['rating'], $_REQUEST['alternate_names'], 104 | $_REQUEST['uids'], $_REQUEST['platform']); 105 | 106 | if($res) 107 | { 108 | $new_game_data = $API->GetGameByID($_REQUEST['game_id'], 0, 1, $filters)[0]; 109 | DiscordUtils::PostGameUpdate($_user, $old_game_data, $new_game_data, 1); 110 | returnJSONAndDie(1, "success!!"); 111 | } 112 | 113 | } 114 | catch (Exception $e) 115 | { 116 | error_log($e); 117 | } 118 | returnJSONAndDie(-1, "Unexpected Error has occured, Please try again!!"); 119 | -------------------------------------------------------------------------------- /website/contr.php: -------------------------------------------------------------------------------- 1 | SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 7 | $errorPage->SetMSG(ErrorPage::$MSG_MISSING_PARAM_ERROR); 8 | $errorPage->print_die(); 9 | } 10 | require_once __DIR__ . "/include/header.footer.class.php"; 11 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 12 | require_once __DIR__ . "/../include/TGDB.API.php"; 13 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 14 | require_once __DIR__ . "/include/login.phpbb.class.php"; 15 | 16 | $_user = phpBBuser::getInstance(); 17 | 18 | { 19 | $game_id = $_REQUEST['id']; 20 | $API = TGDB::getInstance(); 21 | $list = $API->GetGameEditContributors($_REQUEST['id']); 22 | if($_REQUEST['id'] < 60000) 23 | { 24 | $legacy = $API->GetLegacyCopy($_REQUEST['id']); 25 | } 26 | 27 | } 28 | 29 | 30 | $Header = new HEADER(); 31 | $Header->setTitle("TGDB - Browse - Game - $Game->game_title"); 32 | $Header->appendRawHeader(function() { global $Game, $box_cover, $_user; ?> 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 89 | 90 | print(); ?> 91 | 92 |
93 | 94 |
95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
Edit IDUsernameTimestampTypeValue
id; ?>username; ?>timestamp; ?>type; ?>value; ?>
119 | 120 |

No user edits on record. You can check legacy edit below.

121 | 122 |
123 |
124 | 125 | 126 |
127 |
128 |

legacy data (reference only)

129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | $value): ?> 138 | 139 | 140 | 141 | 142 | 143 | 144 |
TypeValue
145 |
146 |
147 | 148 |
149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /website/my_games.php: -------------------------------------------------------------------------------- 1 | isLoggedIn()) 19 | { 20 | $errorPage = new ErrorPage(); 21 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 22 | $errorPage->SetMSG(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 23 | $errorPage->print_die(); 24 | } 25 | 26 | 27 | $API = TGDB::getInstance(); 28 | $page = PaginationUtils::getPage(); 29 | $limit = 18; 30 | $offset = ($page - 1) * $limit; 31 | $list = $API->GetUserBookmarkedGames($_user->GetUserID(), $offset, $limit + 1); 32 | $Platform_IDs = $API->GetUserBookmarkedGamesPlatforms($_user->GetUserID()); 33 | $listed_by = "My Games"; 34 | 35 | if($has_next_page = count($list) > $limit) 36 | { 37 | unset($list[$limit]); 38 | } 39 | 40 | foreach($list as $Game) 41 | { 42 | $IDs[] = $Game->id; 43 | } 44 | if(isset($IDs) && !empty($IDs)) 45 | { 46 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 47 | foreach($list as $Game) 48 | { 49 | if(isset($covers[$Game->id])) 50 | { 51 | $Game->boxart = $covers[$Game->id]; 52 | } 53 | } 54 | } 55 | 56 | $platforms = []; 57 | if(isset($Platform_IDs) && !empty($Platform_IDs)) 58 | { 59 | $platforms = $API->GetPlatforms(array_unique($Platform_IDs), ['name']); 60 | $icons = $API->GetPlatformBoxartByID($Platform_IDs, 0, 99999, ['icon']); 61 | foreach($platforms as &$platform) 62 | { 63 | if(isset($icons[$platform->id])) 64 | { 65 | $platform->boxart = &$icons[$platform->id]; 66 | } 67 | } 68 | } 69 | unset($platform); 70 | $Header = new HEADER(); 71 | $Header->setTitle("TGDB - Browser - Game By $listed_by"); 72 | ?> 73 | print(); ?> 74 | 75 |
76 |
77 |
78 |
79 |
80 |
81 | Platforms 82 |
83 | 84 | 85 | <?= $platform->name?> 86 |

name ?>

87 |
88 | 89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | 97 | 98 | 114 | 115 | 116 |
117 |
118 |
119 |

Please add games to your collection first.

120 |
121 |
122 |
123 | 124 |
125 | 126 |
127 | 128 | -------------------------------------------------------------------------------- /website/user_contrib.php: -------------------------------------------------------------------------------- 1 | SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 7 | $errorPage->SetMSG(ErrorPage::$MSG_MISSING_PARAM_ERROR); 8 | $errorPage->print_die(); 9 | } 10 | require_once __DIR__ . "/include/header.footer.class.php"; 11 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 12 | require_once __DIR__ . "/../include/TGDB.API.php"; 13 | require_once __DIR__ . "/include/login.phpbb.class.php"; 14 | require_once __DIR__ . "/include/PaginationUtils.class.php"; 15 | 16 | $API = TGDB::getInstance(); 17 | $page = PaginationUtils::getPage(); 18 | $limit = 18; 19 | $offset = ($page - 1) * $limit; 20 | $list = $API->GetUserEditsByUserID($_REQUEST['id'], $offset, $limit + 1); 21 | $count = $API->GetUserEditsCountByUserID($_REQUEST['id']); 22 | 23 | $displayMin = ($page - 1) * $limit; 24 | $displayMax = $page * $limit; 25 | if($displayMax > $count) 26 | { 27 | $displayMax = $count; 28 | } 29 | if($has_next_page = count($list) > $limit) 30 | { 31 | unset($list[$limit]); 32 | } 33 | 34 | foreach($list as $Game) 35 | { 36 | $IDs[] = $Game->id; 37 | } 38 | if(isset($IDs) && !empty($IDs)) 39 | { 40 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 41 | foreach($list as $Game) 42 | { 43 | if(isset($covers[$Game->id])) 44 | { 45 | $Game->boxart = $covers[$Game->id]; 46 | } 47 | } 48 | } 49 | //print_r($list); 50 | 51 | $Header = new HEADER(); 52 | $Header->setTitle("TGDB - Browse - Game - $Game->game_title"); 53 | $Header->appendRawHeader(function() { global $Game, $box_cover, $_user; ?> 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 72 | 110 | 111 | print(); ?> 112 | 113 |
114 | 115 |
116 | 117 |

- /

118 | 119 | 134 | 135 |
136 |
137 |
138 |

This User has no contributions.

139 |
140 |
141 |
142 | 143 |
144 | 145 |
146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /website/add_dev_pub.php: -------------------------------------------------------------------------------- 1 | isLoggedIn()) 6 | { 7 | $errorPage = new ErrorPage(); 8 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 9 | $errorPage->SetMSG(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 10 | $errorPage->print_die(); 11 | } 12 | else 13 | { 14 | if(!$_user->hasPermission('m_delete_games')) 15 | { 16 | $errorPage = new ErrorPage(); 17 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 18 | $errorPage->SetMSG(ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 19 | $errorPage->print_die(); 20 | } 21 | } 22 | 23 | require_once __DIR__ . "/include/header.footer.class.php"; 24 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 25 | require_once __DIR__ . "/../include/TGDB.API.php"; 26 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 27 | 28 | $API = TGDB::getInstance(); 29 | $devs_list = $API->GetDevsList(); 30 | $pubs_list = $API->GetPubsList(); 31 | 32 | $Header = new HEADER(); 33 | $Header->setTitle("TGDB - Add Dev/Pub"); 34 | $Header->appendRawHeader(function() { global $_user, $devs_list, $pubs_list; ?> 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 112 | 113 | print(); ?> 114 | 115 |
116 |
117 |

Developer

118 | 122 |

123 |
124 |
125 |
126 |
127 |

Publisher

128 | 129 | 133 |

134 |
135 |
136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /website/actions/merge_dev_pub.php: -------------------------------------------------------------------------------- 1 | $code, "msg" => $msg)); 8 | die(); 9 | } 10 | 11 | $_user = phpBBuser::getInstance(); 12 | if(!$_user->isLoggedIn()) 13 | { 14 | returnJSONAndDie(-1, ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 15 | } 16 | else 17 | { 18 | if(!$_user->hasPermission('m_delete_games')) 19 | { 20 | returnJSONAndDie(-1, ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 21 | } 22 | } 23 | 24 | if( 25 | !isset($_REQUEST['keep']) || !is_numeric($_REQUEST['keep']) || 26 | !isset($_REQUEST['remove']) || !is_numeric($_REQUEST['remove']) 27 | ) 28 | { 29 | returnJSONAndDie(-1, ErrorPage::$MSG_MISSING_PARAM_ERROR); 30 | } 31 | 32 | if($_REQUEST['remove'] == $_REQUEST['keep']) 33 | { 34 | returnJSONAndDie(-1, "Invalid Selection"); 35 | } 36 | 37 | require_once __DIR__ . "/../../include/db.config.php"; 38 | require_once __DIR__ . "/../../include/TGDB.API.php"; 39 | 40 | $database = database::getInstance(); 41 | $API = TGDB::getInstance(); 42 | 43 | $dbh = $database->dbh; 44 | 45 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 46 | $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); 47 | 48 | 49 | $old_id = $_REQUEST['remove']; 50 | $new_id = $_REQUEST['keep']; 51 | $is_pub = $_REQUEST['tbl'] == 'publishers'; 52 | 53 | if($is_pub) 54 | { 55 | $games_tbl = "games_pubs"; 56 | $list_tbl = "pubs_list"; 57 | $field = "pub_id"; 58 | $edit_name = "publishers"; 59 | if(count($API->GetPubsListByIDs([$old_id, $new_id])) != 2) 60 | { 61 | returnJSONAndDie(-2, "1 or both $edit_name can't be found."); 62 | } 63 | } 64 | else 65 | { 66 | $games_tbl = "games_devs"; 67 | $list_tbl = "devs_list"; 68 | $field = "dev_id"; 69 | $edit_name = "developers"; 70 | if(count($API->GetDevsListByIDs([$old_id, $new_id])) != 2) 71 | { 72 | returnJSONAndDie(-2, "1 or both $edit_name can't be found."); 73 | } 74 | } 75 | 76 | try 77 | { 78 | // 1) find all games with pub/dev id 79 | $sth = $dbh->prepare("SELECT games_id from $games_tbl where $field = :$field;"); 80 | $sth->bindValue(":$field", $old_id); 81 | if($sth->execute()) 82 | { 83 | $Games = $sth->fetchAll(PDO::FETCH_OBJ); 84 | } 85 | if(empty($Games)) 86 | { 87 | returnJSONAndDie(-3, "Error No Games found under $edit_name"); 88 | } 89 | 90 | $dbh->beginTransaction(); 91 | // 2) delete games dev/pub 92 | $sth = $dbh->prepare("DELETE FROM $games_tbl where $field = :$field;"); 93 | $sth->bindValue(":$field", $old_id); 94 | $sth->execute(); 95 | 96 | // 3) delete pub/dev listing 97 | $sth = $dbh->prepare("DELETE FROM $list_tbl where id = :$field;"); 98 | $sth->bindValue(":$field", $old_id); 99 | $sth->execute(); 100 | 101 | // 4) updating all games listing 102 | $insert_values = ''; 103 | foreach($Games as $Game) 104 | { 105 | if(!empty($insert_values)) 106 | { 107 | $insert_values .= ","; 108 | } 109 | 110 | $insert_values .= "(" . $Game->games_id . ", $new_id) "; 111 | } 112 | 113 | $sth = $dbh->prepare("INSERT INTO $games_tbl (games_id, $field) values $insert_values;"); 114 | $sth->execute(); 115 | 116 | if(!$dbh->commit()) 117 | { 118 | $dbh->rollBack(); 119 | echo "fail!!!"; 120 | echo "INSERT INTO $games_tbl (games_id, $field) values $insert_values;"; 121 | die(); 122 | } 123 | } 124 | catch(Exception $e) 125 | { 126 | $dbh->rollBack(); 127 | echo 'Message: ' .$e->getMessage(); 128 | echo "INSERT INTO $games_tbl (games_id, $field) values $insert_values;"; 129 | die(); 130 | } 131 | 132 | foreach($Games as $Game) 133 | { 134 | $ids[] = $Game->games_id; 135 | } 136 | 137 | if($is_pub) 138 | { 139 | $ids = $API->GetGamesPubs($ids); 140 | } 141 | else 142 | { 143 | $ids = $API->GetGamesDevs($ids); 144 | } 145 | 146 | ob_start(); 147 | foreach($Games as $Game) 148 | { 149 | $valid_ids = []; 150 | if(isset($ids[$Game->games_id])) 151 | { 152 | foreach($ids[$Game->games_id] as $subval) 153 | { 154 | $valid_ids[] = $subval; 155 | } 156 | if($API->InsertUserEdits(48, $Game->games_id, $edit_name, json_encode($valid_ids, JSON_NUMERIC_CHECK))) 157 | { 158 | echo "game_id: $Game->games_id\n"; 159 | print_r($valid_ids); 160 | echo "Phase 2 success!!!\n"; 161 | } 162 | } 163 | } 164 | $output = ob_get_clean(); 165 | returnJSONAndDie(0, $output); 166 | 167 | -------------------------------------------------------------------------------- /API/include/APIAccessDB.class.php: -------------------------------------------------------------------------------- 1 | database = database::getInstance(); 13 | } 14 | 15 | public static function getInstance() 16 | { 17 | static $instance = null; 18 | if (!isset($instance)) 19 | { 20 | $object = __CLASS__; 21 | $instance = new $object; 22 | } 23 | return $instance; 24 | } 25 | 26 | function GetUserAllowanceByAPIKey($key) 27 | { 28 | 29 | $dbh = $this->database->dbh; 30 | $sth = $dbh->prepare("Select APIU.*, AA.monthly_allowance, sum(AMC.count) as count FROM apiusers APIU 31 | LEFT JOIN api_allowance_level AA ON AA.id = APIU.api_allowance_level_id 32 | LEFT JOIN api_month_counter AMC ON AMC.IP = INET6_ATON(:IP) AND AMC.apiusers_id = APIU.id AND AMC.date >= APIU.last_refresh_date AND AMC.is_extra = 0 33 | WHERE apikey=:apikey GROUP BY APIU.id;"); 34 | $sth->bindValue(':apikey', $key, PDO::PARAM_STR); 35 | $sth->bindValue(':IP', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR); 36 | 37 | if($sth->execute()) 38 | { 39 | $res = $sth->fetch(PDO::FETCH_OBJ | PDO::FETCH_GROUP); 40 | return $res; 41 | } 42 | } 43 | 44 | function countAPIRequest($User, $update_refresh_date, $is_extra) 45 | { 46 | $dbh = $this->database->dbh; 47 | try 48 | { 49 | $dbh->beginTransaction(); 50 | if($update_refresh_date) 51 | { 52 | $sth = $dbh->prepare("UPDATE apiusers SET last_refresh_date=:date WHERE id=:id;"); 53 | $sth->bindValue(':date', date('Y-m-d')); 54 | $sth->bindValue(':id', $User->id, PDO::PARAM_INT); 55 | $sth->execute(); 56 | } 57 | if($is_extra) 58 | { 59 | $sth = $dbh->prepare("UPDATE apiusers SET extra_allowance = extra_allowance - 1 WHERE id=:id;"); 60 | $sth->bindValue(':id', $User->id, PDO::PARAM_INT); 61 | $sth->execute(); 62 | } 63 | $sth = $dbh->prepare("INSERT INTO api_month_counter (apiusers_id, count, is_extra, date, IP) 64 | VALUES (:id, 1, :is_extra, :date, INET6_ATON(:IP)) ON DUPLICATE KEY UPDATE count = count + 1;"); 65 | $sth->bindValue(':date', date('Y-m-d')); 66 | $sth->bindValue(':id', $User->id, PDO::PARAM_INT); 67 | $sth->bindValue(':is_extra', $is_extra, PDO::PARAM_INT); 68 | $sth->bindValue(':IP', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR); 69 | $sth->execute(); 70 | $dbh->commit(); 71 | } 72 | catch (Exception $e) 73 | { 74 | $dbh->commit(); 75 | //Free lunch :P 76 | } 77 | } 78 | 79 | function RequestPublicAPIKey($user_id) 80 | { 81 | $dbh = $this->database->dbh; 82 | 83 | $sth = $dbh->prepare("Select apikey, is_banned FROM apiusers where userid = :user_id AND is_private_key = 0 LIMIT 1;"); 84 | $sth->bindValue(':user_id', $user_id, PDO::PARAM_INT); 85 | 86 | if($sth->execute()) 87 | { 88 | $res = $sth->fetch(PDO::FETCH_OBJ); 89 | if(!empty($res)) 90 | { 91 | if($res->is_banned == 0) 92 | { 93 | return $res->apikey; 94 | } 95 | else 96 | { 97 | return "Access Denied"; 98 | } 99 | } 100 | else 101 | { 102 | $bytes = openssl_random_pseudo_bytes(64/2); 103 | $key = bin2hex($bytes); 104 | $sth = $dbh->prepare("INSERT INTO apiusers (userid, apikey, api_allowance_level_id, extra_allowance, is_private_key) 105 | VALUES(:user_id, :apikey, 1, 0, 0);"); 106 | $sth->bindValue(':user_id', $user_id, PDO::PARAM_INT); 107 | $sth->bindValue(':apikey', $key, PDO::PARAM_INT); 108 | 109 | if($sth->execute()) 110 | { 111 | return $key; 112 | } 113 | else 114 | { 115 | return "Failed to generate API Key."; 116 | } 117 | } 118 | } 119 | } 120 | 121 | function RequestPrivateAPIKey($user_id) 122 | { 123 | $dbh = $this->database->dbh; 124 | 125 | $sth = $dbh->prepare("Select apikey, extra_allowance, is_banned FROM apiusers where userid = :user_id AND is_private_key != 0 LIMIT 1;"); 126 | $sth->bindValue(':user_id', $user_id, PDO::PARAM_INT); 127 | 128 | if($sth->execute()) 129 | { 130 | $res = $sth->fetch(PDO::FETCH_OBJ); 131 | if(!empty($res)) 132 | { 133 | if($res->is_banned == 0) 134 | { 135 | return $res; 136 | } 137 | else 138 | { 139 | return "Access Denied"; 140 | } 141 | } 142 | else 143 | { 144 | $bytes = openssl_random_pseudo_bytes(64/2); 145 | $key = bin2hex($bytes); 146 | $sth = $dbh->prepare("INSERT INTO apiusers (userid, apikey, api_allowance_level_id, extra_allowance, is_private_key) 147 | VALUES(:user_id, :apikey, 0, 6000, 1);"); 148 | $sth->bindValue(':user_id', $user_id, PDO::PARAM_INT); 149 | $sth->bindValue(':apikey', $key, PDO::PARAM_INT); 150 | 151 | if($sth->execute()) 152 | { 153 | return $this->RequestPrivateAPIKey($user_id); 154 | } 155 | else 156 | { 157 | return "Failed to generate API Key."; 158 | } 159 | } 160 | } 161 | } 162 | } 163 | 164 | ?> 165 | -------------------------------------------------------------------------------- /website/index.php: -------------------------------------------------------------------------------- 1 | GetGamesByDate(date("d/m/Y"), 0, 5, array('AFTER' => true), "release_date", 'ASC'); 10 | $recent = $API->GetGamesByDate(date("d/m/Y"), 0, 6, array('BEFORE' => true), "release_date", 'DESC'); 11 | foreach($soon as $Game) 12 | { 13 | $PlatformIDs[] = $Game->platform; 14 | } 15 | foreach($recent as $Game) 16 | { 17 | $IDs[] = $Game->id; 18 | $PlatformIDs[] = $Game->platform; 19 | } 20 | 21 | $API = TGDB::getInstance(); 22 | $limit = 18; 23 | $page = 1; 24 | $offset = ($page - 1) * $limit; 25 | $lastupdated = $API->GetAllGames($offset, $limit + 1, array('overview' => true), "id", 'DESC'); 26 | if($has_next_page = count($lastupdated) > $limit) 27 | { 28 | unset($lastupdated[$limit]); 29 | } 30 | 31 | foreach($lastupdated as $Game) 32 | { 33 | $IDs[] = $Game->id; 34 | $PlatformIDs[] = $Game->platform; 35 | } 36 | $Platforms = $API->GetPlatforms($PlatformIDs); 37 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 38 | foreach($recent as $Game) 39 | { 40 | if(isset($covers[$Game->id])) 41 | { 42 | $Game->boxart = $covers[$Game->id]; 43 | } 44 | } 45 | foreach($lastupdated as $Game) 46 | { 47 | if(isset($covers[$Game->id])) 48 | { 49 | $Game->boxart = $covers[$Game->id]; 50 | } 51 | } 52 | $Game = null; 53 | 54 | $Header = new HEADER(); 55 | $Header->setTitle("TGDB - Homepage"); 56 | $Header->appendRawHeader(function() { ?> 57 | 58 | 59 | 60 | 61 | 62 | print(); ?> 63 | 64 |
65 | 66 |
67 |
68 | 69 |
70 | 71 | 77 |
78 | 79 |
80 | 81 |
82 |
83 |
84 | 85 |
86 | 87 |
88 |

Recently Added


89 | 90 |
91 |
92 | 93 | <?= $game->gamr_title?> 94 | 95 |
96 |
97 |

game_title ?>

98 |
Platform: platform]->name ?>
99 |

100 | overview) ? WebUtils::truncate($game->overview, 200) : "No overview is currently available for this title, please feel free to add one."; ?>... Read More

101 |
102 |
103 |
104 | 105 |
106 | 107 |
108 | 109 |
110 |
111 |
Releasing Soon
112 |
113 | 114 | 115 | 116 | 117 | 124 | 125 | 126 | 127 |
118 | 119 | game_title ?> 120 |
121 | platform]->name ?> 122 |
123 |
128 |
129 |
130 | 131 | 132 |
133 | 134 |
135 | 136 |
137 | 138 | 139 | -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/fine-uploader-new.min.css: -------------------------------------------------------------------------------- 1 | .qq-btn{box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 1px 0 rgba(0,0,0,.36),0 -2px 12px rgba(0,0,0,.08) inset;padding:3px 4px;border:1px solid #ccc;border-radius:2px;color:inherit;background-color:#fff}.qq-upload-continue,.qq-upload-delete,.qq-upload-pause{display:inline}.qq-upload-delete{background-color:#e65c47;color:#fafafa;border-color:#dc523d;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-delete:hover{background-color:#f56b56}.qq-upload-cancel{background-color:#f5d7d7;border-color:#e6c8c8}.qq-upload-cancel:hover{background-color:#ffe1e1}.qq-upload-retry{background-color:#ebf6e0;border-color:#d2ddc7}.qq-upload-retry:hover{background-color:#f7ffec}.qq-upload-continue,.qq-upload-pause{background-color:#00abc7;color:#fafafa;border-color:#2dadc2;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-continue:hover,.qq-upload-pause:hover{background-color:#0fbad6}.qq-upload-button{display:inline;width:105px;margin-bottom:10px;padding:7px 10px;text-align:center;float:left;background:#00abc7;color:#fff;border-radius:2px;border:1px solid #2dadc2;box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 1px 0 rgba(0,0,0,.36),0 -2px 12px rgba(0,0,0,.08) inset}.qq-upload-button-hover{background:#33b6cc}.qq-upload-button-focus{outline:1px dotted #000}.qq-uploader{position:relative;min-height:200px;max-height:490px;overflow-y:hidden;width:inherit;border-radius:6px;background-color:#fdfdfd;border:1px dashed #ccc;padding:20px}.qq-uploader:before{content:attr(qq-drop-area-text) " ";position:absolute;font-size:200%;left:0;width:100%;text-align:center;top:45%;opacity:.25}.qq-upload-drop-area,.qq-upload-extra-drop-area{position:absolute;top:0;left:0;width:100%;height:100%;min-height:30px;z-index:2;background:#f9f9f9;border-radius:4px;border:1px dashed #ccc;text-align:center}.qq-upload-drop-area span{display:block;position:absolute;top:50%;width:100%;margin-top:-8px;font-size:16px}.qq-upload-extra-drop-area{position:relative;margin-top:50px;font-size:16px;padding-top:30px;height:20px;min-height:40px}.qq-upload-drop-area-active{background:#fdfdfd;border-radius:4px;border:1px dashed #ccc}.qq-upload-list{margin:0;padding:0;list-style:none;max-height:450px;overflow-y:auto;box-shadow:0 1px 0 rgba(15,15,50,.14);clear:both}.qq-upload-list li{margin:0;padding:9px;line-height:15px;font-size:16px;color:#424242;background-color:#f6f6f6;border-top:1px solid #fff;border-bottom:1px solid #ddd}.qq-upload-list li:first-child{border-top:none}.qq-upload-list li:last-child{border-bottom:none}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-failed-text,.qq-upload-file,.qq-upload-pause,.qq-upload-retry,.qq-upload-size,.qq-upload-spinner{margin-right:12px;display:inline}.qq-upload-file{vertical-align:middle;display:inline-block;width:300px;text-overflow:ellipsis;white-space:nowrap;overflow-x:hidden;height:18px}.qq-upload-spinner{display:inline-block;background:url(loading.gif);width:15px;height:15px;vertical-align:text-bottom}.qq-drop-processing{display:block}.qq-drop-processing-spinner{display:inline-block;background:url(processing.gif);width:24px;height:24px;vertical-align:text-bottom}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-pause,.qq-upload-retry,.qq-upload-size{font-size:12px;font-weight:400;cursor:pointer;vertical-align:middle}.qq-upload-status-text{font-size:14px;font-weight:700;display:block}.qq-upload-failed-text{display:none;font-style:italic;font-weight:700}.qq-upload-failed-icon{display:none;width:15px;height:15px;vertical-align:text-bottom}.qq-upload-fail .qq-upload-failed-text{display:inline}.qq-upload-retrying .qq-upload-failed-text{display:inline}.qq-upload-list li.qq-upload-success{background-color:#ebf6e0;color:#424242;border-bottom:1px solid #d3ded1;border-top:1px solid #f7fff5}.qq-upload-list li.qq-upload-fail{background-color:#f5d7d7;color:#424242;border-bottom:1px solid #decaca;border-top:1px solid #fce6e6}.qq-progress-bar{display:block;display:block;background:#00abc7;width:0;height:15px;border-radius:6px;margin-bottom:3px}.qq-total-progress-bar{height:25px;border-radius:9px}.qq-total-progress-bar-container{margin-left:9px;display:inline;float:right;width:500px}INPUT.qq-edit-filename{position:absolute;opacity:0;z-index:-1}.qq-upload-file.qq-editable{cursor:pointer;margin-right:4px}.qq-edit-filename-icon.qq-editable{display:inline-block;cursor:pointer}INPUT.qq-edit-filename.qq-editing{position:static;height:28px;padding:0 8px;margin-right:10px;margin-bottom:-5px;border:1px solid #ccc;border-radius:2px;font-size:16px;opacity:1}.qq-edit-filename-icon{display:none;background:url(edit.gif);width:15px;height:15px;vertical-align:text-bottom;margin-right:16px}.qq-hide{display:none}.qq-thumbnail-selector{vertical-align:middle;margin-right:12px}.qq-uploader DIALOG{display:none}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG{display:none}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG .qq-dialog-buttons{text-align:center;padding-top:10px}.qq-uploader DIALOG .qq-dialog-buttons BUTTON{margin-left:5px;margin-right:5px}.qq-uploader DIALOG .qq-dialog-message-selector{padding-bottom:10px}.qq-uploader DIALOG::backdrop{background-color:rgba(0,0,0,.7)}/*# sourceMappingURL=fine-uploader-new.min.css.map */ -------------------------------------------------------------------------------- /website/missing.php: -------------------------------------------------------------------------------- 1 | SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 7 | $errorPage->SetMSG(ErrorPage::$MSG_MISSING_PARAM_ERROR); 8 | $errorPage->print_die(); 9 | } 10 | require_once __DIR__ . "/include/header.footer.class.php"; 11 | require_once __DIR__ . "/include/PaginationUtils.class.php"; 12 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 13 | require_once __DIR__ . "/include/WebUtils.class.php"; 14 | require_once __DIR__ . "/../include/TGDB.API.php"; 15 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 16 | 17 | $API = TGDB::getInstance(); 18 | $PlatformList = $API->GetPlatformsList(); 19 | if(isset($_GET['platform_id']) && !empty($_GET['platform_id']) && !in_array(0, $_GET['platform_id'])) 20 | { 21 | $platformIDs = $_GET['platform_id']; 22 | foreach($_GET['platform_id'] as $platform_id) 23 | { 24 | $platformIDs[$platform_id] = true; 25 | } 26 | } 27 | 28 | $limit = 18; 29 | $page = PaginationUtils::getPage(); 30 | $offset = ($page - 1) * $limit; 31 | if(isset($_REQUEST['type'])) 32 | { 33 | if(!isset($_REQUEST['platform_id']) || !is_array($_REQUEST['platform_id']) || in_array(0, $_REQUEST['platform_id'])) 34 | { 35 | $platform_id = 0; 36 | } 37 | else 38 | { 39 | $platform_id = $_REQUEST['platform_id']; 40 | } 41 | if($_REQUEST['type'] == 'overview') 42 | { 43 | $list = $API->GetMissingGames($_REQUEST['type'], $platform_id, $offset, $limit+1, ['platform'], "game_title"); 44 | } 45 | else 46 | { 47 | $sub_type = ''; 48 | if(isset($_REQUEST['sub_type'])) 49 | { 50 | $sub_type = $_REQUEST['sub_type']; 51 | } 52 | $list = $API->GetMissingGamesImages($_REQUEST['type'], $sub_type, $platform_id, $offset, $limit+1, ['platform'], "game_title"); 53 | } 54 | $Platforms = $API->GetPlatforms($PlatformIDs); 55 | 56 | } 57 | else 58 | { 59 | $errorPage = new ErrorPage(); 60 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 61 | $errorPage->SetMSG(ErrorPage::$MSG_INVALID_PARAM_ERROR); 62 | $errorPage->print_die(); 63 | } 64 | 65 | 66 | 67 | if($has_next_page = count($list) > $limit) 68 | { 69 | unset($list[$limit]); 70 | } 71 | foreach($list as $Game) 72 | { 73 | $IDs[] = $Game->id; 74 | $PlatformIDs[] = $Game->platform; 75 | } 76 | if(isset($IDs) && !empty($IDs)) 77 | { 78 | $Platforms = $API->GetPlatforms($PlatformIDs); 79 | $covers = $API->GetGameBoxartByID($IDs, 0, 40); 80 | foreach($list as $Game) 81 | { 82 | if(isset($covers[$Game->id])) 83 | { 84 | $Game->boxart = $covers[$Game->id]; 85 | } 86 | } 87 | } 88 | $Header = new HEADER(); 89 | $Header->setTitle("TGDB - Browser - Game By $listed_by"); 90 | ?> 91 | print(); ?> 92 | 93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 | Filter by platform 101 |
102 | 103 | 109 |
110 | 111 | 112 | 113 | 114 | 115 |
116 |
117 |
118 | 119 |
120 |
121 | 122 |
123 | 124 | 140 | 141 |
142 |
143 |
144 |

No associated games.

145 |
146 |
147 |
148 | 149 |
150 | 151 |
152 | 153 | 154 | -------------------------------------------------------------------------------- /website/my_games_by_platform.php: -------------------------------------------------------------------------------- 1 | isLoggedIn()) 14 | { 15 | $errorPage = new ErrorPage(); 16 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 17 | $errorPage->SetMSG(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 18 | $errorPage->print_die(); 19 | } 20 | 21 | function subarray_item_count($array) 22 | { 23 | $count = 0; 24 | foreach($array as $sub_array) 25 | { 26 | $count += count($sub_array); 27 | } 28 | 29 | return $count; 30 | } 31 | 32 | $API = TGDB::getInstance(); 33 | $listed_by = "My Games"; 34 | $page = PaginationUtils::getPage(); 35 | $limit = 18; 36 | $offset = ($page - 1) * $limit; 37 | if(isset($_REQUEST['platform_id']) && is_numeric($_REQUEST['platform_id'])) 38 | { 39 | $list = $API->GetUserBookmarkedGamesByPlatformID($_user->GetUserID(), $_REQUEST['platform_id'], $offset, $limit + 1); 40 | $Platform_IDs = $API->GetUserBookmarkedGamesPlatforms($_user->GetUserID()); 41 | 42 | if($has_next_page = subarray_item_count($list) > $limit) 43 | { 44 | unset($list[$_REQUEST['platform_id']][$limit]); 45 | } 46 | } 47 | else 48 | { 49 | $errorPage = new ErrorPage(); 50 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 51 | $errorPage->SetMSG(ErrorPage::$MSG_MISSING_PARAM_ERROR); 52 | $errorPage->print_die(); 53 | } 54 | 55 | 56 | foreach($list as $platform_id => $per_platform_list) 57 | { 58 | foreach($per_platform_list as $Game) 59 | { 60 | $IDs[] = $Game->id; 61 | } 62 | $Platform_IDs[] = $platform_id; 63 | } 64 | if(isset($IDs) && !empty($IDs)) 65 | { 66 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 67 | foreach($list as $per_platform_list) 68 | { 69 | foreach($per_platform_list as $Game) 70 | { 71 | if(isset($covers[$Game->id])) 72 | { 73 | $Game->boxart = $covers[$Game->id]; 74 | } 75 | } 76 | } 77 | } 78 | if(isset($Platform_IDs) && !empty($Platform_IDs)) 79 | { 80 | $platforms = $API->GetPlatforms(array_unique($Platform_IDs), ['name']); 81 | } 82 | if(isset($platforms) && count($platforms) > 1) 83 | { 84 | $icons = $API->GetPlatformBoxartByID($Platform_IDs, 0, 99999, ['icon']); 85 | foreach($platforms as &$platform) 86 | { 87 | if(isset($icons[$platform->id])) 88 | { 89 | $platform->boxart = &$icons[$platform->id]; 90 | } 91 | } 92 | unset($platform); 93 | } 94 | $Header = new HEADER(); 95 | $Header->setTitle("TGDB - Browser - Game By $listed_by"); 96 | ?> 97 | print(); ?> 98 | 99 |
100 | 1) : ?> 101 |
102 |
103 |
104 |
105 |
106 | Platforms 107 | 119 |
120 |
121 |
122 |
123 |
124 | 125 |
126 | $per_platform_list) : ?> 127 |
128 |
129 |

130 | name ?> 131 | 6) : ?> 132 | More 133 | 134 |

135 |
136 |
137 | 138 | 153 | 154 | 155 |
156 |
157 |
158 |

No associated games.

159 |
160 |
161 |
162 | 163 |
164 | 165 |
166 | 167 | -------------------------------------------------------------------------------- /website/list_games.php: -------------------------------------------------------------------------------- 1 | SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 13 | $errorPage->SetMSG(ErrorPage::$MSG_MISSING_PARAM_ERROR); 14 | $errorPage->print_die(); 15 | } 16 | require_once __DIR__ . "/include/header.footer.class.php"; 17 | require_once __DIR__ . "/include/PaginationUtils.class.php"; 18 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 19 | require_once __DIR__ . "/include/WebUtils.class.php"; 20 | require_once __DIR__ . "/../include/TGDB.API.php"; 21 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 22 | 23 | $API = TGDB::getInstance(); 24 | 25 | $limit = 18; 26 | $page = PaginationUtils::getPage(); 27 | $offset = ($page - 1) * $limit; 28 | if(isset($_REQUEST['dev_id']) && is_numeric($_REQUEST['dev_id'])) 29 | { 30 | $listed_by = "Developer"; 31 | $list = $API->GetGamesByDevID($_REQUEST['dev_id'], $offset, $limit+1, array(), "game_title"); 32 | $DevInfo = $API->GetDevsListByIDs($_REQUEST['dev_id']); 33 | if(!empty($DevInfo)) 34 | { 35 | $DevInfo = $DevInfo[$_REQUEST['dev_id']]; 36 | } 37 | else 38 | { 39 | $errorPage = new ErrorPage(); 40 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 41 | $errorPage->SetMSG(ErrorPage::$MSG_INVALID_PARAM_ERROR); 42 | $errorPage->print_die(); 43 | } 44 | } 45 | else if(isset($_REQUEST['pub_id']) && is_numeric($_REQUEST['pub_id'])) 46 | { 47 | $listed_by = "Publisher"; 48 | $list = $API->GetGamesByPubID($_REQUEST['pub_id'], $offset, $limit+1, array(), "game_title"); 49 | $DevInfo = $API->GetPubsListByIDs($_REQUEST['pub_id']); 50 | if(!empty($DevInfo)) 51 | { 52 | $DevInfo = $DevInfo[$_REQUEST['pub_id']]; 53 | } 54 | else 55 | { 56 | $errorPage = new ErrorPage(); 57 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 58 | $errorPage->SetMSG(ErrorPage::$MSG_INVALID_PARAM_ERROR); 59 | $errorPage->print_die(); 60 | } 61 | } 62 | else if(isset($_REQUEST['platform_id']) && is_numeric($_REQUEST['platform_id'])) 63 | { 64 | $listed_by = "Platform"; 65 | $Platform = $API->GetPlatforms($_REQUEST['platform_id'], array("icon" => true, "overview" => true, "developer" => true)); 66 | if(isset($Platform[$_REQUEST['platform_id']])) 67 | { 68 | $Platform = $Platform[$_REQUEST['platform_id']]; 69 | } 70 | else 71 | { 72 | $errorPage = new ErrorPage(); 73 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 74 | $errorPage->SetMSG(ErrorPage::$MSG_INVALID_PARAM_ERROR); 75 | $errorPage->print_die(); 76 | } 77 | $list = $API->GetGameListByPlatform($_REQUEST['platform_id'], $offset, $limit+1, array(), "game_title"); 78 | } 79 | else 80 | { 81 | $errorPage = new ErrorPage(); 82 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 83 | $errorPage->SetMSG(ErrorPage::$MSG_INVALID_PARAM_ERROR . " (2)"); 84 | $errorPage->print_die(); 85 | } 86 | 87 | 88 | 89 | if($has_next_page = count($list) > $limit) 90 | { 91 | unset($list[$limit]); 92 | } 93 | foreach($list as $Game) 94 | { 95 | $IDs[] = $Game->id; 96 | $PlatformIDs[] = $Game->platform; 97 | } 98 | if(isset($IDs) && !empty($IDs)) 99 | { 100 | $covers = $API->GetGameBoxartByID($IDs, 0, 40); 101 | foreach($list as $Game) 102 | { 103 | if(isset($covers[$Game->id])) 104 | { 105 | $Game->boxart = $covers[$Game->id]; 106 | } 107 | } 108 | } 109 | 110 | $Platforms = $API->GetPlatforms($PlatformIDs); 111 | 112 | $Header = new HEADER(); 113 | $Header->setTitle("TGDB - Browser - Game By $listed_by"); 114 | ?> 115 | print(); ?> 116 | 117 |
118 | 119 |
120 |
121 |
122 |
123 |
124 | name ?> 125 |
126 |
127 |
128 |

Developer: developer ?>

129 |

overview, 200, true) ?> Read More

130 |
131 |
132 |
133 |
134 | 135 |
136 |
137 |
138 |
139 |
140 | name ?> 141 |
142 |
143 |
144 | s overview have not been added yet. 145 |
146 |
147 |
148 |
149 | 150 | 151 |
152 | 153 | 169 | 170 |
171 |
172 |
173 |

No associated games.

174 |
175 |
176 |
177 | 178 |
179 | 180 |
181 | 182 | -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/fine-uploader.css: -------------------------------------------------------------------------------- 1 | .qq-uploader { 2 | position: relative; 3 | width: 100%; 4 | } 5 | .qq-upload-button { 6 | display: block; 7 | width: 105px; 8 | padding: 7px 0; 9 | text-align: center; 10 | background: #880000; 11 | border-bottom: 1px solid #DDD; 12 | color: #FFF; 13 | } 14 | .qq-upload-button-hover { 15 | background: #CC0000; 16 | } 17 | .qq-upload-button-focus { 18 | outline: 1px dotted #000000; 19 | } 20 | .qq-upload-drop-area, .qq-upload-extra-drop-area { 21 | position: absolute; 22 | top: 0; 23 | left: 0; 24 | width: 100%; 25 | height: 100%; 26 | min-height: 30px; 27 | z-index: 2; 28 | background: #FF9797; 29 | text-align: center; 30 | } 31 | .qq-upload-drop-area span { 32 | display: block; 33 | position: absolute; 34 | top: 50%; 35 | width: 100%; 36 | margin-top: -8px; 37 | font-size: 16px; 38 | } 39 | .qq-upload-extra-drop-area { 40 | position: relative; 41 | margin-top: 50px; 42 | font-size: 16px; 43 | padding-top: 30px; 44 | height: 20px; 45 | min-height: 40px; 46 | } 47 | .qq-upload-drop-area-active { 48 | background: #FF7171; 49 | } 50 | .qq-upload-list { 51 | margin: 0; 52 | padding: 0; 53 | list-style: none; 54 | } 55 | .qq-upload-list li { 56 | margin: 0; 57 | padding: 9px; 58 | line-height: 15px; 59 | font-size: 16px; 60 | background-color: #FFF0BD; 61 | } 62 | .qq-upload-file, .qq-upload-spinner, .qq-upload-size, 63 | .qq-upload-cancel, .qq-upload-retry, .qq-upload-failed-text, 64 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 65 | margin-right: 12px; 66 | display: inline; 67 | } 68 | .qq-upload-file { 69 | } 70 | .qq-upload-spinner { 71 | display: inline-block; 72 | background: url("loading.gif"); 73 | width: 15px; 74 | height: 15px; 75 | vertical-align: text-bottom; 76 | } 77 | .qq-drop-processing { 78 | display: block; 79 | } 80 | .qq-drop-processing-spinner { 81 | display: inline-block; 82 | background: url("processing.gif"); 83 | width: 24px; 84 | height: 24px; 85 | vertical-align: text-bottom; 86 | } 87 | 88 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 89 | display: inline; 90 | } 91 | 92 | .qq-upload-retry, .qq-upload-delete, .qq-upload-cancel, 93 | .qq-upload-pause, .qq-upload-continue { 94 | color: #000000; 95 | } 96 | 97 | .qq-upload-size, .qq-upload-cancel, .qq-upload-retry, 98 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 99 | font-size: 12px; 100 | font-weight: normal; 101 | } 102 | .qq-upload-failed-text { 103 | display: none; 104 | font-style: italic; 105 | font-weight: bold; 106 | } 107 | .qq-upload-failed-icon { 108 | display:none; 109 | width:15px; 110 | height:15px; 111 | vertical-align:text-bottom; 112 | } 113 | .qq-upload-fail .qq-upload-failed-text { 114 | display: inline; 115 | } 116 | .qq-upload-retrying .qq-upload-failed-text { 117 | display: inline; 118 | color: #D60000; 119 | } 120 | .qq-upload-list li.qq-upload-success { 121 | background-color: #5DA30C; 122 | color: #FFFFFF; 123 | } 124 | .qq-upload-list li.qq-upload-fail { 125 | background-color: #D60000; 126 | color: #FFFFFF; 127 | } 128 | .qq-progress-bar { 129 | display: block; 130 | background: -moz-linear-gradient(top, rgba(30,87,153,1) 0%, rgba(41,137,216,1) 50%, rgba(32,124,202,1) 51%, rgba(125,185,232,1) 100%); /* FF3.6+ */ 131 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(50%,rgba(41,137,216,1)), color-stop(51%,rgba(32,124,202,1)), color-stop(100%,rgba(125,185,232,1))); /* Chrome,Safari4+ */ 132 | background: -webkit-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* Chrome10+,Safari5.1+ */ 133 | background: -o-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* Opera 11.10+ */ 134 | background: -ms-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* IE10+ */ 135 | background: linear-gradient(to bottom, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* W3C */ 136 | width: 0%; 137 | height: 15px; 138 | border-radius: 6px; 139 | margin-bottom: 3px; 140 | } 141 | 142 | .qq-total-progress-bar { 143 | height: 25px; 144 | border-radius: 9px; 145 | } 146 | 147 | .qq-total-progress-bar-container { 148 | margin: 9px; 149 | } 150 | 151 | INPUT.qq-edit-filename { 152 | position: absolute; 153 | opacity: 0; 154 | filter: alpha(opacity=0); 155 | z-index: -1; 156 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; 157 | } 158 | 159 | .qq-upload-file.qq-editable { 160 | cursor: pointer; 161 | } 162 | 163 | .qq-edit-filename-icon.qq-editable { 164 | display: inline-block; 165 | cursor: pointer; 166 | } 167 | 168 | INPUT.qq-edit-filename.qq-editing { 169 | position: static; 170 | margin-top: -5px; 171 | margin-right: 10px; 172 | margin-bottom: -5px; 173 | 174 | opacity: 1; 175 | filter: alpha(opacity=100); 176 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 177 | } 178 | 179 | .qq-edit-filename-icon { 180 | display: none; 181 | background: url("edit.gif"); 182 | width: 15px; 183 | height: 15px; 184 | vertical-align: text-bottom; 185 | margin-right: 5px; 186 | } 187 | 188 | .qq-hide { 189 | display: none; 190 | } 191 | 192 | /* element styles */ 193 | .qq-uploader DIALOG { 194 | display: none; 195 | } 196 | 197 | .qq-uploader DIALOG[open] { 198 | display: block; 199 | } 200 | 201 | .qq-uploader DIALOG { 202 | display: none; 203 | } 204 | 205 | .qq-uploader DIALOG[open] { 206 | display: block; 207 | } 208 | 209 | .qq-uploader DIALOG .qq-dialog-buttons { 210 | text-align: center; 211 | padding-top: 10px; 212 | } 213 | 214 | .qq-uploader DIALOG .qq-dialog-buttons BUTTON { 215 | margin-left: 5px; 216 | margin-right: 5px; 217 | } 218 | 219 | .qq-uploader DIALOG .qq-dialog-message-selector { 220 | padding-bottom: 10px; 221 | } 222 | 223 | .qq-uploader DIALOG::backdrop { 224 | background-color: rgba(0, 0, 0, 0.7); 225 | } -------------------------------------------------------------------------------- /website/merge_dev_pub.php: -------------------------------------------------------------------------------- 1 | isLoggedIn()) 6 | { 7 | $errorPage = new ErrorPage(); 8 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 9 | $errorPage->SetMSG(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 10 | $errorPage->print_die(); 11 | } 12 | else 13 | { 14 | if(!$_user->hasPermission('m_delete_games')) 15 | { 16 | $errorPage = new ErrorPage(); 17 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 18 | $errorPage->SetMSG(ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 19 | $errorPage->print_die(); 20 | } 21 | } 22 | 23 | require_once __DIR__ . "/include/header.footer.class.php"; 24 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 25 | require_once __DIR__ . "/../include/TGDB.API.php"; 26 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 27 | 28 | $API = TGDB::getInstance(); 29 | $devs_list = $API->GetDevsList(); 30 | $pubs_list = $API->GetPubsList(); 31 | 32 | $Header = new HEADER(); 33 | $Header->setTitle("TGDB - Merge"); 34 | $Header->appendRawHeader(function() { global $_user, $devs_list, $pubs_list; ?> 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 158 | 159 | print(); ?> 160 | 161 |
162 |
163 |

Developer

164 | 168 | 172 |

173 |
174 |
175 |
176 |
177 |

Publisher

178 | 179 | 183 | 187 |

188 |
189 |
190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /website/login.php: -------------------------------------------------------------------------------- 1 | isLoggedIn() && $_user->Logout()) 12 | { 13 | $success_msg[] = "User logged out successfully. You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 14 | ''; 15 | } 16 | else 17 | { 18 | $error_msgs[] = "User is already logged out. You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 19 | ''; 20 | } 21 | } 22 | else if($_user->isLoggedIn()) 23 | { 24 | $error_msgs[] = "User is already logged in. You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 25 | ''; 26 | } 27 | 28 | if($_SERVER['REQUEST_METHOD'] == "POST" && empty($error_msgs) && empty($success_msg)) 29 | { 30 | if(!$_user->isLoggedIn()) 31 | { 32 | if(!empty($_POST['username']) && !empty($_POST['password'])) 33 | { 34 | $res = $_user->Login(isset($_POST['autologin']), isset($_POST['viewonline'])); 35 | if($res['status'] == LOGIN_SUCCESS) 36 | { 37 | if(!empty($_POST['redirect']) && strpos($_POST['redirect'], "login") === false) 38 | { 39 | $length = strlen("thegamesdb.net"); 40 | $url = parse_url($_POST['redirect']); 41 | if($length !== 0 && (substr($url['host'], -$length) === "thegamesdb.net")) 42 | { 43 | $success_msg[] = "Login successful, You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 44 | ''; 45 | 46 | } 47 | else 48 | { 49 | $success_msg[] = "Login successful, You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 50 | ''; } 51 | } 52 | else 53 | { 54 | $success_msg[] = "Login successful, You will be automatically redirected, if it takes longer than 10 seconds Click Here." . 55 | ''; 56 | } 57 | } 58 | else 59 | { 60 | $error_msgs[] = $res['error_msgs_str']; 61 | } 62 | } 63 | else 64 | { 65 | $error_msgs[] = "Username or Password fields can't be empty, please try again."; 66 | } 67 | } 68 | } 69 | 70 | require_once __DIR__ . "/include/header.footer.class.php"; 71 | 72 | $Header = new HEADER(); 73 | $Header->setTitle("TGDB - Login"); 74 | $Header->appendRawHeader(function() { global $Game; ?> 75 | 76 | 78 | 79 | 80 | print(); ?> 81 | 82 |
83 | 84 |
85 |
86 |

Action Failed!

87 | 88 |

89 | 90 |
91 |
92 | 93 | 94 |
95 |
96 |

Action Completed!

97 | 98 |

99 | 100 |
101 |
102 | 103 |
104 |
105 |
106 |
107 | Login 108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | 116 |
117 | 118 |
119 |
120 | 121 |
122 |
123 |
124 | 125 |
126 | 127 |
128 |
129 | 130 |
131 |
132 | 133 |
134 |
135 |
136 |
137 | 138 |
139 | 140 |
141 | 144 |
145 |
146 |
147 |
148 | 149 |
150 | 151 | 152 | -------------------------------------------------------------------------------- /website/include/DiscordUtils.class.php: -------------------------------------------------------------------------------- 1 | $embeds['author']['name'], 17 | 'avatar_url' => $embeds['author']['icon_url'], 18 | ); 19 | 20 | $data['embeds'] = [$embeds]; 21 | $json_string = json_encode($data); 22 | 23 | $curl = curl_init(); 24 | curl_setopt($curl, CURLOPT_URL, Config::$DiscordWebhook); 25 | curl_setopt($curl, CURLOPT_POST, 1); 26 | curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 27 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 28 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 29 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 30 | curl_setopt($curl, CURLOPT_POSTFIELDS, $json_string); 31 | 32 | $output = curl_exec($curl); 33 | $output = json_decode($output, true); 34 | 35 | if (curl_getinfo($curl, CURLINFO_HTTP_CODE) != 204) 36 | { 37 | if(isset($output['message'])) 38 | { 39 | throw new \Exception($output['message']); 40 | } 41 | else if(isset($output)) 42 | { 43 | throw new \Exception(json_encode($output)); 44 | } 45 | } 46 | 47 | curl_close($curl); 48 | return true; 49 | } 50 | 51 | static function PostGameUpdate($_user, $old_game_data, $new_game_data, $type = 0) 52 | { 53 | if(!isset($new_game_data)) 54 | return; 55 | 56 | try 57 | { 58 | CommonUtils::htmlspecialchars_decodeArrayRecursive($old_game_data); 59 | CommonUtils::htmlspecialchars_decodeArrayRecursive($new_game_data); 60 | 61 | $embeds = array(); 62 | $embeds["author"] = array( 63 | "name" => $_user->GetUsername(), 64 | "url" => "https://forums.thegamesdb.net/memberlist.php?mode=viewprofile&u=" . $_user->GetUserID(), 65 | "icon_url" => $_user->GetAvatar() 66 | ); 67 | $embeds["title"] = $new_game_data->game_title; 68 | $embeds["url"] = CommonUtils::$WEBSITE_BASE_URL . "game.php?id=$new_game_data->id"; 69 | switch($type) 70 | { 71 | case 0: 72 | $embeds["color"] = 0x00b159; 73 | $embeds["footer"] = ['text' => "Game Added"]; 74 | break; 75 | case 1: 76 | $embeds["color"] = 0xffc425; 77 | $embeds["footer"] = ['text' => "Game Updated"]; 78 | break; 79 | case 2: 80 | $embeds["color"] = 0xd11141; 81 | $embeds["footer"] = ['text' => "Game Removed"]; 82 | break; 83 | } 84 | 85 | $embeds["fields"][] = ["name" => "id", "value" => $new_game_data->id, "inline" => "true"]; 86 | $embeds["fields"][] = ["name" => "platform", "value" => $new_game_data->platform, "inline" => "true"]; 87 | $is_change = false; 88 | foreach($new_game_data as $key => $val) 89 | { 90 | if(($type == 0 || $type == 2) && ($key == "id" || $key == "platform" || $key == "game_title")) 91 | continue; 92 | 93 | if(!empty($val) && (empty($old_game_data) || empty($old_game_data->$key) || $val != $old_game_data->$key)) 94 | { 95 | if($key == "uids") 96 | { 97 | $uids = []; 98 | foreach($val as $item) 99 | { 100 | $uids[] = $item->uid; 101 | } 102 | $val = $uids; 103 | } 104 | 105 | if(is_array($val)) 106 | $val = implode(",", $val); 107 | $data = ["name" => $key, "value" => $val]; 108 | if($key != "overview") 109 | $data["inline"] = "true"; 110 | 111 | $embeds["fields"][] = $data; 112 | $is_change = true; 113 | } 114 | else if(empty($val) && (!empty($old_game_data) && !empty($old_game_data->$key))) 115 | { 116 | $embeds["fields"][] = ["name" => $key, "value" => "[REMOVED]", "inline" => "true"]; 117 | $is_change = true; 118 | } 119 | } 120 | if(!$is_change) 121 | return; 122 | 123 | if($type == 1) 124 | { 125 | $API = TGDB::getInstance(); 126 | $boxarts = $API->GetGameBoxartByID($new_game_data->id, 0, 9999, 'boxart'); 127 | if(isset($boxarts[$new_game_data->id])) 128 | { 129 | $new_game_data->boxart = $boxarts[$new_game_data->id]; 130 | 131 | $box_cover = new \stdClass(); 132 | $box_cover->front = TGDBUtils::GetAllCovers($new_game_data, 'boxart', 'front'); 133 | 134 | if(!empty($box_cover->front)) 135 | { 136 | $embeds["thumbnail"] = array( 137 | "url" => $box_cover->front[0]->thumbnail 138 | ); 139 | } 140 | } 141 | } 142 | 143 | DiscordUtils::Send($embeds); 144 | } 145 | catch(Exception $e) 146 | { 147 | error_log($e); 148 | } 149 | 150 | } 151 | 152 | static function PostImageUpdate($_user, $game_id, $image_path, $type, $sub_type, $action_type) 153 | { 154 | if(!isset($game_id)) 155 | return; 156 | 157 | try 158 | { 159 | $API = TGDB::getInstance(); 160 | $game = $API->GetGameByID($game_id, 0, 1)[0]; 161 | CommonUtils::htmlspecialchars_decodeArrayRecursive($game); 162 | 163 | $embeds = array(); 164 | $embeds["author"] = array( 165 | "name" => $_user->GetUsername(), 166 | "url" => "https://forums.thegamesdb.net/memberlist.php?mode=viewprofile&u=" . $_user->GetUserID(), 167 | "icon_url" => $_user->GetAvatar() 168 | ); 169 | $embeds["title"] = $game->game_title; 170 | $embeds["url"] = CommonUtils::$WEBSITE_BASE_URL . "game.php?id=$game->id"; 171 | 172 | switch($action_type) 173 | { 174 | case 0: 175 | $embeds["color"] = 0x00b159; 176 | $embeds["footer"] = ['text' => "Image Added"]; 177 | break; 178 | case 1: 179 | $embeds["color"] = 0xffc425; 180 | $embeds["footer"] = ['text' => "Image Replaced"]; 181 | break; 182 | case 2: 183 | $embeds["color"] = 0xd11141; 184 | $embeds["footer"] = ['text' => "Image Removed"]; 185 | break; 186 | } 187 | $embeds["fields"][] = ["name" => "game_id", "value" => $game->id, "inline" => "true"]; 188 | $embeds["fields"][] = ["name" => "type", "value" => $type, "inline" => "true"]; 189 | if(!empty($sub_type)) 190 | { 191 | $embeds["fields"][] = ["name" => "subtype", "value" => $sub_type, "inline" => "true"]; 192 | } 193 | 194 | if($action_type < 2) 195 | { 196 | $embeds["image"] = array( 197 | "url" => $image_path 198 | ); 199 | } 200 | 201 | DiscordUtils::Send($embeds); 202 | } 203 | catch(Exception $e) 204 | { 205 | error_log($e); 206 | } 207 | 208 | } 209 | } 210 | ?> 211 | -------------------------------------------------------------------------------- /website/include/UploadHandler.fineupload.class.php: -------------------------------------------------------------------------------- 1 | inputName])) 29 | return $_FILES[$this->inputName]['name']; 30 | } 31 | 32 | public function getInitialFiles() { 33 | $initialFiles = array(); 34 | 35 | for ($i = 0; $i < 5000; $i++) { 36 | array_push($initialFiles, array("name" => "name" + $i, uuid => "uuid" + $i, thumbnailUrl => "/test/dev/handlers/vendor/fineuploader/php-traditional-server/fu.png")); 37 | } 38 | 39 | return $initialFiles; 40 | } 41 | 42 | /** 43 | * Get the name of the uploaded file 44 | */ 45 | public function getUploadName(){ 46 | return $this->uploadName; 47 | } 48 | 49 | /** 50 | * Process the upload. 51 | * @param string $uploadDirectory Target directory. 52 | * @param string $name Overwrites the name of the file. 53 | */ 54 | public function handleUpload($uploadDirectory, $name = null){ 55 | 56 | // Check that the max upload size specified in class configuration does not 57 | // exceed size allowed by server config 58 | if ($this->toBytes(ini_get('post_max_size')) < $this->sizeLimit || 59 | $this->toBytes(ini_get('upload_max_filesize')) < $this->sizeLimit){ 60 | $neededRequestSize = max(1, $this->sizeLimit / 1024 / 1024) . 'M'; 61 | return array('error'=>"Server error. Increase post_max_size and upload_max_filesize to ".$neededRequestSize); 62 | } 63 | 64 | if ($this->isInaccessible($uploadDirectory)){ 65 | return array('error' => "Server error. Uploads directory isn't writable"); 66 | } 67 | 68 | $type = $_SERVER['CONTENT_TYPE']; 69 | if (isset($_SERVER['HTTP_CONTENT_TYPE'])) { 70 | $type = $_SERVER['HTTP_CONTENT_TYPE']; 71 | } 72 | 73 | if(!isset($type)) { 74 | return array('error' => "No files were uploaded."); 75 | } else if (strpos(strtolower($type), 'multipart/') !== 0){ 76 | return array('error' => "Server error. Not a multipart request. Please set forceMultipart to default value (true)."); 77 | } 78 | 79 | // Get size and name 80 | $file = $_FILES[$this->inputName]; 81 | $size = $file['size']; 82 | if (isset($_REQUEST['qqtotalfilesize'])) { 83 | $size = $_REQUEST['qqtotalfilesize']; 84 | } 85 | 86 | if ($name === null){ 87 | $name = $this->getName(); 88 | } 89 | 90 | // check file error 91 | if($file['error']) { 92 | return array('error' => 'Upload Error #'.$file['error']); 93 | } 94 | 95 | // Validate name 96 | if ($name === null || $name === ''){ 97 | return array('error' => 'File name empty.'); 98 | } 99 | 100 | // Validate file size 101 | if ($size == 0){ 102 | return array('error' => 'File is empty.'); 103 | } 104 | 105 | if (!is_null($this->sizeLimit) && $size > $this->sizeLimit) { 106 | return array('error' => 'File is too large.', 'preventRetry' => true); 107 | } 108 | 109 | // Validate file extension 110 | $pathinfo = pathinfo($name); 111 | $ext = isset($pathinfo['extension']) ? $pathinfo['extension'] : ''; 112 | 113 | if($this->allowedExtensions && !in_array(strtolower($ext), array_map("strtolower", $this->allowedExtensions))){ 114 | $these = implode(', ', $this->allowedExtensions); 115 | return array('error' => 'File has an invalid extension, it should be one of '. $these . '.'); 116 | } 117 | 118 | $target = join(DIRECTORY_SEPARATOR, array($uploadDirectory, $name)); 119 | 120 | if ($target){ 121 | $this->uploadName = basename($target); 122 | 123 | if (!is_dir(dirname($target))){ 124 | mkdir(dirname($target), 0777, true); 125 | } 126 | if (move_uploaded_file($file['tmp_name'], $target)){ 127 | return array('success'=> true, "path" => $target); 128 | } 129 | } 130 | 131 | return array('error'=> 'Could not save uploaded file.' . 132 | 'The upload was cancelled, or server error encountered'); 133 | } 134 | 135 | 136 | /** 137 | * Converts a given size with units to bytes. 138 | * @param string $str 139 | */ 140 | protected function toBytes($str){ 141 | $str = trim($str); 142 | $last = strtolower($str[strlen($str)-1]); 143 | $val; 144 | if(is_numeric($last)) { 145 | $val = (int) $str; 146 | } else { 147 | $val = (int) substr($str, 0, -1); 148 | } 149 | switch($last) { 150 | case 'g': case 'G': $val *= 1024; 151 | case 'm': case 'M': $val *= 1024; 152 | case 'k': case 'K': $val *= 1024; 153 | } 154 | return $val; 155 | } 156 | 157 | /** 158 | * Determines whether a directory can be accessed. 159 | * 160 | * is_executable() is not reliable on Windows prior PHP 5.0.0 161 | * (http://www.php.net/manual/en/function.is-executable.php) 162 | * The following tests if the current OS is Windows and if so, merely 163 | * checks if the folder is writable; 164 | * otherwise, it checks additionally for executable status (like before). 165 | * 166 | * @param string $directory The target directory to test access 167 | */ 168 | protected function isInaccessible($directory) { 169 | $isWin = $this->isWindows(); 170 | $folderInaccessible = ($isWin) ? !is_writable($directory) : ( !is_writable($directory) && !is_executable($directory) ); 171 | return $folderInaccessible; 172 | } 173 | 174 | /** 175 | * Determines is the OS is Windows or not 176 | * 177 | * @return boolean 178 | */ 179 | 180 | protected function isWindows() { 181 | $isWin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); 182 | return $isWin; 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/fine-uploader-gallery.min.css: -------------------------------------------------------------------------------- 1 | .qq-gallery .qq-btn{float:right;border:none;padding:0;margin:0;box-shadow:none}.qq-gallery .qq-upload-button{display:inline;width:105px;padding:7px 10px;float:left;text-align:center;background:#00abc7;color:#fff;border-radius:2px;border:1px solid #37b7cc;box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 1px 0 rgba(0,0,0,.36),0 -2px 12px rgba(0,0,0,.08) inset}.qq-gallery .qq-upload-button-hover{background:#33b6cc}.qq-gallery .qq-upload-button-focus{outline:1px dotted #000}.qq-gallery.qq-uploader{position:relative;min-height:200px;max-height:490px;overflow-y:hidden;width:inherit;border-radius:6px;border:1px dashed #ccc;background-color:#fafafa;padding:20px}.qq-gallery.qq-uploader:before{content:attr(qq-drop-area-text) " ";position:absolute;font-size:200%;left:0;width:100%;text-align:center;top:45%;opacity:.25}.qq-gallery .qq-upload-drop-area,.qq-upload-extra-drop-area{position:absolute;top:0;left:0;width:100%;height:100%;min-height:30px;z-index:2;background:#f9f9f9;border-radius:4px;text-align:center}.qq-gallery .qq-upload-drop-area span{display:block;position:absolute;top:50%;width:100%;margin-top:-8px;font-size:16px}.qq-gallery .qq-upload-extra-drop-area{position:relative;margin-top:50px;font-size:16px;padding-top:30px;height:20px;min-height:40px}.qq-gallery .qq-upload-drop-area-active{background:#fdfdfd;border-radius:4px}.qq-gallery .qq-upload-list{margin:0;padding:10px 0 0;list-style:none;max-height:450px;overflow-y:auto;clear:both;box-shadow:none}.qq-gallery .qq-upload-list li{display:inline-block;position:relative;max-width:120px;margin:0 25px 25px 0;padding:0;line-height:16px;font-size:13px;color:#424242;background-color:#fff;border-radius:2px;box-shadow:0 1px 1px 0 rgba(0,0,0,.22);vertical-align:top;height:186px}.qq-gallery .qq-upload-continue,.qq-gallery .qq-upload-delete,.qq-gallery .qq-upload-failed-text,.qq-gallery .qq-upload-pause,.qq-gallery .qq-upload-retry,.qq-gallery .qq-upload-size,.qq-gallery .qq-upload-spinner{display:inline}.qq-gallery .qq-upload-continue:hover,.qq-gallery .qq-upload-delete:hover,.qq-gallery .qq-upload-pause:hover,.qq-gallery .qq-upload-retry:hover{background-color:transparent}.qq-gallery .qq-upload-cancel,.qq-gallery .qq-upload-continue,.qq-gallery .qq-upload-delete,.qq-gallery .qq-upload-pause{cursor:pointer}.qq-gallery .qq-upload-continue,.qq-gallery .qq-upload-delete,.qq-gallery .qq-upload-pause{border:none;background:0 0;color:#00a0ba;font-size:12px;padding:0}.qq-gallery .qq-upload-status-text{color:#333;font-size:12px;padding-left:3px;padding-top:2px;width:inherit;display:none;width:108px}.qq-gallery .qq-upload-fail .qq-upload-status-text{text-overflow:ellipsis;white-space:nowrap;overflow-x:hidden;display:block}.qq-gallery .qq-upload-retrying .qq-upload-status-text{display:inline-block}.qq-gallery .qq-upload-retrying .qq-progress-bar-container{display:none}.qq-gallery .qq-upload-cancel{background-color:#525252;color:#f7f7f7;font-weight:700;font-family:Arial,Helvetica,sans-serif;border-radius:12px;border:none;height:22px;width:22px;padding:4px;position:absolute;right:-5px;top:-6px;margin:0;line-height:17px}.qq-gallery .qq-upload-cancel:hover{background-color:#525252}.qq-gallery .qq-upload-retry{cursor:pointer;position:absolute;top:30px;left:50%;margin-left:-31px;box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 4px 4px rgba(0,0,0,.5),0 -2px 12px rgba(0,0,0,.08) inset;padding:3px 4px;border:1px solid #d2ddc7;border-radius:2px;color:inherit;background-color:#ebf6e0;z-index:1}.qq-gallery .qq-upload-retry:hover{background-color:#f7ffec}.qq-gallery .qq-file-info{padding:10px 6px 4px;margin-top:-3px;border-radius:0 0 2px 2px;text-align:left;overflow:hidden}.qq-gallery .qq-file-info .qq-file-name{position:relative}.qq-gallery .qq-upload-file{display:block;margin-right:0;margin-bottom:3px;width:auto;text-overflow:ellipsis;white-space:nowrap;overflow-x:hidden}.qq-gallery .qq-upload-spinner{display:inline-block;background:url(loading.gif);position:absolute;left:50%;margin-left:-7px;top:53px;width:15px;height:15px;vertical-align:text-bottom}.qq-gallery .qq-drop-processing{display:block}.qq-gallery .qq-drop-processing-spinner{display:inline-block;background:url(processing.gif);width:24px;height:24px;vertical-align:text-bottom}.qq-gallery .qq-upload-failed-text{display:none;font-style:italic;font-weight:700}.qq-gallery .qq-upload-failed-icon{display:none;width:15px;height:15px;vertical-align:text-bottom}.qq-gallery .qq-upload-fail .qq-upload-failed-text{display:inline}.qq-gallery .qq-upload-retrying .qq-upload-failed-text{display:inline}.qq-gallery .qq-upload-list li.qq-upload-success{background-color:#f2f7ed}.qq-gallery .qq-upload-list li.qq-upload-fail{background-color:#f5eded;box-shadow:0 0 1px 0 red;border:0}.qq-gallery .qq-progress-bar{display:block;background:#00abc7;width:0;height:15px;border-radius:6px;margin-bottom:3px}.qq-gallery .qq-total-progress-bar{height:25px;border-radius:9px}.qq-gallery .qq-total-progress-bar-container{margin-left:9px;display:inline;float:right;width:500px}.qq-gallery .qq-upload-size{float:left;font-size:11px;color:#929292;margin-bottom:3px;margin-right:0;display:inline-block}.qq-gallery INPUT.qq-edit-filename{position:absolute;opacity:0;z-index:-1}.qq-gallery .qq-upload-file.qq-editable{cursor:pointer;margin-right:20px}.qq-gallery .qq-edit-filename-icon.qq-editable{display:inline-block;cursor:pointer;position:absolute;right:0;top:0}.qq-gallery INPUT.qq-edit-filename.qq-editing{position:static;height:28px;width:90px;width:-moz-available;padding:0 8px;margin-bottom:3px;border:1px solid #ccc;border-radius:2px;font-size:13px;opacity:1}.qq-gallery .qq-edit-filename-icon{display:none;background:url(edit.gif);width:15px;height:15px;vertical-align:text-bottom}.qq-gallery .qq-delete-icon{background:url(trash.gif);width:15px;height:15px;vertical-align:sub;display:inline-block}.qq-gallery .qq-retry-icon{background:url(retry.gif);width:15px;height:15px;vertical-align:sub;display:inline-block;float:none}.qq-gallery .qq-continue-icon{background:url(continue.gif);width:15px;height:15px;vertical-align:sub;display:inline-block}.qq-gallery .qq-pause-icon{background:url(pause.gif);width:15px;height:15px;vertical-align:sub;display:inline-block}.qq-gallery .qq-hide{display:none}.qq-gallery .qq-in-progress .qq-thumbnail-wrapper{/* makes the spinner on top of the thumbnail more visible */opacity:.5}.qq-gallery .qq-thumbnail-wrapper{overflow:hidden;position:relative;height:120px;width:120px}.qq-gallery .qq-thumbnail-selector{border-radius:2px 2px 0 0;bottom:0;top:0;margin:auto;display:block}:root *>.qq-gallery .qq-thumbnail-selector{position:relative;top:50%;transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);-webkit-transform:translateY(-50%)}.qq-gallery.qq-uploader DIALOG{display:none}.qq-gallery.qq-uploader DIALOG[open]{display:block}.qq-gallery.qq-uploader DIALOG{display:none}.qq-gallery.qq-uploader DIALOG[open]{display:block}.qq-gallery.qq-uploader DIALOG .qq-dialog-buttons{text-align:center;padding-top:10px}.qq-gallery.qq-uploader DIALOG .qq-dialog-buttons BUTTON{margin-left:5px;margin-right:5px}.qq-gallery.qq-uploader DIALOG .qq-dialog-message-selector{padding-bottom:10px}.qq-gallery .qq-uploader DIALOG::backdrop{background-color:rgba(0,0,0,.7)}/*# sourceMappingURL=fine-uploader-gallery.min.css.map */ -------------------------------------------------------------------------------- /website/actions/uploads.php: -------------------------------------------------------------------------------- 1 | fromFile($original_image); 22 | $type = ($type == 'jpg') ? 'jpeg' : $type; 23 | $image->toFile($dest_image, "image/$type", 100); 24 | return true; 25 | } 26 | catch(Exception $err) 27 | { 28 | error_log($err); 29 | return false; 30 | } 31 | } 32 | } 33 | 34 | function returnJSONAndDie($msg) 35 | { 36 | global $tmp_image_out_path, $image_out_path; 37 | if(isset($tmp_image_out_path) && file_exists($tmp_image_out_path)) 38 | { 39 | unlink($tmp_image_out_path); 40 | } 41 | if(isset($image_out_path) && file_exists($image_out_path)) 42 | { 43 | unlink($image_out_path); 44 | } 45 | echo json_encode(array("error" => $msg)); 46 | die(); 47 | } 48 | 49 | $_user = phpBBUser::getInstance(); 50 | if(!$_user->isLoggedIn()) 51 | { 52 | returnJSONAndDie(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 53 | } 54 | else 55 | { 56 | if(!$_user->hasPermission('u_edit_games')) 57 | { 58 | returnJSONAndDie(ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 59 | } 60 | } 61 | $Fields = ['game_id', 'type', 'subtype']; 62 | { 63 | foreach($Fields as $field) 64 | { 65 | if(!isset($_REQUEST[$field])) 66 | { 67 | returnJSONAndDie(ErrorPage::$MSG_MISSING_PARAM_ERROR . ": ($field)."); 68 | } 69 | } 70 | // TODO: move these hardcoded values to a table, but this will do for now 71 | switch($_REQUEST['type']) 72 | { 73 | case 'boxart': 74 | if($_REQUEST['subtype'] == 'front' || $_REQUEST['subtype'] == 'back') 75 | { 76 | break; 77 | } 78 | returnJSONAndDie("Invalid subtype selection: " . $_REQUEST['subtype']); 79 | case 'titlescreen': 80 | case 'fanart': 81 | case 'banner': 82 | case 'screenshot': 83 | case 'clearlogo': 84 | if(empty($_REQUEST['subtype'])) 85 | { 86 | break; 87 | } 88 | returnJSONAndDie("Invalid subtype selection: " . $_REQUEST['subtype']); 89 | default: 90 | returnJSONAndDie("Invalid type selection: " . $_REQUEST['type']); 91 | } 92 | } 93 | 94 | 95 | $uploader = new UploadHandler(); 96 | 97 | $uploader->allowedExtensions = array('jpe', 'jpg', 'jpeg', 'gif', 'png', 'bmp'); 98 | $uploader->sizeLimit = 5 * 1024 *1024; 99 | 100 | $uploader->inputName = "qqfile"; 101 | 102 | function get_request_method() 103 | { 104 | global $HTTP_RAW_POST_DATA; 105 | 106 | if(isset($HTTP_RAW_POST_DATA)) 107 | { 108 | parse_str($HTTP_RAW_POST_DATA, $_POST); 109 | } 110 | 111 | if (isset($_POST["_method"]) && $_POST["_method"] != null) 112 | { 113 | return $_POST["_method"]; 114 | } 115 | 116 | return $_SERVER["REQUEST_METHOD"]; 117 | } 118 | 119 | if (get_request_method() == "POST") 120 | { 121 | header("Content-Type: text/plain"); 122 | 123 | $tmp_path = __DIR__ . "/../../cdn/images/tmp/original/" . $_REQUEST['type']; 124 | $path = __DIR__ . "/../../cdn/images/original/" . $_REQUEST['type']; 125 | if(!empty($_REQUEST['subtype'])) 126 | { 127 | $tmp_path .= "/" . $_REQUEST['subtype']; 128 | $path .= "/" . $_REQUEST['subtype']; 129 | } 130 | 131 | $API = TGDB::getInstance(); 132 | $covers = $API->GetGameBoxartByID($_REQUEST['game_id'], 0, 30, $_REQUEST['type']); 133 | if(!empty($covers) && ($covers = $covers[$_REQUEST['game_id']]) && count($covers) > 10) 134 | { 135 | returnJSONAndDie("Max (10) allowed uploaded images has been reached."); 136 | } 137 | 138 | if($_REQUEST['type'] == 'clearlogo') 139 | { 140 | $type = "png"; 141 | } 142 | else 143 | { 144 | $type = "jpg"; 145 | if($_REQUEST['type'] == 'boxart') 146 | { 147 | // by forcing the name to "-1.$type", we'll always replace the cover with new upload 148 | $image_name = $_REQUEST['game_id'] . "-1.$type"; 149 | } 150 | } 151 | if(!isset($image_name)) 152 | { 153 | for($i = 1; $i <= 10; ++$i) 154 | { 155 | $tmp_name = $_REQUEST['game_id'] . "-$i.$type"; 156 | if(!file_exists($path . "/" . $tmp_name)) 157 | { 158 | $image_name = $tmp_name; 159 | break; 160 | } 161 | } 162 | if(!isset($image_name)) 163 | { 164 | die("Failed to find an image_name"); 165 | } 166 | } 167 | 168 | if(!file_exists($tmp_path)) 169 | { 170 | mkdir($tmp_path, 0755, true); 171 | } 172 | $result = $uploader->handleUpload($tmp_path, $image_name); 173 | $result["uploadName"] = $uploader->getUploadName(); 174 | 175 | if(isset($result['success'])) 176 | { 177 | $tmp_image_out_path = $tmp_path . "/" . $image_name; 178 | $image_out_path = $path . "/" . $image_name; 179 | $result['final_out'] = $image_out_path; 180 | if(save_image($tmp_image_out_path, $image_out_path, $type)) 181 | { 182 | if($_REQUEST['type'] == 'boxart') 183 | { 184 | if(!empty($covers)) 185 | { 186 | foreach($covers as $cover) 187 | { 188 | if($_REQUEST['subtype'] == $cover->side) 189 | { 190 | $sql_image_path = $cover->filename; 191 | break; 192 | } 193 | } 194 | if(isset($sql_image_path)) 195 | { 196 | $sizes = ["small", "thumb", "cropped_center_thumb", "cropped_center_thumb_square", "medium", "large"]; 197 | WebUtils::purgeCDNCache($sql_image_path); 198 | if(basename($sql_image_path) != $image_name) 199 | { 200 | array_push($sizes, 'original'); 201 | } 202 | foreach($sizes as $size) 203 | { 204 | $image_to_delete = __DIR__ . "/../../cdn/images/$size/" . $sql_image_path; 205 | if(file_exists($image_to_delete)) 206 | { 207 | unlink($image_to_delete); 208 | } 209 | } 210 | if($_REQUEST['subtype'] == $cover->side) 211 | { 212 | $image_path = $_REQUEST['type'] . "/" . $_REQUEST['subtype'] . "/" . $image_name; 213 | $res = $API->DeleteAndInsertGameImages($_user->GetUserID(), $cover->id, $_REQUEST['game_id'], $_REQUEST['type'], $image_path, $_REQUEST['subtype']); 214 | DiscordUtils::PostImageUpdate($_user, $_REQUEST['game_id'], CommonUtils::getImagesBaseURL()['thumb'] . $image_path, $_REQUEST['type'], $_REQUEST['subtype'], 1); 215 | echo json_encode($result); return; 216 | } 217 | } 218 | } 219 | $image_path = $_REQUEST['type'] . "/" . $_REQUEST['subtype'] . "/" . $image_name; 220 | $res = $API->InsertGameImages($_user->GetUserID(), $_REQUEST['game_id'], $_REQUEST['type'], $image_path, $_REQUEST['subtype']); 221 | } 222 | else 223 | { 224 | $image_path = $_REQUEST['type'] . "/" . $image_name; 225 | $res = $API->InsertGameImages($_user->GetUserID(), $_REQUEST['game_id'], $_REQUEST['type'], $image_path); 226 | } 227 | 228 | if(!isset($res) || !$res) 229 | { 230 | returnJSONAndDie("Failed to update database."); 231 | } 232 | else if(!empty($image_path)) 233 | { 234 | $sub_type = ""; 235 | if(!empty($_REQUEST['subtype'])) 236 | $sub_type = $_REQUEST['subtype']; 237 | DiscordUtils::PostImageUpdate($_user, $_REQUEST['game_id'], CommonUtils::getImagesBaseURL()['thumb'] . $image_path, $_REQUEST['type'], $sub_type, 0); 238 | 239 | } 240 | } 241 | else 242 | { 243 | returnJSONAndDie("Failed save image." . $image_out_path); 244 | } 245 | } 246 | 247 | echo json_encode($result); 248 | } 249 | else 250 | { 251 | header("HTTP/1.0 405 Method Not Allowed"); 252 | } -------------------------------------------------------------------------------- /website/report_review.php: -------------------------------------------------------------------------------- 1 | isLoggedIn()) 6 | { 7 | $errorPage = new ErrorPage(); 8 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 9 | $errorPage->SetMSG(ErrorPage::$MSG_NOT_LOGGED_IN_EDIT_ERROR); 10 | $errorPage->print_die(); 11 | } 12 | else 13 | { 14 | if(!$_user->hasPermission('m_delete_games')) 15 | { 16 | $errorPage = new ErrorPage(); 17 | $errorPage->SetHeader(ErrorPage::$HEADER_OOPS_ERROR); 18 | $errorPage->SetMSG(ErrorPage::$MSG_NO_PERMISSION_TO_EDIT_ERROR); 19 | $errorPage->print_die(); 20 | } 21 | } 22 | 23 | require_once __DIR__ . "/include/header.footer.class.php"; 24 | require_once __DIR__ . "/include/TGDBUtils.class.php"; 25 | require_once __DIR__ . "/include/WebUtils.class.php"; 26 | require_once __DIR__ . "/../include/TGDB.API.php"; 27 | require_once __DIR__ . "/../include/CommonUtils.class.php"; 28 | 29 | $BASE_URL = CommonUtils::getImagesBaseURL(); 30 | 31 | $API = TGDB::getInstance(); 32 | $offset = 0; 33 | $limit = 100; 34 | $reports = $API->GetGamesReports(0, $offset, $limit); 35 | foreach($reports as $Game) 36 | { 37 | $IDs[] = $Game->games_id; 38 | if($Game->type == 1) 39 | { 40 | $additional_games_id[] = $Game->metadata_0; 41 | } 42 | $PlatformIDs[] = $Game->platform; 43 | } 44 | if(isset($additional_games_id)) 45 | { 46 | $additional_games = $API->GetGameByID($additional_games_id, $offset, $limit); 47 | } 48 | if(isset($IDs)) 49 | { 50 | $games = $API->GetGameByID($IDs, $offset, $limit); 51 | } 52 | 53 | foreach($additional_games as $Game) 54 | { 55 | $IDs[] = $Game->id; 56 | $PlatformIDs[] = $Game->platform; 57 | } 58 | $Platforms = $API->GetPlatforms($PlatformIDs, $offset, $limit); 59 | $covers = $API->GetGameBoxartByID($IDs, 0, 9999); 60 | foreach($reports as $Game) 61 | { 62 | if(isset($covers[$Game->games_id])) 63 | { 64 | $Game->boxart = $covers[$Game->games_id]; 65 | } 66 | } 67 | 68 | foreach($additional_games as &$Game) 69 | { 70 | $ref_additional_games[$Game->id] = $Game; 71 | if(isset($covers[$Game->id])) 72 | { 73 | $Game->boxart = $covers[$Game->id]; 74 | } 75 | } 76 | foreach($games as &$Game) 77 | { 78 | $ref_games[$Game->id] = $Game; 79 | } 80 | 81 | $Game = null; 82 | 83 | function PrintViews(&$report) 84 | { 85 | switch($report->type) 86 | { 87 | case 1: 88 | PrintDuplicateView($report); 89 | break; 90 | } 91 | } 92 | 93 | function PrintDuplicateView(&$report) 94 | { global $ref_additional_games, $ref_games, $Platforms; 95 | if(!isset($ref_additional_games[$report->metadata_0]) || !isset($ref_games[$report->games_id])) 96 | { 97 | //TODO: mark as resolved 98 | return; 99 | } 100 | ?> 101 |
102 |
103 |
104 | 105 | <?= $report->game_title ?> 106 | 107 |
108 |
109 |
110 | username ?> reports the following game 111 |
112 | game_title . "(games_id: $report->games_id)" ?> 113 |
as a duplicate of
114 | metadata_0]->game_title . " (games_id: $report->metadata_0)" ?> 115 |
116 |
117 |
118 |
119 | 120 |
121 |
122 | 123 |
124 |
125 |
126 |
127 | 128 |
129 |
130 |
131 |
132 | 133 | <?= $ref_additional_games[$report->metadata_0]->game_title ?> 134 | 135 |
136 |
137 | 138 |
139 |
140 |
game_title ?>
141 |

Platform: platform]->name ?>

142 |
143 |
144 |
145 |
146 |
metadata_0]->game_title ?>
147 |

Platform: metadata_0]->platform]->name ?>

148 |
149 |
150 |
151 |
152 | setTitle("TGDB - Games Reports"); 157 | $Header->appendRawHeader(function() { ?> 158 | 249 | 251 | 252 | print(); ?> 253 | 254 |
255 |
256 | 257 |
258 |

Reports()


259 |
260 | 264 |
265 | 266 |
267 | 268 | 269 | -------------------------------------------------------------------------------- /website/include/header.footer.class.php: -------------------------------------------------------------------------------- 1 | _title = $title; 28 | } 29 | 30 | public function appendRawHeader($fun) 31 | { 32 | $this->_printExtraHeader = $fun; 33 | } 34 | public function print() 35 | { global $_user;?> 36 | 37 | 38 | 39 | 40 | <?= $this->_title ?> 41 | 42 | 44 | 45 | 46 | 47 | '; 53 | break; 54 | case 2: 55 | echo ''; 56 | break; 57 | case 3: 58 | echo ''; 59 | break; 60 | case 4: 61 | echo ''; 62 | break; 63 | case 5: 64 | echo ''; 65 | echo ""; 66 | break; 67 | default: 68 | echo ''; 69 | } 70 | ?> 71 | 72 | 73 | 74 | 75 | _printExtraHeader)) : call_user_func($this->_printExtraHeader); endif; ?> 76 | 77 | 78 | 144 | 147 | 153 | 213 | 214 | 215 | 219 | -------------------------------------------------------------------------------- /website/css/fine_uploader.5.16.2/fine-uploader-new.css: -------------------------------------------------------------------------------- 1 | /* --------------------------------------- 2 | /* Fine Uploader Styles 3 | /* --------------------------------------- 4 | 5 | /* Buttons 6 | ------------------------------------------ */ 7 | .qq-btn 8 | { 9 | box-shadow: 0 1px 1px rgba(255, 255, 255, 0.37) inset, 10 | 1px 0 1px rgba(255, 255, 255, 0.07) inset, 11 | 0 1px 0 rgba(0, 0, 0, 0.36), 12 | 0 -2px 12px rgba(0, 0, 0, 0.08) inset; 13 | padding: 3px 4px; 14 | border: 1px solid #CCCCCC; 15 | border-radius: 2px; 16 | color: inherit; 17 | background-color: #FFFFFF; 18 | } 19 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 20 | display: inline; 21 | } 22 | .qq-upload-delete 23 | { 24 | background-color: #e65c47; 25 | color: #FAFAFA; 26 | border-color: #dc523d; 27 | text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55); 28 | } 29 | .qq-upload-delete:hover { 30 | background-color: #f56b56; 31 | } 32 | .qq-upload-cancel 33 | { 34 | background-color: #F5D7D7; 35 | border-color: #e6c8c8; 36 | } 37 | .qq-upload-cancel:hover { 38 | background-color: #ffe1e1; 39 | } 40 | .qq-upload-retry 41 | { 42 | background-color: #EBF6E0; 43 | border-color: #d2ddc7; 44 | } 45 | .qq-upload-retry:hover { 46 | background-color: #f7ffec; 47 | } 48 | .qq-upload-pause, .qq-upload-continue { 49 | background-color: #00ABC7; 50 | color: #FAFAFA; 51 | border-color: #2dadc2; 52 | text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55); 53 | } 54 | .qq-upload-pause:hover, .qq-upload-continue:hover { 55 | background-color: #0fbad6; 56 | } 57 | 58 | /* Upload Button 59 | ------------------------------------------ */ 60 | .qq-upload-button { 61 | display: inline; 62 | width: 105px; 63 | margin-bottom: 10px; 64 | padding: 7px 10px; 65 | text-align: center; 66 | float: left; 67 | background: #00ABC7; 68 | color: #FFFFFF; 69 | border-radius: 2px; 70 | border: 1px solid #2dadc2; 71 | box-shadow: 0 1px 1px rgba(255, 255, 255, 0.37) inset, 72 | 1px 0 1px rgba(255, 255, 255, 0.07) inset, 73 | 0 1px 0 rgba(0, 0, 0, 0.36), 74 | 0 -2px 12px rgba(0, 0, 0, 0.08) inset; 75 | } 76 | .qq-upload-button-hover { 77 | background: #33B6CC; 78 | } 79 | .qq-upload-button-focus { 80 | outline: 1px dotted #000000; 81 | } 82 | 83 | 84 | /* Drop Zone 85 | ------------------------------------------ */ 86 | .qq-uploader { 87 | position: relative; 88 | min-height: 200px; 89 | max-height: 490px; 90 | overflow-y: hidden; 91 | width: inherit; 92 | border-radius: 6px; 93 | background-color: #FDFDFD; 94 | border: 1px dashed #CCCCCC; 95 | padding: 20px; 96 | } 97 | .qq-uploader:before { 98 | content: attr(qq-drop-area-text) " "; 99 | position: absolute; 100 | font-size: 200%; 101 | left: 0; 102 | width: 100%; 103 | text-align: center; 104 | top: 45%; 105 | opacity: 0.25; 106 | } 107 | .qq-upload-drop-area, .qq-upload-extra-drop-area { 108 | position: absolute; 109 | top: 0; 110 | left: 0; 111 | width: 100%; 112 | height: 100%; 113 | min-height: 30px; 114 | z-index: 2; 115 | background: #F9F9F9; 116 | border-radius: 4px; 117 | border: 1px dashed #CCCCCC; 118 | text-align: center; 119 | } 120 | .qq-upload-drop-area span { 121 | display: block; 122 | position: absolute; 123 | top: 50%; 124 | width: 100%; 125 | margin-top: -8px; 126 | font-size: 16px; 127 | } 128 | .qq-upload-extra-drop-area { 129 | position: relative; 130 | margin-top: 50px; 131 | font-size: 16px; 132 | padding-top: 30px; 133 | height: 20px; 134 | min-height: 40px; 135 | } 136 | .qq-upload-drop-area-active { 137 | background: #FDFDFD; 138 | border-radius: 4px; 139 | border: 1px dashed #CCCCCC; 140 | } 141 | .qq-upload-list { 142 | margin: 0; 143 | padding: 0; 144 | list-style: none; 145 | max-height: 450px; 146 | overflow-y: auto; 147 | box-shadow: 0px 1px 0px rgba(15, 15, 50, 0.14); 148 | clear: both; 149 | } 150 | 151 | 152 | /* Uploaded Elements 153 | ------------------------------------------ */ 154 | .qq-upload-list li { 155 | margin: 0; 156 | padding: 9px; 157 | line-height: 15px; 158 | font-size: 16px; 159 | color: #424242; 160 | background-color: #F6F6F6; 161 | border-top: 1px solid #FFFFFF; 162 | border-bottom: 1px solid #DDDDDD; 163 | } 164 | .qq-upload-list li:first-child { 165 | border-top: none; 166 | } 167 | .qq-upload-list li:last-child { 168 | border-bottom: none; 169 | } 170 | 171 | .qq-upload-file, .qq-upload-spinner, .qq-upload-size, 172 | .qq-upload-cancel, .qq-upload-retry, .qq-upload-failed-text, 173 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 174 | margin-right: 12px; 175 | display: inline; 176 | } 177 | .qq-upload-file { 178 | vertical-align: middle; 179 | display: inline-block; 180 | width: 300px; 181 | text-overflow: ellipsis; 182 | white-space: nowrap; 183 | overflow-x: hidden; 184 | height: 18px; 185 | } 186 | .qq-upload-spinner { 187 | display: inline-block; 188 | background: url("loading.gif"); 189 | width: 15px; 190 | height: 15px; 191 | vertical-align: text-bottom; 192 | } 193 | .qq-drop-processing { 194 | display: block; 195 | } 196 | .qq-drop-processing-spinner { 197 | display: inline-block; 198 | background: url("processing.gif"); 199 | width: 24px; 200 | height: 24px; 201 | vertical-align: text-bottom; 202 | } 203 | .qq-upload-size, .qq-upload-cancel, .qq-upload-retry, 204 | .qq-upload-delete, .qq-upload-pause, .qq-upload-continue { 205 | font-size: 12px; 206 | font-weight: normal; 207 | cursor: pointer; 208 | vertical-align: middle; 209 | } 210 | .qq-upload-status-text { 211 | font-size: 14px; 212 | font-weight: bold; 213 | display: block; 214 | } 215 | .qq-upload-failed-text { 216 | display: none; 217 | font-style: italic; 218 | font-weight: bold; 219 | } 220 | .qq-upload-failed-icon { 221 | display:none; 222 | width:15px; 223 | height:15px; 224 | vertical-align:text-bottom; 225 | } 226 | .qq-upload-fail .qq-upload-failed-text { 227 | display: inline; 228 | } 229 | .qq-upload-retrying .qq-upload-failed-text { 230 | display: inline; 231 | } 232 | .qq-upload-list li.qq-upload-success { 233 | background-color: #EBF6E0; 234 | color: #424242; 235 | border-bottom: 1px solid #D3DED1; 236 | border-top: 1px solid #F7FFF5; 237 | } 238 | .qq-upload-list li.qq-upload-fail { 239 | background-color: #F5D7D7; 240 | color: #424242; 241 | border-bottom: 1px solid #DECACA; 242 | border-top: 1px solid #FCE6E6; 243 | } 244 | .qq-progress-bar { 245 | display: block; 246 | display: block; 247 | background: #00abc7; 248 | width: 0%; 249 | height: 15px; 250 | border-radius: 6px; 251 | margin-bottom: 3px; 252 | } 253 | 254 | .qq-total-progress-bar { 255 | height: 25px; 256 | border-radius: 9px; 257 | } 258 | 259 | .qq-total-progress-bar-container { 260 | margin-left: 9px; 261 | display: inline; 262 | float: right; 263 | width: 100%; 264 | } 265 | 266 | INPUT.qq-edit-filename { 267 | position: absolute; 268 | opacity: 0; 269 | filter: alpha(opacity=0); 270 | z-index: -1; 271 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; 272 | } 273 | 274 | .qq-upload-file.qq-editable { 275 | cursor: pointer; 276 | margin-right: 4px; 277 | } 278 | 279 | .qq-edit-filename-icon.qq-editable { 280 | display: inline-block; 281 | cursor: pointer; 282 | } 283 | 284 | INPUT.qq-edit-filename.qq-editing { 285 | position: static; 286 | height: 28px; 287 | padding: 0 8px; 288 | margin-right: 10px; 289 | margin-bottom: -5px; 290 | border: 1px solid #ccc; 291 | border-radius: 2px; 292 | font-size: 16px; 293 | 294 | opacity: 1; 295 | filter: alpha(opacity=100); 296 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 297 | } 298 | 299 | .qq-edit-filename-icon { 300 | display: none; 301 | background: url("edit.gif"); 302 | width: 15px; 303 | height: 15px; 304 | vertical-align: text-bottom; 305 | margin-right: 16px; 306 | } 307 | 308 | .qq-hide { 309 | display: none; 310 | } 311 | 312 | 313 | /* Thumbnail 314 | ------------------------------------------ */ 315 | .qq-thumbnail-selector { 316 | vertical-align: middle; 317 | margin-right: 12px; 318 | } 319 | 320 | 321 | /* element styles */ 322 | .qq-uploader DIALOG { 323 | display: none; 324 | } 325 | 326 | .qq-uploader DIALOG[open] { 327 | display: block; 328 | } 329 | 330 | .qq-uploader DIALOG { 331 | display: none; 332 | } 333 | 334 | .qq-uploader DIALOG[open] { 335 | display: block; 336 | } 337 | 338 | .qq-uploader DIALOG .qq-dialog-buttons { 339 | text-align: center; 340 | padding-top: 10px; 341 | } 342 | 343 | .qq-uploader DIALOG .qq-dialog-buttons BUTTON { 344 | margin-left: 5px; 345 | margin-right: 5px; 346 | } 347 | 348 | .qq-uploader DIALOG .qq-dialog-message-selector { 349 | padding-bottom: 10px; 350 | } 351 | 352 | .qq-uploader DIALOG::backdrop { 353 | background-color: rgba(0, 0, 0, 0.7); 354 | } --------------------------------------------------------------------------------