Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/contest-gallery/ajax/ajax-functions-frontend.php
+++ b/contest-gallery/ajax/ajax-functions-frontend.php
@@ -42,13 +42,23 @@
$galleriesIds = [];
$hasGalleriesIds = false;
- if(!empty($_POST['cgIds'])){
- $galleriesIds = [];
- foreach ($_POST['cgIds'] as $idToSet){
- $galleriesIds[] = intval($idToSet);
- }
+ if(!empty($_POST['cgIds']) && is_array($_POST['cgIds'])){
+ $galleriesIds = cg1l_normalize_positive_int_id_list($_POST['cgIds']);
$hasGalleriesIds = true;
}
+ $hasGalleriesIds = (!empty($hasGalleriesIds) && !empty($galleriesIds));
+
+ $isGalleriesMainPage = false;
+ if(array_key_exists('isGalleriesMainPage', $_POST)){
+ $isGalleriesMainPage = cg1l_parse_bool_value($_POST['isGalleriesMainPage']);
+ }
+
+ if(array_key_exists('hasGalleriesIds', $_POST)){
+ $hasGalleriesIds = (
+ cg1l_parse_bool_value($_POST['hasGalleriesIds']) &&
+ !empty($galleriesIds)
+ );
+ }
$cgFromGalleriesUrl = '';
if(!empty($_POST['cg_from_galleries_url'])){
@@ -81,6 +91,21 @@
cg1l_ajax_frontend_response(false, ['message' => $galleryRequestErrorMessage, 'code' => 'cg_invalid_gallery_request']);
}
+ $galleriesDataAccessHash = (!empty($_POST['galleriesDataAccessHash'])) ? sanitize_text_field($_POST['galleriesDataAccessHash']) : '';
+ $viewerUserId = (is_user_logged_in()) ? get_current_user_id() : 0;
+ $expectedGalleriesDataAccessHash = cg1l_get_galleries_data_access_hash($shortcode_name,$viewerUserId,$isGalleriesMainPage,$galleriesIds,$hasGalleriesIds);
+ if(
+ empty($galleriesDataAccessHash) ||
+ empty($expectedGalleriesDataAccessHash) ||
+ !hash_equals((string)$expectedGalleriesDataAccessHash, (string)$galleriesDataAccessHash)
+ ){
+ cg1l_ajax_frontend_response(false, ['message' => $galleryRequestErrorMessage, 'code' => 'cg_invalid_gallery_request']);
+ }
+
+ if($hasGalleriesIds && $requestedGalleryId !== 9999999 && !in_array($requestedGalleryId, $galleriesIds, true)){
+ cg1l_ajax_frontend_response(false, ['message' => $galleryRequestErrorMessage, 'code' => 'cg_invalid_gallery_request']);
+ }
+
$entryId = 0;
$frontend_gallery = '';
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-comments-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-comments-data.php
@@ -1,6 +1,12 @@
<?php
if (!function_exists('cg1l_get_entry_comments_data')) {
function cg1l_get_entry_comments_data($gid,$entryId) {
+ $gid = absint($gid);
+ $entryId = absint($entryId);
+ if(empty($gid) || empty($entryId)){
+ return [];
+ }
+
$wp_upload_dir = wp_upload_dir();
$jsonFile = $wp_upload_dir['basedir'] . '/contest-gallery/gallery-id-' . $gid . '/json/image-comments/image-comments-'.$entryId.'.json';
if(file_exists($jsonFile)) {
@@ -185,4 +191,3 @@
}
}
}
-
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-data-for-frontend.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-data-for-frontend.php
@@ -435,11 +435,15 @@
}
$fieldMap = [
+ 'thumbnail' => 'thumbnail',
'WpUpload' => 'WpUpload',
'post_title' => 'post_title',
'post_name' => 'post_name',
'post_content' => 'post_content',
'post_excerpt' => 'post_excerpt',
+ 'post_alt' => 'post_alt',
+ 'post_caption' => 'post_caption',
+ 'post_date' => 'post_date',
'post_mime_type' => 'post_mime_type',
'medium' => 'medium',
'large' => 'large',
@@ -478,6 +482,7 @@
$normalizedData = $fullData;
$normalizedData['selectedOrder'] = $selectedOrder;
+ $normalizedData['MultipleFiles'] = $multipleFiles;
if (empty($selectedFileData['isRealIdSource'])) {
foreach ($fieldMap as $targetKey => $sourceKey) {
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-image-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-image-data.php
@@ -2,6 +2,12 @@
if (!function_exists('cg1l_get_entry_main_data')) {
function cg1l_get_entry_main_data($gid,$entryId)
{
+ $gid = absint($gid);
+ $entryId = absint($entryId);
+ if(empty($gid) || empty($entryId)){
+ return [];
+ }
+
$wp_upload_dir = wp_upload_dir();
$jsonFile = $wp_upload_dir['basedir'] . '/contest-gallery/gallery-id-' . $gid . '/json/image-data/image-data-'.$entryId.'.json';
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-info-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-info-data.php
@@ -1,6 +1,12 @@
<?php
if (!function_exists('cg1l_get_entry_info_data')) {
function cg1l_get_entry_info_data($gid,$entryId) {
+ $gid = absint($gid);
+ $entryId = absint($entryId);
+ if(empty($gid) || empty($entryId)){
+ return [];
+ }
+
$wp_upload_dir = wp_upload_dir();
$jsonFile = $wp_upload_dir['basedir'] . '/contest-gallery/gallery-id-' . $gid . '/json/image-info/image-info-'.$entryId.'.json';
if(file_exists($jsonFile)) {
@@ -120,4 +126,3 @@
}
-
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-query-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-query-data.php
@@ -2,13 +2,20 @@
if (!function_exists('cg1l_get_entry_query_data')) {
function cg1l_get_entry_query_data($entryId)
{
+ $entryId = absint($entryId);
+ if (empty($entryId)) {
+ return [];
+ }
+
global $wpdb;
$tablename = $wpdb->prefix . "contest_gal1ery";
- $queryData = $wpdb->get_results(
+ $queryData = $wpdb->get_results($wpdb->prepare(
"SELECT id, Exif, MultipleFiles
FROM $tablename
- WHERE (id = $entryId AND Active = '1' AND Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
- OR (id = $entryId AND Active = '1' AND MultipleFiles != '')");
+ WHERE id = %d AND Active = '1' AND ((Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
+ OR MultipleFiles != '')",
+ $entryId
+ ));
$queryDataArray = [];
if (!empty($queryData)) {
@@ -33,6 +40,13 @@
if (!function_exists('cg1l_build_images_query_data_gzip')) {
function cg1l_build_images_query_data_gzip($gid, $getDataOnly = false, $getRecentIds = []) {
+ $gid = absint($gid);
+ if(!empty($getRecentIds) && is_array($getRecentIds)){
+ $getRecentIds = array_values(array_unique(array_filter(array_map('absint', $getRecentIds))));
+ }else{
+ $getRecentIds = [];
+ }
+
$wp_upload_dir = wp_upload_dir();
$base_dir = $wp_upload_dir['basedir'].'/contest-gallery/gallery-id-'.$gid.'/json/segments';
@@ -74,27 +88,24 @@
$tablename = $wpdb->prefix . "contest_gal1ery";
if(!empty($getRecentIds)){
- $collected = '';
- foreach($getRecentIds as $id) {
- if(!$collected){
- $collected .= "id = $id";
- }else{
- $collected .= " OR id = $id";
- }
- }
+ $placeholders = implode(',', array_fill(0, count($getRecentIds), '%d'));
$queryData = $wpdb->get_results(
+ $wpdb->prepare(
"SELECT id, Exif, MultipleFiles
FROM $tablename
- WHERE (($collected) AND Active = '1' AND Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
- OR (($collected) AND Active = '1' AND MultipleFiles != '')"
+ WHERE id IN ($placeholders) AND Active = '1' AND ((Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
+ OR MultipleFiles != '')",
+ $getRecentIds
+ )
);
}else{
- $queryData = $wpdb->get_results(
+ $queryData = $wpdb->get_results($wpdb->prepare(
"SELECT id, Exif, MultipleFiles
FROM $tablename
- WHERE (GalleryID = '$gid' AND Active = '1' AND Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
- OR (GalleryID = '$gid' AND Active = '1' AND MultipleFiles != '')"
- );
+ WHERE GalleryID = %d AND Active = '1' AND ((Exif != '' AND Exif != '0' AND Exif IS NOT NULL)
+ OR MultipleFiles != '')",
+ $gid
+ ));
}
$queryDataArray = [];
@@ -160,4 +171,3 @@
}
}
}
-
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-stats-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-stats-data.php
@@ -1,6 +1,12 @@
<?php
if (!function_exists('cg1l_get_entry_stats_data')) {
function cg1l_get_entry_stats_data($gid,$entryId) {
+ $gid = absint($gid);
+ $entryId = absint($entryId);
+ if(empty($gid) || empty($entryId)){
+ return [];
+ }
+
$wp_upload_dir = wp_upload_dir();
$jsonFile = $wp_upload_dir['basedir'] . '/contest-gallery/gallery-id-' . $gid . '/json/image-stats/image-stats-'.$entryId.'.json';
--- a/contest-gallery/functions/frontend/prepare/cg-prepare-urls-data.php
+++ b/contest-gallery/functions/frontend/prepare/cg-prepare-urls-data.php
@@ -12,6 +12,11 @@
}
if (!function_exists('cg1l_get_entry_urls_data')) {
function cg1l_get_entry_urls_data($entryId,$recentMainData,$shortcode_name) {
+ $entryId = absint($entryId);
+ if(empty($entryId)){
+ return [];
+ }
+
$map = cg1l_get_shortcode_entry_url_map();
if(empty($map[$shortcode_name])){
return $recentMainData;
--- a/contest-gallery/functions/general/cg-general-functions.php
+++ b/contest-gallery/functions/general/cg-general-functions.php
@@ -373,6 +373,9 @@
$name = preg_replace('/_+/', '_', $name);
$name = cg_remove_emoji($name);
return strtolower($name);// mysql statements are caseinsensitive by default*/
+ if(function_exists('cg1l_decode_nested_entities_for_plain_text')){
+ $name = cg1l_decode_nested_entities_for_plain_text($name);
+ }
$name = cg_remove_emoji( $name );
return sanitize_title($name);
}
--- a/contest-gallery/functions/general/cg-get-version.php
+++ b/contest-gallery/functions/general/cg-get-version.php
@@ -17,7 +17,7 @@
if(!function_exists('cg_get_version_for_scripts')){
function cg_get_version_for_scripts () {
/**###NORMAL###**/
- return '30.0.0';
+ return '30.0.1';
/**###NORMAL-END###**/
}
}
--- a/contest-gallery/functions/general/convert-values.php
+++ b/contest-gallery/functions/general/convert-values.php
@@ -115,6 +115,40 @@
}
}
+if(!function_exists('cg1l_decode_nested_entities_for_plain_text')){
+ function cg1l_decode_nested_entities_for_plain_text($content){
+ $content = cg1l_convert_mixed_value_to_string($content);
+
+ if($content===''){
+ return '';
+ }
+
+ $content = trim($content);
+ $content = str_replace(array('','',''), '', $content);
+ $content = str_replace(html_entity_decode('', ENT_QUOTES, 'UTF-8'), '', $content);
+
+ for($i=0;$i<3;$i++){
+ $decoded = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
+ if($decoded===$content){
+ break;
+ }
+ $content = $decoded;
+ }
+
+ if(function_exists('wp_strip_all_tags')){
+ $content = wp_strip_all_tags($content,true);
+ }else{
+ $content = strip_tags($content);
+ }
+
+ $content = preg_replace('/\\/', '', $content);
+ $content = preg_replace('/[x00-x1Fx7F]+/', ' ', $content);
+ $content = preg_replace('/s+/', ' ', $content);
+
+ return trim($content);
+ }
+}
+
if(!function_exists('cg_stripslashes_recursively')){
function cg_stripslashes_recursively ($content){
if(!empty($content)){
--- a/contest-gallery/index.php
+++ b/contest-gallery/index.php
@@ -2,7 +2,7 @@
/*
Plugin Name: Contest Gallery
Description: Upload form, files, photos and videos upload contest gallery plugin for WordPress. Create upload forms for entries with or without file/image upload. Create user registration form. Create login form. Create responsive galleries and allow to vote for any kind of entries. Sell entries via PayPal or Stripe API. Create or edit images via OpenAI API.
-Version: 30.0.0
+Version: 30.0.1
Author: Contest Gallery
Plugin URI: https://www.contest-gallery.com
Author URI: https://www.contest-gallery.com
--- a/contest-gallery/shortcodes/cg_gallery.php
+++ b/contest-gallery/shortcodes/cg_gallery.php
@@ -17,12 +17,12 @@
$galeryID = 0;
if(!empty($atts['id'])){
- $galeryID = trim($atts['id']);
+ $galeryID = absint($atts['id']);
}
$entryId = 0;
if(!empty($atts['entry_id'])){
- $entryId = $atts['entry_id'];
+ $entryId = absint($atts['entry_id']);
}
$frontend_gallery = '';
@@ -46,4 +46,4 @@
}
}
-?>
No newline at end of file
+?>
--- a/contest-gallery/shortcodes/cg_gallery_ecommerce.php
+++ b/contest-gallery/shortcodes/cg_gallery_ecommerce.php
@@ -21,12 +21,12 @@
$galeryID = 0;
if(!empty($atts['id'])){
- $galeryID = trim($atts['id']);
+ $galeryID = absint($atts['id']);
}
$entryId = 0;
if(!empty($atts['entry_id'])){
- $entryId = $atts['entry_id'];
+ $entryId = absint($atts['entry_id']);
}
$frontend_gallery = '';
@@ -54,4 +54,4 @@
}
}
-?>
No newline at end of file
+?>
--- a/contest-gallery/shortcodes/cg_gallery_no_voting.php
+++ b/contest-gallery/shortcodes/cg_gallery_no_voting.php
@@ -19,12 +19,12 @@
$galeryID = 0;
if(!empty($atts['id'])){
- $galeryID = trim($atts['id']);
+ $galeryID = absint($atts['id']);
}
$entryId = 0;
if(!empty($atts['entry_id'])){
- $entryId = $atts['entry_id'];
+ $entryId = absint($atts['entry_id']);
}
$frontend_gallery = '';
@@ -50,4 +50,4 @@
}
}
-?>
No newline at end of file
+?>
--- a/contest-gallery/shortcodes/cg_gallery_user.php
+++ b/contest-gallery/shortcodes/cg_gallery_user.php
@@ -19,12 +19,12 @@
$galeryID = 0;
if(!empty($atts['id'])){
- $galeryID = trim($atts['id']);
+ $galeryID = absint($atts['id']);
}
$entryId = 0;
if(!empty($atts['entry_id'])){
- $entryId = $atts['entry_id'];
+ $entryId = absint($atts['entry_id']);
}
$frontend_gallery = '';
@@ -50,4 +50,4 @@
}
}
-?>
No newline at end of file
+?>
--- a/contest-gallery/shortcodes/cg_gallery_winner.php
+++ b/contest-gallery/shortcodes/cg_gallery_winner.php
@@ -19,12 +19,12 @@
$galeryID = 0;
if(!empty($atts['id'])){
- $galeryID = trim($atts['id']);
+ $galeryID = absint($atts['id']);
}
$entryId = 0;
if(!empty($atts['entry_id'])){
- $entryId = $atts['entry_id'];
+ $entryId = absint($atts['entry_id']);
}
$frontend_gallery = '';
@@ -53,4 +53,4 @@
}
}
-?>
No newline at end of file
+?>
--- a/contest-gallery/templates/landing.php
+++ b/contest-gallery/templates/landing.php
@@ -944,11 +944,59 @@
echo $HeaderWpPageEntry;
if(class_exists( 'QM_Plugin' )){
+ $wpScripts = wp_scripts();
+
+ $jqueryCoreSrc = includes_url('js/jquery/jquery.min.js');
+ $jqueryCoreVer = '';
+ if(!empty($wpScripts->registered['jquery-core'])){
+ $jqueryCore = $wpScripts->registered['jquery-core'];
+ $jqueryCoreVer = $jqueryCore->ver;
+ if(!empty($jqueryCore->src)){
+ $jqueryCoreSrc = $jqueryCore->src;
+ if(strpos($jqueryCoreSrc,'http://') !== 0 && strpos($jqueryCoreSrc,'https://') !== 0 && strpos($jqueryCoreSrc,'//') !== 0){
+ $jqueryCoreSrc = (strpos($jqueryCoreSrc,'/') === 0) ? site_url($jqueryCoreSrc) : includes_url($jqueryCoreSrc);
+ }
+ }
+ }
+ if($jqueryCoreVer !== null && $jqueryCoreVer !== ''){
+ $jqueryCoreSrc = add_query_arg('ver',$jqueryCoreVer,$jqueryCoreSrc);
+ }
+
+ $jqueryMigrateSrc = includes_url('js/jquery/jquery-migrate.min.js');
+ $jqueryMigrateVer = '';
+ if(!empty($wpScripts->registered['jquery-migrate'])){
+ $jqueryMigrate = $wpScripts->registered['jquery-migrate'];
+ $jqueryMigrateVer = $jqueryMigrate->ver;
+ if(!empty($jqueryMigrate->src)){
+ $jqueryMigrateSrc = $jqueryMigrate->src;
+ if(strpos($jqueryMigrateSrc,'http://') !== 0 && strpos($jqueryMigrateSrc,'https://') !== 0 && strpos($jqueryMigrateSrc,'//') !== 0){
+ $jqueryMigrateSrc = (strpos($jqueryMigrateSrc,'/') === 0) ? site_url($jqueryMigrateSrc) : includes_url($jqueryMigrateSrc);
+ }
+ }
+ }
+ if($jqueryMigrateVer !== null && $jqueryMigrateVer !== ''){
+ $jqueryMigrateSrc = add_query_arg('ver',$jqueryMigrateVer,$jqueryMigrateSrc);
+ }
+
+ $queryMonitorVersion = (defined('QM_VERSION')) ? QM_VERSION : '';
+ $queryMonitorCssSrc = plugins_url('assets/query-monitor.css', WP_PLUGIN_DIR . '/query-monitor/query-monitor.php');
+ $queryMonitorJsSrc = plugins_url('assets/query-monitor.js', WP_PLUGIN_DIR . '/query-monitor/query-monitor.php');
+ if(class_exists('QueryMonitor') && method_exists('QueryMonitor','init')){
+ $queryMonitor = QueryMonitor::init();
+ if(is_object($queryMonitor) && !empty($queryMonitor->file) && method_exists($queryMonitor,'plugin_url')){
+ $queryMonitorCssSrc = $queryMonitor->plugin_url('assets/query-monitor.css');
+ $queryMonitorJsSrc = $queryMonitor->plugin_url('assets/query-monitor.js');
+ }
+ }
+ if($queryMonitorVersion !== ''){
+ $queryMonitorCssSrc = add_query_arg('ver',$queryMonitorVersion,$queryMonitorCssSrc);
+ $queryMonitorJsSrc = add_query_arg('ver',$queryMonitorVersion,$queryMonitorJsSrc);
+ }
?>
- <script type='text/javascript' src='<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery.min.js?ver=3.6.1' id='jquery-core-js'></script>
- <script type='text/javascript' src='<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script>
- <link rel='stylesheet' id='query-monitor-css' href='<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/query-monitor/assets/query-monitor.css?ver=1673467028' type='text/css' media='all' />
- <script type='text/javascript' src='<?php echo get_bloginfo('wpurl'); ?>/wp-content/plugins/query-monitor/assets/query-monitor.js?ver=1673467028' id='query-monitor-js'></script>
+ <script type='text/javascript' src='<?php echo esc_url($jqueryCoreSrc); ?>' id='jquery-core-js'></script>
+ <script type='text/javascript' src='<?php echo esc_url($jqueryMigrateSrc); ?>' id='jquery-migrate-js'></script>
+ <link rel='stylesheet' id='query-monitor-css' href='<?php echo esc_url($queryMonitorCssSrc); ?>' type='text/css' media='all' />
+ <script type='text/javascript' src='<?php echo esc_url($queryMonitorJsSrc); ?>' id='query-monitor-js'></script>
<?php
}
?>
--- a/contest-gallery/v10/v10-admin/gallery/gallery.php
+++ b/contest-gallery/v10/v10-admin/gallery/gallery.php
@@ -1191,7 +1191,7 @@
$PdfPreviewImage = $anotherFirstMultipleFilePdfPreviewImage;
}
echo '<a href="'.$sourceOriginalImgShow.'?time='.time().'" target="_blank" title="'.$title.'" alt="'.$title.'">
- <div class="cg_backend_image cg_backend_image_stage"><img class="cg0degree cg_backend_image_preview" src="'.($PdfPreviewImage.'?time='.time()).'" alt="'.$title.'" ></div></a>';
+ <div class="cg0degree cg_backend_image cg_backend_image_stage"><img class="cg_backend_image_preview" src="'.($PdfPreviewImage.'?time='.time()).'" alt="'.$title.'" ></div></a>';
}elseif(empty($allWpPostsByWpUploadIdArray[$WpUpload]) && $ImgTypeToShow!='con'){
echo '<div class="cg_backend_image_full_size_target_empty" >';
echo "</div>";
@@ -1250,7 +1250,7 @@
<?php
}else{
echo '<a href="'.$sourceOriginalImgShow.'?time='.time().'" target="_blank" title="Show full size" alt="Show full size">
- <div class="cg_backend_image cg_backend_image_stage"><img class="cg'.$rThumbToShow.'degree cg_backend_image_preview" src="'.($imgSrcLargeToShow.'?time='.time()).'" width="'.absint($imgSrcFullWidth).'" height="'.absint($imgSrcFullHeight).'" alt="Show full size" ></div></a>';
+ <div class="cg'.$rThumbToShow.'degree cg_backend_image" style="background: url('.($imgSrcLargeToShow.'?time='.time()).') center center no-repeat;"></div></a>';
}
echo "</div>";
--- a/contest-gallery/v10/v10-admin/gallery/show-comments.php
+++ b/contest-gallery/v10/v10-admin/gallery/show-comments.php
@@ -445,7 +445,7 @@
<?php
}else{
echo '<div id="cgVotesImageVisualContent">';
- echo '<a href="'.$sourceOriginalImgShow.'" target="_blank" title="Show full size"><img class="cg'.$rThumb.'degree" src="'.$imageThumb.'" style="'.$padding.';position: absolute !important;max-width:none !important;" width="'.$WidthThumbPic.'"></a>';
+ echo '<a href="'.$sourceOriginalImgShow.'" target="_blank" title="Show full size"><div class="cg'.$rThumb.'degree cg_backend_image" style="background: url('.$imageThumb.') center center no-repeat;"></div></a>';
//echo '<a href="'.$sourceOriginalImgShow.'" target="_blank" title="Show full size" alt="Show full size"><img src="'.$WPdestination.$value->Timestamp.'_'.$value->NamePic.'-300width.'.$value->ImgType.'" style="'.$padding.';position: absolute !important;max-width:none !important;" width="'.$WidthThumbPic.'"></a>';
echo "</div>";
}
--- a/contest-gallery/v10/v10-admin/gallery/sort-gallery-files.php
+++ b/contest-gallery/v10/v10-admin/gallery/sort-gallery-files.php
@@ -183,7 +183,7 @@
echo "<div class='cg_backend_image_full_size_target_container'>";
//echo $galleryFile['id'];
echo '<div class="cg_backend_image_full_size_target_container_drag"></div>';
- echo '<div class="cg_backend_image_full_size_target"><div class="cg_backend_image cg_backend_image_stage"><img class="cg'.$galleryFile['rThumb'].'degree cg_backend_image_preview" src="'.$wp_upload_dir['baseurl'].$galleryFile['large'].'"'.$imageWidthAttribute.$imageHeightAttribute.' alt="" ></div></div>';
+ echo '<div class="cg_backend_image_full_size_target"><div class="cg'.$galleryFile['rThumb'].'degree cg_backend_image" style="background: url('.$wp_upload_dir['baseurl'].$galleryFile['large'].') center center no-repeat;"></div></div>';
echo "<input type='hidden' class='cg_position' data-cg-real-id=".$galleryFile['id']." name='cg_position[".$galleryFile['id']."]' value='$order' >";
echo "</div>";
}else{
--- a/contest-gallery/v10/v10-admin/votes/show-votes.php
+++ b/contest-gallery/v10/v10-admin/votes/show-votes.php
@@ -320,7 +320,7 @@
echo '</a>';
}elseif(cg_is_is_image($ImgType)){
echo '<div id="cgVotesImageVisualContent">';
- echo '<a href="'.$sourceOriginalImgShow.'" target="_blank" title="Show full size"><div class="cg_backend_image cg_backend_image_stage"><img class="cg_backend_image_preview cg'.$rThumb.'degree" src="'.$imageThumb.'" alt="Show full size"></div></a>';
+ echo '<a href="'.$sourceOriginalImgShow.'" target="_blank" title="Show full size"><div class="cg'.$rThumb.'degree cg_backend_image" style="background: url('.$imageThumb.') center center no-repeat;"></div></a>';
echo "</div>";
}elseif($ImgType=='ytb'){
echo '<div id="cgVotesImageVisualContent">';
--- a/contest-gallery/v10/v10-frontend/gallery-view.php
+++ b/contest-gallery/v10/v10-frontend/gallery-view.php
@@ -381,12 +381,27 @@
'.$cg_gallery_info.'
</figure>';
}elseif(cg_is_is_image($ImgType)){
+ if($rThumb === ' cg90degree' || $rThumb === ' cg270degree'){
+ $rotatedContainerRatioWidth = ($naturalHeight > 0) ? $naturalHeight : 1;
+ $rotatedContainerRatioHeight = ($naturalWidth > 0) ? $naturalWidth : 1;
+ $rotatedImageWidthPercent = ($naturalHeight > 0) ? round(($naturalWidth / $naturalHeight) * 100, 4) : 100;
+ $rotatedImageHeightPercent = ($naturalWidth > 0) ? round(($naturalHeight / $naturalWidth) * 100, 4) : 100;
+ $imageContent = '<div class="cg_append_container cg_rotated_image_container" style="width:100%; aspect-ratio: '.(int)$rotatedContainerRatioWidth.' / '.(int)$rotatedContainerRatioHeight.'; overflow:hidden;">
+ <div
+ role="img"
+ aria-label="'.esc_attr($altAttr).'"
+ class="cg_append cg_rotated_image_background skip-lazy'.$rThumb.'"
+ itemprop="contentUrl"
+ style="background: url('.esc_url($imgSrcLarge).') center center no-repeat; background-size: contain !important; width:'.$rotatedImageWidthPercent.'%; height:'.$rotatedImageHeightPercent.'%;" ></div>
+ </div>';
+ }else{
$imageContent = '<img
src="'.$imgSrcLarge.'" '.$WidthAttribute.' '.$HeightAttribute.'
alt="'.esc_attr($altAttr).'"
loading="lazy"
class="'.$rThumb.'"
itemprop="contentUrl" '.$imgStyle.' >';
+ }
$figure = '<figure class="cg_figure" itemscope itemtype="https://schema.org/'.$itemTypeObject.'Object">
'.$meta.'
'.$metaComment.'
--- a/contest-gallery/v10/v10-frontend/user_upload/users-upload-check.php
+++ b/contest-gallery/v10/v10-frontend/user_upload/users-upload-check.php
@@ -1443,6 +1443,15 @@
}
$post_title_to_insert = (($WpPageTitle) ? $WpPageTitle : $post_title);
+ if(function_exists('cg1l_decode_nested_entities_for_plain_text')){
+ $post_title_to_insert = cg1l_decode_nested_entities_for_plain_text($post_title_to_insert);
+ if(empty($post_title_to_insert)){
+ $post_title_to_insert = cg1l_decode_nested_entities_for_plain_text($post_title);
+ }
+ }
+ if(empty($post_title_to_insert)){
+ $post_title_to_insert = 'entry';
+ }
$post_title_to_insert = substr($post_title_to_insert,0,100);
if(!empty($selectSQL1->WpPageParent)){
--- a/contest-gallery/v10/v10-frontend/v10-get-data.php
+++ b/contest-gallery/v10/v10-frontend/v10-get-data.php
@@ -127,6 +127,7 @@
if(!isset($entryId)){
$entryId = 0;
}
+$entryId = absint($entryId);
if(empty($isFromOrderSummary)){// to go sure is initiated
$isFromOrderSummary = false;