diff --git a/frontend/classes/class.controller.php b/frontend/classes/controller.php similarity index 100% rename from frontend/classes/class.controller.php rename to frontend/classes/controller.php diff --git a/frontend/classes/class.iprange.php b/frontend/classes/iprange.php similarity index 100% rename from frontend/classes/class.iprange.php rename to frontend/classes/iprange.php diff --git a/frontend/classes/class.node.php b/frontend/classes/node.php similarity index 100% rename from frontend/classes/class.node.php rename to frontend/classes/node.php diff --git a/frontend/classes/class.sshconnector.php b/frontend/classes/sshconnector.php similarity index 100% rename from frontend/classes/class.sshconnector.php rename to frontend/classes/sshconnector.php diff --git a/frontend/classes/class.template.php b/frontend/classes/template.php similarity index 100% rename from frontend/classes/class.template.php rename to frontend/classes/template.php diff --git a/frontend/classes/class.user.php b/frontend/classes/user.php similarity index 100% rename from frontend/classes/class.user.php rename to frontend/classes/user.php diff --git a/frontend/classes/class.container.php b/frontend/classes/vps.php similarity index 100% rename from frontend/classes/class.container.php rename to frontend/classes/vps.php diff --git a/frontend/includes/include.base.php b/frontend/includes/include.base.php index 0721097..6fc6e15 100644 --- a/frontend/includes/include.base.php +++ b/frontend/includes/include.base.php @@ -22,12 +22,18 @@ require("include.constants.php"); require("include.parsing.php"); require("include.misc.php"); -/* TODO: Reorganize and autoloading. */ -require("classes/class.user.php"); -require("classes/class.controller.php"); -require("classes/class.container.php"); -require("classes/class.node.php"); -require("classes/class.template.php"); -require("classes/class.sshconnector.php"); -require("classes/class.iprange.php"); -?> +function __autoload($class_name) +{ + global $_CVM; + + if(strpos($class_name, "\\") !== false) + { + $class_name = str_replace("\\", "/", strtolower($class_name)); + require_once("classes/{$class_name}.php"); + } + else + { + $class_name = strtolower($class_name); + require_once("classes/{$class_name}.php"); + } +}