Jump to content

Dennis Spohr

Members
  • Content Count

    42
  • Joined

  • Last visited

Posts posted by Dennis Spohr


  1. I have to reopen this thread, because I still have these problems.

    I am absolutely sure that my user-name is valid and unique.
    Still, if using $users->add($name) I'm getting a NullPage back, but just sometimes.
    I couldn't find a way to reproduce this error on our test-server.

    Our database is huge, we have some traffic and probably sometimes users are created nearly simultaneously (but definitely with unique names)
    Currently we have more than 150k user-accounts in the system.
    Do you think that could be a problem?

    The solution of @Noel Boss is interesting. How will the user-name be generated in this case?

    Any help is really appreciated! Thank you!


  2. I created a tool where users can design their individual landingpage. Lately users want to implement their own html- and/or javascript code, for example for loading an iframe or custom tracking codes.

    If I give them an textarea, where they can paste their custom html or javascript code - is this secure?
    I would use $sanitizer->text to prevent sql injections.

    But is this a safe way? I don't (really) know which code they would save (and load).

    I would like to get an idea and your thoughts.

    Thanks and greetings from Malta,
    Dennis


  3. Finally I was able to reproduce the problem on the clean install of ProcessWire. It seems to be a problem with a SelectOptions-FIeld, when no value is set.

    I did the following on the clean install:

    • Create a new SelectOptions-Field with some values in it.
    • Assign the field to a template
    • Create a new Page of this template using the API:
    $mypage = new Page();
    $mypage->template = 'basic-page';
    $mypage->parent = $pages->get(1);
    $mypage->title = 'TEST';
    $mypage->save();
    
    print ($mypage->id);
    • Copy the ID of the new page and do the following:
    $mypage = $pages->get(1042);
    $pages->clone($mypage);
    • While doing this I get this exception:
    Quote

    Error: Exception: Can’t save page 0: /test-1/: Call $page->of(false); before getting/setting values that will be modified and saved. [Page::statusCorrupted] fields: images, selectoptions (in D:\xampp\htdocs\pw-test\wire\core\PagesEditor.php line 515)

    selectoptions is the name of my SelectOptions-Field. Settings $page->selectoptions = ''; seems to create the same problem (no value set).

    I don't think this should be the expected behavior?


  4. I have another weird behavior on this.

    If I use $pages->clone($mypage) I get this error:

    Quote

    Exception: Can’t save page 0: /ma/.../video/: Call $page->of(false); before getting/setting values that will be modified and saved. [Page::statusCorrupted] fields: align, textalign, position

    Looks like somehow something is corrupt. But I don't have any idea why and how to fix it.


  5. Hi all,

    I have a weird behavior. I'm using the following code to clone one of my pages:

    $block = $salespage->children("id={$duplicate_id},include=all")->first();
    $block->of(false);
    
    if ($block && $block->id)
    {
      $newone = $pages->clone($block);
    }

    Problem: the page itself gets cloned, but on of the fields (a repeater) does not get cloned. It's empty.

    If I do the same in the ProcessWire-Admin via the PageTree, it works fine. The repeater-field gets cloned there as well.

    What could be the problem?

    Thanks,
    Dennis


  6. Looks like it doesn't have something todo with the server.

    I created a test-url for them (without /6 it works):
    https://www.coachy.net/seqtest/1/2/3/4/5/6

    Their support wrote the following (freely translated from German):

    Quote

    I just checked it again, after loading https://www.coachy.net/seqtest/1/2/3/4/5/6 the process get killed in .../site/assets/cache/FileCompiler/site/modules/ProCache/ProCacheMinifyHTML.php

    I can't do more and deeper debugging, because my following test-script works just fine:
    https://www.coachy.net/test/1/1/2/3/4/5/6/7/8/9/10/11/12/13/14

    There limits for the length of a request, but they are set to 2GB. In case of a server-limit, you would get a 500 error from Apache.

    I'm guessing it's either a problem with ProCache or with your .htaccess-File.

    For testing I removed the ProCache Module. Additionally I downloaded a clean .htaccess File (latest pw-version).

    I'm still getting the same error.


  7. Hi all,

    if my url has more than 6 url-segments it throws an 404 error. This happens just on my live-server, locally it works perfect. 

    I already set

    $config->maxUrlSegments = 15;

    Is there any PHP setting that can cause this behaviour? 
    I tried many things but got totally stuck now.

    Thanks for your help!
    Dennis


  8. I just did a test, but unfortunately it doesn't work somehow.

    I have the following code:

    if ($_FILES['thumbnail']['name'])
    {
    	$upload = new WireUpload('thumbnail');
    	$upload->setMaxFiles(1);
    	$upload->setOverwrite(true);
    	$upload->setDestinationPath($lesson->video_image->path());
    	$upload->setValidExtensions(array('jpg', 'jpeg', 'png'));
    
    	$lesson->video_image->removeAll();
    
    	foreach ($upload->execute() as $file)
    	{
                $original = $file;
                $options  = array('upscaling' => false, 'quality' => 100);
    
                $imageSizer = new ImageSizer($original, $options);
                $success    = $imageSizer->resize(500, 500);
    
                if ($success)
            	$lesson->video_image->add($original);
    	}
    }

    I always get this error:

    Quote

    Error: Exception: no valid filename passed to image inspector (in D:\xampp\htdocs\test\wire\core\ImageSizerEngine.php line 428)

     


  9. Hi all,

    in the backend of ProcessWire it's possible to define a maximum width and height for images. If you upload an image, it will be resized automatically. I find this feature very handy to safe space. Very often users upload images which are much bigger than needed.

    On my application users can upload their images via the frontend. But if you upload images using the API, images won't be resized automatically.

    Is there any way to do this?

    Currently that's my code:

    if ($_FILES['thumbnail']['name'])
    {
    	$upload = new WireUpload('thumbnail');
    	$upload->setMaxFiles(1);
    	$upload->setOverwrite(true);
    	$upload->setDestinationPath($lesson->video_image->path());
    	$upload->setValidExtensions(array('jpg', 'jpeg', 'png'));
    
    	$lesson->video_image->removeAll();
    
    	foreach ($upload->execute() as $file)
    		$lesson->video_image->add($file);
    }

    Thanks very much!

    Dennis

×
×
  • Create New...