<%
# $Id: list-public-compact.inc.php,v 1.12 2004/05/30 22:37:09 hirokai Exp $
include_once( "$modules/get-option.inc.php" );
include_once( "$modules/utils.inc.php" );
$u = $sessionUserId = $_COOKIE["c_uid"];
$viewedByOwner = ($u == $who) ? 1 : 0;
if( $debug ) {
%>
$viewedByOwner: <%= $viewedByOwner %><br />
<%
}
$page = "public";
if( ! $sortOrder )
$sortOrder = "groupid";
$direction = $sortOrder == name ? "ASC" : "DESC";
# first, set up options and defaults.
$MAX_NAME_LENGTH = 40;
$showURLs = false;
$USE_LONG_URLS = false;
%>
<span class="head"><%= $viewedByOwner ? "YOUR" : ($who ? strtoupper( $who . "'s" ) : "ALL") %> <%= $viewedByOwner ? "" : "PUBLIC" %> <%= strtoupper( getCatsName()) %>:</span>
<br />
<%
mysql_connect();
mysql_selectdb( getDBName() );
$magick = 1;
$hotRow = -1;
$columnCount = $showURLs ? 7 : 6;
$singleGroup = $folder ? true : false;
$whereClause = $who ? "WHERE userid='$who'" : "";
$qs = "SELECT * FROM linksGroups $whereClause ORDER BY name";
$q = mysql_query( $qs );
$numRows = mysql_num_rows($q);
if( $numRows ) {
%>
<table cellpadding="1" cellspacing="0">
<tr>
<td class="boxBorder">
<table cellpadding="4" cellspacing="0">
<tr>
<td class="header" width="50"># links</td>
<td class="header">
</td>
<td class="header">
<%= getCatName() %>
</td>
<% if( ! $who ) { %>
<td class="header">
user
</td>
<% } %>
</tr>
<%
$i = $j = 0;
while ($i < $numRows) {
$name = makeSafeName( mysql_result($q,$i,"name"));
$isPublic = isPublic( $name ) ? 1 : 0;
if( $viewedByOwner || $isPublic ) {
$id = mysql_result($q,$i,"ID");
$qs = "SELECT count(*) FROM linksCategoriesXRef WHERE catID = $id";
$q2 = mysql_query( $qs );
$count = mysql_result($q2,0);
if( $count ) {
$userid = mysql_result($q,$i,"userid");
if( $isPublic )
$name = ($name == makePublicFolderName( "public")) ? "public " . getCatName() : makePrettyFolderName( $name );
if( $i % 2 == 0 )
$bg = "class='r0'";
else
$bg = "class='r1'";
%>
<tr>
<td align="right" <%= $bg %> colspan="2">
<%= $count %> links
</td>
<td <%= $bg %>><%= makeFolderLink( $id, $name ) %></td>
<% if( ! $who ) { %>
<td <%= $bg %>>
<%= makeUserLink( $userid ) %></a>
</td>
<% } %>
</tr>
<%
if( $j != 0 )
$j++;
} # end if folderHadLinks
} # end if viewedByOwner or Public
$i++;
}
mysql_close();
%>
</table>
</td>
</tr>
</table>
<% if( $viewedByOwner ) { %>
<%= getColorKey() %>
<%
}
} # end if hadResultsFromDB
%>