From 808ca2490d43fc5723988675723a47fb20cb16b2 Mon Sep 17 00:00:00 2001
From: AsPiD21 <72015749+AsPiD21@users.noreply.github.com>
Date: Mon, 28 Sep 2020 18:08:44 +0300
Subject: [PATCH] Add files via upload

---
 addons/oncontrol/classes/Loader.php           |  258 ++--
 addons/oncontrol/lang/english.php             |  250 ++--
 addons/oncontrol/logics/vmlist.php            |  590 ++++-----
 addons/oncontrol/oncontrol.php                |  222 ++--
 addons/oncontrol/pages/configuration/menu.php |    8 +-
 .../pages/configuration/moduleconfig.php      |  305 +++--
 .../pages/configuration/newConfig.php         |  373 +++---
 addons/oncontrol/pages/vmlist/freeip.php      |   23 +-
 addons/oncontrol/pages/vmlist/menu.php        |   10 +-
 addons/oncontrol/pages/vmlist/panel.php       | 1060 ++++++++---------
 addons/oncontrol/pages/vmlist/qutas.php       |  190 ++-
 addons/oncontrol/pages/vmlist/reinstall.php   |  340 +++---
 .../pages/vmlist/service_manager.php          |    8 +-
 addons/oncontrol/pages/vmlist/vmlist.php      |  826 ++++++-------
 servers/onconnector/hooks.php                 |  631 +++++-----
 servers/onconnector/lib/ONConnect.php         |  348 +++---
 servers/onconnector/onconnector.php           |  526 +++-----
 17 files changed, 2768 insertions(+), 3200 deletions(-)

