/** * @version $Id: admin.admin.html.php 10790 2008-08-24 09:36:26Z pasamio $ * @package Joomla * @subpackage Admin * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); /** * @package Joomla * @subpackage Admin */ class HTML_admin_misc { function get_php_setting($val) { $r = (ini_get($val) == '1' ? 1 : 0); return $r ? JText::_( 'ON' ) : JText::_( 'OFF' ) ; } function get_server_software() { if (isset($_SERVER['SERVER_SOFTWARE'])) { return $_SERVER['SERVER_SOFTWARE']; } else if (($sf = getenv('SERVER_SOFTWARE'))) { return $sf; } else { return JText::_( 'n/a' ); } } function system_info( ) { global $mainframe; //Load switcher behavior JHTML::_('behavior.switcher'); $db =& JFactory::getDBO(); $contents = ''; ob_start(); require_once(JPATH_COMPONENT.DS.'tmpl'.DS.'navigation.php'); $contents = ob_get_contents(); ob_clean(); $document =& JFactory::getDocument(); $document->setBuffer($contents, 'modules', 'submenu'); ?> } /** * Display Help Page * * For this method the important two scenarios are local or remote help files. * In the case of local help files the language tag will be added in order to * allow different languages of help. * In case of the remote server it is assumed that this server provide one specific * help set of files in one particular language. */ function help() { global $mainframe; jimport( 'joomla.filesystem.folder' ); jimport( 'joomla.language.help' ); // Get Help URL - an empty helpurl is interpreted as local help files! $helpurl = $mainframe->getCfg('helpurl'); if ( $helpurl == 'http://help.mamboserver.com' ) { $helpurl = 'http://help.joomla.org'; } $fullhelpurl = $helpurl . '/index2.php?option=com_content&task=findkey&pop=1&keyref='; $helpsearch = JRequest::getString('helpsearch'); $page = JRequest::getCmd('page', 'joomla.whatsnew15.html'); $toc = getHelpToc( $helpsearch ); $lang =& JFactory::getLanguage(); $langTag = $lang->getTag(); if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { $langTag = 'en-GB'; // use english as fallback } if (!eregi( '\.html$', $page )) { $page .= '.xml'; } ?> : if ($helpurl) { ?> | | } else { ?> | | } ?> | | | | foreach ($toc as $k=>$v) { if ($helpurl) { echo ''; echo JHTML::_('link', JHelp::createUrl( $k ), $v, array('target' => 'helpFrame')); echo ''; } else { echo ''; echo JHTML::_('link', JURI::base() .'help/'.$langTag.'/'.$k, $v, array('target' => 'helpFrame')); echo ''; } } ?> if ($helpurl && $page != 'joomla.whatsnew15.html') { ?> } else { ?> } ?> } /* * Displays contents of Changelog.php file */ function changelog() { ?> ob_start(); readfile( JPATH_SITE.DS.'CHANGELOG.php' ); $changelog = ob_get_contents(); ob_clean(); // Strip php tag $changelog = preg_replace('/\/','',$changelog); // Convert all other HTML entities echo htmlentities($changelog); ?> } } function writableCell( $folder, $relative=1, $text='', $visible=1 ) { $writeable = ''. JText::_( 'Writable' ) .''; $unwriteable = ''. JText::_( 'Unwritable' ) .''; echo ''; echo ''; echo $text; if ( $visible ) { echo $folder . '/'; } echo ''; echo ''; if ( $relative ) { echo is_writable( "../$folder" ) ? $writeable : $unwriteable; } else { echo is_writable( "$folder" ) ? $writeable : $unwriteable; } echo ''; echo ''; } /** * Compiles the help table of contents * @param string A specific keyword on which to filter the resulting list */ function getHelpTOC( $helpsearch ) { global $mainframe; $lang =& JFactory::getLanguage(); jimport( 'joomla.filesystem.folder' ); $helpurl = $mainframe->getCfg('helpurl'); // Check for files in the actual language $langTag = $lang->getTag(); if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { $langTag = 'en-GB'; // use english as fallback } $files = JFolder::files( JPATH_BASE.DS.'help'.DS.$langTag, '\.xml$|\.html$' ); $toc = array(); foreach ($files as $file) { $buffer = file_get_contents( JPATH_BASE.DS.'help'.DS.$langTag.DS.$file ); if (preg_match( '#(.*?)#', $buffer, $m )) { $title = trim( $m[1] ); if ($title) { if ($helpurl) { // strip the extension $file = preg_replace( '#\.xml$|\.html$#', '', $file ); } if ($helpsearch) { if (JString::strpos( strip_tags( $buffer ), $helpsearch ) !== false) { $toc[$file] = $title; } } else { $toc[$file] = $title; } } } } asort( $toc ); return $toc; }