09 Moderated Torrents By pdq

Started by Mindless, July 21, 2012, 09:32:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

Credits to pdq
This is so moderators can mark torrents 'checked/moderated' without having to go to edit.php
the option is on details page and when checked a little icon shows beside torrent name in browse.
[gives moderators something to do i guess]
also only moderators and up will see the displays, anyways...
very simple =]

Code (sql) Select
ALTER TABLE torrents ADD `checked_by` varchar(40) NOT NULL default '';

in details.php
find the big query near the top and add to it:

Code (sql) Select
torrents.checked_by,

so looks like:
Code (sql) Select
$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.checked_by, ...etc.

in details.php
then find like this:

Code (php) Select
elseif (isset($_GET["rated"]))
$HTMLOUT .= "<h2>{$lang['details_rating_added']}</h2>\n";


Below add :

   
Code (php) Select
//==pdq's Torrent Moderation
    if ($CURUSER['class'] >= UC_MODERATOR)
    {
    if (isset($_GET["checked"]) &&  $_GET["checked"] == 1)
    {
    mysql_query("UPDATE torrents SET checked_by = ".sqlesc($CURUSER['username'])." WHERE id =$id LIMIT 1");
    write_log("Torrent <a href={$TBDEV['baseurl']}/details.php?id=$id>('.htmlspecialchars($row['name']).')</a> was checked by $CURUSER[username]");
    header("Location: {$TBDEV["baseurl"]}/details.php?id=$id&checked=done#Success");
    }
    elseif (isset($_GET["rechecked"]) &&  $_GET["rechecked"] == 1)
    {
    mysql_query("UPDATE torrents SET checked_by = ".sqlesc($CURUSER['username'])." WHERE id =$id LIMIT 1");
    write_log("Torrent <a href={$TBDEV['baseurl']}/details.php?id=$id>('.htmlspecialchars($row[name]).')</a> was re-checked by $CURUSER[username]");
    header("Location: {$TBDEV["baseurl"]}/details.php?id=$id&rechecked=done#Success");
    }
    elseif (isset($_GET["clearchecked"]) &&  $_GET["clearchecked"] == 1)
    {
    mysql_query("UPDATE torrents SET checked_by = '' WHERE id =$id LIMIT 1");
    write_log("Torrent <a href={$TBDEV["baseurl"]}/details.php?id=$id>('.htmlspecialchars($row[name]).')</a> was un-checked by $CURUSER[username]");
    header("Location: {$TBDEV["baseurl"]}/details.php?id=$id&clearchecked=done#Success");
    }
    if (isset($_GET["checked"]) &&  $_GET["checked"] == 'done')
    {
    $HTMLOUT .="<h2><a name='Success'>Successfully checked {$CURUSER['username']}!</a></h2>";
    }
    if (isset($_GET["rechecked"]) &&  $_GET["rechecked"] == 'done')
    {
    $HTMLOUT .="<h2><a name='Success'>Successfully re-checked {$CURUSER['username']}!</a></h2>";
    }
    if (isset($_GET["clearchecked"]) &&  $_GET["clearchecked"] == 'done')
    {
    $HTMLOUT .="<h2><a name='Success'>Successfully un-checked {$CURUSER['username']}!</a></h2>";
    }
    }
    // end


in details.php
then find like:

Code (php) Select
$HTMLOUT .= tr("Upped by", $uprow, 1);

add this below:

   
Code (php) Select
//==pdq's Torrent Moderation
   if ($CURUSER['class'] >= UC_MODERATOR)
   {
   if (!empty($row['checked_by']))
   {
   $checked_by = mysql_query("SELECT id FROM users WHERE username='$row[checked_by]'");
   $checked = mysql_fetch_array($checked_by);
   $HTMLOUT .="<tr><td class='rowhead'>Checked by</td><td align='left'><a href='{$TBDEV["baseurl"]}/userdetails.php?id=".(int)$checked['id']."'><strong>
   ".htmlspecialchars($row['checked_by'])."</strong></a>&nbsp;
   <img src='{$TBDEV['pic_base_url']}mod.gif' width='15' border='0' alt='Checked' title='Checked - by ".htmlspecialchars($row['checked_by'])."' />
   <a href='{$TBDEV["baseurl"]}/details.php?id=".$row['id']."&amp;rechecked=1'><small><em><strong>[Re-Check this torrent]</strong></em></small></a>
   &nbsp;<a href='{$TBDEV["baseurl"]}/details.php?id=".(int)$row['id']."&amp;clearchecked=1'><small><em><strong>[Un-Check this torrent]</strong></em></small></a> &nbsp;* STAFF Eyes Only *</td></tr>";
   }
   else
   {
   $HTMLOUT .="<tr><td class='rowhead'>Checked by</td><td align='left'><font color='#ff0000'><strong>NOT CHECKED!</strong></font>&nbsp;
   <a href='{$TBDEV["baseurl"]}/details.php?id=".(int)$row['id']."&amp;checked=1'>
   <small><em><strong>[Check this torrent]</strong></em></small></a> &nbsp;* STAFF Eyes Only *</td></tr>";
   }
   }
   // end



then in include/torrenttable_functions.php find :

Code (php) Select
$dispname = htmlspecialchars($row["name"]);

add this somewhere above/below that:

Code (php) Select
$checked = ((!empty($row['checked_by']) && $CURUSER['class'] >= UC_MODERATOR) ? "&nbsp;<img src='{$TBDEV['pic_base_url']}mod.gif' width='15' border='0' title='Checked - by ".htmlspecialchars($row['checked_by'])."' />" : "");

or use this one uses text instead of an image:

Code (php) Select
$checked = ((!empty($row['checked_by']) && $CURUSER['class'] >= UC_MODERATOR) ? '<a title="Checked - by '.htmlspecialchars($row['checked_by']).'"><small><strong><font color="#8000ff">M</font></strong></small></a>': '');

then find like:

Code (php) Select
$htmlout .= "'><b>$dispname</b></a>

add in $checked in line :

Code (php) Select
$htmlout .= "'><b>$dispname</b></a>&nbsp;$checked..............ect

or add below the dispname line :

Code (php) Select
echo $checked;

in browse.php
find the big query and add to it:

Code (php) Select
torrents.checked_by,