Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/cxs/3/install.php |
<?php
/*
function __cxs_requirements(){
}
function __cxs_postinstall(){
}
*/
function __cxs_preinstall(){
global $softpanel, $globals;
vexec('wget -O '.CXS_WAPP.'/cxs-'.$globals['arch'].'.tar.gz https://download.configserver.com/cxsinstaller.tgz');
vexec('cd '.CXS_WAPP.'; tar -zxf '.CXS_WAPP.'/cxs-x86_64.tar.gz');
}
function __cxs_install(){
global $globals, $error, $softpanel, $infos, $iapps, $sysmlink_created;
$iptype = 'ipv4';
if(empty($globals['WU_PRIMARY_IP']) && !empty($globals['WU_PRIMARY_IPV6'])){
$iptype = 'ipv6';
}
$sysmlink_created = '';
if(!file_exists('/usr/include/xlocale.h')){
$sysmlink_created = 1;
symlink('/usr/include/locale.h', '/usr/include/xlocale.h');
}
vexec('yes | /usr/local/apps/perl/bin/cpan install Net::SSLeay LWP::UserAgent LWP::Protocol::https Archive::Tar Archive::Zip Linux::Inotify2');
vexec('yes | /usr/local/apps/perl/bin/cpan install Compress::Zlib SQLite DBI DBD::SQLite');
vexec('yes | /usr/local/apps/perl/bin/cpan install IO::Socket::SSL Time::HiRes HTML::HeadParser');
vexec('cd '.CXS_WAPP.'; perl cxsinstaller.pl '.$iptype);
vexec('rm -rf '.CXS_APP);
// Move the CONF Files
//copy(CXS_WAPP.'/index.cgi', '/etc/cxs/webmin/cxs/index.cgi');
// Make the directories
mkdir($globals['web_admin'].'/cxs', 0755);
symlink(CXS_WAPP.'/index.php', $globals['web_admin'].'/cxs/index.php');
vexec('cp -a /etc/cxs/webmin/cxs/images/ '.$globals['web_admin'].'/cxs/images');
vexec('chmod -R 0755 '.$globals['web_admin'].'/cxs/images');
vexec('chmod 0755 '.CXS_WAPP.'/index.cgi');
symlink('/etc/cxs/cxsdaily.sh', '/etc/cron.daily/cxsdaily');
symlink(CXS_WAPP.'/admin_locations_cxs.conf', $globals['path'].'/conf/webuzo/emps/admin_locations_cxs.conf');
$post = [];
$post[] = 'vendor_conf_url=https://download.configserver.com/waf/meta_configserver.yaml';
$post[] = 'add_vendor=1';
// Add modsecurity rules
$cmd = 'webuzo --api act=add_modsec_vendors '.implode(' ', $post);
exec($cmd, $out, $ret);
$resp = json_decode(implode('', $out), true);
}
function __cxs_configure(){
global $webuzo, $error, $softpanel, $infos, $iapps, $globals, $sysmlink_created;
// Restart Webuzo service
vexec('(sleep 5 && service webuzo restart) > /dev/null 2>&1 &');
if(!empty($sysmlink_created)){
@unlink('/usr/include/xlocale.h');
}
}