]> git.mxchange.org Git - friendica.git/blob - mod/update_community.php
Merge pull request #4167 from MrPetovan/bug/4155-remove-proxy-oembed
[friendica.git] / mod / update_community.php
1 <?php
2
3 // See update_profile.php for documentation
4
5 use Friendica\App;
6 use Friendica\Core\PConfig;
7
8 require_once("mod/community.php");
9
10 function update_community_content(App $a) {
11         header("Content-type: text/html");
12         echo "<!DOCTYPE html><html><body>\r\n";
13         echo "<section>";
14
15         if ($_GET["force"] == 1) {
16                 $text = community_content($a, true);
17         } else {
18                 $text = '';
19         }
20
21         $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
22         $replace = "<img\${1} dst=\"\${2}\"";
23         $text = preg_replace($pattern, $replace, $text);
24
25         if (PConfig::get(local_user(), "system", "bandwith_saver")) {
26                 $replace = "<br />".t("[Embedded content - reload page to view]")."<br />";
27                 $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
28                 $text = preg_replace($pattern, $replace, $text);
29                 $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
30                 $text = preg_replace($pattern, $replace, $text);
31                 $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
32                 $text = preg_replace($pattern, $replace, $text);
33                 $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
34                 $text = preg_replace($pattern, $replace, $text);
35         }
36
37         echo str_replace("\t", "       ", $text);
38         echo "</section>";
39         echo "</body></html>\r\n";
40         killme();
41 }