Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

115 lines
2.6 KiB

  1. <?php
  2. require_once("boot.php");
  3. $a = new App;
  4. $debug_text = ''; // Debugging functions should never be used on production systems.
  5. // Setup the database.
  6. $install = ((file_exists('.htconfig.php')) ? false : true);
  7. @include(".htconfig.php");
  8. require_once("dba.php");
  9. $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
  10. unset($db_host, $db_user, $db_pass, $db_data);
  11. if(! $install)
  12. require_once("session.php");
  13. require_once("datetime.php");
  14. date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC');
  15. $a->init_pagehead();
  16. session_start();
  17. if((x($_SESSION,'authenticated')) || (x($_POST['auth-params'])))
  18. require("auth.php");
  19. if($install)
  20. $a->module = 'install';
  21. else
  22. check_config($a);
  23. if(strlen($a->module)) {
  24. if(file_exists("mod/{$a->module}.php")) {
  25. include("mod/{$a->module}.php");
  26. $a->module_loaded = true;
  27. }
  28. else {
  29. header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
  30. notice( t('Page not found.' ) . EOL);
  31. }
  32. }
  33. if($a->module_loaded) {
  34. $a->page['page_title'] = $a->module;
  35. if(function_exists($a->module . '_init')) {
  36. $func = $a->module . '_init';
  37. $func($a);
  38. }
  39. if(($_SERVER['REQUEST_METHOD'] == 'POST') && (! $a->error)
  40. && (function_exists($a->module . '_post'))
  41. && (! x($_POST,'auth-params'))) {
  42. $func = $a->module . '_post';
  43. $func($a);
  44. }
  45. if((! $a->error) && (function_exists($a->module . '_afterpost'))) {
  46. $func = $a->module . '_afterpost';
  47. $func($a);
  48. }
  49. if((! $a->error) && (function_exists($a->module . '_content'))) {
  50. $func = $a->module . '_content';
  51. $a->page['content'] .= $func($a);
  52. }
  53. }
  54. if(stristr($_SESSION['sysmsg'], t('Permission denied'))) {
  55. header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
  56. }
  57. // report anything important happening
  58. if(x($_SESSION,'sysmsg')) {
  59. $a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
  60. . $a->page['content'];
  61. unset($_SESSION['sysmsg']);
  62. }
  63. // Feel free to comment out this line on production sites.
  64. $a->page['content'] .= $debug_text;
  65. $a->page['content'] .= '<div id="pause"><img src="" alt="" /></div>';
  66. // build page
  67. // Navigation (menu) template
  68. if($a->module != 'install')
  69. require_once("nav.php");
  70. $a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array(
  71. '$stylesheet' => $a->get_baseurl() . '/view/theme/'
  72. . ((x($_SESSION,'theme')) ? $_SESSION['theme'] : 'default')
  73. . '/style.css'
  74. ));
  75. $page = $a->page;
  76. $profile = $a->profile;
  77. header("Content-type: text/html; charset=utf-8");
  78. $template = "view/"
  79. . ((x($a->page,'template')) ? $a->page['template'] : 'default' )
  80. . ".php";
  81. require_once($template);
  82. session_write_close();
  83. exit;