first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,184 @@
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2019 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU GPL version 3 or later
*/
namespace Solo\View\Restore;
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
use Awf\Text\Text;
use Awf\Uri\Uri;
use Awf\Utils\Template;
use Solo\Helper\Escape;
use Solo\View\Html as BaseHtml;
class Html extends BaseHtml
{
public $password;
public $id;
public $ftpparams;
public $extractionmodes;
public $extension;
public $siteURL;
public function display($tpl = null)
{
Template::addJs('media://js/solo/configuration.js', $this->container->application);
Template::addJs('media://js/solo/restore.js', $this->container->application);
$this->loadCommonJavascript();
return parent::display($tpl);
}
public function onBeforeMain()
{
/** @var \Solo\Model\Restore $model */
$model = $this->getModel();
$this->id = $model->getState('id', 0, 'int');
$this->ftpparams = $model->getFTPParams();
$this->extractionmodes = $model->getExtractionModes();
$backup = Platform::getInstance()->get_statistics($this->id);
$this->extension = strtolower(substr($backup['absolute_path'], -3));
$router = $this->container->router;
$urlBrowser = addslashes($router->route('index.php?view=browser&tmpl=component&processfolder=1&folder='));
$urlFtpBrowser = addslashes($router->route('index.php?view=ftpbrowser'));
$urlTestFtp = addslashes($router->route('index.php?view=restore&task=ajax&ajax=testftp'));
$js = <<< JS
// Callback routine to close the browser dialog
var akeeba_browser_callback = null;
akeeba.loadScripts.push(function() {
akeeba.Configuration.URLs['browser'] = '$urlBrowser';
akeeba.Configuration.URLs['ftpBrowser'] = '$urlFtpBrowser';
akeeba.Configuration.URLs['testFtp'] = '$urlTestFtp';
// This element doesn't exist in the current version of the code
try
{
akeeba.System.addEventListener('ftp-browse', 'click', function(e) {
akeeba.Configuration.FtpBrowser.initialise('ftp.initial_directory', 'ftp');
});
}
catch (e)
{
}
akeeba.System.addEventListener('testftp', 'click', function(e) {
akeeba.Configuration.FtpTest.testConnection('ftp.test', 'ftp');
});
akeeba.System.addEventListener(document.getElementById('procengine'), 'change', akeeba.Restore.onProcEngineChange);
akeeba.Restore.onProcEngineChange();
// Work around Safari which ignores autocomplete=off
setTimeout(akeeba.Restore.restoreDefaultOptions, 500);
});
JS;
$this->getContainer()->application->getDocument()->addScriptDeclaration($js);
return true;
}
public function onBeforeStart()
{
/** @var \Solo\Model\Restore $model */
$model = $this->getModel();
$inCMS = $this->container->segment->get('insideCMS', false);
if ($inCMS)
{
$this->siteURL = $this->container->appConfig->get('cms_url', '');
}
else
{
$this->siteURL = Factory::getConfiguration()->get('akeeba.platform.site_url', '');
}
$this->siteURL = trim($this->siteURL);
$this->setLayout('restore');
$password = Escape::escapeJS($model->getState('password'));
$urlToRestore = Escape::escapeJS(Uri::base(false, $this->container) . 'restore.php');
$mainURL = Escape::escapeJS($this->getContainer()->router->route('index.php'));
$js = <<< JS
// Callback routine to close the browser dialog
var akeeba_browser_callback = null;
akeeba.loadScripts.push(function() {
akeeba.Restore.password = '$password';
akeeba.Restore.ajaxURL = '$urlToRestore';
akeeba.Restore.mainURL = '$mainURL';
akeeba.Restore.errorCallback = akeeba.Restore.errorCallbackDefault;
akeeba.Restore.pingRestoration();
});
JS;
$this->getContainer()->application->getDocument()->addScriptDeclaration($js);
return true;
}
public function loadCommonJavascript()
{
$keys = array(
'COM_AKEEBA_CONFIG_UI_BROWSE' => 'COM_AKEEBA_CONFIG_UI_BROWSE',
'COM_AKEEBA_CONFIG_UI_CONFIG' => 'COM_AKEEBA_CONFIG_UI_CONFIG',
'COM_AKEEBA_CONFIG_UI_REFRESH' => 'COM_AKEEBA_CONFIG_UI_REFRESH',
'COM_AKEEBA_CONFIG_UI_FTPBROWSER_TITLE' => 'COM_AKEEBA_CONFIG_UI_FTPBROWSER_TITLE',
'COM_AKEEBA_FILEFILTERS_LABEL_UIROOT' => 'SOLO_COMMON_LBL_ROOT',
'COM_AKEEBA_CONFIG_DIRECTFTP_TEST_OK' => 'COM_AKEEBA_CONFIG_DIRECTFTP_TEST_OK',
'COM_AKEEBA_CONFIG_DIRECTFTP_TEST_FAIL' => 'COM_AKEEBA_CONFIG_DIRECTFTP_TEST_FAIL',
'COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE' => 'COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE',
);
$strings = array();
foreach ($keys as $k => $v)
{
$strings[$k] = Escape::escapeJS(Text::_($v));
}
$router = $this->getContainer()->router;
$browserURL = Escape::escapeJS($router->route('index.php?view=browser&tmpl=component&processfolder=1&folder='));
$ftpBrowserURL = Escape::escapeJS($router->route('index.php?view=ftpbrowser'));
$testFTPURL = Escape::escapeJS($router->route('index.php?view=configuration&task=testftp'));
$js = <<< JS
akeeba.loadScripts.push(function() {
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_UI_BROWSE'] = '{$strings['COM_AKEEBA_CONFIG_UI_BROWSE']}';
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_UI_CONFIG'] = '{$strings['COM_AKEEBA_CONFIG_UI_CONFIG']}';
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_UI_REFRESH'] = '{$strings['COM_AKEEBA_CONFIG_UI_REFRESH']}';
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_UI_FTPBROWSER_TITLE'] = '{$strings['COM_AKEEBA_CONFIG_UI_FTPBROWSER_TITLE']}';
akeeba.Configuration.translations['COM_AKEEBA_FILEFILTERS_LABEL_UIROOT'] = '{$strings['COM_AKEEBA_FILEFILTERS_LABEL_UIROOT']}';
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_DIRECTFTP_TEST_OK'] = '{$strings['COM_AKEEBA_CONFIG_DIRECTFTP_TEST_OK']}';
akeeba.Configuration.translations['COM_AKEEBA_CONFIG_DIRECTFTP_TEST_FAIL'] = '{$strings['COM_AKEEBA_CONFIG_DIRECTFTP_TEST_FAIL']}';
akeeba.Configuration.translations['COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE'] = '{$strings['COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE']}';
akeeba.Restore.translations['COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE'] = '{$strings['COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE']}';
akeeba.Configuration.URLs['browser'] = '$browserURL';
akeeba.Configuration.URLs['ftpBrowser'] = '$ftpBrowserURL';
akeeba.Configuration.URLs['testFtp'] = '$testFTPURL';
});
JS;
$this->getContainer()->application->getDocument()->addScriptDeclaration($js);
}
}

