andre пре 1 година
родитељ
комит
99a6ce797c

+ 9 - 6
core/App/Controllers/Instances/AddonController.php

@@ -65,12 +65,15 @@ abstract class AddonController implements DefaultController
 
     public function isValidIntegrationCallback($callback = null)
     {
-        if (is_callable($callback))
-        {
-            return true;
-        }
-
-        return false;
+        if(!is_array($callback))
+            {
+                return false;
+            }
+        $callback = array_reverse($callback);
+        $class = array_pop($callback);
+        $method = array_pop($callback);
+         
+        return is_string($class) &&  is_string($method) && method_exists($class, $method);
     }
 
     public function resolveAjax($resault)

+ 2 - 2
core/Http/View/Smarty.php

@@ -18,12 +18,12 @@ class Smarty
     private $templateDIR;
     private $lang;
 
-    final private function __construct()
+    private function __construct()
     {
         $this->smarty = new \Smarty();
     }
 
-    final private function __clone()
+    private function __clone()
     {
         
     }

+ 1 - 1
core/UI/MainContainerAjax.php

@@ -38,7 +38,7 @@ class MainContainerAjax extends MainContainer
         return $this;
     }
 
-    public function addElement($element)
+    public function addElement($element = null, $containerName = null)
     {
         if (is_string($element))
         {

+ 1 - 1
core/UI/ViewAjax.php

@@ -23,7 +23,7 @@ class ViewAjax extends View
     /**
      * Adds elements to the root element
      */
-    public function addElement($element)
+    public function addElement($element = null, $containerName = null)
     {
         return $this;
     }

+ 10 - 8
core/UI/Widget/DataTable/DataTable.php

@@ -93,7 +93,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
         
     }
 
-    public function setName($name)
+    public function setName($name = null)
     {
         $this->name = $name;
         return $this;
@@ -126,7 +126,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
         return $this;
     }
 
-    public function setData(\ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\DataSetInterface $data)
+    public function setData(array $data = [])
     {
         $this->recordsSet = $data;
         
@@ -135,7 +135,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
 
     protected function getCount()
     {
-        return count($this->recordsSet->records);
+        return count($this->recordsSet['records']);
     }
 
     protected function getRecords()
@@ -158,7 +158,7 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
             $this->loadHtml();
         }
 
-        $this->setData($this->dataProvider->getData($this->columns));
+        $this->setData((array)$this->dataProvider->getData($this->columns));
     }
     
     protected function parseDataRecords()
@@ -169,9 +169,9 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
             return false;
         }
 
-        foreach ($this->recordsSet->records as $key => $row)
+        foreach ($this->recordsSet['records'] as $key => $row)
         {
-            $this->recordsSet->records[$key] = $this->replaceRowData($row, $replacementFunctions);
+            $this->recordsSet['records'][$key] = $this->replaceRowData($row, $replacementFunctions);
         }
     }
 
@@ -210,8 +210,10 @@ class DataTable extends BaseContainer implements \ModulesGarden\Servers\ProxmoxV
             
             return $this;
         }
-        
-        $row->$colName = $value;
+        if (is_object($row))
+        {
+            $row->$colName = $value;
+        }
 
         return $this;        
     }    

+ 1 - 1
core/UI/Widget/Forms/DataProviders/BaseDataProvider.php

@@ -58,7 +58,7 @@ abstract class BaseDataProvider implements FormDataProviderInterface
 
     public function getAvailableValuesById($id)
     {
-        if (is_array($this->availableValues[$id]) ||  (is_object($this->availableValues[$id]) && count($this->availableValues[$id]) > 0))
+        if (!is_null($this->availableValues[$id]) && (is_array($this->availableValues[$id]) || count($this->availableValues[$id]) > 0))
         {
             return $this->availableValues[$id];
         }

+ 1 - 1
core/UI/Widget/Sidebar/SidebarItem.php

@@ -47,7 +47,7 @@ class SidebarItem extends BaseContainer
         return $this->id;
     }
 
