Changeset 26470 for extensions/gvideo/admin/photo.php
- Timestamp:
- Jan 6, 2014, 4:41:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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'));
Note: See TracChangeset
for help on using the changeset viewer.