Skip to content

Commit

Permalink
Merge pull request #1 from ione-cloud/master2
Browse files Browse the repository at this point in the history
Better PHP 7.0 Support, v0.6.0
  • Loading branch information
slntopp authored Sep 29, 2020
2 parents b435ffd + 808ca24 commit 4e32eca
Show file tree
Hide file tree
Showing 17 changed files with 2,768 additions and 3,200 deletions.
258 changes: 128 additions & 130 deletions addons/oncontrol/classes/Loader.php
Original file line number Diff line number Diff line change
@@ -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');
}
}

}
Loading

0 comments on commit 4e32eca

Please sign in to comment.