Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 92.39 KB | None | 0 0
  1. /***
  2. *
  3. * BNBT Beta 7.7 - A C++ BitTorrent Tracker
  4. * Copyright (C) 2003 Trevor Hogan
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. ***/
  21.  
  22. // Trinity Edition Modified Source File
  23.  
  24. #include "bnbt.h"
  25. #include "atom.h"
  26. #include "sort.h"
  27. #include "tracker.h"
  28. #include "util.h"
  29.  
  30. void CTracker :: serverResponseIndex( struct request_t *pRequest, struct response_t *pResponse, user_t user )
  31. {
  32.     struct bnbttv btv = UTIL_CurrentTime( );
  33.  
  34.     pResponse->strCode = "200 OK";
  35.  
  36.     pResponse->mapHeaders.insert( pair<string, string>( "Content-Type", string( "text/html; charset=" ) + gstrCharSet ) );
  37.  
  38.     pResponse->strContent += "<html>\n";
  39.     pResponse->strContent += "<head>\n";
  40.    
  41.     // The Trinity Edition - Addition BEGINS
  42.     // Inserts an HTML <script> tag to reference an external Javascript (.js) document when an ONLINE file path is specified in the tracker's configuration file...
  43.  
  44.     if ( !gstrExternalJavascript.empty( ) ) {
  45.             pResponse->strContent += "<script src=\"" + gstrExternalJavascript + "\" language=\"JavaScript\" type=\"text/javascript\"></script>\n\n";
  46.         }
  47.  
  48.         // ---------------------------------------- End of Addition
  49.  
  50.     // The Trinity Edition - Modification Begins
  51.     // Changed Title of Page
  52.  
  53.     // Uses a Custom Tracker Title in place of BNBT - bnbt_tracker_title
  54.     if ( !gstrTrackerTitle.empty( ) ) {
  55.         pResponse->strContent += "<title>" + gstrTrackerTitle + " - Home</title>\n";
  56.     }
  57.     else {
  58.         pResponse->strContent += "<title>BNBT Tracker</title>\n"; // <-- Original Source Code
  59.     }
  60.  
  61.     if( !gstrStyle.empty( ) )
  62.         pResponse->strContent += "<link rel=stylesheet type=\"text/css\" href=\"" + gstrStyle + "\">\n";
  63.  
  64.     pResponse->strContent += "</head>\n";
  65.     pResponse->strContent += "<body>\n";
  66.  
  67.     // The Trinity Edition - Addition Begins
  68.     // The following displays a special navigation bar on index.html
  69.     // Specific Buttons are displayed based on the User's Access Level
  70.  
  71.  
  72.  
  73.     // ------------------------------------------------- END OF ADDITION
  74.  
  75. // The Trinity Edition - Modification Begins
  76. // Removes Login and Logged In Message when using the NAVBAR
  77.  
  78.     /* Original Source Code:
  79.     if( user.strLogin.empty( ) )
  80.         pResponse->strContent += "<p class=\"login1_index\">You are not logged in. Click <a href=\"/login.html\">here</a> to login.</p>\n";
  81.     else
  82.         pResponse->strContent += "<p class=\"login2_index\">You are logged in as <span class=\"username\">" + UTIL_RemoveHTML( user.strLogin ) + "</span>. Click <a href=\"/login.html?logout=1\">here</a> to logout.</p>\n";
  83.     */
  84.  
  85. // ------------------------------------------------- END OF MODIFICATION
  86.  
  87.     if( user.iAccess & ACCESS_VIEW )
  88.     {
  89.         //
  90.         // delete torrent
  91.         //
  92.  
  93.         if( user.iAccess & ACCESS_EDIT )
  94.         {
  95.             if( pRequest->mapParams.find( "del" ) != pRequest->mapParams.end( ) )
  96.             {
  97.                 string strDelHashString = pRequest->mapParams["del"];
  98.                 string strDelHash = UTIL_StringToHash( strDelHashString );
  99.                 string strOK = pRequest->mapParams["ok"];
  100.  
  101.                 if( strDelHash.empty( ) )
  102.                 {
  103.                     pResponse->strContent += "<p>Unable to delete torrent " + strDelHashString + ". The info hash is invalid. Click <a href=\"/index.html\">here</a> to return to the tracker.</p>\n";
  104.  
  105.                     if( m_bGen )
  106.                         pResponse->strContent += "<center><p class=\"gen\">Generated in " + UTIL_ElapsedTimeStr( btv, UTIL_CurrentTime( ) ) + " seconds.</p></center>\n";
  107.  
  108.                     pResponse->strContent += "</body>\n";
  109.                     pResponse->strContent += "</html>\n";
  110.  
  111.                     return;
  112.                 }
  113.                 else
  114.                 {
  115.                     if( strOK == "1" )
  116.                     {
  117.                         if( m_pAllowed )
  118.                         {
  119.                             // delete from disk
  120.  
  121.                             CAtom *pList = m_pAllowed->getItem( strDelHash );
  122.  
  123.                             if( pList && pList->isList( ) )
  124.                             {
  125.                                 vector<CAtom *> vecTorrent = ( (CAtomList *)pList )->getValue( );
  126.  
  127.                                 if( vecTorrent.size( ) == 6 )
  128.                                 {
  129.                                     CAtom *pFileName = vecTorrent[0];
  130.  
  131.                                     if( pFileName )
  132.                                     {
  133.                                         if( m_strArchiveDir.empty( ) )
  134.                                             UTIL_DeleteFile( ( m_strAllowedDir + pFileName->toString( ) ).c_str( ) );
  135.                                         else
  136.                                             UTIL_MoveFile( ( m_strAllowedDir + pFileName->toString( ) ).c_str( ), ( m_strArchiveDir + pFileName->toString( ) ).c_str( ) );
  137.                                     }
  138.                                 }
  139.                             }
  140.  
  141.                             m_pAllowed->delItem( strDelHash );
  142.                             m_pDFile->delItem( strDelHash );
  143.                             m_pTags->delItem( strDelHash );
  144.  
  145.                             // The Trinity Edition - Modification Begins
  146.                             // The following alerts the user that the torrent has been deleted
  147.                             // and AUTOMATICALLY returns him/her to the login/mytorrents page.
  148.  
  149.                             /* Original Source Code:
  150.                             pResponse->strContent += "<p>Deleted torrent " + strDelHashString + ". Click <a href=\"/index.html\">here</a> to return to the tracker.</p>\n";
  151.                             */
  152.  
  153.                             pResponse->strContent += "<p>Torrent Deleted: " + strDelHashString + "</p>\n\n";
  154.  
  155.                             pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  156.                             pResponse->strContent += "alert('TORRENT DELETED! \\n\\n The following torrent has been deleted: \\n\\n Hash ID: " + strDelHashString + "\\n\\n' + 'Press OK to return to the Tracker.');\n";
  157.                             pResponse->strContent += "window.location=\"/index.html\";\n";
  158.                             pResponse->strContent += "</script>\n\n";
  159.  
  160.                             // ------------------------------------------------ END OF MODIFICATION
  161.  
  162.                             if( m_bGen )
  163.                                 pResponse->strContent += "<center><p class=\"gen\">Generated in " + UTIL_ElapsedTimeStr( btv, UTIL_CurrentTime( ) ) + " seconds.</p></center>\n";
  164.  
  165.                             pResponse->strContent += "</body>\n";
  166.                             pResponse->strContent += "</html>\n";
  167.  
  168.                             return;
  169.                         }
  170.                     }
  171.                     else
  172.                     {
  173.  
  174.                         // The Trinity Edition - Modification Begins
  175.                         // The following prompts the user for delete confirmation using a JavaScript Prompt
  176.  
  177.                         /* Original Source Code:
  178.                         pResponse->strContent += "<p>Are you sure you want to delete the torrent " + strDelHashString + "?</p>\n";
  179.                         pResponse->strContent += "<p><a href=\"/index.html?del=" + strDelHashString + "&ok=1\">OK</a></p>\n";
  180.                         */
  181.  
  182.                         pResponse->strContent += "<p>Deleting Torrent...</p>\n\n";
  183.  
  184.                         pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  185.                         pResponse->strContent += "if ( confirm ('DELETE CONFIRMATION! \\n\\n Are you sure you want to delete the following torrent? \\n\\n Hash ID: " + strDelHashString + "') ) {\n";
  186.                         pResponse->strContent += "  window.location=\"/index.html?del=" + strDelHashString + "&ok=1\";\n";
  187.                         pResponse->strContent += "}\n";
  188.                         pResponse->strContent += "else {\n";
  189.                         pResponse->strContent += "  window.history.back();\n";
  190.                         pResponse->strContent += "}\n";
  191.                         pResponse->strContent += "</script>\n\n";
  192.  
  193.                         // ------------------------------------------------------ END OF MODIFICATION
  194.  
  195.                         pResponse->strContent += "</body>\n";
  196.                         pResponse->strContent += "</html>\n";
  197.  
  198.                         return;
  199.                     }
  200.                 }
  201.             }
  202.         }
  203.  
  204.         pResponse->strContent += m_strStaticHeader;
  205.  
  206.         // The Trinity Edition - Addition Begins
  207.         // The following code sets a CSS class "index" using a <div> tag that can be used
  208.         // to specify style attributes... hide, center, etc.
  209.  
  210.         pResponse->strContent += "<div class=\"index\">\n\n";
  211.  
  212.         // ------------------------------------------------- End of Addition
  213.  
  214.         if( m_pDFile )
  215.         {
  216.             if( m_pDFile->isEmpty( ) )
  217.             {
  218.                 pResponse->strContent += "<p>Not tracking any files yet!</p>\n";
  219.                
  220.                 pResponse->strContent += m_strStaticFooter;
  221.  
  222.                 if( m_bGen )
  223.                     pResponse->strContent += "<center><p class=\"gen\">Generated in " + UTIL_ElapsedTimeStr( btv, UTIL_CurrentTime( ) ) + " seconds.</p></center>\n";
  224.  
  225.                 pResponse->strContent += "</body>\n";
  226.                 pResponse->strContent += "</html>\n";
  227.  
  228.                 return;
  229.             }
  230.  
  231.             map<string, CAtom *> mapDicti = m_pDFile->getValue( );
  232.  
  233.             unsigned long iKeySize = mapDicti.size( );
  234.  
  235.             // add the torrents into this structure one by one and sort it afterwards
  236.  
  237.             struct torrent_t *pTorrents = new struct torrent_t[iKeySize];
  238.  
  239.             unsigned long i = 0;
  240.  
  241.             for( map<string, CAtom *> :: iterator it = mapDicti.begin( ); it != mapDicti.end( ); it++ )
  242.             {
  243.                 pTorrents[i].strInfoHash = (*it).first;
  244.                 pTorrents[i].strName = "unknown";
  245.                 pTorrents[i].strLowerName = "unknown";
  246.                 pTorrents[i].iComplete = 0;
  247.                 pTorrents[i].iDL = 0;
  248.                 pTorrents[i].iSize = 0;
  249.                 pTorrents[i].iFiles = 0;
  250.                 pTorrents[i].iComments = 0;
  251.                 pTorrents[i].iAverageLeft = 0;
  252.                 pTorrents[i].iAverageLeftPercent = 0;
  253.                 pTorrents[i].iMinLeft = 0;
  254.                 pTorrents[i].iMaxiLeft = 0;
  255.                 pTorrents[i].iCompleted = 0;
  256.                 pTorrents[i].iTransferred = 0;
  257.  
  258.                 if( (*it).second->isDicti( ) )
  259.                 {
  260.                     map<string, CAtom *> mapPeersDicti = ( (CAtomDicti *)(*it).second )->getValue( );
  261.  
  262.                     bool bFirst = true;
  263.  
  264.                     for( map<string, CAtom *> :: iterator j = mapPeersDicti.begin( ); j != mapPeersDicti.end( ); j++ )
  265.                     {
  266.                         if( (*j).second->isDicti( ) )
  267.                         {
  268.                             CAtom *pLeft = ( (CAtomDicti *)(*j).second )->getItem( "left" );
  269.  
  270.                             if( pLeft && pLeft->isLong( ) )
  271.                             {
  272.                                 int64 iLeft = ( (CAtomLong *)pLeft )->getValue( );
  273.  
  274.                                 if( iLeft == 0 )
  275.                                     pTorrents[i].iComplete++;
  276.                                 else
  277.                                 {
  278.                                     pTorrents[i].iDL++;
  279.  
  280.                                     // only calculate average / min / max on leechers
  281.  
  282.                                     pTorrents[i].iAverageLeft += iLeft;
  283.  
  284.                                     if( bFirst || iLeft < pTorrents[i].iMinLeft )
  285.                                         pTorrents[i].iMinLeft = iLeft;
  286.  
  287.                                     if( bFirst || iLeft > pTorrents[i].iMaxiLeft )
  288.                                         pTorrents[i].iMaxiLeft = iLeft;
  289.  
  290.                                     bFirst = false;
  291.                                 }
  292.                             }
  293.                         }
  294.                     }
  295.  
  296.                     if( m_pAllowed )
  297.                     {
  298.                         CAtom *pList = m_pAllowed->getItem( pTorrents[i].strInfoHash );
  299.  
  300.                         if( pList && pList->isList( ) )
  301.                         {
  302.                             vector<CAtom *> vecTorrent = ( (CAtomList *)pList )->getValue( );
  303.  
  304.                             if( vecTorrent.size( ) == 6 )
  305.                             {
  306.                                 CAtom *pFileName = vecTorrent[0];
  307.                                 CAtom *pName = vecTorrent[1];
  308.                                 CAtom *pAdded = vecTorrent[2];
  309.                                 CAtom *pSize = vecTorrent[3];
  310.                                 CAtom *pFiles = vecTorrent[4];
  311.  
  312.                                 if( pFileName )
  313.                                     pTorrents[i].strFileName = pFileName->toString( );
  314.  
  315.                                 if( pName )
  316.                                 {
  317.                                     // stick a lower case version in strNameLower for non case sensitive searching and sorting
  318.  
  319.                                     pTorrents[i].strName = pName->toString( );
  320.                                     pTorrents[i].strLowerName = UTIL_ToLower( pTorrents[i].strName );
  321.                                 }
  322.  
  323.                                 if( pAdded )
  324.                                     pTorrents[i].strAdded = pAdded->toString( );
  325.  
  326.                                 if( pSize && pSize->isLong( ) )
  327.                                     pTorrents[i].iSize = ( (CAtomLong *)pSize )->getValue( );
  328.  
  329.                                 if( pFiles && pFiles->isInt( ) )
  330.                                     pTorrents[i].iFiles = ( (CAtomInt *)pFiles )->getValue( );
  331.                             }
  332.                         }
  333.  
  334.                         if( m_bAllowComments )
  335.                         {
  336.                             if( m_pComments )
  337.                             {
  338.                                 CAtom *pCommentList = m_pComments->getItem( pTorrents[i].strInfoHash );
  339.  
  340.                                 if( pCommentList && pCommentList->isList( ) )
  341.                                     pTorrents[i].iComments = ( (CAtomList *)pCommentList )->getValue( ).size( );
  342.                             }
  343.                         }
  344.                     }
  345.  
  346.                     if( m_pCompleted )
  347.                     {
  348.                         CAtom *pCompleted = m_pCompleted->getItem( pTorrents[i].strInfoHash );
  349.  
  350.                         if( pCompleted && pCompleted->isLong( ) )
  351.                         {
  352.                             pTorrents[i].iCompleted = (int)( (CAtomLong *)pCompleted )->getValue( );
  353.  
  354.                             // size has already been found, calculate transferred
  355.  
  356.                             if( m_pAllowed && m_bShowTransferred )
  357.                                 pTorrents[i].iTransferred = pTorrents[i].iCompleted * pTorrents[i].iSize;
  358.                         }
  359.                     }
  360.  
  361.                     if( m_pTags )
  362.                     {
  363.                         CAtom *pDicti = m_pTags->getItem( pTorrents[i].strInfoHash );
  364.  
  365.                         if( pDicti && pDicti->isDicti( ) )
  366.                         {
  367.                             CAtom *pTag = ( (CAtomDicti *)pDicti )->getItem( "tag" );
  368.                             CAtom *pName = ( (CAtomDicti *)pDicti )->getItem( "name" );
  369.                             CAtom *pUploader = ( (CAtomDicti *)pDicti )->getItem( "uploader" );
  370.                             CAtom *pInfoLink = ( (CAtomDicti *)pDicti )->getItem( "infolink" );
  371.  
  372.                             if( pTag )
  373.                                 pTorrents[i].strTag = pTag->toString( );
  374.  
  375.                             if( pName )
  376.                             {
  377.                                 // this will overwrite the previous name, i.e. the filename
  378.  
  379.                                 pTorrents[i].strName = pName->toString( );
  380.                                 pTorrents[i].strLowerName = UTIL_ToLower( pTorrents[i].strName );
  381.                             }
  382.  
  383.                             if( pUploader )
  384.                                 pTorrents[i].strUploader = pUploader->toString( );
  385.  
  386.                             if( pInfoLink )
  387.                                 pTorrents[i].strInfoLink = pInfoLink->toString( );
  388.                         }
  389.                     }
  390.  
  391.                     if( m_bShowAverageLeft )
  392.                     {
  393.                         // iAverageLeft actually contains the total left at this point, so find the average
  394.  
  395.                         if( pTorrents[i].iDL > 0 )
  396.                             pTorrents[i].iAverageLeft /= pTorrents[i].iDL;
  397.  
  398.                         if( pTorrents[i].iSize > 0 )
  399.                             pTorrents[i].iAverageLeftPercent = (int)( ( (float)pTorrents[i].iAverageLeft / pTorrents[i].iSize ) * 100 );
  400.                     }
  401.                 }
  402.  
  403.                 i++;
  404.             }
  405.  
  406.             string strSort = pRequest->mapParams["sort"];
  407.  
  408.             if( m_bSort )
  409.             {
  410.                 if( !strSort.empty( ) )
  411.                 {
  412.                     int iSort = atoi( strSort.c_str( ) );
  413.  
  414.                     if( iSort == SORT_ANAME )
  415.                     {
  416.                         if( m_pAllowed && m_bShowNames )
  417.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByName );
  418.                     }
  419.                     else if( iSort == SORT_ACOMPLETE )
  420.                         qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByComplete );
  421.                     else if( iSort == SORT_AINCOMPLETE )
  422.                         qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByDL );
  423.                     else if( iSort == SORT_AADDED )
  424.                     {
  425.                         if( m_pAllowed && m_bShowAdded )
  426.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByAdded );
  427.                     }
  428.                     else if( iSort == SORT_ASIZE )
  429.                     {
  430.                         if( m_pAllowed && m_bShowSize )
  431.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortBySize );
  432.                     }
  433.                     else if( iSort == SORT_AFILES )
  434.                     {
  435.                         if( m_pAllowed && m_bShowNumFiles )
  436.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByFiles );
  437.                     }
  438.                     else if( iSort == SORT_ACOMMENTS )
  439.                     {
  440.                         if( m_pAllowed && m_bAllowComments )
  441.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByComments );
  442.                     }
  443.                     else if( iSort == SORT_AAVGLEFT )
  444.                     {
  445.                         if( m_bShowAverageLeft )
  446.                         {
  447.                             if( m_pAllowed )
  448.                             {
  449.                                 if( m_bShowLeftAsProgress )
  450.                                     qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAvgLeftPercent );
  451.                                 else
  452.                                     qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByAvgLeftPercent );
  453.                             }
  454.                             else
  455.                                 qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByAvgLeft );
  456.                         }
  457.                     }
  458.                     else if( iSort == SORT_ACOMPLETED )
  459.                     {
  460.                         if( m_bShowCompleted )
  461.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByCompleted );
  462.                     }
  463.                     else if( iSort == SORT_ATRANSFERRED )
  464.                     {
  465.                         if( m_pAllowed && m_bShowTransferred )
  466.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByTransferred );
  467.                     }
  468.                     else if( iSort == SORT_DNAME )
  469.                     {
  470.                         if( m_pAllowed && m_bShowNames )
  471.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByName );
  472.                     }
  473.                     else if( iSort == SORT_DCOMPLETE )
  474.                         qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByComplete );
  475.                     else if( iSort == SORT_DINCOMPLETE )
  476.                         qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByDL );
  477.                     else if( iSort == SORT_DADDED )
  478.                     {
  479.                         if( m_pAllowed && m_bShowAdded )
  480.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAdded );
  481.                     }
  482.                     else if( iSort == SORT_DSIZE )
  483.                     {
  484.                         if( m_pAllowed && m_bShowSize )
  485.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortBySize );
  486.                     }
  487.                     else if( iSort == SORT_DFILES )
  488.                     {
  489.                         if( m_pAllowed && m_bShowNumFiles )
  490.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByFiles );
  491.                     }
  492.                     else if( iSort == SORT_DCOMMENTS )
  493.                     {
  494.                         if( m_pAllowed && m_bAllowComments )
  495.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByComments );
  496.                     }
  497.                     else if( iSort == SORT_DAVGLEFT )
  498.                     {
  499.                         if( m_bShowAverageLeft )
  500.                         {
  501.                             if( m_pAllowed )
  502.                             {
  503.                                 if( m_bShowLeftAsProgress )
  504.                                     qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), asortByAvgLeftPercent );
  505.                                 else
  506.                                     qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAvgLeftPercent );
  507.                             }
  508.                             else
  509.                                 qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAvgLeft );
  510.                         }
  511.                     }
  512.                     else if( iSort == SORT_DCOMPLETED )
  513.                     {
  514.                         if( m_bShowCompleted )
  515.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByCompleted );
  516.                     }
  517.                     else if( iSort == SORT_DTRANSFERRED )
  518.                     {
  519.                         if( m_pAllowed && m_bShowTransferred )
  520.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByTransferred );
  521.                     }
  522.                     else
  523.                     {
  524.                         // default action is to sort by added if we can
  525.  
  526.                         if( m_pAllowed && m_bShowAdded )
  527.                             qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAdded );
  528.                     }
  529.                 }
  530.                 else
  531.                 {
  532.                     // default action is to sort by added if we can
  533.  
  534.                     if( m_pAllowed && m_bShowAdded )
  535.                         qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAdded );
  536.                 }
  537.             }
  538.             else
  539.             {
  540.                 // sort is disabled, but default action is to sort by added if we can
  541.  
  542.                 if( m_pAllowed && m_bShowAdded )
  543.                     qsort( pTorrents, iKeySize, sizeof( struct torrent_t ), dsortByAdded );
  544.             }
  545.  
  546.             // some preliminary search crap
  547.  
  548.             string strSearch = pRequest->mapParams["search"];
  549.             string strLowerSearch = UTIL_ToLower( strSearch );
  550.             string strSearchResp = UTIL_StringToEscaped( strSearch );
  551.  
  552.             if( !strSearch.empty( ) && m_pAllowed && m_bShowNames && m_bSearch )
  553.                 pResponse->strContent += "<p class=\"search_results\">Search results for \"" + UTIL_RemoveHTML( strSearch ) + "\".</p>\n";
  554.  
  555.             // filters
  556.  
  557.             string strFilter = pRequest->mapParams["filter"];
  558.  
  559.             if( !m_vecTags.empty( ) )
  560.             {
  561.                 // pResponse->strContent += "<p align=\"center\">";
  562.  
  563.                 bool bFound = false;
  564.  
  565.                 for( vector< pair<string, string> > :: iterator i = m_vecTags.begin( ); i != m_vecTags.end( ); i++ )
  566.                 {
  567.                     if( !bFound )
  568.                                            
  569.                         // The Trinity Edition - Modification Begins
  570.  
  571.                         // The following changes the Clear Filter link to a button.
  572.  
  573.                         /* The following adds the Custom Label Feature
  574.                         to the NEW "Clear Filter" button and sets a CSS class
  575.                         "clearfilterbutton" which can be used to HIDE the button
  576.                         using the following CSS command: */
  577.  
  578.                         // .clearfilterbutton{display:none}
  579.  
  580.                     {
  581.  
  582.                         if( m_bUseCustomlabels ) {
  583.                             pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  584.                             pResponse->strContent += "if (typeof(buttonClearFilter) == \"undefined\") {\n";
  585.                             pResponse->strContent += "   document.write(\"<input class=\\\"clearfilter\\\" type=\\\"button\\\" value=\\\"Clear Filter\\\" onClick=\\\"window.location=\'/index.html\'\\\">\");\n";
  586.                             pResponse->strContent += "}\n";
  587.                             pResponse->strContent += "else {\n";
  588.                             pResponse->strContent += "   document.write(\"<input class=\\\"clearfilter\\\" type=\\\"button\\\" value=\\\"\" + buttonClearFilter + \"\\\" onClick=\\\"window.location=\'/index.html\'\\\">\");\n";
  589.                             pResponse->strContent += "}\n";
  590.                             pResponse->strContent += "</script>\n";
  591.                         }
  592.                         else { // Use Original Source Code WITH PARAGRAPH TAGS AND BUTTON CODE:
  593.                             pResponse->strContent += "<input class=\"clearfilter\" type=\"button\" value=\"Clear Filter\" onClick=\"window.location=\'/index.html\'\">\n";
  594.                         }
  595.  
  596.                         pResponse->strContent += "<p>\n";
  597.  
  598.                     }
  599.  
  600.                         /* Original Source Code:
  601.                         pResponse->strContent += "<a href=\"/index.html\">Clear Filter</a><br><br>\n";
  602.                         */
  603.  
  604.                         // ------------------------------------------------- End of Modification
  605.  
  606.                     pResponse->strContent += "<a href=\"/index.html?filter=" + UTIL_StringToEscaped( (*i).first );
  607.  
  608.                     if( !strSort.empty( ) )
  609.                         pResponse->strContent += "&sort=" + strSort;
  610.  
  611.                     if( !strSearch.empty( ) )
  612.                         pResponse->strContent += "&search=" + strSearchResp;
  613.  
  614.                     pResponse->strContent += "\">";
  615.  
  616.                     // The Trinity Edition - Modification Begins
  617.                     // The following code does two things.
  618.  
  619.                     // 1. Sets a TITLE parameter for each Tag Image, so that a TOOLTIP box will popup when
  620.                     // the user's mouse pointer hovers over the Tag Image.
  621.  
  622.                     // 2. Assigns functions to onMouseOver and onMouseOut for each Tag Image
  623.                     // whose actions can be specified in the HEADER.HTML document to create Image Flips.
  624.                     // The function names are hoverOnTagname() and hoverOffTagname() and are case sensitive
  625.                     // Each Tag Image is referenced using JavaScript: document.Tagname.src and is case sensitive
  626.  
  627.                     // MouseOvers should only be activated if you plan on creating the corresponding functions in HEADER.HTML
  628.                     // Activated by setting "trinity_use_mouseovers" to 1
  629.  
  630.                     if( !(*i).second.empty( ) ) {
  631.  
  632.                         if( m_bUseMouseovers ) {
  633.                             pResponse->strContent += "<img src=\"" + (*i).second + "\" border=\"0\" title=\"" + (*i).first + "\" name=\"" + (*i).first + "\" onMouseOver=\"hoverOn" + (*i).first + "()\" onMouseOut=\"hoverOff" + (*i).first + "()\"; return true;>";
  634.                         }
  635.                         else {
  636.                             pResponse->strContent += "<img src=\"" + (*i).second + "\" border=\"0\" title=\"" + (*i).first + "\" name=\"" + (*i).first + "\">";
  637.                         }
  638.                     }
  639.  
  640.                     else {
  641.                         pResponse->strContent += UTIL_RemoveHTML( (*i).first );
  642.                     }
  643.  
  644.                     /* Original Source Code:
  645.                     if( !(*i).second.empty( ) )
  646.                         pResponse->strContent += "<img src=\"" + (*i).second + "\" border=\"0\">";
  647.                     else
  648.                         pResponse->strContent += UTIL_RemoveHTML( (*i).first );
  649.                     */
  650.  
  651.                     pResponse->strContent += "</a>";
  652.  
  653.                     if( i + 1 != m_vecTags.end( ) )
  654.                         pResponse->strContent += " <span class=\"pipe\">|</span> ";
  655.  
  656.                     bFound = true;
  657.                 }
  658.  
  659.                 pResponse->strContent += "</p>\n";
  660.             }
  661.  
  662.             // which page are we viewing
  663.  
  664.             unsigned int iStart = 0;
  665.  
  666.             if( m_iPerPage > 0 )
  667.             {
  668.                 string strPage = pRequest->mapParams["page"];
  669.  
  670.                 if( !strPage.empty( ) )
  671.                     iStart = atoi( strPage.c_str( ) ) * m_iPerPage;
  672.  
  673.                 // The Trinity Edition - Modification Begins
  674.  
  675.                 // The following adds the Custom Label Feature to the string
  676.                 // of text that appears just before the current page number,
  677.                 // which is displayed just after the Tag Filter Images.
  678.  
  679.                 // ------------------------------------------------------------------- END OF MODIFICATION
  680.  
  681.             }
  682.  
  683.             bool bFound = false;
  684.  
  685.             int iAdded = 0;
  686.             int iSkipped = 0;
  687.  
  688.             // for correct page numbers after searching
  689.  
  690.             int iFound = 0;
  691.  
  692.             for( unsigned long i = 0; i < iKeySize; i++ )
  693.             {
  694.                 if( !strFilter.empty( ) )
  695.                 {
  696.                     // only display entries that match the filter
  697.  
  698.                     if( pTorrents[i].strTag != strFilter )
  699.                         continue;
  700.                 }
  701.  
  702.                 if( !strSearch.empty( ) )
  703.                 {
  704.                     // only display entries that match the search
  705.  
  706.                     if( pTorrents[i].strLowerName.find( strLowerSearch ) == string :: npos )
  707.                         continue;
  708.                 }
  709.  
  710.                 iFound++;
  711.  
  712.                 if( m_iPerPage == 0 || iAdded < m_iPerPage )
  713.                 {
  714.                     if( !bFound )
  715.                     {
  716.                         // output table headers
  717.  
  718.                         // The Trinity Edition - ADD BEGINS
  719.                         // Assigns a class to a <div> element that surrounds the table
  720.  
  721.                         pResponse->strContent += "<br><br><div class=\"torrent_table\">\n\n";
  722.  
  723.                         // ----------------------------------- END OF ADD
  724.  
  725.                         pResponse->strContent += "<table summary=\"files\" class=\"torrent_table\">\n";
  726.                         pResponse->strContent += "<tr>";
  727.  
  728.                         // <th> tag
  729.  
  730.                         if( !m_vecTags.empty( ) )
  731.                             // Trinity Edition - Modification Begins
  732.                             // The following adds the Custom Label Feature
  733.                             // Also adds the CSS class th.tag
  734.                             if( m_bUseCustomlabels ) {
  735.                                 pResponse->strContent += "<th class=\"tag\">\n";
  736.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  737.                                 pResponse->strContent += "if (typeof(headerTag) == \"undefined\") {\n";
  738.                                 pResponse->strContent += "   document.write(\"Tag\");\n";
  739.                                 pResponse->strContent += "}\n";
  740.                                 pResponse->strContent += "else {\n";
  741.                                 pResponse->strContent += "   document.write(headerTag);\n";
  742.                                 pResponse->strContent += "}\n";
  743.                                 pResponse->strContent += "</script>\n";
  744.                                 pResponse->strContent += "</th>\n\n";
  745.                             }
  746.                             else { // Use Original Source Code WITH ADDED CLASS:
  747.                             pResponse->strContent += "<th class=\"tag\">Tag</th>";
  748.                             }
  749.  
  750.                             // ------------------------------------------ END OF MODIFICATION
  751.  
  752.                         // <th> info hash
  753.  
  754.                         if( m_bShowInfoHash )
  755.                             // Trinity Edition - Modification Begins
  756.                             // The following adds the Custom  Label Feature
  757.                             if( m_bUseCustomlabels ) {
  758.                                 pResponse->strContent += "<th class=\"hash\">\n";
  759.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  760.                                 pResponse->strContent += "if (typeof(headerInfoHash) == \"undefined\") {\n";
  761.                                 pResponse->strContent += "   document.write(\"Info Hash\");\n";
  762.                                 pResponse->strContent += "}\n";
  763.                                 pResponse->strContent += "else {\n";
  764.                                 pResponse->strContent += "   document.write(headerInfoHash);\n";
  765.                                 pResponse->strContent += "}\n";
  766.                                 pResponse->strContent += "</script>\n";
  767.                                 pResponse->strContent += "</th>\n\n";
  768.                             }
  769.                             else { // Use Original Source Code:
  770.                             pResponse->strContent += "<th class=\"hash\">Info Hash</th>";
  771.                             }
  772.  
  773.                             // ------------------------------------------ END OF MODIFICATION
  774.  
  775.  
  776.                         // <th> name
  777.  
  778.                         if( m_pAllowed && m_bShowNames )
  779.                         {
  780.                             // Trinity Edition - Modification Begins
  781.                             // The following adds the Custom Label Feature
  782.                             if( m_bUseCustomlabels ) {
  783.                                 pResponse->strContent += "<th class=\"name\">\n";
  784.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  785.                                 pResponse->strContent += "if (typeof(headerName) == \"undefined\") {\n";
  786.                                 pResponse->strContent += "   document.write(\"Name\");\n";
  787.                                 pResponse->strContent += "}\n";
  788.                                 pResponse->strContent += "else {\n";
  789.                                 pResponse->strContent += "   document.write(headerName);\n";
  790.                                 pResponse->strContent += "}\n";
  791.                                 pResponse->strContent += "</script>\n";
  792.                             }
  793.                             else { // Use Original Source Code:
  794.                             pResponse->strContent += "<th class=\"name\">Name";
  795.                             }
  796.  
  797.                             // ------------------------------------------ END OF MODIFICATION
  798.  
  799.                             if( m_bSort )
  800.                             {
  801.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ANAME;
  802.  
  803.                                 if( !strSearch.empty( ) )
  804.                                     pResponse->strContent += "&search=" + strSearchResp;
  805.  
  806.                                 if( !strFilter.empty( ) )
  807.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  808.  
  809.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  810.  
  811.                                 if( m_bUseCustomlabels ) {
  812.                                     pResponse->strContent += "\">\n\n";
  813.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  814.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  815.                                     pResponse->strContent += "   document.write(\"A\");\n";
  816.                                     pResponse->strContent += "}\n";
  817.                                     pResponse->strContent += "else {\n";
  818.                                     pResponse->strContent += "   document.write(linkA);\n";
  819.                                     pResponse->strContent += "}\n";
  820.                                     pResponse->strContent += "</script>\n";
  821.                                 }
  822.                                 else {
  823.                                     pResponse->strContent += "\">A";
  824.                                 }
  825.  
  826.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DNAME;
  827.  
  828.                                 /* Original Source Code:
  829.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DNAME;
  830.                                 */
  831.  
  832.                                 // ------------------------------------------------------------- END OF MOD
  833.  
  834.                                 if( !strSearch.empty( ) )
  835.                                     pResponse->strContent += "&search=" + strSearchResp;
  836.  
  837.                                 if( !strFilter.empty( ) )
  838.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  839.  
  840.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  841.  
  842.                                 if( m_bUseCustomlabels ) {
  843.                                     pResponse->strContent += "\">";
  844.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  845.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  846.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  847.                                     pResponse->strContent += "}\n";
  848.                                     pResponse->strContent += "else {\n";
  849.                                     pResponse->strContent += "   document.write(linkZ);\n";
  850.                                     pResponse->strContent += "}\n";
  851.                                     pResponse->strContent += "</script>\n";
  852.                                     pResponse->strContent += "</a>";
  853.                                 }
  854.                                 else {
  855.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  856.                                 }
  857.  
  858.                                 // ----------------------------------------------- END OF MOD
  859.  
  860.                             }
  861.  
  862.                             pResponse->strContent += "</th>";
  863.                         }
  864.  
  865.                         // <th> torrent
  866.  
  867.                         if( m_pAllowed && m_bAllowTorrentDownloads && ( user.iAccess & ACCESS_DL ) )
  868.                             // Trinity Edition - Modification Begins
  869.                             // The following adds the Custom Label Feature
  870.                             if( m_bUseCustomlabels ) {
  871.                                 pResponse->strContent += "<th class=\"download\">\n";
  872.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  873.                                 pResponse->strContent += "if (typeof(headerTorrent) == \"undefined\") {\n";
  874.                                 pResponse->strContent += "   document.write(\"Torrent\");\n";
  875.                                 pResponse->strContent += "}\n";
  876.                                 pResponse->strContent += "else {\n";
  877.                                 pResponse->strContent += "   document.write(headerTorrent);\n";
  878.                                 pResponse->strContent += "}\n";
  879.                                 pResponse->strContent += "</script>\n";
  880.                                 pResponse->strContent += "</th>\n\n";
  881.                             }
  882.                             else { // Use Original Source Code:
  883.                             pResponse->strContent += "<th class=\"download\">Torrent</th>\n";
  884.                             }
  885.  
  886.                             // ------------------------------------------ END OF MODIFICATION
  887.  
  888.                         // <th> comments
  889.  
  890.                         if( m_pAllowed && m_bAllowComments )
  891.                         {
  892.                             if( m_pComments )
  893.                             {
  894.                             // Trinity Edition - Modification Begins
  895.                             // The following adds the Custom Label Feature
  896.                             if( m_bUseCustomlabels ) {
  897.                                 pResponse->strContent += "<th class=\"number\">\n";
  898.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  899.                                 pResponse->strContent += "if (typeof(headerComments) == \"undefined\") {\n";
  900.                                 pResponse->strContent += "   document.write(\"Comments\");\n";
  901.                                 pResponse->strContent += "}\n";
  902.                                 pResponse->strContent += "else {\n";
  903.                                 pResponse->strContent += "   document.write(headerComments);\n";
  904.                                 pResponse->strContent += "}\n";
  905.                                 pResponse->strContent += "</script>\n";
  906.                             }
  907.                             else { // Use Original Source Code:
  908.                                 pResponse->strContent += "<th class=\"number\">Comments";
  909.                             }
  910.  
  911.                                 if( m_bSort )
  912.                                 {
  913.                                     pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ACOMMENTS;
  914.  
  915.                                     if( !strSearch.empty( ) )
  916.                                         pResponse->strContent += "&search=" + strSearchResp;
  917.  
  918.                                     if( !strFilter.empty( ) )
  919.                                         pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  920.  
  921.                                     // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  922.  
  923.                                     if( m_bUseCustomlabels ) {
  924.                                         pResponse->strContent += "\">\n\n";
  925.                                         pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  926.                                         pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  927.                                         pResponse->strContent += "   document.write(\"A\");\n";
  928.                                         pResponse->strContent += "}\n";
  929.                                         pResponse->strContent += "else {\n";
  930.                                         pResponse->strContent += "   document.write(linkA);\n";
  931.                                         pResponse->strContent += "}\n";
  932.                                         pResponse->strContent += "</script>\n";
  933.                                     }
  934.                                     else {
  935.                                         pResponse->strContent += "\">A";
  936.                                     }
  937.  
  938.                                     pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMMENTS;
  939.  
  940.                                 /* Original Source Code:
  941.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMMENTS;
  942.                                 */
  943.  
  944.                                 // ------------------------------------------------------------- END OF MOD                                
  945.  
  946.                                     if( !strSearch.empty( ) )
  947.                                         pResponse->strContent += "&search=" + strSearchResp;
  948.  
  949.                                     if( !strFilter.empty( ) )
  950.                                         pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  951.  
  952.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  953.  
  954.                                 if( m_bUseCustomlabels ) {
  955.                                     pResponse->strContent += "\">";
  956.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  957.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  958.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  959.                                     pResponse->strContent += "}\n";
  960.                                     pResponse->strContent += "else {\n";
  961.                                     pResponse->strContent += "   document.write(linkZ);\n";
  962.                                     pResponse->strContent += "}\n";
  963.                                     pResponse->strContent += "</script>\n";
  964.                                     pResponse->strContent += "</a>";
  965.                                 }
  966.                                 else {
  967.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  968.                                 }
  969.  
  970.                                 // ----------------------------------------------- END OF MOD
  971.  
  972.                                 }
  973.  
  974.                                 pResponse->strContent += "</th>";
  975.                             }
  976.                         }
  977.  
  978.                         // <th> added
  979.  
  980.                         if( m_pAllowed && m_bShowAdded )
  981.                         {
  982.                             // Trinity Edition - Modification Begins
  983.                             // The following adds the Custom Label Feature
  984.                             if( m_bUseCustomlabels ) {
  985.                                 pResponse->strContent += "<th class=\"date\">\n";
  986.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  987.                                 pResponse->strContent += "if (typeof(headerAdded) == \"undefined\") {\n";
  988.                                 pResponse->strContent += "   document.write(\"Added\");\n";
  989.                                 pResponse->strContent += "}\n";
  990.                                 pResponse->strContent += "else {\n";
  991.                                 pResponse->strContent += "   document.write(headerAdded);\n";
  992.                                 pResponse->strContent += "}\n";
  993.                                 pResponse->strContent += "</script>\n";
  994.                             }
  995.                             else { // Use Original Source Code:
  996.                                 pResponse->strContent += "<th class=\"date\">Added";
  997.                             }
  998.                             // ------------------------------------------ END OF MODIFICATION
  999.                            
  1000.                             if( m_bSort )
  1001.                             {
  1002.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_AADDED;
  1003.  
  1004.                                 if( !strSearch.empty( ) )
  1005.                                     pResponse->strContent += "&search=" + strSearchResp;
  1006.  
  1007.                                 if( !strFilter.empty( ) )
  1008.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1009.  
  1010.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1011.  
  1012.                                 if( m_bUseCustomlabels ) {
  1013.                                     pResponse->strContent += "\">\n\n";
  1014.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1015.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1016.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1017.                                     pResponse->strContent += "}\n";
  1018.                                     pResponse->strContent += "else {\n";
  1019.                                     pResponse->strContent += "   document.write(linkA);\n";
  1020.                                     pResponse->strContent += "}\n";
  1021.                                     pResponse->strContent += "</script>\n";
  1022.                                 }
  1023.                                 else {
  1024.                                     pResponse->strContent += "\">A";
  1025.                                 }
  1026.  
  1027.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DADDED;
  1028.  
  1029.                                 /* Original Source Code:
  1030.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DADDED;
  1031.                                 */
  1032.  
  1033.                                 // ------------------------------------------------------------- END OF MOD
  1034.  
  1035.                                 if( !strSearch.empty( ) )
  1036.                                     pResponse->strContent += "&search=" + strSearchResp;
  1037.  
  1038.                                 if( !strFilter.empty( ) )
  1039.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1040.  
  1041.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1042.  
  1043.                                 if( m_bUseCustomlabels ) {
  1044.                                     pResponse->strContent += "\">";
  1045.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1046.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1047.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1048.                                     pResponse->strContent += "}\n";
  1049.                                     pResponse->strContent += "else {\n";
  1050.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1051.                                     pResponse->strContent += "}\n";
  1052.                                     pResponse->strContent += "</script>\n";
  1053.                                     pResponse->strContent += "</a>";
  1054.                                 }
  1055.                                 else {
  1056.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1057.                                 }
  1058.  
  1059.                                 // ----------------------------------------------- END OF MOD
  1060.  
  1061.                             }
  1062.  
  1063.                             pResponse->strContent += "</th>";
  1064.                         }
  1065.  
  1066.                         // <th> size
  1067.  
  1068.                         if( m_pAllowed && m_bShowSize )
  1069.                         {
  1070.                             // Trinity Edition - Modification Begins
  1071.                             // The following adds the Custom Label Feature
  1072.                             if( m_bUseCustomlabels ) {
  1073.                                 pResponse->strContent += "<th class=\"bytes\">\n";
  1074.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1075.                                 pResponse->strContent += "if (typeof(headerSize) == \"undefined\") {\n";
  1076.                                 pResponse->strContent += "   document.write(\"Size\");\n";
  1077.                                 pResponse->strContent += "}\n";
  1078.                                 pResponse->strContent += "else {\n";
  1079.                                 pResponse->strContent += "   document.write(headerSize);\n";
  1080.                                 pResponse->strContent += "}\n";
  1081.                                 pResponse->strContent += "</script>\n";
  1082.                             }
  1083.                             else { // Use Original Source Code:
  1084.                                 pResponse->strContent += "<th class=\"bytes\">Size";
  1085.                             }
  1086.                             // ------------------------------------------ END OF MODIFICATION
  1087.  
  1088.                             if( m_bSort )
  1089.                             {
  1090.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ASIZE;
  1091.  
  1092.                                 if( !strSearch.empty( ) )
  1093.                                     pResponse->strContent += "&search=" + strSearchResp;
  1094.  
  1095.                                 if( !strFilter.empty( ) )
  1096.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1097.  
  1098.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1099.  
  1100.                                 if( m_bUseCustomlabels ) {
  1101.                                     pResponse->strContent += "\">\n\n";
  1102.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1103.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1104.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1105.                                     pResponse->strContent += "}\n";
  1106.                                     pResponse->strContent += "else {\n";
  1107.                                     pResponse->strContent += "   document.write(linkA);\n";
  1108.                                     pResponse->strContent += "}\n";
  1109.                                     pResponse->strContent += "</script>\n";
  1110.                                 }
  1111.                                 else {
  1112.                                     pResponse->strContent += "\">A";
  1113.                                 }
  1114.  
  1115.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DSIZE;
  1116.  
  1117.                                 /* Original Source Code:
  1118.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DSIZE;
  1119.                                 */
  1120.  
  1121.                                 // ------------------------------------------------------------- END OF MOD                            
  1122.  
  1123.                                 if( !strSearch.empty( ) )
  1124.                                     pResponse->strContent += "&search=" + strSearchResp;
  1125.  
  1126.                                 if( !strFilter.empty( ) )
  1127.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1128.  
  1129.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1130.  
  1131.                                 if( m_bUseCustomlabels ) {
  1132.                                     pResponse->strContent += "\">";
  1133.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1134.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1135.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1136.                                     pResponse->strContent += "}\n";
  1137.                                     pResponse->strContent += "else {\n";
  1138.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1139.                                     pResponse->strContent += "}\n";
  1140.                                     pResponse->strContent += "</script>\n";
  1141.                                     pResponse->strContent += "</a>";
  1142.                                 }
  1143.                                 else {
  1144.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1145.                                 }
  1146.  
  1147.                                 // ----------------------------------------------- END OF MOD
  1148.  
  1149.                             }
  1150.  
  1151.                             pResponse->strContent += "</th>";
  1152.                         }
  1153.  
  1154.                         // <th> files
  1155.  
  1156.                         if( m_pAllowed && m_bShowNumFiles )
  1157.                         {
  1158.                             // Trinity Edition - Modification Begins
  1159.                             // The following adds the Custom Label Feature
  1160.                             if( m_bUseCustomlabels ) {
  1161.                                 pResponse->strContent += "<th class=\"number\">\n";
  1162.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1163.                                 pResponse->strContent += "if (typeof(headerFiles) == \"undefined\") {\n";
  1164.                                 pResponse->strContent += "   document.write(\"Files\");\n";
  1165.                                 pResponse->strContent += "}\n";
  1166.                                 pResponse->strContent += "else {\n";
  1167.                                 pResponse->strContent += "   document.write(headerFiles);\n";
  1168.                                 pResponse->strContent += "}\n";
  1169.                                 pResponse->strContent += "</script>\n";
  1170.                             }
  1171.                             else { // Use Original Source Code:                        
  1172.                                 pResponse->strContent += "<th class=\"number\">Files";
  1173.                             }
  1174.                             // ------------------------------------------ END OF MODIFICATION
  1175.  
  1176.                             if( m_bSort )
  1177.                             {
  1178.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_AFILES;
  1179.  
  1180.                                 if( !strSearch.empty( ) )
  1181.                                     pResponse->strContent += "&search=" + strSearchResp;
  1182.  
  1183.                                 if( !strFilter.empty( ) )
  1184.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1185.  
  1186.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1187.  
  1188.                                 if( m_bUseCustomlabels ) {
  1189.                                     pResponse->strContent += "\">\n\n";
  1190.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1191.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1192.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1193.                                     pResponse->strContent += "}\n";
  1194.                                     pResponse->strContent += "else {\n";
  1195.                                     pResponse->strContent += "   document.write(linkA);\n";
  1196.                                     pResponse->strContent += "}\n";
  1197.                                     pResponse->strContent += "</script>\n";
  1198.                                 }
  1199.                                 else {
  1200.                                     pResponse->strContent += "\">A";
  1201.                                 }
  1202.  
  1203.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DFILES;
  1204.  
  1205.                                 /* Original Source Code:
  1206.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DFILES;
  1207.                                 */
  1208.  
  1209.                                 // ------------------------------------------------------------- END OF MOD                                
  1210.  
  1211.                                 if( !strSearch.empty( ) )
  1212.                                     pResponse->strContent += "&search=" + strSearchResp;
  1213.  
  1214.                                 if( !strFilter.empty( ) )
  1215.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1216.  
  1217.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1218.  
  1219.                                 if( m_bUseCustomlabels ) {
  1220.                                     pResponse->strContent += "\">";
  1221.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1222.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1223.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1224.                                     pResponse->strContent += "}\n";
  1225.                                     pResponse->strContent += "else {\n";
  1226.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1227.                                     pResponse->strContent += "}\n";
  1228.                                     pResponse->strContent += "</script>\n";
  1229.                                     pResponse->strContent += "</a>";
  1230.                                 }
  1231.                                 else {
  1232.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1233.                                 }
  1234.  
  1235.                                 // ----------------------------------------------- END OF MOD
  1236.                             }
  1237.  
  1238.                             pResponse->strContent += "</th>";
  1239.                         }
  1240.  
  1241.                         // <th> seeders
  1242.  
  1243.                             // Trinity Edition - Modification Begins
  1244.                             // The following adds the Custom Label Feature
  1245.                             if( m_bUseCustomlabels ) {
  1246.                                 pResponse->strContent += "<th class=\"number\">\n";
  1247.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1248.                                 pResponse->strContent += "if (typeof(headerSeeders) == \"undefined\") {\n";
  1249.                                 pResponse->strContent += "   document.write(\"Seeders\");\n";
  1250.                                 pResponse->strContent += "}\n";
  1251.                                 pResponse->strContent += "else {\n";
  1252.                                 pResponse->strContent += "   document.write(headerSeeders);\n";
  1253.                                 pResponse->strContent += "}\n";
  1254.                                 pResponse->strContent += "</script>\n";
  1255.                             }
  1256.                             else { // Use Original Source Code:
  1257.                                 pResponse->strContent += "<th class=\"number\">Seeders";
  1258.                             }
  1259.                             // ------------------------------------------ END OF MODIFICATION
  1260.                        
  1261.                         if( m_bSort )
  1262.                         {
  1263.                             pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ACOMPLETE;
  1264.  
  1265.                             if( !strSearch.empty( ) )
  1266.                                 pResponse->strContent += "&search=" + strSearchResp;
  1267.  
  1268.                             if( !strFilter.empty( ) )
  1269.                                 pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1270.  
  1271.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1272.  
  1273.                                 if( m_bUseCustomlabels ) {
  1274.                                     pResponse->strContent += "\">\n\n";
  1275.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1276.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1277.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1278.                                     pResponse->strContent += "}\n";
  1279.                                     pResponse->strContent += "else {\n";
  1280.                                     pResponse->strContent += "   document.write(linkA);\n";
  1281.                                     pResponse->strContent += "}\n";
  1282.                                     pResponse->strContent += "</script>\n";
  1283.                                 }
  1284.                                 else {
  1285.                                     pResponse->strContent += "\">A";
  1286.                                 }
  1287.  
  1288.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMPLETE;
  1289.  
  1290.                                 /* Original Source Code:
  1291.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMPLETE;
  1292.                                 */
  1293.  
  1294.                                 // ------------------------------------------------------------- END OF MOD                            
  1295.  
  1296.                             if( !strSearch.empty( ) )
  1297.                                 pResponse->strContent += "&search=" + strSearchResp;
  1298.  
  1299.                             if( !strFilter.empty( ) )
  1300.                                 pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1301.  
  1302.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1303.  
  1304.                                 if( m_bUseCustomlabels ) {
  1305.                                     pResponse->strContent += "\">";
  1306.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1307.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1308.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1309.                                     pResponse->strContent += "}\n";
  1310.                                     pResponse->strContent += "else {\n";
  1311.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1312.                                     pResponse->strContent += "}\n";
  1313.                                     pResponse->strContent += "</script>\n";
  1314.                                     pResponse->strContent += "</a>";
  1315.                                 }
  1316.                                 else {
  1317.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1318.                                 }
  1319.  
  1320.                                 // ----------------------------------------------- END OF MOD
  1321.                         }
  1322.  
  1323.                         pResponse->strContent += "</th>";
  1324.  
  1325.                         // <th> leechers
  1326.                        
  1327.                             // Trinity Edition - Modification Begins
  1328.                             // The following adds the Custom Label Feature
  1329.                             if( m_bUseCustomlabels ) {
  1330.                                 pResponse->strContent += "<th class=\"number\">\n";
  1331.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1332.                                 pResponse->strContent += "if (typeof(headerLeechers) == \"undefined\") {\n";
  1333.                                 pResponse->strContent += "   document.write(\"Leechers\");\n";
  1334.                                 pResponse->strContent += "}\n";
  1335.                                 pResponse->strContent += "else {\n";
  1336.                                 pResponse->strContent += "   document.write(headerLeechers);\n";
  1337.                                 pResponse->strContent += "}\n";
  1338.                                 pResponse->strContent += "</script>\n";
  1339.                             }
  1340.                             else { // Use Original Source Code:
  1341.                                 pResponse->strContent += "<th class=\"number\">Leechers";
  1342.                             }
  1343.                             // ------------------------------------------ END OF MODIFICATION
  1344.                        
  1345.                         if( m_bSort )
  1346.                         {
  1347.                             pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_AINCOMPLETE;
  1348.  
  1349.                             if( !strSearch.empty( ) )
  1350.                                 pResponse->strContent += "&search=" + strSearchResp;
  1351.  
  1352.                             if( !strFilter.empty( ) )
  1353.                                 pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1354.  
  1355.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1356.  
  1357.                                 if( m_bUseCustomlabels ) {
  1358.                                     pResponse->strContent += "\">\n\n";
  1359.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1360.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1361.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1362.                                     pResponse->strContent += "}\n";
  1363.                                     pResponse->strContent += "else {\n";
  1364.                                     pResponse->strContent += "   document.write(linkA);\n";
  1365.                                     pResponse->strContent += "}\n";
  1366.                                     pResponse->strContent += "</script>\n";
  1367.                                 }
  1368.                                 else {
  1369.                                     pResponse->strContent += "\">A";
  1370.                                 }
  1371.  
  1372.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DINCOMPLETE;
  1373.  
  1374.                                 /* Original Source Code:
  1375.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DINCOMPLETE;
  1376.                                 */
  1377.  
  1378.                                 // ------------------------------------------------------------- END OF MOD
  1379.  
  1380.                             if( !strSearch.empty( ) )
  1381.                                 pResponse->strContent += "&search=" + strSearchResp;
  1382.  
  1383.                             if( !strFilter.empty( ) )
  1384.                                 pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1385.  
  1386.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1387.  
  1388.                                 if( m_bUseCustomlabels ) {
  1389.                                     pResponse->strContent += "\">";
  1390.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1391.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1392.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1393.                                     pResponse->strContent += "}\n";
  1394.                                     pResponse->strContent += "else {\n";
  1395.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1396.                                     pResponse->strContent += "}\n";
  1397.                                     pResponse->strContent += "</script>\n";
  1398.                                     pResponse->strContent += "</a>";
  1399.                                 }
  1400.                                 else {
  1401.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1402.                                 }
  1403.  
  1404.                                 // ----------------------------------------------- END OF MOD
  1405.                         }
  1406.  
  1407.                         pResponse->strContent += "</th>";
  1408.  
  1409.                         // <th> completed
  1410.  
  1411.                         if( m_bShowCompleted )
  1412.                         {
  1413.                             // Trinity Edition - Modification Begins
  1414.                             // The following adds the Custom Label Feature
  1415.                             if( m_bUseCustomlabels ) {
  1416.                                 pResponse->strContent += "<th class=\"number\">\n";
  1417.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1418.                                 pResponse->strContent += "if (typeof(headerCompleted) == \"undefined\") {\n";
  1419.                                 pResponse->strContent += "   document.write(\"Downloads\");\n";
  1420.                                 pResponse->strContent += "}\n";
  1421.                                 pResponse->strContent += "else {\n";
  1422.                                 pResponse->strContent += "   document.write(headerCompleted);\n";
  1423.                                 pResponse->strContent += "}\n";
  1424.                                 pResponse->strContent += "</script>\n";
  1425.                             }
  1426.                             else { // Use Original Source Code:
  1427.                                 pResponse->strContent += "<th class=\"number\">Completed";
  1428.                             }
  1429.                             // ------------------------------------------ END OF MODIFICATION
  1430.  
  1431.                             if( m_bSort )
  1432.                             {
  1433.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ACOMPLETED;
  1434.  
  1435.                                 if( !strSearch.empty( ) )
  1436.                                     pResponse->strContent += "&search=" + strSearchResp;
  1437.  
  1438.                                 if( !strFilter.empty( ) )
  1439.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1440.  
  1441.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1442.  
  1443.                                 if( m_bUseCustomlabels ) {
  1444.                                     pResponse->strContent += "\">\n\n";
  1445.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1446.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1447.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1448.                                     pResponse->strContent += "}\n";
  1449.                                     pResponse->strContent += "else {\n";
  1450.                                     pResponse->strContent += "   document.write(linkA);\n";
  1451.                                     pResponse->strContent += "}\n";
  1452.                                     pResponse->strContent += "</script>\n";
  1453.                                 }
  1454.                                 else {
  1455.                                     pResponse->strContent += "\">A";
  1456.                                 }
  1457.  
  1458.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMPLETED;
  1459.  
  1460.                                 /* Original Source Code:
  1461.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DCOMPLETED;
  1462.                                 */
  1463.  
  1464.                                 // ------------------------------------------------------------- END OF MOD
  1465.  
  1466.                                 if( !strSearch.empty( ) )
  1467.                                     pResponse->strContent += "&search=" + strSearchResp;
  1468.  
  1469.                                 if( !strFilter.empty( ) )
  1470.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1471.  
  1472.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1473.  
  1474.                                 if( m_bUseCustomlabels ) {
  1475.                                     pResponse->strContent += "\">";
  1476.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1477.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1478.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1479.                                     pResponse->strContent += "}\n";
  1480.                                     pResponse->strContent += "else {\n";
  1481.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1482.                                     pResponse->strContent += "}\n";
  1483.                                     pResponse->strContent += "</script>\n";
  1484.                                     pResponse->strContent += "</a>";
  1485.                                 }
  1486.                                 else {
  1487.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1488.                                 }
  1489.  
  1490.                                 // ----------------------------------------------- END OF MOD
  1491.                             }
  1492.  
  1493.                             pResponse->strContent += "</th>";
  1494.                         }
  1495.  
  1496.                         // <th> transferred
  1497.  
  1498.                         if( m_pAllowed && m_bShowTransferred )
  1499.                         {
  1500.                             // Trinity Edition - Modification Begins
  1501.                             // The following adds the Custom Label Feature
  1502.                             if( m_bUseCustomlabels ) {
  1503.                                 pResponse->strContent += "<th class=\"bytes\">\n";
  1504.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1505.                                 pResponse->strContent += "if (typeof(headerTransferred) == \"undefined\") {\n";
  1506.                                 pResponse->strContent += "   document.write(\"Transferred\");\n";
  1507.                                 pResponse->strContent += "}\n";
  1508.                                 pResponse->strContent += "else {\n";
  1509.                                 pResponse->strContent += "   document.write(headerTransferred);\n";
  1510.                                 pResponse->strContent += "}\n";
  1511.                                 pResponse->strContent += "</script>\n";
  1512.                             }
  1513.                             else { // Use Original Source Code:
  1514.                                 pResponse->strContent += "<th class=\"bytes\">Transferred";
  1515.                             }
  1516.                             // ------------------------------------------ END OF MODIFICATION
  1517.  
  1518.                             if( m_bSort )
  1519.                             {
  1520.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_ATRANSFERRED;
  1521.  
  1522.                                 if( !strSearch.empty( ) )
  1523.                                     pResponse->strContent += "&search=" + strSearchResp;
  1524.  
  1525.                                 if( !strFilter.empty( ) )
  1526.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1527.  
  1528.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1529.  
  1530.                                 if( m_bUseCustomlabels ) {
  1531.                                     pResponse->strContent += "\">\n\n";
  1532.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1533.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1534.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1535.                                     pResponse->strContent += "}\n";
  1536.                                     pResponse->strContent += "else {\n";
  1537.                                     pResponse->strContent += "   document.write(linkA);\n";
  1538.                                     pResponse->strContent += "}\n";
  1539.                                     pResponse->strContent += "</script>\n";
  1540.                                 }
  1541.                                 else {
  1542.                                     pResponse->strContent += "\">A";
  1543.                                 }
  1544.  
  1545.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DTRANSFERRED;
  1546.  
  1547.                                 /* Original Source Code:
  1548.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DTRANSFERRED;
  1549.                                 */
  1550.  
  1551.                                 // ------------------------------------------------------------- END OF MOD
  1552.  
  1553.                                 if( !strSearch.empty( ) )
  1554.                                     pResponse->strContent += "&search=" + strSearchResp;
  1555.  
  1556.                                 if( !strFilter.empty( ) )
  1557.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1558.  
  1559.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1560.  
  1561.                                 if( m_bUseCustomlabels ) {
  1562.                                     pResponse->strContent += "\">";
  1563.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1564.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1565.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1566.                                     pResponse->strContent += "}\n";
  1567.                                     pResponse->strContent += "else {\n";
  1568.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1569.                                     pResponse->strContent += "}\n";
  1570.                                     pResponse->strContent += "</script>\n";
  1571.                                     pResponse->strContent += "</a>";
  1572.                                 }
  1573.                                 else {
  1574.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1575.                                 }
  1576.  
  1577.                                 // ----------------------------------------------- END OF MOD
  1578.                             }
  1579.  
  1580.                             pResponse->strContent += "</th>";
  1581.                         }
  1582.  
  1583.                         // <th> min left
  1584.  
  1585.                         if( m_bShowMinLeft )
  1586.                         {
  1587.                             if( m_pAllowed && m_bShowLeftAsProgress )
  1588.                                 // Trinity Edition - Modification Begins
  1589.                                 // The following adds the Custom Label Feature
  1590.                                 if( m_bUseCustomlabels ) {
  1591.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1592.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1593.                                     pResponse->strContent += "if (typeof(headerMinProgress) == \"undefined\") {\n";
  1594.                                     pResponse->strContent += "   document.write(\"Min Progress\");\n";
  1595.                                     pResponse->strContent += "}\n";
  1596.                                     pResponse->strContent += "else {\n";
  1597.                                     pResponse->strContent += "   document.write(headerMinProgress);\n";
  1598.                                     pResponse->strContent += "}\n";
  1599.                                     pResponse->strContent += "</script>\n";
  1600.                                     pResponse->strContent += "</th>\n\n";
  1601.                                 }
  1602.                                 else { // Use Original Source Code:
  1603.                                     pResponse->strContent += "<th class=\"percent\">Min Progress</th>";
  1604.                                 }
  1605.                             // ------------------------------------------ END OF MODIFICATION
  1606.                             else
  1607.                                 // Trinity Edition - Modification Begins
  1608.                                 // The following adds the Custom Label Feature
  1609.                                 if( m_bUseCustomlabels ) {
  1610.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1611.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1612.                                     pResponse->strContent += "if (typeof(headerMinLeft) == \"undefined\") {\n";
  1613.                                     pResponse->strContent += "   document.write(\"Min Left\");\n";
  1614.                                     pResponse->strContent += "}\n";
  1615.                                     pResponse->strContent += "else {\n";
  1616.                                     pResponse->strContent += "   document.write(headerMinLeft);\n";
  1617.                                     pResponse->strContent += "}\n";
  1618.                                     pResponse->strContent += "</script>\n";
  1619.                                     pResponse->strContent += "</th>\n\n";
  1620.                                 }
  1621.                                 else { // Use Original Source Code:
  1622.                                     pResponse->strContent += "<th class=\"percent\">Min Left</th>";
  1623.                                 }
  1624.                             // ------------------------------------------ END OF MODIFICATION
  1625.                         }
  1626.  
  1627.                         // <th> average left
  1628.  
  1629.                         if( m_bShowAverageLeft )
  1630.                         {
  1631.                             if( m_pAllowed && m_bShowLeftAsProgress )
  1632.                                 // Trinity Edition - Modification Begins
  1633.                                 // The following adds the Custom Label Feature
  1634.                                 if( m_bUseCustomlabels ) {
  1635.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1636.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1637.                                     pResponse->strContent += "if (typeof(headerAverageProgress) == \"undefined\") {\n";
  1638.                                     pResponse->strContent += "   document.write(\"Average Progress\");\n";
  1639.                                     pResponse->strContent += "}\n";
  1640.                                     pResponse->strContent += "else {\n";
  1641.                                     pResponse->strContent += "   document.write(headerAverageProgress);\n";
  1642.                                     pResponse->strContent += "}\n";
  1643.                                     pResponse->strContent += "</script>\n";
  1644.                                 }
  1645.                                 else { // Use Original Source Code:
  1646.                                     pResponse->strContent += "<th class=\"percent\">Average Progress";
  1647.                                 }
  1648.                             // ------------------------------------------ END OF MODIFICATION
  1649.                             else
  1650.                                 // Trinity Edition - Modification Begins
  1651.                                 // The following adds the Custom Label Feature
  1652.                                 if( m_bUseCustomlabels ) {
  1653.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1654.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1655.                                     pResponse->strContent += "if (typeof(headerAverageLeft) == \"undefined\") {\n";
  1656.                                     pResponse->strContent += "   document.write(\"Average Left\");\n";
  1657.                                     pResponse->strContent += "}\n";
  1658.                                     pResponse->strContent += "else {\n";
  1659.                                     pResponse->strContent += "   document.write(headerAverageLeft);\n";
  1660.                                     pResponse->strContent += "}\n";
  1661.                                     pResponse->strContent += "</script>\n";
  1662.                                 }
  1663.                                 else { // Use Original Source Code:
  1664.                                     pResponse->strContent += "<th class=\"percent\">Average Left";
  1665.                                 }
  1666.                             // ------------------------------------------ END OF MODIFICATION
  1667.  
  1668.                             if( m_bSort )
  1669.                             {
  1670.                                 pResponse->strContent += "<br><a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_AAVGLEFT;
  1671.  
  1672.                                 if( !strSearch.empty( ) )
  1673.                                     pResponse->strContent += "&search=" + strSearchResp;
  1674.  
  1675.                                 if( !strFilter.empty( ) )
  1676.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1677.  
  1678.                                 // The Trinity Edition - MOD BEGINS - Replaces the Ascending Link Text when using Custom Labels
  1679.  
  1680.                                 if( m_bUseCustomlabels ) {
  1681.                                     pResponse->strContent += "\">\n\n";
  1682.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1683.                                     pResponse->strContent += "if (typeof(linkA) == \"undefined\") {\n";
  1684.                                     pResponse->strContent += "   document.write(\"A\");\n";
  1685.                                     pResponse->strContent += "}\n";
  1686.                                     pResponse->strContent += "else {\n";
  1687.                                     pResponse->strContent += "   document.write(linkA);\n";
  1688.                                     pResponse->strContent += "}\n";
  1689.                                     pResponse->strContent += "</script>\n";
  1690.                                 }
  1691.                                 else {
  1692.                                     pResponse->strContent += "\">A";
  1693.                                 }
  1694.  
  1695.                                 pResponse->strContent += "</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DAVGLEFT;
  1696.  
  1697.                                 /* Original Source Code:
  1698.                                 pResponse->strContent += "\">A</a> <a class=\"sort\" href=\"/index.html?sort=" + SORTSTR_DAVGLEFT;
  1699.                                 */
  1700.  
  1701.                                 // ------------------------------------------------------------- END OF MOD
  1702.  
  1703.                                 if( !strSearch.empty( ) )
  1704.                                     pResponse->strContent += "&search=" + strSearchResp;
  1705.  
  1706.                                 if( !strFilter.empty( ) )
  1707.                                     pResponse->strContent += "&filter=" + UTIL_StringToEscaped( strFilter );
  1708.  
  1709.                                 // The Trinity Edition - MOD BEGINS - Replaces the Descending Link Text when using Custom Labels
  1710.  
  1711.                                 if( m_bUseCustomlabels ) {
  1712.                                     pResponse->strContent += "\">";
  1713.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1714.                                     pResponse->strContent += "if (typeof(linkZ) == \"undefined\") {\n";
  1715.                                     pResponse->strContent += "   document.write(\"Z\");\n";
  1716.                                     pResponse->strContent += "}\n";
  1717.                                     pResponse->strContent += "else {\n";
  1718.                                     pResponse->strContent += "   document.write(linkZ);\n";
  1719.                                     pResponse->strContent += "}\n";
  1720.                                     pResponse->strContent += "</script>\n";
  1721.                                     pResponse->strContent += "</a>";
  1722.                                 }
  1723.                                 else {
  1724.                                     pResponse->strContent += "\">Z</a>"; // <<< Original Source Code:
  1725.                                 }
  1726.  
  1727.                                 // ----------------------------------------------- END OF MOD
  1728.                             }
  1729.  
  1730.                             pResponse->strContent += "</th>";
  1731.                         }
  1732.  
  1733.                         // <th> maxi left
  1734.  
  1735.                         if( m_bShowMaxiLeft )
  1736.                         {
  1737.                             if( m_pAllowed && m_bShowLeftAsProgress )
  1738.                                 // Trinity Edition - Modification Begins
  1739.                                 // The following adds the Custom Label Feature
  1740.                                 if( m_bUseCustomlabels ) {
  1741.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1742.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1743.                                     pResponse->strContent += "if (typeof(headerMaxProgress) == \"undefined\") {\n";
  1744.                                     pResponse->strContent += "   document.write(\"Max Progress\");\n";
  1745.                                     pResponse->strContent += "}\n";
  1746.                                     pResponse->strContent += "else {\n";
  1747.                                     pResponse->strContent += "   document.write(headerMaxProgress);\n";
  1748.                                     pResponse->strContent += "}\n";
  1749.                                     pResponse->strContent += "</script>\n";
  1750.                                     pResponse->strContent += "</th>\n\n";
  1751.                                 }
  1752.                                 else { // Use Original Source Code:
  1753.                                     pResponse->strContent += "<th class=\"percent\">Max Progress</th>";
  1754.                                 }
  1755.                             // ------------------------------------------ END OF MODIFICATION
  1756.                             else
  1757.                                 // Trinity Edition - Modification Begins
  1758.                                 // The following adds the Custom Label Feature
  1759.                                 if( m_bUseCustomlabels ) {
  1760.                                     pResponse->strContent += "<th class=\"percent\">\n";
  1761.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1762.                                     pResponse->strContent += "if (typeof(headerMaxLeft) == \"undefined\") {\n";
  1763.                                     pResponse->strContent += "   document.write(\"Max Left\");\n";
  1764.                                     pResponse->strContent += "}\n";
  1765.                                     pResponse->strContent += "else {\n";
  1766.                                     pResponse->strContent += "   document.write(headerMaxLeft);\n";
  1767.                                     pResponse->strContent += "}\n";
  1768.                                     pResponse->strContent += "</script>\n";
  1769.                                     pResponse->strContent += "</th>\n\n";
  1770.                                 }
  1771.                                 else { // Use Original Source Code:
  1772.                                     pResponse->strContent += "<th class=\"percent\">Max Left</th>";
  1773.                                 }
  1774.                             // ------------------------------------------ END OF MODIFICATION
  1775.                         }
  1776.  
  1777.                         // <th> uploader
  1778.  
  1779.                         if( m_bShowUploader )
  1780.                             // Trinity Edition - Modification Begins
  1781.                             // The following adds the Custom Label Feature
  1782.                             if( m_bUseCustomlabels ) {
  1783.                                 pResponse->strContent += "<th class=\"name\">\n";
  1784.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1785.                                 pResponse->strContent += "if (typeof(headerUploader) == \"undefined\") {\n";
  1786.                                 pResponse->strContent += "   document.write(\"Uploader\");\n";
  1787.                                 pResponse->strContent += "}\n";
  1788.                                 pResponse->strContent += "else {\n";
  1789.                                 pResponse->strContent += "   document.write(headerUploader);\n";
  1790.                                 pResponse->strContent += "}\n";
  1791.                                 pResponse->strContent += "</script>\n";
  1792.                                 pResponse->strContent += "</th>\n\n";
  1793.                             }
  1794.                             else { // Use Original Source Code:
  1795.                                 pResponse->strContent += "<th class=\"name\">Uploader</th>";
  1796.                             }
  1797.                             // ------------------------------------------ END OF MODIFICATION
  1798.  
  1799.                         // <th> info link
  1800.  
  1801.                         if( m_bAllowInfoLink )
  1802.                             // Trinity Edition - Modification Begins
  1803.                             // The following adds the Custom Label Feature
  1804.                             if( m_bUseCustomlabels ) {
  1805.                                 pResponse->strContent += "<th class=\"infolink\">\n";
  1806.                                 pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1807.                                 pResponse->strContent += "if (typeof(headerInfoLink) == \"undefined\") {\n";
  1808.                                 pResponse->strContent += "   document.write(\"Info Link\");\n";
  1809.                                 pResponse->strContent += "}\n";
  1810.                                 pResponse->strContent += "else {\n";
  1811.                                 pResponse->strContent += "   document.write(headerInfoLink);\n";
  1812.                                 pResponse->strContent += "}\n";
  1813.                                 pResponse->strContent += "</script>\n";
  1814.                                 pResponse->strContent += "</th>\n\n";
  1815.                             }
  1816.                             else { // Use Original Source Code:
  1817.                                 pResponse->strContent += "<th class=\"infolink\">Info Link</th>";
  1818.                             }
  1819.                             // ------------------------------------------ END OF MODIFICATION
  1820.  
  1821.                         // <th> admin
  1822.  
  1823.                         if( user.iAccess & ACCESS_EDIT )
  1824.                         {
  1825.                             if( m_pAllowed )
  1826.                                 // Trinity Edition - Modification Begins
  1827.                                 // The following adds the Custom Label Feature
  1828.                                 // Added th.admin class
  1829.                                 if( m_bUseCustomlabels ) {
  1830.                                     pResponse->strContent += "<th class=\"admin\">\n";
  1831.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1832.                                     pResponse->strContent += "if (typeof(headerAdmin) == \"undefined\") {\n";
  1833.                                     pResponse->strContent += "   document.write(\"Admin\");\n";
  1834.                                     pResponse->strContent += "}\n";
  1835.                                     pResponse->strContent += "else {\n";
  1836.                                     pResponse->strContent += "   document.write(headerAdmin);\n";
  1837.                                     pResponse->strContent += "}\n";
  1838.                                     pResponse->strContent += "</script>\n";
  1839.                                     pResponse->strContent += "</th>\n\n";
  1840.                                 }
  1841.                                 else { // Use Original Source Code WITH ADDED CLASS:
  1842.                                     pResponse->strContent += "<th class=\"admin\">Admin</th>";
  1843.                                 }
  1844.                             // ------------------------------------------ END OF MODIFICATION
  1845.                         }
  1846.  
  1847.                         pResponse->strContent += "</tr>\n";
  1848.  
  1849.                         bFound = true;
  1850.                     }
  1851.  
  1852.                     if( iSkipped == (int)iStart )
  1853.                     {
  1854.                         // output table rows
  1855.  
  1856.                         if( iAdded % 2 )
  1857.                             pResponse->strContent += "<tr class=\"even\">";
  1858.                         else
  1859.                             pResponse->strContent += "<tr class=\"odd\">";
  1860.  
  1861.                         // <td> tag
  1862.  
  1863.                         if( !m_vecTags.empty( ) )
  1864.                         {
  1865.                             string strTemp = pTorrents[i].strTag;
  1866.  
  1867.                             for( vector< pair<string, string> > :: iterator j = m_vecTags.begin( ); j != m_vecTags.end( ); j++ )
  1868.                             {
  1869.                                 // The Trinity Edition - Modification Begins
  1870.                                    
  1871.                                 if( (*j).first == pTorrents[i].strTag && !(*j).second.empty( ) ) {
  1872.  
  1873.                                         /* The following removes the border around the tag image
  1874.                                         that normally displays when the image is hyperlinked...
  1875.                                         which it will be because of the new LINK CODE FOR TAG FILTERS below
  1876.                                         */
  1877.  
  1878.                                         pTorrents[i].strTag = "<img border=\"0\" src=\"" + (*j).second + "\" title=\"" + (*j).first + "\">";
  1879.                                        
  1880.                                         /* Future OnMouseOver/Out Implimentation for the Tag Column Filters
  1881.  
  1882.                                         ------ NOT YET IMPLIMENTED ------
  1883.  
  1884.                                         if( m_bUseMouseovers ) { // WILL MOST LIKELY CHANGE CONFIG KEY TO "trinity_use_mouseovers_ontags"
  1885.                                             pTorrents[i].strTag = "<img src=\"" + (*j).second + "\" border=\"0\" title=\"" + (*j).first + "\" name=\"" + (*j).first + "\" onMouseOver=\"hoverOn" + (*i).first + "()\" onMouseOut=\"hoverOff" + (*j).first + "()\"; return true;>";
  1886.                                         }
  1887.                                         else {
  1888.                                             pTorrents[i].strTag = "<img src=\"" + (*j).second + "\" border=\"0\" title=\"" + (*j).first + "\" name=\"" + (*j).first + "\">";
  1889.                                         }
  1890.  
  1891.                                         */
  1892.  
  1893.                                 }
  1894.  
  1895.                                 /* Original Source Code:
  1896.                                 if( (*j).first == pTorrents[i].strTag && !(*j).second.empty( ) )
  1897.                                     pTorrents[i].strTag = "<img src=\"" + (*j).second + "\">";
  1898.                                 */
  1899.  
  1900.                                 // ----------------------------------------------- END OF MODIFICATIONS
  1901.                             }
  1902.  
  1903.                             if( pTorrents[i].strTag == strTemp )
  1904.                                 pTorrents[i].strTag = UTIL_RemoveHTML( pTorrents[i].strTag );
  1905.  
  1906.                             // Trinity Edition - Modification Begins
  1907.  
  1908.                             /* The following allows the Tag/Category images in the far left column
  1909.                             to act as an additional filter, functioning the same as the one at
  1910.                             the top of the Torrent Table... SPECIAL THANKS to DreadWingKnight */
  1911.                            
  1912.                             pResponse->strContent += "<td class=\"tag\">";
  1913.  
  1914.                             // Link code for tag Filters
  1915.                             pResponse->strContent += "<a href=\"/index.html?filter=" + UTIL_StringToEscaped( strTemp );
  1916.  
  1917.                             if( !strSort.empty( ) )
  1918.                                 pResponse->strContent += "&sort=" + strSort;
  1919.  
  1920.                             if( !strSearch.empty( ) )
  1921.                                 pResponse->strContent += "&search=" + strSearchResp;
  1922.  
  1923.                             pResponse->strContent += "\">";
  1924.                             // End link code for tag Filters
  1925.                             pResponse->strContent += pTorrents[i].strTag;
  1926.                             pResponse->strContent += "</a>";
  1927.                             pResponse->strContent += "</td>";
  1928.  
  1929.                             /* Original Source Code:
  1930.                             pResponse->strContent += "<td>" + pTorrents[i].strTag + "</td>";
  1931.                             */
  1932.  
  1933.                             // ------------------------------------------------------ END OF MODIFICATION
  1934.                         }
  1935.  
  1936.                         // <td> info hash
  1937.  
  1938.                         if( m_bShowInfoHash )
  1939.                         {
  1940.                             pResponse->strContent += "<td class=\"hash\">";
  1941.  
  1942.                             if( m_bShowStats )
  1943.                                 pResponse->strContent += "<a class=\"hash\" href=\"/stats.html?info_hash=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">";
  1944.  
  1945.                             pResponse->strContent += UTIL_HashToString( pTorrents[i].strInfoHash );
  1946.  
  1947.                             if( m_bShowStats )
  1948.                                 pResponse->strContent += "</a>";
  1949.  
  1950.                             pResponse->strContent += "</td>";
  1951.                         }
  1952.  
  1953.                         // <td> name
  1954.  
  1955.                         if( m_pAllowed && m_bShowNames )
  1956.                         {
  1957.                             pResponse->strContent += "<td class=\"name\">";
  1958.  
  1959.                             //if( m_bShowStats )
  1960.                             //  pResponse->strContent += "<a class=\"stats\" href=\"/torrent.html?info_hash=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">";
  1961.  
  1962.                             pResponse->strContent += UTIL_RemoveHTML( pTorrents[i].strName );
  1963.  
  1964.                             if( m_bShowStats )
  1965.                                 pResponse->strContent += "</a>";
  1966.  
  1967.                             pResponse->strContent += "</td>";
  1968.                         }
  1969.  
  1970.                         // <td> torrent
  1971.  
  1972.                         if( m_pAllowed && m_bAllowTorrentDownloads && ( user.iAccess & ACCESS_DL ) )
  1973.                         {
  1974.                             // The Trinity Edition - Modification Begins
  1975.  
  1976.                             // The following adds brackets around thepTorrents[i].strTag Torrent Download Link
  1977.  
  1978.                             pResponse->strContent += "<td class=\"download\"><nobr>[<a class=\"download\" href=\"";
  1979.                            
  1980.                             /* Original Source Code:
  1981.                             pResponse->strContent += "<td class=\"download\"><a class=\"download\" href=\"";
  1982.                             */
  1983.  
  1984.                             if( m_strExternalTorrentDir.empty( ) )
  1985.                                 pResponse->strContent += "/torrent.html?info_hash=" + UTIL_HashToString( pTorrents[i].strInfoHash );
  1986.                             else
  1987.                                 pResponse->strContent += m_strExternalTorrentDir + UTIL_StringToEscapedStrict( pTorrents[i].strFileName );
  1988.  
  1989.                                 // The following adds the Custom Label Feature
  1990.  
  1991.                                 if( m_bUseCustomlabels ) {
  1992.                                     pResponse->strContent += "\">\n";
  1993.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  1994.                                     pResponse->strContent += "if (typeof(linkDownload) == \"undefined\") {\n";
  1995.                                     pResponse->strContent += "   document.write(\"Download\");\n";
  1996.                                     pResponse->strContent += "}\n";
  1997.                                     pResponse->strContent += "else {\n";
  1998.                                     pResponse->strContent += "   document.write(linkDownload);\n";
  1999.                                     pResponse->strContent += "}\n";
  2000.                                     pResponse->strContent += "</script>\n";
  2001.                                     pResponse->strContent += "</a>]</nobr></td>\n\n";
  2002.                                 }
  2003.                                 else { // Use Original Source Code WITH ADDED BRACKET:
  2004.                                     pResponse->strContent += "\">DL</a>]</nobr></td>";
  2005.                                 }
  2006.  
  2007.                             /* Original Source Code:
  2008.                             pResponse->strContent += "\">DL</a></td>";
  2009.                             */
  2010.  
  2011.                             // ------------------------------------------------------------- END OF MODIFICATION
  2012.                         }
  2013.  
  2014.                         // <td> comments
  2015.  
  2016.                         if( m_pAllowed && m_bAllowComments )
  2017.                         {
  2018.                             if( m_pComments )
  2019.                                 pResponse->strContent += "<td class=\"number\"><a href=\"/stats.html?info_hash=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">" + CAtomInt( pTorrents[i].iComments ).toString( ) + "</a></td>";
  2020.                         }
  2021.  
  2022.                         // <td> added
  2023.  
  2024.                         if( m_pAllowed && m_bShowAdded )
  2025.                         {
  2026.                             pResponse->strContent += "<td class=\"date\">";
  2027.  
  2028.                             if( !pTorrents[i].strAdded.empty( ) )
  2029.                             {
  2030.                                 // strip year and seconds from time
  2031.  
  2032.                                 pResponse->strContent += pTorrents[i].strAdded.substr( 5, pTorrents[i].strAdded.size( ) - 8 );
  2033.                             }
  2034.  
  2035.                             pResponse->strContent += "</td>";
  2036.                         }
  2037.  
  2038.                         // <td> size
  2039.  
  2040.                         if( m_pAllowed && m_bShowSize )
  2041.                             pResponse->strContent += "<td class=\"bytes\">" + UTIL_BytesToString( pTorrents[i].iSize ) + "</td>";
  2042.  
  2043.                         // <td> files
  2044.  
  2045.                         if( m_pAllowed && m_bShowNumFiles )
  2046.                             pResponse->strContent += "<td class=\"number\">" + CAtomInt( pTorrents[i].iFiles ).toString( ) + "</td>";
  2047.  
  2048.                         // <td> seeders
  2049.  
  2050.                         pResponse->strContent += "<td class=\"number_";
  2051.  
  2052.                         if( pTorrents[i].iComplete == 0 )
  2053.                             pResponse->strContent += "red\">";
  2054.                         else if( pTorrents[i].iComplete < 5 )
  2055.                             pResponse->strContent += "yellow\">";
  2056.                         else
  2057.                             pResponse->strContent += "green\">";
  2058.  
  2059.                         pResponse->strContent += CAtomInt( pTorrents[i].iComplete ).toString( ) + "</td>";
  2060.  
  2061.                         // <td> leechers
  2062.  
  2063.                         pResponse->strContent += "<td class=\"number_";
  2064.  
  2065.                         if( pTorrents[i].iDL == 0 )
  2066.                             pResponse->strContent += "red\">";
  2067.                         else if( pTorrents[i].iDL < 5 )
  2068.                             pResponse->strContent += "yellow\">";
  2069.                         else
  2070.                             pResponse->strContent += "green\">";
  2071.  
  2072.                         pResponse->strContent += CAtomInt( pTorrents[i].iDL ).toString( ) + "</td>";
  2073.  
  2074.                         // <td> completed
  2075.  
  2076.                         if( m_bShowCompleted )
  2077.                             pResponse->strContent += "<td class=\"number\">" + CAtomInt( pTorrents[i].iCompleted ).toString( ) + "</td>";
  2078.  
  2079.                         // <td> transferred
  2080.  
  2081.                         if( m_pAllowed && m_bShowTransferred )
  2082.                             pResponse->strContent += "<td class=\"bytes\">" + UTIL_BytesToString( pTorrents[i].iTransferred ) + "</td>";
  2083.  
  2084.                         // <td> min left
  2085.  
  2086.                         if( m_bShowMinLeft )
  2087.                         {
  2088.                             pResponse->strContent += "<td class=\"percent\">";
  2089.  
  2090.                             if( pTorrents[i].iDL == 0 )
  2091.                                 pResponse->strContent += "N/A";
  2092.                             else
  2093.                             {
  2094.                                 if( m_pAllowed )
  2095.                                 {
  2096.                                     int iPercent = 0;
  2097.  
  2098.                                     if( pTorrents[i].iSize > 0 )
  2099.                                     {
  2100.                                         if( m_bShowLeftAsProgress )
  2101.                                             iPercent = 100 - (int)( ( (float)pTorrents[i].iMaxiLeft / pTorrents[i].iSize ) * 100 );
  2102.                                         else
  2103.                                             iPercent = (int)( ( (float)pTorrents[i].iMinLeft / pTorrents[i].iSize ) * 100 );
  2104.                                     }
  2105.  
  2106.                                     pResponse->strContent += CAtomInt( iPercent ).toString( ) + "%</td>";
  2107.                                 }
  2108.                                 else
  2109.                                     pResponse->strContent += UTIL_BytesToString( pTorrents[i].iMinLeft );
  2110.                             }
  2111.                         }
  2112.  
  2113.                         // <td> average left
  2114.  
  2115.                         if( m_bShowAverageLeft )
  2116.                         {
  2117.                             pResponse->strContent += "<td class=\"percent\">";
  2118.  
  2119.                             if( pTorrents[i].iDL == 0 )
  2120.                                 pResponse->strContent += "N/A";
  2121.                             else
  2122.                             {
  2123.                                 if( m_pAllowed )
  2124.                                 {
  2125.                                     int iPercent;
  2126.  
  2127.                                     if( m_bShowLeftAsProgress )
  2128.                                         iPercent = 100 - pTorrents[i].iAverageLeftPercent;
  2129.                                     else
  2130.                                         iPercent = pTorrents[i].iAverageLeftPercent;
  2131.  
  2132.                                     pResponse->strContent += CAtomInt( iPercent ).toString( ) + "%";
  2133.  
  2134.                                     if( !m_strImageBarFill.empty( ) && !m_strImageBarTrans.empty( ) )
  2135.                                     {
  2136.                                         pResponse->strContent += "<br>";
  2137.  
  2138.                                         if( iPercent > 0 )
  2139.                                             pResponse->strContent += "<img src=\"" + m_strImageBarFill + "\" width=" + CAtomInt( iPercent ).toString( ) + " height=8>";
  2140.  
  2141.                                         if( iPercent < 100 )
  2142.                                             pResponse->strContent += "<img src=\"" + m_strImageBarTrans + "\" width=" + CAtomInt( 100 - iPercent ).toString( ) + " height=8>";
  2143.                                     }
  2144.                                 }
  2145.                                 else
  2146.                                     pResponse->strContent += UTIL_BytesToString( pTorrents[i].iAverageLeft );
  2147.  
  2148.                                 pResponse->strContent += "</td>";
  2149.                             }
  2150.                         }
  2151.  
  2152.                         // <td> maxi left
  2153.  
  2154.                         if( m_bShowMaxiLeft )
  2155.                         {
  2156.                             pResponse->strContent += "<td class=\"percent\">";
  2157.  
  2158.                             if( pTorrents[i].iDL == 0 )
  2159.                                 pResponse->strContent += "N/A";
  2160.                             else
  2161.                             {
  2162.                                 if( m_pAllowed )
  2163.                                 {
  2164.                                     int iPercent = 0;
  2165.  
  2166.                                     if( pTorrents[i].iSize > 0 )
  2167.                                     {
  2168.                                         if( m_bShowLeftAsProgress )
  2169.                                             iPercent = 100 - (int)( ( (float)pTorrents[i].iMinLeft / pTorrents[i].iSize ) * 100 );
  2170.                                         else
  2171.                                             iPercent = (int)( ( (float)pTorrents[i].iMaxiLeft / pTorrents[i].iSize ) * 100 );
  2172.                                     }
  2173.  
  2174.                                     pResponse->strContent += CAtomInt( iPercent ).toString( ) + "%</td>";
  2175.                                 }
  2176.                                 else
  2177.                                     pResponse->strContent += UTIL_BytesToString( pTorrents[i].iMaxiLeft );
  2178.                             }
  2179.                         }
  2180.  
  2181.                         // <td> uploader
  2182.  
  2183.                         if( m_bShowUploader )
  2184.                             pResponse->strContent += "<td class=\"name\">" + UTIL_RemoveHTML( pTorrents[i].strUploader ) + "</td>";
  2185.  
  2186.                         // <td> info link
  2187.  
  2188.                         if( m_bAllowInfoLink )
  2189.                         {
  2190.                             pResponse->strContent += "<td class=\"infolink\">";
  2191.  
  2192.                             // The Trinity Edition - Modification Begins
  2193.  
  2194.                             /* The following adds the Custom Label Feature and also sets
  2195.                             the target for InfoLinks to a new browser window */
  2196.  
  2197.                             if( !pTorrents[i].strInfoLink.empty( ) ) {
  2198.                                
  2199.                                 if( m_bUseCustomlabels ) {
  2200.                                     pResponse->strContent += "[ <a target=\"_blank\" href=\"" + UTIL_RemoveHTML( pTorrents[i].strInfoLink ) + "\">\n\n";
  2201.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  2202.                                     pResponse->strContent += "if (typeof(linkInfoLink) == \"undefined\") {\n";
  2203.                                     pResponse->strContent += "   document.write(\"Link\");\n";
  2204.                                     pResponse->strContent += "}\n";
  2205.                                     pResponse->strContent += "else {\n";
  2206.                                     pResponse->strContent += "   document.write(linkInfoLink);\n";
  2207.                                     pResponse->strContent += "}\n";
  2208.                                     pResponse->strContent += "</script>\n";
  2209.                                     pResponse->strContent += "</a> ]";
  2210.                                 }
  2211.                                 else { // Use Original Source Code WITH ADDED TARGET:
  2212.                                     pResponse->strContent += "[ <a target=\"_blank\" href=\"" + UTIL_RemoveHTML( pTorrents[i].strInfoLink ) + "\">Link</a> ]";
  2213.                                 }
  2214.  
  2215.                             }
  2216.  
  2217.                             /* Original Source Code:
  2218.                             if( !pTorrents[i].strInfoLink.empty( ) )
  2219.                                 pResponse->strContent += "<a href=\"" + UTIL_RemoveHTML( pTorrents[i].strInfoLink ) + "\">Link</a>";
  2220.                             */
  2221.  
  2222.                             // ----------------------------------------------------------- END OF MODIFICATION
  2223.  
  2224.                             pResponse->strContent += "</td>";
  2225.                         }
  2226.  
  2227.                         // <td> admin
  2228.  
  2229.                         if( user.iAccess & ACCESS_EDIT )
  2230.                         {
  2231.                             if( m_pAllowed )
  2232.                                 // The Trinity Edition - Modification Begins
  2233.                                 // The following adds the Custom Label Feature to the DELETE LINK
  2234.                                 if ( m_bUseCustomlabels ) {
  2235.                                     pResponse->strContent += "<td><nobr>[<a href=\"/index.html?del=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">\n";
  2236.                                     pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  2237.                                     pResponse->strContent += "if (typeof(linkDelete) == \"undefined\") {\n";
  2238.                                     pResponse->strContent += "    document.write(\"Delete\");\n";
  2239.                                     pResponse->strContent += "}\n";
  2240.                                     pResponse->strContent += "else {\n";
  2241.                                     pResponse->strContent += "    document.write(linkDelete);\n";
  2242.                                     pResponse->strContent += "}\n";
  2243.                                     pResponse->strContent += "</script>\n\n";
  2244.                                     pResponse->strContent += "</a>]</nobr></td>";
  2245.                                 }
  2246.                                 else { // Use Original Source Code WITH SPACES ADDED BETWEEN BRACKETS AND LINK TEXT:
  2247.                                     pResponse->strContent += "<td><nobr>[ <a href=\"/index.html?del=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">Delete</a> ]</nobr></td>";
  2248.                                 }
  2249.  
  2250.                             /* Original Source Code:
  2251.                             pResponse->strContent += "<td>[<a href=\"/index.html?del=" + UTIL_HashToString( pTorrents[i].strInfoHash ) + "\">Delete</a>]</td>";
  2252.                             */
  2253.                         }
  2254.  
  2255.                         pResponse->strContent += "</tr>\n";
  2256.  
  2257.                         iAdded++;
  2258.                     }
  2259.                     else
  2260.                         iSkipped++;
  2261.                 }
  2262.             }
  2263.  
  2264.             delete [] pTorrents;
  2265.  
  2266.             // some finishing touches
  2267.  
  2268.             if( bFound )
  2269.                 pResponse->strContent += "</table>\n";
  2270.  
  2271.             // The Trinity Edition - Additions Begin
  2272.  
  2273.             pResponse->strContent += "</div>\n\n"; // END THE TABLE DIV ELEMENT
  2274.  
  2275.             // The following adds an internal anchor for the PageNavJumpLink internal document link set earlier in the document
  2276.  
  2277.             pResponse->strContent += "<a name=\"search\"></a>\n";
  2278.  
  2279.             // ------------------------------------------------------------ END OF ADDITIONS
  2280.  
  2281.             if( m_pAllowed && m_bShowNames && m_bSearch )
  2282.             {
  2283.                 // The Trinity Edition - Modification Begins:
  2284.                 // The following specifies an inline display
  2285.                 // for the form to remove extra unwanted space on top and bottom.
  2286.                 // Also added identical span class to form tag for redundancy
  2287.  
  2288.                 pResponse->strContent += "<span class=\"search_index\"><form style=\"display:inline\" class=\"search_index\" method=\"get\" action=\"/index.html\">\n";
  2289.  
  2290.                 /* Original Source Code:
  2291.                 pResponse->strContent += "<span class=\"search_index\"><form method=\"get\" action=\"/index.html\">\n";
  2292.                 */
  2293.  
  2294.                 // ---------------------------------------- END OF MODIFICATION
  2295.  
  2296.                 if( !strSort.empty( ) )
  2297.                     pResponse->strContent += "<input name=\"sort\" type=hidden value=\"" + strSort + "\">\n";
  2298.  
  2299.                 if( !strFilter.empty( ) )
  2300.                     pResponse->strContent += "<input name=\"filter\" type=hidden value=\"" + strFilter + "\">\n";
  2301.  
  2302.                 // The Trinity Edition - Modifications Begin
  2303.  
  2304.                 // The following adds the Custom Label Feature to the form field label "Search" and
  2305.                 // changes the "Clear Search" link into a button, whose label can also be customized.
  2306.                 // <BR> tags are also inserted to further separate the Search form from the Torrent Table
  2307.                 // Added Go button for Search Form
  2308.  
  2309.                     if( m_bUseCustomlabels ) {
  2310.                         pResponse->strContent += "<br><br>\n";
  2311.                         pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  2312.                         pResponse->strContent += "if (typeof(labelSearch) == \"undefined\") {\n";
  2313.                         pResponse->strContent += "   document.write(\"Search\");\n";
  2314.                         pResponse->strContent += "}\n";
  2315.                         pResponse->strContent += "else {\n";
  2316.                         pResponse->strContent += "   document.write(labelSearch);\n";
  2317.                         pResponse->strContent += "}\n";
  2318.                         pResponse->strContent += "</script>\n";
  2319.                         pResponse->strContent += "<input name=\"search\" type=text size=40>\n";
  2320.                         pResponse->strContent += "<script language=\"javascript\" type=\"text/javascript\">\n";
  2321.                         pResponse->strContent += "if (typeof(buttonGo) == \"undefined\") {\n";
  2322.                         pResponse->strContent += "   document.write(\"<input class=\\\"go\\\" type=\\\"submit\\\" value=\\\"Go\\\">\\n\");\n";
  2323.                         pResponse->strContent += "}\n";
  2324.                         pResponse->strContent += "else {\n";
  2325.                         pResponse->strContent += "   document.write(\"<input class=\\\"go\\\" type=\\\"submit\\\" value=\\\"\" + buttonGo + \"\\\">\\n\");\n";
  2326.                         pResponse->strContent += "}\n";
  2327.                         pResponse->strContent += "if (typeof(buttonClearSearch) == \"undefined\") {\n";
  2328.                         pResponse->strContent += "   document.write(\"<input class=\\\"clearsearch\\\" type=\\\"button\\\" value=\\\"Clear Search\\\" onClick=\\\"window.location=\'/index.html\'\\\">\");\n";
  2329.                         pResponse->strContent += "}\n";
  2330.                         pResponse->strContent += "else {\n";
  2331.                         pResponse->strContent += "   document.write(\"<input class=\\\"clearsearch\\\" type=\\\"button\\\" value=\\\"\" + buttonClearSearch + \"\\\" onClick=\\\"window.location=\'/index.html\'\\\">\");\n";
  2332.                         pResponse->strContent += "}\n";
  2333.                         pResponse->strContent += "</script>\n\n";
  2334.  
  2335.                     }
  2336.                     else { // Use Original Source Code WITH <BR> TAGS AND BUTTON CODE:
  2337.                         pResponse->strContent += "<br><br>Search <input name=\"search\" type=text size=40>\n";
  2338.                         pResponse->strContent += "<input class=\"go\" type=\"submit\" value=\"Go\">\n";
  2339.                         pResponse->strContent += "<input class=\"clearsearch\" type=\"button\" value=\"Clear Search\" onClick=\"window.location=\'/index.html\'\"></p>\n";
  2340.                     }
  2341.  
  2342.                 /* Original Source Code:
  2343.                 pResponse->strContent += "Search <input name=\"search\" type=text size=40> <a href=\"/index.html\">Clear Search</a>\n";
  2344.                 */
  2345.  
  2346.                 // -------------------------------------------------------------------- END OF MODIFICATIONS
  2347.  
  2348.                 pResponse->strContent += "</form></span>\n";
  2349.             }
  2350.  
  2351.             // page numbers
  2352.  
  2353.             if( m_iPerPage > 0 )
  2354.             {
  2355.                 pResponse->strContent += "<p class=\"pagenum_bottom\">";
  2356.  
  2357.                 // The Trinity Edition - Additions Begin
  2358.  
  2359.                 /* The following adds the ability to use the Custom Label Feature
  2360.                 to add text to the beginning of the Page Navigation Links */
  2361.             }
  2362.         }
  2363.  
  2364.         // The Trinity Edition - Addition Begins
  2365.  
  2366.         // The following ends the <div class="index"> set earlier in the document
  2367.  
  2368.         pResponse->strContent += "</div>\n";
  2369.  
  2370.         // -------------------------------------------- END OF ADD
  2371.  
  2372.         // pResponse->strContent += m_strStaticFooter;
  2373.  
  2374.         // don't even think about removing this :)
  2375.  
  2376.         // The Trinity Edition - Modification Begins
  2377.         // The following modifies the displayed Tracker Version String
  2378.  
  2379.     //  pResponse->strContent += "<hr>\n";
  2380.         // pResponse->strContent += "<p align=\"center\">BNBT EasyTracker</p>\n";
  2381.     //  pResponse->strContent += "<p align=\"center\">Powered by BNBT Tracker." "</p>\n";
  2382.         /* Original Source Code:
  2383.         pResponse->strContent += "<p align=\"center\">POWERED BY BNBT " + string( BNBT_VER ) + "</p>\n";
  2384.         */
  2385.  
  2386.         // ------------------------------------------------- End of Modification
  2387.     }
  2388.     else
  2389.     {
  2390.         pResponse->strContent += "<p class=\"denied\">You are not authorized to view this page.";
  2391.  
  2392.         if( user.iAccess & ACCESS_SIGNUP )
  2393.             pResponse->strContent += " Click <a href=\"/signup.html\">here</a> to sign up for an account!";
  2394.  
  2395.         pResponse->strContent += "</p>\n";
  2396.     }
  2397.  
  2398.     if( m_bGen )
  2399.         // The Trinity Edition - Modification Begins
  2400.         // The following modifies the CSS class "gen" to "gen_index"
  2401.         // so that differing styles (i.e. horizontal alignment) can
  2402.         // be applied to JUST the Generation Time that is displayed
  2403.         // on the tracker index
  2404.  
  2405.         pResponse->strContent += "<br>We are currently tracking: " + CAtomLong( m_pDFile->getValue( ).size( ) ).toString( ) + " Torrents with ";
  2406.  
  2407.             unsigned long iPeers = 0;
  2408.  
  2409.             map<string, CAtom *> mapDicti = m_pDFile->getValue( );
  2410.  
  2411.             for( map<string, CAtom *> :: iterator i = mapDicti.begin( ); i != mapDicti.end( ); i++ )
  2412.             {
  2413.                 if( (*i).second->isDicti( ) )
  2414.                     iPeers += ( (CAtomDicti *)(*i).second )->getValue( ).size( );
  2415.             }
  2416.  
  2417.             //pResponse->strContent += CAtomLong( iPeers ).toString( ) + " Peers";
  2418.  
  2419.             if( m_bCountUniquePeers )
  2420.                 pResponse->strContent += "" + CAtomLong( m_pIPs->getValue( ).size( ) ).toString( ) + " Peers.";
  2421.             pResponse->strContent += "</strong></li><p class=\"gen_index\"><center>Generated in " + UTIL_ElapsedTimeStr( btv, UTIL_CurrentTime( ) ) + " seconds.<center></p>\n";
  2422.         /* Original Source Code:
  2423.         pResponse->strContent += "<center><p class=\"gen\">Generated in " + UTIL_ElapsedTimeStr( btv, UTIL_CurrentTime( ) ) + " seconds.</p></center>\n";
  2424.         */
  2425.  
  2426.         // ------------------------------------------------- END OF MODIFICATION
  2427.  
  2428.     pResponse->strContent += "</body>\n";
  2429.     pResponse->strContent += "</html>\n";
  2430. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement