PhotoPost Community

PhotoPost Community (http://www.photopost.com/forum/)
-   Bugs - vBulletin 3.5.X (http://www.photopost.com/forum/bugs-vbulletin-3-5-x/)
-   -   little problem with custom fields (http://www.photopost.com/forum/bugs-vbulletin-3-5-x/118956-little-problem-custom-fields.html)

Luciano August 13th, 2005 10:44 AM

little problem with custom fields
 
I seem to get a an error when i use a required custom field.

I have a multiple options, multiple choices custom checkbox field

I set it to required.

the user shood specify if the pic contains nudity or not (for over 18 gallery)

if the users clicks a checkbox and uploads... everything is ok...

if he forgets to check one box and uploads.. the pic is still uploaded (it shouldn't as the field is required) and the page has following error:

Parse error: parse error, unexpected T_STRING in /home/sunmodn/public_html/vb/vb/includes/functions_gallery_imageedit.php(470) : eval()'d code on line 1

did I do something wrong???
________________
Edit:
actually the error line is:
Code:

Content visible to verified customers only.
also i get following error in upload.php
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /gallery/upload.php on line 362
ok.. its only a warning :cool:

the line is:
Code:

Content visible to verified customers only.
hmmm... isnt fieldid supposed to be a number and not a string????

Luc

Brian August 14th, 2005 01:48 PM

Re: little problem with custom fields
 
If you'll look in your functions_gallery_imageedit.php file for this code:
Code:

Content visible to verified customers only.
And replace with this:
Code:

Content visible to verified customers only.
Then that should take care of the problem with custom fields.

I can't seem to reproduce the second error, but if you'd like to submit a support ticket I'll be glad to take a look at that one for you.

Luciano August 15th, 2005 03:33 AM

Re: little problem with custom fields
 
Thx brian
that worked as always.

as for the second problem.. it really exists and I found a workaround myself..
its not very elegant.. but it works.. which for me is the main thing..

to reproduce the warning:
you create a required customfield with 5 options.. in each option 3 to 4 words of text.

at upload.. you upload 2 pictures and select the checkboxex of 2 of the options (any of the options). you get the warning when you get to the editpage where you can change some parameters for each picture...
-------------------------------


First it is not an error, but a warning... which means i could turn it off in php... maybe it is not seen when warnings are switched off in php..

but i wanted to get rid of it and so i did some reading.. code and php.net..

the problem with the line of code above.. is, that in the case of custom fields being multiple checkboxes with longer descriptions, the variable $_POST["field$customfield[fieldid]"] is neither an integer nor a string... but it is an Array. You get that warning when you use htmlspecialchars() on an Array...

One solution would be to just take out the htmlspecialchars() but then.. if you use quotes or other signs in you optionfields it wouldnt be to good...

the solution i found is just to check if $_POST["field$customfield[fieldid]"] is an array.. if yes.. i htmlspecialchars() the elements of the array.. if it is not an array.. i just use the normal htmlspecialchars() function.

so what I did:
i found in upload.php:
Code:

Content visible to verified customers only.
and replaced it with
Code:

Content visible to verified customers only.
I hope there is no security drawback... but i do not think so...
And yes I know the ifs-else could be cut down in a nested shorthandcode with "..? ..:..; but this way its clearer to understand..
the function is not in the functionsfile because it is only used here...


Luciano

Brian August 15th, 2005 12:44 PM

Re: little problem with custom fields
 
Thanks for going into more detail. The reason I wasn't getting the error was because I was only uploading one image at a time. I believe your fix is going to cause problems when you try to upload multiple and have multiple pages with the FTP upload options. For the official fix though, just look in your gallery/upload.php file for this code:
Code:

Content visible to verified customers only.
And replace with this:
Code:

Content visible to verified customers only.

Luciano August 16th, 2005 11:35 PM

Re: little problem with custom fields
 
great!!! - I really prefer the official one... !!!!!!

didn't test the ftp upload yet :eek:

Ramses September 14th, 2005 01:00 AM

Re: little problem with custom fields
 
Hm, we seem to have everytime the same problems Luciano ;)
Also had the htmlspecialchars() expects parameter 1 to be string, array given in /gallery/upload.php on line 362 Error, after changing as Brian described the ftp upload is fine.

Zachariah January 12th, 2006 08:28 AM

Fixed and added


All times are GMT -5. The time now is 06:47 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97