Changeset 1334

Show
Ignore:
Timestamp:
02/16/07 14:17:21 (2 years ago)
Author:
jm3
Message:
  • massive database refactor; renamed tables and columns logically
  • cleaned up more asp-style tags so that Vim? font-locks them correctly
  • we have clean URLs now! http://feedmelinks.com/u/pheezy/tags/cassettes
  • probably broke some stuff; just let me know.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/account.php

    r1313 r1334  
    1616                                if( $email ) { 
    1717                                        $email = urlencode( $email ); 
    18                                         $qs = "UPDATE linksUsers SET email = '$email' WHERE userId = '$u'"; 
     18                                        $qs = "UPDATE users SET email = '$email' WHERE userId = '$u'"; 
    1919                                        $successEmail = mysql_query( $qs ); 
    2020                                        $showForm = 1; 
     
    4141                                if( $password1 == $password2 ) { 
    4242                                        $password = urlencode( $password1 ); 
    43                                         $qs = "UPDATE linksUsers SET password = '$password' WHERE userId = '$u'"; 
     43                                        $qs = "UPDATE users SET password = '$password' WHERE userId = '$u'"; 
    4444                                        $successPass = mysql_query( $qs ); 
    4545%> 
  • feedmelinks/action.php

    r1331 r1334  
    3131                        } else { 
    3232                                $where_clause = preg_replace( "/^ OR /", "", $where_clause); 
    33                                 $qs = "DELETE FROM linksGroups WHERE userid = '$u' AND ($where_clause);"; 
     33                                $qs = "DELETE FROM tags WHERE userid = '$u' AND ($where_clause);"; 
    3434                                if( $debug ) echo $qs; 
    3535                                $q = mysql_query( $qs ); 
     
    169169                                                $valuesClause = "$valuesClause($link, $tag) "; 
    170170                                                $c++; 
    171                                                 $qs = "INSERT INTO linksCategoriesXRef VALUES($link, $tag);"; 
     171                                                $qs = "INSERT INTO links_tags_xref VALUES($link, $tag);"; 
    172172                                                $q = mysql_query( $qs ); 
    173173                                                if( ! $q ) { 
     
    204204                                else 
    205205                                         $whereClause = "$whereClause OR"; 
    206                                 $whereClause = "$whereClause (linkID = $link AND catID = $folderID) "; 
     206                                $whereClause = "$whereClause (linkID = $link AND tagID = $folderID) "; 
    207207                                $c++; 
    208208                        } 
    209209 
    210                         $qs = "DELETE FROM linksCategoriesXRef $whereClause;"; 
     210                        $qs = "DELETE FROM links_tags_xref $whereClause;"; 
    211211                } else { 
    212212                        $errors = "Unknown operation parameter: \$op: $op"; 
     
    227227                                        $c++; 
    228228                                } 
    229                                 $qs = "DELETE FROM linksCategoriesXRef $whereClause;"; 
     229                                $qs = "DELETE FROM links_tags_xref $whereClause;"; 
    230230                                $q = mysql_query( $qs ); 
    231231                                if( !$q )  
  • feedmelinks/admin/shortlist.php

    r1331 r1334  
    3535        mysql_selectdb( getDBName() ); 
    3636 
    37         $qs = "SELECT u.userid, u.email, l.ID, l.userid, count(*) from linksUsers as u, links as l WHERE l.userid = u.userid AND disabled IS NULL group by u.userid ORDER BY $orderBy;"; 
     37        $qs = "SELECT u.userid, u.email, l.ID, l.userid, count(*) from users as u, links as l WHERE l.userid = u.userid AND disabled IS NULL group by u.userid ORDER BY $orderBy;"; 
    3838 
    3939        $q = mysql_query( $qs ); 
     
    5959 
    6060                        # count folders 
    61                         $qs2 = "SELECT count(*) FROM linksGroups WHERE userid='$userId'"; 
     61                        $qs2 = "SELECT count(*) FROM tags WHERE userid='$userId'"; 
    6262                        $q2 = mysql_query( $qs2 ); 
    6363                        if( $q2 ) $numFolders = mysql_result($q2,0); 
  • feedmelinks/admin/sudo-core.php

    r724 r1334  
    1111 
    1212        if( $who ) { 
    13                 $qs = "SELECT * FROM linksUsers WHERE userid LIKE \"%$who%\""; 
     13                $qs = "SELECT * FROM users WHERE userid LIKE \"%$who%\""; 
    1414                if( $debug ) 
    1515                        e( $qs ); 
  • feedmelinks/admin/userlist.php

    r1331 r1334  
    3636        mysql_selectdb( getDBName() ); 
    3737 
    38         $qs = "SELECT * from linksUsers ORDER BY $orderBy"; 
     38        $qs = "SELECT * from users ORDER BY $orderBy"; 
    3939        $q = mysql_query( $qs ); 
    4040        $numRows = mysql_num_rows($q); 
     
    5959 
    6060                        # count folders 
    61                         $qs2 = "SELECT count(*) FROM linksGroups WHERE userid='$userId'"; 
     61                        $qs2 = "SELECT count(*) FROM tags WHERE userid='$userId'"; 
    6262                        $q2 = mysql_query( $qs2 ); 
    6363                        if( $q2 ) $numFolders = mysql_result($q2,0); 
  • feedmelinks/categorize.php

    r1331 r1334  
    304304                                        # from=toolbar 
    305305                                        # op=submit 
    306                                         # groupid=XXXX 
    307306                                        # name=asd 
    308307                                        # url=http%3A//feedmelinks.com/testing/categories.php%3Furl%3Dfoo 
  • feedmelinks/delete.php

    r1331 r1334  
    2424</script> 
    2525 
    26 <% 
     26<?php 
    2727        $con_delete = mysql_connect(); 
    2828        mysql_selectdb( getDBName() ); 
     
    3737    $url = $link =  urldecode( mysql_result($q,0,"url")) ; 
    3838    $private = mysql_result($q,0,"isPrivate"); 
    39  
    40     $groupid = mysql_result($q,$i,"groupid"); 
    41  
    42     if( $groupid ) { 
    43       $qs2 = getQuery( "find_tag", $groupid ); 
    44       $q2 = mysql_query( $qs2 ); 
    45       $numRows2 = mysql_num_rows($q2); 
    46       if( $numRows2 ) { 
    47         $tag   = urldecode( mysql_result($q2,0,"name")); 
    48         $tagID = urldecode( mysql_result($q2,0,"ID")); 
    49         $isPrivate = urldecode( mysql_result($q2,0,"isPrivate")); 
    50       } 
    51     } else 
    52       $tag = "unnamed"; 
     39                $tag = "unnamed"; 
    5340    $public = 0; 
    5441    if( ! $isPrivate ) { 
     
    6552    $niceCreateDate = formatTS( $createDate ) ; 
    6653                conClose( $con_delete ); 
    67 %
     54?
    6855<form action="index"> 
    6956<input type="hidden" name="folder" value="<%= $tagID %>" /> 
  • feedmelinks/edit-folder.php

    r1331 r1334  
    3535                        $name = urlencode( $name ); 
    3636                        $isPrivate = $isPrivate ? 1 : "NULL"; 
    37                         $qs = "UPDATE linksGroups SET name = '$name', isPrivate = $isPrivate WHERE id = $id AND userid = '$u'"; 
     37                        $qs = "UPDATE tags SET name = '$name', isPrivate = $isPrivate WHERE id = $id AND userid = '$u'"; 
    3838 
    3939                        if( $debug ) { 
     
    9999                mysql_selectdb( getDBName() ); 
    100100 
    101                 $qs = "SELECT userid FROM linksGroups where ID = $id;"; 
     101                $qs = "SELECT userid FROM tags where ID = $id;"; 
    102102                $q = mysql_query( $qs ); 
    103103                if( $q ) 
     
    118118                                                echo "deleting the links<br />"; 
    119119 
    120                                                 $qs = "SELECT linkID FROM linksCategoriesXRef WHERE catID = $id;"; 
     120                                                $qs = "SELECT linkID FROM links_tags_xref WHERE tagID = $id;"; 
    121121                                                $q = mysql_query( $qs ); 
    122122                                                if( $q ) { 
     
    133133                                                $fail = "sorry, an error occurred and the links weren&apos;t deleted!"; 
    134134                                        } else { 
    135                                                 # need to also clean the fuck out of linksCategoriesXRef 
     135                                                # need to also clean the fuck out of links_tags_xref 
    136136 
    137137                                                $qs = getQuery( "delete_tag_refs", $id ); 
    138138                                                $q = mysql_query( $qs ); 
    139139                                                if( $q ) {  
    140                                                         #echo "we are just clearing the groupid of the links<br />"; 
    141140                                                        $success = "all links untagged!"; 
    142141                                                } 
    143                                                 $fail = "ugh. some weird error occurred. i hate being a dumb computer. sorry!"; 
    144                                                 $qs = "UPDATE links SET groupid = NULL WHERE userid = '$u' AND groupid = $id"; 
    145142                                        } 
    146                                         if( $debug ) print "DEBUG: $qs<br />\n"; 
    147                                         $q = mysql_query( $qs ); 
    148                                         if( $q ) { echo "$success<br />\n"; } else { echo "$fail<br />\n"; } 
    149143%> 
    150144 
  • feedmelinks/folder-as-rss.php

    r1331 r1334  
    11<% 
    2   Header( "Content-type: text/xml"); 
     2  Header( "Content-type: text/plain"); 
    33        # $Id$ 
    44 
     
    1313                $sortOrder = "createDate"; 
    1414        $direction = $sortOrder == name ? "ASC" : "DESC"; 
    15  
    1615 
    1716        # first, set up options and defaults. 
     
    6463                                                $singleGroupName = substr( $singleGroupName, 2, strlen( $singleGroupName ) ); 
    6564                                        } 
    66                                         if( $pubFolder ) 
    6765                                                $whereClause = " WHERE  
    68                                                                 l.groupid=$folder "; 
    69                                         else 
    70                                                 $whereClause = " WHERE  
    71                                                                 l.groupid=$folder AND 
    7266                                                                l.userid='$sessionUserId' "; 
    7367                                                                if( $debug ) 
    7468                                                                        echo "whereClause: $whereClause<br />"; 
    7569 
    76                                                 $qs = "SELECT * FROM links AS l, linksCategoriesXRef AS x WHERE l.ID = x.linkID AND x.catID = $folder ORDER BY $sortOrder $direction;"; 
     70                                                $qs = "SELECT * FROM links AS l, links_tags_xref AS x WHERE l.ID = x.linkID AND x.tagID = $folder ORDER BY $sortOrder $direction;"; 
    7771                                } else { 
    7872                                        $errors = 1; 
     
    8276                } else { 
    8377 
    84                         $qs = "SELECT * FROM linksGroups"; 
     78                        $qs = "SELECT * FROM tags"; 
    8579                        $q = mysql_query( $qs ); 
    8680 
     
    9791                                                if( $j != 0 )  
    9892                                                        $whereClause = " $whereClause OR"; 
    99                                                 $whereClause = "$whereClause groupid=$id"; 
     93                                                $whereClause = "$whereClause"; 
    10094                                                $j++; 
    10195                                        } 
     
    108102    $title = $owner . "'s " . $singleGroupName . " - a FeedMeLinks public " . getCatName() . ""; 
    109103%> 
    110 <<%= "?" %>xml version="1.0"?> 
     104<!-- <%= "?" %>xml version="1.0"?> 
    111105<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> 
    112 <rss version="0.91"
     106<rss version="0.91"--
    113107  <channel> 
    114108    <title><%= $errors ? "private " . getCatName() : $title %></title> 
     
    136130                        $id          = mysql_result($q,$i,"ID"); 
    137131                        $userId      = makeSafeName( mysql_result($q,$i,"userid")); 
    138                         $groupid = mysql_result($q,$i,"groupid"); 
    139                         $group = $singleGroup ? $singleGroupName : $groups[$groupid]; 
    140                         $group = $group ? $group : "unfiled"; 
    141                         if( !$unfiled && $group == "unfiled" ) 
    142                                 break; 
    143132                        if( $prevGroup != $group && $sortOrder == "groupid" ) { 
    144133                                $bg = "bgcolor='white'"; 
  • feedmelinks/folder-by-tag-name.php

    r1178 r1334  
    1 <%  
     1<?php 
    22  # $Id$ 
    33  include_once( "modules/utils.inc.php" ); 
    44 
    5         $tok =  $authenticated = $_COOKIE["c_pass_token"]; 
    6         $u   =  $sessionUserId = ( $user ? $user : $_COOKIE["c_uid"] ); 
    7  
    8         # TODO: extend this to do delicious/flickr-style "show this tag for all users" view 
     5        # FIXME: doesn't work with &'s in tag names 
    96        if( ! $user ) 
    107                croak( "shit, no username!" ); 
     
    129        if( $tok && $tok == md5( getPasswdForUser( $u ))) 
    1310                $authed = true; 
    14         $who_hath = ($authed ? "you have" : "$user has" ); 
     11        $who_hath = ($authed ? "You have" : "$user has" ); 
     12 
    1513 
    1614        if( ! $tag ) 
    1715                croak( "shit, no tag!" ); 
    1816         
    19                comment( "user: $user, tag: $tag" ); 
    20                $con_t = mysql_connect(); 
    21                mysql_selectdb( getDBName() ); 
    22                 
    23                # allow authenticated users to view their own private tags 
    24                $taglist_clause = "isPrivate IS NULL" . ($authed ? " OR name = '$tag'" : ""); 
     17        comment( "user: $user, tag: $tag" ); 
     18        $con_t = mysql_connect(); 
     19        mysql_selectdb( getDBName() ); 
     20         
     21        # allow authenticated users to view their own private tags 
     22        $taglist_clause = "(isPrivate IS NULL OR isPrivate = 0)" . ($authed ? " AND name = '$tag'" : ""); 
    2523 
    26                 $qs = getQuery( "tag_by_name", $user, "($taglist_clause)" ); 
    27                 $q = mysql_query( $qs ); 
    28                 if( !$q || !( $numRows = mysql_num_rows($q))) 
    29                         croak( "$who_hath no tag called '$tag', dog!" ); 
    30                  
    31                 # TODO: either handle this case or remove the if/for statements 
    32                 if( $numRows > 1) 
    33                         echo "$who_hath more than one tag called $tag."; 
     24        $qs = getQuery( "tag_by_name", $user, "($taglist_clause)" ); 
    3425 
    35                 for( $i = 0; $i < $numRows; $i++ ) { 
    36                         $folder = $tagID =  mysql_result($q, $i, "ID"); 
    37                         comment( "<!-- redirect via folder-by-tag-name -->" ); 
    38                         include( "folder.php" ); 
    39                 } 
     26        $q = mysql_query( $qs ); 
     27        if( !$q || !( $numRows = mysql_num_rows($q))) 
     28                croak( "Sorry, we screwed up. We're currently working on fixing this. $who_hath no tag called '$tag', dog!" ); 
     29         
     30        # TODO: either handle this case or remove the if/for statements 
     31        if( $numRows > 1) 
     32                echo "$who_hath more than one tag called $tag."; 
    4033 
    41                 conClose( $con_t); 
    42 %> 
     34        $folder = $tagID =  mysql_result($q, $i, "ID"); 
     35        $singleGroupName = $tag; 
     36        comment( "<!-- redirect to folder from folder-by-tag-name: tag = $tagID, name = $tag -->" ); 
     37        include( "folder.php" ); 
     38 
     39        conClose( $con_t); 
     40?> 
  • feedmelinks/folder.php

    r1331 r1334  
    1 <% 
     1<?php 
    22        ob_start(); 
     3 
     4        $debug = 0; 
     5 
    36        include_once( "modules/class.gzip_encode.inc.php" ); 
    4  
    5         # $Id$ 
    6  
    77        include_once( "modules/utils.inc.php" ); 
    88        $site = getSiteUrl(); 
     
    1515 
    1616        if( $sidebar ) { 
    17                 include_once( "folder-sidebar.php" ); 
     17                include( "folder-sidebar.php" ); 
    1818        } else { 
    1919 
     
    7878                                        $numRows = $q ? mysql_num_rows($q) : 0; 
    7979                                        if( $q && $numRows ) { 
    80                                                 $singleGroupName = makeSafeName( mysql_result($q,$i,"name") ); 
     80                                                $singleGroupName = $singleGroupName ? $singleGroupName : makeSafeName( mysql_result($q,$i,"name") ); 
    8181                                                $email = getEmailAddressForUser( mysql_result($q,$i,"userid")); 
    8282                                        } else { 
    8383                                                # cache error for display in the proper place: 
    8484                                                ob_start(); 
    85 %
     85?
    8686 
    8787<div class="attention"> 
    8888Sadly, no such folder exists.<br /> 
    89 Please double-check the URL, or try visiting the list of <a href=\"/list-public\">public <%= getCatsName() %></a>. 
    90 </div> 
    91  
    92 <% 
     89Please double-check the URL, or try visiting the list of <a href=\"/list-public\">public <?= getCatsName() ?></a>. 
     90</div> 
     91 
     92<?php 
    9393                                        $errors = ob_get_clean(); 
    9494                                } 
     
    127127                                        if( $debug )  
    128128                                                echo "<br />using the second query<br />"; 
    129                                         if( $pubFolder ) 
    130129                                                $whereClause = " WHERE  
    131                                                                 l.groupid=$folder "; 
    132                                         else 
    133                                                 $whereClause = " WHERE  
    134                                                                 l.groupid=$folder AND 
    135130                                                                l.userid='$u' "; 
    136131                                                                if( $debug ) 
    137132                                                                        echo "whereClause: $whereClause<br />"; 
    138133 
    139                                         $qs = "SELECT * FROM links AS l, linksCategoriesXRef AS x WHERE l.ID = x.linkID AND x.catID = $folder ORDER BY $sortOrder $direction;"; 
     134                                        $qs = "SELECT * FROM links AS l, links_tags_xref AS x WHERE l.ID = x.linkID AND x.tagID = $folder ORDER BY $sortOrder $direction;"; 
    140135                                        if( $debug ) 
    141136                                                e( "QS: " . $qs ); 
     
    144139                        } else {  
    145140                                if( $errors != 1 ) { 
     141                                echo $qs; 
    146142                                        $errors = "Unfortunately, this " . getCatName() . " (#$folder) isn't public, bub.<br /> 
    147143                                        Try <a href='/login'>logging in</a>, <a href=\"mailto:$email\">emailing the owner</a> and asking them to make it public, 
     
    152148        } else { 
    153149 
    154                 $qs = "SELECT * FROM linksGroups"; 
     150                $qs = "SELECT * FROM tags"; 
    155151                $q = mysql_query( $qs ); 
    156152 
     
    167163                                        if( $j != 0 )  
    168164                                                $whereClause = " $whereClause OR"; 
    169                                         $whereClause = "$whereClause groupid=$id"; 
     165                                        $whereClause = "$whereClause"; 
    170166                                        $j++; 
    171167                                } 
     
    173169                        } 
    174170                } 
    175                 $qs = "SELECT * FROM links AS l, linksComments AS x $whereClause ORDER BY $sortOrder $direction"; 
     171                $qs = "SELECT * FROM links AS l $whereClause ORDER BY $sortOrder $direction"; 
    176172        } 
    177173        if( $owned || $public ) 
    178                 $title = "$owner&rsquo;s links " . getCatPast() . " with $singleGroupName"; 
     174                $title = "$owner&rsquo;s links " . getCatPast() . " with '$fName'"; 
    179175        else  
    180176                $title = "(a private " . getCatName() . ")"; 
     
    183179        $title = "Feed Me Links &raquo; $title"; 
    184180        if( ! $condensed ) {  
    185                 include_once( "$modules/header.inc.php" );  
     181                include( "$modules/header.inc.php" );  
    186182        } else { 
    187                 include_once( "$modules/header.insecure.inc.php" );  
    188         } 
    189 %
     183                include( "$modules/header.insecure.inc.php" );  
     184        } 
     185?
    190186 
    191187 
     
    194190</style> 
    195191</head> 
    196 <% if( ! $condensed ) { %
     192<?php if( ! $condensed ) { ?
    197193<body> 
    198 <% 
    199         include_once( "$modules/menu.inc.php" );  
    200 %
     194<?php 
     195        include( "$modules/menu.inc.php" );  
     196?
    201197<br /> 
    202198<br /> 
    203 <% } %
    204  
    205          <% 
     199<?php } ?
     200 
     201         <?php 
    206202                                if( $owned ) { 
    207 %
    208 &laquo; <a href="/u/<%= $u %>/tags">back to my list of <%= getCatsName() %></a> 
    209 <% 
     203?
     204&laquo; <a href="/u/<?= $u ?>/tags">back to my list of <?= getCatsName() ?></a> 
     205<?php 
    210206                                } 
    211207        if( ! $errors ) { 
     
    213209                $q = mysql_query( $qs ); 
    214210                if( $debug)  
    215                         echo d( "ran \$qs" ); 
     211                        echo d( "ran \$qs $qs" ); 
    216212                if( $q )  
    217213                        $numRows = mysql_num_rows($q); 
     
    222218                if( $numRows ) { 
    223219 
    224                         if( $owned && !$condensed ) { %
     220                        if( $owned && !$condensed ) { ?
    225221 
    226222<script language="javascript"> 
    227223 
    228224 var numSelected = 0; 
    229  var numLinks = <%= $numRows %>; 
     225 var numLinks = <?= $numRows ?>; 
    230226 
    231227        function updateSelectedTotal( cb ) { 
     
    284280 
    285281<form method="post" action="/action" name="folderForm"> 
    286 &nbsp; (<a href="/edit-folder?op=edit&id=<%= $id %>&name=<%= urlencode( $fName ) %>&options=">click to edit this <%= getCatName() %>'s name</a>) 
     282&nbsp; (<a href="/edit-folder?op=edit&id=<?= $id ?>&name=<?= urlencode( $fName ) ?>&options=">click to edit this <?= getCatName() ?>'s name</a>) 
    287283<p /> 
    288                 <% } %
     284                <?php } ?
    289285 
    290286<!-- start block --> 
     
    292288<div class="box"> 
    293289        <div class="subhead"> 
    294 <% if( $public && (!$owned)) { %
    295         <a class="link" href="/u/<%= $owner %>"><%= $owner %>'s <%= getCatsName() %></a> 
    296 <% } else { %
    297         <a class="link" href="/index">my <%= getCatsName() %></a>  
    298 <% } %> / <b><%= makePrettyFolderName( getNameForFolder( $folder )) %></b> 
    299 <%  
     290<?php if( $public && (!$owned)) { ?
     291        <a class="link" href="/u/<?= $owner ?>"><?= $owner ?>'s <?= getCatsName() ?></a> 
     292<?php } else { ?
     293        <a class="link" href="/index">my <?= getCatsName() ?></a>  
     294<?php } ?> / <b><?= makePrettyFolderName( getNameForFolder( $folder )) ?></b> 
     295<?php  
    300296        echo " ($numRows links) &nbsp;"; 
    301297        if( ! $public && ! $_internal ) {  
    302         %><img src="/img/lock" /><%  
     298        ?><img src="/img/lock" /><?php  
    303299        }  
    304 %
     300?
    305301<small> 
    306 <% 
    307         if( $condensed ) { %
    308         (<a class="link" href="/f/<%= $folder %>">view expanded</a>) 
    309 <% } else { %
    310         (<a class="link" href="/f/<%= $folder %>/c">view condensed</a>) 
    311 <% } %
    312  
    313 <% if( !$condensed ) { %
    314  
    315 <%     if( $sortOrder != "name" ) { %
    316                 (<a class="link" title="sort by name" href="/f/<%= $folder %>/by-name">sort by name</a>) 
    317 <% }  
    318  
    319         if( $sortOrder != "createDate" ) { %
    320                 (<a class="link" title="sort by date" href="/f/<%= $folder %>/by-date">sort by date</a>) 
    321 <% } %
    322  
    323 <% } else { %
    324  
    325         <% if( $sortOrder != "name" ) { %
    326                 (<a class="link" title="sort by name" href="/f/<%= $folder %>/c/by-name">sort by name</a>) 
    327         <% } %
    328  
    329         <% if( $sortOrder != "createDate" ) { %
    330                 (<a class="link" title="sort by date" href="/f/<%= $folder %>/c/by-date">sort by date</a>) 
    331         <% } %
    332  
    333 <% } %
     302<?php 
     303        if( $condensed ) { ?
     304        (<a class="link" href="/f/<?= $folder ?>">view expanded</a>) 
     305<?php } else { ?
     306        (<a class="link" href="/f/<?= $folder ?>/c">view condensed</a>) 
     307<?php } ?
     308 
     309<?php if( !$condensed ) { ?
     310 
     311<?php  if( $sortOrder != "name" ) { ?
     312                (<a class="link" title="sort by name" href="/f/<?= $folder ?>/by-name">sort by name</a>) 
     313<?php }  
     314 
     315        if( $sortOrder != "createDate" ) { ?
     316                (<a class="link" title="sort by date" href="/f/<?= $folder ?>/by-date">sort by date</a>) 
     317<?php } ?
     318 
     319<?php } else { ?
     320 
     321        <?php if( $sortOrder != "name" ) { ?
     322                (<a class="link" title="sort by name" href="/f/<?= $folder ?>/c/by-name">sort by name</a>) 
     323        <?php } ?
     324 
     325        <?php if( $sortOrder != "createDate" ) { ?
     326                (<a class="link" title="sort by date" href="/f/<?= $folder ?>/c/by-date">sort by date</a>) 
     327        <?php } ?
     328 
     329<?php } ?
    334330</small> 
    335331 
    336 <% if( $owned ) { %> 
    337 <% if( !$condensed ) { %> 
     332<?php  
     333        if( $owned ) { 
     334                if( !$condensed ) { ?> 
    338335<small>&nbsp;select all:</small><input style="margin-bottom: -1px;" type="checkbox" name="selectAll" onChange="selectAllLinks(document.forms.folderForm);"/> 
    339 <% } %
    340 <% } else if( ! $condensed ) { %
     336<?php } ?
     337<?php } else if( ! $condensed ) { ?
    341338| 
    342339        snatch 
    343 <% } %
     340<?php } ?
    344341        </div> 
    345342<!-- end row --> 
    346343 
    347 <% 
     344<?php 
    348345        $i = 0; 
     346 
    349347        while ($i < $numRows) { 
    350348                $id          = mysql_result($q,$i,"ID"); 
    351349                $userId      = makeSafeName( mysql_result($q,$i,"userid")); 
    352                 $folderId = mysql_result($q,$i,"groupid"); 
    353350                $group = $singleGroup ? $singleGroupName : $groups[$folderId]; 
    354                 $group = $group ? $group : "unfiled"
     351                $group = $tag ? $tag : ($group ? $group : "unfiled")
    355352                if( !$unfiled && $group == "unfiled" ) 
    356353                        break; 
     
    358355                        $bg = "class='header2'"; 
    359356                        $prevGroup = $group; 
    360 %> 
    361 <%  
     357 
    362358                        if( !$owned && !$condensed ) { 
    363 %
     359?
    364360<!-- start row --> 
    365361<div class="r1"> 
    366         (owned by <b><%= makeUserLink( $userId ) %></b>) 
    367 </div> 
    368 <%             } %
     362        (owned by <b><?= makeUserLink( $userId ) ?></b>) 
     363</div> 
     364<?php          } ?
    369365<!-- end row --> 
    370366 
    371 <% 
     367<?php 
    372368                } 
    373369                $group = $group ? $group : "..."; 
     
    390386                else 
    391387                        $bg = "r1"; 
    392 %
     388?
    393389<!-- start row --> 
    394 <div style="padding: 4px;" class="<%= $bg %>"> 
    395 <% 
     390<div style="padding: 4px;" class="<?= $bg ?>"> 
     391<?php 
    396392        if( strlen( $name ) > $MAX_NAME_LENGTH ) { 
    397393                $displayName = substr( $name, 0, $MAX_NAME_LENGTH ) . "..."; 
     
    399395        } else  
    400396                $displayName = $name; 
    401 %
     397?
    402398        <div style="float: left;"> 
    403         <%= insertImageLinkIcon( $url ) %
    404         <%= makeNamedLinkOut( $id, $displayName) %> <%= makePermaLink( $id ) %
     399        <?= insertImageLinkIcon( $url ) ?
     400        <?= makeNamedLinkOut( $id, $displayName) ?> <?= makePermaLink( $id ) ?
    405401 
    406402        </div> 
    407403        <div style="float: right;"> 
    408                 <span class="subtle"><%= $createDate %></span> 
    409 <% if( ! $owned ) {  
     404                <span class="subtle"><?= $createDate ?></span> 
     405<?php if( ! $owned ) {  
    410406                        if( !$condensed ) {  
    411 %
    412                 &nbsp;<%= makeStealItLink( $id ) %
    413 <%
     407?
     408                &nbsp;<?= makeStealItLink( $id ) ?
     409<?php
    414410        } else { 
    415411         
    416412                if( !$condensed ) { 
    417 %
    418                 <%= makeEditLink( $id ) %
    419                 <%= makeDeleteLink( $id ) %
    420                 <input type="checkbox" name="<%= $id %>" onChange="updateSelectedTotal(this);" /> 
    421 <% } %
     413?
     414                <?= makeEditLink( $id ) ?
     415                <?= makeDeleteLink( $id ) ?
     416                <input type="checkbox" name="<?= $id ?>" onChange="updateSelectedTotal(this);" /> 
     417<?php } ?
    422418<br clear="all"> 
    423 <% } %
     419<?php } ?
    424420        </div> 
    425421 
     
    427423<!-- end row --> 
    428424 
    429 <% $i++; %> 
    430 <% 
     425<?php 
     426$i++;  
    431427        } 
    432428        conClose( $con_folder ); 
    433 %> 
    434  
    435 <% if( $owned && !$condensed) { %> 
     429?> 
     430 
     431<?php 
     432if( $owned && !$condensed) { ?> 
    436433<!-- start row --> 
    437434<div class="r1 last"> 
    438435 
    439         <%= getCatVerb() %> selected links as:  
     436        <?= getCatVerb() ?> selected links as:  
    440437        <select name="newFolderID"> 
    441         <% include( "$modules/folder-menu.inc.php" ); %
     438        <?php include( "$modules/folder-menu.inc.php" ); ?
    442439        </select> 
    443440        <input type="hidden" name="op" value="tag" /> 
    444         <input type="hidden" name="debug" value="<%= $debug %>" /> 
    445         <input type="hidden" name="folderID" value="<%= $folder %>" /> 
     441        <input type="hidden" name="debug" value="<?= $debug ?>" /> 
     442        <input type="hidden" name="folderID" value="<?= $folder ?>" /> 
    446443        <input class="button" type="button" name="tagButton" value="tag" onClick="tagSelected()"/> 
    447444</div> 
     
    464461<br> 
    465462 
    466 <% 
     463<?php 
    467464        $rss_url = "/f/$folder/rss"; 
    468 %
    469