View File

@@ -0,0 +1,158 @@
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2019 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU GPL version 3 or later
*/
use Awf\Text\Text;
defined('_AKEEBA') or die();
/** @var \Solo\View\Restore\Html $this */
$router = $this->getContainer()->router;
$token = $this->getContainer()->session->getCsrfToken()->getValue();
echo $this->loadAnyTemplate('Common/ftp_browser');
echo $this->loadAnyTemplate('Common/ftp_test');
echo $this->loadAnyTemplate('Common/folder_browser');
?>
<form action="<?php echo $router->route('index.php?view=restore&task=start&id=' . $this->id) ?>" method="POST"
name="adminForm" id="adminForm" class="akeeba-form--horizontal" role="form">
<input type="hidden" name="token" value="<?php echo $token ?>">
<h4><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_EXTRACTIONMETHOD'); ?></h4>
<div class="akeeba-form-group">
<label for="procengine">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_EXTRACTIONMETHOD'); ?>
</label>
<?php echo \Awf\Html\Select::genericList($this->extractionmodes, 'procengine', ['class' => 'form-control'], 'value', 'text', $this->ftpparams['procengine']); ?>
<p class="akeeba-help-text">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_REMOTETIP'); ?>
</p>
</div>
<?php if($this->getContainer()->appConfig->get('showDeleteOnRestore', 0) == 1): ?>
<div class="akeeba-form-group">
<label for="zapbefore">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_ZAPBEFORE'); ?>
</label>
<div class="akeeba-toggle">
<?php echo \Solo\Helper\FEFSelect::booleanList('zapbefore', array('forToggle' => 1), 0) ?>
</div>
<p class="akeeba-help-text"><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_ZAPBEFORE_HELP'); ?></p>
</div>
<?php endif; ?>
<?php if ($this->extension == 'jps'): ?>
<h4><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_JPSOPTIONS'); ?></h4>
<div class="akeeba-form-group">
<label >
<?php echo Text::_('COM_AKEEBA_CONFIG_JPS_KEY_TITLE') ?>
</label>
<input value="" type="password" class="form-control" id="jps_key" name="jps_key"
placeholder="<?php echo Text::_('COM_AKEEBA_CONFIG_JPS_KEY_TITLE') ?>" autocomplete="off">
</div>
<?php endif; ?>
<div id="ftpOptions">
<h4><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FTPOPTIONS'); ?></h4>
<input id="ftp_passive_mode" type="checkbox" checked autocomplete="off" style="display: none">
<input id="ftp_ftps" type="checkbox" autocomplete="off" style="display: none">
<div class="akeeba-form-group">
<label for="ftp_host">
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_HOST_TITLE') ?>
</label>
<input id="ftp_host" name="ftp_host" value="<?php echo $this->ftpparams['ftp_host']; ?>"
type="text" class="form-control">
</div>
<div class="akeeba-form-group">
<label for="ftp_port">
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_PORT_TITLE') ?>
</label>
<input id="ftp_port" name="ftp_port" value="<?php echo $this->ftpparams['ftp_port']; ?>"
type="text" class="form-control">
</div>
<div class="akeeba-form-group">
<label for="ftp_user">
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_USER_TITLE') ?>
</label>
<input id="ftp_user" name="ftp_user" value="<?php echo $this->ftpparams['ftp_user']; ?>"
type="text" class="form-control">
</div>
<div class="akeeba-form-group">
<label for="ftp_pass">
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_PASSWORD_TITLE') ?>
</label>
<input id="ftp_pass" name="ftp_pass" value="<?php echo $this->ftpparams['ftp_pass']; ?>"
type="password" class="form-control">
</div>
<div class="akeeba-form-group">
<label for="ftp_root">
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_INITDIR_TITLE') ?>
</label>
<input id="ftp_root" name="ftp_root"
value="<?php echo $this->ftpparams['ftp_root']; ?>" type="text" class="form-control">
<div class="akeXXeba-input-group">
<div class="akeXXeba-input-group-btn" style="display: none;">
<button class="akeeba-btn--dark" id="ftp-browse" onclick="return false;">
<span class="akion-folder"></span>
<?php echo Text::_('COM_AKEEBA_CONFIG_UI_BROWSE'); ?>
</button>
</div>
</div>
</div>
</div>
<h4><?= Text::_('COM_AKEEBA_RESTORE_LABEL_TIME_HEAD') ?></h4>
<div class="akeeba-form-group">
<label for="min_exec">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_MIN_EXEC'); ?>
</label>
<input type="number" min="0" max="180" name="min_exec" value="<?= $this->getModel()->getState('min_exec', 0, 'int') ?>"/>
<p class="akeeba-help-text">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_MIN_EXEC_TIP'); ?>
</p>
</div>
<div class="akeeba-form-group">
<label for="max_exec">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_MAX_EXEC'); ?>
</label>
<input type="number" min="0" max="180" name="max_exec" value="<?= $this->getModel()->getState('max_exec', 5, 'int') ?>"/>
<p class="akeeba-help-text">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_MAX_EXEC_TIP'); ?>
</p>
</div>
<hr/>
<div class="akeeba-form-group--pull-right">
<div class="akeeba-form-group--actions">
<button class="akeeba-btn--primary" id="backup-start">
<span class="akion-refresh"></span>
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_START') ?>
</button>
<button class="akeeba-btn--grey" id="testftp" onclick="return false;">
<span class="akion-ios-pulse-strong"></span>
<?php echo Text::_('COM_AKEEBA_CONFIG_DIRECTFTP_TEST_TITLE') ?>
</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,105 @@
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2019 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU GPL version 3 or later
*/
use Awf\Text\Text;
defined('_AKEEBA') or die();
/** @var \Solo\View\Restore\Html $this */
$router = $this->container->router;
?>
<div class="akeeba-block--info">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_DONOTCLOSE'); ?>
</div>
<div id="restoration-progress">
<h3><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_INPROGRESS') ?></h3>
<table class="akeeba-table--striped">
<tr>
<td width="25%">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_BYTESREAD'); ?>
</td>
<td>
<span id="extbytesin"></span>
</td>
</tr>
<tr>
<td width="25%">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_BYTESEXTRACTED'); ?>
</td>
<td>
<span id="extbytesout"></span>
</td>
</tr>
<tr>
<td width="25%">
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FILESEXTRACTED'); ?>
</td>
<td>
<span id="extfiles"></span>
</td>
</tr>
</table>
<div id="response-timer">
<div class="color-overlay"></div>
<div class="text"></div>
</div>
</div>
<div id="restoration-error" style="display:none">
<div class="akeeba-block--failure">
<h4>
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FAILED'); ?>
</h4>
<div id="errorframe">
<p><?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FAILED_INFO'); ?></p>
<p id="backup-error-message">
</p>
</div>
</div>
</div>
<div id="restoration-extract-ok" style="display:none">
<div class="akeeba-block--success">
<h4>
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_SUCCESS'); ?>
</h4>
<?php if (empty($this->siteURL)): ?>
<p>
<?php echo Text::_('SOLO_RESTORE_LABEL_SUCCESS_INFO'); ?>
</p>
<?php else: ?>
<p>
<?php echo Text::sprintf('SOLO_RESTORE_LABEL_SUCCESS_INFO_HASURL', $this->siteURL, $this->siteURL); ?>
</p>
<?php endif; ?>
</div>
<?php if (!empty($this->siteURL)): ?>
<p>
<button class="akeeba-btn--primary" id="restoration-runinstaller" onclick="akeeba.Restore.runInstaller('<?php echo $this->siteURL?>'); return false;">
<span class="akion-android-share"></span>
<?php echo Text::_('SOLO_RESTORE_BTN_INSTALLER'); ?>
</button>
</p>
<p>
<button class="akeeba-btn--green" id="restoration-finalize" style="display: none;" onclick="akeeba.Restore.finalize(); return false;">
<span class="akion-android-exit"></span>
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FINALIZE'); ?>
</button>
</p>
<?php else: ?>
<button class="akeeba-btn--green" id="restoration-finalize" onclick="akeeba.Restore.finalize(); return false;">
<span class="akion-android-exit"></span>
<?php echo Text::_('COM_AKEEBA_RESTORE_LABEL_FINALIZE'); ?>
</button>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,3 @@
{
"show": []
}