]> git.mxchange.org Git - friendica.git/blob - mod/update_network.php
Merge from develop
[friendica.git] / mod / update_network.php
1 <?php
2
3 // See update_profile.php for documentation
4
5 require_once 'mod/network.php';
6 require_once 'include/group.php';
7
8 function update_network_content(&$a)
9 {
10     $profile_uid = intval($_GET['p']);
11
12     header('Content-type: text/html');
13     echo "<!DOCTYPE html><html><body>\r\n";
14     echo '<section>';
15
16     if (!get_pconfig($profile_uid, 'system', 'no_auto_update') or ($_GET['force'] == 1)) {
17         $text = network_content($a, $profile_uid);
18     } else {
19         $text = '';
20     }
21
22     $pattern = '/<img([^>]*) src="([^"]*)"/';
23     $replace = '<img${1} dst="${2}"';
24     $text = preg_replace($pattern, $replace, $text);
25
26     if (get_pconfig(local_user(), 'system', 'bandwith_saver')) {
27         $replace = '<br />'.t('[Embedded content - reload page to view]').'<br />';
28         $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
29         $text = preg_replace($pattern, $replace, $text);
30         $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
31         $text = preg_replace($pattern, $replace, $text);
32         $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
33         $text = preg_replace($pattern, $replace, $text);
34         $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
35         $text = preg_replace($pattern, $replace, $text);
36     }
37
38     // reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
39     echo str_replace("\t", '       ', $text);
40     echo '</section>';
41     echo "</body></html>\r\n";
42     killme();
43 }