index.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // Setup includes to work right. Much of this is duped in Config.inc, but gotta get this info to include it, so..
  3. $user_info = posix_getpwuid(posix_geteuid());
  4. $dir = ( $user_info['dir'] ? $user_info['dir'] : '/var/www/' );
  5. $basedir = ( file_exists( $dir . "/.tCMS_basedir") ? file_get_contents("$dir/.tCMS_basedir") : "$dir/.tCMS" );
  6. set_include_path(get_include_path() . PATH_SEPARATOR . "$basedir/lib");
  7. require_once "tCMS/Config.inc";
  8. // Get the config, set the theme (also set the basedir so we don't have to fetch it again).
  9. $conf_obj = new Config;
  10. $conf_obj->set_base_dir($basedir);
  11. $config = $conf_obj->get();
  12. $theme = ( !array_key_exists( 'theme', $config ) || empty($config['theme']) ? 'default' : $config['theme'] );
  13. $themedir = "$basedir/templates/$theme";
  14. if(empty($config)) {
  15. # XXX Need to have manual be hosted in repo under sys/admin/manual
  16. include( "$themedir/notconfigured.tmpl" );
  17. die();
  18. }
  19. $nav = ( !empty($_GET['nav'] ) ) ? $_GET['nav'] : '';
  20. $post = ( !empty($_GET['post'] ) ) ? $_GET['post'] : '';
  21. // Not sure if I'll ever really even need to localize (see html tag attrs).
  22. ?>
  23. <!doctype html>
  24. <html dir="ltr" lang="en-US">
  25. <?php include "$themedir/header.tmpl"; ?>
  26. <body>
  27. <div id="topkek">
  28. <?php
  29. //Site's Titlebar comes in here
  30. include "$themedir/nav.inc";
  31. ?>
  32. </div>
  33. <div id="littlemenu">
  34. </div>
  35. <div id="kontainer">
  36. <div id="leftbar" class="kontained">
  37. <?php include $config['leftbar']; ?>
  38. </div>
  39. <div id="kontent" class="kontained">
  40. <?php
  41. //XXX fileshare, etc. shouldn't be a config value. Home should refer to a template.
  42. $destinations = [
  43. $config['home'], $config['fileshare'], $config['microblog'], $config['blog'], $config['postloader'],
  44. $config['codeloader'], $config['audioloader'], $config['videoloader'], $config['imgloader'],
  45. $config['docloader']
  46. ];
  47. if ( empty($nav) ) $nav = 0;
  48. if ( $nav === 1 || $nav > 4 ) {
  49. $pwd = $post;
  50. include 'sys/fileshare/sanitize.inc';
  51. }
  52. //Main Content Display Frame goes below
  53. include $destinations[$nav];
  54. ?>
  55. </div>
  56. <div id="rightbar" class="kontained">
  57. <?php
  58. include $config['rightbar'];
  59. ?>
  60. </div>
  61. </div>
  62. <div id="footbar">
  63. <?php
  64. include $config['footbar'];
  65. ?>
  66. </div>
  67. </body>
  68. </html>