JamesAB
09-26-2007, 01:53 AM
I'm currently looking at attachment.php and trying to give users different error messages based on the extension of the file they are downloading.
Here's the original:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
print_no_permission();
}
Now instead of calling print_no_permission(); first, I would like to give a customized error message.
I'd like to do something like this:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
if (in_array($extension, array('wmv', 'asx', 'asf', 'mpg', 'mpeg', 'mov', 'flv', '3gp', 'avi', 'zip')))
{
DO SOMETHING;
}
else
{
print_no_permission();
}
}
What do you suggest I use instead of print_no_permission();?
Thanks for your help.
--------------- Added at 05:05 ---------------
Okay. I did some searching and I think I solved it myself by adding a phrase called "my_no_permisission_videos" in the "Front-End Error Messages" section.
The new code looks like this:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
if (in_array($extension, array('wmv', 'asx', 'asf', 'mpg', 'mpeg', 'mov', 'flv', '3gp', 'avi')))
{
eval(standard_error(fetch_error('my_no_permisissio n_videos')));
}
else
{
print_no_permission();
}
}
Is this the best solution?
Here's the original:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
print_no_permission();
}
Now instead of calling print_no_permission(); first, I would like to give a customized error message.
I'd like to do something like this:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
if (in_array($extension, array('wmv', 'asx', 'asf', 'mpg', 'mpeg', 'mov', 'flv', '3gp', 'avi', 'zip')))
{
DO SOMETHING;
}
else
{
print_no_permission();
}
}
What do you suggest I use instead of print_no_permission();?
Thanks for your help.
--------------- Added at 05:05 ---------------
Okay. I did some searching and I think I solved it myself by adding a phrase called "my_no_permisission_videos" in the "Front-End Error Messages" section.
The new code looks like this:
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
{
if (in_array($extension, array('wmv', 'asx', 'asf', 'mpg', 'mpeg', 'mov', 'flv', '3gp', 'avi')))
{
eval(standard_error(fetch_error('my_no_permisissio n_videos')));
}
else
{
print_no_permission();
}
}
Is this the best solution?