Advertisement
Black_heart

main.php

May 23rd, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.51 KB | None | 0 0
  1. <?php
  2. /*
  3. *----------------------------phpMyBitTorrent V 2.0-----------------------------*
  4. *--- The Ultimate BitTorrent Tracker and BMS (Bittorrent Management System) ---*
  5. *--------------   Created By Antonio Anzivino (aka DJ Echelon)   --------------*
  6. *-------------               http://www.p2pmania.it               -------------*
  7. *------------ Based on the Bit Torrent Protocol made by Bram Cohen ------------*
  8. *-------------              http://www.bittorrent.com             -------------*
  9. *------------------------------------------------------------------------------*
  10. *------------------------------------------------------------------------------*
  11. *--   This program is free software; you can redistribute it and/or modify   --*
  12. *--   it under the terms of the GNU General Public License as published by   --*
  13. *--   the Free Software Foundation; either version 2 of the License, or      --*
  14. *--   (at your option) any later version.                                    --*
  15. *--                                                                          --*
  16. *--   This program is distributed in the hope that it will be useful,        --*
  17. *--   but WITHOUT ANY WARRANTY; without even the implied warranty of         --*
  18. *--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          --*
  19. *--   GNU General Public License for more details.                           --*
  20. *--                                                                          --*
  21. *--   You should have received a copy of the GNU General Public License      --*
  22. *--   along with this program; if not, write to the Free Software            --*
  23. *-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA --*
  24. *--                                                                          --*
  25. *------------------------------------------------------------------------------*
  26. *------              ©2005 phpMyBitTorrent Development Team              ------*
  27. *-----------               http://phpmybittorrent.com               -----------*
  28. *------------------------------------------------------------------------------*
  29. *-----------------   Sunday, September 27, 2008 8:37 PM   ---------------------*
  30. */
  31.  
  32. if (!defined('IN_PMBT')) die ("You can't access this file directly");
  33.  
  34. $tableopen = false;
  35. $errtableopen = false;
  36. $table2open = false;
  37. $btback1 = "f0f0f0";
  38. $btback2 = "f9f9f9";
  39. $btback3 = "EBDDE2";
  40.                    
  41.  
  42. function OpenTable($title = "title", $tablewidth = "") {
  43.         global $tableopen, $siteurl;
  44.         if ($tableopen) return;
  45.         if($tablewidth !="") $stylewidth = "style=\"width: ".$tablewidth."px;\"";
  46.         else $stylewidth = '';
  47.     echo "<div id=\"contenttop\">".$title."</div><div id=\"content\" ".$stylewidth.">";
  48.            
  49.     $tableopen = true;
  50. }
  51.  
  52. function CloseTable() {
  53.         global $tableopen, $siteurl;
  54.         if (!$tableopen) return;
  55.         echo "</div></div>";
  56.  
  57.         $tableopen = false;
  58. }
  59.  
  60. function OpenTable2($title = "") {
  61.       global $tableopen2, $siteurl;
  62.         if ($tableopen2) return;
  63.         echo "<div id=\"messagebox\" > ";
  64.     echo "<span class=\"messagebox-title\">".$title."</span><div style=\"margin: 0 auto;\">";
  65.            
  66.     $tableopen2 = true;
  67.  }
  68.  
  69. function CloseTable2() {
  70.           global $tableopen2, $siteurl;
  71.         if (!$tableopen2) return;
  72.         echo "</div></div>";
  73.  
  74.         $tableopen2 = false;
  75. }
  76.  
  77. function OpenNewsTable($title = "") {
  78.       global $OpenNewsTable, $siteurl;
  79.         if ($OpenNewsTable) return;
  80.         echo "<div id=\"newsbox\" > ";
  81.            
  82.     $OpenNewsTable = true;
  83.  }
  84.  
  85. function CloseNewsTable() {
  86.           global $OpenNewsTable, $siteurl;
  87.         if (!OpenNewsTable) return;
  88.         echo "</div>";
  89.  
  90.         $OpenNewsTable = false;
  91. }
  92.  
  93. function OpenMessTable($title = "") {
  94.       global $OpenMessTable, $siteurl;
  95.         if ($OpenMessTable) return;
  96.         echo "<div id=\"messagebox\"> ";
  97.     echo "<span class=\"messagebox-title\">".$title."</span>";
  98.            
  99.     $OpenMessTable = true;
  100.  }
  101.  
  102. function CloseMessTable() {
  103.           global $OpenMessTable, $siteurl;
  104.         if (!$OpenMessTable) return;
  105.         echo "</div>";
  106.  
  107.         $OpenMessTable = false;
  108. }
  109.  
  110. function OpenSuccTable($title = "") {
  111.       global $OpenSuccTable, $siteurl;
  112.         if ($OpenSuccTable) return;
  113.         echo "<div id=\"successbox\" > ";
  114.     echo "<span class=\"successbox-title\">".$title."</span>";
  115.            
  116.     $OpenSuccTable = true;
  117.  }
  118.  
  119. function CloseSuccTable() {
  120.           global $OpenSuccTable, $siteurl;
  121.         if (!$OpenSuccTable) return;
  122.         echo "</div>";
  123.  
  124.         $OpenSuccTable = false;
  125. }
  126. function OpenErrTable($title) {
  127.       global $OpenErrTable, $siteurl;
  128.         if ($OpenErrTable) return;
  129.         echo "<div id=\"errorbox\" > ";
  130.     echo "<span class=\"errorbox-title\">".$title."</span>";
  131.            
  132.     $OpenErrTable = true;
  133.  }
  134.  
  135. function CloseErrTable() {
  136.           global $OpenErrTable, $siteurl;
  137.         if (!$OpenErrTable) return;
  138.         echo "</div>";
  139.  
  140.         $OpenErrTable = false;
  141. }
  142. function overlib_init() {
  143.         echo "<script type=\"text/javascript\" src=\"overlib/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>\n";
  144.         echo "<script type=\"text/javascript\" src=\"overlib/overlib_shadow.js\"><!-- overLIB (c) Erik Bosrup --></script>\n";
  145. }
  146. function themechange(){
  147. {
  148. global $theme;
  149.         $themes = Array();
  150.         $thememaindir = "themes";
  151.         $themehandle = opendir($thememaindir);
  152.         while ($themedir = readdir($themehandle)) {
  153.                 if (is_dir($thememaindir."/".$themedir) AND $themedir != "." AND $themedir != ".." AND $themedir != "CVS")
  154.                         $themes[$themedir] = $themedir;
  155.         }
  156.         closedir($themehandle);
  157.         unset($thememaindir,$themedir);
  158. }
  159.         $change = '';
  160. foreach ($themes as $key=>$val) {
  161.         $change .= "<option ";
  162.         if ($theme == $key) $change .="selected ";
  163.         $change .= "value=\"".$key."\">".$val."</option>\n";
  164. }
  165. unset($themes);
  166. return $change;
  167. }
  168. function languagechange(){
  169. {
  170. global $language;
  171.         $languages = Array();
  172.         $langdir = "language";
  173.         $langhandle = opendir($langdir);
  174.         while ($langfile = readdir($langhandle)) {
  175.                 if (preg_match("/\.php$/",$langfile) AND strtolower($langfile) != "mailtexts.php")
  176.                         $languages[str_replace(".php","",$langfile)] = ucwords(str_replace(".php","",$langfile));
  177.         }
  178.         closedir($langhandle);
  179.         unset($langdir,$langfile);
  180. }
  181.         $change = '';
  182. foreach ($languages as $key=>$val) {
  183.         $change .="<option ";
  184.         if ($language == $key) $change .="selected";
  185.         $change .=" value=\"".$key."\">".$val."</option>\n";
  186. }
  187. unset($languages);
  188. return $change;
  189. }
  190.  
  191. function themeheader() {
  192. global $db, $db_prefix, $theme, $siteurl, $user, $upload_level, $sitename, $gfx_check, $donations, $INVITEONLY,$onlysearch, $pivate_mode, $forumshare, $shout_config, $version;
  193.  
  194. if ($user->user) {
  195.         //Update online user list
  196.         $pagename = substr($_SERVER["PHP_SELF"],strrpos($_SERVER["PHP_SELF"],"/")+1);
  197.         $sqlupdate = "UPDATE ".$db_prefix."_online_users SET page = '".addslashes($pagename)."', last_action = NOW() WHERE id = ".$user->id.";";
  198.         $sqlinsert = "INSERT INTO ".$db_prefix."_online_users VALUES ('".$user->id."','".addslashes($pagename)."', NOW(), NOW())";
  199.         $res = $db->sql_query($sqlupdate);
  200.         if (!$db->sql_affectedrows($res)) $db->sql_query($sqlinsert);
  201. }
  202. echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
  203. echo "<html>\n";
  204. echo "<head>\n";
  205. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
  206. echo "<meta name=\"generator\" content=\"PMBT ".$version."\" />\n";
  207. echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
  208. echo "<meta http-equiv=\"Expires\" content=\"-1\" />\n";
  209. echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
  210. echo "<!--[if lt IE 7]>
  211. <script defer type=\"text/javascript\" src=\"$siteurl/pngfix.js\"></script><![endif]-->";
  212. echo "<title>".$sitename."</title>\n";
  213. ?>
  214.  
  215. <script type="text/javascript">
  216. pmbtsite_url = "<?php echo $siteurl; ?>";
  217. tag_prompt = "<?php echo _bb_tag_prompt; ?>";
  218. img_prompt = "<?php echo _bb_img_prompt; ?>";
  219. font_formatter_prompt = "<?php echo _bb_font_formatter_prompt; ?>";
  220. link_text_prompt = "<?php echo _bb_link_text_prompt; ?>";
  221. link_url_prompt = "<?php echo _bb_link_url_prompt; ?>";
  222. link_email_prompt = "<?php echo _bb_link_email_prompt; ?>";
  223. list_type_prompt = "<?php echo _bb_list_type_prompt; ?>";
  224. list_item_prompt = "<?php echo _bb_list_item_prompt; ?>";
  225. _btshoutnowprivate = "<?php echo _btshoutnowprivate; ?>";
  226. shoutrefresht = "<?php echo $shout_config['refresh_time']; ?>";
  227. shoutidle = "<?php echo $shout_config['idle_time']; ?>";
  228. </script>
  229. <?php
  230. if (is_readable("themes/$theme/favicon.ico")) {
  231.         echo "<link REL=\"shortcut icon\" HREF=\"$siteurl/themes/".$theme."/favicon.ico\" TYPE=\"image/x-icon\">\n";
  232. }
  233.  
  234. if (!$onlysearch) {
  235.         echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Last Torrents\" href=\"$siteurl/backend.php?op=last\">\n";
  236.         echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Best Torrents\" href=\"$siteurl/backend.php?op=best\">\n";
  237. }
  238.  
  239.  
  240. if (is_readable("themes/$theme/style.css")) {
  241.         echo "<link rel=\"StyleSheet\" href=\"$siteurl/themes/$theme/style.css\" type=\"text/css\">\n<script type=\"text/javascript\" src=\"$siteurl/global.js\"></script>\n";
  242. }
  243. overlib_init();
  244.  
  245. echo "</head>\n\n";
  246.  
  247. $themepage = false;
  248.  
  249. ?>
  250. <!--[if lt IE 7]><link rel="stylesheet" type="text/css" media="screen" href="themes/pmbt/iestyle.css">
  251. <![endif]-->
  252. <!--[if IE 7]>
  253. <link rel="stylesheet" type="text/css" media="screen" href="themes/pmbt/iestyle.css">
  254. <![endif]-->
  255. <?php
  256. if($user->user)echo "<body onload=\"shoutthis_ajax()\">\n";
  257. else
  258. echo "<body>";
  259. echo"<noscript>
  260. <center><h1><font class=warntext>Javascript is not available!</font></h1></center>
  261. <center><h1><font class=warntext>This website cannot function correctly without JavaScript!</font></h1></center>
  262. </noscript>\n";
  263.  
  264. echo "<div id=\"overDiv\" style=\"position:absolute; visibility:hidden; z-index:1000; \"></div>\n";
  265.  
  266. echo "<div id=\"head\">";
  267. echo "<img style=\"display: block; margin: 0 auto;\" src=\"/themes/grayline/pics/updatelogo2.gif\" height=\"150\" width=\"365\" alt=\"\">";
  268. echo "</div>";
  269.  
  270. include("themes/$theme/blocks/usercp.php");
  271.  
  272. if(!preg_match("/phpBB.php/",$_SERVER["PHP_SELF"]))
  273. {
  274.  
  275. if ($user->user AND $INVITEONLY)
  276. {
  277. echo "<div id=\"extratop\">";
  278. echo _btinvites;
  279. echo "</div>";
  280.  
  281. echo "<div id=\"extra\">";
  282. echo _btinfituh ."<br>";
  283. echo "<br>";
  284. if ($user->invites > 0 ){
  285.     echo "<a href=invite.php>"._btsendiv."</a>\n";
  286. }
  287. echo "</div>";
  288. }
  289. }
  290.  
  291. echo "<div id=\"menutop\">";
  292. echo "Menu";
  293. echo "</div>";
  294.  
  295. echo "<div id=\"menu\">";
  296. echo "<a href=\"index.php\">Home</a>";
  297. echo "<a href=\"torrents.php\">Torrents</a>";
  298. if($forumshare)echo(preg_match("/phpBB.php/",$_SERVER["PHP_SELF"])) ? "<a href=\"phpBB.php\">Forums</a>":"<a href=\"phpBB.php\">Forums</a>";
  299. echo "<a href=\"user.php?op=profile&id=" . $user->id ."\">User Profile</a>";
  300. echo "<a href=\"donate.php\" title=\"\">Donate</a>";
  301. if(($user->user OR $upload_level == "all"))echo(preg_match("/upload.php/",$_SERVER["PHP_SELF"])) ? "<a href=\"upload.php\">Upload</a>":"<a href=\"upload.php\">Upload</a>";
  302. if($user->user)echo(preg_match("/memberslist.php/",$_SERVER["PHP_SELF"])) ? "<a href=\"memberslist.php\">Members</a>":"<a href=\"memberslist.php\">Members</a>";
  303. if($user->user)echo(preg_match("/helpdesk.php/",$_SERVER["PHP_SELF"])) ? "<a href=\"helpdesk.php\">Help Desk</a>":"<a href=\"helpdesk.php\">Help Desk</a>";
  304. echo "</div>";
  305.  
  306. function newuserpage($page)
  307. {
  308. if(preg_match("/user.php/",$page))return true;
  309. if(preg_match("/takeconfirminvite.php/",$page))return true;
  310. if(preg_match("/confirminvite.php/",$page))return true;
  311. return false;
  312. }
  313. if($pivate_mode AND !$user->user AND !newuserpage($_SERVER["PHP_SELF"])){
  314.  loginrequired("user", false);
  315. include'footer.php';
  316. }
  317.  
  318. $reason = "";
  319. if (is_banned($user, $reason)) {
  320.         echo "<p>&nbsp;</p>\n";
  321.         echo "<p>&nbsp;</p>\n";
  322.         echo "<h3 align=\"center\">".str_replace("**reason**",htmlspecialchars($reason),_btbannedmsg)."</p>\n";
  323.         echo "<p>&nbsp;</p>\n";
  324.         echo "<p>&nbsp;</p>\n";
  325.         include("footer.php");
  326.         die();
  327. }
  328.  
  329. $has_newpm = false;
  330. $sql = "SELECT id FROM ".$db_prefix."_private_messages WHERE recipient = '".$user->id."' AND is_read = 'false' LIMIT 1;";
  331. $res = $db->sql_query($sql) or btsqlerror($sql);
  332. $has_newpm = ($db->sql_numrows($res) > 0) ? true : false;
  333. $db->sql_freeresult($res);
  334. if ($has_newpm)
  335. {
  336.   echo "<script type=\"text/javascript\" language=\"JavaScript\">";
  337.   echo "sPath = window.location.pathname;";
  338.   echo "sPage = sPath.substring(sPath.lastIndexOf('/') + 1);";
  339.  
  340.   echo "if (sPage != \"pm.php\"){ var answer = confirm (\""._jscriptconfirmtext."\");";
  341.   echo "if (answer) window.location=\"pm.php?op=inbox\";";
  342.   echo "}";
  343.   echo "</script>";
  344.   }
  345. }
  346. function themefooter(){
  347. global $startpagetime;
  348. if(!preg_match("/phpBB.php/",$_SERVER["PHP_SELF"])){
  349. echo"</div></td><td width=\"18%\" valign=top >";#right hand collom here
  350. echo"</td>";
  351. echo"</tr>";
  352. }
  353. echo'
  354. <tr>
  355. <td>
  356. <td><p class="foot">
  357. <!-- Feel free to add you custom disclaimer or copyright notice here -->
  358. <!-- YOU ARE NOT ALLOWED TO EDIT THE FOLLOWING COPYRIGHT NOTICE!!! -->
  359. phpMyBitTorrent &copy; 2005-2010 <a href="http://phpmybittorrent.com">phpMyBitTorrent Team</a>.<br>
  360. This is free software and contains source code version of GNU/LGPL distributed libraries.<br>
  361. You may redistribute the whole package and its source code according to the GNU/GPL license.<br>
  362. The Development Team cannot be held responsible in any way for the results of the use of this software.<br>
  363. <!-- END OF COPYRIGHT NOTICE -->
  364. Generated in ' . abs(round(microtime()-$startpagetime,2)) . ' seconds
  365. </p>';
  366.  echo'
  367. </td>
  368. </tr>
  369. </table>
  370. </td>
  371. </tr>
  372. </table>
  373. </div>
  374. </div>
  375. <div id="theme-footer"></div>
  376. </div>
  377. </body>
  378. </html>';
  379. }
  380.  
  381. function help($name,$help,$title = "") {
  382.         echo "<span onmouseover=\"return overlib('".addslashes(str_replace(Array("\n","\""),Array("","'"),$help)),"'";
  383.         if ($title != "") echo ",CAPTION, '".addslashes(str_replace(Array("\n","\""),Array("","'"),$title))."'";
  384.         echo ",FGCOLOR,'#ffffaa',CAPICON,'themes/pmbt/pics/help.png',SHADOW,SHADOWOPACITY,40,SHADOWCOLOR,'#000000',SHADOWX,2,SHADOWY,2,HAUTO,VAUTO);\" onmouseout=\"return nd();\" style=\"cursor:help\">".$name."</span>";
  385. }
  386. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement