X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/fae5cd150c35b3f9669372e87da8d13415a4bf19..f849e0c715b70742a92d1312c2a8eac6cc4336c4:/Classes/class-plugin-git.php diff --git a/Classes/class-plugin-git.php b/Classes/class-plugin-git.php index 232fc20..04fa44c 100644 --- a/Classes/class-plugin-git.php +++ b/Classes/class-plugin-git.php @@ -1,62 +1,75 @@ 200) // Cache for 3.333 minutes lol + { + // come simba it is taem + $curl = curl_init($url); + + // Set the options + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Return the response instead of printing it + curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); // Set the content type to JSON + curl_setopt($curl, CURLOPT_USERAGENT, "UnrealIRCd Admin Panel"); // This is Secret Agent UnrealIRCd Admin Panel reporting for doody + // Execute the request + $response = curl_exec($curl); + + // Check for errors + if ($response === false) + $this->err = curl_error($curl); + else { - $config['third-party-plugins']['data'] = NULL; - $config['third-party-plugins']['timestamp'] = 0; + $this->data = json_decode($response, false); + $config['third-party-plugins']['data'] = $this->data; + $config['third-party-plugins']['timestamp'] = time(); + write_config('third-party-plugins'); } - if (time() - $config['third-party-plugins']['timestamp'] > 200) // Cache for 3.333 minutes lol - { - // come simba it is taem - $curl = curl_init($url); - - // Set the options - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Return the response instead of printing it - curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); // Set the content type to JSON - curl_setopt($curl, CURLOPT_USERAGENT, "UnrealIRCd Admin Panel"); // This is Secret Agent UnrealIRCd Admin Panel reporting for doody - // Execute the request - $response = curl_exec($curl); + } + else + $this->data = $config['third-party-plugins']['data']; - // Check for errors - if ($response === false) - $this->err = curl_error($curl); - else - { - $this->data = json_decode($response, false); - $config['third-party-plugins']['data'] = $this->data; - $config['third-party-plugins']['timestamp'] = time(); - write_config('third-party-plugins'); - } - } - else - $this->data = $config['third-party-plugins']['data']; - - } + } - public function ifInstalledLabel($name, $installed = false) + public function ifInstalledLabel($name, $installed = false) + { + if ($installed) + { ?> +
✔ Installed
+ + ?>
✔ Installed
- -
✔ Installed
- minver <= $wpversion) + { ?> +
Compatible
+ +
Incompatible
+err) die("Could not fetch list.\n"); - global $config; + ?>
data as $p) + foreach($this->data->list as $p) { + $tok = split(WEBPANEL_VERSION,"-"); + $upgradeRequired = false; + $wpversion = $tok[0]; + if ($p->minver > $wpversion) + $upgradeRequired = true; $installed = in_array($p->name, $config['plugins']) ? true : false; - if (is_string($p)) continue; @@ -90,9 +107,9 @@
-
ifInstalledLabel($p->name); ?>
+
ifInstalledLabel($p->name); $this->ifCompatible($p) ?>

title ?>

- By email" ?>" target="_blank">author ?> + By contact" ?>" target="_blank">author ?>
@@ -100,17 +117,21 @@
title ?> vversion ?>
-

description ?>

+

description ?>

-