Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Yuna Scatari Edition (YSE) > Mods & Themes
Reply
Thread Tools
  #1  
Old 29th August 2008, 12:36
kp380lv's Avatar
kp380lv kp380lv is offline
Senior Member
 
Join Date: May 2008
Latvia
Posts: 388
Thumbs up Demote uploader automatically
YSE PRE 6

Mod automatic uplouder lowering
Attention! Mod not been tested in real time!
This mod automatically lowering uplouder if they did not have releases within 60 days (number of days - you can change at its discretion).

Attention:
The request to base initially set number of days to verify the (now 60).
Before installing, change the value in the request, if you want to use another term verification! Similarly, in the texts of messages, change 60 days for its significance.
Change reference to the FAQ (displayed in the message the user in private), in accordance with relevant to your site.

Installation:


Make a request to base:

Code:
CREATE TABLE `uploaders` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `nowdate` int(11) NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL,
  `releas` enum('yes','no') NOT NULL default 'no',
  `days` int(5) unsigned NOT NULL default '60',
  `sended` enum('yes','no') NOT NULL default 'no',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;
Create a file with the content uploaders_down.php:

Code:
<?
//////////////////////////////////////////////////////////////
///////////////  Мod automatic lowering uplouder //////////////
////////////////////////////////////////////////////////////


/ / require "include / bittorrent.php"; / / string for manual test - out connecting to tracker!!
/ / dbconn (false); / / string for manual test - out connecting to tracker!!

$ one_hour = 3600;
$ date_to = time (); / / obtain the current time (unixtimestamp)

