Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > contribute/features/index.php
<% # $Id: index.php,v 1.12 2004/05/13 18:19:32 hirokai Exp $ %>
<% 
	include( "../../modules/utils.inc.php" ); 
	$tok =  $authenticated = $_COOKIE["c_pass_token"];
	$u   =  $sessionUserId = $_COOKIE["c_uid"];

	if( $u ) 
		include( "$modules/header.inc.php" ); 
	else {
		include( "$modules/header.insecure.inc.php" ); 
		include( "$modules/menu-insecure.inc.php" ); 
	}
	if( $tok && $tok == md5( getPasswdForUser( $u ))) {

	$startPage = 1;
	$perPage = 50;

%>
<base href="<%= $site %>/contribute/features/" />
<title> feed me new features </title>

<p/>

<div class="attention holyshit">
	click to <a href="add">request a new feature</a>
</div>
<p/>

<div>
<h2>FEATURE REQUEST TYPES:</h2>

<a href="?showCat=">all</a>
<%
  $ft = getFeatureTypes();
	foreach( $ft as $type => $n ) {
%>
|&nbsp;<a href="?showCat=<%= $type %>"><%= $n %></a>&nbsp;
<%
	}
%>

<%
    mysql_connect( );
    mysql_selectdb( getDBName() );
    $qs = "SELECT * from linksFeatures as lf, linksFeatureTypes as lt WHERE lf.type = lt.ID ";
		if( $showCat ) {
			$showCat = urlencode( $showCat ); 
			$qs = "$qs AND lf.type = $showCat";
		}
		if( $debug )
			echo "<p>isSuperUser( $u ): " . isSuperUser( $u ) . "</p>";
		if( ! isSuperUser( $u )) {
			$qs = "$qs AND lf.submitter = '$u'";
		}
		$qs = "$qs AND lf.deleted is NULL"; # hide deleted feature requests, for now
		$qs = $sortOrder ? "$qs ORDER BY " . urlencode( $sortOrder )  : "$qs ORDER BY lf.lastMod ";
		$qs = "$qs LIMIT $perPage;"; 
    $q = mysql_query( $qs );
    if( $q ) {
      $numRows = mysql_num_rows($q);
			if( $numRows ) {
			$i = 0;
%>
<p/>

<table border="0" cellpadding="5" cellspacing="1">

<tr class="header">
	<td><a class="header" href="?sortOrder=lf.ID">id#</a></td>
	<td><a class="header" href="?sortOrder=lf.name">name</a></td>
	<td><a class="header" href="?sortOrder=lf.lastMod">date</a></td>
	<td><a class="header" href="?sortOrder=lf.submitter">submitted by</a></td>
	<td colspan="2"><a class="header" href="?sortOrder=lt.name">category</a></td>
</tr>
<%
      while ($i < $numRows) {
        $id = mysql_result($q,$i,"lf.ID");
        $lastMod = formatTS( mysql_result($q,$i,"lf.lastMod"));
        $user = urldecode( mysql_result($q,$i,"submitter"));
        $name = urldecode( mysql_result($q,$i,"name"));
        $desc = urldecode( mysql_result($q,$i,"lf.description"));
        $tname = urldecode( mysql_result($q,$i,"lt.name"));
        $deleted = urldecode( mysql_result($q,$i,"lf.deleted"));
        $tdesc = urldecode( mysql_result($q,$i,"lt.description"));
				$rowClass = $i % 2 ? "r0" : "r1";
%>


<tr class="<%= $deleted ? "deleted" : $rowClass %>">
	<td><%= $id %></td>
	<td><a href="/contribute/features/<%= $id %>"><b><%= $deleted ? "<s>$name</s>" : $name %></b></a></td>
	<td><%= $lastMod %></td>
	<td><%= makeUserLink($user) %></td>
	<td><%= $tname %>: <%= $tdesc %></td>
	<td><%
	if( $u == $user || isSuperUser( $u ) ) {
%>
<a href="edit?id=<%= $id %>">edit</a> /
<a href="do-delete?id=<%= $id %>">delete</a>
<%
	}
%></td>
</tr>
<tr class="<%= $deleted ? "deleted" : $rowClass %>">
	<td valign="top" colspan="6"><%= $desc %><br /><br /></td>
</tr>

<%
        $i++;
      }
%>
</table>
<%
			} else {
%>
<div class="attention">
you have submitted no feature requests
<%
	if( $showCat )  {
%>
in category #<%= $showCat %> yet.<br />
try <a href="?showCat=">showing all feature requests</a>.
<%
	} else echo "yet.";
%>
</div>
<%
			}
    }
	} else {
%>
<div class="attention holyshit">
	<a href="/login?bounceToPage=contribute/features">login</a> in order to view features
</div>
<%
	}
%>

</div>

<p/>

<div class="attention holyshit">
	click to <a href="add">request a new feature</a>
</div>

<% include( "$modules/footer.inc.php" ); %>
Return current item: FeedMeLinks, Social BookmarkingSince2002