]> git.mxchange.org Git - friendica.git/blob - mod/update_contacts.php
Avoid beeing flooded by invalid requests
[friendica.git] / mod / update_contacts.php
1 <?php
2
3 // See update_profile.php for documentation
4
5 use Friendica\App;
6 use Friendica\Core\L10n;
7 use Friendica\Core\PConfig;
8
9 require_once 'mod/contacts.php';
10
11 function update_contacts_content(App $a)
12 {
13         header("Content-type: text/html");
14         echo "<!DOCTYPE html><html><body>\r\n";
15         echo "<section>";
16
17         if ($_GET["force"] == 1) {
18                 $text = contacts_content($a, true);
19         } else {
20                 $text = '';
21         }
22
23         if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
24                 $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
25                 $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
26                 $text = preg_replace($pattern, $replace, $text);
27                 $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
28                 $text = preg_replace($pattern, $replace, $text);
29                 $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
30                 $text = preg_replace($pattern, $replace, $text);
31                 $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
32                 $text = preg_replace($pattern, $replace, $text);
33         }
34
35         echo str_replace("\t", "       ", $text);
36         echo "</section>";
37         echo "</body></html>\r\n";
38         killme();
39 }