Changeset 1360

Show
Ignore:
Timestamp:
03/03/07 15:11:54 (2 years ago)
Author:
jm3
Message:

cleanup shit
added link-crush notifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/.htaccess-global

    r1355 r1360  
    2929 
    3030# grab links 
    31 RewriteRule    ^g/([0-9]+)$ /categorize?l=$1 [L] 
     31RewriteRule    ^g/([0-9]+)$ /categorize?from=grab&l=$1 [L] 
     32RewriteRule    ^g/([0-9]+)/d$ /categorize?from=grab&debug=1&l=$1 [L] 
    3233 
    3334# convenience/remote add 
  • feedmelinks/admin/index.php

    r1352 r1360  
    3232        <b>TOOLS</b>:<br /> 
    3333        <ul> 
    34                 <li><a href="/admin/delete-all-comments-from-spammer">delete all comments from spammer</a></li> 
    3534                <li><a href="/admin/todays-users">today's new users</a></li> 
     35                <li><a href="/admin/allow-unlimited-imports-from">allow unlimited imports from: FIXME: not yet implemented</a></li> 
    3636                <li><a href="/admin/disable-user">disable/enable/expire user</a></li> 
    3737                <li><a href="/admin/expire-old-users">expire old users</a></li> 
     38                <li><a href="/admin/delete-all-comments-from-spammer">delete all comments from spammer</a></li> 
    3839                <li><a href="/admin/snuff">snuff a user</a></li> 
    3940                <li><a href="/admin/bulk-snuff">snuff a batch of users</a></li> 
  • feedmelinks/api/add.php

    r1355 r1360  
    2323                $new_link_ID = addLinkSimple( $url, $name, $u, $private, $debug ); 
    2424                if( ! $new_link_ID ) { 
    25                         echo "<result code='duplicate add -- looks like you have already added this link'/>"; 
     25                        $mesg = "Duplicate add -- looks like you have already added this link"; 
     26                        echo "<result code='$mesg'>$mesg</result>"; 
    2627                        return; 
    2728                } 
     29                $l = "http://" . get_domain() . "/$new_link_ID"; 
    2830 
    29                 echo "<result code='done' new_link='http://" . get_domain() . "/$new_link_ID'/>"; 
     31                echo "<result code='done' new_link='$l'>$l</result>"; 
    3032 
    3133                if( $tags ) { 
     
    3335                        $added_tags = add_tags_from_request( $u, $new_link_ID, Array(), mysql_connect(), $tags ); 
    3436                        if( ! $added_tags ) { 
    35                                 echo "<result code='unknown server error tagging link'/>"; 
     37                                $mesg = "Unknown server error while tagging link"; 
     38                                echo "<result code='$mesg'>$mesg</result>"; 
    3639                                return; 
    3740                        } 
  • feedmelinks/categorize.php

    r1352 r1360  
    1 <% 
     1<?php 
    22        ob_start(); 
    33        include_once( "modules/class.gzip_encode.inc.php" ); 
     
    2222        $hiddenColor = "#bcbcbc"; 
    2323 
    24 %
    25 <base href="<%= $site %>/funnel.php" /> 
    26  
    27 <title> Feed Me Links : <%= $op == "Change" ? getCatVerb() : "Save" %> This Link </title> 
     24?
     25<base href="<?= $site ?>/funnel.php" /> 
     26 
     27<title> Feed Me Links : <?= $op == "Change" ? getCatVerb() : "Save" ?> This Link </title> 
    2828 
    2929<div style="text-align: right; margin-bottom: 2em;"> 
    30 <% 
     30<?php 
    3131        if( $u ) { 
    3232                $change_user_url = urlencode( "categorize?from=$from&loggedIn=someone-else&op=submit&name=$name&url=$url&ref=$ref&version=$version" ); 
    3333                $change_user_mesg = urlencode( "Login to save the link '<u>$name</u>'..." ); 
    34 %
    35         Not <a href="/"><%= $u %></a>? 
    36         <a href="/login?mesg=<%= $change_user_mesg %>&bounceToPage=<%= $change_user_url %>">Log in</a>. 
    37 <% } %
    38 </div> 
    39  
    40 <% if( $debug ) { %
    41         user is "<%= $u %>"<br /> 
    42 <% 
     34?
     35        Not <a href="/"><?= $u ?></a>? 
     36        <a href="/login?mesg=<?= $change_user_mesg ?>&bounceToPage=<?= $change_user_url ?>">Log in</a>. 
     37<?php } ?
     38</div> 
     39 
     40<?php if( $debug ) { ?
     41        user is "<?= $u ?>"<br /> 
     42<?php 
    4343        } 
    4444        if( $tok && $tok == md5( getPasswdForUser( $u ))) { 
     
    5959                        foreach ($li as $key => $value) { $li[$key] = urldecode( $li[$key] ); } 
    6060                        $tags = getShortCategoriesForLinkAsHTML( $li['id'], $u ); 
    61 %
     61?
    6262 
    6363<div class="warning" style="text-align: center;"> 
    6464<h1>Double-Link!</h1> 
    6565        <h3> 
    66         Link: <a href="/<%= $li['id'] %>"><%= $li['name'] %></a> 
     66        Link: <a href="/<?= $li['id'] ?>"><?= $li['name'] ?></a> 
    6767        <p /> 
    6868        <img src="/img/doublemint-twins.jpg" border="2" /> 
    6969                <p> 
    70                         Hmm, you've already added this link <%= $count == 1 ? "" : "$count times" %> and 
    71                         tagged it with: <%= $tags %>.<br /> 
    72                         Do you want to <a href="/recategorize/<%= $li['id'] %>">re-tag it?<a/> 
     70                        Hmm, you've already added this link <?= $count == 1 ? "" : "$count times" ?> and 
     71                        tagged it with: <?= $tags ?>.<br /> 
     72                        Do you want to <a href="/recategorize/<?= $li['id'] ?>">re-tag it?<a/> 
    7373                </p> 
    7474        <a href="javascript:history.go( -1 );">&laquo; or just never mind &raquo;</a><br /> 
     
    7878<h1> 
    7979</h1> 
    80 <% 
     80<?php 
    8181                } else { 
    8282 
    83 %
     83?
    8484 
    8585<body onLoad="document.forms['funnelForm'].name.select()"> 
    8686 
    87 <% 
     87<?php 
    8888        if( $debug ) 
    8989                dumpParams(); 
     
    121121        } else { 
    122122 
     123                        # grabbing link from someone else: 
    123124                        if( $l ) { 
    124125                                $con_getLinkInfo = mysql_connect(); 
     
    129130                                if( $q && mysql_num_rows($q) ) { 
    130131                                        $row = mysql_fetch_assoc( $q ); 
    131                                         $url = urldecode( $row["url"] ); 
    132                                         $name = urldecode( $row["name"] ) . " (thanks, " . urldecode( $row["userid"] ) . ")"; 
    133                                         } 
     132 
     133                                        $url        = urldecode( $row["url"   ] ); 
     134                                        $orig_name  = urldecode( $row["name"  ] ); 
     135                                        $grabbee    = urldecode( $row["userid"] ); 
     136 
     137                                        $name = $orig_name . " (thanks, $grabbee!)"; 
     138                                } 
    134139                                conClose( $con_getLinkInfo ); 
    135  
     140                                notify_grab( $u, $grabbee, $l ); 
    136141                        } 
    137142 
     
    155160                else if( $debug ) 
    156161                        echo "warning: DB query failed or no " . getCatsName() . " found in DB!<br />"; 
    157 %
     162?
    158163<center> 
    159164 
    160         <form style="margin: 0px;" action="<%= $op == "change" ? "/action" : "/submit-link" %>" name="funnelForm" method="post"> 
     165        <form style="margin: 0px;" action="<?= $op == "change" ? "/action" : "/submit-link" ?>" name="funnelForm" method="post"> 
    161166 
    162167        <script type="javascript"> 
     
    174179                <tr> 
    175180                        <td valign="top"> 
    176                                 <h2><%= $opVerb %> <input type="text" size="64" maxlength="127" name="name" value="<%= $from == "toolbar" ? $name : o( $name ) %>">  
    177 <% 
     181                                <h2><?= $opVerb ?> <input type="text" size="64" maxlength="127" name="name" value="<?= $from == "toolbar" ? $name : o( $name ) ?>">  
     182<?php 
    178183                                if( $debug ) { 
    179 %
    180                                 $name: <%= $name %><br /> 
    181                                 $from: <%= $from %><br /> 
    182                                 o( $name ): <%= o( $name ) %><br /> 
    183 <% 
     184?
     185                                $name: <?= $name ?><br /> 
     186                                $from: <?= $from ?><br /> 
     187                                o( $name ): <?= o( $name ) ?><br /> 
     188<?php 
    184189                                } 
    185 %
     190?
    186191 
    187192                                <br /> 
    188                                 <% 
     193                                <?php 
    189194                                        # existing links that other users have already linked will be made silently private 
    190195                                        if( link_exists( $url )) { 
    191                                 %
     196                                ?
    192197                                <input type="hidden" name="is_private" value="checked" /> 
    193                                 <% 
     198                                <?php 
    194199                                        # otherwise the user can choose 
    195200                                        } else { 
    196                                 %
     201                                ?
    197202                                <br /> 
    198203                                <a href="javascript:setPrivate();">Save as private</a>? 
    199204                                <input type="checkbox" name="is_private" /> 
    200205                                <br /> 
    201                                 <% 
     206                                <?php 
    202207                                        }  
    203                                 %
     208                                ?
    204209                                </h2> 
    205210 
     
    215220        </table> 
    216221 
    217         <input type="hidden" name="op" value="<%= $op == "change" ? "changeCategories" : "submit" %>" /> 
    218         <input type="hidden" name="debug" value="<%= $debug %>" /> 
    219         <input type="hidden" name="version" value="<%= $version ? $version : "pre_version" %>" /> 
    220 <% if( $op == "change" ) { %
    221         <input type="hidden" name="id" value="<%= $id %>" /> 
    222 <% } else { %
    223         <input type="hidden" name="from" value="<%= $from ? $from : "funnel" %>" /> 
    224         <input type="hidden" name="url" value="<%= $url %>" /> 
    225         <input type="hidden" name="ref" value="<%= $ref %>"  /> 
    226         <input type="hidden" name="loggedIn" value="<%= $loggedIn %>" /> 
    227 <% } %
    228 </div> 
    229  
    230 <% 
     222        <input type="hidden" name="op" value="<?= $op == "change" ? "changeCategories" : "submit" ?>" /> 
     223        <input type="hidden" name="debug" value="<?= $debug ?>" /> 
     224        <input type="hidden" name="version" value="<?= $version ? $version : "pre_version" ?>" /> 
     225<?php if( $op == "change" ) { ?
     226        <input type="hidden" name="id" value="<?= $id ?>" /> 
     227<?php } else { ?
     228        <input type="hidden" name="from" value="<?= $from ? $from : "funnel" ?>" /> 
     229        <input type="hidden" name="url" value="<?= $url ?>" /> 
     230        <input type="hidden" name="ref" value="<?= $ref ?>"  /> 
     231        <input type="hidden" name="loggedIn" value="<?= $loggedIn ?>" /> 
     232<?php } ?
     233</div> 
     234 
     235<?php 
    231236                if( $numRows ) { 
    232237                        $catsRendered = 0; 
    233 %
     238?
    234239                <table cellspacing="0" cellpadding="8" border="0" width="650"> 
    235240                        <tr> 
    236 <% 
     241<?php 
    237242                        $categories = array(); 
    238243                        $count = 0; 
     
    261266                        } 
    262267 
    263                         if( !$bigLayout ) { %
     268                        if( !$bigLayout ) { ?
    264269 
    265270<style type="text/css"> 
     
    270275</style> 
    271276 
    272 <% 
     277<?php 
    273278                        } 
    274279 
     
    313318                                        if( $bigLayout ) { 
    314319 
    315 %
     320?
    316321<td class="funnelTD" height="45" align="center" valign="bottom"> 
    317         <%= $cb %
    318         <a <%= $alreadySelected ? "class=\"hot\" " : "" %>href="javascript:pc(<%= $id %>);"><img src="<%= $public ? "img/big-tag-bice" : "img/big-tag-private-bice" %>.gif" border="0" /><br /> 
    319         <b><%= $catName %><%= $debug ? " ($id)" : "" %></b></a><br /> 
     322        <?= $cb ?
     323        <a <?= $alreadySelected ? "class=\"hot\" " : "" ?>href="javascript:pc(<?= $id ?>);"><img src="<?= $public ? "img/big-tag-bice" : "img/big-tag-private-bice" ?>.gif" border="0" /><br /> 
     324        <b><?= $catName ?><?= $debug ? " ($id)" : "" ?></b></a><br /> 
    320325</td> 
    321 <% 
     326<?php 
    322327                                } else { 
    323 %
     328?
    324329<div class="l"> 
    325 <%= $cb %
    326 <a href="javascript:pc(<%= $id %>);"><img src="img/lil-tag<%= !$public ? "-private" : "" %>-bice.gif" align="absmiddle" border="0" /></a> 
    327 <a <%= !$public ? "style='color: $hiddenColor;'" : "" %> <%= $alreadySelected ? "class=\"hot\" " : "" %>href="javascript:pc(<%= $id %>);"><%
    328         $catName %></a> 
    329 </div> 
    330 <% 
     330<?= $cb ?
     331<a href="javascript:pc(<?= $id ?>);"><img src="img/lil-tag<?= !$public ? "-private" : "" ?>-bice.gif" align="absmiddle" border="0" /></a> 
     332<a <?= !$public ? "style='color: $hiddenColor;'" : "" ?> <?= $alreadySelected ? "class=\"hot\" " : "" ?>href="javascript:pc(<?= $id ?>);"><?
     333        $catName ?></a> 
     334</div> 
     335<?php 
    331336                                } 
    332337                                        $catsRendered++; 
    333338                                } else if ( $catsRendered == $numRows ) { 
    334339                                        $catsRendered++; 
    335 %
    336 <% 
     340?
     341<?php 
    337342                                } else { 
    338343                                        echo "&nbsp;"; 
     
    341346 
    342347                        if( $bigLayout ) { 
    343 %
     348?
    344349                </td> 
    345350                </tr> 
     
    347352                <td class="funnelTD" height="45" align="center" valign="bottom"> 
    348353 
    349                         <a href="/?op=submit&from=funnel&name=<%= urlencode( $name ) 
    350                                 %>&url=<%= urlencode( $url ) %><%= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  %>"><img  
     354                        <a href="/?op=submit&from=funnel&name=<?= urlencode( $name ) 
     355                                ?>&url=<?= urlencode( $url ) ?><?= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  ?>"><img  
    351356                                src="img/big-tag-private-bice" border="0" /></a><br /> 
    352                         leave <a href="/?op=submit&from=funnel&name=<%= urlencode( $name ) 
    353                                         %>&url=<%= urlencode( $url ) %><%= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  %>"> <b><%= getUnCattedName() %></b></a><br /> 
     357                        leave <a href="/?op=submit&from=funnel&name=<?= urlencode( $name ) 
     358                                        ?>&url=<?= urlencode( $url ) ?><?= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  ?>"> <b><?= getUnCattedName() ?></b></a><br /> 
    354359                </td> 
    355 <%  
     360<?php  
    356361                        } else { 
    357 %
     362?
    358363<div class="l"> 
    359364<br /> 
    360 or, leave this link <a href="/?op=submit&name=<%=  
    361         urlencode( $name ) %>&url=<%= urlencode( $url ) %>&from=funnel<%= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  %>"><%= getUnCattedName() %></a>. 
    362 </div> 
    363 <% 
    364                         } 
    365 %
     365or, leave this link <a href="/?op=submit&name=<?=  
     366        urlencode( $name ) ?>&url=<?= urlencode( $url ) ?>&from=funnel<?= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : ""  ?>"><?= getUnCattedName() ?></a>. 
     367</div> 
     368<?php 
     369                        } 
     370?
    366371        </tr> 
    367372</table> 
    368373 
    369374<br /> 
    370 or, <b>Add new <%= getCatsName() %></b>: 
     375or, <b>Add new <?= getCatsName() ?></b>: 
    371376<input name="new_tag_1" size="14" maxlength="48" />,  
    372377<input name="new_tag_2" size="14" maxlength="48" />,  
     
    377382<br /><br /> 
    378383 
    379 <% if( $ref != "" ) { 
     384<?php if( $ref != "" ) { 
    380385                        preg_match("/http:\/\/([^\/]+)\//", $ref, $matches ); 
    381386                        $domain = $matches[1]; 
    382 %
     387?
    383388<div class="head" style="margin-bottom: 0.5em;"> 
    384 (Linked from: <a href="<%= $ref %>"><%= $domain %></a> / Edit: <input name="referrer" value="<%= $domain %>" />) 
    385 </div> 
    386 <% } %
     389(Linked from: <a href="<?= $ref ?>"><?= $domain ?></a> / Edit: <input name="referrer" value="<?= $domain ?>" />) 
     390</div> 
     391<?php } ?
    387392 
    388393        <br /> 
    389394        <input type="button" class="default button" style="padding: 3px;" value="Save It!" onClick="submitLink();" /> 
    390         <input type="button" onClick="deselectAllCategories();" value="De-Select All <%= getCatsName() %>" class="button" /> 
     395        <input type="button" onClick="deselectAllCategories();" value="De-Select All <?= getCatsName() ?>" class="button" /> 
    391396 
    392397</form> 
    393398 
    394 <% if( !$bigLayout ) { %
     399<?php if( !$bigLayout ) { ?
    395400        <p> 
    396                 (private <%= getCatsName() %> are light gray) 
     401                (private <?= getCatsName() ?> are light gray) 
    397402        </p> 
    398 <% } %
     403<?php } ?
    399404 
    400405</center> 
    401 <% 
     406<?php 
    402407                } else { 
    403 %
     408?
    404409<div class="attention warning"> 
    405         You appear to have no <%= getCatsName() %>. 
    406 </div> 
    407 <% 
     410        You appear to have no <?= getCatsName() ?>. 
     411</div> 
     412<?php 
    408413                } 
    409414        } else { 
    410 %
     415?
    411416<style type="text/css"> 
    412417        /* momentarily override the visited colorizing so as not to confuse the user... */ 
     
    414419        table, tr, td { background-color: #E5E5E5 } 
    415420</style> 
    416 <% 
     421<?php 
    417422         
    418423                echo $_GET["link_name"]; 
     
    421426                if( preg_match( ":/add/success:", $REQUEST_URI )) { 
    422427                        $op = "mobile_bitch"; 
    423 %
     428?
    424429<div class="attention"> 
    425         Added <b><%= $link_name %></b> as <%= getPermaLink( $link_num ) %>! 
     430        Added <b><?= $link_name ?></b> as <?= getPermaLink( $link_num ) ?>! 
    426431        <br /> 
    427432        Add 'nother link? 
    428433        <br /> 
    429434</div> 
    430 <% 
     435<?php 
    431436                } else if( preg_match( ":add:", $REQUEST_URI )) { 
    432437                        $op = "mobile_bitch"; 
    433438                } else { 
    434 %
     439?
    435440<h2>This page is usually used with the <u>Feed Me Links</u> Button (or "Bookmarklet") to add links</h2> 
    436441(go <a href="/install">here</a> to get the <a href="/install">Bookmarklet</a>) 
    437442<p /> 
    438 <% 
     443<?php 
    439444                }  
    440 %
     445?
    441446 
    442447<br /> 
    443448<form action="categorize" method="post"> 
    444449 
    445 <%    if( $op == "mobile_bitch" ) {  
     450<?php         if( $op == "mobile_bitch" ) {  
    446451                        startTell( "<img src='/img/mobile-header.gif' alt='for our nomadic users...'/>", "600"); 
    447 %
     452?
    448453<input type="hidden" name="from" value="mobile_bitch" /> 
    449 <% } %
     454<?php } ?
    450455 
    451456<div class="attention" style="width: 50em;"> 
     
    458463                                <tr> 
    459464                                        <td align="right">url:&nbsp;</td> 
    460                                         <td><input name="url" value="<%= $url %>" size="40" maxlength="254" /></td> 
     465                                        <td><input name="url" value="<?= $url ?>" size="40" maxlength="254" /></td> 
    461466                                        <td>&nbsp;</td> 
    462467                                </tr> 
    463468                                <tr> 
    464469                                        <td align="right">name:&nbsp;</td> 
    465                                         <td><input name="name" value="<%= $name %>" size="40" maxlength="127" /></td> 
     470                                        <td><input name="name" value="<?= $name ?>" size="40" maxlength="127" /></td> 
    466471                                </tr> 
    467472                        </table> 
     
    480485</form> 
    481486 
    482 <% 
     487<?php 
    483488                if( $op == "mobile_bitch" ) {  
    484489                        endTell(); 
     
    509514        else 
    510515                echo bounceTo( $site . "/login?bounceToPage=$bounce" ); 
    511 %
    512  
    513 <% }  
     516?
     517 
     518<?php }  
    514519        new gzip_encode(); 
    515 %
     520?
  • feedmelinks/lib/FeedMeLinks/Bot.pm

    r1357 r1360  
    33#use strict; 
    44 
     5require Encode; 
    56use Data::Dumper; 
    67use Date::Format; 
     
    1213use MIME::Base64; 
    1314use XML::XPath; 
    14 require Encode; 
     15 
     16my $logfile = FeedMeLinks::Environment::get_webserver_root() . "/_logs/aim.log"; 
     17print "opening $logfile\n"; 
     18open(LOG, ">>" . $logfile) or die "can't open log $logfile"; 
     19 
     20# always flush write to the log file so we see them immediately 
     21
     22        my $ofh = select LOG; 
     23        $| = 1; 
     24        select $ofh; 
     25
     26 
     27log_mesg( \*LOG, "starting run" ); 
    1528 
    1629my $www = get_proxy( FeedMeLinks::Environment::get_bot_user(), FeedMeLinks::Environment::get_bot_password()); 
     
    2437        $message = strip_html( $message ); 
    2538 
     39        print "handle_resopnse can see site = $site\n"; 
     40 
    2641        # init user 
    2742 
    2843        my $fml_username = is_user_validated( $sender ); 
    2944        $fml_username .= ""; # type coerce 
    30         print "fml_username: $fml_username\n"; 
    3145        if( ! $fml_username ) { 
    32                 print "bulding FAKE session for $sender\n"; 
    3346                $sessions_ref->{"$sender"} = build_empty_session(); 
    3447         if( ! $sessions_ref->{ $sender }->{ "seen_welcome" } ) { 
     
    4154                        $sessions_ref->{ $sender }->{ "seen_welcome" } = 1; 
    4255                } 
    43                 print "bulding real session for $sender\n"; 
    4456                $sessions_ref->{"$sender"} = build_authenticated_session( $fml_username ); 
    4557        } 
     
    5365                if( $sessions_ref->{ $sender }->{ "validated" } ) { 
    5466                        my $url = $message; 
    55                         print "orig url is $url\n"; 
    5667                        $url =~ s/^add //; 
    5768                        $url = add_prefix( $url ); 
     
    6374                        my $encoded_url = $url; 
    6475                        $encoded_url =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; 
    65                         print "$sender adding $url as $name\n"; 
     76                        print "< $sender adding $url as $name\n"; 
    6677 
    6778                        my $response = $sessions_ref->{$sender}->{"proxy"}->get( "$site/api/add?url=$encoded_url&name=$encoded_name", []); 
     
    6980                        my $info = $xp->getNodeText( "/result" ); 
    7081 
    71                         print "raw: " . Dumper( $response->content ) . "\n"; 
    72                         print "got $info back from FML\n"; 
     82                        print "> raw: " . Dumper( $response->content ) . "\n"; 
     83                        print "< got $info back from FML\n"; 
    7384                        if( $info =~ m/http/ ) { 
    7485                                my $link_id = $info; 
    7586                                $link_id =~ s/.*com\///; 
    76                                 print "link_id: $link_id\n"; 
     87                                print "< FML server gave us link ID: $link_id\n"; 
    7788                                $sessions_ref->{$sender}->{"last_link"} = $link_id; 
    7889                                $sessions_ref->{$sender}->{"last_action"} = "added_link"; 
     
    153164                $aim->send_im($sender, "recent links here, soon! (not finished yet, sorry"); 
    154165         
     166        } elsif( $message =~ m/(^log)/ ) { 
     167                log_mesg( \*LOG, "log test", " $message from $sender" ); 
     168         
    155169        } elsif( $message =~ m/(recent|new)/ ) { 
    156170                $aim->send_im($sender, "(soon!) show the last 10 links"); 
     
    182196 
    183197sub is_user_validated { 
     198        log_mesg( \*LOG, "debug", " is_user_validated() - why is bri getting kicked off?" ); 
    184199        my $sender = shift; 
    185200        my $response = $www->get( "$site/api/backroom/is_im_account_known&user=$sender" , []); 
     
    188203        $is_valid .= ""; 
    189204        my $fml_user = $xp->getNodeText("/rest/user"); 
    190         print "trying to validate user $sender; server said: account $fml_user, valid=$is_valid\n"; 
     205        print "> trying to validate user $sender; FML server said: account $fml_user, valid=$is_valid\n"; 
    191206 
    192207        if( $is_valid ) { 
    193                 print "this AIM account is associated with FML account $fml_user and has been validated\n"; 
     208                print "> this AIM account is associated with FML account $fml_user and has been validated\n"; 
    194209                return "" . $fml_user; # stupid string conversion 
    195210        } else { 
    196                 print "(not showing username $fml_user cause it hasn't been validated -- could be anyone)\n"; 
     211                print "> not showing username $fml_user cause it hasn't been validated -- could be anyone\n"; 
    197212                return 0; 
    198213        } 
     
    201216 
    202217sub build_empty_session { 
     218        print "> building UNauthenticated session for $sender\n"; 
    203219        return {  
    204220    'last_link' => 'none yet', 
     
    216232        my $u = $_[0]; 
    217233        my $p; 
     234        print "> building authenticated session for $u\n"; 
    218235 
    219236        print "> passing user: $u\n"; 
     
    297314} 
    298315 
    299 sub print_version { print get_version() . "\n"; } 
     316sub print_version { print "> " . get_version() . "\n"; } 
    300317 
    301318sub get_version {  
     319        my $version = "0.1.6"; 
    302320        $^T = time; 
    303321        my $d = -M "/home/fml/public_html/lib/FeedMeLinks/Bot.pm"; 
    304322        $d = int( $d * 1440 ); 
    305         return "You are speaking with Feed Me Links bot v0.1.4!\n(code last baked $d minutes ago)\n"; 
     323        return "You are speaking with Feed Me Links bot v$version\n(code last baked $d minutes ago)\n"; 
     324
     325 
     326sub log_mesg { 
     327        my $log = shift; 
     328        my $type = shift; 
     329        my $message = shift; 
     330        print $log get_date() . " [$type] $message\n"; 
     331        print get_date() . " [$type] $message\n"; 
     332
     333 
     334sub get_date { 
     335        ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 
     336        $year += 1900; 
     337        $mon += 1; 
     338 
     339        $mon = $mon < 10 ? "0" . "$mon" : $mon; 
     340        $mday = $mday < 10 ? "0" . "$mday" : $mday; 
     341        $hour = $hour < 10 ? "0" . "$hour" : $hour; 
     342        $min = $min < 10 ? "0" . "$min" : $min; 
     343        $sec = $sec < 10 ? "0" . "$sec" : $sec; 
     344 
     345        my $now = "$year-$mon-$mday" . "T" . "$hour:$min:$sec"; 
     346        return $now; 
    306347} 
    307348 
  • feedmelinks/login.php

    r1353 r1360  
    7979                                        } 
    8080                                        } else { 
    81                                                 log_mesg_to( "WARN. attempted login from invalidated user $userId", "global" ); 
     81                                                log_mesg_to( "[attempted login by invalidated user] $userId", "security" ); 
    8282                                                warn( "Your account was temporarily disabled. Please your email for the link to re-enable your account."); 
    83                                                 notify_expired( $userId ); 
    8483                                                return; 
    8584                                        } 
  • feedmelinks/modules/menu.inc.php

    r1350 r1360  
    55 
    66<div class="topNav"> 
    7 <a class="tn" href="/portal">Feed Me Links</a> : Social Bookmarking since 2002. 
     7<a class="tn" href="/">Feed Me Links</a> : Social Bookmarking since 2002. 
    88&nbsp; 
    99&nbsp; 
  • feedmelinks/modules/utils.inc.php

    r1355 r1360  
    349349        <input type="hidden" name="user" value="<?= $user ?>" /> 
    350350        <input type="hidden" name="confirm" value="true" /> 
    351         <input type="submit" style="padding: 3em; background-color: red;" value="GUARDLESS KILL: <?= $user ?>" /> 
     351        <input type="submit" style="padding: 1em; background-color: red; font-size: 14px;" value="Snuff <?= $user ?>" /> 
    352352</form> 
    353353<?php 
     
    589589        return 90; # FIXME: move into server config 
    590590} 
     591         
     592function make_safe_for_email( $s ) { 
     593        $s = preg_replace( "/&amp;/", "&", $s ); 
     594        $s = preg_replace( "/&quot;/", "\"", $s ); 
     595        $s = preg_replace( "/&apos;/", "'", $s ); 
     596        return $s; 
     597} 
     598 
     599function notify_grab( $grabber, $grabbee, $orig_link_ID ) {  
     600        $site = get_site(); 
     601        $name = make_safe_for_email( get_link_name( $orig_link_ID )); 
     602        $body = <<<END 
     603 
     604Hey $grabbee. 
     605 
     606It looks like $grabber ($site/u/$grabber) liked your link $name ($site/$orig_link_ID)! 
     607 
     608Nice work, 
     609 
     610-- 
     611 
     612The Feed Me Links Lovebot 
     613 
     614END; 
     615  $headers = get_mail_headers(); 
     616  $to = getEmailAddressForUser( $grabbee ); 
     617        log_mesg_to( "notify_grab( $grabber, $grabbee($to), $orig_link_ID", "mail" ); 
     618  $success = mail( $to, "Someone has a link-crush on you!", $body, $headers); 
     619  if( $success ) 
     620    log_mesg_to( "[link-crush notification] $to", "mail" ); 
     621  return $success; 
     622}    
    591623 
    592624function notify_expired( $u ) { 
    593         $site = "http://" . get_domain(); 
     625        $site = get_site(); 
     626        $days = get_num_days_allowed_idle(); 
     627        $code = md5( getPasswdForUser( $u )); 
    594628  $body = "Hello, $u. 
    595629 
    596630It looks like you've been busy and haven't been using your Feed Me Links account ($site/u/$u) lately. We tried to send you a reminder email last week, but perhaps you didn't receive it or weren't interested in continuing to use Feed Me Links. That's OK. :-)i 
    597631 
    598 Because your account has been unused for " . get_num_days_allowed_idle() . ", in order to protect your account and as a safegaurd against spammers, we have temporarly disabled your login until we hear from you that you would like to keep linking. Do NOT worry -- all your links are just fine are will be kept safely in Feed Me Links.  
    599  
    600 To Re-Enable your account, just click this link: $site/user/re-enable?user=$u&code=" . md5( getPasswdForUser( $u )) .  " 
     632Because your account has been unused for $days, in order to protect your account and as a safegaurd against spammers, we have temporarly disabled your login until we hear from you that you would like to keep linking. Do NOT worry -- all your links are just fine are will be kept safely in Feed Me Links.  
     633 
     634To Re-Enable your account, just click this link: $site/user/re-enable?user=$u&code=$code 
    601635 
    602636(To completely REMOVE your account, please click $site/user/remove-me?user=$u) 
     
    609643  $success = mail( $to, "Long time, no link : You haven't used Feed Me Links lately", $body, $headers); 
    610644  if( $success ) 
    611     log_mesg_to( "sent expiration notification mail to $to", "mail" ); 
     645    log_mesg_to( "[user expiration notification] $to", "mail" ); 
    612646  return $success; 
    613647} 
     
    10771111    $pi["moodmat"] = true; 
    10781112    $pi["webgirl"] = true; 
     1113    $pi["marker_pen"] = true; 
    10791114 
    10801115    #$pi["khemraj"] = true; 
     
    18821917 
    18831918<br /> 
    1884 <h2> <%= $argUser %> has no peeps... what a LOSER!  </h2> 
     1919(<%= $argUser %> has not added any peeps yet). 
    18851920 
    18861921<% 
     
    19461981    $inList = inList( $user, "contacts", get_cache() ) ; 
    19471982    if( ! $inList ) { 
    1948       $r .= "<a href='" . getSiteURL() . "/contacts/add?user=$user'>" 
     1983      $r .= "<small><a href='" . getSiteURL() . "/contacts/add?user=$user'>" 
    19491984      . "<img src=\"" . getSiteURL() . "/img/plus.gif\" alt=\"+\" border=\"0\" />" 
    1950       . ($argVerbose ? " Add <b>$user</b> as " . get_ownoun() . " peep?</a> " : "</a>") 
     1985      . ($argVerbose ? " Add to peeps?</a> " : "</a></small>") 
    19511986      . "" 
    19521987      ; 
     
    19551990      $r .= "<a href=\"" . getSiteURL() . "/contacts/\">" 
    19561991      . "<img src=\"" . getSiteURL() . "/img/happy.png\" alt=\"*\" border=\"0\" class=\"icon\" align=\"middle\" /></a>" 
    1957       . ($argVerbose ? " is one of <a href='/contacts/index'>your peeps</a>. " : "") 
    1958       .  ($argVerbose ? " <small>(<a href='/contacts/remove?user=$user'>Remove <b>$user</b></a> from your peeps?)</small>" : "" ) 
     1992      . ($argVerbose ? " is <a href='/contacts/index'>a peep</a>. " : "") 
     1993      .  ($argVerbose ? " <small>(<a href='/contacts/remove?user=$user'>Remove <b>$user</b></a>?)</small>" : "" ) 
    19591994      ; 
    19601995      #$r = "<small>(" . get_ownoun() . " peep)&#160; (<a href='/contacts/remove?user=$user'>remove?</a>)</small>"; 
     
    36873722} 
    36883723 
     3724function get_link_name( $argId ) { 
     3725  return getTitleForLink( $argId ); 
     3726} 
     3727 
     3728# deprecated, use get_link_name 
    36893729function getNameForLink( $argId ) { 
    36903730  return getTitleForLink( $argId ); 
  • feedmelinks/submit-link.php

    r1331 r1360  
    1 <% 
     1<?php 
    22        ob_start(); 
    33        include_once( "modules/class.gzip_encode.inc.php" ); 
     
    5252                        mysql_selectdb( getDBName() ); 
    5353                        if( $op == "submit" ) { 
    54 %
    55  
    56 tagging link "<a href="<%= $url %>"><%= $name %></a>"...<br /> 
    57  
    58 <% 
     54?
     55 
     56tagging link "<a href="<?= $url ?>"><?= $name ?></a>"...<br /> 
     57 
     58<?php 
    5959                        if( $debug ) { 
    6060                                echo "<br />"; 
     
    8888 
    8989                                        if( $from == "mobile_bitch" ) { 
    90 %
     90?
    9191<div class="attention"> 
    9292link added, mobile bitch 
    9393</div> 
    94 <% 
     94<?php 
    9595        echo bounceTo( "/add/success?link_name=" . urlencode( $name ) . "&link_num=$newLinkID" )