1
Roby73
Bug /class/textsanitizer/youtube
  • 2015/8/14 6:31

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


I include in the news module an youtube video.
I had the problem in the code /class/textsanitizer/youtube/youtube.php
le="color: #000000"><?php static function decode($url, $width, $height) { if (!preg_match("/^http://(www.)?youtube.com/watch?v=(.*)/i", $url, $matches)) { trigger_error("Not matched: {$url} {$width} {$height}", E_USER_WARNING); return ""; } $src = "http://www.youtube.com/v/" . $matches[2];


I modified http to https for resolve.

2
zyspec
Re: Bug /class/textsanitizer/youtube
  • 2015/8/15 15:15

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Roby73,

Another thing that should be done to fix this is to change the preg_match so either http: or https: will work if passed as the $url variable into the function. Something like:

le="color: #000000"><?php static function decode($url, $width, $height) { if (!preg_match("/^http(s)?://(www.)?youtube.com/watch?v=(.*)/i", $url, $matches)) { trigger_error("Not matched: {$url} {$width} {$height}", E_USER_WARNING); return ""; } $src = "https://www.youtube.com/v/" . $matches[3];

3
Roby73
Re: Bug /class/textsanitizer/youtube
  • 2015/8/15 21:35

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


This is better .

4
Mamba
Re: Bug /class/textsanitizer/youtube
  • 2015/8/16 20:27

  • Mamba

  • Moderator

  • Posts: 11523

  • Since: 2004/4/23


The "https" issue has been already addressed in the upcoming XOOPS 2.5.8, but for the time being, please follow the code from Zyspec
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

5
Roby73
Re: Bug /class/textsanitizer/youtube
  • 2015/8/23 21:59

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


This patch does not work always.
In some server (new php version) the code of Zyspec give an error.
To resolve i change only http to https.

6
Mamba
Re: Bug /class/textsanitizer/youtube
  • 2015/8/24 10:01

  • Mamba

  • Moderator

  • Posts: 11523

  • Since: 2004/4/23


Try to use this:

Quote:
static function decode($url, $width, $height)
{
if (!preg_match("/^http[s]?:\/\/(www\.)?youtube\.com\/watch\?v=(.*)/i", $url, $matches)) {
trigger_error("Not matched: {$url} {$width} {$height}", E_USER_WARNING);

return "";
}
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

7
Roby73
Re: Bug /class/textsanitizer/youtube
  • 2015/8/24 20:56

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


Now work fine.
I tried to fix the regular expressions but i made a mistake.

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits