Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

50 líneas
1.6 KiB

  1. <?php
  2. /**
  3. * Module: update_profile
  4. * Purpose: AJAX synchronisation of profile page
  5. */
  6. use Friendica\App;
  7. use Friendica\Core\L10n;
  8. use Friendica\DI;
  9. use Friendica\Module\Profile;
  10. function update_profile_content(App $a) {
  11. $profile_uid = intval($_GET["p"]);
  12. header("Content-type: text/html");
  13. echo "<!DOCTYPE html><html><body>\r\n";
  14. // We can remove this hack once Internet Explorer recognises HTML5 natively
  15. echo "<section>";
  16. /**
  17. * Grab the page inner contents by calling the content function from the profile module directly,
  18. * but move any image src attributes to another attribute name. This is because
  19. * some browsers will prefetch all the images for the page even if we don't need them.
  20. * The only ones we need to fetch are those for new page additions, which we'll discover
  21. * on the client side and then swap the image back.
  22. */
  23. $text = Profile::content([], $profile_uid);
  24. if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
  25. $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
  26. $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
  27. $text = preg_replace($pattern, $replace, $text);
  28. $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
  29. $text = preg_replace($pattern, $replace, $text);
  30. $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
  31. $text = preg_replace($pattern, $replace, $text);
  32. $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
  33. $text = preg_replace($pattern, $replace, $text);
  34. }
  35. // reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
  36. echo str_replace("\t", " ", $text);
  37. echo "</section>";
  38. echo "</body></html>\r\n";
  39. exit();
  40. }