PATH:
home
/
centosnipponia
/
public_html
/
nipponiacom2
/
modules
/
mod_djmegamenu
/
fields
<?php /** * @package DJ-MediaTools * @copyright Copyright (C) 2021 DJ-Extensions.com, All rights reserved. * @license http://www.gnu.org/licenses GNU/GPL * @author url: https://dj-extensions.com * @author email contact@dj-extensions.com * @developer Szymon Woronowski, Artur Kaczmarek * * DJ-MediaTools 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 3 of the License, or * (at your option) any later version. * * DJ-MediaTools 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 DJ-MediaTools. If not, see <http://www.gnu.org/licenses/>. * */ defined('JPATH_PLATFORM') or die; /** * Form Field class for the Joomla Platform. * Supports a one line text field. * * @link http://www.w3.org/TR/html-markup/input.text.html#input.text * @since 11.1 */ class JFormFieldDJUpdater extends JFormField { /** * The form field type. * * @var string * @since 11.1 */ protected $type = 'DJUpdater'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $module = $this->form->getData()->get('module'); if ($module) { $lang = JFactory::getLanguage(); $lang->load($module, JPATH_ROOT, 'en-GB', true, false); $lang->load($module, JPATH_ROOT . '/modules/' . $module, 'en-GB', true, false); $lang->load($module, JPATH_ROOT, null, true, false); $lang->load($module, JPATH_ROOT . '/modules/' . $module, null, true, false); $doc->addStylesheet(JURI::root(true) . '/modules/' . $module . '/assets/css/forms.css'); } $extension = $this->element['extension']; $pro = (int)$this->element['pro']; $task = $app->input->get('djtask'); if ($task) { ob_clean(); echo 'DJUPDATERRESPONSE' . $this->$task($extension); $app->close(); } self::setUpdateServer('MegaMenu', $pro); $html = self::getSubscription($extension, $pro); return $html; } public static function getSubscription($ext, $pro) { if (!in_array('curl', get_loaded_extensions())) { return self::renderAlert(JText::_('DJUPDATER_CURL_NOT_INSTALLED'), 'error'); } $app = JFactory::getApplication(); $db = JFactory::getDBO(); $query = "SELECT manifest_cache FROM #__extensions WHERE element ='" . $ext . "'"; $db->setQuery($query); $mc = json_decode($db->loadResult()); $version = $mc->version; $config = JFactory::getConfig(); $secret_file = JFile::makeSafe('license_' . $config->get('secret') . '.txt'); $license_file = JPath::clean(dirname(__FILE__) . '/../' . $secret_file); if (file_exists($license_file)) { $license = file_get_contents($license_file); } else { $license = ''; } $license = preg_replace("/[^a-zA-Z0-9:]+/", '', $license); if ($pro) { $html = '<h4>' . JText::_('MOD_DJMEGAMENU_MODULE_DESC') . ' ' . $version . '</h4>'; } else { $html = '<h4>' . JText::_('MOD_DJMEGAMENU_LIGHT_MODULE_DESC') . ' ' . $version . '</h4>'; } $html .= '<p>'.JText::_('DJUPDATER_LICENSE_INFO').'</p>'; $html .= '<input id="license" type="text" name="license" class="input input-large" value="'.htmlspecialchars($license).'" placeholder="'. JText::_('DJUPDATER_PASTE_KEY').'" /> '; $html .= '<button id="register" class="btn btn-info" href="#">'.JText::_('DJUPDATER_SAVE_KEY').'</button> '; $js = " jQuery(document).ready(function(){ var button = jQuery('#register'); var loader = jQuery('<span class=\"icon-refresh djspin\" />'); button.click(function(e){ button.prop('disabled', true); button.prepend(loader); e.preventDefault(); jQuery.ajax({ data: { license: jQuery('#license').val(), djtask: 'save' } }).done(function(data) { var message = data.substr(data.lastIndexOf('DJUPDATERRESPONSE')+17); button.closest('.alert').before(jQuery(message)); setTimeout(function(){ location.reload(); }, 1000); }) .fail(function() { alert( 'connection error' ); button.prop('disabled', false); loader.detach(); }); }); }); "; JFactory::getDocument()->addScriptDeclaration($js); return self::renderAlert($html, 'info'); } public static function renderAlert($msg, $type = '', $title = '') { if (!in_array($type, array('success', 'error', 'info', ''))) $type = 'info'; $html = '<div class="alert alert-' . $type . '">' . (!empty($title) ? '<h3>' . $title . '</h3>' : '') . '<div class="alert-body">' . $msg . '</div>' . '</div>'; return $html; } private function save($ext) { $app = JFactory::getApplication(); $config = JFactory::getConfig(); $db = JFactory::getDbo(); $license = $app->input->get('license', '', 'string'); $r = $app->input->get('release', '0', 'string'); $license = preg_replace("/[^a-zA-Z0-9:]+/", '', $license); $secret_file = JFile::makeSafe('license_' . $config->get('secret') . '.txt'); $license_file = JPath::clean(dirname(__FILE__) . '/../' . $secret_file); $query = "SELECT manifest_cache FROM #__extensions WHERE element='pkg_dj-megamenu' AND type='package' "; $db->setQuery($query); $mc = json_decode($db->loadResult()); $version = $mc->version; $extra_query = 'dlid=' . $license . '&v=' . $version . '&site=' . JURI::root(); $query = "UPDATE #__update_sites SET extra_query='" . addslashes($extra_query) . "' WHERE name='DJ-MegaMenu' AND type='extension' "; $db->setQuery($query); $db->execute(); if ($license == '') { JFile::delete($license_file); } else { JFile::write($license_file, $license); } $msg = ($license == '') ? 'DJUPDATER_KEY_REMOVED' : 'DJUPDATER_KEY_STORED'; return self::renderAlert(JText::_($msg), 'success'); } public static function setUpdateServer($name = 'MegaMenu', $pro = false) { if (empty($name)) return; // update the update server information for package $db = JFactory::getDbo(); $config = JFactory::getConfig(); $secret_file = JFile::makeSafe('license_' . $config->get('secret') . '.txt'); $license_file = JPath::clean(JPATH_ROOT . '/modules/mod_dj' . strtolower($name) . '/' . $secret_file); if ($pro && file_exists($license_file)) { $license = file_get_contents($license_file); } else { $license = ''; } $query = "SELECT extension_id, manifest_cache FROM #__extensions WHERE element='pkg_dj-" . strtolower($name) . "' AND type='package' "; $db->setQuery($query); $pkg = $db->loadObject(); if ($pkg) { $mc = json_decode($pkg->manifest_cache); $version = $mc->version; $extra_query = $pro ? 'dlid=' . $license . '&v=' . $version . '&site=' . JURI::root() : ''; $db->setQuery("SELECT COUNT(*) FROM #__update_sites WHERE name='DJ-" . $name . "' AND type='extension'"); if ($db->loadResult() > 0) { if ($pro) { $db->setQuery("UPDATE #__update_sites SET location='https://dj-extensions.com/index.php?option=com_ars&view=update&task=stream&format=xml&id=5', extra_query='" . addslashes($extra_query) . "' WHERE name='DJ-" . $name . "' AND type='extension'"); } else { $db->setQuery("UPDATE #__update_sites SET location='https://dj-extensions.com/index.php?option=com_ars&view=update&task=stream&format=xml&id=6', extra_query='" . addslashes($extra_query) . "' WHERE name='DJ-" . $name . "' AND type='extension'"); } } else { if ($pro) { $db->setQuery("INSERT INTO #__update_sites (`name`, `type`, `location`, `enabled`, `extra_query`) VALUES ('DJ-" . $name . "', 'extension', 'https://dj-extensions.com/index.php?option=com_ars&view=update&task=stream&format=xml&id=5', 1, '" . addslashes($extra_query) . "')"); } else { $db->setQuery("INSERT INTO #__update_sites (`name`, `type`, `location`, `enabled`, `extra_query`) VALUES ('DJ-" . $name . "', 'extension', 'https://dj-extensions.com/index.php?option=com_ars&view=update&task=stream&format=xml&id=6', 1, '" . addslashes($extra_query) . "')"); } $db->execute(); $update_site_id = $db->insertid(); $db->setQuery("INSERT INTO #__update_sites_extensions (`update_site_id`, `extension_id`) VALUES (" . $update_site_id . ", " . $pkg->extension_id . ")"); } $db->execute(); } } }
[+]
..
[-] djmobilebutton.php
[edit]
[-] djmodules.php
[edit]
[-] djspacer.php
[edit]
[-] djcolor.php
[edit]
[-] djfolderlist.php
[edit]
[-] djonlypro.php
[edit]
[-] djupdater.php
[edit]
[-] .htaccess.disabled
[edit]