common.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. error_reporting(E_ALL);
  3. ob_start("ob_gzhandler");
  4. require_once ("config.php");
  5. if(!extension_loaded("soap"))
  6. die("Soap extension not loaded!");
  7. session_start();
  8. /** autoload functie voor PHP5 */
  9. function __autoload($classname) {
  10. $path = dirname(__file__);
  11. if(file_exists("$path/lib/data_objects/$classname.class.php")){
  12. include("$path/lib/data_objects/$classname.class.php");
  13. }elseif(file_exists("$path/lib/soap/$classname.class.php")){
  14. include("$path/lib/soap/$classname.class.php");
  15. }elseif(file_exists("$path/lib/$classname.class.php")){
  16. include("$path/lib/$classname.class.php");
  17. }
  18. }
  19. /** Schrijft de gegeven tekst naar de debug file */
  20. function debug($txt,$file="debug.txt"){
  21. $fp = fopen($file, "a");
  22. fwrite($fp, str_replace("\n","\r\n","\r\n".$txt));
  23. fclose($fp);
  24. }
  25. /** Schrijft het gegeven object weg in de debug log */
  26. function debugObject($txt,$obj){
  27. ob_start();
  28. print_r($obj);
  29. $data = ob_get_contents();
  30. ob_end_clean();
  31. debug($txt."\n".$data);
  32. }