Ignore:
Timestamp:
Sep 2, 2012, 6:06:10 PM (12 years ago)
Author:
mistic100
Message:

big mistakes on photo properties page

File:
1 edited

Legend:

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

    r17626 r17687  
    2424if(!defined("PHPWG_ROOT_PATH")) die ("Hacking attempt!");
    2525
     26include_once(GVIDEO_PATH.'include/functions.inc.php');
     27
    2628
    2729// +-----------------------------------------------------------------------+
     
    7577  if (count($page['errors']) == 0)
    7678  {
    77     include_once(GVIDEO_PATH.'include/functions.inc.php');
    7879    include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    7980
    80     // download thumbnail
    81     $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
    82     $thumb_source = $conf['data_location'].$thumb_name;
    83     if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
    84     {
    85       $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
    86       copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
    87     }
    88    
    89     // add image and update infos
    90     $image_id = add_uploaded_file($thumb_source, $thumb_name, null, null, $_GET['image_id']);
    91    
    92     $updates = array(
    93       'name' => pwg_db_real_escape_string($video['title']),
    94       'comment' => pwg_db_real_escape_string($video['description']),
    95       'author' => pwg_db_real_escape_string($video['author']),
    96       'is_gvideo' => 1,
    97       );
    98    
    99     single_update(
    100       IMAGES_TABLE,
    101       $updates,
    102       array('id' => $_GET['image_id']),
    103       true
    104       );
     81    if ( $gvideo['url'] != $video['url'] )
     82    {
     83      // download thumbnail
     84      $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']);
     85      $thumb_source = $conf['data_location'].$thumb_name;
     86      if (download_remote_file($video['thumbnail'], $thumb_source) !== true)
     87      {
     88        $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';
     89        copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);
     90      }
     91     
     92      // add image and update infos
     93      $image_id = add_uploaded_file($thumb_source, $thumb_name, null, null, $_GET['image_id']);
     94     
     95      $updates = array(
     96        'name' => pwg_db_real_escape_string($video['title']),
     97        'comment' => pwg_db_real_escape_string($video['description']),
     98        'author' => pwg_db_real_escape_string($video['author']),
     99        'is_gvideo' => 1,
     100        );
     101     
     102      single_update(
     103        IMAGES_TABLE,
     104        $updates,
     105        array('id' => $_GET['image_id']),
     106        true
     107        );
     108    }
    105109   
    106110    // register video
    107111    if ($_POST['size_common'] == 'true')
    108112    {
     113      $_POST['width'] = $_POST['height'] = '';
     114    }
     115    else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) )
     116    {
     117      array_push($page['errors'], l10n('Width and height must be integers'));
    109118      $_POST['width'] = $_POST['height'] = '';
    110119    }
     
    131140     
    132141    array_push($page['infos'], l10n('Video successfully updated'));
    133     unset($_POST);
     142    $gvideo = array_merge($gvideo, $updates);
    134143  }
    135144}
Note: See TracChangeset for help on using the changeset viewer.