Location: PHPKode > projects > Open ShareLive > F3-OSL-pre_alpha-2005_05_30/showcat.php
<?php include("tmpl_top.php"); ?>
<?php
/******************************************************************************
*
*    Open ShareLive (main site code)
*    Copyright (C) 2002-2005  ShareLive
*
*    This program is free software; you can redistribute it and/or
*    modify it under the terms of the GNU General Public License
*    as published by the Free Software Foundation; either version 2
*    of the License, or (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
******************************************************************************/

	$cat = $_GET['cat'];
	if (!$cat) $cat = 1;

	$q = mysql_query("SELECT singularname FROM ".$dbprefix."categories WHERE cat_id = $cat");
	$cname = mysql_fetch_row($q);

	$catname = $cname[0];		// get the category display name

	if (file_exists("tabs/$network/zonenews.php")) include("tabs/$network/zonenews.php");

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#FFCC33"><img src="spacer.gif" width="1" height="1"></td>
              </tr>
              <tr>
                <td bgcolor="#FFFAE6"><table width="100%" border="0" cellpadding="6" cellspacing="2">
                    <tr>
                      <td bgcolor="#FFFAE6"> <p class="bodytext"><strong><a href="<?php echo "newrelease.php?cat=$_GET[cat]" ?>" class="cattitle">Release
                          New <?php echo $cname[0] ?></a><br>
                          </strong><span class="smallprint">Add new files to our
                          database by clicking the link above. Please search before
                          posting something. Creating a duplicate release only
                          causes problems and will end up deleted.</span></p>
                        <p class="cattitle"><strong><a href="search.php?s=&cat=<?php echo $_GET[cat] ?>&rel=1&req=1&network=<?php echo $network?>">Browse
                          This Category</a><br>
                          </strong><span class="smallprint">Use this link to explore
                          the category alphabetically. All items (requests and
                          releases) are shown. If you are looking for something
                          more specific, the search feature is probably a better
                          option.</span></p>
                        <p class="bodytext"><strong><span class="cattitle"><a href="forums/index.php?act=SF&f=<?php

						$r = mysql_query("SELECT forum_id FROM ".$dbprefix."categories WHERE cat_id=$_GET[cat]");
						$rt = mysql_fetch_row($r);
						echo $rt[0];

						?>">Visit
                          the Forums</a></span></strong> <br>
                          <span class="smallprint">The forums are a great place
                          to get help. If you are having problems with one of
                          the releases or would like to discuss this category
                          this is the place to go.<?  ?></span></p></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td bgcolor="#FFCC33"><img src="spacer.gif" width="1" height="1"></td>
              </tr>
            </table>
            <h2><strong><?php echo $catname ?> Request of the Day</strong></h2>
            <?php
	// get a random featured request from the featured_releases table (requests have req_type 1)
	$q = mysql_query("SELECT *, ".$dbprefix."shares.* FROM ".$dbprefix."featured_releases INNER JOIN ".$dbprefix."shares ON (".$dbprefix."featured_releases.rel_id = ".$dbprefix."shares.rel_id) WHERE ((".$dbprefix."shares.req_state = 1) AND (cat_id = $cat)) AND reqrel_date > " . (time() - EXPIRE) . "$netsql ORDER BY RAND() LIMIT 0, 1", $Default);
	echo mysql_error();
	if ($q) {
		if (mysql_num_rows($q)) {
			$row = mysql_fetch_array($q);
			if (!$row['title']) $row['title'] = "Warning: please correct me, admin!";
			if (!$row['screen_url']) $row['screen_url'] = "images/no_img.gif";

?>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td rowspan="2" valign="top">
                  <p align="left" class="smallprint"><span class="newstitle"><strong><?php echo $row['title'] ?></strong></span><strong><br>
                        <br>
                  </strong><?php echo $row['bodyhtml'] ?></p>
                </td>
                <td width="160" valign="top">
                  <div align="right" class="bodytext">
                    <p><font color="#FF0000"><span class="newstitle"></span>&nbsp;<img src="<?php echo $row['screen_url'] ?>"></font></p>
                  </div>
                </td>
              </tr>
              <tr>
                <td height="20" valign="bottom" class="smallprint">
                  <div align="right"><br>
        Requested <strong><?php echo $row['req_counter'] ?></strong> times<br>
        <strong><a href="req.php?pid=<?php echo $row['rel_id'] ?>">Request</a></strong> again,
        or <a href="rel.php?pid=<?php echo $row['rel_id'] ?>"><strong>Release</strong></a></div>
                </td>
              </tr>
            </table>
            <?php
				} else {
					echo "<font class=\"bodytext\">There are no featured requests in this category yet.<br></font>"; //
				}
			} ?>
            <br>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#CCCCCC"><img src="spacer.gif" width="1" height="2"></td>
              </tr>
            </table>
            <h2><strong>Featured Releases</strong></h2>
            <?php
				$q = mysql_query("SELECT *, ".$dbprefix."shares.* FROM ".$dbprefix."featured_releases INNER JOIN ".$dbprefix."shares ON (".$dbprefix."featured_releases.rel_id = ".$dbprefix."shares.rel_id) WHERE ((".$dbprefix."shares.req_state=2) AND (".$dbprefix."shares.cat_id=$cat)) AND reqrel_date > " . (time() - EXPIRE) . "$netsql ORDER BY RAND() LIMIT 0, 1", $Default);
				if ($q) {
					$xc = 0;
					if ($xr = mysql_num_rows($q)) {
						while($row = mysql_fetch_array($q)) {
							$xc++;
							if (!$row['title']) $row['title'] = "Warning: please correct me, admin!";
							if (!$row['screen_url']) $row['screen_url'] = "images/no_img.gif";
			?>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td rowspan="2" valign="top">
                  <p align="left" class="smallprint"><span class="newstitle"><strong><?php echo $row['title'] ?></strong></span><strong><br>
                        <br>
                  </strong><?php echo $row['bodyhtml'] ?></p>
                </td>
                <td width="160" valign="top">
                  <div align="right" class="bodytext">
                    <p><font color="#FF0000"><img src="<?php echo $row['screen_url'] ?>"></font></p>
                  </div>
                </td>
              </tr>
              <tr>
                <td height="20" valign="bottom" class="smallprint">
                  <div align="right"><br>
        Downloaded<strong> <?php echo $row['dl_counter'] ?></strong> times<br>
        <strong><a href="view.php?pid=<?php echo $row['rel_id'] ?>">View Release</a></strong></div>
                </td>
              </tr>
            </table>
            <?php if ($xc < $xr) { ?>
            <br>
            <? } ?>
            <?php
						}
					} else {
						echo "<font class=\"bodytext\">No features found in this category.<br></font>"; //
					}
				} else {
					echo "Error: " . mysql_error($Default);
				}

			?>
            <br>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#CCCCCC"><img src="spacer.gif" width="1" height="2"></td>
              </tr>
            </table>
            <h2>Most Popular Requests and Releases</h2>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr valign="top" class="newstitle">
                <td width="52%" background="images/bar11.gif"> <p><strong>Top Requests</strong></p></td>
                <td width="48%" background="images/bar11.gif"> <p><strong>Top Releases</strong></p></td>
              </tr>
              <tr valign="top" class="newstitle">
                <td><br>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <?php
					$q = mysql_query("SELECT * FROM ".$dbprefix."shares WHERE cat_id=$cat AND req_state=1 AND reqrel_date > " . (time() - EXPIRE) . " $netsql ORDER BY req_counter DESC LIMIT 0,20");
					if ($q && mysql_num_rows($q)) {
						while ($row = mysql_fetch_array($q)) {

					?>
                      <tr>
                        <td class="smallprint"><?php echo "<img src=\"arrow1.gif\">&nbsp;<a href=\"view.php?pid=$row[rel_id]\">" . GetTextLimit(FormatReleaseName($row['str_short']), 170) . "</a>" ?><img src="spacer.gif" width="3" height="3"></td>
                      </tr>
                      <?
						}
					}
    				?>
                  </table>
                  <strong>                  <span class="smallprint">                <br>
                  <a href="search.php?sort=reqs&direction=desc&req=1&network=<?php echo $network ?>&cat=<?php echo $_GET['cat']?>">Show all top requests</a></span></strong></td>
                <td><br>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <?php
					$q = mysql_query("SELECT * FROM ".$dbprefix."shares WHERE cat_id=$cat AND req_state=2 AND reqrel_date > " . (time() - EXPIRE) . " $netsql ORDER BY dl_counter DESC LIMIT 0,20");
					if ($q && mysql_num_rows($q)) {
						while ($row = mysql_fetch_array($q)) {

					?>
                      <tr>
                        <td class="smallprint"><?php echo "<img src=\"arrow1.gif\">&nbsp;<a href=\"view.php?pid=$row[rel_id]\">" .  GetTextLimit(FormatReleaseName($row['str_short']), 170) . "</a>"?><img src="spacer.gif" width="3" height="3"></td>
                      </tr>
                      <?
						}
					}
    				?>
                  </table>
                    <br>
                    <strong><span class="smallprint"><a href="search.php?sort=dls&direction=desc&rel=1&network=<?php echo $network ?>&cat=<?php echo $_GET['cat']?>">Show all top releases</a></span></strong></td></tr>
            </table>
            <h2>Recent Requests and Releases</h2>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr valign="top" class="newstitle">
                <td width="52%" background="images/bar11.gif">
                <p><strong>New Requests</strong></p></td>
                <td width="48%" background="images/bar11.gif">
                <p><strong>New Releases</strong></p></td>
              </tr>
              <tr valign="top" class="newstitle">
                <td><br>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <?php
					$q = mysql_query("SELECT * FROM ".$dbprefix."shares WHERE cat_id=$cat AND req_state=1 $netsql ORDER BY reqrel_date DESC LIMIT 0,20");
					if ($q && mysql_num_rows($q)) {
						while ($row = mysql_fetch_array($q)) {

					?>
                      <tr>
                        <td class="smallprint"><img src="spacer.gif" width="3" height="3"><?php echo "<img src=\"arrow1.gif\">&nbsp;<a href=\"view.php?pid=$row[rel_id]\">" . GetTextLimit(FormatReleaseName($row['str_short']), 170) . "</a>" ?></td>
                      </tr>
                      <?
						}
					}
    				?>
                  </table>
                                      <br>
                    <strong><span class="smallprint"><a href="search.php?sort=date&direction=desc&req=1&network=<?php echo $network ?>&cat=<?php echo $_GET['cat']?>">Show all new requests</a></span></strong></td>
                <td><br>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <?php
					$q = mysql_query("SELECT * FROM ".$dbprefix."shares WHERE cat_id=$cat AND req_state=2 $netsql ORDER BY reqrel_date DESC LIMIT 0,20");
					if ($q && mysql_num_rows($q)) {
						while ($row = mysql_fetch_array($q)) {

					?>
                      <tr>
                        <td class="smallprint"><?php echo "<img src=\"arrow1.gif\">&nbsp;<a href=\"view.php?pid=$row[rel_id]\">" .  GetTextLimit(FormatReleaseName($row['str_short']), 170) . "</a>"?><img src="spacer.gif" width="3" height="3"></td>
                      </tr>
                      <?
						}
					}
    				?>
                  </table>
                                      <a href="search.php?sort=date&direction=desc&rel=1&network=<?php echo $network ?>&cat=<?php echo $_GET['cat']?>"><br>
                                      <strong><span class="smallprint">Show all new releases</span></strong></a></td></tr>
            </table>
            <?php include("tmpl_foot.php"); ?>
Return current item: Open ShareLive