-    public function setId($id)
+    public function setId($id = null)
     {
         $this->id = $id;
 

+ 10 - 50
proxmoxVPS.php

@@ -15,16 +15,9 @@ if (!defined('DS'))
 
 require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'WhmcsErrorIntegration.php';
 
-
-
-
-
 function proxmoxVPS_CreateAccount(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
-    
-    
     $appContext = new AppContext();
     return $appContext->runApp(__FUNCTION__, $params);
 }
@@ -32,33 +25,21 @@ function proxmoxVPS_CreateAccount(array $params)
 function proxmoxVPS_SuspendAccount(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
-    
-    
     $appContext = new AppContext();    
-    
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
 function proxmoxVPS_UnsuspendAccount(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
-    
-    
     $appContext = new AppContext();    
-    
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
 function proxmoxVPS_TerminateAccount(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
-    
-    
     $appContext = new AppContext();    
-    
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
@@ -68,22 +49,22 @@ if($_REQUEST['id'] || $_REQUEST['serviceid']){
         $statement = DB::connection()
             ->getPdo()
             ->prepare("SELECT p.`value`
-                                                              FROM `ProxmoxAddon_ProductConfiguration` p
-                                                              LEFT JOIN tblhosting h ON ( h.packageid = p.product_id )
-                                                              WHERE h.id =:id
-                                                              AND p.`setting` = :setting
-                                                              AND p.`value`  LIKE :value");
+                        FROM `ProxmoxAddon_ProductConfiguration` p
+                        LEFT JOIN tblhosting h ON ( h.packageid = p.product_id )
+                        WHERE h.id =:id
+                        AND p.`setting` = :setting
+                        AND p.`value`  LIKE :value");
         $statement->execute(["id" => $serviceId, "setting" => "cloudInit", "value" => '"on"' ]);
         $proxmoxVpsChangePassword =  $statement->rowCount() == 1;
         if(!$proxmoxVpsChangePassword){
             $statement = DB::connection()
                 ->getPdo()
                 ->prepare("SELECT p.`value`
-                                                              FROM `ProxmoxAddon_ProductConfiguration` p
-                                                              LEFT JOIN tblhosting h ON ( h.packageid = p.product_id )
-                                                              WHERE h.id =:id
-                                                              AND p.`setting` = :setting
-                                                              AND p.`value`  LIKE :value");
+                        FROM `ProxmoxAddon_ProductConfiguration` p
+                        LEFT JOIN tblhosting h ON ( h.packageid = p.product_id )
+                        WHERE h.id =:id
+                        AND p.`setting` = :setting
+                        AND p.`value`  LIKE :value");
             $statement->execute(["id" => $serviceId, "setting" => "agentServicePassword", "value" => '"on"' ]);
             $proxmoxVpsChangePassword =  $statement->rowCount() == 1;
         }
@@ -103,42 +84,32 @@ if($proxmoxVpsChangePassword){
 function proxmoxVPS_ChangePackage(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
-    
-    
     $appContext = new AppContext();    
-    
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
 function proxmoxVPS_TestConnection(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
     $appContext = new AppContext();
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
 function proxmoxVPS_UsageUpdate(array $params)
 {
-
 }
 
 function proxmoxVPS_ConfigOptions(array $params)
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
     $appContext = new AppContext();    
-    
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
 function proxmoxVPS_MetaData()
 {
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-    
     $appContext = new AppContext();    
-    
    return $appContext->runApp(__FUNCTION__, []);
 }
 
@@ -177,34 +148,23 @@ function proxmoxVPS_AdminServicesTabFields($params)
     return $appContext->runApp(__FUNCTION__, $params);
 }
 
-
-
 function proxmoxVPS_ClientArea($params)
 {
     if($params['status']!='Active'){
         return;
     }
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'AppContext.php';
-
-    
-
     $appContext = new AppContext();
-
     return $appContext->runApp('clientarea', $params);
 }
 
 function proxmoxVPS_GetLicenseData($force = false)
 {
     $class  = '';
-
     if(!class_exists($class ))
     {
         return [];
     }
     $class = '\\'.$class;
-
     return $class::getLicenseData($force);
 }
-
-
-