Changeset 17488 for extensions


Ignore:
Timestamp:
Aug 9, 2012, 2:12:23 PM (12 years ago)
Author:
mistic100
Message:

compatibility with Lightbox

Location:
extensions/gvideo
Files:
4 edited

Legend:

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

    r17432 r17488  
    4040      'comment' => pwg_db_real_escape_string($video['description']),
    4141      'author' => pwg_db_real_escape_string($video['author']),
     42      'is_gvideo' => 1,
    4243      );
    4344   
  • extensions/gvideo/include/functions.inc.php

    r17383 r17488  
    193193 
    194194  return $video;
     195}
     196
     197/**
     198 * test if a download method is available
     199 * @return: bool
     200 */
     201if (!function_exists('test_remote_download'))
     202{
     203  function test_remote_download()
     204  {
     205    return function_exists('curl_init') || ini_get('allow_url_fopen');
     206  }
    195207}
    196208
     
    224236     
    225237      curl_setopt($ch, CURLOPT_URL, $src);
    226       curl_setopt($ch, CURLOPT_HEADER, 0);
     238      curl_setopt($ch, CURLOPT_HEADER, false);
    227239      curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-language: en"));
    228240      curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
     
    243255      }
    244256     
    245       if (($out = curl_exec($ch)) === false)
     257      $out = curl_exec($ch);
     258      curl_close($ch);
     259     
     260      if ($out === false)
    246261      {
    247262        return 'file_error';
    248263      }
    249      
    250       curl_close($ch);
    251      
    252       if (!$return)
     264      else if (!$return)
    253265      {
    254266        fclose($newf);
  • extensions/gvideo/include/gvideo.inc.php

    r17383 r17488  
    77function gvideo_element_content($content, $element_info)
    88{
     9  if (!$element_info['is_gvideo'])
     10  {
     11    return $content;
     12  }
     13 
    914  global $page, $picture, $template, $conf;
     15 
     16  $conf['gvideo'] = unserialize($conf['gvideo']);
     17 
     18  remove_event_handler('render_element_content', 'default_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL);
    1019 
    1120  $query = '
     
    1423  WHERE picture_id = '.$element_info['id'].'
    1524;';
    16   $result = pwg_query($query);
     25  $video = pwg_db_fetch_assoc(pwg_query($query));
    1726 
    18   if (!pwg_db_num_rows($result))
    19   {
    20     return $content;
    21   }
    22  
    23   remove_event_handler('render_element_content', 'default_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL);
    24  
    25   $conf['gvideo'] = unserialize($conf['gvideo']);
    26  
    27   $video = pwg_db_fetch_assoc($result); 
    2827  if (empty($video['width']))
    2928  {
  • extensions/gvideo/maintain.inc.php

    r17423 r17488  
    5151  pwg_query($query);
    5252 
     53  pwg_query('ALTER TABLE `' . IMAGES_TABLE . '` ADD `is_gvideo` TINYINT(1) NOT NULL DEFAULT 0;');
     54 
    5355  if (isset($conf['PY_GVideo']))
    5456  {
     
    8082    {     
    8183      pwg_query('ALTER TABLE '.gvideo_table.' ADD `url` VARCHAR(255) DEFAULT NULL;');
     84    }
     85   
     86    $result = pwg_query('SHOW COLUMNS FROM '.IMAGES_TABLE.' LIKE "is_gvideo";');
     87    if (!pwg_db_num_rows($result))
     88    {     
     89      pwg_query('ALTER TABLE `' . IMAGES_TABLE . '` ADD `is_gvideo` TINYINT(1) NOT NULL DEFAULT 0;');
     90     
     91      $query = '
     92UPDATE '.IMAGES_TABLE.'
     93  SET is_gvideo = 1
     94  WHERE id IN(
     95    SELECT picture_id FROM '.gvideo_table.'
     96    )
     97;';
     98      pwg_query($query);
    8299    }
    83100  }
     
    89106  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "gvideo" LIMIT 1;');
    90107  pwg_query('DROP TABLE `'.gvideo_table.'`;');
     108  pwg_query('ALTER TABLE `' . IMAGES_TABLE . '` DROP `is_gvideo`;');
    91109}
    92110
Note: See TracChangeset for help on using the changeset viewer.