primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,94 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2021 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Form\FormField;
defined('_JEXEC') or die();
/**
* Class ShackFormFieldBase
*
* @property bool $fromInstaller
*/
class ShackFormFieldBase extends FormField
{
/**
* @var bool
*/
protected $fromInstaller = false;
public function __set($name, $value = null)
{
switch ($name) {
case 'fromInstaller':
$this->fromInstaller = (bool)$value;
break;
default:
parent::__set($name, $value);
}
}
/**
* @inheritDoc
*/
protected function getInput()
{
return '';
}
/**
* @param ?string $path
*
* @return string
*/
protected function getStyle(?string $path): string
{
if ($path && is_file($path)) {
return '<style>' . file_get_contents($path) . '</style>';
}
return '';
}
/**
* @inheritDoc
*/
protected function getLabel()
{
return '';
}
/**
* @param SimpleXMLElement $element
*
* @return ?string
*/
public function getInputUsingCustomElement(SimpleXMLElement $element): ?string
{
$this->element = $element;
$this->setup($element, null);
return $this->getInput();
}
}

View File

@ -0,0 +1,176 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
/**
* @property bool $fromInstaller
*/
class JFormFieldCustomFooter extends FormField
{
/**
* @inheritdoc
*/
protected $layout = 'alledia.customfooter';
/**
* @var bool
*/
protected $fromInstaller = false;
/**
* @inheritDoc
*/
public function __set($name, $value = null)
{
switch ($name) {
case 'fromInstaller':
$this->fromInstaller = (bool)$value;
break;
default:
parent::__set($name, $value);
}
}
/**
* @inheritDoc
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
if ($path = realpath(__DIR__ . '/../..')) {
Factory::getLanguage()->load('shackdefaultfiles', $path);
}
return parent::setup($element, $value, $group);
}
/**
* @inheritDoc
*/
protected function getInput()
{
return $this->getRenderer($this->layout)->render($this->getLayoutData());
}
/**
* @inheritDoc
*/
protected function getRenderer($layoutId = 'default')
{
$renderer = parent::getRenderer($layoutId);
if ($layoutId == $this->layout) {
$renderer->addIncludePath(__DIR__ . '/layouts');
}
return $renderer;
}
/**
* @inheritDoc
*/
protected function getLayoutData()
{
$displayData = parent::getLayoutData();
$requiredClasses = [
'joomlashack-footer',
'row-fluid'
];
if ($this->fromInstaller) {
$requiredClasses[] = 'installer';
}
$classes = array_unique(
array_filter(
array_merge(
preg_split('/\s/', $displayData['class']),
$requiredClasses
)
)
);
$goProUrl = (string)$this->element['showgoproad'] ?: '0';
$showGoProAd = !($goProUrl == '0' || $goProUrl == 'false');
if ($showGoProAd && !filter_var($goProUrl, FILTER_VALIDATE_URL)) {
$goProUrl = 'https://www.joomlashack.com/plans';
}
return array_merge(
$displayData,
[
'class' => join(' ', $classes),
'media' => $this->element['media'],
'jslogo' => (string)$this->element['jslogo'] ?: 'joomlashack-logo.png',
'jshome' => (string)$this->element['jshome'] ?: 'https://www.joomlashack.com',
'jedurl' => (string)$this->element['jedurl'],
'fromInstaller' => $this->fromInstaller,
'showGoProAd' => $showGoProAd,
'goProUrl' => $goProUrl
]
);
}
/**
* @param ?string $path
*
* @return string
* @TODO: Doesn't seem to be useful
*/
protected function getStyle(?string $path): string
{
if ($path && is_file($path)) {
return '<style>' . file_get_contents($path) . '</style>';
}
return '';
}
/**
* @inheritDoc
*/
protected function getLabel()
{
return '';
}
/**
* @param SimpleXMLElement $element
*
* @return ?string
*/
public function getInputUsingCustomElement(SimpleXMLElement $element): ?string
{
$this->element = $element;
$this->setup($element, null);
return $this->getInput();
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2018-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
/**
* @var array $displayData
*/
$class = $displayData['class'];
$media = $displayData['media'];
$jslogo = $media . '/' . $displayData['jslogo'];
$jedurl = $displayData['jedurl'];
$showGoProAd = $displayData['showGoProAd'];
$goProUrl = $displayData['goProUrl'];
$fromInstaller = $displayData['fromInstaller'];
$footerCss = HTMLHelper::_('stylesheet', $media . '/field_customfooter.css', ['relative' => true, 'pathOnly' => true]);
$adminCss = HTMLHelper::_('stylesheet', $media . '/admin-default.css', ['relative' => true, 'pathOnly' => true]);
?>
<link href="<?php echo $footerCss; ?>" rel="stylesheet"/>
<link href="<?php echo $adminCss; ?>" rel="stylesheet"/>
<div class="<?php echo $class; ?>">
<div>
<?php
if ($showGoProAd) :
?>
<div class="gopro-ad">
<?php
echo HTMLHelper::_(
'link',
$goProUrl,
Text::_('SHACKDEFAULTFILES_GO_PRO'),
'class="gopto-btn" target="_blank"'
);
?>
</div>
<?php endif;
if ($jedurl) : ?>
<div class="joomlashack-jedlink">
<?php
echo Text::_('SHACKDEFAULTFILES_LIKE_THIS_EXTENSION');
echo '&nbsp;'
. HTMLHelper::_(
'link',
$jedurl,
Text::_('SHACKDEFAULTFILES_LEAVE_A_REVIEW_ON_JED'),
'target="_blank"'
);
echo '&nbsp;' . str_repeat("<i class=\"icon-star\"></i>", 5);
?>
</div>
<?php endif; ?>
<div class="poweredby">
Powered by
<?php
echo HTMLHelper::_(
'link',
'https://www.joomlashack.com',
HTMLHelper::_('image', $jslogo, 'Joomlashack', 'class="joomlashack-logo" width="150"', true),
'target="_blank"'
);
?>
</div>
<div class="joomlashack-copyright">
<?php echo '&copy; ' . date('Y'); ?> Joomlashack.com. All rights reserved.
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
let footer = document.getElementsByClassName('joomlashack-footer').item(0),
container = footer ? footer.parentElement : null,
wrapper = null;
if (container && container.classList.contains('controls')) {
wrapper = document.getElementById('content') || document.querySelector('.container-popup');
}
if (footer && wrapper) {
wrapper.parentNode.insertBefore(footer, wrapper.nextSibling);
} else if (footer) {
footer.remove();
}
});
</script>

View File

@ -0,0 +1,83 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
FormHelper::loadFieldClass('Spacer');
class JFormFieldSubtitle extends JFormFieldSpacer
{
/**
* @inheritDoc
*/
protected function getLabel()
{
$html = [];
$class = $this->class ?: sprintf(' class="%s"', $this->class);
$tag = $this->element['tag'] ? (string)$this->element['tag'] : 'h4';
$html[] = '<span class="spacer">';
$html[] = '<span class="before"></span>';
$html[] = '<span' . $class . '>';
if ((string)$this->element['hr'] == 'true') {
$html[] = '<hr' . $class . '>';
} else {
$label = '';
// Get the label text from the XML element, defaulting to the element name.
$text = (string)$this->element['label'] ?: (string)$this->element['name'];
$text = $this->translateLabel ? Text::_($text) : $text;
// Build the class for the label.
$class = $this->description ? 'hasTooltip' : '';
$class = $this->required == true ? $class . ' required' : $class;
// Add the opening label tag and main attributes attributes.
$label .= '<' . $tag . ' id="' . $this->id . '-lbl" class="' . $class . '"';
if ($this->description) {
// Use description to build a tooltip.
HTMLHelper::_('bootstrap.tooltip');
$label .= sprintf(
' title="%s"',
HTMLHelper::tooltipText(trim($text, ':'), Text::_($this->description), 0)
);
}
// Add the label text and closing tag.
$label .= '>' . $text . '</' . $tag . '>';
$html[] = $label;
}
$html[] = '</span>';
$html[] = '<span class="after"></span>';
$html[] = '</span>';
return implode('', $html);
}
}

