Changeset 17687


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

big mistakes on photo properties page

Location:
extensions/gvideo/admin
Files:
2 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}
  • extensions/gvideo/admin/template/photo.tpl

    r17626 r17687  
    6868      <label><input type="radio" name="size_common" value="false" {if $GVIDEO.size_common != 'true'}checked="checked"{/if} data-toggle="size"> {'Change'|@translate}</label>
    6969     
    70       <span {if $GVIDEO.size_common == 'true'}style="display:none;"{/if} id="size">
     70      <span style="display:{if $GVIDEO.size_common == 'true'}none{else}block{/if};" id="size">
    7171        <input type="text" name="width" value="{$GVIDEO.width}" size="4"> &times;
    7272        <input type="text" name="height" value="{$GVIDEO.height}" size="4"> px
     
    7979      <label><input type="radio" name="autoplay_common" value="false" {if $GVIDEO.autoplay_common != 'true'}checked="checked"{/if} data-toggle="autoplay"> {'Change'|@translate}</label>
    8080     
    81       <span {if $GVIDEO.autoplay_common == 'true'}style="display:none;"{/if} id="autoplay">
     81      <span style="display:{if $GVIDEO.autoplay_common == 'true'}none{else}block{/if};" id="autoplay">
    8282        <label><input type="radio" name="autoplay" value="0" {if $GVIDEO.autoplay == '0'}checked="checked"{/if}> {'No'|@translate}</label>
    8383        <label><input type="radio" name="autoplay" value="1" {if $GVIDEO.autoplay == '1'}checked="checked"{/if}> {'Yes'|@translate}</label>
Note: See TracChangeset for help on using the changeset viewer.