Search History +

title

Body

[close]

/administrator/components/com_admin/ -> admin.admin.html.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: admin.admin.html.php 11300 2008-11-22 02:19:40Z ian $
   4   * @package        Joomla
   5   * @subpackage    Admin
   6   * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * @package        Joomla
  20  * @subpackage    Admin
  21  */
  22  class HTML_admin_misc
  23  {
  24  	function get_php_setting($val)
  25      {
  26          $r =  (ini_get($val) == '1' ? 1 : 0);
  27          return $r ? JText::_( 'ON' ) : JText::_( 'OFF' ) ;
  28      }
  29  
  30  	function get_server_software()
  31      {
  32          if (isset($_SERVER['SERVER_SOFTWARE'])) {
  33              return $_SERVER['SERVER_SOFTWARE'];
  34          } else if (($sf = getenv('SERVER_SOFTWARE'))) {
  35              return $sf;
  36          } else {
  37              return JText::_( 'n/a' );
  38          }
  39      }
  40  
  41  	function system_info( )
  42      {
  43          global $mainframe;
  44  
  45          //Load switcher behavior
  46          JHTML::_('behavior.switcher');
  47  
  48          $db =& JFactory::getDBO();
  49  
  50          $contents = '';
  51          ob_start();
  52          require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'navigation.php');
  53          $contents = ob_get_contents();
  54          ob_clean();
  55  
  56          $document =& JFactory::getDocument();
  57          $document->setBuffer($contents, 'modules', 'submenu');
  58          ?>
  59          <form action="index.php" method="post" name="adminForm">
  60  
  61          <div id="config-document">
  62              <div id="page-site">
  63                  <table class="noshow">
  64                  <tr>
  65                      <td>
  66                          <?php require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'sysinfo_system.php'); ?>
  67                      </td>
  68                  </tr>
  69                  </table>
  70              </div>
  71  
  72              <div id="page-phpsettings">
  73                  <table class="noshow">
  74                  <tr>
  75                      <td>
  76                          <?php require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'sysinfo_phpsettings.php'); ?>
  77                      </td>
  78                  </tr>
  79                  </table>
  80              </div>
  81  
  82              <div id="page-config">
  83                  <table class="noshow">
  84                  <tr>
  85                      <td>
  86                          <?php require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'sysinfo_config.php'); ?>
  87                      </td>
  88                  </tr>
  89                  </table>
  90              </div>
  91  
  92              <div id="page-directory">
  93                  <table class="noshow">
  94                  <tr>
  95                      <td>
  96                          <?php require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'sysinfo_directory.php'); ?>
  97                      </td>
  98                  </tr>
  99                  </table>
 100              </div>
 101  
 102              <div id="page-phpinfo">
 103                  <table class="noshow">
 104                  <tr>
 105                      <td>
 106                          <?php require_once (JPATH_COMPONENT.DS.'tmpl'.DS.'sysinfo_phpinfo.php'); ?>
 107                      </td>
 108                  </tr>
 109                  </table>
 110              </div>
 111          </div>
 112  
 113          <div class="clr"></div>
 114          <?php
 115      }
 116  
 117      /**
 118       * Display Help Page
 119       *
 120       * For this method the important two scenarios are local or remote help files.
 121       * In the case of local help files the language tag will be added in order to
 122       * allow different languages of help.<br />
 123       * In case of the remote server it is assumed that this server provide one specific
 124       * help set of files in one particular language.
 125       */
 126  	function help()
 127      {
 128          global $mainframe;
 129          jimport( 'joomla.filesystem.folder' );
 130          jimport( 'joomla.language.help' );
 131  
 132          // Get Help URL - an empty helpurl is interpreted as local help files!
 133          $helpurl    = $mainframe->getCfg('helpurl');
 134          if ( $helpurl == 'http://help.mamboserver.com' ) {
 135              $helpurl = 'http://help.joomla.org';
 136          }
 137          $fullhelpurl = $helpurl . '/index2.php?option=com_content&amp;task=findkey&amp;pop=1&amp;keyref=';
 138  
 139          $helpsearch = JRequest::getString('helpsearch');
 140          $page        = JRequest::getCmd('page', 'joomla.whatsnew15.html');
 141          $toc        = getHelpToc( $helpsearch );
 142          $lang        =& JFactory::getLanguage();
 143          $langTag = $lang->getTag();
 144          if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) {
 145              $langTag = 'en-GB';        // use english as fallback
 146          }
 147  
 148          if (!eregi( '\.html$', $page )) {
 149              $page .= '.xml';
 150          }
 151          ?>
 152          <form action="index.php?option=com_admin&amp;task=help" method="post" name="adminForm">
 153  
 154          <table class="adminform" border="1">
 155          <tr>
 156              <td colspan="2">
 157                  <table width="100%">
 158                      <tr>
 159                          <td>
 160                              <strong><?php echo JText::_( 'Search' ); ?>:</strong>
 161                              <input class="text_area" type="hidden" name="option" value="com_admin" />
 162                              <input type="text" name="helpsearch" value="<?php echo $helpsearch;?>" class="inputbox" />
 163                              <input type="submit" value="<?php echo JText::_( 'Go' ); ?>" class="button" />
 164                              <input type="button" value="<?php echo JText::_( 'Clear Results' ); ?>" class="button" onclick="f=document.adminForm;f.helpsearch.value='';f.submit()" />
 165                          </td>
 166                          <td class="helpMenu">
 167                              <?php
 168                              if ($helpurl) {
 169                              ?>
 170                              <?php echo JHTML::_('link', JHelp::createUrl( 'joomla.glossary' ), JText::_( 'Glossary' ), array('target' => 'helpFrame')) ?>
 171                              |
 172                              <?php echo JHTML::_('link', JHelp::createUrl( 'joomla.credits' ), JText::_( 'Credits' ), array('target' => 'helpFrame')) ?>
 173                              |
 174                              <?php echo JHTML::_('link', JHelp::createUrl( 'joomla.support' ), JText::_( 'Support' ), array('target' => 'helpFrame')) ?>
 175                              <?php
 176                              } else {
 177                              ?>
 178                              <?php echo JHTML::_('link', 'http://docs.joomla.org/index.php?title=Glossary&printable=true', JText::_( 'Glossary' ), array('target' => 'helpFrame')) ?> |
 179                              <?php echo JHTML::_('link', 'http://docs.joomla.org/index.php?title=Joomla.credits.15&printable=true', JText::_( 'Credits' ), array('target' => 'helpFrame')) ?> |
 180                              <?php echo JHTML::_('link', 'http://docs.joomla.org/index.php?title=Joomla.support.15&printable=true', JText::_( 'Support' ), array('target' => 'helpFrame')) ?>
 181                              <?php } ?>
 182                              |
 183                              <?php echo JHTML::_('link', 'http://www.gnu.org/licenses/gpl-2.0.html', JText::_( 'License' ), array('target' => 'helpFrame')) ?>
 184                              |
 185                              <?php echo JHTML::_('link', 'http://docs.joomla.org', 'docs.joomla.org', array('target' => 'helpFrame')) ?>
 186                              |
 187                              <?php echo JHTML::_('link', 'index.php?option=com_admin&amp;task=changelog&amp;tmpl=component', JText::_( 'Changelog' ), array('target' => 'helpFrame')) ?>
 188                              |
 189                              <?php echo JHTML::_('link', 'http://docs.joomla.org/index.php?title=Joomla_1.5_version_history&printable=true', JText::_( 'Latest Version Check' ), array('target' => 'helpFrame')) ?>
 190                          </td>
 191                      </tr>
 192                  </table>
 193              </td>
 194          </tr>
 195          </table>
 196  
 197          <div id="treecellhelp">
 198              <fieldset title="<?php echo JText::_( 'Alphabetical Index' ); ?>">
 199                  <legend>
 200                      <?php echo JText::_( 'Alphabetical Index' ); ?>
 201                  </legend>
 202  
 203                  <div class="helpIndex">
 204                      <ul class="subext">
 205                          <?php
 206                          foreach ($toc as $k=>$v) {
 207                              if ($helpurl) {
 208                                  echo '<li>';
 209                                  echo JHTML::_('link', JHelp::createUrl( $k ), $v, array('target' => 'helpFrame'));
 210                                  echo '</li>';
 211                              } else {
 212                                  echo '<li>';
 213                                  echo JHTML::_('link', JURI::base() .'help/'.$langTag.'/'.$k, $v, array('target' => 'helpFrame'));
 214                                  echo '</li>';
 215                              }
 216                          }
 217                          ?>
 218                      </ul>
 219                  </div>
 220              </fieldset>
 221          </div>
 222  
 223          <div id="datacellhelp">
 224              <fieldset title="<?php echo JText::_( 'View' ); ?>">
 225                  <legend>
 226                      <?php echo JText::_( 'View' ); ?>
 227                  </legend>
 228                  <?php
 229                  if ($helpurl && $page != 'joomla.whatsnew15.html') {
 230                      ?>
 231                      <iframe name="helpFrame" src="<?php echo $fullhelpurl .preg_replace( '#\.xml$|\.html$#', '', $page );?>" class="helpFrame" frameborder="0"></iframe>
 232                      <?php
 233                  } else {
 234                      ?>
 235                      <iframe name="helpFrame" src="<?php echo JURI::base() .'help/' .$langTag. '/' . $page;?>" class="helpFrame" frameborder="0"></iframe>
 236                      <?php
 237                  }
 238                  ?>
 239              </fieldset>
 240          </div>
 241  
 242          <input type="hidden" name="task" value="help" />
 243          </form>
 244          <?php
 245      }
 246  
 247      /*
 248      * Displays contents of Changelog.php file
 249      */
 250  	function changelog()
 251      {
 252          ?>
 253          <pre>
 254              <?php
 255              ob_start();
 256              readfile( JPATH_SITE.DS.'CHANGELOG.php' );
 257              $changelog = ob_get_contents();
 258              ob_clean();
 259  
 260              // Strip php tag
 261              $changelog = preg_replace('/\<\?php[^\?]*\?\>/','',$changelog);
 262  
 263              // Convert all other HTML entities
 264              echo htmlentities($changelog);
 265              ?>
 266          </pre>
 267          <?php
 268      }
 269  }
 270  
 271  function writableCell( $folder, $relative=1, $text='', $visible=1 )
 272  {
 273      $writeable        = '<b><font color="green">'. JText::_( 'Writable' ) .'</font></b>';
 274      $unwriteable    = '<b><font color="red">'. JText::_( 'Unwritable' ) .'</font></b>';
 275  
 276      echo '<tr>';
 277      echo '<td class="item">';
 278      echo $text;
 279      if ( $visible ) {
 280          echo $folder . '/';
 281      }
 282      echo '</td>';
 283      echo '<td >';
 284      if ( $relative ) {
 285          echo is_writable( "../$folder" )    ? $writeable : $unwriteable;
 286      } else {
 287          echo is_writable( "$folder" )        ? $writeable : $unwriteable;
 288      }
 289      echo '</td>';
 290      echo '</tr>';
 291  }
 292  
 293  /**
 294   * Compiles the help table of contents
 295   * @param string A specific keyword on which to filter the resulting list
 296   */
 297  function getHelpTOC( $helpsearch )
 298  {
 299      global $mainframe;
 300  
 301      $lang =& JFactory::getLanguage();
 302      jimport( 'joomla.filesystem.folder' );
 303  
 304      $helpurl        = $mainframe->getCfg('helpurl');
 305  
 306      // Check for files in the actual language
 307      $langTag = $lang->getTag();
 308      if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) {
 309          $langTag = 'en-GB';        // use english as fallback
 310      }
 311      $files = JFolder::files( JPATH_BASE.DS.'help'.DS.$langTag, '\.xml$|\.html$' );
 312  
 313      $toc = array();
 314      foreach ($files as $file) {
 315          $buffer = file_get_contents( JPATH_BASE.DS.'help'.DS.$langTag.DS.$file );
 316          if (preg_match( '#<title>(.*?)</title>#', $buffer, $m )) {
 317              $title = trim( $m[1] );
 318              if ($title) {
 319                  if ($helpurl) {
 320                      // strip the extension
 321                      $file = preg_replace( '#\.xml$|\.html$#', '', $file );
 322                  }
 323                  if ($helpsearch) {
 324                      if (JString::strpos( strip_tags( $buffer ), $helpsearch ) !== false) {
 325                          $toc[$file] = $title;
 326                      }
 327                  } else {
 328                      $toc[$file] = $title;
 329                  }
 330              }
 331          }
 332      }
 333      asort( $toc );
 334      return $toc;
 335  }