Merge pull request #14 from cp6/dev

1.3
This commit is contained in:
corbpie 2021-01-31 12:47:56 +11:00 committed by GitHub
commit d6c23a97e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 324 additions and 271 deletions

View File

@ -5,23 +5,21 @@ A web app for displaying, organizing and storing information about servers (VPS)
Despite what the name infers this self hosted web app isn't just for storing idling server information. Despite what the name infers this self hosted web app isn't just for storing idling server information.
By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting. By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting.
[![Generic badge](https://img.shields.io/badge/version-1.2-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/version-1.3-blue.svg)](https://shields.io/)
## 1.2 changes: ## 1.3 changes:
**If you have version 1.1 or less already installed please run ```update.sql```** **If you have version 1.2 already installed please run ```update1.2to1.3.sql```**
* Added table view type (use switcher icon to change to this view) * Added constant to set main view type (cards or table).
* Added auto get IPv4/IPv6 based on hostname (Click icon at hostname input) * Fixed DNS GET requests.
* Added up/down status (Click OS icon) * Added label field/input for servers.
* Updated the order by table for better formatting * Fixed domain & shared hosting deletion.
* Removed unused buttons from the CSS * Updated to dns_get_record() instead of DNS API calling.
* Updated Minor style changes * Added KB/s to MB/s conversion.
* Updated `update.sql` for pre-existing installations only. * Fixed active status for view type div.
* Updated when type DEDI selected "is_dedi" will be toggled * Added attach domain to server or shared hosting.
* Updated IPv4 no longer required field * Updated search to include tags and labels.
* Fixed no location and/or provider causing uneven cards * Updated server view more modal formatting.
* Updated delete labels * Updated server edit modal formatting.
* Updated domain terms to be annual and longer only
* Fixed error when all speedtests are "busy"
* Updated `my_idlers.sql` for changes * Updated `my_idlers.sql` for changes
## Requires ## Requires
@ -45,6 +43,7 @@ By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you
* Multi payment-term compatibility * Multi payment-term compatibility
* Pre-defined operating systems * Pre-defined operating systems
* Assign tags * Assign tags
* Assign labels
* Assign server type (KVM, OVZ, LXC & dedi) * Assign server type (KVM, OVZ, LXC & dedi)
* Easy to edit values * Easy to edit values
* Order by table * Order by table
@ -57,11 +56,13 @@ By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you
* Download [the zip](https://github.com/cp6/my-idlers/archive/main.zip) and unpack the files from ```my-idlers-main/``` into your directory of choice. * Download [the zip](https://github.com/cp6/my-idlers/archive/main.zip) and unpack the files from ```my-idlers-main/``` into your directory of choice.
* Run `my_idlers.sql` in MySQL. * Run `my_idlers.sql` in MySQL.
* **Only run ```update.sql``` if you have version 1.1 or less already installed.** * **Only run ```update1.2to1.3.sql``` if you have version 1.2 installed.**
* Edit ```class.php``` lines ```13-16``` for your MySQL details. * Edit ```class.php``` lines ```13-16``` for your MySQL details.
* Edit ```class.php``` lines ```8-10``` for card order type. * Edit ```class.php``` lines ```8-10``` for card order type.
* Make sure you have write access to process and store the YABs outputs.
## Notes ## Notes

View File

@ -57,10 +57,6 @@ body {
.container { .container {
max-width: 960px max-width: 960px
} }
.modal-lg {
max-width: 800px;
}
} }
@media (min-width: 1200px) { @media (min-width: 1200px) {
@ -196,6 +192,10 @@ body {
} }
} }
.mm-col {
margin-bottom: 0.2rem;
}
[tabindex="-1"]:focus { [tabindex="-1"]:focus {
outline: 0 !important outline: 0 !important
} }
@ -249,7 +249,7 @@ a:hover {
code { code {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 87.5%; font-size: 82%;
color: #e83e8c; color: #e83e8c;
word-break: break-word word-break: break-word
} }
@ -1535,3 +1535,9 @@ input:checked + .slider:before {
overflow-x: scroll overflow-x: scroll
} }
} }
@media (min-width: 992px) {
.modal-lg {
max-width: 800px;
}
}

View File

