/themes/third_party/wygwam/lib/ckfinder/core/connector/php/connector.php

https://bitbucket.org/tdevonshire/guinness-jazz-festival · PHP · 104 lines · 31 code · 12 blank · 61 comment · 7 complexity · c100e891ece77252cfc9272e7a8c355c MD5 · raw file

  1. <?php
  2. /*
  3. * CKFinder
  4. * ========
  5. * http://ckfinder.com
  6. * Copyright (C) 2007-2012, CKSource - Frederico Knabben. All rights reserved.
  7. *
  8. * The software, this file and its contents are subject to the CKFinder
  9. * License. Please read the license.txt file before using, installing, copying,
  10. * modifying or distribute this file or part of its contents. The contents of
  11. * this file is part of the Source Code of CKFinder.
  12. */
  13. /**
  14. * Main heart of CKFinder - Connector
  15. *
  16. * @package CKFinder
  17. * @subpackage Connector
  18. * @copyright CKSource - Frederico Knabben
  19. */
  20. /**
  21. * Protect against sending warnings to the browser.
  22. * Comment out this line during debugging.
  23. */
  24. // error_reporting(0);
  25. /**
  26. * Protect against sending content before all HTTP headers are sent (#186).
  27. */
  28. ob_start();
  29. /**
  30. * define required constants
  31. */
  32. require_once "./constants.php";
  33. // @ob_end_clean();
  34. // header("Content-Encoding: none");
  35. /**
  36. * we need this class in each call
  37. */
  38. require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/CommandHandlerBase.php";
  39. /**
  40. * singleton factory
  41. */
  42. require_once CKFINDER_CONNECTOR_LIB_DIR . "/Core/Factory.php";
  43. /**
  44. * utils class
  45. */
  46. require_once CKFINDER_CONNECTOR_LIB_DIR . "/Utils/Misc.php";
  47. /**
  48. * hooks class
  49. */
  50. require_once CKFINDER_CONNECTOR_LIB_DIR . "/Core/Hooks.php";
  51. /**
  52. * Simple function required by config.php - discover the server side path
  53. * to the directory relative to the "$baseUrl" attribute
  54. *
  55. * @package CKFinder
  56. * @subpackage Connector
  57. * @param string $baseUrl
  58. * @return string
  59. */
  60. function resolveUrl($baseUrl) {
  61. $fileSystem =& CKFinder_Connector_Core_Factory::getInstance("Utils_FileSystem");
  62. return $fileSystem->getDocumentRootPath() . $baseUrl;
  63. }
  64. $utilsSecurity =& CKFinder_Connector_Core_Factory::getInstance("Utils_Security");
  65. $utilsSecurity->getRidOfMagicQuotes();
  66. /**
  67. * $config must be initialised
  68. */
  69. $config = array();
  70. $config['Hooks'] = array();
  71. $config['Plugins'] = array();
  72. /**
  73. * Fix cookies bug in Flash.
  74. */
  75. if (!empty($_GET['command']) && $_GET['command'] == 'FileUpload' && !empty($_POST)) {
  76. foreach ($_POST as $key => $val) {
  77. if (strpos($key, "ckfcookie_") === 0)
  78. $_COOKIE[str_replace("ckfcookie_", "", $key)] = $val;
  79. }
  80. }
  81. /**
  82. * read config file
  83. */
  84. require_once CKFINDER_CONNECTOR_CONFIG_FILE_PATH;
  85. CKFinder_Connector_Core_Factory::initFactory();
  86. $connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
  87. if(isset($_GET['command'])) {
  88. $connector->executeCommand($_GET['command']);
  89. }
  90. else {
  91. $connector->handleInvalidCommand();
  92. }