Changeset 17383 for extensions/gvideo/admin
- Timestamp:
- Aug 4, 2012, 4:15:54 PM (12 years ago)
- Location:
- extensions/gvideo/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/admin/add.php
r17310 r17383 12 12 array_push($page['errors'], l10n('Please fill the video URL')); 13 13 } 14 if ($_POST['name_server'] == 'false' and empty($_POST['name']))15 {16 array_push($page['errors'], l10n('Please fill the video name'));17 }18 if ($_POST['thumbnail_server'] == 'false' and empty($_FILES['thumbnail_src']))19 {20 array_push($page['errors'], l10n('Please add a thumbnail'));21 }22 14 if ( !empty($_POST['url']) and ($video = parse_video_url($_POST['url'])) === false ) 23 15 { … … 28 20 { 29 21 // download thumbnail 30 $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid(); 31 if ($_POST['thumbnail_server'] == 'true') 22 $thumb_name = $video['type'].'-'.$video['id'].'-'.uniqid().'.'.get_extension($video['thumbnail']); 23 $thumb_source = $conf['data_location'].$thumb_name; 24 if (download_remote_file($video['thumbnail'], $thumb_source) !== true) 32 25 { 33 $thumb_name.= '.'.get_extension($video['thumbnail']); 34 $thumb_source = $conf['data_location'].$thumb_name; 35 if (download_remote_file($video['thumbnail'], $thumb_source) !== true) 36 { 37 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg'; 38 copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source); 39 } 40 } 41 // upload thumbnail 42 else 43 { 44 if ($_FILES['thumbnail_src']['error'] > 0) 45 { 46 array_push($page['errors'], l10n('Unknown upload error')); 47 } 48 else if ( !in_array($_FILES['thumbnail_src']['type'], array('image/jpeg','image/png','image/gif')) ) 49 { 50 array_push($page['errors'], l10n('Incorrect file type,').' '.sprintf(l10n('Allowed file types: %s.'), 'jpg, png, gif')); 51 } 52 53 $thumb_name.= '.'.get_extension($_FILES['thumbnail_src']['name']); 54 $thumb_source = $_FILES['thumbnail_src']['tmp_name']; 26 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg'; 27 copy(GVIDEO_PATH.'mimetypes/'.$video['type'].'.jpg', $thumb_source); 55 28 } 56 29 57 if ( count($page['errors']) == 0)30 if (isset($_POST['add_film_frame'])) 58 31 { 59 if (isset($_POST['add_film_frame'])) 60 { 61 add_film_frame($thumb_source); 62 } 32 add_film_frame($thumb_source); 33 } 34 35 // add image and update infos 36 $image_id = add_uploaded_file($thumb_source, $thumb_name, array($_POST['category'])); 37 38 $updates = array( 39 'name' => pwg_db_real_escape_string($video['title']), 40 'comment' => pwg_db_real_escape_string($video['description']), 41 'author' => pwg_db_real_escape_string($video['author']), 42 ); 43 44 single_update( 45 IMAGES_TABLE, 46 $updates, 47 array('id' => $image_id), 48 true 49 ); 50 51 // register video 52 if ($_POST['size_common'] == 'true') 53 { 54 $_POST['width'] = $_POST['height'] = ''; 55 } 56 if ($_POST['autoplay_common'] == 'true') 57 { 58 $_POST['autoplay'] = ''; 59 } 60 61 $insert = array( 62 'picture_id' => $image_id, 63 'url' => $video['url'], 64 'type' => $video['type'], 65 'video_id' => $video['id'], 66 'width' => $_POST['width'], 67 'height' => $_POST['height'], 68 'autoplay' => $_POST['autoplay'], 69 ); 63 70 64 // add image and update infos 65 $image_id = add_uploaded_file($thumb_source, $thumb_name, array($_POST['category'])); 71 single_insert( 72 GVIDEO_TABLE, 73 $insert 74 ); 66 75 67 if ($_POST['name_server'] == 'true') $_POST['name'] = $video['title']; 68 if ($_POST['description_server'] == 'true') $_POST['description'] = $video['description']; 69 if ($_POST['author_server'] == 'true') $_POST['author'] = $video['author']; 70 71 $updates = array( 72 'name' => pwg_db_real_escape_string($_POST['name']), 73 'comment' => pwg_db_real_escape_string(@$_POST['description']), 74 'author' => pwg_db_real_escape_string(@$_POST['author']), 75 ); 76 77 single_update( 78 IMAGES_TABLE, 79 $updates, 80 array('id' => $image_id), 81 true 82 ); 83 84 // register video 85 if ($_POST['size_common'] == 'true') 86 { 87 $_POST['width'] = $_POST['height'] = ''; 88 } 89 if ($_POST['autoplay_common'] == 'true') 90 { 91 $_POST['autoplay'] = ''; 92 } 93 94 $insert = array( 95 'picture_id' => $image_id, 96 'type' => $video['type'], 97 'video_id' => $video['id'], 98 'width' => $_POST['width'], 99 'height' => $_POST['height'], 100 'autoplay' => $_POST['autoplay'], 101 ); 102 103 single_insert( 104 GVIDEO_TABLE, 105 $insert 106 ); 107 108 array_push($page['infos'], sprintf( 109 l10n('Video successfully added. <a href="%s">View</a>'), 110 make_picture_url(array( 111 'image_id' => $image_id, 112 'category' => array( 113 'id' => $_POST['category'], 114 'name' => '', 115 'permalink' => '', 116 ), 117 )) 118 )); 119 unset($_POST); 120 } 76 array_push($page['infos'], sprintf( 77 l10n('Video successfully added. <a href="%s">View</a>'), 78 make_picture_url(array( 79 'image_id' => $image_id, 80 'category' => array( 81 'id' => $_POST['category'], 82 'name' => '', 83 'permalink' => '', 84 ), 85 )) 86 )); 87 unset($_POST); 121 88 } 122 89 } … … 143 110 'upload_max_filesize' => $upload_max_filesize, 144 111 'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand, 112 'gd_available' => function_exists('imagecreatetruecolor'), 145 113 'gvideo' => $conf['gvideo'], 146 114 'POST' => @$_POST, -
extensions/gvideo/admin/template/add.tpl
r17310 r17383 37 37 </label> 38 38 </li> 39 <li> 40 <span class="property">{'Name'|@translate}</span> 41 <label><input type="radio" name="name_server" value="true" {if $POST.name_server != 'false'}checked="checked"{/if} data-toggle="name"> {'From the video'|@translate}</label> 42 <label><input type="radio" name="name_server" value="false" {if $POST.name_server == 'false'}checked="checked"{/if} data-toggle="name"> {'Change'|@translate}</label> 43 </li> 44 <li {if $POST.name_server != 'false'}style="display:none;"{/if} id="name"> 45 <span class="property"> </span> 46 <input type="text" name="name" value="{$POST.name}" size="70"> 47 </li> 48 <li> 49 <span class="property">{'Author'|@translate}</span> 50 <label><input type="radio" name="author_server" value="true" {if $POST.author_server != 'false'}checked="checked"{/if} data-toggle="author"> {'From the video'|@translate}</label> 51 <label><input type="radio" name="author_server" value="false" {if $POST.author_server == 'false'}checked="checked"{/if} data-toggle="author"> {'Change'|@translate}</label> 52 </li> 53 <li {if $POST.author_server != 'false'}style="display:none;"{/if} id="author"> 54 <span class="property"> </span> 55 <input type="text" name="author" value="{$POST.author}" size="20"> 56 </li> 57 <li> 58 <span class="property">{'Description'|@translate}</span> 59 <label><input type="radio" name="description_server" value="true" {if $POST.description_server != 'false'}checked="checked"{/if} data-toggle="description"> {'From the video'|@translate}</label> 60 <label><input type="radio" name="description_server" value="false" {if $POST.description_server == 'false'}checked="checked"{/if} data-toggle="description"> {'Change'|@translate}</label> 61 </li> 62 <li {if $POST.description_server != 'false'}style="display:none;"{/if} id="description"> 63 <span class="property"> </span> 64 <textarea name="description" rows="5" cols="50">{$POST.description}</textarea> 65 </li> 39 {if $gd_available} 66 40 <li> 67 41 <span class="property">{'Thumbnail'|@translate}</span> 68 <label><input type="radio" name="thumbnail_server" value="true" checked="checked" data-toggle="thumbnail_src"> {'From the video'|@translate}</label>69 <label><input type="radio" name="thumbnail_server" value="false" data-toggle="thumbnail_src"> {'Change'|@translate}</label>70 </li>71 <li id="thumbnail_src" style="display:none;">72 <span class="property"> </span>73 <input type="file" name="thumbnail_src"><br>74 <span class="property"> </span>75 {'Maximum file size: %sB.'|@translate|@sprintf:$upload_max_filesize_shorthand} {'Allowed file types: %s.'|@translate|@sprintf:'jpg, png, gif'}76 <input type="hidden" name="MAX_FILE_SIZE" value="{$upload_max_filesize}">77 </li>78 <li>79 <span class="property"> </span>80 42 <label><input type="checkbox" name="add_film_frame" value="true"> {'Add film effect'|@translate} </label> 81 43 <a class="showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>">i</a> 82 44 </li> 45 {/if} 83 46 </ul> 84 47 </fieldset> … … 117 80 <legend>{'Supported services'|@translate}</legend> 118 81 119 <ul >82 <ul class="services"> 120 83 <li> 121 84 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/youtube.png"> -
extensions/gvideo/admin/template/style.css
r17310 r17383 52 52 font-size:0.8em; 53 53 } 54 55 ul.services li { 56 display:inline; 57 margin-left:20px; 58 }
Note: See TracChangeset
for help on using the changeset viewer.