]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - plugins.php
Add Plugins: remove author from card footer
[irc/unrealircd/unrealircd-webpanel.git] / plugins.php
index de3307e1af6f4d87259ad04e79425dc7d4f5f652..225d144050226e86fc085166fa9ad10ce00bfa4f 100644 (file)
@@ -1,9 +1,5 @@
 <?php
-
-require_once "config.php";
-
-require_once "common.php";
-
+require_once "inc/common.php";
 require_once "Classes/class-message.php";
 
 
@@ -46,6 +42,15 @@ class Plugins
                        self::$list[] = $plugin;
                }
        }
+       static function plugin_exists($name, $version = NULL)
+       {
+               foreach(self::$list as $p)
+                       if (!strcmp($p->name,$name) && (!$version || ($version >= $p->version)))
+                               return true;
+
+               return false;
+       }
+
 }
 
 class Plugin
@@ -101,8 +106,26 @@ class Plugin
        }
 }
 
-if (defined('PLUGINS'))
+if (get_config("plugins"))
 {
-       foreach(PLUGINS as $plugin)
+       foreach(get_config("plugins") as $plugin)
                Plugins::load($plugin);
-}
\ No newline at end of file
+}
+
+/* Requires the plugin */
+function require_plugin($name, $version)
+{
+       if (!Plugins::plugin_exists($name,$version))
+               die("Missing plugin: $name v$version");
+}
+
+/* I'm not a fan of globals */
+class AuthModLoaded
+{
+       public static $status = 0;
+}
+
+function is_auth_provided()
+{
+       return AuthModLoaded::$status;
+}