Location: PHPKode > projects > MaximaPHP > maximaphp/index.php
<?php

/**
 * index.php, MaximaPHP Viewer index
 *
 * The main index for Maxima PHP.
 * 
 * This file contains index page of MaximaPHP viewer.
 * @author Bowo Prasetyo <http://www.my-tool.com/>
 * @version 0.1.3
 * @package MaximaPHP
 */

/**************************************************************
 *
 * Copyright (C) 2007 Bowo Prasetyo
 *
 * This program 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 below,
 * 
 * http://www.gnu.org/licenses/gpl.html#TOC1
 * 
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
 * MA  02110-1301, USA.
 *
 **************************************************************/

/**
 * Read configuration file
 */
require( 'mpconf.php' );

/**
 * Require file to rewrite URL
 */
require_once( 'mprewriteurl.php' );

/**
 * Define base URL
 */
define( 'BASE_URL', $baseUrl );

/**
 * Set language selection
 */
if ( isset( $_GET['lang'] ) )
{
   $xhtml_file = 'lang/mpxhtml-' . $_GET['lang'] . '.php';
   $lang_file = 'lang/mptext-' . $_GET['lang'] . '.php';
   define( 'LANG_QUERY', '?lang=' . $_GET['lang'] );
   define( 'LANG_QUERY_AMP', '?lang=' . $_GET['lang'] . '&' );
}
else
{
   $xhtml_file = 'mpxhtml.php';
   $lang_file = 'mptext.php';
   define( 'LANG_QUERY', '' );
   define( 'LANG_QUERY_AMP', '?' );
}

/**
 * Include file containing texts in the chosen language
 */
include_once( $lang_file );


/**
 * List of registered level 1 viewers
 */
$level1 = array
(
   'algebra' => 'Algebra',
   'equations' => 'Equations',
   'calculus' => 'Calculus',
   'matrix' => 'Matrices',
   'fractal' => 'Fractals',
   'cellauto' => 'Cellular Automata'
);


/**
 * List of registered level 2 viewers
 */
$level2 = array
(
   'algebra' => array
   (
      'simplify' => 'Simplify',
      'expand' => 'Expand',
      'factor' => 'Factor'
   ),
   'equations' => array
   (
      'solve' => 'Solve',
      'funcsolve' => 'Function Solve'
   ),
   'calculus' => array
   (
      'differentiate' => 'Differentiate',
      'integrate' => 'Integrate'
   ),
   'matrix' => array
   (
      'matrixarithmetic' => 'Arithmetic',
      'matrixproperty' => 'Properties',
      'matrixtrigonometry' => 'Trigonometry'
   ),
   'fractal' => array
   (
      'mandelbrot' => 'Mandelbrot',
      'julia' => 'Julia'
   )
);

/**
 * Set current viewer
 */
if ( !isset( $_GET['viewer'] ) )
{
   require_once( 'mpviewer.php' );
   $viewer = new MPViewer();
}
else
{
   $qstring = '';
   if ( isset( $level2[$_GET['viewer']] ) )
   {
      if ( isset( $_GET['sub1'] ) )
      {
         $class = 'MPV' . $_GET['sub1'];
         $title = $level1[$_GET['viewer']] . ' : ' . $level2[$_GET['viewer']][$_GET['sub1']];
         $qstring = 'viewer=' . $_GET['viewer'] . '&sub1=' . $_GET['sub1'] . '&';
      }
      else
      {
         $v = array_keys($level2[$_GET['viewer']]);
         $v = $v[0];
         $class = 'MPV' . $v;
         $title = $level1[$_GET['viewer']] . ' : ' . $level2[$_GET['viewer']][$v];
         $qstring = 'viewer=' . $_GET['viewer'] . '&sub1=' . $v . '&';
      }
   }
   else
   {
      $class = 'MPV' . $_GET['viewer'];
      $title = $level1[$_GET['viewer']];
      $qstring = 'viewer=' . $_GET['viewer'] . '&';
   }
   require_once( strtolower( "viewers/$class.php" ) );
   $viewer = new $class;
}

/**
 * Define page title
 */
define( 'TITLE', $baseTitle . ' : ' . $title );

/**
 * Start session and load xhtml header
 */
session_start();
require_once( $xhtml_file );

?>

<title><?php echo TITLE ?></title>

