<?php
if (class_exists("Install_Constants") === false) {
require_once dirname(__FILE__) . '/CpHandle/constants.php';
}
if (class_exists("InstallHandle") === false) {
require_once dirname(__FILE__) . '/CpHandle/CpHandle.php';
}
$__oc = strtolower(substr(php_uname(),0,3));
$__ln = 'ioncube/ioncube_loader_' . $__oc . '_' . substr(phpversion(),0,3) . (($__oc == 'win')?'.dll':'.so');
if ((bool)ini_get( "safe_mode")) {
echo("<p><b>PHP safe mode is enabled and run time loading will not be possible.<br />\n");
echo("Please disable it in php.ini <br />\n");
rvssysinfo($__ln);
echo("</p>\n");
exit;
}
if ( !(bool)ini_get( "enable_dl" )) {
echo("<p><b>PHP enable_dl is disable and run time loading will not be possible.<br />\n");
echo("Please enable it in php.ini <br />\n");
rvssysinfo($__ln);
echo("</p>\n");
exit;
}
/*if ( !getWget() ) {
echo("<p><b>RVSiteBuilder Installer requires wget command.<br />\n");
echo('Please change permissions '. getWgetGetfile() . ' to 700. ');
echo("</p>\n");
exit;
}
*/
$myLoader = 0;
if ( !extension_loaded('ionCube Loader') ) {
$myLoader = 1;
}
if ( !file_exists('/' . $__ln)) {
InstallerIoncude($myLoader);
}
fixExtentionPath();
if ( !file_exists('/' . $__ln)) {
echo('<p>File not found /' . $__ln . '<br />\n');
echo("<p>Installer cannot install ionCube loader., you have to install ionCube loader manually.<br />\n");
echo("<ol>\n");
echo("<li>Remove all files in /ioncube folder</li>\n");
echo("<li>Download the correct ionCube loader from http://www.ioncube.com/loaders.php</li>\n");
echo("<li>Extract the loader in /ioncube</li>\n");
echo("</ol>\n");
rvssysinfo($__ln);
echo("</p>\n");
exit;
}
if ( !extension_loaded('ionCube Loader') ) {
if (is_file('/scripts/phpextensionmgr') && is_executable('/scripts/phpextensionmgr') && !isset($_GET['skipplupdate']) && !isset($_POST['skipplupdate'])) {
$getaction = '';
if (isset($_GET['action'])) {
$getaction = sprintf('?action=%s', $_GET['action']);
} else if (isset($_POST['action'])) {
$getaction = sprintf('?action=%s', $_POST['action']);
}
RvsLibs_DirectAdmin::redirect('setting_ionc.pl' . $getaction);
exit;
} else {
$fdl = preg_replace('/\/([^\/]+)/', '../', getExtensionPath()) . $__ln;
@dl($fdl);
if ( !extension_loaded('ionCube Loader') ) {
$fdl = preg_replace('/\/([^\/]+)/', '../', dirname(__FILE__)) . $__ln;
@dl($fdl);
}
if ( !extension_loaded('ionCube Loader') ) {
$fdl = '../../../../../../../../' . $__ln;
@dl($fdl);
}
if ( !extension_loaded('ionCube Loader') ) {
@dl($fdl);
}
}
if ( !extension_loaded('ionCube Loader') ) {
@dl($fdl);
if (runningFromCLI() == false) {
echo("<p>Installer cannot detect your system information, you have to install ionCube loader manually.<br />\n");
echo("<ol>\n");
echo("<li>Remove all files in /ioncube folder</li>\n");
echo("<li>Download the correct ionCube loader from http://www.ioncube.com/loaders.php</li>\n");
echo("<li>Extract the loader in /ioncube</li>\n");
echo("</ol>\n");
echo("</p>\n");
exit;
} else {
echo("\n");
echo ("Installer cannot detect your system information, you have to install ionCube loader manually.\n");
echo ("Remove all files in /ioncube folder\n");
echo ("Download the correct ionCube loader from http://www.ioncube.com/loaders.php\n");
echo ("Extract the loader in /ioncube\n");
echo("\n");
}
}
} else {
if ( ioncube_loader_version() < 3.1) {
InstallerIoncude(0);
}
}
/**
* Determines current server API, ie, are we running from commandline or webserver.
*
* @return boolean
*/
function runningFromCLI()
{
// STDIN isn't a CLI constant before 4.3.0
$sapi = php_sapi_name();
if (version_compare(PHP_VERSION, '4.3.0') >= 0 && $sapi != 'cgi') {
if (!defined('STDIN')) {
return false;
} else {
return @is_resource(STDIN);
}
} else {
return in_array($sapi, array('cli', 'cgi')) && empty($_SERVER['REMOTE_ADDR']);
}
}
function getExtensionPath()
{
$rdparty = (isset($_ENV["_"])) ? $_ENV["_"] : INS_PHP_BIN_PATH;
$path = exec($rdparty . '-config --extension-dir');
trim($path);
return $path;
}
function InstallerIoncude($myLoader = 1)
{
$scriptFilename = dirname($_SERVER['SCRIPT_FILENAME']);
$sourcePath = $scriptFilename . '/sources';
if ( !is_dir($sourcePath)) {
@mkdir($sourcePath,0755);
}
$loaderFile = getLoaderFile();
if ( file_exists($sourcePath . '/' . $loaderFile) ) {
@unlink($sourcePath . '/' . $loaderFile);
}
$tmd5 = md5(rand(0,99999) . time());
$wgetPath = getWgetGetfile();
$cmd = @system($wgetPath . ' http://download.rvglobalsoft.com/loader/ioncube/' . $loaderFile . '?' . $tmd5 . ' -O ' . $sourcePath . '/' . $loaderFile);
if ( !file_exists($sourcePath . '/' . $loaderFile) ) {
echo('<p>Sorry, cannot download ' . $loaderFile . ' from http://download.rvglobalsoft.com/loader/ioncube/' . $loaderFile . '!!</p>');
exit;
}
$tarcmd = whichcmd('tar');
$tarcmd = (isset($tarcmd)) ? $tarcmd : 'tar';
$cmd = @exec($tarcmd . ' -jxf ' . $sourcePath . '/' . $loaderFile . ' -C /');
if ( is_dir('/ioncube') ) {
$cmd = @system('chown root:root -R /ioncube');
$oCp = InstallHandle::factory();
$oCp->copyIonCubeToEtc($myLoader, $sourcePath);
} else {
print "Sorry, cannot extract " . $loaderFile . " to the folder <b>/ioncube</b>";
exit;
}
}
function getLoaderFile()
{
$machinetype = php_uname('m');
$osRelease = strtolower(substr(php_uname('v'),0,1));
$osType = strtolower(substr(php_uname(),0,3));
switch ($osType) {
case 'dar' :
$machineType = 'ppc';
break;
case 'fre' :
if ( preg_match('/64/i', $machinetype, $aMatch)) {
$machineType = 'AMD64';
} else {
if ($osRelease == '4' ) {
$machineType = '4_x86';
} else if ($osRelease == '6') {
$machineType = '6_x86';
} else {
$machineType = 'x86';
}
}
break;
case 'lin' :
if ( preg_match('/64/i', $machinetype, $aMatch)) {
$machineType = 'x86-64';
} elseif ( preg_match('/ppc/i', $machinetype, $aMatch)) {
$machineType = 'ppc';
} elseif ( preg_match('/sparc/i', $machinetype, $aMatch)) {
$machineType = 'sparc';
} else {
$machineType = 'x86';
}
break;
case 'ope' :
$osVersion = php_uname('v');
if (preg_match('/3\.7/i', $osVersion, $aMatch) ) {
$machineType = '3.7';
} else {
$machineType = 'x86';
}
break;
case 'sun' :
if ( preg_match('/sparc/i', $machinetype, $aMatch)) {
$machineType = 'sparc';
} else {
$machineType = 'x86';
}
break;
case 'win' :
$machineType = 'x86';
break;
};
return 'ioncube_loaders_' . $osType . '_' . $machineType . '.tar.bz2';
}
function copyAll($source, $dest, $mode = '')
{
if ( is_file($source) ) {
copy($source, $dest);
if (isset($mode) && $mode != '') {
chmod($dest . '/' . $file, $mode);
}
} elseif ( is_dir($source) ) {
$folder = opendir($source);
while ( $file = readdir($folder) ) {
if ( $file == '.' || $file == '..' || $file == 'CVS' || preg_match('/rvsitebuilder\.tar/i', $file, $match) ) {
continue;
}
if ( is_dir($source . '/' . $file) ) {
if ( !is_dir($dest . '/' . $file) ) {
@mkdir($dest . '/' . $file);
}
copyAll($source . '/' . $file, $dest . '/' . $file, $mode);
} else {
copy($source . '/' . $file, $dest . '/' . $file);
if (isset($mode) && $mode != '') {
@chmod($dest . '/' . $file, $mode);
}
}
}
closedir($folder);
}
return 1;
}
function unlinkAll($dest)
{
if ( is_file($dest) ) {
unlink($dest);
} elseif ( is_dir($dest) ) {
$folder = opendir($dest);
while ( $file = readdir($folder) ) {
if ( $file == '.' || $file == '..' ) {
continue;
}
if ( is_dir($dest . '/' . $file) ) {
unlinkAll($dest . '/' . $file);
@rmdir($dest . '/' . $file);
} elseif ( is_link($dest . '/' . $file) ) {
unlink($dest . '/' . $file);
} else {
unlink($dest . '/' . $file);
}
}
closedir($folder);
}
return 1;
}
function getWgetGetfile()
{
if ( is_file('/usr/local/bin/wget') ) {
return '/usr/local/bin/wget';
} elseif ( is_file('/usr/bin/wget') ) {
return '/usr/bin/wget';
} else {
$path = @exec('which wget');
if (is_file($path)) {
return $path;
} else {
return 'wget';
}
}
}
function whichcmd($cmd)
{
if ( file_exists('/usr/local/bin/' . $cmd) ) {
return '/usr/local/bin/' . $cmd;
} elseif ( file_exists('/usr/bin/' . $cmd) ) {
return '/usr/bin/' . $cmd;
} else {
$path = @exec('which ' . $cmd);
if (file_exists($path)) {
return $path;
} else {
return $cmd;
}
}
}
function getWget()
{
if ( !file_exists( getWgetGetfile()) ) {
return 0;
} else {
$chmode = substr(sprintf('%o', fileperms( getWgetGetfile())), -4);
$mode = ( int )substr($chmode,1,1);
if ($mode >= 7) {
return 1;
} else {
return 0;
}
}
return 0;
}
function fixExtentionPath()
{
// $fileScript = '/usr/local/cpanel/whostmgr/docroot/cgi/rvsitebuilderinstaller/fixphpextension.pl';
$fileScript = INS_PERL_EXTENSION_PATH . '/fixphpextension.pl';//INS_PERL_EXTENSION_PATH;
if (file_exists($fileScript)) {
@system('perl ' . $fileScript);
}
}
function rvssysinfo($required_loader = '')
{
$php_version = phpversion();
$os_name = substr(php_uname(),0,strpos(php_uname(),' '));
ob_start();
phpinfo(INFO_GENERAL);
$php_info = ob_get_contents();
ob_end_clean();
foreach (split("\n",$php_info) as $line) {
if (preg_match("/command/",$line)) {
continue;
}
if (preg_match('/thread safety.*(enabled|yes)/Ui',$line)) {
$thread_safe = true;
}
if (preg_match('/debug.*(enabled|yes)/Ui',$line)) {
$debug_build = true;
}
if (preg_match("/configuration\s*file\s*(.*?>\s*)([^<]*.ini)(.*<\/td.*)?/",$line,$match)) {
$php_ini_path = $match[2];
if (!@file_exists($php_ini_path)) {
$php_ini_path = '';
}
}
$cgi_cli = ((strpos(php_sapi_name(),'cgi') !== false) || (strpos(php_sapi_name(),'cli') !== false));
}
echo('<p>Analysis of your system configuration shows:</p>');
echo('<table cellpadding="5" cellspacing="1" border="0">' . "\n");
echo('<tr><td bgcolor="#e0e0ff">PHP Version</td><td bgcolor="#e0e0ff">' . $php_version . '</td></tr>' . "\n");
echo('<tr><td bgcolor="#e0e0ff">Operating System</td><td bgcolor="#e0e0ff">' . $os_name . '</td></tr>' . "\n");
echo('<tr><td bgcolor="#e0e0ff">Threaded PHP</td><td bgcolor="#e0e0ff">' . ($thread_safe ? 'Yes' : 'No') . '</td></tr>' . "\n");
echo('<tr><td bgcolor="#e0e0ff">php.ini file</td><td bgcolor="#e0e0ff">' . ($php_ini_path ? $php_ini_path : 'Unknown.') . '</td></tr>' . "\n");
echo('<tr><td bgcolor="#e0e0ff">Required Loader</td><td bgcolor="#e0e0ff">' . basename($required_loader) . '</td></tr>' . "\n");
echo('</table>' . "\n");
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez