jargon

// Shared :: "linedancerMain.php"

Sep 13th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.47 KB | Gaming | 0 0
  1. <?php
  2. // Shared :: "linedancerMain.php"
  3.  
  4. include_once("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/php/Generators 2/iconGenerator.php");
  5.  
  6. if( isset($_GET["summary"])){
  7.     include_once("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/php/Classes/linedancerOverviewClass.php");
  8. }else{
  9.     include_once("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/php/Classes/linedancerClass.php");
  10. }
  11.  
  12. // Get the specified release and game from the query parameters
  13. $release = isset($_GET['release']) ? $_GET['release'] : '';
  14. $game = isset($_GET['game']) ? $_GET['game'] : '';
  15.  
  16. $linedancer = new linedancerClass($release,$game);
  17.  
  18. include_once("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/php/Generators 2/gameListGenerator.php");
  19.  
  20. $gamesByRelease = $gameList->listGames();
  21.  
  22. $pagedata = loader("");
  23.  
  24. function loader($pagedata){
  25.    
  26.     include_once("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/php/Generators 2/gameListGenerator.php");
  27.    
  28.     $gameList = new gameListClass();
  29.    
  30.     $release = isset($_GET['release']) ? $_GET['release'] : '';
  31.     $game = isset($_GET['game']) ? $_GET['game'] : '';
  32.  
  33.     $gamesByRelease = $gameList->listGames();
  34.    
  35.     if(isset($gamesByRelease[$release][$game])){
  36.         return file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/scripts/html/main.html");
  37.     }  
  38. }  
  39.  
  40. if ($game !== "") {
  41.     $fancyTitle = "{$game}";
  42. } elseif ($release !== "") {
  43.     $fancyTitle = "{$release}";
  44. } else {
  45.     $fancyTitle = "Door Games";
  46. }
  47.  
  48. $fancyTitle = ucwords($fancyTitle);
  49.  
  50. $fancyHost = str_replace(" ",".",ucwords(str_replace("."," ","{$_SERVER['HTTP_HOST']}")));
  51.  
  52. $fancyTitle = "Keal's {$fancyTitle} @ {$fancyHost}";
  53.  
  54. /*if(is_file("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/icon/{$game}.png")){
  55.     $favIcon = "data:image/png;base64," . str_replace("="," ",base64_encode(file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/icon/{$game}.png")));
  56. }else*/if(is_file("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/{$release} {$game}.png")){
  57.     $favIcon = "data:image/png;base64," . str_replace("="," ",base64_encode(file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/{$release} {$game}.png")));
  58. } elseif(is_file("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/{$release}.png")) {
  59.     $favIcon = "data:image/png;base64," . str_replace("="," ",base64_encode(file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/{$release}.png")));
  60. } elseif(is_file("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/Main.png")) {
  61.     $favIcon = "data:image/png;base64," . str_replace("="," ",base64_encode(file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/generated/Main.png")));
  62. } elseif(is_file("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/icon/crescent-onion-dome.png")) {
  63.     $favIcon = "data:image/png;base64," . str_replace("="," ",base64_encode(file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/Shared/assets/Sprites/icon/crescent-onion-dome.png")));
  64. }
  65.  
  66. $swaps = [
  67.     "{{ release name }}" => "{$release}" !== "" ? "{$release}" : "Main",
  68.     "{{ project name }}" => "{$game}" !== "" ? "{$game}" : "",
  69.     "{{ release root }}" => "{$release}" !== "" ? "/{$release}" : "/Main",
  70.     "{{ project root }}" => "{$game}" !== "" ? "/{$game}" : "",
  71.     "{{ fav icon }}" => $favIcon,
  72.     "{{ title }}" => $fancyTitle
  73. ];
  74.  
  75. foreach($swaps as $swapOut => $swapIn){
  76.     $pagedata = str_replace($swapOut, $swapIn, $pagedata);
  77. }
  78.  
  79. $pagedata = $linedancer->loader($pagedata);
  80.  
  81. // Output the final page data
  82. header("Content-Type: text/html");
  83. echo $pagedata;
  84.  
Add Comment
Please, Sign In to add comment