Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. I don't think I ever tried to output html in messages in the existing message/error system, but with the new notifications system, it is easy: $this->user->notifications->message("Message Title")->html("Message details including a <a href=''>link</a>"); You will need to enable the new core notifications module.
  2. To be fair to WP, this is not a vulnerability with the core code, but rather an issue with a 3rd party plugin: http://codecanyon.net/item/slider-revolution-responsive-wordpress-plugin/2751380 I haven't read the details of the issue, so perhaps some stronger core code might have prevented this, but it doesn't matter how good the core code is, a plugin/module can be a vector for security issues in even the most secure core code.
  3. Just a quick comment - not sure if this is exactly the same problem or not: https://github.com/ryancramerdesign/ProcessWire/issues/663 I think there still needs to be some work done for a proper fix. If you think it is the same issue, would you mind commenting there, or if not, maybe post a new issue.
  4. I haven't used it, but take a look at this module: http://modules.processwire.com/modules/inline-editor/ Keep in mind that it is listed as a proof of concept. The other options which are much more mature, but not exactly inline, are: http://modules.processwire.com/modules/fredi/ http://modules.processwire.com/modules/admin-bar/ Hope that helps.
  5. Sorry about all that - shouldn't try offering advise with browser written code. This works fine for me: $page_id = (int) $input->post->select_product; // page ID $p = $pages->get($page_id); $template = $p->template->name; // this is the template where we will get the fields from // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; $form->attr("id+name",'subscribe-form'); // add the page's fields to the form $fields = $p->fieldgroup; foreach($fields as $field) { $inputfield = $fields->{$field->name}->getInputfield($p); $form->append($inputfield); } // add template name field to the form $field = $modules->get("InputfieldHidden"); $field->attr('id', 'Inputfield_template_name'); $field->attr('name', 'template_name'); $field->value = $template; $form->append($field); // append the field // add a submit button to the form $submit = $modules->get('InputfieldSubmit'); $submit->name = 'save_new_aanvraag'; $submit->attr("value", "Go"); $form->append($submit); // process the form if it was submitted if($this->input->post->save_new_aanvraag) { // now we assume the form has been submitted. // tell the form to process input from the post vars. $form->processInput($this->input->post); // see if any errors occurred if( count( $form->getErrors() )) { // re-render the form, it will include the error messages echo $form->render(); } else { // successful form submission $np = new Page(); // create new page object $np->template = $form->get("template_name")->value; // set template $np->parent = $pages->get('/aanvraag/'); // set the parent $np->of(false); // turn off output formatting before setting values $np->save(); foreach($np->fields as $f) { $np->set($f->name, $form->get($f->name)->value); } $np->save(); //create the page echo "<p>Page saved.</p>"; } } else { echo $form->render(); } The one thing missing is sanitizing of user input. You should read through: http://processwire.com/api/variables/sanitizer/ This is also a good read: https://processwire.com/api/variables/input/
  6. I think the building of the form the way you are doing should work, and I think it is, correct? But just for something a little cleaner, this is how I always do it: $p = $pages->get($page_id); // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; $form->attr("id+name",'subscribe-form'); $fields = $p->getInputfields(); foreach($fields as $field){ $form->append($field); } echo $form->render(); Now to the issue of the fields not being added to the new page: It shouldn't matter, but to be more obvious, I would call your new page: $np This should do what you need - you need to iterate through the fields of the new page. $np = new Page(); $np->template = $form->get("template_name")->value; // set template $np->parent = $pages->get('/aanvraag/'); // set the parent $np->of(false); // turn off output formatting before setting values foreach($np->fields as $f) { $np->set($f->name, $form->get($f->name)->value); } $np->save();
  7. That all sounds very cool, but I think you might avoid future issues with code changes by creating a module that hooks into the standard PW upload process, rather than having a custom upload form. Sorry, I don't have much time right now to investigate why the width is not being captured for your custom upload. Pagefile::install or InputfieldFile::processInputAddFile might be appropriate methods to hook.
  8. Hi Marc Here a few things I see that need fixing: $page_id = htmlspecialchars($_POST['select_product']); // page ID You should use (int) instead of htmlspecialchars - that is the safest way to sanitize a page id. You shouldn't overwrite $page, so change: $page = $pages->get($page_id); to: $p = $pages->get($page_id); I think you want: $template = $page->template; // this is the template where we will get the fields from to be: $template = $page->template->name; // this is the template where we will get the fields from That will mean that your hidden field is storing the name of the template, rather than the template object. Also, you are using: $form->processInput($this->input->post); But then still using: $p->template = $input->post->template_name; // set template when you could be using: $p->template = $form->get("template_name"); // set template Hopefully that should get things working for you, although it is only: $template = $page->template->name; that is critical.
  9. Hi @mrkhan and welcome to the forums. Not sure if it is the only issue, but the most obvious problem I see with your code is: $menu_page->page-tile You can't have dashes in field names, and I am also assuming it is the title of the page you are looking for. Have you tried: $menu_page->title
  10. Sorry, I forgot that notifications are still not enabled by default. That is a weird one You seem to be having the same issue as gebeer: https://processwire.com/talk/topic/8152-notice-undefined-index-searchfields-after-update-to-25-dev/?p=78973
  11. Looks like you are missing the notifications "bug", which shows the number of notifications. Click on it and the messages will collapse. Maybe do a hard reload to clear the browser cache - I am assuming a JS file needs updating, but just a guess.
  12. This is the bit in .htaccess that blocks access to files in the templates directory: # Block access to any PHP or markup files in /site/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ [OR] Which is why css, js etc work, but php, html, tpl, inc etc don't.
  13. Just wanted to let you guys know that I have submitted a PR to Ryan to fix this issue: https://github.com/ryancramerdesign/ProcessWire/pull/823 Along with this, I wanted to note somewhere (for now here, although I will probably write a PW SVG tutorial sometime soon) that if you want to embed SVGs into CkEditor RTE fields and be able to drag to resize them, you need to add the following to the "Extra Allowed Content" section on the Input tab of the field: img[alt,!src,width,height] This allows the img tags to have width and height attributes, which allows you to resize the image to a fixed number of pixels.
  14. Thanks for the code. Have you tried logging: $pagefile->url just before the if(!$pagefile->width) { just so you can know for certain what file it getting to that point. I am also wondering about this custom upload form - what does it actually do when the image is uploaded? Seems to me that it might be easier to hook into fileAdded (or similar) and make the changes that way, rather than replace the upload form entirely.
  15. I haven't followed through this completely, but in your last code example, you foreach($muzikanten as $muzikant) { but then you never do anything with $muzikant That doesn't seem right!
  16. @kd.quantum - firstly, sorry for the bad start to your PW experience. Firstly, can you please confirm the versions of PW and FormBuilder that you are running. Maybe there is a conflict there, if PW was updated, but FB wasn't. Looking at that error message, it is coming from line#176 of ProcessFormBuilder.module I get the feeling that since the ID is 0, that the (int) statement in that function might be converting a string or an empty value to the 0. Could you please try getting the value of $id before it has (int) applied - that might help us track down the issue a little better. Hopefully Ryan will get back to you shortly, but in the meantime, this info might help the rest of us to get you up and running again.
  17. Take a look at: https://github.com/ryancramerdesign/ProcessWire/blob/7b9730d43e6eda8bd27841a4811a1b9737bfe903/wire/core/Pageimage.php#L152 That is where the image dimensions are coming from. It is using the standard php getimagesize function. Unless you are uploading an SVG without width/height attributes, it should work fine if it is a legitimate image. I am actually just putting together a PR for sorting out the SVG image width issue and will send to Ryan tomorrow. Can you try inserting a debug statement in the getImageInfo function to check the filename it is working with is correct and to see whether $this->imageInfo is getting populated at this point. Also, can you explain your custom image upload - can you show us the code you have for it?
  18. Hi prototype and welcome to PW! What you are looking for is the PageTable fieldtype. It is in the core, but not installed by default, so go to Modules > Core and scroll down to ProFields: Page Table and install it. Even though it is tagged as a ProField, it is free and included by default with PW. Unfortunately we don't have any proper docs for this new fieldtype yet, but there are some good snippets of info throughout the forums: https://processwire.com/talk/topic/6546-pagetable-documentation/ https://processwire.com/talk/topic/8177-page-table-howto/ You should also take a look at the excellent extended version of it: http://modules.processwire.com/modules/fieldtype-page-table-extended/ Really opens up lots of great opportunities. Dive in and let us know if you need any specific bits of help.
  19. Just committed a small, but I think quite useful option. You can now choose to replace the SVG thumbnail in the admin page edit view with a rasterized version - primarily for speed of display. All the details about the image will still refer to the original SVG, and viewing the full sized version (in the lightbox) will still be the SVG. The reason I added this is that on one site we have been uploading many very complex SVGs and using the rasterize() API method to display them on the site. We still want the originals to be in SVG though so that resizing results in no loss of quality, and also so we can offer the SVG as a downloadable version. The problem was that during page edit, the SVGs were taking too long to render in the browser. Hope this helps others too.
  20. So I think what you are saying is that you need a different format for your site links (that is what google calls these links to sub pages). Not sure of the rules on this, but in my experience change the order of your title tag so it reads: About | Marinus de Beer - Spatial Design Using the pipe vs the dash is probably not critical, but I prefer it. Google should grab the "About" from that and use it for the site link for the about sub page. You should also make sure you have a sitemap.xml and register it with google webmaster tools. Remember that you won't see any changes in google's results until it reindexes your site, which could take hours to weeks depending on your site. Having all the pages of your site available in a sitemap.xml will help with this considerably. Here are a couple of links that might be worth reading (not really read thoroughly myself): http://honestppc.com/adding-sub-links-sitelinks-results-google-search/ https://support.google.com/webmasters/answer/47334?hl=en https://www.hochmanconsultants.com/articles/sitelinks.shtml
  21. No problem here on 2.5.10. Did you remember to configure Modules > Core > InputField > Page and SelectInputfieldSelectMultipleTransfer as an allowed Inputfield for Page selection, and save? See the instructions here: https://github.com/ryancramerdesign/InputfieldSelectMultipleTransfer EDIT: I don't know how I missed your edit at 4:50 when I posted at 5:00pm - oh well, glad you got it sorted regardless
  22. Thanks for this - awesome. I have used OpenWeather, but not yet with PW and will need to in the next few weeks, so this will be a big timesaver. Another nice set of icons that work seamlessly with OpenWeather are Skycons: http://darkskyapp.github.io/skycons/
  23. Sorry - I figured the lazycron was a typo - I should have phrased my comment as such I have another thought for you which I think is important. You are setting the status directly as statusHidden and StatusOn, but really you should be using addStatus and removeStatus to add/remove Page::statusHidden Otherwise you will override unpublished, locked etc.
  24. Google will use the content inside the page's <title></title> tags. There isn't anything you can do to change that, but you can change what goes in here in a PW template. eg: <title><?php echo $page->google_title; ?></title> assuming you have a field called "google_title" in the template for that page. Of course this will also be the title that is shown as the label for the tab in the user's browser as well, so bad choice of field name, but you get the idea Does that help?
  25. Looks very handy - thanks! A few minor comments: I don't see why it requires LazyCron I think you have the messages reversed - it says "Changed page status to 'hidden'" when it should say "visible" It would be nice if the message told you what page had its status changed I'd love to see this work via ajax, rather than a page refresh, or at a minimum, it would be great if the EDIT / VIEW etc links were turned on for that page after the reload I am not sure whether the obscurity of the tick/cross is really worth the reduced space usage - I would rather see hidden/visible, but maybe that's just me. Thanks again!
×
×
  • Create New...