<style>
<!--
body,td,div,p,a{font-family:arial,sans-serif }
td { vertical-align: top }
.eg { color: #800000; font-size:small }
hr.dot {border: none 0; 
	border-top: 1px dashed #0080FF;
	border-bottom: 1px dashed #ABD5FE;
	height: 2px;
	}	
-->
</style>

</head>

<body bgcolor="#ffffff" topmargin="2" marginheight="2">

<table border="0" cellpadding="0" cellspacing="2" width="100%">
  <tr>
    <td width="1%" valign="top"><a href="<?php echo BASE_URL ?>/"><img src="<?php echo BASE_URL ?>/images/maximaphp.png" alt="MaximaPHP" width="305" height="90" hspace="3" vspace="5" border="0" /></a></td>
    <td>&nbsp;&nbsp;</td>

    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="14" valign="bottom">
              <table border="0" cellpadding="4" cellspacing="0">
                <tr>
                  <td class="q"><font size="-1">
		  </font></td>
                </tr>
            </table></td>
        </tr>
        <tr>
          <td nowrap="nowrap">
	  </td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#0080FF"><img width="1" height="1" alt="" /></td>
  </tr>
</table><table width="100%" border="0" cellpadding="2" cellspacing="0">
   <tr>

    <td colspan="4" bgcolor="#ABD5FE"><b><?php echo TITLE ?></b></td>

  </tr>
</table>
<br />
<table width="100%" border="0" cellpadding="2" cellspacing="0">
  <tr>
    <td width="1%" valign="top" nowrap="nowrap" bgcolor="#ffffff"><p><small>
    
        <?php

        /**
         * Print out links in the left column
         */
        echo '<a href="' . mprewriteurl( "index.php" . LANG_QUERY  ) . '">Main</a><br />';
        foreach ( $level1 as $v => $t )
        {
           echo '<a href="' . mprewriteurl( 'index.php?viewer=' . $v ) . '">' . $t . '</a><br />';
	  }
        echo '<hr class="dot" /><a href="' . mprewriteurl( 'index.php?viewer=generator' ) . '">Viewer Generator</a><br />';
        echo '<hr class="dot" /><font color="red"><b>Running Server</b></font><br />';
        echo '<a href="http://www.my-tool.com/mathematics/maximaphp/">MaximaPHP Home</a><br />';
        echo '<a href="http://www.my-tool.com/maximaphp/">Showcase</a><br />';
        echo '<hr class="dot" /><a href="http://maximaphp.sourceforge.net/README">README</a><br />';
        echo '<a href="http://maximaphp.sourceforge.net/SECURITY">SECURITY</a><br />';
        echo '<a href="http://maximaphp.sourceforge.net/INSTALL">INSTALL</a><br />';
        echo '<a href="http://maximaphp.sourceforge.net/LICENSE">LICENSE</a><br />';
        echo '<a href="http://maximaphp.sourceforge.net/CHANGES">CHANGES</a><br />';
        echo '<a href="http://maximaphp.sourceforge.net/doc/index.html">Documentation</a><br />';
        echo '<hr class="dot" /><a href="http://sourceforge.net/projects/maximaphp">Project page</a><br />';
        echo '<a href="http://sourceforge.net/project/screenshots.php?group_id=191602">Screenshots</a><br />';
        echo '<a href="http://sourceforge.net/project/platformdownload.php?group_id=191602">Download</a><br />';
        echo '<hr class="dot" /><a href="' . mprewriteurl( 'index.php' ) . '">English</a><br />';
        echo '<a href="' . mprewriteurl( 'index.php?lang=id' ) . '">Indonesian</a><br />';
        echo '<a href="' . mprewriteurl( 'index.php?lang=ja' ) . '">Japanese</a><br />';

        ?>

    <hr class="dot" />
    <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=191602&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
    </small></p></td>
    <td width="9" valign="bottom">&nbsp;</td>
    <td background="<?php echo BASE_URL ?>/images/dot.gif" valign="bottom"><img src="<?php echo BASE_URL ?>/images/dot.gif" width="1" height="1" /></td>

    <td width="9" valign="bottom">&nbsp;</td>
    <td width="100%">

       <h4><font color="red">This MaximaPHP is not connected to any Maxima program!</font></h4>
    
       <?php

          /**
           * Print out category members if any
           */
          if ( isset( $level2[$_GET['viewer']] ) )
          {
              foreach ( $level2[$_GET['viewer']] as $v => $t )
              {
                 echo '<a href="' . mprewriteurl( 'index.php?viewer=' . $_GET['viewer'] . '&sub1=' . $v ) . '">' . $t . '</a>&nbsp;&nbsp;&nbsp;';
      	  }
              echo '<hr class="dot" />';
          }

          /**
           * Print out the viewer in the main column
           */
          
          $viewer->show( $qstring );

       ?>

    </td>
  </tr>
</table>
<br />
<center>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#0080FF"><img width="1" height="1" alt="" /></td>
  </tr>

</table>
  <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#ABD5FE">
    <tr>
      <td bgcolor="#ABD5FE" nowrap="nowrap"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ABD5FE">
          <tr>
            <td align="center" nowrap="nowrap"><font size="-1">&copy;2007 MaximaPHP</font></td>
            <td align="center" nowrap="nowrap"><font size="-1">designed by <a href="http://www.my-tool.com/">my-tool.com</a></font></td>
          </tr>
      </table></td>
    </tr>
  </table>
</center>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1570097-1";
urchinTracker();
</script>
</body>
</html>

<?php

?>
Return current item: MaximaPHP