| Server IP : 87.98.154.146 / Your IP : 216.73.216.101 Web Server : Apache System : Linux webm005.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : bsiadvisil ( 110003) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/bsiadvisil/www/plugins/system/msframework/models/ |
Upload File : |
<?php
/**
* MS Framework
*
* @package MS Framework Plugin
* @version 1.2.1.573
*
* @author Michael Snoeren
* @link https://snoerendevelopment.nl/
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
// Deny direct access
defined('_JEXEC') or die;
class MSFrameworkModelKey extends JModelLegacy
{
/**
* Model Tables
* @var String
* @access Protected
*/
protected $tableExtensions = '#__extensions';
/**
* Model Cache
* @var Mixed
* @access Protected
*/
protected $cacheKey = '';
/**
* Get the key
* @param Boolean $refresh
* @access Public
* @return String|Boolean
*/
public function getKey($refresh = false)
{
if (!empty($this->cacheKey) && !$refresh) {
return $this->cacheKey;
}
$db = $this->getDbo();
$query = $db->getQuery(true);
$query
->select($db->qn('params'))
->from($db->qn($this->tableExtensions))
->where([
$db->qn('element') . ' = ' . $db->q('msframework')
]);
$db->setQuery($query);
$result = $db->loadResult();
if (!is_string($result) || empty($result)) {
return false;
}
$params = @json_decode($result, true);
if ($params === null || !count($params)) {
return '';
}
if (!array_key_exists('key', $params)) {
return '';
}
// Cache the key
$this->cacheKey = $params['key'];
return $this->cacheKey;
}
/**
* Set the key
* @param String $key
* @access Public
* @return Boolean
*/
public function setKey($key)
{
if (!is_string($key) || empty($key)) {
return false;
}
// Get the plugin parameters
$plugin = JPluginHelper::getPlugin('system', 'msframework');
if (!is_object($plugin) || !property_exists($plugin, 'params')) {
return false;
}
$params = new JRegistry($plugin->params);
$params->set('key', $key);
$db = $this->getDbo();
$query = $db->getQuery(true);
$query
->update($db->qn($this->tableExtensions))
->set([
$db->qn('params') . ' = ' . $db->q($params->toString())
])
->where([
$db->qn('element') . ' = ' . $db->q('msframework'),
$db->qn('folder') . ' = ' . $db->q('system')
]);
$db->setQuery($query);
return $db->execute();
}
/**
* Check if a key is present
* @access Public
* @return Boolean
*/
public function hasKey()
{
return !empty($this->getKey());
}
}