$query = "SELECT * FROM uploaders";
$res = mysql_query($query)  or sqlerr(__FILE__,__LINE__);
while($result = mysql_fetch_array($res))
{

	
$ userid = $ result [ 'userid']; / / id user
            
     if (! $ result [ 'nowdate'])
     (
     $ query = "UPDATE uploaders SET nowdate ='".$ date_to ."'";
     mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / recorded in the database current date, if the value of a blank
     )
                        
     if (abs ($ date_to - $ result [ 'nowdate'])> = $ one_hour * 24) / / If the day passed, then more work
    {
                        
            if ($result['days'])
            {
              $new_days = $result['days'] - 1;
$ query = "UPDATE uploaders SET days = $ new_days WHERE userid = $ userid";
               mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / taken 1 day at the counter
             )
            
             if ($ result [ 'days'] <= 7) / / For how many days to warn
             (
                 if ($ result [ 'releas'] == "no" and $ result [' sended '] == "no") / / If there is no release and not to send a message
                 (
/ / send a message in private

$res1 = sql_query("SELECT username FROM users WHERE id=$userid") or sqlerr(__FILE__,__LINE__);
$row1 = mysql_fetch_array($res1);

$ lshead = 'Warning to demote';
$ lsbody = 'Hello, [b]'. $ row1 [ 'username'].'[/ b]!
 
You received this message because left [b] '. $ result [' days'].'[/ b] days prior to the expiration date,
for which you were supposed to deploy at least one new release on our website,
under [url = '. $ DEFAULTBASEURL.' / faq.php # 37] REGULATION OF ADOPTING In APLOADERY [/ url].
[hr] [color = red] [b] If the '. $ result [' days']. ' days at the site did not appear any of your release:
-- You'll automatically be demoted to class user! [/ B] [/ color]
[hr] [i] Sincerely, the Administration " '. $ SITENAME .'"[/ i]';
                        
$query = "INSERT INTO messages (sender, receiver, added, subject, msg, unread, saved) VALUES ('0', '$userid', NOW(), ".sqlesc($lshead).", ".sqlesc($lsbody).", 'yes', 'no')";
sql_query($query) or sqlerr(__FILE__,__LINE__);

/ / Writing in the commentary
writecomment ($ userid, timestamp2time (TIMENOW). "Warned (a) to demote class Aploader to user.");

/ / Writing in the log
$ link_to_user = "<a target='_blank' href='userdetails.php?id=$userid'>". $ row1 [ 'username']."</ a >";// Poluchaem user data
                                        
write_log ( "$ link_to_user was warned system. <br> The reason: Remained". $ result [ 'days']. "days before lowering class (there was no release)", "FFC166", "tracker");

                
$ query = "UPDATE uploaders SET sended = 'yes' WHERE userid = $ userid";
mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / Pomechaem that the message sent
                }
            }
            
	
if (! $ result [ 'days']) / / If expired 60 days
             (
                 if ($ result [ 'releas'] == "no") / / If there had been no release
                 (

                 / / Ponizhaem class of users, write the new parameters to the database
                 $ query = "UPDATE users SET class = 0 WHERE id = $ userid";
                 mysql_query ($ query) or sqlerr (__FILE__, __LINE__);

                 $ query = "DELETE FROM uploaders WHERE userid = $ userid";
                 mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / remove from the table uplouder
                
/ / send a message in private

$res2 = sql_query("SELECT username FROM users WHERE id=$userid") or sqlerr(__FILE__,__LINE__);
$row2 = mysql_fetch_array($res2);

	
$ lshead = 'You have been demoted';
$ lsbody = 'Hello, [b]'. $ row2 [ 'username'].'[/ b]!
 
You received this message because expired, you released at least one placement release
but you ignored the warning system previously expelled, not placing any release.
[hr] According to [url = '. $ DEFAULTBASEURL.' / faq.php # 37] EXCEPTIONS TO THE RULES APLOADEROV [/ url]:
[color = red] [b] - you were automatically demoted to class user! [/ b] [/ color]
[hr] [i] Sincerely, the Administration " '. $ SITENAME .'"[/ i]';
                        
$query = "INSERT INTO messages (sender, receiver, added, subject, msg, unread, saved) VALUES ('0', '$userid', NOW(), ".sqlesc($lshead).", ".sqlesc($lsbody).", 'yes', 'no')";
sql_query($query) or sqlerr(__FILE__,__LINE__);

	
/ / Writing in the commentary
writecomment ($ userid, timestamp2time (TIMENOW). "lowered (a) system user to class.");

/ / Writing in the log
$ link_to_user = "<a target='_blank' href='userdetails.php?id=$userid'>". $ row2 [ 'username']."</ a >";// Poluchaem user data
                                        
write_log ( "$ link_to_user system was downgraded to the User. <br> The reason: Not a single release in the allotted time - 60 days", "FFC166", "tracker");
                
                }
                else
                {
	
/ / If the releases were
                 $ query = "UPDATE uploaders SET days = 60, releas = 'no', sended = 'no' WHERE userid = $ userid";
                 mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / Insert a new countdown meter in 60 days
                 )
             )
      
     $ query = "UPDATE uploaders SET nowdate ='".$ date_to ."'";
     mysql_query ($ query) or sqlerr (__FILE__, __LINE__); / / recorded in the database current date

    }
}
?>
The file userdetails.php find:

Code:
print("<tr><td class=\"rowhead\">Класс</td><td align=\"left\"><b>" . get_user_class_color($user["class"], get_user_class_name($user["class"])) . ($user["title"] != "" ? " / <span style=\"color: purple;\">{$user["title"]}</span>" : "") . "</b></td></tr>\n");

Add the following:

Code:
//////////////////////////////////////////////////////////////
///////////////  Мod automatic lowering uplouder //////////////
////////////////////////////////////////////////////////////
	
if ($ user [ "class"] == 3) (/ / If uplouder

    if (get_user_class ()> = UC_MODERATOR or $ user [ "id"] == $ CURUSER [ "id"]) (/ / Access Moderatoram and above, very user

    $ fromup = sql_query ( "SELECT releas, days, sended FROM uploaders WHERE userid =". $ user [ 'id']."") or sqlerr (__FILE__, __LINE__);
    $ testup = mysql_fetch_array ($ fromup); / / Select the user from the table aploaderov
   
	
if (! $ testup) (/ / If for some reason it is not on the table uploaders (verification)
    $ messtxt = "<font color='red'> <b> Checking user does not </ b> </ font>"; / / Vyvodimoe message
    )
    else
    (
        $ days = "<font color='red'> <b>". $ testup [ 'days']. "days. </ b> </ font>"; / / How many days before a possible downgrading
   
	
if ($ testup [ 'releas'] == "no") (/ / There are no press releases or
        $ releas = "<font color='red'> <b> ON </ b> (no releases) </ font>";
        ) Else (
        $ releas = "<font color='green'> <b> OFF </ b> (there are releases) </ font>";
       }
   
	
if ($ testup [ 'sended'] == "yes") (/ / Is Sent warning
        $ sended = "<font color='red'>, <b> warned </ b> (<b> and </ b>) </ b> </ font>";
        ) Else (
        $ sended = "";
       }
   
$ messtxt = "<b> remaining </ b>:". $ days. "<b> Ponizhenie </ b>:". $ releas ."".$ sended. ""; / / Vyvodimoe message
   }

	
print ( "<tr> <td class=\"rowhead\"> Avtoponizhenie </ td> <td align=left>". $ messtxt. "</ td> </ tr> \ n"); / / Conclusion profile
   }
}
//////////////////////////////////////////////////////////////
///////////////  Мod automatic lowering uplouder  //////////////
////////////////////////////////////////////////////////////
The file modtask.php find:

Code:
// Notify user
        $what = ($class > $curclass ? "повышены" : "понижены");

Add the above:

Code:
//////////////////////////////////////////////////////////////
                ///////////////  Мod automatic lowering uplouder  //////////////
                ////////////////////////////////////////////////////////////

                 if ($curclass != $class)
                 {
                    if ($class == 3){
                    sql_query("INSERT INTO uploaders (userid) VALUES ($userid)") or sqlerr(__FILE__,__LINE__);
                    }
                    else
                    if ($curclass == 3){
                    sql_query("DELETE FROM uploaders WHERE userid=$userid") or sqlerr(__FILE__,__LINE__);
                    }
                  }
                  //////////////////////////////////////////////////////////////
                  ///////////////  Мod automatic lowering uplouder //////////////
                  ////////////////////////////////////////////////////////////

The file takeupload.php find:

Code:
$fp = fopen("$torrent_dir/$id.torrent", "w");
if ($fp)
{
    @fwrite($fp, benc($dict), strlen(benc($dict)));
    fclose($fp);
}
Add the following:

Code:
//////////////////////////////////////////////////////////////
///////////////  Мod automatic lowering uplouder  //////////////
////////////////////////////////////////////////////////////
if ($CURUSER["class"] == 3){                //Если аплоадер

   sql_query("UPDATE uploaders SET releas='yes', sended='no' WHERE userid=".$CURUSER['id']."") or sqlerr(__FILE__,__LINE__);
}
//////////////////////////////////////////////////////////////
///////////////  Мod automatic lowering uplouder  //////////////
////////////////////////////////////////////////////////////
Connecting fashion:

The file stdhead.php your theme, add up to the top:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

This:

Code:
<?
    include("uploaders_down.php"); //Automatic demotion uplouder
?>
Reply With Quote
The Following 3 Users Say Thank You to kp380lv For This Useful Post:
mondolfo (18th March 2010), theone3 (3rd October 2010), wxlg1117 (4th September 2009)
Reply

Tags
automatically , demote , uploader


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Request to be Uploader sammygo Mods & Themes 21 7th June 2013 10:52
Anonymous Uploader dyzzy Mods & Themes 1 7th November 2012 15:45
Uploader application Nilsons Mods & Themes 7 18th October 2012 22:34
Auto Promote/Demote user joeroberts Mods & Themes 9 7th February 2010 18:45
uploader wanted joeroberts Community Cafe 0 29th August 2009 21:05



All times are GMT +2. The time now is 07:27. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.