undo the disabling of browser_prefetch and for the time being revert the HTML cache until we can isolate all the zid and observer calls. Also get rid of youtube and vimeo bbcode tags which we should not be using any more.

This commit is contained in:
redmatrix 2015-06-25 20:07:10 -07:00
parent 70975dda4a
commit a3d7e8456a
9 changed files with 43 additions and 57 deletions

View File

@ -459,8 +459,6 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text);
}
// If we find any event code, turn it into an event.
// After we're finished processing the bbcode we'll
// replace all of the event code with a reformatted version.
@ -906,35 +904,35 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
}
// Youtube extensions
if (strpos($Text,'[youtube]') !== false) {
if ($tryoembed) {
$Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
}
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
// if (strpos($Text,'[youtube]') !== false) {
// if ($tryoembed) {
// $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
// $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
// $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
// }
// $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
// $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
// $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism", '[youtube]$1[/youtube]', $Text);
if ($tryoembed)
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', $Text);
else
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text);
}
if (strpos($Text,'[vimeo]') !== false) {
if ($tryoembed) {
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
}
// if ($tryoembed)
// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0"></iframe>', $Text);
// else
// $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text);
// }
// if (strpos($Text,'[vimeo]') !== false) {
// if ($tryoembed) {
// $Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
// $Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism", 'tryoembed', $Text);
// }
$Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
$Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
// $Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
// $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism", '[vimeo]$1[/vimeo]', $Text);
if ($tryoembed)
$Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
else
$Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "http://vimeo.com/$1", $Text);
}
// if ($tryoembed)
// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
// else
// $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "http://vimeo.com/$1", $Text);
// }
// oembed tag
$Text = oembed_bbcode2html($Text);
@ -984,15 +982,3 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
return $Text;
}
/**
* This function exists as a short-term solution to folks linking to private images from their /cloud in
* their profiles, which brings up a login dialogue in the directory when that entry is viewed.
* The long term solution is to separate the web file browser from DAV so that you'll never see a
* login prompt (though the resource may return a permission denied).
*/
function strip_bbimage($s) {
return preg_replace("/\[[zi]mg(.*?)\](.*?)\[\/[zi]mg\]/ism", '', $s);
}

View File

@ -1442,23 +1442,23 @@ function generate_named_map($location) {
function prepare_body(&$item,$attach = false) {
if($item['html']) {
$s = bb_observer($item['html']);
}
else {
// if($item['html']) {
// $s = bb_observer($item['html']);
// }
// else {
call_hooks('prepare_body_init', $item);
unobscure($item);
// unobscure($item);
$s = prepare_text($item['body'],$item['mimetype'], true);
}
// }
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body', $prep_arr);
$s = $prep_arr['html'];
q("update item set html = '%s' where id = %d",
dbesc($s),
intval($item['id'])
);
// q("update item set html = '%s' where id = %d",
// dbesc($s),
// intval($item['id'])
// );
if(! $attach) {
return $s;

View File

@ -244,7 +244,7 @@ function directory_content(&$a) {
$hometown = ((x($profile,'hometown') == 1) ? $profile['hometown'] : False);
$about = ((x($profile,'about') == 1) ? bbcode(strip_bbimage($profile['about'])) : False);
$about = ((x($profile,'about') == 1) ? bbcode($profile['about']) : False);
$keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');

View File

@ -37,7 +37,7 @@ function update_channel_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';

View File

@ -19,7 +19,7 @@ function update_display_content(&$a) {
$text = display_content($a,$profile_uid, $load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';

View File

@ -15,7 +15,7 @@ function update_home_content(&$a) {
$text = home_content($a,$profile_uid, $load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';

View File

@ -17,7 +17,7 @@ function update_network_content(&$a) {
$text = network_content($a,$profile_uid, $load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';

View File

@ -15,7 +15,7 @@ function update_public_content(&$a) {
$text = public_content($a,$profile_uid, $load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';

View File

@ -40,7 +40,7 @@ function update_search_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
// $text = preg_replace($pattern, $replace, $text);
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';