public.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
  3. get_include_path());
  4. /* remove ill effects of magic quotes */
  5. if (get_magic_quotes_gpc()) {
  6. function stripslashes_deep($value) {
  7. $value = is_array($value) ?
  8. array_map('stripslashes_deep', $value) : stripslashes($value);
  9. return $value;
  10. }
  11. $_POST = array_map('stripslashes_deep', $_POST);
  12. $_GET = array_map('stripslashes_deep', $_GET);
  13. $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
  14. $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
  15. }
  16. require_once "autoload.php";
  17. require_once "sessions.php";
  18. require_once "functions.php";
  19. require_once "sanity_check.php";
  20. require_once "config.php";
  21. require_once "db.php";
  22. require_once "db-prefs.php";
  23. startup_gettext();
  24. $script_started = microtime(true);
  25. if (!init_plugins()) return;
  26. if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
  27. ob_start("ob_gzhandler");
  28. }
  29. $method = $_REQUEST["op"];
  30. $override = PluginHost::getInstance()->lookup_handler("public", $method);
  31. if ($override) {
  32. $handler = $override;
  33. } else {
  34. $handler = new Handler_Public($_REQUEST);
  35. }
  36. if (implements_interface($handler, "IHandler") && $handler->before($method)) {
  37. if ($method && method_exists($handler, $method)) {
  38. $handler->$method();
  39. } else if (method_exists($handler, 'index')) {
  40. $handler->index();
  41. }
  42. $handler->after();
  43. return;
  44. }
  45. header("Content-Type: text/plain");
  46. print error_json(13);
  47. ?>