PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |
Old August 13th, 2005, 11:44 AM   #1 (permalink)
Moderator
Verified Customer
 
Join Date: Aug 2005
Posts: 1,231
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

the line is:
Code:
Content visible to verified customers only.
hmmm... isnt fieldid supposed to be a number and not a string????

Luc
Luciano is offline  
Old August 14th, 2005, 02:48 PM   #2 (permalink)
Brian
Guest
 
Posts: n/a
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.
 
Old August 15th, 2005, 04:33 AM   #3 (permalink)
Moderator
Verified Customer
 
Join Date: Aug 2005
Posts: 1,231
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
Luciano is offline  
Old August 15th, 2005, 01:44 PM   #4 (permalink)
Brian
Guest
 
Posts: n/a
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.
 
Old August 17th, 2005, 12:35 AM   #5 (permalink)
Moderator
Verified Customer
 
Join Date: Aug 2005
Posts: 1,231
Re: little problem with custom fields

great!!! - I really prefer the official one... !!!!!!

didn't test the ftp upload yet
Luciano is offline  
Old September 14th, 2005, 02:00 AM   #6 (permalink)
Member
Verified Customer
 
Join Date: Nov 2005
Location: Southern Germany
Posts: 194
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.
Ramses is offline  
Old January 12th, 2006, 09:28 AM   #7 (permalink)
Registered User
Verified Customer
 
Zachariah's Avatar
 
Join Date: Nov 2005
Location: Canoga Park, CA
Posts: 3,243
Send a message via ICQ to Zachariah Send a message via AIM to Zachariah Send a message via MSN to Zachariah Send a message via Skype™ to Zachariah
Fixed and added
Zachariah is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Phrases in custom fields possible? Ramses How Do I? - vBulletin 3.5.X 6 February 20th, 2006 01:45 PM
Custom Fields Suggestions indiamike ReviewPost Suggestions 3 February 7th, 2006 06:21 AM
Rating custom fields cinq vBGallery Suggestions 0 March 27th, 2005 08:16 PM
Custom fields not being updated... KW802 Bugs From 1.0.0 2 December 22nd, 2004 11:15 PM


All times are GMT -5. The time now is 08:19 AM.

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