home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / wiki / lib / main.php < prev    next >
PHP Script  |  2004-03-08  |  5KB  |  119 lines

  1. <?php
  2. // $Id: main.php,v 1.1 2004/01/12 22:14:05 comsubvie Exp $
  3.  
  4. // Harvest script parameters and other variables.  We do this even if
  5. // register_globals=on; this way, we force the variables to be defined.
  6. // (Which is better form in case the admin has warnings cranked all the
  7. // way up).
  8.  
  9. $HTTP_REFERER = isset($HTTP_SERVER_VARS['HTTP_REFERER'])
  10.                 ? $HTTP_SERVER_VARS['HTTP_REFERER'] : '';
  11. $QUERY_STRING = isset($HTTP_SERVER_VARS['QUERY_STRING'])
  12.                 ? $HTTP_SERVER_VARS['QUERY_STRING'] : '';
  13. $REMOTE_ADDR  = isset($HTTP_SERVER_VARS['REMOTE_ADDR'])
  14.                 ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : '';
  15.  
  16. $action       = isset($HTTP_GET_VARS['action'])
  17.                 ? $HTTP_GET_VARS['action'] : '';
  18. $page         = isset($HTTP_GET_VARS['page'])
  19.                 ? $HTTP_GET_VARS['page'] : '';
  20. $ver1         = isset($HTTP_GET_VARS['ver1'])
  21.                 ? $HTTP_GET_VARS['ver1'] : '';
  22. $ver2         = isset($HTTP_GET_VARS['ver2'])
  23.                 ? $HTTP_GET_VARS['ver2'] : '';
  24. $find         = isset($HTTP_GET_VARS['find'])
  25.                 ? $HTTP_GET_VARS['find'] : '';
  26. $style         = isset($HTTP_GET_VARS['style'])
  27.                 ? $HTTP_GET_VARS['style'] : '';
  28. $version      = isset($HTTP_GET_VARS['version'])
  29.                 ? $HTTP_GET_VARS['version'] : '';
  30. $full         = isset($HTTP_GET_VARS['full'])
  31.                 ? $HTTP_GET_VARS['full'] : '';
  32. $min          = isset($HTTP_GET_VARS['min'])
  33.                 ? $HTTP_GET_VARS['min'] : '';
  34. $days         = isset($HTTP_GET_VARS['days'])
  35.                 ? $HTTP_GET_VARS['days'] : '';
  36.  
  37. $Preview      = isset($HTTP_POST_VARS['Preview'])
  38.                 ? $HTTP_POST_VARS['Preview'] : '';
  39. $Save         = isset($HTTP_POST_VARS['Save'])
  40.                 ? $HTTP_POST_VARS['Save'] : '';
  41. $archive      = isset($HTTP_POST_VARS['archive'])
  42.                 ? $HTTP_POST_VARS['archive'] : '';
  43. $auth         = isset($HTTP_POST_VARS['auth'])
  44.                 ? $HTTP_POST_VARS['auth'] : '';
  45. $categories   = isset($HTTP_POST_VARS['categories'])
  46.                 ? $HTTP_POST_VARS['categories'] : '';
  47. $cols         = isset($HTTP_POST_VARS['cols'])
  48.                 ? $HTTP_POST_VARS['cols'] : '';
  49. $comment      = isset($HTTP_POST_VARS['comment'])
  50.                 ? $HTTP_POST_VARS['comment'] : '';
  51. $days         = isset($HTTP_POST_VARS['days'])
  52.                 ? $HTTP_POST_VARS['days'] : $days;
  53. $discard      = isset($HTTP_POST_VARS['discard'])
  54.                 ? $HTTP_POST_VARS['discard'] : '';
  55. $document     = isset($HTTP_POST_VARS['document'])
  56.                 ? $HTTP_POST_VARS['document'] : '';
  57. $hist         = isset($HTTP_POST_VARS['hist'])
  58.                 ? $HTTP_POST_VARS['hist'] : '';
  59. $min          = isset($HTTP_POST_VARS['min'])
  60.                 ? $HTTP_POST_VARS['min'] : $min;
  61. $nextver      = isset($HTTP_POST_VARS['nextver'])
  62.                 ? $HTTP_POST_VARS['nextver'] : '';
  63. $rows         = isset($HTTP_POST_VARS['rows'])
  64.                 ? $HTTP_POST_VARS['rows'] : '';
  65. $tzoff        = isset($HTTP_POST_VARS['tzoff'])
  66.                 ? $HTTP_POST_VARS['tzoff'] : '';
  67. $user         = isset($HTTP_POST_VARS['user'])
  68.                 ? $HTTP_POST_VARS['user'] : '';
  69. $referrer     = isset($HTTP_POST_VARS['referrer'])
  70.                 ? $HTTP_POST_VARS['referrer'] : '';
  71.  
  72. require('lib/init.php');
  73. require('parse/transforms.php');
  74.  
  75. // To add an action=x behavior, add an entry to this array.  First column
  76. //   is the file to load, second is the function to call, and third is how
  77. //   to treat it for rate-checking purposes ('view', 'edit', or 'search').
  78. $ActionList = array(
  79.                 'view' => array('action/view.php', 'action_view', 'view'),
  80.                 'edit' => array('action/edit.php', 'action_edit', 'view'),
  81.                 'save' => array('action/save.php', 'action_save', 'edit'),
  82.                 'diff' => array('action/diff.php', 'action_diff', 'search'),
  83.                 'find' => array('action/find.php', 'action_find', 'search'),
  84.                 'latex'   => array('action/latex.php', 'action_latex', 'view'),
  85.                 'history' => array('action/history.php', 'action_history',
  86.                                    'search'),
  87.                 'prefs'   => array('action/prefs.php', 'action_prefs', 'view'),
  88.                 'macro'   => array('action/macro.php', 'action_macro', 'search'),
  89.                 'rss'     => array('action/rss.php', 'action_rss', 'view'),
  90.                 'style'   => array('action/style.php', 'action_style', '')
  91.               );
  92.  
  93. // Default action and page names.
  94. if(!isset($page) && !isset($action))
  95.   { $page = $QUERY_STRING; }
  96. if(empty($action))
  97.   { $action = 'view'; }
  98. if(!isset($page) or $page=="")
  99.   { $page = $HomePage; }
  100.  
  101. // Confirm we have a valid page name.
  102. if(!validate_page($page))
  103.   { die(LIB_ErrorInvalidPage); }
  104.  
  105. // Don't let people do too many things too quickly.
  106. if($ActionList[$action][2] != '')
  107.   { rateCheck($pagestore->dbh, $ActionList[$action][2]); }
  108.  
  109. // Dispatch the appropriate action.
  110. if(!empty($ActionList[$action]))
  111. {
  112.   include($ActionList[$action][0]);
  113.   $ActionList[$action][1]();
  114. }
  115.  
  116. // Expire old versions, etc.
  117. $pagestore->maintain();
  118. ?>
  119.