Jump to content

jacmaes

Members
  • Posts

    285
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by jacmaes

  1. You should be able to use the "data-uk–*" prefix and have it pass the HTML validation. See the docs here, under the "Component usage" heading: https://getuikit.com/docs/javascript I understand that according to the spec, HTML5 custom data attributes should be prefixed as such, with "data-*": https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
  2. Like @Falk and @Macrura I sometimes have the same, forever-spinning loading behavior, especially with images that are at least larger than 3000 pixels.
  3. I've used the code on this tutorial for at least 4 or 5 sites, and it's rather easy to tweak for your needs. (You can pay for the full source code if you want to reward the developer for his work, but you don't have to: you can copy and paste the various parts needed).
  4. @Macrura thanks, I can confirm that I no longer have the issue after downloading the module from Github manually.
  5. @Macrura @Peter Knight so we have a pattern. I'm not the only one experiencing this issue then.
  6. @horst Yes, I've refreshed the modules a couple of times, and I've made sure to clear the cache (browser cache + "cache" folder in "assets"). I've tried on three different sites that are very similar, and same problem. @adrian Upgrading PW is indeed the only thing I did. Reverting back to the master branch fixes the issue immediately. My field setting is as such: And I'm calling the image this way: <img alt="<?= $page->title; ?>" src="<?= $page->image->first->getCrop('landscape')->url; ?>">
  7. Anyone using this module with the latest dev (3.051)? After updating from the master branch (3.042 at the time of writing), it no longer points to the full URL of the crops, i.e. URL in Master: "/site/assets/files/9168/death-of-a-fisherman.675x0-landscape.jpg" Truncated URL in Dev: "/site/assets/files/9168/" A modules refresh hasn't fixed this issue.
  8. Regarding the email validation, it works great... except when my client tried in on his fully updated iPhone 5, and somehow the session gets lost when he clicks on the link in the activation email he receives: he ends up with the initial default form (username + email), and he's stuck in a loop. I've been trying to reproduce it, but to no avail. He's using Safari, and not in Private Mode (which by the way does break the activation). Have you any of you guys run into this issue? Or have any clue what could be happening? Thanks in advance.
  9. I'm getting the following error on PW 3.045: Error: Uncaught Error: Call to a member function of() on boolean in /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module:187 Stack trace: #0 /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module(235): PasswordReset->resetPassword() #1 /home/my-domain/public_html/site/templates/password-reset.php(3): PasswordReset->controller() #2 /home/my-domain/public_html/wire/core/TemplateFile.php(268): require('/home/my-domain...') #3 /home/my-domain/public_html/wire/core/Wire.php(374): ProcessWire\TemplateFile->___render() #4 /home/my-domain/public_html/wire/core/WireHooks.php(682): ProcessWire\Wire->_callMethod('___render', Array) #5 /home/my-domain/public_html/wire/core/Wire.php(402): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #6 /home/my-domain/public_html/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) (línea 187 de /home/my-domain/public_html/site/modules/PasswordReset/PasswordReset.module)
  10. Ah, there's light at the end of the tunnel. Those annoying cookie banners required by a misguided 2012 European law might soon disappear. One less thing to implement...
  11. @szabesz you'll need to remove the line that I added to block attempts to scan Wordpress, or you won't be able to login: RedirectMatch 403 (?i)(wp-admin|wp-content|wp-login) But you can basically copy and paste from from the code from the original site: https://perishablepress.com/6g/
  12. @Macrura Here's what's above the PW directives in my .htaccess. Notice that I'm pointing explicitly to a 403 html file, right below the 6G directives: ErrorDocument 403 /403.html Start of .htaccess: # 6G FIREWALL/BLACKLIST # @ https://perishablepress.com/6g/ # 6G:[QUERY STRINGS] <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} (eval\() [NC,OR] RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR] RewriteCond %{QUERY_STRING} ([a-z0-9]{2000}) [NC,OR] RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR] RewriteCond %{QUERY_STRING} (base64_encode)(.*)(\() [NC,OR] RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)(.*)script(.*)(>|%3) [NC,OR] RewriteCond %{QUERY_STRING} (\\|\.\.\.|\.\./|~|`|<|>|\|) [NC,OR] RewriteCond %{QUERY_STRING} (boot\.ini|etc/passwd|self/environ) [NC,OR] RewriteCond %{QUERY_STRING} (thumbs?(_editor|open)?|tim(thumb)?)\.php [NC,OR] RewriteCond %{QUERY_STRING} (\'|\")(.*)(drop|insert|md5|select|union) [NC] RewriteRule .* - [F] </IfModule> # 6G:[REQUEST METHOD] <IfModule mod_rewrite.c> RewriteCond %{REQUEST_METHOD} ^(connect|debug|delete|move|put|trace|track) [NC] RewriteRule .* - [F] </IfModule> # 6G:[REFERRERS] <IfModule mod_rewrite.c> RewriteCond %{HTTP_REFERER} ([a-z0-9]{2000}) [NC,OR] RewriteCond %{HTTP_REFERER} (semalt.com|todaperfeita) [NC] RewriteRule .* - [F] </IfModule> # 6G:[REQUEST STRINGS] <IfModule mod_alias.c> RedirectMatch 403 (?i)(wp-admin|wp-content|wp-login) RedirectMatch 403 (?i)([a-z0-9]{2000}) RedirectMatch 403 (?i)(https?|ftp|php):/ RedirectMatch 403 (?i)(base64_encode)(.*)(\() RedirectMatch 403 (?i)(=\\\'|=\\%27|/\\\'/?)\. RedirectMatch 403 (?i)/(\$(\&)?|\*|\"|\.|,|&|&amp;?)/?$ RedirectMatch 403 (?i)(\{0\}|\(/\(|\.\.\.|\+\+\+|\\\"\\\") RedirectMatch 403 (?i)(~|`|<|>|:|;|,|%|\\|\s|\{|\}|\[|\]|\|) RedirectMatch 403 (?i)/(=|\$&|_mm|cgi-|etc/passwd|muieblack) RedirectMatch 403 (?i)(&pws=0|_vti_|\(null\)|\{\$itemURL\}|echo(.*)kae|etc/passwd|eval\(|self/environ) RedirectMatch 403 (?i)\.(aspx?|bash|bak?|cfg|cgi|dll|exe|git|hg|ini|jsp|log|mdb|out|sql|svn|swp|tar|rar|rdf)$ RedirectMatch 403 (?i)/(^$|(wp-)?config|mobiquo|phpinfo|shell|sqlpatch|thumb|thumb_editor|thumbopen|timthumb|webshell)\.php </IfModule> # 6G:[USER AGENTS] <IfModule mod_setenvif.c> SetEnvIfNoCase User-Agent ([a-z0-9]{2000}) bad_bot SetEnvIfNoCase User-Agent (archive.org|binlar|casper|checkpriv|choppy|clshttp|cmsworld|diavol|dotbot|extract|feedfinder|flicky|g00g1e|harvest|heritrix|httrack|kmccrew|loader|miner|nikto|nutch|planetwork|postrank|purebot|pycurl|python|seekerspider|siclab|skygrid|sqlmap|sucker|turnit|vikspider|winhttp|xxxyy|youda|zmeu|zune) bad_bot # Apache < 2.3 <IfModule !mod_authz_core.c> Order Allow,Deny Allow from all Deny from env=bad_bot </IfModule> # Apache >= 2.3 <IfModule mod_authz_core.c> <RequireAll> Require all Granted Require not env bad_bot </RequireAll> </IfModule> </IfModule> ErrorDocument 403 /403.html <FilesMatch "\.(js|css|html|htm|php|svg)$"> SetOutputFilter DEFLATE </FilesMatch> <ifModule mod_headers.c> Header set Connection keep-alive </ifModule> # ---------------------------------------------------------------------- # Expires headers (for better cache control) # ---------------------------------------------------------------------- <IfModule mod_expires.c> ExpiresActive on # Your document html ExpiresByType text/html "access plus 0 seconds" # Data ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds" # Favicon (cannot be renamed) ExpiresByType image/x-icon "access plus 5 days" # Media: images, video, audio ExpiresByType image/gif "access plus 1 week" ExpiresByType image/png "access plus 1 week" ExpiresByType image/jpeg "access plus 1 week" ExpiresByType image/webp "access plus 1 week" ExpiresByType image/svg+xml "access plus 1 week" # HTC files (css3pie) ExpiresByType text/x-component "access plus 1 month" # Webfonts ExpiresByType application/x-font-ttf "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType application/x-font-woff "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month" # CSS and JavaScript ExpiresByType text/css "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" </IfModule> ################################################################################################# # START PROCESSWIRE HTACCESS DIRECTIVES # @version 3.0 # @indexVersion 300 ################################################################################################# ....
  13. @bernhard I've used various versions of the firewall over the years (it's usually updated once a year), and while I ran into the occasional conflict a few years back, it's been solid ever since. I'm currently using it on a couple of Apache servers (Ubuntu 14.04 with the most recent version of Apache) on about 6 different PW-powered sites (both http:// and https://), and so far so good. I haven't run any specific test to measure its efficiency, but I see fewer traffic peaks from questionable sources and fewer errors in my logs. And it gives me an additional peace of mind to have this added layer of protection against bad actors. I've added this additional block as my logs showed persistent automated (and dumb) attempts to access Wordpress login or directories. # 6G:[REQUEST STRINGS] <IfModule mod_alias.c> RedirectMatch 403 (?i)(wp-admin|wp-content|wp-login) I don't think this really needs a module as it's a quick copy and paste operation, although it's true that releasing a module would raise awareness and more people would discover it. @Mike Rockett I'm certainly not a Regex expert, but if you look at the "Learn more" section, there are various articles over the years that show how some highly optimized regex rules can go a long way.
  14. Speaking of bad bot blockers, I've had great success with Jeff Starr's robust "6G Firewall" for Apache: https://perishablepress.com/6g/
  15. @horst, I've tried running your bootstrapped script to copy the variations (on PW 2.7.3), but it stops short: It collects the field and displays the crop settings correctly, but then does not iterate over all pages. Looks like it stops running after echo "<hr />"; Edit: tried a test run on another site, and it almost works. Problem is with str_replace that also replaces the domain name (see what I've marked in bold): 'Sorolla and America' sorolla-and-america-optimized.jpg pequeno /var/www/domain.com/site/assets/files/1228/pequeno_sorolla-and-america-optimized.jpg /var/www/domain.-pequeno.com/site/assets/files/1228/sorolla-and-america-optimized.-pequeno.jpg grande /var/www/domain.com/site/assets/files/1228/grande_sorolla-and-america-optimized.jpg /var/www/domain.-grande.com/site/assets/files/1228/sorolla-and-america-optimized.-grande.jpg destacado /var/www/domain.com/site/assets/files/1228/destacado_sorolla-and-america-optimized.jpg /var/www/domain.-destacado.com/site/assets/files/1228/sorolla-and-america-optimized.-destacado.jpg Edit 2: I've managed to fix my problem with a few tweaks, and all files were successfully copied. // now iterate over all pages and rename or copy the crop variations echo "<ul>"; foreach($wire->pages->find("include=all") as $p) { set_time_limit($timelimit); // reset the timelimit for this page foreach($collection as $fName => $suffixes) { if(!$p->$fName instanceof Pageimages) continue; $images = $p->$fName; if(0 == $images->count()) continue; echo "<li>{$p->title}<ol>"; foreach($images as $image) { echo "{$image->name}<ul>"; foreach($suffixes as $suffix) { $old = dirname($image->filename) . "/{$suffix}_" . $image->name; $new = str_replace($suffix . '_', '', $old); // These two lines are my tweaks $new = str_replace('.', '.-' . $suffix . '.', $image->name); $newer = dirname($image->filename) . "/" . $new; // $newer is the new $new below: echo "<li>$suffix<ul><li>$old</li><li>$newer</li></ul>"; if($doFilecopy) { if(!file_exists($old)) { echo "ERROR: original variation is missing!"; } else { if(file_exists($newer)) { echo "file already exists"; } else { $res = @copy($old, $newer); echo "filecopy: " . ($res ? "Success!" : "!ERROR: $res"); } } } echo "</li>"; } echo "</ul>"; } echo "</ol></li>"; if($debugIteration) break; } } echo "</ul>"; exit();
  16. Thanks a million for the detailed walk-through and the full script @horst! I wouldn't have been able to do this without your expertise. You even took the time to test your script, which makes me more confident. It never ceases to amaze me how helpful the PW community is. I'm sure this will help other people who, like me, would like to upgrade but were not sure how to. I'll definitely take the site down before launching the upgrade, and do a full backup of the site beforehand in case something goes wrong.
  17. @horst thanks a lot for your kind help. Being able to upgrade directly would be fantastic. My field is named simply "image" and its formatted value is set to "Automatic (single item or null when...)". Maximum files allowed is set to 0 (no limit). This is the only field in my site that's using the Thumbnails module. Here's a screenshot of the field settings that show that I have set three crops named "pequeno", "grande" and "destacado": And here's how I'm calling the "grande" crop variation in one of my templates: <img alt="<?= $page->title; ?>" src="<?= $page->image->first->getThumb('grande'); ?>"> An example of the filenames, original and output: Original: "spanish_fever.jpg" Output: "grande_spanish_fever.jpg" I hope this is all you need to give me some pointers. Thanks again.
  18. I have a few sites on PW 2.7 using the legacy Thumbnail module. I'd like to upgrade these sites to PW 3x (and the just-released PW3-compatible Croppable Image 3 module) to take advantage of the new goodness, but I'm not sure how best to proceed. I have easily more than a thousand pages that use the Thumbnail module. I think the safest way would be to create a new image field using Croppable as a fieldtype, and leave the current Thumbnails image field untouched as I can't possibly go and recrop thousands of images, especially on live sites. Anyone has tried upgrading? Any advice would be greatly appreciated.
  19. One of PW 3.010's major novelty was the introduction of Horst's new image resizing engine that uses ImageMagick. Now I understand that ImageMagick can convert images to Webp, the image format that Google says can reduce image size up to 34% compared to JPEG. Mozilla is apparently adding support to Firefox, and even the Safari team is playing with it, so it looks like Webp is soon going to be available in most major browsers. If Horst's module can be extended to add Webp conversion, that would be a great addition to PW's already very powerful image manipulation arsenal. I'm currently using the free ImageEngine Lite to serve Webp images to supporting browsers, and the results are impressive. I routinely get images that are between 25 and 60% smaller compared to JPEG, with the same visual quality. I would love to eliminate the need to rely on a third-party service though.
  20. Yep, same error. I managed to do what I wanted by adding after line 266 in "FrontendUser.module" the following code: $value = $field->value; $sanitizedValue = wire('sanitizer')->pageName($value); if ($value != $sanitizedValue) { $field->error('Your username cannot contain uppercase letters, spaces, accents or special characters.'); } But of course hacking the module is not the recommended way to proceed.
  21. Thanks, but when I tried $uname = $fu->form->get('username'); to retrieve the "username" field, I got a 500 Internal error on 3.0.18: Error: Uncaught Error: Call to a member function get() on null in /home/xxxx/public_html/site/assets/cache/FileCompiler/site/templates/register.php:34
  22. @pwFoo, can't get it to work. Could you please post a code sample? Edit: got it by creating a "test" field, but not sure how to apply the same code to the "username" field: $test = $modules->get('InputfieldText'); $test->label = $this->_('Test'); $test->attr('id+name', 'test'); $test->required = 1; $test->fhSanitizer = 'name'; $test->addHookAfter('processInput', function($event) { $currentField = $event->object; $value = $currentField->value; $sanitizedValue = wire('sanitizer')->pageName($value); if ($value != $sanitizedValue) { $currentField->error('Your username cannot contain uppercase letters, spaces, accents or special characters'); } });
  23. How do I check whether the user who wants to register has entered a username that does not contain accents, spaces, and any other characters that are not allowed? Can it be achieved server-side with a hook, or do we have to use something like "InputfieldPageName.js" from the core on the frontend? The issue I'm having is that if someone for example enters a space in his or her username, it will be converted into a dash (which they wouldn't realize unless we indicate it to them specifically), and they wouldn't understand why they can't log in after registering.
  24. I also have an Ubuntu droplet on Digital Ocean. After setting up the free Let's Encrypt SSL certificates, I have activated http/2 and everything runs smoothly. I haven't tweaked my sites to take full advantage of http/2, or run benchmarks to measure improvements though.
  25. Yep, we need a good and gifted soul to pick up this project and make it compatible with PW 3x. Or it could be extended to be the next Pro module (hint, hint, Ryan )
×
×
  • Create New...