Changeset 272

Show
Ignore:
Timestamp:
03/14/08 12:32:30 (9 months ago)
Author:
timh
Message:

v0.2 "Priavte Feed" plugin
Adds cryptic URL for a quasi-authenticated RSS feed
(basically lets you have autheticated RSS via an obscure URL)
Use with caution

(more fixes for walled garden use and to ensure all posts that the user has access to are included even if they are logged out)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • privatefeed/privatefeed.php

    r271 r272  
    66 
    77//let's include the basic stuff 
     8define("context","external"); 
    89require_once("../../includes.php"); 
    910 
     
    4142} 
    4243 
    43 // query the database directly: 
    44 $where=run("users:access_level_sql_where",$user_id); 
     44 
     45if (isadmin($user_id)) { 
     46    $where = ' 1=1 '; // allow admins to access any object 
     47} else { 
     48        if (empty($run_result)) { 
     49                $where = ''; 
     50        } else { 
     51                $where .= ' OR '; 
     52        } 
     53             
     54        $where .= " owner = " . $user_id . " "; 
     55        $where .= " OR access IN ('PUBLIC', 'LOGGED_IN', 'user" . $user_id . "') "; 
     56 } 
     57 
     58 
     59$communitieslist = array(); 
     60if ($communities = get_records_sql("SELECT u.* FROM ".$CFG->prefix."friends f 
     61                                   JOIN ".$CFG->prefix."users u ON u.ident = f.friend 
     62                                   WHERE u.user_type = 'community'  
     63                                   AND u.owner <> ".$user_id."  
     64                                   AND f.owner = ".$user_id)) { 
     65 
     66    foreach($communities as $community) { 
     67        $communitieslist[] = $community->ident; 
     68    } 
     69
     70if ($communities = get_records('users','owner',$user_id)) { 
     71    foreach($communities as $community) { 
     72        $communitieslist[] = $community->ident; 
     73    } 
     74
     75if (count($communitieslist) > 0) { 
     76    $communitieslist = array_unique($communitieslist); 
     77    if (!empty($where)) 
     78        $where .= " OR"; 
     79    $where .= " access IN ('community" . implode("', 'community", $communitieslist) . "') "; 
     80
     81 
     82 
    4583$where=str_replace("owner","wp.owner",$where); 
    4684$where=str_replace(")",") ",$where); 
     85 
    4786 
    4887if ($using_forum==true) {