picture.send.php 644 B

12345678910111213141516171819202122232425
  1. <?php
  2. include('../../../inc/includes.php');
  3. $provider = new PluginSinglesignonProvider();
  4. $path = false;
  5. if (isset($_GET['id'])) { // docid for document
  6. if (!$provider->getFromDB($_GET['id'])) {
  7. Html::displayErrorAndDie(__('Unknown file'), true);
  8. }
  9. $path = $provider->fields['picture'];
  10. } else if (isset($_GET['path'])) {
  11. $path = $_GET['path'];
  12. } else {
  13. Html::displayErrorAndDie(__('Invalid filename'), true);
  14. }
  15. $path = GLPI_PLUGIN_DOC_DIR . "/singlesignon/" . $path;
  16. if (!file_exists($path)) {
  17. Html::displayErrorAndDie(__('File not found'), true); // Not found
  18. }
  19. Toolbox::sendFile($path, "logo.png", null, true);