ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,103 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Buttons;
use Magento\Framework\Data\Form\Element\AbstractElement;
class AbstractBlock extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* Template path
*/
public $template = "system/config/button.phtml";
/**
* Button Label
*/
public $buttonLabel;
/**
* @var \Plumrocket\GeoIPLookup\Helper\Config
*/
public $configHelper;
/**
* @param \Plumrocket\GeoIPLookup\Helper\Config $configHelper
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Plumrocket\GeoIPLookup\Helper\Config $configHelper,
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
$this->configHelper = $configHelper;
}
/**
* @return $this|\Magento\Config\Block\System\Config\Form\Field
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
if (!$this->getTemplate()) {
$this->setTemplate($this->template);
}
return $this;
}
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$originalData = $element->getOriginalData();
$buttonLabel = !empty($originalData['button_label']) ? $originalData['button_label'] : $this->buttonLabel;
$this->addData(
[
'button_label' => __($buttonLabel),
'html_id' => $element->getHtmlId(),
'onclick' => $this->getOnclick($element->getHtmlId())
]
);
return $this->_toHtml();
}
/**
* @return string
*/
public function getOnclick($htmlId = null)
{
return 'return false;';
}
}
@@ -0,0 +1,43 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Buttons;
use Plumrocket\GeoIPLookup\Helper\Config;
class Connection extends AbstractBlock
{
/**
* Button Label
*/
public $buttonLabel = 'Test Connection';
/**
* @param $htmlId
* @return null|string
*/
public function getOnclick($htmlId = null)
{
return sprintf(
'window.prGeoIptestApiConnection(\'%s\', \'%s\'); return false;',
$this->getUrl('prgeoiplookup/test/ipapiEndpoint'),
$htmlId
);
}
}
@@ -0,0 +1,48 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Buttons;
class Install extends AbstractBlock
{
/**
* Button Label
*/
public $buttonLabel = 'Install Database';
/**
* @return string
*/
public function getOnclick($htmlId = null)
{
$serviceId = mb_substr($htmlId, 0, mb_strrpos($htmlId, "_"));
$urlAutomatic = $this->getUrl(
'prgeoiplookup/import/autoimport',
['dataId' => $serviceId]
);
$urlProgress = $this->getUrl(
'prgeoiplookup/import/importprogress',
['dataId' => $serviceId, 'is_progress' => 1]
);
return "window.runInstallation('$serviceId', '$urlAutomatic', '$urlProgress'); return false;";
}
}
@@ -0,0 +1,100 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data;
use Plumrocket\GeoIPLookup\Helper\Config;
class Enable extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var \Plumrocket\GeoIPLookup\Helper\Data
*/
private $dataHelper;
/**
* @var \Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry
*/
private $ipToCountry;
/**
* @var \Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip
*/
private $maxmindGeoIp;
/**
* Enable constructor.
*
* @param \Plumrocket\GeoIPLookup\Helper\Data $dataHelper
* @param \Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry $ipToCountry
* @param \Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip $maxmindGeoIp
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Plumrocket\GeoIPLookup\Helper\Data $dataHelper,
\Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry $ipToCountry,
\Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip $maxmindGeoIp,
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
$this->dataHelper = $dataHelper;
$this->ipToCountry = $ipToCountry;
$this->maxmindGeoIp = $maxmindGeoIp;
parent::__construct($context, $data);
}
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
protected function _renderValue(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$dataVersion = null;
$elementId = $element->getId();
$modelName = $this->dataHelper->getModelNameByElementId($elementId, false, true);
$tooltip = '';
switch ($modelName) {
case Config::IPTOCOUNTRY_GROUP:
$dataVersion = $this->ipToCountry->getInstalledMessage();
break;
case Config::MAXMIND_GROUP:
$dataVersion = $this->maxmindGeoIp->getInstalledMessage();
break;
}
if (! $dataVersion) {
$element->setDisabled('disabled');
$form = $element->getForm();
$serviceId = mb_substr($elementId, 0, mb_strrpos($elementId, "_"));
$fieldset = $form->getElement($serviceId);
$title = __('Please install %1 in order to enable this IP Geolocation method.', $fieldset->getLegend());
$tooltip .= '<div id="' . $serviceId . '_tooltip" class="tooltip">
<span><span><img src="' . $this->getViewFileUrl('Plumrocket_Base::images/error_msg_icon.gif')
. '" style="margin-top: 2px;float: right;" /></span></span>';
$tooltip .= '<div class="tooltip-content">' . $title . '</div></div>';
}
$html = '<td class="value with-tooltip">';
$html .= $this->_getElementHtml($element) . $tooltip;
$html .= '</td>';
return $html;
}
}
@@ -0,0 +1,97 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data;
use Plumrocket\GeoIPLookup\Helper\Config;
class Status extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var \Plumrocket\GeoIPLookup\Helper\Data
*/
private $dataHelper;
/**
* @var \Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry
*/
private $ipToCountry;
/**
* @var \Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip
*/
private $maxmindGeoIp;
/**
* Status constructor.
*
* @param \Plumrocket\GeoIPLookup\Helper\Data $dataHelper
* @param \Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry $ipToCountry
* @param \Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip $maxmindGeoIp
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Plumrocket\GeoIPLookup\Helper\Data $dataHelper,
\Plumrocket\GeoIPLookup\Model\Data\Import\Iptocountry $ipToCountry,
\Plumrocket\GeoIPLookup\Model\Data\Import\Maxmindgeoip $maxmindGeoIp,
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
$this->dataHelper = $dataHelper;
$this->ipToCountry = $ipToCountry;
$this->maxmindGeoIp = $maxmindGeoIp;
parent::__construct($context, $data);
}
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$dataVersion = null;
$elementId = $element->getId();
$modelName = $this->dataHelper->getModelNameByElementId($elementId, false, true);
switch ($modelName) {
case Config::IPTOCOUNTRY_GROUP:
$dataVersion = $this->ipToCountry->getInstalledMessage();
break;
case Config::MAXMIND_GROUP:
$dataVersion = $this->maxmindGeoIp->getInstalledMessage();
break;
}
$elementStyle = ($dataVersion) ? "color: green" : "color: red";
$elementText = $dataVersion ?: __('Not Installed')->render();
$html = '
<div id="' . $elementId . '" class="status-container">
<span class="status" style="' . $elementStyle . '">' . $elementText . '</span>
<div class="progress-container" style="display: none;">
<div class="progress-bar w3-light-grey w3-border">
<div class="progress-value w3-container w3-blue w3-center" style="width:0%">0%</div>
</div>
<div class="progress-title"></div>
</div>
</div>
';
return $html;
}
}
@@ -0,0 +1,43 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Test;
class Api extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* Rest Api Static Path
*/
const REST_PATH = 'rest/V1/prgeoiplookup/';
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = '<p id="hidden_field_api_url">' . $this->getRestApiUrl() . '</p>'
. '<a id="rest_ip_test" target="_blank" href=""></a>';
return $html;
}
private function getRestApiUrl()
{
return $this->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB) . self::REST_PATH;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Test;
class Button extends \Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Buttons\AbstractBlock
{
/**
* Button Label
*/
public $buttonLabel = 'Get Location From IP';
/**
* @param null $htmlId
* @return string
*/
public function getOnclick($htmlId = null)
{
$urlTest = $this->getUrl(
'prgeoiplookup/test/index'
);
return sprintf(
'window.geoipTest(\'%s\'); return false;',
$urlTest
);
}
}
@@ -0,0 +1,53 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Test;
class Ipaddress extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress
*/
private $remoteAddress;
/**
* Ipaddress constructor.
*
* @param \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress,
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
$this->remoteAddress = $remoteAddress;
parent::__construct($context, $data);
}
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$ip = $this->remoteAddress->getRemoteAddress();
$element->setValue($ip);
return parent::_getElementHtml($element);
}
}
@@ -0,0 +1,34 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_GeoIPLookup
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
namespace Plumrocket\GeoIPLookup\Block\Adminhtml\System\Config\Data\Test;
class Map extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = __('Open in')
. " <a id='prgeoiplookup_google_map' target='_blank' href='https://www.google.com/maps'>"
. __('Google Maps') . "</a>";
return $html;
}
}