Seriously Devs. It's not that hard if you would be willing to expand basedir
sed -i "s@fastcgi_param PHP_ADMIN_VALUE \"open_basedir =/home@fastcgi_param PHP_ADMIN_VALUE \"open_basedir =/usr/local/apache/domlogs/:/home@g" /root/cwpsrv/conf.d/users/*.conf
cwpsrv -s reload
cp -R /usr/local/cwpsrv/var/services/users/cwp_theme/origional /usr/local/cwpsrv/var/services/users/cwp_theme/modified/
// PHP Section /usr/local/cwpsrv/var/services/user_files/modules/php_error.php
<?php
if (isset($_GET["loadfile"])) {
if (file_exists("/usr/local/apache/domlogs/{$_GET["loadfile"]}.error.log")) {
echo $content = file_get_contents("/usr/local/apache/domlogs/{$_GET["loadfile"]}.error.log");
} else {
echo "No File Found";
};
exit;
}
// Replace this with built in code to populate domains and subdomains //
//use API to get list of users
$mod["returl"] = $_SERVER['REQUEST_URI'];
$data = array("key" => "(SET YOUR API KEY HERE)","action"=>'list',"user"=>$_SESSION ['username']);
$url = "https://{$_SERVER['SERVER_NAME']}:2304/v1/accountdetail";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
$domains = array();
$mod['select'] = array();
foreach ($response->result->domains as $key) {
$domains[] = trim($key->domain);
}
foreach ($response->result->subdomins as $key) {
$domains[] = trim($key->subdomain .".". $key->domain);
}
foreach ($domains as $domain) {
$mod['select'][] = $domain;
}
if (file_exists("/usr/local/apache/domlogs/{$domains[0]}.error.log")) {
$mod['file'] = file_get_contents("/usr/local/apache/domlogs/{$domains[0]}.error.log");
} else {
$mod['file'] = "No File Found";
};
?>
HTML /usr/local/cwpsrv/var/services/users/cwp_theme/modified/mod_php_error.html <<< YOu might want to copy origional to modified so it doesn't go bye bye
<div class="row">
<div class="col-lg-12">
<h1>Error Log</h1>
</div>
<div>
/usr/local/apache/domlogs/
<form action="{{mod.returl}}" action="get"><select id="loadfile">
{% for option in mod.select %}
<option>{{ option }}</option>
{% endfor %}
</select><noscript><input type="submit" value="Change"></noscript></form>
<textarea id="logfile" readonly style="width:800px; height:400px">{{mod.file}}</textarea>
</div>
</div>
javascript /usr/local/cwpsrv/var/services/users/cwp_theme/modified/js/modules/php_error.js.twig
(function($){
$(document).ready(function() {
$("#loadfile").change(function() {
$.get( "{{mod.returl}}", { loadfile: $("#loadfile").val() },"text" )
.done(function( data ) {
if (data == "") data = "Congratulations! No PHP Errors were logged";
$("#logfile").text(data);
});
});
});
})(jQuery);
INI File /usr/local/cwpsrv/var/services/users/cwp_lang/en/php_error.ini
SOMETHING="Nobody Really Cares"
Edit file /usr/local/cwpsrv/var/services/users/cwp_theme/modified/menu_left.html
find (~ Line 62)
{% if ("statistics" in rmenu )or(swmenu==1) %}
<li class="search"><a href="?module=statistics">{{langene.GNLABEL51}}</a></li>
{% endif %}
add after
<li class="search"><a href="?module=php_error">PHP Error Log</a></li>