]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - Classes/class-plugin-git.php
Shut up some errors
[irc/unrealircd/unrealircd-webpanel.git] / Classes / class-plugin-git.php
index 8b128be5fe0d585c5679791bbd79d931188ac5c6..4bf9dabceda50d38e340d00dc33633a139fdc0b0 100644 (file)
@@ -1,5 +1,5 @@
 <?php
 <?php
-       define('DEFAULT_PLUGINS_DIR', 'https://api.dalek.services/plugins.list');
+       define('DEFAULT_PLUGINS_DIR', 'https://api.valware.uk/plugins.list');
        
 class PluginRepo
 {
        
 class PluginRepo
 {
@@ -10,6 +10,10 @@ class PluginRepo
     {
         global $config;
         if (!isset($config['third-party-plugins']))
     {
         global $config;
         if (!isset($config['third-party-plugins']))
+        {
+            $config['third-party-plugins'] = [];
+        }
+        if (empty($config['third-party-plugins']))
         {
             $config['third-party-plugins']['data'] = NULL;
             $config['third-party-plugins']['timestamp'] = 0;
         {
             $config['third-party-plugins']['data'] = NULL;
             $config['third-party-plugins']['timestamp'] = 0;
@@ -67,7 +71,7 @@ class PluginRepo
 <?php   }
         else
         {   ?>
 <?php   }
         else
         {   ?>
-            <div style="margin-left:40px;" class="badge rounded-pill badge-danger">Inompatible</div>
+            <div style="margin-left:40px;" class="badge rounded-pill badge-danger">Incompatible</div>
 <?php   }
     }
 
 <?php   }
     }
 
@@ -79,15 +83,16 @@ class PluginRepo
         if ($this->err)
             die("Could not fetch list.\n");
 
         if ($this->err)
             die("Could not fetch list.\n");
 
-        global $config;
             ?>
                <div class="row">
             ?>
                <div class="row">
-            <?php     
-        $counter = 0;
-
-
+            <?php
         foreach($this->data->list 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;
             $installed = in_array($p->name, $config['plugins']) ? true : false;
             if (is_string($p))
                 continue;
@@ -121,23 +126,17 @@ class PluginRepo
                     <div id="justALonelyEmptyDivCryEmoji"></div>
                     <div>
                         <div id="<?php echo $p->name ?>" class="more-info btn btn-info">More Info</div>
                     <div id="justALonelyEmptyDivCryEmoji"></div>
                     <div>
                         <div id="<?php echo $p->name ?>" class="more-info btn btn-info">More Info</div>
-                        <div id="<?php echo $p->name ?>install" class="btn-install-plugin btn btn-primary">Install</div>
+                        <?php if ($upgradeRequired){
+                            ?>
+                                <div id="<?php echo $p->name ?>coming-soon" class="btn-coming-soon btn btn-dark disabled">Panel Upgrade Required</div>
+                            <?php
+                        }
+                        ?>
+                        <div id="<?php echo $p->name ?>install" <?php if ($upgradeRequired) echo 'style="display:none" '; ?> class="btn-install-plugin btn btn-primary">Install</div>
                     </div>
                 </div>
             </div>
             <?php
                     </div>
                 </div>
             </div>
             <?php
-                /** only do three per row.
-                 *  WARNING: untested due to not having more than 2 plugins atm...
-                */
-                if ($counter >= 3)
-                {
-                    ?><!-- New row please mr html -->
-                        </div>
-                        <div class="row"> 
-                    <?php
-                    $counter = 0;
-                }
-                $counter++;
 
 
             }
 
 
             }