Changeset 1278
- Timestamp:
- 12/30/06 11:24:00 (2 years ago)
- Files:
-
- feedmelinks/.htaccess-global (modified) (1 diff)
- feedmelinks/FAQ/index.php (modified) (1 diff)
- feedmelinks/action.php (modified) (1 diff)
- feedmelinks/comments.php (modified) (7 diffs)
- feedmelinks/contacts/add.php (modified) (1 diff)
- feedmelinks/contacts/remove.php (modified) (1 diff)
- feedmelinks/contacts/testing.php (modified) (1 diff)
- feedmelinks/diespammersdie/index.php (modified) (1 diff)
- feedmelinks/diespammersdie/report.php (modified) (1 diff)
- feedmelinks/modules/header.inc.php (modified) (2 diffs)
- feedmelinks/modules/utils.inc.php (modified) (17 diffs)
- feedmelinks/modules/view-link.inc.php (modified) (1 diff)
- feedmelinks/portal-uncached.php (modified) (2 diffs)
- feedmelinks/script/mootools.js (added)
- feedmelinks/style/main.css (moved) (moved from feedmelinks/style/new-portal.css)
- feedmelinks/testing/contacts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
feedmelinks/.htaccess-global
r1226 r1278 26 26 RewriteRule ^([0-9]+)$ /?l=$1 [L] 27 27 RewriteRule ^([0-9]+)/d$ /?l=$1&debug=1 [L] 28 RewriteRule ^([0-9]+)/m/(.*)$ /?l=$1&mesg=$2 [L] 28 29 29 30 # grab links feedmelinks/FAQ/index.php
r1082 r1278 151 151 <div class="q">Can I have the source code to Feed Me Links?</div> 152 152 <div class="a"> 153 Of course! We're all about sharing. <a href="/code">Download the source to Feed Me Links at <u>feedmelinks.com/code</u></a> 153 Of course! We're all about sharing. The code is a total mess, so, you know -- be forewarned.<p/> 154 155 if you just want to <b>read</b> the source code, you can browse it online at: <a href="/code">Download the source to Feed Me Links at <u>feedmelinks.com/code</u></a> 156 <p/> 157 if you want to check-out / download it, you'll need <a href="http://subversion.tigris.org/">Subversion</a>. From a command-line, type: <p/> 158 <code> 159 svn co http://toolstomaketools.svnrepository.com/svn/codepot/feedmelinks/ 160 </code> 161 154 162 </div> 155 163 <a href="#top">back to top</a> feedmelinks/action.php
r1178 r1278 250 250 <% } else { %> 251 251 252 <link rel="stylesheet" type="text/css" href="/ new-portal.css" title="default stylings">252 <link rel="stylesheet" type="text/css" href="/style/main.css" title="default stylings"> 253 253 <div class='welcome'> 254 254 no links selected;<br/> feedmelinks/comments.php
r961 r1278 1 < %1 <?php 2 2 # $Id$ 3 3 include_once( "modules/utils.inc.php" ); … … 11 11 $authenticated = 1; 12 12 $user = $who ? $who : $sessionUserId; 13 %>13 ?> 14 14 15 15 <title> Feed me comments </title> 16 16 17 <% 18 include( "$modules/header.inc.php" ); 19 %> 17 <?php 18 include( "$modules/header.inc.php" ); 19 $show_comments = true; 20 21 if( $op == "delete" ) 22 $show_comments = false; 23 ?> 20 24 21 25 <h3> 22 <% 23 if( $who ) 24 echo "Comments by and about $who"; 25 else 26 echo "My Comments"; 27 %> 26 <?php 27 if( $who ) 28 echo "Comments by and about $who"; 29 else if( $op == "delete" ) 30 echo "Delete comment:"; 31 else 32 echo "My Comments"; 33 ?> 28 34 </h3> 35 <?php 36 if( $op == "delete" && getOwnerForLink( $link ) == $u ) { 37 38 $comments = get_file_safe( get_comments_file( $link, $u )); 39 if( ! array_key_exists( $comment, $comments )) 40 bounceBack(); 41 42 # cache it for displaying in any error messages 43 $c = parse_comment( $comments[ $comment ]); 44 echo '"' . $c["comment"] . '"' . " by " . getUserLink( $c["user"] ) . " from " . formatAsSimpleDate( $c["date"]) . " on " . getLink( $link ) . "</p>"; 45 46 if( $debug ) 47 echo "<p>comment #$comment</p>"; 48 49 # back up the comment file so the deletion can be un-done if necessary 50 $undo_file = get_undo_file( $u, "comment", "delete" ); 51 file_append_contents( $undo_file, $link . ":" . $comments[ $comment ]); 52 53 # remove the comment line from the array 54 $new_comments = $comments; 55 unset( $new_comments[ $comment ]); 56 if( $debug ) { 57 echo "<pre>post deletion"; 58 print_r( $new_comments ); 59 } 60 61 # write the modified array back into the comment file 62 file_put_contents( get_comments_file($link, $u), implode( "", $new_comments )); 63 64 # send the user back to the link page with a note that the comment was deleted 65 echo bounceTo( "/$link/m/Comment+deleted.", 1 ); 66 67 } 68 if( $show_comments ) { 69 ?> 29 70 30 71 <div style="width: 630px; height: 400px;"> 31 72 32 73 <div class="column" style="float: left;"> 33 <span style="font-weight: bold; text-transform: uppercase">others' comments on < %= $who ? $who . "'s" : "YOUR" %> links:</span>74 <span style="font-weight: bold; text-transform: uppercase">others' comments on <?= $who ? $who . "'s" : "YOUR" ?> links:</span> 34 75 <div class="onepxlline"> </div> 35 76 <br /> 36 77 37 < %78 <?php 38 79 chdir( get_webserver_root() ); 39 80 $cmd = "find _comments/$user -type f | xargs -n1 grep -H -v $user | sort -rk 2"; … … 50 91 if( $debug ) 51 92 echo "got here<br />"; 52 %>53 <b>< %= $n %> <%= $n == 1 ? "comment" : "comments" %></b>:<br />54 < %93 ?> 94 <b><?= $n ?> <?= $n == 1 ? "comment" : "comments" ?>b>:<br /> 95 <?php 55 96 56 97 foreach ($oba as $line) { … … 76 117 } 77 118 } else { 78 %>119 ?> 79 120 <!-- DEBUG: 80 $o: < %= $o %>81 < %= $cmd %> failed with code <%= $r %>!121 $o: <?= $o ?> 122 <?= $cmd ?> failed with code <?= $r ?> 82 123 --> 83 124 84 <center>(nobody's added comments to < %= $who ? "$user's" : "your" %> links yet)</center>85 <br /> 86 < %125 <center>(nobody's added comments to <?= $who ? "$user's" : "your" ?> links yet)</center> 126 <br /> 127 <?php 87 128 } 88 %>129 ?> 89 130 90 131 <br /> 91 132 <span style="font-weight: bold; text-transform: uppercase"> 92 < %= $who ? ($who . "'s comments on his own links") : "Your comments on your own links" %>:</span>133 <?= $who ? ($who . "'s comments on his own links") : "Your comments on your own links" ?>span> 93 134 <div class="onepxlline"> </div> 94 135 <br /> 95 136 96 < %137 <?php 97 138 $c = 1; #counter 98 139 $the_dir = get_webserver_root() . '/_comments/' . $user; … … 127 168 } 128 169 } else { 129 %>170 ?> 130 171 <!-- 131 172 DEBUG: 132 < %= $cmd %> failed with code <%= $r%> !173 <?= $cmd ?> failed with code <?= $r?> ! 133 174 --> 134 175 <center> 135 (< %= $who ? "$who hasn't" : "you haven't" %> any comments to your links)176 (<?= $who ? "$who hasn't" : "you haven't" ?> any comments to your links) 136 177 </center> 137 178 <br /> 138 < %179 <?php 139 180 } # end if dir exists: 140 %>181 ?> 141 182 142 183 </div> 143 184 144 185 <div class="column" style="float: right;"> 145 <span style="font-weight: bold; text-transform: uppercase">< %= $who ? $who . "'s" : "" %> comments on others' links:</span>186 <span style="font-weight: bold; text-transform: uppercase"><?= $who ? $who . "'s" : "" ?> comments on others' links:</span> 146 187 <div class="onepxlline"> </div> 147 188 <br /> 148 189 149 < %190 <?php 150 191 chdir( get_webserver_root() ); 151 192 $cmd = "find _comments/ -type f | sort -r | xargs -n1 grep -H $user, | grep -v comments/$user | sort -r -k 2"; … … 179 220 } 180 221 } else { 181 %>182 <center>(< %= $who ? "$user has" : "you've" %> made no comments here yet)</center>222 ?> 223 <center>(<?= $who ? "$user has" : "you've" ?> made no comments here yet)</center> 183 224 <br /> 184 225 <!-- DEBUG: 185 $o: < %= $o %>186 < %= $cmd %> failed with code <%= $r %>!226 $o: <?= $o ?> 227 <?= $cmd ?> failed with code <?= $r ?> 187 228 --> 188 < %229 <?php 189 230 } 190 %>231 ?> 191 232 192 233 </div> … … 197 238 <br /> 198 239 <div width="650"> 199 <% include( "$modules/footer.inc.php" ); %> 200 </div> 201 202 <% } else { %> 203 <%= bounceTo( $site . "/login?bounceToPage=" . urlencode( "comments" )) %> 204 <% } %> 205 240 <?php include( "$modules/footer.inc.php" ); ?> 241 </div> 242 243 <?php 244 } 245 } else { ?> 246 <?= bounceTo( $site . "/login?bounceToPage=" . urlencode( "comments" )) ?> 247 <?php } ?> 248 feedmelinks/contacts/add.php
r1276 r1278 6 6 $u = $_COOKIE["c_uid"]; 7 7 %> 8 <link rel="stylesheet" type="text/css" href="/ new-portal.css" title="default stylings">8 <link rel="stylesheet" type="text/css" href="/style/main.css" title="default stylings"> 9 9 <% 10 10 feedmelinks/contacts/remove.php
r427 r1278 6 6 $u = $_COOKIE["c_uid"]; 7 7 %> 8 <link rel="stylesheet" type="text/css" href="/ new-portal.css" title="default stylings">8 <link rel="stylesheet" type="text/css" href="/style/main.css" title="default stylings"> 9 9 <% 10 10 feedmelinks/contacts/testing.php
r427 r1278 6 6 $u = $_COOKIE["c_uid"]; 7 7 %> 8 <link rel="stylesheet" type="text/css" href="/ new-portal.css" title="default stylings">8 <link rel="stylesheet" type="text/css" href="/style/main.css" title="default stylings"> 9 9 <% 10 10 feedmelinks/diespammersdie/index.php
r1248 r1278 9 9 </title> 10 10 11 <link href="/style/ new-portal.css" rel="stylesheet" type="text/css">11 <link href="/style/main.css" rel="stylesheet" type="text/css"> 12 12 <link href="/style/one-page.css" rel="stylesheet" type="text/css"> 13 13 feedmelinks/diespammersdie/report.php
r1177 r1278 9 9 </title> 10 10 11 <link href="/style/ new-portal.css" rel="stylesheet" type="text/css">11 <link href="/style/main.css" rel="stylesheet" type="text/css"> 12 12 <link href="/style/one-page.css" rel="stylesheet" type="text/css"> 13 13 feedmelinks/modules/header.inc.php
r1272 r1278 21 21 <link rel="shortcut icon" href="/img/favicon.png" type="image/png"> 22 22 <% if( $css ) { %><link rel="stylesheet" type="text/css" href="<%= $css %>"><% } %> 23 <link rel="stylesheet" type="text/css" href="/style/new-portal.css"> 24 <link rel="stylesheet" type="text/css" href="/style/notebox.css"> 23 <link rel="stylesheet" type="text/css" href="/style/main.css"> 25 24 <link rel="alternate" type="application/rss+xml" title="Feed Me Links" href="<?= $site ?>/rss"> 26 25 … … 56 55 if( ! $noBody ) 57 56 echo "<body>"; 57 ?> 58 59 <script type='text/javascript' src='http://track3.mybloglog.com/js/jsserv.php?mblID=2006121201422511'></script> 60 61 <?php 58 62 if( ! $noMenu ) 59 63 include( "$modules/menu.inc.php" ); feedmelinks/modules/utils.inc.php
r1272 r1278 169 169 fclose( $f ); 170 170 } 171 } 172 173 # convenience function, now part of php5 174 function file_put_contents( $filename, $data ) { 175 return file_put_contents_driver( $filename, $data, "w+" ); 176 } 177 178 function file_append_contents( $filename, $data ) { 179 return file_put_contents_driver( $filename, $data, "a+" ); 180 } 181 182 function file_put_contents_driver( $filename, $data, $mode ) { 183 if( !$f = fopen($filename, $mode)) { 184 echo "Cannot open file ($filename)"; 185 exit; 186 } 187 if( fwrite($f, $data) === FALSE) { 188 echo "Cannot write to file ($filename)"; 189 exit; 190 } 191 fclose($f); 192 return "Success, wrote ($data) to file ($filename)"; 171 193 } 172 194 … … 562 584 $pi["samanthers"] = true; 563 585 $pi["r34l"] = true; 586 $pi["chrishaney"] = true; 587 $pi["troubledyouth"] = true; 564 588 565 589 #$pi["rrhobbs"] = true; … … 582 606 $config = new Config; 583 607 608 function mk_folder( $f ) { 609 if( !$f || is_dir( $f )) 610 return; 611 $old_umask = umask(0); 612 mkdir( $f ); 613 umask($old_umask); 614 } 615 584 616 function make_user_dir( $u ) { 585 617 chdir( get_root() ); 586 618 $u_dir = get_user_folder( $u ? $u : get_user() ); 587 619 if( ! is_dir( $u_dir )) { 588 $old_umask = umask(0); 589 mkdir( $u_dir ); 590 umask($old_umask); 620 mk_folder( $u_dir ); 591 621 } 592 622 if( !is_dir( $u_dir )) … … 663 693 } 664 694 665 666 695 function startTell( $t = "", $wide = false ) { 667 696 %> 697 <link rel="stylesheet" type="text/css" href="/style/notebox.css"> 668 698 <div class="notebox" <%= $wide ? 'style="width: 600px; margin-left: auto; margin-right: auto;"' : ""%>> 669 699 <div class="noteboxHead" <%= $wide ? 'style="font-size: 140%;"' : ""%>><h2><%= $t %></h2></div> … … 716 746 $linkfolder = $COMMENT_DIR . $folder; 717 747 return( get_root() ."/" . $COMMENT_DIR . $folder . escapeshellcmd( $l ) . $COMMENT_EXT ); 748 } 749 750 function get_undo_file( $u, $noun, $verb ) { 751 if( ! $u ) 752 return; 753 $u = escapeshellcmd( $u ); 754 $f = get_root() ."/" . get_user_folder( $u ) . "/undo"; 755 if( ! is_dir( $f )) 756 mk_folder( $f ); 757 if( $noun ) 758 mk_folder( "$f/$noun" ); 759 $noun = $noun ? $noun : "last"; 760 return "$f/$noun" . ($verb ? "/$verb" : ""); 718 761 } 719 762 … … 1475 1518 if( $debug ) 1476 1519 echo "<br><b>making usr dir..</b><br>"; 1477 $old_umask = umask(0); 1478 mkdir( $u_dir ); 1479 umask($old_umask); 1520 mk_folder( $u_dir ); 1480 1521 } 1481 1522 if( is_writable( $argCacheFile )) { … … 2400 2441 } 2401 2442 2443 function parse_comment( $c ) { 2444 if( ! $c ) 2445 return ; 2446 $pieces = explode(", ", $c); 2447 return array( "user" => $pieces[0], "date" => $pieces[1], "comment" => $pieces[2]); 2448 } 2449 2402 2450 function getCommentCSS() { 2403 2451 return ' … … 2452 2500 } 2453 2501 2502 # flock a file and read into an array 2503 function get_file_safe( $fname ) { 2504 if( !$fname ) 2505 return; 2506 ignore_user_abort(true); 2507 $f = fopen( $fname, 'r' ); 2508 flock( $f, LOCK_SH ); 2509 $lines = file( $fname ); 2510 flock( $f, LOCK_UN ); 2511 fclose( $f ); 2512 return $lines; 2513 } 2514 2454 2515 function getCommentsForLink() { 2455 2516 $args = func_get_args(); … … 2457 2518 $argUser = $args[1]; 2458 2519 $debug = 0; 2459 #$debug = $args[2];2520 $u = get_user(); 2460 2521 2461 2522 $link = $argId; … … 2464 2525 2465 2526 $owner = getOwnerForLink( $link ); 2527 $yours = ($u == $owner) ? true : false; 2466 2528 $linkfile = get_comments_file( $link, $owner ); 2467 2529 … … 2469 2531 if( $debug ) 2470 2532 echo "(COMMENTS FILE $link$COMMENT_EXT EXISTS AND IS READABLE)<br /><br />"; 2471 2472 # flock comments file and read into an array 2473 ignore_user_abort(true); 2474 $f = fopen( $linkfile, 'r' ); 2475 flock( $f, LOCK_SH ); 2476 $lines = file( $linkfile ); 2477 flock( $f, LOCK_UN ); 2478 fclose( $f ); 2533 2534 # flock comments file and read into an array 2535 $lines = get_file_safe( $linkfile ); 2479 2536 2480 2537 %> … … 2509 2566 } 2510 2567 2511 echo "<div class=\"$class\" style=\"width: 40em;\">$comment</div><br />"; 2568 echo "<div class=\"$class\" id=\"comment_" . $argId . "_" . $line_num . "\" style=\"width: 40em;\">$comment"; 2569 echo "<p/>"; 2570 if( $yours ) 2571 echo "[<a href='/comments?op=delete&link=$argId&comment=$line_num'>delete</a>]"; 2572 echo "</div><br />"; 2512 2573 } 2513 2574 } else { … … 2521 2582 echo "NO LINK or INVALID LINK ID ($argID)<br />"; 2522 2583 } 2523 #if( ! $comments )2524 #echo " NO COMMENTS FOR THIS LINK EXIST (YET)<br />";2525 2584 if( $argUser && $argUser != "nobody") 2526 2585 echo getAddCommentForm( $argId, $comments, $debug ); … … 2761 2820 2762 2821 if( !is_dir( $linkfolder ) || !is_writable( $linkfolder )) { 2763 $old_umask = umask(0); 2764 mkdir( $linkfolder ); 2765 umask($old_umask); 2822 mk_folder( $linkfolder ); 2766 2823 } else 2767 2824 if( $debug ) … … 3361 3418 3362 3419 function getLink( $id, $url, $text, $title, $class, $target ) { 3420 ob_start(); 3363 3421 if( $url && $text) { 3364 ob_start();3365 3422 $url = encodeAmps( $url ); 3366 3423 $title = $title ? "title=\"" . encodeAmps( $title ) . "\"" : ""; … … 3368 3425 $target = $target ? "target=\"$target\"" : ""; 3369 3426 %><a <%= $title ? $title : "" %> href="<%= $url %>" <%= $class %> <%= $target %>><%= $text %></a><%= isPrivate( $id ) ? " " . getLinkLock( $id ) : "" %><% 3370 $out = ob_get_clean(); 3371 return $out; 3372 } 3427 } else if( $id ) { 3428 %><a href="/<%= $id %>"><%= getTitleForLink( $id ) %></a><% 3429 } 3430 $out = ob_get_clean(); 3431 return $out; 3373 3432 } 3374 3433 … … 3610 3669 return $txt; 3611 3670 } 3671 3672 function formatAsSimpleDate( $ts ) { 3673 return preg_replace( "/T.*$/", "", formatAsDCDate( $ts )); 3674 } 3612 3675 3613 3676 function formatAsDCDate( $ts ) { feedmelinks/modules/view-link.inc.php
r1188 r1278 26 26 $owned = ( $user == $u ) ? 1 : 0; 27 27 28 if( $mesg ) { 28 29 %> 29 30 30 <div class="attention" style="width: 45em;"> 31 <div class="warning"> 32 <?= $mesg ?> 31 33 </div> 32 34 <% 35 36 } 33 37 if( $owned ) { 34 38 %> feedmelinks/portal-uncached.php
r1184 r1278 26 26 <meta name="ICBM" content="42.544396, -83.213255"> 27 27 <meta name="DC.title" content="Feed Me Links!"> 28 <link rel="stylesheet" type="text/css" href="style/ new-portal.css" title="default stylings">28 <link rel="stylesheet" type="text/css" href="style/main.css" title="default stylings"> 29 29 </head> 30 30 … … 64 64 </div> 65 65 66 <link rel="stylesheet" type="text/css" href="/style/ new-portal.css">66 <link rel="stylesheet" type="text/css" href="/style/main.css"> 67 67 <style type="text/css"> 68 68 .peepBox { feedmelinks/testing/contacts.php
r475 r1278 11 11 12 12 %> 13 <link rel="stylesheet" type="text/css" href="/ new-portal.css" title="default stylings">13 <link rel="stylesheet" type="text/css" href="/style/main.css" title="default stylings"> 14 14 15 15 <pre>