Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Yuna Scatari Edition (YSE) > Mods & Themes
Reply
  #1  
Old 23rd September 2009, 19:14
kp380lv's Avatar
kp380lv kp380lv is offline
Senior Member
 
Join Date: May 2008
Latvia
Posts: 388
Thumbs up Optimization mod
Go to details.php and search for this:

Drop in your database: DROP TABLE `readtorrents`;
And add your database this: ALTER TABLE `users` ADD `last_checked` datetime NOT NULL default '0000-00-00 00:00:00';

PHP Code:
sql_query("INSERT INTO readtorrents (userid, torrentid) VALUES (".sqlesc($CURUSER["id"]).", ".sqlesc($id).")")/* or sqlerr(__FILE__,__LINE__)*/
After you find that simply comment it out...

like this:
PHP Code:
//sql_query("INSERT INTO readtorrents (userid, torrentid) VALUES (".sqlesc($CURUSER["id"]).", ".sqlesc($id).")")/* or sqlerr(__FILE__,__LINE__)*/; 
After this line add this;

PHP Code:
if(checkNewTorrent($id$row["added"])) 

  
$coo_ch $_COOKIE['torrents_vis']; 
  
setcookie("torrents_vis", ($coo_ch $coo_ch"A" .$id $id)); 
  
sql_query("UPDATE torrents SET views = views + 1 WHERE id = $id"); 

Then open functions.php and search for function userlogin

After this:

PHP Code:

