From 70b7da3a53e43ad8de2254bf66abe7951937cee5 Mon Sep 17 00:00:00 2001 From: KristianP26 Date: Mon, 12 Dec 2022 20:08:50 +0100 Subject: [PATCH] Edited Map preview image look --- inc/config.php | 4 +- inc/functions.php | 89 ++++++++++++++++++++++++++++-------- inc/pages/dashboard_maps.php | 26 +---------- 3 files changed, 75 insertions(+), 44 deletions(-) diff --git a/inc/config.php b/inc/config.php index 9c1aa3d5..4c28c8ce 100644 --- a/inc/config.php +++ b/inc/config.php @@ -6,7 +6,7 @@ /* Database Config */ $db_host = 'your_database_host'; // DB Hostame -$db_port = 3306; // DB Port (Default: 3306) +$db_port = 3306; // DB Port (Default: 3306) $db_username = 'your_database_username'; // DB Username $db_password = 'your_database_password'; // DB Password $db_database = 'your_database_name'; // DB Database @@ -37,7 +37,7 @@ $settings_navbar_title = "Surf Stats"; $settings_player_profile_icon = TRUE; // TRUE or FALSE # FALSE will disable player profile icons $settings_map_link_icon = TRUE; // TRUE or FALSE # FALSE will disable link icon after map name -$settings_map_image_preview = TRUE; // TRUE or FALSE # FALSE will disable map images preview +$settings_map_image_preview = TRUE; // TRUE or FALSE # FALSE will disable map images preview // TRUE may have effect on page load $settings_map_mapper = TRUE; // TRUE or FALSE # FALSE will disable map mapper name diff --git a/inc/functions.php b/inc/functions.php index 5781e0c6..7a955413 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -135,7 +135,6 @@ function BackgroundImage(): string return $settings_background_image; } -if($settings_language_enable): function LanguageActive($language): string { if($_SESSION['language'] == $language) @@ -151,7 +150,6 @@ function LanguageURL($language): string else return '?language='.$language; } - endif; function MapDownload($map_name): string { @@ -176,27 +174,82 @@ function MapDownload($map_name): string } - function MapPreviewImage($map_name): string + function MapInfo($m_name, $m_mapper, $m_type, $m_tier, $m_bonus, $m_added, $m_added_d, $m_velocity): string { global $settings_map_image_preview; + global $settings_map_mapper; + $images_source_url = "https://raw.githubusercontent.com/Sayt123/SurfMapPics/Maps-and-bonuses/csgo/"; - if($settings_map_image_preview === TRUE): - $image_url = $images_source_url.$map_name.".jpg"; + + if ($settings_map_image_preview): + $image_url = $images_source_url.$m_name.".jpg"; $file_headers = @get_headers($image_url); - if(str_contains($file_headers[0], '200')) - return ''.$map_name.' - Preview Image'; - else - return ''; - else: - return ''; + if (str_contains($file_headers[0], '200')) + $m_image = $image_url; endif; - } - function MapMapper($map_mapper): string - { - global $settings_map_mapper; - if($settings_map_mapper === TRUE) - return '
'.MAPS_MAP_CREATED_BY.': '.$map_mapper.'
'; + if (($settings_map_mapper) && ($m_mapper !== null)) + $m_mapper_text = '
'.MAPS_MAP_CREATED_BY.': '.$m_mapper.'
'; else - return ''; + $m_mapper_text = ''; + + if (isset($m_image)): + return ' + + '; + + else: + return ' +

'.$m_name.'

+ '.$m_mapper_text.' +
+
+ '.TABLE_TYPE.': '.$m_type.' +
+
+ '.TABLE_TIER.': '.$m_tier.' +
+
+ '.TABLE_BONUS.': '.$m_bonus.' +
+
+
+
+ '.TABLE_ADDED.': '.$m_added.' ('.$m_added_d.') +
+
+ '.MAPS_MAX_VELOCITY.': '.number_format($m_velocity).' +
+
+ '; + endif; } \ No newline at end of file diff --git a/inc/pages/dashboard_maps.php b/inc/pages/dashboard_maps.php index e72c37c5..bee86c53 100644 --- a/inc/pages/dashboard_maps.php +++ b/inc/pages/dashboard_maps.php @@ -30,8 +30,7 @@ $map_name = $row_map['mapname']; $map_tier = $row_map['tier']; - if(isset($row_map['mapper'])) - $map_mapper = $row_map['mapper']; + $map_mapper = $row_map['mapper'] ?? null; $map_dateadded = $row_map['date']; $map_maxvelocity = $row_map['maxvelocity']; @@ -425,28 +424,7 @@ 0): ?>
-

- -
-
- : -
-
- : -
-
- : -
-
-
-
- : () -
-
- : -
-
- +