From 82f65173983837c704cbbeda2825a52ef1d0eed6 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Mon, 21 Nov 2022 20:37:19 +0100 Subject: [PATCH] recode for PHP 8.x --- cms/js/jquery.cookiesdirective.js | 588 +++++++++--------- conlite/backend_search.php | 26 +- conlite/classes/class.article.php | 8 +- conlite/includes/ajax/include.ajax.con.php | 4 +- conlite/includes/functions.con.php | 2 +- conlite/includes/include.con_art_overview.php | 7 +- .../includes/include.js_files_overview.php | 159 ++++- conlite/includes/include.tpl_edit_form.php | 1 - data/config/production/config.misc.php | 3 +- 9 files changed, 472 insertions(+), 326 deletions(-) diff --git a/cms/js/jquery.cookiesdirective.js b/cms/js/jquery.cookiesdirective.js index 3798de2..8ffceb9 100644 --- a/cms/js/jquery.cookiesdirective.js +++ b/cms/js/jquery.cookiesdirective.js @@ -1,294 +1,294 @@ -/* Cookies Directive - The rewrite. Now a jQuery plugin - * Version: 2.0.1 - * Author: Ollie Phillips - * 24 October 2013 - */ - -;(function($) { - $.cookiesDirective = function(options) { - - // Default Cookies Directive Settings - var settings = $.extend({ - //Options - explicitConsent: true, - position: 'top', - duration: 10, - limit: 0, - message: null, - cookieScripts: null, - privacyPolicyUri: 'privacy.html', - inlineAction: false, - scriptWrapper: function(){}, - // Styling - fontFamily: 'helvetica', - fontColor: '#FFFFFF', - fontSize: '13px', - backgroundColor: '#000000', - backgroundOpacity: '80', - linkColor: '#CA0000', - // Messages - multipleCookieScriptBeginningLabel: ' We use ', - and: ' and ', - multipleCookieScriptEndLabel: ' scripts, which all set cookies. ', - singleCookieScriptBeginningLabel: ' We use a ', - singleCookieScriptEndLabel: ' script which sets cookies.', - explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.', - explicitFindOutMore: 'To find out more about cookies on this website, see our', - privacyPolicyLinkText: ' privacy policy', - explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept', - explicitCookieAcceptanceLabel: 'I accept cookies from this site', - explicitCookieAcceptButtonText: 'Continue', - impliedDisclosureText: ' More details can be found in our', - impliedSubmitText: 'Do not show this message again', - }, options); - - // Perform consent checks - if(!getCookie('cookiesDirective')) { - if(settings.limit > 0) { - // Display limit in force, record the view - if(!getCookie('cookiesDisclosureCount')) { - setCookie('cookiesDisclosureCount',1,1); - } else { - var disclosureCount = getCookie('cookiesDisclosureCount'); - disclosureCount ++; - setCookie('cookiesDisclosureCount',disclosureCount,1); - } - - // Have we reached the display limit, if not make disclosure - if(settings.limit >= getCookie('cookiesDisclosureCount')) { - disclosure(settings); - } - } else { - // No display limit - disclosure(settings); - } - - // If we don't require explicit consent, load up our script wrapping function - if(!settings.explicitConsent) { - settings.scriptWrapper.call(); - } - } else { - // Cookies accepted, load script wrapping function - settings.scriptWrapper.call(); - } - }; - - // Used to load external javascript files into the DOM - $.cookiesDirective.loadScript = function(options) { - var settings = $.extend({ - uri: '', - appendTo: 'body' - }, options); - - var elementId = String(settings.appendTo); - var sA = document.createElement("script"); - sA.src = settings.uri; - sA.type = "text/javascript"; - sA.onload = sA.onreadystatechange = function() { - if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) { - return; - } - } - switch(settings.appendTo) { - case 'head': - $('head').append(sA); - break; - case 'body': - $('body').append(sA); - break; - default: - $('#' + elementId).append(sA); - } - } - - // Helper scripts - // Get cookie - var getCookie = function(name) { - var nameEQ = name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); - } - return null; - } - - // Set cookie - var setCookie = function(name,value,days) { - if (days) { - var date = new Date(); - date.setTime(date.getTime()+(days*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - } - else var expires = ""; - document.cookie = name+"="+value+expires+"; path=/"; - } - - // Detect IE < 9 - var checkIE = function(){ - var version; - if (navigator.appName == 'Microsoft Internet Explorer') { - var ua = navigator.userAgent; - var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); - if (re.exec(ua) != null) { - version = parseFloat(RegExp.$1); - } - if (version <= 8.0) { - return true; - } else { - if(version == 9.0) { - if(document.compatMode == "BackCompat") { - // IE9 in quirks mode won't run the script properly, set to emulate IE8 - var mA = document.createElement("meta"); - mA.content = "IE=EmulateIE8"; - document.getElementsByTagName('head')[0].appendChild(mA); - return true; - } else { - return false; - } - } - return false; - } - } else { - return false; - } - } - - // Disclosure routines - var disclosure = function(options) { - var settings = options; - settings.css = 'fixed'; - - // IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that - if(checkIE()) { - settings.position = 'top'; - settings.css = 'absolute'; - } - - // Any cookie setting scripts to disclose - var scriptsDisclosure = ''; - if (settings.cookieScripts) { - var scripts = settings.cookieScripts.split(','); - var scriptsCount = scripts.length; - var scriptDisclosureTxt = ''; - if(scriptsCount>1) { - for(var t=0; t < scriptsCount - 1; t++) { - scriptDisclosureTxt += scripts[t] + ', '; - } - - scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel; - } else { - scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel; - } - } - - // Create overlay, vary the disclosure based on explicit/implied consent - // Set our disclosure/message if one not supplied - var html = ''; - html += '
'; - html += '
'; - html += '
'; - - if(!settings.message) { - if(settings.explicitConsent) { - // Explicit consent message - settings.message = 'This site uses cookies. Some of the cookies we '; - settings.message += 'use are essential for parts of the site to operate and have already been set.'; - } else { - // Implied consent message - settings.message = 'We have placed cookies on your computer to help make this website better.'; - } - } - html += settings.message; - - // Build the rest of the disclosure for implied and explicit consent - if(settings.explicitConsent) { - // Explicit consent disclosure - html += scriptsDisclosure + settings.explicitCookieDeletionWarning; - html += settings.explicitFindOutMore + ''+ settings.privacyPolicyLinkText +'.'; - html += '' - html += '
' + settings.explicitCookieAcceptanceLabel + ' '; - html += '
'; - - } else { - // Implied consent disclosure - html += scriptsDisclosure + settings.impliedDisclosureText + ' ' + settings.privacyPolicyLinkText + '.'; - html += '
'; - } - html += '
'; - $('body').append(html); - - // Serve the disclosure, and be smarter about branching - var dp = settings.position.toLowerCase(); - if(dp != 'top' && dp!= 'bottom') { - dp = 'top'; - } - var opts = new Array(); - if(dp == 'top') { - opts['in'] = {'top':'0'}; - opts['out'] = {'top':'-300'}; - } else { - opts['in'] = {'bottom':'0'}; - opts['out'] = {'bottom':'-300'}; - } - - // Start animation - $('#cookiesdirective').animate(opts['in'], 1000, function() { - // Set event handlers depending on type of disclosure - if(settings.explicitConsent) { - // Explicit, need to check a box and click a button - $('#explicitsubmit').click(function() { - if($('#epdagree').is(':checked')) { - // Set a cookie to prevent this being displayed again - setCookie('cookiesDirective',1,365); - // Close the overlay - $('#cookiesdirective').animate(opts['out'],1000,function() { - // Remove the elements from the DOM and reload page - $('#cookiesdirective').remove(); - location.reload(true); - }); - } else { - // We need the box checked we want "explicit consent", display message - $('#epdnotick').css('display', 'block'); - } - }); - } else { - // Implied consent, just a button to close it - $('#impliedsubmit').click(function() { - // Set a cookie to prevent this being displayed again - setCookie('cookiesDirective',1,365); - // Close the overlay - $('#cookiesdirective').animate(opts['out'],1000,function() { - // Remove the elements from the DOM and reload page - $('#cookiesdirective').remove(); - }); - }); - } - - // Set a timer to remove the warning after 'settings.duration' seconds - setTimeout(function(){ - $('#cookiesdirective').animate({ - opacity:'0' - },2000, function(){ - $('#cookiesdirective').css(dp,'-300px'); - }); - }, settings.duration * 1000); - }); - } -})(jQuery); +/* Cookies Directive - The rewrite. Now a jQuery plugin + * Version: 2.0.1 + * Author: Ollie Phillips test + * 24 October 2013 + */ + +;(function($) { + $.cookiesDirective = function(options) { + + // Default Cookies Directive Settings + var settings = $.extend({ + //Options + explicitConsent: true, + position: 'top', + duration: 10, + limit: 0, + message: null, + cookieScripts: null, + privacyPolicyUri: 'privacy.html', + inlineAction: false, + scriptWrapper: function(){}, + // Styling + fontFamily: 'helvetica', + fontColor: '#FFFFFF', + fontSize: '13px', + backgroundColor: '#000000', + backgroundOpacity: '80', + linkColor: '#CA0000', + // Messages + multipleCookieScriptBeginningLabel: ' We use ', + and: ' and ', + multipleCookieScriptEndLabel: ' scripts, which all set cookies. ', + singleCookieScriptBeginningLabel: ' We use a ', + singleCookieScriptEndLabel: ' script which sets cookies.', + explicitCookieDeletionWarning: 'You may delete and block all cookies from this site, but parts of the site will not work.', + explicitFindOutMore: 'To find out more about cookies on this website, see our', + privacyPolicyLinkText: ' privacy policy', + explicitCheckboxLabel: 'You must tick the "I accept cookies from this site" box to accept', + explicitCookieAcceptanceLabel: 'I accept cookies from this site', + explicitCookieAcceptButtonText: 'Continue', + impliedDisclosureText: ' More details can be found in our', + impliedSubmitText: 'Do not show this message again', + }, options); + + // Perform consent checks + if(!getCookie('cookiesDirective')) { + if(settings.limit > 0) { + // Display limit in force, record the view + if(!getCookie('cookiesDisclosureCount')) { + setCookie('cookiesDisclosureCount',1,1); + } else { + var disclosureCount = getCookie('cookiesDisclosureCount'); + disclosureCount ++; + setCookie('cookiesDisclosureCount',disclosureCount,1); + } + + // Have we reached the display limit, if not make disclosure + if(settings.limit >= getCookie('cookiesDisclosureCount')) { + disclosure(settings); + } + } else { + // No display limit + disclosure(settings); + } + + // If we don't require explicit consent, load up our script wrapping function + if(!settings.explicitConsent) { + settings.scriptWrapper.call(); + } + } else { + // Cookies accepted, load script wrapping function + settings.scriptWrapper.call(); + } + }; + + // Used to load external javascript files into the DOM + $.cookiesDirective.loadScript = function(options) { + var settings = $.extend({ + uri: '', + appendTo: 'body' + }, options); + + var elementId = String(settings.appendTo); + var sA = document.createElement("script"); + sA.src = settings.uri; + sA.type = "text/javascript"; + sA.onload = sA.onreadystatechange = function() { + if ((!sA.readyState || sA.readyState == "loaded" || sA.readyState == "complete")) { + return; + } + } + switch(settings.appendTo) { + case 'head': + $('head').append(sA); + break; + case 'body': + $('body').append(sA); + break; + default: + $('#' + elementId).append(sA); + } + } + + // Helper scripts + // Get cookie + var getCookie = function(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; + } + + // Set cookie + var setCookie = function(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name+"="+value+expires+"; path=/"; + } + + // Detect IE < 9 + var checkIE = function(){ + var version; + if (navigator.appName == 'Microsoft Internet Explorer') { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) { + version = parseFloat(RegExp.$1); + } + if (version <= 8.0) { + return true; + } else { + if(version == 9.0) { + if(document.compatMode == "BackCompat") { + // IE9 in quirks mode won't run the script properly, set to emulate IE8 + var mA = document.createElement("meta"); + mA.content = "IE=EmulateIE8"; + document.getElementsByTagName('head')[0].appendChild(mA); + return true; + } else { + return false; + } + } + return false; + } + } else { + return false; + } + } + + // Disclosure routines + var disclosure = function(options) { + var settings = options; + settings.css = 'fixed'; + + // IE 9 and lower has issues with position:fixed, either out the box or in compatibility mode - fix that + if(checkIE()) { + settings.position = 'top'; + settings.css = 'absolute'; + } + + // Any cookie setting scripts to disclose + var scriptsDisclosure = ''; + if (settings.cookieScripts) { + var scripts = settings.cookieScripts.split(','); + var scriptsCount = scripts.length; + var scriptDisclosureTxt = ''; + if(scriptsCount>1) { + for(var t=0; t < scriptsCount - 1; t++) { + scriptDisclosureTxt += scripts[t] + ', '; + } + + scriptsDisclosure = settings.multipleCookieScriptBeginningLabel + scriptDisclosureTxt.substring(0, scriptDisclosureTxt.length - 2) + settings.and + scripts[scriptsCount - 1] + settings.multipleCookieScriptEndLabel; + } else { + scriptsDisclosure = setting.singleCookieScriptBeginningLabel + scripts[0] + settings.singleCookieScriptEndLabel; + } + } + + // Create overlay, vary the disclosure based on explicit/implied consent + // Set our disclosure/message if one not supplied + var html = ''; + html += '
'; + html += '
'; + html += '
'; + + if(!settings.message) { + if(settings.explicitConsent) { + // Explicit consent message + settings.message = 'This site uses cookies. Some of the cookies we '; + settings.message += 'use are essential for parts of the site to operate and have already been set.'; + } else { + // Implied consent message + settings.message = 'We have placed cookies on your computer to help make this website better.'; + } + } + html += settings.message; + + // Build the rest of the disclosure for implied and explicit consent + if(settings.explicitConsent) { + // Explicit consent disclosure + html += scriptsDisclosure + settings.explicitCookieDeletionWarning; + html += settings.explicitFindOutMore + ''+ settings.privacyPolicyLinkText +'.'; + html += '' + html += '
' + settings.explicitCookieAcceptanceLabel + ' '; + html += '
'; + + } else { + // Implied consent disclosure + html += scriptsDisclosure + settings.impliedDisclosureText + ' ' + settings.privacyPolicyLinkText + '.'; + html += '
'; + } + html += '
'; + $('body').append(html); + + // Serve the disclosure, and be smarter about branching + var dp = settings.position.toLowerCase(); + if(dp != 'top' && dp!= 'bottom') { + dp = 'top'; + } + var opts = new Array(); + if(dp == 'top') { + opts['in'] = {'top':'0'}; + opts['out'] = {'top':'-300'}; + } else { + opts['in'] = {'bottom':'0'}; + opts['out'] = {'bottom':'-300'}; + } + + // Start animation + $('#cookiesdirective').animate(opts['in'], 1000, function() { + // Set event handlers depending on type of disclosure + if(settings.explicitConsent) { + // Explicit, need to check a box and click a button + $('#explicitsubmit').click(function() { + if($('#epdagree').is(':checked')) { + // Set a cookie to prevent this being displayed again + setCookie('cookiesDirective',1,365); + // Close the overlay + $('#cookiesdirective').animate(opts['out'],1000,function() { + // Remove the elements from the DOM and reload page + $('#cookiesdirective').remove(); + location.reload(true); + }); + } else { + // We need the box checked we want "explicit consent", display message + $('#epdnotick').css('display', 'block'); + } + }); + } else { + // Implied consent, just a button to close it + $('#impliedsubmit').click(function() { + // Set a cookie to prevent this being displayed again + setCookie('cookiesDirective',1,365); + // Close the overlay + $('#cookiesdirective').animate(opts['out'],1000,function() { + // Remove the elements from the DOM and reload page + $('#cookiesdirective').remove(); + }); + }); + } + + // Set a timer to remove the warning after 'settings.duration' seconds + setTimeout(function(){ + $('#cookiesdirective').animate({ + opacity:'0' + },2000, function(){ + $('#cookiesdirective').css(dp,'-300px'); + }); + }, settings.duration * 1000); + }); + } +})(jQuery); diff --git a/conlite/backend_search.php b/conlite/backend_search.php index b6d5c2c..aeb740a 100644 --- a/conlite/backend_search.php +++ b/conlite/backend_search.php @@ -330,13 +330,9 @@ if( sizeof($_GET) == 0 && isset($_POST['save_search']) ) // STORED SEARCH HAS BEEN CALLED elseif( sizeof($_GET) > 0) { - $itemtypeReq = $_GET['itemtype']; - $itemidReq = $_GET['itemid']; - // Do we have the request parameters we need to fetch search values of stored search ? - if( (isset($itemtypeReq) && strlen($itemtypeReq)>0) && - (isset($itemidReq) && strlen($itemidReq)>0) - ) - { + $itemtypeReq = (isset($itemtypeReq))?$_GET['itemtype']:''; + $itemidReq = (isset($itemidReq))?$_GET['itemid']:''; + if(strlen($itemtypeReq) > 0 && strlen($itemidReq) > 0) { $searchResults = getSearchResults($itemidReq, $itemtypeReq); $sSearchStr_tmp = $searchResults[$save_title]; $iSearchID_tmp = $searchResults[$save_id]; @@ -403,13 +399,13 @@ if ($iSearchID_tmp > 0) { } // Date if ($sSearchStrDateType_tmp != 'n/a') { - if (($sSearchStrDateFromDay_tmp > 0) && ($sSearchStrDateFromMonth_tmp > 0) && ($sSearchStrDateFromYear_tmp > 0)) { + if (!empty($sSearchStrDateFromDay_tmp) && !empty($sSearchStrDateFromMonth_tmp) && !empty($sSearchStrDateFromYear_tmp)) { $sSearchStrDateFrom = $sSearchStrDateFromYear_tmp.'-'.$sSearchStrDateFromMonth_tmp.'-'.$sSearchStrDateFromDay_tmp.' 00:00:00'; } else { $sSearchStrDateFrom = ''; } - if (($sSearchStrDateToDay_tmp > 0) && ($sSearchStrDateToMonth_tmp > 0) && ($sSearchStrDateToYear_tmp > 0)) { + if (!empty($sSearchStrDateToDay_tmp) && !empty($sSearchStrDateToMonth_tmp) && !empty($sSearchStrDateToYear_tmp)) { $sSearchStrDateTo = $sSearchStrDateToYear_tmp.'-'.$sSearchStrDateToMonth_tmp.'-'.$sSearchStrDateToDay_tmp.' 23:59:59'; } else { $sSearchStrDateTo = ''; @@ -623,7 +619,9 @@ if (empty($where) || $iAffectedRows <= 0) { // fuer den ersten gefundenen Artikel die Werte fuer CategoryID und TemplateID merken if ($i == 0) { $iIDCat = $idcat; - $iIDTpl = $idtpl; + if(!empty($idtpl)) { + $iIDTpl = $idtpl; + } } /* Funktion zum umwandeln in Startartikel/normale Artikel*/ @@ -637,8 +635,10 @@ if (empty($where) || $iAffectedRows <= 0) { } } else { if( $startidartlang == $idartlang ) { + $sFlagTitle = i18n('Flag as normal article'); $makeStartarticle = "\"{$sFlagTitle}\""; } else { + $sFlagTitle = i18n('Flag as start article'); $makeStartarticle = "\"{$sFlagTitle}\""; } } @@ -703,7 +703,7 @@ if (empty($where) || $iAffectedRows <= 0) { } if ($perm->have_perm_area_action_item("con", "con_deleteart",$idcat)) { - $delete = "
$db->f('title')", "deleteArticle($idart,$idcat)")\" title=\"$sDeleteArticle\">\"$sDeleteArticle\"
"; + $delete = "
".$db->f('title')."", "deleteArticle($idart,$idcat)")\" title=\"$sDeleteArticle\">\"$sDeleteArticle\"
"; }else { $delete = ""; } @@ -717,8 +717,6 @@ if (empty($where) || $iAffectedRows <= 0) { $sTemplateName \"$sReminder\" - $properties - $tplconfig $duplicate $delete @@ -746,7 +744,7 @@ if (empty($where) || $iAffectedRows <= 0) { # Save Search Parameters ########################### -if($bHit && sizeof($_GET) == 0 && isset($_POST) ) { +if(!empty($bHit) && sizeof($_GET) == 0 && isset($_POST) ) { // Build form with hidden fields that contain all search parameters to be stored using generic db $searchForm = '