[Risolto] aggio a 5.2.5, script non funzionante
-
ciao a tutti
dopo l'aggio a 5.2.5 non funziona piu' lo script che avevo messo x evitare il download delle img
lo script sta in includes/app.php:<?php /** * @package Joomla.Site * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ \defined('_JEXEC') or die; // Saves the start time and memory usage. $startTime = microtime(1); $startMem = memory_get_usage(); if (file_exists(\dirname(__DIR__) . '/defines.php')) { include_once \dirname(__DIR__) . '/defines.php'; } require_once __DIR__ . '/defines.php'; // Check for presence of vendor dependencies not included in the git repository if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_PUBLIC . '/media/vendor')) { echo file_get_contents(JPATH_ROOT . '/templates/system/build_incomplete.html'); exit; } require_once JPATH_BASE . '/includes/framework.php'; // Set profiler start time and memory usage and mark afterLoad in the profiler. JDEBUG && \Joomla\CMS\Profiler\Profiler::getInstance('Application')->setStart($startTime, $startMem)->mark('afterLoad'); // Boot the DI container $container = \Joomla\CMS\Factory::getContainer(); /* * Alias the session service keys to the web session service as that is the primary session backend for this application * * In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects * is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered * deprecated to be removed when the class name alias is removed as well. */ $container->alias('session.web', 'session.web.site') ->alias('session', 'session.web.site') ->alias('JSession', 'session.web.site') ->alias(\Joomla\CMS\Session\Session::class, 'session.web.site') ->alias(\Joomla\Session\Session::class, 'session.web.site') ->alias(\Joomla\Session\SessionInterface::class, 'session.web.site'); // Instantiate the application. $app = $container->get(\Joomla\CMS\Application\SiteApplication::class); // Set the application as global app \Joomla\CMS\Factory::$application = $app; // Execute the application. $app->execute(); ?> <script type="text/javascript"> $(document).ready(function() { $(document).bind("contextmenu",function(e){ return false; }); }) $(document).keydown(function (event) { if (event.keyCode == 123) { return false; } else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { return false; } else if (event.ctrlKey && event.shiftKey && event.keyCode == 74) { return false; } else if (event.ctrlKey && event.keyCode == 85) { return false; } else if (event.keyCode == 83 && (navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey)) { return false; } }); </script> <?php
capisco che non e' il posto ideale x metterlo ma se lo metto nel component gallery (com_eventgallery/) il component non funziona piu' probabilmente perche' non ha un vero e proprio main (o meglio non si capisce dove sta il main) ma una specie di file di config (config.php):
<?php /** * * DO NOT EDIT THIS FILE! CREATE AN OVERRIDE! * This file gets overwritten with every update. * * Place your custom settings in a file config_override.php in this folder to make sure those settings do not get lost with an update. * * To override settings from this file, you only need to define the constants like: * define('COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH', 1600); * * The override-file is called first, so there is no need to check for existing constant definitions before, * * @package Sven.Bluege * @subpackage com_eventgallery * * @copyright Copyright (C) 2005 - 2019 Sven Bluege All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die('Restricted access'); define('COM_EVENTGALLERY_ALLOWED_FILE_EXTENSIONS', ['jpg', 'gif', 'png', 'jpeg', 'webp', 'mp4']); define('COM_EVENTGALLERY_ALLOWED_MIME_TYPES', ['image/jpeg','image/gif','image/png','image/webp', 'video/mp4']); if (file_exists(JPATH_ROOT.'/components/com_eventgallery/config_override.php')) { require_once JPATH_ROOT.'/components/com_eventgallery/config_override.php'; } // defines the path to the image source folder if (!defined ('COM_EVENTGALLERY_IMAGE_FOLDER_PATH')) { define('COM_EVENTGALLERY_IMAGE_FOLDER_PATH', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'eventgallery' . DIRECTORY_SEPARATOR); } // define the path to the images on the webserver if (!defined ('COM_EVENTGALLERY_IMAGE_FOLDER_WEB_PATH')) { define('COM_EVENTGALLERY_IMAGE_FOLDER_WEB_PATH', 'images/eventgallery'); } // defines the path to the image cache folder if (!defined('COM_EVENTGALLERY_IMAGE_CACHE_PATH')) { define('COM_EVENTGALLERY_IMAGE_CACHE_PATH', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'eventgallery_generated' . DIRECTORY_SEPARATOR); } // defines the webpath to the cache directory if (!defined('COM_EVENTGALLERY_IMAGE_CACHE_WEB_PATH')) { define('COM_EVENTGALLERY_IMAGE_CACHE_WEB_PATH', 'images/eventgallery_generated'); } // Defines the image size which is used to copy images from Google Photos if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_IMAGE_SIZE_OF_COPY')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_IMAGE_SIZE_OF_COPY', 2400); } // defines the path to the google photos xml cache folder if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_CACHE_PATH')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_CACHE_PATH', preg_replace('/administrator[\/\\\\]+/', '', JPATH_CACHE . DIRECTORY_SEPARATOR . 'com_eventgallery_googlephotos' . DIRECTORY_SEPARATOR)); } // defines the path to the google photos xml cache folder if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_SHAREDPAGE_CACHE_PATH')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_SHAREDPAGE_CACHE_PATH', preg_replace('/administrator[\/\\\\]+/', '', JPATH_CACHE . DIRECTORY_SEPARATOR . 'com_eventgallery_googlephotos_sharedpage' . DIRECTORY_SEPARATOR)); } // defines the path to the flickr cache folder if (!defined('COM_EVENTGALLERY_FLICKR_CACHE_PATH')) { define('COM_EVENTGALLERY_FLICKR_CACHE_PATH', preg_replace('/administrator[\/\\\\]+/', '', JPATH_CACHE . DIRECTORY_SEPARATOR . 'com_eventgallery_flickr' . DIRECTORY_SEPARATOR)); } /** * If you upload images smaller than 2048px, this value must allow original images. * * 0 > 2049 * k == 2048 * h == 1600 * b == 1024 */ if(!defined('COM_EVENTGALLERY_FLICKR_MAX_IMAGE_SIZE')) { define('COM_EVENTGALLERY_FLICKR_MAX_IMAGE_SIZE', 2049); } // defines the path to the xml cache folder if (!defined('COM_EVENTGALLERY_GENERAL_CACHE_PATH')) { define('COM_EVENTGALLERY_GENERAL_CACHE_PATH', preg_replace('/administrator[\/\\\\]+/', '', JPATH_CACHE . DIRECTORY_SEPARATOR . 'com_eventgallery' . DIRECTORY_SEPARATOR)); } // maximum available image size This is used mostly for the images in the lightbox. if (!defined('COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH')) { define('COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH', 1600); } // defines the thumbnail sizes which are used for Amazon S3 and local images. Remember that you might have to // regenerate thumbnails. if (!defined('COM_EVENTGALLERY_IMAGE_THUMBNAIL_SIZES')) { define('COM_EVENTGALLERY_IMAGE_THUMBNAIL_SIZES', [48, 104, 160, 288, 320, 400, 512, 640, 720, 800, 1024, 1280, 1440]); } /** * Defines how long to cache Google results for images. Since the image urls are only valid for 60 minutes and sometimes we * get urls which are not new, we need to keep this value as short as possible. But also as long as possible to avoid too many requests * to the Google Servers. */ if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_IMAGE_CACHE_LIFETIME')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_IMAGE_CACHE_LIFETIME', 600); } if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_SHARED_PAGE_IMAGE_CACHE_LIFETIME')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_SHARED_PAGE_IMAGE_CACHE_LIFETIME', 86400); } /** * Defines how long we cache a list of albums. This value is used for the album selector in the back end. */ if (!defined('COM_EVENTGALLERY_GOOGLE_PHOTOS_ALBUMS_CACHE_LIFETIME')) { define('COM_EVENTGALLERY_GOOGLE_PHOTOS_ALBUMS_CACHE_LIFETIME', 300); } // defines the size of the cart thumbnails. if (!defined('COM_EVENTGALLERY_IMAGE_THUMBNAIL_IN_CART_WIDTH')) { define('COM_EVENTGALLERY_IMAGE_THUMBNAIL_IN_CART_WIDTH', 160); } // defines the size of the minicart thumbnails. if (!defined('COM_EVENTGALLERY_IMAGE_THUMBNAIL_IN_MINICART_WIDTH')) { define('COM_EVENTGALLERY_IMAGE_THUMBNAIL_IN_MINICART_WIDTH', 48); } // folder name for original images if (!defined('COM_EVENTGALLERY_IMAGE_ORIGINAL_SUBFOLDER')) { define('COM_EVENTGALLERY_IMAGE_ORIGINAL_SUBFOLDER', 'originals'); } // the content of the .htaccess file if (!defined('COM_EVENTGALLERY_IMAGE_PROTECTION_HTACCESS')) { define('COM_EVENTGALLERY_IMAGE_PROTECTION_HTACCESS', <<<CONFIG <FilesMatch "(?i)\.(jpg|gif|png|jpeg|webp)$"> Order Allow,Deny Deny from all </FilesMatch> <FilesMatch "(?i)\.(mp4)$"> Order Allow,Deny Allow from all </FilesMatch> CONFIG); } // the content of the web.config file if (!defined('COM_EVENTGALLERY_IMAGE_PROTECTION_WEB_CONFIG')) { define('COM_EVENTGALLERY_IMAGE_PROTECTION_WEB_CONFIG', <<<CONFIG <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Block Image Files" stopProcessing="true"> <match url=".*\.(jpg|gif|png|jpeg|webp)$" ignoreCase="true" /> <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Access to image files is denied." /> </rule> <rule name="Allow Video Files" stopProcessing="true"> <match url=".*\.(mp4)$" ignoreCase="true" /> <action type="None" /> </rule> </rules> </rewrite> </system.webServer> </configuration> CONFIG); } // the content of the index.html file if (!defined('COM_EVENTGALLERY_IMAGE_PROTECTION_INDEX_HTML')) { define('COM_EVENTGALLERY_IMAGE_PROTECTION_INDEX_HTML', "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>"); } // set the name of the image which is used for a redirect in case an image is not visible for the current user if (!defined('COM_EVENTGALLERY_IMAGE_NO_ACCESS')) { define('COM_EVENTGALLERY_IMAGE_NO_ACCESS', 'media/com_eventgallery/frontend/images/locked.png'); } if (!defined('COM_EVENTGALLERY_VIDEO_PLACEHOLDER_IMAGE')) { define('COM_EVENTGALLERY_VIDEO_PLACEHOLDER_IMAGE', 'media/com_eventgallery/frontend/images/video_placeholder.jpg'); } // defines the path to the google photos loading spinner. The name needs to be exactly gp.svg, but you can change the path. if (!defined('COM_EVENTGALLERY_GOOGLEPHOTOS_LOADING_IMAGE_PATH')) { define('COM_EVENTGALLERY_GOOGLEPHOTOS_LOADING_IMAGE_PATH', 'media/com_eventgallery/frontend/images'); } /** * Here you can find the codes for the fields. They are usually referenced like 2:05, * For this configuration, replace the colon with a hashsign. Make is a three-digit number. * * Example: The title if 2:05 in the reference, here you need to specify 2#005 * * https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#metadata-properties */ if (!defined('COM_EVENTGALLERY_IMAGE_METADATA_IPTC_FIELD_TITLE')) { define('COM_EVENTGALLERY_IMAGE_METADATA_IPTC_FIELD_TITLE', '2#005'); } if (!defined('COM_EVENTGALLERY_IMAGE_METADATA_IPTC_FIELD_CAPTION')) { define('COM_EVENTGALLERY_IMAGE_METADATA_IPTC_FIELD_CAPTION', '2#120'); }
che faccio?
-
J jabba ha spostato questa discussione da Domande generiche su Joomla!
-
grazie dello spostamento e dell'aiuto
attivando il debug di Joomla non saltano fuori errori ma mi prende in giro nel senso che col debug lo script funziona senza debug non funziona
-
@jabba ha detto in aggio a 5.2.5, script non funzionante:
Secondo me è un problema di cache
e' la prima cosa che ho pensato ma le cache le ho pulite tutte
si puo' anche' escudere il server perche' in locale e' idem
e non e' il template: con cassiopeia e' ugualeora ho fatto la prova di mettere un alert nel codice:
<script type="text/javascript"> alert('kkkkkkkkkkkkkkkkkkkkk'); debugger; $(document).ready(function() ............... {
ebbene senza debug l'alert non esce, quindi li' non ci passa
ma con il debug l'alert esce e lo script funzionae come se dopo l'aggio il "flusso" prendesse un'altra strada, la cosa strana e' che col debug inserito tutto funziona
-
mentre mettendo un echo nella parte php di app.php
esce fuori questo:
il che' puo' anche' essere: li' il sito ancora non esiste
ma ce la conferma che passa per app.php ma non vede lo script -
ok tutto apposto
ho spostato lo script dentro la gallery e funziona, cosi' e' pure meglio
risolto -
a posteriori forse il problema era che con gli aggio di sicurezza avendo messo codice "alieno" nel core veniva saltato
... si' sarebbe interessante capire se col debug deve andare cosi' o nochissa' perche' a posteriori e' sempre tutto chiaro ...bah
grazie di tutto