Index: /extensions/gvideo/admin.php
===================================================================
--- /extensions/gvideo/admin.php (revision 19055)
+++ /extensions/gvideo/admin.php (revision 19056)
@@ -4,5 +4,8 @@
global $template, $page, $conf;
-$conf['gvideo'] = unserialize($conf['gvideo']);
+if (is_string($conf['gvideo']))
+{
+ $conf['gvideo'] = unserialize($conf['gvideo']);
+}
$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'add';
Index: /extensions/gvideo/admin/add.php
===================================================================
--- /extensions/gvideo/admin/add.php (revision 19055)
+++ /extensions/gvideo/admin/add.php (revision 19056)
@@ -20,5 +20,5 @@
{
// download thumbnail
- $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
+ $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
$thumb_source = $conf['data_location'].$thumb_name;
if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
@@ -38,8 +38,16 @@
$updates = array(
'name' => pwg_db_real_escape_string($video['title']),
- 'comment' => pwg_db_real_escape_string($video['description']),
'author' => pwg_db_real_escape_string($video['author']),
'is_gvideo' => 1,
);
+
+ if ( $_POST['sync_description'] and !empty($video['description']) )
+ {
+ $updates['comment'] = pwg_db_real_escape_string($video['description']);
+ }
+ if ( $_POST['sync_tags'] and !empty($video['tags']) )
+ {
+ set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
+ }
single_update(
@@ -55,4 +63,9 @@
$_POST['width'] = $_POST['height'] = '';
}
+ else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) )
+ {
+ array_push($page['errors'], l10n('Width and height must be integers'));
+ $_POST['width'] = $_POST['height'] = '';
+ }
if ($_POST['autoplay_common'] == 'true')
{
@@ -64,5 +77,5 @@
'url' => $video['url'],
'type' => $video['type'],
- 'video_id' => $video['id'],
+ 'video_id' => $video['video_id'],
'width' => $_POST['width'],
'height' => $_POST['height'],
Index: /extensions/gvideo/admin/config.php
===================================================================
--- /extensions/gvideo/admin/config.php (revision 19055)
+++ /extensions/gvideo/admin/config.php (revision 19056)
@@ -5,7 +5,9 @@
{
$conf['gvideo'] = array(
- 'autoplay' => $_POST['autoplay'],
- 'width' => $_POST['width'],
- 'height' => $_POST['height'],
+ 'autoplay' => (int)$_POST['autoplay'],
+ 'width' => (int)$_POST['width'],
+ 'height' => (int)$_POST['height'],
+ 'sync_description' => (int)$_POST['sync_description'],
+ 'sync_tags' => (int)$_POST['sync_tags'],
'vimeo' => array(
'title' => (int)isset($_POST['vimeo']['title']),
@@ -24,5 +26,5 @@
'videobb' => array(),
);
-
+
conf_update_param('gvideo', serialize($conf['gvideo']));
array_push($page['infos'], l10n('Information data registered in database'));
Index: /extensions/gvideo/admin/photo.php
===================================================================
--- /extensions/gvideo/admin/photo.php (revision 19055)
+++ /extensions/gvideo/admin/photo.php (revision 19056)
@@ -70,7 +70,14 @@
array_push($page['errors'], l10n('Please fill the video URL'));
}
- if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'])) === false )
- {
- array_push($page['errors'], l10n('Unable to contact host server'));
+ else if ($gvideo['url']!=$_POST['url'])
+ {
+ if( ($video = parse_video_url($_POST['url'])) === false )
+ {
+ array_push($page['errors'], l10n('Unable to contact host server'));
+ }
+ }
+ else
+ {
+ $video = $gvideo;
}
@@ -82,5 +89,5 @@
{
// download thumbnail
- $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
+ $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
$thumb_source = $conf['data_location'].$thumb_name;
if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
@@ -95,8 +102,20 @@
$updates = array(
'name' => pwg_db_real_escape_string($video['title']),
- 'comment' => pwg_db_real_escape_string($video['description']),
'author' => pwg_db_real_escape_string($video['author']),
'is_gvideo' => 1,
);
+
+ if ( $_POST['sync_description'] and !empty($video['description']) )
+ {
+ $updates['comment'] = pwg_db_real_escape_string($video['description']);
+ }
+ else
+ {
+ $updates['comment'] = null;
+ }
+ if ( $_POST['sync_tags'] and !empty($video['tags']) )
+ {
+ set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
+ }
single_update(
@@ -126,5 +145,5 @@
'url' => $video['url'],
'type' => $video['type'],
- 'video_id' => $video['id'],
+ 'video_id' => $video['video_id'],
'width' => $_POST['width'],
'height' => $_POST['height'],
@@ -199,4 +218,6 @@
$gvideo['autoplay_common'] = 'true';
}
+$gvideo['sync_description'] = $conf['gvideo']['sync_description'];
+$gvideo['sync_tags'] = $conf['gvideo']['sync_tags'];
if (function_exists('imagecreatetruecolor'))
Index: /extensions/gvideo/admin/template/add.tpl
===================================================================
--- /extensions/gvideo/admin/template/add.tpl (revision 19055)
+++ /extensions/gvideo/admin/template/add.tpl (revision 19056)
@@ -74,4 +74,14 @@
+
+ {'Get video description'|@translate}
+
+
+
+
+ {'Get video tags'|@translate}
+
+
+
@@ -104,8 +114,4 @@
Wideo
-
-
- videobb
-
Index: /extensions/gvideo/admin/template/config.tpl
===================================================================
--- /extensions/gvideo/admin/template/config.tpl (revision 19055)
+++ /extensions/gvideo/admin/template/config.tpl (revision 19056)
@@ -18,16 +18,22 @@
@@ -35,5 +41,5 @@