1+ <?php
2+ /*
3+ * Made by Partydragen
4+ * https://github.com/partydragen/Members/
5+ * https://partydragen.com/
6+ * NamelessMC version 2.0.0-pr8
7+ *
8+ * License: MIT
9+ */
10+
11+ class Members {
12+ /*
13+ * Check for Module updates
14+ * Returns JSON object with information about any updates
15+ */
16+ public static function updateCheck ($ current_version = null ) {
17+ $ queries = new Queries ();
18+
19+ // Check for updates
20+ if (!$ current_version ) {
21+ $ current_version = $ queries ->getWhere ('settings ' , array ('name ' , '= ' , 'nameless_version ' ));
22+ $ current_version = $ current_version [0 ]->value ;
23+ }
24+
25+ $ uid = $ queries ->getWhere ('settings ' , array ('name ' , '= ' , 'unique_id ' ));
26+ $ uid = $ uid [0 ]->value ;
27+
28+ $ enabled_modules = Module::getModules ();
29+ foreach ($ enabled_modules as $ enabled_item ){
30+ if ($ enabled_item ->getName () == 'Members ' ){
31+ $ module = $ enabled_item ;
32+ break ;
33+ }
34+ }
35+
36+
37+ $ ch = curl_init ();
38+ curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
39+ curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , false );
40+ curl_setopt ($ ch , CURLOPT_URL , 'https://api.partydragen.com/stats.php?uid= ' . $ uid . '&version= ' . $ current_version . '&module=Members&module_version= ' .$ module ->getVersion ());
41+
42+ $ update_check = curl_exec ($ ch );
43+ curl_close ($ ch );
44+
45+ $ info = json_decode ($ update_check );
46+ if (isset ($ info ->blacklisted ) && $ info ->blacklisted == true ) {
47+ die (SITE_NAME . ' is blacklisted from using this module, Contact us at https://partydragen.com ' );
48+ }
49+
50+ return $ update_check ;
51+ }
52+ }
0 commit comments