Show
Ignore:
Timestamp:
03/10/07 11:32:55 (2 years ago)
Author:
jm3
Message:

invitations! (prompted by Feed Me Links RT feature "share"...)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/invite/index.php

    r1402 r1408  
     1<?php 
     2        include( "../modules/utils.inc.php" ); 
     3        include( "$modules/header.inc.php" ); 
    14 
    2 hi 
     5        if( !$tok || $tok != md5( getPasswdForUser( $u )))  { 
     6                echo bounceTo( "/login?bounceToPage=/invite/" ); 
     7                return; 
     8        } 
     9 
     10        $peeps_rs = get_full_peeps_reciprocal( $u ); 
     11        $peeps_rs = get_full_peeps( $u ); 
     12 
     13        $num_peeps = 0; 
     14        while( $row = mysql_fetch_assoc( $peeps_rs )) { 
     15                $peep = urldecode( $row["userid"] ); 
     16                $peeps .= "$peep, "; 
     17                $email = urldecode( $row["email"] ); 
     18                $email_recips .= "$email, "; 
     19                ++ $num_peeps; 
     20        } 
     21        log_mesg_to( "[invite] $u invited $num_peeps peeps", "mail" ); 
     22        $peeps = preg_replace( "/, $/", "", $peeps ); 
     23        $show_form = true; 
     24 
     25        if( $op == "send" ) { 
     26 
     27                $body = "Hi!\n\n$user_message\n\n" . get_invite_boilerplate( $u ); 
     28                $sub = get_invite_sub( $u ); 
     29                $show_form = false; 
     30                $result = mail( $email_recips, $sub, $body, get_mail_headers( $u ) ); 
     31                h1( "Sending invitation..." .  ($result == 1 ? "done!" : "failed")); 
     32        } 
     33 
     34        function get_invite_sub( $u ) { 
     35                return "[Feed Me Links] $u is inviting you to get down with some real-time link play!"; 
     36        } 
     37 
     38        function get_invite_boilerplate( $user ) { 
     39                return "Feed Me Links just launched a new AIM app for savinv your links directly from AIM. It's great for folks who are too busy to sign into a web browser but still want a way to capture and share incoming links. Link, tag, share, and connect from Adium, Trillian, or plain ol'e AIM. 
     40 
     41To start playing around, just click http://feedmelinks.com/aim/hello 
     42 
     43Peace! 
     44 
     45-- 
     46 
     47$user and the Feed Me Links team 
     48"; 
     49
     50 
     51        if( $show_form ) { 
     52?> 
     53 
     54<form name="invite_form"> 
     55        <input type="hidden" name="op" value="send" /> 
     56 
     57        <div id="fake_email"> 
     58                <h1> 
     59                        Invite your peeps to AIM 
     60                </h1> 
     61 
     62                <p style="font-family: sans-serif;"> 
     63 
     64                        <p> 
     65                                <b>From</b>: <?= $u ?> &lt;<?= getEmailAddressForUser( $u ) ?>&gt; 
     66                        </p> 
     67 
     68                        <p> 
     69                                <b>To</b>: <?= $peeps ?><br /> 
     70                        </p> 
     71                        <p> 
     72                                <b>Subject</b>: <?= get_invite_sub( $u ) ?><br /> 
     73                        </p> 
     74                        <br /> 
     75 
     76                        <big> 
     77                                <p> 
     78                                        Hi! 
     79                                </p> 
     80 
     81                                <textarea name="user_message" rows="5" cols="60"></textarea> 
     82 
     83                                <p> 
     84                                        <?= preg_replace( "/$/m", "\n<br/>", get_invite_boilerplate( $u )) ?> 
     85                                </p> 
     86 
     87                        </big> 
     88 
     89                </p> 
     90 
     91                <input type="submit" value="Send it!" /> 
     92 
     93        </form> 
     94 
     95</div> 
     96 
     97<?php 
     98 
     99        } 
     100 
     101?>