Пример #1
0
function echoPage()
{
    $automation = AKAutomation::getInstance();
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Akeeba Kickstart 3.3.2</title>
<style type="text/css" media="all" rel="stylesheet">
<?php 
    echoCSS();
    ?>
</style>
<?php 
    if (function_exists('base64_decode')) {
        ?>
<script type="text/javascript">
<?php 
        $data = <<<ENDDATA
KGZ1bmN0aW9uKEEsdyl7ZnVuY3Rpb24gbWEoKXtpZighYy5pc1JlYWR5KXt0cnl7cy5kb2N1bWVudEVsZW1lbnQuZG9TY3JvbGwoImxlZnQiKX1jYXRjaChhKXtzZXRUaW1lb3V0KG1hLDEpO3JldHVybn1jLnJlYWR5KCl9fWZ1bmN0aW9uIFFhKGEsYil7Yi5zcmM/Yy5hamF4KHt1cmw6Yi5zcmMsYXN5bmM6ZmFsc2UsZGF0YVR5cGU6InNjcmlwdCJ9KTpjLmdsb2JhbEV2YWwoYi50ZXh0fHxiLnRleHRDb250ZW50fHxiLmlubmVySFRNTHx8IiIpO2IucGFyZW50Tm9kZSYmYi5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGIpfWZ1bmN0aW9uIFgoYSxiLGQsZixlLGope3ZhciBpPWEubGVuZ3RoO2lmKHR5cGVvZiBiPT09Im9iamVjdCIpe2Zvcih2YXIgbyBpbiBiKVgoYSxvLGJbb10sZixlLGQpO3JldHVybiBhfWlmKGQhPT13KXtmPSFqJiZmJiZjLmlzRnVuY3Rpb24oZCk7Zm9yKG89MDtvPGk7bysrKWUoYVtvXSxiLGY/ZC5jYWxsKGFbb10sbyxlKGFbb10sYikpOmQsaik7cmV0dXJuIGF9cmV0dXJuIGk/DQplKGFbMF0sYik6d31mdW5jdGlvbiBKKCl7cmV0dXJuKG5ldyBEYXRlKS5nZXRUaW1lKCl9ZnVuY3Rpb24g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JiZlLmRvY3VtZW50P2UuZG9jdW1lbnQuY29tcGF0TW9kZT09PSJDU1MxQ29tcGF0IiYmZS5kb2N1bWVudC5kb2N1bWVudEVsZW1lbnRbImNsaWVudCIrYl18fGUuZG9jdW1lbnQuYm9keVsiY2xpZW50IitiXTplLm5vZGVUeXBlPT09OT9NYXRoLm1heChlLmRvY3VtZW50RWxlbWVudFsiY2xpZW50IitiXSxlLmJvZHlbInNjcm9sbCIrYl0sZS5kb2N1bWVudEVsZW1lbnRbInNjcm9sbCIrYl0sZS5ib2R5WyJvZmZzZXQiK2JdLGUuZG9jdW1lbnRFbGVtZW50WyJvZmZzZXQiK2JdKTpmPT09dz9jLmNzcyhlLGQpOnRoaXMuY3NzKGQsdHlwZW9mIGY9PT0ic3RyaW5nIj9mOmYrInB4Iil9fSk7QS5qUXVlcnk9QS4kPWN9KSh3aW5kb3cpOw0KDQo=
ENDDATA;
        echo base64_decode($data);
        ?>
</script>
<?php 
    } else {
        ?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<?php 
    }
    ?>
<script type="text/javascript">
	if(!this.JSON){this.JSON={};}
	(function(){function f(n){return n<10?'0'+n:n;}
	if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
	f(this.getUTCMonth()+1)+'-'+
	f(this.getUTCDate())+'T'+
	f(this.getUTCHours())+':'+
	f(this.getUTCMinutes())+':'+
	f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
	var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
	function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
	if(typeof rep==='function'){value=rep.call(holder,key,value);}
	switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
	gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
	v=partial.length===0?'[]':gap?'[\n'+gap+
	partial.join(',\n'+gap)+'\n'+
	mind+']':'['+partial.join(',')+']';gap=mind;return v;}
	if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
	v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
	mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
	if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
	rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
	return str('',{'':value});};}
	if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
	return reviver.call(holder,key,value);}
	text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
	('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
	if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
	throw new SyntaxError('JSON.parse');};}}());
</script>
<script type="text/javascript">
	var akeeba_automation = <?php 
    echo $automation->hasAutomation() ? 'true' : 'false';
    ?>
;

	$(document).ready(function(){
		// Hide 2nd Page
		$('#page2').css('display','none');

		// Translate the GUI
		translateGUI();

		// Hook interaction handlers
		$(document).keyup( closeLightbox );
		$('#kickstart\\.procengine').change( onChangeProcengine );
		$('#checkFTPTempDir').click( oncheckFTPTempDirClick );
		$('#resetFTPTempDir').click( onresetFTPTempDir );
		$('#testFTP').click( onTestFTPClick );
		$('#gobutton').click( onStartExtraction );
		$('#runInstaller').click( onRunInstallerClick );
		$('#runCleanup').click( onRunCleanupClick );
		$('#gotoSite').click(function(event){window.open('index.php','finalstepsite'); window.close();});
		$('#gotoAdministrator').click(function(event){window.open('administrator/index.php','finalstepadmin'); window.close();});
		$('#gotoStart').click( onGotoStartClick );

		// Reset the progress bar
		setProgressBar(0);

		// Do we have automation?
		if(akeeba_automation) {
			$('#automode').css('display','block');
			$('#gobutton').click();
		} else {
			// Show warning
			if( jQuery.browser.msie && (jQuery.browser.version.substr(0,1) == '7') )
			{
				$('#ie7Warning').css('display','block');
			}
			$('#preextraction').css('display','block');
			$('#fade').css('display','block');
		}
	});

	var translation = {
	<?php 
    echoTranslationStrings();
    ?>
	}

	var akeeba_ajax_url = '<?php 
    echo basename(__FILE__);
    ?>
