Changeset 28268 for extensions/gvideo


Ignore:
Timestamp:
Apr 27, 2014, 1:30:00 AM (10 years ago)
Author:
mistic100
Message:

allow to add any video with direct embed code + add batch manager filter

Location:
extensions/gvideo
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/admin/add.php

    r26470 r28268  
    99{
    1010  $_POST['url'] = trim($_POST['url']);
    11   // check inputs
    12   if (empty($_POST['url']))
     11  $_POST['add_film_frame'] = isset($_POST['add_film_frame']);
     12 
     13  if ($_POST['mode'] == 'provider')
    1314  {
    14     $page['errors'][] = l10n('Please fill the video URL');
     15    // check inputs
     16    if (empty($_POST['url']))
     17    {
     18      $page['errors'][] = l10n('Please fill the video URL');
     19    }
     20    else if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
     21    {
     22      if (isset($_POST['safe_mode']))
     23      {
     24        $page['errors'][] = l10n('an error happened');
     25      }
     26      else
     27      {
     28        $page['errors'][] = l10n('Unable to contact host server');
     29        $page['errors'][] = l10n('Try in safe-mode');
     30      }
     31      $_POST['safe_mode'] = true;
     32    }
     33
     34    if (count($page['errors']) == 0)
     35    {
     36      if ($_POST['size_common'] == 'true')
     37      {
     38        $_POST['width'] = $_POST['height'] = '';
     39      }
     40      else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))
     41      {
     42        $page['errors'][] = l10n('Width and height must be integers');
     43        $_POST['width'] = $_POST['height'] = '';
     44      }
     45      if ($_POST['autoplay_common'] == 'true')
     46      {
     47        $_POST['autoplay'] = '';
     48      }
     49     
     50      $image_id = add_video($video, $_POST);
     51    }
    1552  }
    16   else if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
     53  else
    1754  {
    18     if (isset($_POST['safe_mode']))
     55    $_POST['embed_code'] = trim($_POST['embed_code']);
     56   
     57    if (empty($_POST['embed_code']))
    1958    {
    20       $page['errors'][] = l10n('an error happened');
     59      $page['errors'][] = l10n('Please fill the embed code');
    2160    }
    2261    else
    2362    {
    24       $page['errors'][] = l10n('Unable to contact host server');
    25       $page['errors'][] = l10n('Try in safe-mode');
     63      $image_id = add_video_embed($_POST);
    2664    }
    27     $_POST['safe_mode'] = true;
    2865  }
    29 
    30   if (count($page['errors']) == 0)
     66 
     67  if (isset($image_id))
    3168  {
    32     if ($_POST['size_common'] == 'true')
    33     {
    34       $_POST['width'] = $_POST['height'] = '';
    35     }
    36     else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))
    37     {
    38       $page['errors'][] = l10n('Width and height must be integers');
    39       $_POST['width'] = $_POST['height'] = '';
    40     }
    41     if ($_POST['autoplay_common'] == 'true')
    42     {
    43       $_POST['autoplay'] = '';
    44     }
    45     $_POST['add_film_frame'] = isset($_POST['add_film_frame']);
    46    
    47    
    48     $image_id = add_video($video, $_POST);
    49    
    50    
    5169    $query = '
    5270SELECT id, name, permalink
  • extensions/gvideo/admin/photo.php

    r26470 r28268  
    4545if (isset($_POST['save_properties']))
    4646{
    47   // check inputs
    48   if (empty($_POST['url']))
    49   {
    50     $page['errors'][] = l10n('Please fill the video URL');
    51   }
    52   else if ($gvideo['url']!=$_POST['url'])
    53   {
    54     if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
    55     {
    56       if (isset($_POST['safe_mode']))
    57       {
    58         $page['errors'][] = l10n('an error happened');
    59       }
    60       else
    61       {
    62         $page['errors'][] = l10n('Unable to contact host server');
    63         $page['errors'][] = l10n('Try in safe-mode');
    64       }
    65     }
    66   }
    67   else
    68   {
    69     $video = $gvideo;
    70   }
    71  
    72   if (count($page['errors']) == 0)
    73   {
    74 
    75     if ( $gvideo['url'] != $video['url'] )
    76     {
    77       // download thumbnail
    78       $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);
    79       $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
    80       $thumb_source = $conf['data_location'].$thumb_name;
     47  $_POST['url'] = trim($_POST['url']);
     48 
     49  if ($gvideo['type'] != 'embed')
     50  {
     51    // check inputs
     52    if (empty($_POST['url']))
     53    {
     54      $page['errors'][] = l10n('Please fill the video URL');
     55    }
     56    else if ($gvideo['url']!=$_POST['url'])
     57    {
     58      if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
     59      {
     60        if (isset($_POST['safe_mode']))
     61        {
     62          $page['errors'][] = l10n('an error happened');
     63        }
     64        else
     65        {
     66          $page['errors'][] = l10n('Unable to contact host server');
     67          $page['errors'][] = l10n('Try in safe-mode');
     68        }
     69      }
     70    }
     71    else
     72    {
     73      $video = $gvideo;
     74    }
     75   
     76    if (count($page['errors']) == 0)
     77    {
     78
     79      if ($gvideo['url'] != $video['url'])
     80      {
     81        // download thumbnail
     82        $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);
     83        $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
     84        $thumb_source = $conf['data_location'].$thumb_name;
     85       
     86        if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true)
     87        {
     88          $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
     89          copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
     90        }
     91       
     92        // add image and update infos
     93        $image_id = add_uploaded_file($thumb_source, $thumb_name, null, null, $_GET['image_id']);
     94       
     95        $updates = array(
     96          'name' => pwg_db_real_escape_string($video['title']),
     97          'author' => pwg_db_real_escape_string($video['author']),
     98          'is_gvideo' => 1,
     99          );
     100         
     101        if ($_POST['sync_description'] and !empty($video['description']))
     102        {
     103          $updates['comment'] = pwg_db_real_escape_string($video['description']);
     104        }
     105        else
     106        {
     107          $updates['comment'] = null;
     108        }
     109        if ($_POST['sync_tags'] and !empty($video['tags']))
     110        {
     111          set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
     112        }
     113       
     114        single_update(
     115          IMAGES_TABLE,
     116          $updates,
     117          array('id' => $_GET['image_id']),
     118          true
     119          );
     120      }
    81121     
    82       if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true)
    83       {
    84         $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
    85         copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
    86       }
    87      
    88       // add image and update infos
    89       $image_id = add_uploaded_file($thumb_source, $thumb_name, null, null, $_GET['image_id']);
     122      // register video
     123      if ($_POST['size_common'] == 'true')
     124      {
     125        $_POST['width'] = $_POST['height'] = '';
     126      }
     127      else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))
     128      {
     129        $page['errors'][] = l10n('Width and height must be integers');
     130        $_POST['width'] = $_POST['height'] = '';
     131      }
     132      if ($_POST['autoplay_common'] == 'true')
     133      {
     134        $_POST['autoplay'] = '';
     135      }
    90136     
    91137      $updates = array(
    92         'name' => pwg_db_real_escape_string($video['title']),
    93         'author' => pwg_db_real_escape_string($video['author']),
    94         'is_gvideo' => 1,
     138        'url' => $video['url'],
     139        'type' => $video['type'],
     140        'video_id' => $video['video_id'],
     141        'width' => $_POST['width'],
     142        'height' => $_POST['height'],
     143        'autoplay' => $_POST['autoplay'],
    95144        );
    96        
    97       if ($_POST['sync_description'] and !empty($video['description']))
    98       {
    99         $updates['comment'] = pwg_db_real_escape_string($video['description']);
    100       }
    101       else
    102       {
    103         $updates['comment'] = null;
    104       }
    105       if ($_POST['sync_tags'] and !empty($video['tags']))
    106       {
    107         set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
    108       }
    109      
    110       single_update(
    111         IMAGES_TABLE,
    112         $updates,
    113         array('id' => $_GET['image_id']),
    114         true
     145    }
     146  }
     147  else
     148  {
     149    $_POST['embed_code'] = trim($_POST['embed_code']);
     150   
     151    if (empty($_POST['embed_code']))
     152    {
     153      $page['errors'][] = l10n('Please fill the embed code');
     154    }
     155    else
     156    {
     157      $updates = array(
     158        'url' => $_POST['url'],
     159        'embed' => stripslashes($_POST['embed_code']),
    115160        );
    116161    }
    117    
    118     // register video
    119     if ($_POST['size_common'] == 'true')
    120     {
    121       $_POST['width'] = $_POST['height'] = '';
    122     }
    123     else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))
    124     {
    125       $page['errors'][] = l10n('Width and height must be integers');
    126       $_POST['width'] = $_POST['height'] = '';
    127     }
    128     if ($_POST['autoplay_common'] == 'true')
    129     {
    130       $_POST['autoplay'] = '';
    131     }
    132    
    133     $updates = array(
    134       'url' => $video['url'],
    135       'type' => $video['type'],
    136       'video_id' => $video['video_id'],
    137       'width' => $_POST['width'],
    138       'height' => $_POST['height'],
    139       'autoplay' => $_POST['autoplay'],
    140       );
    141      
     162  }
     163 
     164  if (isset($updates))
     165  {
    142166    single_update(
    143167      GVIDEO_TABLE,
  • extensions/gvideo/admin/template/add.tpl

    r26470 r28268  
    1717  $(".providersInfo").toggle();
    1818});
     19jQuery(".radio input").on('change', function() {
     20  if (jQuery(this).is(':checked')) {
     21    var mode = jQuery(this).val();
     22   
     23    jQuery('.'+mode+'-hide').hide();
     24    jQuery('.'+mode+'-show').show();
     25  }
     26}).trigger('change');
    1927{/footer_script}
    2028
     
    2432</div>
    2533
    26 <form method="post" action="" class="properties">
     34<form method="post" action="" class="properties" enctype="multipart/form-data">
     35  <div class="radio">
     36    <input type="radio" name="mode" value="provider" id="mode_provider" {if $POST.mode!="embed"}checked{/if}><label for="mode_provider">{'Add video from hosting platform'|translate}</label><!--
     37    --><input type="radio" name="mode" value="embed" id="mode_embed" {if $POST.mode=="embed"}checked{/if}><label for="mode_embed">{'Add video from embed code'|translate}</label>
     38  </div>
     39 
     40  <div class="warnings custom-warn embed-show provider-hide">
     41    <ul><li>{'Do not use this form for videos provided by Youtube, Dailymotion, Vimeo, Wat or Wideo.'|translate}</li></ul>
     42  </div>
     43
    2744<fieldset>
    2845  <legend>{'Properties'|translate}</legend>
     
    3855      {'... or '|translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|translate}">{'create a new album'|translate}</a>
    3956    </li>
     57    <li class="embed-show provider-hide">
     58      <label>
     59        <span class="property">{'Title'|translate}</span>
     60        <input type="text"name="title" value="{$POST.title}" style="width:400px;">
     61      </label>
     62    </li>
    4063    <li>
    4164      <label>
    42         <span class="property">{'Video URL'|translate}</span>
     65        <span class="property">{'Video URL'|translate} <small class="embed-show provider-hide">({'optional'|translate})</small></span>
    4366        <input type="text" name="url" value="{$POST.url}" style="width:400px;">
    4467      </label>
    4568    </li>
    46   {if $gd_available}
    47     <li>
    48       <span class="property">{'Thumbnail'|translate}</span>
     69    <li class="embed-show provider-hide">
     70      <label>
     71        <span class="property">{'Embed code'|translate}</span>
     72        <textarea name="embed_code" style="width:400px;height:80px;">{$POST.embed_code}</textarea>
     73      </label>
     74    </li>
     75    <li class="embed-show {if $gd_available}provider-show{else}provider-hide{/if}">
     76      <span class="property">{'Thumbnail'|translate} <small class="embed-show provider-hide">({'optional'|translate})</small></span>
     77      <input type="file" size="20" name="thumbnail_file" class="embed-show provider-hide">
     78    {if $gd_available}
    4979      <label><input type="checkbox" name="add_film_frame" value="true" {if $POST.add_film_frame}checked="checked"{/if}> {'Add film effect'|translate} </label>
    5080      <a class="icon-info-circled-1 showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>"></a>
     81    {/if}
    5182    </li>
    52   {/if}
    5383  </ul> 
    5484</fieldset>
    5585
    56 <fieldset>
     86<fieldset class="embed-hide provider-show">
    5787  <legend>{'Configuration'|translate}</legend>
    5888 
     
    94124<p style="text-align:left;">
    95125  <input type="submit" name="add_video" value="{'Add'|translate}">
    96   <label style="font-weight:bold;"><input type="checkbox" name="safe_mode" {if $POST.safe_mode}checked="checked"{/if}> {'Safe-mode'|translate}</label>
    97   <a class="icon-info-circled-1 showInfo" title="{'In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'|translate|escape:html}"></a>
     126 
     127  <span class="embed-hide provider-show">
     128    <label style="font-weight:bold;"><input type="checkbox" name="safe_mode" {if $POST.safe_mode}checked="checked"{/if}> {'Safe-mode'|translate}</label>
     129    <a class="icon-info-circled-1 showInfo" title="{'In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'|translate|escape:html}"></a>
     130  </span>
    98131</p>
    99132
    100 <fieldset style="margin-top:40px;">
     133<fieldset style="margin-top:40px;" class="embed-hide provider-show">
    101134  <legend>{'Supported services'|translate}</legend>
    102135 
  • extensions/gvideo/admin/template/photo.tpl

    r26470 r28268  
    11{combine_css path=$GVIDEO_PATH|cat:'admin/template/style.css'}
    22
     3{if $GVIDEO.type != 'embed'}
    34{footer_script}
    45jQuery("input[data-toggle]").change(function() {
     
    2425});
    2526{/footer_script}
     27{/if}
    2628
    2729
     
    6466    </p>
    6567   
     68    {if $GVIDEO.type != 'embed'}
    6669    <p class="video_update">
    6770      <b>{'Get video description'|translate}</b>
     
    97100      </span>
    98101    </p>
    99 
     102    {else}
     103    <p>
     104      <b>{'Embed code'|translate}</b><br>
     105      <textarea name="embed_code" style="width:400px;height:80px;">{$GVIDEO.embed}</textarea>
     106    </p>
     107    {/if}
     108   
    100109    <p style="margin:0;">
    101       <label style="font-weight:bold;"><input type="checkbox" name="safe_mode"> {'Safe-mode'|translate}</label>
    102       <br>
     110      {if $GVIDEO.type != 'embed'}<label style="font-weight:bold;"><input type="checkbox" name="safe_mode"> {'Safe-mode'|translate}</label>
     111      <br>{/if}
    103112      <input class="submit" type="submit" value="{'Save Settings'|translate}" name="save_properties">
    104113    </p>
  • extensions/gvideo/admin/template/style.css

    r26470 r28268  
    6464  font-size:0.9em;
    6565}
     66
     67.radio {
     68  margin-left:2em;
     69}
     70.radio input {
     71  display:none;
     72}
     73.radio label {
     74  display:inline-block;
     75  background:#fff;
     76  border:1px solid #ddd;
     77  border-left-width:0;
     78  padding:5px 10px;
     79}
     80  .radio label:first-of-type {
     81    border-left-width:1px;
     82    border-radius:5px 0 0 5px;
     83  }
     84  .radio label:last-of-type {
     85    border-radius:0 5px 5px 0;
     86  }
     87  .radio input:checked + label {
     88    background:#C6FF91;
     89    background:linear-gradient(to bottom, #C6FF91, #A5E06D);
     90    border-color:#A5E06D;
     91    text-shadow:1px 1px 0 white;
     92  }
     93
     94.custom-warn {
     95  background-image:none;
     96  padding:2px 5px;
     97  margin-left:2em;
     98  border-radius:5px;
     99  min-height:0;
     100  display:inline-block;
     101}
     102  .custom-warn ul li {
     103    clear:none;
     104    list-style:none;
     105    margin:0 !important;
     106  }
  • extensions/gvideo/include/events.inc.php

    r26524 r28268  
    2323      $template->assign(array(
    2424        'GVIDEO_PATH' => GVIDEO_PATH,
    25         'U_GVIDEO_EDIT' => GVIDEO_ADMIN.'-photo&amp;image_id='.$picture['current']['id'],
     25        'U_GVIDEO_EDIT' => get_root_url().GVIDEO_ADMIN.'-photo&amp;image_id='.$picture['current']['id'],
    2626        ));
    2727
     
    105105  }
    106106
    107   $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'template/video_'.$video['type'].'.tpl'));
    108   return $template->parse('gvideo_content', true);
     107  if ($video['type'] == 'embed')
     108  {
     109    return $video['embed'];
     110  }
     111  else
     112  {
     113    $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'template/video_'.$video['type'].'.tpl'));
     114    return $template->parse('gvideo_content', true);
     115  }
    109116}
    110117
     
    120127  pwg_query($query);
    121128}
     129
     130/**
     131 * add a prefilter to the Batch Downloader
     132 */
     133function gvideo_add_prefilter($prefilters)
     134{
     135        $prefilters[] = array(
     136    'ID' => 'gvideo',
     137    'NAME' => l10n('Videos'),
     138  );
     139 
     140        return $prefilters;
     141}
     142
     143/**
     144 * perform added prefilter
     145 */
     146function gvideo_apply_prefilter($filter_sets, $prefilter)
     147{
     148  if ($prefilter == 'gvideo')
     149  {
     150    $query = 'SELECT picture_id FROM '.GVIDEO_TABLE.';';
     151    $filter_sets[] = query2array($query, null, 'picture_id');
     152  }
     153 
     154        return $filter_sets;
     155}
  • extensions/gvideo/include/functions.inc.php

    r26469 r28268  
    346346
    347347/**
     348 * @params:
     349 *  $config :
     350 *    - url, string
     351 *    - category, integer
     352 *    - add_film_frame, boolean
     353 *    - title, string
     354 *    - embed_code, string
     355 */
     356function add_video_embed($config)
     357{
     358  global $page, $conf;
     359 
     360  $query = '
     361SELECT picture_id
     362  FROM '.GVIDEO_TABLE.'
     363  WHERE url = "'.$config['url'].'"
     364;';
     365  $result = pwg_query($query);
     366 
     367  if (pwg_db_num_rows($result))
     368  {
     369    $page['warnings'][] = l10n('This video was already registered');
     370    list($image_id) = pwg_db_fetch_row($result);
     371    return $image_id;
     372  }
     373 
     374  include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
     375 
     376  // upload thumbnail
     377  if (isset($_FILES['thumbnail_file']) && $_FILES['thumbnail_file']['error'] === UPLOAD_ERR_OK)
     378  {
     379    $source_filepath = $_FILES['thumbnail_file']['tmp_name'];
     380    list(,, $type) = getimagesize($source_filepath);
     381   
     382    if (IMAGETYPE_PNG == $type || IMAGETYPE_GIF == $type || IMAGETYPE_JPEG == $type)
     383    {
     384      $thumb_name = $_FILES['thumbnail_file']['name'];
     385      $thumb_source = $conf['data_location'].$thumb_name;
     386      move_uploaded_file($source_filepath, $thumb_source);
     387    }
     388  }
     389 
     390  if (!isset($thumb_source))
     391  {
     392    $thumb_name = 'embed-'.uniqid().'.jpg';
     393    $thumb_source = $conf['data_location'].$thumb_name;
     394    copy(GVIDEO_PATH.'mimetypes/any.jpg', $thumb_source);
     395  }
     396 
     397  if ($config['add_film_frame'])
     398  {
     399    add_film_frame($thumb_source);
     400  }
     401 
     402  // add image and update infos
     403  $image_id = add_uploaded_file($thumb_source, $thumb_name, array($config['category']));
     404 
     405  if (empty($config['title']))
     406  {
     407    $config['title'] = get_filename_wo_extension($thumb_name);
     408  }
     409 
     410  $updates = array(
     411    'name' => pwg_db_real_escape_string($config['title']),
     412    'is_gvideo' => 1,
     413    );
     414 
     415  single_update(
     416    IMAGES_TABLE,
     417    $updates,
     418    array('id' => $image_id),
     419    true
     420    );
     421
     422  $insert = array(
     423    'picture_id' => $image_id,
     424    'url' => $config['url'],
     425    'type' => 'embed',
     426    'video_id' => 'embed',
     427    'width' => '',
     428    'height' => '',
     429    'autoplay' => '',
     430    'embed' => $config['embed_code']
     431    );
     432  var_dump($insert);
     433  single_insert(
     434    GVIDEO_TABLE,
     435    $insert
     436    );
     437   
     438  return $image_id;
     439}
     440
     441/**
    348442 * test if a download method is available
    349443 * @return: bool
  • extensions/gvideo/language/en_UK/plugin.lang.php

    r20821 r28268  
    3535$lang['Videos can be private if you use the private permalink.'] = 'Videos can be private if you use the private permalink.';
    3636$lang['No privacy option.'] = 'No privacy option.';
     37$lang['Add video from embed code'] = 'Add video from embed code';
     38$lang['Add video from hosting platform'] = 'Add video from hosting platform';
     39$lang['Embed code'] = 'Embed code';
     40$lang['optional'] = 'optional';
     41$lang['Please fill the embed code'] = 'Please fill the embed code';
     42$lang['This video was already registered'] = 'This video was already registered';
     43$lang['Videos'] = 'Videos';
     44$lang['Width and height must be integers'] = 'Width and height must be integers';
     45$lang['Do not use this form for videos provided by Youtube, Dailymotion, Vimeo, Wat or Wideo.'] = 'Do not use this form for videos provided by Youtube, Dailymotion, Vimeo, Wat or Wideo.';
    3746
    3847?>
  • extensions/gvideo/language/fr_FR/plugin.lang.php

    r20809 r28268  
    3535$lang['Videos can be private if you use the private permalink.'] = 'Les videos peuvent être privées si vous utilisez le permalink privé.';
    3636$lang['No privacy option.'] = 'Pas d\'option de privacité.';
     37$lang['Add video from embed code'] = 'Ajouter un code d\'intégration';
     38$lang['Add video from hosting platform'] = 'Ajouter depuis une plateforme d\'hébergement';
     39$lang['Embed code'] = 'Code d\'intégration';
     40$lang['optional'] = 'optionel';
     41$lang['Please fill the embed code'] = 'Veuilles renseigner le code d\'intégration';
     42$lang['This video was already registered'] = 'Cette vidéo existe déjà';
     43$lang['Videos'] = 'Vidéos';
     44$lang['Width and height must be integers'] = 'Hauteur et largeur doivent être des entiers';
     45$lang['Do not use this form for videos provided by Youtube, Dailymotion, Vimeo, Wat or Wideo.'] = 'N\'utilisez pas ce formulaire pour les vidéos hébergées par Youtube, Dailymotion, Vimeo, Wat or Wideo.';
    3746
    3847?>
  • extensions/gvideo/main.inc.php

    r26524 r28268  
    2626{
    2727  add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
    28   add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2);
     28  add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2);
     29 
     30  add_event_handler('get_batch_manager_prefilters', 'gvideo_add_prefilter');
     31  add_event_handler('perform_batch_manager_prefilters', 'gvideo_apply_prefilter');
    2932}
    3033
     
    7679  if (!pwg_db_num_rows($result)) return $sheets;
    7780 
    78   global $gvideo;
     81  global $gvideo, $page;
     82
     83  if ($page['tab'] == 'properties')
     84  {
     85    $page['infos'][] = 'This element is a video added with "Embedded Video"';
     86  }
     87 
    7988  $gvideo = pwg_db_fetch_assoc($result);
    8089 
  • extensions/gvideo/maintain.inc.php

    r26470 r28268  
    7272  `width` smallint(9) DEFAULT NULL,
    7373  `height` smallint(9) DEFAULT NULL,
    74   `autoplay` tinyint(1) DEFAULT NULL
     74  `autoplay` tinyint(1) DEFAULT NULL,
     75  `embed` text DEFAULT NULL
    7576) ENGINE=MyISAM DEFAULT CHARSET=utf8
    7677;';
     
    7879   
    7980    // update video_id lenght
    80     $query = 'ALTER TABLE `' . $this->table . '` CHANGE `video_id` `video_id` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;';
    81     pwg_query($query);
     81    pwg_query('ALTER TABLE `' . $this->table . '` CHANGE `video_id` `video_id` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;');
    8282   
    8383    // new collumn in images table
     
    9595;';
    9696      pwg_query($query);
     97    }
     98   
     99    // new column "embed"
     100    $result = pwg_query('SHOW COLUMNS FROM `' . $this->table . '` LIKE "embed";');
     101    if (!pwg_db_num_rows($result))
     102    {
     103      pwg_query('ALTER TABLE `' . $this->table . '` ADD `embed` text DEFAULT NULL;');
    97104    }
    98105   
Note: See TracChangeset for help on using the changeset viewer.