diff --git a/addons/oncontrol/classes/Loader.php b/addons/oncontrol/classes/Loader.php
index e4d8bde..c9c41df 100644
--- a/addons/oncontrol/classes/Loader.php
+++ b/addons/oncontrol/classes/Loader.php
@@ -1,131 +1,129 @@
-<?php
-use WHMCS\Database\Capsule;
-ini_set('display_errors', 0);
-class Loader{
-    protected $vars;
-    protected $LANG;
-    protected $tabs;
-    protected $mod;
-    private $onconnect;
-    private $modulelink;
-
-    public function __construct($vars)
-    {
-        require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
-        $this->onconnect = new ONConnect();
-        ini_set('error_reporting', E_ALL);
-        ini_set('display_errors', 0);
-        ini_set('display_startup_errors', 1);
-        $this->vars = $vars;
-        $this->LANG = $this->vars['_lang'];
-        $this->tabs = $_GET['tabs'];
-        $this->mod = $_GET['mod'];
-        $pageUrl['mod'] = $this->mod;
-        $pageUrl['tabs'] = $this->tabs;
-        $pageUrl = http_build_query($pageUrl);
-        $this->modulelink=$vars['modulelink'].'&'.$pageUrl;
-    }
-
-    private function addOrUpdate($name,$value){
-        if(Capsule::table( 'tblconfiguration' )
-            ->where('setting',$name)
-            ->get()) {
-            Capsule::table( 'tblconfiguration' )
-                ->where('setting',$name)
-                ->update([
-                    'setting'=>$name,
-                    'value'=>$value
-                ]);
-        }
-        else{
-            $result = Capsule::table('tblconfiguration')
-                ->insert([
-                    'setting' => $name,
-                    'value' => $value
-                ]);
-        };
-    }
-    private function loadTabs()
-    {
-        ?>
-            <div class="nav-menu">
-                  <ul class="nav nav-tabs">
-                      <li class=" <? if($this->tabs=='vmlist') {print 'active';};?>"><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist"><span class="glyphicon glyphicon-th-list"></span> <?=$this->LANG['tabsvmlist']?></a></li>
-                      <li class=" <? if($this->tabs=='configuration') {print 'active';};?>"><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration"><span class="glyphicon glyphicon-cog"></span> <?=$this->LANG['tabsconfiguration']?></a></li>
-                      <li class=" <? if($this->tabs=='ansible') {print 'active';};?>"><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=ansible&mod=ansibledb"><span class="glyphicon glyphicon-ok"></span> <?=$this->LANG['tabsansible']?></a></li>
-                  </ul>
-            </div>
-        <?
-    }
-
-    private function breadCrumbs()
-    {
-        ?>
-           <div>
-                  <ul class="breadcrumb" onclick="$('.loading').attr('hidden',false);">
-                      <li><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>"><span class="glyphicon glyphicon-home"></span></a> <span class="divider">/</span></li>
-                      <? if($this->tabs){ printf('<li><a onclick="$(\'.loading\').attr(\'hidden\',false);" href="%s&tabs=%s">%s</a> <span class="divider">/</span></li>',$this->vars['modulelink'],$this->tabs,$this->LANG['tabs'.$this->tabs]);}?>
-                      <? if($this->mod){ printf('<li><a onclick="$(\'.loading\').attr(\'hidden\',false);" href="%s&tabs=%s&mod=%s">%s</a> <span class="divider">/</span></li>',$this->vars['modulelink'],$this->tabs,$this->mod,$this->mod);}?>
-                  </ul>
-           </div>
-        <?
-    }
-
-    public function constructPage()
-    {
-        if ($this->tabs == NULL) {
-        $this->tabs = 'vmlist';
-        $this->mod = 'vmlist';
-        }?>
-        <?=$this->loadTabs();?>
-        <?=$this->breadCrumbs();?>
-
-        <div>
-            <div class="col-lg-2">
-                <?=$this->loadPageMenu();?>
-            </div>
-
-            <div class="col-lg-10">
-                <?=$this->loadPageContent();?>
-            </div>
-        </div>
-        <div hidden class="loading" style="position: absolute; z-index: 1000000;top:200px;left:47%;">
-            <img src="/modules/addons/oncontrol/img/loading.gif">
-        </div>
-    <?}
-
-    public function constructPageFirstStart()
-    {
-            $this->tabs = 'configuration';
-            $this->mod = 'moduleconfig';
-        ?>
-        <?=$this->loadTabs();?>
-        <?=$this->breadCrumbs();?>
-
-        <div>
-            <div class="col-lg-2">
-                <?=$this->loadPageMenu();?>
-            </div>
-
-            <div class="col-lg-10">
-                <?=$this->loadPageContent();?>
-            </div>
-        </div>
-    <?}
-
-
-    public function loadPageMenu()
-    {
-        if($this->tabs) {
-            require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/pages/' . $this->tabs . '/menu.php');
-        }
-    }
-
-    public function loadPageContent()
-    {
-        if($this->mod) {
-            require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/pages/' . $this->tabs . '/' . $this->mod . '.php');
-        }
-    }
-
+<?php
+use WHMCS\Database\Capsule;
+class Loader{
+    protected $vars;
+    protected $LANG;
+    protected $tabs;
+    protected $mod;
+    private $onconnect;
+    private $modulelink;
+
+    public function __construct($vars)
+    {
+        require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
+        $this->onconnect = new ONConnect();
+        ini_set('error_reporting', E_ALL);
+        ini_set('display_errors', 1);
+        ini_set('display_startup_errors', 1);
+        $this->vars = $vars;
+        $this->LANG = $this->vars['_lang'];
+        $this->tabs = $_GET['tabs'];
+        $this->mod = $_GET['mod'];
+        $pageUrl['mod'] = $this->mod;
+        $pageUrl['tabs'] = $this->tabs;
+        $pageUrl = http_build_query($pageUrl);
+				$this->modulelink=$vars['modulelink'].'&'.$pageUrl;
+    }
+
+    private function addOrUpdate($name,$value){
+        if(Capsule::table( 'tblconfiguration' )
+            ->where('setting',$name)
+            ->get()) {
+            Capsule::table( 'tblconfiguration' )
+                ->where('setting',$name)
+                ->update([
+                    'setting'=>$name,
+                    'value'=>$value
+                ]);
+        }
+        else{
+            $result = Capsule::table('tblconfiguration')
+                ->insert([
+                    'setting' => $name,
+                    'value' => $value
+                ]);
+        };
+    }
+    private function loadTabs()
+    {
+        ?>
+            <div class="nav-menu">
+                  <ul class="nav nav-tabs">
+                      <li class=" <?php if($this->tabs=='vmlist') {print 'active';};?>"><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist"><span class="glyphicon glyphicon-th-list"></span> <?=$this->LANG['tabsvmlist']?></a></li>
+                      <li class=" <?php if($this->tabs=='configuration') {print 'active';};?>"><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration"><span class="glyphicon glyphicon-cog"></span> <?=$this->LANG['tabsconfiguration']?></a></li>
+                  </ul>
+            </div>
+        <?php
+    }
+
+    private function breadCrumbs()
+    {
+        ?>
+           <div>
+                  <ul class="breadcrumb" onclick="$('.loading').attr('hidden',false);">
+                      <li><a onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>"><span class="glyphicon glyphicon-home"></span></a> <span class="divider">/</span></li>
+                      <?php if($this->tabs){ printf('<li><a onclick="$(\'.loading\').attr(\'hidden\',false);" href="%s&tabs=%s">%s</a> <span class="divider">/</span></li>',$this->vars['modulelink'],$this->tabs,$this->LANG['tabs'.$this->tabs]);}?>
+                      <?php if($this->mod){ printf('<li><a onclick="$(\'.loading\').attr(\'hidden\',false);" href="%s&tabs=%s&mod=%s">%s</a> <span class="divider">/</span></li>',$this->vars['modulelink'],$this->tabs,$this->mod,$this->mod);}?>
+                  </ul>
+           </div>
+        <?php
+    }
+
+    public function constructPage()
+    {
+        if ($this->tabs == NULL) {
+        $this->tabs = 'vmlist';
+        $this->mod = 'vmlist';
+        }?>
+        <?=$this->loadTabs();?>
+        <?=$this->breadCrumbs();?>
+
+        <div>
+            <div class="col-lg-2">
+                <?=$this->loadPageMenu();?>
+            </div>
+
+            <div class="col-lg-10">
+                <?=$this->loadPageContent();?>
+            </div>
+        </div>
+        <div hidden class="loading" style="position: absolute; z-index: 1000000;top:200px;left:47%;">
+            <img src="/modules/addons/oncontrol/img/loading.gif">
+        </div>
+    <?php }
+
+    public function constructPageFirstStart()
+    {
+            $this->tabs = 'configuration';
+            $this->mod = 'moduleconfig';
+        ?>
+        <?=$this->loadTabs();?>
+        <?=$this->breadCrumbs();?>
+
+        <div>
+            <div class="col-lg-2">
+                <?=$this->loadPageMenu();?>
+            </div>
+
+            <div class="col-lg-10">
+                <?=$this->loadPageContent();?>
+            </div>
+        </div>
+    <?php }
+
+
+    public function loadPageMenu()
+    {
+        if($this->tabs) {
+            require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/pages/' . $this->tabs . '/menu.php');
+        }
+    }
+
+    public function loadPageContent()
+    {
+        if($this->mod) {
+            require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/pages/' . $this->tabs . '/' . $this->mod . '.php');
+        }
+    }
+
 }
\ No newline at end of file
diff --git a/addons/oncontrol/lang/english.php b/addons/oncontrol/lang/english.php
index 7fb82bb..c9cacca 100644
--- a/addons/oncontrol/lang/english.php
+++ b/addons/oncontrol/lang/english.php
@@ -1,126 +1,126 @@
-<?php
-$_ADDONLANG['menu1']='New version';
-$_ADDONLANG['menu2']='Modules configure';
-$_ADDONLANG['menu3']='Old version';
-$_ADDONLANG['PanelHeading']='Host';
-$_ADDONLANG['PanelAddress']='IONe host address:';
-$_ADDONLANG['PanelIP']='IP address:';
-$_ADDONLANG['PanelPort']='Port:';
-$_ADDONLANG['defaultPortAnsible']='Ansible default Port:';
-$_ADDONLANG['buttonReset']='Reset:';
-$_ADDONLANG['thId']='ID';
-$_ADDONLANG['thProductId']='product ID';
-$_ADDONLANG['thOperatingSystem']='Operating System';
-$_ADDONLANG['thOSAddonId']='OS Addon ID';
-$_ADDONLANG['thTemplateId']='Template ID';
-$_ADDONLANG['thControl']='Control';
-$_ADDONLANG['buttonOnconSubmit']='Save';
-$_ADDONLANG['buttonAdd']='Add';
-$_ADDONLANG['buttonDelete']='Delete';
-$_ADDONLANG['buttonEdit']='Edit';
-$_ADDONLANG['tabsvmlist']='List of machines';
-$_ADDONLANG['tabsconfiguration']='Configuration';
-$_ADDONLANG['idConfigurate']='Сonfigure templates';
-$_ADDONLANG['moduleConfigurate']='Сonfigure module';
-$_ADDONLANG['tabsansible']='Ansible';
-$_ADDONLANG['searchByIP']='Search by IP';
-$_ADDONLANG['thClientsId']='Client ID';
-$_ADDONLANG['thHostingId']='Product ID';
-$_ADDONLANG['thLoginOpenNebula']='ONe username';
-$_ADDONLANG['thUserIdOpenNebula']='ONe User ID';
-$_ADDONLANG['thVmidOpenNebula']='ONe VmID';
-$_ADDONLANG['thStatusOpenNebula']='ONe status';
-$_ADDONLANG['thStatusWHMCS']='WHMCS status';
-$_ADDONLANG['thHost']='Host';
-$_ADDONLANG['thIpAddress']='IP address';
-$_ADDONLANG['thDo']='Do';
-$_ADDONLANG['searchFilter']='Search/Filter';
-$_ADDONLANG['filterByProblem']='Filter by problem';
-$_ADDONLANG['freeIp']='Free IP';
-$_ADDONLANG['modEdit']='Edit';
-$_ADDONLANG['quotas']='Dashboard';
-$_ADDONLANG['usedIP']='Used IP';
-$_ADDONLANG['Status']='Status';
-$_ADDONLANG['IP']='IP';
-$_ADDONLANG['VMID']='VM ID';
-$_ADDONLANG['client']='Client';
-$_ADDONLANG['tariff']='Tariff plan';
-$_ADDONLANG['vcpu']='vCPU';
-$_ADDONLANG['cpu']='CPU';
-$_ADDONLANG['ram']='RAM';
-$_ADDONLANG['import']='Imported';
-$_ADDONLANG['reboot']='Reboot';
-$_ADDONLANG['reset']='Reset';
-$_ADDONLANG['reinstall']='Reinstall';
-$_ADDONLANG['reinstallgp']='Reinstall group';
-$_ADDONLANG['reinstallos']='Reinstall OS';
-$_ADDONLANG['restore']='Restore from backup';
-$_ADDONLANG['terminate']='Terminate';
-$_ADDONLANG['open']='open';
-$_ADDONLANG['noopen']='does not';
-$_ADDONLANG['revert']='Revert';
-$_ADDONLANG['createsnap']='Create snapshot';
-$_ADDONLANG['create']='Create';
-$_ADDONLANG['name']='Name';
-$_ADDONLANG['activate']='Activate';
-$_ADDONLANG['addons']='Addons';
-$_ADDONLANG['addon']='Addon';
-$_ADDONLANG['actaddons']='Active addons';
-$_ADDONLANG['seladdons']='Select the addon';
-$_ADDONLANG['selsaddons']='Selected addons';
-$_ADDONLANG['apply']='Apply';
-$_ADDONLANG['vmquantity']='Quantity VM';
-$_ADDONLANG['attention']='Attention';
-$_ADDONLANG['attentiontariff']='Tariff plan, corresponding to the tariff plan of the current user, has not yet been configured!';
-$_ADDONLANG['alldata']='All data from system will be';
-$_ADDONLANG['deletecaps']='DELETE';
-$_ADDONLANG['timescript']='Execution time';
-$_ADDONLANG['second']='second';
-$_ADDONLANG['updatecache']='Update cache from ON';
-$_ADDONLANG['whmcsadmin']='WHMCS admin username';
-$_ADDONLANG['ansibledbuse']='Use AnsibleDb in installation scripts';
-$_ADDONLANG['dataadd']='Data added';
-$_ADDONLANG['dataaddbd']='Data was successfully added to the database';
-$_ADDONLANG['error']='Error';
-$_ADDONLANG['errordb']='Failed to update data in database';
-$_ADDONLANG['faildb']='Failed to add data to DB';
-$_ADDONLANG['updatedate']='Data updated';
-$_ADDONLANG['updatedatedb']='Data was successfully updated in the database';
-$_ADDONLANG['datadel']='Data deleted';
-$_ADDONLANG['datadelall']='Data deleted';
-$_ADDONLANG['datadeldb']='All items that you marked have been successfully deleted';
-$_ADDONLANG['deldb']='Failed to delete data from database';
-$_ADDONLANG['add']='Add';
-$_ADDONLANG['savech']='Save changes';
-$_ADDONLANG['cortariff']='Correction of tariff';
-$_ADDONLANG['addtariff']='Adding a new tariff';
-$_ADDONLANG['osname']='OS Name';
-$_ADDONLANG['os']='OS';
-$_ADDONLANG['idtem']='Template ID';
-$_ADDONLANG['desc']='Description';
-$_ADDONLANG['descs']='Descriptions';
-$_ADDONLANG['entid']='Enter the template ID from the ON';
-$_ADDONLANG['optfield']='This field is optional';
-$_ADDONLANG['enttem']='Enter template id';
-$_ADDONLANG['change']='Change';
-$_ADDONLANG['addnew']='Add new';
-$_ADDONLANG['backlist']='Back to the list';
-$_ADDONLANG['body']='Body';
-$_ADDONLANG['noteos']='Mark the supported operating systems';
-$_ADDONLANG['update']='Update';
-$_ADDONLANG['search']='Search';
-$_ADDONLANG['invalcomb']='Invalid combination of parameters';
-$_ADDONLANG['fillederror']='Filled with errors';
-$_ADDONLANG['notmatch']='Do not match statuses';
-$_ADDONLANG['misswhmcs']='Missing in WHMCS';
-$_ADDONLANG['addent']='The entry was successfully added';
-$_ADDONLANG['addyou']='Your post was successfully added';
-$_ADDONLANG['errorname']='Error: Field Name can not be empty';
-$_ADDONLANG['errorname2']='Error: Field Name must be unique';
-$_ADDONLANG['errorname3']='Error: Field Body can not be empty';
-$_ADDONLANG['customfield']='Immunity (field name)';
-$_ADDONLANG['updok']='Successfully updated:';
-$_ADDONLANG['updok2']='Data successfully updated';
-$_ADDONLANG['deleteall']='Delete all data when removing a module';
-$_ADDONLANG['azureserver']='Сonfigure Azure';
+<?php
+$_ADDONLANG['menu1']='New version';
+$_ADDONLANG['menu2']='Modules configure';
+$_ADDONLANG['menu3']='Old version';
+$_ADDONLANG['PanelHeading']='Host';
+$_ADDONLANG['PanelAddress']='IONe host address:';
+$_ADDONLANG['PanelIP']='IP address:';
+$_ADDONLANG['PanelPort']='Port:';
+$_ADDONLANG['defaultPortAnsible']='Ansible default Port:';
+$_ADDONLANG['buttonReset']='Reset:';
+$_ADDONLANG['thId']='ID';
+$_ADDONLANG['thProductId']='product ID';
+$_ADDONLANG['thOperatingSystem']='Operating System';
+$_ADDONLANG['thOSAddonId']='OS Addon ID';
+$_ADDONLANG['thTemplateId']='Template ID';
+$_ADDONLANG['thControl']='Control';
+$_ADDONLANG['buttonOnconSubmit']='Save';
+$_ADDONLANG['buttonAdd']='Add';
+$_ADDONLANG['buttonDelete']='Delete';
+$_ADDONLANG['buttonEdit']='Edit';
+$_ADDONLANG['tabsvmlist']='List of machines';
+$_ADDONLANG['tabsconfiguration']='Configuration';
+$_ADDONLANG['idConfigurate']='Сonfigure templates';
+$_ADDONLANG['moduleConfigurate']='Сonfigure module';
+$_ADDONLANG['tabsansible']='Ansible';
+$_ADDONLANG['searchByIP']='Search by IP';
+$_ADDONLANG['thClientsId']='Client ID';
+$_ADDONLANG['thHostingId']='Product ID';
+$_ADDONLANG['thLoginOpenNebula']='ONe username';
+$_ADDONLANG['thUserIdOpenNebula']='ONe User ID';
+$_ADDONLANG['thVmidOpenNebula']='ONe VmID';
+$_ADDONLANG['thStatusOpenNebula']='ONe status';
+$_ADDONLANG['thStatusWHMCS']='WHMCS status';
+$_ADDONLANG['thHost']='Host';
+$_ADDONLANG['thIpAddress']='IP address';
+$_ADDONLANG['thDo']='Do';
+$_ADDONLANG['searchFilter']='Search/Filter';
+$_ADDONLANG['filterByProblem']='Filter by problem';
+$_ADDONLANG['freeIp']='Free IP';
+$_ADDONLANG['modEdit']='Edit';
+$_ADDONLANG['quotas']='Dashboard';
+$_ADDONLANG['usedIP']='Used IP';
+$_ADDONLANG['Status']='Status';
+$_ADDONLANG['IP']='IP';
+$_ADDONLANG['VMID']='VM ID';
+$_ADDONLANG['client']='Client';
+$_ADDONLANG['tariff']='Tariff plan';
+$_ADDONLANG['vcpu']='vCPU';
+$_ADDONLANG['cpu']='CPU';
+$_ADDONLANG['ram']='RAM';
+$_ADDONLANG['import']='Imported';
+$_ADDONLANG['reboot']='Reboot';
+$_ADDONLANG['reset']='Reset';
+$_ADDONLANG['reinstall']='Reinstall';
+$_ADDONLANG['reinstallgp']='Reinstall group';
+$_ADDONLANG['reinstallos']='Reinstall OS';
+$_ADDONLANG['restore']='Restore from backup';
+$_ADDONLANG['terminate']='Terminate';
+$_ADDONLANG['open']='open';
+$_ADDONLANG['noopen']='does not';
+$_ADDONLANG['revert']='Revert';
+$_ADDONLANG['createsnap']='Create snapshot';
+$_ADDONLANG['create']='Create';
+$_ADDONLANG['name']='Name';
+$_ADDONLANG['activate']='Activate';
+$_ADDONLANG['addons']='Addons';
+$_ADDONLANG['addon']='Addon';
+$_ADDONLANG['actaddons']='Active addons';
+$_ADDONLANG['seladdons']='Select the addon';
+$_ADDONLANG['selsaddons']='Selected addons';
+$_ADDONLANG['apply']='Apply';
+$_ADDONLANG['vmquantity']='Quantity VM';
+$_ADDONLANG['attention']='Attention';
+$_ADDONLANG['attentiontariff']='Tariff plan, corresponding to the tariff plan of the current user, has not yet been configured!';
+$_ADDONLANG['alldata']='All data from system will be';
+$_ADDONLANG['deletecaps']='DELETE';
+$_ADDONLANG['timescript']='Execution time';
+$_ADDONLANG['second']='second';
+$_ADDONLANG['updatecache']='Update cache from ON';
+$_ADDONLANG['whmcsadmin']='WHMCS admin username';
+$_ADDONLANG['ansibledbuse']='Use AnsibleDb in installation scripts';
+$_ADDONLANG['dataadd']='Data added';
+$_ADDONLANG['dataaddbd']='Data was successfully added to the database';
+$_ADDONLANG['error']='Error';
+$_ADDONLANG['errordb']='Failed to update data in database';
+$_ADDONLANG['faildb']='Failed to add data to DB';
+$_ADDONLANG['updatedate']='Data updated';
+$_ADDONLANG['updatedatedb']='Data was successfully updated in the database';
+$_ADDONLANG['datadel']='Data deleted';
+$_ADDONLANG['datadelall']='Data deleted';
+$_ADDONLANG['datadeldb']='All items that you marked have been successfully deleted';
+$_ADDONLANG['deldb']='Failed to delete data from database';
+$_ADDONLANG['add']='Add';
+$_ADDONLANG['savech']='Save changes';
+$_ADDONLANG['cortariff']='Correction of tariff';
+$_ADDONLANG['addtariff']='Adding a new tariff';
+$_ADDONLANG['osname']='OS Name';
+$_ADDONLANG['os']='OS';
+$_ADDONLANG['idtem']='Template ID';
+$_ADDONLANG['desc']='Description';
+$_ADDONLANG['descs']='Descriptions';
+$_ADDONLANG['entid']='Enter the template ID from the ON';
+$_ADDONLANG['optfield']='This field is optional';
+$_ADDONLANG['enttem']='Enter template id';
+$_ADDONLANG['change']='Change';
+$_ADDONLANG['addnew']='Add new';
+$_ADDONLANG['backlist']='Back to the list';
+$_ADDONLANG['body']='Body';
+$_ADDONLANG['noteos']='Mark the supported operating systems';
+$_ADDONLANG['update']='Update';
+$_ADDONLANG['search']='Search';
+$_ADDONLANG['invalcomb']='Invalid combination of parameters';
+$_ADDONLANG['fillederror']='Filled with errors';
+$_ADDONLANG['notmatch']='Do not match statuses';
+$_ADDONLANG['misswhmcs']='Missing in WHMCS';
+$_ADDONLANG['addent']='The entry was successfully added';
+$_ADDONLANG['addyou']='Your post was successfully added';
+$_ADDONLANG['errorname']='Error: Field Name can not be empty';
+$_ADDONLANG['errorname2']='Error: Field Name must be unique';
+$_ADDONLANG['errorname3']='Error: Field Body can not be empty';
+$_ADDONLANG['customfield']='Immunity (field name)';
+$_ADDONLANG['updok']='Successfully updated:';
+$_ADDONLANG['updok2']='Data successfully updated';
+$_ADDONLANG['deleteall']='Delete all data when removing a module';
+$_ADDONLANG['azureserver']='Сonfigure Azure';
 ?>
\ No newline at end of file
diff --git a/addons/oncontrol/logics/vmlist.php b/addons/oncontrol/logics/vmlist.php
index 65ee2ca..874bda8 100644
--- a/addons/oncontrol/logics/vmlist.php
+++ b/addons/oncontrol/logics/vmlist.php
@@ -1,296 +1,296 @@
-<?php
-use WHMCS\Database\Capsule;
-
-function vmlist_javaScripts()
-{?>
-    <script>
-
-        $( document ).ready(function() {
-            $('#host').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#statusWhmcs').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#statusOn').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#tabs').tabs({
-                active:false,
-                collapsible: true
-            });
-
-            $('#selectFilterStatus').selectize({
-                plugins:['remove_button'],
-                onChange:function () {
-                    var valueSearch = this.getValue();
-                    if(this.getValue().length>1 && (valueSearch.indexOf('notInWhmcs')!=-1)){
-                        this.clear();
-                        this.setValue('notInWhmcs');
-                        $.growl.warning({ message: "Недопустимая комбинация параметров в \"фильтр по проблеме\"" });
-                    };
-                }
-            });
-        });
-
-    </script>
-<?}
-
-$start = microtime(true);
-
-vmlist_javaScripts();
-$vars['cloudLink']= Capsule::table('tblconfiguration')
-    ->select('value')->where('setting',ione_address)->get();
-
-$arrayVariant=[
-    'Active'=>['RUNNING','POWEROFF'],
-    'Suspended'=>['SUSPENDED','POWEROFF']
-];
-
-$arrayProblems=[
-    'notInWhmcs'=>'Отсутствующие в WHMCS',
-    'hasError'=>'Заполнены с ошибками',
-    'noStatus'=>'Не совпадают статусы'
-];
-
-$searchStatusWhmcs=$_REQUEST['statusWhmcs'];
-$statusOn=$_REQUEST['statusOn'];
-$searchHost=$_REQUEST['host'];
-$searchIP=$_REQUEST['searchForIp'];
-$smartStatus=$_REQUEST['selectFilterStatus'];
-
-$page=$_REQUEST['page'];
-$pageCount=20;
-
-$hostsON=Capsule::table('mod_iOne_vmlist_cache')
-    ->groupBy('host')
-    ->lists('host');
-
-$satesON=Capsule::table('mod_iOne_vmlist_cache')
-    ->groupBy('state')
-    ->lists('state');
-
-$satusWhmcs=Capsule::table('tblhosting')
-    ->groupBy('domainstatus')
-    ->lists('domainstatus');
-
-
-if(!$searchStatusWhmcs){
-    $searchStatusWhmcs=['Suspended','Active'];
-};
-
-if(!$statusOn){
-    $statusOn=$satesON;
-};
-
-if(!$searchHost){
-    $searchHost=$hostsON;
-}
-
-if(in_array('notInWhmcs',$smartStatus)){
-    $loginWhmcs=Capsule::table('tblhosting')
-        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
-        ->lists('vmid');
-    $userIdOn=Capsule::table('mod_iOne_vmlist_cache')
-        ->whereNotIn('vmid',$loginWhmcs)
-        ->lists('login');
-}
-
-if(in_array('hasError',$smartStatus)){
-    $hostingIds[]=Capsule::table('tblhosting')
-        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
-        ->orWhere('mod_on_user.vmid',' ')
-        ->orWhere('mod_on_user.userid',' ')
-        ->orWhere('mod_on_user.loginon',' ')
-        ->orwhereNull('mod_on_user.vmid')
-        ->orWhereNull('mod_on_user.userid')
-        ->orWhereNull('mod_on_user.loginon')
-        ->lists('hosting.id');
-}
-
-
-if(in_array('noStatus',$smartStatus)){
-    foreach ($arrayVariant as $key=>$variant) {
-        $hostingIds[] = Capsule::table('tblhosting')
-            ->select('mod_iOne_vmlist_cache.state','tblhosting.domainstatus','tblhosting.id')
-            ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-            ->join('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-            ->where('tblhosting.domainstatus',$key)
-            ->whereNotIn('mod_iOne_vmlist_cache.state',$variant)
-            ->lists('tblhosting.id');
-    }
-}
-
-
-$pageGetUrl['statusWhmcs']=$searchStatusWhmcs;
-$pageGetUrl['statusOn']=$statusOn;
-$pageGetUrl['selectFilterStatus']=$smartStatus;
-$pageGetUrl['host']=$searchHost;
-$pageGetUrl['searchForIp']=$searchIP;
-$pageGetUrl=http_build_query($pageGetUrl);
-
-
-if(!$page) {
-    require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
-    $onconnect = new ONConnect();
-    $dataON = $onconnect->compare_info();
-    $userON = $dataON['result'][0];
-    $hostsON = $dataON['result'][1];
-
-    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-        ->truncate();
-    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-        ->insert($userON);
-}
-
-if(count($hostingIds)==0 && count($userIdOn)==0) {
-    $answerCount = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.userid',
-            'tblhosting.domainstatus',
-            'tblhosting.dedicatedip',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.gid', $groups)
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.domainstatus',
-            'tblhosting.userid',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid',
-            'tblhosting.dedicatedip',
-            'mod_iOne_vmlist_cache.state',
-            'mod_iOne_vmlist_cache.host')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.gid', $groups)
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-}
-elseif(count($hostingIds)!=0 && count($userIdOn)==0){
-
-    $resultHostingIds=[];
-    foreach ($hostingIds as $ids){
-        $resultHostingIds=array_merge($resultHostingIds,$ids);
-    }
-
-    $answerCount = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.userid',
-            'tblhosting.domainstatus',
-            'tblhosting.dedicatedip',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.gid', $groups)
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->whereIn('tblhosting.id',$resultHostingIds)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.domainstatus',
-            'tblhosting.userid',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid',
-            'tblhosting.dedicatedip',
-            'mod_iOne_vmlist_cache.state',
-            'mod_iOne_vmlist_cache.host')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.gid', $groups)
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->whereIn('tblhosting.id',$resultHostingIds)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-}
-elseif(count($hostingIds)==0 && count($userIdOn)!=0){
-    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-        ->whereIn('login',$userIdOn)
-        ->where('ip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('mod_iOne_vmlist_cache')
-        ->whereIn('login',$userIdOn)
-        ->where('ip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-}
-elseif(count($hostingIds)!=0 && count($userIdOn)!=0){}
-
-foreach ($userWHMCS as $oneUser)
-{
-    if(!$oneUser->vmid){
-        $oneUser->col='warning';
-    }
-    if(!$oneUser->loginon){
-        $oneUser->col='info';
-    }
-    if(!$oneUser->host){
-        $oneUser->col='danger';
-    }
-    if(!$oneUser->col){
-        $oneUser->col='success';
-    }
-}
-
-$pageAll=ceil($answerCount/$pageCount);
-
-$minPage=$page-3;
-$maxPage=$page+3;
-if($minPage<1){
-    $minPage=1;
-}
-if($maxPage>$pageAll){
-    $maxPage=$pageAll;
-}
-$LANG=$vars['_lang'];
+<?php
+use WHMCS\Database\Capsule;
+
+function vmlist_javaScripts()
+{?>
+    <script>
+
+        $( document ).ready(function() {
+            $('#host').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#statusWhmcs').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#statusOn').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#tabs').tabs({
+                active:false,
+                collapsible: true
+            });
+
+            $('#selectFilterStatus').selectize({
+                plugins:['remove_button'],
+                onChange:function () {
+                    var valueSearch = this.getValue();
+                    if(this.getValue().length>1 && (valueSearch.indexOf('notInWhmcs')!=-1)){
+                        this.clear();
+                        this.setValue('notInWhmcs');
+                        $.growl.warning({ message: "invalid combination of parameters in \"filter by issue\"" });
+                    };
+                }
+            });
+        });
+
+    </script>
+<?php }
+
+$start = microtime(true);
+
+vmlist_javaScripts();
+$vars['cloudLink']= Capsule::table('tblconfiguration')
+    ->select('value')->where('setting',ione_address)->get();
+
+$arrayVariant=[
+    'Active'=>['RUNNING','POWEROFF'],
+    'Suspended'=>['SUSPENDED','POWEROFF']
+];
+
+$arrayProblems=[
+    'notInWhmcs'=>'Missing in WHMCS',
+    'hasError'=>'Filled with errors',
+    'noStatus'=>'Statuses do not match'
+];
+
+$searchStatusWhmcs=$_REQUEST['statusWhmcs'];
+$statusOn=$_REQUEST['statusOn'];
+$searchHost=$_REQUEST['host'];
+$searchIP=$_REQUEST['searchForIp'];
+$smartStatus=$_REQUEST['selectFilterStatus'];
+
+$page=$_REQUEST['page'];
+$pageCount=20;
+
+$hostsON=Capsule::table('mod_iOne_vmlist_cache')
+    ->groupBy('host')
+    ->lists('host');
+
+$satesON=Capsule::table('mod_iOne_vmlist_cache')
+    ->groupBy('state')
+    ->lists('state');
+
+$satusWhmcs=Capsule::table('tblhosting')
+    ->groupBy('domainstatus')
+    ->lists('domainstatus');
+
+
+if(!$searchStatusWhmcs){
+    $searchStatusWhmcs=['Suspended','Active'];
+};
+
+if(!$statusOn){
+    $statusOn=$satesON;
+};
+
+if(!$searchHost){
+    $searchHost=$hostsON;
+}
+
+if(in_array('notInWhmcs',$smartStatus)){
+    $loginWhmcs=Capsule::table('tblhosting')
+        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
+        ->lists('vmid');
+    $userIdOn=Capsule::table('mod_iOne_vmlist_cache')
+        ->whereNotIn('vmid',$loginWhmcs)
+        ->lists('login');
+}
+
+if(in_array('hasError',$smartStatus)){
+    $hostingIds[]=Capsule::table('tblhosting')
+        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
+        ->orWhere('mod_on_user.vmid',' ')
+        ->orWhere('mod_on_user.userid',' ')
+        ->orWhere('mod_on_user.loginon',' ')
+        ->orwhereNull('mod_on_user.vmid')
+        ->orWhereNull('mod_on_user.userid')
+        ->orWhereNull('mod_on_user.loginon')
+        ->lists('hosting.id');
+}
+
+
+if(in_array('noStatus',$smartStatus)){
+    foreach ($arrayVariant as $key=>$variant) {
+        $hostingIds[] = Capsule::table('tblhosting')
+            ->select('mod_iOne_vmlist_cache.state','tblhosting.domainstatus','tblhosting.id')
+            ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+            ->join('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+            ->where('tblhosting.domainstatus',$key)
+            ->whereNotIn('mod_iOne_vmlist_cache.state',$variant)
+            ->lists('tblhosting.id');
+    }
+}
+
+
+$pageGetUrl['statusWhmcs']=$searchStatusWhmcs;
+$pageGetUrl['statusOn']=$statusOn;
+$pageGetUrl['selectFilterStatus']=$smartStatus;
+$pageGetUrl['host']=$searchHost;
+$pageGetUrl['searchForIp']=$searchIP;
+$pageGetUrl=http_build_query($pageGetUrl);
+
+
+if(!$page) {
+    require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
+    $onconnect = new ONConnect();
+    $dataON = $onconnect->compare_info();
+    $userON = $dataON['result'][0];
+    $hostsON = $dataON['result'][1];
+
+    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+        ->truncate();
+    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+        ->insert($userON);
+}
+
+if(count($hostingIds)==0 && count($userIdOn)==0) {
+    $answerCount = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.userid',
+            'tblhosting.domainstatus',
+            'tblhosting.dedicatedip',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.gid', $groups)
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.domainstatus',
+            'tblhosting.userid',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid',
+            'tblhosting.dedicatedip',
+            'mod_iOne_vmlist_cache.state',
+            'mod_iOne_vmlist_cache.host')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.gid', $groups)
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+}
+elseif(count($hostingIds)!=0 && count($userIdOn)==0){
+
+    $resultHostingIds=[];
+    foreach ($hostingIds as $ids){
+        $resultHostingIds=array_merge($resultHostingIds,$ids);
+    }
+
+    $answerCount = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.userid',
+            'tblhosting.domainstatus',
+            'tblhosting.dedicatedip',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.gid', $groups)
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->whereIn('tblhosting.id',$resultHostingIds)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.domainstatus',
+            'tblhosting.userid',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid',
+            'tblhosting.dedicatedip',
+            'mod_iOne_vmlist_cache.state',
+            'mod_iOne_vmlist_cache.host')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.gid', $groups)
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->whereIn('tblhosting.id',$resultHostingIds)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+}
+elseif(count($hostingIds)==0 && count($userIdOn)!=0){
+    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+        ->whereIn('login',$userIdOn)
+        ->where('ip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('mod_iOne_vmlist_cache')
+        ->whereIn('login',$userIdOn)
+        ->where('ip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+}
+elseif(count($hostingIds)!=0 && count($userIdOn)!=0){}
+
+foreach ($userWHMCS as $oneUser)
+{
+    if(!$oneUser->vmid){
+        $oneUser->col='warning';
+    }
+    if(!$oneUser->loginon){
+        $oneUser->col='info';
+    }
+    if(!$oneUser->host){
+        $oneUser->col='danger';
+    }
+    if(!$oneUser->col){
+        $oneUser->col='success';
+    }
+}
+
+$pageAll=ceil($answerCount/$pageCount);
+
+$minPage=$page-3;
+$maxPage=$page+3;
+if($minPage<1){
+    $minPage=1;
+}
+if($maxPage>$pageAll){
+    $maxPage=$pageAll;
+}
+$LANG=$vars['_lang'];
 ?>
\ No newline at end of file
diff --git a/addons/oncontrol/oncontrol.php b/addons/oncontrol/oncontrol.php
index 6d3a0d1..2f726ac 100644
--- a/addons/oncontrol/oncontrol.php
+++ b/addons/oncontrol/oncontrol.php
@@ -1,118 +1,104 @@
-<?php
-/*if( !defined( "WHMCS" ) )
-    die( "This file cannot be accessed directly" );*/
-
-use WHMCS\Database\Capsule;
-ini_set('display_errors', 0);
-
-
-function oncontrol_config() {
-    $configarray = array(
-        "name" => "Open Nebula Control",
-        "description" => "Open Nebula Control",
-        "version" => "0.5",
-        "author" => "support.by",
-        "language"=> 'english'
-        );
-    return $configarray;
-}
-
-
-function oncontrol_activate()
-{
-    $query = "CREATE TABLE `mod_iOne_vmlist_cache` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `vmid` int(11) NOT NULL,
- `userid` int(11) NOT NULL,
- `host` VARCHAR(64) NOT NULL,
- `login` VARCHAR(64) NOT NULL,
- `ip` VARCHAR(64) NOT NULL,
- `state` VARCHAR(64) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1";
-    $result = full_query($query);
-
-    $query = "CREATE TABLE `mod_onconfiguratorAddon` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` VARCHAR(64) NOT NULL,
- `descriptions` VARCHAR (512),
- `body` VARCHAR(1024) NOT NULL,
- `os` VARCHAR (128),
- `Addon` INT (11),
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1";
-    $result = full_query($query);
-
-    $query = "CREATE TABLE `mod_onconfiguratorOS` (
-      `id` int(11) NOT NULL AUTO_INCREMENT,
-      `templateid` int(11) NOT NULL,
-      `addonid` int(11) NOT NULL,
-      `description` varchar(1024),
-      PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1";
-    $result = full_query($query);
-
-    $query = "CREATE TABLE `mod_on_user` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `loginon` VARCHAR(64) NOT NULL,
- `passwordon` VARCHAR(64) NOT NULL,
- `userid` int(11) NOT NULL,
- `useridOn`int(11) NOT NULL,
- `vmid` int(11) NOT NULL,
- `id_service` int(11) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1";
-    $result = full_query($query);
-
-    $query = "CREATE TABLE `mod_onconfigurator` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `idtariff` int(11) NOT NULL,
- `os` VARCHAR(64) NOT NULL,
- `addonid` int(11) NOT NULL,
- `templateid`int(11) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1";
-    $result = full_query($query);
-
-}
-
-function oncontrol_deactivate($vars)
-{
-    $deletedate = Capsule::table('tblconfiguration')->where('setting', 'ione_delete')->get();
-    if ($deletedate[0]->value == 'on'){
-        $query = "DROP TABLE `mod_onconfiguratorAddon`";
-        $result = full_query($query);
-
-        $query = "DROP TABLE `mod_onconfiguratorOS`";
-        $result = full_query($query);
-
-        $query = "DROP TABLE `mod_on_user`";
-        $result = full_query($query);
-
-        $query = "DROP TABLE `mod_iOne_vmlist_cache`";
-        $result = full_query($query);
-
-        $query = "DROP TABLE `mod_onconfigurator`";
-        $result = full_query($query);
-
-        return array('status'=>'success','description'=>'All data is deleted');
-    }else{
-        return array('status'=>'success','description'=>'Module removed');
-    }
-}
-
-
-function oncontrol_output($vars)
-{
-    require_once ('classes/Loader.php');
-    $loader = new Loader($vars);
-    $host = Capsule::table('tblconfiguration')->where('setting', 'ione_config_host')->get();
-    $port = Capsule::table('tblconfiguration')->where('setting', 'ione_config_port')->get();
-    $address = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
-    if ($host == NULL || $port == NULL || $address == NULL){
-        $loader->constructPageFirstStart();
-    }else{
-    $loader->constructPage();
-        }
-}
-
+<?php
+/*if( !defined( "WHMCS" ) )
+    die( "This file cannot be accessed directly" );*/
+
+use WHMCS\Database\Capsule;
+
+
+function oncontrol_config() {
+    $configarray = array(
+        "name" => "Open Nebula Control",
+        "description" => "Open Nebula Control",
+        "version" => "0.5",
+        "author" => "support.by",
+        "language"=> 'english'
+        );
+    return $configarray;
+}
+
+
+function oncontrol_activate()
+{
+    $query = "CREATE TABLE `mod_iOne_vmlist_cache` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `vmid` int(11) NOT NULL,
+ `userid` int(11) NOT NULL,
+ `host` VARCHAR(64) NOT NULL,
+ `login` VARCHAR(64) NOT NULL,
+ `ip` VARCHAR(64) NOT NULL,
+ `state` VARCHAR(64) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1";
+    $result = full_query($query);
+
+    $query = "CREATE TABLE `mod_onconfiguratorOS` (
+      `id` int(11) NOT NULL AUTO_INCREMENT,
+      `templateid` int(11) NOT NULL,
+      `addonid` int(11) NOT NULL,
+      `description` varchar(1024),
+      PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1";
+    $result = full_query($query);
+
+    $query = "CREATE TABLE `mod_on_user` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `loginon` VARCHAR(64) NOT NULL,
+ `passwordon` VARCHAR(64) NOT NULL,
+ `userid` int(11) NOT NULL,
+ `useridOn`int(11) NOT NULL,
+ `vmid` int(11) NOT NULL,
+ `id_service` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1";
+    $result = full_query($query);
+
+    $query = "CREATE TABLE `mod_onconfigurator` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `idtariff` int(11) NOT NULL,
+ `os` VARCHAR(64) NOT NULL,
+ `addonid` int(11) NOT NULL,
+ `templateid`int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1";
+    $result = full_query($query);
+
+
+}
+
+function oncontrol_deactivate($vars)
+{
+    $deletedate = Capsule::table('tblconfiguration')->where('setting', 'ione_delete')->get();
+    if ($deletedate[0]->value == 'on'){
+        $query = "DROP TABLE `mod_onconfiguratorOS`";
+        $result = full_query($query);
+
+        $query = "DROP TABLE `mod_on_user`";
+        $result = full_query($query);
+
+        $query = "DROP TABLE `mod_iOne_vmlist_cache`";
+        $result = full_query($query);
+
+        $query = "DROP TABLE `mod_onconfigurator`";
+        $result = full_query($query);
+
+        return array('status'=>'success','description'=>'All data is deleted');
+    }else{
+        return array('status'=>'success','description'=>'Module removed');
+    }
+}
+
+
+function oncontrol_output($vars)
+{
+    require_once ('classes/Loader.php');
+    $loader = new Loader($vars);
+    $host = Capsule::table('tblconfiguration')->where('setting', 'ione_config_host')->get();
+    $port = Capsule::table('tblconfiguration')->where('setting', 'ione_config_port')->get();
+    $address = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
+    if ($host == NULL || $port == NULL || $address == NULL){
+        $loader->constructPageFirstStart();
+    }else{
+    $loader->constructPage();
+        }
+}
+
diff --git a/addons/oncontrol/pages/configuration/menu.php b/addons/oncontrol/pages/configuration/menu.php
index 99ed016..ef465f9 100644
--- a/addons/oncontrol/pages/configuration/menu.php
+++ b/addons/oncontrol/pages/configuration/menu.php
@@ -1,4 +1,4 @@
-<ul class="nav nav-pills nav-stacked">
-    <li><a class="list-group-item <? if($this->mod=='moduleconfig'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration&mod=moduleconfig"><?=$this->LANG['moduleConfigurate']?></a></li>
-    <li><a class="list-group-item <? if($this->mod=='newConfig'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration&mod=newConfig"><?=$this->LANG['idConfigurate']?></a></li>
-</ul>
+<ul class="nav nav-pills nav-stacked">
+    <li><a class="list-group-item <? if($this->mod=='moduleconfig'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration&mod=moduleconfig"><?=$this->LANG['moduleConfigurate']?></a></li>
+    <li><a class="list-group-item <? if($this->mod=='newConfig'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=configuration&mod=newConfig"><?=$this->LANG['idConfigurate']?></a></li>
+</ul>
diff --git a/addons/oncontrol/pages/configuration/moduleconfig.php b/addons/oncontrol/pages/configuration/moduleconfig.php
index c35264b..98a3ab3 100644
--- a/addons/oncontrol/pages/configuration/moduleconfig.php
+++ b/addons/oncontrol/pages/configuration/moduleconfig.php
@@ -1,161 +1,144 @@
-<?php if( !defined( "WHMCS" ) )
-    die( "This file cannot be accessed directly" );
-use WHMCS\Database\Capsule;
-
-
-function addOrUpdate($name,$value){
-    if(Capsule::table( 'tblconfiguration' )
-        ->where('setting',$name)
-        ->get()) {
-        Capsule::table( 'tblconfiguration' )
-            ->where('setting',$name)
-            ->update([
-                'setting'=>$name,
-                'value'=>$value
-            ]);
-    }
-    else{
-        $result = Capsule::table('tblconfiguration')
-            ->insert([
-                'setting' => $name,
-                'value' => $value
-            ]);
-    };
-}
-
-
-    if ($_POST['save'] == 'save') {
-        if ($_POST['host']) {
-            $this->addOrUpdate('ione_config_host', $_POST['host']);
-        }
-
-        if ($_POST['port']) {
-            $this->addOrUpdate('ione_config_port', $_POST['port']);
-        }
-
-        if ($_POST['address']) {
-            $this->addOrUpdate('ione_address', $_POST['address']);
-        }
-
-        if ($_POST['admin']) {
-            $this->addOrUpdate('whmcs_admin', $_POST['admin']);
-        }
-
-        if ($_POST['customfield']) {
-            $this->addOrUpdate('customfield', $_POST['customfield']);
-        }
-
-        if ($_POST['iaas_group']) {
-            $this->addOrUpdate('ione_iaas_group', $_POST['iaas_group']);
-        }
-
-        if ($_POST['ansiblePort']) {
-            $this->addOrUpdate('ansibledb_config_port', $_POST['ansiblePort']);
-        }
-
-        if ($_POST['groups']) {
-            $strGroup = implode($_POST['groups'], ',');
-            $this->addOrUpdate('vmlist_config_groups', $strGroup);
-        }
-        if ($_POST['useAnsible']) {
-            $this->addOrUpdate('ione_use_ansible', $_POST['useAnsible']);
-        } else {
-            $this->addOrUpdate('ione_use_ansible', 'off');
-        }
-        if ($_POST['deletedate']) {
-            $this->addOrUpdate('ione_delete', $_POST['deletedate']);
-        } else {
-            $this->addOrUpdate('ione_delete', 'off');
-        }
-
-}
-
-    $host = Capsule::table('tblconfiguration')->where('setting', 'ione_config_host')->get();
-    $port = Capsule::table('tblconfiguration')->where('setting', 'ione_config_port')->get();
-    $address = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
-    $admin = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-    $custom = Capsule::table('tblconfiguration')->where('setting', 'customfield')->get();
-    $portAnsible = Capsule::table('tblconfiguration')->where('setting', 'ansibledb_config_port')->get();
-    $isCheckAnsible = Capsule::table('tblconfiguration')->where('setting', 'ione_use_ansible')->get();
-    $deletedate = Capsule::table('tblconfiguration')->where('setting', 'ione_delete')->get();
-    $iaas = Capsule::table('tblconfiguration')->where('setting', 'ione_iaas_group')->get();
-
-
-    $descriptions = Capsule::table('tbladdons')
-        ->select('description')
-        ->where('description', 'like', '%"GROUP"%')
-        ->lists('description');
-    $groups = [];
-
-    foreach ($descriptions as $description) {
-        $jsn = json_decode($description);
-        if (!in_array($jsn->GROUP, $groups)) {
-            $groups[] = $jsn->GROUP;
-        }
-    }
-
-    $currentGroups = Capsule::table('tblconfiguration')
-        ->where('setting', 'vmlist_config_groups')
-        ->pluck('value');
-    $currentGroups = explode(',', $currentGroups);
-
-?>
-
-<div class="panel panel-default">
-    <div class="panel-body">
-        <form method="post" name="save">
-            <div class="form-group">
-                <label for="host"><?=$this->LANG['whmcsadmin']?></label>
-                <input id="host" class="form-control" type="text" name="admin" value="<?=$admin[0]->value?>">
-            </div>
-            <div class="form-group">
-                <label for="host"><?=$this->LANG['PanelAddress']?></label>
-                <input id="host" class="form-control" type="text" name="address" value="<?=$address[0]->value?>">
-            </div>
-            <div class="form-group">
-                <label for="host"><?=$this->LANG['PanelIP']?></label>
-                <input id="host" class="form-control" type="text" name="host" value="<?=$host[0]->value?>">
-            </div>
-            <div class="form-group">
-                <label for="port"><?=$this->LANG['PanelPort']?></label>
-                <input id="port" class="form-control" type="text" name="port" value="<?=$port[0]->value?>">
-            </div>
-            <div class="form-group">
-                <label for="port"><?=$this->LANG['customfield']?></label>
-                <input id="port" class="form-control" type="text" name="customfield" value="<?=$custom[0]->value?>">
-            </div>
-            <div class="form-group">
-                <label for="iaas_group">ID группы iaas пользователей в ON</label>
-                <input id="iaas_group" class="form-control" type="text" name="iaas_group" value="<?=$iaas[0]->value?>">
-            </div>
-    </div>
-</div>
-
-<div class="panel panel-default">
-    <div class="panel-body">
-            <div class="form-group">
-                <label for="ansiblePort"><?=$this->LANG['defaultPortAnsible']?></label>
-                <input id="ansiblePort" class="form-control" type="text" name="ansiblePort" value="<?=$portAnsible[0]->value?>">
-            </div>
-    </div>
-</div>
-
-
-<div class="panel panel-default">
-    <div class="panel-body">
-            <table class="table table-striped table-bordered table-hover">
-                <input id="useAnsibleCheckbox" type="checkbox" name="useAnsible" <?if($isCheckAnsible[0]->value=='on'){print 'checked';}?>>
-                <label for="useAnsibleCheckbox"><?=$this->LANG['ansibledbuse']?>: </label>
-            </table>
-        <table class="table table-striped table-bordered table-hover">
-            <input id="deletedate" type="checkbox" name="deletedate" <?if($deletedate[0]->value=='on'){print 'checked';}?>>
-            <label for="deletedate"><?=$this->LANG['deleteall']?>: </label>
-        </table>
-            <button class="form-control" type="submit" name="save" value="save"><?=$this->LANG['buttonOnconSubmit']?></button>
-        </form>
-    </div>
-</div>
-
-
-</div>
-
+<?php if( !defined( "WHMCS" ) )
+    die( "This file cannot be accessed directly" );
+use WHMCS\Database\Capsule;
+
+function addOrUpdate($name,$value){
+    if(Capsule::table( 'tblconfiguration' )
+        ->where('setting',$name)
+        ->get()) {
+        Capsule::table( 'tblconfiguration' )
+            ->where('setting',$name)
+            ->update([
+                'setting'=>$name,
+                'value'=>$value
+            ]);
+    }
+    else{
+        $result = Capsule::table('tblconfiguration')
+            ->insert([
+                'setting' => $name,
+                'value' => $value
+            ]);
+    };
+}
+
+
+if($_POST['save'] == 'save') {
+    if ($_POST['host']) {
+        $this->addOrUpdate('ione_config_host', $_POST['host']);
+    }
+
+    if ($_POST['port']) {
+        $this->addOrUpdate('ione_config_port', $_POST['port']);
+    }
+
+    if ($_POST['address']) {
+        $this->addOrUpdate('ione_address', $_POST['address']);
+    }
+
+    if ($_POST['admin']) {
+        $this->addOrUpdate('whmcs_admin', $_POST['admin']);
+    }
+
+    if ($_POST['customfield']) {
+        $this->addOrUpdate('customfield', $_POST['customfield']);
+    }
+
+    if ($_POST['groups']) {
+        $strGroup = implode($_POST['groups'], ',');
+        $this->addOrUpdate('vmlist_config_groups', $strGroup);
+    }
+    if ($_POST['deletedate']) {
+        $this->addOrUpdate('ione_delete', $_POST['deletedate']);
+    } else {
+        $this->addOrUpdate('ione_delete', 'off');
+    }
+
+    if ($_POST['login']) {
+        $this->addOrUpdate('ione_config_login', $_POST['login']);
+    }
+    if ($_POST['passwd']) {
+        $this->addOrUpdate('ione_config_passwd', $_POST['passwd']);
+    }
+
+}
+
+    $host = Capsule::table('tblconfiguration')->where('setting', 'ione_config_host')->get();
+    $port = Capsule::table('tblconfiguration')->where('setting', 'ione_config_port')->get();
+    $address = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
+    $admin = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+    $custom = Capsule::table('tblconfiguration')->where('setting', 'customfield')->get();
+    $deletedate = Capsule::table('tblconfiguration')->where('setting', 'ione_delete')->get();
+    $login = Capsule::table('tblconfiguration')->where('setting', 'ione_config_login')->get();
+    $passwd = Capsule::table('tblconfiguration')->where('setting', 'ione_config_passwd')->get();
+
+
+    $descriptions = Capsule::table('tbladdons')
+        ->select('description')
+        ->where('description', 'like', '%"GROUP"%')
+        ->lists('description');
+    $groups = [];
+
+    foreach ($descriptions as $description) {
+        $jsn = json_decode($description);
+        if (!in_array($jsn->GROUP, $groups)) {
+            $groups[] = $jsn->GROUP;
+        }
+    }
+
+    $currentGroups = Capsule::table('tblconfiguration')
+        ->where('setting', 'vmlist_config_groups')
+        ->pluck('value');
+    $currentGroups = explode(',', $currentGroups);
+
+?>
+
+<div class="panel panel-default">
+    <div class="panel-body">
+        <form method="post" name="save">
+            <div class="form-group">
+                <label for="host"><?=$this->LANG['whmcsadmin']?></label>
+                <input id="host" class="form-control" type="text" name="admin" value="<?=$admin[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="host"><?=$this->LANG['PanelAddress']?></label>
+                <input id="host" class="form-control" type="text" name="address" value="<?=$address[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="host"><?=$this->LANG['PanelIP']?></label>
+                <input id="host" class="form-control" type="text" name="host" value="<?=$host[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="port"><?=$this->LANG['PanelPort']?></label>
+                <input id="port" class="form-control" type="text" name="port" value="<?=$port[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="port"><?=$this->LANG['customfield']?></label>
+                <input id="port" class="form-control" type="text" name="customfield" value="<?=$custom[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="login">ON Login</label>
+                <input id="login" class="form-control" type="text" name="login" value="<?=$login[0]->value?>">
+            </div>
+            <div class="form-group">
+                <label for="passwd">ON Passwrod</label>
+                <input id="passwd" class="form-control" type="text" name="passwd" value="<?=$passwd[0]->value?>">
+            </div>
+    </div>
+</div>
+
+
+<div class="panel panel-default">
+    <div class="panel-body">
+        <table class="table table-striped table-bordered table-hover">
+            <input id="deletedate" type="checkbox" name="deletedate" <?php if($deletedate[0]->value=='on'){print 'checked';}?>>
+            <label for="deletedate"><?=$this->LANG['deleteall']?>: </label>
+        </table>
+            <button class="form-control" type="submit" name="save" value="save"><?=$this->LANG['buttonOnconSubmit']?></button>
+        </form>
+    </div>
+</div>
+
+
+</div>
+
diff --git a/addons/oncontrol/pages/configuration/newConfig.php b/addons/oncontrol/pages/configuration/newConfig.php
index 425a81c..0f23d6d 100644
--- a/addons/oncontrol/pages/configuration/newConfig.php
+++ b/addons/oncontrol/pages/configuration/newConfig.php
@@ -1,187 +1,186 @@
-<?php
-if( !defined( "WHMCS" ) )
-    die( "This file cannot be accessed directly" );
-use WHMCS\Database\Capsule;
-ini_set('display_errors', 0);
-
-function onconfigurator_errorMessage($bigText,$allText){
-    printf('<div class="errorbox">
-<strong class="title">%s</strong><br>
-%s</div>',$bigText,$allText);
-}
-
-function onconfigurator_successMessage($bigText,$allText){
-    printf('<div class="successbox">
-<strong class="title">%s</strong><br>%s
-</div>',$bigText,$allText);
-}
-
-
-if($_POST['action']){
-    $action=key($_POST['action']);
-    switch ($action){
-        case 'add':
-            $result=Capsule::table( 'mod_onconfiguratorOS' )
-                ->insert([
-                    'addonid'=>$_POST['osadd'],
-                    'templateid'=>$_POST['templateid'],
-                    'description'=>$_POST['descriptions'],
-                ]);
-            if ($result){
-                onconfigurator_successMessage($this->LANG['dataadd'].' ',$this->LANG['dataaddbd']);
-            }else{
-                onconfigurator_errorMessage($this->LANG['Error'].' ',$this->LANG['faildb']);
-            }
-            break;
-        case 'edit':
-            $result=Capsule::table( 'mod_onconfiguratorOS' )
-                ->where('id',$_POST['id'])
-                ->update([
-                    'addonid'=>$_POST['osadd'],
-                    'templateid'=>$_POST['templateid'],
-                    'description'=>$_POST['descriptions'],
-                ]);
-            if ($result){
-                onconfigurator_successMessage($this->LANG['updatedate'].' ',$this->LANG['updatedatedb']);
-            }else{
-                onconfigurator_errorMessage($this->LANG['error'].' ',$this->LANG['errordb']);
-            }
-            break;
-        case 'delete':
-            foreach ($_POST['check'] as $key=>$value){
-                $check[]=$key;
-            }
-            $result=Capsule::table( 'mod_onconfiguratorOS' )
-                ->whereIn('id',$check)
-                ->delete();
-            if ($result){
-                onconfigurator_successMessage($this->LANG['datadel'].' ',$this->LANG['datadeldb']);
-            }else{
-                onconfigurator_errorMessage($this->LANG['error'].' ',$this->LANG['deldb']);
-            }
-            break;
-    }
-}
-$tariffs=Capsule::table('mod_onconfiguratorOS')->get();
-?>
-
-<script>
-    var tariffs=<?=json_encode($tariffs,true)?>;
-
-    $(document).ready(
-        function () {
-
-            dialog = $("#edit-options").dialog({
-                autoOpen: false,
-                modal: true,
-                width: 900
-            });
-
-            $("input:checkbox").bind("change click", function () {
-                checkbox = $('input:checked');
-                if(checkbox.length==1){
-                    $('#editButton').prop("disabled",false);
-                }else{
-                    $('#editButton').prop("disabled",true);
-                }
-                if(checkbox.length>0){
-                    $('#deleteButton').prop("disabled",false);
-                }else{
-                    $('#deleteButton').prop("disabled",true);
-                }
-            });
-
-            $("#editButton").button().on("click", function () {
-                var checkbox = $('input:checked').first().attr('name');
-                checkbox=checkbox.substr(6,checkbox.length-7);
-
-                var findObject=tariffs.find(function (obj) {
-                    if(obj.id==checkbox){
-                        return true;
-                    }
-                });
-                $('#templateid').attr({
-                    "value":findObject.templateid
-                });
-                $('#osadd').val(findObject.addonid);
-                $('#descriptions').text(findObject.description);
-                $('#hidden_value').attr("value",findObject.id);
-                $('#actionButton').attr({
-                    "name":"action[edit]",
-                    "value":"<?=$this->LANG['savech']?>"
-                });
-                $('.panel-heading').text("<?=$this->LANG['cortariff']?>");
-                dialog.dialog("open");
-            });
-
-            $("#addButton").button().on("click", function () {
-                $('#actionButton').attr({
-                    "name":"action[add]",
-                    "value":"<?=$this->LANG['add']?>"
-                });
-                $('#templateid').attr({
-                    "value":""
-                });
-                $('#descriptions').text("");
-                $('#hidden_value').attr("value","");
-                $('.panel-heading').text("<?=$this->LANG['addtariff']?>");
-                dialog.dialog("open");
-            });
-            $(".have-tooltip").tooltip({
-                track: false
-            });
-            $('#editButton').prop("disabled",true);
-            $('#deleteButton').prop("disabled",true);
-        });
-</script>
-
-<form method="post">
-    <table class="table table-striped table-bordered table-hover">
-            <tr>
-                <th>#</th>
-                <th><?=$this->LANG['osname']?></th>
-                <th><?=$this->LANG['idtem']?></th>
-                <th><?=$this->LANG['desc']?></th>
-            </tr>
-        <?php foreach ($tariffs as $os):?>
-            <tr>
-                <td id="<?=$os->id?>"><input type="checkbox" name="check[<?=$os->id?>]"></td>
-                <td><?=Capsule::table( 'tbladdons' )->select('name')->where( 'id',$os->addonid)->first()->name?></td>
-                <td><?=$os->templateid?></td>
-                <td class="have-tooltip" title="<?=$os->description?>"><?=substr($os->description,0,200)?>...</td>
-            </tr>
-        <?php endforeach;?>
-    </table>
-
-    <div class="btn-group" role="group">
-        <button id="addButton" type="button" class="btn btn-info"><?=$this->LANG['buttonAdd']?></button>
-        <input id="deleteButton" type="submit" class="btn btn-info ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" name="action[delete]" value="<?=$this->LANG['buttonDelete']?>">
-        <button id="editButton" type="button" class="btn btn-info"><?=$this->LANG['buttonEdit']?></button>
-    </div>
-</form>
-
-<div id="edit-options" class="panel panel-info">
-    <div class="panel-heading"><?=$this->LANG['addtariff']?></div>
-    <form method="post">
-        <input id="hidden_value" type="hidden" name="id" value="">
-        <div class="form-group">
-            <label for="templateid"><?=$this->LANG['idtem']?> :</label>
-            <input type="text" name="templateid" class="form-control" id="templateid" autocomplete="off" placeholder="<?=$this->LANG['enttem']?>">
-            <small class="form-text text-muted"><?=$this->LANG['entid']?></small>
-        </div>
-        <div class="form-group">
-            <select id="osadd" class="form-control" type="select" name="osadd">
-                <?php foreach (Capsule::table( 'tbladdons' )->where( 'description','like',  '%"GROUP": "os"%')->get() as $os):?>
-                    <option value="<?=$os->id?>"><?=$os->name?></option>
-                <?php endforeach;?>
-            </select>
-        </div>
-        <div class="form-group">
-            <label for="descriptions"><?=$this->LANG['descs']?>:</label>
-            <textarea name="descriptions" class="form-control" id="descriptions"></textarea>
-            <small id="descriptionsHelp" class="form-text text-muted"><?=$this->LANG['optfield']?></small>
-        </div>
-        <input id="actionButton" type="submit" name="action[edit]" value="Принять изменения" class="btn btn-info">
-    </form>
-</div>
-
+<?php
+if( !defined( "WHMCS" ) )
+    die( "This file cannot be accessed directly" );
+use WHMCS\Database\Capsule;
+
+function onconfigurator_errorMessage($bigText,$allText){
+    printf('<div class="errorbox">
+<strong class="title">%s</strong><br>
+%s</div>',$bigText,$allText);
+}
+
+function onconfigurator_successMessage($bigText,$allText){
+    printf('<div class="successbox">
+<strong class="title">%s</strong><br>%s
+</div>',$bigText,$allText);
+}
+
+
+if($_POST['action']){
+    $action=key($_POST['action']);
+    switch ($action){
+        case 'add':
+            $result=Capsule::table( 'mod_onconfiguratorOS' )
+                ->insert([
+                    'addonid'=>$_POST['osadd'],
+                    'templateid'=>$_POST['templateid'],
+                    'description'=>$_POST['descriptions'],
+                ]);
+            if ($result){
+                onconfigurator_successMessage($this->LANG['dataadd'].' ',$this->LANG['dataaddbd']);
+            }else{
+                onconfigurator_errorMessage($this->LANG['Error'].' ',$this->LANG['faildb']);
+            }
+            break;
+        case 'edit':
+            $result=Capsule::table( 'mod_onconfiguratorOS' )
+                ->where('id',$_POST['id'])
+                ->update([
+                    'addonid'=>$_POST['osadd'],
+                    'templateid'=>$_POST['templateid'],
+                    'description'=>$_POST['descriptions'],
+                ]);
+            if ($result){
+                onconfigurator_successMessage($this->LANG['updatedate'].' ',$this->LANG['updatedatedb']);
+            }else{
+                onconfigurator_errorMessage($this->LANG['error'].' ',$this->LANG['errordb']);
+            }
+            break;
+        case 'delete':
+            foreach ($_POST['check'] as $key=>$value){
+                $check[]=$key;
+            }
+            $result=Capsule::table( 'mod_onconfiguratorOS' )
+                ->whereIn('id',$check)
+                ->delete();
+            if ($result){
+                onconfigurator_successMessage($this->LANG['datadel'].' ',$this->LANG['datadeldb']);
+            }else{
+                onconfigurator_errorMessage($this->LANG['error'].' ',$this->LANG['deldb']);
+            }
+            break;
+    }
+}
+$tariffs=Capsule::table('mod_onconfiguratorOS')->get();
+?>
+
+<script>
+    var tariffs=<?=json_encode($tariffs,true)?>;
+
+    $(document).ready(
+        function () {
+
+            dialog = $("#edit-options").dialog({
+                autoOpen: false,
+                modal: true,
+                width: 900
+            });
+
+            $("input:checkbox").bind("change click", function () {
+                checkbox = $('input:checked');
+                if(checkbox.length==1){
+                    $('#editButton').prop("disabled",false);
+                }else{
+                    $('#editButton').prop("disabled",true);
+                }
+                if(checkbox.length>0){
+                    $('#deleteButton').prop("disabled",false);
+                }else{
+                    $('#deleteButton').prop("disabled",true);
+                }
+            });
+
+            $("#editButton").button().on("click", function () {
+                var checkbox = $('input:checked').first().attr('name');
+                checkbox=checkbox.substr(6,checkbox.length-7);
+
+                var findObject=tariffs.find(function (obj) {
+                    if(obj.id==checkbox){
+                        return true;
+                    }
+                });
+                $('#templateid').attr({
+                    "value":findObject.templateid
+                });
+                $('#osadd').val(findObject.addonid);
+                $('#descriptions').text(findObject.description);
+                $('#hidden_value').attr("value",findObject.id);
+                $('#actionButton').attr({
+                    "name":"action[edit]",
+                    "value":"<?=$this->LANG['savech']?>"
+                });
+                $('.panel-heading').text("<?=$this->LANG['cortariff']?>");
+                dialog.dialog("open");
+            });
+
+            $("#addButton").button().on("click", function () {
+                $('#actionButton').attr({
+                    "name":"action[add]",
+                    "value":"<?=$this->LANG['add']?>"
+                });
+                $('#templateid').attr({
+                    "value":""
+                });
+                $('#descriptions').text("");
+                $('#hidden_value').attr("value","");
+                $('.panel-heading').text("<?=$this->LANG['addtariff']?>");
+                dialog.dialog("open");
+            });
+            $(".have-tooltip").tooltip({
+                track: false
+            });
+            $('#editButton').prop("disabled",true);
+            $('#deleteButton').prop("disabled",true);
+        });
+</script>
+
+<form method="post">
+    <table class="table table-striped table-bordered table-hover">
+            <tr>
+                <th>#</th>
+                <th><?=$this->LANG['osname']?></th>
+                <th><?=$this->LANG['idtem']?></th>
+                <th><?=$this->LANG['desc']?></th>
+            </tr>
+        <?php foreach ($tariffs as $os):?>
+            <tr>
+                <td id="<?=$os->id?>"><input type="checkbox" name="check[<?=$os->id?>]"></td>
+                <td><?=Capsule::table( 'tbladdons' )->select('name')->where( 'id',$os->addonid)->first()->name?></td>
+                <td><?=$os->templateid?></td>
+                <td class="have-tooltip" title="<?=$os->description?>"><?=substr($os->description,0,200)?>...</td>
+            </tr>
+        <?php endforeach;?>
+    </table>
+
+    <div class="btn-group" role="group">
+        <button id="addButton" type="button" class="btn btn-info"><?=$this->LANG['buttonAdd']?></button>
+        <input id="deleteButton" type="submit" class="btn btn-info ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" name="action[delete]" value="<?=$this->LANG['buttonDelete']?>">
+        <button id="editButton" type="button" class="btn btn-info"><?=$this->LANG['buttonEdit']?></button>
+    </div>
+</form>
+
+<div id="edit-options" class="panel panel-info">
+    <div class="panel-heading"><?=$this->LANG['addtariff']?></div>
+    <form method="post">
+        <input id="hidden_value" type="hidden" name="id" value="">
+        <div class="form-group">
+            <label for="templateid"><?=$this->LANG['idtem']?> :</label>
+            <input type="text" name="templateid" class="form-control" id="templateid" autocomplete="off" placeholder="<?=$this->LANG['enttem']?>">
+            <small class="form-text text-muted"><?=$this->LANG['entid']?></small>
+        </div>
+        <div class="form-group">
+            <select id="osadd" class="form-control" type="select" name="osadd">
+                <?php foreach (Capsule::table( 'tbladdons' )->where( 'description','like',  '%"GROUP": "os"%')->get() as $os):?>
+                    <option value="<?=$os->id?>"><?=$os->name?></option>
+                <?php endforeach;?>
+            </select>
+        </div>
+        <div class="form-group">
+            <label for="descriptions"><?=$this->LANG['descs']?>:</label>
+            <textarea name="descriptions" class="form-control" id="descriptions"></textarea>
+            <small id="descriptionsHelp" class="form-text text-muted"><?=$this->LANG['optfield']?></small>
+        </div>
+        <input id="actionButton" type="submit" name="action[edit]" value="Accept changes" class="btn btn-info">
+    </form>
+</div>
+
diff --git a/addons/oncontrol/pages/vmlist/freeip.php b/addons/oncontrol/pages/vmlist/freeip.php
index 2222d16..c33b500 100644
--- a/addons/oncontrol/pages/vmlist/freeip.php
+++ b/addons/oncontrol/pages/vmlist/freeip.php
@@ -1,12 +1,13 @@
-<?
-ini_set('display_errors', 0);
-$result = $this->onconnect->compare_info();
-$freeIP = $result['result']['2']['0'];
-?>
-<table class="table table-bordered table-hover table-condensed">
-    <?php foreach ($freeIP as $it): ?>
-        <tr>
-            <td><?= $it ?></td>
-        </tr>
-    <?php endforeach; ?>
+<?php
+ini_set('display_errors', 0);
+$result = $this->onconnect->compare_info();
+$freeIP = $result['result']['2']['0'];
+
+?>
+<table class="table table-bordered table-hover table-condensed">
+    <?php foreach ($freeIP as $it): ?>
+        <tr>
+            <td><?= $it ?></td>
+        </tr>
+    <?php endforeach; ?>
 </table>
\ No newline at end of file
diff --git a/addons/oncontrol/pages/vmlist/menu.php b/addons/oncontrol/pages/vmlist/menu.php
index 0cf27df..9fb524f 100644
--- a/addons/oncontrol/pages/vmlist/menu.php
+++ b/addons/oncontrol/pages/vmlist/menu.php
@@ -1,5 +1,5 @@
-<ul class="nav nav-pills nav-stacked" onclick="$('.loading').attr('hidden',false);">
-    <li><a class="list-group-item <? if($this->mod=='vmlist'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=vmlist"><?=$this->LANG['usedIP']?></a></li>
-    <li><a class="list-group-item <? if($this->mod=='freeip'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=freeip"><?=$this->LANG['freeIp']?></a></li>
-    <li><a class="list-group-item <? if($this->mod=='qutas'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=qutas"><?=$this->LANG['quotas']?></a></li>
-</ul>
+<ul class="nav nav-pills nav-stacked" onclick="$('.loading').attr('hidden',false);">
+    <li><a class="list-group-item <?php if($this->mod=='vmlist'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=vmlist"><?=$this->LANG['usedIP']?></a></li>
+    <li><a class="list-group-item <?php if($this->mod=='freeip'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=freeip"><?=$this->LANG['freeIp']?></a></li>
+    <li><a class="list-group-item <?php if($this->mod=='qutas'){print 'active';}?>" onclick="$('.loading').attr('hidden',false);" href="<?=$this->vars['modulelink']?>&tabs=vmlist&mod=qutas"><?=$this->LANG['quotas']?></a></li>
+</ul>
diff --git a/addons/oncontrol/pages/vmlist/panel.php b/addons/oncontrol/pages/vmlist/panel.php
index d4980c2..77710b5 100644
--- a/addons/oncontrol/pages/vmlist/panel.php
+++ b/addons/oncontrol/pages/vmlist/panel.php
@@ -1,549 +1,513 @@
-<?php
-ini_set('display_errors', 0);
-if (!defined("WHMCS")) {
-    die("This file cannot be accessed directly");
-}
-
-use WHMCS\Database\Capsule as Capsule;
-
-
-if (isset($_POST['action']))                                            // <-- ACTIONS LIKE SUSPEND/UNSUSPEND ARE HERE
-{
-    require_once 'service_manager.php';
-}
-
-$system_id = $_GET['serviceId'];
-
-
-$addons = Capsule::table('tbladdons')
-    ->select('id', 'name', 'description')
-    ->get();
-
-$service = Capsule::table('tblproducts')
-    ->select('tblproducts.name', 'tblhosting.userid', 'tblhosting.packageid', 'tblhosting.dedicatedip',
-        'tblhosting.domain', 'tblhosting.id', 'server')
-    ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-    ->where('tblhosting.id', $system_id)
-    ->first();
-
-$service_addons = Capsule::table('tblhostingaddons')
-    ->where('hostingid', $system_id)
-    ->get();
-
-$service_user = Capsule::table('tblclients')
-    ->where('id', $service->userid)
-    ->first();
-
-$ansibles = Capsule::table('mod_onconfiguratorAddon')
-    ->get();
-
-$machineInfo = Capsule::table('mod_on_user')
-    ->where('id_service', $system_id)
-    ->first();
-
-$server_ip = Capsule::table('tblservers')
-    ->where('id', $service->server)
-    ->select('ipaddress')
-    ->first()->ipaddress;
-
-$snapshotList = $this->onconnect->getSnapshotList($machineInfo->vmid);
-if ($snapshotList['result']['0'] == '') {
-    unset ($snapshotList['result']['0']);
-}
-
-
-$reinstal_settings = Capsule::table('tblproduct_upgrade_products')
-    ->where('product_id', $service->packageid)
-    ->select('upgrade_product_id')
-    ->get();
-
-$vm_data = $this->onconnect->getVmData($machineInfo->vmid)['result'];
-
-$groups = [];
-foreach ($addons as $addon) {
-    $addon->description = json_decode($addon->description, 1);
-    if (json_last_error() === JSON_ERROR_NONE && $addon->description != '') {
-        $groups = add_group_to_array($groups, $addon->description['GROUP']);
-    }
-}
-
-function getStatusMachine($onconnect, $vmid)
-{
-    $status = $onconnect->lcmStateStr($vmid);
-    if ($status->result == 'LCM_INIT') {
-        $status = $onconnect->stateStr($vmid);
-    }
-    return $status;
-}
-
-function add_group_to_array($current_array, $group)
-{
-    if (isset($group)) {
-        if (!in_array($group, $current_array)) {
-            $current_array[] = $group;
-        }
-    }
-    return $current_array;
-}
-
-
-function is_checked_box($addon_name)
-{
-    if ($_POST[$addon_name] == 'on') {
-        return 'checked';
-    } else {
-        return '';
-    }
-}
-
-function get_color_by_status($status)
-{
-    switch ($status) {
-
-        case 'RUNNING':
-            return 'green';
-
-        default :
-            return 'blue';
-    }
-}
-
-
-$wanted_groups = [];
-
-foreach ($_POST as $wanted_group => $value) {
-    if ($value == 'on' && is_string($wanted_group)) {
-        $wanted_groups[] = $wanted_group;
-    }
-}
-
-if (count($wanted_groups) == 0) {
-    $_POST[$groups[0]] = 'on';
-}
-
-function disable_current_state($service, $status)
-{
-    if ($service->domainstatus == $status) {
-        echo 'disabled';
-    }
-}
-
-$status = getStatusMachine($this->onconnect, $machineInfo->vmid);
-
-//SUSPEND BUTTON PROPERTIES
-switch ($status['result']) {
-    case 'RUNNING':
-        $suspendButtonTitle = 'Suspend';
-        $suspendButtonValue = 'suspend';
-        $suspendButtonGlyph = 'glyphicon-pause';
-        $suspendButtonType = 'warning';
-        break;
-
-    default :
-        $suspendButtonTitle = 'Resume';
-        $suspendButtonValue = 'unsuspend';
-        $suspendButtonGlyph = 'glyphicon-play';
-        $suspendButtonType = 'success';
-        if ($status['result'] == 'SAVE_SUSPEND' or $status['result'] == 'BOOT_SUSPENDED') {
-            $suspendButtondDisable = 'disabled';
-        }
-        break;
-
-}
-
-// POWER BUTTON PROPERTIES
-switch ($status['result']) {
-    case 'RUNNING':
-        $powerButtonTitle = 'Power off';
-        $powerButtonValue = 'shutdown';
-        $powerButtonGlyph = 'glyphicon-off';
-        $powerButtonType = 'danger';
-        break;
-
-    default :
-        $powerButtonTitle = 'Power on';
-        $powerButtonValue = 'shutdown';
-        $powerButtonGlyph = 'glyphicon-off';
-        $powerButtonType = 'success';
-        $powerButtonDisable = 'disabled';
-        break;
-}
-
-
-// REBOOT BUTTON PROPERTIES
-switch ($status['result']) {
-    case 'RUNNING':
-        break;
-
-    default:
-        $rebootButtonDisable = 'disabled';
-        break;
-}
-
-// REFRESH BUTTON PROPERTIES
-switch ($status['result']) {
-    case 'RUNNING':
-        break;
-
-    default:
-        $refreshButtonDisable = 'disabled';
-        break;
-}
-
-$isCheckAnsible=Capsule::table( 'tblconfiguration' )->where('setting','ione_use_ansible')->get();
-$LANG=$this->vars['_lang'];
-$cloudlink = Capsule::table('tblconfiguration')
-    ->select('value')->where('setting',ione_address)->get();
-?>
-
-<style>
-    .jumbotron {
-        padding: 15px;
-    }
-</style>
-
-<div class="container-fluid ">
-    <div class="jumbotron">
-        <div class="row ">
-
-            <form method="POST">
-                <input type="hidden" name="serviceId" value="<?php echo $system_id ?>"> <input type="hidden"
-                                                                                               name="serverId" value="<?php echo $service->server; ?>"> <input type="hidden" name="groupid"
-                                                                                                                                                               value="<?php echo $service_user->groupid; ?>">
-
-                <div class="col-sm-8">
-                    <div class="col-sm-12">
-                        <div class="col-sm-6">
-                            <div class="col-sm-12">
-                                <b><?=$LANG['thId']?>:</b> <?php echo $service->id; ?> <!-- PASTE FIELDS HERE -->
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['Status']?>:</b> <b id="state"
-                                                   style="font-size: 110%; border: 1px solid <? echo get_color_by_status($status['result']) ?>; color: <? echo get_color_by_status($status['result']); ?>;">
-                                    <?= $vm_data['STATE'] ?>
-                                </b>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['IP']?>:</b> <?= $vm_data['IP'] ?>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['VMID']?></b> <a
-                                    href="<?=$cloudlink[0]->value?>/#vms-tab/<?= $machineInfo->vmid ?>"><?= $machineInfo->vmid ?></a>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['PanelHeading']?>:</b><?= $vm_data['HOST']; ?>
-                            </div>
-                        </div>
-                        <div class="col-sm-6">
-                            <div class="col-sm-12">
-                                <b><?=$LANG['client']?>:</b> <a
-                                    href="/admin/clientsservices.php?userid=<?= $service_user->id ?>&id=<?= $system_id ?>">
-                                    <?= $service_user->firstname . ' ' . $service_user->lastname ?>
-                                </a>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['tariff']?>:</b> <?= $service->name ?>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['vcpu']?>:</b> <?= $vm_data['CPU']; ?>
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['ram']?>:</b> <?= $vm_data['RAM']; ?>MB
-                            </div>
-                            <div class="col-sm-12">
-                                <b><?=$LANG['import']?>:</b> <?= $vm_data['IMPORTED'] ?>
-                            </div>
-                        </div>
-                        <div class="col-sm-12">
-
-                            <!-- STATE MONITORING -->
-                            <script>
-                                $(document).ready(function () {
-
-                                    function buttonsByStateChange(state) {
-                                        switch (state) {
-                                            case 'RUNNING':
-                                                $('#suspendButton').attr({
-                                                    'value': 'suspend',
-                                                    'glyph': 'glyphicon-pause',
-                                                    'class': 'btn btn-warning',
-                                                    'disabled': false
-                                                });
-                                                $('#suspendButton').text('Suspend');
-
-                                                $('#powerButton').attr({
-                                                    'disabled': false
-                                                });
-
-                                                $('#rebootButton').attr({
-                                                    'disabled': false
-                                                });
-
-                                                $('#refreshButton').attr({
-                                                    'disabled': false
-                                                });
-
-                                                $('button[data-toogle="collapse"').attr('disabled', false);
-                                                $('button[data-toogle="collapse"').text('Snapshots(opens)');
-
-                                                break;
-
-                                            case 'SUSPENDED' :
-                                                $('#suspendButton').attr({
-                                                    'disabled': false
-                                                });
-                                                break;
-
-                                            default:
-                                                $('#suspendButton').attr({
-                                                    'text': 'Resume',
-                                                    'value': 'unsuspend',
-                                                    'glyph': 'glyphicon-play',
-                                                    'class': 'btn btn-success',
-                                                    'disabled': true
-                                                });
-                                                break;
-                                        }
-                                    }
-
-                                    stateChecker = setInterval(function () {
-
-                                        state = $('#state').text().trim();
-                                        if (state != 'RUNNING' &&
-                                            state != 'FAIL' &&
-                                            state != 'SUSPENDED' &&
-                                            state != 'POWEROFF') {
-
-                                            $.ajax({
-                                                url: "addonmodules.php",
-                                                data: {
-                                                    module: 'tabl',
-                                                    mod: 'currentState',
-                                                    vmid: '<?=$machineInfo->vmid;?>'
-                                                }
-                                            }).done(function (data) {
-
-                                                var re = new RegExp("<div id=\"state\">.*?</div>");
-
-                                                stateStr = re.exec(data)[0];
-
-                                                stateStr = stateStr.replace("<div id=\"state\">", "");
-                                                stateStr = stateStr.replace("<\/div>", "");
-
-                                                state = JSON.parse(stateStr);
-
-                                                console.log(state.state);
-
-                                                $('#state').text(state.state);
-                                                buttonsByStateChange(state.state);
-
-                                            });
-                                        } else {
-                                            clearInterval(stateChecker);
-                                        }
-                                    }, 5000);
-
-                                });
-                            </script>
-                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
-                                <button id="suspendButton" <?= $suspendButtonDisable; ?>
-                                        type="submit" name="action" value="<?= $suspendButtonValue; ?>"
-                                        class="btn btn-<?= $suspendButtonType ?>"><?= $suspendButtonTitle; ?>
-                                    <span class="glyphicon <?= $suspendButtonGlyph; ?>"></span>
-                                </button>
-                            </div>
-                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
-                                <button id="powerButton" <?= $powerButtonDisable; ?> type="submit" name="action"
-                                        value="<?= $powerButtonValue; ?>"
-                                        class="btn btn-<?= $powerButtonType ?> <?php disable_current_state($service,
-                                            'Active'); ?>"><?= $powerButtonTitle; ?> <span
-                                        class="glyphicon <?= $powerButtonGlyph; ?>"></span>
-                                </button>
-                            </div>
-
-                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
-                                <button id="rebootButton" <?= $rebootButtonDisable; ?> type="submit" name="action"
-                                        value="reboot" class="btn btn-info">
-                                    <?=$LANG['reboot']?> <span class="glyphicon glyphicon-repeat"></span>
-                                </button>
-                            </div>
-                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
-                                <button id="rebootRetrieveShowback" type="submit" name="action"
-                                        value="RetrieveShowback" class="btn btn-info">
-                                    RetrieveShowback <span class="glyphicon glyphicon-repeat"></span>
-                                </button>
-                            </div>
-                            <div id="refreshButton" class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
-                                <button <?= $refreshButtonDisable; ?> type="submit" name="action" value="reset"
-                                                                      class="btn btn-info">
-                                    <?=$LANG['reset']?> <span class="glyphicon glyphicon-refresh"></span>
-                                </button>
-                            </div>
-                        </div>
-
-                    </div>
-                </div>
-            </form>
-            <div class="col-sm-4">
-
-                <form action="" method="POST"></form>
-
-                <form action="<?= $this->modulelink."&mod=reinstall&serviceId=" . $system_id ?>" method="POST">
-                    <div class="col-sm-12 text-center" style="margin-top: 20px;">
-                        <button class="btn btn-block btn-default"><?=$LANG['reinstall']?></button>
-                    </div>
-                </form>
-
-
-                <div class="col-sm-12 text-center" style="margin-top: 20px;">
-                    <a id="terminate" class="btn btn-block btn-danger"><?=$LANG['terminate']?></a>
-                </div>
-
-                <div class="col-sm-12 text-center" style="margin-top: 20px;">
-                    <button <?= $vm_data['STATE'] != 'RUNNING' ? 'disabled' : ''; ?>
-                        data-toggle="collapse" data-target="#collapse1" class="btn btn-block btn-default">
-                        Snapshots(<?= $vm_data['STATE'] != 'RUNNING' ? ''.$LANG["tariff"].'' : ''; ?><?=$LANG['open']?>)
-                    </button>
-
-                    <div id="collapse1" class="collapse">
-                        <ul class="list-group">
-                            <?php foreach ($snapshotList['result'] as $snapshot): ?>
-                                <form action="" method="POST">
-                                    <li class="list-group-item"><?= $snapshot['NAME'] ?>: <?= date('H:i:s Y/m/d',
-                                            $snapshot['TIME']) ?> :
-                                        <button type="submit" name="action" value="revertSnapshot"
-                                                class="btn btn-default btn-xs">
-                                            <span class="fa fa-mail-reply"></span> <?=$LANG['revert']?>
-                                        </button>
-                                        <button type="submit" name="action" value="deleteSnapshot"
-                                                class="btn btn-danger btn-xs">
-                                            <span class="glyphicon glyphicon-remove"></span> <?=$LANG['buttonDelete']?>
-                                        </button>
-                                        <input type="hidden" name="snapshotId" value="<?= $snapshot['SNAPSHOT_ID'] ?>">
-                                        <input type="hidden" name="serviceId" value="<?= $system_id ?>">
-                                    </li>
-                                </form>
-                            <?php endforeach; ?>
-                            <button rel="createSnapshotPopup" name="createSnapshot[<?= $machineInfo->vmid ?>]"
-                                    class="btn-block btn-info showCreateSnapshot"><?=$LANG['createsnap']?>
-                            </button>
-                            <div class="overlay_popup" style="
-									display: none;
-									position: fixed;
-									z-index: 999;
-									top: 0;
-									right: 0;
-									bottom: 0;
-									left: 0;
-									background: black;
-									opacity: 0.7;
-									transition: opacity: .5s;
-								"></div>
-
-                            <div class="popup" id="createSnapshotPopup" style="
-								display: none;
-								z-index: 1000;
-								position: fixed;
-								top: 40%;
-								right: 0;
-								bottom: 0;
-								left: 30%;
-								width: 40%;
-								max-height: 20%;
-								background: white;
-								border 1px solid black;
-								border-radius: 5px;
-								padding: 10px;
-										">
-                                <form class="form" action="" method="POST">
-                                    <div class="form-group">
-                                        <label for="snapshotNameInput" style="color: black;"><?=$LANG['name']?>:</label> <input
-                                            id="snapshotNameInput" class="form-control" type="text" name="snapshotName"
-                                            placeholder="<?=$LANG['name']?>" style=" width: 100%"> <input type="hidden" name="serviceId"
-                                                                                           value="<?php echo $system_id ?>"> <input type="hidden" name="serverId"
-                                                                                                                                    value="<?php echo $service->server; ?>"> <input type="hidden" name="groupid"
-                                                                                                                                                                                    value="<?php echo $service_user->groupid; ?>">
-                                    </div>
-
-                                    <button class="btn btn-block btn-primary" type="submit" name="action"
-                                            value="MKSnapshot"><?=$LANG['create']?>
-                                    </button>
-                                </form>
-                            </div>
-                            <script type="text/javascript">
-                                $(document).ready(function () {
-                                    $('.showCreateSnapshot').on('click', function () {
-                                        var popup_id = $('#' + $(this).attr('rel'));
-                                        $(popup_id).show();
-                                        $('.overlay_popup').show();
-                                    });
-                                    $('.overlay_popup').on('click', function () {
-                                        $('.overlay_popup, .popup').hide();
-                                    });
-                                });
-
-                            </script>
-                        </ul>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-
-    <?if($isCheckAnsible[0]->value=='on'):?>
-    <div class="jumbotron">
-        <div class="row">
-
-            <div class="col-sm-12">
-                <h2 class="text-center"><?=$LANG['tabsansible']?>:</h2>                           <!-- ANSIBLE -->
-                <div class="form-check">
-                    <form id="ansiblesForm" action="/admin/addonmodules.php" method="GET">
-                        <?php $i = 0; ?>
-                        <?php foreach ($ansibles as $ansible): ?>
-                            <div class="col-sm-4">
-                                <input type="checkbox" name="ansibles[]" value="<?php echo $ansible->id; ?>"
-                                       id="<?php echo $ansible->name; ?>"><label
-                                    for="<?php echo $ansible->name; ?>">&#160;<?php echo $ansible->name; ?></label><br>
-                            </div>
-                            <?php $i++;
-                        endforeach; ?>
-                        <input type="hidden" name="serviceId" value="<?php echo $system_id; ?>">
-                        <div class="col-sm-12 text-center">
-                            <input type="hidden" name="module" value="oncontrol">
-                            <input type="hidden" name="tabs" value="ansible">
-                            <input type="hidden" name="mod" value="ansibledb">
-                            <input type="hidden" name="action" value="addAnsibleOnExternalLink">
-                            <input type="hidden" name="idSystem" value="<?php echo $system_id; ?>">
-                            <button class="btn btn-success" style="width: 180px; margin-top: 20px;"><?=$LANG['activate']?></button>
-                        </div>
-                    </form>
-                </div>
-            </div>
-        </div>
-    </div>
-    <?endif;?>
-
-    <script type="text/javascript">
-        $(document).ready(function () {
-            $("select[name='addedAddons[]']").on('change', function (e) {
-                var optionSelectedText = $("option:selected", this).text();
-                var optionSelectedGroup = $("option:selected", this).attr('group');
-
-                $("#selectedAddonsList li[group='" + optionSelectedGroup + "']").remove();
-
-                if (optionSelectedText != '') {
-                    $('#selectedAddonsList').append(
-                        "<li group=\"" + optionSelectedGroup + "\" class=\"list-group-item\">" + optionSelectedText + "</li>"
-                    )
-                    ;
-                }
-            });
-
-
-            $("a[href=\"#backup\"]").on("click", function () {
-                $('#selectbackup').selectmenu("open");
-            });
-        });
-    </script>
-
+<?php
+
+if (!defined("WHMCS")) {
+    die("This file cannot be accessed directly");
+}
+
+use WHMCS\Database\Capsule as Capsule;
+
+
+if (isset($_POST['action']))
+{
+    require_once 'service_manager.php';
+}
+
+$system_id = $_GET['serviceId'];
+
+
+$addons = Capsule::table('tbladdons')
+    ->select('id', 'name', 'description')
+    ->get();
+
+$service = Capsule::table('tblproducts')
+    ->select('tblproducts.name', 'tblhosting.userid', 'tblhosting.packageid', 'tblhosting.dedicatedip',
+        'tblhosting.domain', 'tblhosting.id', 'server')
+    ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+    ->where('tblhosting.id', $system_id)
+    ->first();
+
+$service_addons = Capsule::table('tblhostingaddons')
+    ->where('hostingid', $system_id)
+    ->get();
+
+$service_user = Capsule::table('tblclients')
+    ->where('id', $service->userid)
+    ->first();
+
+
+$machineInfo = Capsule::table('mod_on_user')
+    ->where('id_service', $system_id)
+    ->first();
+
+$server_ip = Capsule::table('tblservers')
+    ->where('id', $service->server)
+    ->select('ipaddress')
+    ->first()->ipaddress;
+
+$snapshotList = $this->onconnect->getSnapshotList($machineInfo->vmid);
+$snapshotList = json_decode($snapshotList);
+if ($snapshotList['result']['0'] == '') {
+    unset ($snapshotList['result']['0']);
+}
+
+
+$reinstal_settings = Capsule::table('tblproduct_upgrade_products')
+    ->where('product_id', $service->packageid)
+    ->select('upgrade_product_id')
+    ->get();
+
+$vm_data = $this->onconnect->getVmData($machineInfo->vmid->result);
+
+$groups = [];
+foreach ($addons as $addon) {
+    $addon->description = json_decode($addon->description, 1);
+    if (json_last_error() === JSON_ERROR_NONE && $addon->description != '') {
+        $groups = add_group_to_array($groups, $addon->description['GROUP']);
+    }
+}
+
+function getStatusMachine($onconnect, $vmid)
+{
+    $status = $onconnect->lcmStateStr($vmid);
+    if ($status->result == 'LCM_INIT') {
+        $status = $onconnect->stateStr($vmid);
+    }
+    return $status;
+}
+
+function add_group_to_array($current_array, $group)
+{
+    if (isset($group)) {
+        if (!in_array($group, $current_array)) {
+            $current_array[] = $group;
+        }
+    }
+    return $current_array;
+}
+
+
+function is_checked_box($addon_name)
+{
+    if ($_POST[$addon_name] == 'on') {
+        return 'checked';
+    } else {
+        return '';
+    }
+}
+
+function get_color_by_status($status)
+{
+    switch ($status) {
+
+        case 'RUNNING':
+            return 'green';
+
+        default :
+            return 'blue';
+    }
+}
+
+
+$wanted_groups = [];
+
+foreach ($_POST as $wanted_group => $value) {
+    if ($value == 'on' && is_string($wanted_group)) {
+        $wanted_groups[] = $wanted_group;
+    }
+}
+
+if (count($wanted_groups) == 0) {
+    $_POST[$groups[0]] = 'on';
+}
+
+function disable_current_state($service, $status)
+{
+    if ($service->domainstatus == $status) {
+        echo 'disabled';
+    }
+}
+
+$status = getStatusMachine($this->onconnect, $machineInfo->vmid);
+$status = json_decode($status);
+switch ($status['result']) {
+    case 'RUNNING':
+        $suspendButtonTitle = 'Suspend';
+        $suspendButtonValue = 'suspend';
+        $suspendButtonGlyph = 'glyphicon-pause';
+        $suspendButtonType = 'warning';
+        break;
+
+    default :
+        $suspendButtonTitle = 'Resume';
+        $suspendButtonValue = 'unsuspend';
+        $suspendButtonGlyph = 'glyphicon-play';
+        $suspendButtonType = 'success';
+        if ($status['result'] == 'SAVE_SUSPEND' or $status['result'] == 'BOOT_SUSPENDED') {
+            $suspendButtondDisable = 'disabled';
+        }
+        break;
+
+}
+
+
+switch ($status['result']) {
+    case 'RUNNING':
+        $powerButtonTitle = 'Power off';
+        $powerButtonValue = 'shutdown';
+        $powerButtonGlyph = 'glyphicon-off';
+        $powerButtonType = 'danger';
+        break;
+
+    default :
+        $powerButtonTitle = 'Power on';
+        $powerButtonValue = 'shutdown';
+        $powerButtonGlyph = 'glyphicon-off';
+        $powerButtonType = 'success';
+        $powerButtonDisable = 'disabled';
+        break;
+}
+
+
+
+switch ($status['result']) {
+    case 'RUNNING':
+        break;
+
+    default:
+        $rebootButtonDisable = 'disabled';
+        break;
+}
+
+// REFRESH BUTTON PROPERTIES
+switch ($status['result']) {
+    case 'RUNNING':
+        break;
+
+    default:
+        $refreshButtonDisable = 'disabled';
+        break;
+}
+
+$vm_data = json_decode($vm_data);
+$LANG=$this->vars['_lang'];
+$cloudlink = Capsule::table('tblconfiguration')
+    ->select('value')->where('setting',ione_address)->get();
+?>
+
+<style>
+    .jumbotron {
+        padding: 15px;
+    }
+</style>
+
+<div class="container-fluid ">
+    <div class="jumbotron">
+        <div class="row ">
+
+            <form method="POST">
+                <input type="hidden" name="serviceId" value="<?php echo $system_id ?>"> <input type="hidden"
+                                                                                               name="serverId" value="<?php echo $service->server; ?>"> <input type="hidden" name="groupid"
+                                                                                                                                                               value="<?php echo $service_user->groupid; ?>">
+
+                <div class="col-sm-8">
+                    <div class="col-sm-12">
+                        <div class="col-sm-6">
+                            <div class="col-sm-12">
+                                <b><?=$LANG['thId']?>:</b> <?php echo $service->id; ?> <!-- PASTE FIELDS HERE -->
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['Status']?>:</b> <b id="state"
+                                                   style="font-size: 110%; border: 1px solid <?php echo get_color_by_status($status['result']) ?>; color: <?php echo get_color_by_status($status['result']); ?>;">
+                                    <?= $vm_data['STATE'] ?>
+                                </b>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['IP']?>:</b> <?= $vm_data['IP'] ?>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['VMID']?></b> <a
+                                    href="<?=$cloudlink[0]->value?>/#vms-tab/<?= $machineInfo->vmid ?>"><?= $machineInfo->vmid ?></a>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['PanelHeading']?>:</b><?= $vm_data['HOST']; ?>
+                            </div>
+                        </div>
+                        <div class="col-sm-6">
+                            <div class="col-sm-12">
+                                <b><?=$LANG['client']?>:</b> <a
+                                    href="/admin/clientsservices.php?userid=<?= $service_user->id ?>&id=<?= $system_id ?>">
+                                    <?= $service_user->firstname . ' ' . $service_user->lastname ?>
+                                </a>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['tariff']?>:</b> <?= $service->name ?>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['vcpu']?>:</b> <?= $vm_data['CPU']; ?>
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['ram']?>:</b> <?= $vm_data['RAM']; ?>MB
+                            </div>
+                            <div class="col-sm-12">
+                                <b><?=$LANG['import']?>:</b> <?= $vm_data['IMPORTED'] ?>
+                            </div>
+                        </div>
+                        <div class="col-sm-12">
+
+
+                            <script>
+                                $(document).ready(function () {
+
+                                    function buttonsByStateChange(state) {
+                                        switch (state) {
+                                            case 'RUNNING':
+                                                $('#suspendButton').attr({
+                                                    'value': 'suspend',
+                                                    'glyph': 'glyphicon-pause',
+                                                    'class': 'btn btn-warning',
+                                                    'disabled': false
+                                                });
+                                                $('#suspendButton').text('Suspend');
+
+                                                $('#powerButton').attr({
+                                                    'disabled': false
+                                                });
+
+                                                $('#rebootButton').attr({
+                                                    'disabled': false
+                                                });
+
+                                                $('#refreshButton').attr({
+                                                    'disabled': false
+                                                });
+
+                                                $('button[data-toogle="collapse"').attr('disabled', false);
+                                                $('button[data-toogle="collapse"').text('Snapshots(opens)');
+
+                                                break;
+
+                                            case 'SUSPENDED' :
+                                                $('#suspendButton').attr({
+                                                    'disabled': false
+                                                });
+                                                break;
+
+                                            default:
+                                                $('#suspendButton').attr({
+                                                    'text': 'Resume',
+                                                    'value': 'unsuspend',
+                                                    'glyph': 'glyphicon-play',
+                                                    'class': 'btn btn-success',
+                                                    'disabled': true
+                                                });
+                                                break;
+                                        }
+                                    }
+
+                                    stateChecker = setInterval(function () {
+
+                                        state = $('#state').text().trim();
+                                        if (state != 'RUNNING' &&
+                                            state != 'FAIL' &&
+                                            state != 'SUSPENDED' &&
+                                            state != 'POWEROFF') {
+
+                                            $.ajax({
+                                                url: "addonmodules.php",
+                                                data: {
+                                                    module: 'tabl',
+                                                    mod: 'currentState',
+                                                    vmid: '<?=$machineInfo->vmid;?>'
+                                                }
+                                            }).done(function (data) {
+
+                                                var re = new RegExp("<div id=\"state\">.*?</div>");
+
+                                                stateStr = re.exec(data)[0];
+
+                                                stateStr = stateStr.replace("<div id=\"state\">", "");
+                                                stateStr = stateStr.replace("<\/div>", "");
+
+                                                state = JSON.parse(stateStr);
+
+                                                console.log(state.state);
+
+                                                $('#state').text(state.state);
+                                                buttonsByStateChange(state.state);
+
+                                            });
+                                        } else {
+                                            clearInterval(stateChecker);
+                                        }
+                                    }, 5000);
+
+                                });
+                            </script>
+                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
+                                <button id="suspendButton" <?= $suspendButtonDisable; ?>
+                                        type="submit" name="action" value="<?= $suspendButtonValue; ?>"
+                                        class="btn btn-<?= $suspendButtonType ?>"><?= $suspendButtonTitle; ?>
+                                    <span class="glyphicon <?= $suspendButtonGlyph; ?>"></span>
+                                </button>
+                            </div>
+                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
+                                <button id="powerButton" <?= $powerButtonDisable; ?> type="submit" name="action"
+                                        value="<?= $powerButtonValue; ?>"
+                                        class="btn btn-<?= $powerButtonType ?> <?php disable_current_state($service,
+                                            'Active'); ?>"><?= $powerButtonTitle; ?> <span
+                                        class="glyphicon <?= $powerButtonGlyph; ?>"></span>
+                                </button>
+                            </div>
+
+                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
+                                <button id="rebootButton" <?= $rebootButtonDisable; ?> type="submit" name="action"
+                                        value="reboot" class="btn btn-info">
+                                    <?=$LANG['reboot']?> <span class="glyphicon glyphicon-repeat"></span>
+                                </button>
+                            </div>
+                            <div class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
+                                <button id="rebootRetrieveShowback" type="submit" name="action"
+                                        value="RetrieveShowback" class="btn btn-info">
+                                    RetrieveShowback <span class="glyphicon glyphicon-repeat"></span>
+                                </button>
+                            </div>
+                            <div id="refreshButton" class="col-md-3 col-sm-6 text-center" style="margin-top: 20px;">
+                                <button <?= $refreshButtonDisable; ?> type="submit" name="action" value="reset"
+                                                                      class="btn btn-info">
+                                    <?=$LANG['reset']?> <span class="glyphicon glyphicon-refresh"></span>
+                                </button>
+                            </div>
+                        </div>
+
+                    </div>
+                </div>
+            </form>
+            <div class="col-sm-4">
+
+                <form action="" method="POST"></form>
+
+                <form action="<?= $this->modulelink."&mod=reinstall&serviceId=" . $system_id ?>" method="POST">
+                    <div class="col-sm-12 text-center" style="margin-top: 20px;">
+                        <button class="btn btn-block btn-default"><?=$LANG['reinstall']?></button>
+                    </div>
+                </form>
+
+                <div class="col-sm-12 text-center" style="margin-top: 20px;">
+                    <a id="terminate" class="btn btn-block btn-danger"><?=$LANG['terminate']?></a>
+                </div>
+
+                <div class="col-sm-12 text-center" style="margin-top: 20px;">
+                    <button <?= $vm_data['STATE'] != 'RUNNING' ? 'disabled' : ''; ?>
+                        data-toggle="collapse" data-target="#collapse1" class="btn btn-block btn-default">
+                        Snapshots(<?= $vm_data['STATE'] != 'RUNNING' ? ''.$LANG["tariff"].'' : ''; ?><?=$LANG['open']?>)
+                    </button>
+
+                    <div id="collapse1" class="collapse">
+                        <ul class="list-group">
+                            <?php foreach ($snapshotList['result'] as $snapshot): ?>
+                                <form action="" method="POST">
+                                    <li class="list-group-item"><?= $snapshot['NAME'] ?>: <?= date('H:i:s Y/m/d',
+                                            $snapshot['TIME']) ?> :
+                                        <button type="submit" name="action" value="revertSnapshot"
+                                                class="btn btn-default btn-xs">
+                                            <span class="fa fa-mail-reply"></span> <?=$LANG['revert']?>
+                                        </button>
+                                        <button type="submit" name="action" value="deleteSnapshot"
+                                                class="btn btn-danger btn-xs">
+                                            <span class="glyphicon glyphicon-remove"></span> <?=$LANG['buttonDelete']?>
+                                        </button>
+                                        <input type="hidden" name="snapshotId" value="<?= $snapshot['SNAPSHOT_ID'] ?>">
+                                        <input type="hidden" name="serviceId" value="<?= $system_id ?>">
+                                    </li>
+                                </form>
+                            <?php endforeach; ?>
+                            <button rel="createSnapshotPopup" name="createSnapshot[<?= $machineInfo->vmid ?>]"
+                                    class="btn-block btn-info showCreateSnapshot"><?=$LANG['createsnap']?>
+                            </button>
+                            <div class="overlay_popup" style="
+									display: none;
+									position: fixed;
+									z-index: 999;
+									top: 0;
+									right: 0;
+									bottom: 0;
+									left: 0;
+									background: black;
+									opacity: 0.7;
+									transition: opacity: .5s;
+								"></div>
+
+                            <div class="popup" id="createSnapshotPopup" style="
+								display: none;
+								z-index: 1000;
+								position: fixed;
+								top: 40%;
+								right: 0;
+								bottom: 0;
+								left: 30%;
+								width: 40%;
+								max-height: 20%;
+								background: white;
+								border 1px solid black;
+								border-radius: 5px;
+								padding: 10px;
+										">
+                                <form class="form" action="" method="POST">
+                                    <div class="form-group">
+                                        <label for="snapshotNameInput" style="color: black;"><?=$LANG['name']?>:</label> <input
+                                            id="snapshotNameInput" class="form-control" type="text" name="snapshotName"
+                                            placeholder="<?=$LANG['name']?>" style=" width: 100%"> <input type="hidden" name="serviceId"
+                                                                                           value="<?php echo $system_id ?>"> <input type="hidden" name="serverId"
+                                                                                                                                    value="<?php echo $service->server; ?>"> <input type="hidden" name="groupid"
+                                                                                                                                                                                    value="<?php echo $service_user->groupid; ?>">
+                                    </div>
+
+                                    <button class="btn btn-block btn-primary" type="submit" name="action"
+                                            value="MKSnapshot"><?=$LANG['create']?>
+                                    </button>
+                                </form>
+                            </div>
+                            <script type="text/javascript">
+                                $(document).ready(function () {
+                                    $('.showCreateSnapshot').on('click', function () {
+                                        var popup_id = $('#' + $(this).attr('rel'));
+                                        $(popup_id).show();
+                                        $('.overlay_popup').show();
+                                    });
+                                    $('.overlay_popup').on('click', function () {
+                                        $('.overlay_popup, .popup').hide();
+                                    });
+                                });
+
+                            </script>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("select[name='addedAddons[]']").on('change', function (e) {
+                var optionSelectedText = $("option:selected", this).text();
+                var optionSelectedGroup = $("option:selected", this).attr('group');
+
+                $("#selectedAddonsList li[group='" + optionSelectedGroup + "']").remove();
+
+                if (optionSelectedText != '') {
+                    $('#selectedAddonsList').append(
+                        "<li group=\"" + optionSelectedGroup + "\" class=\"list-group-item\">" + optionSelectedText + "</li>"
+                    )
+                    ;
+                }
+            });
+
+
+            $("a[href=\"#backup\"]").on("click", function () {
+                $('#selectbackup').selectmenu("open");
+            });
+        });
+    </script>
+
 </div>
\ No newline at end of file
diff --git a/addons/oncontrol/pages/vmlist/qutas.php b/addons/oncontrol/pages/vmlist/qutas.php
index 25e75f6..bfca06c 100644
--- a/addons/oncontrol/pages/vmlist/qutas.php
+++ b/addons/oncontrol/pages/vmlist/qutas.php
@@ -1,97 +1,95 @@
-<?php
-ini_set('display_errors', 0);
-$quotas = $this->onconnect->datastoresMonitoring();
-$quotasRam = $this->onconnect->hostsMonitoring();
-$LANG=$this->vars['_lang'];
-
-?>
-<script>
-    function progressBarPrint(name,quota) {
-        var progressColor;
-        if(quota>90){
-            progressColor='progress-bar-danger';
-        }else if(quota>70){
-            progressColor='progress-bar-warning';
-        }
-        var divProgress = $('<div/>', {
-            class: 'progress',
-        });
-
-        var mydiv = $('<div/>', {
-            class:  'progress-bar '+progressColor,
-            text: 	Math.round(quota)+'%',
-            style:  'width:'+quota+'%; color: #F8F8FF;',
-            role: "progressbar",
-            'aria-valuenow': "70",
-            'aria-valuemin':"0",
-            'aria-valuemax':"100"
-        });
-        divProgress.append(mydiv);
-        $('#'+name).append(divProgress);
-    }
-
-    $( function() {
-        var quota = <?=json_encode($quotas,true)?>;
-        var quotaRam = <?=json_encode($quotasRam,true)?>;
-        $(document).ready(function() {
-        quotaRam.result.forEach(function (ram) {
-            ram.reserved=ram.reserved.substr(0, ram.reserved.length - 2);
-            ram.full_size=ram.full_size.substr(0, ram.full_size.length - 2);
-            ram.cpu=ram.cpu.substr(0, ram.cpu.length - 1);
-            progressBarPrint('ram_'+ram.name,ram.reserved/ram.full_size*100);
-            progressBarPrint('cpu_'+ram.name,Math.round(ram.cpu));
-        });
-        quota.result.forEach(function (obj) {
-            if (obj.used.slice(-2) == 'GB'){
-                obj.used=obj.used.substr(0, obj.used.length - 2);
-                obj.used=obj.used/1000;
-            }else {
-                obj.used = obj.used.substr(0, obj.used.length - 2);
-            }
-            obj.full_size=obj.full_size.substr(0, obj.full_size.length - 2);
-            progressBarPrint(obj.name,obj.used/obj.full_size*100);
-        });
-    } )});
-
-</script>
-
-<div class="panel panel-info col-lg-6">
-    <table class="table table-bordered table-hover table-condensed">
-        <?php foreach ($quotasRam['result'] as $quota):?>
-            <tr class="quota">
-                <td rowspan="4"><?=$quota['name']?></td>
-                <td><b><?=$LANG['cpu']?>:</b> <?=$quota['cpu']?></td>
-                <td rowspan="4"><b><?=$LANG['vmquantity']?></b> <?=$quota['running_vms']?></td>
-            <tr class="quota">
-                <td id="cpu_<?=$quota['name']?>"></td>
-            </tr>
-            <tr class="quota">
-                <td><b><?=$LANG['ram']?>:</b> <?=$quota['reserved']?>/<?=$quota['full_size']?> (<?=round($quota['reserved']/$quota['full_size']*100)?>%)</td>
-            </tr>
-            <tr class="quota">
-                <td id="ram_<?=$quota['name']?>"></td>
-            </tr>
-            </tr>
-        <?php endforeach;?>
-    </table>
-</div>
-
-<div class="panel panel-info col-lg-6">
-    <table class="table table-bordered table-hover table-condensed">
-        <?php foreach ($quotas['result'] as $quota):?>
-            <tr class="quota">
-                <td rowspan="2"><b><?=$quota['name']?></b></td>
-                <?if(substr($quota['used'],-2) == 'GB'){
-                    $quotamod = round($quota['used']) / 1000;
-                }else{
-                    $quotamod = round($quota['used']);
-                }
-                ?>
-                <td><?=$quota['used']?>/<?=$quota['full_size']?> (<?=round($quotamod/$quota['full_size']*100)?>%)</td>
-            <tr class="quota">
-                <td id="<?=$quota['name']?>"></td>
-            </tr>
-            </tr>
-        <?php endforeach;?>
-    </table>
+<?php
+$quotas = $this->onconnect->datastoresMonitoring();
+$quotasRam = $this->onconnect->hostsMonitoring();
+$LANG=$this->vars['_lang'];
+?>
+<script>
+    function progressBarPrint(name,quota) {
+        var progressColor;
+        if(quota>90){
+            progressColor='progress-bar-danger';
+        }else if(quota>70){
+            progressColor='progress-bar-warning';
+        }
+        var divProgress = $('<div/>', {
+            class: 'progress',
+        });
+
+        var mydiv = $('<div/>', {
+            class:  'progress-bar '+progressColor,
+            text: 	Math.round(quota)+'%',
+            style:  'width:'+quota+'%; color: #F8F8FF;',
+            role: "progressbar",
+            'aria-valuenow': "70",
+            'aria-valuemin':"0",
+            'aria-valuemax':"100"
+        });
+        divProgress.append(mydiv);
+        $('#'+name).append(divProgress);
+    }
+
+    $( function() {
+        var quota = <?=json_encode($quotas,true)?>;
+        var quotaRam = <?=json_encode($quotasRam,true)?>;
+        $(document).ready(function() {
+        quotaRam.result.forEach(function (ram) {
+            ram.reserved=ram.reserved.substr(0, ram.reserved.length - 2);
+            ram.full_size=ram.full_size.substr(0, ram.full_size.length - 2);
+            ram.cpu=ram.cpu.substr(0, ram.cpu.length - 1);
+            progressBarPrint('ram_'+ram.name,ram.reserved/ram.full_size*100);
+            progressBarPrint('cpu_'+ram.name,Math.round(ram.cpu));
+        });
+        quota.result.forEach(function (obj) {
+            if (obj.used.slice(-2) == 'GB'){
+                obj.used=obj.used.substr(0, obj.used.length - 2);
+                obj.used=obj.used/1000;
+            }else {
+                obj.used = obj.used.substr(0, obj.used.length - 2);
+            }
+            obj.full_size=obj.full_size.substr(0, obj.full_size.length - 2);
+            progressBarPrint(obj.name,obj.used/obj.full_size*100);
+        });
+    } )});
+
+</script>
+
+<div class="panel panel-info col-lg-6">
+    <table class="table table-bordered table-hover table-condensed">
+        <?php foreach ($quotasRam->response as $quota):?>
+            <tr class="quota">
+                <td rowspan="4"><?=$quota->name?></td>
+                <td><b><?=$LANG['cpu']?>:</b> <?=$quota->cpu?></td>
+                <td rowspan="4"><b><?=$LANG['vmquantity']?></b> <?=$quota->running_vms?></td>
+            <tr class="quota">
+                <td id="cpu_<?=$quota->name?>"></td>
+            </tr>
+            <tr class="quota">
+                <td><b><?=$LANG['ram']?>:</b> <?=$quota->reserved?>/<?=$quota->full_size?> (<?=round($quota->reserved/$quota->full_size*100)?>%)</td>
+            </tr>
+            <tr class="quota">
+                <td id="ram_<?=$quota->name?>"></td>
+            </tr>
+            </tr>
+        <?php endforeach;?>
+    </table>
+</div>
+
+<div class="panel panel-info col-lg-6">
+    <table class="table table-bordered table-hover table-condensed">
+        <?php foreach ($quotas->response as $quota):?>
+            <tr class="quota">
+                <td rowspan="2"><b><?=$quota->name?></b></td>
+                <?php if(substr($quota->used,-2) == 'GB'){
+                    $quotamod = round($quota->used) / 1000;
+                }else{
+                    $quotamod = round($quota->used);
+                }
+                ?>
+                <td><?=$quota->used?>/<?=$quota->full_size?> (<?=round($quotamod/$quota->full_size*100)?>%)</td>
+            <tr class="quota">
+                <td id="<?=$quota->name?>"></td>
+            </tr>
+            </tr>
+        <?php endforeach;?>
+    </table>
 </div>
\ No newline at end of file
diff --git a/addons/oncontrol/pages/vmlist/reinstall.php b/addons/oncontrol/pages/vmlist/reinstall.php
index c19df56..552e963 100644
--- a/addons/oncontrol/pages/vmlist/reinstall.php
+++ b/addons/oncontrol/pages/vmlist/reinstall.php
@@ -1,183 +1,157 @@
-<?php
-
-
-use WHMCS\Database\Capsule;
-$LANG=$this->vars['_lang'];
-if (!defined("WHMCS")) {
-	die("This file cannot be accessed directly");
-}
-
-ini_set('display_errors', 0);
-$idRefreshSystem=$_GET['serviceId'];
-extract($_POST);?>
-    <div class="container-fluid">
-    <div id="alert"></div>
-<?php
-	$packageid = Capsule::table('tblhosting')
-		->where('id', $idRefreshSystem)
-		->first()->packageid;
-
-	$reinstal_settings = Capsule::table('tblproduct_upgrade_products')
-		->where('product_id', $packageid)
-		->select('id', 'upgrade_product_id', 'product_id')
-		->get();
-    if(!$reinstal_settings){
-        $oneObject = new stdClass();
-        $oneObject -> upgrade_product_id=$packageid;
-        $reinstal_settings[]=$oneObject;
-        print ($packageid);
-    }
-
-    $ansibles = Capsule::table('mod_onconfiguratorAddon')
-        ->select('id','name','descriptions','os')
-        ->get();
-
-    $operating_systems = Capsule::table('tbladdons')
-    ->select('tbladdons.id as addonid','tbladdons.name as os')
-    ->join('mod_onconfiguratorOS','mod_onconfiguratorOS.addonid','=','tbladdons.id')
-    ->where('tbladdons.description','like','%"GROUP": "os"%')
-    ->get();
-
-    $osConfig = Capsule::table('mod_onconfigurator')
-        ->select('os','addonid','idtariff')
-        ->get();
-
-
-    if(!$operating_systems):?>
-        <div class="infobox">
-            <span class="title"><?=$LANG['attention']?>:</span>
-            <div><?=$LANG['attentiontariff']?></div>
-        </div>
-    <?php endif; ?>
-
-	<script type="text/javascript">
-        var tariffs = <?=json_encode($reinstal_settings)?>;
-        var ansible = <?=json_encode($ansibles)?>;
-        var osConfig = <?=json_encode($osConfig)?>;
-
-        ansible = ansible.map(function(item){
-            item.os=item.os.match(/\d+/g);
-            return item;
-        });
-
-        $(document).ready(
-            function () {
-                $('#idNewOS').on('change', function() {
-                    var checkBoxs = $('input:checkbox');
-                    var idChangeOs = this.value;
-                    $('input:checkbox:checked').prop( "checked", false );
-
-                    ansibleConfigFilter = ansible.filter(function (currentValue) {
-                        if(currentValue.os.indexOf(idChangeOs)!='-1'){
-                            return true;
-                        } else {
-                            return false;
-                        }
-                    }).map(function(item){
-                        return $('#checkbox_'+item.id)[0];
-                    });
-                    checkBoxs.removeAttr("disabled");
-                    checkBoxs.not(ansibleConfigFilter).attr("disabled","disabled");
-                });
-
-                $('#idNewProduct').on('change', function() {
-                    var spanAlert= $('#alert');
-                    spanAlert.html('');
-                    var idChangeProduct=this.value;
-                    osConfigFilter = osConfig.filter(function (currentValue) {
-                        if(currentValue.idtariff==idChangeProduct){
-                            return true;
-                        } else {
-                            return false;
-                        }
-                    });
-
-                    if(osConfigFilter.length==0){
-                        $.growl.warning({ message: "The selected tariff plan has not yet been configured!" });
-                    }
-                    var idNewOsSelector=$("#idNewOS");
-                    idNewOsSelector.html('');
-                    osConfigFilter.forEach(function (item) {
-                        var oneOption =$('<option/>',{
-                                value:item.addonid,
-                                text:item.os
-                            }
-                        );
-                        idNewOsSelector.append(oneOption);
-                    });
-                });
-            });
-	</script>
-
-	<div class="jumbotron">
-		<div class="row">
-			<p id="test"></p>
-			<div class="col-sm-12">
-
-				<div class="panel panel-danger">
-					<div class="panel-body">
-                        <h3><b><?=$LANG['thId']?></b> = <?php echo $idRefreshSystem; ?></h3>
-						<h2><?=$LANG['alldata']?> <b style="color: red"><?=$LANG['deletecaps']?></b></h2>
-					</div>
-				</div>
-
-				<form method="GET" action="/admin/addonmodules.php">
-                    <div class=" test col-sm-12"></div>
-
-                    <div>
-                        <?php foreach ($ansibles as $ansible):?>
-                            <label class="checkbox-inline">
-                                <input id="checkbox_<?=$ansible->id?>" name="ansibles[]" type="checkbox" value="<?=$ansible->id?>"><?=$ansible->name?>
-                            </label>
-                        <? endforeach;?>
-                    </div>
-
-					<div class="col-sm-12">
-						<label for="groupId"><?=$LANG['reinstallgp']?>:</label>
-                        <select class="form-control"	id="idNewProduct" name="idNewProduct">
-							<?php foreach ($reinstal_settings as $reinstal_setting) :                   // <-- ALL RATES IN THE SAME GROUPS HERE
-								$possible_product = Capsule::table('tblproducts')
-									->where('id', $reinstal_setting->upgrade_product_id)
-									->first() ?>
-								<option value="<?php echo $possible_product->id;?>">                     <!-- PRODUCT ID | GID -->
-									<?php echo $possible_product->name ?>
-								</option>
-							<?php endforeach; ?>
-						</select>
-					</div>
-
-					<div class="col-sm-12">
-						<label for="idNewOS" style="margin-top: 10px;"><?=$LANG['reinstallos']?>:</label>
-                        <select class="form-control" id="idNewOS" name="idNewOS" style="width: 100%;">
-							<?php foreach ($operating_systems as $operating_system) : ?>            <!-- ALL OS HERE -->
-								<option value="<?php echo $operating_system->addonid; ?>">
-									<?php echo $operating_system->os ?>
-								</option>
-							<?php endforeach; ?>
-						</select>
-					</div>
-
-					<div class="col-sm-6" class="text-center" style="margin-top: 20px;">
-                        <input type="hidden" name="module" value="oncontrol">
-                        <input type="hidden" name="tabs" value="ansible">
-                        <input type="hidden" name="mod" value="ansibledb">
-                        <input type="hidden" name="action" value="reinstall">
-						<input type="hidden" name="serviceId" value="<?php echo $idRefreshSystem ?>">
-                        <input type="hidden" name="forced" value="true">
-                        <input type="submit" class="btn btn-block btn-danger" value="Reinstall system!">
-					</div>
-
-				</form>
-				<form method="POST" action="<?=$vars['modulelink']?>&mod=test">
-				<div class="col-sm-6 text-center" style="margin-top: 20px;">
-					<input type="hidden" name="id" value="<?php echo $idRefreshSystem ?>">
-                    <input type="submit" class="btn btn-block btn-success" value="Back to change page">
-				</div>
-				</form>
-			</div>
-		</div>
-	    </div>
-    </div>
-
-
-    
+<?php
+
+
+use WHMCS\Database\Capsule;
+$LANG=$this->vars['_lang'];
+if (!defined("WHMCS")) {
+	die("This file cannot be accessed directly");
+}
+
+$idRefreshSystem=$_GET['serviceId'];
+extract($_POST);?>
+    <div class="container-fluid">
+    <div id="alert"></div>
+<?php
+	$packageid = Capsule::table('tblhosting')
+		->where('id', $idRefreshSystem)
+		->first()->packageid;
+
+	$reinstal_settings = Capsule::table('tblproduct_upgrade_products')
+		->where('product_id', $packageid)
+		->select('id', 'upgrade_product_id', 'product_id')
+		->get();
+    if(!$reinstal_settings){
+        $oneObject = new stdClass();
+        $oneObject -> upgrade_product_id=$packageid;
+        $reinstal_settings[]=$oneObject;
+        print ($packageid);
+    }
+
+    $operating_systems = Capsule::table('tbladdons')
+    ->select('tbladdons.id as addonid','tbladdons.name as os')
+    ->join('mod_onconfiguratorOS','mod_onconfiguratorOS.addonid','=','tbladdons.id')
+    ->where('tbladdons.description','like','%"GROUP": "os"%')
+    ->get();
+
+    $osConfig = Capsule::table('mod_onconfigurator')
+        ->select('os','addonid','idtariff')
+        ->get();
+
+
+    if(!$operating_systems):?>
+        <div class="infobox">
+            <span class="title"><?=$LANG['attention']?>:</span>
+            <div><?=$LANG['attentiontariff']?></div>
+        </div>
+    <?php endif; ?>
+
+	<script type="text/javascript">
+        var tariffs = <?=json_encode($reinstal_settings)?>;
+
+        var osConfig = <?=json_encode($osConfig)?>;
+
+
+
+        $(document).ready(
+            function () {
+                $('#idNewOS').on('change', function() {
+                    var checkBoxs = $('input:checkbox');
+                    var idChangeOs = this.value;
+                    $('input:checkbox:checked').prop( "checked", false );
+
+                    checkBoxs.removeAttr("disabled");
+
+                });
+
+                $('#idNewProduct').on('change', function() {
+                    var spanAlert= $('#alert');
+                    spanAlert.html('');
+                    var idChangeProduct=this.value;
+                    osConfigFilter = osConfig.filter(function (currentValue) {
+                        if(currentValue.idtariff==idChangeProduct){
+                            return true;
+                        } else {
+                            return false;
+                        }
+                    });
+
+                    if(osConfigFilter.length==0){
+                        $.growl.warning({ message: "The selected tariff plan has not yet been configured!" });
+                    }
+                    var idNewOsSelector=$("#idNewOS");
+                    idNewOsSelector.html('');
+                    osConfigFilter.forEach(function (item) {
+                        var oneOption =$('<option/>',{
+                                value:item.addonid,
+                                text:item.os
+                            }
+                        );
+                        idNewOsSelector.append(oneOption);
+                    });
+                });
+            });
+	</script>
+
+	<div class="jumbotron">
+		<div class="row">
+			<p id="test"></p>
+			<div class="col-sm-12">
+
+				<div class="panel panel-danger">
+					<div class="panel-body">
+                        <h3><b><?=$LANG['thId']?></b> = <?php echo $idRefreshSystem; ?></h3>
+						<h2><?=$LANG['alldata']?> <b style="color: red"><?=$LANG['deletecaps']?></b></h2>
+					</div>
+				</div>
+
+				<form method="GET" action="/admin/addonmodules.php">
+                    <div class=" test col-sm-12"></div>
+
+
+					<div class="col-sm-12">
+						<label for="groupId"><?=$LANG['reinstallgp']?>:</label>
+                        <select class="form-control"	id="idNewProduct" name="idNewProduct">
+							<?php foreach ($reinstal_settings as $reinstal_setting) :                   // <-- ALL RATES IN THE SAME GROUPS HERE
+								$possible_product = Capsule::table('tblproducts')
+									->where('id', $reinstal_setting->upgrade_product_id)
+									->first() ?>
+								<option value="<?php echo $possible_product->id;?>">                     <!-- PRODUCT ID | GID -->
+									<?php echo $possible_product->name ?>
+								</option>
+							<?php endforeach; ?>
+						</select>
+					</div>
+
+					<div class="col-sm-12">
+						<label for="idNewOS" style="margin-top: 10px;"><?=$LANG['reinstallos']?>:</label>
+                        <select class="form-control" id="idNewOS" name="idNewOS" style="width: 100%;">
+							<?php foreach ($operating_systems as $operating_system) : ?>            <!-- ALL OS HERE -->
+								<option value="<?php echo $operating_system->addonid; ?>">
+									<?php echo $operating_system->os ?>
+								</option>
+							<?php endforeach; ?>
+						</select>
+					</div>
+
+					<div class="col-sm-6" class="text-center" style="margin-top: 20px;">
+                        <input type="hidden" name="module" value="oncontrol">
+                        <input type="hidden" name="action" value="reinstall">
+						<input type="hidden" name="serviceId" value="<?php echo $idRefreshSystem ?>">
+                        <input type="hidden" name="forced" value="true">
+                        <input type="submit" class="btn btn-block btn-danger" value="Reinstall system!">
+					</div>
+
+				</form>
+				<form method="POST" action="<?=$vars['modulelink']?>&mod=test">
+				<div class="col-sm-6 text-center" style="margin-top: 20px;">
+					<input type="hidden" name="id" value="<?php echo $idRefreshSystem ?>">
+                    <input type="submit" class="btn btn-block btn-success" value="Back to change page">
+				</div>
+				</form>
+			</div>
+		</div>
+	    </div>
+    </div>
+
+
+    
diff --git a/addons/oncontrol/pages/vmlist/service_manager.php b/addons/oncontrol/pages/vmlist/service_manager.php
index 9cd00ec..2f230fc 100644
--- a/addons/oncontrol/pages/vmlist/service_manager.php
+++ b/addons/oncontrol/pages/vmlist/service_manager.php
@@ -1,11 +1,9 @@
 <?php
 
 use WHMCS\Database\Capsule as Capsule;
-ini_set('display_errors', 0);
+
 if (isset($_POST['action'])) {
-//    echo '<pre>';
-//    print_r($_POST);
-//    echo '</pre>';
+
 	extract($_POST);
 	require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
 
@@ -102,7 +100,7 @@
 
 
 if (isset($message)): ?>
-	<div class="col-sm-12">                            <!-- STATUS PANEL -->
+	<div class="col-sm-12">
 		<div class="panel panel-success">
 			<div class="panel-heading">
 				<h2><?=$message; ?></h2>
diff --git a/addons/oncontrol/pages/vmlist/vmlist.php b/addons/oncontrol/pages/vmlist/vmlist.php
index 668dfbf..a90c052 100644
--- a/addons/oncontrol/pages/vmlist/vmlist.php
+++ b/addons/oncontrol/pages/vmlist/vmlist.php
@@ -1,413 +1,413 @@
-<?php
-use WHMCS\Database\Capsule;
-ini_set('display_errors', 0);
-function vmlist_javaScripts()
-{?>
-    <script>
-
-        $( document ).ready(function() {
-            $('#host').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#statusWhmcs').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#statusOn').selectize({
-                plugins: ['remove_button']
-            });
-
-            $('#tabs').tabs({
-                active:false,
-                collapsible: true
-            });
-
-            $('#selectFilterStatus').selectize({
-                plugins:['remove_button'],
-                onChange:function () {
-                    var valueSearch = this.getValue();
-                    if(this.getValue().length>1 && (valueSearch.indexOf('notInWhmcs')!=-1)){
-                        this.clear();
-                        this.setValue('notInWhmcs');
-                        $.growl.warning({ message: "Invalid combination of parameters \"Filter by problem\"" });
-                    }
-                }
-            });
-        });
-
-    </script>
-<?}
-
-$start = microtime(true);
-vmlist_javaScripts();
-$cloudlink = Capsule::table('tblconfiguration')
-    ->select('value')->where('setting',ione_address)->get();
-
-
-$arrayVariant=[
-    'Active'=>['RUNNING','POWEROFF'],
-    'Suspended'=>['SUSPENDED','POWEROFF']
-];
-
-$arrayProblems=[
-    'notInWhmcs'=>$this->LANG['misswhmcs'],
-    'hasError'=>$this->LANG['fillederror'],
-    'noStatus'=>$this->LANG['notmatch']
-];
-
-$searchStatusWhmcs=$_REQUEST['statusWhmcs'];
-$statusOn=$_REQUEST['statusOn'];
-$searchHost=$_REQUEST['host'];
-$searchIP=$_REQUEST['searchForIp'];
-$smartStatus=$_REQUEST['selectFilterStatus'];
-
-$page=$_REQUEST['page'];
-$pageCount=20;
-
-$hostsON=Capsule::table('mod_iOne_vmlist_cache')
-    ->groupBy('host')
-    ->lists('host');
-
-$satesON=Capsule::table('mod_iOne_vmlist_cache')
-    ->groupBy('state')
-    ->lists('state');
-
-$satusWhmcs=Capsule::table('tblhosting')
-    ->groupBy('domainstatus')
-    ->lists('domainstatus');
-
-
-if(!$searchStatusWhmcs){
-    $searchStatusWhmcs=['Suspended','Active'];
-};
-
-if(!$statusOn){
-    $statusOn=$satesON;
-};
-
-if(!$searchHost){
-    $searchHost=$hostsON;
-}
-
-if(in_array('notInWhmcs',$smartStatus)){     //missing in whmcs
-    $loginWhmcs=Capsule::table('tblhosting')
-        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
-        ->lists('vmid');
-
-    $userIdOn=Capsule::table('mod_iOne_vmlist_cache')
-        ->whereNotIn('vmid',$loginWhmcs)
-        ->lists('login');
-}
-
-if(in_array('hasError',$smartStatus)){       //filled with an error
-    $hostingIds[]=Capsule::table('tblhosting')
-        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
-        ->orWhere('mod_on_user.vmid',' ')
-        ->orWhere('mod_on_user.userid',' ')
-        ->orWhere('mod_on_user.loginon',' ')
-        ->orwhereNull('mod_on_user.vmid')
-        ->orWhereNull('mod_on_user.userid')
-        ->orWhereNull('mod_on_user.loginon')
-        ->lists('hosting.id');
-}
-
-
-if(in_array('noStatus',$smartStatus)){        //if the statuses do not match
-    foreach ($arrayVariant as $key=>$variant) {
-        $hostingIds[] = Capsule::table('tblhosting')
-            ->select('mod_iOne_vmlist_cache.state','tblhosting.domainstatus','tblhosting.id')
-            ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-            ->join('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-            ->where('tblhosting.domainstatus',$key)
-            ->whereNotIn('mod_iOne_vmlist_cache.state',$variant)
-            ->lists('tblhosting.id');
-    }
-}
-
-
-$pageGetUrl['statusWhmcs']=$searchStatusWhmcs;
-$pageGetUrl['statusOn']=$statusOn;
-$pageGetUrl['selectFilterStatus']=$smartStatus;
-$pageGetUrl['host']=$searchHost;
-$pageGetUrl['searchForIp']=$searchIP;
-$pageGetUrl=http_build_query($pageGetUrl);
-
-
-if(!$page) {
-    require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
-    $onconnect = new ONConnect();
-    $dataON = $onconnect->compare_info();
-    $userON = $dataON['result'][0];
-    $hostsON = $dataON['result'][1];
-        if(count($userON)>0) {
-            $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-                ->truncate();
-            $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-                ->insert($userON);
-        }
-}
-
-if(count($hostingIds)==0 && count($userIdOn)==0) {
-    $answerCount = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.userid',
-            'tblhosting.domainstatus',
-            'tblhosting.dedicatedip',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.domainstatus',
-            'tblhosting.userid',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid',
-            'tblhosting.dedicatedip',
-            'mod_iOne_vmlist_cache.state',
-            'mod_iOne_vmlist_cache.host')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-}
-elseif(count($hostingIds)!=0 && count($userIdOn)==0){
-
-    $resultHostingIds=[];
-    foreach ($hostingIds as $ids){
-        $resultHostingIds=array_merge($resultHostingIds,$ids);
-    }
-
-    $answerCount = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.userid',
-            'tblhosting.domainstatus',
-            'tblhosting.dedicatedip',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->whereIn('tblhosting.id',$resultHostingIds)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('tblproducts')
-        ->select(
-            'tblproducts.gid',
-            'tblhosting.domainstatus',
-            'tblhosting.userid',
-            'mod_on_user.id_service',
-            'mod_on_user.loginon',
-            'mod_on_user.passwordon',
-            'mod_on_user.userid as useridOn',
-            'mod_on_user.vmid',
-            'tblhosting.dedicatedip',
-            'mod_iOne_vmlist_cache.state',
-            'mod_iOne_vmlist_cache.host')
-        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
-        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
-        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
-        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
-        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
-        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
-        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
-        ->whereIn('tblhosting.id',$resultHostingIds)
-        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-}
-elseif(count($hostingIds)==0 && count($userIdOn)!=0){   //does not exist in whmcs
-    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
-        ->whereIn('login',$userIdOn)
-        ->where('ip', 'like', '%' . $searchIP . '%')
-        ->count();
-
-    $userWHMCS = Capsule::table('mod_iOne_vmlist_cache')
-        ->whereIn('login',$userIdOn)
-        ->where('ip', 'like', '%' . $searchIP . '%')
-        ->offset(($page - 1) * $pageCount)
-        ->limit($pageCount)
-        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
-        ->get();
-    var_dump($answerCount);
-}
-elseif(count($hostingIds)!=0 && count($userIdOn)!=0){}
-
-foreach ($userWHMCS as $oneUser)
-{
-    if(!$oneUser->vmid){
-        $oneUser->col='warning';
-    }
-    if(!$oneUser->loginon){
-        $oneUser->col='info';
-    }
-    if(!$oneUser->host){
-        $oneUser->col='danger';
-    }
-    if(!$oneUser->col){
-        $oneUser->col='success';
-    }
-}
-
-$pageAll=ceil($answerCount/$pageCount);
-
-$minPage=$page-3;
-$maxPage=$page+3;
-if($minPage<1){
-    $minPage=1;
-}
-
-if($maxPage>$pageAll){
-    $maxPage=$pageAll;
-}
-
-$LANG=$this->vars['_lang'];
-?>
-
-    <link rel="stylesheet" href="/assets/css/selectize.css">
-    <script src="/assets/js/selectize.js"></script>
-    <form method="post" action="<?=$this->modulelink?>&page=1">
-        <div id="tabs">
-            <ul>
-                <li><a href="#tabs-1"><?=$LANG['searchFilter']?></a></li>
-            </ul>
-            <div id="tabs-1">
-                <div id="dialog-confirm" class="panel panel-default" style="position: relative; z-index: 2;">
-                    <ul class="list-group">
-
-                        <li class="list-group-item">
-                            <label for="host"><?=$LANG['searchByIP']?></label>
-                            <input id="inputForSearch" name="searchForIp" type="text" class="form-control" value="<?=$searchIP?>">
-                        </li>
-
-                        <li class="list-group-item">
-                            <label for="host"><?=$LANG['thHost']?></label>
-                            <select id="host" name="host[]" multiple="multiple">
-                                <?foreach ($hostsON as $host):?>
-                                    <option value="<?=$host?>" <? if(in_array($host,$searchHost)){print 'selected';}?>><?=$host?></option>
-                                <?endforeach;?>
-                            </select>
-                        </li>
-
-                        <li class="list-group-item">
-                            <label for="statusWhmcs"><?=$LANG['thStatusWHMCS']?></label>
-                            <select id="statusWhmcs" name="statusWhmcs[]" multiple="multiple">
-                                <?foreach ($satusWhmcs as $status):?>
-                                    <option value="<?=$status?>" <? if(in_array($status,$searchStatusWhmcs)){print 'selected';}?>><?=$status?></option>
-                                <?endforeach;?>
-                            </select>
-                        </li>
-
-                        <li class="list-group-item">
-                            <label for="statusOn"><?=$LANG['thStatusOpenNebula']?></label>
-                            <select id="statusOn" name="statusOn[]" multiple="multiple">
-                                <?foreach ($satesON as $sate):?>
-                                    <option value="<?=$sate?>" <? if(in_array($sate,$statusOn)){print 'selected';}?>><?=$sate?></option>
-                                <?endforeach;?>
-                            </select>
-                        </li>
-
-                        <li class="list-group-item">
-                            <label for="statusOn"><?=$LANG['filterByProblem']?></label>
-                            <select id="selectFilterStatus" name="selectFilterStatus[]" multiple="multiple">
-                                <?foreach ($arrayProblems as $codeProblem=>$problem):?>
-                                    <option value="<?=$codeProblem?>" <? if(in_array($codeProblem,$smartStatus)){print 'selected';}?>><?=$problem?></option>
-                                <?endforeach;?>
-                            </select>
-                        </li>
-                    </ul>
-                    <div class="row">
-                        <div class="col-lg-9"></div>
-                        <div class="col-lg-1"><input type="submit" style="width: 100%" class="btn btn-info" value="<?=$LANG['search']?>"></div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </form>
-    <table class='table table-bordered table-hover table-condensed'>
-        <thead class="thead-inverse">
-        <tr>
-            <th><?=$LANG['thClientsId']?></th>
-            <th><?=$LANG['thHostingId']?></th>
-            <th><?=$LANG['thLoginOpenNebula']?></th>
-            <th><?=$LANG['thUserIdOpenNebula']?></th>
-            <th><?=$LANG['thVmidOpenNebula']?></th>
-            <th><?=$LANG['thStatusOpenNebula']?></th>
-            <th><?=$LANG['thStatusWHMCS']?></th>
-            <th><?=$LANG['thHost']?></th>
-            <th><?=$LANG['thIpAddress']?></th>
-            <th><?=$LANG['thDo']?></th>
-        </tr>
-        </thead>
-
-        <?foreach ($userWHMCS as $oneUser):?>
-            <tr class='<?=$oneUser->col?>'>
-                <td><a href="/admin/clientssummary.php?userid=<?=$oneUser->userid?>" target="_blank"><?=$oneUser->userid?></a></td>
-                <td><a href="/admin/clientsservices.php?userid=<?=$oneUser->userid?>&id=<?=$oneUser->id_service?>" target="_blank"><?=$oneUser->id_service?></a></td>
-                <td><?=$oneUser->loginon?></td>
-                <td><a href="<?=$cloudlink[0]->value?>/#users-tab/<?=$oneUser->useridOn?>" target="_blank"><?=$oneUser->useridOn?></a></td>
-                <td><a href="<?=$cloudlink[0]->value?>/#vms-tab/<?=$oneUser->vmid?>" target="_blank"><?=$oneUser->vmid?></a></td>
-                <td><?=$oneUser->state?></td>
-                <td><?=$oneUser->domainstatus?></td>
-                <td><?=$oneUser->host?></td>
-                <td><?=$oneUser->dedicatedip?></td>
-                <td>
-                    <a href="<?=$this->vars['modulelink'].'&tabs=vmlist&mod=panel&serviceId='.$oneUser->id_service?>" class="btn btn-info"><?=$LANG['modEdit']?></a>
-                </td>
-            </tr>
-        <?endforeach;?>
-    </table>
-    <div class="row">
-        <div class="col-lg-10 col-mg-10">
-            <ul class="pagination">
-                <li><a href="<?=$this->modulelink?>&page=1&<?=$pageGetUrl?>">«</a></li>
-                <? for($i=$minPage;$i<=$maxPage;$i++):?>
-                    <li class="<?php if($i==$page){print 'active';};?>"><a href="<?=$this->modulelink?>&page=<?=$i?>&<?=$pageGetUrl?>"><?=$i?></a></li>
-                <? endfor;?>
-                <li><a href="<?=$this->modulelink?>&page=<?=$pageAll?>&<?=$pageGetUrl?>">»</a></li>
-            </ul>
-        </div>
-
-        <div class="col-lg-2 col-mg-2">
-            <a class="btn btn-info" href="<?=$this->modulelink?>"><?=$LANG['updatecache']?><span class="glyphicon glyphicon-refresh"></span></a>
-        </div>
-    </div>
-
-<?
-print ($LANG['timescript'].': '.(microtime(true) - $start).' '.$LANG['second'] );
+<?php
+use WHMCS\Database\Capsule;
+
+function vmlist_javaScripts()
+{?>
+    <script>
+
+        $( document ).ready(function() {
+            $('#host').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#statusWhmcs').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#statusOn').selectize({
+                plugins: ['remove_button']
+            });
+
+            $('#tabs').tabs({
+                active:false,
+                collapsible: true
+            });
+
+            $('#selectFilterStatus').selectize({
+                plugins:['remove_button'],
+                onChange:function () {
+                    var valueSearch = this.getValue();
+                    if(this.getValue().length>1 && (valueSearch.indexOf('notInWhmcs')!=-1)){
+                        this.clear();
+                        this.setValue('notInWhmcs');
+                        $.growl.warning({ message: "Invalid combination of parameters \"Filter by problem\"" });
+                    }
+                }
+            });
+        });
+
+    </script>
+<?php }
+
+$start = microtime(true);
+vmlist_javaScripts();
+$cloudlink = Capsule::table('tblconfiguration')
+    ->select('value')->where('setting',ione_address)->get();
+
+
+$arrayVariant=[
+    'Active'=>['RUNNING','POWEROFF'],
+    'Suspended'=>['SUSPENDED','POWEROFF']
+];
+
+$arrayProblems=[
+    'notInWhmcs'=>$this->LANG['misswhmcs'],
+    'hasError'=>$this->LANG['fillederror'],
+    'noStatus'=>$this->LANG['notmatch']
+];
+
+$searchStatusWhmcs=$_REQUEST['statusWhmcs'];
+$statusOn=$_REQUEST['statusOn'];
+$searchHost=$_REQUEST['host'];
+$searchIP=$_REQUEST['searchForIp'];
+$smartStatus=$_REQUEST['selectFilterStatus'];
+
+$page=$_REQUEST['page'];
+$pageCount=20;
+
+$hostsON=Capsule::table('mod_iOne_vmlist_cache')
+    ->groupBy('host')
+    ->lists('host');
+
+$satesON=Capsule::table('mod_iOne_vmlist_cache')
+    ->groupBy('state')
+    ->lists('state');
+
+$satusWhmcs=Capsule::table('tblhosting')
+    ->groupBy('domainstatus')
+    ->lists('domainstatus');
+
+
+if(!$searchStatusWhmcs){
+    $searchStatusWhmcs=['Suspended','Active'];
+};
+
+if(!$statusOn){
+    $statusOn=$satesON;
+};
+
+if(!$searchHost){
+    $searchHost=$hostsON;
+}
+
+if(in_array('notInWhmcs',$smartStatus)){
+    $loginWhmcs=Capsule::table('tblhosting')
+        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
+        ->lists('vmid');
+
+    $userIdOn=Capsule::table('mod_iOne_vmlist_cache')
+        ->whereNotIn('vmid',$loginWhmcs)
+        ->lists('login');
+}
+
+if(in_array('hasError',$smartStatus)){       //filled with an error
+    $hostingIds[]=Capsule::table('tblhosting')
+        ->join('mod_on_user','mod_on_user.id_service','=','tblhosting.id')
+        ->orWhere('mod_on_user.vmid',' ')
+        ->orWhere('mod_on_user.userid',' ')
+        ->orWhere('mod_on_user.loginon',' ')
+        ->orwhereNull('mod_on_user.vmid')
+        ->orWhereNull('mod_on_user.userid')
+        ->orWhereNull('mod_on_user.loginon')
+        ->lists('hosting.id');
+}
+
+
+if(in_array('noStatus',$smartStatus)){        //if the statuses do not match
+    foreach ($arrayVariant as $key=>$variant) {
+        $hostingIds[] = Capsule::table('tblhosting')
+            ->select('mod_iOne_vmlist_cache.state','tblhosting.domainstatus','tblhosting.id')
+            ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+            ->join('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+            ->where('tblhosting.domainstatus',$key)
+            ->whereNotIn('mod_iOne_vmlist_cache.state',$variant)
+            ->lists('tblhosting.id');
+    }
+}
+
+
+$pageGetUrl['statusWhmcs']=$searchStatusWhmcs;
+$pageGetUrl['statusOn']=$statusOn;
+$pageGetUrl['selectFilterStatus']=$smartStatus;
+$pageGetUrl['host']=$searchHost;
+$pageGetUrl['searchForIp']=$searchIP;
+$pageGetUrl=http_build_query($pageGetUrl);
+
+
+if(!$page) {
+    require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/servers/onconnector/lib/ONConnect.php');
+    $onconnect = new ONConnect();
+    $dataON = $onconnect->compare_info();
+    $userON = $dataON['response'][0];
+    $hostsON = $dataON['response'][1];
+        if(count($userON)>0) {
+            $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+                ->truncate();
+            $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+                ->insert($userON);
+        }
+}
+
+if(count($hostingIds)==0 && count($userIdOn)==0) {
+    $answerCount = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.userid',
+            'tblhosting.domainstatus',
+            'tblhosting.dedicatedip',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.domainstatus',
+            'tblhosting.userid',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid',
+            'tblhosting.dedicatedip',
+            'mod_iOne_vmlist_cache.state',
+            'mod_iOne_vmlist_cache.host')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+}
+elseif(count($hostingIds)!=0 && count($userIdOn)==0){
+
+    $resultHostingIds=[];
+    foreach ($hostingIds as $ids){
+        $resultHostingIds=array_merge($resultHostingIds,$ids);
+    }
+
+    $answerCount = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.userid',
+            'tblhosting.domainstatus',
+            'tblhosting.dedicatedip',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->whereIn('tblhosting.id',$resultHostingIds)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('tblproducts')
+        ->select(
+            'tblproducts.gid',
+            'tblhosting.domainstatus',
+            'tblhosting.userid',
+            'mod_on_user.id_service',
+            'mod_on_user.loginon',
+            'mod_on_user.passwordon',
+            'mod_on_user.userid as useridOn',
+            'mod_on_user.vmid',
+            'tblhosting.dedicatedip',
+            'mod_iOne_vmlist_cache.state',
+            'mod_iOne_vmlist_cache.host')
+        ->join('tblhosting', 'tblproducts.id', '=', 'tblhosting.packageid')
+        ->join('mod_on_user', 'mod_on_user.id_service', '=', 'tblhosting.id')
+        ->leftJoin('mod_iOne_vmlist_cache', 'mod_iOne_vmlist_cache.vmid', '=', 'mod_on_user.vmid')
+        ->whereIn('tblproducts.servertype', ['onconnector','ione'])
+        ->whereIn('tblhosting.domainstatus', $searchStatusWhmcs)
+        ->whereIn('mod_iOne_vmlist_cache.state', $statusOn)
+        ->whereIn('mod_iOne_vmlist_cache.host', $searchHost)
+        ->whereIn('tblhosting.id',$resultHostingIds)
+        ->where('tblhosting.dedicatedip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+}
+elseif(count($hostingIds)==0 && count($userIdOn)!=0){   //does not exist in whmcs
+    $answerCount = Capsule::table('mod_iOne_vmlist_cache')
+        ->whereIn('login',$userIdOn)
+        ->where('ip', 'like', '%' . $searchIP . '%')
+        ->count();
+
+    $userWHMCS = Capsule::table('mod_iOne_vmlist_cache')
+        ->whereIn('login',$userIdOn)
+        ->where('ip', 'like', '%' . $searchIP . '%')
+        ->offset(($page - 1) * $pageCount)
+        ->limit($pageCount)
+        ->orderBy('mod_iOne_vmlist_cache.vmid', 'asc')
+        ->get();
+    var_dump($answerCount);
+}
+elseif(count($hostingIds)!=0 && count($userIdOn)!=0){}
+
+foreach ($userWHMCS as $oneUser)
+{
+    if(!$oneUser->vmid){
+        $oneUser->col='warning';
+    }
+    if(!$oneUser->loginon){
+        $oneUser->col='info';
+    }
+    if(!$oneUser->host){
+        $oneUser->col='danger';
+    }
+    if(!$oneUser->col){
+        $oneUser->col='success';
+    }
+}
+
+$pageAll=ceil($answerCount/$pageCount);
+
+$minPage=$page-3;
+$maxPage=$page+3;
+if($minPage<1){
+    $minPage=1;
+}
+
+if($maxPage>$pageAll){
+    $maxPage=$pageAll;
+}
+
+$LANG=$this->vars['_lang'];
+?>
+
+    <link rel="stylesheet" href="/assets/css/selectize.css">
+    <script src="/assets/js/selectize.js"></script>
+    <form method="post" action="<?=$this->modulelink?>&page=1">
+        <div id="tabs">
+            <ul>
+                <li><a href="#tabs-1"><?=$LANG['searchFilter']?></a></li>
+            </ul>
+            <div id="tabs-1">
+                <div id="dialog-confirm" class="panel panel-default" style="position: relative; z-index: 2;">
+                    <ul class="list-group">
+
+                        <li class="list-group-item">
+                            <label for="host"><?=$LANG['searchByIP']?></label>
+                            <input id="inputForSearch" name="searchForIp" type="text" class="form-control" value="<?=$searchIP?>">
+                        </li>
+
+                        <li class="list-group-item">
+                            <label for="host"><?=$LANG['thHost']?></label>
+                            <select id="host" name="host[]" multiple="multiple">
+                                <?php foreach ($hostsON as $host):?>
+                                    <option value="<?=$host?>" <?php if(in_array($host,$searchHost)){print 'selected';}?>><?=$host?></option>
+                                <?php endforeach;?>
+                            </select>
+                        </li>
+
+                        <li class="list-group-item">
+                            <label for="statusWhmcs"><?=$LANG['thStatusWHMCS']?></label>
+                            <select id="statusWhmcs" name="statusWhmcs[]" multiple="multiple">
+                                <?php foreach ($satusWhmcs as $status):?>
+                                    <option value="<?=$status?>" <?php if(in_array($status,$searchStatusWhmcs)){print 'selected';}?>><?=$status?></option>
+                                <?php endforeach;?>
+                            </select>
+                        </li>
+
+                        <li class="list-group-item">
+                            <label for="statusOn"><?=$LANG['thStatusOpenNebula']?></label>
+                            <select id="statusOn" name="statusOn[]" multiple="multiple">
+                                <?php foreach ($satesON as $sate):?>
+                                    <option value="<?=$sate?>" <?php if(in_array($sate,$statusOn)){print 'selected';}?>><?=$sate?></option>
+                                <?php endforeach;?>
+                            </select>
+                        </li>
+
+                        <li class="list-group-item">
+                            <label for="statusOn"><?=$LANG['filterByProblem']?></label>
+                            <select id="selectFilterStatus" name="selectFilterStatus[]" multiple="multiple">
+                                <?php foreach ($arrayProblems as $codeProblem=>$problem):?>
+                                    <option value="<?=$codeProblem?>" <?php if(in_array($codeProblem,$smartStatus)){print 'selected';}?>><?=$problem?></option>
+                                <?php endforeach;?>
+                            </select>
+                        </li>
+                    </ul>
+                    <div class="row">
+                        <div class="col-lg-9"></div>
+                        <div class="col-lg-1"><input type="submit" style="width: 100%" class="btn btn-info" value="<?=$LANG['search']?>"></div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </form>
+    <table class='table table-bordered table-hover table-condensed'>
+        <thead class="thead-inverse">
+        <tr>
+            <th><?=$LANG['thClientsId']?></th>
+            <th><?=$LANG['thHostingId']?></th>
+            <th><?=$LANG['thLoginOpenNebula']?></th>
+            <th><?=$LANG['thUserIdOpenNebula']?></th>
+            <th><?=$LANG['thVmidOpenNebula']?></th>
+            <th><?=$LANG['thStatusOpenNebula']?></th>
+            <th><?=$LANG['thStatusWHMCS']?></th>
+            <th><?=$LANG['thHost']?></th>
+            <th><?=$LANG['thIpAddress']?></th>
+            <th><?=$LANG['thDo']?></th>
+        </tr>
+        </thead>
+
+        <?php foreach ($userWHMCS as $oneUser):?>
+            <tr class='<?=$oneUser->col?>'>
+                <td><a href="/admin/clientssummary.php?userid=<?=$oneUser->userid?>" target="_blank"><?=$oneUser->userid?></a></td>
+                <td><a href="/admin/clientsservices.php?userid=<?=$oneUser->userid?>&id=<?=$oneUser->id_service?>" target="_blank"><?=$oneUser->id_service?></a></td>
+                <td><?=$oneUser->loginon?></td>
+                <td><a href="<?=$cloudlink[0]->value?>/#users-tab/<?=$oneUser->useridOn?>" target="_blank"><?=$oneUser->useridOn?></a></td>
+                <td><a href="<?=$cloudlink[0]->value?>/#vms-tab/<?=$oneUser->vmid?>" target="_blank"><?=$oneUser->vmid?></a></td>
+                <td><?=$oneUser->state?></td>
+                <td><?=$oneUser->domainstatus?></td>
+                <td><?=$oneUser->host?></td>
+                <td><?=$oneUser->dedicatedip?></td>
+                <td>
+                    <a href="<?=$this->vars['modulelink'].'&tabs=vmlist&mod=panel&serviceId='.$oneUser->id_service?>" class="btn btn-info"><?=$LANG['modEdit']?></a>
+                </td>
+            </tr>
+        <?php endforeach;?>
+    </table>
+    <div class="row">
+        <div class="col-lg-10 col-mg-10">
+            <ul class="pagination">
+                <li><a href="<?=$this->modulelink?>&page=1&<?=$pageGetUrl?>">«</a></li>
+                <?php for($i=$minPage;$i<=$maxPage;$i++):?>
+                    <li class="<?php if($i==$page){print 'active';};?>"><a href="<?=$this->modulelink?>&page=<?=$i?>&<?=$pageGetUrl?>"><?=$i?></a></li>
+                <?php endfor;?>
+                <li><a href="<?=$this->modulelink?>&page=<?=$pageAll?>&<?=$pageGetUrl?>">»</a></li>
+            </ul>
+        </div>
+
+        <div class="col-lg-2 col-mg-2">
+            <a class="btn btn-info" href="<?=$this->modulelink?>"><?=$LANG['updatecache']?><span class="glyphicon glyphicon-refresh"></span></a>
+        </div>
+    </div>
+
+<?php
+print ($LANG['timescript'].': '.(microtime(true) - $start).' '.$LANG['second'] );
diff --git a/servers/onconnector/hooks.php b/servers/onconnector/hooks.php
index cae4a5a..6dc3ad1 100644
--- a/servers/onconnector/hooks.php
+++ b/servers/onconnector/hooks.php
@@ -1,352 +1,279 @@
-<?php
-
-use WHMCS\Database\Capsule;
-
-
-
-function hook_onconnector_clientedit(array $params)
-{
-    try {
-
-    } catch (Exception $e) {
-        // Consider logging or reporting the error.
-    }
-}
-
-function hook_onconnector_InvoicePaid(array $params)
-{
-    try {
-        $order = Capsule::table('tblorders')
-            ->where('invoiceid', $params['invoiceid'])
-            ->get();
-
-        $tblhosting = Capsule::table('tblhosting')
-            ->where('orderid', $order[0]->id)
-            ->get();
-
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $params,
-            "Paid"
-        );
-
-        $data = Capsule::table('mod_on_user')
-            ->where('id_service', $tblhosting[0]->id)
-            ->get();
-
-        $server = Capsule::table('tblservers')
-            ->where('id', $tblhosting[0]->server)
-            ->get();
-        if (isset($server[0]->ipaddress) && ctype_digit($data[0]->userid) && ctype_digit($data[0]->vmid)) {
-
-            require_once("lib/ONConnect.php");
-            $onconnect = new ONConnect($server[0]->ipaddress);
-            $result = $onconnect->Unsuspend($data[0]->vmid);
-
-            Capsule::table('tblhosting')
-                ->where('orderid', $order[0]->id)
-                ->update(
-                    array(
-                        'domainstatus' => 'Activity',
-                    ));
-        }
-    } catch (Exception $e) {
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $e->getMessage(),
-            $e->getTraceAsString()
-        );
-    }
-
-}
-
-function hook_onconnector_EmailTplMergeFields(array $params)
-{
-    $merge_fields = [];
-    $merge_fields['ONLogin'] = "User ON";
-    $merge_fields['OnPassword'] = "Password ON";
-    $merge_fields['wiki_link'] = "Wiki link";
-    return $merge_fields;
-}
-
-function hook_onconnector_EmailPreSend(array $params)
-{
-    $date = Capsule::table('mod_on_user')
-        ->where('id_service', $params['relid'])
-        ->get();
-    $merge_fields = [];
-    $merge_fields['ONLogin'] = $date[0]->loginon;
-    $merge_fields['OnPassword'] = $date[0]->passwordon;
-    $marge_fields['wiki_link'] = 'https://goo.gl/k5VgQE';
-    return $merge_fields;
-}
-
-add_hook('AddonSuspended', 1, function ($vars) {
-    $command = 'GetClientsProducts';
-    $postData = array(
-        'serviceid' => $vars['serviceid'],
-    );                                                                      // Getting service;
-    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-    $adminUsername = $adminlog[0]->value;                                             // Init using hell api;
-
-    $results = localAPI($command, $postData, $adminUsername);
-
-    logModuleCall(
-        'AddonSuspended',
-        __FUNCTION__,
-        'Suspend attempt',
-        $vars,
-        $vars
-    );
-
-    if ($results['products']['product'][0]['status'] == 'Active') {
-
-        $command = 'UpdateClientAddon';
-        $postData = array(
-            'id' => $vars['id'],
-            'status' => 'Active',
-        );
-        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-        $adminUsername = $adminlog[0]->value; // Optional for WHMCS 7.2 and later
-
-        $results = localAPI($command, $postData, $adminUsername);
-        print_r($results);
-    }
-});
-
-add_hook('PreModuleSuspend', 1, function ($params) {
-
-    $iaas_servers =  Capsule::table( 'mod_iaas_servers' )->where('idproduct','=',$params['pid'])->get();
-    if($iaas_servers == null) {
-
-        if ($params['params']['moduletype'] != 'onconnector') {
-            return true;
-        } else {
-            logModuleCall(
-                'immun',
-                __FUNCTION__,
-                'Suspend attempt',
-                $params,
-                get_declared_classes()
-            );
-        }
-
-        if (class_exists('WHMCS\Form')) {
-            logModuleCall(
-                'immun',
-                __FUNCTION__,
-                'Manual suspend',
-                $params,
-                get_declared_classes()
-            );
-        }
-
-        if (strstr($params['params']['suspendreason'], 'force')) {
-            return true;
-        } else {
-            $castomfild = Capsule::table('tblcustomfieldsvalues')
-                ->where('relid', $params['params']['userid'])
-                ->where('fieldid', '3697')
-                ->get();
-
-
-
-            $customname = Capsule::table('tblconfiguration')->where('setting', 'customfield')->get();
-            $customfildcheck = Capsule::table('tblcustomfields')
-                ->select('id')->where('fieldname', $customname[0]->value)->get();
-            $castomfild = Capsule::table('tblcustomfieldsvalues')
-                ->where('relid', $params['params']['userid'])
-                ->where('fieldid', $customfildcheck[0]->id)
-                ->get();
-
-            if (((!isset($castomfild[0]->value)) || ($castomfild[0]->value != 'Да')) && ((!isset($castomfild[0]->value)) || ($castomfild[0]->value != 'Yes')) && (date(N) < 5)) {
-
-                // If immun field not created or not filled with 'Yes', and today is not 5, 6 or 7-th weekday.
-
-                $command = 'GetClientsProducts';
-                $postData = array(
-                    'serviceid' => $params['params']['serviceid'],
-                );                                                                      // Getting service;
-                $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-                $adminUsername = $adminlog[0]->value;                                              // Init using hell api;
-
-                $results = localAPI($command, $postData, $adminUsername);
-                $age = time() - strtotime($results['products']['product'][0]['regdate']);   // Service 'age';
-
-                if ($age < 2592000) {                                                       // If service isn't older than 30 days;
-                    logModuleCall(
-                        'immun',
-                        __FUNCTION__,
-                        'Service age is lower than 30 days',
-                        $params,
-                        $params
-                    );
-                    $result['abortcmd'] = true;                                         // Setting param for suspend cancellation;
-                    return $result;                                                     // Return vars to handler;
-                }
-
-                $invoiceitems = Capsule::table('tblinvoiceitems')
-                    ->where('relid', $params['params']['serviceid'])
-                    ->get();                                        // Getting invoices for this service from DB;
-
-                if (!$invoiceitems) {                                 // If no invoices;
-                    logModuleCall(
-                        'immun',
-                        __FUNCTION__,
-                        'Service suspended',
-                        $params,
-                        $params
-                    );
-                    $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
-                    return $result;                                 // Return vars to handler;
-                }
-
-                $lastInvoice = array_pop($invoiceitems);              // Getting last invoice(dangerous, check it twice);
-
-                if (time() < strtotime($lastInvoice->duedate)) {        // If pay-date earlier than today.
-                    logModuleCall(
-                        'immun',
-                        __FUNCTION__,
-                        'Invoice transfered or delayed',
-                        $params,
-                        $params
-                    );
-
-                    $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
-                    return $result;                                 // Return vars to handler;
-                }
-
-                $delay = Capsule::table('support_delay_invoice')
-                    ->where('invoice_id', $lastInvoice->invoiceid)
-                    ->get();                                        // Getting from DB next pay-date;
-
-                if (time() < strtotime($delay[0]->expire_date))        // If today is earlier than delayed pay-date;
-                {
-                    $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
-                    return $result;                                 // Return vars to handler;
-                } else {
-                    logModuleCall(
-                        'immun',
-                        __FUNCTION__,
-                        'Service suspended',
-                        $params,
-                        $params
-                    );
-                    return true;                                         // Suspending
-                }
-            } else {
-                logModuleCall(
-                    'immun',
-                    __FUNCTION__,
-                    'Immun-service suspend attempt',
-                    $params,
-                    $params['params']['suspendreason']
-                );
-
-                $result['error'] = "This service has suspend immun";
-                $result['abortcmd'] = true;
-                return $result;
-            }
-        }
-    }
-});
-add_hook('InvoicePaid', 1, function ($vars) {
-
-    $command = 'GetInvoice';
-    $postData = array(
-        'invoiceid' => $vars['invoiceid'],
-    );
-    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-    $adminUsername = $adminlog[0]->value;
-
-    $results = localAPI($command, $postData, $adminUsername);
-    $usid = $results['userid'];
-
-    $command = 'GetClientsProducts';
-    $postData = array(
-        'clientid' => $usid,
-        'stats' => true,
-    );
-    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-    $adminUsername = $adminlog[0]->value;
-
-    $results = localAPI($command, $postData, $adminUsername);
-
-
-    if (strripos($results['products']['product'][0]['translated_groupname'], 'Trial') > -1) {
-        $command = 'ModuleCreate';
-        $postData = array(
-            'accountid' => $results['products']['product'][0]['id'],
-        );
-
-        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-        $adminUsername = $adminlog[0]->value;
-
-        $results = localAPI($command, $postData, $adminUsername);
-
-    }
-
-    logModuleCall(
-        'onconnector',
-        __FUNCTION__,
-        $vars, $results, $results
-    );
-
-    return;
-
-});
-add_hook('EmailPreSend', 1, 'hook_onconnector_EmailPreSend');
-add_hook('EmailTplMergeFields', 1, 'hook_onconnector_EmailTplMergeFields');
-add_hook('InvoiceUnpaid', 1, 'hook_onconnector_Invoice');
-add_hook('InvoiceCancelled', 1, 'hook_onconnector_InvoiceCancelled');
-add_hook('ClientEdit', 1, 'hook_onconnector_clientedit');
-add_hook('AfterInvoicingGenerateInvoiceItems', 1, 'hook_onconnector_AfterInvoicingGenerateInvoiceItems');
-add_hook('ClientAreaPageProductDetails', 1, function ($vars) {
-    $userDate = Capsule::table('mod_on_user')
-        ->select('loginon', 'passwordon')
-        ->where('id_service', $vars['serviceid'])
-        ->first();
-    $extraTemplateVariables['loginOn'] = $userDate->loginon;
-    $extraTemplateVariables['passwordOn'] = $userDate->passwordon;
-    return $extraTemplateVariables;
-});
-
-add_hook('ClientAreaPageProductDetails', 1, function ($vars) {
-    $userDate = Capsule::table('mod_on_user')
-        ->select('loginon', 'passwordon')
-        ->where('id_service', $vars['serviceid'])
-        ->first();
-    $extraTemplateVariables['loginOn'] = $userDate->loginon;
-    $extraTemplateVariables['passwordOn'] = $userDate->passwordon;
-    return $extraTemplateVariables;
-});
-
-
-
-    add_hook('ClientAreaPageHome', 1, function ($vars) {
-        if ($vars['clientsdetails']['userid']){
-        $result = '';
-        $counter = 0;
-        $id = $vars['clientsdetails']['userid'];
-        $key = 413397;
-        $result = strlen($id) . $id;
-        while (strlen($result) < 6) {
-            if ($counter > strlen($id)) {
-                $counter = 0;
-            }
-            $result .= str_split($vars['clientsdetails']['userid'])[0];
-            $counter++;
-        }
-        $key = (string)$key;
-        for ($i = 0; $i < 6; $i++) {
-            $result[$i] = ($result[$i] + $key[$i]) % 10;
-        }
-        $extraTemplateVariables['clientPinCode'] = $result;
-        return $extraTemplateVariables;
-
-        }
-    });
+<?php
+
+use WHMCS\Database\Capsule;
+
+
+
+
+function hook_onconnector_EmailTplMergeFields(array $params)
+{
+    $merge_fields = [];
+    $merge_fields['ONLogin'] = "User ON";
+    $merge_fields['OnPassword'] = "Password ON";
+    $merge_fields['wiki_link'] = "Wiki link";
+    return $merge_fields;
+}
+
+function hook_onconnector_EmailPreSend(array $params)
+{
+    $date = Capsule::table('mod_on_user')
+        ->where('id_service', $params['relid'])
+        ->get();
+    $merge_fields = [];
+    $merge_fields['ONLogin'] = $date[0]->loginon;
+    $merge_fields['OnPassword'] = $date[0]->passwordon;
+    $marge_fields['wiki_link'] = 'https://goo.gl/k5VgQE';
+    return $merge_fields;
+}
+
+
+
+add_hook('AddonSuspended', 1, function ($vars) {
+    $command = 'GetClientsProducts';
+    $postData = array(
+        'serviceid' => $vars['serviceid'],
+    );                                                                      // Getting service;
+    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+    $adminUsername = $adminlog[0]->value;
+
+    $results = localAPI($command, $postData, $adminUsername);
+
+    logModuleCall(
+        'AddonSuspended',
+        __FUNCTION__,
+        'Suspend attempt',
+        $vars,
+        $vars
+    );
+
+    if ($results['products']['product'][0]['status'] == 'Active') {
+
+        $command = 'UpdateClientAddon';
+        $postData = array(
+            'id' => $vars['id'],
+            'status' => 'Active',
+        );
+        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+        $adminUsername = $adminlog[0]->value;
+
+        $results = localAPI($command, $postData, $adminUsername);
+        print_r($results);
+    }
+});
+
+add_hook('PreModuleSuspend', 1, function ($params) {
+
+    if ($params['params']['moduletype'] != 'onconnector') {
+        return true;
+    } else {
+        logModuleCall(
+            'immun',
+            __FUNCTION__,
+            'Suspend attempt',
+            $params,
+            get_declared_classes()
+        );
+    }
+
+    if (class_exists('WHMCS\Form')) {
+        logModuleCall(
+            'immun',
+            __FUNCTION__,
+            'Manual suspend',
+            $params,
+            get_declared_classes()
+        );
+    }
+
+    if (strstr($params['params']['suspendreason'], 'force')) {
+        return true;
+    } else {
+        $customname = Capsule::table('tblconfiguration')->where('setting', 'customfield')->get();
+        $customfildcheck = Capsule::table('tblcustomfields')
+            ->select('id')->where('fieldname', $customname[0]->value)->get();
+        $castomfild = Capsule::table('tblcustomfieldsvalues')
+            ->where('relid', $params['params']['userid'])
+            ->where('fieldid', $customfildcheck[0]->id)
+            ->get();
+
+        if (((!isset($castomfild[0]->value)) || ($castomfild[0]->value != 'Да') || ($castomfild[0]->value != 'Yes')) && (date(N) < 5)) {
+
+            $command = 'GetClientsProducts';
+            $postData = array(
+                'serviceid' => $params['params']['serviceid'],
+            );                                                                      // Getting service;
+            $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+            $adminUsername = $adminlog[0]->value;
+
+            $results = localAPI($command, $postData, $adminUsername);
+            $age = time() - strtotime($results['products']['product'][0]['regdate']);   // Service 'age';
+
+            if ($age < 432000) {                                                       // If service isn't older than 30 days;
+                logModuleCall(
+                    'immun',
+                    __FUNCTION__,
+                    'Service age is lower than 30 days',
+                    $params,
+                    $params
+                );
+                $result['abortcmd'] = true;                                         // Setting param for suspend cancellation;
+                return $result;                                                     // Return vars to handler;
+            }
+
+            $invoiceitems = Capsule::table('tblinvoiceitems')
+                ->where('relid', $params['params']['serviceid'])
+                ->get();                                        // Getting invoices for this service from DB;
+
+            if (!$invoiceitems) {                                 // If no invoices;
+                logModuleCall(
+                    'immun',
+                    __FUNCTION__,
+                    'Service suspended',
+                    $params,
+                    $params
+                );
+                $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
+                return $result;                                 // Return vars to handler;
+            }
+
+            $lastInvoice = array_pop($invoiceitems);              // Getting last invoice(dangerous, check it twice);
+
+            if (time() < strtotime($lastInvoice->duedate)) {        // If pay-date earlier than today.
+                logModuleCall(
+                    'immun',
+                    __FUNCTION__,
+                    'Invoice transfered or delayed',
+                    $params,
+                    $params
+                );
+
+                $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
+                return $result;                                 // Return vars to handler;
+            }
+
+            $delay = Capsule::table('support_delay_invoice')
+                ->where('invoice_id', $lastInvoice->invoiceid)
+                ->get();                                        // Getting from DB next pay-date;
+
+            if (time() < strtotime($delay[0]->expire_date)) {
+                $result['abortcmd'] = true;                     // Setting param for suspend cancellation;
+                return $result;                                 // Return vars to handler;
+            } else {
+                logModuleCall(
+                    'immun',
+                    __FUNCTION__,
+                    'Service suspended',
+                    $params,
+                    $params
+                );
+                return true;                                         // Suspending
+            }
+        } else {
+            logModuleCall(
+                'immun',
+                __FUNCTION__,
+                'Immun-service suspend attempt',
+                $params,
+                $params['params']['suspendreason']
+            );
+
+            $result['error'] = "This service has suspend immun";
+            $result['abortcmd'] = true;
+            return $result;
+        }
+    }
+});
+
+add_hook('InvoicePaid', 1, function ($vars) {
+
+    $command = 'GetInvoice';
+    $postData = array(
+        'invoiceid' => $vars['invoiceid'],
+    );
+    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+    $adminUsername = $adminlog[0]->value;
+
+    $results = localAPI($command, $postData, $adminUsername);
+    $usid = $results['userid'];
+
+    $command = 'GetClientsProducts';
+    $postData = array(
+        'clientid' => $usid,
+        'stats' => true,
+    );
+    $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+    $adminUsername = $adminlog[0]->value;
+
+    $results = localAPI($command, $postData, $adminUsername);
+
+
+    if (strripos($results['products']['product'][0]['translated_groupname'], 'Trial') > -1) {
+        $command = 'ModuleCreate';
+        $postData = array(
+            'accountid' => $results['products']['product'][0]['id'],
+        );
+        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+        $adminUsername = $adminlog[0]->value;
+
+        $results = localAPI($command, $postData, $adminUsername);
+
+    }
+
+    logModuleCall(
+        'onconnector',
+        __FUNCTION__,
+        $vars, $results, $results
+    );
+
+    return;
+
+});
+
+add_hook('EmailPreSend', 1, 'hook_onconnector_EmailPreSend');
+add_hook('EmailTplMergeFields', 1, 'hook_onconnector_EmailTplMergeFields');
+
+
+add_hook('ClientAreaPageProductDetails', 1, function ($vars) {
+    $userDate = Capsule::table('mod_on_user')
+        ->select('loginon', 'passwordon')
+        ->where('id_service', $vars['serviceid'])
+        ->first();
+    $extraTemplateVariables['loginOn'] = $userDate->loginon;
+    $extraTemplateVariables['passwordOn'] = $userDate->passwordon;
+    return $extraTemplateVariables;
+});
+
+add_hook('ClientAreaPageProductDetails', 1, function ($vars) {
+    $userDate = Capsule::table('mod_on_user')
+        ->select('loginon', 'passwordon')
+        ->where('id_service', $vars['serviceid'])
+        ->first();
+    $extraTemplateVariables['loginOn'] = $userDate->loginon;
+    $extraTemplateVariables['passwordOn'] = $userDate->passwordon;
+    return $extraTemplateVariables;
+});
+
+
+add_hook('ClientAreaPageHome', 1, function ($vars) {
+        if ($vars['clientsdetails']['userid']){
+        $result = '';
+        $counter = 0;
+        $id = $vars['clientsdetails']['userid'];
+        $key = 413397;
+        $result = strlen($id) . $id;
+        while (strlen($result) < 6) {
+            if ($counter > strlen($id)) {
+                $counter = 0;
+            }
+            $result .= str_split($vars['clientsdetails']['userid'])[0];
+            $counter++;
+        }
+        $key = (string)$key;
+        for ($i = 0; $i < 6; $i++) {
+            $result[$i] = ($result[$i] + $key[$i]) % 10;
+        }
+        $extraTemplateVariables['clientPinCode'] = $result;
+        return $extraTemplateVariables;
+
+        }
+    });
diff --git a/servers/onconnector/lib/ONConnect.php b/servers/onconnector/lib/ONConnect.php
index a0337e5..18e88de 100644
--- a/servers/onconnector/lib/ONConnect.php
+++ b/servers/onconnector/lib/ONConnect.php
@@ -1,105 +1,128 @@
 <?php
 use WHMCS\Database\Capsule;
 
-ini_set('display_errors', 0);
 
 class ONConnect
 {
-    private $context;
-    private $socket;
-    private $dsn;
-    private $debug;
 
-    public function __construct($ip=false,$port=8008,$debugMod=false)
-    {
-        if(!class_exists('ZMQContext')){
-            logModuleCall(__CLASS__,__FUNCTION__,'error', $this->dsn, 'Failed to load class ZMQContext');
-        }
-        if(!$ip) {
-            $ip = Capsule::table('tblconfiguration')->where('setting', 'ione_config_host')->get();
-            $ip=$ip[0]->value;
+    public function CurlLogin()
+    {
+        $username = Capsule::table('tblconfiguration')->where('setting', 'ione_config_login')->get();
+        $password = Capsule::table('tblconfiguration')->where('setting', 'ione_config_passwd')->get();
+        $addr = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $addr[0]->value.'login');
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_HEADER, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array()));
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_USERPWD, $username[0]->value . ":" . $password[0]->value);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        $response = curl_exec($ch);
+        curl_close($ch);
+
+        $cookie_start = stristr($response, 'sunstone');
+        $cookie = stristr($cookie_start, ' path', true);
+
+
+        if (Capsule::table('tblconfiguration')
+            ->where('setting', 'cookie_on')
+            ->get()) {
+            Capsule::table('tblconfiguration')
+                ->where('setting', 'cookie_on')
+                ->update([
+                    'setting' => 'cookie_on',
+                    'value' => $cookie
+                ]);
+        } else {
+            $result = Capsule::table('tblconfiguration')
+                ->insert([
+                    'setting' => 'cookie_on',
+                    'value' => $cookie
+                ]);
         };
