Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by horst

  1. No, it is called as server URL in the JS, with the initializing button click. ?!? And it runs as a simple PHP file in the apache server?!? I don't get really where you stuck. ? πŸ™‚
  2. As far as I could see, it uses no PHP, only .htaccess rules for apache. And there are other around that uses it, like @FireWire and @nbcommunication . Maybe we can ask them about their experiences? https://processwire.com/talk/topic/24230-7g-firewall-tweaks-required/
  3. The file source is included in my post. As I primary need to observe / check the GIT tree, what can be done without PW, I only connect to PW on demand from the PHP file. In my case the most of the time the SSE-PHP file is doing tasks outside PW. Check git tree, send keep-alive pings, etc. I think this is essentiell for not blocking a PW user account. Or, at least, early release of the PW session in the SSE PHP file.
  4. I once may have used it 4-6 years ago, if I remember correct. And if so, isn't there a mode where all notices flow as overlaying bubbles in the upper right of the window and then disappear?
  5. Maybe the 7G-Firewall htaccess rules do help? https://perishablepress.com/7g-firewall/ https://processwire.com/talk/topic/24230-7g-firewall-tweaks-required/
  6. Hey all. I have read a bit through all the posts here, got inspired and have changed my personal little local tool for live reloading from using ajax polling to use SSE. If you like, I can share my experiences and thoughts to some of the (somewhere) above mentioned problems. My setup is manually enabling / disabling SSE via a button. The SSE-php file does NOT use PWs system. It is complet solely, means it does not use (and maybe block) a users PW session. It uses the basic examples from MDN, as the JS do too. No special buffering, string_padding or the like is needed! I use h2 (HTTP2) protocol, what also needs https to run. (I'm not sure, but I think h2 is needed for not early disconnecting (and then start polling)). My polling loop on the server is every second. I send one keep-alive ping around every 15 to 20 seconds. In the one-second-server-loop I check if something has changed in the GIT tree, in comparison to the previous run. If so, I do an ajax call to PW, where my styles and scripts pre- and post processors are hosted (in a module). (It is similar then included in ProCache, but was coded earlier then that in PC.) They do a in-depth check and do recompile necessary files on demand and return if refresh is needed or not, what, only if true, gets pushed through to the client browser. I can work in the admin, I can work in the client, also with concurrent fetch/ajax calls while SSE is listening, etc. My PHP file is: My JS in browser is: Here is a screen, showing the network tab and console:
  7. In general, a main domain and a sub domain would be in separate sibling folders in a webservers disc space. Also the domains are unrelated siblings, nearly. Only thing I would do is ensure that the main domain only is reachable via www.example.com and NOT via example.com (without www.), so that any cookies from the main domain always rever to www.example.com host.
  8. SMTP is not IMAP. Maybe you can setup your SMTP server to send a copy into your desired subfolder, or simply use the BCC header with every outgoing email for that. see: https://www.socketlabs.com/blog/smtp-or-imap/
  9. @Val_0x42 Nice that it is working for you til that point. But your ajax processing lacks a bit of security. Actually you pass any submitted ID to get a page and add it to the page reference field. Best practice is to verify that it is a page with a correct template and parent page, etc, before you add it to the page reference field. Something like: <?php namespace ProcessWire; include( './index.php' ); $page_id = $input->get('pageid', 'int'); $status = $input->get('status', 'text'); $p = wire('pages')->get($page_id); // now check if it is a real page or a NullPage if(0 == $p->id) { return; // maybe early give up on none existing page? } else { // check for the right template if('your-sorceries-template-name' == $p->template->name) { // a check if it is located under the right parent page? If necessary then if('your-sorceries-parent-template-name' == $p->parent()->template->name) { // or check against a hard coded page ID of the parent page ? $method = $status == 'true' ? 'add' : 'remove'; $user->sorceries_checked->$method($p); } } }
  10. @bernhard At first glance this can work, but I need to do some thorough tests against different cases/situations/states a page and images can have. It's just the first shot that came to my mind: $page->getUnformatted('images')->find("created<{$page->modified}")
  11. Ok, I see. But I also every time use ProCache(d) sites and the authors do know that they can edit a page without changes on the front end as long as they do not save it. But I see, it isn't that "bullet-proof" I thought it is, (in the front end too). Thanks for pointing that out!
  12. Very interesting details, that I haven't known. So my use cases for getUnformatted("imagesField") is in template / frontend context only. I haven't had a need to use this in the admin, but definitely will note that down for when this use case may arise.
  13. Ha, that's what I use only and everywhere since a couple of years already. Because the code then is bulletproof, even if sometimes in the future a single image field need to be changed to a multiple one or vise versa. No changes in code are needed. First I thought to mention that too, but decided that it may be not close enough to the topic. So good that you brought it up! πŸ™‚
  14. I believe you are using a single images field, means the allowed amount of stored image is set to 1. If that is true, the scope where you calling it is important. Behind the scenes a single image field and a multiple images field are the same, they only behave different in template scope, where output formatting is set to true by default. For single image fields this reduces the code a bit so that you already act with a single image right after the field name. So in a function or method scope, this is not (cannot be) auto set to true, and your image field returns a collection from which you have to select the first item: $page->image_contact->first() So a working code then can be: if(0 < count($page->image_contact)) { $vcard->addPhoto($page->image_contact->first()->filename); }
  15. @Ivan Gretsky you are surely 95%+ right in what you say and I agree! Except I do not agree with that youth is a universal excuse. And I find it a little dissonant that someone can write such very carefully worded posts with tutorials on the one hand and not recognize some obviously insensitive statements on the other. But 95% or more consensus. πŸ™‚
  16. Thanks @ryan for answering detailed on all this. I have read the initial post this morning and found it quite ok at first to compare different (equivalent) systems. Since I had a very tight day today and still have, I have not read very carefully, but had to think again and again in between times to the post. And more and more I came to the conclusion that there must be some "slipped" something. Above all, a much too egocentric approach that has almost exclusively the needs of their own agency in mind and the like. I had planned this evening, when finished my day's work, to read again in more detail and to formulate my impression in a post. For example, I don't know the other CMS and especially didn't know about their licensing model. That's really a bummer not to mention that! During the day, I had thought that the OP had formulated something unfortunate insensitive. Now I could come rather to the impression, that consciously one tries to produce a pressure, which manipulates the development in a direction favorable for the own agency. So all personal preferences in the CMS available, but without "annoying license costs". Between buddies one would say "nice try", but that's not it at all.
  17. I got a lot of questions when reading the above last two posts. A) Why using a php file OUTSIDE of /site/templates ? B) Why using a file that needs to include PWs index.php? C) Why using RELATIVE URLs? (Sounds the worst decision to me) D) Then, why using jQuery? Is it used for other things on the site, or was it coming into play ONLY for the ajax action? A & B) The only reason why to use a external php file, should/would be be to process something OUTSIDE from PW. But when I need PWs internal processing, why leaving it (through the front door) and directly enter it again (through the backdoor)? I would create a template that is called, for example, "ajax", that has the family restrictions: only parent is home cannot have children can be used for ONE page the page can get the URL: /ajax/ The template file, that processes all ajax calls, is called ajax.php then, and is located under /site/templates/ajax.php. Also, when bootstraping PW, you need to declare its namespace at first: <?php namespace ProcessWire; include( PWs index.php ); Without namespace, all following PHP code cannot work properly! <-- HINT! C) The code ./ is the placeholder for the current URL a page lives under. The URL "./../somewhere/", when called on a page like https://example.com/subpage/ points to https://example.com/somewhere/. When I call it on the homepage, it points ABOVE the homepage, what is not possible. When I call it from https://example.com/subpage/subsubpage/ it points to https://example.com/subpage/somewhere/. This looks worse to me. Also, when reading in the code while developing, a URL ./../ doesn't tell me anything about its location, whereas a absolute URL like /site/templates/images/icon.svg does! This delivers more context that can be helpful in many cases. D) @Val_0x42 Do you already use jQuery on your site for other things then ajax? If not, you should use the modern Fetch Web-API that is native available in all modern browsers, what seems to be your target group. (Also, if you want or need to support old browsers like IE11, there are polyfills available for that too πŸ™‚). My suggestion not to use jQuery ajax but the Fetch API is, because you don't know no one of them yet and need to learn one. So, why learning an old thing, that comes with the disadvantage of an additional 150k+ JS lib download, when all the things are already available in the browser engines? Fetch API is future proof! A very detailed fetch request can look like this:
  18. Hi @Val_0x42, Yep, please ignore my suggestion or question. It is totally fine to use PWs user, maybe a role with only guest rights, but able to register and authenticate. With guest rights, they can see nothing in the backend. To the other points: I like to code old schooled. πŸ™‚ First send a complete form with checkboxes and submit button, so that it also will work without JS, or, more interesting today, when any early JS throws an error and it stops further execution. Then also a "modern page" maybe left unusable when the bound events cannot run, or even got not bound to the checkboxes, etc.. The next step for me would be to disable the submit button on DOMContentLoaded, collect all checkboxes and add a change event to them, for example: (code not tested, written in the browser) ... <form id='myForm'> <label for='i1234'><input id='i1234' type='checkbox' value='1234' /> YOUR CONTENT HERE </label> <label for='i1235'><input id='i1235' type='checkbox' value='1235' /> YOUR CONTENT HERE </label> <label for='i1236'><input id='i1236' type='checkbox' value='1236' /> YOUR CONTENT HERE </label> <label for='i1237'><input id='i1237' type='checkbox' value='1237' /> YOUR CONTENT HERE </label> <label for='i1238'><input id='i1238' type='checkbox' value='1238' /> YOUR CONTENT HERE </label> <input type="submit" name="submit" id="submit" value="SEND" /> </form> <script type='text/javascript'> document.addEventListener('DOMContentLoaded', function(event) { const myForm = document.getElementById('myForm'); myForm.getElementById('submit').style.display = 'none'; // or, for better A11y support, visibility = hidden, plus shrinking the sizes, or move it out of viewport const checkboxes = myForm.querySelectorAll('input[type="checkbox"]'); for(i = 0; i < checkboxes.length; i++) { // add on change event listener for each checkbox in the form: checkboxes[i].addEventListener('change', function(event) { // get the ID and the status (checked|unchecked) and send via AJAX to update the server. Done! :-) }); } }); </script> </body> </html> Hope that helps to get started. πŸ™‚
  19. Maybe this scenario can be starting point? Create a parent page that holds all items, each as a page. Create a parent page for visitors (users, but maybe not PW user?), that holds every visitor as a page. Create a page reference field for the items. Add this page reference field to the visitor template. Show the visitor a page with a normal HTML form, showing a regular checkbox for each item. On form submission, check which ones were selected and for each of that, add its ID to the page reference field of the current visitor. On a second visit of that visitor, you can present him/her the form with all collected items preselected (checked checkboxes). SO he/she is able to add and remove items to / from the collection. On form submission simply clear the old state of the reference field and build it up new. That's a raw starting point that has potential for additions and modifications. But for me it looks uncomplicated and straight forward for what you try to achieve, if I have understand it correct. πŸ™‚
  20. I believe you must use pathes, not URLs: $path = $this->wire('config')->paths('siteModules').'myModule/includes/'; ---------------------------------^
  21. This sounds that on the not proceeding servers something interferes with the post processing after save before the rename request was processed. Have you turned on $config->debug? Anything in the logs? The normal processing is save sends a post request, that is processed (successful or not) and then a GET redirect is invoked. So, there must be some unusual things happen when you do not get notified via admin messages.
  22. @fuzenco You may also use CURL, or maybe WireHttp, also a wrapper around CURL. BUt not really sure about wireHttp here! Otherwise the phpseclib for sftp is good to go, but maybe a bit to much overhead in this case, compared to CURL, if available? https://everything.curl.dev/usingcurl/scpsftp https://unix.stackexchange.com/questions/56261/automated-sftp-upload-with-curl
  23. Hi you all. May I ask a question? AFAIK SSE only works proper over HTTP2 protocol. Is there any working solution known from within the browsers JS to detect if the server supports or delivers in H2 ??
  24. Hi @ceberlin, can we go PM or phone tomorrow or this evening?
  • Create New...