';
	var akeeba_error_callback = onGenericError;
	var akeeba_restoration_stat_inbytes = 0;
	var akeeba_restoration_stat_outbytes = 0;
	var akeeba_restoration_stat_files = 0;
	var akeeba_restoration_stat_total = 0;
	var akeeba_factory = null;

	function translateGUI()
	{
		$('*').each(function(i,e){
			transKey = $(e).text();
			if(array_key_exists(transKey, translation))
			{
				$(e).text( translation[transKey] );
			}
		});
	}

	function trans(key)
	{
		if(array_key_exists(key, translation)) {
			return translation[key];
		} else {
			return key;
		}
	}

	function array_key_exists ( key, search ) {
	   if (!search || (search.constructor !== Array && search.constructor !== Object)){
	        return false;
	    }
	    return key in search;
	}

	function empty (mixed_var) {
	    var key;

	    if (mixed_var === "" ||
	        mixed_var === 0 ||
	        mixed_var === "0" ||
	        mixed_var === null ||
	        mixed_var === false ||
	        typeof mixed_var === 'undefined'
	    ){
	        return true;
	    }

	    if (typeof mixed_var == 'object') {
	        for (key in mixed_var) {
	            return false;
	        }
	        return true;
	    }

	    return false;
	}

	function is_array (mixed_var) {
	    var key = '';
	    var getFuncName = function (fn) {
	        var name = (/\W*function\s+([\w\$]+)\s*\(/).exec(fn);
	        if (!name) {
	            return '(Anonymous)';
	        }
	        return name[1];
	    };

	    if (!mixed_var) {
	        return false;
	    }

	    // BEGIN REDUNDANT
	    this.php_js = this.php_js || {};
	    this.php_js.ini = this.php_js.ini || {};
	    // END REDUNDANT

	    if (typeof mixed_var === 'object') {

	        if (this.php_js.ini['phpjs.objectsAsArrays'] &&  // Strict checking for being a JavaScript array (only check this way if call ini_set('phpjs.objectsAsArrays', 0) to disallow objects as arrays)
	            (
	            (this.php_js.ini['phpjs.objectsAsArrays'].local_value.toLowerCase &&
	                    this.php_js.ini['phpjs.objectsAsArrays'].local_value.toLowerCase() === 'off') ||
	                parseInt(this.php_js.ini['phpjs.objectsAsArrays'].local_value, 10) === 0)
	            ) {
	            return mixed_var.hasOwnProperty('length') && // Not non-enumerable because of being on parent class
	                            !mixed_var.propertyIsEnumerable('length') && // Since is own property, if not enumerable, it must be a built-in function
	                                getFuncName(mixed_var.constructor) !== 'String'; // exclude String()
	        }

	        if (mixed_var.hasOwnProperty) {
	            for (key in mixed_var) {
	                // Checks whether the object has the specified property
	                // if not, we figure it's not an object in the sense of a php-associative-array.
	                if (false === mixed_var.hasOwnProperty(key)) {
	                    return false;
	                }
	            }
	        }

	        // Read discussion at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_is_array/
	        return true;
	    }

	    return false;
	}

	/**
	 * Performs an AJAX request and returns the parsed JSON output.
	 * The global akeeba_ajax_url is used as the AJAX proxy URL.
	 * If there is no errorCallback, the global akeeba_error_callback is used.
	 * @param data An object with the query data, e.g. a serialized form
	 * @param successCallback A function accepting a single object parameter, called on success
	 * @param errorCallback A function accepting a single string parameter, called on failure
	 */
	function doAjax(data, successCallback, errorCallback)
	{
		var structure =
		{
			type: "POST",
			url: akeeba_ajax_url,
			cache: false,
			data: data,
			timeout: 600000,
			success: function(msg) {
				// Initialize
				var junk = null;
				var message = "";

				// Get rid of junk before the data
				var valid_pos = msg.indexOf('###');
				if( valid_pos == -1 ) {
					// Valid data not found in the response
					msg = 'Invalid AJAX data received:<br/>' + msg;
					if(errorCallback == null)
					{
						if(akeeba_error_callback != null)
						{
							akeeba_error_callback(msg);
						}
					}
					else
					{
						errorCallback(msg);
					}
					return;
				} else if( valid_pos != 0 ) {
					// Data is prefixed with junk
					junk = msg.substr(0, valid_pos);
					message = msg.substr(valid_pos);
				}
				else
				{
					message = msg;
				}
				message = message.substr(3); // Remove triple hash in the beginning

				// Get of rid of junk after the data
				var valid_pos = message.lastIndexOf('###');
				message = message.substr(0, valid_pos); // Remove triple hash in the end

				try {
					var data = eval('('+message+')');
				} catch(err) {
					var msg = err.message + "\n<br/>\n<pre>\n" + message + "\n</pre>";
					if(errorCallback == null)
					{
						if(akeeba_error_callback != null)
						{
							akeeba_error_callback(msg);
						}
					}
					else
					{
						errorCallback(msg);
					}
					return;
				}

				// Call the callback function
				successCallback(data);
			},
			error: function(Request, textStatus, errorThrown) {
				var message = '<strong>AJAX Loading Error</strong><br/>HTTP Status: '+Request.status+' ('+Request.statusText+')<br/>';
				message = message + 'Internal status: '+textStatus+'<br/>';
				message = message + 'XHR ReadyState: ' + Response.readyState + '<br/>';
				message = message + 'Raw server response:<br/>'+Request.responseText;
				if(errorCallback == null)
				{
					if(akeeba_error_callback != null)
					{
						akeeba_error_callback(message);
					}
				}
				else
				{
					errorCallback(message);
				}
			}
		};
		$.ajax( structure );
	}

	function onChangeProcengine(event)
	{
		if( $('#kickstart\\.procengine').val() == 'ftp' ) {
			$('#ftp-options').show('fast');
		} else {
			$('#ftp-options').hide('fast');
		}
	}

	function closeLightbox(event)
	{
		var closeMe = false;

		if( (event == null) || (event == undefined) ) {
			closeMe = true;
		} else if(event.keyCode == '27') {
			closeMe = true;
		}

		if(closeMe)
		{
			document.getElementById('preextraction').style.display='none';
			document.getElementById('genericerror').style.display='none';
			document.getElementById('fade').style.display='none';
			$(document).unbind('keyup', closeLightbox);
		}
	}

	function onGenericError(msg)
	{
		$('#genericerrorInner').html(msg);
		$('#genericerror').css('display','block');
		$('#fade').css('display','block');
		$(document).keyup(closeLightbox);
	}

	function setProgressBar(percent)
	{
		var newValue = 0;

		if(percent <= 1) {
			newValue = 100 * percent;
		} else {
			newValue = percent;
		}

		$('#progressbar-inner').css('width',percent+'%');
	}

	function oncheckFTPTempDirClick(event)
	{
		var data = {
			'task' : 'checkTempdir',
			'json': JSON.stringify({
				'kickstart.ftp.tempdir': $('#kickstart\\.ftp\\.tempdir').val()
			})
		};

		doAjax(data, function(ret){
			var key = ret.status ? 'FTP_TEMPDIR_WRITABLE' : 'FTP_TEMPDIR_UNWRITABLE';
			alert( trans(key) );
		});
	}

	function onTestFTPClick(event)
	{
		var data = {
			'task' : 'checkFTP',
			'json': JSON.stringify({
				'kickstart.ftp.host':		$('#kickstart\\.ftp\\.host').val(),
				'kickstart.ftp.port':		$('#kickstart\\.ftp\\.port').val(),
				'kickstart.ftp.ssl':		$('#kickstart\\.ftp\\.ssl').is(':checked'),
				'kickstart.ftp.passive':	$('#kickstart\\.ftp\\.passive').is(':checked'),
				'kickstart.ftp.user':		$('#kickstart\\.ftp\\.user').val(),
				'kickstart.ftp.pass':		$('#kickstart\\.ftp\\.pass').val(),
				'kickstart.ftp.dir':		$('#kickstart\\.ftp\\.dir').val(),
				'kickstart.ftp.tempdir':	$('#kickstart\\.ftp\\.tempdir').val()
			})
		};
		doAjax(data, function(ret){
			var key = ret.status ? 'FTP_CONNECTION_OK' : 'FTP_CONNECTION_FAILURE';
			alert( trans(key) + "\n\n" + (ret.status ? '' : ret.message) );
		});
	}

	function onStartExtraction()
	{
		$('#page1').hide('fast');
		$('#page2').show('fast');

		$('#currentFile').text( '' );

		akeeba_error_callback = errorHandler;

		var data = {
			'task' : 'startExtracting',
			'json': JSON.stringify({
<?php 
    if (!$automation->hasAutomation()) {
        ?>
				'kickstart.setup.sourcefile':		$('#kickstart\\.setup\\.sourcefile').val(),
				'kickstart.jps.password':			$('#kickstart\\.jps\\.password').val(),
				'kickstart.tuning.min_exec_time':	$('#kickstart\\.tuning\\.min_exec_time').val(),
				'kickstart.tuning.max_exec_time':	$('#kickstart\\.tuning\\.max_exec_time').val(),
				'kickstart.stealth.enable': 		$('#kickstart\\.stealth\\.enable').is(':checked'),
				'kickstart.stealth.url': 			$('#kickstart\\.stealth\\.url').val(),
				'kickstart.tuning.run_time_bias':	75,
				'kickstart.setup.restoreperms':		0,
				'kickstart.setup.dryrun':			0,
				'kickstart.setup.ignoreerrors':		0,
				'kickstart.enabled':				1,
				'kickstart.security.password':		'',
				'kickstart.procengine':				$('#kickstart\\.procengine').val(),
				'kickstart.ftp.host':				$('#kickstart\\.ftp\\.host').val(),
				'kickstart.ftp.port':				$('#kickstart\\.ftp\\.port').val(),
				'kickstart.ftp.ssl':				$('#kickstart\\.ftp\\.ssl').is(':checked'),
				'kickstart.ftp.passive':			$('#kickstart\\.ftp\\.passive').is(':checked'),
				'kickstart.ftp.user':				$('#kickstart\\.ftp\\.user').val(),
				'kickstart.ftp.pass':				$('#kickstart\\.ftp\\.pass').val(),
				'kickstart.ftp.dir':				$('#kickstart\\.ftp\\.dir').val(),
				'kickstart.ftp.tempdir':			$('#kickstart\\.ftp\\.tempdir').val()
<?php 
    } else {
        ?>
				'kickstart.setup.sourcefile':		<?php 
        echo autoVar('kickstart.setup.sourcefile');
        ?>
,
				'kickstart.jps.password':			<?php 
        echo autoVar('kickstart.jps.password');
        ?>
,
				'kickstart.tuning.min_exec_time':	<?php 
        echo autoVar('kickstart.tuning.min_exec_time', 1);
        ?>
,
				'kickstart.tuning.max_exec_time':	<?php 
        echo autoVar('kickstart.tuning.max_exec_time', 5);
        ?>
,
				'kickstart.stealth.enable': 		false,
				'kickstart.tuning.run_time_bias':	75,
				'kickstart.setup.restoreperms':		0,
				'kickstart.setup.dryrun':			0,
				'kickstart.setup.ignoreerrors':		0,
				'kickstart.enabled':				1,
				'kickstart.security.password':		'',
				'kickstart.procengine':				<?php 
        echo autoVar('kickstart.procengine', 'direct');
        ?>
,
				'kickstart.ftp.host':				<?php 
        echo autoVar('kickstart.ftp.host', 'localhost');
        ?>
,
				'kickstart.ftp.port':				<?php 
        echo autoVar('kickstart.ftp.port', 22);
        ?>
,
				'kickstart.ftp.ssl':				<?php 
        echo autoVar('kickstart.ftp.ssl', 0);
        ?>
,
				'kickstart.ftp.passive':			<?php 
        echo autoVar('kickstart.ftp.passive', 1);
        ?>
,
				'kickstart.ftp.user':				<?php 
        echo autoVar('kickstart.ftp.user');
        ?>
,
				'kickstart.ftp.pass':				<?php 
        echo autoVar('kickstart.ftp.pass');
        ?>
,
				'kickstart.ftp.dir':				<?php 
        echo autoVar('kickstart.ftp.dir', '/');
        ?>
,
				'kickstart.ftp.tempdir':			<?php 
        echo autoVar('kickstart.ftp.tempdir', AKKickstartUtils::getPath() . 'kicktemp');
    }
    ?>
			})
		};
		doAjax(data, function(ret){
			processRestorationStep(ret);
		});
	}

	function processRestorationStep(data)
	{
		// Look for errors
		if(!data.status)
		{
			errorHandler(data.message);
			return;
		}

		// Propagate warnings to the GUI
		if( !empty(data.Warnings) )
		{
			$.each(data.Warnings, function(i, item){
				$('#warnings').append(
					$(document.createElement('div'))
					.html(item)
				);
				$('#warningsBox').show('fast');
			});
		}

		// Parse total size, if exists
		if(array_key_exists('totalsize', data))
		{
			if(is_array(data.filelist))
			{
				akeeba_restoration_stat_total = 0;
				$.each(data.filelist,function(i, item)
				{
					akeeba_restoration_stat_total += item[1];
				});
			}
			akeeba_restoration_stat_outbytes = 0;
			akeeba_restoration_stat_inbytes = 0;
			akeeba_restoration_stat_files = 0;
		}

		// Update GUI
		akeeba_restoration_stat_inbytes += data.bytesIn;
		akeeba_restoration_stat_outbytes += data.bytesOut;
		akeeba_restoration_stat_files += data.files;
		var percentage = 0;
		if( akeeba_restoration_stat_total > 0 )
		{
			percentage = 100 * akeeba_restoration_stat_inbytes / akeeba_restoration_stat_total;
			if(percentage < 0) {
				percentage = 0;
			} else if(percentage > 100) {
				percentage = 100;
			}
		}
		if(data.done) percentage = 100;
		setProgressBar(percentage);
		$('#currentFile').text( data.lastfile );

		if(!empty(data.factory)) akeeba_factory = data.factory;

		post = {
			'task'	: 'continueExtracting',
			'json'	: JSON.stringify({factory: akeeba_factory})
		};

		if(!data.done)
		{
			doAjax(post, function(ret){
				processRestorationStep(ret);
			});
		}
		else
		{
			$('#page2a').hide('fast');
			$('#extractionComplete').show('fast');

			$('#runInstaller').css('display','inline-block');
			if(akeeba_automation) $('#runInstaller').click();
		}
	}

	function onGotoStartClick(event)
	{
		$('#page2').hide('fast');
		$('#error').hide('fast');
		$('#page1').show('fast');
	}

	function onRunInstallerClick(event)
	{
		var windowReference = window.open('installation/index.php','installer');
		if(!windowReference.opener) {
			windowReference.opener = this.window;
		}
		$('#runCleanup').css('display','inline-block');
		$('#runInstaller').hide('fast');
	}

	function onRunCleanupClick(event)
	{
		post = {
			'task'	: 'cleanUp',
			// Passing the factory preserves the renamed files array
			'json'	: JSON.stringify({factory: akeeba_factory})
		};

		doAjax(post, function(ret){
			$('#runCleanup').hide('fast');
			$('#gotoSite').css('display','inline-block');
			$('#gotoAdministrator').css('display','inline-block');
			$('#gotoPostRestorationRroubleshooting').css('display','block');
		});
	}

	function errorHandler(msg)
	{
		$('#errorMessage').html(msg);
		$('#error').show('fast');
	}

	function onresetFTPTempDir(event)
	{
		$('#kickstart\\.ftp\\.tempdir').val('<?php 
    echo addcslashes(AKKickstartUtils::getPath(), '\\\'"');
    ?>
');
	}

		/**
	 * Akeeba Kickstart Update Check
	 */

	var akeeba_update = {version: '0'};
	var akeeba_version = '3.3.2';
	
	function version_compare (v1, v2, operator) {
		// BEGIN REDUNDANT
		this.php_js = this.php_js || {};
		this.php_js.ENV = this.php_js.ENV || {};
		// END REDUNDANT
		// Important: compare must be initialized at 0. 
		var i = 0,
			x = 0,
			compare = 0,
			// vm maps textual PHP versions to negatives so they're less than 0.
			// PHP currently defines these as CASE-SENSITIVE. It is important to
			// leave these as negatives so that they can come before numerical versions
			// and as if no letters were there to begin with.
			// (1alpha is < 1 and < 1.1 but > 1dev1)
			// If a non-numerical value can't be mapped to this table, it receives
			// -7 as its value.
			vm = {
				'dev': -6,
				'alpha': -5,
				'a': -5,
				'beta': -4,
				'b': -4,
				'RC': -3,
				'rc': -3,
				'#': -2,
				'p': -1,
				'pl': -1
			},
			// This function will be called to prepare each version argument.
			// It replaces every _, -, and + with a dot.
			// It surrounds any nonsequence of numbers/dots with dots.
			// It replaces sequences of dots with a single dot.
			//    version_compare('4..0', '4.0') == 0
			// Important: A string of 0 length needs to be converted into a value
			// even less than an unexisting value in vm (-7), hence [-8].
			// It's also important to not strip spaces because of this.
			//   version_compare('', ' ') == 1
			prepVersion = function (v) {
				v = ('' + v).replace(/[_\-+]/g, '.');
				v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
				return (!v.length ? [-8] : v.split('.'));
			},
			// This converts a version component to a number.
			// Empty component becomes 0.
			// Non-numerical component becomes a negative number.
			// Numerical component becomes itself as an integer.
			numVersion = function (v) {
				return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
			};
		v1 = prepVersion(v1);
		v2 = prepVersion(v2);
		x = Math.max(v1.length, v2.length);
		for (i = 0; i < x; i++) {
			if (v1[i] == v2[i]) {
				continue;
			}
			v1[i] = numVersion(v1[i]);
			v2[i] = numVersion(v2[i]);
			if (v1[i] < v2[i]) {
				compare = -1;
				break;
			} else if (v1[i] > v2[i]) {
				compare = 1;
				break;
			}
		}
		if (!operator) {
			return compare;
		}

		// Important: operator is CASE-SENSITIVE.
		// "No operator" seems to be treated as "<."
		// Any other values seem to make the function return null.
		switch (operator) {
		case '>':
		case 'gt':
			return (compare > 0);
		case '>=':
		case 'ge':
			return (compare >= 0);
		case '<=':
		case 'le':
			return (compare <= 0);
		case '==':
		case '=':
		case 'eq':
			return (compare === 0);
		case '<>':
		case '!=':
		case 'ne':
			return (compare !== 0);
		case '':
		case '<':
		case 'lt':
			return (compare < 0);
		default:
			return null;
		}
	}

	function checkUpdates()
	{
		var structure =
		{
			type: "GET",
			url: 'http://query.yahooapis.com/v1/public/yql',
			data: {
				q: 'SELECT * FROM xml WHERE url="http://cdn.akeebabackup.com/updates/kickstart.xml"',
				format: 'json',
				callback: 'updatesCallback'
			},
			cache: true,
			crossDomain: true,
			jsonp: 'updatesCallback',
			timeout: 15000
		};
		$.ajax( structure );
	}
	
	function updatesCallback(msg)
	{
		$.each(msg.query.results.updates.update, function(i, el){
			var myUpdate = {
				'version'	: el.version,
				'infourl'	: el.infourl['content'],
				'dlurl'		: el.downloads.downloadurl.content
			}
			if(version_compare(myUpdate.version, akeeba_update.version, 'ge')) {
				akeeba_update = myUpdate;
			}
		});
		
		if(version_compare(akeeba_update.version, akeeba_version, 'gt')) {
			notifyAboutUpdates();
		}
	}
	
	function notifyAboutUpdates()
	{
		$('#update-version').text(akeeba_update.version);
		$('#update-dlnow').attr('href', akeeba_update.dlurl);
		$('#update-whatsnew').attr('href', akeeba_update.infourl);
		$('#update-notification').show('slow');
	}
	</script>
</head>
<body>

<div id="automode" style="display:none;">
	AUTOMODEON
</div>

<div id="preextraction" class="white_content">
	<div id="ie7Warning" style="display:none;">
		<h2>Deprecated Internet Explorer version</h2>
		<p>This script is not guaranteed to work properly on Internet Explorer 7 or previous version,
		or on Internet Explorer 8 and higher running in compatibility mode.</p>
		<p>Please use Internet Explorer 8 in native mode (the &quot;broken page&quot; icon next to the
		address bar should not be enabled). Alternatively, you may use the latest versions of Firefox,
		Safari, Google Chrome or SRWare Iron.</p>
	</div>

	<h2>THINGS_HEADER</h2>
	<ol>
		<li>THINGS_01</li>
		<li>THINGS_02</li>
		<li>THINGS_03</li>
		<li>THINGS_04</li>
		<li>THINGS_05</li>
		<li>THINGS_06</li>
		<li>THINGS_07</li>
		<li>THINGS_08</li>
		<li>THINGS_09</li>
	</ol>
	<a href="javascript:void(0)" onclick="closeLightbox();">CLOSE_LIGHTBOX</a>
</div>

<div id="genericerror" class="white_content">
	<pre id="genericerrorInner"></pre>
</div>

<div id="fade" class="black_overlay"></div>

<div id="page-container">

	<div id="header">
		<div class="title">Akeeba Kickstart 3.3.2</div>
	</div>
	
	<div id="update-notification" style="display: none">
		<p class="update-notify">UPDATE_HEADER</p>
		<p class="update-whyupdate">UPDATE_NOTICE</p>
		<p class="update-links">
			<a href="#" id="update-dlnow">UPDATE_DLNOW</a>
			<a href="#" id="update-whatsnew" target="_blank">UPDATE_MOREINFO</a> 
		</p>
	</div>

<div id="page1">
	<div class="helpme">
		<span>NEEDSOMEHELPKS</span> <a href="https://www.akeebabackup.com/documentation/quick-start-guide/using-kickstart.html" target="_blank">QUICKSTART</a>
	</div>
	
	
	<div class="step1">
		<div class="circle">1</div>
		<h2>SELECT_ARCHIVE</h2>
		<div class="area-container">
			<label for="kickstart.setup.sourcefile">ARCHIVE_FILE</label>
			<span class="field">
				<?php 
    $filelist = AKKickstartUtils::getArchivesAsOptions();
    if (!empty($filelist)) {
        ?>
					<select id="kickstart.setup.sourcefile">
					<?php 
        echo $filelist;
        ?>
					</select>
				<?php 
    } else {
        ?>
					<a href="https://www.akeebabackup.com/documentation/troubleshooter/ksnoarchives.html" target="_blank">NOARCHIVESCLICKHERE</a>
				<?php 
    }
    ?>
			</span>
			<br />
			<label for="kickstart.jps.password">JPS_PASSWORD</label>
			<span class="field"><input type="password" id="kickstart.jps.password" value="" /></span>
		</div>
	</div>

	<div class="clr"></div>

	<div class="step2">
		<div class="circle">2</div>
		<h2>SELECT_EXTRACTION</h2>
		<div class="area-container">
			<label for="kickstart.procengine">WRITE_TO_FILES</label>
			<span class="field">
				<select id="kickstart.procengine">
					<option value="direct">WRITE_DIRECTLY</option>
					<option value="ftp">WRITE_FTP</option>
				</select>
			</span>

			<div id="ftp-options">
				<label for="kickstart.ftp.host">FTP_HOST</label>
				<span class="field"><input type="text" id="kickstart.ftp.host" value="localhost" /></span><br />
				<label for="kickstart.ftp.port">FTP_PORT</label>
				<span class="field"><input type="text" id="kickstart.ftp.port" value="21" /></span><br />
				<label for="kickstart.ftp.ssl">FTP_FTPS</label>
				<span class="field"><input type="checkbox" id="kickstart.ftp.ssl" /></span><br />
				<label for="kickstart.ftp.passive">FTP_PASSIVE</label>
				<span class="field"><input type="checkbox" id="kickstart.ftp.passive" checked="checked" /></span><br />
				<label for="kickstart.ftp.user">FTP_USER</label>
				<span class="field"><input type="text" id="kickstart.ftp.user" value="" /></span><br />
				<label for="kickstart.ftp.pass">FTP_PASS</label>
				<span	class="field"><input type="password" id="kickstart.ftp.pass" value="" /></span><br />
				<label for="kickstart.ftp.dir">FTP_DIR</label>
				<span class="field"><input type="text" id="kickstart.ftp.dir" value="" /></span><br />

				<label for="kickstart.ftp.tempdir">FTP_TEMPDIR</label>
				<span class="field">
					<input type="text" id="kickstart.ftp.tempdir" value="<?php 
    echo htmlentities(AKKickstartUtils::getPath());
    ?>
" />
					<span class="button" id="checkFTPTempDir">BTN_CHECK</span>
					<span class="button" id="resetFTPTempDir">BTN_RESET</span>
				</span><br />
				<label></label>
				<span class="button" id="testFTP">BTN_TESTFTPCON</span>
				<a href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a>
				<br />
			</div>

		</div>
	</div>

	<div class="clr"></div>

	<div class="step3">
		<div class="circle">3</div>
		<h2>FINE_TUNE</h2>
		<div class="area-container">
			<label for="kickstart.tuning.min_exec_time">MIN_EXEC_TIME</label>
			<span class="field"><input type="text" id="kickstart.tuning.min_exec_time" value="1" /></span> <span>SECONDS_PER_STEP</span><br />
			<label for="kickstart.tuning.max_exec_time">MAX_EXEC_TIME</label>
			<span class="field"><input type="text" id="kickstart.tuning.max_exec_time" value="5" /></span> <span>SECONDS_PER_STEP</span><br />

			<label for="kickstart.stealth.enable">STEALTH_MODE</label>
			<span class="field"><input type="checkbox" id="kickstart.stealth.enable" /></span><br />
			<label for="kickstart.stealth.url">STEALTH_URL</label>
			<span class="field"><input type="text" id="kickstart.stealth.url" value="" /></span><br />
		</div>
	</div>

	<div class="clr"></div>

	<div class="step4">
		<div class="circle">4</div>
		<h2>EXTRACT_FILES</h2>
		<div class="area-container">
			<span></span>
			<span id="gobutton" class="button">BTN_START</span>
		</div>
	</div>

	<div class="clr"></div>
</div>

<div id="page2">
	<div id="page2a">
		<div class="circle">5</div>
		<h2>EXTRACTING</h2>
		<div class="area-container">
			<div id="warn-not-close">DO_NOT_CLOSE_EXTRACT</div>
			<div id="progressbar">
				<div id="progressbar-inner">&nbsp;</div>
			</div>
			<div id="currentFile"></div>
		</div>
	</div>

	<div id="extractionComplete" style="display: none">
		<div class="circle">6</div>
		<h2>RESTACLEANUP</h2>
		<div id="runInstaller" class="button">BTN_RUNINSTALLER</div>
		<div id="runCleanup" class="button" style="display:none">BTN_CLEANUP</div>
		<div id="gotoSite" class="button" style="display:none">BTN_SITEFE</div>
		<div id="gotoAdministrator" class="button" style="display:none">BTN_SITEBE</div>
		<div id="gotoPostRestorationRroubleshooting" style="display:none">
			<a href="https://www.akeebabackup.com/documentation/troubleshooter/post-restoration.html" target="_blank">POSTRESTORATIONTROUBLESHOOTING</a>
		</div>
	</div>

	<div id="warningsBox" style="display: none;">
		<div id="warningsHeader">
			<h2>WARNINGS</h2>
		</div>
		<div id="warningsContainer">
		<div id="warnings"></div>
		</div>
	</div>

	<div id="error" style="display: none;">
		<h3>ERROR_OCCURED</h3>
		<p id="errorMessage"></p>
		<div id="gotoStart" class="button">BTN_GOTOSTART</div>
		<p><a href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a></p>
	</div>
</div>

<div id="footer">
	<div class="copyright">Copyright &copy; 2008&ndash;2010 <a	href="http://www.akeebabackup.com">Nicholas K.
		Dionysopoulos / Akeeba Backup</a>. All legal rights reserved.<br />

		This program is free software: you can redistribute it and/or modify it under the terms of
		the <a href="http://www.gnu.org/gpl-3.htmlhttp://www.gnu.org/copyleft/gpl.html">GNU General
		Public License</a> as published by the Free Software Foundation, either version 3 of the License,
		or (at your option) any later version.
	</div>
</div>

</div>

</body>
</html>
	<?php 
}
Пример #2
0
function echoPage()
{
    $edition = KICKSTARTPRO ? 'Professional' : 'Core';
    $automation = AKAutomation::getInstance();
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Akeeba Kickstart <?php 
    echo $edition;
    ?>
 <?php 
    echo VERSION;
    ?>
</title>
<style type="text/css" media="all" rel="stylesheet">
<?php 
    echoCSS();
    ?>
</style>
<?php 
    if (@file_exists('jquery.min.js')) {
        ?>
<script type="text/javascript" src="jquery.min.js"></script>
<?php 
    } else {
        ?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<?php 
    }
    if (@file_exists('json2.min.js')) {
        ?>
<script type="text/javascript" src="json2.min.js"></script>
<?php 
    } else {
        ?>
<script type="text/javascript" src="http://yandex.st/json2/2011-10-19/json2.min.js"></script>
<?php 
    }
    ?>
<script type="text/javascript" language="javascript">
	var akeeba_automation = <?php 
    echo $automation->hasAutomation() ? 'true' : 'false';
    ?>
;
	var akeeba_debug = <?php 
    echo defined('KSDEBUG') ? 'true' : 'false';
    ?>
;

	$(document).ready(function(){
		// Hide 2nd Page
		$('#page2').css('display','none');

		// Translate the GUI
		translateGUI();

		// Hook interaction handlers
		$(document).keyup( closeLightbox );
		$('#kickstart\\.procengine').change( onChangeProcengine );
		$('#checkFTPTempDir').click( oncheckFTPTempDirClick );
		$('#resetFTPTempDir').click( onresetFTPTempDir );
		$('#testFTP').click( onTestFTPClick );
		$('#gobutton').click( onStartExtraction );
		$('#runInstaller').click( onRunInstallerClick );
		$('#runCleanup').click( onRunCleanupClick );
		$('#gotoSite').click(function(event){window.open('index.php','finalstepsite'); window.close();});
		$('#gotoAdministrator').click(function(event){window.open('administrator/index.php','finalstepadmin'); window.close();});
		$('#gotoStart').click( onGotoStartClick );

		// Reset the progress bar
		setProgressBar(0);

		// Do we have automation?
		if(akeeba_automation) {
			$('#automode').css('display','block');
			$('#gobutton').click();
		} else {
			// Show warning
			if( jQuery.browser.msie && (jQuery.browser.version.substr(0,1) == '7') )
			{
				$('#ie7Warning').css('display','block');
			}
			if(!akeeba_debug) {
				$('#preextraction').css('display','block');
				$('#fade').css('display','block');
			}
		}
	});

	var translation = {
	<?php 
    echoTranslationStrings();
    ?>
	}

	var akeeba_ajax_url = '<?php 
    echo basename(__FILE__);
    ?>
';
	var akeeba_error_callback = onGenericError;
	var akeeba_restoration_stat_inbytes = 0;
	var akeeba_restoration_stat_outbytes = 0;
	var akeeba_restoration_stat_files = 0;
	var akeeba_restoration_stat_total = 0;
	var akeeba_factory = null;

	function translateGUI()
	{
		$('*').each(function(i,e){
			transKey = $(e).text();
			if(array_key_exists(transKey, translation))
			{
				$(e).text( translation[transKey] );
			}
		});
	}

	function trans(key)
	{
		if(array_key_exists(key, translation)) {
			return translation[key];
		} else {
			return key;
		}
	}

	function array_key_exists ( key, search ) {
	   if (!search || (search.constructor !== Array && search.constructor !== Object)){
	        return false;
	    }
	    return key in search;
	}

	function empty (mixed_var) {
	    var key;

	    if (mixed_var === "" ||
	        mixed_var === 0 ||
	        mixed_var === "0" ||
	        mixed_var === null ||
	        mixed_var === false ||
	        typeof mixed_var === 'undefined'
	    ){
	        return true;
	    }

	    if (typeof mixed_var == 'object') {
	        for (key in mixed_var) {
	            return false;
	        }
	        return true;
	    }

	    return false;
	}

	function is_array (mixed_var) {
	    var key = '';
	    var getFuncName = function (fn) {
	        var name = (/\W*function\s+([\w\$]+)\s*\(/).exec(fn);
	        if (!name) {
	            return '(Anonymous)';
	        }
	        return name[1];
	    };

	    if (!mixed_var) {
	        return false;
	    }

	    // BEGIN REDUNDANT
	    this.php_js = this.php_js || {};
	    this.php_js.ini = this.php_js.ini || {};
	    // END REDUNDANT

	    if (typeof mixed_var === 'object') {

	        if (this.php_js.ini['phpjs.objectsAsArrays'] &&  // Strict checking for being a JavaScript array (only check this way if call ini_set('phpjs.objectsAsArrays', 0) to disallow objects as arrays)
	            (
	            (this.php_js.ini['phpjs.objectsAsArrays'].local_value.toLowerCase &&
	                    this.php_js.ini['phpjs.objectsAsArrays'].local_value.toLowerCase() === 'off') ||
	                parseInt(this.php_js.ini['phpjs.objectsAsArrays'].local_value, 10) === 0)
	            ) {
	            return mixed_var.hasOwnProperty('length') && // Not non-enumerable because of being on parent class
	                            !mixed_var.propertyIsEnumerable('length') && // Since is own property, if not enumerable, it must be a built-in function
	                                getFuncName(mixed_var.constructor) !== 'String'; // exclude String()
	        }

	        if (mixed_var.hasOwnProperty) {
	            for (key in mixed_var) {
	                // Checks whether the object has the specified property
	                // if not, we figure it's not an object in the sense of a php-associative-array.
	                if (false === mixed_var.hasOwnProperty(key)) {
	                    return false;
	                }
	            }
	        }

	        // Read discussion at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_is_array/
	        return true;
	    }

	    return false;
	}

	/**
	 * Performs an AJAX request and returns the parsed JSON output.
	 * The global akeeba_ajax_url is used as the AJAX proxy URL.
	 * If there is no errorCallback, the global akeeba_error_callback is used.
	 * @param data An object with the query data, e.g. a serialized form
	 * @param successCallback A function accepting a single object parameter, called on success
	 * @param errorCallback A function accepting a single string parameter, called on failure
	 */
	function doAjax(data, successCallback, errorCallback)
	{
		var structure =
		{
			type: "POST",
			url: akeeba_ajax_url,
			cache: false,
			data: data,
			timeout: 600000,
			success: function(msg) {
				// Initialize
				var junk = null;
				var message = "";

				// Get rid of junk before the data
				var valid_pos = msg.indexOf('###');
				if( valid_pos == -1 ) {
					// Valid data not found in the response
					msg = 'Invalid AJAX data received:<br/>' + msg;
					if(errorCallback == null)
					{
						if(akeeba_error_callback != null)
						{
							akeeba_error_callback(msg);
						}
					}
					else
					{
						errorCallback(msg);
					}
					return;
				} else if( valid_pos != 0 ) {
					// Data is prefixed with junk
					junk = msg.substr(0, valid_pos);
					message = msg.substr(valid_pos);
				}
				else
				{
					message = msg;
				}
				message = message.substr(3); // Remove triple hash in the beginning

				// Get of rid of junk after the data
				var valid_pos = message.lastIndexOf('###');
				message = message.substr(0, valid_pos); // Remove triple hash in the end

				try {
					var data = eval('('+message+')');
				} catch(err) {
					var msg = err.message + "\n<br/>\n<pre>\n" + message + "\n</pre>";
					if(errorCallback == null)
					{
						if(akeeba_error_callback != null)
						{
							akeeba_error_callback(msg);
						}
					}
					else
					{
						errorCallback(msg);
					}
					return;
				}

				// Call the callback function
				successCallback(data);
			},
			error: function(Request, textStatus, errorThrown) {
				var message = '<strong>AJAX Loading Error</strong><br/>HTTP Status: '+Request.status+' ('+Request.statusText+')<br/>';
				message = message + 'Internal status: '+textStatus+'<br/>';
				message = message + 'XHR ReadyState: ' + Response.readyState + '<br/>';
				message = message + 'Raw server response:<br/>'+Request.responseText;
				if(errorCallback == null)
				{
					if(akeeba_error_callback != null)
					{
						akeeba_error_callback(message);
					}
				}
				else
				{
					errorCallback(message);
				}
			}
		};
		$.ajax( structure );
	}

	function onChangeProcengine(event)
	{
		if( $('#kickstart\\.procengine').val() == 'ftp' ) {
			$('#ftp-options').show('fast');
		} else {
			$('#ftp-options').hide('fast');
		}
	}

	function closeLightbox(event)
	{
		var closeMe = false;

		if( (event == null) || (event == undefined) ) {
			closeMe = true;
		} else if(event.keyCode == '27') {
			closeMe = true;
		}

		if(closeMe)
		{
			document.getElementById('preextraction').style.display='none';
			document.getElementById('genericerror').style.display='none';
			document.getElementById('fade').style.display='none';
			$(document).unbind('keyup', closeLightbox);
		}
	}

	function onGenericError(msg)
	{
		$('#genericerrorInner').html(msg);
		$('#genericerror').css('display','block');
		$('#fade').css('display','block');
		$(document).keyup(closeLightbox);
	}

	function setProgressBar(percent)
	{
		var newValue = 0;

		if(percent <= 1) {
			newValue = 100 * percent;
		} else {
			newValue = percent;
		}

		$('#progressbar-inner').css('width',percent+'%');
	}

	function oncheckFTPTempDirClick(event)
	{
		var data = {
			'task' : 'checkTempdir',
			'json': JSON.stringify({
				'kickstart.ftp.tempdir': $('#kickstart\\.ftp\\.tempdir').val()
			})
		};

		doAjax(data, function(ret){
			var key = ret.status ? 'FTP_TEMPDIR_WRITABLE' : 'FTP_TEMPDIR_UNWRITABLE';
			alert( trans(key) );
		});
	}

	function onTestFTPClick(event)
	{
		var data = {
			'task' : 'checkFTP',
			'json': JSON.stringify({
				'kickstart.ftp.host':		$('#kickstart\\.ftp\\.host').val(),
				'kickstart.ftp.port':		$('#kickstart\\.ftp\\.port').val(),
				'kickstart.ftp.ssl':		$('#kickstart\\.ftp\\.ssl').is(':checked'),
				'kickstart.ftp.passive':	$('#kickstart\\.ftp\\.passive').is(':checked'),
				'kickstart.ftp.user':		$('#kickstart\\.ftp\\.user').val(),
				'kickstart.ftp.pass':		$('#kickstart\\.ftp\\.pass').val(),
				'kickstart.ftp.dir':		$('#kickstart\\.ftp\\.dir').val(),
				'kickstart.ftp.tempdir':	$('#kickstart\\.ftp\\.tempdir').val()
			})
		};
		doAjax(data, function(ret){
			var key = ret.status ? 'FTP_CONNECTION_OK' : 'FTP_CONNECTION_FAILURE';
			alert( trans(key) + "\n\n" + (ret.status ? '' : ret.message) );
		});
	}

	function onStartExtraction()
	{
		$('#page1').hide('fast');
		$('#page2').show('fast');

		$('#currentFile').text( '' );

		akeeba_error_callback = errorHandler;

		var data = {
			'task' : 'startExtracting',
			'json': JSON.stringify({
<?php 
    if (!$automation->hasAutomation()) {
        ?>
				'kickstart.setup.sourcefile':		$('#kickstart\\.setup\\.sourcefile').val(),
				'kickstart.jps.password':			$('#kickstart\\.jps\\.password').val(),
				'kickstart.tuning.min_exec_time':	$('#kickstart\\.tuning\\.min_exec_time').val(),
				'kickstart.tuning.max_exec_time':	$('#kickstart\\.tuning\\.max_exec_time').val(),
				'kickstart.stealth.enable': 		$('#kickstart\\.stealth\\.enable').is(':checked'),
				'kickstart.stealth.url': 			$('#kickstart\\.stealth\\.url').val(),
				'kickstart.tuning.run_time_bias':	75,
				'kickstart.setup.restoreperms':		0,
				'kickstart.setup.dryrun':			0,
				'kickstart.setup.ignoreerrors':		$('#kickstart\\.setup\\.ignoreerrors').is(':checked'),
				'kickstart.enabled':				1,
				'kickstart.security.password':		'',
				'kickstart.procengine':				$('#kickstart\\.procengine').val(),
				'kickstart.ftp.host':				$('#kickstart\\.ftp\\.host').val(),
				'kickstart.ftp.port':				$('#kickstart\\.ftp\\.port').val(),
				'kickstart.ftp.ssl':				$('#kickstart\\.ftp\\.ssl').is(':checked'),
				'kickstart.ftp.passive':			$('#kickstart\\.ftp\\.passive').is(':checked'),
				'kickstart.ftp.user':				$('#kickstart\\.ftp\\.user').val(),
				'kickstart.ftp.pass':				$('#kickstart\\.ftp\\.pass').val(),
				'kickstart.ftp.dir':				$('#kickstart\\.ftp\\.dir').val(),
				'kickstart.ftp.tempdir':			$('#kickstart\\.ftp\\.tempdir').val()
<?php 
    } else {
        ?>
				'kickstart.setup.sourcefile':		<?php 
        echo autoVar('kickstart.setup.sourcefile');
        ?>
,
				'kickstart.jps.password':			<?php 
        echo autoVar('kickstart.jps.password');
        ?>
,
				'kickstart.tuning.min_exec_time':	<?php 
        echo autoVar('kickstart.tuning.min_exec_time', 1);
        ?>
,
				'kickstart.tuning.max_exec_time':	<?php 
        echo autoVar('kickstart.tuning.max_exec_time', 5);
        ?>
,
				'kickstart.stealth.enable': 		false,
				'kickstart.tuning.run_time_bias':	75,
				'kickstart.setup.restoreperms':		0,
				'kickstart.setup.dryrun':			0,
				'kickstart.setup.ignoreerrors':		<?php 
        echo autoVar('kickstart.setup.ignoreerrors', 0);
        ?>
,
				'kickstart.enabled':				1,
				'kickstart.security.password':		'',
				'kickstart.procengine':				<?php 
        echo autoVar('kickstart.procengine', 'direct');
        ?>
,
				'kickstart.ftp.host':				<?php 
        echo autoVar('kickstart.ftp.host', 'localhost');
        ?>
,
				'kickstart.ftp.port':				<?php 
        echo autoVar('kickstart.ftp.port', 22);
        ?>
,
				'kickstart.ftp.ssl':				<?php 
        echo autoVar('kickstart.ftp.ssl', 0);
        ?>
,
				'kickstart.ftp.passive':			<?php 
        echo autoVar('kickstart.ftp.passive', 1);
        ?>
,
				'kickstart.ftp.user':				<?php 
        echo autoVar('kickstart.ftp.user');
        ?>
,
				'kickstart.ftp.pass':				<?php 
        echo autoVar('kickstart.ftp.pass');
        ?>
,
				'kickstart.ftp.dir':				<?php 
        echo autoVar('kickstart.ftp.dir', '/');
        ?>
,
				'kickstart.ftp.tempdir':			<?php 
        echo autoVar('kickstart.ftp.tempdir', AKKickstartUtils::getPath() . 'kicktemp');
    }
    ?>
			})
		};
		doAjax(data, function(ret){
			processRestorationStep(ret);
		});
	}

	function processRestorationStep(data)
	{
		// Look for errors
		if(!data.status)
		{
			errorHandler(data.message);
			return;
		}

		// Propagate warnings to the GUI
		if( !empty(data.Warnings) )
		{
			$.each(data.Warnings, function(i, item){
				$('#warnings').append(
					$(document.createElement('div'))
					.html(item)
				);
				$('#warningsBox').show('fast');
			});
		}

		// Parse total size, if exists
		if(array_key_exists('totalsize', data))
		{
			if(is_array(data.filelist))
			{
				akeeba_restoration_stat_total = 0;
				$.each(data.filelist,function(i, item)
				{
					akeeba_restoration_stat_total += item[1];
				});
			}
			akeeba_restoration_stat_outbytes = 0;
			akeeba_restoration_stat_inbytes = 0;
			akeeba_restoration_stat_files = 0;
		}

		// Update GUI
		akeeba_restoration_stat_inbytes += data.bytesIn;
		akeeba_restoration_stat_outbytes += data.bytesOut;
		akeeba_restoration_stat_files += data.files;
		var percentage = 0;
		if( akeeba_restoration_stat_total > 0 )
		{
			percentage = 100 * akeeba_restoration_stat_inbytes / akeeba_restoration_stat_total;
			if(percentage < 0) {
				percentage = 0;
			} else if(percentage > 100) {
				percentage = 100;
			}
		}
		if(data.done) percentage = 100;
		setProgressBar(percentage);
		$('#currentFile').text( data.lastfile );

		if(!empty(data.factory)) akeeba_factory = data.factory;

		post = {
			'task'	: 'continueExtracting',
			'json'	: JSON.stringify({factory: akeeba_factory})
		};

		if(!data.done)
		{
			doAjax(post, function(ret){
				processRestorationStep(ret);
			});
		}
		else
		{
			$('#page2a').hide('fast');
			$('#extractionComplete').show('fast');

			$('#runInstaller').css('display','inline-block');
			if(akeeba_automation) $('#runInstaller').click();
		}
	}

	function onGotoStartClick(event)
	{
		$('#page2').hide('fast');
		$('#error').hide('fast');
		$('#page1').show('fast');
	}

	function onRunInstallerClick(event)
	{
		var windowReference = window.open('installation/index.php','installer');
		if(!windowReference.opener) {
			windowReference.opener = this.window;
		}
		$('#runCleanup').css('display','inline-block');
		$('#runInstaller').hide('fast');
	}

	function onRunCleanupClick(event)
	{
		post = {
			'task'	: 'cleanUp',
			// Passing the factory preserves the renamed files array
			'json'	: JSON.stringify({factory: akeeba_factory})
		};

		doAjax(post, function(ret){
			$('#runCleanup').hide('fast');
			$('#gotoSite').css('display','inline-block');
			$('#gotoAdministrator').css('display','inline-block');
			$('#gotoPostRestorationRroubleshooting').css('display','block');
		});
	}

	function errorHandler(msg)
	{
		$('#errorMessage').html(msg);
		$('#error').show('fast');
	}

	function onresetFTPTempDir(event)
	{
		$('#kickstart\\.ftp\\.tempdir').val('<?php 
    echo addcslashes(AKKickstartUtils::getPath(), '\\\'"');
    ?>
');
	}

	/**
	 * Akeeba Kickstart Update Check
	 */

	var akeeba_update = {version: '0'};
	var akeeba_version = '3.6.0';
	
	function version_compare (v1, v2, operator) {
		// BEGIN REDUNDANT
		this.php_js = this.php_js || {};
		this.php_js.ENV = this.php_js.ENV || {};
		// END REDUNDANT
		// Important: compare must be initialized at 0. 
		var i = 0,
			x = 0,
			compare = 0,
			// vm maps textual PHP versions to negatives so they're less than 0.
			// PHP currently defines these as CASE-SENSITIVE. It is important to
			// leave these as negatives so that they can come before numerical versions
			// and as if no letters were there to begin with.
			// (1alpha is < 1 and < 1.1 but > 1dev1)
			// If a non-numerical value can't be mapped to this table, it receives
			// -7 as its value.
			vm = {
				'dev': -6,
				'alpha': -5,
				'a': -5,
				'beta': -4,
				'b': -4,
				'RC': -3,
				'rc': -3,
				'#': -2,
				'p': -1,
				'pl': -1
			},
			// This function will be called to prepare each version argument.
			// It replaces every _, -, and + with a dot.
			// It surrounds any nonsequence of numbers/dots with dots.
			// It replaces sequences of dots with a single dot.
			//    version_compare('4..0', '4.0') == 0
			// Important: A string of 0 length needs to be converted into a value
			// even less than an unexisting value in vm (-7), hence [-8].
			// It's also important to not strip spaces because of this.
			//   version_compare('', ' ') == 1
			prepVersion = function (v) {
				v = ('' + v).replace(/[_\-+]/g, '.');
				v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
				return (!v.length ? [-8] : v.split('.'));
			},
			// This converts a version component to a number.
			// Empty component becomes 0.
			// Non-numerical component becomes a negative number.
			// Numerical component becomes itself as an integer.
			numVersion = function (v) {
				return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
			};
		v1 = prepVersion(v1);
		v2 = prepVersion(v2);
		x = Math.max(v1.length, v2.length);
		for (i = 0; i < x; i++) {
			if (v1[i] == v2[i]) {
				continue;
			}
			v1[i] = numVersion(v1[i]);
			v2[i] = numVersion(v2[i]);
			if (v1[i] < v2[i]) {
				compare = -1;
				break;
			} else if (v1[i] > v2[i]) {
				compare = 1;
				break;
			}
		}
		if (!operator) {
			return compare;
		}

		// Important: operator is CASE-SENSITIVE.
		// "No operator" seems to be treated as "<."
		// Any other values seem to make the function return null.
		switch (operator) {
		case '>':
		case 'gt':
			return (compare > 0);
		case '>=':
		case 'ge':
			return (compare >= 0);
		case '<=':
		case 'le':
			return (compare <= 0);
		case '==':
		case '=':
		case 'eq':
			return (compare === 0);
		case '<>':
		case '!=':
		case 'ne':
			return (compare !== 0);
		case '':
		case '<':
		case 'lt':
			return (compare < 0);
		default:
			return null;
		}
	}

	function checkUpdates()
	{
		var structure =
		{
			type: "GET",
			url: 'http://query.yahooapis.com/v1/public/yql',
			data: {
<?php 
    if (KICKSTARTPRO) {
        ?>
				q: 'SELECT * FROM xml WHERE url="http://nocdn.akeebabackup.com/updates/kickstart.xml"',
<?php 
    } else {
        ?>
				q: 'SELECT * FROM xml WHERE url="http://nocdn.akeebabackup.com/updates/kickstartpro.xml"',
<?php 
    }
    ?>
				format: 'json',
				callback: 'updatesCallback'
			},
			cache: true,
			crossDomain: true,
			jsonp: 'updatesCallback',
			timeout: 15000
		};
		$.ajax( structure );
	}
	
	function updatesCallback(msg)
	{
		$.each(msg.query.results.updates.update, function(i, el){
			var myUpdate = {
				'version'	: el.version,
				'infourl'	: el.infourl['content'],
				'dlurl'		: el.downloads.downloadurl.content
			}
			if(version_compare(myUpdate.version, akeeba_update.version, 'ge')) {
				akeeba_update = myUpdate;
			}
		});
		
		if(version_compare(akeeba_update.version, akeeba_version, 'gt')) {
			notifyAboutUpdates();
		}
	}
	
	function notifyAboutUpdates()
	{
		$('#update-version').text(akeeba_update.version);
		$('#update-dlnow').attr('href', akeeba_update.dlurl);
		$('#update-whatsnew').attr('href', akeeba_update.infourl);
		$('#update-notification').show('slow');
	}
	
	<?php 
    callExtraFeature('onExtraHeadJavascript');
    ?>
	</script>
</head>
<body>

<div id="automode" style="display:none;">
	AUTOMODEON
</div>

<div id="fade" class="black_overlay"></div>

<div id="page-container">

<div id="preextraction" class="white_content">
	<div id="ie7Warning" style="display:none;">
		<h2>Deprecated Internet Explorer version</h2>
		<p>This script is not guaranteed to work properly on Internet Explorer 7 or previous version,
		or on Internet Explorer 8 and higher running in compatibility mode.</p>
		<p>Please use Internet Explorer 8+ in native mode (the &quot;broken page&quot; icon next to the
		address bar should not be enabled). Alternatively, you may use the latest versions of Firefox,
		Safari, Google Chrome or SRWare Iron.</p>
	</div>

	<h2>THINGS_HEADER</h2>
	<ol>
		<li>THINGS_01</li>
		<li>THINGS_02</li>
		<li>THINGS_03</li>
		<li>THINGS_04</li>
		<li>THINGS_05</li>
		<li>THINGS_06</li>
		<li>THINGS_07</li>
		<li>THINGS_08</li>
		<li>THINGS_09</li>
	</ol>
	<a href="javascript:void(0)" onclick="closeLightbox();">CLOSE_LIGHTBOX</a>
</div>

<div id="genericerror" class="white_content">
	<pre id="genericerrorInner"></pre>
</div>

	<div id="header">
		<div class="title">Akeeba Kickstart <?php 
    echo $edition;
    ?>
 3.6.0</div>
	</div>
	
	<div id="update-notification" style="display: none">
		<p class="update-notify">UPDATE_HEADER</p>
		<p class="update-whyupdate">UPDATE_NOTICE</p>
		<p class="update-links">
			<a href="#" id="update-dlnow">UPDATE_DLNOW</a>
			<a href="#" id="update-whatsnew" target="_blank">UPDATE_MOREINFO</a> 
		</p>
	</div>

<div id="page1">
	<?php 
    callExtraFeature('onPage1');
    ?>
	
	<div id="page1-content">
		
	<div class="helpme">
		<span>NEEDSOMEHELPKS</span> <a href="https://www.akeebabackup.com/documentation/quick-start-guide/using-kickstart.html" target="_blank">QUICKSTART</a>
	</div>
	
	<div class="step1">
		<div class="circle">1</div>
		<h2>SELECT_ARCHIVE</h2>
		<div class="area-container">
			<?php 
    callExtraFeature('onPage1Step1');
    ?>
			<div class="clr"></div>
			
			<label for="kickstart.setup.sourcefile">ARCHIVE_FILE</label>
			<span class="field">
				<?php 
    $filelist = AKKickstartUtils::getArchivesAsOptions();
    if (!empty($filelist)) {
        ?>
					<select id="kickstart.setup.sourcefile">
					<?php 
        echo $filelist;
        ?>
					</select>
				<?php 
    } else {
        ?>
					<a href="https://www.akeebabackup.com/documentation/troubleshooter/ksnoarchives.html" target="_blank">NOARCHIVESCLICKHERE</a>
				<?php 
    }
    ?>
			</span>
			<br />
			<label for="kickstart.jps.password">JPS_PASSWORD</label>
			<span class="field"><input type="password" id="kickstart.jps.password" value="" /></span>
		</div>
	</div>

	<div class="clr"></div>

	<div class="step2">
		<div class="circle">2</div>
		<h2>SELECT_EXTRACTION</h2>
		<div class="area-container">
			<label for="kickstart.procengine">WRITE_TO_FILES</label>
			<span class="field">
				<select id="kickstart.procengine">
					<option value="direct">WRITE_DIRECTLY</option>
					<option value="ftp">WRITE_FTP</option>
				</select>
			</span><br/>
			
			<label for="kickstart.setup.ignoreerrors">IGNORE_MOST_ERRORS</label>
			<span class="field"><input type="checkbox" id="kickstart.setup.ignoreerrors" /></span>

			<div id="ftp-options">
				<label for="kickstart.ftp.host">FTP_HOST</label>
				<span class="field"><input type="text" id="kickstart.ftp.host" value="localhost" /></span><br />
				<label for="kickstart.ftp.port">FTP_PORT</label>
				<span class="field"><input type="text" id="kickstart.ftp.port" value="21" /></span><br />
				<label for="kickstart.ftp.ssl">FTP_FTPS</label>
				<span class="field"><input type="checkbox" id="kickstart.ftp.ssl" /></span><br />
				<label for="kickstart.ftp.passive">FTP_PASSIVE</label>
				<span class="field"><input type="checkbox" id="kickstart.ftp.passive" checked="checked" /></span><br />
				<label for="kickstart.ftp.user">FTP_USER</label>
				<span class="field"><input type="text" id="kickstart.ftp.user" value="" /></span><br />
				<label for="kickstart.ftp.pass">FTP_PASS</label>
				<span	class="field"><input type="password" id="kickstart.ftp.pass" value="" /></span><br />
				<label for="kickstart.ftp.dir">FTP_DIR</label>
				<span class="field"><input type="text" id="kickstart.ftp.dir" value="" /></span><br />

				<label for="kickstart.ftp.tempdir">FTP_TEMPDIR</label>
				<span class="field">
					<input type="text" id="kickstart.ftp.tempdir" value="<?php 
    echo htmlentities(AKKickstartUtils::getPath());
    ?>
" />
					<span class="button" id="checkFTPTempDir">BTN_CHECK</span>
					<span class="button" id="resetFTPTempDir">BTN_RESET</span>
				</span><br />
				<label></label>
				<span class="button" id="testFTP">BTN_TESTFTPCON</span>
				<a id="notWorking" class="button" href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a>
				<br />
			</div>

		</div>
	</div>

	<div class="clr"></div>

	<div class="step3">
		<div class="circle">3</div>
		<h2>FINE_TUNE</h2>
		<div class="area-container">
			<label for="kickstart.tuning.min_exec_time">MIN_EXEC_TIME</label>
			<span class="field"><input type="text" id="kickstart.tuning.min_exec_time" value="1" /></span> <span>SECONDS_PER_STEP</span><br />
			<label for="kickstart.tuning.max_exec_time">MAX_EXEC_TIME</label>
			<span class="field"><input type="text" id="kickstart.tuning.max_exec_time" value="5" /></span> <span>SECONDS_PER_STEP</span><br />

			<label for="kickstart.stealth.enable">STEALTH_MODE</label>
			<span class="field"><input type="checkbox" id="kickstart.stealth.enable" /></span><br />
			<label for="kickstart.stealth.url">STEALTH_URL</label>
			<span class="field"><input type="text" id="kickstart.stealth.url" value="" /></span><br />
		</div>
	</div>

	<div class="clr"></div>

	<div class="step4">
		<div class="circle">4</div>
		<h2>EXTRACT_FILES</h2>
		<div class="area-container">
			<span></span>
			<span id="gobutton" class="button">BTN_START</span>
		</div>
	</div>

	<div class="clr"></div>
	
	</div>
</div>

<div id="page2">
	<div id="page2a">
		<div class="circle">5</div>
		<h2>EXTRACTING</h2>
		<div class="area-container">
			<div id="warn-not-close">DO_NOT_CLOSE_EXTRACT</div>
			<div id="progressbar">
				<div id="progressbar-inner">&nbsp;</div>
			</div>
			<div id="currentFile"></div>
		</div>
	</div>

	<div id="extractionComplete" style="display: none">
		<div class="circle">6</div>
		<h2>RESTACLEANUP</h2>
		<div id="runInstaller" class="button">BTN_RUNINSTALLER</div>
		<div id="runCleanup" class="button" style="display:none">BTN_CLEANUP</div>
		<div id="gotoSite" class="button" style="display:none">BTN_SITEFE</div>
		<div id="gotoAdministrator" class="button" style="display:none">BTN_SITEBE</div>
		<div id="gotoPostRestorationRroubleshooting" style="display:none">
			<a href="https://www.akeebabackup.com/documentation/troubleshooter/post-restoration.html" target="_blank">POSTRESTORATIONTROUBLESHOOTING</a>
		</div>
	</div>

	<div id="warningsBox" style="display: none;">
		<div id="warningsHeader">
			<h2>WARNINGS</h2>
		</div>
		<div id="warningsContainer">
		<div id="warnings"></div>
		</div>
	</div>

	<div id="error" style="display: none;">
		<h3>ERROR_OCCURED</h3>
		<p id="errorMessage"></p>
		<div id="gotoStart" class="button">BTN_GOTOSTART</div>
		<div>
			<a href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a>
		</div>
	</div>
</div>

<div id="footer">
	<div class="copyright">Copyright &copy; 2008&ndash;2012 <a	href="http://www.akeebabackup.com">Nicholas K.
		Dionysopoulos / Akeeba Backup</a>. All legal rights reserved.<br />

		This program is free software: you can redistribute it and/or modify it under the terms of
		the <a href="http://www.gnu.org/gpl-3.htmlhttp://www.gnu.org/copyleft/gpl.html">GNU General
		Public License</a> as published by the Free Software Foundation, either version 3 of the License,
		or (at your option) any later version.<br />
		Design credits: <a href="http://internet-inspired.com/">Internet Inspired</a>, slightly modified by AkeebaBackup.com
	</div>
</div>

</div>

</body>
</html>
	<?php 
}
Пример #3
0
function echoPage()
{
    $edition = KICKSTARTPRO ? 'Professional' : 'Core';
    $bestArchivePath = AKKickstartUtils::getBestArchivePath();
    $filelist = AKKickstartUtils::getArchivesAsOptions($bestArchivePath);
    ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Akeeba Kickstart <?php 
    echo $edition;
    ?>
 <?php 
    echo VERSION;
    ?>
</title>
	<style type="text/css" media="all" rel="stylesheet">
		<?php 
    echoCSS();
    ?>
	</style>
	<?php 
    if (@file_exists('jquery.min.js')) {
        ?>
		<script type="text/javascript" src="jquery.min.js"></script>
	<?php 
    } else {
        ?>
		<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
	<?php 
    }
    ?>
	<?php 
    if (@file_exists('json2.min.js')) {
        ?>
		<script type="text/javascript" src="json2.min.js"></script>
	<?php 
    } else {
        ?>
		<script type="text/javascript" src="//yandex.st/json2/2011-10-19/json2.min.js"></script>
	<?php 
    }
    ?>
	<?php 
    if (@file_exists('jquery-ui.min.js')) {
        ?>
		<script type="text/javascript" src="jquery-ui.min.js"></script>
	<?php 
    } else {
        ?>
		<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
	<?php 
    }
    ?>
	<?php 
    echoHeadJavascript();
    ?>
	</head>
	<body>

	<div id="automode" style="display:none;">
		AUTOMODEON
	</div>

	<div id="fade" class="black_overlay"></div>

	<div id="page-container">

	<div id="preextraction" class="white_content">
		<div id="ie7Warning" style="display:none;">
			<h2>Deprecated Internet Explorer version</h2>
			<p>
				This script is not guaranteed to work properly on Internet Explorer 8
				or previous version, or on Internet Explorer 9 and higher running
				in compatibility mode.
			</p>
			<p>
				Please use Internet Explorer 9 or later in native mode (the
				&quot;broken page&quot; icon next to the address bar should not be
				enabled). Alternatively, you may use the latest versions of Firefox,
				Safari, Google Chrome or Opera.
			</p>
		</div>

		<h2>THINGS_HEADER</h2>
		<ol>
			<li>THINGS_01</li>
			<li>THINGS_02</li>
			<li>THINGS_03</li>
			<li>THINGS_04</li>
			<li>THINGS_05</li>
			<li>THINGS_06</li>
			<li>THINGS_07</li>
			<li>THINGS_08</li>
			<li>THINGS_09</li>
		</ol>
		<a href="javascript:void(0)" onclick="closeLightbox();">CLOSE_LIGHTBOX</a>
	</div>

	<div id="genericerror" class="white_content">
		<pre id="genericerrorInner"></pre>
	</div>

	<div id="header">
		<div class="title">Akeeba Kickstart <?php 
    echo $edition;
    ?>
 4.0.0</div>
	</div>

	<div id="update-notification" style="display: none">
		<p class="update-notify">UPDATE_HEADER</p>
		<p class="update-whyupdate">UPDATE_NOTICE</p>
		<p class="update-links">
			<a href="#" id="update-dlnow">UPDATE_DLNOW</a>
			<a href="#" id="update-whatsnew" target="_blank">UPDATE_MOREINFO</a>
		</p>
	</div>

	<div id="page1">
		<?php 
    callExtraFeature('onPage1');
    ?>

		<div id="page1-content">

			<div class="helpme">
				<span>NEEDSOMEHELPKS</span> <a href="https://www.akeebabackup.com/documentation/quick-start-guide/using-kickstart.html" target="_blank">QUICKSTART</a>
			</div>

			<div class="step1">
				<div class="circle">1</div>
				<h2>SELECT_ARCHIVE</h2>
				<div class="area-container">
					<?php 
    callExtraFeature('onPage1Step1');
    ?>
					<div class="clr"></div>

					<label for="kickstart.setup.sourcepath">ARCHIVE_DIRECTORY</label>
			<span class="field">
				<input type="text" id="kickstart.setup.sourcepath" value="<?php 
    echo htmlentities($bestArchivePath);
    ?>
" />
				<span class="button" id="reloadArchives" style="margin-top:0;margin-bottom:0">RELOAD_ARCHIVES</span>
			</span>
					<br/>

					<label for="kickstart.setup.sourcefile">ARCHIVE_FILE</label>
			<span class="field" id="sourcefileContainer">
				<?php 
    if (!empty($filelist)) {
        ?>
					<select id="kickstart.setup.sourcefile">
						<?php 
        echo $filelist;
        ?>
					</select>
				<?php 
    } else {
        ?>
					<a href="https://www.akeebabackup.com/documentation/troubleshooter/ksnoarchives.html" target="_blank">NOARCHIVESCLICKHERE</a>
				<?php 
    }
    ?>
			</span>
					<br />
					<label for="kickstart.jps.password">JPS_PASSWORD</label>
					<span class="field"><input type="password" id="kickstart.jps.password" value="" /></span>
				</div>
			</div>

			<div class="clr"></div>

			<div class="step2">
				<div class="circle">2</div>
				<h2>SELECT_EXTRACTION</h2>
				<div class="area-container">
					<label for="kickstart.procengine">WRITE_TO_FILES</label>
			<span class="field">
				<select id="kickstart.procengine">
					<option value="hybrid">WRITE_HYBRID</option>
					<option value="direct">WRITE_DIRECTLY</option>
					<option value="ftp">WRITE_FTP</option>
					<option value="sftp">WRITE_SFTP</option>
				</select>
			</span><br/>

					<label for="kickstart.setup.ignoreerrors">IGNORE_MOST_ERRORS</label>
					<span class="field"><input type="checkbox" id="kickstart.setup.ignoreerrors" /></span>

					<div id="ftp-options">
						<label for="kickstart.ftp.host">FTP_HOST</label>
						<span class="field"><input type="text" id="kickstart.ftp.host" value="localhost" /></span><br />
						<label for="kickstart.ftp.port">FTP_PORT</label>
						<span class="field"><input type="text" id="kickstart.ftp.port" value="21" /></span><br />
						<div id="ftp-ssl-passive">
							<label for="kickstart.ftp.ssl">FTP_FTPS</label>
							<span class="field"><input type="checkbox" id="kickstart.ftp.ssl" /></span><br />
							<label for="kickstart.ftp.passive">FTP_PASSIVE</label>
							<span class="field"><input type="checkbox" id="kickstart.ftp.passive" checked="checked" /></span><br />
						</div>
						<label for="kickstart.ftp.user">FTP_USER</label>
						<span class="field"><input type="text" id="kickstart.ftp.user" value="" /></span><br />
						<label for="kickstart.ftp.pass">FTP_PASS</label>
						<span	class="field"><input type="password" id="kickstart.ftp.pass" value="" /></span><br />
						<label for="kickstart.ftp.dir">FTP_DIR</label>
				<span class="field">
                    <input type="text" id="kickstart.ftp.dir" value="" />
                    <span class="button" id="browseFTP" style="margin-top:0;margin-bottom:0">FTP_BROWSE</span>
                </span><br />

						<label for="kickstart.ftp.tempdir">FTP_TEMPDIR</label>
				<span class="field">
					<input type="text" id="kickstart.ftp.tempdir" value="<?php 
    echo htmlentities(AKKickstartUtils::getPath());
    ?>
" />
					<span class="button" id="checkFTPTempDir">BTN_CHECK</span>
					<span class="button" id="resetFTPTempDir">BTN_RESET</span>
				</span><br />
						<label></label>
						<span class="button" id="testFTP">BTN_TESTFTPCON</span>
						<a id="notWorking" class="button" href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a>
						<br />
					</div>

				</div>
			</div>

			<div class="clr"></div>

			<div class="step3">
				<div class="circle">3</div>
				<h2>FINE_TUNE</h2>
				<div class="area-container">
					<label for="kickstart.tuning.min_exec_time">MIN_EXEC_TIME</label>
					<span class="field"><input type="text" id="kickstart.tuning.min_exec_time" value="1" /></span> <span>SECONDS_PER_STEP</span><br />
					<label for="kickstart.tuning.max_exec_time">MAX_EXEC_TIME</label>
					<span class="field"><input type="text" id="kickstart.tuning.max_exec_time" value="5" /></span> <span>SECONDS_PER_STEP</span><br />

					<label for="kickstart.stealth.enable">STEALTH_MODE</label>
					<span class="field"><input type="checkbox" id="kickstart.stealth.enable" /></span><br />
					<label for="kickstart.stealth.url">STEALTH_URL</label>
					<span class="field"><input type="text" id="kickstart.stealth.url" value="" /></span><br />
				</div>
			</div>

			<div class="clr"></div>

			<div class="step4">
				<div class="circle">4</div>
				<h2>EXTRACT_FILES</h2>
				<div class="area-container">
					<span></span>
					<span id="gobutton" class="button">BTN_START</span>
				</div>
			</div>

			<div class="clr"></div>

		</div>

		<div id="ftpdialog" style="display:none;">
			<p class="instructions alert alert-info">FTPBROWSER_LBL_INSTRUCTIONS</p>
			<div class="error alert alert-error" id="ftpBrowserErrorContainer">
				<h3>FTPBROWSER_LBL_ERROR</h3>
				<p id="ftpBrowserError"></p>
			</div>
			<ul id="ak_crumbs" class="breadcrumb"></ul>
			<div class="row-fluid">
				<div class="span12">
					<table id="ftpBrowserFolderList" class="table table-striped">
					</table>
				</div>
			</div>
		</div>
	</div>

	<div id="page2">
		<div id="page2a">
			<div class="circle">5</div>
			<h2>EXTRACTING</h2>
			<div class="area-container">
				<div id="warn-not-close">DO_NOT_CLOSE_EXTRACT</div>
				<div id="progressbar">
					<div id="progressbar-inner">&nbsp;</div>
				</div>
				<div id="currentFile"></div>
			</div>
		</div>

		<div id="extractionComplete" style="display: none">
			<div class="circle">6</div>
			<h2>RESTACLEANUP</h2>
			<div id="runInstaller" class="button">BTN_RUNINSTALLER</div>
			<div id="runCleanup" class="button" style="display:none">BTN_CLEANUP</div>
			<div id="gotoSite" class="button" style="display:none">BTN_SITEFE</div>
			<div id="gotoAdministrator" class="button" style="display:none">BTN_SITEBE</div>
			<div id="gotoPostRestorationRroubleshooting" style="display:none">
				<a href="https://www.akeebabackup.com/documentation/troubleshooter/post-restoration.html" target="_blank">POSTRESTORATIONTROUBLESHOOTING</a>
			</div>
		</div>

		<div id="warningsBox" style="display: none;">
			<div id="warningsHeader">
				<h2>WARNINGS</h2>
			</div>
			<div id="warningsContainer">
				<div id="warnings"></div>
			</div>
		</div>

		<div id="error" style="display: none;">
			<h3>ERROR_OCCURED</h3>
			<p id="errorMessage"></p>
			<div id="gotoStart" class="button">BTN_GOTOSTART</div>
			<div>
				<a href="https://www.akeebabackup.com/documentation/troubleshooter/kscantextract.html" target="_blank">CANTGETITTOWORK</a>
			</div>
		</div>
	</div>

	<div id="footer">
		<div class="copyright">Copyright &copy; 2008&ndash;2013 <a	href="http://www.akeebabackup.com">Nicholas K.
				Dionysopoulos / Akeeba Backup</a>. All legal rights reserved.<br />

			This program is free software: you can redistribute it and/or modify it under the terms of
			the <a href="http://www.gnu.org/gpl-3.htmlhttp://www.gnu.org/copyleft/gpl.html">GNU General
				Public License</a> as published by the Free Software Foundation, either version 3 of the License,
			or (at your option) any later version.<br />
			Design credits: <a href="http://internet-inspired.com/">Internet Inspired</a>, slightly modified by AkeebaBackup.com
		</div>
	</div>

	</div>

	</body>
	</html>
<?php 
}