PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/base_code/index.php

https://code.google.com/p/mathcloud/
PHP | 174 lines | 117 code | 33 blank | 24 comment | 8 complexity | e9f5c706a3ff7d845f2b5ca3c8d1e81d MD5 | raw file
  1. <?php
  2. /*********************************************************************
  3. *
  4. * This file is a part of Web Interface to Octave project.
  5. * Copyright (C) 2008 Kolo Naukowe Numerykow Uniwersytetu Warszawskiego
  6. * (Students' Numerical Scientific Group of University of Warsaw)
  7. *
  8. * e-mail:knn@students.mimuw.edu.pl
  9. *
  10. * Distributed under terms of GPL License
  11. *
  12. *
  13. *********************************************************************/
  14. // set absolute path
  15. set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
  16. // global variables
  17. require('config/config.php');
  18. require('config/environment.php');
  19. // include necessary files
  20. require_once('code/session.php');
  21. require_once('code/user.php');
  22. // start session
  23. $session = new Session();
  24. $user = new User($session->GetUserID(), $session->GetSessionID());
  25. // log in user
  26. if (isset($_POST['login']) and isset($_POST['password']))
  27. if ($user->Login($_POST['login'], $_POST['password']))
  28. {
  29. $session->ChangeUserID($user->GetId());
  30. // reload page
  31. header("Location: index.php");
  32. }
  33. // log out
  34. if ($user->IsAnonymous() == false)
  35. if (isset($_GET['logout']))
  36. {
  37. $user->Logout();
  38. $session->ChangeUserID(0);
  39. // reload page
  40. header("Location: index.php");
  41. }
  42. // load content file
  43. //verify whcih tab is active
  44. $c_tab_class_active = "";
  45. $ya_tab_class_active = "";
  46. $yf_tab_class_active = "";
  47. $yfiles_tab_class_active = "";
  48. $plots_tab_class_active = "";
  49. if (isset($_GET['p']))
  50. switch ($_GET['p'])
  51. {
  52. case 'c': include('code/command.php');
  53. $content = new Command($session, $user);
  54. $c_tab_class_active = ' class="active"';
  55. break;
  56. case 'ya': include('your_account.php');
  57. $content = new YourAccount($user);
  58. $ya_tab_class_active = ' class="active"';
  59. break;
  60. case 'yf': include('your_functions.php');
  61. $content = new YourFunctions($session, $user);
  62. $yf_tab_class_active = ' class="active"';
  63. break;
  64. case 'plots': include('your_plots.php');
  65. $content = new YourPlots($session, $user);
  66. $plots_tab_class_active = ' class="active"';
  67. break;
  68. case 'yfiles': include('your_files.php');
  69. $content = new YourFiles($session, $user);
  70. $yfiles_tab_class_active = ' class="active"';
  71. break;
  72. case 'signup':
  73. include('signup.php');
  74. $content = new Singup($session, $user);
  75. $ya_tab_class_active = ' class="active"';
  76. }
  77. else // if the page wasn't chosen load the default page
  78. {
  79. include('code/command.php');
  80. $content = new Command($session, $user);
  81. $c_tab_class_active = ' class="active"';
  82. }
  83. // initialize content
  84. $content->Initialize();
  85. ?>
  86. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  87. "http://www.w3.org/TR/html4/strict.dtd">
  88. <html>
  89. <head>
  90. <title>Web interface to Octave</title>
  91. <meta NAME="description" CONTENT="Web interface to Octave">
  92. <meta NAME="author" CONTENT="Ko? naukowe numeryk?, Students' numerical research group">
  93. <meta NAME="keywords" CONTENT="scientific computing, obliczenia naukowe, Octave,
  94. web interface, matematyka obliczeniowa, metody numeryczne, analiza numeryczna">
  95. <link href="weboctave.css" rel="stylesheet">
  96. <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">
  97. </head>
  98. <body>
  99. <div id="title"><h1>Web Interface to Octave</h1><p style="font-size: smaller">Version <?php echo WIO_VERSION;?></div>
  100. <h2>Try Octave in your browser!</h2>
  101. <p>Web Interface to Octave makes it possible to use <a
  102. href="http://www.octave.org">Octave</a> remotely through your browser. Learn more <a href="http://knn.mimuw.edu.pl/weboctave-project">about the <cite>Web Interface to Octave</cite> project</a>.
  103. <div class="fineprint">
  104. <p><strong>Please do not submit codes that will run for a long time or take up a lot of memory.</strong> This service is intended for occasional, quick computations. Use "<kbd>Files -> Remove all files</kbd>" button to clear your workspace after you are done. All your activities are being logged. If you don't like this policy, don't use this service.
  105. <p>If you are new to Octave, you may find it useful to read <a href='http://www.gnu.org/software/octave/doc/interpreter'>Octave's manual</a> prior to using it. If you like Octave, it is recommended to <a href='http://www.gnu.org/software/octave/download.html'>get your own copy</a> - it is all free!
  106. </div>
  107. <?php echo HT_GREETING; ?>
  108. <hr>
  109. <div id="menus">
  110. <ul class="xmenu">
  111. <?php
  112. echo '<li><a href="?p=c#menus" '.$c_tab_class_active.'>Commands</a>';
  113. echo '<li><a href="?p=plots#menus" '.$plots_tab_class_active.'>Plots</a>';
  114. echo '<li><a href="?p=yfiles#menus" '.$yfiles_tab_class_active.'>Files</a>';
  115. echo '<li><a href="?p=yf#menus" '.$yf_tab_class_active.'>Functions</a>';
  116. echo '<li><a href="?p=ya#menus" '.$ya_tab_class_active.'>Account</a>';
  117. ?>
  118. </ul>
  119. </div>
  120. <div>
  121. <?
  122. // load content
  123. $content->ShowContent();
  124. ?>
  125. </div>
  126. <hr>
  127. <?php
  128. echo HT_INFO_PANEL;
  129. ?>
  130. <p style="font-size: smaller">Last updated:
  131. <?php echo date ("F d Y H:i:s.", getlastmod()); ?>
  132. </p>
  133. <p style="font-size:xx-small">This page intentionally uses directly a <a href="http://www.gnu.org/software/octave/octave.css">stylesheet</a> from <a href="http://www.gnu.org/software/octave/about.html">Octave project</a> webpage for basic formatting.
  134. </body>
  135. </html>