vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Decoding the privacy options (https://vborg.vbsupport.ru/showthread.php?t=277026)

squishi 01-15-2012 07:49 PM

Decoding the privacy options
 
I have create a page that lists all users albums. I have filtered out private albums.
Now it has come to my attention that public albums of members who have chosen to make all their albums private in the settings are listed on as well.

I can get the options of the vb_user table without problems.
But the privacy settings are encoded in some way.

Examples:
60295255
45096150

The albums have four privacy settings:
- Everyone
- Registered Members
- Your Contacts
- Your Friends

I will have to check the last three settings individually.
How can I check these settings, given the above privacy codes?
Maybe there's a vb function that could do this for me?

kh99 01-15-2012 08:35 PM

I'm not sure if it's what you need, but in includes/functions_album.php there are functions can_view_private_albums($userid) and can_view_profile_albums($userid). They tell whether the current viewing user is allowed to view private or profile albums of the given $userid. You could then read the state column of the albums table and if it's 'private' or 'profile', call the corresponding function to determine whether or not to display it. BTW, I got this from looking at album.php around line 1872, the section that starts with this code:

Code:

if ($_REQUEST['do'] == 'user')
{


so I haven't actually tried it out at all.

squishi 01-16-2012 06:15 AM

Yes. I've added the two can_view functions to the output while loop of my script.
But now the output stays empty. I also have doubts that the speed could be affected if I call these functions in a loop.
It would also be better for the database if I only queried the right albums, and not all of them. Let's say I query 20 albums, because they will fill up the page nicely. If 19 people have set their albums to private, the script would only output 1 album. The page would be almost empty.

So I need to already tackle this problem in the SQL query.

squishi 01-17-2012 05:54 PM

The can_view_private_albums() function will slow the page down, if the album permissions are not cached. I have no reason to believe that they are cached.
So showing 20 albums on the page will could add up to 20 additional queries.

--------------- Added [DATE]1326826973[/DATE] at [TIME]1326826973[/TIME] ---------------

Am I blind? Or is the can_view_private_albums() function missing a check to see if the user has set all albums to private (on the page "profile.php?do=privacy")?
Because that exactly is the issue on my forum: a member had a public album but had set all albums to be visible by friends only. Yet the album thumbnail was visible on the page.

Kolektor 10-15-2012 09:53 AM

Hi, is this successfully done? I wish to see how you've done it...


All times are GMT. The time now is 08:47 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01885 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete