Tags/Genre mod

Started by Kustff, March 31, 2015, 10:13:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kustff

I have installed very basic tag/genre mod and wanted some more options in browse. From box code not working...

Tag mod:

Code (mysql) Select
ALTER TABLE torrents ADD tags text NOT NULL DEFAULT ' ';


details add in big query

Code (php) Select
torrents.tags,


Where you want. torrenttable function, details etc..

Code (php) Select
if ($row["tags"] == "")
     {
$keyw = "No tags Specified.";
         } else {
$tags = explode(",", htmlspecialchars($row["tags"]));
$keyw= "";

foreach ($tags as $tag){
     $keyw.= "<a href='browse.php?search=$tag'>$tag</a>, ";
}
     $keyw = substr($keyw, 0, (strlen($keyw) - 2));
}
echo("<tr>
<td class='detail'>Genre/Tag</td>
<td class='rowhead'>".$keyw."</td>
</tr>");


upload page

Code (php) Select
echo("<tr>
     <td class='rowhead' width='10%' align='center'>
         <label for='tags'>Genre/tags</label></td>
<td class='rowhead' width='39%' align='left'>
<input type='text' name='tags' size='50' value='".$_POST["tags"]."'><br />Example: Horror, Mystery
</tr>");


takeupload

Code (php) Select
if (isset($_POST["tags"]))
{
     $tags = str_replace(" ", "", $_POST["tags"]);
     $tags = htmlspecialchars($tags);
}else{
     $tags = " ";
}



Query add

Code (php) Select
tags,


and

Code (php) Select
'".$tags."',


edit.php

Code (php) Select
echo ("<tr>
<td class='rowhead'><label for='tags'>Genre/tags:</td>
<td class='rowhead'><input type='text' name='tags' size='50' value='".htmlspecialchars($row["tags"])."' /></td>
</tr>");



take edit

Code (php) Select
$tags = str_replace(" ", "", $_POST["tags"]);
$updateset[] = "tags = " . sqlesc($tags);



Now.. Browse searching things...

Code (php) Select
$from = isset($_GET['from']) ? $_GET["from"] : false;


Code (php) Select


// IN HERE TORRENT TAGS SEARCH AND I DON'T SURE IF THIS CODE WORKS
// Added $from
// Search name, description or both
if (isset($cleansearchstr)) {
if ($from == 0) {
// Name
$wherea[] = "torrents.name LIKE (" . sqlesc($searchstr) . ")";
} elseif ($from == 1) {
// Description
$wherea[] = "MATCH (search_text, ori_descr) AGAINST (".sqlesc($searchstr).")";
} elseif ($from == 2) {
// Tags/Genre
$wherea[] = "torrents.tags LIKE (".sqlesc($searchstr).")";
} elseif ($from == 3) {
// Name and description
$wherea[] = "MATCH (search_text, descr) AGAINST (".sqlesc($searchstr).")";
}




Code (php) Select
$wrschdropdown = "<select name=from>";

$wrschdropdown .= "<option value=0";
if ($_GET["from"] == 0) $wrschdropdown .= " selected=\"selected\"";
$wrschdropdown .= ">vain nimest&auml;</option>\n";

$frombox .= "<option value=1";
if ($_GET["from"] == 1) $frombox .= " selected=\"selected\"";
$frombox .= ">Name and Description</option>\n";

$frombox .= "<option value=2";
if ($_GET["from"] == 2) $frombox .= " selected=\"selected\"";
$frombox .= ">Tags</option>\n";

$frombox .= "<option value=3";
if ($_GET["from"] == 3) $frombox .= " selected=\"selected\"";
$frombox .= ">Name and Description</option>\n";

$frombox .= "</select>\n";