Changeset 1403

Show
Ignore:
Timestamp:
03/08/07 21:01:46 (2 years ago)
Author:
jm3
Message:

functions for getting all your peeps vs just the peeps who also have you as a peep

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/modules/utils.inc.php

    r1400 r1403  
    1111define( "IDLENESS", 1 ); 
    1212define( "SPAMMING", 2 ); 
     13 
     14function has_me_as_a_peep( $them, $me ) { 
     15        $their_peeps = array_to_hash( get_xml_cachelist( get_contacts_file( $them ))); 
     16        if( $their_peeps[$me] ) 
     17                return true; 
     18        else 
     19                return false; 
     20} 
     21 
     22function get_full_peeps( $user ) { return get_full_peeps_driver( $user, 0 ); } 
     23function get_full_peeps_reciprocal( $user ) { return get_full_peeps_driver( $user, 1 ); } 
     24 
     25function get_full_peeps_driver( $user, $reciprocate ) { 
     26        if( ! $user ) 
     27                return; 
     28        $peeps = get_contacts( $user ); 
     29        if( $reciprocate ) 
     30                foreach( $peeps as $peep => $useless) 
     31                        if( ! has_me_as_a_peep( $peep, $user )) 
     32                                unset( $peeps[$peep] ); # remove people who don't have US as a peep: 
     33 
     34        $q = run_query( getQuery( "full_peeps", $peeps )); 
     35        return $q; 
     36} 
    1337 
    1438function get_imported_link_and_comment( $raw_name ) { 
     
    15411565  </td> 
    15421566</tr> 
    1543 <% 
     1567<?php 
    15441568      return ob_get_clean(); 
    15451569    } 
     
    23492373      LEFT JOIN links_tags_xref ON links.ID = links_tags_xref.linkID WHERE links_tags_xref.linkID IS NULL "; 
    23502374   
     2375        } else if( $argWhichQuery == "full_peeps" ) { 
     2376                $peeps = $args[1]; 
     2377                $where_clause = ""; 
     2378                foreach( $peeps as $peep => $useless) { 
     2379                        $peep = urlencode( $peep ); 
     2380                        $where_clause .= " userid = '$peep' OR"; 
     2381                } 
     2382                $where_clause = preg_replace( "/OR$/", "", $where_clause ); 
     2383                return " 
     2384                SELECT userid, email, im FROM users WHERE $where_clause;"; 
     2385 
    23512386        } else if( $argWhichQuery  == "top_linking_users" ) { 
    23522387    return "