The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Bitfield confusion
Hi there,
I'm trying to understand vBulletin's use of bitfields and this has confused me. If anyone can clear it up, I'd appreciate it: Code:
<group name="forumpermissions"> <bitfield name="canview" group="forum_viewing_permissions" phrase="can_view_forum" install="1,2,3,4,5,6,7">1</bitfield> <bitfield name="canviewthreads" group="forum_viewing_permissions" phrase="can_view_threads" install="1,2,3,4,5,6,7">524288</bitfield> <bitfield name="canviewothers" group="forum_viewing_permissions" phrase="can_view_others_threads" install="1,2,3,4,5,6,7">2</bitfield> <bitfield name="cansearch" group="forum_searching_permissions" phrase="can_search_forums" install="1,2,3,4,5,6,7">4</bitfield> <bitfield name="canemail" group="forum_viewing_permissions" phrase="can_use_email_to_friend" install="1,2,3,4,5,6,7">8</bitfield> <bitfield name="canpostnew" group="post_thread_permissions" phrase="can_post_threads" install="2,5,6,7">16</bitfield> <bitfield name="canreplyown" group="post_thread_permissions" phrase="can_reply_to_own_threads" install="2,5,6,7">32</bitfield> <bitfield name="canreplyothers" group="post_thread_permissions" phrase="can_reply_to_others_threads" install="2,5,6,7">64</bitfield> <bitfield name="caneditpost" group="post_thread_permissions" phrase="can_edit_own_posts" install="2,5,6,7">128</bitfield> <bitfield name="candeletepost" group="post_thread_permissions" phrase="can_delete_own_posts" install="2,5,6,7">256</bitfield> <bitfield name="candeletethread" group="post_thread_permissions" phrase="can_delete_own_threads" install="5,6">512</bitfield> <bitfield name="canopenclose" group="post_thread_permissions" phrase="can_open_close_own_threads" install="5,6">1024</bitfield> <bitfield name="canmove" group="post_thread_permissions" phrase="can_move_own_threads" install="5,6">2048</bitfield> <bitfield name="cangetattachment" group="forum_viewing_permissions" phrase="can_download_attachments" install="2,5,6,7">4096</bitfield> <bitfield name="canpostattachment" group="attachment_permissions" phrase="can_upload_attachments" install="2,5,6,7">8192</bitfield> <bitfield name="attachlimit" intperm="true" group="attachment_permissions" phrase="space_in_bytes_attachlimit">1</bitfield> <bitfield name="canpostpoll" group="poll_permissions" phrase="can_post_polls" install="2,5,6,7">16384</bitfield> <bitfield name="canvote" group="poll_permissions" phrase="can_vote_on_polls" install="2,5,6,7">32768</bitfield> <bitfield name="canthreadrate" group="post_thread_permissions" phrase="can_rate_threads" install="2,5,6,7">65536</bitfield> <bitfield name="followforummoderation" group="post_thread_permissions" phrase="follow_forum_moderation_rules" install="1,2,3,4,5,6,7">131072</bitfield> <bitfield name="canseedelnotice" group="forum_viewing_permissions" phrase="can_see_deletion_notices" install="5,6">262144</bitfield> <bitfield name="cantagown" group="post_thread_permissions" phrase="can_tag_own_threads" install="2,5,6,7">1048576</bitfield> <bitfield name="cantagothers" group="post_thread_permissions" phrase="can_tag_others_threads" install="2,5,6,7">2097152</bitfield> <bitfield name="candeletetagown" group="post_thread_permissions" phrase="can_delete_tags_own_threads" install="5,6">4194304</bitfield> <bitfield name="canseethumbnails" group="forum_viewing_permissions" phrase="can_see_thumbnails" install="2,5,6,7">8388608</bitfield> </group> 1, 524288, 2, 4, 8 I thought the generic method to go was: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc? |
#2
|
||||
|
||||
|
#3
|
|||
|
|||
Hi borbole,
I've read that article, I just want to know why the format of the forumpermissions goes 1, 524288, 2, 4, 8 when the generic method is to go 1, 2, 4, 8, 16 |
#4
|
|||
|
|||
You are correct, however, in terms of the XML file and the mechanics behind how vB parses the xml permissions data into a datastore array, the order doesn't matter. As long as the bitfield value is valid (and 524288 is), you won't run into problems.
From the looks of this, the reason that particular permission is placed out of order is for readability purposes; both 2 and 524288 deal with thread viewing permissions. |
#5
|
|||
|
|||
Ahh, thanks for that Danny!
I didn't even think of that... I knew it went off of the numbers rather than the actual order, but I didn't expect it to be for readability purposes. |
#6
|
|||
|
|||
It was added at a later stage, when 524288 was the first available number. For readability it was placed at that location in the XML file.
Keep in mind that all these values are already stored/used in the database (in case of an upgrade) so you can not simply renumber the options without also performing an upgrade of the values already in the database when upgrading a vB version. |
#7
|
|||
|
|||
Thanks Marco,
I wasn't planning on changing anything anyway; I'm just trying to learn about bitfields! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|