Index: /extensions/gvideo/include/functions.inc.php
===================================================================
--- /extensions/gvideo/include/functions.inc.php	(revision 26468)
+++ /extensions/gvideo/include/functions.inc.php	(revision 26469)
@@ -1,8 +1,8 @@
 <?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
 
 function parse_video_url($source_url, $safe_mode=false)
 {
-  $source_url = 'http://'.preg_replace('#^http(s?)://#', null, $source_url);
+  $source_url = 'http://'.preg_replace('#^http(s?)://#', null, trim($source_url));
   
   $url = parse_url($source_url);
@@ -38,4 +38,5 @@
       if (empty($video['video_id']))
       {
+        if ($url['host'][1] != 'be') return false;
         $url['path'] = explode('/', $url['path']);
         $video['video_id'] = $url['path'][1];
@@ -122,12 +123,21 @@
     case 'dailymotion':
     {
-      $video['type'] = 'dailymotion';
-      
       $url['path'] = explode('/', $url['path']);
       if ($url['path'][1] != 'video') return false;
       $video['video_id'] = $url['path'][2];
+    }
+    
+    case 'dai':  // dai.ly (short-url service)
+    {
+      $video['type'] = 'dailymotion';
+      
+      if (empty($video['video_id']))
+      {
+        if ($url['host'][1] != 'ly') return false;
+        $video['video_id'] = ltrim($url['path'], '/');
+      }
       
       $video['url'] = 'http://dailymotion.com/video/'.$video['video_id'];
-      $video['title'] = $video['video_id'];
+      $video['title'] = 'Dailymotion #'.$video['video_id'];
       
       if (!$safe_mode)
@@ -157,31 +167,32 @@
     case 'wat':
     {
-      if (!$safe_mode) return false; // no safe_mode for wat.tv, must connect to get the video id
+      if ($safe_mode) return false;
+      
+      $html = gvideo_download_remote_file($source_url, true);
+
+      if ($html===false || $html=='file_error') return false;
       
       $video['type'] = 'wat';
-      
-      $html = gvideo_download_remote_file($source_url, true);
-      
-      if ($html===false || $html=='file_error') return false;
-      
-      preg_match('#<meta property="og:video" content="http://www.wat.tv/swf2/([^"/>]+)" />#', $html, $matches);
+      $video['url'] = $source_url;
+      
+      preg_match('#<meta name="twitter:player" content="https://www.wat.tv/embedframe/([^">]+)">#', $html, $matches);
       if (empty($matches[1])) return false;
       $video['video_id'] = $matches[1];
-      
-      $video['url'] = $source_url;
-      
-      preg_match('#<meta name="name" content="([^">]*)" />#', $html, $matches);
+
+      preg_match('#<meta property="og:title" content="([^">]*)">#', $html, $matches);
       $video['title'] = $matches[1];
       
-      preg_match('#<p class="description"(?:[^>]*)>(.*?)</p>#s', $html, $matches);
+      preg_match('#<meta property="og:description" content="([^">]*)">#s', $html, $matches);
       $video['description'] = $matches[1];
       
-      preg_match('#<meta property="og:image" content="([^">]+)" />#', $html, $matches);
+      preg_match('#<meta property="og:image" content="([^">]+)">#', $html, $matches);
       $video['thumbnail'] = $matches[1];
       
-      $video['author'] = null;
-      
-      preg_match_all('#<meta property="video:tag" content="([^">]+)" />#', $html, $matches);
+      preg_match('#<meta property="video:director" content="http://www.wat.tv/([^">]+)">#', $html, $matches);
+      $video['author'] = $matches[1];
+      
+      preg_match_all('#<meta property="video:tag" content="([^">]+)">#', $html, $matches);
       $video['tags'] = implode(',',  $matches[1]);
+      
       break;
     }
@@ -196,5 +207,5 @@
       
       $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html';
-      $video['title'] = $video['video_id'];
+      $video['title'] = 'Wideo #'.$video['video_id'];
       
       if (!$safe_mode)
@@ -207,5 +218,5 @@
         $video['title'] = $matches[1];
         
-        preg_match('#<meta property="og:description" content="([^">]*)" />#', $html, $matches);
+        preg_match('#<meta property="og:description" content="([^">]*)" />#s', $html, $matches);
         $video['description'] = $matches[1];
         
@@ -222,5 +233,5 @@
       break;
     }
-      
+
     default:
       return false;   
@@ -267,5 +278,6 @@
   $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
   $thumb_source = $conf['data_location'].$thumb_name;
-  if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true )
+  
+  if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true)
   {
     $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
@@ -287,10 +299,10 @@
     );
     
