Changeset 1360
- Timestamp:
- 03/03/07 15:11:54 (2 years ago)
- Files:
-
- feedmelinks/.htaccess-global (modified) (1 diff)
- feedmelinks/admin/index.php (modified) (1 diff)
- feedmelinks/api/add.php (modified) (2 diffs)
- feedmelinks/categorize.php (modified) (20 diffs)
- feedmelinks/lib/FeedMeLinks/Bot.pm (modified) (13 diffs)
- feedmelinks/lib/Strip.bs (added)
- feedmelinks/lib/Strip.so (added)
- feedmelinks/login.php (modified) (1 diff)
- feedmelinks/modules/menu.inc.php (modified) (1 diff)
- feedmelinks/modules/utils.inc.php (modified) (8 diffs)
- feedmelinks/submit-link.php (modified) (8 diffs)
- feedmelinks/user/re-enable.php (modified) (1 diff)
- feedmelinks/users.php (modified) (2 diffs)
- feedmelinks/validate/IM.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
feedmelinks/.htaccess-global
r1355 r1360 29 29 30 30 # grab links 31 RewriteRule ^g/([0-9]+)$ /categorize?l=$1 [L] 31 RewriteRule ^g/([0-9]+)$ /categorize?from=grab&l=$1 [L] 32 RewriteRule ^g/([0-9]+)/d$ /categorize?from=grab&debug=1&l=$1 [L] 32 33 33 34 # convenience/remote add feedmelinks/admin/index.php
r1352 r1360 32 32 <b>TOOLS</b>:<br /> 33 33 <ul> 34 <li><a href="/admin/delete-all-comments-from-spammer">delete all comments from spammer</a></li>35 34 <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> 36 36 <li><a href="/admin/disable-user">disable/enable/expire user</a></li> 37 37 <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> 38 39 <li><a href="/admin/snuff">snuff a user</a></li> 39 40 <li><a href="/admin/bulk-snuff">snuff a batch of users</a></li> feedmelinks/api/add.php
r1355 r1360 23 23 $new_link_ID = addLinkSimple( $url, $name, $u, $private, $debug ); 24 24 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>"; 26 27 return; 27 28 } 29 $l = "http://" . get_domain() . "/$new_link_ID"; 28 30 29 echo "<result code='done' new_link=' http://" . get_domain() . "/$new_link_ID'/>";31 echo "<result code='done' new_link='$l'>$l</result>"; 30 32 31 33 if( $tags ) { … … 33 35 $added_tags = add_tags_from_request( $u, $new_link_ID, Array(), mysql_connect(), $tags ); 34 36 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>"; 36 39 return; 37 40 } feedmelinks/categorize.php
r1352 r1360 1 < %1 <?php 2 2 ob_start(); 3 3 include_once( "modules/class.gzip_encode.inc.php" ); … … 22 22 $hiddenColor = "#bcbcbc"; 23 23 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> 28 28 29 29 <div style="text-align: right; margin-bottom: 2em;"> 30 < %30 <?php 31 31 if( $u ) { 32 32 $change_user_url = urlencode( "categorize?from=$from&loggedIn=someone-else&op=submit&name=$name&url=$url&ref=$ref&version=$version" ); 33 33 $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 43 43 } 44 44 if( $tok && $tok == md5( getPasswdForUser( $u ))) { … … 59 59 foreach ($li as $key => $value) { $li[$key] = urldecode( $li[$key] ); } 60 60 $tags = getShortCategoriesForLinkAsHTML( $li['id'], $u ); 61 %>61 ?> 62 62 63 63 <div class="warning" style="text-align: center;"> 64 64 <h1>Double-Link!</h1> 65 65 <h3> 66 Link: <a href="/< %= $li['id'] %>"><%= $li['name'] %></a>66 Link: <a href="/<?= $li['id'] ?>"><?= $li['name'] ?></a> 67 67 <p /> 68 68 <img src="/img/doublemint-twins.jpg" border="2" /> 69 69 <p> 70 Hmm, you've already added this link < %= $count == 1 ? "" : "$count times" %> and71 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/> 73 73 </p> 74 74 <a href="javascript:history.go( -1 );">« or just never mind »</a><br /> … … 78 78 <h1> 79 79 </h1> 80 < %80 <?php 81 81 } else { 82 82 83 %>83 ?> 84 84 85 85 <body onLoad="document.forms['funnelForm'].name.select()"> 86 86 87 < %87 <?php 88 88 if( $debug ) 89 89 dumpParams(); … … 121 121 } else { 122 122 123 # grabbing link from someone else: 123 124 if( $l ) { 124 125 $con_getLinkInfo = mysql_connect(); … … 129 130 if( $q && mysql_num_rows($q) ) { 130 131 $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 } 134 139 conClose( $con_getLinkInfo ); 135 140 notify_grab( $u, $grabbee, $l ); 136 141 } 137 142 … … 155 160 else if( $debug ) 156 161 echo "warning: DB query failed or no " . getCatsName() . " found in DB!<br />"; 157 %>162 ?> 158 163 <center> 159 164 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"> 161 166 162 167 <script type="javascript"> … … 174 179 <tr> 175 180 <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 178 183 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 184 189 } 185 %>190 ?> 186 191 187 192 <br /> 188 < %193 <?php 189 194 # existing links that other users have already linked will be made silently private 190 195 if( link_exists( $url )) { 191 %>196 ?> 192 197 <input type="hidden" name="is_private" value="checked" /> 193 < %198 <?php 194 199 # otherwise the user can choose 195 200 } else { 196 %>201 ?> 197 202 <br /> 198 203 <a href="javascript:setPrivate();">Save as private</a>? 199 204 <input type="checkbox" name="is_private" /> 200 205 <br /> 201 < %206 <?php 202 207 } 203 %>208 ?> 204 209 </h2> 205 210 … … 215 220 </table> 216 221 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 231 236 if( $numRows ) { 232 237 $catsRendered = 0; 233 %>238 ?> 234 239 <table cellspacing="0" cellpadding="8" border="0" width="650"> 235 240 <tr> 236 < %241 <?php 237 242 $categories = array(); 238 243 $count = 0; … … 261 266 } 262 267 263 if( !$bigLayout ) { %>268 if( !$bigLayout ) { ?> 264 269 265 270 <style type="text/css"> … … 270 275 </style> 271 276 272 < %277 <?php 273 278 } 274 279 … … 313 318 if( $bigLayout ) { 314 319 315 %>320 ?> 316 321 <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 /> 320 325 </td> 321 < %326 <?php 322 327 } else { 323 %>328 ?> 324 329 <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 331 336 } 332 337 $catsRendered++; 333 338 } else if ( $catsRendered == $numRows ) { 334 339 $catsRendered++; 335 %>336 < %340 ?> 341 <?php 337 342 } else { 338 343 echo " "; … … 341 346 342 347 if( $bigLayout ) { 343 %>348 ?> 344 349 </td> 345 350 </tr> … … 347 352 <td class="funnelTD" height="45" align="center" valign="bottom"> 348 353 349 <a href="/?op=submit&from=funnel&name=< %= urlencode( $name )350 %>&url=<%= urlencode( $url ) %><%= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : "" %>"><img354 <a href="/?op=submit&from=funnel&name=<?= urlencode( $name ) 355 ?>&url=<?= urlencode( $url ) ?><?= $loggedIn == "wasnt" ? "&loggedIn=wasnt" : "" ?>"><img 351 356 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 /> 354 359 </td> 355 < %360 <?php 356 361 } else { 357 %>362 ?> 358 363 <div class="l"> 359 364 <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 %>365 or, 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 ?> 366 371 </tr> 367 372 </table> 368 373 369 374 <br /> 370 or, <b>Add new < %= getCatsName() %></b>:375 or, <b>Add new <?= getCatsName() ?></b>: 371 376 <input name="new_tag_1" size="14" maxlength="48" />, 372 377 <input name="new_tag_2" size="14" maxlength="48" />, … … 377 382 <br /><br /> 378 383 379 < %if( $ref != "" ) {384 <?php if( $ref != "" ) { 380 385 preg_match("/http:\/\/([^\/]+)\//", $ref, $matches ); 381 386 $domain = $matches[1]; 382 %>387 ?> 383 388 <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 } ?> 387 392 388 393 <br /> 389 394 <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" /> 391 396 392 397 </form> 393 398 394 < % if( !$bigLayout ) { %>399 <?php if( !$bigLayout ) { ?> 395 400 <p> 396 (private < %= getCatsName() %> are light gray)401 (private <?= getCatsName() ?> are light gray) 397 402 </p> 398 < % } %>403 <?php } ?> 399 404 400 405 </center> 401 < %406 <?php 402 407 } else { 403 %>408 ?> 404 409 <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 408 413 } 409 414 } else { 410 %>415 ?> 411 416 <style type="text/css"> 412 417 /* momentarily override the visited colorizing so as not to confuse the user... */ … … 414 419 table, tr, td { background-color: #E5E5E5 } 415 420 </style> 416 < %421 <?php 417 422 418 423 echo $_GET["link_name"]; … … 421 426 if( preg_match( ":/add/success:", $REQUEST_URI )) { 422 427 $op = "mobile_bitch"; 423 %>428 ?> 424 429 <div class="attention"> 425 Added <b>< %= $link_name %></b> as <%= getPermaLink( $link_num ) %>!430 Added <b><?= $link_name ?></b> as <?= getPermaLink( $link_num ) ?>! 426 431 <br /> 427 432 Add 'nother link? 428 433 <br /> 429 434 </div> 430 < %435 <?php 431 436 } else if( preg_match( ":add:", $REQUEST_URI )) { 432 437 $op = "mobile_bitch"; 433 438 } else { 434 %>439 ?> 435 440 <h2>This page is usually used with the <u>Feed Me Links</u> Button (or "Bookmarklet") to add links</h2> 436 441 (go <a href="/install">here</a> to get the <a href="/install">Bookmarklet</a>) 437 442 <p /> 438 < %443 <?php 439 444 } 440 %>445 ?> 441 446 442 447 <br /> 443 448 <form action="categorize" method="post"> 444 449 445 < %if( $op == "mobile_bitch" ) {450 <?php if( $op == "mobile_bitch" ) { 446 451 startTell( "<img src='/img/mobile-header.gif' alt='for our nomadic users...'/>", "600"); 447 %>452 ?> 448 453 <input type="hidden" name="from" value="mobile_bitch" /> 449 < % } %>454 <?php } ?> 450 455 451 456 <div class="attention" style="width: 50em;"> … … 458 463 <tr> 459 464 <td align="right">url: </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> 461 466 <td> </td> 462 467 </tr> 463 468 <tr> 464 469 <td align="right">name: </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> 466 471 </tr> 467 472 </table> … … 480 485 </form> 481 486 482 < %487 <?php 483 488 if( $op == "mobile_bitch" ) { 484 489 endTell(); … … 509 514 else 510 515 echo bounceTo( $site . "/login?bounceToPage=$bounce" ); 511 %>512 513 < %}516 ?> 517 518 <?php } 514 519 new gzip_encode(); 515 %>520 ?> feedmelinks/lib/FeedMeLinks/Bot.pm
r1357 r1360 3 3 #use strict; 4 4 5 require Encode; 5 6 use Data::Dumper; 6 7 use Date::Format; … … 12 13 use MIME::Base64; 13 14 use XML::XPath; 14 require Encode; 15 16 my $logfile = FeedMeLinks::Environment::get_webserver_root() . "/_logs/aim.log"; 17 print "opening $logfile\n"; 18 open(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 27 log_mesg( \*LOG, "starting run" ); 15 28 16 29 my $www = get_proxy( FeedMeLinks::Environment::get_bot_user(), FeedMeLinks::Environment::get_bot_password()); … … 24 37 $message = strip_html( $message ); 25 38 39 print "handle_resopnse can see site = $site\n"; 40 26 41 # init user 27 42 28 43 my $fml_username = is_user_validated( $sender ); 29 44 $fml_username .= ""; # type coerce 30 print "fml_username: $fml_username\n";31 45 if( ! $fml_username ) { 32 print "bulding FAKE session for $sender\n";33 46 $sessions_ref->{"$sender"} = build_empty_session(); 34 47 if( ! $sessions_ref->{ $sender }->{ "seen_welcome" } ) { … … 41 54 $sessions_ref->{ $sender }->{ "seen_welcome" } = 1; 42 55 } 43 print "bulding real session for $sender\n";44 56 $sessions_ref->{"$sender"} = build_authenticated_session( $fml_username ); 45 57 } … … 53 65 if( $sessions_ref->{ $sender }->{ "validated" } ) { 54 66 my $url = $message; 55 print "orig url is $url\n";56 67 $url =~ s/^add //; 57 68 $url = add_prefix( $url ); … … 63 74 my $encoded_url = $url; 64 75 $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"; 66 77 67 78 my $response = $sessions_ref->{$sender}->{"proxy"}->get( "$site/api/add?url=$encoded_url&name=$encoded_name", []); … … 69 80 my $info = $xp->getNodeText( "/result" ); 70 81 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"; 73 84 if( $info =~ m/http/ ) { 74 85 my $link_id = $info; 75 86 $link_id =~ s/.*com\///; 76 print " link_id: $link_id\n";87 print "< FML server gave us link ID: $link_id\n"; 77 88 $sessions_ref->{$sender}->{"last_link"} = $link_id; 78 89 $sessions_ref->{$sender}->{"last_action"} = "added_link"; … … 153 164 $aim->send_im($sender, "recent links here, soon! (not finished yet, sorry"); 154 165 166 } elsif( $message =~ m/(^log)/ ) { 167 log_mesg( \*LOG, "log test", " $message from $sender" ); 168 155 169 } elsif( $message =~ m/(recent|new)/ ) { 156 170 $aim->send_im($sender, "(soon!) show the last 10 links"); … … 182 196 183 197 sub is_user_validated { 198 log_mesg( \*LOG, "debug", " is_user_validated() - why is bri getting kicked off?" ); 184 199 my $sender = shift; 185 200 my $response = $www->get( "$site/api/backroom/is_im_account_known&user=$sender" , []); … … 188 203 $is_valid .= ""; 189 204 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"; 191 206 192 207 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"; 194 209 return "" . $fml_user; # stupid string conversion 195 210 } 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"; 197 212 return 0; 198 213 } … … 201 216 202 217 sub build_empty_session { 218 print "> building UNauthenticated session for $sender\n"; 203 219 return { 204 220 'last_link' => 'none yet', … … 216 232 my $u = $_[0]; 217 233 my $p; 234 print "> building authenticated session for $u\n"; 218 235 219 236 print "> passing user: $u\n"; … … 297 314 } 298 315 299 sub print_version { print get_version() . "\n"; }316 sub print_version { print "> " . get_version() . "\n"; } 300 317 301 318 sub get_version { 319 my $version = "0.1.6"; 302 320 $^T = time; 303 321 my $d = -M "/home/fml/public_html/lib/FeedMeLinks/Bot.pm"; 304 322 $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 326 sub 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 334 sub 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; 306 347 } 307 348 feedmelinks/login.php
r1353 r1360 79 79 } 80 80 } else { 81 log_mesg_to( " WARN. attempted login from invalidated user $userId", "global" );81 log_mesg_to( "[attempted login by invalidated user] $userId", "security" ); 82 82 warn( "Your account was temporarily disabled. Please your email for the link to re-enable your account."); 83 notify_expired( $userId );84 83 return; 85 84 } feedmelinks/modules/menu.inc.php
r1350 r1360 5 5 6 6 <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. 8 8 9 9 feedmelinks/modules/utils.inc.php
r1355 r1360 349 349 <input type="hidden" name="user" value="<?= $user ?>" /> 350 350 <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 ?>" /> 352 352 </form> 353 353 <?php … … 589 589 return 90; # FIXME: move into server config 590 590 } 591 592 function make_safe_for_email( $s ) { 593 $s = preg_replace( "/&/", "&", $s ); 594 $s = preg_replace( "/"/", "\"", $s ); 595 $s = preg_replace( "/'/", "'", $s ); 596 return $s; 597 } 598 599 function 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 604 Hey $grabbee. 605 606 It looks like $grabber ($site/u/$grabber) liked your link $name ($site/$orig_link_ID)! 607 608 Nice work, 609 610 -- 611 612 The Feed Me Links Lovebot 613 614 END; 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 } 591 623 592 624 function notify_expired( $u ) { 593 $site = "http://" . get_domain(); 625 $site = get_site(); 626 $days = get_num_days_allowed_idle(); 627 $code = md5( getPasswdForUser( $u )); 594 628 $body = "Hello, $u. 595 629 596 630 It 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 597 631 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 )) . "632 Because 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 634 To Re-Enable your account, just click this link: $site/user/re-enable?user=$u&code=$code 601 635 602 636 (To completely REMOVE your account, please click $site/user/remove-me?user=$u) … … 609 643 $success = mail( $to, "Long time, no link : You haven't used Feed Me Links lately", $body, $headers); 610 644 if( $success ) 611 log_mesg_to( " sent expiration notification mail to$to", "mail" );645 log_mesg_to( "[user expiration notification] $to", "mail" ); 612 646 return $success; 613 647 } … … 1077 1111 $pi["moodmat"] = true; 1078 1112 $pi["webgirl"] = true; 1113 $pi["marker_pen"] = true; 1079 1114 1080 1115 #$pi["khemraj"] = true; … … 1882 1917 1883 1918 <br /> 1884 <h2> <%= $argUser %> has no peeps... what a LOSER! </h2> 1919 (<%= $argUser %> has not added any peeps yet). 1885 1920 1886 1921 <% … … 1946 1981 $inList = inList( $user, "contacts", get_cache() ) ; 1947 1982 if( ! $inList ) { 1948 $r .= "< a href='" . getSiteURL() . "/contacts/add?user=$user'>"1983 $r .= "<small><a href='" . getSiteURL() . "/contacts/add?user=$user'>" 1949 1984 . "<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>") 1951 1986 . "" 1952 1987 ; … … 1955 1990 $r .= "<a href=\"" . getSiteURL() . "/contacts/\">" 1956 1991 . "<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>" : "" ) 1959 1994 ; 1960 1995 #$r = "<small>(" . get_ownoun() . " peep)  (<a href='/contacts/remove?user=$user'>remove?</a>)</small>"; … … 3687 3722 } 3688 3723 3724 function get_link_name( $argId ) { 3725 return getTitleForLink( $argId ); 3726 } 3727 3728 # deprecated, use get_link_name 3689 3729 function getNameForLink( $argId ) { 3690 3730 return getTitleForLink( $argId ); feedmelinks/submit-link.php
r1331 r1360 1 < %1 <?php 2 2 ob_start(); 3 3 include_once( "modules/class.gzip_encode.inc.php" ); … … 52 52 mysql_selectdb( getDBName() ); 53 53 if( $op == "submit" ) { 54 %>55 56 tagging link "<a href="< %= $url %>"><%= $name %></a>"...<br />57 58 < %54 ?> 55 56 tagging link "<a href="<?= $url ?>"><?= $name ?></a>"...<br /> 57 58 <?php 59 59 if( $debug ) { 60 60 echo "<br />"; … … 88 88 89 89 if( $from == "mobile_bitch" ) { 90 %>90 ?> 91 91 <div class="attention"> 92 92 link added, mobile bitch 93 93 </div> 94 < %94 <?php 95 95 echo bounceTo( "/add/success?link_name=" . urlencode( $name ) . "&link_num=$newLinkID" )