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,107 @@
<?php
/**
* @package solo
* @copyright Copyright (c)2014-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Solo\View\Browser;
use Awf\Mvc\View;
use Awf\Text\Text;
use Awf\Utils\Template;
use Solo\Model\Browser;
class Html extends View
{
/**
* Path to current folder (with variables such as [SITEROOT] replaced)
*
* @var string
*/
public $folder = '';
/**
* Path to current folder (WITHOUT variables such as [SITEROOT] replaced)
*
* @var string
*/
public $folder_raw = '';
/**
* Parent folder
*
* @var string
*/
public $parent = '';
/**
* Does the current folder exist in the filesystem?
*
* @var bool
*/
public $exists = false;
/**
* Is the current folder under the site's root directory? False means it's an off-site directory.
*
* @var bool
*/
public $inRoot = false;
/**
* Is the current folder restricted by open_basedir?
*
* @var bool
*/
public $openbasedirRestricted = false;
/**
* Is the current folder writable?
*
* @var bool
*/
public $writable = false;
/**
* Subdirectories
*
* @var array
*/
public $subfolders = [];
/**
* Breadcrumbs to display in the browser view
*
* @var array
*/
public $breadcrumbs = [];
/**
* Pull the folder browser data from the model
*
* @return boolean
*/
public function onBeforeMain()
{
Template::addJs('media://js/solo/browser.js', $this->container->application);
/** @var Browser $model */
$model = $this->getModel();
$this->folder = $model->getState('folder', '', 'string');
$this->folder_raw = $model->getState('folder_raw', '', 'string');
$this->parent = $model->getState('parent', '', 'string');
$this->exists = $model->getState('exists', 0, 'boolean');
$this->inRoot = $model->getState('inRoot', 0, 'boolean');
$this->openbasedirRestricted = $model->getState('openbasedirRestricted', 0, 'boolean');
$this->writable = $model->getState('writable', 0, 'boolean');
$this->subfolders = $model->getState('subfolders');
$this->breadcrumbs = $model->getState('breadcrumbs');
Text::script('COM_AKEEBA_CONFIG_UI_ROOTDIR');
return true;
}
}

View File

