A tumblelog CMS built on AJAX, PHP and MySQL.

entry.php 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. ob_start();
  3. if (!defined('entry') || !entry) {
  4. die('Not a valid page');
  5. }
  6. error_reporting(E_ALL);
  7. ini_set('display_errors', '1');
  8. // PHP settings specific to Sorbet
  9. ini_set('pcre.backtrack_limit', '10000');
  10. define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);
  11. $installed = true;
  12. $configFile = Absolute_Path.'config.php';
  13. $dir = (strpos($_SERVER['REQUEST_URI'], '/admin')) ? "../" : "";
  14. if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php') {
  15. header("Location: {$dir}install.php");
  16. exit;
  17. } else {
  18. include_once(Absolute_Path.'classes/install.class.php');
  19. $install = new Install();
  20. if (!$install->is_sorbet_installed()) {
  21. if (basename($_SERVER['PHP_SELF'])!='install.php') {
  22. header("Location: {$dir}install.php");
  23. exit;
  24. }
  25. $installed = false;
  26. }
  27. }
  28. if ($installed) {
  29. require_once($configFile);
  30. }
  31. if (!extension_loaded('json')) {
  32. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'JSON.php');
  33. $GLOBALS['JSON_OBJECT'] = new Services_JSON();
  34. function json_encode($value)
  35. {
  36. return $GLOBALS['JSON_OBJECT']->encode($value);
  37. }
  38. function json_decode($value, $none)
  39. {
  40. return $GLOBALS['JSON_OBJECT']->decode($value);
  41. }
  42. }
  43. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'configuration.class.php');
  44. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'util.class.php');
  45. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'sorbet.class.php');
  46. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'templates.class.php');
  47. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'themes.class.php');
  48. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'pagination.class.php');
  49. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'user.class.php');
  50. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'comments.class.php');
  51. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'feeds.class.php');
  52. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'mysql_connection.class.php');
  53. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'streams.class.php');
  54. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
  55. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php');
  56. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'plugin.class.php');
  57. require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'plugins.class.php');
  58. if ($installed) {
  59. // Globals to be used throughout the application
  60. $db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  61. $conf = new configuration();
  62. $tumble = new sorbet();
  63. $user = new user();
  64. session_start();
  65. $util_init_plugins = new util();
  66. $util_init_plugins -> init_plugins();
  67. $plugin_instance = new plugin();
  68. $trigger =& $plugin_instance -> instance(); //DO NOT remove the & after the =
  69. $trigger->call('sorbet_init');
  70. $feeds = new feeds();
  71. $feeds->updateFeeds();
  72. unset($feeds);
  73. }