home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2007 April / PCpro_2007_04.ISO / files / dsl / NVinst.exe / Scripts / HTTP / 127.0.0.3 / ReloadCMS / common.php < prev    next >
Encoding:
PHP Script  |  2007-02-10  |  4.8 KB  |  102 lines

  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. //   Copyright (C) ReloadCMS Development Team                                 //
  4. //   http://reloadcms.sf.net                                                  //
  5. //                                                                            //
  6. //   This program is distributed in the hope that it will be useful,          //
  7. //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  8. //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  9. //                                                                            //
  10. //   This product released under GNU General Public License v2                //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. error_reporting(E_ALL);
  13.  
  14. // Unset any globals created by register_globals being turned ON
  15. while (list($global) = each($GLOBALS)){
  16.     if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST)$/', $global)){
  17.         unset($$global);
  18.     }
  19. }
  20. unset($global);
  21.  
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // Defining constants                                                         //
  24. ////////////////////////////////////////////////////////////////////////////////
  25. define('RCMS_VERSION_A', '1');
  26. define('RCMS_VERSION_B', '2');
  27. define('RCMS_VERSION_C', '5');
  28. if(is_file(RCMS_ROOT_PATH . '_nightly.txt')) define('RCMS_VERSION_SUFFIX', '-svn'); else define('RCMS_VERSION_SUFFIX', '');
  29. define('RCMS_LINK', 'http://reloadcms.com');
  30. define('RCMS_COPYRIGHT', '© 2004-2005 ReloadCMS Team');
  31. define('RCMS_POWERED', '<a href="' . RCMS_LINK . '">Powered by ReloadCMS</a>');
  32.  
  33. // Main paths
  34. define('SYSTEM_MODULES_PATH',RCMS_ROOT_PATH . 'modules/system/');
  35. define('ENGINE_PATH',        RCMS_ROOT_PATH . 'modules/engine/');
  36. define('MODULES_PATH',       RCMS_ROOT_PATH . 'modules/general/');
  37. define('MODULES_TPL_PATH',   RCMS_ROOT_PATH . 'modules/templates/');
  38. define('CONFIG_PATH',        RCMS_ROOT_PATH . 'config/');
  39. define('LANG_PATH',          RCMS_ROOT_PATH . 'languages/');
  40. define('ADMIN_PATH',         RCMS_ROOT_PATH . 'admin/');
  41. define('SKIN_PATH',          RCMS_ROOT_PATH . 'skins/');
  42. define('BACKUP_PATH',        RCMS_ROOT_PATH . 'backups/');
  43.  
  44. // Content paths
  45. define('DATA_PATH',     RCMS_ROOT_PATH . 'content/');
  46. define('DF_PATH',       DATA_PATH . 'datafiles/');
  47. define('USERS_PATH',    DATA_PATH . 'users/');
  48. define('FILES_PATH',    DATA_PATH . 'uploads/');
  49. define('GALLERY_PATH',  DATA_PATH . 'gallery/');
  50. define('FORUM_PATH',    DATA_PATH . 'forum/');
  51. define('LOGS_PATH',     DATA_PATH . 'logs/');
  52.  
  53. // Cookies
  54. define('FOREVER_COOKIE', time()+3600*24*365*5);
  55.  
  56. define('IGNORE_LOCK_FILES', false);
  57. define('SAFEMODE_HACK', false);
  58. define('SAFEMODE_HACK_FTP', 'ftp://username:password@localhost/path/to/reloadcms');
  59.  
  60. ////////////////////////////////////////////////////////////////////////////////
  61. // Loading modules                                                            //
  62. ////////////////////////////////////////////////////////////////////////////////
  63. include_once(SYSTEM_MODULES_PATH . 'load.php');
  64.  
  65. ////////////////////////////////////////////////////////////////////////////////
  66. // magic_quotes_gpc fix                                                       //
  67. ////////////////////////////////////////////////////////////////////////////////
  68. if(@get_magic_quotes_gpc()) unfck_gpc();
  69.  
  70. function unfck($v) {
  71.     return is_array($v) ? array_map('unfck', $v) : stripslashes($v);
  72. }
  73.  
  74. function unfck_gpc() {
  75.     foreach (array('POST', 'GET', 'REQUEST', 'COOKIE') as $gpc){
  76.         $GLOBALS['_' . $gpc] = array_map('unfck', $GLOBALS['_' . $gpc]);
  77.     }
  78. }
  79.  
  80. function rcms_showAdminMessage($mesg){
  81.     global $lang;
  82.     echo '<table border="0" cellspacing="2" cellpadding="2" class="input-form-table" width="100%"><tr class="input-form-tr"><td valign="middle" align="left" class="row1">' . $mesg . '</td></tr></table>';
  83. }
  84.  
  85. if(empty($_SERVER['REQUEST_URI'])) $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
  86. if(empty($_SERVER['REMOTE_ADDR'])) $_SERVER['REMOTE_ADDR'] = '0.0.0.0';
  87. if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
  88. if(empty($_SERVER['REMOTE_HOST'])) $_SERVER['REMOTE_HOST'] = $_SERVER['REMOTE_ADDR'];
  89. if(empty($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';
  90. if(empty($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = '';
  91.  
  92. ////////////////////////////////////////////////////////////////////////////////
  93. // Loading modules                                                            //
  94. ////////////////////////////////////////////////////////////////////////////////
  95. $em_dir = opendir(ENGINE_PATH);
  96. while ($em = readdir($em_dir)){
  97.     if(substr($em, 0, 1) != '.' && is_file(ENGINE_PATH . $em)){
  98.         include_once(ENGINE_PATH . $em);
  99.     }
  100. }
  101. closedir($em_dir);
  102. ?>