@ -149,8 +149,36 @@ $(document).ready(function () {
$('.next-dd').val(one_month_on); $('.next-dd').val(one_month_on);
if ($("#cardsViewDiv").hasClass("active")) {
loadCards();
} else if ($("#tableViewDiv").hasClass("active")){
loadTable();
}
}); });
function loadCards(){
$.ajax({
type: "GET",
url: "calls.php",
data: {"type": "object_cards"},
success: function (result) {
$("#cardsViewDiv").append(result);
}
});
}
function loadTable(){
$.ajax({
type: "GET",
url: "calls.php",
data: {"type": "object_tables"},
success: function (result) {
$("#tableViewDiv").append(result);
}
});
}
$(function () { $(function () {
$(".location-input").autocomplete({ $(".location-input").autocomplete({
source: function (request, response) { source: function (request, response) {
@ -175,7 +203,6 @@ $(function () {
}); });
}); });
$(document).on("click", "#viewMoreServer", function () { $(document).on("click", "#viewMoreServer", function () {
var serverId = this.getAttribute("value"); var serverId = this.getAttribute("value");
$("#viewMoreModalBody").empty(); $("#viewMoreModalBody").empty();
@ -315,34 +342,29 @@ $(document).on("click", "#checkUpStatus", function () {
$(document).on("click", "#viewSwitcherIcon", function () { $(document).on("click", "#viewSwitcherIcon", function () {
var icon = $(this).children().first(); var icon = $(this).children().first();
if ($("#serversTable").children().length == 0){ if (icon.hasClass("fa-table")) {
$.ajax({ if ($("#serversTable").children().length == 0) {
type: "GET", loadTable();
url: "calls.php", }
data: {"type": "object_tables"},
success: function (result) {
$("#tableViewDiv").append(result);
}
});
icon.removeClass("fa-table"); icon.removeClass("fa-table");
icon.addClass("fa-th"); icon.addClass("fa-th");
$("#cardsViewDiv" ).hide(); $("#tableViewDiv").addClass("active");
$("#tableViewDiv" ).show(); $("#cardsViewDiv").removeClass("active");
$("#cardsViewDiv").hide();
$("#tableViewDiv").show();
$('#viewSwitchIcon').prop('title', 'Switch to cards'); $('#viewSwitchIcon').prop('title', 'Switch to cards');
} else {
if (icon.hasClass("fa-table")) { } else if (icon.hasClass("fa-th")) {
icon.removeClass("fa-table"); if ($("#cardsViewDiv").children().length == 0) {
icon.addClass("fa-th"); loadCards();
$( "#cardsViewDiv" ).hide();
$( "#tableViewDiv" ).show();
$('#viewSwitchIcon').prop('title', 'Switch to cards');
} else if (icon.hasClass("fa-th")) {
icon.removeClass("fa-th");
icon.addClass("fa-table");
$( "#tableViewDiv" ).hide();
$( "#cardsViewDiv" ).show();
$('#viewSwitchIcon').prop('title', 'Switch to table');
} }
icon.removeClass("fa-th");
icon.addClass("fa-table");
$("#cardsViewDiv").addClass("active");
$("#tableViewDiv").removeClass("active");
$("#tableViewDiv").hide();
$("#cardsViewDiv").show();
$('#viewSwitchIcon').prop('title', 'Switch to table');
} }
}); });
@ -361,6 +383,7 @@ function modalServerEdit(id) {
$("#me_tags").tagsinput('removeAll'); $("#me_tags").tagsinput('removeAll');
$("#me_server_id").val(result["server_id"]); $("#me_server_id").val(result["server_id"]);
$("#me_hostname").val(result["hostname"]); $("#me_hostname").val(result["hostname"]);
$("#me_label").val(result["label"]);
$("#me_hostname_header").text( result["hostname"]); $("#me_hostname_header").text( result["hostname"]);
$("#me_ns1").val(result["ns1"]); $("#me_ns1").val(result["ns1"]);
$("#me_ns2").val(result["ns2"]); $("#me_ns2").val(result["ns2"]);
@ -432,6 +455,7 @@ function modalEditDomain(id) {
$("#d_me_term").val(result["term"]); $("#d_me_term").val(result["term"]);
$("#d_me_ns1").val(result["ns1"]); $("#d_me_ns1").val(result["ns1"]);
$("#d_me_ns2").val(result["ns2"]); $("#d_me_ns2").val(result["ns2"]);
$("#d_me_attached_to").val(result["attached_to"]);
} }
}); });
} }

View File

@ -40,6 +40,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$idle->getIpForDomain($_GET['hostname'], $_GET['dns_type']); $idle->getIpForDomain($_GET['hostname'], $_GET['dns_type']);
} elseif ($_GET['type'] == 'check_up') { } elseif ($_GET['type'] == 'check_up') {
echo $idle->checkIsUp($_GET['host']); echo $idle->checkIsUp($_GET['host']);
} elseif ($_GET['type'] == 'object_cards') {
header('Content-Type: text/html; charset=utf-8');
echo $idle->objectCards();
} elseif ($_GET['type'] == 'object_tables') { } elseif ($_GET['type'] == 'object_tables') {
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
echo $idle->objectTables(); echo $idle->objectTables();
@ -64,7 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} elseif (isset($_POST['action']) && $_POST['action'] == 'update') { } elseif (isset($_POST['action']) && $_POST['action'] == 'update') {
$update = new itemUpdate($_POST); $update = new itemUpdate($_POST);
if (isset($_POST['me_delete'])) {//Delete object if (isset($_POST['me_delete']) || isset($_POST['sh_me_delete']) || isset($_POST['d_me_delete'])) {//Delete object
$update->deleteObjectData(); $update->deleteObjectData();
} elseif ($_POST['type'] == 'server_modal_edit') {//Update the server info } elseif ($_POST['type'] == 'server_modal_edit') {//Update the server info
$update->updateServerFromModal(); $update->updateServerFromModal();

431
class.php
View File

@ -17,6 +17,8 @@ class idlersConfig
//Have slight background color for server table values: was special price and due soon //Have slight background color for server table values: was special price and due soon
const COLOR_TABLE = true; const COLOR_TABLE = true;
const DEFAULT_VIEW = 'CARDS';//CARDS or TABLE
} }
class elementHelpers extends idlersConfig class elementHelpers extends idlersConfig
@ -523,9 +525,11 @@ class helperFunctions extends elementHelpers
} }
protected function diskSpeedAsMbps(string $type, string $value) protected function diskSpeedAsMbps(string $type, string $value)
{//If value type GB/s convert to MB/s {//If value type GB/s convert to MB/s, KB/s to MB/s
if ($type == "GB/s") { if ($type == "GB/s") {
return $this->GBpstoMBps($value); return $this->GBpstoMBps($value);
} elseif ($type == "KB/s") {
return ($value / 1000);
} else { } else {
return $value; return $value;
} }
@ -596,12 +600,17 @@ class idlers extends helperFunctions
$this->outputString('<div id="myTabContent" class="tab-content">'); $this->outputString('<div id="myTabContent" class="tab-content">');
$this->outputString('<div class="tab-pane server-cards fade active show" id="services">'); $this->outputString('<div class="tab-pane server-cards fade active show" id="services">');
$this->viewSwitcherIcon(); $this->viewSwitcherIcon();
$this->tagOpen('div', '', 'cardsViewDiv'); if (self::DEFAULT_VIEW == 'CARDS') {
$this->serverCards(); $cards_start = 'active';
$this->sharedHostingCards(); $table_start = '';
$this->domainCards(); } else {
$cards_start = '';
$table_start = 'active';
}
$this->tagOpen('div', $cards_start, 'cardsViewDiv');
//Object cards
$this->tagClose('div'); $this->tagClose('div');
$this->tagOpen('div', '', 'tableViewDiv'); $this->tagOpen('div', $table_start, 'tableViewDiv');
//Objects tables //Objects tables
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->outputString('<div class="tab-pane fade" id="add_server">'); $this->outputString('<div class="tab-pane fade" id="add_server">');
@ -647,7 +656,7 @@ class idlers extends helperFunctions
$this->editDomainModal(); $this->editDomainModal();
$this->outputString('<div class="modal fade" id="viewMoreServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">'); $this->outputString('<div class="modal fade" id="viewMoreServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">');
$this->outputString('<div class="modal-dialog" role="document">'); $this->outputString('<div class="modal-dialog modal-lg" role="document">');
$this->outputString('<div class="modal-content" id="viewMoreModalBody">'); $this->outputString('<div class="modal-content" id="viewMoreModalBody">');
$this->tagClose('div', 3); $this->tagClose('div', 3);
@ -714,8 +723,8 @@ class idlers extends helperFunctions
if ($row['has_yabs'] == 1 && $row['has_st'] == 1) { if ($row['has_yabs'] == 1 && $row['has_st'] == 1) {
$select = $this->dbConnect()->prepare(" $select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v, SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`, is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,next_dd,pr.name as provider loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
@ -729,8 +738,8 @@ class idlers extends helperFunctions
} elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) { } elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) {
$select = $this->dbConnect()->prepare(" $select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v, SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`, is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,label,virt,has_yabs,has_st,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
INNER JOIN locations loc on servers.location = loc.id INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
@ -740,8 +749,8 @@ class idlers extends helperFunctions
} else { } else {
$select = $this->dbConnect()->prepare(" $select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type, SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,
bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2, bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,label,has_st,
DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,usd_per_month,next_dd,pr.name as provider
FROM servers INNER JOIN locations loc on servers.location = loc.id FROM servers INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
$select->execute([$id]); $select->execute([$id]);
@ -979,6 +988,13 @@ class idlers extends helperFunctions
} }
} }
public function objectCards()
{
$this->serverCards();
$this->sharedHostingCards();
$this->domainCards();
}
public function objectTables() public function objectTables()
{ {
$this->serverTable(); $this->serverTable();
@ -1247,7 +1263,7 @@ class idlers extends helperFunctions
public function editServerModal() public function editServerModal()
{ {
$this->outputString('<div class="modal fade" id="editServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">'); $this->outputString('<div class="modal fade" id="editServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">');
$this->outputString('<div class="modal-dialog" role="document">'); $this->outputString('<div class="modal-dialog modal-lg" role="document">');
$this->tagOpen('div', 'modal-content'); $this->tagOpen('div', 'modal-content');
$this->tagOpen('div', 'modal-header'); $this->tagOpen('div', 'modal-header');
$this->outputString('<h4 class="modal-title w-100" id="me_hostname_header"></h4>'); $this->outputString('<h4 class="modal-title w-100" id="me_hostname_header"></h4>');
@ -1258,78 +1274,77 @@ class idlers extends helperFunctions
$this->tagOpen('div', 'modal-body'); $this->tagOpen('div', 'modal-body');
$this->outputString('<form id="editForm" method="post">'); $this->outputString('<form id="editForm" method="post">');
$this->rowColOpen('form-row', 'col-8'); $this->rowColOpen('form-row', 'col-12 col-md-6');
$this->outputString('<label for="me_delete">Delete server data</label>'); $this->outputString('<label for="me_delete">Delete server data</label>');
$this->tagClose('div');
$this->colOpen('col-4');
$this->outputString('<label class="switch"><input type="checkbox" name="me_delete" id="me_delete"><span class="slider round"></span></label>'); $this->outputString('<label class="switch"><input type="checkbox" name="me_delete" id="me_delete"><span class="slider round"></span></label>');
$this->tagClose('div', 2);
$this->rowColOpen('form-row', 'col-8');
$this->outputString('<label for="me_non_active">No longer have (Keep info)</label>');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-12 col-md-6');
$this->outputString('<label for="me_non_active">No longer have (Keep info)</label>');
$this->outputString('<label class="switch"><input type="checkbox" name="me_non_active" id="me_non_active"><span class="slider round"></span></label>'); $this->outputString('<label class="switch"><input type="checkbox" name="me_non_active" id="me_non_active"><span class="slider round"></span></label>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Hostname'); $this->inputPrepend('Hostname');
$this->textInput('me_hostname', '', 'form-control', true); $this->textInput('me_hostname', '', 'form-control', true);
$this->tagClose('div'); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Label');
$this->textInput('me_label', '', 'form-control', false, 1, 24);
$this->hiddenInput('me_server_id'); $this->hiddenInput('me_server_id');
$this->hiddenInput('action', 'update'); $this->hiddenInput('action', 'update');
$this->hiddenInput('type', 'server_modal_edit'); $this->hiddenInput('type', 'server_modal_edit');
$this->tagClose('div', 2); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-md-6');
$this->rowColOpen('form-row', 'col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('NS1'); $this->inputPrepend('NS1');
$this->textInput('me_ns1', '', 'form-control', false); $this->textInput('me_ns1', '', 'form-control', false);
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6'); $this->colOpen('col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('NS2'); $this->inputPrepend('NS2');
$this->textInput('me_ns2', '', 'form-control', false); $this->textInput('me_ns2', '', 'form-control', false);
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-6'); $this->rowColOpen('form-row', 'col-6 col-md-4 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Price'); $this->inputPrepend('Price');
$this->numberInput('me_price', '', 'form-control', true, 0, 999, 'any'); $this->numberInput('me_price', '', 'form-control', true, 0, 999, 'any');
$this->tagClose('div'); $this->tagClose('div');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-6'); $this->colOpen('col-6 col-md-4 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Term'); $this->inputPrepend('Term');
$this->selectElement('me_term'); $this->selectElement('me_term');
$this->termSelectOptions(); $this->termSelectOptions();
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 2);
$this->colOpen('col-6 col-md-4 mm-col');
$this->rowColOpen('form-row', 'col-6');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Currency'); $this->inputPrepend('Currency');
$this->selectElement('me_currency'); $this->selectElement('me_currency');
$this->CurrencySelectOptions(); $this->CurrencySelectOptions();
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 2); $this->tagClose('div', 3);
$this->colOpen('col-6');
$this->rowColOpen('form-row', 'col-12 col-md-4 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('OS'); $this->inputPrepend('OS');
$this->selectElement('me_os'); $this->selectElement('me_os');
$this->OsSelectOptions(); $this->OsSelectOptions();
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-4 mm-col');
$this->rowColOpen('form-row', 'col-12 col-md-6');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Virt'); $this->inputPrepend('Virt');
$this->selectElement('me_virt'); $this->selectElement('me_virt');
$this->virtSelectOptions(); $this->virtSelectOptions();
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6'); $this->colOpen('col-12 col-md-4 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('SSH Port'); $this->inputPrepend('SSH Port');
$this->textInput('me_ssh_port'); $this->textInput('me_ssh_port');
@ -1346,24 +1361,23 @@ class idlers extends helperFunctions
$this->textInput('me_ipv6'); $this->textInput('me_ipv6');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Owned since'); $this->inputPrepend('Owned since');
$this->outputString('<input type="date" class="form-control" id="me_owned_since" name="me_owned_since">'); $this->outputString('<input type="date" class="form-control" id="me_owned_since" name="me_owned_since">');
$this->tagClose('div', 3); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6 mm-col');
$this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Next due date'); $this->inputPrepend('Next due date');
$this->outputString('<input type="date" class="form-control" id="me_next_dd" name="me_next_dd">'); $this->outputString('<input type="date" class="form-control" id="me_next_dd" name="me_next_dd">');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12 col-md-6'); $this->rowColOpen('form-row', 'col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('CPU amount'); $this->inputPrepend('CPU amount');
$this->numberInput('me_cpu_amount', '', 'form-control', false, 1, 48); $this->numberInput('me_cpu_amount', '', 'form-control', false, 1, 48);
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6'); $this->colOpen('col-12 col-md-6 mm-col');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Bandwidth'); $this->inputPrepend('Bandwidth');
$this->numberInput('me_bandwidth', '', 'form-control', false, 1, 9999); $this->numberInput('me_bandwidth', '', 'form-control', false, 1, 9999);
@ -1405,11 +1419,16 @@ class idlers extends helperFunctions
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12 col-md-6');
$this->htmlPhrase('p', 'm-desc', 'Notes:'); $this->htmlPhrase('p', 'm-desc', 'Notes:');
$this->outputString("<textarea class='form-control' id='me_notes' name='me_notes' rows='4' cols='40' maxlength='255'>"); $this->outputString("<textarea class='form-control' id='me_notes' name='me_notes' rows='4' cols='40' maxlength='255'>");
$this->outputString("</textarea>"); $this->outputString("</textarea>");
$this->tagClose('div', 2); $this->tagClose('div');
$this->colOpen('col-12 col-md-6');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Tags');
$this->tagsInput('me_tags', 'form-control');
$this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12');
$this->htmlPhrase('p', 'm-desc', 'Update YABs disk & network speeds:'); $this->htmlPhrase('p', 'm-desc', 'Update YABs disk & network speeds:');
@ -1417,12 +1436,6 @@ class idlers extends helperFunctions
$this->outputString("</textarea>"); $this->outputString("</textarea>");
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Tags');
$this->tagsInput('me_tags', 'form-control');
$this->tagClose('div', 3);
$this->rowColOpen('form-row text-center', 'col-12'); $this->rowColOpen('form-row text-center', 'col-12');
$this->submitInput('Update', 'submitInput', 'btn btn-second'); $this->submitInput('Update', 'submitInput', 'btn btn-second');
$this->tagClose('div', 2); $this->tagClose('div', 2);
@ -1547,6 +1560,27 @@ class idlers extends helperFunctions
$this->tagClose('div', 4); $this->tagClose('div', 4);
} }
protected function attachDomainInput()
{
$this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Attached to');
$this->selectElement('d_me_attached_to');
$select_servers = $this->dbConnect()->prepare("SELECT `id`, `hostname` FROM `servers`;");
$select_servers->execute();
$this->selectOption('', '', true);//Empty option for when not attached
while ($row = $select_servers->fetch(PDO::FETCH_ASSOC)) {
$this->selectOption($row['hostname'], $row['id']);
}
$select_shared = $this->dbConnect()->prepare("SELECT `id`, `domain` FROM `shared_hosting`;");
$select_shared->execute();
while ($row = $select_shared->fetch(PDO::FETCH_ASSOC)) {
$this->selectOption($row['domain'], $row['id']);
}
$this->tagClose('select');
$this->tagClose('div', 3);
}
public function editDomainModal() public function editDomainModal()
{ {
$this->outputString('<div class="modal fade" id="editModalDomain" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">'); $this->outputString('<div class="modal fade" id="editModalDomain" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">');
@ -1607,6 +1641,8 @@ class idlers extends helperFunctions
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->attachDomainInput();
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Owned since'); $this->inputPrepend('Owned since');
@ -1955,12 +1991,17 @@ class idlers extends helperFunctions
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12 col-md-6'); $this->rowColOpen('form-row', 'col-12 col-md-4');
$this->tagOpen('div', 'input-group');
$this->inputPrepend('Label');
$this->textInput('label', '', 'form-control', false, 1, 24);
$this->tagClose('div', 2);
$this->colOpen('col-12 col-md-4');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('IPv4'); $this->inputPrepend('IPv4');
$this->textInput('ipv4', '', 'form-control', false, 4, 124); $this->textInput('ipv4', '', 'form-control', false, 4, 124);
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->colOpen('col-12 col-md-6'); $this->colOpen('col-12 col-md-4');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('IPv6'); $this->inputPrepend('IPv6');
$this->textInput('ipv6', '', 'form-control', false, 4, 124); $this->textInput('ipv6', '', 'form-control', false, 4, 124);
@ -2058,11 +2099,11 @@ class idlers extends helperFunctions
public function searchResults(string $search_term) public function searchResults(string $search_term)
{ {
if (!empty($search_term)) { if (!empty($search_term)) {
$select = $this->dbConnect()->prepare("SELECT `id`, `hostname`,`ipv4`, `virt`, p.price, p.currency, p.term FROM `servers` INNER JOIN pricing p on servers.id = p.server_id WHERE `hostname` LIKE ? OR `ipv4` LIKE ? LIMIT 30;"); $select = $this->dbConnect()->prepare("SELECT `id`, `hostname`,`ipv4`, `virt`, `tags`, `label`, p.price, p.currency, p.term FROM `servers` INNER JOIN pricing p on servers.id = p.server_id WHERE `hostname` LIKE ? OR `ipv4` LIKE ? OR `tags` LIKE ? OR `label` LIKE ? LIMIT 30;");
$select->execute(["%$search_term%", "%$search_term%"]); $select->execute(["%$search_term%", "%$search_term%", "%$search_term%", "%$search_term%"]);
while ($row = $select->fetch(PDO::FETCH_ASSOC)) { while ($row = $select->fetch(PDO::FETCH_ASSOC)) {
$this->rowColOpen('row search-result', 'col-6'); $this->rowColOpen('row search-result', 'col-6');
$this->outputString("<p class='m-value'>{$row['hostname']} <code>{$row['ipv4']}</code> <span class='data-type'>{$row['virt']}</span> {$row['price']} {$row['currency']} <span class='data-type'>" . $this->paymentTerm($row['term']) . "</span></p>"); $this->outputString("<p class='m-value'>{$row['hostname']} <code>{$row['ipv4']}</code> <span class='data-type'>{$row['virt']}</span> {$row['price']} {$row['currency']} <span class='data-type'>" . $this->paymentTerm($row['term']) . "</span> <code>{$row['label']}</code></p>");
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-3'); $this->colOpen('col-3');
$this->outputString('<a class="btn btn-main" id="viewMoreServer" value="' . $row['id'] . '" data-target="#viewMoreServerModal" data-toggle="modal" href="#" role="button">View</a>'); $this->outputString('<a class="btn btn-main" id="viewMoreServer" value="' . $row['id'] . '" data-target="#viewMoreServerModal" data-toggle="modal" href="#" role="button">View</a>');
@ -2157,11 +2198,8 @@ class idlers extends helperFunctions
if (!isset($data)) {//returned no data if (!isset($data)) {//returned no data
exit; exit;
} }
if (is_null($data['ipv6']) || empty($data['ipv6'])) { (is_null($data['ipv6']) || empty($data['ipv6'])) ? $ipv6 = '-' : $ipv6 = $data['ipv6'];
$ipv6 = '-';
} else {
$ipv6 = $data['ipv6'];
}
($data['has_yabs'] == 1) ? $has_yabs = true : $has_yabs = false; ($data['has_yabs'] == 1) ? $has_yabs = true : $has_yabs = false;
($data['has_st'] == 1) ? $has_st = true : $has_st = false; ($data['has_st'] == 1) ? $has_st = true : $has_st = false;
$this->tagOpen('div', 'modal-header'); $this->tagOpen('div', 'modal-header');
@ -2169,157 +2207,125 @@ class idlers extends helperFunctions
$this->outputString('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'); $this->outputString('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>');
$this->tagClose('div'); $this->tagClose('div');
$this->tagOpen('div', 'modal-body'); $this->tagOpen('div', 'modal-body');
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'IPv4');
$this->tagClose('div');
$this->colOpen('col-8');
$this->outputString('<code><p class="m-value">' . $data['ipv4'] . '</p></code>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); if (!is_null($data['label']) || !empty($data['label'])) {
$this->HTMLphrase('p', 'm-desc', 'IPv6'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Label');
$this->tagClose('div');
$this->colOpen('col-8');
$this->outputString('<p class="m-value">' . $data['label'] . '</p>');
$this->tagClose('div', 2);
}
$this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'IPv4 ');
$this->outputString('<code><p class="m-value">' . $data['ipv4'] . '</p></code>');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'IPv6 ');
$this->outputString('<code><p class="m-value">' . $ipv6 . '</p></code>'); $this->outputString('<code><p class="m-value">' . $ipv6 . '</p></code>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'NS1'); $this->HTMLphrase('p', 'm-desc', 'NS1 ');
$this->tagClose('div');
$this->colOpen('col-8');
$this->outputString('<code><p class="m-value">' . $data['ns1'] . '</p></code>'); $this->outputString('<code><p class="m-value">' . $data['ns1'] . '</p></code>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'NS2');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'NS2 ');
$this->outputString('<code><p class="m-value">' . $data['ns2'] . '</p></code>'); $this->outputString('<code><p class="m-value">' . $data['ns2'] . '</p></code>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'SSH Port'); $this->HTMLphrase('p', 'm-desc', 'Location ');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', '<code>' . $data['ssh_port'] . '</code>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Bandwidth');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', '' . $data['bandwidth'] . '<span class="data-type">' . $data['bandwidth_type'] . '</span>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Disk');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', '' . $data['disk'] . '<span class="data-type">' . $data['disk_type'] . '</span>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Location');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', $data['location']); $this->HTMLphrase('p', 'm-value', $data['location']);
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Provider');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Provider ');
$this->HTMLphrase('p', 'm-value', $data['provider']); $this->HTMLphrase('p', 'm-value', $data['provider']);
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'OS'); $this->HTMLphrase('p', 'm-desc', 'OS ');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', $this->osIntToString($data['os'])); $this->HTMLphrase('p', 'm-value', $this->osIntToString($data['os']));
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Due in');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Due in ');
$this->HTMLphrase('p', 'm-value', '' . $this->processDueDate($data['server_id'], $data['term'], $data['next_dd']) . '<span class="data-type">days</span>'); $this->HTMLphrase('p', 'm-value', '' . $this->processDueDate($data['server_id'], $data['term'], $data['next_dd']) . '<span class="data-type">days</span>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-section-text', 'CPU'); $this->HTMLphrase('p', 'm-desc', 'Bandwidth ');
$this->HTMLphrase('p', 'm-value', '' . $data['bandwidth'] . '<span class="data-type">' . $data['bandwidth_type'] . '</span>');
$this->tagClose('div');
$this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'SSH Port ');
$this->outputString('<code><p class="m-value">' . $data['ssh_port'] . '</p></code>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Amount'); $this->HTMLphrase('p', 'm-desc', 'Disk ');
$this->tagClose('div'); $this->HTMLphrase('p', 'm-value', '' . $data['disk'] . '<span class="data-type">' . $data['disk_type'] . '</span>');
$this->colOpen('col-8'); $this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 col-md-6');
$this->HTMLphrase('p', 'm-section-text text-center', 'CPU');
$this->rowColOpen('row m-row', 'col-12 col-md-6');
$this->HTMLphrase('p', 'm-desc', 'Amount ');
$this->HTMLphrase('p', 'm-value', $data['cpu']); $this->HTMLphrase('p', 'm-value', $data['cpu']);
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Frequency');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6');
$this->HTMLphrase('p', 'm-value', $data['cpu_freq']); $this->HTMLphrase('p', 'm-desc', 'Frequency ');
$this->HTMLphrase('p', 'm-value', $data['cpu_freq'] . '<span class="data-type">Mhz</span>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-12'); $this->rowColOpen('row m-row', 'col-12');
$this->outputString('<i><p class="m-value">' . $data['cpu_type'] . '</p></i>'); $this->outputString('<i><p class="m-value">' . $data['cpu_type'] . '</p></i>');
$this->tagClose('div', 2); $this->tagClose('div', 3);
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->colOpen('col-12 col-md-6');
$this->outputString('<p class="m-section-text">Ram</p>'); $this->outputString('<p class="m-section-text text-center">Ram</p>');
$this->tagClose('div', 2); $this->rowColOpen('row m-row', 'col-12 col-md-6');
$this->HTMLphrase('p', 'm-desc', 'Ram ');
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Ram');
$this->tagClose('div');
$this->colOpen('col-8');
$this->HTMLphrase('p', 'm-value', '' . $data['ram'] . '<span class="data-type">' . $data['ram_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['ram'] . '<span class="data-type">' . $data['ram_type'] . '</span>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Swap');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-12 col-md-6');
$this->HTMLphrase('p', 'm-desc', 'Swap ');
$this->HTMLphrase('p', 'm-value', '' . $data['swap'] . '<span class="data-type">' . $data['swap_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['swap'] . '<span class="data-type">' . $data['swap_type'] . '</span>');
$this->tagClose('div', 2); $this->tagClose('div', 4);
if ($has_yabs) { if ($has_yabs) {
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'GeekBench 5'); $this->HTMLphrase('p', 'm-section-text', 'GeekBench 5');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'single: '); $this->HTMLphrase('p', 'm-desc', 'single: ');
$this->HTMLphrase('p', 'm-value', $data['gb5_single']); $this->HTMLphrase('p', 'm-value', $data['gb5_single']);
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'multi: '); $this->HTMLphrase('p', 'm-desc', 'multi: ');
$this->HTMLphrase('p', 'm-value', $data['gb5_multi']); $this->HTMLphrase('p', 'm-value', $data['gb5_multi']);
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'id: '); $this->HTMLphrase('p', 'm-desc', 'id: ');
$this->outputString('<a id="m_gb5_id_link" href="https://browser.geekbench.com/v5/cpu/' . $data['gb5_id'] . '"><p class="m-value">' . $data['gb5_id'] . '</p></a>'); $this->outputString('<a id="m_gb5_id_link" href="https://browser.geekbench.com/v5/cpu/' . $data['gb5_id'] . '"><p class="m-value">' . $data['gb5_id'] . '</p></a>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'Disk test'); $this->HTMLphrase('p', 'm-section-text', 'Disk tests');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-6'); $this->rowColOpen('row m-row', 'col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '4k: '); $this->HTMLphrase('p', 'm-desc', '4k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['4k'] . '<span class="data-type">' . $data['4k_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['4k'] . '<span class="data-type">' . $data['4k_type'] . '</span>');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-6'); $this->colOpen('col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '64k: '); $this->HTMLphrase('p', 'm-desc', '64k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['64k'] . '<span class="data-type">' . $data['64k_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['64k'] . '<span class="data-type">' . $data['64k_type'] . '</span>');
$this->tagClose('div', 2); $this->tagClose('div');
$this->colOpen('col-6 col-md-3 mm-col');
$this->rowColOpen('row m-row', 'col-6');
$this->HTMLphrase('p', 'm-desc', '512k: '); $this->HTMLphrase('p', 'm-desc', '512k: ');
$this->HTMLphrase('p', 'm-value', '' . $data['512k'] . '<span class="data-type">' . $data['512k_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['512k'] . '<span class="data-type">' . $data['512k_type'] . '</span>');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-6'); $this->colOpen('col-6 col-md-3 mm-col');
$this->HTMLphrase('p', 'm-desc', '1m: '); $this->HTMLphrase('p', 'm-desc', '1m: ');
$this->HTMLphrase('p', 'm-value', '' . $data['1m'] . '<span class="data-type">' . $data['1m_type'] . '</span>'); $this->HTMLphrase('p', 'm-value', '' . $data['1m'] . '<span class="data-type">' . $data['1m_type'] . '</span>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
@ -2328,63 +2334,67 @@ class idlers extends helperFunctions
$this->HTMLphrase('p', 'm-section-text', 'Pricing'); $this->HTMLphrase('p', 'm-section-text', 'Pricing');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-12'); $this->rowColOpen('row m-row', 'col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-value', '' . $data['price'] . ' <span class="data-type">' . $data['currency'] . '</span> '); $this->HTMLphrase('p', 'm-value', '' . $data['price'] . ' <span class="data-type">' . $data['currency'] . '</span> ');
$this->HTMLphrase('p', 'm-value', $this->paymentTerm($data['term'])); $this->HTMLphrase('p', 'm-value', $this->paymentTerm($data['term']));
$this->tagClose('div');
$this->colOpen('col-12 col-md-6 mm-col');
$this->HTMLphrase('p', 'm-desc', 'As USD per month: ');
$this->HTMLphrase('p', 'm-value', '$' . $data['usd_per_month'] . '');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'Other'); $this->HTMLphrase('p', 'm-section-text', 'Other');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Owned since'); $this->HTMLphrase('p', 'm-desc', 'Owned since');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-8'); $this->colOpen('col-8 mm-col');
$this->HTMLphrase('p', 'm-value', $data['owned_since']); $this->HTMLphrase('p', 'm-value', $data['owned_since']);
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Dedicated: '); $this->HTMLphrase('p', 'm-desc', 'Dedicated: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_dedicated'])); $this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_dedicated']));
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Dedi CPU: '); $this->HTMLphrase('p', 'm-desc', 'Dedi CPU: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_cpu_dedicated'])); $this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['is_cpu_dedicated']));
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Is offer: '); $this->HTMLphrase('p', 'm-desc', 'Is offer: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['was_special'])); $this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['was_special']));
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'AES-NI: '); $this->HTMLphrase('p', 'm-desc', 'AES-NI: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['aes_ni'])); $this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['aes_ni']));
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'VM-x/AMD-V: '); $this->HTMLphrase('p', 'm-desc', 'VM-x/AMD-V: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['amd_v'])); $this->HTMLphrase('p', 'm-value', $this->intToYesNo($data['amd_v']));
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-4'); $this->colOpen('col-4 mm-col');
$this->HTMLphrase('p', 'm-desc', 'Virt: '); $this->HTMLphrase('p', 'm-desc', 'Virt: ');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-2'); $this->colOpen('col-2 mm-col');
$this->HTMLphrase('p', 'm-value', $data['virt']); $this->HTMLphrase('p', 'm-value', $data['virt']);
$this->tagClose('div', 2); $this->tagClose('div', 2);
if ($has_yabs && $has_st) { if ($has_yabs && $has_st) {
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'Network test'); $this->HTMLphrase('p', 'm-section-text', 'Network tests');
$this->tagClose('div', 2); $this->tagClose('div', 2);
$this->tagOpen('div', 'row'); $this->tagOpen('div', 'row');
$this->outputString('<div class="col-6"><p class="m-desc">Location:</p></div>'); $this->outputString('<div class="col-6"><p class="m-desc">Location:</p></div>');
@ -2407,8 +2417,8 @@ class idlers extends helperFunctions
} }
} }
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 col-md-6');
$this->htmlPhrase('p', 'm-section-text', 'Notes'); $this->htmlPhrase('p', 'm-section-text text-center', 'Notes');
$this->outputString("<textarea class='form-control' id='server_notes' name='server_notes' rows='4' cols='40' maxlength='255' disabled>"); $this->outputString("<textarea class='form-control' id='server_notes' name='server_notes' rows='4' cols='40' maxlength='255' disabled>");
if (is_null($data['notes']) || empty($data['notes'])) { if (is_null($data['notes']) || empty($data['notes'])) {
$this->outputString(''); $this->outputString('');
@ -2416,12 +2426,9 @@ class idlers extends helperFunctions
$this->outputString($data['notes']); $this->outputString($data['notes']);
} }
$this->outputString("</textarea>"); $this->outputString("</textarea>");
$this->tagClose('div', 2); $this->tagClose('div');
$this->colOpen('col-12 col-md-6');
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->HTMLphrase('p', 'm-section-text text-center', 'Tags');
$this->HTMLphrase('p', 'm-section-text', 'Tags');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-12');
$this->tagOpen('ul'); $this->tagOpen('ul');
$tags_arr = explode(",", $data['tags']); $tags_arr = explode(",", $data['tags']);
foreach ($tags_arr as $tag) { foreach ($tags_arr as $tag) {
@ -2430,16 +2437,16 @@ class idlers extends helperFunctions
} }
} }
$this->tagClose('ul'); $this->tagClose('ul');
$this->tagClose('div', 3); $this->tagClose('div', 2);
if (file_exists("yabs/{$data['server_id']}.txt")) { if (file_exists("yabs/{$data['server_id']}.txt")) {
$this->rowColOpen('row text-center', 'col-12 col-md-6'); $this->rowColOpen('row m-section-row text-center', 'col-12 col-md-6');
$this->outputString('<a class="btn btn-main view-yabs-btn" id="viewYabs" value="' . $item_id . '" data-target="#yabsModal" data-toggle="modal" href="#" role="button">View YABs</a>'); $this->outputString('<a class="btn btn-main view-yabs-btn" id="viewYabs" value="' . $item_id . '" data-target="#yabsModal" data-toggle="modal" href="#" role="button">View YABs</a>');
$this->tagClose('div'); $this->tagClose('div');
$this->colOpen('col-12 col-md-6'); $this->colOpen('col-12 col-md-6');
$this->outputString('<a class="btn btn-third" id="closeViewMoreModal" role="button" data-dismiss="modal">Close</a>'); $this->outputString('<a class="btn btn-third" id="closeViewMoreModal" role="button" data-dismiss="modal">Close</a>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
} else { } else {
$this->rowColOpen('row text-center', 'col-12'); $this->rowColOpen('row m-section-row text-center', 'col-12');
$this->outputString('<a class="btn btn-third" id="closeViewMoreModal" role="button" data-dismiss="modal">Close</a>'); $this->outputString('<a class="btn btn-third" id="closeViewMoreModal" role="button" data-dismiss="modal">Close</a>');
$this->tagClose('div', 2); $this->tagClose('div', 2);
} }
@ -2557,6 +2564,15 @@ class idlers extends helperFunctions
$this->outputString('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'); $this->outputString('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>');
$this->tagClose('div'); $this->tagClose('div');
$this->tagOpen('div', 'modal-body'); $this->tagOpen('div', 'modal-body');
$this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'Attached to');
$this->tagClose('div');
$this->colOpen('col-8');
$this->outputString('<code><p class="m-value">' . $this->idToObjectName($data['attached_to']) . '</p></code>');
$this->tagClose('div', 2);
$this->rowColOpen('row m-row', 'col-4'); $this->rowColOpen('row m-row', 'col-4');
$this->HTMLphrase('p', 'm-desc', 'NS2'); $this->HTMLphrase('p', 'm-desc', 'NS2');
$this->tagClose('div'); $this->tagClose('div');
@ -3088,10 +3104,38 @@ class idlers extends helperFunctions
protected function viewSwitcherIcon() protected function viewSwitcherIcon()
{ {
$this->rowColOpen('row text-center', 'col-12'); $this->rowColOpen('row text-center', 'col-12');
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-table" id="viewSwitchIcon" title="Switch to table"></i></a>'); if (self::DEFAULT_VIEW == 'CARDS') {
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-table" id="viewSwitchIcon" title="Switch to table"></i></a>');
} else {
$this->outputString('<a id="viewSwitcherIcon"><i class="fas fa-th" id="viewSwitchIcon" title="Switch to cards"></i></a>');
}
$this->tagClose('div', 2); $this->tagClose('div', 2);
} }
protected function idToObjectName(string $id)
{//Returns a hostname or domain for an id
$servers = $this->dbConnect()->prepare("SELECT `hostname` FROM `servers` WHERE `id` = ? LIMIT 1;");
$servers->execute([$id]);
$servers_res = $servers->fetch(PDO::FETCH_ASSOC);
if ($servers_res) {
return $servers_res['hostname'];
} else {
$shared = $this->dbConnect()->prepare("SELECT `domain` FROM `shared_hosting` WHERE `id` = ? LIMIT 1;");
$shared->execute([$id]);
$shared_res = $shared->fetch(PDO::FETCH_ASSOC);
if ($shared_res) {
return $shared_res['domain'];
} else {
$domain = $this->dbConnect()->prepare("SELECT `domain` FROM `domains` WHERE `id` = ? LIMIT 1;");
$domain->execute([$id]);
$domain_res = $domain->fetch(PDO::FETCH_ASSOC);
if ($domain_res) {
return $domain_res['domain'];
}
}
}
return $id;
}
} }
class itemInsert extends idlers class itemInsert extends idlers
@ -3114,10 +3158,11 @@ class itemInsert extends idlers
(isset($data['was_offer'])) ? $offer = 1 : $offer = 0; (isset($data['was_offer'])) ? $offer = 1 : $offer = 0;
(empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4']; (empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4'];
(empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6']; (empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6'];
(empty($data['label'])) ? $label = null : $label = $data['label'];
$location_id = $this->handleLocation($data['location']); $location_id = $this->handleLocation($data['location']);
$provider_id = $this->handleProvider($data['provider']); $provider_id = $this->handleProvider($data['provider']);
$insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, has_yabs, ns1, ns2, ssh_port) VALUES (?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)'); $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, has_yabs, ns1, ns2, ssh_port, label) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
$insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['has_yabs'], $data['ns1'], $data['ns2'], $data['ssh_port']]); $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['has_yabs'], $data['ns1'], $data['ns2'], $data['ssh_port'], $label]);
$this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']); $this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']);
return $item_id; return $item_id;
} }
@ -3131,13 +3176,14 @@ class itemInsert extends idlers
(isset($data['was_offer'])) ? $offer = 1 : $offer = 0; (isset($data['was_offer'])) ? $offer = 1 : $offer = 0;
(empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4']; (empty($data['ipv4'])) ? $ipv4 = null : $ipv4 = $data['ipv4'];
(empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6']; (empty($data['ipv6'])) ? $ipv6 = null : $ipv6 = $data['ipv6'];
(empty($data['label'])) ? $label = null : $label = $data['label'];
($data['ram_type'] == 'GB') ? $ram_mb = $this->GBtoMB($data['ram']) : $ram_mb = $data['ram']; ($data['ram_type'] == 'GB') ? $ram_mb = $this->GBtoMB($data['ram']) : $ram_mb = $data['ram'];
($data['swap_type'] == 'GB') ? $swap_mb = $this->GBtoMB($data['swap']) : $swap_mb = $data['swap']; ($data['swap_type'] == 'GB') ? $swap_mb = $this->GBtoMB($data['swap']) : $swap_mb = $data['swap'];
($data['disk_type'] == 'TB') ? $disk_gb = $this->TBtoGB($data['disk']) : $disk_gb = $data['disk']; ($data['disk_type'] == 'TB') ? $disk_gb = $this->TBtoGB($data['disk']) : $disk_gb = $data['disk'];
$location_id = $this->handleLocation($data['location']); $location_id = $this->handleLocation($data['location']);
$provider_id = $this->handleProvider($data['provider']); $provider_id = $this->handleProvider($data['provider']);
$insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, cpu, cpu_freq, ram, ram_type, swap, swap_type, disk, disk_type, ram_mb, swap_mb, disk_gb, ns1, ns2, ssh_port) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); $insert = $this->dbConnect()->prepare('INSERT IGNORE INTO `servers` (id, hostname, location, provider, ipv4,ipv6, owned_since, os, is_cpu_dedicated, is_dedicated, was_special, bandwidth, virt, cpu, cpu_freq, ram, ram_type, swap, swap_type, disk, disk_type, ram_mb, swap_mb, disk_gb, ns1, ns2, ssh_port, label) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
$insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['cpu_amount'], $data['cpu_speed'], $data['ram'], $data['ram_type'], $data['swap'], $data['swap_type'], $data['disk'], $data['disk_type'], $ram_mb, $swap_mb, $disk_gb, $data['ns1'], $data['ns2'], $data['ssh_port']]); $insert->execute([$item_id, $data['hostname'], $location_id, $provider_id, $ipv4, $ipv6, $data['owned_since'], $data['os'], $dedi_cpu, $dedi, $offer, $data['bandwidth'], $data['virt'], $data['cpu_amount'], $data['cpu_speed'], $data['ram'], $data['ram_type'], $data['swap'], $data['swap_type'], $data['disk'], $data['disk_type'], $ram_mb, $swap_mb, $disk_gb, $data['ns1'], $data['ns2'], $data['ssh_port'], $label]);
$this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']); $this->insertPrice($data['price'], $data['currency'], $data['term'], $data['next_due_date']);
return $item_id; return $item_id;
} }
@ -3317,8 +3363,8 @@ class itemUpdate extends idlers
} elseif ($data['me_non_active'] == 'on') { } elseif ($data['me_non_active'] == 'on') {
$this->updateActiveStatus(0); $this->updateActiveStatus(0);
} }
$update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ?, `notes` = ? WHERE `id`= ? LIMIT 1;"); $update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ?, `notes` = ?, `label` = ? WHERE `id`= ? LIMIT 1;");
return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $data['me_notes'], $this->item_id]); return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $data['me_notes'], $data['me_label'], $this->item_id]);
} }
public function updateServerPricingFromModal() public function updateServerPricingFromModal()
@ -3357,8 +3403,9 @@ class itemUpdate extends idlers
} elseif ($data['d_me_non_active'] == 'on') { } elseif ($data['d_me_non_active'] == 'on') {
$this->updateActiveStatus(0); $this->updateActiveStatus(0);
} }
$update = $this->dbConnect()->prepare("UPDATE `domains` SET `domain` = ?,`ns1` = ?,`ns2` = ?,`owned_since` = ? WHERE `id`= ? LIMIT 1;"); (!empty($_POST['d_me_attached_to'])) ? $attached_to = $_POST['d_me_attached_to'] : $attached_to = null;
return $update->execute([$data['d_me_hostname'], $data['d_me_ns1'], $data['d_me_ns2'], $data['d_me_owned_since'], $this->item_id]); $update = $this->dbConnect()->prepare("UPDATE `domains` SET `domain` = ?,`ns1` = ?,`ns2` = ?,`owned_since` = ?, `attached_to` = ? WHERE `id`= ? LIMIT 1;");
return $update->execute([$data['d_me_hostname'], $data['d_me_ns1'], $data['d_me_ns2'], $data['d_me_owned_since'], $attached_to, $this->item_id]);
} }
public function updateDomainPricingFromModal() public function updateDomainPricingFromModal()

