![]() |
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.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.Luc |
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.Code: Content visible to verified customers only.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. |
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.Code: Content visible to verified customers only.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 |
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.Code: Content visible to verified customers only. |
Re: little problem with custom fields great!!! - I really prefer the official one... !!!!!! didn't test the ftp upload yet :eek: |
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. |
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