Changeset 20804 for extensions/gvideo/admin/add.php
- Timestamp:
- Feb 18, 2013, 12:20:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/admin/add.php
r19213 r20804 7 7 if (isset($_POST['add_video'])) 8 8 { 9 $_POST['url'] = trim($_POST['url']); 9 10 // check inputs 10 11 if (empty($_POST['url'])) … … 12 13 array_push($page['errors'], l10n('Please fill the video URL')); 13 14 } 14 if ( !empty($_POST['url']) and($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )15 else if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false ) 15 16 { 16 17 if (isset($_POST['safe_mode'])) … … 28 29 if (count($page['errors']) == 0) 29 30 { 30 // download thumbnail31 $thumb_ext = empty($video['thumbnail']) ? 'jpg' : get_extension($video['thumbnail']);32 $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext;33 $thumb_source = $conf['data_location'].$thumb_name;34 if ( empty($video['thumbnail']) or download_remote_file($video['thumbnail'], $thumb_source) !== true )35 {36 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg';37 copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source);38 }39 40 if (isset($_POST['add_film_frame']))41 {42 add_film_frame($thumb_source);43 }44 45 // add image and update infos46 $image_id = add_uploaded_file($thumb_source, $thumb_name, array($_POST['category']));47 48 $updates = array(49 'name' => pwg_db_real_escape_string($video['title']),50 'author' => pwg_db_real_escape_string($video['author']),51 'is_gvideo' => 1,52 );53 54 if ( $_POST['sync_description'] and !empty($video['description']) )55 {56 $updates['comment'] = pwg_db_real_escape_string($video['description']);57 }58 if ( $_POST['sync_tags'] and !empty($video['tags']) )59 {60 set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id);61 }62 63 single_update(64 IMAGES_TABLE,65 $updates,66 array('id' => $image_id),67 true68 );69 70 // register video71 31 if ($_POST['size_common'] == 'true') 72 32 { … … 82 42 $_POST['autoplay'] = ''; 83 43 } 44 $_POST['add_film_frame'] = isset($_POST['add_film_frame']); 84 45 85 $insert = array( 86 'picture_id' => $image_id, 87 'url' => $video['url'], 88 'type' => $video['type'], 89 'video_id' => $video['video_id'], 90 'width' => $_POST['width'], 91 'height' => $_POST['height'], 92 'autoplay' => $_POST['autoplay'], 93 ); 94 95 single_insert( 96 GVIDEO_TABLE, 97 $insert 98 ); 99 46 47 $image_id = add_video($video, $_POST); 48 49 100 50 $query = ' 101 51 SELECT id, name, permalink … … 137 87 get_ini_size('post_max_filesize', false); 138 88 89 if (!isset($_POST['safe_mode'])) 90 { 91 $_POST['safe_mode'] = !test_remote_download(); 92 } 93 139 94 // template 140 95 $template->assign(array(
Note: See TracChangeset
for help on using the changeset viewer.