diff --git a/README.md b/README.md index f8441f9..b8847d2 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,24 @@ 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. 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.1-blue.svg)](https://shields.io/) +[![Generic badge](https://img.shields.io/badge/version-1.2-blue.svg)](https://shields.io/) -## 1.1 changes: -**If you have version 1.0 please run ```update.sql```** -* Added notes input for servers -* Added SSH port input for servers -* Added YABs update disk & network speed values (Keeps history) -* Added red button for closing modals -* Added `update.sql` for pre-existing installations only. -* Fixed page jumping horizontally when opening modals -* Fixed search showing duplicates when typing fast -* Fixed adding provider and locations return id +## 1.2 changes: +**If you have version 1.1 or less already installed please run ```update.sql```** +* Added table view type (use switcher icon to change to this view) +* Added auto get IPv4/IPv6 based on hostname (Click icon at hostname input) +* Added up/down status (Click OS icon) +* Updated the order by table for better formatting +* Removed unused buttons from the CSS +* Updated Minor style changes +* Updated `update.sql` for pre-existing installations only. +* Updated when type DEDI selected "is_dedi" will be toggled +* Updated IPv4 no longer required field +* Fixed no location and/or provider causing uneven cards +* Updated delete labels +* Updated domain terms to be annual and longer only +* Fixed error when all speedtests are "busy" * Updated `my_idlers.sql` for changes -* Updated view YABs modal to be wider -* Updated config constants to new class at top of ```class.php``` ## Requires @@ -32,8 +35,11 @@ By using a [YABs](https://github.com/masonr/yet-another-bench-script) output you * Add domains * [Auto suggest locations](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif) * [Auto suggest providers](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-provider.gif) +* [Auto get IP's from hostname](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ips-from-hostname.gif) +* [Check up/down status](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ping-up-feature.gif) * Get YABs data from output * Save & view YABs output +* Update YABs disk & network results * Next due date system * Multi currency compatibility * Multi payment-term compatibility @@ -51,7 +57,7 @@ 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. * Run `my_idlers.sql` in MySQL. -* **Only run ```update.sql``` if you have version 1.0 installed.** +* **Only run ```update.sql``` if you have version 1.1 or less already installed.** * Edit ```class.php``` lines ```13-16``` for your MySQL details. * Edit ```class.php``` lines ```8-10``` for card order type. @@ -97,9 +103,20 @@ or [![screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-tally-card.png) +[![screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-data-table-view.png) + [![Auto complete location](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-location.gif) [![Auto complete provider](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-provider.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-auto-provider.gif) + +[![Auto complete IP's](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ips-from-hostname.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ips-from-hostname.gif) + + +[![Get up/down status](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ping-up-feature.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-ping-up-feature.gif) + + +[![Table scrolling x](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-table-view.gif)](https://cdn.write.corbpie.com/wp-content/uploads/2021/01/my-idlers-self-hosted-server-domain-information-table-view.gif) + diff --git a/assets/css/all.min.css b/assets/css/all.min.css index 18e53d6..084eda0 100644 --- a/assets/css/all.min.css +++ b/assets/css/all.min.css @@ -2,4 +2,4 @@ * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */ -.fa,.fas,.far,.fal,.fad,.fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fas.fa-pull-left,.far.fa-pull-left,.fal.fa-pull-left,.fab.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fas.fa-pull-right,.far.fa-pull-right,.fal.fa-pull-right,.fab.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-flip-both{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-centos:before{content:"\f789"}.fa-box:before{content:"\f466"}.fa-compact-disc:before{content:"\f51f"}.fa-fedora:before{content:"\f798"}.fa-hdd:before{content:"\f0a0"}.fa-linux:before{content:"\f17c"}.fa-memory:before{content:"\f538"}.fa-microchip:before{content:"\f2db"}.fa-ubuntu:before{content:"\f7df"}.fa-windows:before{content:"\f17a"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:'Font Awesome 5 Brands';font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.eot);src:url("../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url("../webfonts/fa-brands-400.svg#fontawesome") format("svg")}.fab{font-family:'Font Awesome 5 Brands';font-weight:400}@font-face{font-family:'Font Awesome 5 Free';font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url("../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url("../webfonts/fa-regular-400.svg#fontawesome") format("svg")}.far{font-family:'Font Awesome 5 Free';font-weight:400}@font-face{font-family:'Font Awesome 5 Free';font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url("../webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url("../webfonts/fa-solid-900.svg#fontawesome") format("svg")}.fa,.fas{font-family:'Font Awesome 5 Free';font-weight:900;margin-right: 0.15rem;} \ No newline at end of file +.fa,.fas,.far,.fal,.fad,.fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fas.fa-pull-left,.far.fa-pull-left,.fal.fa-pull-left,.fab.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fas.fa-pull-right,.far.fa-pull-right,.fal.fa-pull-right,.fab.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-flip-both{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-centos:before{content:"\f789"}.fa-box:before{content:"\f466"}.fa-compact-disc:before{content:"\f51f"}.fa-fedora:before{content:"\f798"}.fa-hdd:before{content:"\f0a0"}.fa-linux:before{content:"\f17c"}.fa-memory:before{content:"\f538"}.fa-microchip:before{content:"\f2db"}.fa-search:before{content:"\f002"}.fa-table:before{content:"\f0ce"}.fa-th:before{content:"\f00a"}.fa-ubuntu:before{content:"\f7df"}.fa-windows:before{content:"\f17a"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:'Font Awesome 5 Brands';font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.eot);src:url("../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url("../webfonts/fa-brands-400.svg#fontawesome") format("svg")}.fab{font-family:'Font Awesome 5 Brands';font-weight:400}@font-face{font-family:'Font Awesome 5 Free';font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url("../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url("../webfonts/fa-regular-400.svg#fontawesome") format("svg")}.far{font-family:'Font Awesome 5 Free';font-weight:400}@font-face{font-family:'Font Awesome 5 Free';font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url("../webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url("../webfonts/fa-solid-900.svg#fontawesome") format("svg")}.fa,.fas{font-family:'Font Awesome 5 Free';font-weight:900;margin-right: 0.15rem;} \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css index f0c188b..5e657ee 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -331,13 +331,13 @@ textarea { .table td, .table th { padding: .75rem; - vertical-align: top; border-top: 1px solid #dee2e6 } .table thead th { vertical-align: bottom; - border-bottom: 2px solid #dee2e6 + border-bottom: 2px solid #dee2e6; + font-weight: 600; } .table-sm td, .table-sm th { @@ -492,7 +492,7 @@ textarea.form-control { padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; - border-radius: .25rem; + border-radius: 0.2rem; transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out } @@ -519,166 +519,6 @@ textarea.form-control { cursor: pointer } -.btn-primary:not(:disabled):not(.disabled).active, .btn-primary:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #0062cc; - border-color: #005cbf -} - -.btn-primary:not(:disabled):not(.disabled).active:focus, .btn-primary:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .5) -} - -.btn-secondary:not(:disabled):not(.disabled).active, .btn-secondary:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #545b62; - border-color: #4e555b -} - -.btn-secondary:not(:disabled):not(.disabled).active:focus, .btn-secondary:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(108, 117, 125, .5) -} - -.btn-success:not(:disabled):not(.disabled).active, .btn-success:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #1e7e34; - border-color: #1c7430 -} - -.btn-success:not(:disabled):not(.disabled).active:focus, .btn-success:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(40, 167, 69, .5) -} - -.btn-info:not(:disabled):not(.disabled).active, .btn-info:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #117a8b; - border-color: #10707f -} - -.btn-info:not(:disabled):not(.disabled).active:focus, .btn-info:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(23, 162, 184, .5) -} - -.btn-warning:not(:disabled):not(.disabled).active, .btn-warning:not(:disabled):not(.disabled):active { - color: #212529; - background-color: #d39e00; - border-color: #c69500 -} - -.btn-warning:not(:disabled):not(.disabled).active:focus, .btn-warning:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(255, 193, 7, .5) -} - -.btn-danger:not(:disabled):not(.disabled).active, .btn-danger:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #bd2130; - border-color: #b21f2d -} - -.btn-danger:not(:disabled):not(.disabled).active:focus, .btn-danger:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .5) -} - -.btn-light:not(:disabled):not(.disabled).active, .btn-light:not(:disabled):not(.disabled):active { - color: #212529; - background-color: #dae0e5; - border-color: #d3d9df -} - -.btn-light:not(:disabled):not(.disabled).active:focus, .btn-light:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(248, 249, 250, .5) -} - -.btn-dark:not(:disabled):not(.disabled).active, .btn-dark:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #1d2124; - border-color: #171a1d -} - -.btn-dark:not(:disabled):not(.disabled).active:focus, .btn-dark:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(52, 58, 64, .5) -} - -.btn-outline-primary:not(:disabled):not(.disabled).active, .btn-outline-primary:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #007bff; - border-color: #007bff -} - -.btn-outline-primary:not(:disabled):not(.disabled).active:focus, .btn-outline-primary:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .5) -} - -.btn-outline-secondary:not(:disabled):not(.disabled).active, .btn-outline-secondary:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #6c757d; - border-color: #6c757d -} - -.btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .btn-outline-secondary:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(108, 117, 125, .5) -} - -.btn-outline-success:not(:disabled):not(.disabled).active, .btn-outline-success:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #28a745; - border-color: #28a745 -} - -.btn-outline-success:not(:disabled):not(.disabled).active:focus, .btn-outline-success:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(40, 167, 69, .5) -} - -.btn-outline-info:not(:disabled):not(.disabled).active, .btn-outline-info:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8 -} - -.btn-outline-info:not(:disabled):not(.disabled).active:focus, .btn-outline-info:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(23, 162, 184, .5) -} - -.btn-outline-warning:not(:disabled):not(.disabled).active, .btn-outline-warning:not(:disabled):not(.disabled):active { - color: #212529; - background-color: #ffc107; - border-color: #ffc107 -} - -.btn-outline-warning:not(:disabled):not(.disabled).active:focus, .btn-outline-warning:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(255, 193, 7, .5) -} - -.btn-outline-danger:not(:disabled):not(.disabled).active, .btn-outline-danger:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #dc3545; - border-color: #dc3545 -} - -.btn-outline-danger:not(:disabled):not(.disabled).active:focus, .btn-outline-danger:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .5) -} - -.btn-outline-light:not(:disabled):not(.disabled).active, .btn-outline-light:not(:disabled):not(.disabled):active { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa -} - -.btn-outline-light:not(:disabled):not(.disabled).active:focus, .btn-outline-light:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(248, 249, 250, .5) -} - -.btn-outline-dark:not(:disabled):not(.disabled).active, .btn-outline-dark:not(:disabled):not(.disabled):active { - color: #fff; - background-color: #343a40; - border-color: #343a40 -} - -.btn-outline-dark:not(:disabled):not(.disabled).active:focus, .btn-outline-dark:not(:disabled):not(.disabled):active:focus { - box-shadow: 0 0 0 .2rem rgba(52, 58, 64, .5) -} - .btn-block { display: block; width: 100% @@ -1110,6 +950,10 @@ button.close { visibility: hidden } +.no-loc, .no-prov { + visibility: hidden +} + .form-control:focus { color: #495057; background-color: #fff; @@ -1120,7 +964,8 @@ button.close { .value { display: inline; - margin-bottom: .4rem + margin-bottom: .4rem; + font-size: 0.91rem; } .price { @@ -1281,10 +1126,87 @@ button.close { color: #00000096 } +.fa-search { + color: #537cf7; +} + +.os-icon { + color: #6f6b6b; +} + +.green-fa { + color: #51bf51; +} + +.red-fa { + color: #bf5151; +} + +.fa-th, .fa-table { + color: #8787ff; + font-size: 1.2rem; +} + +.os-td { + text-align: center; + vertical-align: middle; +} + +.objects-table td, .objects-table th { + padding: 0.6rem 0.4rem; +} + +.objects-table tr { + transition: ease-in-out 0.4s; +} + +.objects-table tr:hover { + background: #f2f7fb; +} + +.td-text-sml { + font-size: 86%; +} + +.td-text-med { + font-size: 90%; +} + +.td-special-price { + background: #ffd70014; +} + +.td-due-soon { + background: #ff00000f; +} + +.td-not-due-soon { + background: #00ff340f; +} + +.objects-table th:first-child, .objects-table td:first-child { + position: sticky; + left: 0; + background-color: #f6f6f6; +} + +.table-btn { + font-size: 0.8rem; + padding: .01rem 0.6rem; +} + +.td-nowrap { + white-space: nowrap; +} + .tab-pane { margin-top: .8rem } +.mt-1 { + margin-top: 1rem; +} + .input-group-text { color: #2d3032; background-color: #dbe4ee; @@ -1305,7 +1227,7 @@ button.close { .btn-main { color: #f7f7f7; background-color: #5a95f5; - border-color: #3a73cf + border-color: #3a73cf6b } .btn-main:hover, .btn-main:focus, .btn-main:active { @@ -1321,25 +1243,25 @@ button.close { .btn-second { color: #f7f7f7; background-color: #30cfc0; - border-color: #2ea69a + border-color: #2ea69a75 } .btn-second:hover, .btn-second:focus, .btn-second:active { color: #f7f7f7; background-color: #26bdae; - border-color: #2ea69a + border-color: #2ea69a; } .btn-third { color: #f7f7f7; background-color: #f06f6f; - border-color: #df4b4b; + border-color: #df4b4b66; } .btn-third:hover, .btn-third:focus, .btn-third:active { color: #f7f7f7; - background-color: #d05555; - border-color: #a62e2e; + background-color: #e95656; + border-color: #a62e2e8f; } .view-yabs-btn { diff --git a/assets/js/scripts.min.js b/assets/js/scripts.min.js index 774a714..9d5d267 100644 --- a/assets/js/scripts.min.js +++ b/assets/js/scripts.min.js @@ -265,6 +265,93 @@ $(document).on("click", "#addDomainBTN", function () { $("#addSharedHosting").removeClass("show"); }); +$(document).on("click", "#fillIpv4", function () { + var host_name = $('#hostname').val(); + if (host_name) { + $.ajax({ + type: "GET", + url: "get_ip.php", + data: {"type" : "dns_search", "hostname": host_name, "type": "A"}, + success: function (result) { + $('#ipv4').val(result); + } + }); + //Now wait 3 seconds before checking AAAA + setTimeout(function(){ + $.ajax({ + type: "GET", + url: "get_ip.php", + data: {"type" : "dns_search", "hostname": host_name, "type": "AAAA"}, + success: function (result) { + if (result != ''){ + $('#ipv6').val(result); + } else { + $('#ipv6').val(''); + } + } + }); + }, 3000); + } +}); + +$(document).on("click", "#checkUpStatus", function () { + var host_name = $(this).attr('value'); + var icon = $(this).children().first(); + if (host_name) { + $.ajax({ + type: "GET", + url: "check_up.php", + data: {"type": "check_up", "host": host_name}, + success: function (result) { + if (result == 1) { + icon.addClass("green-fa"); + } else { + icon.addClass("red-fa"); + } + } + }); + } +}); + +$(document).on("click", "#viewSwitcherIcon", function () { + var icon = $(this).children().first(); + if ($("#serversTable").children().length == 0){ + $.ajax({ + type: "GET", + url: "calls.php", + data: {"type": "object_tables"}, + success: function (result) { + $("#tableViewDiv").append(result); + } + }); + icon.removeClass("fa-table"); + icon.addClass("fa-th"); + $("#cardsViewDiv" ).hide(); + $("#tableViewDiv" ).show(); + $('#viewSwitchIcon').prop('title', 'Switch to cards'); + } else { + if (icon.hasClass("fa-table")) { + icon.removeClass("fa-table"); + icon.addClass("fa-th"); + $( "#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'); + } + } +}); + +$('#virt').change(function(){ + if($(this).val() == 'DEDI'){ + $('#dedi_cpu').prop("checked", true); + } +}); + function modalServerEdit(id) { $.ajax({ type: "GET", diff --git a/calls.php b/calls.php index 0b71e8d..e3f0dbf 100644 --- a/calls.php +++ b/calls.php @@ -36,6 +36,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif ($_GET['value'] == 'domain') { $idle->viewMoreDomainModal($_GET['id']);//View more details modal } + } elseif ($_GET['type'] == 'dns_search') { + $idle->getIpForDomain($_GET['hostname'], $_GET['type']); + } elseif ($_GET['type'] == 'check_up') { + echo $idle->checkIsUp($_GET['host']); + } elseif ($_GET['type'] == 'object_tables') { + header('Content-Type: text/html; charset=utf-8'); + echo $idle->objectTables(); } } } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -62,7 +69,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif ($_POST['type'] == 'server_modal_edit') {//Update the server info $update->updateServerFromModal(); $update->updateServerPricingFromModal(); - if (!is_null($_POST['me_yabs']) && !empty($_POST['me_yabs'])){ + if (!is_null($_POST['me_yabs']) && !empty($_POST['me_yabs'])) { $update->updateYabsData(); } } elseif ($_POST['type'] == 'shared_hosting_modal_edit') {//Update the shared hosting info diff --git a/class.php b/class.php index db5d040..302fb62 100644 --- a/class.php +++ b/class.php @@ -14,6 +14,9 @@ class idlersConfig const DB_NAME = 'idlers'; const DB_USERNAME = 'root'; const DB_PASSWORD = ''; + + //Have slight background color for server table values: was special price and due soon + const COLOR_TABLE = true; } class elementHelpers extends idlersConfig @@ -153,10 +156,10 @@ class elementHelpers extends idlersConfig $this->tagClose("ul"); } - protected function tableHeader(array $headers) + protected function tableHeader(array $headers, string $class = 'table table-striped table-bordered table-sm', string $id = 'orderTable') { $this->tagOpen('div', 'table-responsive'); - $this->outputString(""); + $this->outputString("
"); $this->tagOpen('thead'); $this->tagOpen('tr'); foreach ($headers as $th) { @@ -165,6 +168,13 @@ class elementHelpers extends idlersConfig $this->outputString(''); } + protected function tableTd(string $class, $content) + { + $this->tagOpen('td', $class); + $this->outputString($content); + $this->tagClose('td'); + } + protected function virtSelectOptions() { $this->selectOption('KVM', 'KVM', true); @@ -198,6 +208,13 @@ class elementHelpers extends idlersConfig $this->selectOption('Triennial (3 years)', '6'); } + protected function domainTermSelectOptions() + { + $this->selectOption('Annual (yearly)', '4', true); + $this->selectOption('Biennial (2 years)', '5'); + $this->selectOption('Triennial (3 years)', '6'); + } + protected function CurrencySelectOptions() { $this->selectOption('AUD', 'AUD'); @@ -578,10 +595,15 @@ class idlers extends helperFunctions $this->navTabs(array('Services', 'Add', 'Order', 'Info', 'Search'), array('#services', '#add_server', '#order', '#info', '#search')); $this->outputString('
'); $this->outputString('
'); + $this->viewSwitcherIcon(); + $this->tagOpen('div', '', 'cardsViewDiv'); $this->serverCards(); $this->sharedHostingCards(); $this->domainCards(); $this->tagClose('div'); + $this->tagOpen('div', '', 'tableViewDiv'); + //Objects tables + $this->tagClose('div', 2); $this->outputString('
'); //BTN Bar $this->rowColOpen('row text-center', 'col-12 btn-bar-col'); @@ -686,13 +708,13 @@ class idlers extends helperFunctions public function serverData(string $id) { - $select = $this->dbConnect()->prepare("SELECT `has_yabs` FROM `servers` WHERE `id` = ? LIMIT 1;"); + $select = $this->dbConnect()->prepare("SELECT `has_yabs`, `has_st` FROM `servers` WHERE `id` = ? LIMIT 1;"); $select->execute([$id]); $row = $select->fetch(); - if ($row['has_yabs'] == 1) { + if ($row['has_yabs'] == 1 && $row['has_st'] == 1) { $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, - is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,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,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 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 @@ -704,6 +726,17 @@ class idlers extends helperFunctions $speed_tests = $sel_st->fetchAll(PDO::FETCH_ASSOC); $final = array_merge($speed_tests, $data); return json_encode($final); + } elseif ($row['has_yabs'] == 1 && $row['has_st'] == 0) { + $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, + 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`, + loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider + FROM servers INNER JOIN disk_speed ds on servers.id = ds.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;"); + $select->execute([$id]); + $data = $select->fetchAll(PDO::FETCH_ASSOC)[0]; + return json_encode($data); } else { $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, @@ -838,10 +871,45 @@ class idlers extends helperFunctions $this->tagClose('div'); } + protected function serverTable() + { + if (self::SRV_SORT_TYPE == 'HOSTNAME_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname` DESC;"); + } elseif (self::SRV_SORT_TYPE == 'HOSTNAME_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `hostname`;"); + } elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since` DESC;"); + } elseif (self::SRV_SORT_TYPE == 'OWNED_SINCE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` ORDER BY `owned_since`;"); + } elseif (self::SRV_SORT_TYPE == 'PRICE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd` DESC;"); + } elseif (self::SRV_SORT_TYPE == 'PRICE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `as_usd`;"); + } elseif (self::SRV_SORT_TYPE == 'DUE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd` DESC;"); + } elseif (self::SRV_SORT_TYPE == 'DUE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers` INNER JOIN `pricing` ON servers.id = pricing.server_id ORDER BY `next_dd`;"); + } else { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `servers`;"); + } + $select->execute(); + $count = $select->rowCount(); + if ($count > 0) { + $this->HTMLPhrase('h4', 'card-section-header', 'Servers ' . $count . ''); + $this->tagOpen('div', 'row'); + $this->tableHeader(array('Hostname', '', '', 'Type', 'CPU', 'RAM', 'Disk', 'Price', 'OS', 'Location', 'Provider', 'Due', 'Owned', 'IPv4', 'IPv6', 'Tags'), 'table objects-table', 'serversTable'); + while ($row = $select->fetch(PDO::FETCH_ASSOC)) { + $this->vpsTableRow($row['id']); + } + $this->outputString('
'); + $this->tagClose('div'); + } + } + protected function vpsCard(string $id) { $select = $this->dbConnect()->prepare(" - SELECT servers.id,servers.hostname,servers.`cpu`,servers.cpu_freq,servers.ram,servers.ram_type,servers.`disk`, + SELECT servers.id,servers.hostname,servers.ipv4,servers.`cpu`,servers.cpu_freq,servers.ram,servers.ram_type,servers.`disk`, servers.disk_type,servers.os,servers.virt,servers.was_special,locations.name as location,providers.name as provider,pricing.price,pricing.currency,pricing.term,pricing.next_dd FROM servers INNER JOIN locations on servers.location = locations.id INNER JOIN providers on servers.provider = providers.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); @@ -856,15 +924,24 @@ class idlers extends helperFunctions $this->HTMLphrase('h4', 'hostname-header', $data['hostname']); $this->tagClose('div'); $this->colOpen('col-12 col-xl-2 os-col'); - $this->outputString($this->osIntToIcon($data['os'])); + (empty($data['ipv4']) || is_null($data['ipv4'])) ? $host = $data['hostname'] : $host = $data['ipv4']; + $this->outputString('' . $this->osIntToIcon($data['os']) . ''); $this->tagClose('div', 3); $this->tagOpen('div', 'card-body'); $this->HTMLphrase('h6', 'price', '$' . $data['price'] . ' ' . $data['currency'] . ' ' . $this->paymentTerm($data['term'])); $this->rowColOpen('row text-center', 'col-12'); - $this->HTMLphrase('h6', 'provider', $data['provider']); + if (is_null($data['provider']) || empty($data['provider'])) { + $this->HTMLphrase('h6', 'provider no-prov', ' '); + } else { + $this->HTMLphrase('h6', 'provider', $data['provider']); + } $this->tagClose('div', 2); $this->rowColOpen('row text-center', 'col-12'); - $this->HTMLphrase('h6', 'location', $data['location']); + if (is_null($data['location']) || empty($data['location'])) { + $this->HTMLphrase('h6', 'location no-loc', ' '); + } else { + $this->HTMLphrase('h6', 'location', $data['location']); + } $this->tagClose('div', 2); $this->rowColOpen('row text-center', 'col-12'); $this->HTMLphrase('p', $dd_class, "Due in {$this->processDueDate($data['id'], $data['term'], $data['next_dd'])} days"); @@ -893,6 +970,206 @@ class idlers extends helperFunctions $this->tagClose('div', 5); } + protected function locationForTable(string $location) + { + if (strpos($location, ',') !== false) { + return explode(',', $location)[0]; + } else { + return $location; + } + } + + public function objectTables() + { + $this->serverTable(); + $this->sharedHostingTable(); + $this->domainTable(); + } + + protected function vpsTableRow(string $id) + { + $select = $this->dbConnect()->prepare(" + SELECT servers.id,servers.hostname,servers.ipv4,servers.ipv6,servers.`cpu`,servers.cpu_freq,servers.ram,servers.ram_type,servers.`disk`, + servers.disk_type,servers.os,servers.virt,servers.tags, DATE_FORMAT(`owned_since`, '%d %b %Y') as dt, servers.was_special,locations.name as location,providers.name as provider,pricing.price,pricing.currency,pricing.term,pricing.next_dd + FROM servers INNER JOIN locations on servers.location = locations.id INNER JOIN providers on servers.provider = providers.id + INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); + $select->execute([$id]); + $data = $select->fetchAll(PDO::FETCH_ASSOC)[0]; + if (self::COLOR_TABLE) { + ($data['was_special'] == 1) ? $special_class = 'td-special-price' : $special_class = ''; + if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) { + $ds_class = 'td-due-soon'; + } elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) { + $ds_class = 'td-not-due-soon'; + } else { + $ds_class = ''; + } + } else { + $special_class = $ds_class = ''; + } + (empty($data['ipv4']) || is_null($data['ipv4'])) ? $host = $data['hostname'] : $host = $data['ipv4']; + $this->tagOpen('tr'); + $this->tableTd('', $data['hostname']); + $this->tableTd('', 'More'); + $this->tableTd('', 'Edit'); + $this->tableTd('td-text-sml', $data['virt']); + $this->tableTd('td-nowrap', $data['cpu'] . '@' . $this->mhzToGhz($data['cpu_freq']) . 'Ghz'); + $this->tableTd('td-nowrap', $data['ram'] . '' . $data['ram_type'] . ''); + $this->tableTd('td-nowrap', $data['disk'] . '' . $data['disk_type'] . ''); + $this->tableTd('td-nowrap ' . $special_class . '', $data['price'] . ' ' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . ''); + $this->tableTd('', '' . $this->osIntToIcon($data['os']) . ''); + $this->tableTd('td-nowrap td-text-med', '
' . $this->locationForTable($data['location']) . '
'); + $this->tableTd('td-nowrap td-text-med', '
' . $data['provider'] . '
'); + $this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '
' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days
'); + $this->tableTd('td-nowrap td-text-sml', '
' . $data['dt'] . '
'); + $this->tableTd('td-nowrap td-text-sml', '
' . $data['ipv4'] . '
'); + $this->tableTd('td-nowrap td-text-sml', '
' . $data['ipv6'] . '
'); + $this->tableTd('td-nowrap td-text-sml', '
' . $data['tags'] . '
'); + $this->tagClose('tr'); + } + + protected function sharedHostingTable() + { + if (self::SH_SORT_TYPE == 'DOMAIN_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain` DESC;"); + } elseif (self::SH_SORT_TYPE == 'DOMAIN_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `domain`;"); + } elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since` DESC;"); + } elseif (self::SH_SORT_TYPE == 'OWNED_SINCE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` ORDER BY `owned_since`;"); + } elseif (self::SH_SORT_TYPE == 'PRICE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd` DESC;"); + } elseif (self::SH_SORT_TYPE == 'PRICE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `as_usd`;"); + } elseif (self::SH_SORT_TYPE == 'DUE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd` DESC;"); + } elseif (self::SH_SORT_TYPE == 'DUE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting` INNER JOIN `pricing` ON shared_hosting.id = pricing.server_id ORDER BY `next_dd`;"); + } else { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `shared_hosting`;"); + } + $select->execute(); + $count = $select->rowCount(); + if ($count > 0) { + $this->HTMLPhrase('h4', 'card-section-header mt-1', 'Shared hosting ' . $count . ''); + $this->tagOpen('div', 'row'); + $this->tableHeader(array('Domain', '', '', 'Type', 'Disk', 'Price', 'Location', 'Provider', 'Due', 'BWidth', 'Domains', 'Emails', 'FTPs', 'DBs', 'Since'), 'table objects-table', 'sharedHostingTable'); + while ($row = $select->fetch(PDO::FETCH_ASSOC)) { + $this->sharedHostingTableRow($row['id']); + } + $this->outputString(''); + $this->tagClose('div'); + } + } + + protected function domainTable() + { + if (self::DC_SORT_TYPE == 'DOMAIN_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain` DESC;"); + } elseif (self::DC_SORT_TYPE == 'DOMAIN_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `domain`;"); + } elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since` DESC;"); + } elseif (self::DC_SORT_TYPE == 'OWNED_SINCE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` ORDER BY `owned_since`;"); + } elseif (self::DC_SORT_TYPE == 'PRICE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd` DESC;"); + } elseif (self::DC_SORT_TYPE == 'PRICE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `as_usd`;"); + } elseif (self::DC_SORT_TYPE == 'DUE_DESC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd` DESC;"); + } elseif (self::DC_SORT_TYPE == 'DUE_ASC') { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains` INNER JOIN `pricing` ON domains.id = pricing.server_id ORDER BY `next_dd`;"); + } else { + $select = $this->dbConnect()->prepare("SELECT `id` FROM `domains`;"); + } + $select->execute(); + $count = $select->rowCount(); + if ($count > 0) { + $this->HTMLPhrase('h4', 'card-section-header mt-1', 'Domains ' . $count . ''); + $this->tagOpen('div', 'row'); + $this->tableHeader(array('Domain', '', '', 'NS1', 'NS2', 'Price', 'Provider', 'Due', 'Since'), 'table objects-table', 'domainsTable'); + while ($row = $select->fetch(PDO::FETCH_ASSOC)) { + $this->domainTableRow($row['id']); + } + $this->outputString(''); + $this->tagClose('div'); + } + } + + protected function domainTableRow(string $id) + { + $select = $this->dbConnect()->prepare(" + SELECT domains.id,domains.domain,domains.attached_to,domains.ns1,domains.ns2,DATE_FORMAT(`owned_since`, '%d %b %Y') as dt,providers.name as provider, pricing.price,pricing.currency,pricing.term,pricing.next_dd + FROM domains INNER JOIN providers on domains.provider = providers.id + INNER JOIN pricing on domains.id = pricing.server_id WHERE domains.id = ? LIMIT 1;"); + $select->execute([$id]); + $data = $select->fetchAll(PDO::FETCH_ASSOC)[0]; + if (self::COLOR_TABLE) { + if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) { + $ds_class = 'td-due-soon'; + } elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) { + $ds_class = 'td-not-due-soon'; + } else { + $ds_class = ''; + } + } else { + $ds_class = ''; + } + $this->tagOpen('tr'); + $this->tableTd('td-nowrap', $data['domain']); + $this->tableTd('', 'More'); + $this->tableTd('', 'Edit'); + $this->tableTd('td-nowrap', '' . $data['ns1'] . ''); + $this->tableTd('td-nowrap', '' . $data['ns2'] . ''); + $this->tableTd('td-nowrap', $data['price'] . ' ' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . ''); + $this->tableTd('td-nowrap td-text-med', '
' . $data['provider'] . '
'); + $this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '
' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days
'); + $this->tableTd('td-nowrap', $data['dt']); + $this->tagClose('tr'); + } + + protected function sharedHostingTableRow(string $id) + { + $select = $this->dbConnect()->prepare(" + SELECT shared_hosting.id,shared_hosting.domain,shared_hosting.type,shared_hosting.was_special,shared_hosting.disk,shared_hosting.disk_type,shared_hosting.bandwidth,shared_hosting.domains_limit,shared_hosting.emails, + shared_hosting.ftp,shared_hosting.db,DATE_FORMAT(`owned_since`, '%d %b %Y') as dt,locations.name as location,providers.name as provider,pricing.price,pricing.currency,pricing.term,pricing.next_dd + FROM shared_hosting INNER JOIN locations on shared_hosting.location = locations.id INNER JOIN providers on shared_hosting.provider = providers.id + INNER JOIN pricing on shared_hosting.id = pricing.server_id WHERE shared_hosting.id = ? LIMIT 1;"); + $select->execute([$id]); + $data = $select->fetchAll(PDO::FETCH_ASSOC)[0]; + if (self::COLOR_TABLE) { + ($data['was_special'] == 1) ? $special_class = 'td-special-price' : $special_class = ''; + if ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) < 7) { + $ds_class = 'td-due-soon'; + } elseif ($this->processDueDate($data['id'], $data['term'], $data['next_dd']) > 300) { + $ds_class = 'td-not-due-soon'; + } else { + $ds_class = ''; + } + } else { + $special_class = $ds_class = ''; + } + $this->tagOpen('tr'); + $this->tableTd('td-nowrap', $data['domain']); + $this->tableTd('', 'More'); + $this->tableTd('', 'Edit'); + $this->tableTd('td-nowrap td-text-sml', $data['type']); + $this->tableTd('td-nowrap', $data['disk'] . '' . $data['disk_type'] . ''); + $this->tableTd('td-nowrap ' . $special_class . '', $data['price'] . ' ' . $data['currency'] . ' ' . $this->paymentTerm($data['term']) . ''); + $this->tableTd('td-nowrap td-text-med', '
' . $this->locationForTable($data['location']) . '
'); + $this->tableTd('td-nowrap td-text-med', '
' . $data['provider'] . '
'); + $this->tableTd('td-nowrap td-text-sml ' . $ds_class . '', '
' . $this->processDueDate($data['id'], $data['term'], $data['next_dd']) . ' days
'); + $this->tableTd('td-nowrap', $data['bandwidth'] . 'TB'); + $this->tableTd('td-nowrap', $data['domains_limit']); + $this->tableTd('td-nowrap', $data['emails']); + $this->tableTd('td-nowrap', $data['ftp']); + $this->tableTd('td-nowrap', $data['db']); + $this->tableTd('td-nowrap', $data['dt']); + $this->tagClose('tr'); + } + protected function SharedHostingCard(string $id) { $select = $this->dbConnect()->prepare(" @@ -1168,7 +1445,7 @@ class idlers extends helperFunctions $this->outputString('
'); $this->rowColOpen('form-row', 'col-8'); - $this->outputString(''); + $this->outputString(''); $this->tagClose('div'); $this->colOpen('col-4'); $this->outputString(''); @@ -1285,7 +1562,7 @@ class idlers extends helperFunctions $this->outputString(''); $this->rowColOpen('form-row', 'col-8'); - $this->outputString(''); + $this->outputString(''); $this->tagClose('div'); $this->colOpen('col-4'); $this->outputString(''); @@ -1318,7 +1595,7 @@ class idlers extends helperFunctions $this->tagOpen('div', 'input-group'); $this->inputPrepend('Term'); $this->selectElement('d_me_term'); - $this->termSelectOptions(); + $this->domainTermSelectOptions(); $this->tagClose('select'); $this->tagClose('div', 3); @@ -1640,6 +1917,7 @@ class idlers extends helperFunctions $this->tagOpen('div', 'input-group'); $this->inputPrepend('Hostname'); $this->textInput('hostname', '', 'form-control', true, 1, 124); + $this->outputString('
'); $this->tagClose('div', 2); $this->colOpen('col-12 col-md-4'); $this->tagOpen('div', 'input-group'); @@ -1680,7 +1958,7 @@ class idlers extends helperFunctions $this->rowColOpen('form-row', 'col-12 col-md-6'); $this->tagOpen('div', 'input-group'); $this->inputPrepend('IPv4'); - $this->textInput('ipv4', '', 'form-control', true, 4, 124); + $this->textInput('ipv4', '', 'form-control', false, 4, 124); $this->tagClose('div', 2); $this->colOpen('col-12 col-md-6'); $this->tagOpen('div', 'input-group'); @@ -1724,7 +2002,8 @@ class idlers extends helperFunctions $this->rowColOpen('form-row', 'col-12 col-md-6'); $this->tagOpen('div', 'input-group'); $this->inputPrepend('Bandwidth'); - $this->numberInput('bandwidth', '', 'form-control', false, 1, 99999, 'any'); + $this->numberInput('bandwidth', '4', 'form-control', false, '0.5', 99999, '0.5'); + $this->outputString('
TB
'); $this->tagClose('div', 2); $this->colOpen('col-12 col-md-6'); $this->tagOpen('div', 'input-group'); @@ -1884,6 +2163,7 @@ class idlers extends helperFunctions $ipv6 = $data['ipv6']; } ($data['has_yabs'] == 1) ? $has_yabs = true : $has_yabs = false; + ($data['has_st'] == 1) ? $has_st = true : $has_st = false; $this->tagOpen('div', 'modal-header'); $this->HTMLphrase('h4', 'modal-title w-100', $data['hostname'], 'view_more_header'); $this->outputString(''); @@ -2102,7 +2382,7 @@ class idlers extends helperFunctions $this->colOpen('col-2'); $this->HTMLphrase('p', 'm-value', $data['virt']); $this->tagClose('div', 2); - if ($has_yabs) { + if ($has_yabs && $has_st) { $this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->HTMLphrase('p', 'm-section-text', 'Network test'); $this->tagClose('div', 2); @@ -2130,7 +2410,7 @@ class idlers extends helperFunctions $this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->htmlPhrase('p', 'm-section-text', 'Notes'); $this->outputString("