Ignore:
Timestamp:
Nov 17, 2012, 5:05:32 PM (11 years ago)
Author:
mistic100
Message:

allow to add private dailymotion videos, remove videobb support, add tags support

Location:
extensions/gvideo/admin
Files:
1 deleted
7 edited

Legend:

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

    r17488 r19056  
    2020  {
    2121    // download thumbnail
    22     $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
     22    $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
    2323    $thumb_source = $conf['data_location'].$thumb_name;
    2424    if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
     
    3838    $updates = array(
    3939      'name' => pwg_db_real_escape_string($video['title']),
    40       'comment' => pwg_db_real_escape_string($video['description']),
    4140      'author' => pwg_db_real_escape_string($video['author']),
    4241      'is_gvideo' => 1,
    4342      );
     43     
     44    if ( $_POST['sync_description'] and !empty($video['description']) )
     45    {
     46      $updates['comment'] = pwg_db_real_escape_string($video['description']);
     47    }
     48    if ( $_POST['sync_tags'] and !empty($video['tags']) )
     49    {
     50      set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
     51    }
    4452   
    4553    single_update(
     
    5563      $_POST['width'] = $_POST['height'] = '';
    5664    }
     65    else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) )
     66    {
     67      array_push($page['errors'], l10n('Width and height must be integers'));
     68      $_POST['width'] = $_POST['height'] = '';
     69    }
    5770    if ($_POST['autoplay_common'] == 'true')
    5871    {
     
    6477      'url' => $video['url'],
    6578      'type' => $video['type'],
    66       'video_id' => $video['id'],
     79      'video_id' => $video['video_id'],
    6780      'width' => $_POST['width'],
    6881      'height' => $_POST['height'],
  • extensions/gvideo/admin/config.php

    r17307 r19056  
    55{
    66  $conf['gvideo'] = array(
    7     'autoplay' => $_POST['autoplay'],
    8     'width' => $_POST['width'],
    9     'height' => $_POST['height'],
     7    'autoplay' => (int)$_POST['autoplay'],
     8    'width' => (int)$_POST['width'],
     9    'height' => (int)$_POST['height'],
     10    'sync_description' => (int)$_POST['sync_description'],
     11    'sync_tags' => (int)$_POST['sync_tags'],
    1012    'vimeo' => array(
    1113      'title' => (int)isset($_POST['vimeo']['title']),
     
    2426    'videobb' => array(),
    2527    );
    26      
     28 
    2729  conf_update_param('gvideo', serialize($conf['gvideo']));
    2830  array_push($page['infos'], l10n('Information data registered in database'));
  • extensions/gvideo/admin/photo.php

    r17687 r19056  
    7070    array_push($page['errors'], l10n('Please fill the video URL'));
    7171  }
    72   if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'])) === false )
    73   {
    74     array_push($page['errors'], l10n('Unable to contact host server'));
     72  else if ($gvideo['url']!=$_POST['url'])
     73  {
     74    if( ($video = parse_video_url($_POST['url'])) === false )
     75    {
     76      array_push($page['errors'], l10n('Unable to contact host server'));
     77    }
     78  }
     79  else
     80  {
     81    $video = $gvideo;
    7582  }
    7683 
     
    8289    {
    8390      // download thumbnail
    84       $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
     91      $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
    8592      $thumb_source = $conf['data_location'].$thumb_name;
    8693      if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
     
    95102      $updates = array(
    96103        'name' => pwg_db_real_escape_string($video['title']),
    97         'comment' => pwg_db_real_escape_string($video['description']),
    98104        'author' => pwg_db_real_escape_string($video['author']),
    99105        'is_gvideo' => 1,
    100106        );
     107       
     108      if ( $_POST['sync_description'] and !empty($video['description']) )
     109      {
     110        $updates['comment'] = pwg_db_real_escape_string($video['description']);
     111      }
     112      else
     113      {
     114        $updates['comment'] = null;
     115      }
     116      if ( $_POST['sync_tags'] and !empty($video['tags']) )
     117      {
     118        set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
     119      }
    101120     
    102121      single_update(
     
    126145      'url' => $video['url'],
    127146      'type' => $video['type'],
    128       'video_id' => $video['id'],
     147      'video_id' => $video['video_id'],
    129148      'width' => $_POST['width'],
    130149      'height' => $_POST['height'],
     
    199218  $gvideo['autoplay_common'] = 'true';
    200219}
     220$gvideo['sync_description'] = $conf['gvideo']['sync_description'];
     221$gvideo['sync_tags'] = $conf['gvideo']['sync_tags'];
    201222
    202223if (function_exists('imagecreatetruecolor'))
  • extensions/gvideo/admin/template/add.tpl

    r17626 r19056  
    7474      <label><input type="radio" name="autoplay" value="1" {if $POST.autoplay == '1'}checked="checked"{/if}> {'Yes'|@translate}</label>
    7575    </li>
     76    <li>
     77      <span class="property">{'Get video description'|@translate}</span>
     78      <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label>
     79      <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|@translate}</label>
     80    </li>
     81    <li>
     82      <span class="property">{'Get video tags'|@translate}</span>
     83      <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label>
     84      <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|@translate}</label>
     85    </li>
    7686  </ul> 
    7787</fieldset>
     
    104114      <a href="http://www.wideo.fr" target="_blank">Wideo</a>
    105115    </li>
    106     <li>
    107       <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/videobb.png">
    108       <a href="http://www.videobb.com" target="_blank">videobb</a>
    109     </li>
    110116  </ul>
    111117</fieldset>
  • extensions/gvideo/admin/template/config.tpl

    r17307 r19056  
    1818  <ul>
    1919    <li>
    20       <label>
    21         <span class="property">{'Video size'|@translate}</span>
    22         <input type="text" name="width" value="{$gvideo.width}" size="4"> &times;
    23         <input type="text" name="height" value="{$gvideo.height}" size="4"> px
    24       </label>
     20      <span class="property">{'Video size'|@translate}</span>
     21      <input type="text" name="width" value="{$gvideo.width}" size="4"> &times;
     22      <input type="text" name="height" value="{$gvideo.height}" size="4"> px
    2523    </li>
    2624    <li>
    27       <label>
    28         <span class="property">{'Autoplay'|@translate}</span>
    29         <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'|@translate}</label>
    30         <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'|@translate}</label>
    31       </label>
     25      <span class="property">{'Autoplay'|@translate}</span>
     26      <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'|@translate}</label>
     27      <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'|@translate}</label>
     28    </li>
     29    <li>
     30      <span class="property">{'Get video description'|@translate}</span>
     31      <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label>
     32      <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|@translate}</label>
     33    </li>
     34    <li>
     35      <span class="property">{'Get video tags'|@translate}</span>
     36      <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label>
     37      <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|@translate}</label>
    3238    </li>
    3339  </ul>
     
    3541
    3642<div class="left"><fieldset>
    37   <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo'|@translate}</legend>
     43  <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo player'|@translate}</legend>
    3844 
    3945  <ul>
     
    4551    </li>
    4652    <li>
    47       <label>
    48         <span class="property">{'Display'|@translate}</span>
    49         <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'|@translate}</label>
    50         <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'|@translate}</label>
    51         <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'|@translate}</label>
    52       </label>
     53      <span class="property">{'Display'|@translate}</span>
     54      <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'|@translate}</label>
     55      <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'|@translate}</label>
     56      <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'|@translate}</label>
    5357    </li>
    5458  </ul>
     
    5660
    5761<div class="right"><fieldset>
    58   <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion'|@translate}</legend>
     62  <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion player'|@translate}</legend>
    5963 
    6064  <ul>
     
    6670    </li>
    6771    <li>
    68       <label>
    69         <span class="property">{'Display'|@translate}</span>
    70         <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'|@translate}</label>
    71         <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'|@translate}</label>
    72       </label>
     72      <span class="property">{'Display'|@translate}</span>
     73      <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'|@translate}</label>
     74      <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'|@translate}</label>
    7375    </li>
    7476  </ul>
  • extensions/gvideo/admin/template/photo.tpl

    r17687 r19056  
    1717  if ($(this).val() != "{$GVIDEO.url}") {ldelim}
    1818    $(this).css('border', '1px solid #c00');
    19     $("#change_warning").show();
     19    $(".video_update").show();
    2020  } else {ldelim}
    2121    $(this).css('border', border);
    22     $("#change_warning").hide();
     22    $(".video_update").hide();
    2323  }
    2424});
     
    6060      <b>{'Video URL'|@translate}</b>
    6161      <input type="text" name="url" value="{$GVIDEO.url}" style="width:400px;">
    62       <span id="change_warning" style="display:none;">{'Changing the url will reset video description, name and thumbnail'|@translate}</span>
     62      <span class="video_update warning" style="display:none;"> {'Changing the url will reset video description, name and thumbnail'|@translate}</span>
    6363    </p>
    64 
     64   
     65    <p class="video_update">
     66      <b>{'Get video description'|@translate}</b>
     67      <label><input type="radio" name="sync_description" value="1" {if $GVIDEO.sync_description}checked="checked"{/if}> {'Yes'|@translate}</label>
     68      <label><input type="radio" name="sync_description" value="0" {if not $GVIDEO.sync_description}checked="checked"{/if}> {'No'|@translate}</label>
     69    </p>
     70   
     71    <p class="video_update">
     72      <b>{'Get video tags'|@translate}</b>
     73      <label><input type="radio" name="sync_tags" value="1" {if $GVIDEO.sync_tags}checked="checked"{/if}> {'Yes'|@translate}</label>
     74      <label><input type="radio" name="sync_tags" value="0" {if not $GVIDEO.sync_tags}checked="checked"{/if}> {'No'|@translate}</label>
     75    </p>
     76   
    6577    <p>
    6678      <b>{'Video size'|@translate}</b>
  • extensions/gvideo/admin/template/style.css

    r17626 r19056  
    99
    1010FORM.properties SPAN.property {
    11   width:150px;
     11  width:180px;
    1212}
    1313
     
    5858}
    5959
    60 #change_warning {
     60.video_update {
     61  display:none;
     62}
     63.video_update.warning {
    6164  display:block;
    6265  color:#c00;
Note: See TracChangeset for help on using the changeset viewer.