Changeset 20804


Ignore:
Timestamp:
Feb 18, 2013, 12:20:10 PM (7 years ago)
Author:
mistic100
Message:
  • add support for semi-private Vimeo videos
  • escape tags
  • compatible with safe_mode=On
  • deactivate autosize
Location:
extensions/gvideo
Files:
8 edited

Legend:

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

    r19213 r20804  
    77if (isset($_POST['add_video']))
    88{
     9  $_POST['url'] = trim($_POST['url']);
    910  // check inputs
    1011  if (empty($_POST['url']))
     
    1213    array_push($page['errors'], l10n('Please fill the video URL'));
    1314  }
    14   if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
     15  else if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
    1516  {
    1617    if (isset($_POST['safe_mode']))
     
    2829  if (count($page['errors']) == 0)
    2930  {
    30     // download thumbnail
    31     $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);
    32     $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
    33     $thumb_source = $conf['data_location'].$thumb_name;
    34     if ( empty($video['thumbnail']) or download_remote_file($video['thumbnail'], $thumb_source) !== true )
    35     {
    36       $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
    37       copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
    38     }
    39    
    40     if (isset($_POST['add_film_frame']))
    41     {
    42       add_film_frame($thumb_source);
    43     }
    44    
    45     // add image and update infos
    46     $image_id = add_uploaded_file($thumb_source, $thumb_name, array($_POST['category']));
    47    
    48     $updates = array(
    49       'name' => pwg_db_real_escape_string($video['title']),
    50       'author' => pwg_db_real_escape_string($video['author']),
    51       'is_gvideo' => 1,
    52       );
    53      
    54     if ( $_POST['sync_description'] and !empty($video['description']) )
    55     {
    56       $updates['comment'] = pwg_db_real_escape_string($video['description']);
    57     }
    58     if ( $_POST['sync_tags'] and !empty($video['tags']) )
    59     {
    60       set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);
    61     }
    62    
    63     single_update(
    64       IMAGES_TABLE,
    65       $updates,
    66       array('id' => $image_id),
    67       true
    68       );
    69    
    70     // register video
    7131    if ($_POST['size_common'] == 'true')
    7232    {
     
    8242      $_POST['autoplay'] = '';
    8343    }
     44    $_POST['add_film_frame'] = isset($_POST['add_film_frame']);
    8445   
    85     $insert = array(
    86       'picture_id' => $image_id,
    87       'url' => $video['url'],
    88       'type' => $video['type'],
    89       'video_id' => $video['video_id'],
    90       'width' => $_POST['width'],
    91       'height' => $_POST['height'],
    92       'autoplay' => $_POST['autoplay'],
    93       );
    94      
    95     single_insert(
    96       GVIDEO_TABLE,
    97       $insert
    98       );
    99      
     46   
     47    $image_id = add_video($video, $_POST);
     48   
     49   
    10050    $query = '
    10151SELECT id, name, permalink
     
    13787  get_ini_size('post_max_filesize', false);
    13888 
     89if (!isset($_POST['safe_mode']))
     90{
     91  $_POST['safe_mode'] = !test_remote_download();
     92}
     93
    13994// template
    14095$template->assign(array(
  • extensions/gvideo/admin/photo.php

    r19213 r20804  
    100100      $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
    101101      $thumb_source = $conf['data_location'].$thumb_name;
    102       if ( empty($video['thumbnail']) or download_remote_file($video['thumbnail'], $thumb_source) !== true )
     102      if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true )
    103103      {
    104104        $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
  • extensions/gvideo/admin/template/add.tpl

    r19331 r20804  
    4343    <li>
    4444      <span class="property">{'Thumbnail'|@translate}</span>
    45       <label><input type="checkbox" name="add_film_frame" value="true"> {'Add film effect'|@translate} </label>
     45      <label><input type="checkbox" name="add_film_frame" value="true" {if $POST.add_film_frame}checked="checked"{/if}> {'Add film effect'|@translate} </label>
    4646      <a class="showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>">i</a>
    4747    </li>
  • extensions/gvideo/include/functions.inc.php

    r19213 r20804  
    2626    case 'youtube':
    2727    {
    28       $video['type'] = 'youtube';
    29 
    3028      parse_str($url['query'], $url['query']);
    3129      if (empty($url['query']['v'])) return false;
     
    3634    case 'youtu': // youtu.be (short-url service)
    3735    {
     36      $video['type'] = 'youtube';
     37     
    3838      if (empty($video['video_id']))
    3939      {
    40         $video['type'] = 'youtube';
    41        
    4240        $url['path'] = explode('/', $url['path']);
    4341        $video['video_id'] = $url['path'][1];
     
    4846      if (!$safe_mode)
    4947      {
    50         $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json';
    51         $json = download_remote_file($api_url, true);
    52         if ($json === false or $json == 'file_error') return false;
     48        $fields = 'entry(id,author,media:group(media:title(text()),media:description(text()),media:thumbnail(@url),media:keywords))';
     49        $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json&fields='.$fields;
     50        $json = gvideo_download_remote_file($api_url, true);
     51       
     52        if ($json===false || $json=='file_error') return false;
    5353       
    5454        $json = json_decode($json, true);
    5555        $video = array_merge($video, array(
    56           'title' => $json['entry']['title']['$t'],
     56          'title' => $json['entry']['media$group']['media$title']['$t'],
    5757          'description' => $json['entry']['media$group']['media$description']['$t'],
    58           'thumbnail' => $json['entry']['media$group']['media$thumbnail'][2]['url'],
     58          'thumbnail' => $json['entry']['media$group']['media$thumbnail'][0]['url'],
    5959          'author' => $json['entry']['author'][0]['name']['$t'],
    6060          ));
     61        if (!empty($json['entry']['media$group']['media$keywords']['$t']))
     62        {
     63          $video['tags'] = $json['entry']['media$group']['media$keywords']['$t'];
     64        }
    6165      }
    6266      else
     
    8084      if (!$safe_mode)
    8185      {
    82         $api_url = 'http://vimeo.com/api/v2/video/'.$video['video_id'].'.json';
    83         $json = download_remote_file($api_url, true);
    84         if ($json === false or $json == 'file_error') return false;
    85        
    86         $json = json_decode($json, true);
    87         $video = array_merge($video, array(
    88           'title' => $json[0]['title'],
    89           'description' => $json[0]['description'],
    90           'thumbnail' => $json[0]['thumbnail_large'],
    91           'author' => $json[0]['user_name'],
    92           'tags' => array_map('trim', explode(',', $json[0]['tags'])),
    93           ));
     86        // simple API for public videos
     87        $api_url_1 = 'http://vimeo.com/api/v2/video/'.$video['video_id'].'.json';
     88        $json = gvideo_download_remote_file($api_url_1, true);
     89       
     90        if ($json!==false && $json!='file_error' && trim($json)!=$video['video_id'].' not found.')
     91        {
     92          $json = json_decode($json, true);
     93          $video = array_merge($video, array(
     94            'title' => $json[0]['title'],
     95            'description' => $json[0]['description'],
     96            'thumbnail' => $json[0]['thumbnail_large'],
     97            'author' => $json[0]['user_name'],
     98            'tags' => $json[0]['tags'],
     99            ));
     100        }
     101        else
     102        {
     103          // oEmbed API, for private videos, doesn't return keywords
     104          $api_url_2 = 'http://vimeo.com/api/oembed.json?url='.rawurlencode($video['url']);
     105          $json = gvideo_download_remote_file($api_url_2, true);
     106         
     107          if ($json===false || $json=='file_error') return false;
     108         
     109          $json = json_decode($json, true);
     110          $video = array_merge($video, array(
     111            'title' => $json['title'],
     112            'description' => $json['description'],
     113            'thumbnail' => $json['thumbnail_url'],
     114            'author' => $json['author_name'],
     115            ));
     116        }
    94117      }
    95118      else
     
    115138      {
    116139        $api_url = 'https://api.dailymotion.com/video/'.$video['video_id'].'?fields=description,thumbnail_large_url,title,owner.username,tags'; // DM doesn't accept non secure connection
    117         $json = download_remote_file($api_url, true);
    118         if ($json === false or $json == 'file_error') return false;
     140        $json = gvideo_download_remote_file($api_url, true);
     141       
     142        if ($json===false || $json=='file_error') return false;
    119143       
    120144        $json = json_decode($json, true);
     
    126150          'thumbnail' => $json['thumbnail_large_url'],
    127151          'author' => $json['owner.username'],
    128           'tags' => $json['tags'],
     152          'tags' => implode(',', $json['tags']),
    129153          ));
    130154      }
     
    143167     
    144168      // no safe_mode for wat.tv
    145       $html = download_remote_file($source_url, true);
    146       if ($html === false or $html == 'file_error') return false;
     169      $html = gvideo_download_remote_file($source_url, true);
     170     
     171      if ($html===false || $html=='file_error') return false;
    147172     
    148173      preg_match('#<meta property="og:video" content="http://www.wat.tv/swf2/([^"/>]+)" />#', $html, $matches);
     
    164189     
    165190      preg_match_all('#<meta property="video:tag" content="([^">]+)" />#', $html, $matches);
    166       $video['tags'] = $matches[1];
     191      $video['tags'] = implode(',',  $matches[1]);
    167192      break;
    168193    }
     
    180205      if (!$safe_mode)
    181206      {
    182         $html = download_remote_file($source_url, true);
    183         if ($html === false or $html == 'file_error') return false;
     207        $html = gvideo_download_remote_file($source_url, true);
     208       
     209        if ($html===false || $html=='file_error') return false;
    184210       
    185211        preg_match('#<meta property="og:title" content="([^">]*)" />#', $html, $matches);
     
    196222       
    197223        preg_match('#<meta name="keywords" content="([^">]+)" />#', $html, $matches);
    198         $video['tags'] = array_map('trim', explode(',', $matches[1]));
     224        $video['tags'] = $matches[1];
    199225      }
    200226      else
     
    211237 
    212238  return $video;
     239}
     240
     241/**
     242 * @params:
     243 *  $video (from parse_video_url)
     244 *  $config :
     245 *    - category, integer
     246 *    - add_film_frame, boolean
     247 *    - sync_description, boolean
     248 *    - sync_tags, boolean
     249 *    - with, integer
     250 *    - height, integer
     251 *    - autoplay, integer (0-1)
     252 */
     253function add_video($video, $config)
     254{
     255  global $page, $conf;
     256 
     257  $query = '
     258SELECT picture_id
     259  FROM '.GVIDEO_TABLE.'
     260  WHERE type = "'.$video['type'].'"
     261    AND video_id = "'.$video['video_id'].'"
     262;';
     263  $result = pwg_query($query);
     264 
     265  if (pwg_db_num_rows($result))
     266  {
     267    $page['warnings'][] = l10n('This video was already registered');
     268    list($image_id) = pwg_db_fetch_row($result);
     269    return $image_id;
     270  }
     271 
     272  include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
     273 
     274  // download thumbnail
     275  $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);
     276  $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
     277  $thumb_source = $conf['data_location'].$thumb_name;
     278  if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true )
     279  {
     280    $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
     281    copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
     282  }
     283 
     284  if ($config['add_film_frame'])
     285  {
     286    add_film_frame($thumb_source);
     287  }
     288 
     289  // add image and update infos
     290  $image_id = add_uploaded_file($thumb_source, $thumb_name, array($config['category']));
     291 
     292  $updates = array(
     293    'name' => pwg_db_real_escape_string($video['title']),
     294    'author' => pwg_db_real_escape_string($video['author']),
     295    'is_gvideo' => 1,
     296    );
     297   
     298  if ( $config['sync_description'] and !empty($video['description']) )
     299  {
     300    $updates['comment'] = pwg_db_real_escape_string($video['description']);
     301  }
     302 
     303  if ( $config['sync_tags'] and !empty($video['tags']) )
     304  {
     305    $tags = pwg_db_real_escape_string($video['tags']);
     306    set_tags(get_tag_ids($tags), $image_id);
     307  }
     308 
     309  single_update(
     310    IMAGES_TABLE,
     311    $updates,
     312    array('id' => $image_id),
     313    true
     314    );
     315 
     316  // register video
     317  if ( !preg_match('#^([0-9]*)$#', $config['width']) or !preg_match('#^([0-9]*)$#', $config['height']) )
     318  {
     319    $config['width'] = $config['height'] = '';
     320  }
     321  if ( $config['autoplay']!='0' and $config['autoplay']!='1' )
     322  {
     323    $config['autoplay'] = '';
     324  }
     325 
     326  $insert = array(
     327    'picture_id' => $image_id,
     328    'url' => $video['url'],
     329    'type' => $video['type'],
     330    'video_id' => $video['video_id'],
     331    'width' => $config['width'],
     332    'height' => $config['height'],
     333    'autoplay' => $config['autoplay'],
     334    );
     335   
     336  single_insert(
     337    GVIDEO_TABLE,
     338    $insert
     339    );
     340   
     341  return $image_id;
    213342}
    214343
     
    233362 * @param: mixed destination file (if true, file content is returned)
    234363 */
    235 if (!function_exists('download_remote_file'))
     364function gvideo_download_remote_file($src, $dest, $headers=array())
    236365{
    237   function download_remote_file($src, $dest)
    238   {
    239     if (empty($src))
     366  if (empty($src))
     367  {
     368    return false;
     369  }
     370 
     371  $return = ($dest === true) ? true : false;
     372 
     373  array_push($headers, 'Accept-language: en');
     374 
     375  /* curl */
     376  if (function_exists('curl_init'))
     377  {
     378    if (!$return)
     379    {
     380      $newf = fopen($dest, "wb");
     381    }
     382    $ch = curl_init();
     383   
     384    curl_setopt($ch, CURLOPT_URL, $src);
     385    curl_setopt($ch, CURLOPT_HEADER, false);
     386    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     387    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
     388    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     389    if (!ini_get('safe_mode'))
     390    {
     391      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     392      curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
     393    }
     394    if (strpos($src, 'https://') !== false)
     395    {
     396      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     397      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     398    }
     399    if (!$return)
     400    {
     401      curl_setopt($ch, CURLOPT_FILE, $newf);
     402    }
     403    else
     404    {
     405      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     406    }
     407   
     408    $out = curl_exec($ch);
     409    curl_close($ch);
     410   
     411    if ($out === false)
     412    {
     413      return 'file_error';
     414    }
     415    else if (!$return)
     416    {
     417      fclose($newf);
     418      return true;
     419    }
     420    else
     421    {
     422      return $out;
     423    }
     424  }
     425  /* file get content */
     426  else if (ini_get('allow_url_fopen'))
     427  {
     428    if (strpos($src, 'https://') !== false and !extension_loaded('openssl'))
    240429    {
    241430      return false;
    242431    }
    243432   
    244     $return = ($dest === true) ? true : false;
    245    
    246     /* curl */
    247     if (function_exists('curl_init'))
    248     {
    249       if (!$return)
    250       {
    251         $newf = fopen($dest, "wb");
    252       }
    253       $ch = curl_init();
    254      
    255       curl_setopt($ch, CURLOPT_URL, $src);
    256       curl_setopt($ch, CURLOPT_HEADER, false);
    257       curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-language: en"));
    258       curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
    259       if (!ini_get('safe_mode'))
    260       {
    261         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    262         curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
    263       }
    264       if (strpos($src, 'https://') !== false)
    265       {
    266         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    267         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    268       }
    269       if (!$return)
    270       {
    271         curl_setopt($ch, CURLOPT_FILE, $newf);
    272       }
    273       else
    274       {
    275         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    276       }
    277      
    278       $out = curl_exec($ch);
    279       curl_close($ch);
    280      
    281       if ($out === false)
    282       {
    283         return 'file_error';
    284       }
    285       else if (!$return)
    286       {
    287         fclose($newf);
    288         return true;
    289       }
    290       else
    291       {
    292         return $out;
    293       }
    294     }
    295     /* file get content */
    296     else if (ini_get('allow_url_fopen'))
    297     {
    298       if (strpos($src, 'https://') !== false and !extension_loaded('openssl'))
    299       {
    300         return false;
    301       }
    302      
    303       $opts = array(
    304         'http' => array(
    305           'method' => "GET",
    306           'user_agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
    307           'header' => "Accept-language: en",
    308         )
    309       );
    310 
    311       $context = stream_context_create($opts);
    312      
    313       if (($file = file_get_contents($src, false, $context)) === false)
    314       {
    315         return 'file_error';
    316       }
    317      
    318       if (!$return)
    319       {
    320         file_put_contents($dest, $file);
    321         return true;
    322       }
    323       else
    324       {
    325         return $file;
    326       }
    327     }
    328    
    329     return false;
    330   }
     433    $opts = array(
     434      'http' => array(
     435        'method' => "GET",
     436        'user_agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
     437        'header' => implode("\r\n", $headers),
     438      )
     439    );
     440
     441    $context = stream_context_create($opts);
     442   
     443    if (($file = file_get_contents($src, false, $context)) === false)
     444    {
     445      return 'file_error';
     446    }
     447   
     448    if (!$return)
     449    {
     450      file_put_contents($dest, $file);
     451      return true;
     452    }
     453    else
     454    {
     455      return $file;
     456    }
     457  }
     458 
     459  return false;
    331460}
    332461
  • extensions/gvideo/include/gvideo.inc.php

    r19056 r20804  
    1313 
    1414    // remove autosize
    15     global $pwg_loaded_plugins, $autosize_controler;
     15    global $pwg_loaded_plugins, $autosize_ctrl;
    1616   
    17     if ( isset($pwg_loaded_plugins['Autosize']) and isset($autosize_controler) )
     17    if ( isset($pwg_loaded_plugins['Autosize']) and isset($autosize_ctrl) )
    1818    {
    19       remove_event_handler('render_element_content', array(&$autosize_controler, 'init'), EVENT_HANDLER_PRIORITY_NEUTRAL);
    20       remove_event_handler('render_element_content', array(&$autosize_controler, 'autosize_calcContent'), 40);
    21       remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_1'), EVENT_HANDLER_PRIORITY_NEUTRAL);
    22       remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_2'), EVENT_HANDLER_PRIORITY_NEUTRAL);
    23       remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_3'), EVENT_HANDLER_PRIORITY_NEUTRAL);
    24       remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21);
     19      remove_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'), EVENT_HANDLER_PRIORITY_NEUTRAL-11, 2);
     20      remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init_1'), EVENT_HANDLER_PRIORITY_NEUTRAL-9, 2);
     21      remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init'), EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2);
     22      remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init2'), EVENT_HANDLER_PRIORITY_NEUTRAL+1, 2);
     23      remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1'));
     24      remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2'));
     25      remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_3'));
     26      remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21);
    2527    }
    2628  }
     
    4648  }
    4749 
     50  // remove some actions
     51  $template->assign('U_SLIDESHOW_START', null);
     52  $template->assign('U_METADATA', null);
     53  $template->append('current', array('U_DOWNLOAD' => null), true);
    4854 
    4955  $query = '
     
    8894  }
    8995
    90   $template->set_filename('gvideo_content', dirname(__FILE__).'/../template/video_'.$video['type'].'.tpl');
     96  $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'template/video_'.$video['type'].'.tpl'));
    9197  return $template->parse('gvideo_content', true);
    9298}
  • extensions/gvideo/include/install.inc.php

    r19213 r20804  
    55
    66// defined here only because it's more convenient
    7 define('gvideo_path', PHPWG_PLUGINS_PATH . 'gvideo/');
     7define('gvideo_path', PHPWG_PLUGINS_PATH . GVIDEO_ID . '/');
    88define('gvideo_table', $prefixeTable.'image_video');
    99
     
    9393  }
    9494 
    95   // remove old configuration and upgrade video files
     95  // remove old configuration
    9696  if (isset($conf['PY_GVideo']))
    9797  {
    9898    pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "PY_GVideo" LIMIT 1;');
    9999    unset($conf['PY_GVideo']);
    100  
    101     gvideo_update_24();
    102   }
     100  }
     101 
     102  // updade video files
     103  gvideo_update_24();
    103104}
    104105
     
    216217    // update path and rename the file
    217218    $img['new_path'] = $real_path.$thumb_name;
    218     rename($img['path'], $img['new_path']);
     219    rename($img['path'], $img['new_path']); // why ? what's the purpose of this line ?
    219220    array_push($images_updates, array(
    220221      'id' => $img['id'],
     
    257258    );
    258259}
     260
     261?>
  • extensions/gvideo/main.inc.php

    r19056 r20804  
    33Plugin Name: Embedded Videos
    44Version: auto
    5 Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo, videobb and Wat.
     5Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo and Wat.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=136
    77Author: Mistic & P@t
     
    1313global $prefixeTable;
    1414
    15 define('GVIDEO_PATH',    PHPWG_PLUGINS_PATH . 'gvideo/');
    16 define('GVIDEO_ADMIN',   get_root_url() . 'admin.php?page=plugin-gvideo');
     15defined('GVIDEO_ID') or define('GVIDEO_ID', basename(dirname(__FILE__)));
     16define('GVIDEO_PATH',    PHPWG_PLUGINS_PATH . GVIDEO_ID . '/');
     17define('GVIDEO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . GVIDEO_ID);
    1718define('GVIDEO_TABLE',   $prefixeTable.'image_video');
    1819define('GVIDEO_VERSION', 'auto');
     
    4243  if (
    4344    GVIDEO_VERSION == 'auto' or
    44     $pwg_loaded_plugins['gvideo']['version'] == 'auto' or
    45     version_compare($pwg_loaded_plugins['gvideo']['version'], GVIDEO_VERSION, '<')
     45    $pwg_loaded_plugins[GVIDEO_ID]['version'] == 'auto' or
     46    version_compare($pwg_loaded_plugins[GVIDEO_ID]['version'], GVIDEO_VERSION, '<')
    4647  )
    4748  {
     
    4950    gvideo_install();
    5051   
    51     if ( $pwg_loaded_plugins['gvideo']['version'] != 'auto' and GVIDEO_VERSION !='auto' )
     52    if ( $pwg_loaded_plugins[GVIDEO_ID]['version'] != 'auto' and GVIDEO_VERSION !='auto' )
    5253    {
    5354      $query = '
    5455UPDATE '. PLUGINS_TABLE .'
    5556SET version = "'. GVIDEO_VERSION .'"
    56 WHERE id = "gvideo"';
     57WHERE id = "'. GVIDEO_ID .'"';
    5758      pwg_query($query);
    5859     
    59       $pwg_loaded_plugins['gvideo']['version'] = GVIDEO_VERSION;
     60      $pwg_loaded_plugins[GVIDEO_ID]['version'] = GVIDEO_VERSION;
    6061     
    6162      if (defined('IN_ADMIN'))
  • extensions/gvideo/maintain.inc.php

    r17661 r20804  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 include_once(PHPWG_PLUGINS_PATH . 'gvideo/include/install.inc.php');
     4defined('GVIDEO_ID') or define('GVIDEO_ID', basename(dirname(__FILE__)));
     5include_once(PHPWG_PLUGINS_PATH . GVIDEO_ID . '/include/install.inc.php');
     6
    57
    68/* install */
Note: See TracChangeset for help on using the changeset viewer.