Advertisement
Sawyer

template

Apr 22nd, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.03 KB | None | 0 0
  1. <?php
  2. function stdhead($title = "", $msgalert = true, $stdhead = false) {
  3.     global $CURUSER, $TBDEV, $lang, $free, $_NO_COMPRESS, $querytime, $query_stat, $q, $mc;
  4.     if (!$TBDEV['site_online'])
  5.       die("We are making updates, please check back again later... thanks<br />");
  6.     header('Content-Type: text/html; charset=utf-8');
  7.     header('Content-Language content="en-us"');
  8.     if ($title == "")
  9.     $title = $TBDEV['site_name'] .(isset($_GET['tbv'])?" (".TBVERSION.")":'');
  10.     else
  11.     $title = $TBDEV['site_name'].(isset($_GET['tbv'])?" (".TBVERSION.")":''). " :: " . htmlspecialchars($title);  
  12.     if ($CURUSER)
  13.     {
  14.     $TBDEV['stylesheet'] = isset($CURUSER['stylesheet']) ? "{$CURUSER['stylesheet']}.css" : $TBDEV['stylesheet'];
  15.     }
  16.     if ($TBDEV['msg_alert'] && $msgalert && $CURUSER)
  17.     {
  18.       $res = sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " && unread='yes'") or sqlerr(__FILE__,__LINE__);
  19.       $arr = mysql_fetch_row($res);
  20.       $unread = $arr[0];
  21.     }
  22.     /** ZZZZZZZZZZZZZZZZZZZZZZZZZZip it! **/
  23.     if (!isset($_NO_COMPRESS))
  24.     if (!ob_start('ob_gzhandler'))
  25.     ob_start();
  26.     /** include js files needed only for the page being used by pdq **/
  27.     $js_incl = '<!-- javascript goes here or in footer -->';
  28.     if ($stdhead['js'] != false) {
  29.     foreach ($stdhead['js'] as $JS)
  30.     $js_incl .= "<script type='text/javascript' src='".$TBDEV['baseurl']."/scripts/".$JS.".js'></script>";
  31.     }
  32.     $htmlout = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
  33.    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  34.    <html xmlns='http://www.w3.org/1999/xhtml'>
  35.    <!-- ************************************************************************** -->
  36.    <!--       THIS WEBSITE IS POWERED BY TBDEV.NET 2009 (FINAL) SOURCECODE         -->
  37.    <!--  DESIGN IS MADE UNIQUE FOR THIS TRACKER, BY KIDVISION FROM TBDEV.NET TEAM  -->
  38.    <!--             HTTP://WWW.KIDVISION.ME  |  HTTP://WWW.TBDEV.NET               -->
  39.    <!-- ************************************************************************** -->
  40.    <head>
  41.    <meta name='generator' content='TBDev.net' />
  42.    <meta http-equiv='Content-Language' content='en-us' />
  43.    <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  44.    <meta name='MSSmartTagsPreventParsing' content='TRUE' />
  45.    <title>{$title}</title>
  46.    <link rel='alternate' type='application/rss+xml' title='Latest Torrents' href='./rss.php?passkey={$CURUSER['passkey']}' />
  47.    <link rel='stylesheet' href='templates/1/1.css' type='text/css' />
  48.    <link rel='stylesheet' href='templates/1/bbcode.css' type='text/css' />
  49.    <script type='text/javascript' src='scripts/jquery.js'></script>
  50.    <script type='text/javascript' src='image-resize/core-resize.js'></script>
  51.    <link type='text/css' rel='stylesheet' href='image-resize/resize.css'  />
  52.    ".$js_incl."
  53.    </head>
  54.    <body>";
  55.     if ($CURUSER)
  56.     {
  57.     $htmlout .= "
  58.     <div id='container' class='container'>
  59.     <div id='logo'><!-- Css - Change logo @ css --></div>
  60.     <ul id='menu'>
  61.  
  62.    <li><a href='index.php'><font color=#555555>HOME</font></a></li>
  63.    <li class='sub'><a class='sub' href='browse.php'><b><font color=#555555>BROWSE</font></b><!--[if gte IE 7]><!--></a><!--<![endif]-->
  64.    <!--[if lte IE 6]><table><tr><td><![endif]-->
  65.    <!--[if lte IE 6]></td></tr></table></a><![endif]-->
  66.    </li>
  67.    <li class='sub'><a class='sub' href='upload.php'><b><font color=#555555>UPLOAD</font></b><!--[if gte IE 7]><!--></a><!--<![endif]-->
  68.    <!--[if lte IE 6]><table><tr><td><![endif]-->  
  69.    <!--[if lte IE 6]></td></tr></table></a><![endif]-->
  70.    </li>
  71.    <li class='sub'><a class='sub' href='usercp.php'><b><font color=#555555>PROFILE</font></b><!--[if gte IE 7]><!--></a><!--<![endif]-->
  72.    <!--[if lte IE 6]><table><tr><td><![endif]-->
  73.    <!--[if lte IE 6]></td></tr></table></a><![endif]-->
  74.    </li>
  75.    <li class='sub'><a class='sub' href='forums.php'><b><font color=#555555>FORUMS</font></b><!--[if gte IE 7]><!--></a><!--<![endif]-->
  76.    <!--[if lte IE 6]><table><tr><td><![endif]-->
  77.    <!--[if lte IE 6]></td></tr></table></a><![endif]-->
  78.    </li>
  79.    <li><a href='rules.php'><b><font color=#555555>RULES</font></b></a></li>
  80.    <li><a href='faq.php'><b><font color=#555555>F.A.Q</font></b></a></li>
  81.     </ul>";
  82.     }
  83.     $htmlout .= StatusBar();
  84.     $htmlout .="
  85.    <!-- Main content -->
  86.    <table class='mainouter' width='100%' align='center' border='0' cellspacing='0' cellpadding='0'>
  87.    <tr><td align='center' class='outer' style='padding-top: 20px; padding-bottom: 5px'>";
  88.     //=== free addon start
  89. if ($CURUSER && isset($free)) {
  90.     foreach ($free as $fl) {
  91.         switch ($fl['modifier']) {
  92.             case 1:
  93.                 $mode = 'All Torrents Free';
  94.                 break;
  95.  
  96.             case 2:
  97.                 $mode = 'All Double Upload';
  98.                 break;
  99.  
  100.             case 3:
  101.                 $mode = 'All Torrents Free and Double Upload';
  102.                 break;
  103.  
  104.             default:
  105.                 $mode = 0;
  106.         }
  107.        
  108.     $htmlout .= ($fl['modifier'] != 0 && $fl['expires'] > TIME_NOW ? '<img src="'.$TBDEV['baseurl'].'/pic/cat_free.gif" alt="FREE!" title="'.$fl['title'].'&nbsp;|&nbsp;'.$mode.'
  109.        '.$fl['message'].'&nbsp;|&nbsp;set by '.$fl['setby'].'&nbsp;|&nbsp;'.($fl['expires'] != 1 ?
  110.     'Until '.get_date($fl['expires'], 'DATE').' ('.mkprettytime($fl['expires'] - time()).' to go)' : '').'
  111.        
  112.    <br />' : '');
  113.     }
  114. }
  115.    // happy hour
  116.    // if ( $CURUSER ) {
  117.     // if ( happyHour( "check" ) ) {
  118.         // $htmlout.="<table border='0' cellspacing='0' cellpadding='10'  ><tr><td align='center' style=\"background:#CCCCCC;color:#222222; padding:10px\">\n
  119.         // <b>Hey its now happy hour ! " . ( ( happyCheck( "check" ) == 255 ) ? "Every torrent downloaded in the happy hour is free" : "Only <a href=\"browse.php?cat=" . happyCheck( "check" ) . "\">this category</a> is free this happy hour" ) . "<br /><font color='red'>" . happyHour( "time" ) . " </font> remaining from this happy hour!</b>";
  120.        // $htmlout.="</td></tr></table><br />\n";
  121.     // }
  122.    // }
  123.    //==Big red staffmess thingy box:
  124.    if($TBDEV['staffmsg_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
  125.         $num = mysql_result(sql_query('SELECT count(id) FROM staffmessages WHERE answeredby = 0'),0);
  126.         if($num > 0)
  127.         $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>
  128.                  <tr><td style='padding: 10px; background: #ccc'>\n
  129.                  <b><a href='staffbox.php'>".sprintf($lang['gl_staffmsg_alert'], $num). "!</a></b>
  130.                  </td></tr></table><br />";
  131.     }
  132.   //==End
  133.   //==Big red report thingy box:
  134.    if($TBDEV['report_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
  135.         $num = mysql_result(sql_query('SELECT COUNT(id) FROM reports WHERE delt_with = 0'),0);
  136.         if($num > 0)
  137.         $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>
  138.                  <tr><td style='padding: 10px; background: #ccc'>\n
  139.                  <b><a href='admin.php?action=reports'>".sprintf($lang['gl_reportmsg_alert'], $num). "!</a></b>
  140.                  </td></tr></table><br />";
  141.     }
  142.     //==End
  143.     //Big red uploadapp thingy box:
  144.    if($TBDEV['uploadapp_alert'] && $CURUSER['class'] >= UC_MODERATOR) {
  145.         $num = mysql_result(sql_query('SELECT count(id) FROM uploadapp WHERE status = "pending"'),0);
  146.         if($num > 0)
  147.         $htmlout .= "<table border='0' cellspacing='0' cellpadding='10'>
  148.                  <tr><td style='padding: 10px; background: #ccc'>\n
  149.                  <b><a href='uploadapps.php'>".sprintf($lang['gl_uploadapp_alert'], $num). "!</a></b>
  150.                  </td></tr></table><br />";
  151.     }
  152.     //==End
  153.    //==Temp demotion
  154.    if ($CURUSER['override_class'] != 255 && $CURUSER) // Second condition needed so that this box isn't displayed for non members/logged out members.
  155.    {
  156.    $htmlout .= "<b><a href='./restoreclass.php'>
  157.   <img src='templates/6/gfx/tool.png' alt='Your running under lower class, restore here' title='Your running under lower class, restore here' /><font color='white'></font></a></b>&nbsp;&nbsp;&nbsp;";
  158.    }
  159.    //==End
  160.    if ($TBDEV['msg_alert'] && isset($unread) && !empty($unread))
  161.    {
  162.    $htmlout .= "<b><a href='./messages.php'><img src='templates/6/gfx/new-mail.png' alt='You got mail' title='You got mail' /></a></b>";
  163.    }
  164.  
  165.     return $htmlout;
  166.     } // stdhead
  167.  
  168. function stdfoot($stdfoot = false) {
  169. global $querytime, $CURUSER, $TBDEV, $q, $queries, $query_stat, $mc;
  170.     $queries = (!empty($queries) ? $queries : 0);
  171.     $q['debug']       = array(1); // USER IDs
  172.     $q['seconds']     = (microtime(true) - $q['start']);
  173.     $q['phptime']     = $q['seconds'] - $q['querytime'];
  174.     $q['percentphp']  = number_format(($q['phptime'] / $q['seconds']) * 100, 2);
  175.     $q['percentsql']  = number_format(($q['querytime'] / $q['seconds']) * 100, 2);
  176.     $q['howmany']     = ($queries != 1 ? 's ' : ' ');
  177.     $q['serverkillers'] = $queries > 6 ? '<br />'.($queries/2).' Server killers ran to show you this page' : '=]';
  178.    
  179.     $htmlfoot = "
  180.    </td></tr></table></div>
  181.    <div id='footer'>
  182.    <div width='710px' align='center' id='footer-tb'>
  183.    <a href='http://tbdev.net'><img src='templates/6/gfx/footer/tbdev.jpg' alt='Tbdev.net powered' title='Tbdev.net powered' style='opacity:0.4;filter:alpha(opacity=40)' onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100' onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=40'/></a>&nbsp;&nbsp;&nbsp;&nbsp;
  184.    <a href='http://validator.w3.org'><img src='templates/6/gfx/footer/xhtml.jpg' alt='Xhtml valid' title='Xhtml valid' style='opacity:0.4;filter:alpha(opacity=40)' onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100' onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=40'/></a>&nbsp;&nbsp;&nbsp;&nbsp;
  185.    <a href='http://kidvision.me'><img src='templates/6/gfx/footer/design.jpg' alt='Designed by kidvision' title='Designed by kidvision' style='opacity:0.4;filter:alpha(opacity=40)' onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100' onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=40'/></a>";  
  186.     $htmlfoot .="</div></div>\n";
  187.     /** query stats **/
  188.     /** include js files needed only for the page being used by pdq **/
  189.     $htmlfoot .= '<!-- javascript goes here -->';
  190.     if ($stdfoot['js'] != false) {
  191.     foreach ($stdfoot['js'] as $JS)
  192.     $htmlfoot .= '<script type="text/javascript" src="'.$TBDEV['baseurl'].'/scripts/'.$JS.'.js"></script>';
  193.     }
  194.     $htmlfoot .= "</body></html>\n";
  195.     return $htmlfoot;
  196.     }
  197.  
  198. function stdmsg($heading, $text)
  199. {
  200.     $htmlout = "<table class='main' width='600' border='0' cellpadding='0' cellspacing='0'>
  201.    <tr><td class='embedded'>\n";
  202.     if ($heading)
  203.       $htmlout .= "<h2>$heading</h2>\n";
  204.     $htmlout .= "<table width='100%' border='1' cellspacing='0' cellpadding='10'><tr><td class='text'>\n";
  205.     $htmlout .= "{$text}</td></tr></table></td></tr></table>\n";
  206.     return $htmlout;
  207. }
  208.  
  209. function StatusBar() {
  210.     global $CURUSER, $TBDEV, $lang, $rep_is_on, $mc;
  211.     if (!$CURUSER)
  212.         return "";
  213.     $upped = mksize($CURUSER['uploaded']);
  214.     $downed = mksize($CURUSER['downloaded']);
  215.   $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0;
  216.   $ratio = number_format($ratio, 2);
  217.   $color = get_ratio_color($ratio);
  218.   if ($color)
  219.   $ratio = "<font color='$color'>$ratio</font>";
  220.   $res1 = @sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__,__FILE__);
  221.     $arr1 = mysql_fetch_row($res1);
  222.     $unread = $arr1[0];
  223.     $inbox = ($unread == 1 ? "$unread&nbsp;{$lang['gl_msg_singular']}" : "$unread&nbsp;{$lang['gl_msg_plural']}");
  224.     $res2 = @sql_query("SELECT seeder, count(*) AS pCount FROM peers WHERE userid=".$CURUSER['id']." GROUP BY seeder") or sqlerr(__LINE__,__FILE__);
  225.     $seedleech = array('yes' => '0', 'no' => '0');
  226.     while( $row = mysql_fetch_assoc($res2) ) {
  227.         if($row['seeder'] == 'yes')
  228.             $seedleech['yes'] = $row['pCount'];
  229.         else
  230.             $seedleech['no'] = $row['pCount'];
  231.     }
  232.     /////////////// REP SYSTEM /////////////
  233.     $member_reputation = get_reputation($CURUSER);
  234.     ////////////// REP SYSTEM END //////////
  235.     $usrclass="";
  236.     if ($CURUSER['override_class'] != 255) $usrclass = "&nbsp;<b>(".get_user_class_name($CURUSER['class']).")</b>&nbsp;";
  237.     else
  238.     if ($CURUSER['class'] >= UC_STAFF)
  239.     $usrclass = "&nbsp;<a href='./setclass.php'><b>(".get_user_class_name($CURUSER['class']).")</b></a>&nbsp;";
  240.       $StatusBar = '';
  241.         $StatusBar =
  242.         "".
  243.         "<div align='center' style='float:left; width:600px;'>
  244.         <div class='topbar'>
  245.        {$lang['gl_msg_welcome']},
  246.         ".format_username($CURUSER)."&nbsp;{$usrclass}&nbsp;&nbsp;|&nbsp;&nbsp;
  247.        Ratio:&nbsp$ratio"."&nbsp;&nbsp;|&nbsp;&nbsp;Upload:&nbsp;$upped"."&nbsp;|&nbsp;
  248.        Bonus:&nbsp;<a href='./mybonus.php'>{$CURUSER['seedbonus']}</a>&nbsp;&nbsp;|&nbsp;&nbsp;Invites:&nbsp;<a href='./invite.php'>{$CURUSER['invites']}</a>&nbsp;&nbsp;|&nbsp;&nbsp;
  249.         Mailbox: <a href='./messages.php'>$inbox</a></div></div>";
  250.     return $StatusBar;
  251.     }
  252. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement