]> git.mxchange.org Git - friendica.git/blob - mod/update_network.php
Merge pull request #6977 from annando/fix-reshare
[friendica.git] / mod / update_network.php
1 <?php
2 /**
3  * @file mod/update_network
4  * See update_profile.php for documentation
5  */
6
7 use Friendica\App;
8 use Friendica\Core\L10n;
9 use Friendica\Core\PConfig;
10
11 require_once "mod/network.php";
12
13 function update_network_content(App $a)
14 {
15         if (!isset($_GET['p']) || !isset($_GET['item'])) {
16                 exit();
17         }
18
19         $profile_uid = intval($_GET['p']);
20         $parent = intval($_GET['item']);
21
22         header("Content-type: text/html");
23         echo "<!DOCTYPE html><html><body>\r\n";
24         echo "<section>";
25
26         if (!PConfig::get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) {
27                 $text = network_content($a, $profile_uid, $parent);
28         } else {
29                 $text = "";
30         }
31
32         if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
33                 $replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
34                 $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
35                 $text = preg_replace($pattern, $replace, $text);
36                 $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
37                 $text = preg_replace($pattern, $replace, $text);
38                 $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
39                 $text = preg_replace($pattern, $replace, $text);
40                 $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
41                 $text = preg_replace($pattern, $replace, $text);
42         }
43
44         echo str_replace("\t", "       ", $text);
45         echo "</section>";
46         echo "</body></html>\r\n";
47         exit();
48 }