ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/var/softaculous/ninja/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/var/softaculous/ninja/_clone.php

<?php

//////////////////////////////////////////////////////////////
//===========================================================
// clone.php
//===========================================================
// SOFTACULOUS 
// Version : 4.2.8
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       10th Jan 2009
// Time:       21:00 hrs
// Site:       http://www.softaculous.com/ (SOFTACULOUS)
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.softaculous.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Inc.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('SOFTACULOUS')){

	die('Hacking Attempt');

}

//The Install process
function __clone(){

global $__settings, $error, $software, $globals, $replace_data, $source_data;
	
	//Do we meet the Minimum software requirements
	__requirements();
	
	if(!empty($error)){
		return false;
	}
	
	$temp = parse_url($source_data['softurl']);
	$source_data['relativeurl'] = $temp['path'];
	
	$temp = parse_url($__settings['softurl']);
	$__settings['relativeurl'] = $temp['path'];
	$__settings['protocol'] = $temp['scheme'];
	
	// .env
	$file = sfile($__settings['softpath'].'/.env');
	
	if(empty($file)){
		$error[] = 'Could not read the .env file.';
		return false;
	}
	
	soft_preg_replace('/APP_KEY=(.*?)\n/is', $file, $__settings['APP_KEY'], 1);
	soft_preg_replace('/REQUIRE_HTTPS=(.*?)\n/is', $file, $__settings['https_enable'], 1);
	
	$__settings['https_enable_'] = 'false';
	if($__settings['protocol'] == 'https'){
		$__settings['https_enable_'] = 'true';
	}
	
	$replace_data['REQUIRE_HTTPS='.$__settings['https_enable']] = 'REQUIRE_HTTPS='.$__settings['https_enable_'];
	
	if(sversion_compare($__settings['ver'], '5.0.0', '>')){
		$replace_data[$__settings['APP_KEY']] = 'base64:'.base64_encode(srandstr(32));
		
		$file1 = sfile($__settings['softpath'].'/bootstrap/cache/config.php');
		
		soft_preg_replace('/("|\')key("|\')(\s*?)=>(\s*?)("|\')(.*?)("|\'),\n/is', $file1, $__settings['KEY'], 6);
		$replace_data[$__settings['KEY']] = 'base64:'.base64_encode(srandstr(32));
		
		$replace_data['\'require_https\' => '.$__settings['https_enable'].','] = '\'require_https\' => '.$__settings['https_enable_'].',';
		
		sclone_replace($replace_data, $__settings['softpath'].'/bootstrap/cache/config.php', true);
	}else{
		$replace_data[$__settings['APP_KEY']] = srandstr(32);
	}
	
	sclone_replace($replace_data, $__settings['softpath'].'/.env', true);
	
	//sql
	$__settings['account_key'] = __random(32);
	
	if(sversion_compare($__settings['ver'], '5.0.0', '>')){
		$query = "UPDATE `accounts` SET `key`='".$__settings['account_key']."' WHERE `id` = 1;";
		sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
		
		$__settings['company_key'] = __random(64);
		$query1 = "UPDATE `companies` SET `company_key`='".$__settings['company_key']."' WHERE `id` = 1;";
		sdb_query($query1, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
		
		$__settings['token'] = __random(64);
		$query2 = "UPDATE `company_tokens` SET `token`='".$__settings['token']."' WHERE `id` = 1;";
		sdb_query($query2, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
		
		$__settings['referral_code'] = __random(32);
		$query3 = "UPDATE `accounts` SET `referral_code`='".$__settings['referral_code']."' WHERE `id` = 1;";
		sdb_query($query3, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
		
		$__settings['confirmation_code'] = __random(72);
		$query4 = "UPDATE `users` SET `confirmation_code`='".$__settings['confirmation_code']."' WHERE `id` = 1;";
		sdb_query($query4, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
		
	}else{
		$query = "UPDATE `accounts` SET `account_key`='".$__settings['account_key']."' WHERE `id` = 1;";
		sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
	}
	
	if(sfile_exists($__settings['softpath'].'/.htaccess')){
	
		// If the installation is on root domain we need to change the below relative URL
		if(is_dom_root($source_data['softpath'])){
			$replace_data['RewriteBase \'/\''] = 'RewriteBase \''.$__settings['relativeurl'].'\'';
			$replace_data['RewriteBase /'] = 'RewriteBase '.$__settings['relativeurl'];
		}elseif(is_dom_root($__settings['softpath'])){
			$replace_data['RewriteBase \''.$source_data['relativeurl'].'\''] = 'RewriteBase \'/\'';
			$replace_data['RewriteBase '.$source_data['relativeurl']] = 'RewriteBase /';
		}
		
		$replace_data["^".$source_data['relativeurl']."/"] = "^".$__settings['relativeurl']."/";
		
		sclone_replace($replace_data, $__settings['softpath'].'/.htaccess', true);		
	}
	
	@schmod($__settings['softpath'].'/storage/', $globals['odc'], 1);
	@schmod($__settings['softpath'].'/public/logo/', $globals['odc'], 1);
}

//Check whether the Minimum Software configuration matches
function __requirements(){

global $__settings, $error, $software;
	
	return true;

}

function __random($length = 16){
	
	if (function_exists('openssl_random_pseudo_bytes')){
		
		$bytes = openssl_random_pseudo_bytes($length * 2);

		if ($bytes === false)
		{	// throw new \RuntimeException('Unable to generate random string.'); 
			// We have commented this as we dont want to throw error so generated with their other way	
			return __quickRandom($length);
		}

		return substr(str_replace(array('/', '+', '='), '', base64_encode($bytes)), 0, $length);
	}

	return __quickRandom($length);
}

function __quickRandom($length = 16){
	
	$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

	return substr(str_shuffle(str_repeat($pool, 5)), 0, $length);
}

?>

Zerion Mini Shell 1.0