Jump to content

qubism

Members
  • Posts

    10
  • Joined

  • Last visited

  • Days Won

    1

qubism last won the day on August 16 2023

qubism had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Cologne, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

qubism's Achievements

Jr. Member

Jr. Member (3/6)

10

Reputation

  1. I'd like to introduce you to my newest employee: Devin
  2. Seems like the field isn't set up correctly. render() on null means the variable doesn't have a valid object or instance associated with it. You likely haven't added the field to your template. Go to Setup => Templates, add the "comments" field you just created to your template where you want them to appear.
  3. Hi lovely people, I'm currently using a JS cookie banner that saves data like (UUID, Categories, Date, Modified) in a cookie, on consent. GDPR wants me to keep track of those consents, "Proof of consent", so I created a Fetch Post Request in JS with a CSRF token & value that sends the request to a URL Hook in PW. In the hook itself, I check the current SessionID, CSRF Token and if the UUID is RFC 4122 compliant. Content of the cookie then gets sanitized & saved into a PW log. const response = await fetch(apiUrl, { headers: { 'X-Requested-With': 'XMLHttpRequest', }, credentials: 'same-origin', method: 'POST', body: formData, }); $this->addHook('/consent/', function ($event) { $sessID = session_id(); $ccCookieValue = $_COOKIE['cc_cookie'] ?? null; $sessCookie = $_COOKIE['wires'] ?? null; if ($this->session->CSRF->hasValidToken() && $ccCookieValue && $sessID === $sessCookie) { if (isValidUuid($uuid)) { $this->log->save('consent', "Consent Received from UUID: $consentUuid, Categories: $consentCatData, On Date: $consentDate, Last Modified: $consentUpdate"); } } }); That's the stripped down version of it. What's the best way to make the request in itself more secure? Or is it enough, cause it just gets posted in the log anyway? Thanks for your time!
  4. Hey friends, I'm currently building a new site and switched from CKEditor to TinyMCE, which works like a charm for now. One option I'm missing from CKEditor is setting the default Image Field when uploading something to the editor. Is there a workaround to achieve the same thing with TinyMCE? Maybe I'm blind and am just missing the option. Thanks a bunch!
  5. I tried that and also rawurlencode() and the API just uploads an blank image with the whole absolute url as filename. Most images work though, so I guess that's not the problem. Another option would be to check for special characters in the filename and skip that images, so ProcessWire at least doesn't throw an error. Not optimal, but still something
  6. Hey Girls & Boys, I'm currently importing data with some basic scraping from another page and adding new pages with the ProcessWire API. The data is mostly text which works fine but some images can't get downloaded from the other page. My guess would be due to the filename. Here's the Error: ProcessWire\WireException File could not be downloaded (https://************.com/content/v1/5e8119f5232766b98/1613689-FJ73MYGC/Außenansicht+2+Galerie.jpg) 400 Bad Request: (tried: curl) search My Code snippet (throws the error also without sanitizer): if($html->find('img.thumb-image', 0)->{'data-src'}) { $image = $html->find('img.thumb-image', 0)->{'data-src'}; $p->article_thumb = $sanitizer->url($image); } Is there a way to do this? Thanks for your time ? Edit: Found a solution. urlencode changed the whole URL and made the API upload empty images. So I kept the URL until the last slash and just changed the filename like so: $image = $html->find('img.thumb-image', 0)->{'data-src'}; $imageURL = $image; $pos = strrpos($imageURL, '/') + 1; $result = substr($imageURL, 0, $pos) . urlencode(substr($imageURL, $pos));
×
×
  • Create New...