Changeset 26470
- Timestamp:
- Jan 6, 2014, 4:41:55 PM (10 years ago)
- Location:
- extensions/gvideo
- Files:
-
- 1 deleted
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/admin.php
r19056 r26470 1 1 <?php 2 if (!defined('GVIDEO_PATH'))die('Hacking attempt!');2 defined('GVIDEO_PATH') or die('Hacking attempt!'); 3 3 4 4 global $template, $page, $conf; 5 5 6 if (is_string($conf['gvideo']))7 {8 $conf['gvideo'] = unserialize($conf['gvideo']);9 }10 11 6 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'add'; 12 13 7 14 8 if ($page['tab'] != 'photo') … … 34 28 35 29 $template->assign_var_from_handle('ADMIN_CONTENT', 'gvideo_content'); 36 37 ?> -
extensions/gvideo/admin/add.php
r20804 r26470 1 1 <?php 2 if (!defined('GVIDEO_PATH'))die('Hacking attempt!');2 defined('GVIDEO_PATH') or die('Hacking attempt!'); 3 3 4 4 include_once(GVIDEO_PATH.'include/functions.inc.php'); 5 5 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'); 6 6 7 7 8 if (isset($_POST['add_video'])) … … 11 12 if (empty($_POST['url'])) 12 13 { 13 array_push($page['errors'], l10n('Please fill the video URL'));14 $page['errors'][] = l10n('Please fill the video URL'); 14 15 } 15 16 else if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false ) … … 17 18 if (isset($_POST['safe_mode'])) 18 19 { 19 array_push($page['errors'], l10n('an error happened'));20 $page['errors'][] = l10n('an error happened'); 20 21 } 21 22 else 22 23 { 23 array_push($page['errors'], l10n('Unable to contact host server'));24 array_push($page['errors'], l10n('Try in safe-mode'));24 $page['errors'][] = l10n('Unable to contact host server'); 25 $page['errors'][] = l10n('Try in safe-mode'); 25 26 } 26 27 $_POST['safe_mode'] = true; 27 28 } 28 29 29 30 if (count($page['errors']) == 0) 30 31 { … … 33 34 $_POST['width'] = $_POST['height'] = ''; 34 35 } 35 else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))36 else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height'])) 36 37 { 37 array_push($page['errors'], l10n('Width and height must be integers'));38 $page['errors'][] = l10n('Width and height must be integers'); 38 39 $_POST['width'] = $_POST['height'] = ''; 39 40 } … … 55 56 $category = pwg_db_fetch_assoc(pwg_query($query)); 56 57 57 array_push($page['infos'], sprintf(58 l10n('Video successfully added. <a href="%s">View</a>'),58 $page['infos'][] = l10n( 59 'Video successfully added. <a href="%s">View</a>', 59 60 make_picture_url(array( 60 61 'image_id' => $image_id, … … 65 66 ), 66 67 )) 67 ) );68 ); 68 69 unset($_POST); 69 70 } … … 72 73 // categories 73 74 $query = ' 74 SELECT id, name,uppercats,global_rank75 SELECT id, name, uppercats, global_rank 75 76 FROM '.CATEGORIES_TABLE.' 76 77 ;'; … … 101 102 )); 102 103 103 $template->set_filename('gvideo_content', dirname(__FILE__) . '/template/add.tpl'); 104 105 ?> 104 $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'admin/template/add.tpl')); -
extensions/gvideo/admin/config.php
r19056 r26470 1 1 <?php 2 if (!defined('GVIDEO_PATH'))die('Hacking attempt!');2 defined('GVIDEO_PATH') or die('Hacking attempt!'); 3 3 4 4 if (isset($_POST['save_config'])) … … 28 28 29 29 conf_update_param('gvideo', serialize($conf['gvideo'])); 30 array_push($page['infos'], l10n('Information data registered in database'));30 $page['infos'][] = l10n('Information data registered in database'); 31 31 } 32 32 … … 39 39 40 40 41 $template->set_filename('gvideo_content', dirname(__FILE__) . '/template/config.tpl'); 42 43 ?> 41 $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'admin/template/config.tpl')); -
extensions/gvideo/admin/photo.php
r20804 r26470 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based photo gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 12 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 22 // +-----------------------------------------------------------------------+ 23 24 if(!defined("PHPWG_ROOT_PATH")) die ("Hacking attempt!"); 2 defined('GVIDEO_PATH') or die ("Hacking attempt!"); 25 3 26 4 include_once(GVIDEO_PATH.'include/functions.inc.php'); 5 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'); 27 6 28 7 … … 30 9 // | Basic checks | 31 10 // +-----------------------------------------------------------------------+ 32 33 11 check_status(ACCESS_ADMINISTRATOR); 34 12 … … 47 25 $tabsheet->assign(); 48 26 27 $page['active_menu'] = get_active_menu('photo'); 28 49 29 // +-----------------------------------------------------------------------+ 50 30 // | Picture infos | 51 31 // +-----------------------------------------------------------------------+ 52 global $gvideo; 32 global $gvideo; // request from GVIDEO_TABLE done when building tabsheet 53 33 54 34 $query = ' … … 68 48 if (empty($_POST['url'])) 69 49 { 70 array_push($page['errors'], l10n('Please fill the video URL'));50 $page['errors'][] = l10n('Please fill the video URL'); 71 51 } 72 52 else if ($gvideo['url']!=$_POST['url']) 73 53 { 74 if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false )54 if ( ($video = parse_video_url($_POST['url'], isset($_POST['safe_mode']))) === false ) 75 55 { 76 56 if (isset($_POST['safe_mode'])) 77 57 { 78 array_push($page['errors'], l10n('an error happened'));58 $page['errors'][] = l10n('an error happened'); 79 59 } 80 60 else 81 61 { 82 array_push($page['errors'], l10n('Unable to contact host server'));83 array_push($page['errors'], l10n('Try in safe-mode'));62 $page['errors'][] = l10n('Unable to contact host server'); 63 $page['errors'][] = l10n('Try in safe-mode'); 84 64 } 85 65 } … … 92 72 if (count($page['errors']) == 0) 93 73 { 94 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');95 74 96 75 if ( $gvideo['url'] != $video['url'] ) … … 100 79 $thumb_name = $video['type'].'-'.$video['video_id'].'-'.uniqid().'.'.$thumb_ext; 101 80 $thumb_source = $conf['data_location'].$thumb_name; 102 if ( empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true ) 81 82 if (empty($video['thumbnail']) or gvideo_download_remote_file($video['thumbnail'], $thumb_source) !== true) 103 83 { 104 84 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg'; … … 115 95 ); 116 96 117 if ( $_POST['sync_description'] and !empty($video['description']))97 if ($_POST['sync_description'] and !empty($video['description'])) 118 98 { 119 99 $updates['comment'] = pwg_db_real_escape_string($video['description']); … … 123 103 $updates['comment'] = null; 124 104 } 125 if ( $_POST['sync_tags'] and !empty($video['tags']))105 if ($_POST['sync_tags'] and !empty($video['tags'])) 126 106 { 127 107 set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id); … … 141 121 $_POST['width'] = $_POST['height'] = ''; 142 122 } 143 else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']))144 { 145 array_push($page['errors'], l10n('Width and height must be integers'));123 else if (!preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height'])) 124 { 125 $page['errors'][] = l10n('Width and height must be integers'); 146 126 $_POST['width'] = $_POST['height'] = ''; 147 127 } … … 167 147 ); 168 148 169 array_push($page['infos'], l10n('Video successfully updated'));149 $page['infos'][] = l10n('Video successfully updated'); 170 150 $gvideo = array_merge($gvideo, $updates); 171 151 } … … 177 157 if (isset($_FILES['photo_update'])) 178 158 { 179 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');180 181 159 if ($_FILES['photo_update']['error'] !== UPLOAD_ERR_OK) 182 160 { 183 array_push($page['errors'], 184 file_upload_error_message($_FILES['photo_update']['error']) 185 ); 161 $page['errors'][] = file_upload_error_message($_FILES['photo_update']['error']); 186 162 } 187 163 else … … 195 171 ); 196 172 197 array_push($page['infos'], l10n('The thumbnail was updated'));173 $page['infos'][] = l10n('The thumbnail was updated'); 198 174 } 199 175 } … … 202 178 // | Add film frame | 203 179 // +-----------------------------------------------------------------------+ 204 if ( function_exists('imagecreatetruecolor') and isset($_GET['add_film_frame']) ) 205 { 206 include_once(GVIDEO_PATH . '/include/functions.inc.php'); 207 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'); 208 180 if (function_exists('imagecreatetruecolor') and isset($_GET['add_film_frame'])) 181 { 209 182 $thumb_source = $conf['data_location'].$picture['file']; 210 183 … … 242 215 )); 243 216 244 $template->set_filename('gvideo_content', dirname(__FILE__).'/template/photo.tpl'); 245 246 ?> 217 $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'admin/template/photo.tpl')); -
extensions/gvideo/admin/template/add.tpl
r20809 r26470 1 {combine_css path=$GVIDEO_PATH| @cat:"admin/template/style.css"}1 {combine_css path=$GVIDEO_PATH|cat:'admin/template/style.css'} 2 2 {include file='include/colorbox.inc.tpl'} 3 3 {include file='include/add_album.inc.tpl'} 4 4 5 {footer_script} {literal}5 {footer_script} 6 6 jQuery("input[data-toggle]").change(function() { 7 7 $('#'+ $(this).data('toggle')).toggle(); … … 17 17 $(".providersInfo").toggle(); 18 18 }); 19 {/literal}{/footer_script} 19 {/footer_script} 20 20 21 21 22 <div class="titrePage"> … … 25 26 <form method="post" action="" class="properties"> 26 27 <fieldset> 27 <legend>{'Properties'| @translate}</legend>28 <legend>{'Properties'|translate}</legend> 28 29 29 30 <ul> 30 31 <li> 31 32 <label> 32 <span class="property">{'Album'| @translate}</span>33 <span class="property">{'Album'|translate}</span> 33 34 <select style="width:400px" name="category" id="albumSelect" size="1"> 34 35 {html_options options=$category_parent_options selected=$POST.category} 35 36 </select> 36 37 </label> 37 {'... or '| @translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>38 {'... or '|translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|translate}">{'create a new album'|translate}</a> 38 39 </li> 39 40 <li> 40 41 <label> 41 <span class="property">{'Video URL'| @translate}</span>42 <span class="property">{'Video URL'|translate}</span> 42 43 <input type="text" name="url" value="{$POST.url}" style="width:400px;"> 43 44 </label> … … 45 46 {if $gd_available} 46 47 <li> 47 <span class="property">{'Thumbnail'| @translate}</span>48 <label><input type="checkbox" name="add_film_frame" value="true" {if $POST.add_film_frame}checked="checked"{/if}> {'Add film effect'| @translate} </label>49 <a class=" showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>">i</a>48 <span class="property">{'Thumbnail'|translate}</span> 49 <label><input type="checkbox" name="add_film_frame" value="true" {if $POST.add_film_frame}checked="checked"{/if}> {'Add film effect'|translate} </label> 50 <a class="icon-info-circled-1 showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>"></a> 50 51 </li> 51 52 {/if} … … 54 55 55 56 <fieldset> 56 <legend>{'Configuration'| @translate}</legend>57 <legend>{'Configuration'|translate}</legend> 57 58 58 59 <ul> 59 60 <li> 60 <span class="property">{'Video size'| @translate}</span>61 <label><input type="radio" name="size_common" value="true" {if $POST.size_common != 'false'}checked="checked"{/if} data-toggle="size"> {'Use common setting'| @translate}</label>62 <label><input type="radio" name="size_common" value="false" {if $POST.size_common == 'false'}checked="checked"{/if} data-toggle="size"> {'Change'| @translate}</label>61 <span class="property">{'Video size'|translate}</span> 62 <label><input type="radio" name="size_common" value="true" {if $POST.size_common != 'false'}checked="checked"{/if} data-toggle="size"> {'Use common setting'|translate}</label> 63 <label><input type="radio" name="size_common" value="false" {if $POST.size_common == 'false'}checked="checked"{/if} data-toggle="size"> {'Change'|translate}</label> 63 64 </li> 64 65 <li {if $POST.size_common != 'false'}style="display:none;"{/if} id="size"> … … 68 69 </li> 69 70 <li> 70 <span class="property">{'Autoplay'| @translate}</span>71 <label><input type="radio" name="autoplay_common" value="true" {if $POST.autoplay_common != 'false'}checked="checked"{/if} data-toggle="autoplay"> {'Use common setting'| @translate}</label>72 <label><input type="radio" name="autoplay_common" value="false" {if $POST.autoplay_common == 'false'}checked="checked"{/if} data-toggle="autoplay"> {'Change'| @translate}</label>71 <span class="property">{'Autoplay'|translate}</span> 72 <label><input type="radio" name="autoplay_common" value="true" {if $POST.autoplay_common != 'false'}checked="checked"{/if} data-toggle="autoplay"> {'Use common setting'|translate}</label> 73 <label><input type="radio" name="autoplay_common" value="false" {if $POST.autoplay_common == 'false'}checked="checked"{/if} data-toggle="autoplay"> {'Change'|translate}</label> 73 74 </li> 74 75 <li {if $POST.autoplay_common != 'false'}style="display:none;"{/if} id="autoplay"> 75 76 <span class="property"> </span> 76 <label><input type="radio" name="autoplay" value="0" {if $POST.autoplay == '0'}checked="checked"{/if}> {'No'| @translate}</label>77 <label><input type="radio" name="autoplay" value="1" {if $POST.autoplay == '1'}checked="checked"{/if}> {'Yes'| @translate}</label>77 <label><input type="radio" name="autoplay" value="0" {if $POST.autoplay == '0'}checked="checked"{/if}> {'No'|translate}</label> 78 <label><input type="radio" name="autoplay" value="1" {if $POST.autoplay == '1'}checked="checked"{/if}> {'Yes'|translate}</label> 78 79 </li> 79 80 <li> 80 <span class="property">{'Get video description'| @translate}</span>81 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'| @translate}</label>82 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'| @translate}</label>81 <span class="property">{'Get video description'|translate}</span> 82 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|translate}</label> 83 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|translate}</label> 83 84 </li> 84 85 <li> 85 <span class="property">{'Get video tags'| @translate}</span>86 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'| @translate}</label>87 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'| @translate}</label>86 <span class="property">{'Get video tags'|translate}</span> 87 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|translate}</label> 88 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|translate}</label> 88 89 </li> 89 90 </ul> … … 92 93 93 94 <p style="text-align:left;"> 94 <input type="submit" name="add_video" value="{'Add'| @translate}">95 <label style="font-weight:bold;"><input type="checkbox" name="safe_mode" {if $POST.safe_mode}checked="checked"{/if}> {'Safe-mode'| @translate}</label>96 <a class=" showInfo" title="{'In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'|@translate}">i</a>95 <input type="submit" name="add_video" value="{'Add'|translate}"> 96 <label style="font-weight:bold;"><input type="checkbox" name="safe_mode" {if $POST.safe_mode}checked="checked"{/if}> {'Safe-mode'|translate}</label> 97 <a class="icon-info-circled-1 showInfo" title="{'In safe-mode, the plugin does\'t try to contact the video host, usefull on some websites where remote connections are blocked.'|translate|escape:html}"></a> 97 98 </p> 98 99 99 100 <fieldset style="margin-top:40px;"> 100 <legend>{'Supported services'| @translate}</legend>101 <legend>{'Supported services'|translate}</legend> 101 102 102 103 <ul class="services"> … … 104 105 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/youtube.png"> 105 106 <a href="http://www.youtube.com" target="_blank">YouTube</a> 106 <span class="providersInfo">{'Videos can be unlisted but not private.'| @translate}<br></span>107 <span class="providersInfo">{'Videos can be unlisted but not private.'|translate}<br></span> 107 108 </li> 108 109 <li> 109 110 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> 110 111 <a href="http://www.vimeo.com" target="_blank">Vimeo</a> 111 <span class="providersInfo">{'Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).'| @translate}<br></span>112 <span class="providersInfo">{'Videos can be unlisted and private if the gallery website is within the authorized domains (PRO).'|translate}<br></span> 112 113 </li> 113 114 <li> 114 115 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> 115 116 <a href="http://www.dailymotion.com" target="_blank">Dailymotion</a> 116 <span class="providersInfo">{'Videos can be private if you use the private permalink.'| @translate}<br></span>117 <span class="providersInfo">{'Videos can be private if you use the private permalink.'|translate}<br></span> 117 118 </li> 118 119 <li> 119 120 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/wat.png"> 120 121 <a href="http://www.wat.tv" target="_blank">Wat</a> 121 <span class="providersInfo" style="font-style:italic;">{'No privacy option.'| @translate}<br></span>122 <span class="providersInfo" style="font-style:italic;">{'No privacy option.'|translate}<br></span> 122 123 </li> 123 124 <li> 124 125 <img class="icon" src="{$GVIDEO_PATH}admin/template/icons/wideo.png"> 125 126 <a href="http://www.wideo.fr" target="_blank">Wideo</a> 126 <span class="providersInfo" style="font-style:italic;">{'No privacy option.'| @translate}<br></span>127 <span class="providersInfo" style="font-style:italic;">{'No privacy option.'|translate}<br></span> 127 128 </li> 128 129 <li> 129 <a class="showProvidersInfo">{'Show privacy details'| @translate}</a>130 <a class="showProvidersInfo">{'Show privacy details'|translate}</a> 130 131 </li> 131 132 </ul> -
extensions/gvideo/admin/template/config.tpl
r19056 r26470 1 {combine_css path=$GVIDEO_PATH| @cat:"admin/template/style.css"}1 {combine_css path=$GVIDEO_PATH|cat:'admin/template/style.css'} 2 2 3 {footer_script} {literal}3 {footer_script} 4 4 jQuery('label.color input').change(function() { 5 5 $('label.color').removeClass('active'); 6 6 $('label.color input:checked').parent('label').addClass('active'); 7 7 }); 8 {/literal}{/footer_script} 8 {/footer_script} 9 9 10 10 11 <div class="titrePage"> … … 14 15 <form method="post" action="" class="properties"> 15 16 <fieldset> 16 <legend>{'Common configuration'| @translate}</legend>17 <legend>{'Common configuration'|translate}</legend> 17 18 18 19 <ul> 19 20 <li> 20 <span class="property">{'Video size'| @translate}</span>21 <span class="property">{'Video size'|translate}</span> 21 22 <input type="text" name="width" value="{$gvideo.width}" size="4"> × 22 23 <input type="text" name="height" value="{$gvideo.height}" size="4"> px 23 24 </li> 24 25 <li> 25 <span class="property">{'Autoplay'| @translate}</span>26 <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'| @translate}</label>27 <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'| @translate}</label>26 <span class="property">{'Autoplay'|translate}</span> 27 <label><input type="radio" name="autoplay" value="1" {if $gvideo.autoplay}checked="checked"{/if}> {'Yes'|translate}</label> 28 <label><input type="radio" name="autoplay" value="0" {if not $gvideo.autoplay}checked="checked"{/if}> {'No'|translate}</label> 28 29 </li> 29 30 <li> 30 <span class="property">{'Get video description'| @translate}</span>31 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'| @translate}</label>32 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'| @translate}</label>31 <span class="property">{'Get video description'|translate}</span> 32 <label><input type="radio" name="sync_description" value="1" {if $gvideo.sync_description}checked="checked"{/if}> {'Yes'|translate}</label> 33 <label><input type="radio" name="sync_description" value="0" {if not $gvideo.sync_description}checked="checked"{/if}> {'No'|translate}</label> 33 34 </li> 34 35 <li> 35 <span class="property">{'Get video tags'| @translate}</span>36 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'| @translate}</label>37 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'| @translate}</label>36 <span class="property">{'Get video tags'|translate}</span> 37 <label><input type="radio" name="sync_tags" value="1" {if $gvideo.sync_tags}checked="checked"{/if}> {'Yes'|translate}</label> 38 <label><input type="radio" name="sync_tags" value="0" {if not $gvideo.sync_tags}checked="checked"{/if}> {'No'|translate}</label> 38 39 </li> 39 40 </ul> … … 41 42 42 43 <div class="left"><fieldset> 43 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo player'| @translate}</legend>44 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/vimeo.png"> {'Vimeo player'|translate}</legend> 44 45 45 46 <ul> 46 47 <li> 47 <span class="property">{'Color'| @translate}</span>48 <span class="property">{'Color'|translate}</span> 48 49 {foreach from=$vimeo_colors item=color} 49 50 <label class="color {$themeconf.name} {if $gvideo.vimeo.color == $color}active{/if}" style="background:#{$color};"><input type="radio" name="vimeo[color]" value="{$color}" {if $gvideo.vimeo.color == $color}checked="checked"{/if}></label> … … 51 52 </li> 52 53 <li> 53 <span class="property">{'Display'| @translate}</span>54 <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'| @translate}</label>55 <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'| @translate}</label>56 <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'| @translate}</label>54 <span class="property">{'Display'|translate}</span> 55 <label><input type="checkbox" name="vimeo[title]" value="1" {if $gvideo.vimeo.title}checked="checked"{/if}> {'Title'|translate}</label> 56 <label><input type="checkbox" name="vimeo[portrait]" value="1" {if $gvideo.vimeo.portrait}checked="checked"{/if}> {'Author portrait'|translate}</label> 57 <label><input type="checkbox" name="vimeo[byline]" value="1" {if $gvideo.vimeo.byline}checked="checked"{/if}> {'Author name'|translate}</label> 57 58 </li> 58 59 </ul> … … 60 61 61 62 <div class="right"><fieldset> 62 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion player'| @translate}</legend>63 <legend><img class="icon" src="{$GVIDEO_PATH}admin/template/icons/dailymotion.png"> {'Dailymotion player'|translate}</legend> 63 64 64 65 <ul> 65 66 <li> 66 <span class="property">{'Color'| @translate}</span>67 <span class="property">{'Color'|translate}</span> 67 68 {foreach from=$dailymotion_colors item=color} 68 69 <label class="color {$themeconf.name} {if $gvideo.dailymotion.color == $color}active{/if}" style="background:#{$color};"><input type="radio" name="dailymotion[color]" value="{$color}" {if $gvideo.dailymotion.color == $color}checked="checked"{/if}></label> … … 70 71 </li> 71 72 <li> 72 <span class="property">{'Display'| @translate}</span>73 <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'| @translate}</label>74 <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'| @translate}</label>73 <span class="property">{'Display'|translate}</span> 74 <label><input type="checkbox" name="dailymotion[logo]" value="1" {if $gvideo.dailymotion.logo}checked="checked"{/if}> {'Logo'|translate}</label> 75 <label><input type="checkbox" name="dailymotion[title]" value="1" {if $gvideo.dailymotion.title}checked="checked"{/if}> {'Title'|translate}</label> 75 76 </li> 76 77 </ul> … … 79 80 <div style="clear:right;"></div> 80 81 81 <p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'| @translate}"></p>82 <p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|translate}"></p> 82 83 83 84 </form> -
extensions/gvideo/admin/template/photo.tpl
r19213 r26470 1 {combine_css path=$GVIDEO_PATH| @cat:"admin/template/style.css"}1 {combine_css path=$GVIDEO_PATH|cat:'admin/template/style.css'} 2 2 3 {footer_script} {literal}3 {footer_script} 4 4 jQuery("input[data-toggle]").change(function() { 5 5 $block = $('#'+ $(this).data('toggle')); … … 10 10 } 11 11 }); 12 {/literal}13 12 14 13 var border = jQuery("input[name='url']").css('border'); 15 14 16 jQuery("input[name='url']").keyup(function() { ldelim}17 if ($(this).val() != "{$GVIDEO.url}") { ldelim}15 jQuery("input[name='url']").keyup(function() { 16 if ($(this).val() != "{$GVIDEO.url}") { 18 17 $(this).css('border', '1px solid #c00'); 19 18 $(".video_update").show(); 20 } else {ldelim} 19 } 20 else { 21 21 $(this).css('border', border); 22 22 $(".video_update").hide(); … … 25 25 {/footer_script} 26 26 27 <h2>{$TITLE} › {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2> 27 28 <h2>{$TITLE} › {'Edit photo'|translate} {$TABSHEET_TITLE}</h2> 28 29 29 30 <fieldset> 30 <legend>{'Thumbnail'| @translate}</legend>31 <legend>{'Thumbnail'|translate}</legend> 31 32 <table> 32 33 <tr> 33 34 <td id="albumThumbnail"> 34 <img src="{$TN_SRC}" alt="{'Thumbnail'| @translate}" class="Thumbnail">35 <img src="{$TN_SRC}" alt="{'Thumbnail'|translate}" class="Thumbnail"> 35 36 </td> 36 37 <td id="albumLinks" style="width:400px;vertical-align:top;"> 37 38 <ul style="padding-left:15px;margin:0;"> 38 39 {if $U_ADD_FILM_FRAME} 39 <li style="margin:10px 0 20px 0;"><a href="{$U_ADD_FILM_FRAME}">{'Add film effect'| @translate}</a></li>40 <li style="margin:10px 0 20px 0;"><a href="{$U_ADD_FILM_FRAME}">{'Add film effect'|translate}</a></li> 40 41 {/if} 41 42 42 43 <li> 43 44 <form id="photo_update" method="post" action="{$F_ACTION}" enctype="multipart/form-data"> 44 {'Upload a new thumbnail'| @translate}<br>45 {'Upload a new thumbnail'|translate}<br> 45 46 <input type="file" size="20" name="photo_update"> 46 <input class="submit" type="submit" value="{'Send'| @translate}" name="photo_update">47 <input class="submit" type="submit" value="{'Send'|translate}" name="photo_update"> 47 48 </form> 48 49 </li> … … 55 56 <form action="{$F_ACTION}" method="post" id="catModify"> 56 57 <fieldset> 57 <legend>{'Properties'| @translate}</legend>58 <legend>{'Properties'|translate}</legend> 58 59 59 60 <p> 60 <b>{'Video URL'| @translate}</b>61 <b>{'Video URL'|translate}</b> 61 62 <input type="text" name="url" value="{$GVIDEO.url}" style="width:400px;"> 62 <span class="video_update warning" style="display:none;"> {'Changing the url will reset video description, name and thumbnail'| @translate}</span>63 <span class="video_update warning" style="display:none;"> {'Changing the url will reset video description, name and thumbnail'|translate}</span> 63 64 </p> 64 65 65 66 <p class="video_update"> 66 <b>{'Get video description'| @translate}</b>67 <label><input type="radio" name="sync_description" value="1" {if $GVIDEO.sync_description}checked="checked"{/if}> {'Yes'| @translate}</label>68 <label><input type="radio" name="sync_description" value="0" {if not $GVIDEO.sync_description}checked="checked"{/if}> {'No'| @translate}</label>67 <b>{'Get video description'|translate}</b> 68 <label><input type="radio" name="sync_description" value="1" {if $GVIDEO.sync_description}checked="checked"{/if}> {'Yes'|translate}</label> 69 <label><input type="radio" name="sync_description" value="0" {if not $GVIDEO.sync_description}checked="checked"{/if}> {'No'|translate}</label> 69 70 </p> 70 71 71 72 <p class="video_update"> 72 <b>{'Get video tags'| @translate}</b>73 <label><input type="radio" name="sync_tags" value="1" {if $GVIDEO.sync_tags}checked="checked"{/if}> {'Yes'| @translate}</label>74 <label><input type="radio" name="sync_tags" value="0" {if not $GVIDEO.sync_tags}checked="checked"{/if}> {'No'| @translate}</label>73 <b>{'Get video tags'|translate}</b> 74 <label><input type="radio" name="sync_tags" value="1" {if $GVIDEO.sync_tags}checked="checked"{/if}> {'Yes'|translate}</label> 75 <label><input type="radio" name="sync_tags" value="0" {if not $GVIDEO.sync_tags}checked="checked"{/if}> {'No'|translate}</label> 75 76 </p> 76 77 77 78 <p> 78 <b>{'Video size'| @translate}</b>79 <label><input type="radio" name="size_common" value="true" {if $GVIDEO.size_common == 'true'}checked="checked"{/if} data-toggle="size"> {'Use common setting'| @translate}</label>80 <label><input type="radio" name="size_common" value="false" {if $GVIDEO.size_common != 'true'}checked="checked"{/if} data-toggle="size"> {'Change'| @translate}</label>79 <b>{'Video size'|translate}</b> 80 <label><input type="radio" name="size_common" value="true" {if $GVIDEO.size_common == 'true'}checked="checked"{/if} data-toggle="size"> {'Use common setting'|translate}</label> 81 <label><input type="radio" name="size_common" value="false" {if $GVIDEO.size_common != 'true'}checked="checked"{/if} data-toggle="size"> {'Change'|translate}</label> 81 82 82 83 <span style="display:{if $GVIDEO.size_common == 'true'}none{else}block{/if};" id="size"> … … 87 88 88 89 <p> 89 <b>{'Autoplay'| @translate}</b>90 <label><input type="radio" name="autoplay_common" value="true" {if $GVIDEO.autoplay_common == 'true'}checked="checked"{/if} data-toggle="autoplay"> {'Use common setting'| @translate}</label>91 <label><input type="radio" name="autoplay_common" value="false" {if $GVIDEO.autoplay_common != 'true'}checked="checked"{/if} data-toggle="autoplay"> {'Change'| @translate}</label>90 <b>{'Autoplay'|translate}</b> 91 <label><input type="radio" name="autoplay_common" value="true" {if $GVIDEO.autoplay_common == 'true'}checked="checked"{/if} data-toggle="autoplay"> {'Use common setting'|translate}</label> 92 <label><input type="radio" name="autoplay_common" value="false" {if $GVIDEO.autoplay_common != 'true'}checked="checked"{/if} data-toggle="autoplay"> {'Change'|translate}</label> 92 93 93 94 <span style="display:{if $GVIDEO.autoplay_common == 'true'}none{else}block{/if};" id="autoplay"> 94 <label><input type="radio" name="autoplay" value="0" {if $GVIDEO.autoplay == '0'}checked="checked"{/if}> {'No'| @translate}</label>95 <label><input type="radio" name="autoplay" value="1" {if $GVIDEO.autoplay == '1'}checked="checked"{/if}> {'Yes'| @translate}</label>95 <label><input type="radio" name="autoplay" value="0" {if $GVIDEO.autoplay == '0'}checked="checked"{/if}> {'No'|translate}</label> 96 <label><input type="radio" name="autoplay" value="1" {if $GVIDEO.autoplay == '1'}checked="checked"{/if}> {'Yes'|translate}</label> 96 97 </span> 97 98 </p> 98 99 99 100 <p style="margin:0;"> 100 <label style="font-weight:bold;"><input type="checkbox" name="safe_mode"> {'Safe-mode'| @translate}</label>101 <label style="font-weight:bold;"><input type="checkbox" name="safe_mode"> {'Safe-mode'|translate}</label> 101 102 <br> 102 <input class="submit" type="submit" value="{'Save Settings'| @translate}" name="save_properties">103 <input class="submit" type="submit" value="{'Save Settings'|translate}" name="save_properties"> 103 104 </p> 104 105 </fieldset> -
extensions/gvideo/admin/template/style.css
r20809 r26470 42 42 visibility:hidden; 43 43 } 44 45 .showInfo {46 position:static;47 display:inline-block;48 padding:1px 7px;49 width:4px;50 height:16px;51 line-height:16px;52 font-size:0.8em;53 }54 44 55 45 ul.services li { -
extensions/gvideo/include/events.inc.php
r24342 r26470 1 1 <?php 2 if (!defined('GVIDEO_PATH'))die('Hacking attempt!');2 defined('GVIDEO_PATH') or die('Hacking attempt!'); 3 3 4 4 /** … … 11 11 // remove default parser 12 12 remove_event_handler('render_element_content', 'default_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL); 13 14 // remove autosize15 global $pwg_loaded_plugins, $autosize_ctrl;16 13 17 if ( isset($pwg_loaded_plugins['Autosize']) and isset($autosize_ctrl) ) 18 { 19 remove_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'), EVENT_HANDLER_PRIORITY_NEUTRAL-11, 2); 20 remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init_1'), EVENT_HANDLER_PRIORITY_NEUTRAL-9, 2); 21 remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init'), EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2); 22 remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init2'), EVENT_HANDLER_PRIORITY_NEUTRAL+1, 2); 23 remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1')); 24 remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2')); 25 remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_3')); 26 remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21); 27 } 14 // add custom parser 15 add_event_handler('render_element_content', 'gvideo_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2); 28 16 } 29 17 … … 42 30 43 31 global $page, $picture, $template, $conf; 44 45 if (is_string($conf['gvideo']))46 {47 $conf['gvideo'] = unserialize($conf['gvideo']);48 }49 32 50 33 // remove some actions … … 89 72 90 73 global $user; 74 // hide stripped overlay preventing to click on video object 91 75 if (strpos('stripped', $user['theme']) !== false) 92 76 { 93 $template-> append('head_elements', '<style type="text/css">.hideTabs{display:none !important;}</style>');77 $template->block_html_style(null, '.hideTabs{ display:none !important; }'); 94 78 } 95 79 … … 109 93 pwg_query($query); 110 94 } 111 112 ?> -
extensions/gvideo/main.inc.php
r20804 r26470 4 4 Version: auto 5 5 Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo and Wat. 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=1367 Author: Mistic & P@t6 Plugin URI: auto 7 Author: Mistic 8 8 Author URI: http://www.strangeplanet.fr 9 9 */ 10 10 11 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');11 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 12 12 13 13 global $prefixeTable; 14 14 15 define d('GVIDEO_ID') or define('GVIDEO_ID',basename(dirname(__FILE__)));15 define('GVIDEO_ID', basename(dirname(__FILE__))); 16 16 define('GVIDEO_PATH', PHPWG_PLUGINS_PATH . GVIDEO_ID . '/'); 17 17 define('GVIDEO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . GVIDEO_ID); … … 22 22 add_event_handler('init', 'gvideo_init'); 23 23 add_event_handler('picture_pictures_data', 'gvideo_prepare_picture'); 24 add_event_handler('render_element_content', 'gvideo_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2);25 24 26 25 if (defined('IN_ADMIN')) 27 26 { 28 add_event_handler('delete_elements', 'gvideo_delete_elements');29 27 add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu'); 30 28 add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); 31 29 } 32 30 33 include_once(GVIDEO_PATH . 'include/gvideo.inc.php'); 31 add_event_handler('delete_elements', 'gvideo_delete_elements'); 32 33 include_once(GVIDEO_PATH . 'include/events.inc.php'); 34 34 35 35 36 36 /** 37 * update & load language37 * init 38 38 */ 39 39 function gvideo_init() 40 40 { 41 global $ pwg_loaded_plugins;41 global $conf; 42 42 43 if ( 44 GVIDEO_VERSION == 'auto' or 45 $pwg_loaded_plugins[GVIDEO_ID]['version'] == 'auto' or 46 version_compare($pwg_loaded_plugins[GVIDEO_ID]['version'], GVIDEO_VERSION, '<') 47 ) 48 { 49 include_once(GVIDEO_PATH . 'include/install.inc.php'); 50 gvideo_install(); 51 52 if ( $pwg_loaded_plugins[GVIDEO_ID]['version'] != 'auto' and GVIDEO_VERSION !='auto' ) 53 { 54 $query = ' 55 UPDATE '. PLUGINS_TABLE .' 56 SET version = "'. GVIDEO_VERSION .'" 57 WHERE id = "'. GVIDEO_ID .'"'; 58 pwg_query($query); 59 60 $pwg_loaded_plugins[GVIDEO_ID]['version'] = GVIDEO_VERSION; 61 62 if (defined('IN_ADMIN')) 63 { 64 $_SESSION['page_infos'][] = 'Embedded Videos updated to version '. GVIDEO_VERSION; 65 } 66 } 67 } 43 include_once(GVIDEO_PATH . 'maintain.inc.php'); 44 $maintain = new gvideo_maintain(GVIDEO_ID); 45 $maintain->autoUpdate(GVIDEO_VERSION, 'install'); 68 46 69 47 load_language('plugin.lang', GVIDEO_PATH); 48 49 $conf['gvideo'] = unserialize($conf['gvideo']); 70 50 } 71 51 … … 75 55 function gvideo_admin_menu($menu) 76 56 { 77 array_push($menu,array(57 $menu[] = array( 78 58 'NAME' => 'Embedded Videos', 79 59 'URL' => GVIDEO_ADMIN, 80 ));60 ); 81 61 return $menu; 82 62 } … … 109 89 return $sheets; 110 90 } 111 112 ?> -
extensions/gvideo/maintain.inc.php
r20804 r26470 1 1 <?php 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 4 defined('GVIDEO_ID') or define('GVIDEO_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . GVIDEO_ID . '/include/install.inc.php'); 6 7 8 /* install */ 9 function plugin_install() 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 4 class gvideo_maintain extends PluginMaintain 10 5 { 11 gvideo_install();6 private $installed = false; 12 7 13 define('gvideo_installed', true); 8 private $default_conf = array( 9 'autoplay' => 0, 10 'width' => 640, 11 'height' => 360, 12 'sync_description' => 1, 13 'sync_tags' => 1, 14 'vimeo' => array( 15 'title' => 1, 16 'portrait' => 1, 17 'byline' => 1, 18 'color' => '00adef', 19 ), 20 'dailymotion' => array( 21 'logo' => 1, 22 'title' => 1, 23 'color' => 'F7FFFD', 24 ), 25 'youtube' => array(), 26 'wat' => array(), 27 'wideo' => array(), 28 ); 29 30 private $table; 31 32 function __construct($plugin_id) 33 { 34 global $prefixeTable; 35 36 parent::__construct($plugin_id); 37 38 $this->table = $prefixeTable . 'image_video'; 39 } 40 41 function install($plugin_version, &$errors=array()) 42 { 43 global $conf; 44 45 // add config parameter 46 if (empty($conf['gvideo'])) 47 { 48 $conf['gvideo'] = serialize($this->default_conf); 49 conf_update_param('gvideo', $conf['gvideo']); 50 } 51 else 52 { 53 $old_conf = is_string($conf['gvideo']) ? unserialize($conf['gvideo']) : $conf['gvideo']; 54 55 if (!isset($old_conf['sync_description'])) 56 { 57 $old_conf['sync_description'] = 1; 58 $old_conf['sync_tags'] = 1; 59 60 $conf['gvideo'] = serialize($old_conf); 61 conf_update_param('gvideo', $conf['gvideo']); 62 } 63 } 64 65 // create table 66 $query = ' 67 CREATE TABLE IF NOT EXISTS `' . $this->table . '` ( 68 `picture_id` mediumint(8) NOT NULL, 69 `url` varchar(255) DEFAULT NULL, 70 `type` varchar(64) NOT NULL, 71 `video_id` varchar(128) NOT NULL, 72 `width` smallint(9) DEFAULT NULL, 73 `height` smallint(9) DEFAULT NULL, 74 `autoplay` tinyint(1) DEFAULT NULL 75 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 76 ;'; 77 pwg_query($query); 78 79 // update video_id lenght 80 $query = 'ALTER TABLE `' . $this->table . '` CHANGE `video_id` `video_id` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;'; 81 pwg_query($query); 82 83 // new collumn in images table 84 $result = pwg_query('SHOW COLUMNS FROM `' . IMAGES_TABLE . '` LIKE "is_gvideo";'); 85 if (!pwg_db_num_rows($result)) 86 { 87 pwg_query('ALTER TABLE `' . IMAGES_TABLE . '` ADD `is_gvideo` TINYINT(1) NOT NULL DEFAULT 0;'); 88 89 $query = ' 90 UPDATE `' . IMAGES_TABLE . '` 91 SET is_gvideo = 1 92 WHERE id IN( 93 SELECT picture_id FROM `' . $this->table . '` 94 ) 95 ;'; 96 pwg_query($query); 97 } 98 99 // remove old configuration 100 if (isset($conf['PY_GVideo'])) 101 { 102 conf_delete_param('PY_GVideo'); 103 } 104 105 // updade video files 106 $this->update_24(); 107 108 $this->installed = true; 109 } 110 111 function activate($plugin_version, &$errors=array()) 112 { 113 if (!$this->installed) 114 { 115 $this->install($plugin_version, $errors); 116 } 117 } 118 119 function deactivate() 120 { 121 } 122 123 function uninstall() 124 { 125 conf_delete_param('gvideo'); 126 127 pwg_query('DROP TABLE `' . $this->table . '`;'); 128 129 pwg_query('ALTER TABLE `'. IMAGES_TABLE .'` DROP `is_gvideo`;'); 130 } 131 132 /** 133 * update from 2.3 to 2.4 134 */ 135 function update_24() 136 { 137 global $conf; 138 139 // search existing videos 140 $query = ' 141 SELECT * 142 FROM '.IMAGES_TABLE.' 143 WHERE 144 file LIKE "%.gvideo" 145 OR file LIKE "%.dm" 146 OR file LIKE "%.ytube" 147 OR file LIKE "%.wideo" 148 OR file LIKE "%.vimeo" 149 OR file LIKE "%.wat" 150 ;'; 151 $result = pwg_query($query); 152 153 if (!pwg_db_num_rows($result)) 154 { 155 return; 156 } 157 158 if (!isset($conf['prefix_thumbnail'])) 159 { 160 $conf['prefix_thumbnail'] = 'TN-'; 161 } 162 163 if (!isset($conf['dir_thumbnail'])) 164 { 165 $conf['dir_thumbnail'] = 'thumbnail'; 166 } 167 168 set_time_limit(600); 169 include_once(gvideo_path . 'include/functions.inc.php'); 170 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'); 171 172 $videos_inserts = array(); 173 $images_updates = array(); 174 $images_delete = array(); 175 176 while ($img = pwg_db_fetch_assoc($result)) 177 { 178 $file_content = file_get_contents($img['path']); 179 list($file['id'], $file['height'], $file['width'], ) = explode('/', $file_content); 180 $file['type'] = get_extension($img['path']); 181 182 switch ($file['type']) 183 { 184 case 'vimeo': 185 $video = array( 186 'type' => 'vimeo', 187 'url' => 'http://vimeo.com/'.$file['id'], 188 ); 189 break; 190 case 'dm': 191 $video = array( 192 'type' => 'dailymotion', 193 'url' => 'http://dailymotion.com/video/'.$file['id'], 194 ); 195 break; 196 case 'ytube': 197 $video = array( 198 'type' => 'youtube', 199 'url' => 'http://youtube.com/watch?v='.$file['id'], 200 ); 201 break; 202 case 'wideo': 203 $video = array( 204 'type' => 'wideo', 205 'url' => 'http://wideo.fr/video/'.$file['id'].'.html', 206 ); 207 break; 208 case 'wat': 209 $video = array( 210 'type' => 'wat', 211 'url' => null, 212 ); 213 break; 214 case 'gvideo': // closed 215 default: 216 $images_delete[] = $img['id']; 217 continue; 218 } 219 220 $real_path = str_replace($img['file'], null, str_replace('././', './', $img['path'])); 221 222 // get existing thumbnail 223 $thumb = $real_path.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'].get_filename_wo_extension($img['file']).'.*'; 224 $thumb = glob($thumb); 225 if (!empty($thumb)) 226 { 227 $thumb_name = $video['type'].'-'.$file['id'].'-'.uniqid().'.'.get_extension($thumb[0]); 228 $thumb_source = $conf['data_location'].$thumb_name; 229 copy($thumb[0], $thumb_source); 230 } 231 else 232 { 233 $thumb_name = $video['type'].'-'.$file['id'].'-'.uniqid().'.jpg'; 234 $thumb_source = $conf['data_location'].$thumb_name; 235 copy(gvideo_path.'mimetypes/'.$video['type'].'.jpg', $thumb_source); 236 add_film_frame($thumb_source); 237 } 238 239 // update element 240 $image_id = add_uploaded_file($thumb_source, $thumb_name, null, null, $img['id']); 241 242 // update path and rename the file 243 $img['new_path'] = $real_path.$thumb_name; 244 rename($img['path'], $img['new_path']); // why ? what's the purpose of this line ? 245 246 $images_updates[] = array( 247 'id' => $img['id'], 248 'path' => $img['new_path'], 249 'is_gvideo' => 1, 250 ); 251 252 if (empty($file['width'])) $file['width'] = ''; 253 if (empty($file['height'])) $file['height'] = ''; 254 255 // register video 256 $videos_inserts[] = array( 257 'picture_id' => $image_id, 258 'url' => $video['url'], 259 'type' => $video['type'], 260 'video_id' => $file['id'], 261 'width' => $file['width'], 262 'height' => $file['height'], 263 'autoplay' => '', 264 ); 265 266 unset($thumb_source, $thumb_name, $file, $video, $url); 267 } 268 269 // delete obsolete elements 270 delete_elements($images_delete); 271 272 // registers videos 273 mass_inserts( 274 gvideo_table, 275 array('picture_id', 'url', 'type', 'video_id', 'width', 'height', 'autoplay'), 276 $videos_inserts 277 ); 278 279 // update images 280 mass_updates( 281 IMAGES_TABLE, 282 array('primary'=>array('id'), 'update'=>array('path', 'is_gvideo')), 283 $images_updates 284 ); 285 } 14 286 } 15 16 /* activate */17 function plugin_activate()18 {19 if (!defined('gvideo_installed'))20 {21 gvideo_install();22 }23 }24 25 /* uninstall */26 function plugin_uninstall()27 {28 global $prefixeTable;29 30 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "gvideo" LIMIT 1;');31 pwg_query('DROP TABLE `'.$prefixeTable.'image_video`;');32 pwg_query('ALTER TABLE `' . IMAGES_TABLE . '` DROP `is_gvideo`;');33 }34 35 ?>
Note: See TracChangeset
for help on using the changeset viewer.