$sec 
hash_pad($row["secret"]); 
    if (
$_COOKIE["pass"] !== $row["passhash"]) { 
        if (
$use_lang
            include_once(
'languages/lang_' $default_language '/lang_main.php'); 
        
user_session(); 
        return; 
    } 
Add this:

PHP Code:
$minutes 20
    
$seconds $minutes*60;
    
$dt get_date_time(gmtime() - $seconds);

    if(
$row['last_access'] < $dt)
    {
        
$set_checked ", last_checked = '" .$row['last_access']. "'";
        
setcookie("torrents_vis""");
    } 
Find this:

PHP Code:
sql_query("UPDATE users SET last_access = ".sqlesc(get_date_time()).", ip = ".sqlesc($ip)." WHERE id=" $row["id"]);// or die(mysql_error()); 
and replace it with this:

PHP Code:
sql_query("UPDATE users SET last_access = ".sqlesc(get_date_time()).", ip = ".sqlesc($ip).$set_checked ." WHERE id=" $row["id"]);// or die(mysql_error()); 
After that paste this code UNTIL function torrenttable

PHP Code:
 function checkNewTorrent($id$added
  { 
    global 
$CURUSER

      
$coo_new $_COOKIE["torrents_vis"]; 

      
$diff_add preg_replace("/[^0-9]/"""$added); 
      
$diff_lch preg_replace("/[^0-9]/"""$CURUSER["last_checked"]); 

      if(
$diff_add $diff_lch
      { 
         if(
$coo_new
         { 
        if(
explode("A"$coo_new)) 
        { 
           if(!
in_array($idexplode("A"$coo_new))) 
           
$new_t true
        } 
        else 
        { 
           if(
$coo_new != $id
           
$new_t true
        } 
         } 
         else 
        
$new_t true
      } 
      else 
     
$new_t false

     return 
$new_t
   } 
After that find and replace this:

PHP Code:
if ($row["readtorrent"] == && $variant == "index"
                   print (
"<b><font color=\"red\" size=\"1\">[NEW]</font></b>"); 
With this:

PHP Code:
 if (checkNewTorrent($row["id"], $row["added"]) && $is_user && $variant == "index"
       print (
"<b><font color=\"red\" size=\"1\">[NEW]</font></b>"$diff); 
Then open takesignup.php and replace this:

PHP Code:
$ret sql_query("INSERT INTO users (username, passhash, secret, editsecret, gender, country, icq, msn, aim, yahoo, skype, mirc, website, email, status, ". (!$users?"class, ":"") ."added, birthday, invitedby, invitedroot) VALUES (" .
        
implode(","array_map("sqlesc", array($wantusername$wantpasshash$secret$editsecret$gender$country$icq$msn$aim$yahoo$skype$mirc$website$email$status))).
        
", ". (!$users?UC_SYSOP.", ":""). "'"get_date_time() ."', '$birthday', '$inviter', '$invitedroot')");// or sqlerr(__FILE__, __LINE__); 
With this:

PHP Code:
 $ret sql_query("INSERT INTO users (username, passhash, secret, editsecret, gender, country, icq, msn, aim, yahoo, skype, mirc, website, email, status, ". (!$users?"class, ":"") ."added, birthday, language, invitedby, invitedroot, last_checked) VALUES (" .
        
implode(","array_map("sqlesc", array($wantusername$wantpasshash$secret$editsecret$gender$country$icq$msn$aim$yahoo$skype$mirc$website$email$status))).
        
", ". (!$users?UC_SYSOP.", ":""). "'"get_date_time() ."', '$birthday', '$default_language', '$inviter', '$invitedroot', '"get_date_time() ."')");// or sqlerr(__FILE__, __LINE__); 
Now open markread.php and replace it with this code:

PHP Code:

<?
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
ob_start();

stdhead();


if (
sql_query("UPDATE users SET last_checked = " .sqlesc(get_date_time()). " WHERE id = " .sqlesc($CURUSER["id"])) && setcookie("torrents_vis"""))
   
stdmsg("Successfully""Latest torrents marked as read.");
else
   
stdmsg("Error""Evaluation of new torrents occurred with error: ".mysql_error());


stdfoot();

header("Refresh: 5; url=browse.php");
?>
Now delete unneeded things..

cleanup.php

PHP Code:
sql_query("DELETE FROM readtorrents WHERE userid = ".sqlesc($arr["id"])) or sqlerr(__FILE__,__LINE__);
sql_query("DELETE FROM readtorrents WHERE userid = ".sqlesc($arr["id"])) or sqlerr(__FILE__,__LINE__
details.php

PHP Code:
sql_query("INSERT INTO readtorrents (userid, torrentid) VALUES (".sqlesc($CURUSER["id"]).", ".sqlesc($id).")")/* or sqlerr(__FILE__,__LINE__)*/
browse.php

PHP Code:
".($CURUSER ? "EXISTS(SELECT FROM readtorrents WHERE readtorrents.userid ".sqlesc($CURUSER["id"])." AND readtorrents.torrentid torrents.id) AS readtorrent" : "AS readtorrent")." 
delacct.php

PHP Code:
sql_query("DELETE FROM readtorrents WHERE userid = $id") or sqlerr(__FILE__,__LINE__); 
delaccadmin.php

PHP Code:
sql_query("DELETE FROM readtorrents WHERE userid = $id") or sqlerr(__FILE__,__LINE__); 
deltorrent.php

PHP Code:
sql_query("DELETE FROM readtorrents WHERE torrentid IN (" implode(", "array_map("sqlesc"$_POST["delete"])) . ")") or sqlerr(__FILE__,__LINE__); 
modtask.php

PHP Code:
sql_query("DELETE FROM readtorrents WHERE userid = $userid") or sqlerr(__FILE__,__LINE__); 

That's all.
Reply With Quote
The Following 2 Users Say Thank You to kp380lv For This Useful Post:
Masterdan (24th October 2009), Moh.ElBaz (6th October 2009)
  #2  
Old 5th October 2009, 23:04
benjaminbih benjaminbih is offline
Senior Member
 
Join Date: Jul 2008
Bosnia-Herzegovina
Posts: 70
Default
nice work, thank you for providing it
Reply With Quote
  #3  
Old 24th July 2011, 00:55
DOPE's Avatar
DOPE DOPE is offline
Senior Member
 
Join Date: Jul 2011
United States
Posts: 32
Default
What does this do exactly?
Reply With Quote
Reply

Tags
mod , optimization

Thread Tools

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
SEO - Optimization for Search Engine kp380lv Mods & Themes 0 27th September 2009 17:48



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