| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/plugins/system/nnframework/helpers/ |
Upload File : |
<?php
/**
* NoNumber! Framework Helper File: VersionCheck
*
* @package NoNumber! Framework
* @version 11.9.1
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2011 NoNumber! All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die();
class NNVersions
{
function &instance()
{
static $instance;
if ( !is_object( $instance ) ) {
$instance = new NoNumberVersions;
}
return $instance;
}
}
class NoNumberVersions
{
var $_version = '11.9.1';
function getMessage( $extension = '', $xml = '', $version = '', $addmargin = 0 )
{
if ( !$extension || ( !$xml && !$version ) ) {
return;
}
$alias = preg_replace( '#[^a-z\-]#', '', str_replace( '?', '-', strtolower( $extension ) ) );
if ( $xml ) {
$xml = JApplicationHelper::parseXMLInstallFile( JPATH_SITE.DS.( str_replace( '/', DS, $xml ) ) );
if ( $xml && isset( $xml['version'] ) ) {
$version = $xml['version'];
}
}
if ( !$version ) {
return;
}
JHTML::_( 'behavior.mootools' );
$document =& JFactory::getDocument();
$document->addScript( JURI::root(true).'/plugins/system/nnframework/js/script.js?v='.$this->_version );
$url = 'http://www.nonumber.nl/ext/version.php?ext='.$alias.'&version='.$version;
$script = "
window.addEvent( 'domready', function() {
nnScripts.loadajax(
'".$url."',
'nnScripts.displayVersion( \'".$alias."\', data )',
'nnScripts.displayVersion( \'".$alias."\', \'\' )'
);
});
";
$document->addScriptDeclaration( $script );
$msg = html_entity_decode( JText::sprintf( 'NN_A_NEWER_VERSION_IS_AVAILABLE', 'http://www.nonumber.nl/'.$alias.'/download', '<span id="nonumber_newversionnumber_'.$alias.'"></span>', $version ), ENT_COMPAT, 'UTF-8' );
$margin = $addmargin ? '10px;' : '3px;';
$msg = '<div style="border:3px solid #F0DC7E;color:#CC0000;margin-bottom:'.$margin.'"><div style="padding: 2px 5px;background-color:#EFE7B8">'.$msg.'</div></div>';
$msg = '<div id="nonumber_version_'.$alias.'" style="display: none;">'.$msg.'</div>';
return $msg;
}
function getVersion( $extension, $xml )
{
if ( !$extension || !$xml ) {
return;
}
$version = '';
if ( $xml ) {
$xml = JApplicationHelper::parseXMLInstallFile( JPATH_SITE.DS.( str_replace( '/', DS, $xml ) ) );
if ( $xml && isset( $xml['version'] ) ) {
$version = $xml['version'];
}
}
return $version;
}
function getXMLVersion( $extension = 'nnframework', $type = 'system', $admin = 1, $urlformat = 0 )
{
if ( !$extension ) {
$extension = 'nnframework';
}
if ( !$type ) {
$type = 'system';
}
switch ( $type ) {
case 'component':
case 'components':
case 'module':
case 'modules':
$type .= in_array( $type, array( 'component', 'module' ) ) ? 's' : '';
if ( $admin ) {
$path = JPATH_ADMINISTRATOR;
} else {
$path = JPATH_SITE;
}
$path .= DS.$type.DS.( $type == 'modules' ? 'mod_' : 'com_' ).$extension.DS.( $type == 'modules' ? 'mod_' : '' ).$extension.'.xml';
break;
default:
if ( $admin ) {
$path = JPATH_ADMINISTRATOR;
} else {
$path = JPATH_SITE;
}
$path = JPATH_SITE.DS.'plugins'.DS.$type.DS.$extension.'.xml';
break;
}
$version = '';
$xml = JApplicationHelper::parseXMLInstallFile( str_replace( '/', DS, $path ) );
if ( $xml && isset( $xml['version'] ) ) {
$version = trim( strtolower( $xml['version'] ) );
if ( $urlformat ) {
$version = '?v='.$version;
}
}
return $version;
}
function setMessage( $current_version = '0', $version_file = '' )
{
echo $this->getMessage( str_replace( 'version_', '', $version_file ), '', $current_version, 1 );
}
}