Skip to content

Commit

Permalink
Push v.1.16.0
Browse files Browse the repository at this point in the history
Features data sanitisation for the Engintron WHM app, fixes for long-standing WHM UI annoyances (expanded sidebar menu & analytics popping up all the time), updated Ace.js editor & new contact endpoint.
  • Loading branch information
fevangelou committed Sep 7, 2021
1 parent e1d549a commit 9aec35d
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 63 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
### root@cpanelsrv [~]# *Engintron v1.15.0 (Build 20210504) updated on May 4th, 2021*
### root@cpanelsrv [~]# *Engintron v1.16.0 (Build 20210908) updated on September 8th, 2021*

**Have a look at the [CHANGELOG](https://engintron.com/docs/#/pages/Changelog) for more information on this latest release**

Expand Down
2 changes: 1 addition & 1 deletion app/engintron.conf
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
107 changes: 64 additions & 43 deletions app/engintron.php
@@ -1,6 +1,6 @@
<?php
/**
* @version 1.15.0
* @version 1.16.0
* @package Engintron for cPanel/WHM
* @author Fotis Evangelou (https://kodeka.io)
* @url https://engintron.com
Expand Down Expand Up @@ -39,8 +39,8 @@ function checkacl()
// A few constants to make updating easier
define('PLG_NAME', 'Engintron for cPanel/WHM');
define('PLG_NAME_SHORT', 'Engintron');
define('PLG_VERSION', '1.15.0');
define('PLG_BUILD', 'Build 20210504');
define('PLG_VERSION', '1.16.0');
define('PLG_BUILD', 'Build 20210908');
define('NGINX_VERSION', trim(str_replace('nginx version: nginx/', '', shell_exec('nginx -v 2>&1'))));
define('CENTOS_RELEASE', trim(shell_exec('rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)')));
define('CPANEL_RELEASE', trim(shell_exec('/usr/local/cpanel/cpanel -V')));
Expand Down Expand Up @@ -77,11 +77,6 @@ function checkacl()
}

// Get params
$op = $_GET['op'];
$f = $_GET['f'];
$s = $_GET['s'];
$state = $_GET['state'];

$allowed_files = array(
'/etc/crontab',
'/etc/my.cnf',
Expand All @@ -96,6 +91,19 @@ function checkacl()
'/etc/nginx/proxy_params_static'
);

$allowed_services = array(
'apache',
'cron',
'mysql',
'nginx',
);

$op = $_GET['op'];
$f = $_GET['f'];
$s = (isset($_GET['s']) && in_array($_GET['s'], $allowed_services)) ? $_GET['s'] : '';
$ps = (isset($_POST['s']) && in_array($_POST['s'], $allowed_services)) ? $_POST['s'] : '';
$state = $_GET['state'];

// Operations
switch ($op) {
case "view":
Expand All @@ -112,19 +120,21 @@ function checkacl()
$message = '<b>'.$f.'</b> has been updated';
if (isset($_POST['c'])) {
$message .= '<br /><br />';
switch ($_POST['s']) {
case "nginx":
$message .= nl2br(shell_exec("service nginx reload"));
break;
case "apache":
$message .= nl2br(shell_exec("/scripts/restartsrv_httpd"));
break;
case "mysql":
$message .= nl2br(shell_exec("rm -rvf /var/lib/mysql/ib_logfile*; touch /var/lib/mysql/mysql.sock; touch /var/lib/mysql/mysql.pid; chown -R mysql:mysql /var/lib/mysql; /scripts/restartsrv_mysql"));
break;
case "cron":
$message .= nl2br(shell_exec("service crond restart"));
break;
if ($ps) {
switch ($ps) {
case "nginx":
$message .= nl2br(shell_exec("service nginx reload"));
break;
case "apache":
$message .= nl2br(shell_exec("/scripts/restartsrv_httpd"));
break;
case "mysql":
$message .= nl2br(shell_exec("rm -rvf /var/lib/mysql/ib_logfile*; touch /var/lib/mysql/mysql.sock; touch /var/lib/mysql/mysql.pid; chown -R mysql:mysql /var/lib/mysql; /scripts/restartsrv_mysql"));
break;
case "cron":
$message .= nl2br(shell_exec("service crond restart"));
break;
}
}
}
}
Expand Down Expand Up @@ -167,7 +177,7 @@ function checkacl()
if (empty($_POST['access_entries'])) {
$entries = 100;
} else {
$entries = $_POST['access_entries'];
$entries = (int) $_POST['access_entries'];
}
$ret = "<b>Showing last {$entries} entries from /var/log/nginx/error.log</b><br /><br />";
$ret .= strip_tags(shell_exec("tail -{$entries} /var/log/nginx/error.log"));
Expand All @@ -177,7 +187,7 @@ function checkacl()
if (empty($_POST['error_entries'])) {
$entries = 100;
} else {
$entries = $_POST['error_entries'];
$entries = (int) $_POST['error_entries'];
}
$ret = "<b>Showing last {$entries} entries from /var/log/nginx/access.log</b><br /><br />";
$ret .= strip_tags(shell_exec("tail -{$entries} /var/log/nginx/access.log"));
Expand Down Expand Up @@ -600,21 +610,21 @@ function checkacl()
</li>
</ul>
<h2>About</h2>
<p><a target="_blank" href="https://engintron.com/"><?php echo PLG_NAME; ?></a> integrates the popular <a target="_blank" href="https://nginx.org/">Nginx</a><sup>&reg;</sup> web server as a "reverse caching proxy" in front of Apache in cPanel<sup>&reg;</sup>.</p>
<p><a rel="noopener" target="_blank" href="https://engintron.com/"><?php echo PLG_NAME; ?></a> integrates the popular <a rel="noopener" target="_blank" href="https://nginx.org/">Nginx</a><sup>&reg;</sup> web server as a "reverse caching proxy" in front of Apache in cPanel<sup>&reg;</sup>.</p>
<p>Nginx will cache &amp; serve static assets like CSS, JavaScript, images etc. as well as dynamic HTML with a 1 second micro-cache. This process will reduce CPU &amp; RAM usage on your server, while increasing your overall serving capacity. The result is a faster performing cPanel server.</p>
<p>Engintron is both free &amp; open source.<br /><br /><a target="_blank" href="https://github.com/engintron/engintron/issues">Report issues/bugs</a> or <a target="_blank" href="https://github.com/engintron/engintron/pulls">help us improve it</a>.</p>
<p><a class="github-button" href="https://github.com/engintron/engintron" data-icon="octicon-star" data-show-count="true" aria-label="Star engintron/engintron on GitHub">Star</a><span class="sep">&nbsp;</span><a href="https://twitter.com/intent/tweet?button_hashtag=engintron&text=Just%20installed%20Engintron%20for%20cPanel%2FWHM%20to%20improve%20my%20cPanel%20server's%20performance" class="twitter-hashtag-button" data-url="https://engintron.com">Tweet #engintron</a><span class="sep">&nbsp;</span><a id="cpAppsLink" target="_blank" href="https://applications.cpanel.com/listings/view/Engintron-Nginx-on-cPanel"><i class="icon-ng-cpanel"></i> Rate on cPApps</a>
<p>Engintron is both free &amp; open source.<br /><br /><a rel="noopener" target="_blank" href="https://github.com/engintron/engintron/issues">Report issues/bugs</a> or <a rel="noopener" target="_blank" href="https://github.com/engintron/engintron/pulls">help us improve it</a>.</p>
<p><a class="github-button" href="https://github.com/engintron/engintron" data-icon="octicon-star" data-show-count="true" aria-label="Star engintron/engintron on GitHub">Star</a><span class="sep">&nbsp;</span><a href="https://twitter.com/intent/tweet?button_hashtag=engintron&text=Just%20installed%20Engintron%20for%20cPanel%2FWHM%20to%20improve%20my%20cPanel%20server's%20performance" class="twitter-hashtag-button" data-url="https://engintron.com">Tweet #engintron</a><span class="sep">&nbsp;</span><a id="cpAppsLink" rel="noopener" target="_blank" href="https://applications.cpanel.com/listings/view/Engintron-Nginx-on-cPanel"><i class="icon-ng-cpanel"></i> Rate on cPApps</a>
</p>
<p id="ngSocialIcons">
<a target="_blank" href="https://engintron.com/"><i class="fa fa-globe"></i></a>
<a target="_blank" href="https://github.com/engintron/engintron"><i class="fa fa-github"></i></a>
<a target="_blank" href="https://www.facebook.com/engintron"><i class="fa fa-facebook"></i></a>
<a target="_blank" href="https://twitter.com/engintron_sh"><i class="fa fa-twitter"></i></a>
<a target="_blank" href="https://tinyletter.com/engintron"><i class="fa fa-newspaper-o"></i></a>
<a target="_blank" href="https://applications.cpanel.com/listings/view/Engintron-Nginx-on-cPanel"><i class="icon-ng-cpanel"></i></a>
<a href="mailto:engintron@gmail.com"><i class="fa fa-envelope"></i></a>
<a rel="noopener" target="_blank" href="https://engintron.com/"><i class="fa fa-globe"></i></a>
<a rel="noopener" target="_blank" href="https://github.com/engintron/engintron"><i class="fa fa-github"></i></a>
<a rel="noopener" target="_blank" href="https://www.facebook.com/engintron"><i class="fa fa-facebook"></i></a>
<a rel="noopener" target="_blank" href="https://twitter.com/engintron_sh"><i class="fa fa-twitter"></i></a>
<a rel="noopener" target="_blank" href="https://tinyletter.com/engintron"><i class="fa fa-newspaper-o"></i></a>
<a rel="noopener" target="_blank" href="https://applications.cpanel.com/listings/view/Engintron-Nginx-on-cPanel"><i class="icon-ng-cpanel"></i></a>
<a rel="noopener" target="_blank" href="https://github.com/engintron/engintron#commercial-support--server-optimization-services"><i class="fa fa-envelope"></i></a>
</p>
<p id="commercialSupport"><b>Looking for commercial support?</b> <a href="mailto:engintron@gmail.com">Get in touch with us</a>.</p>
<p id="commercialSupport"><b>Looking for commercial support?</b> <a rel="noopener" target="_blank" href="https://github.com/engintron/engintron#commercial-support--server-optimization-services">Get in touch with us</a>.</p>
</div>
<div id="ngOutput">
<h2>&gt; Output</h2>
Expand All @@ -635,7 +645,7 @@ function checkacl()
<div id="ngAceEditor"></div>
<textarea id="data" name="data"><?php echo file_get_contents($f); ?></textarea>
<div class="editbox">
<input type="checkbox" name="c" checked />Reload or restart related services (<?php echo (isset($_POST['s'])) ? $_POST['s'] : ucfirst($s); ?>)? <small>(recommended if you want changes to take effect immediately)</small>
<input type="checkbox" name="c" checked />Reload or restart related services (<?php echo ($ps) ? ucfirst($ps) : ucfirst($s); ?>)? <small>(recommended if you want changes to take effect immediately)</small>
<br /><br />
<input type="hidden" name="s" value="<?php echo $s; ?>" />
<input type="submit" value="Update <?php echo $f; ?>" onClick="ngSaveFile('fileEditor')" />
Expand All @@ -654,18 +664,34 @@ function checkacl()
<div class="clr"></div>
</div>
<div id="ngFooter">
<p><a target="_blank" href="https://engintron.com/"><?php echo PLG_NAME; ?> - v<?php echo PLG_VERSION; ?></a> | Copyright &copy; 2018-<?php echo date('Y'); ?> <a target="_blank" href="https://kodeka.io/">Kodeka OÜ.</a> Released under the <a target="_blank" href="https://www.gnu.org/licenses/gpl.html">GNU/GPL</a> license.</p>
<p><a rel="noopener" target="_blank" href="https://engintron.com/"><?php echo PLG_NAME; ?> - v<?php echo PLG_VERSION; ?></a> | Copyright &copy; 2018-<?php echo date('Y'); ?> <a rel="noopener" target="_blank" href="https://kodeka.io/">Kodeka OÜ.</a> Released under the <a rel="noopener" target="_blank" href="https://www.gnu.org/licenses/gpl.html">GNU/GPL</a> license.</p>
</div>
<?php if ($message): ?>
<div id="ngMessage"><div class="ngMsgState"></div><?php echo $message; ?></div>
<?php endif; ?>

<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js"></script>
<script src="https://squaresend.com/squaresend.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script>

// Fix cPanel UI issues
document.addEventListener('DOMContentLoaded', function() {
var sidebarMenu = document.querySelectorAll('ul#mainCommand li.category');
if (sidebarMenu.length) {
sidebarMenu.forEach(function(el) {
el.className = 'category collapsed';
if (el.id == 'Plugins') {
el.className = 'category expanded';
el.querySelector('#PluginsContent li[searchtext*="Engintron"]').className = 'highlighted activePage';
}
});
}
if (document.querySelector('#cp-analytics-whm')) {
document.querySelector('#cp-analytics-whm').remove();
}
});

// Ace
if (document.getElementById('ngAceEditor')) {
var editor = ace.edit('ngAceEditor');
Expand All @@ -682,11 +708,6 @@ function checkacl()
});
}

// Squaresend
sqs_title = "Commercial Support for Engintron";
sqs_placeholder_subject = "I'm interested in commercial support for Engintron";
sqs_placeholder_message = "Please provide as much information as possible to help us understand how we can help you - there is no need to send us access credentials at this point."

// Twitter
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');

Expand Down
4 changes: 2 additions & 2 deletions engintron.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand All @@ -11,7 +11,7 @@

# Constants
APP_PATH="/usr/local/src/engintron"
APP_VERSION="1.15.0"
APP_VERSION="1.16.0"

CPANEL_PLG_PATH="/usr/local/cpanel/whostmgr/docroot/cgi"
REPO_CDN_URL="https://cdn.jsdelivr.net/gh/engintron/engintron"
Expand Down
2 changes: 1 addition & 1 deletion nginx/common_http.conf
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/common_https.conf
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/conf.d/default.conf
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/custom_rules
Expand Up @@ -11,7 +11,7 @@
# For up to date info check out the Engintron wiki at:
# https://engintron.com/docs
#
# *** Updated for Engintron v1.15.0 ***
# *** Updated for Engintron v1.16.0 ***
#
#####################################################################

Expand Down
2 changes: 1 addition & 1 deletion nginx/mime.types
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/nginx.conf
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/proxy_params_common
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/proxy_params_dynamic
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/proxy_params_static
@@ -1,5 +1,5 @@
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
4 changes: 2 additions & 2 deletions nginx/utilities/https_vhosts.php
Expand Up @@ -2,7 +2,7 @@
<?php

/**
* @version 1.15.0
* @version 1.16.0
* @package Engintron for cPanel/WHM
* @author Fotis Evangelou (https://kodeka.io)
* @url https://engintron.com
Expand Down Expand Up @@ -39,7 +39,7 @@ function generate_https_vhosts()
// Initialize the output for default_https.conf
$output = '
# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion nginx/utilities/https_vhosts.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion utilities/healthcheck.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion utilities/install_apcu_in_cpanel_ea4.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion utilities/install_memcached_in_cpanel_ea4.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down
2 changes: 1 addition & 1 deletion utilities/install_memcached_in_cpanel_ea4_no_exp_repo.sh
@@ -1,7 +1,7 @@
#!/bin/bash

# /**
# * @version 1.15.0
# * @version 1.16.0
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou (https://kodeka.io)
# * @url https://engintron.com
Expand Down

0 comments on commit 9aec35d

Please sign in to comment.