public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new NoNumberVersions();
     }
     return self::$instance;
 }
	function setMessage( $current_version = '0', $version_file = '' )
	{
		require_once JPATH_PLUGINS.'/system/nnframework/helpers/versions.php';
		$versions = NNVersions::instance();

		echo $versions->getMessage( str_replace( 'version_', '', $version_file ), '', $current_version, 1 );
	}
Example #3
0
 function fetchElement($name, $value, &$node)
 {
     $xml = $node->attributes('xml');
     $extension = $node->attributes('extension');
     $user = JFactory::getUser();
     if (!strlen($extension) || !strlen($xml) || $user->usertype != 'Super Administrator' && $user->usertype != 'Administrator') {
         return;
     }
     // Import library dependencies
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
     $versions = NNVersions::instance();
     return $versions->getMessage($extension, $xml);
 }
Example #4
0
 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $xml = $this->def('xml');
     $extension = $this->def('extension');
     $user = JFactory::getUser();
     $authorise = $j15 ? $user->usertype == 'Super Administrator' || $user->usertype == 'Administrator' : $user->authorise('core.manage', 'com_installer');
     if (!strlen($extension) || !strlen($xml) || !$authorise) {
         return;
     }
     // Import library dependencies
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
     $versions = NNVersions::instance();
     return $versions->getMessage($extension, $xml);
 }
$session =& JFactory::getSession();
$msgs = JRequest::getVar('msgs', '', 'default', 'none', 4);
if ($msgs != '' && !(strpos($msgs, '<dl id="system') === false)) {
    $session->set('application.nn_msgs', $msgs);
    header('Location: index.php?option=com_nonumbermanager');
    exit;
}
$msgs = $session->get('application.nn_msgs');
if (!(strpos($msgs, 'Remote Server connection failed') === false)) {
    $msgs .= '<dl id="system-message"><dt class="notice">' . JText::_('Notice') . '</dt><dd class="notice message fade"><ul><li>' . JText::_('NNEM_ERROR_CANNOT_DOWNLOAD_FILE') . '</li></ul></dd></dl>';
}
echo $msgs;
$session->set('application.nn_msgs', '');
// Version check
require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
$versions = NNVersions::instance();
$version = '';
$xml = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_nonumbermanager' . DS . 'com_nonumbermanager.xml');
if ($xml && isset($xml['version'])) {
    $version = $xml['version'];
}
$versions->setMessage($version, 'version_nonumbermanager', 'http://www.nonumber.nl/versions', 'http://www.nonumber.nl/nonumbermanager/download');
// Set the controller page
require_once JPATH_COMPONENT . DS . 'controllers' . DS . 'default' . '.php';
// Create a new class of classname and set the default task: display
$controller = new NoNumberManagerController(array('default_task' => 'display'));
// Perform the Request task
$controller->execute(JRequest::getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
// Place Commercial License Code check
Example #6
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $start = $node->attributes('start');
     $end = $node->attributes('end');
     $blocktype = $node->attributes('blocktype');
     if ($blocktype == 'spacer') {
         return;
     }
     if ($end) {
         $html = '';
         $random = rand(100000, 999999);
         $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
         $html .= '</td></tr></table>';
         if ($blocktype == 'fieldset') {
             $html .= '</fieldset>';
         } else {
             $html .= '</div></div>';
         }
         return $html;
     }
     $description = $node->attributes('description');
     $nostyle = $node->attributes('nostyle');
     $title = $node->attributes('label');
     $lang_folder = $node->attributes('language_folder');
     $lang_file = $node->attributes('language_file');
     $message_type = $node->attributes('message_type');
     $image = $node->attributes('image');
     $image_w = $node->attributes('image_w');
     $image_h = $node->attributes('image_h');
     $show_apply = $node->attributes('show_apply');
     $toggle = $node->attributes('toggle');
     $tooltip = $node->attributes('tooltip');
     // The main url
     $url = $node->attributes('url');
     $help = $node->attributes('help_url');
     $extension = $node->attributes('extension');
     $xml = $node->attributes('xml');
     $version = $node->attributes('version');
     $version_file = $node->attributes('version_file');
     // variables
     $v1 = $node->attributes('var1');
     $v2 = $node->attributes('var2');
     $v3 = $node->attributes('var3');
     $v4 = $node->attributes('var4');
     $v5 = $node->attributes('var5');
     if (!$extension) {
         $extension = str_replace('version_', '', $version_file);
     }
     $msg = '';
     if ($description) {
         $description = JText::sprintf($description, $v1, $v2, $v3, $v4, $v5);
         $description = str_replace('<' . 'ul>', '<' . 'ul class="reset">', $description);
     }
     if ($lang_folder) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $language =& JFactory::getLanguage();
         $lang = str_replace('_', '-', $language->_lang);
         if (strpos($lang_folder, '/administrator') === 0) {
             $lang_folder = str_replace('/', DS, str_replace('/administrator', JPATH_ADMINISTRATOR, $lang_folder));
         } else {
             $lang_folder = JPATH_SITE . str_replace('/', DS, $lang_folder);
         }
         $inc = '';
         $lang_file = ($lang_file ? '.' . $lang_file : '') . '.inc.php';
         if (JFile::exists($lang_folder . DS . $lang . DS . $lang . $lang_file)) {
             $inc = $lang_folder . DS . $lang . DS . $lang . $lang_file;
         } else {
             if (JFile::exists($lang_folder . DS . $lang . $lang_file)) {
                 $inc = $lang_folder . DS . $lang . $lang_file;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             if (JFile::exists($lang_folder . DS . $lang . DS . $lang . $lang_file)) {
                 $inc = $lang_folder . DS . $lang . DS . $lang . $lang_file;
             } else {
                 if (JFile::exists($lang_folder . DS . $lang . $lang_file)) {
                     $inc = $lang_folder . DS . $lang . $lang_file;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($nostyle && $description) {
         return $description;
     }
     if ($title) {
         $title = JText::_($title);
     }
     $user = JFactory::getUser();
     if (strlen($version) && strlen($version_file) && ($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) {
         // Import library dependencies
         require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
         $versions = NNVersions::instance();
         $msg = $versions->getMessage($extension, $xml, $version, 1);
         if ($version) {
             if ($title) {
                 $title .= ' v' . $version;
             } else {
                 $title = JText::_('Version') . ' ' . $version;
             }
         }
     } else {
         if ($xml) {
             $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml));
             if ($xml && isset($xml['version'])) {
                 $version = $xml['version'];
             }
             if ($version) {
                 if ($title) {
                     $title .= ' v' . $version;
                 } else {
                     $title = JText::_('Version') . ' ' . $version;
                 }
             }
         }
     }
     if ($url) {
         $url = '<a href="' . $url . '" target="_blank" title="' . $title . '">';
     }
     if ($image) {
         $image = str_replace('/', "\n", str_replace('\\', '/', $image));
         $image = explode("\n", trim($image));
         if ($image['0'] == 'administrator') {
             $image['0'] = JURI::base(true);
         } else {
             $image['0'] = JURI::root(true) . '/' . $image['0'];
         }
         $image = $url . '<img src="' . implode('/', $image) . '" border="0" style="float:right;margin-left:10px" alt=""';
         if ($image_w) {
             $image .= ' width="' . $image_w . '"';
         }
         if ($image_h) {
             $image .= ' height="' . $image_h . '"';
         }
         $image .= ' />';
         if ($url) {
             $image .= '</a>';
         }
     }
     if ($url) {
         $title = $url . $title . '</a>';
     }
     if ($help) {
         $help = '<a href="' . $help . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a>';
     }
     if ($title) {
         $title = html_entity_decoder($title);
     }
     if ($description) {
         $description = html_entity_decoder($description);
     }
     $html = '';
     if ($image) {
         $html .= $image;
     }
     if ($show_apply) {
         $apply_button = '<a href="#" onclick="submitbutton( \'apply\' );" title="' . JText::_('Apply') . '"><img align="right" border="0" alt="' . JText::_('Apply') . '" src="images/tick.png"/></a>';
         $html .= $apply_button;
     }
     if ($toggle && $description) {
         $el = 'document.getElementById( \'' . $control_name . $name . 'description\' )';
         $onclick = 'if( this.innerHTML == \'' . JText::_(JText::_('Show') . ' ' . $title) . '\' ){' . $el . '.style.display = \'block\';' . 'this.innerHTML = \'' . JText::_(JText::_('Hide') . ' ' . $title) . '\';' . '}else{' . $el . '.style.display = \'none\';' . 'this.innerHTML = \'' . JText::_(JText::_('Show') . ' ' . $title) . '\';' . '}' . 'this.blur();return false;';
         $html .= '<div class="button2-left" style="margin:0px 0px 5px 0px;"><div class="blank"><a href="javascript://;" onclick="' . $onclick . '">' . JText::_(JText::_('Show') . ' ' . $title) . '</a></div></div>' . "\n";
         $html .= '<br clear="all" />';
         $html .= '<div id="' . $control_name . $name . 'description" style="display:none;">';
     } else {
         if ($title) {
             if ($blocktype != 'fieldset') {
                 $html .= '<h4 style="margin: 0px;">' . $title . '</h4>';
             }
         }
     }
     if ($description && !$tooltip) {
         $html .= $description;
     }
     if ($help) {
         $html .= '<p>' . $help . '</p>';
     }
     if ($toggle && $description) {
         $html .= '</div>';
     }
     if ($message_type) {
         $html = '<dl id="system-message"><dd class="' . $message_type . '"><ul><li>' . html_entity_decoder($html) . '</li></ul></dd></dl>';
     } else {
         if ($blocktype != 'fieldset' && !$nostyle) {
             $html = '<div class="panel"><div style="padding: 2px 5px;">' . $html . '<div style="clear: both;"></div>';
         }
         if ($start) {
             if ($blocktype == 'fieldset') {
                 if ($description && $tooltip) {
                     $title = '<span class="hasTip" title="' . htmlentities($title . '::' . $description) . '">' . $title . '</span>';
                 }
                 $html = '<fieldset class="adminform"><legend>' . $title . '</legend>' . $html;
             }
             $html .= '<table width="100%" class="paramlist admintable" cellspacing="1">';
             $html .= '<tr><td colspan="2" class="paramlist_value">';
             $random = rand(100000, 999999);
             $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
         } else {
             $html .= '</div></div>';
         }
     }
     if ($msg) {
         $html = $msg . $html;
     }
     return $html;
 }
Example #7
0
 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $start = $this->def('start');
     $end = $this->def('end');
     $blocktype = $this->def('blocktype');
     if ($blocktype == 'spacer') {
         return;
     }
     $document =& JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/plugins/system/nonumberelements/css/style.css?v=' . $this->_version);
     if ($end) {
         $html = '';
         if ($j15) {
             $random = rand(100000, 999999);
             $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
             $html .= '</td></tr></table>';
         } else {
             $html .= '<div style="clear: both;"></div></li></ul>';
         }
         if ($j15 && $blocktype == 'fieldset') {
             $html .= '</fieldset>';
         } else {
             $html .= '</div></div>';
         }
         return $html;
     }
     $description = $this->def('description');
     $nostyle = $this->def('nostyle');
     $title = $this->def('label');
     $lang_file = $this->def('language_file');
     $message_type = $this->def('message_type');
     $image = $this->def('image');
     $image_w = $this->def('image_w');
     $image_h = $this->def('image_h');
     $show_apply = $this->def('show_apply');
     $toggle = $this->def('toggle');
     $tooltip = $this->def('tooltip');
     // The main url
     $url = $this->def('url');
     $help = $this->def('help_url');
     $extension = $this->def('extension');
     $xml = $this->def('xml');
     $version = $this->def('version');
     $version_file = $this->def('version_file');
     if (!$extension) {
         $extension = str_replace('version_', '', $version_file);
     }
     $msg = '';
     if ($description) {
         // variables
         $v1 = $this->def('var1');
         $v2 = $this->def('var2');
         $v3 = $this->def('var3');
         $v4 = $this->def('var4');
         $v5 = $this->def('var5');
         $description = NoNumberElementsFunctions::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
     }
     if ($lang_file) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $language =& JFactory::getLanguage();
         $lang = str_replace('_', '-', $language->getTag());
         $inc = '';
         $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
         if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
             $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
         } else {
             if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                 $inc = JPATH_SITE . DS . $lang_path;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
                 $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
             } else {
                 if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                     $inc = JPATH_SITE . DS . $lang_path;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($description) {
         $description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
         if (!$nostyle && $description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
     }
     if ($nostyle && $description) {
         return $description;
     }
     if ($title) {
         $title = JText::_($title);
     }
     $user = JFactory::getUser();
     if (strlen($version) && strlen($version_file) && ($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) {
         // Import library dependencies
         require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
         $versions = NNVersions::instance();
         $msg = $versions->getMessage($extension, $xml, $version, 1);
         if ($version) {
             if ($title) {
                 $title .= ' v' . $version;
             } else {
                 $title = JText::_('Version') . ' ' . $version;
             }
         }
     } else {
         if ($xml) {
             $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml));
             if ($xml && isset($xml['version'])) {
                 $version = $xml['version'];
             }
             if ($version) {
                 if ($title) {
                     $title .= ' v' . $version;
                 } else {
                     $title = JText::_('Version') . ' ' . $version;
                 }
             }
         }
     }
     if ($url) {
         $url = '<a href="' . $url . '" target="_blank" title="' . $title . '">';
     }
     if ($image) {
         $image = str_replace('/', "\n", str_replace('\\', '/', $image));
         $image = explode("\n", trim($image));
         if ($image['0'] == 'administrator') {
             $image['0'] = JURI::base(true);
         } else {
             $image['0'] = JURI::root(true) . '/' . $image['0'];
         }
         $image = $url . '<img src="' . implode('/', $image) . '" border="0" style="float:right;margin-left:10px" alt=""';
         if ($image_w) {
             $image .= ' width="' . $image_w . '"';
         }
         if ($image_h) {
             $image .= ' height="' . $image_h . '"';
         }
         $image .= ' />';
         if ($url) {
             $image .= '</a>';
         }
     }
     if ($url) {
         $title = $url . $title . '</a>';
     }
     if ($help) {
         $help = '<a href="' . $help . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a>';
     }
     if ($title) {
         $title = NoNumberElementsFunctions::html_entity_decoder($title);
     }
     $html = '';
     if ($image) {
         $html .= $image;
     }
     if ($show_apply) {
         $onclick = '';
         if ($j15) {
             $onclick = 'submitbutton( \'apply\' );';
         } else {
             $bar = JToolBar::getInstance('toolbar');
             foreach ($bar->getItems() as $b) {
                 if (isset($b['3']) && $b['1'] == 'apply') {
                     $onclick = 'Joomla.submitbutton(\'' . $b['3'] . '\')';
                 }
             }
         }
         if ($onclick) {
             $html .= '<a href="#" onclick="' . $onclick . '" title="' . JText::_('Apply') . '"><img style="float:right;" border="0" alt="' . JText::_('Apply') . '" src="' . JURI::root() . 'plugins/system/nonumberelements/images/tick.png"/></a>';
         }
     }
     if ($toggle && $description) {
         $el = 'document.getElementById( \'' . $id . 'description\' )';
         $onclick = 'if( this.innerHTML == \'' . JText::_(JText::_('Show') . ' ' . $title) . '\' ){' . $el . '.style.display = \'block\';' . 'this.innerHTML = \'' . JText::_(JText::_('Hide') . ' ' . $title) . '\';' . '}else{' . $el . '.style.display = \'none\';' . 'this.innerHTML = \'' . JText::_(JText::_('Show') . ' ' . $title) . '\';' . '}' . 'this.blur();return false;';
         $html .= '<div class="button2-left" style="margin:0px 0px 5px 0px;"><div class="blank"><a href="javascript://;" onclick="' . $onclick . '">' . JText::_(JText::_('Show') . ' ' . $title) . '</a></div></div>' . "\n";
         $html .= '<br clear="all" />';
         $html .= '<div id="' . $id . 'description" style="display:none;">';
     } else {
         if ($title) {
             if (!$j15 || $blocktype != 'fieldset') {
                 $html .= '<h4 style="margin: 0px;">' . $title . '</h4>';
             }
         }
     }
     if ($description && !$tooltip) {
         $html .= $description;
     }
     if ($help) {
         $html .= '<p>' . $help . '</p>';
     }
     if ($description) {
         $html = '<div class="nn_block nn_title">' . $html . '</div>';
     }
     if ($toggle && $description) {
         $html .= '</div>';
     }
     if ($message_type) {
         $html = '<dl id="system-message"><dd class="' . $message_type . '"><ul><li>' . NoNumberElementsFunctions::html_entity_decoder($html) . '</li></ul></dd></dl>';
     } else {
         if ((!$j15 || $blocktype != 'fieldset') && !$nostyle) {
             $class = 'panel nn_panel';
             if ($j15) {
                 $class .= ' nn_panel_15';
             }
             $html = '<div class="' . $class . '"><div class="nn_block nn_title">' . $html . '<div style="clear: both;"></div>';
         }
         if ($start) {
             if ($j15 && $blocktype == 'fieldset') {
                 if ($description && $tooltip) {
                     $title = '<span class="hasTip" title="' . htmlentities($title . '::' . $description) . '">' . $title . '</span>';
                 }
                 $html = '<fieldset class="adminform"><legend>' . $title . '</legend>' . $html;
             }
             if ($j15) {
                 $html .= '<table width="100%" class="paramlist admintable" cellspacing="1">';
                 $html .= '<tr><td colspan="2" class="paramlist_value">';
                 $random = rand(100000, 999999);
                 $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
             } else {
                 $html .= '<ul class="adminformlist"><li>';
             }
         } else {
             $html .= '</div></div>';
         }
     }
     if ($msg) {
         $html = $msg . $html;
     }
     return $html;
 }
Example #8
0
 function setMessage($current_version = '0', $version_file = '')
 {
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
     $versions = NNVersions::instance();
     echo $versions->getMessage(str_replace('version_', '', $version_file), '', $current_version, 1);
 }