@@ -0,0 +1,169 @@
<?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\Browser\Html $this */
$rootDirWarning = \Solo\Helper\Escape::escapeJS(Text::_('COM_AKEEBA_CONFIG_UI_ROOTDIR'));
$this->container->application->getDocument()->addScriptDeclaration(
<<<JS
function akeeba_browser_useThis()
{
var rawFolder = document.forms.adminForm.folderraw.value;
if( rawFolder == '[SITEROOT]' )
{
alert('$rootDirWarning');
rawFolder = '[SITETMP]';
}
window.parent.akeeba.Configuration.onBrowserCallback( rawFolder );
}
JS
);
$router = $this->container->router;
?>
<?php if (empty($this->folder)): ?>
<form action="<?php echo $router->route('index.php?view=browser&tmpl=component&processfolder=0') ?>" method="post"
name="adminForm" id="adminForm">
<input type="hidden" name="folder" id="folder" value=""/>
<input type="hidden" name="token"
value="<?php echo $this->container->session->getCsrfToken()->getValue() ?>"/>
</form>
<?php return; endif; ?>
<?php
$writeableText = Text::_($this->writable ? 'COM_AKEEBA_CPANEL_LBL_WRITABLE' : 'COM_AKEEBA_CPANEL_LBL_UNWRITABLE');
$writeableIcon = $this->writable ? 'akion-checkmark-circled' : 'akion-ios-close';
$writeableClass = $this->writable ? 'akeeba-label--green' : 'akeeba-label--red';
?>
<div class="akeeba-panel--100 akeeba-panel--primary">
<div>
<form action="<?php echo $router->route('index.php?view=browser&tmpl=component') ?>" method="post"
name="adminForm" id="adminForm" class="akeeba-form--inline--with-hidden--no-margins">
<div class="akeeba-form-group">
<span title="<?php echo $writeableText; ?>" class="<?php echo $writeableClass ?>">
<span class="<?php echo $writeableIcon; ?>"></span>
</span>
</div>
<div class="akeeba-form-group">
<input type="text" name="folder" id="folder" size="40" value="<?php echo $this->folder; ?>" />
</div>
<div class="akeeba-form-group--action">
<button class="akeeba-btn--primary" onclick="this.form.submit(); return false;">
<span class="akion-folder"></span>
<?php echo Text::_('COM_AKEEBA_BROWSER_LBL_GO'); ?>
</button>
<button class="akeeba-btn--green" onclick="akeeba_browser_useThis(); return false;">
<span class="akion-share"></span>
<?php echo Text::_('COM_AKEEBA_BROWSER_LBL_USE'); ?>
</button>
</div>
<div class="akeeba-hidden-fields-container">
<input type="hidden" name="token"
value="<?php echo $this->container->session->getCsrfToken()->getValue() ?>"/>
<input type="hidden" name="folderraw" id="folderraw" value="<?php echo $this->folder_raw ?>"/>
<input type="hidden" name="token"
value="<?php echo $this->container->session->getCsrfToken()->getValue() ?>"/>
</div>
</form>
</div>
</div>
<?php if (count($this->breadcrumbs) > 0): ?>
<div class="akeeba-panel--100 akeeba-panel--information">
<div>
<ul class="akeeba-breadcrumb">
<?php $i = 0 ?>
<?php foreach ($this->breadcrumbs as $crumb): ?>
<?php
$link = $router->route("index.php?view=browser&tmpl=component&folder=" . urlencode($crumb['folder']));
$label = htmlentities($crumb['label']);
$i++;
$bull = $i < count($this->breadcrumbs) ? '&bull;' : '';
?>
<li class="<?php echo $bull ? '' : 'active' ?>">
<?php if ($bull): ?>
<a href="<?php echo $link ?>">
<?php echo $label ?>
</a>
<span class="divider">&bull;</span>
<?php else: ?>
<?php echo $label ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif; ?>
<div class="akeeba-panel--100 akeeba-panel">
<div>
<?php if (count($this->subfolders) > 0): ?>
<table class="akeeba-table akeeba-table--striped">
<tr>
<td>
<?php $linkbase = $router->route("index.php?&view=browser&tmpl=component&folder="); ?>
<a class="akeeba-btn--dark--small"
href="<?php echo $linkbase . urlencode($this->parent); ?>">
<span class="akion-arrow-up-a"></span>
<?php echo Text::_('COM_AKEEBA_BROWSER_LBL_GOPARENT') ?>
</a>
</td>
</tr>
<?php foreach ($this->subfolders as $subfolder): ?>
<tr>
<td>
<a href="<?php echo $linkbase . urlencode($this->folder . '/' . $subfolder); ?>"><?php echo htmlentities($subfolder) ?></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<?php if (!$this->exists): ?>
<div class="akeeba-block--failure">
<?php echo Text::_('COM_AKEEBA_BROWSER_ERR_NOTEXISTS'); ?>
</div>
<?php elseif (!$this->inRoot): ?>
<div class="akeeba-block--warning">
<?php echo Text::_('COM_AKEEBA_BROWSER_ERR_NONROOT'); ?>
</div>
<?php
elseif ($this->openbasedirRestricted): ?>
<div class="akeeba-block--failure">
<?php echo Text::_('COM_AKEEBA_BROWSER_ERR_BASEDIR'); ?>
</div>
<?php
else: ?>
<table class="akeeba-table--striped">
<tr>
<td>
<?php $linkbase = $router->route("index.php?&view=browser&tmpl=component&folder="); ?>
<a class="akeeba-btn--dark--small"
href="<?php echo $linkbase . urlencode($this->parent); ?>">
<span class="akion-arrow-up-a"></span>
<?php echo Text::_('COM_AKEEBA_BROWSER_LBL_GOPARENT') ?>
</a>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
</div>
</div>

View File

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