Skip to content

Commit

Permalink
fix support issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Gavryliuk committed Oct 25, 2016
1 parent 85ba89c commit 99c83b7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion modules/servers/solusvmpro/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.0.1
11 changes: 7 additions & 4 deletions modules/servers/solusvmpro/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@

$ca = new WHMCS_ClientArea();
if ( ! $ca->isLoggedIn() ) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
if((!isset($_SESSION['adminid']) || ((int)$_SESSION['adminid'] <= 0))){
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
}
$uid = (int)$_GET['uid'];
}else{
$uid = $ca->getUserID();
}
$servid = (int) $_GET['id'];
if ( $servid == "" ) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
}

$uid = $ca->getUserID();

$params = SolusVM::getParamsFromServiceID( $servid, $uid );
if ( $params === false ) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_vserverNotFound'] . '</div></body>';
Expand Down
74 changes: 42 additions & 32 deletions modules/servers/solusvmpro/html5console.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

define( "CLIENTAREA", true );
require( "../../../init.php" );
define("CLIENTAREA", true);
require("../../../init.php");

require_once __DIR__ . '/lib/Curl.php';
require_once __DIR__ . '/lib/CaseInsensitiveArray.php';
Expand Down Expand Up @@ -54,56 +54,60 @@
<?php

$ca = new WHMCS_ClientArea();
if ( ! $ca->isLoggedIn() ) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
if (!$ca->isLoggedIn()) {
if ((!isset($_SESSION['adminid']) || ((int)$_SESSION['adminid'] <= 0))) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
}
$uid = (int)$_GET['uid'];
} else {
$uid = $ca->getUserID();
}
$servid = (int) $_GET['id'];
if ( $servid == "" ) {

$servid = (int)$_GET['id'];
if ($servid == "") {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_unauthorized'] . '</div></body>';
exit();
}

$uid = $ca->getUserID();

$params = SolusVM::getParamsFromServiceID( $servid, $uid );
if ( $params === false ) {
$params = SolusVM::getParamsFromServiceID($servid, $uid);
if ($params === false) {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_vserverNotFound'] . '</div></body>';
exit;
}
$solusvm = new SolusVM( $params );
$solusvm = new SolusVM($params);

if ( $solusvm->getExtData( "clientfunctions" ) == "disable" ) {
if ($solusvm->getExtData("clientfunctions") == "disable") {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_functionDisabled'] . '</body>';
exit;
}
if ( $solusvm->getExtData( "html5serialconsole" ) == "disable" ) {
if ($solusvm->getExtData("html5serialconsole") == "disable") {
echo '<div class="alert alert-danger">' . $_LANG['solusvmpro_functionDisabled'] . '</body>';
exit;
}

################### Code ###################

if ( isset( $_POST["sessioncancel"] ) ) {
$callArray = array( "access" => "disable", "vserverid" => $params['vserver'] );
} elseif ( isset( $_POST["sessioncreate"] ) ) {
if (isset($_POST["sessioncancel"])) {
$callArray = array("access" => "disable", "vserverid" => $params['vserver']);
} elseif (isset($_POST["sessioncreate"])) {
$stime = $_POST["sessiontime"];
if ( ! is_numeric( $stime ) ) {
if (!is_numeric($stime)) {
exit();
} else {
$callArray = array( "access" => "enable", "time" => $stime, "vserverid" => $params['vserver'] );
$callArray = array("access" => "enable", "time" => $stime, "vserverid" => $params['vserver']);
}
} else {
## The call string for the connection function
$callArray = array( "vserverid" => $params['vserver'] );
$callArray = array("vserverid" => $params['vserver']);
}

$solusvm->apiCall( 'vserver-console', $callArray );
$solusvm->apiCall('vserver-console', $callArray);
$r = $solusvm->result;

if ( $r["status"] == "success" ) {
if ( $r["sessionactive"] == "1" ) {
if ( $r["type"] != "openvz" && $r["type"] != "xen" ) {
if ($r["status"] == "success") {
if ($r["sessionactive"] == "1") {
if ($r["type"] != "openvz" && $r["type"] != "xen") {
exit();
}

Expand All @@ -112,7 +116,8 @@
?>

<div align="center">
<p style="padding-bottom: 5px"><?php echo $_LANG['solusvmpro_password'] . ': ' . $r['consolepassword']; ?></p><br>
<p style="padding-bottom: 5px"><?php echo $_LANG['solusvmpro_password'] . ': ' . $r['consolepassword']; ?></p>
<br>
</div>
<br>
<form action="" method="post" name="cancelsession">
Expand All @@ -123,13 +128,16 @@

<div
style="margin: auto;background-color: #454545;width: 800px;padding:10px 10px 0 10px;font-family: 'Source Code Pro', monospace;color:#fff;">
<div style="display:inline-block;width:100%;border-bottom: 1px solid #ffffff;font-size: 14px;padding-bottom:10px">
<div
style="display:inline-block;width:100%;border-bottom: 1px solid #ffffff;font-size: 14px;padding-bottom:10px">
<div style="float: left">Secure Shell Terminal: vt220</div>
<div style="float: right;margin-left: 10px; cursor: pointer">
<i title="<?php echo $_LANG['solusvmpro_quit']; ?>" onclick="window.close();" class="fa fa-times-circle"></i>
<i title="<?php echo $_LANG['solusvmpro_quit']; ?>" onclick="window.close();"
class="fa fa-times-circle"></i>
</div>
<div style="float: right;margin-left: 10px ; cursor: pointer">
<i title="<?php echo $_LANG['solusvmpro_reconnect']; ?>" onclick=" open_terminal({connectionkey: '<?= $r['key']; ?>'});"
<i title="<?php echo $_LANG['solusvmpro_reconnect']; ?>"
onclick=" open_terminal({connectionkey: '<?= $r['key']; ?>'});"
class="fa fa-refresh"></i>
</div>
<div style="float: right;margin-left: 10px; cursor: pointer">
Expand Down Expand Up @@ -264,8 +272,10 @@ function SSH_client() {
<option value="8">8 <?php echo $_LANG['solusvmpro_hours']; ?></option>
</select>
</div>
<button name="sessioncreate" type="submit" class="btn btn-success"><?php echo $_LANG['solusvmpro_createSession']; ?></button>
<button type="button" class="btn btn-danger" onclick="window.close()"><?php echo $_LANG['solusvmpro_closeWindow']; ?></button>
<button name="sessioncreate" type="submit"
class="btn btn-success"><?php echo $_LANG['solusvmpro_createSession']; ?></button>
<button type="button" class="btn btn-danger"
onclick="window.close()"><?php echo $_LANG['solusvmpro_closeWindow']; ?></button>
</form>
</div>
<div class="col-xs-2"></div>
Expand All @@ -276,8 +286,8 @@ function SSH_client() {


} else {
if ( isset( $r["statusmsg"] ) ) {
$pagedata = (string) $r["statusmsg"];
if (isset($r["statusmsg"])) {
$pagedata = (string)$r["statusmsg"];
} else {
$pagedata = $_LANG['solusvmpro_couldntConnectMaster'];
}
Expand Down
2 changes: 1 addition & 1 deletion modules/servers/solusvmpro/solusvmpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

function initConfigOption()
{
$data = Capsule::table('tblproducts')->where('servertype', 'solusvmpro')->get();
$data = Capsule::table('tblproducts')->where('servertype', 'solusvmpro')->where('id', $_POST['id'])->get();
$packageconfigoption = [];
if(is_array($data) && count($data) > 0) {
$packageconfigoption[1] = $data[0]->configoption1;
Expand Down
4 changes: 2 additions & 2 deletions modules/servers/solusvmpro/svm_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ function setFromGetOrSendError( $param ) {
}

if ( $r["type"] == "openvz" || $r["type"] == "xen" ) {
$html5Console = '<button type="button" style="width: 165px" class="btn btn-default" onclick="window.open(\'../modules/servers/solusvmpro/html5console.php?id=' . $serviceid . '\', \'_blank\',\'width=880,height=600,status=no,resizable=yes,copyhistory=no,location=no,toolbar=no,menubar=no,scrollbars=1\')">
$html5Console = '<button type="button" style="width: 165px" class="btn btn-default" onclick="window.open(\'../modules/servers/solusvmpro/html5console.php?id=' . $serviceid . '&uid='.$uid.'\', \'_blank\',\'width=880,height=600,status=no,resizable=yes,copyhistory=no,location=no,toolbar=no,menubar=no,scrollbars=1\')">
' . $_LANG['solusvmpro_html5Console'] . '</button>';
}

if ( $r["type"] == "openvz" || $r["type"] == "xen" ) {
$console = '<button type="button" class="btn btn-default" onclick="window.open(\'../modules/servers/solusvmpro/console.php?id=' . $serviceid . '\', \'_blank\',\'width=830,height=750,status=no,location=no,toolbar=no,scrollbars=1,menubar=no\')">' . $_LANG["solusvmpro_serialConsole"] . '</button>';
$console = '<button type="button" class="btn btn-default" onclick="window.open(\'../modules/servers/solusvmpro/console.php?id=' . $serviceid . '&uid='.$uid.'\', \'_blank\',\'width=830,height=750,status=no,location=no,toolbar=no,scrollbars=1,menubar=no\')">' . $_LANG["solusvmpro_serialConsole"] . '</button>';
$cpass = '';
} else {
$console = '<button type="button" class="btn btn-default" onclick="window.open(\'../modules/servers/solusvmpro/vnc.php?id=' . $serviceid . '\', \'_blank\',\'width=800,height=600,status=no,location=no,toolbar=no,menubar=no,,scrollbars=1,resizable=yes\')">' . $_LANG['solusvmpro_vnc'] . '</button>';
Expand Down

0 comments on commit 99c83b7

Please sign in to comment.