Ignore:
Timestamp:
Nov 28, 2012, 12:49:06 PM (11 years ago)
Author:
mistic100
Message:
  • add safe mode
  • fix little error when adding video without thumbnail
File:
1 edited

Legend:

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

    r19056 r19213  
    1212    array_push($page['errors'], l10n('Please fill the video URL'));
    1313  }
    14   if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'])) === false )
     14  if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )
    1515  {
    16     array_push($page['errors'], l10n('Unable to contact host server'));
     16    if (isset($_POST['safe_mode']))
     17    {
     18      array_push($page['errors'], l10n('an error happened'));
     19    }
     20    else
     21    {
     22      array_push($page['errors'], l10n('Unable to contact host server'));
     23      array_push($page['errors'], l10n('Try in safe-mode'));
     24    }
     25    $_POST['safe_mode'] = true;
    1726  }
    1827 
     
    2029  {
    2130    // download thumbnail
    22     $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
     31    $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);
     32    $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;
    2333    $thumb_source = $conf['data_location'].$thumb_name;
    24     if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
     34    if ( empty($video['thumbnail']) or download_remote_file($video['thumbnail'], $thumb_source) !== true )
    2535    {
    2636      $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
Note: See TracChangeset for help on using the changeset viewer.