-  if ( $config['sync_description'] and !empty($video['description']) )
+  if ($config['sync_description'] and !empty($video['description']))
   {
     $updates['comment'] = pwg_db_real_escape_string($video['description']);
   }
   
-  if ( $config['sync_tags'] and !empty($video['tags']) )
+  if ($config['sync_tags'] and !empty($video['tags']))
   {
     $tags = pwg_db_real_escape_string($video['tags']);
@@ -306,9 +318,9 @@
   
   // register video
-  if ( !preg_match('#^([0-9]*)$#', $config['width']) or !preg_match('#^([0-9]*)$#', $config['height']) )
+  if (!preg_match('#^([0-9]*)$#', $config['width']) or !preg_match('#^([0-9]*)$#', $config['height']))
   {
     $config['width'] = $config['height'] = '';
   }
-  if ( $config['autoplay']!='0' and $config['autoplay']!='1' )
+  if ($config['autoplay']!='0' and $config['autoplay']!='1')
   {
     $config['autoplay'] = '';
@@ -362,5 +374,5 @@
   $return = ($dest === true) ? true : false;
   
-  array_push($headers, 'Accept-language: en');
+  $headers[] = 'Accept-language: en';
   
   /* curl */
@@ -385,6 +397,6 @@
     if (strpos($src, 'https://') !== false)
     {
-      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
-      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     if (!$return)
@@ -394,5 +406,5 @@
     else
     {
-      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     }
     
@@ -454,5 +466,5 @@
  * and film frame to an image (need GD library)
  * @param: string source
- * @param: string destination (if null, the source si modified)
+ * @param: string destination (if null, the source is modified)
  * @return: void
  */
@@ -553,4 +565,2 @@
   }
 }
-
-?>
Index: /extensions/gvideo/template/video_dailymotion.tpl
===================================================================
--- /extensions/gvideo/template/video_dailymotion.tpl	(revision 26468)
+++ /extensions/gvideo/template/video_dailymotion.tpl	(revision 26469)
@@ -1,2 +1,2 @@
-<iframe src="http://www.dailymotion.com/embed/video/{$GVIDEO.video_id}?autoplay={$GVIDEO.autoplay}&amp;info={$GVIDEO.config.dailymotion.title}&amp;logo={$GVIDEO.config.dailymotion.logo}&amp;{$GVIDEO.config.dailymotion.color}" 
+<iframe src="http://www.dailymotion.com/embed/video/{$GVIDEO.video_id}?autoPlay={$GVIDEO.autoplay}&amp;info={$GVIDEO.config.dailymotion.title}&amp;logo={$GVIDEO.config.dailymotion.logo}&amp;{$GVIDEO.config.dailymotion.color}" 
   width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
Index: /extensions/gvideo/template/video_wideo.tpl
===================================================================
--- /extensions/gvideo/template/video_wideo.tpl	(revision 26468)
+++ /extensions/gvideo/template/video_wideo.tpl	(revision 26469)
@@ -9,4 +9,4 @@
   <video poster="http://api.kewego.com/video/getHTML5Thumbnail/?playerKey=0df9b773a15b&sig={$GVIDEO.video_id}" height="{$GVIDEO.width}" width="{$GVIDEO.height}" preload="none" controls="controls"></video>
   <script src="http://sa.kewego.com/embed/assets/kplayer-standalone.js"></script>
-  <script defer="defer">kitd.html5loader("flash_kplayer_{$GVIDEO.video_id}");</script>
+  <script defer="defer">kitd.html5loader("flash_kplayer_{$GVIDEO.video_id}","http://api.kewego.com/video/getHTML5Thumbnail/?playerKey=0df9b773a15b&sig={$GVIDEO.video_id}");</script>
 </object>
Index: /extensions/gvideo/template/video_youtube.tpl
===================================================================
--- /extensions/gvideo/template/video_youtube.tpl	(revision 26468)
+++ /extensions/gvideo/template/video_youtube.tpl	(revision 26469)
@@ -1,1 +1,1 @@
-<iframe src="http://www.youtube.com/embed/{$GVIDEO.video_id}?autoplay={$GVIDEO.autoplay}" width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
+<iframe src="http://www.youtube-nocookie.com/embed/{$GVIDEO.video_id}?autoplay={$GVIDEO.autoplay}" width="{$GVIDEO.width}" height="{$GVIDEO.height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
