diff --git a/admin/history.php b/admin/history.php index c2d3ecb9a..40648e4f6 100644 --- a/admin/history.php +++ b/admin/history.php @@ -50,7 +50,7 @@ else $page['start'] = 0; } -$types = array('none', 'picture', 'high', 'other'); +$types = array_merge(array('none'), get_enums(HISTORY_TABLE, 'image_type')); $display_thumbnails = array('no_display_thumbnail' => l10n('No display'), 'display_thumbnail_classic' => l10n('Classic display'), diff --git a/admin/include/functions.php b/admin/include/functions.php index 4d3ccebe6..9a827d1d6 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -405,11 +405,7 @@ DELETE FROM '.$table.' } // purge of sessions - $query = ' -DELETE FROM '.SESSIONS_TABLE.' - WHERE data LIKE \'pwg_uid|i:'.(int)$user_id.';%\' -;'; - pwg_query($query); + delete_user_sessions($user_id); // destruction of the user $query = ' @@ -2080,6 +2076,8 @@ function cat_admin_access($category_id) */ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_agent='Piwigo', $step=0) { + global $conf; + // Try to retrieve data from local file? if (!url_is_remote($src)) { @@ -2115,6 +2113,17 @@ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_ if (function_exists('curl_init') && function_exists('curl_exec')) { $ch = @curl_init(); + + if (isset($conf['use_proxy']) && $conf['use_proxy']) + { + @curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0); + @curl_setopt($ch, CURLOPT_PROXY, $conf['proxy_server']); + if (isset($conf['proxy_auth']) && !empty($conf['proxy_auth'])) + { + @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $conf['proxy_auth']); + } + } + @curl_setopt($ch, CURLOPT_URL, $src); @curl_setopt($ch, CURLOPT_HEADER, 1); @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 1b5b5bb73..01b453816 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -173,8 +173,24 @@ function get_sync_metadata($infos) $infos['filesize'] = floor($fs/1024); + $is_tiff = false; + if (isset($infos['representative_ext'])) { + if ($image_size = @getimagesize($file)) + { + $type = $image_size[2]; + + if (IMAGETYPE_TIFF_MM == $type or IMAGETYPE_TIFF_II == $type) + { + // in case of TIFF files, we want to use the original file and not + // the representative for EXIF/IPTC, but we need the representative + // for width/height (to compute the multiple size dimensions) + $is_tiff = true; + } + + } + $file = original_to_representative($file, $infos['representative_ext']); } @@ -184,6 +200,12 @@ function get_sync_metadata($infos) $infos['height'] = $image_size[1]; } + if ($is_tiff) + { + // back to original file + $file = PHPWG_ROOT_PATH.$infos['path']; + } + if ($conf['use_exif']) { $exif = get_sync_exif_data($file); diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php index 17e78a200..900612fdd 100644 --- a/admin/include/functions_upload.inc.php +++ b/admin/include/functions_upload.inc.php @@ -535,7 +535,7 @@ function upload_file_video($representative_ext, $file_path) $ffmpeg_video_exts = array( // extensions tested with FFmpeg 'wmv','mov','mkv','mp4','mpg','flv','asf','xvid','divx','mpeg', - 'avi','rm', + 'avi','rm', 'm4v', 'ogg', 'ogv', 'webm', 'webmv', ); if (!in_array(strtolower(get_extension($file_path)), $ffmpeg_video_exts)) diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php index 4d852fee4..a795247e3 100644 --- a/admin/include/photos_add_direct_prepare.inc.php +++ b/admin/include/photos_add_direct_prepare.inc.php @@ -25,25 +25,9 @@ // | Photo selection | // +-----------------------------------------------------------------------+ -$upload_max_filesize = min( - get_ini_size('upload_max_filesize'), - get_ini_size('post_max_size') - ); - -if ($upload_max_filesize == get_ini_size('upload_max_filesize')) -{ - $upload_max_filesize_shorthand = get_ini_size('upload_max_filesize', false); -} -else -{ - $upload_max_filesize_shorthand = get_ini_size('post_max_filesize', false); -} - $template->assign( array( 'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL, - 'upload_max_filesize' => $upload_max_filesize, - 'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand, 'chunk_size' => $conf['upload_form_chunk_size'], ) ); @@ -222,6 +206,16 @@ if (!isset($_SESSION['upload_hide_warnings'])) get_ini_size('post_max_size', false) ); } + + if (get_ini_size('upload_max_filesize') < $conf['upload_form_chunk_size']*1024) + { + $setup_warnings[] = sprintf( + 'Piwigo setting upload_form_chunk_size (%ukB) should be smaller than PHP configuration setting upload_max_filesize (%ukB)', + $conf['upload_form_chunk_size'], + ceil(get_ini_size('upload_max_filesize') / 1024) + ); + } + $template->assign( array( 'setup_warnings' => $setup_warnings, diff --git a/admin/maintenance.php b/admin/maintenance.php index 9befd5032..3728d6094 100644 --- a/admin/maintenance.php +++ b/admin/maintenance.php @@ -109,6 +109,46 @@ DELETE case 'sessions' : { pwg_session_gc(); + + // delete all sessions associated to invalid user ids (it should never happen) + $query = ' +SELECT + id, + data + FROM '.SESSIONS_TABLE.' +;'; + $sessions = query2array($query); + + $query = ' +SELECT + '.$conf['user_fields']['id'].' AS id + FROM '.USERS_TABLE.' +;'; + $all_user_ids = query2array($query, 'id', null); + + $sessions_to_delete = array(); + + foreach ($sessions as $session) + { + if (preg_match('/pwg_uid\|i:(\d+);/', $session['data'], $matches)) + { + if (!isset($all_user_ids[ $matches[1] ])) + { + $sessions_to_delete[] = $session['id']; + } + } + } + + if (count($sessions_to_delete) > 0) + { + $query = ' +DELETE + FROM '.SESSIONS_TABLE.' + WHERE id IN (\''.implode("','", $sessions_to_delete).'\') +;'; + pwg_query($query); + } + break; } case 'feeds' : diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl index 71663fc20..e9ea85473 100644 --- a/admin/themes/default/template/photos_add_direct.tpl +++ b/admin/themes/default/template/photos_add_direct.tpl @@ -21,7 +21,7 @@ {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"} -{combine_script id='piecon' load='footer' path='themes/default/js/plugins/piecon.min.js'} +{combine_script id='piecon' load='footer' path='themes/default/js/plugins/piecon.js'} {footer_script} {* *} @@ -282,10 +282,9 @@ jQuery(document).ready(function(){
{'The picture dimensions will be reduced to %dx%d pixels.'|@translate:$original_resize_maxwidth:$original_resize_maxheight}
{/if} -{$upload_max_filesize_shorthand}B. {$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if}
+{$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if}
- {'Maximum file size: %sB.'|@translate:$upload_max_filesize_shorthand} {'Allowed file types: %s.'|@translate:$upload_file_types} {if isset($max_upload_resolution)} {'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|@translate:$max_upload_resolution:$max_upload_width:$max_upload_height} diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl index 54b8b936e..dedf59cf6 100644 --- a/admin/themes/default/template/user_list.tpl +++ b/admin/themes/default/template/user_list.tpl @@ -28,6 +28,7 @@ var selection = [{$selection}]; var pwg_token = "{$PWG_TOKEN}"; var protectedUsers = [{$protected_users}]; +var passwordProtectedUsers = [{$password_protected_users}]; var guestUser = {$guest_user}; var truefalse = { @@ -247,6 +248,7 @@ jQuery(document).ready(function() { user.isGuest = (parseInt(userId) == guestUser); user.isProtected = (protectedUsers.indexOf(parseInt(userId)) != -1); + user.isPasswordProtected = (passwordProtectedUsers.indexOf(parseInt(userId)) != -1); user.registeredOn_string = sprintf( registeredOn_pattern, @@ -1051,7 +1053,7 @@ span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border