Log in

View Full Version : $vbulletin-options[''] in array check not working


Nullifi3d
02-02-2006, 11:32 PM
I'm having a small problem. I'm installing vbulletin settings for my banner system over at webhostdebate, but when trying to store the mime allowable types in a vbulletin setting it fails to validate an image as an image.

Code that works:if (in_array($_FILES['banner']['type'], array('image/gif', 'image/png', 'image/jpg', 'image/jpeg', 'image/bitmap')))
Code that fails:if (in_array($_FILES['banner']['type'], array($vbulletin->options['banner_types']))) {
The settings banner types in vbulletin's settings is storing ['image/gif', 'image/png', 'image/jpg', 'image/jpeg', 'image/bitmap']. I'm not quite sure why this isn't working. I know the vbulletin->options variables are working properly in my script as there are many others referanced throughout. It's only in this array check that it fails. Anyone know why?

calorie
02-02-2006, 11:47 PM
Store the types as a space delimited list in settings:

image/gif image/png image/jpg image/jpeg image/bitmap

Then use the following bit in your PHP banner code:

if (in_array($_FILES['banner']['type'], explode(" ", $vbulletin->options['banner_types'])))

Nullifi3d
02-03-2006, 12:00 AM
thanks, that worked.