View File

@ -292,6 +292,7 @@ CREATE TABLE IF NOT EXISTS `servers`
( (
`id` char(8) NOT NULL, `id` char(8) NOT NULL,
`hostname` varchar(124) DEFAULT NULL, `hostname` varchar(124) DEFAULT NULL,
`label` varchar(24) DEFAULT NULL,
`location` int(11) DEFAULT NULL, `location` int(11) DEFAULT NULL,
`provider` int(11) DEFAULT NULL, `provider` int(11) DEFAULT NULL,
`ipv4` varchar(124) DEFAULT NULL, `ipv4` varchar(124) DEFAULT NULL,

View File

@ -1,31 +0,0 @@
ALTER TABLE `disk_speed`
ADD COLUMN `datetime` DATETIME NULL DEFAULT CURRENT_TIMESTAMP AFTER `1m_as_mbps`;
ALTER TABLE `servers`
ADD COLUMN `ssh_port` INT(11) NULL DEFAULT '22' AFTER `os`;
ALTER TABLE `servers`
ADD COLUMN `notes` VARCHAR(255) NULL DEFAULT NULL AFTER `tags`;
ALTER TABLE `disk_speed`
DROP PRIMARY KEY;
ALTER TABLE `disk_speed`
ADD UNIQUE INDEX `Index 1` (`server_id`, `datetime`);
ALTER TABLE `servers`
ADD COLUMN `has_st` TINYINT(1) NULL DEFAULT '0' AFTER `has_yabs`;
UPDATE servers t1
JOIN
(
SELECT server_id
FROM speed_tests
GROUP BY server_id
HAVING COUNT(*) > 0
) t2
ON t1.id = t2.server_id
SET t1.has_st = 1;
ALTER TABLE `servers`
CHANGE COLUMN `bandwidth` `bandwidth` FLOAT NULL DEFAULT NULL AFTER `disk_type`;

2
update1.2to1.3.sql Normal file
View File

@ -0,0 +1,2 @@
ALTER TABLE `servers`
ADD COLUMN `label` VARCHAR(24) NULL DEFAULT NULL AFTER `hostname`;