This repository was archived by the owner on Dec 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 4545 }
4646 if (!isset ($ _GET ['code ' ])) {
4747 // If we don't have a code yet, we need to make the link
48- $ scopes = 'guilds.join%20identify %20guilds ' ;
48+ $ scopes = 'identify %20guilds ' ;
4949 $ discordLink = url ($ config ['discord ' ]['clientId ' ], $ config ['discord ' ]['redirectUri ' ], $ scopes );
5050 $ app ->render ("discord.twig " , array ("botToken " => $ config ['discord ' ]['botToken ' ], "discordLink " => $ discordLink ));
5151
Original file line number Diff line number Diff line change 3131createAuthDb ();
3232
3333$ users = getUsers ();
34+ $ status = serverStatus ();
35+ if (!$ status || $ status ['players ' ] === null || (int )$ status ['players ' ] < 100 ) {
36+ die ();
37+ }
3438$ members = $ restcord ->guild ->listGuildMembers (['guild.id ' => $ config ['discord ' ]['guildId ' ], 'limit ' => 1000 ]);
3539$ roles = $ restcord ->guild ->getGuildRoles (['guild.id ' => $ config ['discord ' ]['guildId ' ]]);
3640$ currentGuild = $ restcord ->guild ->getGuild (['guild.id ' => (int )$ config ['discord ' ]['guildId ' ]]);
4953 break ;
5054 }
5155 }
56+ //Additional ESI Check
57+ if (!(int )$ characterData ['corporation_id ' ] || (int )$ characterData ['corporation_id ' ] === null ){
58+ continue ;
59+ }
5260 if (!$ exists ) {
5361 $ log ->notice ("$ eveName has been removed from the database as they are no longer a member of the server. " );
5462 deleteUser ($ id );
Original file line number Diff line number Diff line change @@ -46,5 +46,30 @@ function corporationDetails($corpID)
4646 return null ;
4747 }
4848
49+ return $ data ;
50+ }
51+
52+ function serverStatus ()
53+ {
54+ try {
55+ // Initialize a new request for this URL
56+ $ ch = curl_init ("https://esi.tech.ccp.is/latest/status/ " );
57+ // Set the options for this request
58+ curl_setopt_array ($ ch , array (
59+ CURLOPT_FOLLOWLOCATION => true , // Yes, we want to follow a redirect
60+ CURLOPT_RETURNTRANSFER => true , // Yes, we want that curl_exec returns the fetched data
61+ CURLOPT_TIMEOUT => 8 ,
62+ CURLOPT_SSL_VERIFYPEER => true , // Do not verify the SSL certificate
63+ ));
64+ // Fetch the data from the URL
65+ $ data = curl_exec ($ ch );
66+ // Close the connection
67+ curl_close ($ ch );
68+ $ data = json_decode ($ data , TRUE );
69+
70+ } catch (Exception $ e ) {
71+ return null ;
72+ }
73+
4974 return $ data ;
5075}
You can’t perform that action at this time.
0 commit comments