common.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.com //
  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. // Unset any globals created by register_globals being turned ON
  14. foreach ($GLOBALS as $key => $global) {
  15. if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST)$/', $key)) {
  16. unset($$key);
  17. }
  18. }
  19. unset($global);
  20. ////////////////////////////////////////////////////////////////////////////////
  21. // Defining constants //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. define('RCMS_VERSION_A', '1');
  24. define('RCMS_VERSION_B', '2');
  25. define('RCMS_VERSION_C', '22');
  26. if (!defined('RCMS_ROOT_PATH')) {
  27. die('Even though I walk through the darkest valley, I will fear no evil, for you are with me; your rod and your staff, they comfort me.'); //23:4
  28. }
  29. if (is_file(RCMS_ROOT_PATH . 'CURRENT')) {
  30. define('RCMS_VERSION_SUFFIX', '-git');
  31. } else {
  32. define('RCMS_VERSION_SUFFIX', '');
  33. }
  34. define('RCMS_COPYRIGHT', '&copy; ' . date("Y"));
  35. define('RCMS_POWERED', 'RCMS Framework');
  36. // Main paths
  37. define('SYSTEM_MODULES_PATH', RCMS_ROOT_PATH . 'modules/system/');
  38. define('ENGINE_PATH', RCMS_ROOT_PATH . 'modules/engine/');
  39. define('MODULES_PATH', RCMS_ROOT_PATH . 'modules/general/');
  40. define('REMOTEAPI_PATH', RCMS_ROOT_PATH . 'modules/remoteapi/');
  41. define('MODULES_TPL_PATH', RCMS_ROOT_PATH . 'modules/templates/');
  42. define('MODULES_DOWNLOADABLE', RCMS_ROOT_PATH . 'modules/foreign/');
  43. define('CONFIG_PATH', RCMS_ROOT_PATH . 'config/');
  44. define('LANG_PATH', RCMS_ROOT_PATH . 'languages/');
  45. define('ADMIN_PATH', RCMS_ROOT_PATH . 'admin/');
  46. define('SKIN_PATH', RCMS_ROOT_PATH . 'skins/');
  47. define('SMILES_PATH', SKIN_PATH . 'smiles/');
  48. define('BACKUP_PATH', RCMS_ROOT_PATH . 'backups/');
  49. // Content paths
  50. define('DATA_PATH', RCMS_ROOT_PATH . 'content/');
  51. define('RATE_PATH', DATA_PATH . 'rate/');
  52. define('DF_PATH', DATA_PATH . 'datafiles/');
  53. define('USERS_PATH', DATA_PATH . 'users/');
  54. define('FILES_PATH', DATA_PATH . 'uploads/');
  55. define('GALLERY_PATH', DATA_PATH . 'gallery/');
  56. define('FORUM_PATH', DATA_PATH . 'forum/');
  57. define('LOGS_PATH', DATA_PATH . 'logs/');
  58. define('IPACLALLOWIP_PATH', DATA_PATH . 'documents/ipacl/ip/');
  59. define('IPACLALLOWNETS_PATH', DATA_PATH . 'documents/ipacl/nets/');
  60. // Cookies
  61. define('FOREVER_COOKIE', time() + 3600 * 24 * 365 * 5);
  62. define('IGNORE_LOCK_FILES', false);
  63. ////////////////////////////////////////////////////////////////////////////////
  64. // Loading modules //
  65. ////////////////////////////////////////////////////////////////////////////////
  66. include_once(SYSTEM_MODULES_PATH . 'load.php');
  67. if (empty($_SERVER['REQUEST_URI']))
  68. $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
  69. if (empty($_SERVER['REMOTE_ADDR']))
  70. $_SERVER['REMOTE_ADDR'] = '0.0.0.0';
  71. if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
  72. $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
  73. if (empty($_SERVER['REMOTE_HOST']))
  74. $_SERVER['REMOTE_HOST'] = $_SERVER['REMOTE_ADDR'];
  75. if (empty($_SERVER['HTTP_REFERER']))
  76. $_SERVER['HTTP_REFERER'] = '';
  77. if (empty($_SERVER['HTTP_USER_AGENT']))
  78. $_SERVER['HTTP_USER_AGENT'] = '';
  79. ////////////////////////////////////////////////////////////////////////////////
  80. // Loading modules //
  81. ////////////////////////////////////////////////////////////////////////////////
  82. include("api/apiloader.php");
  83. $em_dir = opendir(ENGINE_PATH);
  84. while ($em = readdir($em_dir)) {
  85. if (substr($em, 0, 1) != '.' && is_file(ENGINE_PATH . $em)) {
  86. include_once(ENGINE_PATH . $em);
  87. }
  88. }
  89. closedir($em_dir);
  90. ?>