Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/27/2018 in all areas

  1. Presentation Originaly developped by Jeff Starr, Blackhole is a security plugin which trap bad bots, crawlers and spiders in a virtual black hole. Once the bots (or any virtual user!) visit the black hole page, they are blocked and denied access for your entire site. This helps to keep nonsense spammers, scrapers, scanners, and other malicious hacking tools away from your site, so you can save precious server resources and bandwith for your good visitors. How It Works You add a rule to your robots.txt that instructs bots to stay away. Good bots will obey the rule, but bad bots will ignore it and follow the link... right into the black hole trap. Once trapped, bad bots are blocked and denied access to your entire site. The main benefits of Blackhole include: Bots have one chance to obey your site’s robots.txt rules. Failure to comply results in immediate banishment. Features Disable Blackhole for logged in users Optionally redirect all logged-in users Send alert email message Customize email message Choose a custom warning message for bad bots Show a WHOIS Lookup informations Choose a custom blocked message for bad bots Choose a custom HTTP Status Code for blocked bots Choose which bots are whitelisted or not Instructions Install the module Create a new page and assign to this page the template "blackhole" Create a new template file "blackhole.php" and call the module $modules->get('Blackhole')->blackhole(); Add the rule to your robot.txt Call the module from your home.php template $modules->get('Blackhole')->blackhole(); Bye bye bad bots! Downloads https://github.com/flydev-fr/Blackhole http://modules.processwire.com/modules/blackhole/ Screen Enjoy
    9 points
  2. Today I had an idea and wanted to try out if that could work... A little later I had a little module as a working prototype and I want to share it with you to start some discussion: Idea: The idea is to have a simple interface that provides some helpers for copying/modifying/deleting elements in any HTML page. For now it is bundled to processwire but generally it would be possible to use this tool combined with any HTML that you provide. Why? I think that mockups can really speed up development and - maybe even more important - can also serve as a tool for better communication between us and our clients. There are several tools for this usecase but all that I know (like https://pencil.evolus.vn/ ) have a totally different look and feel than the final software has. So I thought why not use the look and feel of ProcessWire when developing something for ProcessWire? I've built some simple mockups sometimes with my browsers devtools and this works - but it is not really fast (and therefore not fun). Thats why I started this module today. Usage: After installation the module monitors your mouse and highlights all hovered elements inside the #main div. Then you have several keyboard shortcuts: c --> copy element r --> remove element arrow left --> previous sibling arrow up --> parent element arrow right --> next sibling arrow down --> first child e --> edit content with ckeditor ctrl + enter --> save edit Quite selfexplaining, isn't it? Roadmap/Vision: Save/Load For now the module does not save anything. You can modify content as you like and then do a screenshot, but of course it would be great to save your mockups somewhere. And continue work afterwards. Undo/Redo UI-Element Library It would be great to have a sidebar with common pw elements like inputfields and buttons to add via click to your mockup. Copy feature from other sites For example you could copy markup from any other website (like the UIKit docs) and paste that markup to your mockup. Or you could open another site in the pw backend that has UI elements that are similar to your needs and just copy them over. Use it with any HTML The module could be packed into a single JS file and then be used to modify any HTML content (like themes from themeforest or the like). This would be an awesome tool for creating quick mockups of any page, moving around elements, copying things, removing items, changing texts etc. Download: You can download the module here: https://gitlab.com/baumrock/RockMockup (have a look at the code, it's really really simple and everybody is welcome to contribute!) Use ProcessWire Kickstart for a One-Click-Installation: <?php $password = $this->randomPassword(); return [ 'pw' =>'https://github.com/processwire/processwire/archive/dev.zip', 'profile' => 'site-default', 'settings' => [ 'timezone' => 368, // vienna 'dbName' => 'yourdbname', 'dbUser' => 'root', 'dbPass' => $this->randomPassword(), 'admin_name' => 'youradminurl', 'username' => 'youradminusername', 'userpass' => $password, 'userpass_confirm' => $password, //'dbTablesAction' => 'remove', // overwrite existing tables? ], 'recipes' => [ function() { $this->msg('Installing RockMockup...'); $this->installModule('RockMockup', 'https://gitlab.com/baumrock/RockMockup/repository/master/archive.zip'); $this->succ('RockMockup installation completed'); }, ], ]; What do you think? Would you use such a tool? Do you maybe know any existing tools that do a similar thing?
    4 points
  3. What @BitPoet said. In other words, PHP is fast, MySQL is fast. So, there is no guarantee that you will have only 1 page created per second (your date), or even per microsecond! That leaves you with uniqueness dependent only on the customer ID ($client->CustomerCode). If you can guarantee that customer IDs are unique and that they only appear once per data set, (your JSON array) then you would be fine. The fact that you are getting a SQL error tells us that either your customer IDs are not unique and/or one customer ID is appearing more than once in your data set (i.e., it may be uniqe to the customer, but not the data set). If the database says so, then it must be so . Let me illustrate (non-unique customer ID and/or replicated customer ID): $clientCustomerCode = 12345;// replicating repeated use of customer ID $p = $pages->get(1722); for ($i=0; $i < 30; $i++) { // Create new page $new = new Page(); // Create unique hash {no guarantee this will be unique if same customer ID used} $unique = md5(date("Y-m-d H:i:s") . "-" . $clientCustomerCode); // even these (microseconds) do not guarantee uniqueness throughout #$unique = round(microtime(true) * 1000) . "-". $clientCustomerCode; #$unique = microtime(true) . "-". $clientCustomerCode; #$unique = microtime() . "-". $clientCustomerCode; echo $i . ': ' . $unique . '<br>';// display 'uniqueness'; you should see duplicates here // Set some variables for the new page //$new->setOutputFormatting(false);// not needed for a new page (I think) $new->template = "basic-page"; $new->parent = $p; // Create hash $new->title = "Title " . rand(5,15);// just for testing $new->name = $unique;// not really unique! // Save the page #$new->save();// you'll get PDO error here within a second } Using the above code, you'll be hit by the duplicate entry violation error within a second...
    3 points
  4. This week we’re back with a new dev branch version that adds a new feature we think you’ll like: focus point image cropping. That’s also the “focus” of this blog post. This version also includes resolutions to numerous issue reports and more. https://processwire.com/blog/posts/pw-3.0.89/
    2 points
  5. I missed the XML sitemap generator that I used in a previous CMS so I built my own module to achieve the same functionality. This module outputs an XML sitemap of your site that is readable by Google Webmaster Tools etc. I've generally found that it reduces the time it takes for new sites and pages to be listed in search engines using one in combination with Webmaster Tools etc (since you're specifically telling the service that a new site/new pages exist) so thought I may as well create a module for it. The module ignores any hidden pages and their children, assuming that since you don't want these to be visible on the site then you don't want them to be found via search engines either. It also adds a field called sitemap_ignore that you can add to your templates and exclude specific pages on a per-page basis. Again, this assumes that you wish to ignore that page's children as well. The sitemap is accessible at yoursite.com/sitemap.xml - the module checks to see whether this URL has been called and outputs the sitemap, then does a hard exit before PW gets a chance to output a 404 page. If there's a more elegant way of doing this I'll happily change the code to suit. Feedback and suggestions welcome On a slightly different note, I wanted to call the file XMLSitemap originally so as to be clearer about what it does in the filename, but if you have a module that begins with more than one uppercase letter then a warning containing only the module name is displayed on the Modules page, so I changed it to Sitemap instead which is fine as the description still says what it does. File can be downloaded via GitHub here: https://github.com/N.../zipball/master
    1 point
  6. Since I was stuck to my flat today I took up a wish and rolled a Process module / CKEditor plugin combo that adds @-autocomplete like the mentions here in the forum to CKEditor fields. It's configurable, but only in module settings for now, the positioning of the select list is quite off and there's still some visual work to be done, so it is in early alpha state. Nonetheless, if you want to take a look, here it is: https://github.com/BitPoet/ProcessMention After installation, you may want to look into the "Additional selector" entry in the module's settings. You will most likely want to limit results to certain templates there. Edit: Updated to version 0.0.30 with fixed positioning of the dropdown. Edit2: Settings are configurable in field context now. If pwmentions is enabled, the according settings are shown on the "Input" tab.
    1 point
  7. This link under the download section leads to this Processwire page and not to Github because the href value is empty.
    1 point
  8. That's what they always do. I would ask for 2nd or 3rd level support, first of all. Do they provide some sort of server health monitoring tools? It sounds like you don't have the necessary rights to install this yourself, but I'm sure your host uses something like that: http://www.dnsstuff.com/free-server-monitoring-tools
    1 point
  9. Sorry @Juergen I got my wires crossed here, I'm not using ->focus() at all. Just been messing about in the admin, I output just with: <?php // if page has single image field called 'featuredImage' if ($page->featuredImage) { // save some typing... $image = $page->featuredImage; // for demo purposes, don't leave this in! $options = array( "forceNew" => true ); $rec = $image->size(150, 75, $options); } ?> <div class="container py-5"> <div class="row"> <div class="col"> <img src="<?php echo $rec->url; ?>" /> <p> Changed width and height</br> Width: <?php echo $rec->width() . "px"; ?></br> Height: <?php echo $rec->height() . "px"; ?> </p> </div> </div> </div>
    1 point
  10. It's in my book, he uses GROUP BY on a similar table (with some output though, not an error). I think it's painfully clear I had no idea what GROUP BY does! Lol. However, thanks for the replies. I don't want to disable warnings, rather write decent code. @BitPoets explanation made things a lot clearer!
    1 point
  11. The cropping works now also fine in my case, the only difference is in outputting the coordinates. If it is an image array you can use $image->focus() but if your image is not in array you have to use $image->focus -> without brackets I was a little bit confused for the first time, because I have used a square crop and therefore the crop focus seems to be in center instead of the coordinates. So I wanted to check if the focus coordinates are still there. Therefore I have needed to output the coordinates.
    1 point
  12. From what I understand, you are attempting to group the resulting data by a column that is not unique; There are two entries of 222, which confuses mysql because it doesn't know which one to use for the group. Why are you wanting to group results of this particular query? I understand that you are learning sql, but this example isn't the best option to learn GROUP BY. [edit] @BitPoet replied. The only concern I have is disabling a warning rather than fixing an issue. I would rather use any_value(column_name) to tell mysql to pick one.
    1 point
  13. This means that your MySQL server is in strict mode regarding group by expressions. MySQL used to be rather lenient there, but normally standard SQL requires that you name all non-aggregate (SUM, COUNT, AVG etc.) columns that appear in the SELECT clause also in the GROUP BY expression. Since along version 5.6, the ONLY_FULL_GROUP_BY settings was enabled as a default, and nowadays many hosters and Linux distributions also set this flag in installations of 5.5. Your "SELECT *" include the columns id, member_name, member_id and member_score, so for MySQL it looks like: SELECT id, member_name, member_id, member_score FROM golfscores GROUP BY member_id LIMIT 0, 1000; To understand why MySQL complains, you have to understand what MySQL does under the hood: It scans through the member_id column (or its index) for all unique values. For any of the other columns, since they aren't in the group by, it picks the first value it finds in a row found in the first step. This means, in your example data, it might find a member_score of either 30 or 38 for member_id 222. Which one it finds first and returns is pure chance. Since the SQL standard desires predictability and doesn't like chance at all, such a behavior is unacceptable. Very few databases allow such a thing at all. On the other hand, if you, as the developer, know that mismatched rows like in your example cannot be found in the database (i.e. only one combination for id, member_name and member_score is in the table for each member_id), grouping just by member_name tells MySQL "don't worry about checking uniqueness and order of the other columns, just return the first hit for each member_id" and saves the database server (sometimes quite) a bit of lookup work for those columns. This is, of course, a bit dangerous. Thus, the ONLY_FULL_GROUP_BY setting was switched on at some point. You can switch it off per connection, or globally for all new connection through a SET statement, but these won't be persisted (PW does this every time it initializes a database connection). If you want to use that optimized group by syntax, the best way is to do it in my.cnf (the server configuration). Somewhere there, you will find line in the [mysqld] section with the sql_mode. Remove ONLY_FULL_GROUP_BY from that line. /* MySQL < 5.7.x */ sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY /* newer MySQL */ sql-mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY" Make sure to keep the format (underscore vs. dash, no quotes vs. double quotes) the same and restart the server.
    1 point
  14. Look very interesting, have you got a link to this in action? Sometimes wish the PW module pages had more screenshots/demos of the modules on offer.
    1 point
  15. Yep, coming soon - I have to get off the computer for now, but here is what it looks like. I'll try to commit later today. Do you think we want pixel or percentage widths? Do we want to make sure there is a enough room for all the digits, or do we want to make sure it fits on one line (which could be an issue with pixels if the phone field itself is maybe 33% (or less) of the row). Any thoughts? Settings: Input:
    1 point
  16. Just pushed a little update that makes the definition of recipes easier, see this sample: <?php $password = $this->randomPassword(); return [ 'pw' =>'https://github.com/processwire/processwire/archive/dev.zip', 'profile' => 'site-default', 'settings' => [ 'timezone' => 368, // vienna 'dbName' => 'yourdbname', 'dbUser' => 'root', 'dbPass' => $this->randomPassword(), 'admin_name' => 'youradminurl', 'username' => 'youradminusername', 'userpass' => $password, 'userpass_confirm' => $password, //'dbTablesAction' => 'remove', // overwrite existing tables? ], 'recipes' => [ function() { $this->msg('Installing RockMockup...'); $this->installModule('RockMockup', 'https://gitlab.com/baumrock/RockMockup/repository/master/archive.zip'); $this->succ('RockMockup installation completed'); }, ], ]; I also added this video to the first post to demonstrate how easy it is to use (I think all the screenshots may have made the impression that it is complicated)!
    1 point
  17. @Juergen works for me. Your $image is null, so check that you're on the right page/have the right field name.
    1 point
  18. Looks like your tmp (root if not a separate drive) partition is running out of space (error code 28 = No space left on device).
    1 point
  19. Good to hear you and your family are doing fine Ryan. As always nice solution for a problem which seems to resolved by fixed crops, but this is a way better UX for the content editors.
    1 point
  20. This week I got kicked out of my office, by weather, a furnace, and kids. So I don't have a blog post or a version update, though I do have a lot of work in progress that you'll see next week (including an item from last week's roadmap that I think you'll really like). It's been below freezing all week, and our furnace stopped working, so now there's no heat. Something called the heat exchanger cracked, and it looked like we were going to have to get a whole new furnace. But then we learned that the one we had was still under warranty, so the manufacturer is sending a new one, but it'll take a week to get here. Luckily we've got coats and a fireplace, but houses here in Atlanta really aren't built for the cold, so it's pretty frigid at a little over 50f (10c) indoors. I hadn't really planned on typing this much, but it's keeping my hands warm, so I'll keep going. It started snowing, which is something that doesn't happen often here. It was enough cold, snow and ice that the kids school was canceled for much of the week. So I've been having fun keeping an eye on them, but it's a challenge to keep a 7-year old and 4-year old occupied and away from TV. I grew up in Minnesota, so admittedly a part of me enjoys the cold and the snow. But unlike in Minnesota, snow in Atlanta pretty much shuts everything down. In this case, it's also been so darn cold that everyone is frozen after 10 minutes outside, so nobody wants to go out there. Today is the first day where things are starting to warm up, hopefully a trend. When I say the weather kicked me out of my office, I also mean literally. The day it snowed, water started dripping out of the office ceiling, right onto my head, which is... not what you want to see. There was no entry or access to the space in the ceiling for me to get up there and see what was going on. So I had to cut open the ceiling drywall to get up there and have a look. After making a big mess, I got up there and shined a flashlight around, the scene was surreal. It was a 2 foot high attic crawlspace full of snow, with some snowdrifts nearly a foot high. That answers the question of where the water came from… overhead lights produced heat, melted the snow, and it poured into the office. But how the heck did snow get into my ceiling? And how do I get it out of there before it all melts and destroys my office? As it turns out, the day it snowed was very windy. Structures around here have something called ridge vents at the peak of the roof. They run the length of the roof and vent hot air out during the summer. But if you get the right combination of wind and snow (like sideways and upwards blasting snow) it can get into the ridge vents, and into the attic… so I've learned. The conditions must have been perfect for it, because a whole lot of the snow got in. I've never seen anything like it, and hope I don't ever have to again. I ended up spending a day carefully crawling around on joists every 16-inches in those tight and completely dark quarters, trying to get the snow out of the ceiling and insulation. With a flashlight taped to my head, toting around buckets of snow on my hands and knees, I looked pretty ridiculous. Over a day I filled several big buckets full of snow and got it out of there. It was a pain to clear it out, but certainly much better than having it melt through my office ceiling. It's not been warm enough yet to know how much snow I missed (and will melt through), but with any luck, what's left will just evaporate. That was this week's adventures, which admittedly had nothing to do with ProcessWire, but that's why this isn't a blog post. Coming next week: a new PW version (with some exciting updates), a new blog post, and hopefully a new furnace.
    1 point
  21. Thanks for the report - i was missing a formatValue method which is needed by Lister. Please try the latest version and let me know how that goes for you.
    1 point
  22. Try adding this in site/config.php: $config->dbSqlModes = array( "5.5.0" => "remove:STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY" );
    1 point
  23. and finally this one: As you can see I was not able to fix this... Maybe you find some helpful informations in those posts though.
    1 point
  24. Hello BitPoet and others, don't know if this can help, but before few days in one project I need some solution to store repeatable urls, and build fieldtype "Repeats". It is very simple repeatable input (varchar/text) field (one of custom fields created thanks to Ryan Events module). I am sure that for you wouldn't be a problem to copy/paste/rename and create integer/float repeatable field. I had build many PW fields types but never had enough time to polish it and place in PW modules section. Regards. FieldtypeRepeats.zip EDIT: I read this topic again, and because these days I am mostly in "backend forms job", my first thought was that you need this for backend forms. Sorry for that. Please note - this field type is not for front-end forms - it is for backend/admin forms. Also, here is example how to get field values at front-end. // my first plan was to store few "link" details // because of that, need to call "value" // default foreach($page->field_name as $url){ echo $url->value;// note: "value" } // to get first row echo $page->field_name->first->value;
    1 point
  25. What you describe here is far, far away from what can be expected in a somewhat "normal" server / hosting setup. If you can share a link to such pages, we could have a look at it. Or you could do this yourself - open the same page you opened as PW admin in FF/Chrome "anonymous mode". You mentioned that IMagick is not allowed/installed on your server. Are you aware of any other server-side restrictions? Can you define custom settings via .htaccess, php.ini, user.ini or in php files with ini_set()? I'm afraid someone else has to look into this (relatively new) method and check if there are options...
    1 point
  26. Don't want to divert this thread, but I first got my feet wet with more advanced SQL stuff reading https://philip.greenspun.com/sql/index.html He used AOL server and Oracle, but the underlying principles and problems are similar in the entire DB-world I guess. And what's more, the guy was involved with really huge companies and lists some real-life problems and solution-approaches. Was kinda fun to read back in the day (the nerd-kind-of-fun). tl;dr: Just keep on learning, today there's a million times more learning opportunities than 30 yrs ago (free software, online tutorials/courses etc., cheap hosting, and faster internet than dialup...).
    1 point
  27. @Pixrael the summary is basically: Do a really bad job before with lots of foreach etc and then refactor everything to proper sql statements that join the related data together in a fraction of the time At least I'm on step two of "make it work, make it fast, make it pretty" Jokes aside: The background is that I have quite some performance issues with my CRM - there is an admin page that lists all projects and all their revenues. The revenues are themselfes pages with additional informations (like type of revenue (internal/external/etc), date and so on). This way it is possible to do all kinds of great stuff with that data (fake data here): Listing all those related items is not so easy, thats why I used regular PW api before, looping all projects, summing up all related revenues etc.; And of course that is terribly inefficient. But a lot easier than setting up SQL queries with joins, sum(), concat() etc... Since all the joins etc. are quite complex I created a little ProcessModule that will be part of my Datatables module (planned for this year) that lists the queries instantly, makes it possible to combine different views and - what stants out from regular sql tools - can interpret PHP. So you can for example create custom db views with variable setups: Resulting in this PS: Just realized that this topic went quite far from the initial title (best query for pages->find() ), so I'll change it. @adrian 's suggestion was of course on spot of the old thread title
    1 point
  28. thanks for your advice, so did) I wrote to Ryan, so he added to the release
    1 point
  29. Hi, It's better to put them in /site/modules/... in order to keep the additional symbols after each update. Also, you can normally add them via the backend.
    1 point
  30. Enable tags in your image field Set predefined tag "homepage". Get urls of marked images $pages = wire('pages')->find('myImageField.tags=homepage'); foreach ($pages as $page) { echo $page->myImageField->get('tags=homepage')->url; }
    1 point
  31. http://modules.processwire.com/modules/markup-social-share-buttons/
    1 point
  32. @tpr - just had a quick play with a protected property and selectors. Runtime properties only work with in memory page arrays, so you would have to do: $allResults = $pages->find("template=basic-page"); $notProtectedResults = $allResults->find("protected=0"); I think you already figured this out Anyway, that example works with the attached version. What are your thoughts on the best approach here? PageProtector.zip
    1 point
×
×
  • Create New...