Parcourir la source

new version 3.1.1

andre il y a 4 ans
Parent
commit
71e4723ba4

+ 218 - 272
app/UI/Admin/Product/Providers/ProductProvider.php

@@ -46,12 +46,11 @@ class ProductProvider extends BaseDataProvider implements AdminArea
     use ApiService;
     use ProductService;
 
-    private $productId;
-
     /**
      * @var ProductConfigurationRepository
      */
     protected $configuration;
+    private $productId;
     /**
      * @var Node
      */
@@ -63,27 +62,24 @@ class ProductProvider extends BaseDataProvider implements AdminArea
      */
     public function __construct($productId)
     {
-        if (!is_numeric($productId))
-        {
+        if (!is_numeric($productId)) {
             throw new \InvalidArgumentException("The product id must be definded.");
         }
         $this->configuration = new ProductConfigurationRepository($productId);
-        $this->productId     = $productId;
+        $this->productId = $productId;
     }
 
     public function isSupportedModule()
     {
         return Product::where("id", $this->configuration->getProductId())
-                   ->where("servertype", "proxmoxVPS")->count() == 1;
+                ->where("servertype", "proxmoxVPS")->count() == 1;
     }
 
     public function read()
     {
-        foreach ($this->configuration->all() as $key => $value)
-        {
+        foreach ($this->configuration->all() as $key => $value) {
             //multiselect
-            if (is_array($value))
-            {
+            if (is_array($value)) {
                 $this->data[sprintf("customconfigoption[%s][]", $key)] = $value;
                 continue;
             }
@@ -91,13 +87,10 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         }
         $this->initApi();
         $this->defaultRead();
-        if (!$this->configuration->getVirtualization() || $this->configuration->isQemu())
-        {
+        if (!$this->configuration->getVirtualization() || $this->configuration->isQemu()) {
             //kvm
             $this->qemuRead();
-        }
-        else
-        {
+        } else {
             //lxc
             $this->lxcRead();
         }
@@ -105,7 +98,7 @@ class ProductProvider extends BaseDataProvider implements AdminArea
 
     private function initApi()
     {
-        $lang    = sl("lang");
+        $lang = sl("lang");
         $product = Product::where("id", $this->productId)->firstOrFail();
         sl("whmcsParams")->setParams($product->getParams());
     }
@@ -117,47 +110,39 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         $this->availableValues["customconfigoption[virtualization]"] = ["qemu" => $lang->tr("KVM"), "lxc" => $lang->tr("LXC")];
         //Default Node
         $this->availableValues["customconfigoption[defaultNode]"] = ["serverNode" => $lang->tr('Server-Node'), "autoNode" => $lang->tr('Auto-Node')];
-        $nodeRepository                                           = new NodeRepository();
+        $nodeRepository = new NodeRepository();
         $nodeRepository->setApi($this->api());
         $nodeRepository->findOnline(true);
-        foreach ($nodeRepository->fetch() as $node)
-        {
+        foreach ($nodeRepository->fetch() as $node) {
             $this->availableValues["customconfigoption[defaultNode]"][$node->getNode()] = $node->getNode();
         }
         //realm
-        foreach ($this->api()->get("/access/domains") as $d)
-        {
-            if (!$d['realm'])
-            {
+        foreach ($this->api()->get("/access/domains") as $d) {
+            if (!$d['realm']) {
                 continue;
             }
             $this->availableValues["customconfigoption[realm]"][$d['realm']] = $lang->tr($d['comment']);
         }
         //userRole
-        foreach ($this->api()->get("/access/roles") as $r)
-        {
-            if (!$r['roleid'])
-            {
+        foreach ($this->api()->get("/access/roles") as $r) {
+            if (!$r['roleid']) {
                 continue;
             }
             $this->availableValues["customconfigoption[userRole]"][$r['roleid']] = $lang->tr($r['roleid']);
         }
         //welcomeEmailTemplateId
         $this->availableValues["customconfigoption[welcomeEmailTemplateId]"][0] = "";
-        foreach (EmailTemplate::where('type', "product")->pluck("name", "id")->all() as $key => $value)
-        {
+        foreach (EmailTemplate::where('type', "product")->pluck("name", "id")->all() as $key => $value) {
             $this->availableValues["customconfigoption[welcomeEmailTemplateId]"][$key] = $value;
         }
         //reinstallEmailTemplateId
         $this->availableValues["customconfigoption[reinstallEmailTemplateId]"][0] = "";
-        foreach (EmailTemplate::where('type', "product")->pluck("name", "id")->all() as $key => $value)
-        {
+        foreach (EmailTemplate::where('type', "product")->pluck("name", "id")->all() as $key => $value) {
             $this->availableValues["customconfigoption[reinstallEmailTemplateId]"][$key] = $value;
         }
         //upgradeNotificationTemplateId
         $this->availableValues["customconfigoption[serviceCreationFailedTemplateId]"][0] = "";
-        foreach (EmailTemplate::where('type', "admin")->where("custom", 1)->pluck("name", "id")->all() as $key => $value)
-        {
+        foreach (EmailTemplate::where('type', "admin")->where("custom", 1)->pluck("name", "id")->all() as $key => $value) {
             $this->availableValues["customconfigoption[serviceCreationFailedTemplateId]"][$key] = $value;
         }
         //upgradeNotificationTemplateId
@@ -165,25 +150,20 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         //loadBalancerOnUpgrade
         $this->availableValues["customconfigoption[loadBalancerOnUpgrade]"] = ['0' => $lang->tr('None'), "block" => $lang->tr("Block"), "migrate" => $lang->tr("Migrate")];
         //backupStorage
-        if (in_array($this->configuration->getDefaultNode(), $this->availableValues["customconfigoption[defaultNode]"]))
-        {
+        if (in_array($this->configuration->getDefaultNode(), $this->availableValues["customconfigoption[defaultNode]"])) {
             $this->node = new Node($this->configuration->getDefaultNode());
-        }
-        else
-        {//"Auto-Node" or 'Server-Node' or empty
+        } else {//"Auto-Node" or 'Server-Node' or empty
 
-            $servePrivateIP =  $this->getServerPrivateIpAddress();
+            $servePrivateIP = $this->getServerPrivateIpAddress();
             $serverIp = $servePrivateIP ? $servePrivateIP : $this->getWhmcsParamByKey('serverip');
-            $this->node = $nodeRepository->findWithHostOrIp($this->getWhmcsParamByKey('serverhostname'), $serverIp );
+            $this->node = $nodeRepository->findWithHostOrIp($this->getWhmcsParamByKey('serverhostname'), $serverIp);
         }
         $this->node->setApi($this->api());
         $storageRepository = new StorageRepository();
         $storageRepository->findByNodes([$this->node->getNode()])
             ->findEnabed();
-        foreach ($storageRepository->fetch() as $entity)
-        {
-            if (!in_array("backup", $entity->getContentAsArray()))
-            {
+        foreach ($storageRepository->fetch() as $entity) {
+            if (!in_array("backup", $entity->getContentAsArray())) {
                 continue;
             }
             $this->availableValues["customconfigoption[backupStorage]"] [$entity->getStorage()] = $lang->tr($entity->getStorage());
@@ -194,42 +174,38 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         $this->availableValues["customconfigoption[firewallInterfaces][]"] = ["venet" => $lang->tr("venet"), "eth" => $lang->tr("eth\d+")];
         //clusterGroup
         $this->availableValues["customconfigoption[clusterGroup]"] = ['' => ""];
-        foreach ($this->api()->get('/cluster/ha/groups') as $g)
-        {
+        foreach ($this->api()->get('/cluster/ha/groups') as $g) {
             $this->availableValues["customconfigoption[clusterGroup]"][$g['group']] = ucfirst($g['group']);
         }
         //suspensionAction
         $this->availableValues["customconfigoption[suspensionAction]"] = ['0' => $lang->tr('Default'), "stop" => $lang->tr('Stop VM'), 'shutdown' => $lang->tr('Shutdown VM')];
-        if ($this->configuration()->isQemu())
-        {
+        if ($this->configuration()->isQemu()) {
             $this->availableValues["customconfigoption[suspensionAction]"]["suspend"] = $lang->tr("Pause VM");
             $this->availableValues["customconfigoption[suspensionAction]"]["hibernate"] = $lang->tr("Hibernate VM");
         }
         //tag
         $this->availableValues["customconfigoption[tags][]"];
-        foreach (IpAddress::select("tag")->whereNotNull("tag")->where("tag", ">", 0)->groupBy("tag")->pluck("tag")->all() as $tag)
-        {
+        foreach (IpAddress::select("tag")->whereNotNull("tag")->where("tag", ">", 0)->groupBy("tag")->pluck("tag")->all() as $tag) {
             $this->availableValues["customconfigoption[tags][]"][$tag] = $tag;
         }
         //pool
-        $this->availableValues["customconfigoption[pool]"]=[""];
-        foreach ($this->api()->get('/pools') as $pool)
-        {
+        $this->availableValues["customconfigoption[pool]"] = [""];
+        foreach ($this->api()->get('/pools') as $pool) {
             $this->availableValues["customconfigoption[pool]"][$pool['poolid']] = $lang->tr($pool['poolid']);
         }
         //permissionSnapshotJobPeriod
         $this->availableValues["customconfigoption[permissionSnapshotJobPeriod][]"] = [
             JobPeriod::HOURLY => $lang->tr(JobPeriod::HOURLY),
-            JobPeriod::DAILY => $lang->tr(JobPeriod::DAILY )
+            JobPeriod::DAILY => $lang->tr(JobPeriod::DAILY)
         ];
         //permissionFirewalOptions
         $this->availableValues["customconfigoption[permissionFirewalOptions][]"] = [
             "enable" => $lang->abtr("Enable/Disable Firewall"),
-            "dhcp"  => $lang->abtr("DHCP"),
-            "radv"  => $lang->abtr("Allow Router Advertisement"),
-            "ndp"  => $lang->abtr("NDP"),
-            "macfilter"  => $lang->abtr("MAC Filter"),
-            "ipfilter"  => $lang->abtr("IP Filter"),
+            "dhcp" => $lang->abtr("DHCP"),
+            "radv" => $lang->abtr("Allow Router Advertisement"),
+            "ndp" => $lang->abtr("NDP"),
+            "macfilter" => $lang->abtr("MAC Filter"),
+            "ipfilter" => $lang->abtr("IP Filter"),
         ];
     }
 
@@ -238,137 +214,120 @@ class ProductProvider extends BaseDataProvider implements AdminArea
      */
     private function qemuRead()
     {
-            $lang = sl("lang");
-            //ostype
-            $ostype = new Json('ostype.json', ModuleConstants::getFullPathWhmcs('modules', 'addons', 'proxmoxAddon', 'storage', 'app'));
-            foreach ($ostype->get() as $k => $ostype)
-            {
-                $this->availableValues["customconfigoption[ostype]"][$k] = $lang->tr($ostype);
-            }
-            //hotplug
-            $this->availableValues["customconfigoption[hotplug][]"] = [ "disk" => $lang->tr('disk'), "network" => $lang->tr('network'),  "usb" => $lang->tr('usb'),  "cpu" => $lang->tr('cpu'),   "memory" => $lang->tr('memory')];
-            //keyboard
-            $this->availableValues["customconfigoption[keyboard]"] = ['', 'pt' => $lang->tr('pt'), "tr" => $lang->tr('tr'), 'ja' => $lang->tr('ja'), 'es'  => $lang->tr('es'), 'no' => $lang->tr('no'), 'is' => $lang->tr('is'), 'fr-ca' => $lang->tr('fr-ca'), 'fr' => $lang->tr('fr'), 'pt-br' => $lang->tr('pt-br'),  'da' => $lang->tr('da'), 'fr-ch' => $lang->tr('fr-ch'),  'sl' => $lang->tr('sl'),  'de-ch' => $lang->tr('de-ch'), 'en-gb' => $lang->tr('en-gb'), 'it' => $lang->tr('it'), 'en-us' => $lang->tr('en-us'), 'fr-be' => $lang->tr('fr-be'), 'hu' => $lang->tr('hu'),  'pl'=> $lang->tr('pl'), 'nl' => $lang->tr('nl'), 'mk' => $lang->tr('mk'), 'fi' => $lang->tr('fi'), 'lt' => $lang->tr('lt'), 'sv'=> $lang->tr('sv'), 'de' => $lang->tr('de')];
-            //vga
-            $this->availableValues["customconfigoption[vga]"] = [
-                "std"     => $lang->tr("Standard VGA"),
-                "cirrus"  => $lang->tr("Cirrus Logic"),
-                "vmware"  => $lang->tr("VMWare"),
-                "serial0" => $lang->tr("Serial terminal 0"),
-                "serial1" => $lang->tr("Serial terminal 1"),
-                "serial2" => $lang->tr("Serial terminal 2"),
-                "serial3" => $lang->tr("Serial terminal 3"),
-                "qxl"     => $lang->tr("SPICE"),
-                "qxl2"    => $lang->tr("SPICE dual monitor"),
-                "qxl3"    => $lang->tr("SPICE three monitor"),
-                "qxl4"    => $lang->tr("SPICE four monitor"),
-            ];
-            //clientNameForContainer
-            $this->availableValues["customconfigoption[clientNameForContainer]"] = [
-                0                             => 'No',
-                "emptyHostnameOnly"           => 'Yes  [only when hostname is empty]',
-                "overwriteHostname"           => 'Yes [overwrite hostname] ',
-                "overwriteHostnameWithPrefix" => 'Yes [overwrite hostname with container prefix and service id] ',
-            ];
-            //cloneMode
-            $this->availableValues["customconfigoption[cloneMode]"] = ['1' => $lang->tr('Full Clone'), "0" => $lang->tr("Linked Clone")];
-            //diskStorage images (Disk Images)
-            $storageRepository = new StorageRepository();
-            $storageRepository->findByNodes([$this->node->getNode()])
-                ->findEnabed();
-            foreach ($storageRepository->fetch() as $entity)
-            {
-                if (!in_array("images", $entity->getContentAsArray()))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[diskStorage]"] [$entity->getStorage()]           = $lang->tr($entity->getStorage());
-                $this->availableValues["customconfigoption[additionalDiskStorage]"] [$entity->getStorage()] = $lang->tr($entity->getStorage());
-            }
-            //diskType
-            $this->availableValues["customconfigoption[diskType]"] = ["ide" => $lang->tr('IDE'), "sata" => $lang->tr('SATA'), "virtio" => $lang->tr('VIRTIO'), "scsi" => $lang->tr('SCSI')];
-            //diskFormat
-            $this->availableValues["customconfigoption[diskFormat]"] = ['raw' => $lang->tr('Raw disk image (raw)'), 'qcow2' => $lang->tr('QEMU image format (qcow2)'), 'vmdk' => $lang->tr('VM image format (vmdk)')];
-            //diskCache
-            $this->availableValues["customconfigoption[diskCache]"] = ['none' => $lang->tr('Default (No Cache)'), 'writethrough' => $lang->tr('Write Through'), 'writeback' => $lang->tr('Write Back'), 'unsafe' => $lang->tr('Write Back (Unsafe)'), 'directsync' => $lang->tr('Direct Sync')];
-            //scsihw
-            $this->availableValues["customconfigoption[scsihw]"] = [
-                '0' => $lang->abtr('Default (LSI 53C895A)'),
-                "lsi" => $lang->abtr('LSI 53C895A'),
-                "lsi53c810" => $lang->abtr('LSI 53C810'),
-                'virtio-scsi-pci' => $lang->abtr('VirtIO SCSI'),
-                "virtio-scsi-single" => $lang->abtr('VirtIO SCSI single'),
-                'megasas' => $lang->abtr('MegaRAID SAS 8708EM2'),
-                "pvscsi" => $lang->abtr('VMware PVSCSI'),
-           ];
-            //additionalDiskStorage
-            $this->availableValues["customconfigoption[additionalDiskStorage]"] = $this->availableValues["customconfigoption[diskStorage]"];
-            //additionalDiskType
-            $this->availableValues["customconfigoption[additionalDiskType][]"] = $this->availableValues["customconfigoption[diskType]"];
-            //additionalDiskFormat
-            $this->availableValues["customconfigoption[additionalDiskFormat][]"] = $this->availableValues["customconfigoption[diskFormat]"];
-            if($this->configuration->getAdditionalDiskStorage() && preg_match("/lvm/", $this->configuration->getAdditionalDiskStorage() )){
-                $this->disabledList["customconfigoption[additionalDiskFormat][]"] = ['qcow2', 'vmdk'];
-            }
-            //additionalDiskCache
-            $this->availableValues["customconfigoption[additionalDiskCache]"] =  $this->availableValues["customconfigoption[diskCache]"];
-            //networkModel
-            $this->availableValues["customconfigoption[networkModel]"] = ['e1000' => $lang->tr('e1000'), 'i82551' => $lang->tr('i82551'), 'i82557b' => $lang->tr('i82557b'), 'i82559er' => $lang->tr('i82559er'), 'ne2k_isa' => $lang->tr('ne2k_isa'), 'ne2k_pci' => $lang->tr('ne2k_pci'), 'pcnet' => $lang->tr('pcnet'), 'rtl8139' => $lang->tr('rtl8139'), 'virtio' => $lang->tr('virtio'), 'vmxnet3' => $lang->tr('vmxnet3')];
-            //bridge
-            foreach ($this->api()->get("/nodes/{$this->node->getNode()}/network") as $network)
-            {
-                if (!in_array($network['type'], ['bridge', 'OVSBridge']))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[bridge]"] [$network['iface']] = $lang->tr($network['iface']);
+        $lang = sl("lang");
+        //ostype
+        $ostype = new Json('ostype.json', ModuleConstants::getFullPathWhmcs('modules', 'addons', 'proxmoxAddon', 'storage', 'app'));
+        foreach ($ostype->get() as $k => $ostype) {
+            $this->availableValues["customconfigoption[ostype]"][$k] = $lang->tr($ostype);
+        }
+        //hotplug
+        $this->availableValues["customconfigoption[hotplug][]"] = ["disk" => $lang->tr('disk'), "network" => $lang->tr('network'), "usb" => $lang->tr('usb'), "cpu" => $lang->tr('cpu'), "memory" => $lang->tr('memory')];
+        //keyboard
+        $this->availableValues["customconfigoption[keyboard]"] = ['', 'pt' => $lang->tr('pt'), "tr" => $lang->tr('tr'), 'ja' => $lang->tr('ja'), 'es' => $lang->tr('es'), 'no' => $lang->tr('no'), 'is' => $lang->tr('is'), 'fr-ca' => $lang->tr('fr-ca'), 'fr' => $lang->tr('fr'), 'pt-br' => $lang->tr('pt-br'), 'da' => $lang->tr('da'), 'fr-ch' => $lang->tr('fr-ch'), 'sl' => $lang->tr('sl'), 'de-ch' => $lang->tr('de-ch'), 'en-gb' => $lang->tr('en-gb'), 'it' => $lang->tr('it'), 'en-us' => $lang->tr('en-us'), 'fr-be' => $lang->tr('fr-be'), 'hu' => $lang->tr('hu'), 'pl' => $lang->tr('pl'), 'nl' => $lang->tr('nl'), 'mk' => $lang->tr('mk'), 'fi' => $lang->tr('fi'), 'lt' => $lang->tr('lt'), 'sv' => $lang->tr('sv'), 'de' => $lang->tr('de')];
+        //vga
+        $jsonData = new Json('vga.json', ModuleConstants::getFullPathWhmcs('modules', 'addons', 'proxmoxAddon', 'storage', 'app'));
+        foreach ($jsonData->get() as $k => $name) {
+            $this->availableValues["customconfigoption[vga]"][$k] = $lang->tr($name);
+        }
+        //clientNameForContainer
+        $this->availableValues["customconfigoption[clientNameForContainer]"] = [
+            0 => 'No',
+            "emptyHostnameOnly" => 'Yes  [only when hostname is empty]',
+            "overwriteHostname" => 'Yes [overwrite hostname] ',
+            "overwriteHostnameWithPrefix" => 'Yes [overwrite hostname with container prefix and service id] ',
+        ];
+        //cloneMode
+        $this->availableValues["customconfigoption[cloneMode]"] = ['1' => $lang->tr('Full Clone'), "0" => $lang->tr("Linked Clone")];
+        //diskStorage images (Disk Images)
+        $storageRepository = new StorageRepository();
+        $storageRepository->findByNodes([$this->node->getNode()])
+            ->findEnabed();
+        foreach ($storageRepository->fetch() as $entity) {
+            if (!in_array("images", $entity->getContentAsArray())) {
+                continue;
             }
-            ksort($this->availableValues["customconfigoption[bridge]"]);
-            //privateBridge
-            $this->availableValues["customconfigoption[privateBridge]"] = ['0' => ""] + (array)  $this->availableValues["customconfigoption[bridge]"];
-            //networkPrivateModel
-            $this->availableValues["customconfigoption[networkPrivateModel]"] = $this->availableValues["customconfigoption[networkModel]"];
-            //bootDevice1
-            $this->availableValues["customconfigoption[bootDevice1]"] = ['', 'c' => $lang->tr('Hard Disk'), 'd' => $lang->tr('CD-ROM'), 'n' => $lang->tr('Network')];
-            //bootDevice2
-            $this->availableValues["customconfigoption[bootDevice2]"] = $this->availableValues["customconfigoption[bootDevice1]"];
-            //bootDevice3
-            $this->availableValues["customconfigoption[bootDevice3]"] = $this->availableValues["customconfigoption[bootDevice1]"];
-            //permissionOsTemplates
-            $clusterResourcesRepository = new ClusterResourcesRepository();
-            $clusterResourcesRepository->setApi($this->api());
-            $clusterResourcesRepository->findKvmTemplate();
-            foreach ($clusterResourcesRepository->fetch() as $resurce)
-            {
-                if (preg_match('/^custom[0-9]*/', $resurce->getName()))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[permissionOsTemplates][]"][$resurce->getName()] = $lang->tr($resurce->getName());
+            $this->availableValues["customconfigoption[diskStorage]"] [$entity->getStorage()] = $lang->tr($entity->getStorage());
+            $this->availableValues["customconfigoption[additionalDiskStorage]"] [$entity->getStorage()] = $lang->tr($entity->getStorage());
+        }
+        //diskType
+        $this->availableValues["customconfigoption[diskType]"] = ["ide" => $lang->tr('IDE'), "sata" => $lang->tr('SATA'), "virtio" => $lang->tr('VIRTIO'), "scsi" => $lang->tr('SCSI')];
+        //diskFormat
+        $this->availableValues["customconfigoption[diskFormat]"] = ['raw' => $lang->tr('Raw disk image (raw)'), 'qcow2' => $lang->tr('QEMU image format (qcow2)'), 'vmdk' => $lang->tr('VM image format (vmdk)')];
+        //diskCache
+        $this->availableValues["customconfigoption[diskCache]"] = ['none' => $lang->tr('Default (No Cache)'), 'writethrough' => $lang->tr('Write Through'), 'writeback' => $lang->tr('Write Back'), 'unsafe' => $lang->tr('Write Back (Unsafe)'), 'directsync' => $lang->tr('Direct Sync')];
+        //scsihw
+        $this->availableValues["customconfigoption[scsihw]"] = [
+            '0' => $lang->abtr('Default (LSI 53C895A)'),
+            "lsi" => $lang->abtr('LSI 53C895A'),
+            "lsi53c810" => $lang->abtr('LSI 53C810'),
+            'virtio-scsi-pci' => $lang->abtr('VirtIO SCSI'),
+            "virtio-scsi-single" => $lang->abtr('VirtIO SCSI single'),
+            'megasas' => $lang->abtr('MegaRAID SAS 8708EM2'),
+            "pvscsi" => $lang->abtr('VMware PVSCSI'),
+        ];
+        //additionalDiskStorage
+        $this->availableValues["customconfigoption[additionalDiskStorage]"] = $this->availableValues["customconfigoption[diskStorage]"];
+        //additionalDiskType
+        $this->availableValues["customconfigoption[additionalDiskType][]"] = $this->availableValues["customconfigoption[diskType]"];
+        //additionalDiskFormat
+        $this->availableValues["customconfigoption[additionalDiskFormat][]"] = $this->availableValues["customconfigoption[diskFormat]"];
+        if ($this->configuration->getAdditionalDiskStorage() && preg_match("/lvm/", $this->configuration->getAdditionalDiskStorage())) {
+            $this->disabledList["customconfigoption[additionalDiskFormat][]"] = ['qcow2', 'vmdk'];
+        }
+        //additionalDiskCache
+        $this->availableValues["customconfigoption[additionalDiskCache]"] = $this->availableValues["customconfigoption[diskCache]"];
+        //networkModel
+        $this->availableValues["customconfigoption[networkModel]"] = ['e1000' => $lang->tr('e1000'), 'i82551' => $lang->tr('i82551'), 'i82557b' => $lang->tr('i82557b'), 'i82559er' => $lang->tr('i82559er'), 'ne2k_isa' => $lang->tr('ne2k_isa'), 'ne2k_pci' => $lang->tr('ne2k_pci'), 'pcnet' => $lang->tr('pcnet'), 'rtl8139' => $lang->tr('rtl8139'), 'virtio' => $lang->tr('virtio'), 'vmxnet3' => $lang->tr('vmxnet3')];
+        //bridge
+        foreach ($this->api()->get("/nodes/{$this->node->getNode()}/network") as $network) {
+            if (!in_array($network['type'], ['bridge', 'OVSBridge'])) {
+                continue;
             }
-            //osTemplate
-            $this->availableValues["customconfigoption[osTemplate]"] = ['0' => ""] + (array) $this->availableValues["customconfigoption[permissionOsTemplates][]"];
-            //permissionIsoImage
-            $fileRepository = new FileRepository();
-            $fileRepository->setApi($this->api());
-            $fileRepository->findIso();
-            $fileRepository->findByNode($this->node);
-            $fileRepository->findByStorages($storageRepository->fetchAsArray());
-            foreach ($fileRepository->fetch() as $file)
-            {
-                $this->availableValues["customconfigoption[permissionIsoImages][]"][$file->getVolid()] = $lang->tr($file->getFriendlyName());
+            $this->availableValues["customconfigoption[bridge]"] [$network['iface']] = $lang->tr($network['iface']);
+        }
+        ksort($this->availableValues["customconfigoption[bridge]"]);
+        //privateBridge
+        $this->availableValues["customconfigoption[privateBridge]"] = ['0' => ""] + (array)$this->availableValues["customconfigoption[bridge]"];
+        //networkPrivateModel
+        $this->availableValues["customconfigoption[networkPrivateModel]"] = $this->availableValues["customconfigoption[networkModel]"];
+        //bootDevice1
+        $this->availableValues["customconfigoption[bootDevice1]"] = ['', 'c' => $lang->tr('Hard Disk'), 'd' => $lang->tr('CD-ROM'), 'n' => $lang->tr('Network')];
+        //bootDevice2
+        $this->availableValues["customconfigoption[bootDevice2]"] = $this->availableValues["customconfigoption[bootDevice1]"];
+        //bootDevice3
+        $this->availableValues["customconfigoption[bootDevice3]"] = $this->availableValues["customconfigoption[bootDevice1]"];
+        //permissionOsTemplates
+        $clusterResourcesRepository = new ClusterResourcesRepository();
+        $clusterResourcesRepository->setApi($this->api());
+        $clusterResourcesRepository->findKvmTemplate();
+        foreach ($clusterResourcesRepository->fetch() as $resurce) {
+            if (preg_match('/^custom[0-9]*/', $resurce->getName())) {
+                continue;
             }
-            //isoImage
-            $this->availableValues["customconfigoption[isoImage]"] = ["none" => $lang->tr("None")] + (array)$this->availableValues["customconfigoption[permissionIsoImages][]"];
+            $this->availableValues["customconfigoption[permissionOsTemplates][]"][$resurce->getName()] = $lang->tr($resurce->getName());
+        }
+        //osTemplate
+        $this->availableValues["customconfigoption[osTemplate]"] = ['0' => ""] + (array)$this->availableValues["customconfigoption[permissionOsTemplates][]"];
+        //permissionIsoImage
+        $fileRepository = new FileRepository();
+        $fileRepository->setApi($this->api());
+        $fileRepository->findIso();
+        $fileRepository->findByNode($this->node);
+        $fileRepository->findByStorages($storageRepository->fetchAsArray());
+        foreach ($fileRepository->fetch() as $file) {
+            $this->availableValues["customconfigoption[permissionIsoImages][]"][$file->getVolid()] = $lang->tr($file->getFriendlyName());
+        }
+        //isoImage
+        $this->availableValues["customconfigoption[isoImage]"] = ["none" => $lang->tr("None")] + (array)$this->availableValues["customconfigoption[permissionIsoImages][]"];
 
-            //memoryUnit
-            $this->availableValues["customconfigoption[memoryUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB")];
-            //diskUnit
-            $this->availableValues["customconfigoption[diskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
-            //additionalDiskUnit
-            $this->availableValues["customconfigoption[additionalDiskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
-            //cdromType
-            $this->availableValues["customconfigoption[cdromType]"] = $this->availableValues["customconfigoption[diskType]"];
+        //memoryUnit
+        $this->availableValues["customconfigoption[memoryUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB")];
+        //diskUnit
+        $this->availableValues["customconfigoption[diskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
+        //additionalDiskUnit
+        $this->availableValues["customconfigoption[additionalDiskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
+        //cdromType
+        $this->availableValues["customconfigoption[cdromType]"] = $this->availableValues["customconfigoption[diskType]"];
         //bios
         $this->availableValues["customconfigoption[bios]"] = [
             '0' => "",
@@ -377,17 +336,15 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         ];
         //cloudInitScript
         $this->availableValues["customconfigoption[cloudInitScript]"] =
-            CloudInitScript::pluck('name','id')->prepend("",0)->toArray();
+            CloudInitScript::pluck('name', 'id')->prepend("", 0)->toArray();
         //machine
         $jsonData = new Json('machine.json', ModuleConstants::getFullPathWhmcs('modules', 'addons', 'proxmoxAddon', 'storage', 'app'));
-        foreach ($jsonData->get() as $k => $name)
-        {
+        foreach ($jsonData->get() as $k => $name) {
             $this->availableValues["customconfigoption[machine]"][$k] = $lang->tr($name);
         }
         //cpu
         $jsonData = new Json('cpu.json', ModuleConstants::getFullPathWhmcs('modules', 'addons', 'proxmoxAddon', 'storage', 'app'));
-        foreach ($jsonData->get() as $k => $name)
-        {
+        foreach ($jsonData->get() as $k => $name) {
             $this->availableValues["customconfigoption[cpu]"][$k] = $lang->tr($name);
         }
     }
@@ -397,98 +354,87 @@ class ProductProvider extends BaseDataProvider implements AdminArea
      */
     private function lxcRead()
     {
-            $lang = sl("lang");
-            //storage
-            $storageRepository = new StorageRepository();
-            $storageRepository->findByNodes([$this->node->getNode()])
-                ->findEnabed();
-            foreach ($storageRepository->fetch() as $storage)
-            {
-                if (!in_array("rootdir", $storage->getContentAsArray()))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[storage]"][$storage->getStorage()] = $lang->tr($storage->getStorage());
-            }
-            //arch
-            $this->availableValues["customconfigoption[arch]"] = ['0' => "", 'amd64' => $lang->tr("AMD64"), $lang->tr("i386") => $lang->tr("i386")];
-            //cmode
-            $this->availableValues["customconfigoption[cmode]"] = ['0' => "", 'shell' => $lang->tr("shell"), "console" => $lang->tr("console"), "tty" => $lang->tr("tty")];
-            //ostype
-            $this->availableValues["customconfigoption[ostype]"] = ['0' => "", 'debian' => $lang->tr("Debian"), "ubuntu" => $lang->tr("Ubuntu"), "centos" => $lang->tr("centos"), "archlinux" => $lang->tr("Archlinux")];
-            //osTemplate
-            $fileRepository = new FileRepository();
-            $fileRepository->setApi($this->api());
-            $fileRepository->findLxcTemplates();
-            $fileRepository->findByNode($this->node);
-            $fileRepository->findByStorages($storageRepository->fetchAsArray());
-            foreach ($fileRepository->fetch() as $file)
-            {
-                $this->availableValues["customconfigoption[osTemplate]"][$file->getVolid()] = $lang->tr($file->getFriendlyName());
+        $lang = sl("lang");
+        //storage
+        $storageRepository = new StorageRepository();
+        $storageRepository->findByNodes([$this->node->getNode()])
+            ->findEnabed();
+        foreach ($storageRepository->fetch() as $storage) {
+            if (!in_array("rootdir", $storage->getContentAsArray())) {
+                continue;
             }
-            //memoryUnit
-            $this->availableValues["customconfigoption[memoryUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB")];
-            //diskUnit
-            $this->availableValues["customconfigoption[diskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
-            //additionalDiskUnit
-            $this->availableValues["customconfigoption[additionalDiskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
-            //persimonOsTemplates
-            $this->availableValues["customconfigoption[permissionOsTemplates][]"] = $this->availableValues["customconfigoption[osTemplate]"];
-            //mountPointStorage
-            foreach ($storageRepository->fetch() as $entity)
-            {
-                if (!in_array("rootdir", $entity->getContentAsArray()))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[mountPointStorage]"][$entity->getStorage()] = $lang->tr($entity->getStorage());
+            $this->availableValues["customconfigoption[storage]"][$storage->getStorage()] = $lang->tr($storage->getStorage());
+        }
+        //arch
+        $this->availableValues["customconfigoption[arch]"] = ['0' => "", 'amd64' => $lang->tr("AMD64"), $lang->tr("i386") => $lang->tr("i386")];
+        //cmode
+        $this->availableValues["customconfigoption[cmode]"] = ['0' => "", 'shell' => $lang->tr("shell"), "console" => $lang->tr("console"), "tty" => $lang->tr("tty")];
+        //ostype
+        $this->availableValues["customconfigoption[ostype]"] = ['0' => "", 'debian' => $lang->tr("Debian"), "ubuntu" => $lang->tr("Ubuntu"), "centos" => $lang->tr("centos"), "archlinux" => $lang->tr("Archlinux")];
+        //osTemplate
+        $fileRepository = new FileRepository();
+        $fileRepository->setApi($this->api());
+        $fileRepository->findLxcTemplates();
+        $fileRepository->findByNode($this->node);
+        $fileRepository->findByStorages($storageRepository->fetchAsArray());
+        foreach ($fileRepository->fetch() as $file) {
+            $this->availableValues["customconfigoption[osTemplate]"][$file->getVolid()] = $lang->tr($file->getFriendlyName());
+        }
+        //memoryUnit
+        $this->availableValues["customconfigoption[memoryUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB")];
+        //diskUnit
+        $this->availableValues["customconfigoption[diskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
+        //additionalDiskUnit
+        $this->availableValues["customconfigoption[additionalDiskUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
+        //persimonOsTemplates
+        $this->availableValues["customconfigoption[permissionOsTemplates][]"] = $this->availableValues["customconfigoption[osTemplate]"];
+        //mountPointStorage
+        foreach ($storageRepository->fetch() as $entity) {
+            if (!in_array("rootdir", $entity->getContentAsArray())) {
+                continue;
             }
-            //mountPointAcl
-            $this->availableValues["customconfigoption[mountPointAcl]"] = ["default" => $lang->tr('Default'), "1" => $lang->tr("On"), "0" => $lang->tr("Off")];
-            //ipv4NetworkMode
-            $this->availableValues["customconfigoption[ipv4NetworkMode]"] = ["static" => $lang->tr('Static'), "dhcp" => $lang->tr("DHCP")];
-            //ipv6NetworkMode
-            $this->availableValues["customconfigoption[ipv6NetworkMode]"] = ["static" => $lang->tr('Static'), "dhcp" => $lang->tr("DHCP"), "slaac" => $lang->tr("SLAAC")];
-            //swapUnit
-            $this->availableValues["customconfigoption[swapUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
-            //bridge
-            foreach ($this->api()->get("/nodes/{$this->node->getNode()}/network") as $network)
-            {
-                if (!in_array($network['type'], ['bridge', 'OVSBridge']))
-                {
-                    continue;
-                }
-                $this->availableValues["customconfigoption[bridge]"] [$network['iface']] = $lang->tr($network['iface']);
+            $this->availableValues["customconfigoption[mountPointStorage]"][$entity->getStorage()] = $lang->tr($entity->getStorage());
+        }
+        //mountPointAcl
+        $this->availableValues["customconfigoption[mountPointAcl]"] = ["default" => $lang->tr('Default'), "1" => $lang->tr("On"), "0" => $lang->tr("Off")];
+        //ipv4NetworkMode
+        $this->availableValues["customconfigoption[ipv4NetworkMode]"] = ["static" => $lang->tr('Static'), "dhcp" => $lang->tr("DHCP")];
+        //ipv6NetworkMode
+        $this->availableValues["customconfigoption[ipv6NetworkMode]"] = ["static" => $lang->tr('Static'), "dhcp" => $lang->tr("DHCP"), "slaac" => $lang->tr("SLAAC")];
+        //swapUnit
+        $this->availableValues["customconfigoption[swapUnit]"] = ['mb' => $lang->tr("MB"), "gb" => $lang->tr("GB"), "tb" => $lang->tr("TB")];
+        //bridge
+        foreach ($this->api()->get("/nodes/{$this->node->getNode()}/network") as $network) {
+            if (!in_array($network['type'], ['bridge', 'OVSBridge'])) {
+                continue;
             }
-            ksort($this->availableValues["customconfigoption[bridge]"]);
-            //privateBridge
-            $this->availableValues["customconfigoption[privateBridge]"] = ['0' => ""] + (array)  $this->availableValues["customconfigoption[bridge]"];
+            $this->availableValues["customconfigoption[bridge]"] [$network['iface']] = $lang->tr($network['iface']);
+        }
+        ksort($this->availableValues["customconfigoption[bridge]"]);
+        //privateBridge
+        $this->availableValues["customconfigoption[privateBridge]"] = ['0' => ""] + (array)$this->availableValues["customconfigoption[bridge]"];
     }
 
     public function update()
     {
         $this->loadRequestObj();
-        if (empty($this->request->get('customconfigoption')))
-        {
+        if (empty($this->request->get('customconfigoption'))) {
             return;
         }
 
-        try{
-            $form           = new MainForm();
+        try {
+            $form = new MainForm();
             $switcherFields = $form->getSwitcherFields();
-            $values         = $this->request->get('customconfigoption');
-            foreach ($values as $k => $v)
-            {
-                if (in_array($k, $switcherFields))
-                {
+            $values = $this->request->get('customconfigoption');
+            foreach ($values as $k => $v) {
+                if (in_array($k, $switcherFields)) {
                     unset($switcherFields[array_search($k, $switcherFields)]);
                 }
             }
-            foreach ($switcherFields as $switch)
-            {
+            foreach ($switcherFields as $switch) {
                 $values[$switch] = "off";
             }
-        }catch (\Exception $ex){
+        } catch (\Exception $ex) {
             //login to proxmox host failed
         }
         //delete
@@ -504,18 +450,18 @@ class ProductProvider extends BaseDataProvider implements AdminArea
         $this->configuration->flush();
     }
 
-    public function replicate($replicateProductId){
-        $_SESSION['proxmoxVPS']= null;
-        if(ProductConfiguration::ofProductId($this->productId)->count()){
+    public function replicate($replicateProductId)
+    {
+        $_SESSION['proxmoxVPS'] = null;
+        if (ProductConfiguration::ofProductId($this->productId)->count()) {
             return;
         }
         /**
          * @var $entity ProductConfiguration
          */
-        foreach (ProductConfiguration::ofProductId($replicateProductId)->get() as $entity)
-        {
+        foreach (ProductConfiguration::ofProductId($replicateProductId)->get() as $entity) {
             $newEntity = new ProductConfiguration();
-            $newEntity->setting =  $entity->setting;
+            $newEntity->setting = $entity->setting;
             $newEntity->value = $entity->value;
             $newEntity->product_id = $this->productId;
             $newEntity->save();

+ 2 - 0
app/UI/Admin/Product/Sections/HighAvailabilityClusterSection.php

@@ -44,10 +44,12 @@ class HighAvailabilityClusterSection extends BoxSection implements AdminArea
         //Max. Restart
         $field = new Text('customconfigoption[clusterMaxRestart]');
         $field->setDescription('tip');
+        $field->setDefaultValue(1);
         $this->leftSection->addField($field);
         //Max. Relocate
         $field = new Text('customconfigoption[clusterMaxRelocate]');
         $field->setDescription('tip');
+        $field->setDefaultValue(1);
         $this->rightSection->addField($field);
     }
 

+ 4 - 0
app/UI/Admin/Product/Sections/Qemu/ConfigurationSection.php

@@ -181,6 +181,10 @@ class ConfigurationSection extends BoxSection implements AdminArea
         $field = new Switcher('customconfigoption[aes]');
         $field->setDescription('tip');
         $this->rightSection->addField($field);
+        //vgaMemory
+        $field = new Text('customconfigoption[vgaMemory]');
+        $field->setDescription('tip');
+        $this->leftSection->addField($field);
     }
 
 }

+ 6 - 2
app/UI/Admin/Templates/assets/js/home/index.js

@@ -6,8 +6,12 @@ function mgBytesToSize(bytes) {
         }
         return bytes + ' Byte';
     }
-    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)));
-    return Math.round(bytes / Math.pow(1000, i), 2) + ' ' + sizes[i];
+    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
+    var total = bytes / Math.pow(1024, i) ;
+    if(sizes[i] == 'GB' || sizes[i] == 'TB' ){
+        return total.toFixed(2)+ ' ' + sizes[i];
+    }
+    return Math.round( total, 2) + ' ' + sizes[i];
 }
 
 function mgTooltipCpu(tooltipItem, data) {

+ 6 - 2
app/UI/Client/Templates/assets/js/graph/index.js

@@ -6,8 +6,12 @@ function mgBytesToSize(bytes) {
         }
         return bytes + ' Byte';
     }
-    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)));
-    return Math.round(bytes / Math.pow(1000, i), 2) + ' ' + sizes[i];
+    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
+    var total = bytes / Math.pow(1024, i) ;
+    if(sizes[i] == 'GB' || sizes[i] == 'TB' ){
+        return total.toFixed(2)+ ' ' + sizes[i];
+    }
+    return Math.round( total, 2) + ' ' + sizes[i];
 }
 
 function mgTooltipCpu(tooltipItem, data) {

+ 13 - 0
app/UI/Network/Providers/NetworkProvider.php

@@ -111,7 +111,20 @@ class NetworkProvider extends BaseDataProvider implements ClientArea
                 ->setStatusError()
                 ->setMessageAndTranslate('Private network device not found');
         }
+        if(!$this->formData['id']){
+           throw new \InvalidArgumentException("Network id is empty");
+        }
+        foreach ($this->vm()->getNetworkDevices() as $networkDevice){
+            //public network
+            if( $networkDevice->getId() == $this->formData['id'] && $this->configuration()->getBridge() == $networkDevice->getBridge()){
+                return (new HtmlDataJsonResponse())
+                    ->setStatusError()
+                    ->setMessageAndTranslate('Delete public network is restricted');
+            }
+        }
+
         $this->networkService = new NetworkService();
+        $this->networkService->setDeletePrivateNetwork(true);
         $this->networkService->deleteByNetworkId([$this->formData['id']]);
         if($this->configuration()->isIpsetIpFilter()){
             $ipSetIpFilterService = new IpSetIpFilterService();

+ 1 - 1
app/UI/Reinstall/Providers/TemplateInstallProvider.php

@@ -49,7 +49,7 @@ class TemplateInstallProvider extends BaseDataProvider implements ClientArea, Ad
         if ($this->actionElementId)
         {
             $this->data['id']       = $this->actionElementId;
-            $this->data['password'] = htmlspecialchars($this->getWhmcsParamByKey("password"));
+            $this->data['password'] = $this->getWhmcsCustomField('cipassword') ? $this->getWhmcsCustomField('cipassword') : htmlspecialchars($this->getWhmcsParamByKey("password"));
         }
     }
 

+ 2 - 2
core/Http/Response.php

@@ -237,8 +237,8 @@ class Response extends SymfonyRespose
     
     public function returnClientProvisioning($vars, $path, $fileName)
     {
-//        $templateVarName = ($this->getRequestValue('a', false) === 'management') ? 'tabOverviewReplacementTemplate' : 'templatefile';          
-        $templateVarName = 'tabOverviewReplacementTemplate';          
+        $templateVarName = ($this->getRequestValue('a', false) === 'management') ? 'tabOverviewReplacementTemplate' : 'templatefile';          
+
         return [
             $templateVarName => str_replace(\ModulesGarden\Servers\ProxmoxVps\Core\ModuleConstants::getTemplateDir() . DIRECTORY_SEPARATOR,
                 '', $path . DIRECTORY_SEPARATOR . $fileName),

+ 5 - 4
langs/english.php

@@ -268,9 +268,11 @@ $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[keyboard]']['tip'] = 'Select the keybord layout for the VNC server. The default one is fetched from the data center configuration file.';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[pool]']['customconfigoption[pool]'] = 'Pool';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[pool]']['tip'] = 'Select the pool which the VM should be added to';
-$_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[vga]']['customconfigoption[vga]'] = 'VGA Type';
+$_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[vga]']['customconfigoption[vga]'] = 'Graphic Card';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[vga]']['tip'] = 'If you want to use high resolution modes (>= 1280x1024x16), you should use the option \'std\' or \'vmware\'. The default one is \'std\' for Win8/Win7/w2k8, and \'cirrur\' for other OS types';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[clientNameForContainer]']['customconfigoption[clientNameForContainer]'] = 'Use Client Name For VPS';
+$_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[vgaMemory]']['customconfigoption[vgaMemory]'] = 'Graphic Card Memory';
+$_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[vgaMemory]']['tip'] = 'MiB';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[clientNameForContainer]']['tip'] = 'Choose if and when the hostname should be overwritten';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[osTemplatesInAllNodes]']['customconfigoption[osTemplatesInAllNodes]'] = 'Search For Templates On All Nodes';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['configurationSection']['leftSection']['customconfigoption[osTemplatesInAllNodes]']['tip'] = 'Enable searching for the reinstallation templates on all nodes';
@@ -1741,7 +1743,6 @@ $_LANG['serverAA']['product']['mainContainer']['mainForm']['advancedSection']['r
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['advancedSection']['leftSection']['customconfigoption[machine]']['customconfigoption[machine]'] = 'Qemu Machine Type';
 $_LANG['serverAA']['product']['mainContainer']['mainForm']['advancedSection']['leftSection']['customconfigoption[machine]']['tip'] = 'Specify the Qemu machine type
 (pc|pc(-i440fx)?-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|q35|pc-q35-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|virt(?:-\d+(\.\d+)+)?(\+pve\d+)?)';
-
-
 $_LANG['serverAA']['configOptions']['SeaBIOS'] = 'SeaBIOS';
-$_LANG['serverAA']['configOptions']['OVMF (UEFI)'] = 'OVMF (UEFI)';
+$_LANG['serverAA']['configOptions']['OVMF (UEFI)'] = 'OVMF (UEFI)';
+$_LANG['Delete public network is restricted']= 'Delete public network is restricted';

+ 2 - 2
moduleVersion.php

@@ -5,6 +5,6 @@
  * Below you can find current version & revision of this module
  */
 
-$moduleVersion = '3.1.0';
-$moduleRevision = '40776fba2f70ec03fb7c07ef60b8b9fce1b7388e';
+$moduleVersion = '3.1.1';
+$moduleRevision = '7d8058b345f0d8ee68d265b2b85c96107968dc35';
 $moduleWikiUrl = 'http://www.docs.modulesgarden.com/Proxmox_VPS_For_WHMCS';

+ 4 - 0
proxmoxVPS.php

@@ -185,7 +185,11 @@ function proxmoxVPS_ClientArea($params)
         return;
     }
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
+
+    
+
     $appContext = new AppContext();
+
     return $appContext->runApp('clientarea', $params);
 }
 

+ 11 - 327
templates/client/default/controlers/main.tpl

@@ -1,334 +1,18 @@
-{if $currentPageName == 'Home'}
-    {if $modulecustombuttonresult}
-        {if $modulecustombuttonresult == "success"}
-            {include file="$template/includes/alert.tpl" type="success" msg=$LANG.moduleactionsuccess textcenter=true idname="alertModuleCustomButtonSuccess"}
-        {else}
-            {include file="$template/includes/alert.tpl" type="error" msg=$LANG.moduleactionfailed|cat:' ':$modulecustombuttonresult textcenter=true idname="alertModuleCustomButtonFailed"}
-        {/if}
-    {/if}
-    {if $pendingcancellation}
-        {include file="$template/includes/alert.tpl" type="error" msg=$LANG.cancellationrequestedexplanation textcenter=true idname="alertPendingCancellation"}
-    {/if}
-    {if $unpaidInvoice}
-        <div class="alert alert-{if $unpaidInvoiceOverdue}danger{else}warning{/if}" id="alert{if $unpaidInvoiceOverdue}Overdue{else}Unpaid{/if}Invoice">
-            <div class="pull-right">
-                <a href="viewinvoice.php?id={$unpaidInvoice}" class="btn btn-xs btn-default">
-                    {lang key='payInvoice'}
-                </a>
-            </div>
-            {$unpaidInvoiceMessage}
-        </div>
-    {/if}
-    <div class="tab-content margin-bottom">
-        <div class="tab-pane fade show active" id="tabOverview">
-            {if $tplOverviewTabOutput}
-                    {$tplOverviewTabOutput}
-            {else}
-            <div class="section">
-                <div class="product-details">
-                    <div class="row row-eq-height row-eq-height-sm">
-                        <div class="col-md-6">
-                            <div class="product-holder product-status-{$rawstatus|strtolower}">
-                                <div class="product-content">
-                                    <div class="product-image">
-                                        <div class="feature-icon">
-                                            <img src="/templates/croster/thurdata/logoVPS-color.svg" class="img-fluid">
-                                        </div>
-                                    </div>
-                                    <h4>{$product}</h4>
-                                    <div class="status-sticker-wrapper">
-                                        <div class="status-sticker product-status-{$rawstatus|strtolower}">
-                                            {$status}
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="col-md-6">
-                            <div class="product-info">
-                                <ul class="list-info list-v">
-                                    <li>
-                                        <span class="list-heading">{$LANG.clientareahostingregdate}</span>
-                                        <span class="list-text">{$regdate}</span>
-                                    </li>
-                                    {if $firstpaymentamount neq $recurringamount}
-                                        <li>
-                                            <span class="list-heading">{$LANG.firstpaymentamount}</span>
-                                            <span class="list-text">{$firstpaymentamount}</span>
-                                        </li>
-                                    {/if}
-                                    {if $billingcycle != $LANG.orderpaymenttermonetime && $billingcycle != $LANG.orderfree}
-                                        <li>
-                                            <span class="list-heading">{$LANG.recurringamount}</span>
-                                            <span class="list-text">{$recurringamount}</span>
-                                        </li>
-                                    {/if}
-                                    <li>
-                                            <span class="list-heading">{$LANG.orderbillingcycle}</span>
-                                            <span class="list-text">{$billingcycle}</span>
-                                    </li>
-                                    {if $nextduedate == '-'}{else}
-                                        <li>
-                                            <span class="list-heading">{$LANG.clientareahostingnextduedate}</span>
-                                            <span class="list-text">{$nextduedate}</span>
-                                        </li>
-                                    {/if}
-                                    <li>
-                                        <span class="list-heading">{$LANG.orderpaymentmethod}</span>
-                                        <span class="list-text">{$paymentmethod}</span>
-                                    </li>
-                                </ul>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            {*
-                {if $showcancelbutton || $packagesupgrade}
-                    <div class="row">
-                        {if $packagesupgrade}
-                            <div class="col-xs-{if $showcancelbutton}6{else}12{/if}">
-                                <a href="upgrade.php?type=package&amp;id={$id}" class="btn btn-block btn-primary">{$LANG.upgrade}</a>
-                            </div>
-                        {/if}
-                        {if $showcancelbutton}
-                            <div class="col-xs-{if $packagesupgrade}6{else}12{/if}">
-                                <a href="clientarea.php?action=cancel&amp;id={$id}" class="btn btn-block btn-danger {if $pendingcancellation}disabled{/if}">{if $pendingcancellation}{$LANG.cancellationrequested}{else}{$LANG.clientareacancelrequestbutton}{/if}</a>
-                            </div>
-                        {/if}
-                    </div>
-                {/if}
-            *}
-            {if $systemStatus == 'Active'}
-                {foreach $hookOutput as $output}
-                    <div class="section">
-                        <div>
-                            {$output}
-                        </div>
-                        <div class=" clearfix"></div>
-                    </div>
-                {/foreach}
-                {if $domain || $moduleclientarea || $configurableoptions || $customfields || $lastupdate}
-                    <div class="section">
-                        <div class="card panel panel-tabs">
-                            <div class="card-header">
-                                <ul class="nav nav-pills card-header-pills flex-column flex-md-row">
-                                    {if $domain}
-                                        <li class="nav-item">
-                                            <a href="#domain" data-toggle="tab" class="nav-link active"><i class="fas fa-globe fa-fw"></i> {lang key='manage'}</a>
-                                        </li>
-                                    {/if}
-                                    {if $configurableoptions}
-                                        <li class="nav-item">
-                                            <a href="#configoptions" data-toggle="tab" class="nav-link{if !$domain && !$moduleclientarea} active{/if}"><i class="fas fa-cubes fa-fw"></i>Details</a>
-                                        </li>
-                                    {/if}
-                                    {if $metricStats}
-                                        <li class="nav-item">
-                                            <a href="#metrics" data-toggle="tab" class="nav-link{if !$domain && !$moduleclientarea && !$configurableoptions} active{/if}"><i class="fas fa-chart-line fa-fw"></i> {lang key='metrics.title'}</a>
-                                        </li>
-                                    {/if}
-                                    {if $customfields}
-                                        <li class="nav-item">
-                                            <a href="#additionalinfo" data-toggle="tab" class="nav-link{if !$domain && !$moduleclientarea && !$metricStats && !$configurableoptions} active{/if}"><i class="fas fa-info fa-fw"></i>Zugangsdaten</a>
-                                        </li>
-                                    {/if}
-                                    {if $lastupdate}
-                                        <li class="nav-item">
-                                            <a href="#resourceusage" data-toggle="tab" class="nav-link{if !$domain && !$moduleclientarea && !$configurableoptions && !$customfields} active{/if}"><i class="fas fa-inbox fa-fw"></i> {lang key='resourceUsage'}</a>
-                                        </li>
-                                    {/if}
-                                </ul>
-                            </div>
-                            <div class="card-body">
-                                <div class="tab-content">
-                                    {if $configurableoptions}
-                                        <div class="tab-pane fade{if !$domain && !$moduleclientarea} show active{/if}" role="tabpanel" id="configoptions">
-                                        <table width="100%" cellspacing="0" cellpadding="0" class="frame">
-                                            <tr>
-                                            <td>
-                                                <table width="100%" border="0" cellpadding="10" cellspacing="0" class="table table-striped table-framed">
-                                                <tr>
-                                                    <td align='left'>Servername</td>
-                                                    <td align="left">{$domain}</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>IP Adresse</td>
-                                                    <td align="left">{$dedicatedip}</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>VM Template</td>
-                                                    <td align="left">{$moduleParams.configoptions['VM Template']}</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>CPU Cores</td>
-                                                    <td align="left">{$moduleParams.configoptions['The number of cores per socket']}</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>Hautspeicher</td>
-                                                    <td align="left">{$moduleParams.configoptions['Amount of RAM']} GB</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>Festplattenplatz</td>
-                                                    <td align="left">{$moduleParams.configoptions['Disk Space']} GB</a></td>
-                                                </tr>
-                                                </table>
-                                            </td>
-                                            </tr>
-                                        </table>
-                                        </div>
-                                    {/if}
-                                    {if $metricStats}
-                                        <div class="tab-pane fade{if !$domain && !$moduleclientarea && !$configurableoptions} show active{/if}" role="tabpanel" id="metrics">
-                                            <p>{lang key='metrics.explanation'}</p>
-                                            <table class="table table-striped mb-1 table-solid-bottom-border-light-gray">
-                                                <tr>
-                                                    <th>{lang key='metrics.metric'}</th>
-                                                    <th>{lang key='metrics.currentUsage'}</th>
-                                                    <th>{lang key='metrics.pricing'}</th>
-                                                    <th>{lang key='metrics.lastUpdated'}</th>
-                                                </tr>
-                                                {foreach $metricStats as $metric}
-                                                    <tr>
-                                                        <td>{$metric.displayName}</td>
-                                                        <td>{$metric.currentValue|round:1}</td>
-                                                        <td>
-                                                            {if count($metric.pricing) > 1}
-                                                                {lang key='metrics.startingFrom'} {$metric.lowestPrice} / {if $metric.unitName}{$metric.unitName}{else}{lang key='metrics.unit'}{/if}
-                                                                <br>
-                                                                <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#modalMetricPricing-{$metric.systemName}">
-                                                                    {lang key='metrics.viewPricing'}
-                                                                </button>
-                                                            {elseif count($metric.pricing) == 1}
-                                                                {$metric.lowestPrice} / {if $metric.unitName}{$metric.unitName}{else}{lang key='metrics.unit'}{/if}
-                                                                {if $metric.includedQuantity > 0} ({$metric.includedQuantity|round:1} {lang key='metrics.includedNotCounted'}){/if}
-                                                            {else}
-                                                                &mdash;
-                                                            {/if}
-                                                            {include file="$template/usagebillingpricing.tpl"}
-                                                        </td>
-                                                        <td>{if is_string($metric.lastUpdated)}{$metric.lastUpdated}{else}{$metric.lastUpdated->diffForHumans()}{/if}</td>
-                                                    </tr>
-                                                {/foreach}
-                                            </table>
-                                        </div>
-                                    {/if}
-                                    {if $domain}
-                                        <div class="tab-pane fade show active" role="tabpanel" id="domain">
-                                            <table width="100%" cellspacing="0" cellpadding="0" class="frame">
-                                                <tr>
-                                                    <td align='center'>
-                                                        <div class="mg-wrapper body" data-target=".body" data-spy="scroll" data-twttr-rendered="true">
-                                                            <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
-                                                            <link rel="stylesheet" href="{$assetsURL}/css/layers-ui.css">
-                                                            <link rel="stylesheet" href="{$assetsURL}/css/mg_styles.css">
-                                                            {if $isCustomModuleCss}
-                                                                <link rel="stylesheet" href="{$customAssetsURL}/css/module_styles.css">
-                                                            {/if}
-                                                            <div class="full-screen-module-container" id="layers">
-                                                                <div class="lu-app">
-                                                                    {$content}
-                                                                </div>
-                                                            </div>
-                                                        </div>
-                                                    </td>
-                                                </tr>
-                                            </table>
-                                        </div>
-                                    {/if}
-                                    {if $customfields}
-                                        <div class="tab-pane fade{if !$domain && !$moduleclientarea && !$configurableoptions && !$metricStats} show active{/if}" role="tabpanel" id="additionalinfo">
-                                            <table width="100%" border="0" cellpadding="10" cellspacing="0" class="table table-striped table-framed">
-                                                <tr>
-                                                    <td align='left'>Admin Username</td>
-                                                    <td align="left">{$moduleParams.customfields['ciuser']}</td>
-                                                </tr>
-                                                <tr>
-                                                    <td align='left'>SSH-Key</td>
-                                                    <td align="left">{assign var=keyName value=' '|explode:$moduleParams.customfields['sshkeys']}{$keyName[2]}</td>
-                                                </tr>
-                                            </table>
-                                        </div>
-                                    {/if}
-                                    {if $lastupdate}
-                                        <div class="tab-pane fade" role="tabpanel" id="resourceusage" align="center">
-                                            <table width="100%" cellspacing="0" cellpadding="0" class="frame">
-                                                <tr>
-                                                    <td align="center">
-                                                        <div class="col-sm-10">
-                                                                <h4>{lang key='diskSpace'} %</h4>
-                                                                <input type="text" value="{$diskpercent|substr:0:-1}" class="dial-usage" data-width="100" data-height="100" data-min="0" data-readOnly="true" />
-                                                                <p>{($diskusage / 1024)|round:1} GB / {($disklimit / 1024)|round:1} GB</p>
-                                                        </div>
-                                                        <div class="clearfix"></div>
-                                                        <p class="text-muted">{lang key='clientarealastupdated'}: {$lastupdate}</p>
-                                                    </td>
-                                                    <td align="center">
-                                                        <div class="col-sm-10">
-                                                                <h4>{lang key='bandwidth'} %</h4>
-                                                                <input type="text" value="{$bwpercent|substr:0:-1}" class="dial-usage" data-width="100" data-height="100" data-min="0" data-readOnly="true" />
-                                                                <p>{($bwusage / 1024)|round:1} GB / {if $bwlimit == 'Unbegrenzt'}{$bwlimit}{else}{($bwlimit / 1024)|round:1} GB{/if}</p>
-                                                        </div>
-                                                        <div class="clearfix"></div>
-                                                        <p class="text-muted">{lang key='clientarealastupdated'}: {$lastupdate}</p>
-                                                    </td>
-                                                </tr>
-                                            </table>
-                                            <script src="{$BASE_PATH_JS}/jquery.knob.js"></script>
-                                            <script>
-                                                jQuery(function() {
-                                                    jQuery(".dial-usage").knob({
-                                                        'format': function(v) {
-                                                            alert(v);
-                                                        }
-                                                    });
-                                                });
-                                            </script>
-                                        </div>
-                                    {/if}
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                {/if}
-            {else}
-                <div class="alert-lg no-data">
-                    <div class="icon">
-                        <i class="fas fa-exclamation-triangle"></i>
-                    </div>
-                    <div class="text">
-                        {if $suspendreason}
-                            <strong>{$suspendreason}</strong><br />
-                        {/if}
-                        {$LANG.cPanel.packageNotActive} {$status}.<br />
-                        {if $systemStatus eq "Pending"}
-                            {$LANG.cPanel.statusPendingNotice}
-                        {elseif $systemStatus eq "Suspended"}
-                            {$LANG.cPanel.statusSuspendedNotice}
-                        {/if}
-                    </div>
-                </div>
-            {/if}
-        {/if}
-    </div>
-</div>
-{else}
-    <div class="mg-wrapper body" data-target=".body" data-spy="scroll" data-twttr-rendered="true">
+<div class="mg-wrapper body" data-target=".body" data-spy="scroll" data-twttr-rendered="true">
 
-        <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
-        <link rel="stylesheet" href="{$assetsURL}/css/layers-ui.css">
-        <link rel="stylesheet" href="{$assetsURL}/css/mg_styles.css">
-        {if $isCustomModuleCss}
-            <link rel="stylesheet" href="{$customAssetsURL}/css/module_styles.css">
-        {/if}
+    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
+    <link rel="stylesheet" href="{$assetsURL}/css/layers-ui.css">
+    <link rel="stylesheet" href="{$assetsURL}/css/mg_styles.css">
+    {if $isCustomModuleCss}
+        <link rel="stylesheet" href="{$customAssetsURL}/css/module_styles.css">
+    {/if}
 
-        <div class="full-screen-module-container" id="layers">
-            <div class="lu-app">
-                {$content}
-            </div>
+    <div class="full-screen-module-container" id="layers">
+        <div class="lu-app">
+            {$content}
         </div>
     </div>
-{/if}
+</div>
 
 {if $isDebug}
     <script type="text/javascript" src="https://unpkg.com/vue"></script>