PageRenderTime 57ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/public_html/textpattern/index.php

https://github.com/dragontech/frisan
PHP | 115 lines | 72 code | 26 blank | 17 comment | 18 complexity | 52f753ebb51c1f7d5312485d9dbad7e4 MD5 | raw file
  1. <?php
  2. /*
  3. This is Textpattern
  4. Copyright 2005 by Dean Allen
  5. www.textpattern.com
  6. All rights reserved
  7. Use of this software indicates acceptance of the Textpattern license agreement
  8. $HeadURL: http://svn.textpattern.com/development/4.0/textpattern/index.php $
  9. $LastChangedRevision: 1172 $
  10. */
  11. if (@ini_get('register_globals'))
  12. foreach ( $_REQUEST as $name => $value )
  13. unset($$name);
  14. define("txpath", dirname(__FILE__));
  15. define("txpinterface", "admin");
  16. $thisversion = '4.0.3';
  17. $txp_using_svn = false; // set false for releases
  18. ob_start(NULL, 2048);
  19. if (!@include './config.php') {
  20. ob_end_clean();
  21. include txpath.'/setup/index.php';
  22. exit();
  23. } else ob_end_clean();
  24. header("Content-type: text/html; charset=utf-8");
  25. if (isset($_POST['preview'])) {
  26. include txpath.'/publish.php';
  27. textpattern();
  28. exit;
  29. }
  30. error_reporting(E_ALL);
  31. @ini_set("display_errors","1");
  32. include_once txpath.'/lib/constants.php';
  33. include txpath.'/lib/txplib_db.php';
  34. include txpath.'/lib/txplib_forms.php';
  35. include txpath.'/lib/txplib_html.php';
  36. include txpath.'/lib/txplib_misc.php';
  37. include txpath.'/lib/admin_config.php';
  38. $microstart = getmicrotime();
  39. if ($connected && safe_query("describe `".PFX."textpattern`")) {
  40. $dbversion = safe_field('val','txp_prefs',"name = 'version'");
  41. $prefs = get_prefs();
  42. extract($prefs);
  43. if (empty($siteurl))
  44. $siteurl = $_SERVER['HTTP_HOST'] . rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/');
  45. if (empty($path_to_site))
  46. updateSitePath(dirname(dirname(__FILE__)));
  47. define("LANG",$language);
  48. //i18n: define("LANG","en-gb");
  49. define('txp_version', $thisversion);
  50. define("hu",'http://'.$siteurl.'/');
  51. // v1.0 experimental relative url global
  52. define("rhu",preg_replace("/http:\/\/.+(\/.*)\/?$/U","$1",hu));
  53. if (!empty($locale)) setlocale(LC_ALL, $locale);
  54. $textarray = load_lang(LANG);
  55. include txpath.'/include/txp_auth.php';
  56. doAuth();
  57. $event = (gps('event') ? gps('event') : 'article');
  58. $step = gps('step');
  59. if (!$dbversion or ($dbversion != $thisversion) or $txp_using_svn)
  60. {
  61. define('TXP_UPDATE', 1);
  62. include txpath.'/update/_update.php';
  63. }
  64. if (!empty($admin_side_plugins) and gps('event') != 'plugin')
  65. load_plugins(1);
  66. include txpath.'/lib/txplib_head.php';
  67. // ugly hack, for the people that don't update their admin_config.php
  68. // Get rid of this when we completely remove admin_config and move privs to db
  69. if ($event == 'list')
  70. require_privs('article');
  71. else
  72. require_privs($event);
  73. callback_event($event, $step, 1);
  74. $inc = txpath . '/include/txp_'.$event.'.php';
  75. if (is_readable($inc))
  76. include($inc);
  77. callback_event($event, $step, 0);
  78. $microdiff = (getmicrotime() - $microstart);
  79. echo n.comment(gTxt('runtime').': '.substr($microdiff,0,6));
  80. end_page();
  81. } else {
  82. txp_die('DB-Connect was succesful, but the textpattern-table was not found.',
  83. '503 Service Unavailable');
  84. }
  85. ?>