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
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: 1093

  • 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:

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: 11245

  • 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.10 | 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: 11245

  • 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.10 | 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

Username:
Password:

Lost Password? Register now!

Who's Online

50 user(s) are online (28 user(s) are browsing Support Forums)


Members: 0


Guests: 50


more...

Donat-O-Meter

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

Latest GitHub Commits