-        if(!$port) {
-            $port = Capsule::table('tblconfiguration')->where('setting', 'ione_config_port')->get();
-            $port=$port[0]->value;
-        }
-        $this->debug=$debugMod;
-        $this->dsn="tcp://".$ip.":".$port;
-    }
 
-    private function farmJson($method,$params)
-    {
-        $message= array (
-            "jsonrpc"=>"2.0",
-            "method"=>$method,
-            "params"=>$params,
-            "id"=>rand(0,999),
-        );
-        return json_encode($message);
-    }
+        return;
+    }
+
+    public function CurlConnect($method, $params)
+    {
+        $i = 0;
+        do{
+            $get_cookie = Capsule::table('tblconfiguration')->select('value')->where('setting', 'cookie_on')->get();
+            $addr = Capsule::table('tblconfiguration')->where('setting', 'ione_address')->get();
+
+            $cookie_on = $get_cookie[0]->value;
+            $i++;
+            $data = array('params' => $params);
+            $data_json = json_encode($data);
+
+            $ch = curl_init();
+            curl_setopt($ch, CURLOPT_URL, $addr[0]->value.'/ione/' . $method);
+            curl_setopt($ch, CURLOPT_POST, 1);
+            curl_setopt($ch, CURLOPT_HEADER, 1);
+            curl_setopt($ch, CURLOPT_VERBOSE, true);
+            curl_setopt($ch, CURLOPT_COOKIE, $cookie_on);
+						curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+						curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+						$response = curl_exec($ch);
+						if ($response === false) {
+							logModuleCall(
+									__CLASS__,
+									__FUNCTION__. " error:",
+									curl_getinfo($ch),
+									'err #' . curl_errno($ch) . ": " . curl_error($ch),
+							);
+						}
+            $error = stripos($response, '401 Unauthorized');
+            if ($error === false) {} else {
+
+                $i++;
+                if ($i < 5) {
+                    curl_close($ch);
+                    $this->CurlLogin();
+                } else {
+                    curl_close($ch);
+                    $err = new stdClass();
+                    $err->response->error = 'Error connection to IONE';
+                    logModuleCall(
+                        __CLASS__,
+                        __FUNCTION__,
+                        'error connect',
+                        $err
+                    );
+                    return $err;
+                }
+            }
+            curl_close($ch);
 
-    private function closeConnection(){
-        $endpoints = $this->socket->getEndpoints();
-        if (!in_array($this->dsn, $endpoints['connect'])) {
-            $this->socket->disconnect($this->dsn);
-        }
-    }
+        }while($error != '');
 
-    private function logParams($params,$message=null)
-    {
-        logModuleCall(
-            __CLASS__,
-            __FUNCTION__,
-            $this->dsn, $params, $message
-        );
-        return '{"id":970,"jsonrpc":"2.0","result":{"userid":666,"vmid":666,"ip":"255.255.255.255"}}';
+        $response_start = stristr($response, '{');
+        $array_answer = json_decode ($response_start);
+
+        return $array_answer;
     }
 
-    private function zmqCommunication($method,$params,$persistenId='onConnector')
-    {
-        $json = $this->farmJson($method,$params);
-
-        try {
-            $this->context = new ZMQContext();
-            $this->socket = $this->context->getSocket(ZMQ::SOCKET_REQ, 'ZMQSockIone');
-            $this->socket->setSockOpt(ZMQ::SOCKOPT_RCVTIMEO,-1);
-            $this->socket->setSockOpt(ZMQ::SOCKOPT_SNDTIMEO,10000);
-            $endpoints = $this->socket->getEndpoints();
-            if (!in_array($this->dsn, $endpoints['connect'])) {
-                $this->socket->connect($this->dsn);
-            }
-            if($this->debug){
-                $message=$this->logParams($json);
-            }else {
-                $this->socket->send($json);
-                $message = $this->socket->recv();
-                $this->logParams($json,$message);
-            }
-            $this->closeConnection();
-            return $message;
-        } catch (Exception $exception){
-            $this->closeConnection();
-                logModuleCall(
-                    __CLASS__,
-                    __FUNCTION__,
-                    $exception, $this->dsn, 'Information could not be retrieved because the server was not reachable'
-                );
-                return ['error'=>true,
-                        'errorMessage'=>'Information could not be retrieved because the server was not reachable'];
-        }
+    public function IaaS($method,$params){
+        $json=$this->CurlConnect($method,$params);
+        return $json;
     }
 
     public function Suspend($vmid,$force=false)
     {
         $param=array(
-                array (
+            array (
                 'vmid'=>$vmid,
                 'force'=>$force,
                 'log'=>true
             )
         );
-        $json=$this->zmqCommunication("Suspend",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Suspend",$param);
+        return $json;
     }
 
     public function Unsuspend($vmid)
@@ -109,125 +132,65 @@ public function Unsuspend($vmid)
                 'vmid' =>$vmid
             )
         );
-        $json=$this->zmqCommunication("Unsuspend",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Unsuspend",$param);
+        return $json;
     }
 
     public function Shutdown($vmid)
     {
         $param=array($vmid);
-        $json=$this->zmqCommunication("Shutdown",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Shutdown",$param);
+        return $json;
     }
 
     public function Reboot($vmid,$bool=true)
     {
         $param=array($vmid,$bool);
-        $json=$this->zmqCommunication("Reboot",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Reboot",$param);
+        return $json;
     }
 
     public function Terminate($userid, $vmid)
     {
         $param=array($userid,$vmid);
-        $json=$this->zmqCommunication("Terminate",$param);
-        return json_decode($json,true);
-    }
-    public function TerminateIaas($uid)
-    {
-        $param=array($uid);
-        $json=$this->zmqCommunication("UserDelete",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Terminate",$param);
+        return $json;
     }
 
     public function getVmByName($name)                                  // Getting VM data by name, using for button 'check'
     {
         $param=array($name);
-        $json=$this->zmqCommunication("get_vm_by_uname",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("get_vm_by_uname",$param);
+        return $json;
     }
 
     public function GetIP($vmid)                                        // Getting VM IP using VMID
     {
         $param=array($vmid);
-        $json=$this->zmqCommunication("GetIP",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("GetIP",$param);
+        return $json;
     }
 
-    public function Test($param=array("PING"))                          // Checking IONe availability sending 'ping', answer should be 'pong'
+    public function Test()                                             // Checking IONe availability sending 'ping', answer should be 'pong'
     {
-        $json=$this->zmqCommunication("Test",$param);
-        return json_decode($json,true);
+        $param=array("PING");
+        $json=$this->CurlConnect("Test",$param);
+        return $json;
     }
 
     public function compare_info($ips=[])                               // Getting data about all VMs from IONe
     {
         $params=array($ips);
-        $json=$this->zmqCommunication("compare_info",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("compare_info",$params);
+        $json_new = json_decode(json_encode($json),true);
+        return $json_new;
     }
 
     public function createVMwithSpecs($arrayParam)                      // Creating VM from template with params
     {
         $param=array($arrayParam);
-        $json=$this->zmqCommunication("CreateVMwithSpecs",$param);
-        return json_decode($json,true);
-    }
-
-    public function UserCreateIaaS($arrayParam)                      // Creating iaas user
-    {
-
-        $param=array( $arrayParam['login'],$arrayParam['pass'],$arrayParam['groupid'],$arrayParam['locale']);
-        $json=$this->zmqCommunication("UserCreate",$param);
-        return json_decode($json,true);
-    }
-
-
-
-    public function RetrieveShowback($uid,$time,$balance)                      // get date about iaas users
-    {
-        $checkiaas = Capsule::table('tbladdonmodules')->select('*')->where('module','=','opennebulavdc')->get();
-        if($checkiaas) {
-            $param['uid'] = $uid;
-            $param['time'] = $time;
-            $param['balance'] = $balance;
-
-            $params = array(
-                array(
-                'uid' => $uid,
-                'time' => $time,
-                'balance' => $balance
-                ),
-            );
-
-            logModuleCall(
-                'onconnector',
-                __FUNCTION__,
-                'test',
-                $params
-            );
-            $json = $this->zmqCommunication("IaaS_Gate", $params);
-        }
-
-        return json_decode($json,true);
-    }
-
-    public function SuspendUserIaas($uid){
-        $checkiaas = Capsule::table('tbladdonmodules')->select('*')->where('module','=','opennebulavdc')->get();
-        if($checkiaas) {
-            $params = array($uid);
-            $json = $this->zmqCommunication("SuspendUser", $params);
-            return json_decode($json,true);
-        }
-    }
-
-    public function UnSuspendUserIaas($uid){
-        $checkiaas = Capsule::table('tbladdonmodules')->select('*')->where('module','=','opennebulavdc')->get();
-        if($checkiaas) {
-            $params = array($uid);
-            $json = $this->zmqCommunication("UnsuspendUser", $params);
-            return json_decode($json,true);
-        }
+        $json=$this->CurlConnect("CreateVMwithSpecs",$param);
+        return $json;
     }
 
     public function NewAccount($login, $pass, $templateid, $groupid, $rootpass, $trial, $services, $ansiblebool, $serviceid)
@@ -243,16 +206,16 @@ public function NewAccount($login, $pass, $templateid, $groupid, $rootpass, $tri
             'ansible'=>$ansiblebool,
             'services'=>$services,
             'serviceid'=>$serviceid
-            )
+        )
         );
-        $json=$this->zmqCommunication("NewAccount",$param);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("NewAccount",$param);
+        return $json;
     }
 
     public function Reinstall($params)
     {
-        $json=$this->zmqCommunication("Reinstall",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("Reinstall",$params);
+        return $json;
     }
 
     public function setBackup($func_name, $params = array())
@@ -261,8 +224,8 @@ public function setBackup($func_name, $params = array())
             'method'=>$func_name,
             'params'=>$params
         ));
-        $json=$this->zmqCommunication("FreeNASController",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("FreeNASController",$params);
+        return $json;
     }
 
     public function AnsibleController($host,$serviceName)
@@ -271,77 +234,78 @@ public function AnsibleController($host,$serviceName)
             'host'=>$host,
             'services' => $serviceName
         ));
-        $json=$this->zmqCommunication("AnsibleController",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("AnsibleController",$params);
+        return $json;
     }
 
     public function import($params)
     {
         $params=array($params);
-        $json=$this->zmqCommunication("IMPORT",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("IMPORT",$params);
+        return $json;
     }
 
     public function getSnapshotList($vmid)
     {
-        $json=$this->zmqCommunication("GetSnapshotList",array($vmid));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("GetSnapshotList",array($vmid));
+        return $json;
     }
 
     public function MKSnapshot($vmid, $name)
     {
         $params=array($vmid,$name);
-        $json=$this->zmqCommunication("MKSnapshot",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("MKSnapshot",$params);
+        return $json;
     }
 
     public function RMSnapshot($vmid, $snapid)
     {
         $params=array($vmid,$snapid);
-        $json=$this->zmqCommunication("RMSnapshot",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("RMSnapshot",$params);
+        return $json;
     }
 
     public function RevSnapshot($vmid, $snapid)
     {
         $params=array($vmid,$snapid);
-        $json=$this->zmqCommunication("RevSnapshot",$params);
-        return json_decode($json,true);
+        $json=$this->CurlConnect("RevSnapshot",$params);
+        return $json;
     }
 
     public function lcmStateStr($vmid)
     {
-        $json=$this->zmqCommunication("LCM_STATE_STR",array($vmid));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("LCM_STATE_STR",array($vmid));
+        return $json;
     }
 
     public function stateStr($vmid)
     {
-        $json=$this->zmqCommunication("STATE_STR",array($vmid));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("STATE_STR",array($vmid));
+        return $json;
     }
 
     public function getVmData($vmid)
     {
-        $json=$this->zmqCommunication("get_vm_data",array($vmid));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("get_vm_data",array($vmid));
+        return $json;
     }
 
     public function datastoresMonitoring($type='img')
     {
-        $json=$this->zmqCommunication("DatastoresMonitoring",array($type));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("DatastoresMonitoring",array($type));
+        return $json;
     }
 
     public function hostsMonitoring()
     {
-        $json=$this->zmqCommunication("HostsMonitoring",array());
-        return json_decode($json,true);
+        $json=$this->CurlConnect("HostsMonitoring",array());
+        return $json;
     }
 
     public function reinstallNew($param)
     {
-        $json=$this->zmqCommunication("ReinstallNew",array($param));
-        return json_decode($json,true);
+        $json=$this->CurlConnect("ReinstallNew",array($param));
+        return $json;
     }
-}
+
+}
\ No newline at end of file
diff --git a/servers/onconnector/onconnector.php b/servers/onconnector/onconnector.php
index 51c8d40..8fc7780 100644
--- a/servers/onconnector/onconnector.php
+++ b/servers/onconnector/onconnector.php
@@ -1,11 +1,9 @@
 <?php
 use WHMCS\Database\Capsule;
-use Symfony\Component\Yaml\Yaml;
 
 if (!defined("WHMCS")) {
     die("This file cannot be accessed directly");
 }
-ini_set('display_errors', 0);
 
 set_time_limit(0);
 
@@ -96,10 +94,12 @@ function onconnector_ConfigOptions()
     );
 }
 
+
+
+
 function onconnector_CreateAccount(array $params)
 {try
 {
-
     ini_set('error_reporting', E_ALL);
     ini_set('display_errors', 1);
     ini_set('display_startup_errors', 1);
@@ -113,6 +113,7 @@ function onconnector_CreateAccount(array $params)
         ->join('mod_onconfiguratorOS','mod_onconfiguratorOS.addonid','=','tblhostingaddons.addonid')
         ->first();
 
+
     $allOptions['templateid']=$templateid->templateid;
 
     $root='root';
@@ -194,162 +195,137 @@ function onconnector_CreateAccount(array $params)
                 $allOptions['ds_type']='SSD';
                 $allOptions['iops']=1000;
                 break;
+            }
         }
-    }
 
-    $allOptions['groupid']=$params['configoption1'];
+        $allOptions['groupid']=$params['configoption1'];
 
-    $onaccaunt=Capsule::table('mod_on_user')
-        ->where('id_service',$params['serviceid'])
-        ->first();
+        $onaccaunt=Capsule::table('mod_on_user')
+            ->where('id_service',$params['serviceid'])
+            ->first();
 
+        $userid=$onaccaunt->userid;
+        $vmid=$onaccaunt->vmid;
 
 
-    $userid=$onaccaunt->userid;
-    $vmid=$onaccaunt->vmid;
+        if (!is_numeric($userid) && !is_numeric($vmid))
+        {
+            $ansibles=[];
+            $allOptions['ansible']=false;
+            foreach (Capsule::table( 'tblhostingaddons' )
+                         ->select('mod_onconfiguratorAddon.id')
+                         ->where('tblhostingaddons.hostingid',$params['serviceid'])
+                         ->join('mod_onconfiguratorAddon','mod_onconfiguratorAddon.Addon','=','tblhostingaddons.addonid')
+                         ->get() as $item) {
+                $ansibles[]=$item->id;
+            }
 
+            if($allOptions['services']){
+                $allOptions['ansible']=true;
+            }else{
+                $allOptions['ansible']=false;
+            }
 
-    if (!ctype_digit($userid) && !ctype_digit($vmid))
-    {
-        $ansibles=[];
-        $allOptions['ansible']=false;
-        foreach (Capsule::table( 'tblhostingaddons' )
-                     ->select('mod_onconfiguratorAddon.id')
-                     ->where('tblhostingaddons.hostingid',$params['serviceid'])
-                     ->join('mod_onconfiguratorAddon','mod_onconfiguratorAddon.Addon','=','tblhostingaddons.addonid')
-                     ->get() as $item) {
-            $ansibles[]=$item->id;
-        }
-        $isCheckAnsible=Capsule::table( 'tblconfiguration' )->where('setting','ione_use_ansible')->get();
-        if($isCheckAnsible[0]->value=='on') {
-            require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/classes/ActivateAnsible.php');
-            $ansibleDB = new AutoActivateAnsible($params['serviceid']);
-            $allOptions['services'] = $ansibleDB->getServicesFromIds($ansibles);
 
-        }
+            $allOptions['password'] = passgenerator();
+            $allOptions['login'] = 'user_' . $params['serviceid'];
 
-        if($allOptions['services']){
-            $allOptions['ansible']=true;
-        }else{
-            $allOptions['ansible']=false;
-        }
+            $postData = array(
+                'password2' => passgenerator(),
+            );
 
 
-        $allOptions['password'] = passgenerator();
-        $allOptions['login'] = 'user_' . $params['serviceid'];
+            $allOptions['passwd'] = $postData['password2'];
 
-        $postData = array(
-            'password2' => passgenerator(),
-        );
+            $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
+            $adminUsername = $adminlog[0]->value;
 
-        $allOptions['passwd'] = $postData['password2'];
+            $passroot = localAPI('EncryptPassword', $postData,$adminUsername);
+            if ($passroot['result'] == 'error'){
+                return "Error adminuser. Check configure module.";
+            }
 
-        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-        $adminUsername = $adminlog[0]->value;
+            require_once("lib/ONConnect.php");
 
-        $passroot = localAPI('EncryptPassword', $postData,$adminUsername);
-        if ($passroot['result'] == 'error'){
-            return "Error adminuser. Check configure module.";
-        }
+            if(!$allOptions['iops'])                                // If IOPS is null
+            {
+                return "Error allocating a new virtual machine template. IOPS attribute must be a positive integer value";
+            }
 
-        require_once("lib/ONConnect.php");
-            // Record the error in WHMCS's module log.
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $allOptions
-        );
+            if(!$allOptions['cpu'])                                // If CPU is null
+            {
+                return "Error allocating a new virtual machine template. CPU attribute must be a positive integer value";
+            }
 
-        if(!$allOptions['iops'])                                // If IOPS is null
-        {
-            return "Error allocating a new virtual machine template. IOPS attribute must be a positive integer value";
-        }
+            if(!$allOptions['ram'])                                // If RAM is null
+            {
+                return "Error allocating a new virtual machine template. RAM attribute must be a positive integer value";
+            }
 
-        if(!$allOptions['cpu'])                                // If CPU is null
-        {
-            return "Error allocating a new virtual machine template. CPU attribute must be a positive integer value";
-        }
+            if(!$allOptions['drive'])                                // If Drive is null
+            {
+                return "Error allocating a new virtual machine template. Drive attribute must be a positive integer value";
+            }
+            if(!($allOptions['ds_type'] == 'HDD' || $allOptions['ds_type'] == 'SSD')) // If drive type is not set
+            {
+                return "Error allocating a new virtual machine template. Disk type attribute must be (HDD/SSD) constant value";
+            }
 
-        if(!$allOptions['ram'])                                // If RAM is null
-        {
-            return "Error allocating a new virtual machine template. RAM attribute must be a positive integer value";
-        }
+            if(!($allOptions['units'] == 'GB' || $allOptions['units'] == 'TB' || $allOptions['units'] == 'MB' || $allOptions['units'] == 'KB' || $allOptions['units'] == 'B')) // If units is not set
+            {
+                return "Error allocating a new virtual machine template. Units attribute must be (TB/GB/MB/KB/B) constant value";
+            }
 
-        if(!$allOptions['drive'])                                // If Drive is null
-        {
-            return "Error allocating a new virtual machine template. Drive attribute must be a positive integer value";
-        }
-        if(!($allOptions['ds_type'] == 'HDD' || $allOptions['ds_type'] == 'SSD')) // If drive type is not set
-        {
-            return "Error allocating a new virtual machine template. Disk type attribute must be (HDD/SSD) constant value";
-        }
 
-        if(!($allOptions['units'] == 'GB' || $allOptions['units'] == 'TB' || $allOptions['units'] == 'MB' || $allOptions['units'] == 'KB' || $allOptions['units'] == 'B')) // If units is not set
-        {
-            return "Error allocating a new virtual machine template. Units attribute must be (TB/GB/MB/KB/B) constant value";
-        }
 
+            $onconnect = new ONConnect( $params['serverip'],$params['serverport'] );
+            $result = $onconnect->createVMwithSpecs($allOptions);
 
-        $azure =  Capsule::table( 'mod_azure_servers' )->where('idproduct','=',$params['pid'])->get();
-        if($azure != null){
-            $allOptions['release'] = true;
-            $allOptions['username'] = 'azuser';
-            $allOptions['extra'] = array('type' => 'azure',
-                'instance_size' => $azurename);
-            logModuleCall(
-                'onconnector',
-                'azure',
-                $params,
-                $allOptions
-            );
-        }
 
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $allOptions
-        );
+            if($result->response->error==true)
+            {
+                return 'error: '.$result->errorMessage;
+            }
 
-        $onconnect = new ONConnect( $params['serverip'],$params['serverport'] );
-        $result = $onconnect->createVMwithSpecs($allOptions);
+            if($result->response->error=='UserAllocateError')                 //If user already exists(name taken);
+            {
+                return "User user_$params[serviceid] already exists in ON";
+            }
 
-        if($result['result']['error']=='UserAllocateError')                 //If user already exists(name taken);
-        {
-            return "User user_$params[serviceid] already exists in ON";
-        }
 
-        if($result['result']['exeption']){                                  //If some unhandled Exeption
-            return $result['result']['exeption'];
-        }
+            if($result->response->exeption){                                  //If some unhandled Exeption
+                return $result['result']['exeption'];
+            }
 
-        if ($result['result']['error']=='TemplateLoadError')                //If template not set
-        {
-            return 'error: Template load error';
-        }
+            if ($result->response->error=='TemplateLoadError')                //If template not set
+            {
+                return 'error: Template load error';
+            }
 
-        if(!$result['result']){                                             //If answer is empty.
-            return 'error: Error getting data from IONe';
-        }
+            if(!$result->response){                                             //If answer is empty.
 
-        Capsule::table( 'tblhosting' )
-            ->where('id',$params['serviceid'])
-            ->update(
-                array (
-                    'dedicatedip' => $result['result']['ip'],
-                    'username'=>$root,
-                    'password'=>$passroot['password'],
-                    'domain'=>$result['result']['ip'],
-                )
-            );
+                return 'error: Error getting data from IONe';
+            }
 