View File

@ -0,0 +1,52 @@
<?php
/**
* @package ShackExtensionSupport
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackExtensionSupport.
*
* ShackExtensionSupport is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackExtensionSupport is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Framework\AutoLoader;
use Joomla\CMS\Factory;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
if (defined('ALLEDIA_FRAMEWORK_LOADED') == false) {
$frameworkPath = JPATH_SITE . '/libraries/allediaframework/include.php';
$app = Factory::getApplication();
if (
(is_file($frameworkPath) && include $frameworkPath) == false
&& $app->isClient('administrator')
) {
$app->enqueueMessage('[Joomlashack Extension Support] Joomlashack Framework not found', 'error');
}
unset($app);
}
if (
defined('ALLEDIA_FRAMEWORK_LOADED')
&& defined('SHACKEXTENSIONSUPPORT_LOADED') == false
) {
AutoLoader::register('\\Alledia\\OSMyLicensesManager', JPATH_PLUGINS . '/system/osmylicensesmanager/library');
define('SHACKEXTENSIONSUPPORT_LOADED', 1);
}
return defined('ALLEDIA_FRAMEWORK_LOADED') && defined('SHACKEXTENSIONSUPPORT_LOADED');

View File

@ -0,0 +1,86 @@
; @package AllediaInstaller
; @contact www.joomlashack.com, help@joomlashack.com
; @copyright Copyright (C) 2016 Open Sources Training, LLC, All rights reserved
; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
;
; Note : All ini files need to be saved as UTF-8 - No BOM
;
; @TODO: this file should be removed once all extensions have been updated
LIB_ALLEDIAINSTALLER_CHANGE_LICENSE_KEY = "Change my license key"
LIB_ALLEDIAINSTALLER_I_DONT_REMEMBER_MY_KEY = "I don't remember my key!"
LIB_ALLEDIAINSTALLER_INSTALL_CANCELLED = "Install process canceled."
LIB_ALLEDIAINSTALLER_LICENSE_KEY_ERROR = "We found an error trying to save your license key. Please try again inside the Joomlashack License Key Manager plugin. You can find it by going to Extensions -> Plugins -> search for 'license'."
LIB_ALLEDIAINSTALLER_LICENSE_KEY_SUCCESS = "Your license key was saved successfully!"
LIB_ALLEDIAINSTALLER_LICENSE_KEYS_MANAGER_REQUIRED = "You are using a Joomlashack Pro extension, but you don't have the Joomlashack License Key Manager plugin installed. Please install it and configure your license key in order to be able to update this extension."
LIB_ALLEDIAINSTALLER_LICENSE_KEYS_PLACEHOLDER = "license key"
LIB_ALLEDIAINSTALLER_LICENSED_AS = "%s and all related extensions are licensed as %s"
LIB_ALLEDIAINSTALLER_MANIFEST_NOT_FOUND = "Manifest file not found: %s"
LIB_ALLEDIAINSTALLER_MSG_LICENSE_KEYS_EMPTY = "* Update requires a valid license key."
LIB_ALLEDIAINSTALLER_OBSOLETE_UNINSTALLED_FAIL = "Uninstalling %s %s, failed"
LIB_ALLEDIAINSTALLER_OBSOLETE_UNINSTALLED_SUCCESS = "Uninstalling %s %s was successful"
LIB_ALLEDIAINSTALLER_PUBLISHED = "Published"
LIB_ALLEDIAINSTALLER_RELATED_EXTENSIONS = "Related Extensions"
LIB_ALLEDIAINSTALLER_RELATED_INSTALL = "%s %s was successfully installed"
LIB_ALLEDIAINSTALLER_RELATED_INSTALL_FAIL = "Installation of %s %s failed"
LIB_ALLEDIAINSTALLER_RELATED_NOT_UNINSTALLED = "The %s %s won't be uninstalled because of possible dependencies"
LIB_ALLEDIAINSTALLER_RELATED_UNINSTALL = "%s %s was successfully removed"
LIB_ALLEDIAINSTALLER_RELATED_UNINSTALL_FAIL = "Unable to remove %s %s"
LIB_ALLEDIAINSTALLER_RELATED_UPDATE = "%s %s was successfully updated"
LIB_ALLEDIAINSTALLER_RELATED_UPDATE_FAIL = "Update of %s %s failed"
LIB_ALLEDIAINSTALLER_RELATED_UPDATE_STATE_FAILED = "Failed, version %s"
LIB_ALLEDIAINSTALLER_RELATED_UPDATE_STATE_INSTALLED = "Installed v%s"
LIB_ALLEDIAINSTALLER_RELATED_UPDATE_STATE_SKIPED = "Skipped %s, the version %s is already installed"
LIB_ALLEDIAINSTALLER_RELEASE_V = "Release: v%s"
LIB_ALLEDIAINSTALLER_SAVE_LICENSE_KEY = "Save my license key"
LIB_ALLEDIAINSTALLER_SHOW_DETAILS = "Show more details..."
LIB_ALLEDIAINSTALLER_SORTED = "Sorted [%s]"
LIB_ALLEDIAINSTALLER_THANKS_INSTALL = "Thanks for installing %s!"
LIB_ALLEDIAINSTALLER_THANKS_UPDATE = "Thanks for updating %s!"
LIB_ALLEDIAINSTALLER_WRONG_MYSQL = "Sorry, %s requires at least MySQL %s."
LIB_ALLEDIAINSTALLER_WRONG_PHP = "Sorry, %s requires at least php %s."
LIB_ALLEDIAINSTALLER_WRONG_PLATFORM = "Sorry, %s requires Joomla! %s."
LIB_ALLEDIAINSTALLER_WRONG_PREVIOUS = "Sorry, updating %s requires at least version %s to be installed first."
; Copied from lib_shackinstaller.sys while we transition from old extension
LIB_SHACKINSTALLER_CHANGE_LICENSE_KEY = "Change my license key"
LIB_SHACKINSTALLER_I_DONT_REMEMBER_MY_KEY = "I don't remember my key!"
LIB_SHACKINSTALLER_INSTALL_CANCELLED = "Install process canceled."
LIB_SHACKINSTALLER_LICENSE_KEY_ERROR = "We found an error trying to save your license key. Please try again inside the Joomlashack License Key Manager plugin. You can find it by going to Extensions -> Plugins -> search for 'license'."
LIB_SHACKINSTALLER_LICENSE_KEY_SUCCESS = "Your license key was saved successfully!"
LIB_SHACKINSTALLER_LICENSE_KEYS_MANAGER_REQUIRED = "You are using a Joomlashack Pro extension, but you don't have the Joomlashack License Key Manager plugin installed. Please install it and configure your license key in order to be able to update this extension."
LIB_SHACKINSTALLER_LICENSE_KEYS_PLACEHOLDER = "license key"
LIB_SHACKINSTALLER_LICENSED_AS = "%s and all related extensions are licensed as %s"
LIB_SHACKINSTALLER_MANIFEST_NOT_FOUND = "Manifest file not found: %s"
LIB_SHACKINSTALLER_MSG_LICENSE_KEYS_EMPTY = "* Update requires a valid license key."
LIB_SHACKINSTALLER_OBSOLETE_UNINSTALLED_FAIL = "Uninstalling %s %s, failed"
LIB_SHACKINSTALLER_OBSOLETE_UNINSTALLED_SUCCESS = "Uninstalling %s %s was successful"
LIB_SHACKINSTALLER_PUBLISHED = "Published"
LIB_SHACKINSTALLER_RELATED_EXTENSIONS = "Related Extensions"
LIB_SHACKINSTALLER_RELATED_INSTALL = "%s %s was successfully installed"
LIB_SHACKINSTALLER_RELATED_INSTALL_FAIL = "Installation of %s %s failed"
LIB_SHACKINSTALLER_RELATED_NOT_UNINSTALLED = "This extension does not uninstall %s %s"
LIB_SHACKINSTALLER_RELATED_NOT_UNINSTALLED_SYSTEM = "The %s %s won't be uninstalled because of possible dependencies"
LIB_SHACKINSTALLER_RELATED_UNINSTALL = "%s %s was successfully removed"
LIB_SHACKINSTALLER_RELATED_UNINSTALL_FAIL = "Unable to remove %s %s"
LIB_SHACKINSTALLER_RELATED_UPDATE = "%s %s was successfully updated"
LIB_SHACKINSTALLER_RELATED_UPDATE_FAIL = "Update of %s %s failed"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_FAILED = "Failed, version %s"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_INSTALLED = "Installed v%s"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_SKIPED = "Skipped %s, the version %s is already installed"
LIB_SHACKINSTALLER_RELEASE_V = "Release: v%s"
LIB_SHACKINSTALLER_SAVE_LICENSE_KEY = "Save my license key"
LIB_SHACKINSTALLER_SHOW_DETAILS = "Show more details..."
LIB_SHACKINSTALLER_SORTED = "Sorted [%s]"
LIB_SHACKINSTALLER_THANKS_INSTALL = "Thanks for installing %s!"
LIB_SHACKINSTALLER_THANKS_UPDATE = "Thanks for updating %s!"
LIB_SHACKINSTALLER_WRONG_MYSQL = "Sorry, %s requires at least MySQL %s."
LIB_SHACKINSTALLER_WRONG_PHP = "Sorry, %s requires at least php %s."
LIB_SHACKINSTALLER_WRONG_PLATFORM = "Sorry, %s requires Joomla! %s."
LIB_SHACKINSTALLER_WRONG_PREVIOUS = "Sorry, updating %s requires at least version %s to be installed first."

View File

@ -0,0 +1,62 @@
; @package ShackInstaller
; @contact www.joomlashack.com, help@joomlashack.com
; @copyright 2016-2023 Joomlashack.com. All rights reserved
; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
;
; This file is part of ShackInstaller.
;
; ShackInstaller is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) any later version.
;
; ShackInstaller is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
;
; Note : All ini files need to be saved as UTF-8 - No BOM
LIB_SHACKINSTALLER_ABORT_INSTALL = "Another extension is preventing installation. Please disable it and try again: %s"
LIB_SHACKINSTALLER_ABORT_UNINSTALL = "Another extension has prevented completing the uninstll. Additional, related extensions may need to uninstalled."
LIB_SHACKINSTALLER_CHANGE_LICENSE_KEY = "Change my license key"
LIB_SHACKINSTALLER_I_DONT_REMEMBER_MY_KEY = "I don't remember my key!"
LIB_SHACKINSTALLER_INSTALL_CANCELLED = "Install process canceled."
LIB_SHACKINSTALLER_LICENSE_KEY_ERROR = "We found an error trying to save your license key. Please try again inside the Joomlashack License Key Manager plugin. You can find it by going to Extensions -> Plugins -> search for 'license'."
LIB_SHACKINSTALLER_LICENSE_KEY_SUCCESS = "Your license key was saved successfully!"
LIB_SHACKINSTALLER_LICENSE_KEYS_MANAGER_REQUIRED = "You are using a Joomlashack Pro extension, but you don't have the Joomlashack License Key Manager plugin installed. Please install it and configure your license key in order to be able to update this extension."
LIB_SHACKINSTALLER_LICENSE_KEYS_PLACEHOLDER = "license key"
LIB_SHACKINSTALLER_LICENSED_AS = "%s and all related extensions are licensed as %s"
LIB_SHACKINSTALLER_MANIFEST_NOT_FOUND = "Manifest file not found: %s"
LIB_SHACKINSTALLER_MSG_LICENSE_KEYS_EMPTY = "* Update requires a valid license key."
LIB_SHACKINSTALLER_OBSOLETE_UNINSTALLED_FAIL = "Uninstalling %s %s, failed"
LIB_SHACKINSTALLER_OBSOLETE_UNINSTALLED_SUCCESS = "Uninstalling %s %s was successful"
LIB_SHACKINSTALLER_PUBLISHED = "Published"
LIB_SHACKINSTALLER_RELATED_EXTENSIONS = "Related Extensions"
LIB_SHACKINSTALLER_RELATED_INSTALL = "%s %s was successfully installed"
LIB_SHACKINSTALLER_RELATED_INSTALL_FAIL = "Installation of %s %s failed"
LIB_SHACKINSTALLER_RELATED_NOT_UNINSTALLED = "This extension does not uninstall %s %s"
LIB_SHACKINSTALLER_RELATED_NOT_UNINSTALLED_SYSTEM = "The %s %s won't be uninstalled because of possible dependencies"
LIB_SHACKINSTALLER_RELATED_UNINSTALL = "%s %s was successfully removed"
LIB_SHACKINSTALLER_RELATED_UNINSTALL_FAIL = "Unable to remove %s %s"
LIB_SHACKINSTALLER_RELATED_UPDATE = "%s %s was successfully updated"
LIB_SHACKINSTALLER_RELATED_UPDATE_FAIL = "Update of %s %s failed"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_FAILED = "Failed, version %s"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_INSTALLED = "Installed v%s"
LIB_SHACKINSTALLER_RELATED_UPDATE_STATE_SKIPED = "Skipped %s, the version %s is already installed"
LIB_SHACKINSTALLER_RELEASE_V = "Release: v%s"
LIB_SHACKINSTALLER_SAVE_LICENSE_KEY = "Save my license key"
LIB_SHACKINSTALLER_SHOW_DETAILS = "Show more details..."
LIB_SHACKINSTALLER_SORTED = "Sorted [%s]"
LIB_SHACKINSTALLER_THANKS_INSTALL = "Thanks for installing %s!"
LIB_SHACKINSTALLER_THANKS_UPDATE = "Thanks for updating %s!"
LIB_SHACKINSTALLER_WRONG_MYSQL = "Sorry, %s requires at least MySQL %s."
LIB_SHACKINSTALLER_WRONG_PHP = "Sorry, %s requires at least php %s."
LIB_SHACKINSTALLER_WRONG_PLATFORM = "Sorry, %s requires Joomla! %s."
LIB_SHACKINSTALLER_WRONG_PREVIOUS = "Sorry, updating %s requires at least version %s to be installed first."

View File

@ -0,0 +1,27 @@
; @package ShackExtensionSupport
; @contact www.joomlashack.com, help@joomlashack.com
; @copyright 2016-2024 Joomlashack.com. All rights reserved
; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
;
; This file is part of ShackExtensionSupport.
;
; ShackExtensionSupport is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) any later version.
;
; ShackExtensionSupport is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
;
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_SYSTEM_OSMYLICENSESMANAGER = "System - Joomlashack Extension Support"
PLG_SYSTEM_OSMYLICENSESMANAGER_DESCRIPTION = "For Pro licensed Joomlashack extensions, you must have a valid License Key to receive extension updates. Get your license key here: <a href=\"https://www.joomlashack.com/account/key/\" target=\"_blank\">Your Pro License Key</a>."
PLG_SYSTEM_OSMYLICENSESMANAGER_FIELD_LICENSE_KEYS_LABEL = "License Key"
PLG_SYSTEM_OSMYLICENSESMANAGER_FIELD_LICENSE_KEYS_DESC = "Joomlashack license key to update Pro extensions."

View File

@ -0,0 +1,24 @@
; @package ShackExtensionSupport
; @contact www.joomlashack.com, help@joomlashack.com
; @copyright 2016-2024 Joomlashack.com. All rights reserved
; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
;
; This file is part of ShackExtensionSupport.
;
; ShackExtensionSupport is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) any later version.
;
; ShackExtensionSupport is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
;
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_SYSTEM_OSMYLICENSESMANAGER = "System - Joomlashack Extension Support"
PLG_SYSTEM_OSMYLICENSESMANAGER_DESCRIPTION = "For Pro licensed Joomlashack extensions, you must have a valid License Key to receive extension updates. Get your license key here: <a href=\"https://www.joomlashack.com/account/key/\" target=\"_blank\">Your Pro License Key</a>."

View File

@ -0,0 +1,25 @@
; @package ShackDefaultFiles
; @contact www.joomlashack.com, help@joomlashack.com
; @copyright 2021-2024 Joomlashack.com. All rights reserved
; @license https://www.gnu.org/licenses/gpl.html GNU/GPL
;
; This file is part of ShackDefaultFiles.
;
; ShackDefaultFiles is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) any later version.
;
; ShackDefaultFiles is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
;
; Note : All ini files need to be saved as UTF-8 - No BOM
SHACKDEFAULTFILES_GO_PRO = "Go Pro to access more features"
SHACKDEFAULTFILES_LEAVE_A_REVIEW_ON_JED = "Leave a review on the JED"
SHACKDEFAULTFILES_LIKE_THIS_EXTENSION = "Like this extension?"

View File

@ -0,0 +1,144 @@
<?php
/**
* @package ShackExtensionSupport
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackExtensionSupport.
*
* ShackExtensionSupport is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackExtensionSupport is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\OSMyLicensesManager\Free;
use Alledia\Framework\Joomla\Extension\Licensed;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
// phpcs:enable PSR1.Files.SideEffects
/**
* PluginHelper class
*/
abstract class PluginHelper
{
/**
* @var string
*/
protected static $downloadBaseURL = 'https://deploy.ostraining.com/client/download/';
/**
* Update the license key on the plugin params
*
* @param ?string $licenseKeys
*
* @return bool
*/
public static function updateLicenseKeys(?string $licenseKeys = ''): bool
{
$licenseKeys = PluginHelper::sanitizeKey($licenseKeys);
// Update the extension params
$extension = new Licensed('osmylicensesmanager', 'plugin', 'system');
$extension->params->set('license-keys', $licenseKeys);
$extension->storeParams();
return true;
}
/**
* Detects if the passed URL is our download URL, returning a boolean value.
*
* @param string $url
*
* @return bool
*/
public static function isOurDownloadURL(string $url): bool
{
return preg_match('#^' . static::$downloadBaseURL . '#', $url) === 1;
}
/**
* Removes the license key from the URL and returns it.
*
* @param string $url
*
* @return string
*/
public static function getURLWithoutLicenseKey(string $url): string
{
if (static::isOurDownloadURL($url)) {
$url = preg_replace('#^(' . static::$downloadBaseURL . '(free|pro|paid)/[^/]+/[^/]+).*$#i', '$1', $url);
$url .= '/';
}
return $url;
}
/**
* Sanitizes the license key, making sure we have only valid chars.
*
* @param string $key
*
* @return string
*/
public static function sanitizeKey(string $key): string
{
return preg_replace('/[^a-z0-9,]/i', '', $key);
}
/**
* Appends the license key to the URL and returns it. We recognize the url
* for designated generic extensions using a default license key to allow
* legacy customers to download updates.
*
* @param string $url
* @param string $keys
*
* @return string
*/
public static function appendLicenseKeyToURL(string $url, string $keys): string
{
if (static::isOurDownloadURL($url)) {
$url = PluginHelper::getURLWithoutLicenseKey($url);
$sanitizedKeys = static::sanitizeKey($keys);
if ($keys) {
$encodedKeys = base64_encode($sanitizedKeys);
$url .= $encodedKeys;
}
}
return $url;
}
/**
* Detects the license type based on the URL. If no license is detected,
* returns false
*
* @param string $url
*
* @return ?string
*/
public static function getLicenseTypeFromURL(string $url): ?string
{
if (preg_match('#^' . static::$downloadBaseURL . '(free|pro)/#', $url, $matches)) {
return $matches[1];
}
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,221 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\Installer;
defined('_JEXEC') or die();
class AutoLoader
{
/**
* Associative array where the key is a namespace prefix and the value
* is an array of base directories for classes in that namespace.
*
* @var array
*/
protected static $prefixes = [];
/**
* Associative array of prefixes for loading specialized camelCase classes
* where Uppercase letters in the class name indicate directory structure
*
* @var array
*/
protected static $camelPrefixes = [];
/**
* @var AutoLoader
*/
protected static $instance = null;
/**
* @param string $method
*/
protected static function registerLoader($method)
{
if (static::$instance === null) {
static::$instance = new static();
}
spl_autoload_register([static::$instance, $method]);
}
/**
* Register a psr4 namespace
*
* @param string $prefix The namespace prefix.
* @param string $baseDir A base directory for class files in the
* namespace.
* @param ?bool $prepend If true, prepend the base directory to the stack
* instead of appending it; this causes it to be searched first rather
* than last.
*
* @return void
*/
public static function register(string $prefix, string $baseDir, ?bool $prepend = false)
{
if (count(self::$prefixes) == 0) {
static::registerLoader('loadClass');
}
// normalize namespace prefix
$prefix = trim($prefix, '\\') . '\\';
// normalize the base directory with a trailing separator
$baseDir = rtrim($baseDir, '\\/') . '/';
// initialise the namespace prefix array
if (empty(self::$prefixes[$prefix])) {
self::$prefixes[$prefix] = [];
}
// retain the base directory for the namespace prefix
if ($prepend) {
array_unshift(self::$prefixes[$prefix], $baseDir);
} else {
array_push(self::$prefixes[$prefix], $baseDir);
}
}
/**
* Loads the class file for a given class name.
*
* @param string $class The fully-qualified class name.
*
* @return ?string The mapped file name on success
*/
protected function loadClass(string $class): ?string
{
$prefixes = explode('\\', $class);
$className = '';
while ($prefixes) {
$className = array_pop($prefixes) . $className;
$prefix = join('\\', $prefixes) . '\\';
if ($filePath = $this->loadMappedFile($prefix, $className)) {
return $filePath;
}
$className = '\\' . $className;
}
return null;
}
/**
* Load the mapped file for a namespace prefix and class.
*
* @param string $prefix The namespace prefix.
* @param string $className The relative class name.
*
* @return ?string path that was loaded
*/
protected function loadMappedFile(string $prefix, string $className): ?string
{
// are there any base directories for this namespace prefix?
if (isset(self::$prefixes[$prefix]) === false) {
return null;
}
// look through base directories for this namespace prefix
foreach (self::$prefixes[$prefix] as $baseDir) {
$path = $baseDir . str_replace('\\', '/', $className) . '.php';
if (is_file($path)) {
require_once $path;
return $path;
}
}
return null;
}
/**
* Register a base directory for classes organized using camelCase.
* Class names beginning with the prefix will be automatically loaded
* if there is a matching file in the directory tree starting with $baseDir.
* File names and directory names are all expected to be lower case.
*
* Example:
*
* $prefix = 'Simplerenew'
* $baseDir = '/library/joomla'
*
* A class name of: SimplerenewViewAdmin
* Would be in : /library/joomla/view/admin.php
*
* This system is intended for situations where full name spacing is either
* unavailable or impractical due to integration with other systems.
*
* @param string $prefix
* @param string $baseDir
*
* @return void
* @throws \Exception
*/
public static function registerCamelBase(string $prefix, string $baseDir)
{
if (!is_dir($baseDir)) {
throw new \Exception("Cannot register '{$prefix}'. The requested base directory does not exist!'");
}
if (count(self::$camelPrefixes) == 0) {
// Register function on first call
static::registerLoader('loadCamelClass');
}
if (empty(self::$camelPrefixes[$prefix])) {
self::$camelPrefixes[$prefix] = $baseDir;
}
}
/**
* Autoload a class using the camelCase structure
*
* @param string $class
*
* @return string
*/
protected function loadCamelClass(string $class): ?string
{
if (!class_exists($class)) {
foreach (self::$camelPrefixes as $prefix => $baseDir) {
if (strpos($class, $prefix) === 0) {
$parts = preg_split('/(?<=[a-z])(?=[A-Z])/x', substr($class, strlen($prefix)));
$file = strtolower(join('/', $parts));
$filePath = $baseDir . '/' . $file . '.php';
if (is_file($filePath)) {
require_once $filePath;
return $filePath;
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,435 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\Installer\Extension;
defined('_JEXEC') or die();
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
/**
* Generic extension class
*/
class Generic
{
/**
* The extension namespace
*
* @var string
*/
protected $namespace = null;
/**
* The extension type
*
* @var string
*/
protected $type = null;
/**
* The extension id
*
* @var int
*/
protected $id = null;
/**
* The extension name
*
* @var string
*/
protected $name = null;
/**
* The extension params
*
* @var Registry
*/
public $params = null;
/**
* The extension enable state
*
* @var bool
*/
protected $enabled = null;
/**
* The element of the extension
*
* @var string
*/
protected $element = null;
/**
* @var string
*/
protected $folder = null;
/**
* Base path
*
* @var string
*/
protected $basePath = null;
/**
* The manifest information
*
* @var \SimpleXMLElement
*/
public $manifest = null;
/**
* The config.xml information
*
* @var \SimpleXMLElement
*/
public $config = null;
/**
* Class constructor, set the extension type.
*
* @param string $namespace The element of the extension
* @param string $type The type of extension
* @param ?string $folder The folder for plugins (only)
* @param string $basePath
*
* @return void
*/
public function __construct(string $namespace, string $type, ?string $folder = '', string $basePath = JPATH_SITE)
{
$this->type = $type;
$this->element = strtolower($namespace);
$this->folder = $folder;
$this->basePath = $basePath;
$this->namespace = $namespace;
$this->getManifest();
$this->getDataFromDatabase();
}
/**
* Get information about this extension from the database
* NOTE: This is duplicated code from the corresponding class in
* \Alledia\Framework\Joomla\Extension\Generic
*/
protected function getDataFromDatabase()
{
$element = $this->getElementToDb();
// Load the extension info from database
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select([
$db->quoteName('extension_id'),
$db->quoteName('name'),
$db->quoteName('enabled'),
$db->quoteName('params')
])
->from('#__extensions')
->where($db->quoteName('type') . ' = ' . $db->quote($this->type))
->where($db->quoteName('element') . ' = ' . $db->quote($element));
if ($this->type === 'plugin') {
$query->where($db->quoteName('folder') . ' = ' . $db->quote($this->folder));
}
$db->setQuery($query);
$row = $db->loadObject();
if (is_object($row)) {
$this->id = $row->extension_id;
$this->name = $row->name;
$this->enabled = (bool)$row->enabled;
$this->params = new Registry($row->params);
} else {
$this->id = null;
$this->name = null;
$this->enabled = false;
$this->params = new Registry();
}
}
/**
* Check if the extension is enabled
*
* @return bool
*/
public function isEnabled(): bool
{
return (bool)$this->enabled;
}
/**
* Get the path for the extension
*
* @return string The path
*/
public function getExtensionPath(): string
{
$folders = [
'component' => 'administrator/components/',
'plugin' => 'plugins/',
'template' => 'templates/',
'library' => 'libraries/',
'cli' => 'cli/',
'module' => 'modules/'
];
$basePath = $this->basePath . '/' . $folders[$this->type];
switch ($this->type) {
case 'plugin':
$basePath .= $this->folder . '/';
break;
case 'module':
if (!preg_match('/^mod_/', $this->element)) {
$basePath .= 'mod_';
}
break;
case 'component':
if (!preg_match('/^com_/', $this->element)) {
$basePath .= 'com_';
}
break;
}
$basePath .= $this->element;
return $basePath;
}
/**
* Get the full element
*
* @return string
*/
public function getFullElement(): string
{
$prefixes = [
'component' => 'com',
'plugin' => 'plg',
'template' => 'tpl',
'library' => 'lib',
'cli' => 'cli',
'module' => 'mod'
];
$fullElement = $prefixes[$this->type];
if ($this->type === 'plugin') {
$fullElement .= '_' . $this->folder;
}
$fullElement .= '_' . $this->element;
return $fullElement;
}
/**
* Get the element to match the database records.
* Only components and modules have the prefix.
*
* @return string The element
*/
public function getElementToDb(): string
{
$prefixes = [
'component' => 'com_',
'module' => 'mod_'
];
$fullElement = '';
if (array_key_exists($this->type, $prefixes)) {
if (!preg_match('/^' . $prefixes[$this->type] . '/', $this->element)) {
$fullElement = $prefixes[$this->type];
}
}
$fullElement .= $this->element;
return $fullElement;
}
/**
* Get manifest path for this extension
*
* @return string
*/
public function getManifestPath(): string
{
$extensionPath = $this->getExtensionPath();
switch ($this->type) {
case 'template':
$fileName = 'templateDetails.xml';
break;
case 'library':
$fileName = $this->element . '.xml';
if (!is_file($extensionPath . '/' . $fileName)) {
$extensionPath = JPATH_MANIFESTS . '/libraries';
}
break;
case 'module':
$fileName = 'mod_' . $this->element . '.xml';
break;
case 'pkg':
$extensionPath = JPATH_MANIFESTS . '/packages';
$fileName = 'pkg_' . $this->element . '.xml';
break;
case 'file':
$extensionPath = JPATH_MANIFESTS . '/files';
$fileName = 'file_' . $this->element . '.xml';
break;
default:
$fileName = $this->element . '.xml';
break;
}
return $extensionPath . '/' . $fileName;
}
/**
* Get extension information
*
* @param bool $force If true, force to load the manifest, ignoring the cached one
*
* @return ?\SimpleXMLElement
*/
public function getManifest(bool $force = false): ?\SimpleXMLElement
{
if ($this->manifest === null || $force) {
$this->manifest = false;
$path = $this->getManifestPath();
if (is_file($path)) {
$this->manifest = simplexml_load_file($path);
}
}
return $this->manifest ?: null;
}
/**
* Get extension config file
*
* @param bool $force Force to reload the config file
*
* @return \SimpleXMLElement
*/
public function getConfig(bool $force = false)
{
if ($this->config === null || $force) {
$path = $this->getExtensionPath() . '/config.xml';
$this->config = is_file($path) ? simplexml_load_file($path) : false;
}
return $this->config;
}
/**
* Returns the update URL from database
*
* @return string
*/
public function getUpdateURL(): string
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('sites.location')
->from('#__update_sites AS sites')
->leftJoin('#__update_sites_extensions AS extensions ON (sites.update_site_id = extensions.update_site_id)')
->where('extensions.extension_id = ' . $this->id);
return $db->setQuery($query)->loadResult();
}
/**
* Set the update URL
*
* @param string $url
*/
public function setUpdateURL(string $url)
{
$db = Factory::getDbo();
// Get the update site id
$join = $db->quoteName('#__update_sites_extensions') . ' AS extensions '
. 'ON (sites.update_site_id = extensions.update_site_id)';
$query = $db->getQuery(true)
->select('sites.update_site_id')
->from($db->quoteName('#__update_sites') . ' AS sites')
->leftJoin($join)
->where('extensions.extension_id = ' . $this->id);
$db->setQuery($query);
$siteId = (int)$db->loadResult();
if (!empty($siteId)) {
$query = $db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($db->quoteName('location') . ' = ' . $db->quote($url))
->where($db->quoteName('update_site_id') . ' = ' . $siteId);
$db->setQuery($query);
$db->execute();
}
}
/**
* Store the params on the database
*
* @return void
*/
public function storeParams()
{
$db = Factory::getDbo();
$params = $db->quote($this->params->toString());
$id = $db->quote($this->id);
$query = "UPDATE `#__extensions` SET params = {$params} WHERE extension_id = {$id}";
$db->setQuery($query);
$db->execute();
}
/**
* Get extension name
*
* @return string
*/
public function getName(): string
{
return $this->name;
}
}

View File

@ -0,0 +1,147 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\Installer\Extension;
defined('_JEXEC') or die();
use Alledia\Installer\AutoLoader;
/**
* Licensed class, for extensions with Free and Pro versions
*/
class Licensed extends Generic
{
/**
* License type: free or pro
*
* @var string
*/
protected $license = null;
/**
* The path for the pro library
*
* @var string
*/
protected $proLibraryPath = null;
/**
* The path for the free library
*
* @var string
*/
protected $libraryPath = null;
/**
* @inheritDoc
*/
public function __construct(string $namespace, string $type, ?string $folder = '', string $basePath = JPATH_SITE)
{
parent::__construct($namespace, $type, $folder, $basePath);
$this->license = $this->manifest ? strtolower($this->manifest->alledia->license) : 'free';
$this->getLibraryPath();
$this->getProLibraryPath();
}
/**
* Check if the license is pro
*
* @return bool True for pro license
*/
public function isPro(): bool
{
return $this->license === 'pro';
}
/**
* Check if the license is free
*
* @return bool
*/
public function isFree(): bool
{
return !$this->isPro();
}
/**
* Get the path for the free library, based on the extension type
*
* @return string The path for pro
*/
public function getLibraryPath(): string
{
if (empty($this->libraryPath)) {
$basePath = $this->getExtensionPath();
$this->libraryPath = $basePath . '/library';
}
return $this->libraryPath;
}
/**
* Get path for the pro library, based on the extension type
*
* @return string The path for pro
*/
public function getProLibraryPath(): string
{
if ($this->proLibraryPath === null) {
$basePath = $this->getLibraryPath();
$this->proLibraryPath = $basePath . '/Pro';
}
return $this->proLibraryPath;
}
/**
* Loads the library, if existent (including the Pro Library)
*
* @return bool
* @throws \Exception
*/
public function loadLibrary(): bool
{
$libraryPath = $this->getLibraryPath();
// If we have a library path, lets load it
if (is_dir($libraryPath)) {
if ($this->isPro()) {
// Check if the pro library exists
if (!is_dir($this->getProLibraryPath())) {
throw new \Exception("Pro library not found: {$this->type}, {$this->element}");
}
}
AutoLoader::register('Alledia\\' . $this->namespace, $libraryPath);
return true;
}
return false;
}
}

View File

@ -0,0 +1,101 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\Installer;
use Alledia\Framework\Factory;
use Joomla\CMS\Log\Log;
defined('_JEXEC') or die();
abstract class Loader
{
protected static $logRegistered = false;
/**
* Safely include a PHP file, making sure it exists before import.
*
* This method will register a log message and display a warning for admins
* in case the file is missed.
*
* @param string $path The file path you want to include
*
* @return bool
* @throws \Exception
*/
public static function includeFile(string $path): bool
{
if (!static::$logRegistered) {
Log::addLogger(
['text_file' => 'shackframework.loader.errors.php'],
Log::ALL,
['allediaframework']
);
static::$logRegistered = true;
}
// Check if the file doesn't exist
if (!is_file($path)) {
$logMsg = 'Required file is missed: ' . $path;
// Generate a backtrace to know from where the request cames
if (version_compare(phpversion(), '5.4', '<')) {
$backtrace = debug_backtrace();
} else {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
if (!empty($backtrace)) {
$logMsg .= sprintf(
' (%s:%s)',
$backtrace[0]['file'],
$backtrace[0]['line']
);
}
// Register the log
Log::add($logMsg, Log::ERROR, 'allediaframework');
// Warn admin users
$app = Factory::getApplication();
if ($app->getName() == 'administrator') {
$app->enqueueMessage(
'ShackInstaller Loader detected that a required file was not found! Please, check the logs.',
'error'
);
}
// Stand up a flag to warn a required file is missed
if (!defined('SHACK_INSTALLER_MISSED_FILE')) {
define('SHACK_INSTALLER_MISSED_FILE', true);
}
return false;
}
include_once $path;
return true;
}
}

View File

@ -0,0 +1,85 @@
<?php
/**
* @package OSEmbed
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2020-2021 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of OSEmbed.
*
* OSEmbed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* OSEmbed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OSEmbed. If not, see <https://www.gnu.org/licenses/>.
*/
namespace Alledia\Installer;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
trait TraitInstallerCheck
{
/**
* @var bool
*/
protected $cancelInstallation = false;
/**
* @param InstallerAdapter $parent
*
* @return bool
* @throws \Exception
*/
protected function checkInheritance(InstallerAdapter $parent): bool
{
Factory::getLanguage()->load('lib_shackinstaller.sys', realpath(__DIR__ . '/../..'));
$parentClasses = class_parents($this);
$scriptClassName = array_pop($parentClasses);
$scriptClass = new \ReflectionClass($scriptClassName);
$sourcePath = dirname($scriptClass->getFileName());
$sourceBase = strpos($sourcePath, JPATH_PLUGINS) === 0 ? 3 : 2;
$sourceVersion = AbstractScript::VERSION ?? '0.0.0';
$sourcePath = $this->cleanPath($sourcePath);
$targetPath = $this->cleanPath(SHACK_INSTALLER_BASE);
if ($sourcePath != $targetPath && version_compare($sourceVersion, SHACK_INSTALLER_COMPATIBLE , 'lt')) {
$source = join('/', array_slice(explode('/', $sourcePath), 0, $sourceBase));
$errorMessage = 'LIB_SHACKINSTALLER_ABORT_'
. ($parent->getRoute() == 'uninstall' ? 'UNINSTALL' : 'INSTALL');
Factory::getApplication()->enqueueMessage(Text::sprintf($errorMessage, $source), 'error');
$this->cancelInstallation = true;
return false;
}
return true;
}
/**
* @param string $path
*
* @return string
*/
protected function cleanPath(string $path): string
{
return str_replace(DIRECTORY_SEPARATOR, '/', str_replace(JPATH_ROOT . '/', '', $path));
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Installer\AutoLoader;
use Joomla\CMS\Version;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
if (defined('SHACK_INSTALLER_BASE') == false) {
define('SHACK_INSTALLER_BASE', __DIR__);
require_once SHACK_INSTALLER_BASE . '/AutoLoader.php';
}
AutoLoader::register('Alledia\\Installer', __DIR__, true);
if (defined('SHACK_INSTALLER_VERSION') == false) {
define('SHACK_INSTALLER_VERSION', '2.4.4');
define('SHACK_INSTALLER_COMPATIBLE', '2.4.0');
if (isset($reportErrors) == false) {
$reportErrors = E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED;
if (Version::MAJOR_VERSION == 4) {
// There is a bad line of code in Joomla 4 that runs during extension install/update
$reportErrors = $reportErrors ^ E_NOTICE;
}
}
if ($reportErrors) {
set_error_handler('\\Alledia\\Installer\\AbstractScript::errorHandler', $reportErrors);
}
}

View File

@ -0,0 +1,159 @@
<?php
/**
* @package ShackExtensionSupport
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackExtensionSupport.
*
* ShackExtensionSupport is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackExtensionSupport is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Framework\Joomla\Extension\AbstractPlugin;
use Alledia\Framework\Joomla\Extension\Helper;
use Alledia\OSMyLicensesManager\Free\PluginHelper;
use Alledia\OSMyLicensesManager\PluginBase;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
if ((include 'include.php') == false) {
class_alias(CMSPlugin::class, PluginBase::class);
} else {
class_alias(AbstractPlugin::class, PluginBase::class);
}
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
class PlgSystemOSMyLicensesManager extends PluginBase
{
/**
* @var CMSApplication
*/
protected $app = null;
/**
* @inheritdoc
*/
protected $namespace = 'OSMyLicensesManager';
/**
* @var bool
*/
protected $enabled = null;
/**
* @return void
*/
public function onAfterInitialise(): void
{
$plugin = $this->app->input->getCmd('plugin');
$task = $this->app->input->getCmd('task');
$user = Factory::getUser();
if (
$this->isEnabled()
&& $this->app->isClient('administrator')
&& $plugin == 'system_osmylicensesmanager'
&& $task == 'license.save'
&& $user->guest == false
) {
// The user is saving a license key from the installer screen
$this->init();
$licenseKeys = $this->app->input->post->getString('license-keys', '');
$result = (object)[
'success' => PluginHelper::updateLicenseKeys($licenseKeys),
];
echo json_encode($result);
jexit();
}
}
/**
* @return void
*/
public function onAfterRender(): void
{
$option = $this->app->input->getCmd('option');
$extension = $this->app->input->getCmd('extension');
if (
$this->isEnabled()
&& $this->app->isClient('administrator')
&& $option === 'com_categories'
&& $extension
) {
$this->addCustomFooterToCategories($extension);
}
}
/**
* @param string $url
*
* @return void
*/
public function onInstallerBeforePackageDownload(string &$url): void
{
$licenseKeys = $this->params->get('license-keys', '');
if (
$this->isEnabled()
&& $licenseKeys
&& PluginHelper::getLicenseTypeFromURL($url) !== 'free'
) {
$this->init();
$url = PluginHelper::appendLicenseKeyToURL($url, $licenseKeys);
}
}
/**
* @param ?string $element
*
* @return void
*/
protected function addCustomFooterToCategories(?string $element): void
{
if ($this->isEnabled() && $element) {
// Check if the specified extension is from Alledia
if ($extension = Helper::getExtensionForElement($element)) {
if ($footer = $extension->getFooterMarkup()) {
$this->app->setBody(
str_replace('</section>', '</section>' . $footer, $this->app->getBody())
);
}
}
}
}
/**
* @return bool
*/
protected function isEnabled(): bool
{
if ($this->enabled === null) {
$this->enabled = $this instanceof AbstractPlugin;
}
return $this->enabled;
}
}

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>plg_system_osmylicensesmanager</name>
<author>Joomlashack</author>
<authorEmail>help@joomlashack.com</authorEmail>
<authorUrl>https://www.joomlashack.com</authorUrl>
<copyright>Copyright 2016-2024 Joomlashack. All rights reserved</copyright>
<license>GNU GPL; see LICENSE file</license>
<description>PLG_SYSTEM_OSMYLICENSESMANAGER_DESCRIPTION</description>
<version>2.0.17</version>
<creationDate>March 18 2024</creationDate>
<variant>FREE</variant>
<alledia>
<element publish="true">osmylicensesmanager</element>
<namespace>OSMyLicensesManager</namespace>
<name>Joomlashack Extension Support</name>
<license>free</license>
<platform>3.9</platform>
<phpminimum>7.2.5</phpminimum>
<relatedExtensions>
<extension type="library"
element="allediaframework">ShackFramework</extension>
</relatedExtensions>
<include>ShackDefaultFiles</include>
<obsolete>
<file>/plugins/system/osmylicensesmanager/library/Free/UpdateHelper.php</file>
<extension type="plugin"
group="system"
element="ossystem"/>
</obsolete>
</alledia>
<scriptfile>script.installer.php</scriptfile>
<files>
<folder>form</folder>
<folder>language</folder>
<folder>library</folder>
<folder>views</folder>
<filename plugin="osmylicensesmanager">osmylicensesmanager.php</filename>
<filename>include.php</filename>
</files>
<media destination="plg_system_osmylicensesmanager" folder="media">
<folder>css</folder>
<folder>images</folder>
</media>
<config>
<fields name="params">
<fieldset name="basic" addfieldpath="/plugins/system/osmylicensesmanager/form/fields">
<field name="license-keys"
type="text"
label="PLG_SYSTEM_OSMYLICENSESMANAGER_FIELD_LICENSE_KEYS_LABEL"
description="PLG_SYSTEM_OSMYLICENSESMANAGER_FIELD_LICENSE_KEYS_DESC"/>
<field type="customfooter"
name="customfooter"
media="plg_system_osmylicensesmanager"/>
</fieldset>
</fields>
</config>
<updateservers>
<server type="extension" priority="1" name="Joomlashack Extension Support"><![CDATA[https://deploy.ostraining.com/client/update/free/stable/plg_system_osmylicensesmanager]]></server>
</updateservers>
</extension>

View File

@ -0,0 +1,36 @@
<?php
/**
* @package ShackExtensionSupport
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackExtensionSupport.
*
* ShackExtensionSupport is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackExtensionSupport is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackExtensionSupport. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Installer\AbstractScript;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
require_once 'library/Installer/include.php';
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
class PlgSystemOsmylicensesmanagerInstallerScript extends AbstractScript
{
}

View File

@ -0,0 +1,55 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2021 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\HTML\HTMLHelper;
defined('_JEXEC') or die();
?>
<div class="row-fluid">
<div id="footer" class="span12">
<div>
<a href="https://www.joomlashack.com">
<?php
echo HTMLHelper::_(
'image',
$this->option . '/joomlashack-logo.png',
'Joomlashack',
['width' => '150'],
true
);
?>
</a>
</div>
<br/>
<div>
Powered by
<?php echo HTMLHelper::_(
'link',
'https://www.joomlashack.com',
'Joomlashack',
['target' => '_blank']
); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,62 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Installer\AbstractScript;
use Alledia\Installer\Extension\Generic;
use Alledia\Installer\Extension\Licensed;
defined('_JEXEC') or die();
/**
* @var AbstractScript $this
* @var string $type
* @var Licensed $license
* @var string $name
* @var string $configPath
* @var string $customFooterPath
* @var string $extensionPath
* @var Generic $licensesManagerExtension
* @var string $string
* @var string $path
*/
?>
<div class="joomlashack-wrapper">
<div class="joomlashack-content">
<h2><?php echo $this->welcomeMessage; ?></h2>
<?php
if (is_file(__DIR__ . '/default_custom.php')) :
include __DIR__ . '/default_custom.php';
endif;
if ($license->isPro()) :
include __DIR__ . '/default_license.php';
endif;
include __DIR__ . "/default_info.php";
?>
<?php echo $this->footer; ?>
</div>
</div>

View File

@ -0,0 +1,115 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Installer\AbstractScript;
use Alledia\Installer\Extension\Generic;
use Alledia\Installer\Extension\Licensed;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
/**
* @var AbstractScript $this
* @var string $type
* @var Licensed $license
* @var string $name
* @var string $configPath
* @var string $customFooterPath
* @var string $extensionPath
* @var Generic $licensesManagerExtension
* @var string $string
* @var string $path
*/
?>
<div class="joomlashack-details-container">
<a href="javascript:void(0);" id="joomlashack-installer-footer-toggler">
<?php echo Text::_('LIB_SHACKINSTALLER_SHOW_DETAILS'); ?>
</a>
<div id="joomlashack-installer-footer" style="display: none;">
<div class="joomlashack-license">
<?php echo Text::sprintf('LIB_SHACKINSTALLER_RELEASE_V', (string)$this->manifest->version); ?>
</div>
<br>
<?php if (!empty($this->manifest->alledia->relatedExtensions)) : ?>
<table class="joomlashack-related-table">
<thead>
<tr>
<th colspan="2"><?php echo Text::_('LIB_SHACKINSTALLER_RELATED_EXTENSIONS'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->relatedExtensionFeedback as $data) : ?>
<tr>
<td><?php echo Text::_($data['name']); ?></td>
<td>
<?php
$messages = [$data['message']];
if (isset($data['publish']) && $data['publish']) {
$messages[] = Text::_('LIB_SHACKINSTALLER_PUBLISHED');
}
if (isset($data['ordering'])) {
$messages[] = Text::sprintf('LIB_SHACKINSTALLER_SORTED', $data['ordering']);
}
$messages = implode(', ', $messages);
echo $messages;
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="joomlashack-license">
<?php
echo Text::sprintf(
'LIB_SHACKINSTALLER_LICENSED_AS',
$this->getName(),
'<a href="https://www.gnu.org/licenses/gpl-3.0">GNU/GPL v3.0</a>'
);
?>.
</div>
</div>
</div>
<script>
(function() {
let footer = document.getElementById('joomlashack-installer-footer'),
toggle = document.getElementById('joomlashack-installer-footer-toggler');
if (footer && toggle) {
toggle.addEventListener('click', function(event) {
event.preventDefault();
footer.style.display = 'block';
this.style.display = 'none';
});
}
})();
</script>

View File

@ -0,0 +1,158 @@
<?php
/**
* @package ShackInstaller
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016-2023 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackInstaller.
*
* ShackInstaller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackInstaller is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackInstaller. If not, see <https://www.gnu.org/licenses/>.
*/
use Alledia\Installer\AbstractScript;
use Alledia\Installer\Extension\Generic;
use Alledia\Installer\Extension\Licensed;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
defined('_JEXEC') or die();
/**
* @var AbstractScript $this
* @var string $type
* @var Licensed $license
* @var string $name
* @var string $configPath
* @var string $customFooterPath
* @var string $extensionPath
* @var Generic $licensesManagerExtension
* @var string $string
* @var string $path
*/
$licenseUpdate = Uri::root() . '/administrator/index.php?plugin=system_osmylicensesmanager&task=license.save';
if ($this->isLicensesManagerInstalled) :
?>
<div class="joomlashack-license-form">
<?php
if (!empty($this->licenseKey)) :
?>
<a href="" class="joomlashack-installer-change-license-button btn btn-success">
<?php echo Text::_('LIB_SHACKINSTALLER_CHANGE_LICENSE_KEY'); ?>
</a>
<?php endif; ?>
<div id="joomlashack-installer-license-panel">
<input type="text"
name="joomlashack-license-keys"
id="joomlashack-license-keys"
value="<?php echo $this->licenseKey; ?>"
class="form-control"
placeholder="<?php echo Text::_('LIB_SHACKINSTALLER_LICENSE_KEYS_PLACEHOLDER'); ?>"/>
<p class="joomlashack-empty-key-msg">
<?php echo Text::_('LIB_SHACKINSTALLER_MSG_LICENSE_KEYS_EMPTY'); ?>&nbsp;
<a href="https://www.joomlashack.com/account/key/" target="_blank">
<?php echo Text::_('LIB_SHACKINSTALLER_I_DONT_REMEMBER_MY_KEY'); ?>
</a>
</p>
<a id="joomlashack-license-save-button"
class="btn btn-success"
href="#">
<?php echo Text::_('LIB_SHACKINSTALLER_SAVE_LICENSE_KEY'); ?>
</a>
</div>
<div id="joomlashack-installer-license-success" style="display: none">
<p><?php echo Text::_('LIB_SHACKINSTALLER_LICENSE_KEY_SUCCESS'); ?></p>
</div>
<div id="joomlashack-installer-license-error" style="display: none">
<p><?php echo Text::_('LIB_SHACKINSTALLER_LICENSE_KEY_ERROR'); ?></p>
</div>
</div>
<script>
(function() {
let panel = document.getElementById('joomlashack-installer-license-panel'),
updateButtons = document.getElementsByClassName('joomlashack-installer-change-license-button'),
saveButton = document.getElementById('joomlashack-license-save-button');
if (panel) {
if (updateButtons.length > 0) {
panel.style.display = 'none';
Array.from(updateButtons).forEach(function(button) {
button.addEventListener('click', function(event) {
event.preventDefault();
panel.style.display = 'block';
this.style.display = 'none';
})
});
}
if (saveButton) {
saveButton.addEventListener('click', function(event) {
event.preventDefault();
let request = new XMLHttpRequest(),
data = new FormData(),
keyField = document.getElementById('joomlashack-license-keys')
data.append('license-keys', keyField.value)
request.onreadystatechange = function(data) {
if (this.readyState === XMLHttpRequest.DONE) {
try {
if (this.status === 200) {
let result = JSON.parse(this.response),
success = document.getElementById('joomlashack-installer-license-success'),
error = document.getElementById('joomlashack-installer-license-error');
panel.style.display = 'none';
if (result.success) {
success.style.display = 'block';
} else {
error.style.display = 'block';
}
} else {
error.style.display = 'block';
}
} catch (e) {
panel.style.display = 'none';
error.style.display = 'block';
}
}
};
request.open('POST', '<?php echo $licenseUpdate; ?>');
request.send(data);
});
}
}
})();
</script>
<?php else : ?>
<div class="error">
<?php echo Text::_('LIB_SHACKINSTALLER_LICENSE_KEYS_MANAGER_REQUIRED'); ?>
</div>
<?php endif;