Changeset 1302

Show
Ignore:
Timestamp:
01/29/07 13:47:12 (2 years ago)
Author:
jm3
Message:
  • initial JSON api stubs in prep for ajax redesign
  • developer docs
  • more php tag cleanup

Files:

Legend:

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

    r1301 r1302  
    5353 
    5454# JSON API 
     55RewriteRule    ^json/([0-9a-z-]+)$ /json/index.php?dispatch_to=$1 [L] 
     56 
    5557 
    5658# folder links 
  • feedmelinks/FAQ/index.php

    r1278 r1302  
    4646                        <li><a href="#xml_rss">RSS Feeds - How to syndicate your links</a></li> 
    4747                        <li><a href="#apis">Programming Feed Me Links - The Feed Me Links API</a></li> 
     48                        <li><a href="#developers">Programming Feed Me Links - Developer Sandbox</a></li> 
    4849 
    4950                        <li><a href="#q7"  >How do I include a list of my links on my blog/webpage?</a></li> 
     
    426427                <a href="#top">back to top</a> 
    427428        </div> 
     429         
     430        <div> 
     431                <a name="developers"></a> 
     432                <div class="q">Programming Feed Me Links - Developer's Sandbox</div> 
     433                <div class="a"> 
     434                        please see <a href="http://developers.feedmelinks.com">developers.feedmelinks.com</a>. 
     435                </div> 
     436                <a href="#top">back to top</a> 
     437        </div> 
    428438 
    429439        <div> 
  • feedmelinks/diespammersdie/report.php

    r1278 r1302  
    1 <% 
     1<?php 
    22        include_once( "../modules/utils.inc.php" ); 
    3 %
     3?
    44<html> 
    55<head> 
     
    1919<body> 
    2020 
     21 
    2122<form action="report" name="confirm_flag_form" method="post"> 
    2223        <input type="hidden" name="confirm" value="true" /> 
     
    2526        <div id="main"> 
    2627 
    27 <% 
     28<? 
    2829        if( !$user ) { 
    2930                echo "<h1>whoops.</h1>"; 
     
    3334 
    3435        if( $confirm != "true" ) { 
    35 %
     36?
    3637 
    3738                        <div class="rowbox"> 
    38                                 <h1 style="margin-top: 0px; margin-bottom: 24px;">Really report  <u><%= $user %></u> as a spammer?</h1> 
     39                                <h1 style="margin-top: 0px; margin-bottom: 24px;"> 
     40                                        Really report <%= getBareUserLink( $user ) %> as a spammer?</h1> 
    3941 
    4042                                        <input type="submit" value="Yes. <%= ucfirst( $user ) %> is a complete spamming scumbag." /> 
    4143                                        <p /> 
    4244                                        <input type="button" value="No, I was totally kidding." onclick="history.go( -1 );" /> 
     45<?php 
     46        if( isJJE( $u )) 
     47                echo get_snuff_button( $user ); 
     48?> 
    4349 
    4450                        </div> 
    45                 <p /><center><a href="http://www.ehponline.org/docs/2005/113-3/fumigating.jpg" target="_blank"><img src="/img/fumigating.jpg" /></a></center> 
     51                <p /><center><a href="http://www.flickr.com/search/?q=bug+squish&m=tags&z=t" target="_blank"><img src="/img/fumigating.jpg" /></a></center> 
    4652 
    47 <% 
     53<?php 
    4854                return; 
    4955        }  
     
    5359        echo report_spammer( $user, $u ); 
    5460 
    55         if( 1 ) { 
    56 %> 
     61?> 
    5762 
    5863                        <div class="rowbox" style="padding-left: 1.0em; padding-top: 5px; padding-bottom: 5px;"> 
     
    6671                </form> 
    6772        </div> 
    68 <% } %> 
    6973 
    7074                <p /> 
    7175                <center> 
    7276                        <h2> 
    73                                 <a style="color: black;" href="/"> 
     77                                <a style="color: black;" href="javascript:history.go( -2 );"> 
    7478                                <p> 
    7579                                        Back to playing with links.... 
  • feedmelinks/index.php

    r1301 r1302  
    1 <% 
     1<?php 
    22        ob_start(); 
    33        include( "modules/class.gzip_encode.inc.php" ); 
    4  
    5         # $Id$ 
    6  
    74        include_once( "modules/utils.inc.php" ); 
    85        $page = "index"; 
     
    4643 
    4744                include( "$modules/header.inc.php" );  
    48 %
     45?
    4946 
    5047<br /> 
    5148 
    52 <% 
     49<?php 
    5350        } else { 
    5451                include( "$modules/header.insecure.inc.php" ); 
     
    6461                addCommentToLink( $l, $comment, $u, $debug ); 
    6562                $late_mesg = "Added comment!"; 
    66  
    67                 if( !$debug ) 
    68                         bounceTo( "/$l/m/Added+your+comment." ); 
     63                if( !$debug ) bounceTo( "/$l/m/Added+your+comment." ); 
    6964        } 
    7065 
    71         if( $l ) { 
     66        if( $l ) 
    7267                include( "$modules/view-link.inc.php" ); 
    73         } else if( $mesg ) { 
    74 %> 
    75 <div class="attention"> 
    76         <b><%= $mesg %></b><br /> 
    77         <img src="/img/dk-gray.gif" height="1" width="250" /><br /> 
    78 </div> 
    79 <br /> 
    80 <% 
    81         } 
     68        else if( $mesg ) 
     69                insert_message( $mesg ); 
    8270 
    83         ############################################################## 
    84          
    85         if( $op == "input" ) { 
    86                 $showLinks = 0; 
    87 %> 
     71        include( "modules/main-controller.inc.php" ); 
    8872 
    89 <form> 
    90 <div class="attention"> 
    91         <b>add a link</b><br /> 
    92         <img src="/img/dk-gray.gif" height="1" width="250" /><br /> 
    93   <input name="op" value="submit" type="hidden" /> 
    94 <% if( $from == "toolbar" ) { %> 
    95   return to URL after saving to my links? <input class="light" name="bounce" checked type="checkbox" /> 
    96 <% } %> 
    97 <% include( "$modules/addLinkForm.inc.php" ); %> 
    98 </div> 
    99 </form> 
    100 <% 
     73        if( $showLinks ) 
     74                include( "modules/main-interface.inc.php" ); 
    10175 
    102         ############################################################## 
     76        include( "$modules/footer.inc.php" );  
    10377 
    104         } else if( $op == "makeNewFolderAndSubmit" ) { 
    105                 if( $debug ) 
    106                         echo "DEBUG: ADDING <b>$linkName</b> ($url)TO NEW FOLDER $newFolderName<br />\n"; 
    107                 if( $url && $linkName ) { 
    108                         if( $newFolderName ) { 
    109                                 echo "adding <b>$linkName</b> to <b>$newFolderName</b>...<br />\n"; 
    110                                 $url = prepURLforSubmit( $url ); 
    111                                 $name = urlencode( $linkName ); 
    112                                 $submitter = urlencode( $u ); 
    113                                 $isPrivate = $isPrivate ? 1 : "NULL"; 
    114  
    115                                 # first we create the new category 
    116                                 $folderId = addFolder( $newFolderName, $u ); 
    117  
    118                                 # make sure the category is public, because we want new categories created public by default: 
    119                                 if( $folderId ) { 
    120                                         echo "created <b>$newFolderName</b>.<br />\n"; 
    121                                 }  
    122  
    123                                 # then we add the link: 
    124                                 $q = addLink( $url, $name, $submitter, $folderId, $isPrivate, $options ); 
    125                                 if( $q ) { 
    126                                         echo "link added!<br />\n";  
    127  
    128                                         if( $loggedIn == "wasnt" || $newFolderName  ) { 
    129 %> 
    130         <script type="text/javascript"> history.go( -3 ); </script> 
    131 <% 
    132                                         } else { 
    133 %> 
    134         <script type="text/javascript"> history.go( -2 ); </script> 
    135 <% 
    136                                         } 
    137                                 } else { # link add failed 
    138                                         echo "sorry, something bad happened and your new link wasn't added."; 
    139                                         echo "please click your back button and try again, or email " . get_maintainer_email() . ".<br />\n"; 
    140                                 } 
    141  
    142                         } else { 
    143                                 echo "no new folder to create, try again.";  
    144                         } 
    145  
    146                 } else { 
    147                         echo "no url to add, try again.";  
    148                 } 
    149  
    150         } else if( $op == "submit" ) { 
    151                 if( $url && $name ) { 
    152                         echo "submitting link..."; 
    153                         $url = prepURLforSubmit( $url ); 
    154                         $name = urlencode( $name ); 
    155                         if( !$groupid || $from == "toolbar" ) { 
    156                                 $groupid = "NULL"; 
    157                         } else {  
    158                                 $groupid = $groupid; 
    159                         } 
    160                         $submitter = urlencode( $u ); 
    161                         $isPrivate = $isPrivate ? 1 : "NULL"; 
    162                         $options = ""; # not yet implemented 
    163  
    164 %> 
    165 <!--  
    166         calling: _dLink( <%= $url %>, <%= $name %>, <%= $submitter %>, <%= $groupid %>, <%= $isPrivate %> ); 
    167 --> 
    168 <% 
    169                         $q = addLink( $url, $name, $submitter, $groupid, $isPrivate, $options ); 
    170                         if( $q ) { 
    171                                 echo "link added!<br />\n";  
    172  
    173                                 if( $from == "toolbar" || $from == "funnel" ) { 
    174                                         $showLinks = 0; 
    175  
    176                                         if( $loggedIn == "wasnt" ) { 
    177                                            if( preg_match( "/MSIE.*Mac/", $HTTP_USER_AGENT )) { 
    178                                                         echo "ahh, THE DREADED MAC IE."; 
    179 %> 
    180                                         <script type="text/javascript"> history.go( -5 ); </script> 
    181 <% 
    182                                                  } else { 
    183 %> 
    184                                         <script type="text/javascript"> history.go( -3 ); </script> 
    185 <% 
    186                                                  } 
    187                                                          
    188                                         } else { 
    189 %> 
    190                                         <script type="text/javascript"> history.go( -2 ); </script> 
    191 <% 
    192                                         } 
    193  
    194                                 } else { 
    195                                         $showLinks = 0; 
    196                                         echo bounceWithDelay( urldecode( "/index" ), 1 ); 
    197                                 } 
    198                         } else {  
    199                                 echo "failed!";  
    200                         } 
    201                 } else { 
    202                         echo "no url to add, try again.";  
    203                 } 
    204  
    205         ############################################################## 
    206  
    207         } else if( $op == "edit" ) { 
    208                 $hotRow = $id; 
    209 %> 
    210 <form> 
    211 <input type="hidden" name="folder" value="<%= $folder %>" /> 
    212 <div class="attention"> 
    213 editing link '<%= $name %>':<br /> 
    214   <input class="light" name="op" value="commitEdit" type="hidden" /> 
    215 <% include( "$modules/addLinkForm.inc.php" ); %> 
    216 </div> 
    217 </form> 
    218 <% 
    219  
    220         ############################################################## 
    221  
    222         } else if( $op == "commitEdit" ) { 
    223                 if( strlen( $name ) > $MAX_NAME_LENGTH ) 
    224                         $displayName = substr( $name, 0, $MAX_NAME_LENGTH ) . "..."; 
    225                 else 
    226                         $displayName = $name; 
    227 %> 
    228                 <div class="small attention"> 
    229                 saving <b><%= $name %></b>... 
    230 <% 
    231                         $url = urlencode( $url ); 
    232                         $name = urlencode( $name ); 
    233                         $groupid = ($groupid && $groupid != "unfiled") ? $groupid : "NULL"; 
    234                         $createDate = urlencode( $createDate ); 
    235                         $submitter = urlencode( $u ); 
    236                         $isPrivate = $isPrivate ? 1 : "NULL"; 
    237  
    238     $qs = "REPLACE INTO links VALUES($id, '$url', '$name', '$createDate', NULL, '$submitter', $groupid, $isPrivate);"; 
    239                 $q = mysql_query( $qs ); 
    240                 if( $q ) {  
    241                         $showLinks = 0; 
    242 %> 
    243         <b>saved</b>. (window will close in 2 seconds) 
    244                 </div> 
    245 <% 
    246                         if( $from == "popup" ) { 
    247 %> 
    248  
    249 <script type="text/javascript"> 
    250         var timer = setTimeout( "window.close()", 2 * 1000 ); 
    251         window.resizeTo(437,146); 
    252 </script> 
    253  
    254 <% 
    255                         } 
    256                 } else {  
    257 %> 
    258 <div class="attention"> 
    259 <%= $qs %> 
    260 oh no! couldn't commit edit! 
    261 </div> 
    262 <% 
    263                 } 
    264          
    265         ############################################################## 
    266  
    267         } else if( $op == "confirmDelete" ) { 
    268                 $hotRow = $id; 
    269 %> 
    270 <div class="attention"> 
    271         <b>delete link:</b> 
    272         <br /> 
    273         <img src="/img/dk-gray.gif" height="1" width="250" /> 
    274         <br /> 
    275         <br /> 
    276         are you sure you want to delete the link '<%= $name %>'? 
    277         <p style="text-align:right;"> 
    278         <a href="<%= $page %>?op=delete&id=<%= $id %>&folder=<%= urlencode( $folder ) %>">yes</a> / <a href="<%= $page %>">no</a> 
    279         </p> 
    280 </div> 
    281 <br /> 
    282 <% 
    283  
    284         ############################################################## 
    285  
    286         } else if( $op = "delete" ) { 
    287                 $q = deleteLink( $id, $u ); 
    288                 if( $q ) { 
    289                         $showLinks = 0; 
    290 %> 
    291  
    292 <div class="small attention"> 
    293                 <b>link deleted</b>. (window will close in 2 seconds) 
    294 </div> 
    295         <script type="text/javascript">  
    296                 var timer = setTimeout( "window.close()", 2 * 1000 ); 
    297                 window.resizeTo(437,146); 
    298         </script> 
    299  
    300 <% 
    301                 } else { 
    302                         $_x = 1; 
    303                 } 
    304         } # end if delete  
    305         if( $showLinks ) { 
    306 %> 
    307  
    308 <% if( $debug != "nosubmit" ) { %> 
    309  
    310         <!-- start left --> 
    311         <div id="leftColumn"> 
    312  
    313 <?php 
    314   $num_links = get_simple_rs( getQuery( "links_per_user", $u )); 
    315         if( $num_links < 1 ) { 
    316                 include( "modules/new-user-no-links.inc.php" ); 
    317         } 
    318 ?> 
    319  
    320                 <div class="box"> 
    321                         <div class="subhead">  
    322 <?php 
    323         $qs = getQuery( "sorted_tags_per_user", $u ); 
    324         $q = mysql_query( $qs ); 
    325         if( $q ) 
    326                 $num_tags = $numRows = mysql_num_rows($q); 
    327         else { 
    328                 ?> <!-- ERROR: running <%= $qs %> --> <?php 
    329         } 
    330  
    331         $tagbox_title = ($num_tags < 4)  
    332                 ? "Tags are like labels for your links." :  
    333                 (  
    334                         get_ownoun()  
    335                         . " "  
    336                         . getCatsName()  
    337                         . " (Sort by: " 
    338                         . (( $taglist_sort_order == "alphabetic" ) ?  "<a href='" .  $page . "?taglist_sort_order=popularity'>Popularity</a>" : "Popularity" ) 
    339                         . " |"  
    340                         . (( $taglist_sort_order == "alphabetic" ) ?  "A-Z" : "<a href='" . $page . "?taglist_sort_order=alphabetic'>A-Z</a>") 
    341                                 ); 
    342  
    343                                 echo $tagbox_title; 
    344 ?> 
    345  
    346                         </div> 
    347  
    348 <?php    
    349  
    350  
    351         if( $num_tags > 4 ) { 
    352                 $qs2 = getQuery( "links_per_user", $u ); 
    353                 $q2 = mysql_query( $qs2 ); 
    354                 if( $q2 ) { 
    355                         $numLinks = mysql_result($q2,0); 
    356 ?> 
    357         <div class=""> 
    358                 <%= printLinkCount( $numLinks ) %> total links, 
    359 <% 
    360         $qs3 = getQuery( "num_unfiled" ) .  "AND links.submitter = '$u' ORDER BY $sortOrder $direction"; 
    361  
    362         if( $debug ) { 
    363                 e( "<br>" ); 
    364                 e( $qs ); 
    365         } 
    366  
    367         $q3 = mysql_query( $qs3 ); 
    368         $numLinks = ( $q3 && mysql_num_rows( $q3 )) ?  mysql_result($q3,0) : 0; 
    369         $bg = "class='r0'"; 
    370 %> 
    371                 <%= printLinkCount( $numLinks ) %>  
    372                 <a href="/f/unfiled"><b><em><%= getUnCattedName() %></em></b></a>. 
    373         </div> 
    374  
    375 <% include( "$modules/folder-list.inc.php" ); %> 
    376  
    377 <% 
    378                 } 
    379         } else { 
    380                 include( "modules/new-user-no-tags.inc.php" ); 
    381         } 
    382 %> 
    383  
    384         <p> 
    385                 <form action="edit-folder"> 
    386                  Add <%= getCatName() %>:  
    387                  <input class="text" name="name" value="<%= $folderToEdit ? $folderToEdit : "Type the tag name..." %>"  
    388                  onFocus="if( this.value == 'Type the tag name...')this.value='';"  
    389                  onBlur="if( this.value == '')this.value='Type the tag name...';"  
    390                  type="text"  
    391                  size="18" 
    392                  maxlength="36" 
    393                  /> 
    394                         <input type="hidden" name="op" value="createGroup" /> 
    395                         <input type="submit" class="button" value="Add tag" style="padding: 3px;" /> 
    396                 </form> 
    397         </p> 
    398  
    399         <?php 
    400         if( $num_tags > 3 ) { 
    401  
    402         ?> 
    403         <p> 
    404                 You can also <big><a href="/delete-unused-tags">Delete any unused tags</a></big>. 
    405         </p> 
    406         <?php 
    407         } 
    408         ?> 
    409         </div> 
    410 </div> 
    411  
    412 <div id="rightColumn"> 
    413         <div id="news" class="box"> 
    414                 <% include( "$modules/news-divs.inc.php" ); %> 
    415         </div> 
    416  
    417         <% include( "$modules/recent.inc.php" ); %> 
    418          
    419         <% include( "$modules/my-recent.inc.php" ); %> 
    420  
    421         <% include( "$modules/random-links.inc.php" ); %> 
    422 </div> 
    423  
    424 <% 
    425 } 
    426         } 
    427 %> 
    428 <% include( "$modules/footer.inc.php" ); %> 
    429  
    430 <% 
    43178} // end if login 
    43279 new gzip_encode(); 
    433 %
     80?
  • feedmelinks/modules/utils.inc.php

    r1301 r1302  
    66include_once( "env.inc.php" ); 
    77include( get_root() . "/modules/prep-cache.inc.php" ); 
     8 
     9function get_snuff_button( $user ) { 
     10        if( ! $user ) 
     11                return ""; 
     12        ob_start(); 
     13?> 
     14<form name="snuff_user_form" action="/admin/snuff" method="POST"> 
     15        <input type="hidden" name="user" value="<?= $user ?>" /> 
     16        <input type="hidden" name="confirm" value="true" /> 
     17        <input type="submit" style="padding: 3em; background-color: red;" value="GUARDLESS KILL: <?= $user ?>" /> 
     18</form> 
     19<?php 
     20        return ob_get_clean(); 
     21} 
     22 
     23 function insert_message( $mesg ) { 
     24 ?> 
     25 <div class="attention"> 
     26 <b><?= $mesg ?></b><br /> 
     27 <img src="/img/dk-gray.gif" height="1" width="250" /><br /> 
     28 </div> 
     29 <br /> 
     30<? 
     31} 
    832 
    933function dump( $var ) { 
  • feedmelinks/portal-uncached.php

    r1278 r1302  
    66        echo "\tob_start();\n"; 
    77        echo "\t\$modules = '" . $modules . "';\n"; 
    8         echo "\tinclude_once( \"\$modules/class.gzip_encode.inc.php\" );"; 
     8        echo "\tinclude( \"\$modules/class.gzip_encode.inc.php\" );"; 
    99 
    1010        echo "\n\t\$cached_page_include   = 1;"; 
     
    216216                <% echo "<" . "% \$u   = \$sessionUserId = \$_COOKIE['c_uid']; # " . $u . " %" . ">"; %> 
    217217                <% echo "<" . "% \$tok = \$myTok = \$_COOKIE['c_pass_token']; # " . $tok . " %" . ">"; %> 
    218                 <% echo "<" . "% include_once( '$modules/conditional-login-box.inc.php'); %" . ">"; %> 
     218                <% echo "<" . "% include( '$modules/conditional-login-box.inc.php'); %" . ">"; %> 
    219219        </div> 
    220220 
     
    231231                        new links 
    232232                </div> 
    233                 <% include_once( "$modules/recent-with-times.inc.php"); %> 
     233                <% include( "$modules/recent-with-times.inc.php"); %> 
    234234        </div> 
    235235 
     
    240240                </div> 
    241241                disabled for now 
    242                 <% #include_once( "$modules/recent-users.inc.php"); %> 
     242                <% #include( "$modules/recent-users.inc.php"); %> 
    243243        </div> 
    244244        --> 
     
    249249                        <span class="note">(top linking users)</span> 
    250250                </div> 
    251                 <% include_once( "$modules/highest-linking-users.inc.php"); %> 
     251                <% include( "$modules/highest-linking-users.inc.php"); %> 
    252252        </div> 
    253253 
    254254        <div id="news" class="box"> 
    255                 <% include_once( "$modules/news-divs.inc.php" ); %> 
     255                <% include( "$modules/news-divs.inc.php" ); %> 
    256256        </div> 
    257257 
  • feedmelinks/users.php

    r1273 r1302  
    118118        </p> 
    119119        <p> 
    120                 <form name="snuff_user_form" action="/admin/snuff" method="POST"> 
    121                         <input type="hidden" name="user" value="<%= $userId %>" /> 
    122                         <input type="hidden" name="confirm" value="true" /> 
    123                         <input type="submit" style="padding: 3em; background-color: red;" value="GUARDLESS KILL." /> 
    124                 </form> 
     120                <?= get_snuff_button( $userId ) ?> 
    125121        </p> 
    126122        <% } %>