httpin_url_update_linker.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* Released under the GNU GPL 3.0
  3. * This script can be used in your scripts, but you must include this copyright header as per the GPL Licence
  4. * For more information about GPL 3.0 - see: http://www.gnu.org/copyleft/gpl.html
  5. * This script is part of the SLOODLE Project see http://sloodle.org
  6. *
  7. * sloodle/classroom/httpin_url_update_linker.php
  8. *
  9. * Copyright:
  10. * @contributers Paul G. Preibisch (Fire Centaur in SL)
  11. * @contributers Edmund Edgar
  12. *
  13. * When an object's http-in url changes on a sim restart or crossing, it lets us know here.
  14. *
  15. */
  16. /** Lets Sloodle know we are in a linker script. */
  17. define('SLOODLE_LINKER_SCRIPT', true);
  18. /** Grab the Sloodle/Moodle configuration. */
  19. require_once('../init.php');
  20. /** Include the Sloodle PHP API. */
  21. require_once(SLOODLE_LIBROOT.'/sloodle_session.php');
  22. require_once(SLOODLE_LIBROOT.'/general.php');
  23. require_once(SLOODLE_LIBROOT.'/active_object.php');
  24. // Attempt to authenticate the request
  25. // (only require authentication if controller ID and/or password is set)
  26. $sloodle = new SloodleSession();
  27. $request_auth = $sloodle->authenticate_request(true);
  28. $httpinurl = $sloodle->request->required_param('httpinurl');
  29. $objuuid = $sloodle->request->required_param('sloodleobjuuid');
  30. $ao = new SloodleActiveObject();
  31. if($ao->loadByUUID( $objuuid)) {
  32. $ao->httpinurl = $httpinurl;
  33. $ao->save();
  34. $sloodle->response->set_status_code(1);
  35. $sloodle->response->set_status_descriptor('OK');//httpin config sent properly
  36. } else {
  37. $sloodle->response->set_status_code(-217);//Could not save HTTP In URL for rezzed object
  38. $sloodle->response->set_status_descriptor('OBJECT_AUTH');
  39. $sloodle->response->add_data_line('Could not save HTTP In URL for rezzed object');
  40. }
  41. $sloodle->response->render_to_output();
  42. ?>