You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

  1. <?php
  2. /**
  3. * @file infos.php
  4. * This file is part of MOVIM.
  5. *
  6. * @brief This PHP fiel create a light XML who sum up some information about the Movim pod
  7. *
  8. * @author edhelas <edhelas@movim.eu>
  9. *
  10. * @version 1.0
  11. * @date 26 march 2012
  12. *
  13. * Copyright (C)2010 MOVIM team
  14. *
  15. * See the file `COPYING' for licensing information.
  16. */
  17. // We load the Movim kernel
  18. define('DOCUMENT_ROOT', (dirname(__FILE__));
  19. require_once(DOCUMENT_ROOT.'/bootstrap.php');
  20. $bootstrap = new Bootstrap();
  21. $booted = $bootstrap->boot();
  22. // We get the informations
  23. $pop = 0;
  24. foreach(scandir(USERS_PATH) as $f)
  25. if(is_dir(USERS_PATH.'/'.$f))
  26. $pop++;
  27. $pop = $pop-2;
  28. // We create a simple DOMDocument
  29. $doc = new DOMDocument("1.0");
  30. $doc->formatOutput = true;
  31. $infos = $doc->createElement("infos");
  32. $doc->appendChild($infos);
  33. $language = $doc->createElement("language");
  34. $language->appendChild($doc->createTextNode($conf["defLang"]));
  35. $infos->appendChild($language);
  36. $population = $doc->createElement("population");
  37. $population->appendChild($doc->createTextNode($pop));
  38. $infos->appendChild($population);
  39. $whitelist = $doc->createElement("whitelist");
  40. $whitelist->appendChild($doc->createTextNode($conf["xmppWhiteList"]));
  41. $infos->appendChild($whitelist);
  42. $version = $doc->createElement("version");
  43. $version->appendChild($doc->createTextNode(APP_VERSION));
  44. $infos->appendChild($version);
  45. fclose($f);
  46. $phpversion = $doc->createElement("phpversion");
  47. $phpversion->appendChild($doc->createTextNode(phpversion()));
  48. $infos->appendChild($phpversion);
  49. $limit = $doc->createElement("userlimit");
  50. $limit->appendChild($doc->createTextNode($conf['maxUsers']));
  51. $infos->appendChild($limit);
  52. // And we dispatch it !
  53. ob_clean();
  54. ob_start();
  55. header("Content-type: text/plain");
  56. echo $doc->saveXML();