grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026<?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['APP_KEY'] = base64_encode(md5(microtime()));
	
	// .env
	$file = sfile($__settings['softpath'].'/.env');
	
	if(empty($file)){
		$error[] = 'Could not read the config file.';
		return false;
	}
	
	soft_preg_replace('/APP_KEY=(.*?)\n/is', $file, $APP_KEY, 1);
	
	$replace_data[$APP_KEY] = 'base64:'.$__settings['APP_KEY'];
	
	sclone_replace($replace_data, $__settings['softpath'].'/.env', true);
	
	//Fetching private and public key and putting the values in files
	sconfigure('update_keys.php', false, 0, 1);
	
	$resp_create = swget($__settings['softurl'].'/update_keys.php');
	
	if(empty($resp_create)){
		$error[] = '{{no_domain_verify}}';
		return false;
	}
	
	if(preg_match('/<private_key>(.*?)<\/private_key>/is', $resp_create, $matches1)){
		$__settings['private_key'] = $matches1[1];
	}
	
	if(preg_match('/<public_key>(.*?)<\/public_key>/is', $resp_create, $matches2)){
		$__settings['public_key'] = $matches2[1];
	}
	
	//Fetching and storing encrypted value of private and public keys in database
	if(preg_match('/<installation_id>(.*?)<\/installation_id>/is', $resp_create, $matches2)){
		$__settings['installation_id'] = $matches2[1];
	}
	
	if(preg_match('/<private_key_enc>(.*?)<\/private_key_enc>/is', $resp_create, $matches3)){
		$__settings['private_key_enc'] = $matches3[1];
	}
	
	if(preg_match('/<public_key_enc>(.*?)<\/public_key_enc>/is', $resp_create, $matches4)){
		$__settings['public_key_enc'] = $matches4[1];
	}
	
	sunlink($__settings['softpath'].'/update_keys.php');
	
	//Configuring the public and private key files 
	sconfigure('oauth-public.key', 'storage/oauth-public.key');
	sconfigure('oauth-private.key', 'storage/oauth-private.key');

	//sql
	$query = "UPDATE `configuration` SET `data`='".$__settings['installation_id']."' WHERE `name` = 'installation_id';";
	sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
	
	$query = "UPDATE `configuration` SET `data`='".$__settings['private_key_enc']."' WHERE `name` = 'oauth_private_key';";
	sdb_query($query, $__settings['softdbhost'], $__settings['softdbuser'], $__settings['softdbpass'], $__settings['softdb']);
	
	$query = "UPDATE `configuration` SET `data`='".$__settings['public_key_enc']."' WHERE `name` = 'oauth_public_key';";
	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['^/$'] = '^'.$__settings['relativeurl'].'/$';
			
		}elseif(is_dom_root($__settings['softpath'])){
			
			$replace_data['^'.$source_data['relativeurl'].'/$'] = '^/$';
			
		}
			
		sclone_replace($replace_data, $__settings['softpath'].'/.htaccess', true);		
	}
	
	//From 5.6.9 version onwards composer doesn't create symlinks anymore.
	if(sversion_compare($__settings['ver'], '5.6.9', '<')){
	
		// create symlink
		if($globals['os'] != 'windows'){
			// Have to remove this files so symlinks can be created
			srm($__settings['softpath'].'/vendor/bin/doctrine-dbal');
			srm($__settings['softpath'].'/vendor/bin/generate-defuse-key');
			srm($__settings['softpath'].'/vendor/bin/var-dump-server');
			srm($__settings['softpath'].'/vendor/bin/patch-type-declarations');
			srm($__settings['softpath'].'/vendor/bin/carbon');
			
			//php function to prepare symlinks on all platforms
			symlink($__settings['softpath'].'/vendor/doctrine/dbal/bin/doctrine-dbal', $__settings['softpath'].'/vendor/bin/doctrine-dbal');
			symlink($__settings['softpath'].'/vendor/defuse/php-encryption/bin/generate-defuse-key', $__settings['softpath'].'/vendor/bin/generate-defuse-key');
			symlink($__settings['softpath'].'/vendor/symfony/var-dumper/Resources/bin/var-dump-server', $__settings['softpath'].'/vendor/bin/var-dump-server');
			symlink($__settings['softpath'].'/vendor/symfony/error-handler/Resources/bin/patch-type-declarations', $__settings['softpath'].'/vendor/bin/patch-type-declarations');
			symlink($__settings['softpath'].'/vendor/nesbot/carbon/bin/carbon', $__settings['softpath'].'/vendor/bin/carbon');
		}
	}
	//CHMOD some files
	@schmod($__settings['softpath'].'/storage/', $globals['odc'], 1);
	@schmod($__settings['softpath'].'/bootstrap/cache/', $globals['odc'], 1);
}

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

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

}

?>