-        addinbd( $params['serviceid'], $allOptions['login'], $allOptions['password'], $result['result']['userid'], $result['result']['vmid']);
+            Capsule::table( 'tblhosting' )
+                ->where('id',$params['serviceid'])
+                ->update(
+                    array (
+                        'dedicatedip' => $result->response->ip,
+                        'username'=>$root,
+                        'password'=>$passroot['password'],
+                        'domain'=>$result->response->ip,
+                    )
+                );
+
+            addinbd( $params['serviceid'], $allOptions['login'], $allOptions['password'], $result->response->userid, $result->response->vmid);
+
+        }
+        else
+        {
+            return 'error: Only one account for one service';
+        }
 
-    }
-    else {
-        return 'error: Only one account for one service';
-    }
 }
 
 catch (Exception $e)
@@ -387,7 +363,7 @@ function onconnector_SuspendAccount(array $params)
         ->where('hostingid', $params['serviceid'])
         ->update(['status' => 'Suspended']);
 
-    if (ctype_digit($vmid)) {
+    if (is_numeric($vmid)) {
         require_once("lib/ONConnect.php");
         $onconnect = new ONConnect($params['serverip']);
         $result = $onconnect->Suspend($vmid, $reason);
@@ -401,41 +377,43 @@ function onconnector_SuspendAccount(array $params)
             'priority' => 'Medium',
             'markdown' => true,
         );
-
-        $adminlog = Capsule::table('tblconfiguration')->where('setting', 'whmcs_admin')->get();
-        $adminUsername = $adminlog[0]->value;
+        $adminlog = Capsule::table('tbladmins')
+            ->select('username')->where('disabled', '=', '0')->get();
+        $adminUsername = $adminlog[0]->username;
 
         $results = localAPI($command, $postData, $adminUsername);
         return "error: Auth data is incorrect";
     }
+
     return 'success';
 }
 
 function onconnector_ChangePackage(array $params)
 {
-    $onaccaunt=Capsule::table('mod_on_user')
-        ->select('vmid')
-        ->where('id_service',$params['serviceid'])
-        ->first();                                    // Getting user_id, vmid, Login, Password,
-    $vmid=$onaccaunt->vmid;
-    if(ctype_digit($vmid)) {
-        require_once("lib/ONConnect.php");
-        $onconnect = new ONConnect($params['serverip']);
-        $result = $onconnect->Unsuspend($vmid);
-        if ($result['result']['userid']) {
-            Capsule::table('mod_on_user')
-                ->where('id_service', $params['serviceid'])
-                ->update(
-                    array(
-                        'userid' => $result['result']['userid'],
-                    )
-                );
+        $onaccaunt=Capsule::table('mod_on_user')
+            ->select('vmid')
+            ->where('id_service',$params['serviceid'])
+            ->first();                                    // Getting user_id, vmid, Login, Password,
+        $vmid=$onaccaunt->vmid;
+        if(is_numeric($vmid)) {
+            require_once("lib/ONConnect.php");
+            $onconnect = new ONConnect($params['serverip']);
+            $result = $onconnect->Unsuspend($vmid);
+            if ($result->response->userid) {
+                Capsule::table('mod_on_user')
+                    ->where('id_service', $params['serviceid'])
+                    ->update(
+                        array(
+                            'userid' => $result->response->userid,
+                        )
+                    );
+            }
+            $result = json_encode( $result );
+        }
+        else
+        {
+            return "error: Auth data is incorrect";
         }
-        $result = json_encode( $result );
-    }
-    else {
-        return "error: Auth data is incorrect";
-    }
     return 'success';
 }
 
@@ -453,24 +431,27 @@ function onconnector_UnsuspendAccount(array $params)
 
     $vmid = $onaccaunt->vmid;                             // Putting query-results to vars
 
-    if (ctype_digit($vmid)) {
+    if (is_numeric($vmid)) {
         require_once("lib/ONConnect.php");
         $onconnect = new ONConnect($params['serverip']);
         $result = $onconnect->Unsuspend($vmid);
     } else {
         return "error: Auth data is incorrect";
     }
+
     return 'success';
 }
 
 function onconnector_TerminateAccount(array $params)
 {
 
+
     try {
         $onaccaunt=Capsule::table('mod_on_user')->where('id_service',$params['serviceid'])->first();
         $userid=$onaccaunt->userid;
         $vmid=$onaccaunt->vmid;
-        if(ctype_digit($userid) && ctype_digit($vmid))
+
+        if(is_numeric($userid) && is_numeric($vmid))
         {
             require_once( "lib/ONConnect.php" );
             $onconnect = new ONConnect($params['serverip']);
@@ -479,6 +460,7 @@ function onconnector_TerminateAccount(array $params)
         }
         else
         {
+
             return "error: Auth data is incorrect";
         }
     } catch (Exception $e) {
@@ -495,27 +477,6 @@ function onconnector_TerminateAccount(array $params)
     return 'success';
 }
 
-function onconnector_TestConnection(array $params)
-{
-        require_once( "lib/ONConnect.php" );
-        $onconnect= new ONConnect($params['serverip']);
-        $result=$onconnect->Test();
-        if($result['result']=='PONG')
-        {
-            $success = true;
-        }
-        else
-        {
-            $success = false;
-            $errorMsg = $result['result'] ;
-        }
-
-    return array(
-        'success' => $success,
-        'error' => $errorMsg,
-    );
-}
-
 function onconnector_AdminCustomButtonArray()
 {
     return array(
@@ -531,7 +492,7 @@ function onconnector_restart(array $params)
         require_once( "lib/ONConnect.php" );
         $onaccaunt=Capsule::table('mod_on_user')->where('id_service',$params['serviceid'])->first();
         $vmid=$onaccaunt->vmid;
-        if(ctype_digit($vmid)) {
+        if(is_numeric($vmid)) {
             $onconnect = new ONConnect( $params['serverip'] );
             $result = $onconnect->Reboot( $vmid );
         }
@@ -566,7 +527,7 @@ function onconnector_down(array $params)
             ->where('id_service',$params['serviceid'])
             ->first();
         $vmid=$onaccaunt->vmid;
-        if(ctype_digit($vmid)) {
+        if(is_numeric($vmid)) {
             $onconnect = new ONConnect( $params['serverip'] );
             $result = $onconnect->Shutdown( $vmid );
         }
@@ -592,6 +553,7 @@ function onconnector_down(array $params)
 
     return 'success';
 }
+
 function onconnector_buttonForeFunction(array $params){
     require_once("lib/ONConnect.php");
 
@@ -599,206 +561,31 @@ function onconnector_buttonForeFunction(array $params){
     $user= 'user_'.$params['serviceid'];
     $result = $onconnect->getVmByName($user);
 
-        if($result['result']['vmid']!='none') {
+        if($result->response->vmid!='none') {
             Capsule::table('mod_on_user')
                 ->where('id_service', $params['serviceid'])
                 ->update(
                     [
                         'loginon' => $user,
-                        'vmid' => $result['result']['vmid'],
-                        'userid' => $result['result']['userid']
+                        'vmid' => $result->response->vmid,
+                        'userid' => $result->response->userid
                     ]
                 );
         }
-        if($result['result']['ip']!='nil') {
+        if($result->response->ip!='nil') {
         Capsule::table('tblhosting')
             ->where('id',$params['serviceid'])
             ->update(
                 [
-                    'dedicatedip'=>$result['result']['ip']
+                    'dedicatedip'=>$result->response->ip
                 ]
             );
     }
 
 }
 
-function onconnector_buttonThreeFunction(array $params)
-{
-
-    try
-    {
-        $product=Capsule::table( 'tblproducts' )
-            ->where('id',$params['packageid'])
-            ->first();
-
-        $c=strpos($product->name,"RIAL VDS");
-        if (!empty($c)){
-            $trial=true;
-        }
-
-        $onaccaunt=Capsule::table('mod_on_user')
-            ->where('id_service',$params['serviceid'])
-            ->first();
-
-        $userid=$onaccaunt->userid;
-        $vmid=$onaccaunt->vmid;
-
-        if (!isset($userid) || !ctype_digit($vmid))
-        {
-            $adonbool=false;
-            foreach (Capsule::table( 'tblhostingaddons' )
-                         ->select('mod_onconfiguratorAddon.id')
-                         ->where('tblhostingaddons.hostingid',$params['serviceid'])
-                         ->join('mod_onconfiguratorAddon','mod_onconfiguratorAddon.Addon','=','tblhostingaddons.addonid')
-                         ->max('price') as $item) {
-                $addons[]=$item->id;
-            }
-
-                require_once($_SERVER['DOCUMENT_ROOT'] . '/modules/addons/oncontrol/classes/ActivateAnsible.php');
-                $ansibleDB = new AutoActivateAnsible();
-                $ansible = $ansibleDB->getServicesFromIds($addons);
-
-                if ($ansible) {
-                    $ansiblebool = true;
-                }
-
-            $os=Capsule::table( 'tblhostingaddons' )
-                ->select('tblhostingaddons.addonid','mod_onconfigurator.templateid','mod_onconfigurator.os')
-                ->where('tblhostingaddons.hostingid',$params['serviceid'])
-                ->where('idtariff',$params['packageid'])
-                ->join('mod_onconfigurator','mod_onconfigurator.addonid','=','tblhostingaddons.addonid')
-                ->sum('mod_onconfigurator.os');
-
-            if($os){
-                if (stristr( $os->os, 'windows')!=false){
-                    $root='Administrator';
-                }
-                else{
-                    $root='root';
-                }
-                $temlaitid=$os->templateid;
-            }
-
-            $pass = passgenerator();
-            $user = 'user_' . $params['serviceid'];
-
-            $postData = array(
-                'password2' => passgenerator(),
-            );
-
-
-
-            $passroot = localAPI('EncryptPassword', $postData);
-            require_once("lib/ONConnect.php");
-
-
-            $onconnect = new ONConnect( $params['serverip'],$params['serverport'] );
-
-            $result = $onconnect->NewAccount( $user, $pass, $temlaitid, $params['configoption1'],$postData['password2'],$trial,$ansible,$ansiblebool,$params['serviceid']);
-
-            if($result['error']==true)
-            {
-                return 'error: '.$result['errorMessage'];
-            }
-            if($result['result']['error']=='UserAllocateError')                 // If user already exists;
-            {
-                return "User user_$params[serviceid] already exists in IONe";
-            }
-
-            if ($result['result']['error']=='TemplateLoadError')                // If template is not set;
-            {
-                return 'error: Template error, check template in IONe configurator';
-            }
-
-            if(!$result['result']){                                             // If answer is empty.
-                return 'error: Error getting data from IONe';
-            }
-
-            Capsule::table( 'tblhosting' )
-                ->where('id',$params['serviceid'])
-                ->update(
-                    array (
-                        'dedicatedip' => $result['result']['ip'],
-                        'username'=>$root,
-                        'password'=>$passroot['password'],
-                        'domain'=>$result['result']['ip'],
-                    )
-                );
-
-            $order=Capsule::table( 'tblhosting' )
-                ->select('orderid')
-                ->where('id',$params['serviceid'])
-                ->first();
-
-            addinbd( $params['serviceid'], $user, $pass, $result['result']['userid'], $result['result']['vmid']);
-
-        }
-        else
-        {
-            return 'error: Only one service for one account';
-        }
-    }
-
-    catch (Exception $e)
-    {
-        // Record the error in WHMCS's module log.
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $e->getMessage(),
-            $e->getTraceAsString()
-        );
-
-        return $e->getMessage();
-    }
-    return 'success';
-}
-
-function onconnector_buttonTwoFunction(array $params)
-{
-    try {
 
-        $onaccaunt=Capsule::table('mod_on_user')->where('id_service',$params['serviceid'])->first();
-        $vmid=$onaccaunt->vmid;
-        if(ctype_digit($vmid)) {
-            require_once("lib/ONConnect.php");
-            $onconnect = new ONConnect( $params['serverip'] );
-            $result = $onconnect->GetIP( $vmid );
-        }
-        else{
-            return "error: Auth data is incorrect";
-        }
-        Capsule::table( 'tblhosting' )
-            ->where('id',$params['serviceid'])
-            ->update(
-                array (
-                    'dedicatedip' => $result['result'],
-                    'username'=>'root',
-                    'password'=>'l+sxDZmZrK6Ch1AKRVwTatw1wPP4zlCJxaArkCsCkp1a',
-                    'domain'=>$result['result'],
-                ) );
 
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $result,
-            $result);
-    } catch (Exception $e) {
-        // Record the error in WHMCS's module log.
-        logModuleCall(
-            'onconnector',
-            __FUNCTION__,
-            $params,
-            $e->getMessage(),
-            $e->getTraceAsString()
-        );
-
-        return $e->getMessage();
-    }
-    return 'success';
-}
 
 function onconnector_AdminServicesTabFields(array $params)
 {
@@ -814,12 +601,12 @@ function onconnector_AdminServicesTabFields(array $params)
         $vmid=$onaccaunt->vmid;
     }
 
-       $fieldsarray = array(
-           'Login ON' => '<input type="text" name="loginON" size="30" value="'.$loginon.'" />',
-           'Passwordon ON' => '<input type="text" name="passwordON" size="30" value="'.$password.'" />',
-           'userid ON' => '<input type="text" name="useridON" size="30" value="'.$userid.'" />',
-           'vmid ON' => '<input type="text" name="vmidON" size="30" value="'.$vmid.'" />',
-       );
+    $fieldsarray = array(
+        'Login ON' => '<input type="text" name="loginON" size="30" value="'.$loginon.'" />',
+        'Passwordon ON' => '<input type="text" name="passwordON" size="30" value="'.$password.'" />',
+        'userid ON' => '<input type="text" name="useridON" size="30" value="'.$userid.'" />',
+        'vmid ON' => '<input type="text" name="vmidON" size="30" value="'.$vmid.'" />',
+    );
 
 }
     catch (Exception $e) {
@@ -935,15 +722,4 @@ function onconnector_ClientArea(array $params)
     }
 }
 
-function onconnector_mycustomfunction($vars) {
-    return array(
-        'templatefile' => 'templates/mysimplepanel',
-        'breadcrumb' => array(
-            'stepurl.php?action=this&var=that' => 'Custom Function',
-        ),
-        'vars' => array(
-            'test1' => 'hello',
-            'test2' => 'world',
-        ),
-    );
-}
+