Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/27/2019 in all areas

  1. This version on the dev branch contains 26 commits (relative to 3.0.142) and is focused primarily in resolving reported issues, and we managed to cover 18 of them in this version. Thanks for the reports and help in our GitHub issues repo. This version represents about 2 weeks of work, and ProcessWire Weekly #284 has good coverage of those that occurred last week. More details about this week's updates can be also be found in the dev branch commit log. There are also some other minor additions and improvements in 3.0.143 as well. My favorite are the improvements to our logs system. It now collapses identical log entries that occur near each other. That means a single recurring log entry (like an error message) won't repeat indefinitely in the log and take up a lot of space. Now it just adds a counter to one log entry and updates the timestamp, rather than duplicating the entire log entry... Much more efficient. When you view a log in Setup > Logs, it identifies these collapsed log entries for you. In addition, the output in the "errors" and "exceptions" logs now have improved readability, isolating error messages and filenames from stack traces. Lastly, the ajax navigation in Setup > Logs now shows logs in newest-to-oldest (modification date) rather than alphabetical, which I find a lot more useful. The log at the top of the list is always the one most recently updated. For core updates in coming weeks, I'm primarily focused on preparing the current dev branch to merge to the master branch, as it's been awhile since the last merge and the master branch is itching for a new version. Most of you reading this already run on the dev branch, but there are many out there that also stick to the master branch, and with all the new stuff on the dev branch, I'd like to get our master up-to-date with this as well. Thanks for reading, have a great weekend!
    3 points
  2. A module created in response to the topic here: Page List Select Multiple Quickly Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page. The screencast says it all: https://github.com/Toutouwai/PageListSelectMultipleQuickly https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    2 points
  3. Attached files are updated. Keep in mind that home.php and one search.php are in views/ folder. Hi @All. I am making real estate website with map leaflet module. Please keep in mind that I do SEO and SEM and I am NOT an expert in PHP, so if you find anything that could be better or pit-a-pat, please, please fix and comment. Many tricks learned throw @OLSA coding so thank You my great friend. Explanation: I am using template/view folder for logic = separate code and design. Calls for my fields are included in files attached to the post. Hope you'll get the idea. what I have done All of this is preliminary code which will be speeded up but it is working. Not finished but must have: search button on the home if ajax is not working. _main.php file has: include('views/' . $page->template->name . '.php'); but it doesnt have any influence on this code. Just saying if I update this. So, here are parts views/home.php <?php $izdvojene = wire('pages')->find('template=property, state=featured|new, sort=-date, limit=6'); ?> <div id="sadrzaj"> <div id="rezultati"> <?php foreach($izdvojene as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> &euro;<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> </div> main-search.php which is called by ajax: <?php namespace ProcessWire; ?> <div id="rezultati"> <?php foreach($items as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> €<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> main.js // Ajax search and scrolling to the form function goToByScroll() { $('html,body').animate({ scrollTop: $("#glavna-pretraga").offset().top-200 }, 'slow'); } function ajaxLoaderClass(){ var container = document.getElementById( "sadrzaj" ); container.classList.toggle("loading"); } function ajaxSearch(){ goToByScroll; ajaxLoaderClass(); $.ajax({ type: "GET", url: 'search\/', data: $('#glavna-pretraga').serialize(), success: function(data){ goToByScroll(); $("#sadrzaj").empty().append(data); ajaxLoaderClass(); } }); } search.php <?php namespace ProcessWire; // other params $property_type = $sanitizer->text($input->get->property_type); $bedrooms_min = $sanitizer->int($input->get->bedrooms_min); $bedrooms_max = $sanitizer->int($input->get->bedrooms_max); $price_min = $sanitizer->int($input->get->price_min); $price_max = $sanitizer->int($input->get->price_max); $sq_min = $sanitizer->int($input->get->sq_min); $sq_max = $sanitizer->int($input->get->sq_max); $pid = $sanitizer->text($input->get->pid); $selector = array(); if($property_type){ $input->whitelist('property_type', $property_type); $property_type = $sanitizer->selectorValue($property_type); $selector[]= "parent=$property_type"; } if($bedrooms_min){ $input->whitelist('bedrooms_min', $bedrooms_min); $sq_min = $sanitizer->selectorValue($bedrooms_min); $selector[]= "bedrooms>=$bedrooms_min"; } if($bedrooms_max){ $input->whitelist('bedrooms_max', $bedrooms_max); $rooms = $sanitizer->selectorValue($bedrooms_max); $selector[]= "bedrooms<=$bedrooms_max"; } if($price_min){ $input->whitelist('price_min', $price_min); $price_min = $sanitizer->selectorValue($price_min); $selector[] = "price>=$price_min"; } if($price_max){ $input->whitelist('price_max', $price_max); $price_max = $sanitizer->selectorValue($price_max); $selector[] = "price<=$price_max"; } if($sq_min){ $input->whitelist('sq_min', $sq_min); $sq_min = $sanitizer->selectorValue($sq_min); $selector[]= "surface>=$sq_min"; } if($sq_max){ $input->whitelist('sq_max', $sq_max); $rooms = $sanitizer->selectorValue($sq_max); $selector[]= "surface<=$sq_max"; } if( $pid ){ $selector = array(); // reset selector $input->whitelist('pid', $pid); $pid = $sanitizer->selectorValue($pid); $selector[] = "pid=$pid"; } // search inside property items $selector[] = "template=property"; // search processing if( $config->ajax ){ // Ajax call $query = implode(',', $selector); $items = $pages->find( $query ); $items_count = $items->count; include('./main-search.php');?> <?php exit(0); } else { // is not Ajax call $selector[] = "sort=price"; $selector[] = "limit=10"; $query = implode(',', $selector); $items = $pages->find( $query ); $pagination = $items->renderPager(array( 'nextItemLabel' => "<span aria-hidden='true'>»</span>", 'previousItemLabel' => "<span aria-hidden='true'>«</span>", 'listMarkup' => "<ul class='pagination pagination-lg'>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}' class='btn btn-raised ripple-effect btn-default'>{out}</a>", 'currentItemClass' => "active" )); // did we find any matches? if( $items->count ){ $message = __("Showing results"); } } ?> Complete files attached with function.php were some functions are. All this files are in root folder (except js) of template. home.php main-search.php search.php main.js _func.php search.php
    2 points
  4. Hey gents, for your information, I just upgraded my profile to 3.0.143 and it is all back to normal (at least with the error 500 I had). Thanks to all of you and especially Ryan for fixing the issue.
    2 points
  5. Password is stored as a hash in the database. You cannot read it out. To set a new superuser (admin) password, put the following code in a template, or in your ready.php $users->get($config->superUserPageID)->setAndSave('pass', 'mynewpassword'); Don't forget to remove the code later.
    2 points
  6. Blog has only one hook, used in the backend, limited to save of a single blog post (addHookAfter) to set its blog published date (@note: this is NOT the PW published field but the blog pages date field) The following blog templates have URL segments enabled: Blog Archives (blog-archives) [virtual parent of blog archives; virtual since no real children; works becaue of URL Segments] Blog Authors (blog-authors) [virtual parent of blog authors; can also display multiple authors] Blog Comments (List) (blog-comments) [virtual parent of blog comments; can also display multiple comments] Blog Posts (blog-posts) [parent of posts; can also display all posts] Blog Tag (blog-tag) [a single blog tag] Cross-reference
    1 point
  7. Thanks Jens Martcsjh, I'm following both of your suggestions ;)
    1 point
  8. If you'd like to always use the latest dev, you can also do ProcessWire=https://github.com/processwire/processwire/archive/dev.zip
    1 point
  9. Here is a more detailed answer with the steps you have to take: Download the ProcessWire Zip (or use one of the other install methods) Unzip the file in your web root and rename it to the name how your project should be named Open Laragon control panel Click "reload" button for Apache This automatically creates a virtual host with the name of your folder like "processwire.dev" (I don't remember what is the default domain of Laragon, because I changed it to .localhost) You can then navigate in your browser to this URL You will see the ProcessWire installer and just have to follow the steps
    1 point
  10. Laragon is the best local Webserver for Windows. Good choice.
    1 point
  11. @teppo and @franciccio-ITALIANO This is exactly what I also replied here:
    1 point
  12. https://lmgtfy.com/?q=site%3Aprocesswire.com%2Ftalk+password+recovery+ryan&s=g&t=w
    1 point
  13. Hey, Not a direct answer to your question, but rather a suggestion for a better workflow, as I can see that you're getting yourself into a bit of a mess here – and I think it can all be avoided. This is apparent from the questions you've been posting lately, and as such I really think you should rethink your approach. Basically it seems to me that you're developing a site as a static HTML website, and then on each "server push" transforming it manually to a ProcessWire site, converting HTML files to PHP template files etc. What you really should be doing instead is developing the site locally as a dynamic one – this is pretty much the only workflow that will work well without going through a lot of manual work, or setting up a very complex and fragile transformation process. In other words: set up a local development environment using WAMP (or something similar), install ProcessWire on it, build the site, and then push it to the production server. This way you don't have to worry about any of this tricky transformation stuff, or the resulting stress. Yes, it may take a while to set up (an hour or two even, if you've never done this before) but it's absolutely worth it ? -- A more direct answer: I don't think that what you're suggesting will "hurt" ProcessWire in any way. If you only upload a new folder to the root of the site, that's fine – just be careful not to accidentally remove this directory yourself if/when you update ProcessWire ?
    1 point
  14. I haven't had the chance to see this in action yet, but looking at the code I'm wondering about one thing: at least in my case it's often important to know exactly when a particular issue first occurred, so that I can figure out what might've caused it – but if that initial occurrence is now removed, doesn't this make that process difficult, if not impossible? My initial thinking is that perhaps we should also store the timestamp for the first occurrence along with the counter data. That would, in my opinion, be an improvement over just logging the latest case along with a counter. While debugging a strange issue it's sometimes also helpful to know about the exact timestamps of all occurrences, but then we're basically back at not having this feature at all ? Overall I can see value in this, particularly from the UI point of view and for those cases where you're somehow spammed with a truckload of identical log entries, but I'm also a bit concerned that it could make debugging problems harder. As such, it might actually be a good idea to allow disabling this feature altogether; this way users could still opt-in for "full logging" instead if that works better for their workflow.
    1 point
  15. @gerritvanaaken, I created a module in response to your topic:
    1 point
  16. Hi, I noticed that started to get some spam comments on my site from IPv6 adresses, but unfortunately I cannot easily see from which addresses since IPv6 addresses get logged as 0.0.0.0. I found there is an (rather old) issue regarding this on Github: https://github.com/ryancramerdesign/ProcessWire/issues/1596 Is a fix regarding this on the roadmap? I would prefer not to use $_SERVER['REMOTE_ADDR'] or something similar. Thanks in advance! //Jasper
    1 point
  17. By default, the "Forgot Password" module is not turned on in v2.1. My thought was that lack of such a function is technically more secure (on any site or CMS). Why? Because having such a function active means your password is only as secure as your email (*though see note at end of this message). So I thought we'd start things out as secure as possible and let people adjust it according to their own need. But I'm rethinking that decision, and may change it to be 'on' by default. If you don't already have that "Forgot Password" module installed, it is relatively easy to reset your password with the API. Lets say that you lost the password for your account named 'admin' and you wanted to reset it. Paste this code into any one of your templates (like /site/templates/home.php in the default profile, for example): <?php $admin = $users->get('admin'); $admin->setOutputFormatting(false); $admin->pass = 'yo12345'; // put in your new password $admin->save(); …or if it's easier for you to copy/paste everything on one line, here's the same thing as above on one line: <?php $users->get("admin")->setOutputFormatting(false)->set('pass', 'yo12345')->save(); Replace "yo12345" with the new password you want and save the template. Then view a page using that template (like the homepage, in our example). The password for that account has now been reset, and now you are ready to login. Don't forgot to now remove that snippet of code from the template! Otherwise your password will get reset every time the page is viewed. Once logged in, here's how to install the Forgot Password capability: 1. Click to the "Modules" tab. 2. Scroll down to the "Process" modules. 3. Click "Install" for the "Forgot Password" module. That's all there is to it. You will now see a "Forgot Password" link on your login page. *ProcessWire's "Forgot Password" function is actually a little more secure than what you see in most other CMSs. Not only do you have to have the confidential link in the email, but the link expires in a matter of minutes, and PW will only accept password changes from the browser session that initiated the request. So an attacker would have to initiate the password change request and have access to your email at the same time, making it a lot harder for a man-in-the-middle snooping on your email.
    1 point
×
×
  • Create New...