scaffold.php 776 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Shibboleth;
  3. /**
  4. * Scaffold script. Generates the required database models for the Shibboleth
  5. * plugin.
  6. *
  7. * Will only run when the server is a test server.
  8. *
  9. * @license see /license.txt
  10. * @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
  11. */
  12. $dir = __DIR__;
  13. include_once $dir.'/../init.php';
  14. include_once $dir.'/../app/lib/scaffolder/scaffolder.class.php';
  15. if (!ShibbolethTest::is_enabled())
  16. {
  17. echo 'This is not a test server';
  18. die;
  19. }
  20. if (!Shibboleth::session()->is_logged_in())
  21. {
  22. echo 'Not authorized';
  23. die;
  24. }
  25. $name = 'user';
  26. $result = Scaffolder::instance()->scaffold($name);
  27. file_put_contents("$dir/output/$name.class.php", $result);
  28. header('content-type: text/plain');
  29. echo $result;