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

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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.